Posts

Showing posts from August, 2011

How to reset AutoIncrement field from Access Database -

i trying reset autoincrement field of particular field. reason because gets count auto populates in case number. when hits mindnight 12/31/2013 11:59:00 pm want autoincrement start again zero. this code have. code on form1 , value of id2 form2 keep case number consistant when hit @ field1 using double click private sub field1_dblclick(cancel integer) docmd.openform "form2",,,,acformadd,achidden me.field1 = format(date, "yy") & "-" & format(forms!form2!id2, "0000") me.field2.setfocus end sub maybe has different approach. counting upwards. problem have when reach "12/31/13 11:59:00 pm" want autoincrement reset 1 start brand new case number. format provided. right know works fine format see yy-0001 in order words 13-0001 case number example. have following code think should work reseting autoincrement. has better approach this. code. private sub field1_dblclick(cancel integer) if me.text5 > "12...

neo4j - How to find median degree over all vertices in Cypher? -

i know cypher, possible write query find median of given property (using percentile_disc or percentile_cont ). however, write query calculates median of collection of values isn't coming property. like: match u:user-->r:review u, count(r) edges return median(edges) any suggestions?

sliding window median of correlations of a matrix -

question parts: is there "julia way" implement sliding window? what needed in julia ignore nan s? there matrix 264 recording points (rows) , 200 time points (columns). want median correlation of each recording point every other point on 10 sample window. i've tried matlab-way (tm) creating 3d 264x264x10 matrix third dim correlation window. in matlab, median(cors,3) julia can mean(cors,3) . median not have support this. looks mapslices(median,cors,3) might want, recording points have nans. in r, might na.omit() or function options na.ignore=t don't see julia. #oned=readdlm("10152_20111123_preproc_torque.1d") oned=rand(200,264); oned[:,3]=nan; oned[:,200]=nan windows=10 samplesperwindow=size(oned,1)/windows cors=zeros(size(oned,2),size(oned,2),windows) i=1:windows startat=(i-1)*windows+1 endat=i*windows corofsamples=cor(oned[startat:i*windows,:]) cors[:,:,i]= corofsamples end med = mapslices(median,cors,3) # fail b/c nan here...

networking - how do sockets not missing arriving data? -

