Posts

Showing posts from April, 2011

Using cvGet2D OpenCV function -

i'm trying information image using function cvget2d in opencv. i created array of 10 iplimage pointers: iplimage *imagearray[10]; and i'm saving 10 images webcam: imagearray[numpicture] = cvqueryframe(capture); when call function: info = cvget2d(imagearray[0], 250, 100); where info : cvscalar info; i got error: opencv error: bad argument (unrecognized or unsupported array type) in cvptr2d, file /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp, line 1824 terminate called after throwing instance of 'cv::exception' what(): /build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp:1824: error: (-5) unrecognized or unsupported array type in function cvptr2d if use function cvloadimage initialize iplimage pointer , pass cvget2d function, code works properly: iplimage* imagen = cvloadimage("test0.jpg"); info = cvget2d(imagen, 250, 100); however, want use information stored in array. do know how can solve it...

Is there any way to start automatically the Firebug/Inspector after starting Firefox/Chrome? -

is there way start automatically inspector after starting chrome? is there way start automatically firebug after starting firefox? regards javi in firefox can set firebug on opening about:config , setting extensions.firebug.allpagesactivation on . note have firebug active , recording -- can see firebug icon being colored -- panel may minimized. show clicking icon or using hotkey (usually f12 ctrl f12 ). note valid values extensions.firebug.allpagesactivation are: none -- (default) page-by-page settings may apply. on     -- firebug activated urls. off     -- firebug never activated.

condition - conditional logic in xml storage -

i have situation need pull in different statements xml, based on values set of variables. e.g. if a>10 , b<20 string="ancd" if a>10 , (d+e)<0 string="defg" else string="xyz" rather build these conditions in code, possible cleanly have them in xml in structure this, , code parse condition strings , string value? <conditionalstring> <condition>"a>10 , b<20"</condition> <string>"ancd"</string> </conditionalstring> <conditionalstring> <condition>"a>10 , (d+e)<0"</condition> <string>"defg"</string> </conditionalstring> <conditionalstring> <condition>default</condition> <string>"xyz"</string> </conditionalstring> you can store logic xml. question is, how out , evaluate conditions? lot depend here on language , tools you're using. if have expression parser avail...

No binary built in eclipse cdt -

i have c++ project in eclipse cdt. source files put in folder 'srt-lsh'. however, can not build project successfully. no binary shown after hit 'build all' button. when try run it, 'launch failed, no binary found' dialog pops up. any ideas appreciated.

java - Does periodic garbage collection help JVM performance? -

i encountered following code (slightly simplified): /* periodically requests garbagecollect improve memory usage , garbage collect performance under jvms */ static class gcthread implements runnable { public void run() { while(true) { try { thread.sleep(300000); } catch (interruptedexception e) {} system.gc(); } } } thread gcthread = new thread(new gcthread()); gcthread.setdaemon(true); gcthread.start(); i respect author of code, no longer has easy access ask him defend assertion in comment on top. is true? goes against intuition little hack should improve anything. expect jvm better equipped decide when perform collection. the code running in web-application running inside ibm websphere on z/os. it depends. the jvm can ignore system.gc() code absolutely nothing. secondly, gc has cost impact. if program wouldn't otherwise have done gc (say, doesn't generate garbag...

asp.net - Read word document in C# -

i want read word document in server (both doc , docx). server not have office installed, therefore can't use com objects , no commercial softwares. is there way can use office tools alone , read word docs (2003 , 2007) unfortunately there no free options reading .doc , .docx files. commercial options sparse @ reasonable prices, there extremely expensive options. for reading .doc files free option i'm aware of poi java can run in .net using ikvm. however, word support in experimental branch of poi's svn repository, don't know how works. http://poi.apache.org/ http://www.ikvm.net/ if want text out of .doc file , don't care formatting, can use ifilter win32 interface through pinvoke. for reading .docx files can use microsoft office open xml sdk. don't let "sdk" fool though, light abstraction on dealing xml directly. it's painful use. http://www.microsoft.com/downloads/en/details.aspx?familyid=c6e744e5-36e9-45f5-8d8c-331...

ruby on rails - Simple string comparison not working! Frustration ensues -

i cannot seem figure out why comparison not working: if params[:password].to_s == params[:conf_password].to_s #do else #do else the result false, executing else block... know why? edit: checking output shows 2 parameters identical. "password" collected using 'form_for' , "conf_password" password_field_tag. if "conf_password" included in 'form_for' no such method error thrown, because there no column conf_password in model. perhaps there better way of collecting param, may solve issue. some log output regarding params. params: {"password"=>"1234567", "company"=>"company1", "companykey"=>"ckey2"}, "conf_password"=>"1234567", code these values <tr> <td> <%= label_tag(:password, "password") %> </td> <td> <%= f.password_field :password %> </td> </tr> <tr> <td> ...

facebook - flv img does not appear <fb:flv src="" ..... img='img url' ...> -

i developing facebook application show flv videos.videos shown but, preview img not appear code: <fb:flv src='http://mobimediaworld.com/flv/3.flv' width='180' height='150' title='mekawy' color='#ffbb00' salign='r' img='http://www.gcmob.com/images/media/previewframe/27.png' scale='showall'/> can me, pleas? sorry buddy fb:flv not working anymore dont know why. use this: <fb:swf swfbgcolor="000000" imgstyle="border-width:3px; border-color:white;" swfsrc='http://www.youtube.com/v/xxxxxxxxxx' imgsrc='http://img.youtube.com/vi/xxxxxxxxxx/2.jpg' width='340' height='270' />

zip extraction in sharepoint server 2010 -

