Posts

Showing posts from September, 2014

jquery - Pushing a variable outside of a function -

i have jquery code block twitter widget i'm developing , $.getjson("http://twitter.com/users/show.json?screen_name=" + twitterfeed + "&callback=?" , function(data) { var fstring = ($('<div id="userimage"><h1>'+ data.followers_count +'</h1></div>').digits()).text(); var tstring = ($('<div id="userimage"><h1>'+ data.statuses_count +'</h1></div>').digits()).text(); $('#left-sidebar').prepend('<div id="userimage"><h1>'+ tstring +'</h1></div>'); $('#left-sidebar').prepend('<div id="userimage"><h2>tweets</h2></div>'); $('#left-sidebar').prepend('<div id="userimage"><h1>'+ fstring +'</h1></div>'); $('#left-sidebar').prepend('...

mysql - How do i store array of image names dynamically into the database using PHP -

i using jquery plugin uploadify upload files, , store image name path database simple mysql query , retrieve it. my mysql database table using following entities, id int(20) image_url varchar(255) my image store procedure such as, first rename file, give unique name , move desired directory. , store image name path database. currently using simple mysql insert statement storing single file name. now want upload array of image names path. or want store image want dynamically single table col image_url, reason plan store 4 or more images, want 4 image have 1 particular id number. how do it? thank you edit 2 removed previous scripts, here's new one: basically want achieve when inserting database store image path names arrays. store images want particular id, example id 1 have 3 images, id 2 have 5 images , id 3 have 4 images , on best way add separate entry each image url. can use single entry , store urls array, since you're storing in databa...

c# - Create 2 different versions of the same assembly -

i creating .net assembly. want have 2 different versions of assembly. difference between 2 versions guid string embedded in .cs file. version 1 of assembly, guid ecabafd2-7f19-11d2-978e-0000f8757e2a , version 2 ecabafd2-7f19-11d2-978e-0000f8757e2b how manage in visual studio 2010 ? there kind of automation tool can change string me , compile both versions ? how ? opened suggestions in c#, conditional compilation typically done using conditionalattribute. place code using relevant guid values in assembly conditional on 2 different compilation symbols - variant1, variant2. define build configurations project in visual studio define variant1 first build, variant2 second build. results in 2 output binaries - 1 first guid , other second.

objective c - How should this code be changed to work correctly? -

i downloaded code http://github.com/matej/mbprogresshud show progress meter when doing something. this code makes progress meter pop up. [hud showwhileexecuting:@selector(mytask) ontarget:self withobject:nil animated:yes]; this show progress meter while method mytask running. the strange thing allow program execution continue below line while mytask running. not behavior want. want progress meter show while mytask running, , after mytask finishes running want program execution continue below line. this code showwhileexecuting method. - (void)showwhileexecuting:(sel)method ontarget:(id)target withobject:(id)object animated:(bool)animated { methodforexecution = method; targetforexecution = [target retain]; objectforexecution = [object retain]; // launch execution in new thread taskinprogress = yes; [nsthread detachnewthreadselector:@selector(launchexecution) totarget:self withobject:nil]; // show hud view [self show:animated]; } in order behav...

Windows C/C++ Drive Init/Partition/Format -

i trying build application windows xp 64bit able detect drives of particular model in system, , if not initialized & formatted perform these processes. i able query , set partition information(including volume label). i have started putting code using deviceiocontrol, have not been able figure out how set/get partition/volume labels or format drives method, have got smart access working. is there other method easier use? zac sounds looking disk management control codes .

Efficient computation of "variable (number of points included)" moving average in R -

i'm trying implement variable exponential moving average on time series of intraday data (i.e 10 seconds). variable, mean size of window included in moving average depends on factor (i.e. volatility). thinking of following: ma(t)=alpha(t)*price(t) + (1-alpha(t))ma(t-1), where alpha corresponds example changing volatility index. in backtest on huge series (more 100000) points, computation causes me "troubles". have complete vectors alpha , price, current values of ma need value calculated before. thus, far not see vectorized solution???? another idea, had, trying directly apply implemented ema(..,n=f()) function every data point, having different value f(). not find fast solution neither far. would kind if me problem??? other suggestions of how constructing variable moving average great. thx lot in advance martin a efficient moving average operation possible via filter() : ## create weight vector -- 1 has equal weights, other schemes possible ...

visual studio - how does asp.net code behind work? -

i new asp.net development, , little bit curious on asp.net code behind mechanism. know why use it know is: relation between aspx page , code behind who linking between these 2 separate files ? how work? how element created in aspx page can accessed directly code behind ? i mean happens behind scenes ? thanks check link, understand few details on code-behind - http://www.developer.com/net/csharp/article.php/3087791/meditating-upon-the-aspnet-code-behind-model.htm http://en.wikipedia.org/wiki/asp.net#code-behind_model

database - Rails ActiveSupport Issue with state gems for notifications -

i have installed multiple state_machine gems app use them notification system every time run activesupport issue. looks identical this: >> m = message.new typeerror: wrong argument type nil (expected module) /home/ryan/appname/app/models/message.rb:2:in `include' /home/ryan/appname/app/models/message.rb:2 /home/ryan/.bundle/ruby/1.8/gems/activesupport-2.3.9/lib/active_sup port/dependencies.rb:406:in `load_without_new_constant_marking' /home/ryan/.bundle/ruby/1.8/gems/activesupport-2.3.9/lib/active_sup port/dependencies.rb:406:in `load_file' /home/ryan/.bundle/ruby/1.8/gems/activesupport-2.3.9/lib/active_sup port/dependencies.rb:547:in `new_constants_in' /home/ryan/.bundle/ruby/1.8/gems/activesupport-2.3.9/lib/active_sup port/dependencies.rb:405:in `load_file' /home/ryan/.bundle/ruby/1.8/gems/activesupport-2.3.9/lib/active_sup port/dependencies.rb:285:in `require_or_load' /home/ryan/.bun...

