Posts

Showing posts from March, 2015

jquery unwrap a ul nested inside another with the same id -

hello html looks (i didn't make mistakes 1 ul nested inside next , both have same id) <ul id="members-list"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <ul id="members-list"> <li>5</li> <li>6</li> <li>7</li> <li>8</li> </ul> </ul> i want use jquery().unwrap(); remove second ul , closing tag. leave li elements you have made 2 mistakes there can not more 1 element having same id. ul can not immediate child of ul. but if want remove nested ul try following line. $("#members-list ul li").unwrap() look @ jsfiddle

python - list comprehension joining every two elements together in a list -

how convert lst1 lst2 joining element 1 element 2 , on. lst1=[' ff 55 00 90 00 92 00 ad 00 c6 00 b7 00 8d 00 98 00 87 00 8a 00 98 00 8f 00 ca 01 78 03 54 05 bf'] to lst2=[ff55, 0090, 0092, 00ad, 00c6, 00b7, 008d, 0098, 0087, 008a, 0098, 008f, 00ca, 0178, 0354,05bf] tried not expiated in lst: lstnew = [] templist = i.split() lenlist = len(templist) #print templist index = 0 while (index < lenlist): print templist[index] + templist[index+1] index = index + 2 is ok: >>> lst = ['ff', '55', '00', '90', '00', '92', '00', 'ad', '00', 'c6', '00', 'b7', '00', '8d', '00', '98', '00', '87', '00', '8a', '00', '98', '00', '8f', '00', 'ca',

Multiple selection of dropdown menu and direct to a link -

i looking javascript or in jquery custom dropdown menu <form name="menu"> <select onchange="location = this.options[this.selectedindex].value;"> <option value="" selected="selected">courses</option> <option value="http://www.google.com">course1</option> <option value="http://www.youtube.com">course2</option> <option value="http://www.yahoo.com">course3</option> </select> <select onchange="location = this.options[this.selectedindex].value;"> <option value="" selected="selected">location</option> <option value="http://www.google.com">location1</option> <option value="http://www.youtube.com">location2</option> <option value="http://www.yahoo.com">location3</option> </s

python 2.7 - no module named http.server -

here web server class : import http.server import socketserver class webhandler(http.server.basehttprequesthandler): def parse_post(self): ctype, pdict = cgi.parse_header(self.headers['content-type']) if ctype == 'multipart/form-data': postvars = cgi.parse_multipart(self.rfile, pdict) elif ctype == 'application/x-www-form-urlencoded': length = int(self.headers['content-length']) postvars = urllib.parse.parse_qs(self.rfile.read(length), keep_blank_values=1) else: postvars = {} return postvars def do_post(self): postvars = self.parse_post() print(postvars) # reply json self.send_response(200) self.send_header("content-type", "application/json") self.send_header("access-control-allow-origin","*"); self.send_head

vba - I am getting out of script error, why? -

here code sub logic() 'declaring variables dim r long, long, k long, l long dim num() long dim del() long 'assigning values r = 2 = 0 k = 0 l = 0 redim num(0) redim del(0) until cells(r, 11).value = "" num(i) = cells(r, 15).value 'i m getting error on here del(l) = k - num(i) k = num(i) = + 1 redim preserve num(i) 'preserve value r = r + 1 l = l + 1 loop r = 2 l = 0 ubound(num) - 1 cells(r, 25).value = del(l) r = r + 1 next l end sub you growing num array forget same del array. believe need modify code this: i = + 1 redim preserve num(i) 'preserve value r = r + 1 l = l + 1 redim preserve del(l) ' add line

android - Sending an Audio file and a Text message to WhatsApp -

i want send mp3 file , text message contact on whatsapp. while able send either mp3 file or text message not able send them both together. here doing send text message :- intent waintent = new intent(intent.action_send); waintent.setpackage("com.whatsapp"); waintent.settype("text/plain"); waintent.putextra(intent.extra_text, text); startactivity(intent.createchooser(waintent, "share with")); and send mp3 file :- intent waintent = new intent(intent.action_send); waintent.settype("audio/*"); waintent.setpackage("com.whatsapp"); waintent.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(waintent, "share with")); please suggest way can send them both.