how upload , extract zip file in sharepoint server 2010? a solution might use document library upload zip documents , hook event handler on intercept uploaded documents , unzip them, can decide it, can store unzipped version , drop original file . you can see example here on how create event handler document library: http://karinebosch.wordpress.com/walkthroughs/event-receivers-walkthrough2/

javascript - a String.prototype's "this" doesn't return a string? -

what going on here? when thought knew js inside , out, gem comes up. string.prototype.donothing = function() { return this; }; alert(typeof 'foo'.donothing()) // object alert(typeof 'foo') // string http://jsfiddle.net/djbmf/ this breaking things expect string, such jquery's .text(str) method. here's thorough overview of this keyword. basically, javascript converts object, if wasn't one. the following steps performed when control enters execution context function code contained in function object f, caller provided thisvalue, , caller provided argumentslist: if function code strict code, set thisbinding thisvalue. else if thisvalue null or undefined, set thisbinding global object. else if type(thisvalue) not object, set thisbinding toobject(thisvalue). else set thisbinding thisvalue same thing happens numbers , booleans. similar donothing function return type of object.

c# - IEnumerable<T> to IDictionary<U, IEnumerable<T>> -

what's efficient way convert ienumerable<t> idictionary<u, ienumerable<t>> where u is, example guid, information held in property of t. basically, creates dictionary of lists items in original list grouped based on value in property within objects. example object definition: class myobject { public guid uid { get; set; } // other properties } start with: ienumerable<myobject> listofobj; end with: idictionary<guid, ienumerable<myobject>> dictoflists; whereby listofobj contains objects have many different, overlapping values uid property. using linq: var dict = input.groupby(elem => elem.identifier) .todictionary(grouping => grouping.key, grouping => grouping.select(x => x));

r - Reading user input without echoing -

i'm wondering if there way can read user input stdin without echoing screen in r. know readline() , readlines() , scan() can read in user input keyboard none appear have option not echo back. as might expect grab password. i'm looking let me do: > a<-get_password() password: > [1] "password" what's operating system? if can run terminal, should work. get_password <- function() { cat("password: ") system("stty -echo") <- readline() system("stty echo") cat("\n") return(a) } > <- get_password() password: > [1] "sdfs" > this works on os x using r terminal.app, not r.app. no idea on windows solution, since there doesn't seem native r solution.

Regarding caching data in win application c# -

caching data in asp.net easy. want know how cache data in win application. suppose want fetch & cache data employee table , when ever records inserted or updated in employee table event fire in form , there reload data employee table again , cache it. easy implement in asp.net apps how implement concept in win application. don't want use timer. please me concept ? memcache popular solution. there .net ports: is there port of memcache .net?

php - Animating Graphics with Dynamic Content -

i developing website son's baseball team , want provide graphical display parents "watch" if cannot attend game in person. static graphic portion show field. dynamic part of show each player positioned, ball hit to, , runners on bases. show roster each team , textual play-by-play , scoreboard. display should automatically update on specified interval. i professional trade, have gotten web design on own. use dreamweaver , php development , pretty @ figuring out new stuff. can provide me guidance on best way implement task above? personally go node.js backend, socket.io communication , raphaël display. portable across browsers , make changes visible instantly on every connected client.

google cloud datastore - Problem uploading and downloading data from to deployment app in GAE -

file "c:\program files\google\google_appengine\google\net\proto\protocolbuffer .py", line 436, in skipdata raise protocolbufferdecodeerror, "corrupted" google.net.proto.protocolbuffer.protocolbufferdecodeerror: corrupted what's problem , how fix it? maybe download not ok? i error when im uploading data deplying app in gae. i use in app: builtins: - remote_api: on command downloading data developement: appcfg.py download_data --application=,yapp --kind=survey --url="http://localhost:9999/_ah/remote_api" --filename="c:\myapp\src\test.csv" this command use upload data deployment: appcfg.py upload_data --application=myapp --kind=survey --filename="c:\myapp\src\test.csv" --url=http://myapp.appspot.com myapp not actual name... when uploading, --url parameter must link remote_api of application, so: appcfg.py upload_data --application=myapp --kind=survey --filename="c:\myapp\src\test.csv" -...

Setting up Eclipse for other programming languages -

i have installed eclipse (helios) java programming language, want use programming in c/c++, python , ruby. i've installed cdt , dltk (for python , ruby). i had mingw-w64 (windows platform) installed. how set eclipse uses mingw toolchain? apparently detects mingw toolchain, when create project, 2 warnings appear saying "error launching external scanner info generator". i'm assuming because can't find compiler program. also, doesn't detect of standard-library header files. these problems because i'm using mingw-w64 rather standard mingw? i have ruby working, python, cannot find interpreter nor default system library. have python 2.7 installed. don't know how tell eclipse files. note: on windows 7 professional 64-bit. i've heard of people on 64-bit versions of vista having trouble getting mingw-w64 work. may having same problem. ignoring eclipse, when try compile c file using gcc, has trouble finding libraries , includes. edit : if set pat...

c# - Controller returning file header to view not file -