sql - Convert string id of column to int autoincrement -

i have table cars id nvarchar(25) pk name nvarchar(max) and there records. id name codexyz namezxc codeqaz nameasd codeedc nameqwe i want convert id column int autoincrement: id name 1 namezxc 2 nameasd 3 nameqwe but have no idea how make :/ me ? in sql server management studio, can right click on table, , modify it. once in there, select column want auto increment. should able change int. then @ column properties; 1 of them identity, unique , auto-incrementing field. turning property on, , saving changes, want. if have duplicates in field though, or values can't cast int, fail. need run update on table rid of problems or duplicates first. edit: you made comment "all records strings". if string values don't cast int, can't have waht you're asking for. field looking "aaabc" can't auto-incremented.

winforms - Windows Form launched from WPF window showing no current system theme. Why? -

i have wpf application has variable "x" instance of class custom c# assembly called "myclasses.dll". variable "x" has method "launchform" launches windows form "form1" assembly "myforms.dll". form launched dialog , shown in screen current windows xp / win7 theme/skin not applied it. if "form1" launched windows form (not wpf window) shown correctly though. ideas why happening? hints solve issue? cheers all! edgar i looked @ code again , i'm not using reflection on way of launching winform. code requested in wpf: myinterface x=new myclass1(); x.launchform(); the code in myclasses.dll: public class myclass1() : myinterface { public myclass1() {} public void launchform() { form1 form1dialog=new form1(); form1dialog.showdialog(); } } this, mentioned, launches winform wpf no windows theme applied it. probably don't have proper manifest tell windows compatible new theme (wpf doesn't need...

java ee - Install log formater in glassfish -

i don´t output of com.sun.enterprise.server.logging.uniformlogformatter might uniform not helpfull. in first step replaced java.util.logging.simpleformatter . actualy works fine java.lang.classcastexception exception: java.lang.classcastexception: java.util.logging.simpleformatter cannot cast com.sun.enterprise.server.logging.uniformlogformatter beeing perfectionist want rid of exeption , wonder if can create own child class com.sun.enterprise.server.logging.uniformlogformatter , somehow install class glassfish. but not find information on how install custom log formater glassfish. have pointer on subject? have @ configuring format of server log on glassfish forums. basically, need to: implement formatter put jar formatter in domain_dir/lib/ext . declare in <mydomain>/config/logging.properties see also configuring logging

perl - Why do I get a number instead a list of filenames from readdir? -

i have piece of perl code searchnig directory , display contents of directory, if match found. code given below: $test_case_directory = "/home/sait11/desktop/salt/data_base/test_case"; $xml_file_name = "sample.xml" $file_search_return = file_search($xml_file_name); print "file search return::$file_search_return\n"; sub file_search { opendir (dir, $test_case_directory) or die "\n\tfailed open directory contains test case xml files\n\n"; print "xml_file_name in sub routines:: $xml_file_name\n"; $dirs_found = grep { /^$xml_file_name/i } readdir dir; print "files in directory dirs_found :: $dirs_found\n"; closedir (dir); return $dirs_found; } output is, xml_file_name in sub routines:: sample.xml files in directory dirs_found :: 1 file search return::1 it not returning file name found. instead returns number 1 always. i don't know why not returning file name called sample.xml present ...

ODBC Oracle Connection error from MS Access -