sql - How to optimize a MySQL table? -

this question has answer here: optimizing simple mysql select on large table (75m+ rows) 2 answers i'm looking way improve performance of table. below mysql table. +----------+-------------+------+-----+---------+----------------+ | field | type | null | key | default | | +----------+-------------+------+-----+---------+----------------+ | receiver | varchar(15) | no | | null | | | depcode | varchar(12) | no | | null | | | sms | text | yes | | null | | | billable | varchar(5) | yes | | null | | | smsc | varchar(10) | yes | | null | | | senddate | date | yes | | null | | | sendtime | time | yes | | null | | | id | int(11) | no | pri | null

parsing - group array of dictionaries by date from xml in iOS -

here code. please help. nsdictionary *xmldict = [nsdictionary dictionarywithxmlstring:str]; nsarray *fixtureslist1 = [[xmldict objectforkey:@"matches"] objectforkey:@"ematches"]; nsmutabledictionary *dictionarybydate = [nsmutabledictionary new]; for(nsdictionary *dictionary in fixtureslist1) { nsstring *datestring = dictionary[@"matchdate"]; nsmutablearray *arraywithsamedate = self.resultssection[datestring]; if(! arraywithsamedate) { arraywithsamedate = [nsmutablearray new]; self.resultssection[datestring] = arraywithsamedate; } [arraywithsamedate addobject: dictionary]; } //nslog(@"dictionarybydate:%@",self.resultssection); nssortdescriptor *descriptor=[[nssortdescriptor alloc] initwithkey:@"self" ascending:no]; nsarray *descriptors=[nsarray arraywithobject: descriptor]; reverseorder=[[self.resultssection allkeys] sortedarrayusingdescriptors:descriptors]; nslog(@"results:%@",rev

java - Dedicated MySql server works with app engine -

i know appengine application runs in restricted " sandbox " environment can access limited resources like request execution time limit 60 sec (which speed optimization purpose) read external file can not write ,etc appengine provides high replication datastore ,which store data hard mange number of quires perform simple operation insert, update, delete , update uses nosql(basically jpa , jdo). because of decide go mysql,i know google provide cloud sql instance uses mysql5.6 ,i searched alot on , in post found possible restriction while post says not possible because of limitation of sandbox environment,so confusing . during development 1 can use local mysql instance detail provide on link ,but want use external mysql instance hosted on ourserver it possible use dedicated (external/local) mysql server app engine(for production not development)? thanks in advance!!!!!! google app engine has socket api allows outbound sockets paid apps, possibl

post - 500 XSRF token mismatch (null). Session may be expired -

i trying call rest api creating cart /api/v1/cart on post method. tried , without customer id. still facing error. there configured?? great. below isthe stackrace of jetty server http error 500 problem accessing /api/v1/cart. reason: xsrf token mismatch (null). session may expired. caused by: org.broadleafcommerce.common.exception.serviceexception: xsrf token mismatch (null). session may expired. @ org.broadleafcommerce.common.security.service.exploitprotectionserviceimpl.comparetoken(exploitprotectionserviceimpl.java:122) @ org.broadleafcommerce.common.security.handler.csrffilter.dofilter(csrffilter.java:79) @ org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:342) @ org.springframework.security.web.authentication.logout.logoutfilter.dofilter(logoutfilter.java:105) @ org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(filterchainproxy.java:342) @ org.springframework.security.w

jquery - Can't get magnific popup to work, two javascript errors -

i trying make lightbox gallery , have used example source code. here documentation read over: http://dimsemenov.com/plugins/magnific-popup/documentation.html uncaught typeerror: undefined not function uncaught referenceerror: $ not defined i not sure errors mean or them. in video tutorial watched, said jquery conflict being potential problem. on different page of website, used kwicks sliding menu (which used jquery). that's thing can think of. i appreciate able give me! thank you! there no more errors, need make hovering on image work zooming in magnifying cursor. have made hovering work, need make zooming in magnifying cursor work. have attached page of what cursor when hovers. example: http://dimsemenov.com/plugins/magnific-popup/ have figured out zoom cursor! help! the documentation of plugin magnific popup using suggests - including files <!-- jquery 1.7.2+ or zepto.js 1.0+ --> <script src="//ajax.googleapis.com/ajax/libs/j