my form looks { using (ajax.beginform("log", new ajaxoptions { updatetargetid = "lessontable" })) //removed dropdown list ect... readability input type="submit" name = "submitbutton" value = "filter" input type="submit" name = "submitbutton" value = "print report" and controller this [httppost] public actionresult log(lesson lesson,string submitbutton) { /*retreive lessons*/ list<lesson> lessonlist = (from l in storedb.lessons l.statusid != deleted select l).tolist(); /*filter retreived lesson*/ lessonlist = filterlesson(lesson,lessonlist); switch (submitbutton) { case "filter": return partialview(lessonlist); default: ...

javascript - Express framework giving a very strange error -

i'm trying use express in node, install okay, compiled, got npm , installed express with: npm install express the problem is, everytime try "require" it, gives me error! take look, simple file app.js as: var express = require('express'); when run it: tlab065:~/proj/express-server-abstraction> node app.js node.js:116 throw e; // process.nexttick error, or 'error' event on first tick ^ typeerror: cannot read property 'prototype' of undefined @ object.<anonymous> (/people/home/jdomingues/local/node/lib/node/.npm/express/1.0.7/package/lib/express/server.js:87:44) @ module._compile (module.js:373:26) @ object..js (module.js:379:10) @ module.load (module.js:305:31) @ function._load (module.js:271:10) @ require (module.js:317:19) @ object.<anonymous> (/people/home/jdomingues/local/node/lib/node/.npm/express/1.0.7/package/lib/express/index.js:28:31) @ module._compile (mod...

uiview - Best way to change between views in iOS -

how go 1 view another? is [window addsubview:myview]; the option or there better way this? first @ apple's view controller programming guide ios . might start navigation-based interface sounds. strictly true, want take advantage of features animation, come 'free' if use apple's view controller classes.

php - json_decode to array -

i trying decode json string array following error. fatal error: cannot use object of type stdclass array in c:\wamp\www\temp\asklaila.php on line 6 here code: <?php $json_string = 'http://www.domain.com/jsondata.json'; $jsondata = file_get_contents($json_string); $obj = json_decode($jsondata); print_r($obj['result']); ?> as per the documentation , need specify if want associative array instead of object json_decode , code: json_decode($jsondata, true);

java - Retrieving a row and column from Access Database -

in project 2 matrices using microsoft access database, sourced 2 different tables (for example table_a , table_b ). need retrieve row , column database. selecting col1 1 table means selecting corresponding row other. i retrieve col1 , corresponding row @ same time. how possible using sql , jdbc call? thank you! in order work 2 separate tables of same database need 1 connection , statement , resultset each database table. since not clarify how have stored matrix data in database can not give more details here. but, whatever do, in order access contents of first matrix database table have replicate second. change table name in sql select. however not happen "at same time", 1 query follow other.

How to handle javascript events via WebBrowser control for WinForms -

i have read webbrowser control .net — how inject javascript , is possible call javascript method c# winforms , many others. examples returns function value or alert window (synchronous calls). have result event handler (asyn call): <script type="text/javascript"> window.onload = function() { var o = new m.build(document.getelementbyid("zid")); m.events.observe(o, o.events.success, function() { // have value!! }); m.events.observe(o, o.events.fault, function() { // have value!! }); } </script> calling c# javascript simply put, can expose c# object webbrowser javascript can call directly webbrowser class exposes property called objectforscripting can set application , becomes window.external object within javascript. object must have comvisibleattribute set true c#: [system.runtime.interopservice...

design - Rails + iframe: Rendering another website in your rails application -

i render website in rails application. html tag < iframe> seems want. wondering how make smooth possible. need make new model? how pass parameters website render? thanks if use iframe, you'll have minimal control of page render. can pick url, , pass params takes appending them url itself. requiring login / cookies / etc. need done user - can't set cookies other sites, obvious security reasons. <iframe src="http://www.othersite.com/some/path?param1=value1&param2=value2"> <p>placeholder text; shows if page doesn't render!</p> </iframe> that's simple example, covers iframes can you. if that's need, perfect, if not, you're going have more complex. hope helps!

WPF DataGrid Binding on Columns -

hope wasn't asked already, can't find answer. got viewmodel set datacontext in xaml. in viewmodel list< dealer>-property. dealer has properties should displayed in datagrid (as columns, not of them). tried implement this: <grid x:name="mygrid" datacontext="{binding source={staticresource creategamevm}}"> ... <datagrid name="dealerlist" autogeneratecolumns="false" itemssource="dealerlist"> <datagrid.columns> <datagridtextcolumn header="id" width="30" binding="{dealerid}" /> <datagridtextcolumn header="name" width="*" binding="{dealername}" /> </datagrid.columns> </datagrid> ... </grid> in case propertychanged in viewmodel null, nothing updated when dealerlist changes. (but items in dealerlist, before setting datacontext display...

java - Graceful kill of Apache Commons Exec process -

i starting external process in java program (on linux) , need ability send sigterm signal rather sigkill exec.getwatchdog().destroyprocess() sending. there way can more gracefully stop unix process started commons-exec? or can pid can run appropriate kill command myself? well, commons exec relies on java process class, doesn't expose pid. it's used kill process, it's not can change behavior of. nice , encapsulated. gotta love oo, eh? if launching processes in background, can wrap them in simple shell script captures pid you, , saves off "known place" java routine knows about. still kind of messy, and, naturally, doesn't port other platforms well. you can write own exec function using jni capture information well, that's less friendly. you write platform specific exec launcher daemon in more system oriented (c, python, etc.). send messages launch , stop things, , handles process you. 1 benefit of don't have fork jvm when run new proc...

c# - Printing Selected Row in Gridview -

is there way print information selected rows in gridview? know how print entire gridview, giving div id...but can't seem figure out how extract information each selected row. i imagine can adding style row user has selected (ie class="printme"). print style sheet can have style display none rows in gridview, except style have added row. #mygrid tr {display:none;} #mygrid tr.printme {display:block; }

Matlab Plot Graph -

i have matrix 1000 real numbers within range -3 3. have plot numbers on graph continuous curve combining points. matrix name points , 1000 1 matrix. try plot(points(:)); % plot points ylim([-3 3]); % set y limits

scala - Can we use match to check the type of a class -

i'm new scala, , i'm learning match keyword now. i wanna know if can use keyword match check type of class. code is: object main { def main(args: array[string]) { val x = "aa" checktype(x) } def checktype(cls: anyref) { cls match { case string => println("is string") case date => println("is date") case _ => println("others") } } } the code can't compiled, so, it's impossible this? scala-way check type of class? it: if(cls.isinstanceof[string]) { ... } else if(cls.isinstanceof[date]) { ... } else { ... } right? this will compile: def checktype(cls: anyref) { cls match { case s: string => println("is string") case d: date => println("is date") case _ => println("others") } ...

Specify a xml catalog file to the maven 2 axis plugin -

when use maven axis plugin generate java code given wsdl file, tries reach out internet resolve soap, wsdl etc schemas. there way specify xml catalog file plugin or maven in general? you add official maven repository: plugin repositories or add own repository: using internal repository

How to SELECT a PROCEDURE in Firebird 2.5 -

i'm using firebird embedded v2.5. how use procedures in query (select) ? my procedure: set term ^ ; create procedure fn_test( y integer ) returns( x integer) begin x = y + 1; end^ set term ; ^ i want list field of table modified procedure, this: select some_table_field_1, fn_test( 4 ) zzz, some_table_field_2, fn_test( some_table_field_2 ) field_2_modified tb_test need results (table): some_table_field_1 zzz some_table_field_2 field_2_modified --------------------------------------------------------------------------- aaa 5 14 15 bbb 5 23 24 www 5 75 76 this thing works fine in postgresql, don't know how in firebird. select some_table_field_1, (select x fn_test( 4 )) zzz, some_table_field_2, (select x fn_test( some_table_field_2 )) field_2_modified tb...

java - Create simple POJO classes (bytecode) at runtime (dynamically) -

i've following scenario.. i writing tool run user-entered query against database , return result.. the simplest way return result as: list<string[]> need take step further. i need create (at runtime ) pojo (or dto) name , create fields , setters , getters , populate data returned , return user among .class file generated... so idea here how create simple class(bytecode) @ runtime (dynamically) basic search , found many lib including apache bcel think need more simpler... what think of that? thanks. creating simple pojo getters , setters easy if use cglib : public static class<?> createbeanclass( /* qualified class name */ final string classname, /* bean properties, name -> type */ final map<string, class<?>> properties){ final beangenerator beangenerator = new beangenerator(); /* use our own hard coded class name instead of real naming policy */ beangenerator.setnamingpolicy(new namingpolicy(){ ...

android - Acer Iconia A500 not in adb devices -

just picked iconia a500 (yay $100 off coupon) , started messing playing games, etc. i decided time work, fired adb , launched eclipse test app , discovered wasn't in devices list. i've tried installing acer drivers. puts folder in program files directory...but don't see i'm supposed there. there's "euudriverinstaller" when click on nothing (seems to) happens. when plug device in uses generic microsoft driver show device contents composite adb doesn't show @ droid. i've reboot several times on both device , laptop. i've uninstalled / reinstalled application made driver directory. opened application in driver directory under x64 folder , opened windows driver installer , installed drivers...but still no composite adb when plug in. on usb debugging , i've toggled on , off. it's running 3.1 stock i'm on x64 windows 7 both command prompt adb devices empty under "list of devices attached" , eclipse devices empty. s...

asp.net mvc - Define Custom Attributes for Spark View Engine -

is there way (preferably without modifying source) can define custom attribute apply spark elements? for example, i'd define "permission" attribute can like: <div permission="canviewdivs"> </div> which map specific bit of code determine if current user can view divs , hide if not. i know condition attribute , spark bindings, these don't quite accomplish want. the answer "no" i'm afraid. this, we'd have have kind of schema we'd feed special node parser , compiler, , don't see tenable or pragmatic unless can convince me otherwise :) happy @ use cases in more depth , decide if it's kind of thing can added. dave said in comment, kind of visual logic should come view models, or @ least that's way build projects. you're letting users edit templates , you've got rendering subsystem behind imagine why you're asking in first place - i.e. want give more power users without having recomp...

jquery - Close Modal Box after 10 seconds -

how can close jquery modal box after 10 seconds ??? use settimeout function. //make sure have lower case "o" settimeout(function(){ $(dialog).close(); }, 10000);

mysql - Is there a more efficient way to save an Array to SQL than PHP function serialize()? -

possible duplicate: an efficient way save array , keys database is there maybe serialize() equivalent returns binary? saving data strings inefficient in both ways: inefficient in manner of performance , memory. there function return pure data ram , accordingly function read back? if trying more compact representation of serialized string, e.g., 1 uses less space plain serialize() , might use gzdeflate() compress plain-text output: $data = gzdeflate(serialize($some_array)); // store in database... // restore array: $data database, then: $array = unserialize(gzinflate($data)); instead of gzdeflate() / gzinflate() , can use gzcompress() / gzuncompress() , these produce larger strings include additional metadata such checksum.

windows phone 7 - Membership API WP7 -

i have question have researched lot cannot find solid proven answers yet. i have web application developing, potentially using membership api user membership , authentication. works great when people login browsers. has been tried , tested , works great. i want extend same 'registration/login' functionality wp7 (windows phone). questions are: 1. best approach same? 2. can use wcf same? know use cookie container approach, cause issues on removal of cookies etc right? i want wp7 app work such once user logs in, remains logged in. will have write own oauth2 provider? if yes, can please provide me links give me examples. even better, have people developed own wp7 applications use user registration , authentication? insights help. i understand azure has access control allows me link in hotmail, facebook etc validate user. in scenario, how can ensure still link authentication internal user identifier? i little confused plethora of options , not single popular blog...

javascript - need help with a condition while looping through an array -

i have array 20 elements, , need few if statements while looping through array , need in creating if statement in sense need able search if string contains text in efficient way won't hang whole app. var locations = [ ['maryland', 'usa', 'pentium iv', 120, '1 gb', '15"'], ['new york', 'usa', 'pentium iv', 40, '512 mb', '15" , 17"'], ['frankfurt', 'germany', 'pentium iv', 100, '2 gb', '17"'] ]; (var = 0; < locations.length; i++) { var ram = locations[4]; var monitor = locations[5]; // need if statement below if (ram < '1 gb' || monitor.startswith("15")) { // } } i using pure javascript, no jquery or other frameworks. thank in advance help. how if (ram.indexof('gb') >= 0) this check if wor...

c - How to use cross gdb to examine core file from crosstarget machine -

i have core file embedded sh3 linux device, , gdb of cross compiler environment (sh3-linux-gdb) in host linux. but have problems loading core file gdb: $ sh3-linux-gdb ./myprogram ./core gnu gdb 6.3 copyright 2004 free software foundation, inc. ... gdb configured "--host=i386-pc-linux-gnu --target=sh3-linux"... gdb can't read core files on machine. (gdb) why can't read core file? there way read core file target system cross gdb? there gdbserver in target machine (sh3-linux), not gdb itself. able runtime debuging of processes of target machine gdbserver , sh3-linux-gdb , sh3-linux-gdb should correctly compiled. edit: readelf dump requested: [build]$ sh3-linux-readelf -a core elf header: magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 class: elf32 data: 2's complement, little endian version: 1 (current) os/abi: unix -...

windows - Is the Azure role host actually restarted when a role crashes or is restarted via management API? -

suppose azure role somehow exhausts system-wide resources. example spawns many processes , processes hang , consume virtual memory in system. or creates gazillion of windows api event objects , fails release them , no more such object can created. mean except trashing filesystem . now changes describe cancelled out once normal windows machine restarts - processes terminated, virtual memory "recycled", events , other similar objects "recycled" , on. yet there's concern. if host not restarted, goes through other process when hit "reboot" or "stop", "start"? is host rebooted when restart role or reboot instance? when reboot instance, vm rebooted. when stop , start, vm not rebooted, process restarted.

permutation - VBA display selection options -

i trying write code display value depending on checkbox selected. there total of 5 checkboxes , adding additional checkboxes in future wondering if there easy way determine checkboxes checked determine values display. can in round way minimize code if possible. in other words, if write each scenario out have write separate code of different selection possbilities: 1 only,2 only,3 only,4 only,5 only 1+2, 1+3, 1+4, 1+5, 2+3, 2+4, 2+5, 3+4, 3+5, 4+5 1+2+3, 1+2+4,1+2+5, 1+3+4,1+3+5, 1+4+5,2+3+4, 2+3+5,3+4+5 1+2+3+4, 1+2+3+5, 1+3+4+5, 2+3+4+5 1+2+3+4+5 each value associated sub fill array if selected. , after arrays filled need perform additional function on ones selected. function performed same not want perform function if value not selected because defeat purpose of function otherwise. function select duplicates arrays selected array. you can use binary numbers each checkbox: first value 1 ( =2 0 ) second value 2 ( =2 1 ) third value 4 ( =2 2 ) four...

rails 3 pagination with kaminari on mongoid embedded documents -

when call paginate kaminari on collection of embedded documents following error: (access collection document not allowed since embedded document, please access collection root document.): any idea on how can fix ? have installed kaminari gem. alex you need access collection through parent object. example, given following models: class user include mongoid::document embeds_many :bookmarks end class bookmark include mongoid::document embedded_in :user end then paginate given user's bookmarks do: @user.bookmarks.page(params[:page])

sql - How to select a table dynamically with HSQLDB and Hibernate? -

i have table references other tables. stored table name , entity id. like this: ref_table id | table_name | refid -------+------------+------- 1 | test | 6 2 | test | 9 3 | other | 5 now try formulate sql/function returns correct entities correct tables. like: select * resolveid(3) i expect entity id "5" table "other". possible? guess can stored procedure (create function). function have inspect "ref_table" , return name of table use in sql statement ... how exactly? if want use resuling entities in select statements or joins, should use create function returns table ( .. ) there limitation in hsqldb routines disallows dynamically creating sql. therefore body of create function may include case or if else block switches pre-defined select statement based on input value (1, 2, 3, ..). the details of create function documented here: http://hsqldb.org/doc/2.0/guide/sqlroutines-chap...

javascript - is there a way to write the actual DOM to a string -

i have html document <html> <head></head> <body> <form> <input type="text" value="" /> </form> <input type="button" id="doit" value="do it"/> <!-- jquery --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function() { $("#doit").click(function(){ var dom = document.documentelement.innerhtml; alert(dom); }); }); </script> </body> </html> if edit text field value still original blank value in alert...why? , how see actual dom in string? you'd need set each attribute explicitly current value: http://jsfiddle.net/gw8eu/ . $("#doit").click(function(){ $('*...

iphone - How to setup a ubuntu server that can receive iOS ASIHTTPRequests -

i have ubuntu pc don't use , know how submit asihttprequests iphone. i setup basic system can send image iphone ubuntu server , have server save photo specific folder on ubuntu pc. i have 0 server knowledge have heard, shouldn't terribly difficult implement. know of easy way this? (easy no server knowledge?) any web server do. https://help.ubuntu.com/6.06/ubuntu/serverguide/c/httpd.html

c# - Cannot define class or member that utilizes dynamic because the compiler required type -

i'm using facebook sdk c# library in asp.net 3.5 application. when i'm trying compile code below give me errors. know dynamic type using in 4.0 framework. anyway rewrite in order make work? have reference system.core 3.5 it's still not compiling protected void page_load(object sender, eventargs e) { if (request.params.allkeys.contains("signed_request")) { var result = facebooksignedrequest.parse(facebookcontext.current.appsecret, request.params["signed_request"]); dynamic signedrequestvalue = result.data; this.registrationdata = signedrequestvalue.registration; } else { response.redirect("~/"); } } protected dynamic registrationdata { get; set; } error 1 cannot define class or member utilizes 'dynamic' because compiler required type 'system.runtime.compilerservices.dynam...

append - jquery add closed tag -

i have problem jquery. after many tests, no simple solution me. my cms return me code <ul> <li>text</li> <li>text</li> <li class="last">text</li> <li>text</li> <li>text</li> <li class="last">text</li> <li>text</li> <li>text</li> <li class="last">text</li> </ul> i want add after each class=last code </ul><ul> in order obtain code <ul> <li>text</li> <li>text</li> <li class="last">text</li> </ul><ul> <li>text</li> <li>text</li> <li class="last">text</li> </ul><ul> <li>text</li> <li>text</li> <li class="last">text</li> </ul> i tried jquery code $('.last').after('</ul>...

reflection - C# Retrieving Classname in a static method -

example: namespace myprogram.testing { public class test1 { public void testmethod() { string actualtype = this.gettype().fullname.tostring(); return; } public static string getinheritedclassname() { return system.reflection.methodbase.getcurrentmethod().reflectedtype.fullname; } } public class test2 : test1 { } public class test3 { string test2classname = test2.getinheritedclassname(); } } anyway, want return "myprogram.testing.test2" instead test2.getinheritedclassname() returns "myprogram.testing.test1". have put static class return (if possible)? the code that's printing out type base-class method. except rare reflection scenarios such provide above, execution wouldn't affected whether method called using derived type or base type, system makes no distinction. you could, however, around defining generic b...

ASP.NET: urls in plain html files can't find app root -

a client i'm working insists on including plain-jane html file in asp.net app , can't link urls work properly. here's example: <li><a class="nav_history2" href="/history.html">history</a></li> it finds server root (as expect) how modify respect app root? i'm looking equivalent ~. client has tried ../ claims still finds root. how possible? should please? i don't have ability run on prod server, can't see problem directly. ----- edit ----- if follow suggestions given in first 2 answers work if turn html page aspx, far not in raw html file. if remember correctly, need make asp.net actively aware of tag, , ~ symbol work. try: <a class="nav_history2" runat="server" href="~/history.html">

arrays - Converting a character to another character in PHP -

i have 2 arrays 1 fake japanese characters, english alphabet have no idea go here, i've tried loops, str_replace, using letters array keys jap array did work 1 word, want break words , convert them while including space. $name = $_post['engname']; $name = strtoupper($name); $jap = array('ka','tu','mi', 'te','ku', 'lu', 'ji', 'ri', 'ki', 'zu', 'me', 'ta', 'rin', 'to', 'mo', 'no', 'ke', 'shi', 'ari', 'chi', 'do', 'ru', 'mei', 'na', 'fu', 'zi'); $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x...

PHP, putting a looping variable from a foreach loop into a new array -

i have loop: $dir = 'url/dir/dir/'; $images_array = glob($dir.'*.jpg'); foreach ($images_array $image) { $image = str_replace($dir, '', $image); } i want save $image variables new array. how possible? $dir = 'url/dir/dir/'; $images_array = glob($dir.'*.jpg'); $images = array(); foreach ($images_array $image) { $images[] = str_replace($dir, '', $image); } var_dump($images);

c# - Entity Framework 4.0 won't let me use LINQ-to-Entities -

maybe i'm over-worked ... i'm lost in project use ef4 db stuff. as such, work indeed retrieve complete list of entity. when try filtering, don't it... i have following code, in big trouble public class infoviewmodel { private trackerentities _context; public infoviewmodel (int ticketid) { var ct = new trackerentities(); var res = t in ct.tickets t.ticketid // vs2010 can't evaluate property 'ticketid' select t; } } i not understand why t.ticketid throws me wavy red line error message "can not resolve symbol 'ticketid'" the symbol declared in edmx file, public getter , setter... in fact, looks nothing of entity known in class. why? tia deepcore 1) should compare ticketid of entity desired match, , (recommended) should wrap context instance in using statement (it's idisposable ): private trackerentities _context; public infoviewmodel(int tic...

android - Weird WebView behavior when playing Flash game -

i'm developing android app embeds flash game in webview container. in particular, it's solitaire game requires user drag cards around. in webview specified width , height, card "stuck" user tries drag it, rendering game unplayable. however, discovered in full screen, finger dragging input works fine. have insight regarding flash player behavior in webview? use in webview webview.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { v.ontouchevent(event); return false; } });