i support ms access database has linked connections using microsoft odbc driver oracle. can connect current linked tables without issues, required security reasons change password on account accessing server. i have changed password when attempt relink tables error: odbc--call failed microsoft odbc driver oracle ora-12154: tns not resolve service name these tables part of critical application , can't connect. suggestions on how resolve this? the ora-12154 error indicates specifying tns alias not resolving. using dsn connection oracle? if so, tns alias you're specifying there? alias exist in tnsnames.ora file? there multiple tnsnames.ora files on client? the tnsnames.ora file on client machine access installed. without knowing version of oracle client installed, simplest way find out tnsnames.ora file being used open dos prompt , type "tnsping service_name " `service_name" whatever tns alias specified in dsn. you'll like c:\users...

java - Where is logback encoder pattern documentation -

i've gone through documentation of logback , can't find anywhere documentation configure encoder's pattern when logging, such as: <encoder> <pattern>%d{hh:mm:ss.sss} %-4relative %-5level %logger{35} - %msg%n</pattern> </encoder> i table (like 1 log4j has) explaining different options configure pattern. where documentation of pattern? maybe defined in project? probably should take @ chapter 6: layouts ...

database - why are multiple DBs actually needed? -

i looking @ godaddy.com says offer 10 mysql dbs, don't know why need more 1 ever since db can have mutliple tables. can't multiple dbs integrated single db? there example case better or unfeasible not have multiple ones? , how differentiate between them when want call them, directory or name? best, i guess separation of concerns obvious answer. in same way can have of functionality in 1 humongous class in object oriented programming, it's idea keep non-related information separate. it's easier wrap head around smaller chunks of data, , future developers mights start think tables related, , aggregate data in way never meant to.

python - use sqlalchemy entity isolately -

i want use entity modify show something,but don't want change db, after use ,and in other place session.commit() it add entity db,i don't want happen, 1 me? you can expunge session before modifying object, changes won't accounted on next commits unless add object session. call session.expunge(obj) .

unit testing - Visual Studio data-driven tests -

i'm using textcontext property access current row in excel file. test repeated rows. possible access rows in single step? rows related, hence me 1 sheet should complete run. edit: add code requested: int result = this.textcontext.rows[0]["globalresult"]; foreach(var row in this.testcontext.rows.skip(1)) { componenttotest.eval(convert.toint32(row["a"]), convert.toint32(row["b"])); } assert.areequal(result, componenttotest.result); and file appear this: globalresult, a, b 100, null, null null, 1, 5 null, 3, 6 ... , on thank much instead of using data driven tests, why don't read excel file , iterate through rows? take @ this question on how read excel file's contents. can iterate through rows in test without having use mstest data driven attributes. cheers. jas.

c# - Identify If Access database having ReadOnly Permission -

for acccess database open message "this database has been opended read-only". for db when connect using c#.net application oledbconnectio ..at time of updating query give error "operation must use updateable query." i want prompt user if db opened readonly permission in access database.. how can add code in c#.net application identiy oledb database readonly permission. thanks you can use fileinfo fileinfo f = new fileinfo(@"c:\mydb.accdb"); if (f.isreadonly) { console.writeline("file read only"); } else { console.writeline("file not read only"); }

c# - Automating Authentication Programmatically -

first of all, screen below popup window when requested asp web page. when authenticated, responses xml data. 1.what type of authentication method. how managed? 2.how can bypass programmatically(using c sharp) login screen supplying necessary credentials. login screen thanks, helped much. solved it. code below enough. string url = "www.testweb.com"; webrequest myreq = webrequest.create(url); myreq.timeout = 1000000000; string username = "administrator"; string password = "123456"; myreq.credentials = new networkcredential(username, password); webresponse wr = myreq.getresponse(); stream receivestream = wr.getresponsestream(); streamreader reader = new streamreader(receivestream, encoding.utf8); string content = reader.readtoend();

Oracle update statement - how do you link to related tables? -

i'm relatively new oracle, having working on ms sql of career. i'm used doing stuff like: update t set col1 = o.col2 mytable t join othertable o on t.otherid = o.id i tried syntax in oracle, , doesn't accept it. looked in oracle docs , couldn't find example of i'm trying do. how do it? option a) correlated subquery update mytable t set col1 = (select o.col2 othertable o t.otherid = o.id) this requires subquery return no more 1 match each row in table being updated. if returns no match, column updated null , may not want. add where exists (select o.col2 othertable o t.otherid = o.id) cause update occur match found. option b) updating join view update (select t.col1, o.col2 mytable t join othertable o on t.otherid = o.id) set col1 = col2 this closer used doing. work if oracle can determine unique row in underlying table each row in join -- think means id must unique key of othertable .

database deadlocks - How to do a safe "SELECT FOR UPDATE" with a WHERE condition over multiple tables on a DB2? -

problem on db2 (version 9.5) sql statement select o.id table1 o, table2 x [...] update rr gives me error message sqlstate=42829 (the update clause not allowed because table specified cursor cannot modified). additional info i need specify with rr , because i'm running on isolation level read_committed , need query block while there process running same query. solution far... if instead query this: select t.id table t t.id in ( select o.id table1 o, table2 x [...] ) update rr everything works fine. new problem but deadlock exceptions when multiple processes perform query simultaneously. question is there way formulate for update query without introducing place deadlock can occur? first, having isolation level read_committed not need specify with rr , because results in isolation level serializable . specify with rs (read stability) enough. to propagate for update rs inner select have specify additionally use , keep update locks . s...

java - Exception when using @SchemaValidation annotation on JAX-WS endpoint in Weblogic -

i trying schema validation working jax-ws web service deployed on weblogic 10.3.3. according documentation, should simple adding annotation "@schemavalidation" endpoint class. when try following exception thrown when application deployed: caused by: javax.xml.ws.webserviceexception: annotation@com.sun.xml.internal.ws.developer.schemavalidation (handler=class com.sun.xml.internal.ws.server.draconianvalidationerrorhandler) not recognizable, atleast 1 constructor of class com.sun.xml.internal.ws.developer.schemavalidationfeature should marked @featureconstructor @ com.sun.xml.ws.binding.webservicefeaturelist.getwebservicefeaturebean(webservicefeaturelist.java:169) @ com.sun.xml.ws.binding.webservicefeaturelist.parseannotations(webservicefeaturelist.java:141) the error message complaining "com.sun.xml.internal.ws.developer.schemavalidationfeature" not have constructor annotated @featureconstructor. when @ class, sure seems have one: @com.sun.xml.inter...

ruby on rails - How do I specify that a named route should use a model's columns its _url and _path functions? -

i have posts model id , title columns. i've got route (rails 2.3.8) set follows: map.post ':title/:id', :controller => 'posts', :action => 'show' which works correctly when recognising urls , when generating them explicitly, in post_url(:title => 'foo', :id => 123) which comes out nicely /foo/123. i'd able call p = post.create!(:title => 'foo') # let's assume gets id 123 url_for(p) and same path out. error: post_url failed generate {:action=>"show", :controller=>"posts", :title=>#<post id: 123 title: "foo" created_at: ... how specify named route should use model's columns _url , _path functions? when declare route, way call requires number of parameters, , must specified in correct order or things can confused. here typical routes: map.none '/', :controller => 'none', :action => 'index' map.one '/:one...

Is there a library that integrates R into ruby? -

i investigate integration between ruby , r on windows 7. far, rinruby hangs (on windows7 machine) when run script. learn this post rsruby not work on windows @ all. know library work? let me prefix saying more of linux person windows person ... @ point capabilities of oss matter, support basic posix functionality etc. hence, may not piece of cake embed r ruby or link on windows, handy may you. r after dependent on mingw toolchain on windows. as alternative, consider excellent rserve ---and noticed seemingly new offspring rservewin simon provides. merely needs run somewhere, , can connect on tcp/ip. there example clients c/c++ , java, , other projects such example pyrserve , rserve-ruby-client may fit bill. edit 1 more google search leads this talk r / ruby integration refers rsrruby gem (according quick search) seems have issue on windows too. maybe rserve , connection best ticket.

eclipse - Programmatically add code templates? -

i'm writing custom xml editor our project , want add support templates. i.e when user writes " <ab:mytag " , presses ctrl + space option of inserting chunk of text default/dummy parameters. but should available in xml editor. how go this? clarification : templates i'm talking ones available when write example "syso" in java editor , press ctrl + space. in preferences can add own templates. want do define own templates, own xml tags, want in code , have effect editor after alot of searching fount ppt answered questions had: http://www.eclipsecon.org/2008/sub/attachments/extending_the_xml_and_sse_editors_from_the_wtp_project_.ppt the templates after can programatically added use of extension point org.eclipse.ui.editors.templates

delphi - How to prevent from loss of focus when showing and/or closing secondary forms from the main form? -

showing 2 secondary forms main form , closing both forms cause main form lose focus. (another application gets activated instead of mine) the secondary forms created either main form directly or creating third form second form. the secondary forms set cafree in onclose event: procedure tform1.formclose(sender: tobject; var action: tcloseaction); begin action := cafree; end; using delphi 2009 (update 3 & 4) xp sp3. here steps reproducing problem: create new vcl forms applications assign onclose event above drag button onto created form in click handler create new tform1 , show below run program. click button show second form. click button on second form create third form. when closing both new forms main form lose focus. this code in button click event handler: tform1.create(application) show; is there way stop main form losing focus? (interestingly, when creating both secondary forms directly main form, issue appear when closing first created ...

evolutionary algorithm - Applying Darwinian evolution to programming -

a while recall reading magazine article (in wired believe) applying darwinian evolution programs create better programs. multiple mutations of program spawned, , 1 performed best selected next round of mutations. unforunately can't make subject sound interesting sounded in article, can't find article. since sounds coolest thing ever me, wondering mutations 1 have inside of program yes. called genetic programming , master program writes programs itself. , programs writes can evolve criterion. e.g. 8 queen solved gp.

c# - Using multiple .Where() calls or && conditions for LinqToEntities queries -

are following 2 queries equivalent? if not equivalent, performs better? there way can see sql output of queries? var query1 = items.where(i => i.enabled == true).where(i => i.name == "bob"); var query2 = items.where(i => i.enabled == true && i.name == "bob"); as andrew says, 2 options equivalent. 1 practically useful difference can generate conditions in where clause programmatically. example if wanted exclude names: var query = items; for(string name in excluded) query = query.where(i => i.name != excluded); this cannot done when writing query using && operator.

Issue with Facebook c# toolkit and authentication -

i've used excellent facebook c# sdk http://facebooksdk.codeplex.com/ integrate website facebook profile info etc need create canvas app in iframe. i'm starting mvc sample app in toolkit , have set app id, key, secret, canvaspageurl when go profile link (and authentication stuff kicks in) facebook gives me polite confising error. to fix error, please set connect url in application settings editor. once has been set, users redirected url instead of page after logging in. the thing is, using oauth, not connect, , connect url doesn't exist parameter in application settings. i've dug around, found 1 php example problem didn't seem appropriate using different auth method. ideas facebook pros? david i had same problem. basically, sdk passes "fbconnect=1" in login.php query string , seems break stuff. chopped off fiddler , login proceeded normally. later removed query parameter getloginurl , peachy. no idea why still hasn't been fixed. ...

javascript - dice up a string in JS -

i have string this 4741:green,cirhosis,orange,long-term,green,his b chic,4642:green,crhosis,green,hsysk b cc, the sting contains 2 records record id 4741 , 4642 separated character. within records else separated comma(,) how can split sting. please note example string contains 2 records other ones may contain more or less or none. thank help! basic idea: var str = "4741:green,cirhosis,orange,long-term,green,his b chic,4642:green,crhosis,green,hsysk b cc,1111:asdf" var re = /(\d+):([^(\d+:)]+)/g; var matches = str.match(re); for(var x in matches){ var parts = matches[x].split(":"); var id = parts[0]; var vals = parts[1].split(","); alert(id + "\n" + vals.length); }

c# - How to set the apartment state of the thread serving the .Net Remoting call? -

the client , server of program both marked stathread, , verified in debugger thread make call marked sta. on server side, verified program when setting server marked sta. actual .net remoting call done via thread marked mta. there anyway change behavior service method accesses resources require sta thread. remoting cannot this, hard requirement sta thread pumps message loop. you'll indeed have create own thread, use thread.setapartmentstate() switch sta before start it. , use application.run() dummy form start message loop. can use control.begininvoke() marshal call remoting thread new thread. note since started sta thread server, thread job fine. paste form class prevent getting visible: protected override void setvisiblecore(bool value) { if (!this.ishandlecreated) { this.createhandle(); value = false; } base.setvisiblecore(value); }

How to Integrate WPF Application with OUTLOOK Calendar? -

how integrate outlook calendar in bidirection way?. should send task outlook retrieve calendar task outlook calendar? the short answer use web services provided exchange server.

iphone - How to prevent CALayer from implicit animations? -

when set backgroundcolor property of calayer instance, change seems animated. don't want in case. how can set backgroundcolor without animation? you can wrap change in catransaction disabled animations: [catransaction begin]; [catransaction setvalue:(id)kcfbooleantrue forkey:kcatransactiondisableactions]; //change background colour [catransaction commit];

Mercurial; Possible to list the # of commits a certain user has made? -

is possible? use like: hg log --user whoever@example.com | grep --count "user" # unix or windows grep installed. hg log --user whoever@example.com | find /c "user" # windows. if grep doesn't have --count option, may have equivalent -c option.

java - Can I create a single class which can be the parent for every type of Activity? -

i wish have single class of activity classes extend. have listactivities , activities , mapactivities , tabactivities , etc in app. i have many of these different activities in app, ~12 activities. want each of them have methods in parent class. right now, have created 4 parent activity classes extended activity depending on type( listactivity , activity , mapactivity , tabactivity ) i creating lot of redundant code - each of 4 parent activities has identical code, in exception class activity extends. here example may clarify problem is: i have activity : menuscreen extends baselistactivity baselistactivity extends listactivity baselistactivity contains methods , fields want activities have access to i have activity : homescreen extends baseactivity baseactivity extends activity baseactivity contains same methods , fields in other base[<type>]activity classes(such baselistactivity ) these methods/fields copy-pasted base[<type>]activity , ,...

c# - StreamWriter not writing out the last few characters to a file -

we having issue 1 server , it's utilization of streamwriter class. has experienced similar issue below? if so, solution fix issue? using( streamwriter logwriter = file.createtext( logfilename ) ) { (int = 0; < 500; i++) logwriter.writeline( "process completed successfully." ); } when writing out file following output generated: process completed successfully. ... (497 more lines) process completed successfully. process completed s tried adding logwriter.flush() before close without help. more lines of text write out more data loss occurs. cannot reproduce this. under normal conditions, should not , not fail. is actual code fails ? text "process completed" suggests it's extract. any threading involved? network drive or local? etc.

continuous integration - TeamCity restore -

i trying move teamcity 1 server another. have got installed on new server , have run instructions in file: http://confluence.jetbrains.net/display/tcd5/restoring+teamcity+data+from+backup i running teamcity 5.1.4 on both servers. i got success message on maintaindb command , restarted teamcity web server in services. when login projects etc haven't been moved over. am missing obvious? can help? seems "configure new teamcity installation use proper teamcity data directory , database" (from here ) key case.

WPF: Windows settings for a resizeable, modal dialog -

i have model dialog consisting of datagrid, , ok button, , cancel button. should resizable. what settings windowstyle, etc., recommend? if asking technically involved in displaying modal window, has shown showdialog() method call. call block until user closes window. by default, window shown windowstyle of singleborderwindow , user should able resize it. you may want @ property showintaskbar if don't want dialog appear in taskbar. here's link msdn docs on window class reference.

c# - build .net solution from batch file -

i have solution file comprising of 15 projects using few third party dll references. want able build solution batch file. best way this? thanks run msbuild - example: msbuild mysolution.sln /p:configuration=release /p:platform="any cpu"

vb6 - Post Method + WinHttpRequest + multipart/form-data -

i'm stumped why doesn't work can't seem find problems. here code. public const multipart_boundary = "speed" function getbalance() string dim sentitybody string dim postbody() byte dim username string dim password string username = cstr(frmmain.txtuser.text) password = cstr(frmmain.txtpass.text) sentitybody = "--" & multipart_boundary & vbcrlf sentitybody = sentitybody & "content-disposition: form-data; name=""function""" & vbcrlf & vbcrlf & "balance" & vbcrlf sentitybody = sentitybody & "--" & multipart_boundary & vbcrlf sentitybody = sentitybody & "content-disposition: form-data; name=""username""" & vbcrlf & vbcrlf & username & vbcrlf sentitybody = sentitybody & "--" & multipart_boundary & vbcrlf sentitybody = sentitybody & "content-disposition: form-data; name=""p...

terminology - Is there a technical term for a function that takes one argument and returns an object of the same type? -

i'm considering functions of 1 argument of type t return argument of type t. seem vaguely recall there name sort of function, maybe homo-something. there such term? after hour-long wiki-crawl, appears appropriate term "endofunction". http://en.wikipedia.org/wiki/endomorphism#endofunctions_in_mathematics

c++ - System not declared in scope? -

i know simple code, how fix "system not declared in scope" problem? #include<iostream> using namespace std; int main(void) { system ( "title calculator" ); system ( "color 2" ); char cchar; double dfirstnumber; double dsecondnumber; char cdoagain; { system("cls"); cout << "please enter first number use."<< endl; cin >> dfirstnumber; cout<< "please enter operation perform." << " (+,-,*,or /)" << endl; cin >> cchar; cout<< "please enter second number use." << endl; cin >> dsecondnumber; switch (cchar) { case '+': cout << "the answer is: " << dfirstnumber << "+" << dsecondnumber << "=" << (dfirstnumber + dsecondnumber)...

asp.net mvc 2 - Telerik Html.Grid Style Sheet issue -

i started using telerik html.grid today , have run problem. grid appearing, text based know style sheet issue. also, have been following usage instructions documentation. ill go through them , explain did, maybe interpretation wrong. 1)open existing asp.net mvc application in visual studio or create new one. done 2)add reference telerik.web.mvc.dll located in binaries folder of telerik extensions asp.net mvc install location: done 3)register telerik extensions asp.net mvc namespaces: done, used import instead of add <%@ import namespace="telerik.web.mvc.ui" %> 4)add javascript files in scripts folder of asp.net mvc application. done, essentailly scripts in location web/scripts/2010.2.825 put in scriptregistrar @ end of .aspx page <div id="footer"> <% html.renderpartial("sitemasterfooter");%> </div> <div style="clear: both;"><!-- --></div> <% html.t...

What's the Android OS model for handling custom hardware keys? -

let's have android device has buttons on it, can register 1 of buttons launch app? there configuration file on device controls hardware keys behavior? let's have android device has buttons on it, can register 1 of buttons launch app? you have ask device manufacturer question. non-standard buttons, definition, non-standard, device manufacturer need document use. in particular, need know if there broadcast intent sent out if button pushed , not used current activity, case camera , media buttons today.

c# - How to check to see if a textbox is currently active or has focus? -

in c#, possible bool value, determining if cursor inside textbox? what want achieve: i have masterpage, 2 buttons in it; search-button , login-button. depending on textbox active or has focus, or of none have focus, want set usesubmitbehavior-attribute. what want happen (i know code doesn't work): if (textboxusername.hasfocus == true || textboxpassword.hasfocus == true) { buttonlogin.usesubmitbehavior = true; buttonsearch.usesubmitbehavior = false; } else { buttonlogin.usesubmitbehavior = false; buttonsearch.usesubmitbehavior = true; } the goal make page react way user expect to, e.g. searching when hitting enter, , not trying login, when typing in search-field. what trying won't work that. what can enclosing login fields in panel , search field in panel, , add defaultbutton both of them. <asp:panel runat="server" id="searchpanel" defaultbutton="search"> <asp:textbox runat="server" i...

javascript - OpenLayers Format JSON is Returning Empty responseText String -

after week of posting @ openlayers forum , not receiving responses questions, have decided here. have googled , googled , googled , found wonderful tutorial concerning topic, in spanish, written google translate able translate perfectly. gisandchips.org/2010/05/04/openlayers-y-panoramio/ so have followed tutorial , trying access panoramio data api query photos , display them on map. however, code fails @ line: var panoramio = json.read(response.responsetext); according firebug , alert(response.responsetext), responsetext empty string... in firebug have url http://localhost/cgi-bin/proxy.cgi?url=http%3a%2f%2fwww.panoramio.com%2fmap%2fget_panoramas.php%3forder%3dpopularity%26set%3dfull%26from%3d0%26to%3d40%26minx%3d-20037508.3392%26miny%3d-20037508.3392%26maxx%3d20037508.3392%26maxy%3d20037508.3392%26size%3dthumbnail this shows me valid json. , know response object isn't null because alert(response) shows getting [object xmlhttprequest] honestly out of ideas. ...

c++ - Need Help Tracking Down EXC_BAD_ACCESS on Function Entry on MacOS -

i have program gets kern_protection_failure exc_bad_access in strange place when running multithreaded , haven't faintest idea how troubleshoot further. on macos 10.6 using gcc. the strange place gets when entering function. not on first line of function, actual jump function getmachinefactors(): program received signal exc_bad_access, not access memory. reason: kern_protection_failure @ address: 0xb00009ec [switching process 28242] 0x00012592 in getmachinefactors () @ ../sysinfo/osx.cpp:168 168 machinefactors* getmachinefactors() (gdb) bt #0 0x00012592 in getmachinefactors () @ ../sysinfo/osx.cpp:168 #1 0x000156d0 in collectmachinefactorsthreadproc (parameter=0x200280) @ threads.cpp:341 #2 0x952f681d in _pthread_start () #3 0x952f66a2 in thread_start () (gdb) if run non-threaded, runs great, no issues: #include "machinefactors.h" int main( int argc, char** argv ) { machinefactors* factors = getmachinefactors(); std::string str = createjsonobje...

c# - page theme causing "Failed to load viewstate." error -

in web.config have following: <pages theme="mytheme" enablesessionstate="true" validaterequest="false" enableeventvalidation="false" viewstateencryptionmode="never" enableviewstatemac="false"> as added theme property instantly started receive: failed load viewstate. control tree viewstate being loaded must match control tree used save viewstate during previous request.for example, when adding controls dynamically, controls added during post-back must match type , position of controls added during initial request. when remove theme, no longer viewstate errors. can offer inside happening or how fix it? thanks. fixed by: adding runat="server" , id attributes link (stylesheet) calling page.header.findcontrol("link").databind() in page_load method of master page. do not call page.header.databind(); since databind entire header.

ruby - Subscribe to newsletter form rails 3 -

i'm new rails , know how make form submits database. have tried devise seems deals logins/users , it's not working purpose. don't want me, have learn :). creating form saves database on of basic tasks rails , handled in "getting started"-chapter in rails-guides: http://guides.rubyonrails.org/getting_started.html just work on , you'll idea. looks it's lot on page, explains principles , that. becomes interesting in chapter 5 , 6.

Java implementation of a... JVM? -

some time ago found mjvm project. sadly, project has been abandoned author (i asked igor via email). i wonder if there (continued) open source project of full implementation of jvm in java one. by "full", mean, not emulate mobile devices. the jikes rvm prominent jvm implementation written in java. however, lowest level implementation consists of static method calls "magic" interface treated specially compiler , translated native code. the maxine vm (developed sun labs, oracle labs) real metacircular vm, in not written in java, there no special-casing in compiler going on. more: not maxine vm written in java, runs in itself ! might sound crazy, , frank, have no idea how works, based on klein vm (developed sun labs) same thing self programming language. this has interesting properties: since jvm part of codebase jvm interprets, same codebase user code belongs to, means can optimizations such inlining across vm boundary. iow: can inline vm co...

json - How do I use JSONRequest.POST to get parameters from a url? -

how post parameters @ url, using jsonrequest. original site www.abc.com/aservlet. example, www.abc.com/aservlet?user=tom want paramter of"user" "tom". keying in user manually in aservlet servlet. the problem dont know how use jsonrequest retrieve parameters. please help. i think trying parameter "user" url. suppose request.getparameter cannot used since post method. so, think trying "user" parameter passed servlet (aservlet) via post.

ActionScript - Overriding Method Without Matching Signature? -

when extending class, impossible override method without matching parameters? for example, i'd use method's name, in case it's socket extension , method want override connect . however, want request additional parameters stock connect function not request. is alternative create own connect-like method own parameters, call super.connect function , override stock connect function throw error if it's called? that kind of sounds train wreck. function overloading not supported in actionscript (however darron schall demonstrated kind of pseudo overloading in this article ). i think in case it's left on create own connectex method.

css - how to remove the shadow of png in ie6 -

written pages, why in ie6 png images in automatically cast shadow there 2 possible reasons, depending on how looks. ie 6 doesn't support transparency png images (unless use filter display image), if there transparent background in image replaced solid gray. the png format contains gamma correction value intended solve color profiling problems, hurts as helps images displayed differently on different systems. if have color in png image supposed match background of page, might off, show iamge square different color.

iphone - Dynamic expandable UITableView with sections -

i creating uitableview expandable/collapsable sections. i data internet in json format, storing in arrays : {section 1 {s1 data 1, s1 data 2, ... }, section 2 {s2 data 1, s2 data 2, , on}} sections can alphabetical letters, year number or whatever. i create table view headers : gtheaderview *header = [gtheaderview headerviewwithtitle:[nsstring stringwithformat:@"%@", myarray.sectionvalue]]; [header.button addtarget:self action:@selector(togglesection) forcontrolevents:uicontroleventtouchupinside]; this fine, in "togglesection" method, can't find way know witch section have been touched collapsed/expanded. i know can't send parameters in selector... solution think fit needs ? thanks in advance ! you can write togglesection method as: - (void)togglesection:(id)sender { // send sender object message find out section number here... } and of course change addtarget line specify togglesection method has 1 parameter: [header...

php - Cannot call set or create from with in a Model class in CakePHP? -

i'm working in cakephp model class, writing function supposed perform whole bunch of manipulations on model. i'm trying follow skinny controller, fat model idea. however, don't seem able call any of model's functions in model. hasn't been initialized yet, because sql error when do: warning (512): sql error: 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1 [core/cake/libs/model/datasources/dbo_source.php, line 681] query: show full columns it looks if table name hasn't been set internally somewhere. model looks this: class search extends appmodel { var $name='search'; var $hasmany = 'searchresult'; var $actsas = array('containable'); function search($query) { $this->create(); $this->set('query', $query); $this->save(); } } i know model needs has been created works find, bec...

javascript - .load() is not firing for all images -

i have created gallery script, first loads images shown http://bit.ly/9aqdr3 there 36 images image.load() firing 27 times. here code var c = 0; for(var =1; <= 36; i++){ var img = '<img width="500" src="images/' + + '.jpg" />' $('#gallery .images').append(img); } $('#gallery .images img').css({display: 'block', position: 'absolute', left: '0px', top: '0px'}); $('#gallery .images img').hide(); totalimages = $('#gallery .images img').size(); $('#gallery .images img').load(function(){ c++; var ip = parseint((c/totalimages)*100); $('#gallery .images p').text('loading ... ' + ip + '%'); if(c == totalimages){ $('#gallery .images p').remove(); $('#gallery .images img').eq(0)....

wcf - CustomServiceHostFactory and Generating proxies in silverlight -

hi i'm using , custom servicehostfactory, , when want update service reference would'nt work because assume needs setup servicehostfactory , crash. i have looked other approaches not use generation, havent found replacements. are there anyway go around this, not remove servicehostfactory svc files everytime , put them there after service reference updates :s. we use non generation method described in this dnrtv screencast. it has worked us. prevoiously wasted alot of time due references not updating or developers forgetting update reference before checked in code.

Ready-made Dynamics NAV 2009 web services for integration with e-commerce system? -

i'm planning integrate our e-commerce module navision. know can set , configure web services in nav 2009, i'm not familiar navision, , more out-of-the-box solution, can set-up other customers. does here have experience ready-made web service solutions nav 2009? are looking set of web services expose nav data decided ecommerce platform or looking nav add-on is ecommerce platform? taking account comment (looking services expose nav data pre-existing ecommerce platform): in experience, 1 of situations there doesn't exist off shelf solution. depending on complexity of nav environment should relatively simple build own web services expose data need, in format need it, ecommerce platform. is ecommerce platform bespoke or off shelf? sort of data looking expose?

email - How to check if PHP mail() is enabled? -

i need install php site on microsoft server. reason host isn't allowing site send e-mails. host has sent me code sample... didn't work. is there way check if server allows sending of e-mails through php mail() function? at stage finger pointing , need proof here show client host @ fault. in linux, default mail() function uses sendmail operating system. in windows, default mail() doesn't anything, have set editing php.ini file. you can check options php.ini hosting using, writing showinfo.php file, , inside it, write: <?php phpinfo(); ?> then if call webpage, show enabled options. to able send mail on windows, these 2 values should set similar these: smtp = smtp.isp.net (the name or ip of server) sendmail_from = me@isp.net xampp platform comes mailtodisk replacement, , can set use "fakemail" in place of sendmail, means of smtp connection. can take sendmail folder comes xampp, , set in php.ini iis uses.

cocoa - Extracting an image from H.264 sample data (Objective-C / Mac OS X) -

given sample buffer of h.264, there way extract frame represents image? i'm using qtkit capture video camera , using qtcapturemoviefileoutput output object. i want similar cvimagebufferref passed parameter qtcapturevideopreviewoutput delegate method. reason, file output doesn't contain cvimagebufferref . what qtsamplebuffer which, since i've set in compression options, contains h.264 sample. i have seen on iphone, coremedia , avfoundation can used create cvimagebufferref given cmsamplebufferref (which, imagine close qtsamplebuffer i'll able get) - mac, not iphone. neither coremedia or avfoundation on mac, , can't see way accomplish same task. what need image (whether cvimagebufferref, ciimage or nsimage doesn't matter) current frame of h.264 sample given me output object's call back. extended info (from comments below) i have posted related question focusses on original issue - attempting play stream of video samples using qtkit: ...

javascript - Retrieve if an Updatepanel has made a postback -

can tell me if can retrieve javascript above asp.net updatepanel had made asynchronous postback ? thank's ! have tried registering startup script in updatepanel? this: scriptmanager.registerstartupscript(this.updatepanelid, typeof(string), "updatepanelscript", "alert('from updatepanel');", true); here's link documentation: http://msdn.microsoft.com/en-us/library/bb359558.aspx

listview - Android list view on click -

i have list view 15 items. when click on item want change screen(intent). how can change activity on item selected in android? tutorial or source code? you can use listview 's setonitemclicklistener , , start new activity in implementation of method. following sample code: mylistview.setonitemclicklistener(new adapterview.onitemclicklistener() { public void onitemclick(adapterview parent, view v, int position, long id){ // start activity according item clicked. } });

tfs - Does Visual Studio Team Foundation Server 2010 include ASP.NET in the Install? -

does visual studio team foundation server 2010 has asp.net included when installing? no, tfs refuses install on machine without iis, in turn brings asp.net anyway. hth! thomas

android - To close or not to close? -

in last days i'v got many error messages because of database leak in application, open database, query results , close db again. but use cursoradapter autocompletetextview. should on way there: open db, cursor, close db?! i mean, haven't got problems because of not doing that, ... so need tips experts, tips you you should able open database in oncreate method , close in ondestroy method. guarantee available long activity "alive" , cleaned eventually. further, should use "startmanagingcursor" on cursor use adapter. make sure deactivated, requeried, , closed necessary on pause, resume, , destroy respectively. cursors aren't used in adapters should closed finished getting data them. there should no leaks if follow these rules.

linux - How to convert Windows end of line in Unix end of line (CR/LF to LF) -

i'm java developer , i'm using ubuntu develop. project created in windows eclipse , it's using cp1252 encoding. to convert utf-8 i've used recode program: find web -iname \*.java | xargs recode cp1252...utf-8 this command gives error: recode: web/src/br/cits/projeto/geral/presentation/gravacaomessagehelper.java failed: ambiguous output in step `cr-lf..data i've serached , solution here: http://fvue.nl/wiki/bash_and_windows#recode:_ambiguous_output_in_step_.60data..cr-lf.27 , says: convert line endings cr/lf single lf: edit file vim , give command :set ff=unix , save file. recode should run without errors. nice i've many files remove cr/lf character, can't open each it. vi doesn't provide option command line bash operations. sed can use ? how ? thankx =) there should program called dos2unix fix line endings you. if it's not on linux box, should available via package manager.