c# - How can I to check a property will be renewed or its value will be changed -

how can check property renewed or value changed. public myclass { get{} set { // find if programmer set a=new myclass(); } } it's not clear want exactly, maybe this: myclass _a; public myclass { { return _a; } set { // find if programmer set a=new myclass(); if (value != _a) { // different value } } } for more complex scenario follow suggestion of raphaël althaus , take @ inotifypropertychanged .

javascript - AngularJS return value from factory to controller out of Promise -

i have http request setup promise in .factory , send result controller. stuck getting data out of promise , somewhere can use it. .controller .controller('mainctrl', function ($scope, main, user) { $scope.feedresult = function () { var feeds = []; return main.feed(key).success(function (data, status, headers, config) { (var = 0; < data.length; += 1) { feeds.push(data[i]); } return feeds; }).error(function (data, status, headers, config) { console.log("this error server"); console.log(data); return data; }); }(); }) and .factory feed: function (token) { return $http({ url: 'http://myserver.com/feed', method: 'get', data: { auth_code: token, per_page: 10 } }).success(f

Automation of Cygwin configuration with PowerShell -

i have installed cygwin using powershell scripting. i doing following step manually: running new cygwin bash shell (after edit of cygwin.bat ) , enter: mount --change-cygdrive-prefix / chmod +r /etc/passwd /etc/group chmod 755 /var start cygwin bash shell , run ssh-host-config . answer yes key generation questions. is possible automate these things in powershell scripts, installing cygwin, doing steps 1 , 2 in single shot? use command: bash.exe ssh-host-config --yes -u "cygwinuser" -c "binmode ntsec tty" -w "pwd@123" cygrunsrv -s sshd later go services.msc check if service running or not

javascript - Node.js process.exit() does not exit cleanly, and the dangers of async fs.writeFile -

tl;dr: calling asynchronous fs.writefile asynchronous events (and perhaps plain old loop) , calling process.exit() opens files fails flush data files. callbacks given writefile not chance run before process exits. is expected behavior? regardless of whether process.exit() failing perform cleanup, call question whether should node's duty @ least attempt work file writes schedule, because may case deallocation of huge buffers depends on writing them out disk. details i have conceptually basic piece of node.js code performs transformation on large data file. happens lidar sensor's data file, should not relevant. dataset quite large owing nature of existence. structurally simple. sensor sends data on network. task script produce separate file each rotating scan. details of logic irrelevant well. the basic idea use node_pcap read huge .pcap file using method given task node_pcap, "offline mode". what means instead of asynchronously catching network pac

ruby on rails - Add param to link_to show method -

i have current code in traders.index.html file <ul> <% @traders.each |trader| %> <li><%= link_to trader.name, trader %></li> <%end%> </ul> i want add parameter sent through, tried <li><%= link_to trader.name, trader, {:restricted => params[:s]} %></li> but doesn't send parameter, whats actual format of link_to done? you can do: <%= link_to trader.name, trader_path(trader, restricted: params[:s]) %>

C++ runtime API -

i want create application that, when executed, has runtime functions accessible other applications. for example, c++ application stores values in files , retrieves information. while application running, other c++ applications access it's save , retrieve functionality save , retrieve data, should have no other connection system. sounds simple job web services, or remote database, or ldap server. store , retrieve operations common of these. if goal learn specific technology, ask more specific question. otherwise, don't reinvent wheels. there plenty of things out there store , retrieve. one of simplest "store , retrieve" apis know of berkeley db or sleepycat. we built giant, clustered, simple key based database major telecom company using ldap on top of berkeley db (aka sleepycat). open-source software , commodity hardware , supports mission critical operations millions of customers. a more modern rendition of might use memcached well. if go h

haxe - Class not found : helloworld.Main -

Image
i began learn haxe, have encountered compile error. main.hx package helloworld; import js.lib; class main { static function main() { lib.alert("hello world"); } } please careful target class helloworld.main . build.hxml -js bin/helloworld.js -cp src -main helloworld.main -debug build process log building helloworld_p140627 running pre-build command line... cmd: c:\haxetoolkit\haxe\haxe.exe x:\tmp\helloworld_p140627\build.hxml class not found : helloworld.main build halted errors. done(1) why? class helloworld.main surely exist. cannot "hello, world"? update can see screenshot of project: you trying compile "helloworld.main", means class called "main" in package "helloworld", haxe looking file called "helloworld/main.hx" in "src/" directory. however have "src/main.hx", not "src/helloworld/main.hx". create subfolder called "helloworld&quo

javascript - Kendo Grid: add new row with nested object stopped working -

i'm filling kendo data grid nested json way: https://stackoverflow.com/a/24441318/535556 everything works fine until click on "add new row" button. then receive console error message: "uncaught typeerror: cannot read property 'street' of undefined " i ask how format data obtain nested json object updated data? many advice. when add new row without having defined schema model datasource, object being created not yet have "address" field. column "address.street" attempting "street" field "address" field of new object undefined @ point, hence error. the bad news schema model definition doesn't lend nested types. news can define "address" field defaultvalue of {} , grid editor should happy. $("#mygrid").kendogridex({ ... columns: [ { field: "address.street" }, { field: "address.city" }, { field: "address.st

node.js - How to find a session from MongoDB collection using Express and MongoStore -

i implementing session store using node/express/mongo. problem cannot retrieve sessions sessions collection, unable determine whether user has logged in. i using mongoskin, mongostore, , mongo-connect, although don't mind using mongoose , other tools. here debug output: // check whether current user has session. // if so, adds "currentuser" request. // else, redirect login page. function loaduser(req, res, next) { console.log("loaduser: checking loaduser..."); var db = req.db; console.log("current req.session.token:"); console.log(req.session.token); console.log("current req.session:"); console.log(req.session); if (req.session.token) { // session id in database 'sessions' collection. db.collection('sessions').findone({token : req.session.token}, function(err, user) { console.log("found user looking token:"); console.log(user);

COBOL plugin reports parse errors -

our team running sonarqube instances variety of languages (java,pl/sql,c,c++). recently asked run code quality analysis on cobol code. we have received cobol code development team , ran jenkins job. during analysis see parsing errors . next no issues found according analysis. that first time not encounter issues in analysis suspicious , wonder if cobol code parsed in correct way. fyi not have cobol background ourselves. i have pasted below of errors shown during analysis. in end analysis reports: 09:01:51.131 info - 2/2 files analyzed , since not cobol experts wonder if code analyzed corretly? details: cobol plugin: 1.17 sonarqube: 3.7.3 questions raised towards development team: the cobol dialect (e.g : cobol-2002, microfocus, acucobol,tandem,gcos): tandem/nonstop cobol85 - t9257h01 - (15 mar 09), scobolx screen cobol - t0528h01 - (01feb2009), , ecobol (same cobol85, different system procedure calls) what filename structure (e.g : myfile

android - How to a add button to view -

i developing game, , have class extended view(not xml file). want add button custom view, extended view has not addview method. how can this? your class has extend viewgroup , not view. if want keep class extend view have possibility create object extends viewgroup (for example: linearlayout, relativelayout...). put costum view , button viewgroup.

Can't run DevForce Windows Store sample Application -

i trying run devforce windowsstoredevtour sample application. getting exception: system.typeinitializationexception unhandled user code hresult=-2146233036 message=the type initializer 'windowsstoredevtour.northwindibentities' threw exception. source=windowsstoredevtour typename=windowsstoredevtour.northwindibentities stacktrace: @ windowsstoredevtour.northwindibentities..ctor(boolean shouldconnect, string datasourceextension, entityserviceoption entityserviceoption, string compositioncontextname) @ windowsstoredevtour.dataservice..ctor() @ windowsstoredevtour.dataservice.get_instance() @ windowsstoredevtour.listpage.d__0.movenext() innerexception: system.typeinitializationexception hresult=-2146233036 message=the type initializer 'ideablade.entitymodel.entitymetadatastore' threw exception. source=ideablade.entitymodel.winrt typename=ideablade.entitymodel.entitymetadatastore stacktrace:

javascript - Express.js multilanguage with i18n-node -

how call controller express.js routing? app.get('*', function(req, res, next) { var regexp = /^\/([a-z]{2})(\/|$)/gi, exec = regexp.exec(req.url); exec = exec != null ? exec[1] : undefined; if(exec == undefined) { // add language prefix link } else { i18n.setlocale(exec); // add language prefix link } next(); }); if open page /about need url this: http://example.com/en/about . how can , how display call 'about' controller? app.get('/about', function(req, res) { console.log('here about'); res.send('hello, world'); }); not suitable: app.get('(en|de|ru)/about', ...) thanks in advance. you like app.get('/:language/about', function(req, res) { var language = req.params.language; i18n.setlocale(language); }); for multiple routes maybe this controllers.js module.exports = { about: function(req, res) { res.send('abo

asp.net - Visual Studio 2013 debug session stops 1 minute after logging in with AspNet Identity -

maybe answer trivial, couldn't find exact same behavior in other threads. have mvc 5 web application. implemented custom identity database asp.net identity 2 (owin). have external login (facebook, google...etc). login works fine. users got authenticated roles , everything. after 1 minute of inactivity, visual studio 2013 debug session stops. application remains available (so iis app pool not stopped) recycles iis well. i implemented logging in application_end global.asax method in order have shutdown reason, in these cases there no info in logs. in other cases, when app pool recycled due web.config change have info in logs. i suspect timeout, have no clue kind of timeout be. should look? thanks in advance. open iis, find application's apppool, then: right click on app pool , select advanced settings under "process model" set idle time-out (minutes) 0. for reference, non-default (non-bold) settings in "process model" , "recy

cassandra - sstableloader does not transmit the data, and refer to the weirf ports -

i want bulkload cassandra data node node b. when set ' listen_address ' of each cassandra.yaml file localhost, not show error on console data never transmitted. when set each node's listen address own local network[eth1 ipv4]address (192.168....), following error. i can read error log the application trying access port 1..4 , not have no idea on earth going on. each node on virtual machine on virtual box hypervisor. both os centos. [vagrant@localhost conf]$ ../bin/sstableloader -v -d 192.168.33.12 -p 9160 /db/data/m oomin/hoahoa2/ streaming revelant part of /db/data/moomin/hoahoa2/moomin-hoahoa2-hf-69-data.db [/192.168.33.12] progress: [/192.168.33.12 0/1 (0)] [total: 0 - 0mb/s (avg: 0mb/s)] warn 16:55:42,655 failed attempt 1 connect /192.168.33.12 stream /db/data/moomin/hoahoa2/moomin-hoahoa2-h f-69-data.db sections=1 progress=0/378000000 - 0%. retrying in 4000 ms. (java.net.sock

filesystems - ZFS Blocksize (recordsize) and primarycache issue -

on website: http://www.patpro.net/blog/index.php/2014/03/19/2628-zfs-primarycache-all-versus-metadata/ the person shows switching primarycache or metadata, gets wildly different read performance when using antivirus. however, shows read bandwidth has vast difference too. i create 2 brand new datasets, both primarycache=none , compression=lz4, , copy in each 1 4.8gb file (2.05x compressratio). set primarycache=all on first one, , primarycache=metadata on second one. cat first file /dev/null zpool iostat running in terminal. , finally, cat second file same way. the sum of read bandwidth column (almost) physical size of file on disk (du output) dataset primarycache=all: 2.44gb. other dataset, primarycache=metadata, sum of read bandwidth column ...wait it... 77.95gb. he says anonymous user explained this: clamscan reads file, gets 4k (pagesize?) of data , processes it, reads next 4k, etc. zfs, however, cannot read 4k. reads 128k (recordsize) default. s

javascript - How to make a list of elements on 2 columns with equilibrated height? -

Image
i have list of articles have presented on 2 columns. everything ok except height of articles different , result can have column lot more longer other one. it’s not big issue result not clean. can see picture attached see. it’s because, before make loop, count articles , divide result 2 : this code (a little bit more complicated in template it’s html stuff) // make query number of articles $count_articles = 20; $i = 0; if ($i == 0) { echo '<div class="column_1">'; } if ($i <= 10) { echo '<div style="float:left;width:350px;">'; echo $articles echo '</div><div style="clear:both;"></div>'; $i++; } if ($i == 11) { //close column_1, open column_2 echo '</div><div class="column_2">'; } if ($i >= 11 && $i <= 20) { echo '<div style="float:right;width:358px">'; echo $articles echo '

c# - Method should throw exception but it doesn't -

i wrote small extensionmethod finds indexes of given string in ienumerable. public static ienumerable<int> findindexesof(this ienumerable<string> itemlist, string indexestofind) { if (itemlist == null) throw new argumentnullexception("itemlist"); if (indexestofind == null) throw new argumentnullexception("indextofind"); list<string> enumerable = itemlist list<string> ?? itemlist.tolist(); (int = 0; < enumerable.count(); i++) { if (enumerable[i] == indexestofind) yield return i; } } as can see above, argumentnullexception thrown if itemlist null. plain , simple. when running unittest on above method, expect , exception of type argumentnullexception, because itemlist null. however, test comes out false because no exception gets thrown. how possible? logic seems quite clear. see test below. [testmethod] [expectedexception(typeof(argumentnullexception))] public void fin

python - Default parameter value for objects -

python provides way set default value function parameters. example is: def f(x=3): print(x) this primitive type, lets try objects: def f(x=list()): print(id(x)) f() 44289920 f() 44289920 same object! surprised of being used c/c++ way. done that, understand default value not build @ invoking time @ definition time. so came solution: def f(x=list()): if len(x) == 0: x = list() print(id(x)) solved! @ price: in opinion doesn't seem clean solution. solution rely in use of len(x) == 0 way identify default value ok function not others solution can generalized as: def f(x=none): if x none: x = list() this can shortened to: def f(x=none): x = x or list() # bit shorter version my question is, there shorter or better way solve problem? ever be? i still prefer none approach, here new option think about: if defined type, create new instance of it. def f(x=list): if isinstance(x, type): x = x()

ios - how to make cordova webview auto orientation -

i have extended cordovawebview in ios , custom view doesn't rotate automatically based on device orientation. want ask how can custom webview responded device orientation. if developing ios app webview can set webview autoresizing mask as //autoresizemask webview.autoresizingmask = uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight; or if developing phonegap application ios or android, need modify .plist file in ios , manifest file android. on iphone add -info.plist: <dict> <array> <string>uiinterfaceorientationportrait</string> <string>other orientations like</string> </array> </dict> on android androidmanifest.xml check link

ios8 - How to load html string by use WKWebView -

how load html string use wkwebview. i found loadrequest method. way can think of save html string file, , load nsurlrequest ....... in beta 3 found in wkwebview /*! @abstract sets webpage contents , base url. @param string string use contents of webpage. @param baseurl url used resolve relative urls within document. @result new navigation. */ func loadhtmlstring(string: string!, baseurl: nsurl!) -> wknavigation! so can load html string did uiwebview

android - Difference between removing a view and setting it's visibility as GONE? -

what difference between removing view it's parent , setting it's visibility gone? if remove view parent, no longer in list of children. can add other viewgroup. if loop through old paren't children won't come up, , won't called when viewgroup things resize itself. if make gone, still child of viewgroup. can't added another, because can have 1 parent. still called things resizing of view group.

Java EE: EJB vs JavaBean? How to organize my classes in a web project? -

i developed java application 3 classes , main. have web interface in order replace main. example : function (in 1 of classes) called html button , result visible in combo list. then, used java ee but, after reading severals tutorials, begin mix everything. classes must modified respect java ee model? understand must either ejb or javabean. how know type belong? a bean java object managed container. container environment in deployed project. there various possible container, spring, servlet container, java ee one... the same java class may managed bean if deployed in jsf project or cdi 1 ; or ejb bean if deployed in ejb project ; or spring bean if application using spring ioc container, it's matter of configuration (using annotation or xml configuration). to deploy project web project need web server (tomcat, jetty...) or java ee 1 (glassfish, jboss...) or lightweight http server ( https://github.com/codestory/fluent-http example). i'd advise use tomcat ,

apache pig - Pig Writing too many records in a single file -

i reading huge file 4.4 million records. want split 2 records 4 million records , .4 million records based , want store them. the logic : read huge file 4.4 million records . split 2 relations , b (1:10 ratio) union relations c = union a, b store c . the issue c contain 2 part-m-* files . 1 .4 million records , other 4 million records . now, thing takes lot of time write these files . if dont union , store , b seperately in 2 files , faster. want mappers output fast. for , need more mappers , want mappers output specific relation written multiple files . hoow can ensure ?

c# - Set same value to an array/list without using a for loop -

i want set same value specific range of array or list without using loop. follows: int[] myarray = new int[100]; int lower = 20; int upper = 80; int value = 5; myarray.method(lower,upper,value); i have tried myarray.setvalue() , mylist.insertrange() allows set 1 value, not range. is c#-method doing task? done without loop? well, create temporary array in right size , copy source array array.copy(enumerable.repeat(value, upper-lower+1).toarray(), 0, myarray, lower, upper-lower+1); but that's inefficient (and, internally, enumerable.repeat uses loop, too) i don't see what's wrong simple for loop: for(int = lower; <= upper; i++) myarray[i] = value;

php - Retrieving value with Simple HTML DOM Parser -

how retrieve value simple html dom parser. example: <td class="tabdata" valign="top"><a href="anouncement.asp?s=51&id=1635872">some string</a>&nbsp;&nbsp;</td> i need value: some string . problem values 51 , id = "1635872" not constant. assuming dom in $dom : $value = $dom->find("td.tabdata a", 0)->plaintext

encoding - Save and load image from client to server with django -

here how send data client (coffeescript & dajaxice): imagedata = canvas.todataurl("image/png") dajaxice.draw.saveimage( @saveimage_callback, {'image': imagedata } ) here how save image on server (taken this answer ) @dajaxice_register def saveimage(request, image): imagedata = re.search(r'base64,(.*)', image).group(1) output = open('image.png', 'wb') output.write(imagedata.decode('base64')) output.close() i load image , send so: inputfile = open('image.png', 'rb') imagedata = inputfile.read().encode('base64') inputfile.close() return simplejson.dumps( { 'image': imagedata } ) but not give me exact same data, , client fails draw returned image. imagedata ends 2own9u2 when write it, , 2own when read (missing '9u2'). ok, difference of data not problem, works. here how draw returned image on client: saveimage_callback: (result)=> imagedata = 'da

php - Symfony form submission doesn't work -

i've been following this tutorial create registration form symfony 2.5. the difference made, additional field username in user class , rendering in usertype form. when submitting form account_create -route (which uses create action in account controller) won't handle form. page shows blank, not profiler shows anymore. additionally seems script breaks apache (i'm running locally on windows via xampp ), try after submitting form once results in endless loading. means no matter page on server try access next (even if it's profiler), can't. keeps loading forever (i've been waiting on 10 minutes once). apache restart helped then. this createaction inside account controller // 'account_create' route // testbundle:account:create public function createaction(request $request) { $em = $this->getdoctrine()->getmanager(); echo "doctrine managed. "; $form = $this->createform(new registrationtype(), new registration()

sql - How to use a common cursor in PLSQL script for multiple tables in same definition -

there 4 table in db a, b, c , d. tables has exact same structure. need use same set of procedures process table , generate single file several utility procedures available in design need pass row parameter procedure. what best way implement plsql script purpose ? please provide high level overview? note: basic problem use common cursor , common rowtype this. oracle native dynamic sql it's easy way query table using fixed set of parameters , result variables (including records): execute immediate 'select ... ' || table_name || ' ....' using in_par_1, in_par2, out out_par_1, ...; open <cursor> 'select ... ' || table_name || ' ....' using ...; loop fetch <cursor> ...; exit when <cursor>%notfound; ... end loop (and others ways dynamic data exchange provided). the biggest nds problem lack of compile-time error checks, might not easy support , there risk break , don't notice that. in

mysql constant number between and -

does mysql support ? select sa.*, st.starttime, st.endtime, st.locationid, st.id timingid ccf_session_attendee sa left join ccf_session_timing st on st.id=sa.timingid "2014-11-02 07:00:00" between date_add(starttime, interval 1 minute) , date_sub(endtime, interval 1 minute) i couldn't figure out wrong , cant result. table have record starttime 2014-11-02 06:00:00 , endtime 2014-11-02 10:00:00 . you have error quotes. try this: select sa.*, st.starttime, st.endtime, st.locationid, st.id timingid ccf_session_attendee sa left join ccf_session_timing st on st.id=sa.timingid '2014-11-02 07:00:00' between date_add(starttime, interval 1 minute) , date_sub(endtime, interval 1 minute)

java - webdriver findElement throws NoSuchElementException even though its inside try/catch -

i have problem method throwing nosuchelementexception when driver can't find element "error-row". use method in 2 cases. 1 should return true, , 1 should return false. se why throwing exception? public boolean iserrormessagepresent() { try { driver.findelement(by.classname("error-row")); return true; } catch (nosuchelementexception e) { return false; } } edit: i pointing nosuchelementexception java.util library. changed this: catch (org.openqa.selenium.nosuchelementexception e) , worked!

Test card numbers for balanced payments -

we planning integrate our website balanced payment gateway, know how can test credit card transactions. have list of test card numbers can test card related scenarios. test card numbers listed in documentation. https://docs.balancedpayments.com/1.1/overview/resources/#test-credit-card-numbers

node.js - Error: Failed to find request token in session for passport-twitter -

following error getting when using passport-twitter - error: failed find request token in session @ strategy.oauthstrategy.authenticate (/myproject/node_modules/passport-twitter/node_modules/passport-oauth1/lib/strategy.js:142:54) @ strategy.authenticate (/myproject/node_modules/passport-twitter/lib/strategy.js:85:40) @ attempt (/myproject/node_modules/passport/lib/middleware/authenticate.js:337:16) @ object.authenticate [as handle] (/myproject/node_modules/passport/lib/middleware/authenticate.js:338:7) @ next_layer (/myproject/node_modules/express/lib/router/route.js:103:13) @ route.dispatch (/myproject/node_modules/express/lib/router/route.js:107:5) @ /myproject/node_modules/express/lib/router/index.js:205:24 @ function.proto.process_params (/myproject/node_modules/express/lib/router/index.js:269:12) @ next (/myproject/node_modules/express/lib/router/index.js:199:19) @ next (/myproject/node_modules/express/lib/router/index.js:176:38) f

SAP Hana SQL Type mapped to OData Edm.boolean -

in sap hana developer guide there list explaining sql - edm type mapping missing how map sql type edm.boolean, know how? in sap hana developer guide (sps 07) says odata implementation in sap hana xs supports only sql types listed in mentioned list/table. therefore edm.boolean not supported. a workaround use edm.byte instead of edm.boolean mapped tinyint hana sql type. if want have true/false or 0/1 value think tinyint sql type closest can boolean.

php - Yii soap webservice with input parameter -

i need pass special unique key (string) in constructor input of soap webservice made using yii framework. example of tried: class soapcontroller extends controller { private $uniquekey; public function __construct() { $this->uniquekey = $_get['uniquekey']; } public function actions() { return array( 'service'=>array( 'class'=>'cwebserviceaction', ), ); } /* * @return string result * @soap */ public function actiondemo() { if(isset($this->uniquekey)) return $this->uniquekey; else return 'key not set'; } } the wsdl url is: ../index.php/soap/service?uniquekey=sss displays wsdl data in browser. when call demo action method (with visual studio example) 'the request failed http status 404: not found.' at system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse respon