Android - multithreading issues when changing activity -

i have main menu action bar. on create, run thread hits server current status. when complete, thread calls handler kicks off running thread cycles through items , uses handler call change test in actionbar. problem when change views, either android.view.windowleaked or view not attached window manager here sample code public class mainmenuactivity extends protectedwithactionbaractivity{ private int status_counter; private final int result_status_loaded = 2000; private final int result_show_status = 2001; private currentstatusmodel currentstatus; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mainmenu); actionbar footerbar = (actionbar)findviewbyid(r.id.footerbar); footerbar.settitle("currently connected " + preferenceshelper.getcurrentenvironment().name()); status_counter = 0; statusloadthread.start(); } th...

c# - Cookie timing question -

when add cookie through response.cookies.add(cookie); cookie not placed on clients side until client requests page site. @ time of request .net magic, place cookie in response , client store it. is true? if above assumption true should able see unplaced cookies cookie = response.cookies("foo") . seems logical, correct? to sum up. i placing cookie, later in code before request served checking if cookie in request.cookies("foo" ) if not checking response.cookies("foo") . method not work. how go reading cookie before sent client side. the actual question need answered; is there way view cookies information before send browser? along lines of check if cookie on browser if not other check see if waiting sent.if waiting sent read data on it thank much. if understood question correctly want add cookie httpresponse @ point after receiving request client. @ later point of processing request want access same cookie again. this quote might y...

