Posts

Showing posts from April, 2011

javascript - How to remove a class on click event? -

html: <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script type="text/javascript" src="app.js"></script> <title>prueba</title> </head> <body> <div class="prueba"></div> </body> </html> css: .prueba { height: 100px; width: 100px; background-color: green; } js (edited): var main = function() { $('.prueba').click(function() { $(this).removeclass('.prueba'); }); }; $(document).ready(main); it (still) doesn't work. can me? to select class, should preface class name dot: $('.prueba') jquery docs may want review.

Cannot connect CSS to my HTML -

i keep trying , trying have no idea issue is. linked picture of code showing source code , directory structure of site. got answer thanks you need move index.html page websitename directory. page trying find css directory inside of img directory , of course doesn't exist there.

grails - REST API Design for systems with multiple companies or organizations -

most of examples see implement rest url patterns http://www.app.com/books/1 access book id 1 or http://www.app.com/books access books. that's great, commonly work on applications support multiple companies. example, company abc has 2 users , company def has 2 users. user company abc creates book id 100 . when restful call comes in user @ company def : http://www.app.com/books/100 there need access exception, or http://www.app.com/books would list books belonging def (not new book id 100). many entities, book, company id part of table, other entities may not case. example, if there rest operation 1 chapter in book, http://www.app.com/chapter/333 chapter table have foreign key reference book not company. what best practices managing access resource? if def tried access chapter abc have construct query join chapter book verify company id valid. i'm using grails 3.x of logic abstracted , thinks happen "automagically". url comes in specific book id re

java - Looping into 2d Object array -

object [][] data = new object[4][4] ; (int =0;i<data.length;i++) { data[i]={"a","b","c","d"}; } is there way fill 2 day array way similar that, note: ,b,c , d different data can't use 2 loops fill array 'm searching close way when tried data[i]={"a","b","c","d"}; i thought going work reason didn't you need use "new" or give indexes something this: data[i]= new object[]{"a","b","c","d"}; or data[i][0] = "a"; data[i][1] = "b"; data[i][2] = "c"; data[i][3] = "d";

dump - Segmentation Fault C++, after parentheses operator -