a typical socket program example this: while(1){ data = socket.recv() //do work } since don't know when package arrive,it must block wait until data listening port,suppose if program start heavy work after received command side,during work , package arrived,but because @ moment doing work,you not listening port, might missed package ,no matter how fast handle work. so how socket work handle data without lost? the operating system has receive buffer holds packets have been received network not yet recv() ed application. if buffer fills packets lost. don't have in recv() call when packets arrive, though should make sure call enough keep buffer overflowing.

grand central dispatch - NSOperation or GCD threading with animations -

i'm trying run sequence of disk-based, old-school avi animations (a b c...), back-to-back, nice transition in between. i'm looking little guidance admittedly not having done threading work time, , never having done nsoperation or gcd . these animations run @ 30fps , typically less minute in duration, along coreimage -assisted transition in between. timing-wise, things pretty tight, multi-threading needed. since i'm using ssd disk-access, read rate (theoretically) @ double consumption rate, there's still chunk of post-read , pre-display processing occur lag whole process if singly-threaded -- not mention being bad idea. here's flow: firstly, read starting frame(s) of animation (possibly using serial nsoperation queue these reads). have raw data in nsmutablearray of objects. then, each frame that's been read, convert data in array coreimage format (either using similar separate serial "rendered" queue, or completion handler on each fram...

php - Magento Error Messages are showing up twice -

i seem have issue our cart , unsure if it's theme related or not! error/normal messages (local or global) showing twice on front end. not sure causing issue. doesn't mater if i'm adding cart, editing cart, deleting item cart, changing address - messages showing twice. i looked through error logs , nothing shows up. has else had issue magento? i'm using 1.7. thank you! seems issue theme. magento has block called global_messages, maybe theme renders block twice, although flash messages. if see messages in cart should in theme layout folder in file checkout.xml, of these lines: <block type="core/messages" name="global_messages" /> <block type="core/messages" name="messages" /> try deleting 1 or both if find them.

java - Visibility issue of JInternalFrame -

Image
i having 1 application form. i designed using java swing. i used many swing components menubar,jpanel,jdesktoppane,jinternalframe , many more. on click event of 1 jbutton launched jinternalframe inside jdesktoppane. but whenever click on jinternalframe frame becomes invisible or part of frame available. here share snap hope helpful. can tell me why happens?and how solve bug? here jinternalframe visible. here when clicked on calendar component parts become invisible , parts of frame visible. some times whole frame goes invisible. how can solve issue? edit:- after solving visibility problem how make jdesktoppane transparent?

multithreading - synchronisation on a block of code using akka -

i want use akka in application multi processing. so, same block of code gets executed each actor , results aggregated listener. so, question there synchronisation problem in case. if not how being handled akka actors internally. by default there should not synchronization problems - if strictly respect actor approach. means actors should communicate using messages contain immutable objects - , should never expose internal state of actor outer world directly. make internal state mutable/readable solely reacting received messages. each actor executed in own executioncontext. means each actor has own private state. akka actors designed in way accessing internal state "outer world" not possible (or made hard) since after creating new actor, have intermediary reference actor (an actorref instance), not reference actual actor instance in memory. intention of akka developers way: made hard developers the actual reference , access properties directly - break actor ap...

c# - WCF REST Service (self-hosted) accessible only in local network (and must be accessed remotely) -

i have self-hosted rest service (in c#) works in local network, unreachable remotely. here hosting code: static uri baseaddress = new uri("http://m.y.i.p:8080"); webservicehost servicehost = new webservicehost(typeof(webservice.restservice), baseaddress); servicehost.open(); (which run in windows forms, btw). here app.config: <?xml version="1.0"?> <configuration> <system.servicemodel> <bindings> </bindings> <services> <service name="webservice.restservice" behaviorconfiguration="default"> <host> <baseaddresses> </baseaddresses> </host> <endpoint address="" binding="webhttpbinding" behaviorconfiguration="webbehavior" contract="webservice.icarga"> </endpoint> </service> </services> <behaviors> <endpointbehaviors> <behavior name=...

ganglia - clustering gmetad and pull data from other gmetad -

i new ganglia , trying play around clustering of gmetad project i have cluster of around 500 nodes , hence want distribute load of gmetad(aggregator) multiple nodes , using central gmetad /gweb show results. also, have limitation can not have data nodes on 1 machine, wanted know if there options below, if configure cluster of gmetad, central gmetad contain data in rrd(central) other gmetads? is possible stream data real-time on central gmetad gweb display instead of storing in rrd? please find sample configuration below, central configuration data_source "grid1" xx.xx.xxx.xxx gridname "central" trusted_hosts xx.xx.xxx.xxx all_trusted on rrd_rootdir "/ganglia/rrds" case_sensitive_hostnames 1 grid1 configuration data_source xx.xx.xxx.xxx gridname "grid1" rrd_rootdir "/ganglia/rrds" case_sensitive_hostnames 1 i have tried above configuration , able see data on web data gmetads copied central gmetad. thanks in adv...

c++ - Using Boost Pre-build package -

i want use boost.thread library in c++ software i'm developing. since i'm complete newbie in c++, know if there differences between: downloading , building boost manually msvc9-x64 using pre-built package: http://boost.teeks99.com/ option 1 seems painful... as far can tell, these default builds , not patched or tweaked sources or anything. if take care use correct version of binaries application target , version of vc (including service packs) , link against correct libraries (shared, static crt, debug, etc.) should absolutely fine. also, since seems these packages don't contain boost headers, must take care , use correct version of headers. concerning "differences". boost large , complex collection of libraries. software of size, has quite simple , straightforward build process, still, there many options , customizations can when building boost (e.g. can build boost.iostreams or without zlib , bzip2 support, build boost.regex or without ...

mysql - UPDATE in Procedure does not work -

i have 2 tables: question , quiz. quiz collection of questions. quiz table looks this: quizdid | questionids (nvarchar50) 1 | 1,2,3,4,5 2 | 6,7,8,9 question table has primary key id (integer), question , status field i want write procedure update status of questions in question table. the following query works in sql console update questions set activestatus = 'x' find_in_set(id, (select questionids quiz quizid = 2)) > 0 4 rows updated here. however, when put same query in stored procedure , execute parameters, not work. stored procedure code: create definer=`root`@`localhost` procedure `update_quiz_status`(in `quizid` int, in `status` varchar(1)) modifies sql data sql security invoker update questions set activestatus = status find_in_set(id, (select questionids quiz quizid = quizid)) > 0 procedure has no syntax errors. when call procedure sql console, error: call update_quiz_status(2,'x'); error : #1242 - ...

Python script to run shell command -

i'm having bit of trouble. want run shell command within python in specific directory. based on code found on internet need following inclusions: import os import subprocess import shlex and code below os.chdir('/etc/test/') cmd = 'scrapy crawl test' subprocess.call(shlex.split(cmd)) as looks like, trying run command "scrapy crawl test" within /etc/test/ directory. when run manually terminal seems work fine when run python code gives me error: info exception occured while scraping: [errno 2] no such file or directory is able tell me if code incorrect, or if going wrong way perhaps. why using subprocess? common practice run scrapy script use twisted's reactor . taken docs : from twisted.internet import reactor scrapy.crawler import crawler scrapy.settings import settings scrapy import log testspiders.spiders.followall import followallspider spider = followallspider(domain='scrapinghub.com') crawler = crawler(s...

css - Jquery: change CLASS between multiple DIVs -

i have such task: create function jquery change css-class selected div. class="xxx" can repeated many times class="yyy" once. like this: <div onclick="change_css()"class="xxx">text</div> <div onclick="change_css()"class="xxx">text</div> <div onclick="change_css()"class="xxx">text</div> <div onclick="change_css()"class="yyy">text</div> <div onclick="change_css()"class="xxx">text</div> so, means function need find first class="yyy" , change class="xxx" , secondly modify class "yyy" activated onclick ... please, me achieve functions... know need use somehow .addclass , .removeclass function change_css() { /// tricks here } thank every suggestion! i suggest different, more jquery approach. drop "onclick" attributes <div> s , use class ( mydiv...

Open a .pdf file with Rails outside the public folder -

i'm new programming world , i'm working rails create first project. have library of .pdf files saved on separate shared network server. make links of these files when click link, pdf opens in browser. i understand using: <a href="/filename.pdf">click me</a> i can open file in /public folder in rails project, i'm looking open file on different harddrive. i've tried `href="//drivename/folder/nextfolder/filename.pdf" ` but browser gives me 404 error saying file not found. better use controller action serve file: say have pdfs controller, in view: <a href="pdfs/serve/filename">click me</a> in controller def serve path = "/drivename/folder/nextfolder/#{params[:filename]}" send_file( path, :disposition => 'inline', :type => 'application/pdf', :x_sendfile => true ) end

html - Adding data attributes to elements not yet inserted into DOM in jquery -

this question has answer here: jquery data vs attr? 3 answers so i'm adding elements dom on fly. can use method .addclass on them before exist, , class appended dom along element, when use .data() method add data attribute, data isn't appended dom element. missing here or have wait until element exists in dom add data it? ps. using jquery 1.9.1 heres fiddle play with js var widget = $("<div>"); widget.addclass("banana"); widget.data('color', 'brown'); widget.appendto('#container'); html <div id="container"> </div> and theres nice css there know click inspect , see data attribute isn't(or is) added. my expected result is <div id="container"> <div class="banana" data-color="brown"></div> </div> cheers. ...

c - how memory allocation works at extremes? -

i quite confused how memory allocation (malloc/calloc) works in linux/c. suppose, have machine 16gb ram , run program root. 64-bit machine, 16gb can addressed single segment. can allocate of (less amount os of course) single malloc call? many malloc calls? how relates "heap memory" , "virtual memory"? if allocate small memory chunk, , happens in heap memory, resize (enlarge) chunk, happens when approach stack area? do have fiddle setrlimit rlimit_as if want (almost) ram assigned single process, thought it's running root? a 64-bit process can allocate of memory. doesn't need root, unless system has defined ulimit setting non-root users. try ulimit -v see if limit set. under linux default settings process can ask amount of memory , granted. memory assigned used, , come physical ram or disk swap needed. a memory allocation resize done in c library allocating new, larger size , copying old data new allocation. not done expanding existing a...

ruby on rails - Devise overrides my request params when user is logged in -

i using request params in application transfer information other websites. request looks like: myapp.com/users/sign_up?customer=somevalue once user isn’t logged in, works fine , able retrieve these params in registrations controller (i have overridden devise's controller). them using: customer_key = params[:customer] once user logged in, cant retrieve these params , suspect devise has modified them me. "post-login" params are: {"action"=>"show", "controller"=>"users", "id"=>"my-user"} (this taken users controller) my question - how can retrieve these params when user logged in in users controller? you have create require_no_authentication method in overridden registrations controller. devise::registration controller have before filter prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ] that checks if user logged in or not , if redirect...

php - Hide address bar in browsers or hide url in the address bar -

i trying hide address bar in browsers. have done enough searching , found code work. following code function openwindow(){ var browser=navigator.appname; if (browser=="microsoft internet explorer") { window.opener=self; } window.open("index.html","null","width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =yes"); window.moveto(0,0); window.resizeto(screen.width,screen.height-100); self.close(); } location=no/0 etc not working , address bar still there. should do? if not possible there way hide url in address bar? it not possible in modern browsers since concealing address of page aids phishing attacks.

.net - get Composite Type into WSDL even though it is not in service interface -

i have simple dto defined, datacontract , datamember attributes, of datamembers integers. returning list of worked fine. compressing list , returning byte array. service no longer returns dto part of interface, not generate class in service reference. cant uncompress have no type work on client side. i using visual studio generate service reference. all of examples seem exposing known type class has class 1 of properties. declare type , known type, or using inheritance etc. want declare type. i have tried many things including <datacontractserializer> <declaredtypes> <add type="pgf.business.customercropyeardto, pgf_externalservice"> </add> </declaredtypes> </datacontractserializer> here abbreviated version of class. <datacontract()> public class customercropyeardto <datamember()> public property customercropyearid integer end class i working in vb c# answer fine. hum.. if understandin...

bash - How to cd into a directory with space in the name? -

i tried lot of things. see below: attempt directory: /cygdrive/c/users/my dir/documents $ docs="/cygdrive/c/users/my\ dir/documents" $ echo $docs /cygdrive/c/users/my\ dir/documents $ cd $docs -bash: cd: /cygdrive/c/users/my\: no such file or directory $ cd /cygdrive/c/users/my\ dir/documents (success) very weird behaviour. when manually type in, backspace escape character thing. not when use parameter expansion variable docs. tried other variations such no backslash. $ docs=/cygdrive/c/users/rahman\ dir/documents $ echo $docs /cygdrive/c/users/my dir/documents $ cd $docs -bash: cd: /cygdrive/c/users/my: no such file or directory or $ docs="/cygdrive/c/users/my dir/documents" $ echo $docs /cygdrive/c/users/my dir/documents $ cd $docs -bash: cd: /cygdrive/c/users/my: no such file or directory i know possible. see here: $ echo $home /home/my dir [edit] pointed out, cd $home doesn't work either. quotes must put around it. what heck: ...

Promoting a GitHub repo and suggestions on new API methods -

i have session api on github, have methods such as: starting session, returning session status, setting value within session array, retrieving value array, specified single key, displaying array, destroying session, , function make recursive array search through multi-dimensional session array return value based on session keys. what other methods prove beneficial api make thrive , work seamlessly within enterprise/web environment? also, steps there promote github repository make api thrive , known within development community?

HTML Page with GWT -

is possible have parts (instead of entire page) of html page written gwt? usual? i'm quite new gwt , trying understand workflow of it. thanks. i meant html static pages, written hand (or other means) , on these pages have parts (forms, media, whatever...) in gwt. yes, simplest way can achieved setting id attribute on elements want filled in gwt, e.g. <body> <div> ... <div id="myid"></div> </div> </body> , , using rootpanel myidpanel = rootpanel.get("myid"); so can put gwt contents myidpanel. note, there many more ways mix html that's generated gwt , other means - combination possible.

Bootstrap 3 typeahead.js - query by part of typeahead val -

Image
i'm trying call remote url last part of input value. this: $('#typeahead').typeahead({ remote: { url: '/ajax/tags/get/?name=%query', replace: function (url, query) { var last = query.split(','); last = $.trim(last[last.length-1]); return url.replace('%query', last); } }, limit : 10 }); and when dropdown item selected, add new value end of line any idea how make work? for bootstrap 3 can use bootstrap-3-typeahead . you have overwrite updater , matcher functions. matcher function can use code replace function follows: matcher: function (item) { var last = this.query.split(','); this.query = $.trim(last[last.length-1]); if(this.query.length) return ~item.tolowercase().indexof(this.query.tolowercase()); } use following code update : updater: function (item) { return this.$element.val().replace(new regexp(t...

java - How to find "public static void main" or the start of a program? -

i working on open source project, 10kloc, , know program starts. naturally, think should search "public static void main". using eclipse. know how find this? i tried using search function in eclipse, not finding match. search configuration incorrect, or there better way find method? any other suggestions finding start of program welcome. edit: eclipse plug-in, running eclipse pde. not programs start main method. if java ee app services, eclipse plugin, starting point can anywhere. if have done search "main" , found nothing, probaly should start debugging. put breakpoints in beginning of every method looks might startpoint. breakpoints in constructors idea, since program start instantiating classes.

iphone - tableView didSelectRow not properly functioning -

my other question ambiguous make 1 clearer. have table view on 1 viewcontroller , when cell selected, saves number nsuserdefaults. on main viewcontroller, retrieve number , want update label it. did debugging , found when go main viewcontroller tableview one, order @ happens: 1) main view loads 2) tableview cell tap recognized 3) number saved nsuserdefaults how change order main view loads last when click cell, changes label in main viewcontroller? here code didselectrow method - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsstring *pointspath = [[nsstring alloc] initwithformat:@"totalpoints"]; nsstring *numberfirst = [[nsstring alloc] initwithformat:@"numberfirst"]; int totalpoints = [[nsuserdefaults standarduserdefaults] integerforkey: pointspath]; int number = [[nsuserdefaults standarduserdefaults] integerforkey:numberfirst]; if([indexpath row] == 1) { nslog(@"selected first row"); ...

c# - ImageMagick.NET 'Could Not Load File or Assembly' -

i'm trying set imagemagick.net visual studio 2012. i've done research seems common issue whereby visual studio not recognizing dependencies of imagemagick.net (it recognizes .net dll fine judging auto complete). took steps suggested in threads such this: http://imagemagick.codeplex.com/discussions/66874 whereby .net dll referenced within project, making sure take note chose 16-numbered build, downloading 6.5.3-10 versioned dependencies following link: http://image_magick.veidrodis.com/image_magick/binaries/ which installs dlls , places them automatically on system path shouldn't theoretically have copy dll's install directory project.... have done, in several different locations, including project root, bin, debug , x86 directories, etc. made sure building x86 machines, seems architecture supported dll. yet despite measures, no dice! appreciate if has further insight why might happening way is. i'm building c# project , trying initialize project within w...

javascript - Rotating images and hidden menus -

i navigation @ here , , know how turned image smoothly (i assuming jquery plug-in, menu icons don't turn), , how menu toggled on , off clicking image. i tried @ source code, css illegible. p.s. works in ie well. they using css transitions . to turn image use: .active .icon-menu { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); transform: rotate(90deg); } and animate use: .icon-menu { transition: transform .3s cubic-bezier(0.785,0.135,0.15,0.86); -moz-transition: -moz-transform .3s cubic-bezier(0.785,0.135,0.15,0.86); -webkit-transition: -webkit-transform .3s cubic-bezier(0.785,0.135,0.15,0.86); -o-transition: -o-transform .3s cubic-bezier(0.785,0.135,0.15,0.86); } with these styles defined animation triggered adding or removing .active class on corresponding <a> element.

logging - print a group of the first consecutive lines matching a regex then exit -

i print lines in log file filtered current time. the setup have right reads entire file , prints lines match. how should stop sed reading entire file while still printing multiple lines. normally lines need 3 lines deep log , multiple lines long. currently use: timestamp=`date +"%y-%m-%d %h:%m:%s"` tac mylogfile | gsed -n "/^$timestamp/p" | tac tac bit superfluous in simple demo example data: 2013-08-19 19:23:42 2013-08-19 19:23:42 2013-08-19 19:23:42 2013-08-19 19:23:42 2013-08-19 19:23:43 2013-08-19 19:23:43 2013-08-19 19:23:43 2013-08-19 19:23:44 2013-08-19 19:23:44 2013-08-19 19:23:44 2013-08-19 19:23:44 2013-08-19 19:23:45 2013-08-19 19:23:45 2013-08-19 19:23:45 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 2013-08-19 19:23:46 sed excellent tool simple substitutions on single line else, use awk: awk -v ts="$timestamp" '$0 ~ ts...

How can I check if a string has the same characters? Python -

i need able discern if string of arbitrary length, greater 1 (and lowercase), has same set of characters within base or template string. for example, take string "aabc": "azbc" , "aaabc" false while "acba" true. is there fast way in python without keeping track of permutations of first string , comparing test string? sort 2 strings , compare them: sorted(str1) == sorted(str2) if strings might not same length, might want make sure of first save time: len(str1) == len(str2) , sorted(str1) == sorted(str2)

python - urllib2.ProxyHandler - query -

definition : urllib2.proxyhandler([proxies]) cause requests go through proxy. if proxies given, must dictionary mapping protocol names urls of proxies. default read list of proxies environment variables _proxy. if no proxy environment variables set, in windows environment proxy settings obtained registry’s internet settings section, , in mac os x environment proxy information retrieved os x system configuration framework. my understanding , if proxy not set explicity detects proxy registry settings . buet when run below code: import urllib2 proxy_support = urllib2.proxyhandler({}) print "1" opener = urllib2.build_opener(proxy_support) print "2" urllib2.install_opener(opener) print "3" response = urllib2.urlopen('http://google.com') print "4" html = response.read() i error : 1 2 3 urllib2.urlerror: <urlopen error [errno 10060] connection attempt failed because connected party did not respond after period of time, or es...

linker error - How do you integrate ObjCMongoDb into an iOS application? -

so i'm trying objcmongodb , running in ios application keep getting error. ignoring file /users/user/documents/programming/objcmongodb/objcmongodb.framework/objcmongodb, file built unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) not architecture being linked (armv7): /users/user/documents/programming/objcmongodb/objcmongodb.framework/objcmongodb undefined symbols architecture armv7: "_objc_class_$_bsondecoder", referenced from: objc-class-ref in mongodbconnection.o "_objc_class_$_mongokeyedpredicate", referenced from: objc-class-ref in mongodbconnection.o "_objc_class_$_mongoupdaterequest", referenced from: objc-class-ref in mongodbconnection.o "_objc_class_$_mongoconnection", referenced from: objc-class-ref in mongodbconnection.o ld: symbol(s) not found architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) ...

Python script that prints its source -

is possible (not necessarly using python introspection) print source code of script? i want execute short python script print source (so can see commands executed). the script this: command1() #command2() command3() print some_variable_that_contain_src the real application want run script ipython run -i magic , have output source (i.e. commands executed). in way can check commands commented @ every execution. moreover, if executed in notebook leave trace of commands have been used. solution using korylprince solution end one-liner put @ beginning of script: with open(__file__) f: print '\n'.join(f.read().split('\n')[1:]) this print script source except first line (that noise). it's easy modify slicing in order print different "slice" of script. if want print whole file instead, one-liner simplifies to: with open(__file__) f: print f.read() as long you're not doing crazy packages, put @ top of script with open(__fil...

c# - Why does this code generate a CS1525 ("invalid expression") compiler error? -

i'm trying make program that, when button pressed, takes words typed in text box , adds text file. have far: private void textbox1_textchanged(object sender, eventargs e) { file.writealltext(path, string()); } private void textbox2_textchanged(object sender, eventargs e) { file.writealltext(path, string()); } the string keeps coming error code cs1525 ("invalid expression"). doing wrong? you want use string textbox.text property for example file.writealltext(path, textbox1.text); or file.writealltext(path, (sender textbox).text); and sounds want create button , assign click event , use save text textbox file, , appendalltext may better option. private void button1_click(object sender, eventargs e) { file.appendalltext(path, textbox1.text); }

How to fix this PHP Forgotten Password Script? -

so basically, i'm trying make simple, yet secure, forgotten password script. there 2 scripts, 1 allows user enter email address. send them email link must visit save new password. the second script link leads to. script saves new password. for security purposes, made new table within database called 'token'. has 3 fields; token, email, used. token random generated string of 10 letters , numbers, email users email address, , used integer of either 1 or 0 indicating whether or not token has been used. you able understand far more of structure once read on 2 scripts. not long, , not complex @ all. what going wrong okay, there 1 small thing going wrong, , within reset-password.php script. users come after receive email. basically, type in new password, , click 'reset password', yet nothing happens. no errors or confirmations shown, along nothing changing within database. can't seem debug this, , have been searching , trying hours now. , suggestions a...

unit testing - Python Selenium run multiple tests in one browser instance? -

how can run multiple tests different modules in 1 browser instance in selenium? example, if have test login, , tests action after logging in, can string these tests together? webdriver logs in first, conducts second test? i'm using python 2.7.5 write tests. thanks! ~carpetfizz this depends on capabilities of test runner. nose test framefowrk allows define package level setup methods module, class, , method setups. another method manually providing browser instance class described in this answer similar question.

android - database "CREATE TABLE IF NOT EXISTS" syntax error -

my code contains database class.while running shows error regarding create table if not exists statement.please give me solution correct error. clasdbopenhelper.java package example.events1; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class classdbopenhelper extends sqliteopenhelper { public static final string key_rowid = "_id"; public static final string key_desc = "countdesc"; public static final string key_date = "countdate"; public static final string key_event = "countevent"; public static final string database_name= "countdb"; public static final string database_table = "countable"; public static final int database_version = 1; public classdbopenhelper(context context) { super(context, database_name, nul...

How to pass jquery values to php without page loading -

i want pass jquery value "selected" fetchdata.php without reloading page. how can this? here code: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.min.js" type="text/javascript"> </script> <script> $(document).ready(function() { $("#buttonclass").click(function() { getvalueusingclass(); }); }); function getvalueusingclass() { var chkarray = []; $(".chk:checked").each(function() { chkarray.push($(this).val()); }); /* join array separated comma */ var selected; selected ...

image - how to design layout in R ? -

Image
i have use layout fit 4 image in 1 plot. ist : 1 image iind : 3 images layout(matrix(c(1,1,2,3), 2, 2, byrow = true)) plot(x, y) hist(x,y) plot(x*x,y*y) plot(sqrt(x),sqrt(y)) but output image not expected. how can fix this? i expect image shown below. here required code question: layout(matrix(c(1,1,1,2,3,4), 2, 3, byrow = true)) what first image occupies whole first row denoted 1 , second, third , fourth images occupies 1st, 2nd , 3rd columns of second row respectively. total 6 cells in matrix there (2*3, 2 rows , 3 columns).

memory management - Difference between return values of alloc_pages() and get_free_pages() -

why require alloc_pages() return pointer struct page unlike other memory allocator function (get_free_pages(), kmalloc() ) ? please provide use case. related highmem zone allocation? alloc_pages(mask, order) allocates 2order pages , returns instance of struct page represent start of reserved block. alloc_page(mask) shorter notation order = 0 if 1 page requested. __get_free_pages(mask, order) , __get_free_page(mask) work in same way above functions return virtual address of reserved memory chunk instead of page instance. kmalloc(size, mask) reserves memory area of size bytes , returns void pointer start of area. if insufficient memory available (a improbable situation in kernel 1 must catered for), null pointer result. mask specifies details request: • memory zone • behavior of allocator (blocking/unblocking request, etc.) • e.g. gfp_kernel, gfp_atomic, gfp_dma, etc alloc_pages() , __get_free_pages() : allocate pages, @ low level kmalloc() : allocate physical...

jquery - Adding classes to my Nav bar -

looking bit of jquery, looking add class first ul under nav tag , looking add different class every li parent ul. the code nav bar below, current jquery code doesn't seem want work. i have add them jquery due platform developing for. thanks in advance george <nav class="uk-navbar" id="navbarnav"> <ul add class here> <li class="uk-active"><a href="index.html" rel="self" id="current">home</a></li> <li add class here><a href="page1/index.html" rel="self">page2</a> <ul> <li><a href="page1/page4/index.html" rel="self">sub1</a></li> <li><a href="page1/page5/index.html" rel="self">sub2</a></li> </ul> </li> <li><a href="page2/index.html" rel="self">page3...

javascript - Cross server File Upload in IE 8/9 for ASP.Net WebAPI -

i have read tons file upload ie 8/9. however, have not been able create solution case. pretty new programming web stem lack of knowledge protocols , such. on server side have asp.net webapi: api meant handle file uploads, works fine when using fiddler , direct calls server. on client use html (not html 5), , knockoutjs. because of architecture in place, there 2 servers: 1 serving clients , other misc. activities (lets call a), , hosts file upload api , manages large volumes of data (server b). i have page on client (coming a) uploads files 2nd server (server b). i came across jquery.form.js , read supports ie uploads well. tried implementing code tutorial site . unfortunately not work , browser shows following error: options http://b/files/post/3/g/ 404 (not found) jquery.js:8724 send jquery.js:8724 jquery.extend.ajax jquery.js:8154 fileuploadxhr jquery.form.js:321 $.fn.ajaxsubmit jquery.f...

php - Run/Execute CasperJS script by clicking a button on webpage -

i have casperjs script returns json when run on commandline. want have arrangement such 1) create webpage 2) on clicking button on webpage casperjs scripts gets executed @ server side , post/return result webpage. how can same. edit: invoking ajax process written in php on clicking buttom. php script contains echo exec('casperjs sample.js'); returned nothing on checking webserver error log got error 'casperjs' not recognized internal or external command, operable program or batch file. ps: running absolutely fine via commandline. edit2 changed php script to: echo exec('c:\casperjs\batchbin\casperjs .\sample.js'); error got modified : 'phantonjs' not recognized internal or external command, operable program or batch file. i have found solution post on google group https://groups.google.com/forum/#!topic/casperjs/7lps6tix-78 it worked moving casperjs & phantomjs executable file in directory server (/html)

c++ - Have a header only project as a dependency with bjam -

i have bjam project consists of header files. want include these dependency in separate jamfile unless make collection of headers library (by adding single *.cpp) don't see how can this. possible? you shouldn't have to, unless you're doing weird preprocessor , #include 's. bjam knows how scan source files #include 's , automatically rebuilds them whenever headers change. if that's not happening you, should ask on boost.build mailing list .

wcf - String In XML body with no header -

i have wcf service several methods. log raw request came in client regardless of how sent. using below method public message createmessage(message message) { messagebuffer buffer = message.createbufferedcopy(int32.maxvalue); var messagecopy = buffer.createmessage(); console.writeline(messagecopy.tostring()); return buffer.createmessage(); } public object afterreceiverequest(ref system.servicemodel.channels.message request, system.servicemodel.iclientchannel channel, system.servicemodel.instancecontext instancecontext) { request = createmessage(request); return null; } i xml in result , string in body headers want string in body no header @ all. can me in regard. finally sort out , solution overwrite body writer class. please find detailed solution below. namespace wcfserviceraw { // note: can use "rename" command on "refactor" menu change interface name "...

iphone - Can capture session in avcam have multiple objects at a time -

here using avfoundation framework record video ,and i'm trying use both front , cam @ time here if front cam works cam freezing @ first frame , vise versa.can capturesession have multiple objects @ time.here code can 1 me please. - (void)viewdidload { [super viewdidload]; self.view.frame = cgrectmake(0, 0, 320, 568); self.view.backgroundcolor = [uicolor clearcolor]; activeindicatorview = [[uiview alloc]initwithframe:cgrectmake(0, 0, 320, 250)]; activeindicatorview.backgroundcolor = [uicolor clearcolor]; [self.view addsubview:activeindicatorview]; activeindicatorviewback = [[uiview alloc]initwithframe:cgrectmake(0, 290, 320, 250)]; activeindicatorviewback.backgroundcolor = [uicolor greencolor]; [self.view addsubview:activeindicatorviewback]; tracksarray = [[nsmutablearray alloc] initwithcapacity:2]; [self startrecording]; } -(void)startrecording{ [self startcameratwo];//front camera [self startcamera];//back camera } -(void)startcamera{ // nslog(@...