c# - why do char takes 2 bytes as it can be stored in one byte -

can tell me in c# why char takes 2 bytes although can stored in 1 byte. don't think wastage of memory. if not , how 1-byte used? in simple words ..please make me clear use of 8-bits.!! although can stored in 1 byte what makes think that? it takes 1 byte represent every character in english language, other languages use other characters. consider number of different alphabets (latin, chinese, arabic, cyrillic...), , number of symbols in each of these alphabets (not letters or digits, punctuation marks , other special symbols)... there tens of thousands of different symbols in use in world ! 1 byte never going enough represent them all, that's why unicode standard created. unicode has several representations (utf-8, utf-16, utf-32...). .net strings use utf-16, takes 2 bytes per character (code points, actually). of course, 2 bytes still not enough represent different symbols in world; surrogate pairs used represent characters above u+ffff

php - How to strip all img tags from a text, except for those containing a certain word -

i strip img tags text, except contain keyword (e.g. domain they're hosted at). here's i've come with, i'm afraid doesn't work: $text = preg_replace("/<img[^>]+(?!keyword)[^>]+\>/i", "", $text); any appreciated! :) use callback simplify task: $html = preg_replace_callback('/<img\s[^>]+>/i', "cb_keyword", $html); function cb_keyword($matches) { // return empty str or original text return !strpos($matches[0], "keyword") ? "" : $matches[0]; } if working on html snippets using phpquery/querypath still possible, adds more post-processing.

android - Javadoc in Eclipse failing to recognize packages -

thanks this thread , able javadoc links work android project within eclipse on windows. specifically, "{@link android.widget.toast}" converted link " http://d.android.com/reference/android/widget/toast.html?is-external=true ". achieved javadoc option: -linkoffline http://d.android.com/reference "file:/c:/android/android-sdk-windows/docs/reference" however, errors such following based on lines of java code (not javadoc comments): c:\users\ellen\workspace\testabletoast\src\edu\mills\cs180\helloandroid.java:5: package android.view not exist import android.view.view; ^ c:\users\ellen\workspace\testabletoast\src\edu\mills\cs180\helloandroid.java:6: package android.view.view not exist import android.view.view.onclicklistener; ^ c:\users\ellen\workspace\testabletoast\src\edu\mills\cs180\helloandroid.java:8: package android.widget not exist import android.widget.toast; ^ c:...

php - Adding event listener on all $.goMap markers on the map -

i have been trying add click listener every single marker on map created jquery extension $.gomap. this how load markers map: $.getjson('get_markers.php', function(data) { $.each(data, function(pair) { id = data[pair]['id']; $.gomap.createmarker({ latitude: data[pair]['lat'], longitude: data[pair]['lng'], draggable: false, html: { ajax: 'marker_description.php?q=' + id, content: 'loading...' } }); }); }); i looked html see if figure out id or class of markers, use jquery attach click listener of them, couldn't find them in html markup. i solved adding listener each marker in loop after creating them. added id attribute marker in order create listeners. $.getjson('get_markers.php', function(data) { $.each(data, function(pair) { var id = data[pair]['id']; $.g...

firefox addon - XBL doesn't work well on panel? -

i have found xbl element won't init before shows up. when add xul box element panel,and bind xbl ,i can't use :box.xblmethod(),ff throw xblmethod undefined. question how can know when can call xblmethod? did body encount problem ? advance! you might find can necessary work in binding's <constructor> .

javascript - What is this? (function(){ })() -

possible duplicates: what javascript snippet mean? location of parenthesis auto-executing anonymous javascript functions? (function(){ //something here... })() <--//this part right here. what )() ? if change ()) ? (function(){ //something here... }()) <--//like this declares anonymous function , calls immediately. the upside of doing variables function uses internally not added current scope, , not adding function name current scope either. it important note parentheses surrounding function declaration not arbitrary. if remove these, error. finally, can pass arguments anonymous function using parentheses, in (function (arg) { //do arg })(1); see http://jsfiddle.net/eb4d4/

Simple JSON parsing using Perl -

i'm trying parse facebook graph api json results, , i'm having bit of trouble it. what hoping print number of shares: my $trendsurl = "https://graph.facebook.com/?ids=http://www.filestube.com"; $json; { local $/; #enable slurp open $fh, "<", $trendsurl; $json = <$fh>; } $decoded_json = @{decode_json{shares}}; print $decoded_json; some of code above extremely puzzling. i've rewritten annotations you. #!/usr/bin/perl use lwp::simple; # cpan use json qw( decode_json ); # cpan use data::dumper; # perl core module use strict; # practice use warnings; # practice $trendsurl = "https://graph.facebook.com/?ids=http://www.filestube.com"; # open files. unless have file called # 'https://graph.facebook.com/?ids=http://www.filestube.com' in # local filesystem, won't work. #{ # local $/; #enable slurp # open $fh, "<", $tr...

PHP:: array_unique for arrays inside array -

i need array_unique arrays inside array. the case - should equal, output "not equal": <?php $arr=array(array('a',1),array('a',2)); $arr2=array_unique($arr); if($arr2==$arr){ echo "equal"; } else{ echo "not equal"; } ?> how should code fix output "equal"? thanks, yosef you should modify call array_unique have include sort_regular flag. $arr2 = array_unique($arr, sort_regular);

apache - How to edit / format XML response in web service -

i using apache axis2 write first web service. following official link . observed if call sample stockquoteservice given in link, gives following indented response : <ns:getpriceresponse xmlns:ns="http://pojo.service.quickstart.samples/xsd"> <ns:return>42</ns:return> </ns:getpriceresponse> i want response in specific xml format <answers> // answers should in single `<answers>` tag. <answer> answer1 </answer> // each answer should in `<answer>` tag. <answer> answer2 </answer> </answer> how can format xml response , add xml tag ? ~ajinkya. you should use xsl transformations (xslt) this.

php - set lable to elements created by createElement method in zend framework -

hello all, i'm looking can tell me how set label element created createelement() method in zend form. i want create array of input elements label . thanks in adv. ...how set label element created createelement() method in zend form $form->createelement('text', 'someelement', array( 'label' => 'some label', ));

jquery - How to fade loop gallery background images -

Image
i wish rotate background image of div believe precludes me using excellant jquery cycle plugin. the code below have far not behave like, is: fade out first image swap image second image while not showing image - (fails fade in second image) and repeat infinity ...and beyond. <script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script> <link rel="stylesheet" type="text/css" href="/css/normalize.css"> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <style type='text/css'> #mydiv { width: 100%; height: 365px; margin-left: auto; margin-right: auto; position: relative; display: block; background: url(hp_jquery1.jpg...

.net - output for the following c# snippet -

class program { static void main(string[] args) { program p = new program(); string s = p.tostring(); console.writeline(s.length); console.read(); } } the output receiving 27 why? because string representation of program class, it's full name (namespace , class name) string has number of characters.

Maven build error -

Image
i want build spring mvc project maven,i got following error: the following artifacts not resolved: org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0, org.hibernate:hibernate-validator:jar:4.2.0.beta1: not find artifact org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0 in central (http://repo1.maven.org/maven2) i use eclipse , m2eclipse plugin. don't know how add local repository. , found different versions of eclipse,the result different. can pass, fail.i confused. by way can find version of maven used in m2eclipse? thanks in advanced. update:now can handle hibernate-validator,but deleted spring mvc dependencies,i found there many other library dependent on com.springsource.org.aopalliance, since working spring artifacts, can refer this doc . if working on released versions of spring, can add following repository in settings.xml <repository> <id>com.springsource.repository.maven.release</id> <url>ht...

haskell - How can I get nth element from a list? -

how can access list index c code haskell list? int a[] = { 34, 45, 56 }; return a[1]; look here , operator !! . i.e. [1,2,3]!!1 gives 2 , since lists 0-indexed.

xcode - How to develop an app for Cydia and jailbroken iPhones -

i starting develop apps iphone. there 1 specific app i'd develop, apple sure reject it, want cydia, cause think useful. i'm trying figure out how use theos , xcode create app, can't understand anything. glad if of me this. i have installed theos, , header-dump scripts conor burgess, don't know how start doint anything. how should use xcode , interface builder theos create app? have mac, don't need toolchain develop on windows. have iphone jailbroken, , have been able try on iphone apps had developed on xcode. which steps should follow? mean, if of used develop apps cydia, do? create new template theos, , open .mm file in xcode , create .xib file?? when done, compile xcode? should use ldid? there guide n00bs developers? i have seen templates theos creates, , think need application one, cause need user interface, maybe i'll need tweak too... there not info it, lost... thank in advance! best regards! the theos application template create ja...

user interface - Programmatically how to create task scheduler in windows server 2008 -

the task scheduler works fine when running application in windows xp because task file saved .job. in windows server 2008 task scheduler file saving in xml format. how task scheduler in xml format? have @ task scheduler api http://msdn.microsoft.com/en-us/library/aa383614(v=vs.85).aspx or use schtasks.exe http://msdn.microsoft.com/en-us/library/bb736357.aspx

How to create a composite of existing components in JSF? -

i'd know if it's possible compose own component (or call widget, object). i mean, instead of (for example) using h:panelgroup , h:outputlabel inside it, make own h:panelmarkzzz , composition of panelgroup , outputlabel. is possible on jsf? yes, it's possible create composition of existing components that. kickoff example: /resources/foo/group.xhtml <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:cc="http://xmlns.jcp.org/jsf/composite"> <cc:interface> <cc:attribute name="label" type="java.lang.string" required="true" /> </cc:interface> <cc:implementation> <h:panelgroup> <h:outputlabel value="#{cc.attrs.label}" /> <cc:insertchildren /> </h:panelgroup> </cc:implementation> </html> ...

python - multiprocessing | catching an exiting interpreter -

i'm working on evolutionary computing problem, i'm implementing excellent ecspy module. fitness value i'm using derived pretty complex dynamics simulation. thing not approach of making simulation bomb-proof; pretty useless since evolutionary process come situations simu engine not built able solve. however, constraining generator return scenes solvable on constraining things. so approach simple; if simulation takes long, or crashes, well, i'll let darwin's mercy handle it . i'm using multiprocessing module evaluate fitness of candidates. how catch segfaulting interpreter or kill given number of seconds? many in advance, -jf use subprocess "wrap" python interpreter inside python script. start python interpreter runs thing. start clock. wait until clock runs out or child process crashes. the easy, lazy way poll subprocess periodically see if it's dead yet. yes, it's "busy waiting", it's simple imple...