Android service architecture question -

i'm new android , i'm porting iphone app did. i've been reading on android services , useful network component of app. assume there common pattern i'm trying do, here details: user1 , user2 agree enter virtual room. they send messages each other , notified when receive messages. i'm using remote server handle communication. basically, need 3 methods. 1 add users room, 1 send messages , 1 messages. nothing special. what i'd have 1 service accepts few paramaters. 1 being web service method call, rest being parameters need passed respective web services. i'd prefer approach having different service each method call. suggestions on best approach? i'm not clear on how pass parameters services. btw, not question polling, callbacks or broadcasting. i'm aware of those. want know if it's feasible pass variable amount of parameters service, or there perhaps else should into. sure, read intent s, context.sendbroadcast() , broadcastr...

ruby on rails - Using checkboxes with parameters from a many-to-many link table -

i have following models class outbreak < activerecord::base has_many :risks has_many :factors, :through => :risks end class risk < activerecord::base belongs_to :outbreak belongs_to :factor end class factor < activerecord::base has_many :risks has_many :outbreaks, :through => :risks end risk table id : integer outbreak_id : integer factor_id : integer details : text in view/outbreak/edit <div id="factor_div"> <% factor in factor.find(:all, :conditions => {:outbreak_type => @outbreak.outbreak_type}) %> <div> <%= check_box_tag "outbreak[factor_ids][]", factor.id , @outbreak.factors.include?(factor) %> <%= factor.name %> <%= text_field_tag "risk[details][]", @outbreak.risks.each{ |risk| if risk.factor_id == factor.id; risk} %> </div> <% end %> </div> i'm trying edit risk model details attr...