i have class override parentheses operator. following code works: int main(){ .. a; cout << a({0.5}); .. } while following code doesn't work a fun(){ .. a; return a; .. } int main(){ .. a = fun(); cout << a({0.5}); } when execute second code, have following error: segmentation fault (core dumped) i can't understand why. edit: this overriding of operator: virtual arma::vec operator()(const inputc& input) override { const arma::vec& x = params.normalizationf->normalize(base::phi(input)); forwardcomputation(x); return params.normalizationo->restore(h.back()); } this constructor: ffneuralnetwork_(features_<inputc, denseoutput>& phi, unsigned int neurons, unsigned int outputs) : parametricregressor(phi, outputs), batchregressor_<inputc, arma::vec, denseoutput>(phi, outputs) { layerfunction.push_back(new sigmoid()); layer

image - Charting without using controller action in ASP.NET MVC -

i know how chart using controller action returns fileresult . my question is, possible move action view (cshtml) file helper? way view logic entirely contained in view. the problem is, without controller action, url can fill in img src attribute? or there different way, instead of img tag, display image stream? if core problem want load image data without url (whether url points controller , or static resource), can dump image data directly html using base64 embedding follows: public static mvchtmlstring embedimagewithbase64(this htmlhelper helper, byte[] imagebytes) { var base64data = convert.tobase64string(imagebytes); var imagesrcdata = "data:image/png;base64," + base64data; return new mvchtmlstring(string.format("<img alt="chart data" src=\"{1}\" />", imagesrcdata)); }

How do I write all the printed items in .txt file as an output in R -

suppose have hundreds of print statements , inside loop. although these print statements displayed while running code, want summarized output file written in realtime or @ completion of job. for example print("first print , write.txt") check<-1:50 for(i in 1:length(check)){ print(paste0("this want print , write output",i)) print(paste0("this want print , write output.txt",i)) } i check sink() function. can find information here http://www.statmethods.net/interface/io.html you can setup file want write, , can use cat() output information. can have output sent file , console.

ios - How can I write completion block with nullable? -

when call method nil, app crashes, want know how write nullable. crash [kptaxnoteapisavehandler saveentrywithuuid:uuid completion:nil]; ok [kptaxnoteapisavehandler saveentrywithuuid:uuid completion:^(nserror *error) {}]; this code. + (void)saveentrywithuuid:(nsstring *)uuid completion:(void (^ __nullable)(nserror * _nullable error))completion { nslog(@"saveentrywithuuid"); entry *entry = [entry mr_findfirstbyattribute:@"uuid" withvalue:uuid]; nsdictionary *params = @{@"entry[uuid]":entry.uuid}; [kptaxnoteapisavehandler postwithurl:kapiurlstringforentry params:params completion:^(nserror *error) { if (!error) { [magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { entry *entry = [entry mr_findfirstbyattribute:@"uuid" withvalue:uuid incontext:localcontext]; entry.needsave = @no; }]; } completion(error);

angularjs - Why will my Javascript run fine normally, but minnified, it won't? -

this question has answer here: angularjs minify best practice 6 answers i have webapp i'm developing uses front-end of html + javascript (angular 1.5.0) + css. website performs fine when run on localhost. have /index.html file. file imports javascript code this: <script src="/app/app.js"></script> but have implemented automated linting, uglifying etc. using grunt. grunt nicely converts single javascript file ( /app/app.cs ) minnified 1 ( /dist/js/app.min.js ). changed /index.html include minnified javascript instead: <script src="/dist/js/app.min.js"></script> . application stops working. , in browser's dev console, see following error: angular.js:68 uncaught error: [$injector:modulerr] failed instantiate module myapp due to: error: [$injector:unpr] unknown provider: http://errors.angularjs.org/1.5.0/$injector

javascript - How to remove data-toggle="modal" in specific window size? -

i beginner of javascript. want remove data-toggle attribute when screen size less 760px , make href working. have no idea how remove data-toggle attribute, below code: <div class="portfolio logo1 mix_all" data-cat="logo" style="display: inline-block; opacity: 1;"> <div class="portfolio-wrapper"> <a data-toggle="modal" data-target="#mymodal1" href="http://www.example.com/main/includes/onepager/business_service/example/index.php" class="b-link-stripe b-animate-go thickbox"> <img class="p-img" src="http://www.example.com/theme/mobile-page-files/web/images/small-portfolio/example.jpg" /> <div class="b-wrapper"> <h2 class="b-animate b-from-left b-delay03"> <img src="http://www.example.com/theme/mobile-page-files/web/images/link-ico.

PHP- insert innerhtml with javascript dynamically in each row of table -

innerhtml not working in case, want this: <table width="100%" border="0" id="table2"> <?php include("connection.php"); $sql=mysql_query("select* b1"); while($res=mysql_fetch_array($sql)) { $img=$res["img"]; $url=$res["url"]; ?> <tr> <td><script>document.body.innerhtml="<a href='"+<?php echo '$url' ; ?>.value+"'><img src='"+<?php echo '$img' ; ?>+"' / ></a>" ;</script></td> </tr> <?php } ?> </table> why don't this? <table width="100%" border="0" id="table2"> <?php include("connection.php"); $sql=mysql_query("select* b1"); while($res=mysql_fetch_array($sql)) { $img=$res["img&qu

javascript - JS: ArrayBuffer of Unknown Size -

i have big object want store in arraybuffer (let uint8array). note: not know how big object is. i have logic setting values in buffer. (it working if use new uint8array(100000000); example.) the problem don't know if resizing buffer efficiently possible. performance main preoccupation here. i've been thinking starting let new uint8array(100); , if need more, create new 1 double size new uint8array(200); , copy existing content on new 1 (not quite sure how). , on. what creating regular array , converting @ end uint8array ? if need 1 @ time still many per time , have need speed, need keep first array , overwrite it. can work out amount of memory need first 1 described (it not slow) keep array next ones (you'll need keep current length). every time need more, did first one. might want "free" memory time time when gets large. it poor-man's malloc() / garbage collector, yes, , assumes need of arrays strictly consecutive.

Save data to server data base in Android give unexpected error and close -

Image
i make application track geo location , save data server mysql database. when run application show unexpected error , close application. times geolocation not pointing. when comment save code geo location tracking working nicely. cant find exact problem in here code ///////////////// updated locations///////////// public void onlocationchanged(location location) { string msg = "updated location: " + double.tostring(location.getlatitude()) + "," + double.tostring(location.getlongitude()); toast.maketext(this, msg, toast.length_short).show(); loadsave(); // report ui location updated } public void loadsave() { string mydataurl = "http://myrul.com/savedata.php"; //string type = params[0]; try { string longi = "aaa"; // double.tostring(location.getlongitude()); string lati = "aare";//double.tostring(location.getlatitude()); string user = &

javascript - registration form while filled and send, it should automatically save the filled field as pdf in server and send the link to "TO ADDRESS" -

i have created big registration form many fields, if end user comes , fill , click "send" button, automatically pdf file has created same in "registration from" , save in server , saved path has mailed "to address". i tried lot on behalf of functionalities, cant able trigger out, suggest me best code this. many thanks for pdf part, use dompdf library there make pdf files, can use form values , generate pdf file , store server. and attachment in mail, can try link, http://www.sanwebe.com/2011/01/send-php-mail-with-attachment , 1 great tutorial.

handshake_failure connecting Java client through SSL to Tomcat server -

private void connect(httpsurlconnection uc) throws ioexception { uc.sethostnameverifier(new hostnameverifier() { public boolean verify(string host, sslsession sess) { return true; } }); uc.setrequestproperty("content-type", "application/json"); uc.setreadtimeout(15 * 1000); // 15 seconds uc.connect(); } it failing on clienthello: trigger seeding of securerandom done seeding securerandom allow unsafe renegotiation: false allow legacy hello messages: true initial handshake: true secure renegotiation: false main, setsotimeout(15000) called %% no cached client session *** clienthello, tlsv1 randomcookie: gmt: 1461489945 bytes = { 239, 82, 110, 194, 165, 173, 168, 22, 133, 76, 38, 213, 207, 244, 9, 221, 112, 233, 210, 113, 109, 219, 5, 76, 66, 199, 195, 132 } session id: {} cipher suites: [ssl_rsa_with_rc4_128_md5, ssl_rsa_with_rc4_128_sha, tls_rsa_with_aes_128_cbc_sha, tls_dhe_rsa_with_aes_128_cbc_sha, tls_dhe_d

Better examples of Parallel processing in Python -

i hope not downvoted time. have been struggling parallel processing in python while(2 days , exactly). have checking these resources(a partial list shown here: (a) http://eli.thegreenplace.net/2013/01/16/python-paralellizing-cpu-bound-tasks-with-concurrent-futures (b) https://pythonadventures.wordpress.com/tag/processpoolexecutor/ i came unstuck. want this: master: break file chunks(strings or numbers) broadcast pattern searched workers receive offsets in file pattern found workers: receive pattern , chunk of text master compute() send offsets master. i tried implement using mpi/concurrent.futures/multiprocessing , came unstuck. my naive implementation using multiprocessing module import multiprocessing filename = "file1.txt" pat = "afow" n = 1000 """ naive string search algorithm""" def search(pat, txt): patlen = len(pat) txtlen = len(txt) offsets = [] # loop slide pattern[] 1 one # rang

dictionary - Represent HashMap in class diagram -

Image
i have class diagram has dictionary (in python terms) attribute. basic structure: serverentry = { creditcardobj1 : accountbalance1, creditcardobj2 : accountbalance2, ...} to clarify, creditcardobj1 instance of class creditcard while accountbalance1 integer value , other entries in dictionary. i read in java, called hashmap. in case, implement in uml class diagram. tips on how that. using visio 2007 more helpful if can explain in terms of that. there no single truth , it's merely design decision. here couple variants: if want represent hash in python application code, can go simple class right tells name represents hash. , don't need implement hash (it's done in python interpreter), fine. if implement python interpreter, need show details on how that. middle class uses 2 arrays keys , object references. left 1 uses key/object pair bundled in separate class. there more ways show hash implementation.

javascript - Socket.IO Performance Oddities -

i've been running few tests figure out fastest way send specific data using latest socket.io version (v1.4.5). i tried passing object, string, uint8array , buffer. i'm excluding time generate formatted data. var d = date.now(); var obj = {"q":"-dgn,pqusy","u":{"gm5sp":[1109,1001],"t9sck":[2026],"hpcm8":[1407,841],"dnb7s":[1285,478],"pv7dt":[2043,986,31]}}; var objstr = json.stringify(obj); var objuint8 = new uint8array(objstr.length); for(var = 0 ; < objstr.length; i++) objuint8[i] = objstr[i].charcodeat(i); var objbuffer = new buffer(objuint8); for(var = 0 ; < 20000; i++){ if(num === 0) socket.emit('a',obj); if(num === 1) socket.emit('a',objstr); if(num === 2) socket.emit('a',objuint8); if(num === 3)

SELECT MULTIPLE VALUE USING JQUERY API -

please me out value select in select multiple tags. below jquery code $.get('/api/courses').done(function(data) { var courses = data.courses; object.keys(courses).foreach(function(key, data) { $('#courses').append($("<option>", { value: $('#courses').val(), text : courses[key].course_name })); }); });

java - Why does the javac error "(x) cannot be applied to (y)", happen when both parameters and arguments match up? (inner-class calling outer-class method) -

learning java iterators , general data structures via means of homework. i have built doubly-linked list (linkedlist) uses nodes (linkedlist$node) , has iterator (linkedlist$linkedlistiterator) classes make use of generics. within linkedlistiterator's @overridden remove() method making use of method of outer-class, i.e., linkedlist class. i following compile-time error: ./linkedlist.java:170: deletenode(linkedlist<t>.node<t>,linkedlist<t>.node<t>,linkedlist<t>.node<t>) in linkedlist<t> cannot applied (linkedlist<t>.node<t>,linkedlist<t>.node<t>,linkedlist<t>.node<t>) deletenode(nodetoberemoved, next, prev); my (primitive) understanding types don't match up, cannot see how so. here complete class code: import java.util.iterator; import java.util.nosuchelementexception; import java.util.concurrentmodificationexception; public class linkedlist<t> implements iterable<t

Oracle SQL Formatting -

consider below set of column date in oracle: column_name na 110000 440000 i want achieve 2 things here numbers should in format 99999.90 in output, word na/na should replaced blank or num field select case when lower(col_name='na') '' else to_number(col_name,99999.90) end table_name;

java - How JVM stores meta information of a class? -

we use reflection user defined class employee as: employee e = new employee(); class c = e.getclass(); as per knowledge first jvm loads bytecode of class employee, create object of class.class each loaded class (class employee here). in object of class.class jvm stores meta information loaded class. meta information of class "name of methods", "name of fields" etc. class of these types such "method", "field" etc defined in java.lang.reflect package. i seen code of class.java. found methods in class.class returning objects or array of objects of these types such "method", "field" etc. there not field in class.class type "method", "field" etc. if above statements wrong, please make me correct. if above statements not wrong have following doubts: 1). in field of class.class various information class stored? 2). in memory area of jvm object of employee , object of class.class stored? 3). in memory

c# - The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception -

i need solving error. error {"the type initializer 'system.transactions.diagnostics.diagnostictrace' threw exception."} using access database , platform build configuration cpu. sometimes code runs , throws exception. there many similar questions asked here none of them solving error. this connection string dbpath = @"d:\ek.mdb"; connectionstring =@"provider=microsoft.jet.oledb.4.0;data source="+dbpath+";user id=admin;password=;"; this function open connection getting error on con.open() public bool openconnection() { if (con == null) { con = new oledbconnection(connectionstring); } else if ((con.state == connectionstate.broken || con.state == connectionstate.closed) && (con.state!=connectionstate.open)) { con.open(); tx = con.begintransaction(isolationlevel.readcommitted); return

javascript - file:// prefix is missing in the returned URI of navigator.camera.getPicture -

my cordova mobile app has file chooser uses following code: navigator.camera.getpicture(photocapturedsuccess(fileuri), photocapturedfail, { quality: 50, destinationtype: navigator.camera.destinationtype.file_url, sourcetype: navigator.camera.picturesourcetype.savedphotoalbum, correctorientation: true }); the fileuri returned navigator.camera.getpicture() file:///storage/emulated/0/dcim/camera/img_20041615_135137.jpg working fine 1 day feature stopped working. on debugging code found fileuri missing file:// prefix. ie. uri starts /storage/emulated clue happened? thanks

c# - Decimal vs. Double for small currency numbers that only get stored, not manipulated -

i'm writing small application accesses sql database retrieve information local events, including prices, , allows creation , editing of new events exporting formatted , filtered lists of events printing etc. now event may have entrance fee represented in data sets (ms sql server data type "money"), i'm wondering data type use in client application. i know should use decimal currency calculations because of high precision - i'm not going any calculations, entered number 2 decimal places , stored database, , later gets loaded again , displayed or exported printable document - no calculations accumulate inaccuracies. so data type use in case? still go decimal because it's money , don't care memory etc? or use double instead precise enough? alternatively store price in cents integer well. type should go for? generally when dealing existing data source, follow what's used. in case, sql server .net reader maps money decimal . means no awk

c# - TextBox with an Error bob -

Image
i want have textbox displays error bob next it. wrote below code: <textbox text="my textbox" horizontalalignment="center" verticalalignment="center" height="75" width="75"> <textbox.template> <controltemplate> <dockpanel> <image..."error bob image added here"/> <border borderbrush="red" borderthickness="1.2"/> </dockpanel> </controltemplate> </textbox.template> </textbox> i able see same in designer. when run solution, see textbox red border. image (i.e., error bob) not visible. can suggest why happens? try set property lastchildfill="true" of dockpanel : <textbox text="my textbox" horizontalalignment="center" verticalalignment="center" height="75" width="75"> <textbox.template&

php - passing previous day to crontab argument -

i have php script want run every day @ 5am. script works $_get['datevar'] i create cronjob call following script var/www/somedir/myscript.php&datevar='previous_day' where previous day means "yesterday". i've heard arguments : var/www/somedir/myscript.php datevar='previous_day' but cant make work. previous day has in format "yyyy-mm-dd" can provide me hint?

javascript - JQuery get a contiguous sequnce of elements -

i'm trying contiguous array of elements using jquery. exmaple html: <div class="parent"> <div class="childtype2">1</div> <div class="childtype2">2</div> <div class="childtype2">3</div> <div class="childtype1">4</div> <div class="childtype1">5</div> <div class="childtype1">6</div> <div class="childtype1">7</div> <div class="childtype2">8</div> <div class="childtype1">9</div> <div class="childtype1">10</div> <div class="childtype1">11</div> <div class="childtype1">12</div> </div> i want return div's containing 4,5,6,7 (the first sequnce of divs class="childtype1"). i tried $("<div>test</div>")($('.parent

Pentaho 6.0.1 connection to Mapr 5.0.1 -

i trying connect pentaho di mapr. while creating connection following error unable load {0}shim. i using pentaho enterprise edition. has faced similar issue. thanks have installed pentaho-mapr .jar file in lib folder of pdi?, example if want connect mysql database first need install mysql-connector-java-5.1.23-bin.jar file

javascript - Splitting tasks in gulp -

right have multiple gulpfiles. everytime work need run mulptiple "gulp --gulpfile path/to/another-gulpfile.js". can run 1 command? tried "gulp --gulpfile gulpfile1.js gulpfile2.js gulpfile3.js", didn't work. edit: "scripts": { "gulp": "gulp --gulpfile bin/gulp-tasks/config.js && gulp --gulpfile bin/gulp-tasks/deploy.js" } i tried running multiple gulp instances using npm scripts, looks watchers first specified gulpfile working. simple console.logging showed, second gulpfile not started. work when launched separately. one way can try put gulp command in npm package.json scripts: { gulp: gulp --gulpfile path/to/gulpfile1.js && gulp --gulpfile path/to/gulpfile2.js } then can run 1 command npm run gulp ; the other way can refer post more details http://macr.ae/article/splitting-gulpfile-multiple-files.html

Twitter login with Spring Social not working -

i have working spring boot app using oauth2 authentication (password grant type). need support facebook , twitter login. i using custom tokengranter allow client send me facebook access token or twitter consumer id , secret can logged server application , receive oauth2 access_token generate. have working facebook using facebookconnectionfactory : connection<facebook> connection = facebookconnectionfactory.createconnection(new accessgrant(providertoken)); with connection, user id of facebook: string provideruserid = connection.getkey().getprovideruserid(); with id, search if there such user in userrepository , if so, log in user: customuserdetails userdetails = new customuserdetails(user); userauth = new socialauthenticationtoken(connection, userdetails, null, userdetails.getauthorities()); securitycontextholder.getcontext().setauthentication(userauth); this works fine. doing same twitter: connection<twitter

php - Doctrine get entities distributed over hours -

Image
my problem: need count(orders) several shops distributed on hours. ofcourse order contain createdat field, , bedirectional manytoone relation shop . can done through dql or should use plain sql, or should orders , sort them in loop? what best practices? expected result in excel below. my current solution: repository: public function findsortedtoday() { $orders = $this->createquerybuilder('o') ->select('hour(o.createdat) ocreated') ->addselect('sum( od.dishprice ) odsum') ->addselect('(os.name) oshop') ->innerjoin('o.shop', 'os') ->innerjoin('o.dishes', 'od') ->groupby('ocreated') ->addgroupby('os') ->getquery() ->getresult(); return $orders; } controller: ... $ordersbyhourarray = $this->getdoctrine()->getrepository("terminalbundle:order")->findsorted

video - Android MediaCodec: Backlink to input -

i'm receiving video data via rtp/h.264 (profile baseline). i'm building complete nal unit (using nal (network abstraction limit) delimiter 0x09) , pushing mediacodec. afterwards i'm rendering decoded image via opengl surfacetexture. work far. now need know in rendering calls video frame rendered. need meta information attached video frame later in rendering part. my first idea use simple queue: 1) queue.offer(videoframeid) 2) mediacodec.queueinputbuffer() 3) mediacodec.deqeueoutputbuffer() 4) mediacodec.releaseoutputbuffer() then on rendering side: 1) onframeavailable(surfacetexture) 2) queue.poll() 3) render() but out of sync. there more calls mediacodec.queueinputbuffer onframeavailable(). appears if video frame build multiple nal units. are there means reference original video frame rendering? i'm limited sdk 19 api. thank you

phpmyadmin - mysql privileges on table user can't grant -

i have granted user "database-specific" privilege types. user created following php mysql query: $querygrant = "grant privileges on databasex.* 'user'@'localhost' identified 'pwd' grant option ;"; in phpmyadmin, in table of privileges windows of databasex , column grant user says yes . i'm trying run following query user created $querycgrant = "grant privileges on databasex.tabley 'tableyusr'@'localhost' identified 'ypwd' grant option ;"; it returns: could not grant priv not allowed create user grant why created user privileges on databasex can not grant user privilege on table of same database?

r - How to use Rstudio relative paths -

how can use relative paths in rstudio project environment? for example, access file, use whole path: # rstudio project working directory: getwd() [1] "c:/users/mauriziolocale/onedrive/data_science/10_capstone_project/ cp_natural_language/my_file.txt" but long. i trying use paths relative working environment. tried conceptually similar to: "~/my_file.txt" where ~ represents working environment. unfortunately, not work. you change working directory. address in beginning getwd() , replace project folder setwd() . then, when accessing file use read.table("./folder/file.r") pointed out @roman.

shell - How to sort a 3G bytes access log file? -

hi all: have 3g bytes tomcat access log named urls, each line url. want count each url , sort these urls order number of each url. did way: awk '{print $0}' urls | sort | uniq -c | sort -nr >> output but took long time finish job, it's took 30 minutes , still working. log file bellow: /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /loan/recent_apply_info?passportid=y20151206000011745 /loan/recent_apply_info?passportid=y20160331000000423 /open_api/borrow_business/get_apply_by_user ... is there other way process , sort 3g bytes file? in advance! i'm not sure why you're using awk @ moment - it's not doing useful. i suggest using this: awk '{ ++urls[$0] } end { (i in urls) print urls[i], }' urls | sort -nr this builds count of each url , sorts output.

asp.net - How to modify split function to split string -

please me split string "," having "desc,a" single item in result. string s="\"desc,a\",true,true,false,true,0,1,red,1,1," thanks in advance. you can use regular expression match items , without quotation marks: string[] items = regex.matches(s, @"""[^""]*""|[^,]+") .cast<match>() .select(x => x.value) .toarray(); explanation: ""[^""]*"" - matches item quotation marks (quot, 0 or more non-quot character, quot) | - or operator [^,]+ - matches item without quotation marks (one or more characters other comma)

xml - xslt sum values in multiple documents -

i tried using document function process multiple .xml-documents sum(document(/folder/folders/*)//element) the folders have varying names, path has dynamic(i used * in actual .xsl), document function not work multiple folders different names, ? as did not work, looking solution , stumbled on collection function, can used saxon. <value-of select="sum((collection('/folder/folders?select=*.xml;recurse=yes')//element)" (recursive="yes" set collection go through subfolders) but not seem work correctly. not find documentation of function, either. is there a documentation of function or provide me ? thank in advance. the documentation of saxon's 9.5 collection function http://www.saxonica.com/documentation/html/sourcedocs/collections.html , http://www.saxonica.com/documentation/index.html#!functions/fn/collection . might want try complete file url adapted file system work e.g. collection('file:///c:/folder/folders?select=*.x

intellij idea - Android Studio Java error -

i tried run android-studio , error:(in studio self) cannot run program "c:\program files\java\jdk1.7.0_21\bin\java" (in directory "c:\users\user.androidstudiopreview\system\compile-server"): createprocess error=2, system cannot find file specified the problem why it's trying use jdk1.7.0_21 , not jdk1.7.0_25 ?(that got installed). environment variables are: (system variables) java_home: c:\program files\java\jdk1.7.0_25. android_swt: c:\adt-bundle-windows-x86\sdk\tools\lib\x86. i fixed problem doing this: go file > project structure (or use alt + ctrl + shift + s ) , under platform settings click on "sdks" , delete "1.7" jdk , add new jdk using correct java path.

javascript - IF and ELSE IF executable same time Angularjs -

$scope.closeok = function (e) { var xa = 0; if ($rootscope.viewimage==0&&$rootscope.opencaidat==1&&$rootscope.openthread==1&&xa==0) { $('#caidatkhixem').modal('hide'); xa=1; $rootscope.opencaidat = 0; $scope.$digest(); e.preventdefault(); e.stoppropagation(); return true; } else if ($rootscope.viewimage==0&&$rootscope.opencaidat==0&&$rootscope.openthread==1&&xa==0) { $rootscope.classhienthibaiviet = "modal animated fadeoutrightbig"; xa=1; $timeout(function () { $('#hienbaihome').modal('hide'); }, 1000); $rootscope.taptoexit = 1; $rootscope.openthread = 0; $scope.$digest(); e.p

rust - Kill child process while waiting for it -

i want execute process , want wait until has finished. lets spawn , wait process in thread t1: let child = command::new("rustc").spawn().unwrap(); child.wait(); now, if special event occurs (which thread t0 waiting for) want kill spawned process: if let ok(event) = special_event_notifier.recv() { child.kill(); } but don't see way it: both kill , wait take mutable reference child , therefore mutually exclusive. after calling wait no 1 can have reference child anymore. i've found wait-timeout crate, want know if there's way. obviously, can kill process yourself. child::id method gives "os-assigned process identifier" should sufficient that. the problem killing process platform-dependent action. on unix killing process handled kill function: #![feature(libc)] extern crate libc; use std::env::args; use std::process::command; use std::thread::{spawn, sleep}; use std::time::duration; use libc::{kill, sigterm}; fn main()

regex - xslt remove string and special character from number in xml -

during xslt transformation, have tried clean string , special customer number, doesnt work. need remove c: or s: number. :) xml file 1 <data> <request> <custno>c:222</custno> </request> </data> xml file 2 <data> <request> <custno>s:333</custno> </request> </data> xslt <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fo="http://www.w3.org/1999/xsl/format" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" > <xsl:output method="xml" version="1.0" indent="yes"/> <xsl:template match="request" > <testpayment>

Reading multiple json files from Spark -

i have list of json files load in parallel. i can't use read.json("*") cause files not in same folder , there no specific pattern can implement. i've tried sc.parallelize(filelist).select(hivecontext.read.json) hive context, expected, doesn't exists in executor. any ideas? looks found solution: val text sc.textfile("file1,file2....") val df = sqlcontext.read.json(text)

javascript - Why does PhantomJS not return the correct source? -

i did small test: var page = require('webpage').create() , fs = require('fs'); page.open("http://www.google.it/search?q=web+design", function(status){ if (status === 'success') { page.render('google.png'); fs.write("source.html", page.content, 'w'); } phantom.exit(); }) as can see search "web design" on google.it now, looking source.html noticed differences between phantomjs generated source code , real (element inspector of chrome) html. in source code result has code: <li class="g"> <h3 class="r"><a href="/url?q=http://www.html.it/web-design/&amp;sa=u&amp;ei=z2lzubsabcgv7abm54bi&amp;ved=0ccwqfjab&amp;usg=afqjcngagkxls36cxszgjyhnbx7duci6da"><b>webdesign</b> - guide e approfondimenti per webdesigner - html.it</a></h3> <div class="s"> <div class=&

java - gwt grid header align -

i used gwt 2.5.1, java 1.6. when used grid, want centerd grid header. no data, header. source .getgrid().getcolumnmodel().getcolumns().get(i).setalignment(horizontalalignment.center); but, both aligned. so, can do? thank you. use dom inspector , fish out style corresponds header cell. if named column "test" style may named "x-grid3-td-test". add following stylesheet: .x-grid3-td-test* { text-align: center; }

javascript - Bootstrap popover align in middle -

i making interactive svg map highlights. using bootstrap popover aligned above svg. want place direct on svg in middle or something. here fiddle see how build up. as can see in fiddle trigger popover on svg element. how acces specific popover? thinking this: $('svg').click(function(){ $('div').find('.popover').css('top', '100px','!important'); }) but setting top 100px when click second time (when closing) i ready found solution wrap svg in div , give position: relative , display: inline-block give popover class: .popover { .pos-t-l(50%, 50%) !important; (mixin position top-left) .translate(-50%; -50%); }`

c# - ASP EF Increment / Decrement Value with + / - buttons -

so i'm new asp , ef , wondering how incredibly basic operation, few questions go along doing it. currently have table call resource; class resource { int current; int min; int max; }; right have default crud options this. + / - button on main list manipulate current value of each resource , update value in db , on screen. there operations i'd run such "addfive" selected group of resources. so questions; how do this? is scalable? if hitting buttons going send lot of requests db. there way limit impact of this? what alternatives? thanks. edit: clarify question; here post functions. how / add these in view button showing each resource. want action fire , refresh value rather redirect new page. @html.actionlink("+", "increment", new { id = item.id }) public void increment(int? id) { if (id != null) { movie movie = db.movies.find(id); if (movie != null) { increment(movie)

undefined index error. PHP version : 5.4.7 -

i want login page. when enter details, issue appeared. login.php <?php session_unset (); ?> <html> <head> </head> <body> <form action="movie1.php" method="post"> <p>enter username: <input type="text" name="user"/> </p> <p>enter password: <input type="password" name "pass"/></p> <p> <input type="submit" name="submit" value="submit" /></p> </form> </body> </html> movie1.php <?php session_start(); $_session['username'] = $_post['user']; $_session['userpass'] = $_post['pass']; $_session['authuser'] = 0; if (($_session['username'] == 'joe') , ($_session['userpass'] == '12345')) { $_session ['authuser']=1; } else { echo 'you can not enter here.'; exit (); } ?> <html> <?php $myfavm

android - java.lang.NoSuchFieldError: CONTROL_LOCATION_UPDATES -

java.lang.nosuchfielderror: control_location_updates @ android.app.activitymanager$runningtaskinfo.readfromparcel(activitymanager.java:460) @ android.app.activitymanager$runningtaskinfo.init(activitymanager.java:474) @ android.app.activitymanager$runningtaskinfo.init(activitymanager.java:387) @ android.app.activitymanager$runningtaskinfo$1.createfromparcel(activitymanager.java:466) @ android.app.activitymanager$runningtaskinfo$1.createfromparcel(activitymanager.java:464) @ android.app.activitymanagerproxy.gettasks(activitymanagernative.java:2092) @ android.app.activitymanager.getrunningtasks(activitymanager.java:507) @ android.app.activitymanager.getrunningtasks(activitymanager.java:534) this bug happens in samsung gt-s7560, how solve it? you can't use control_location_updates , it's restricted permission. from doc : not use third-party applications.

linux - Errno 13 when installing python package -

i'm pretty new programming , i've downloaded ubuntu onto laptop. problem i'm having when try install python package tabulate ( https://pypi.python.org/pypi/tabulate ) terminal displays error telling me don't have permission so. kai@kai-hp-notebook:~$ pip install tabulate downloading/unpacking tabulate downloading tabulate-0.7.5.tar.gz running setup.py (path:/tmp/pip_build_kai/tabulate/setup.py) egg_info package tabulate installing collected packages: tabulate running setup.py install tabulate error: [errno 13] permission denied: '/usr/local/lib/python2.7/dist-packages/tabulate.py' complete output command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_kai/tabulate/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-if5xkf-record/install-record.txt --single-version-externally-

groovy - Retrieve all properties of env in Jenkinsfile -

i print available properties (and values) in env object inside jenkinsfile. when do print env i get: org.jenkinsci.plugins.workflow.cps.envactionimpl@112cebc2 so looks tostring not implemented there, how can access properties in object if don't know names? make sure you're not running pipeline script in sandboxed mode , should able use: env.getenvironment() note, if you're running in sandbox mode in pipeline, should approve method @ script approval page: http://jenkins-host/scriptapproval/