Posts

Showing posts from July, 2010

Hide Rows in a Google Spreadsheet based on first Character in a cell -

i working on adding functionality google spreadsheet. spreadsheet imports data web, , have formatted nicely. 1 of columns series of strings, formatted in 1 of 2 ways - string or *string * without space (basically importing italics web). i trying come script runs when open spreadsheet, will: unhide rows in spreadsheet loop through spreadsheet hide every row column 2(b) begins asterisk i have following: function onopen() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getsheetbyname("dodh"); sheet.showrows(1, sheet.getmaxrows()); for(var i=1; i<sheet.getmaxrows()+1; ++i){ if (sheet.getrange(i, 2).getvalue().){ sheet.hiderow(i) } } } i don't know how access string inside each cell, , how access characters within string. thank in advance help. here updated code. see comments have na insight function onopen() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getsheetbyname("dodh

java - Lazy loading and Fetch strategies -

i using hibernate 3.6 user entity class contact entity class user has set<contact> relationship uni-directional , mapped one-to-many. have tried out following lazy loading , fetch combinations. here list of understanding , actual results with session.get(user.class, <some userid>) or session.load(user.class, <some userid>) lazy fetch result * true join ignores lazy loading * 1 select retrieving user , contacts left outer join * select 1 select user record * 1 select contacts of user * subselect 1 select user record * 1 select contacts of user * false join 1 select retrieving user , contacts left outer join * select 1 select user record * 1 select contacts of user * subselect 1 select user record * 1 select contacts of user with session.createquery(from use

html - How to get embedded code of autoplay youtube video -

i need embed video in project , need have code not display suggested videos @ end, , need it autoplayed when page launches. this url of video can in please? try this <iframe width="560" height="315" src="http://www.youtube.com/embed/1wcxuhdfyuo?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>

html - my Child DIV is stretching beyond parent. No fixed / absolute positioning -

http://thestleonardsacademy.org/stlan/extracurricular.php the divs in question #content , #newstiles. #content set set @ 100% height, newstiles, child of content. however, newstiles matching height of content, rather filling remaining space. due other divs inside #content, means scroll bar created additional scroll equalling header , footer inside #content. i'm wanting #content minimum of 100% page height. want fixed-size header , footer, , #newstiles fill remaining space. you have no clear: in css, try adding clear:both; in css.

optimization - optimize python nested loops for YUV2RGB conversion -

we derived yuv2rgb algorithm hikvision. our 720h x 1280w screen resolution python conversion takes long (15 seconds) 720x1280=921,600 rounds of calculations 1 single rgb frame. 1 knows how optimized following 2 large nested loop? yuv2rgb algorithm is: def yuv2rgb (y1, u1, v1, dwheight, dwwidth): # function call rgb1 = np.zeros(dwheight * dwwidth * 3, dtype=np.uint8) # create 1 dimensional empty np array 720x1280x3 in range (0, dwheight): #0-720 j in range (0, dwwidth): #0-1280 # print "cv" y = y1[i * dwwidth + j]; u = u1[(i / 2) * (dwwidth / 2) + (j / 2)]; v = v1[(i / 2) * (dwwidth / 2) + (j / 2)]; r = y + (u - 128) + (((u - 128) * 103) >> 8); g = y - (((v - 128) * 88) >> 8) - (((u - 128) * 183) >> 8); b = y + (v - 128) + (((v - 128) * 198) >> 8); r = max(0, min(255, r)); g = max(0, min(255, g)); b = max(0, min(255, b)); rgb1[3 * (i

apache - How to avoid "RewriteBase" -

i not want manually set rewritebase in .htaccess of every site. how can set relative, moving site root new location not require modification in it. i read http://michael.orlitzky.com/articles/avoiding_rewritebase_with_mod_rewrite.php seems not applicable in .htaccess files. here example htaccess : adddefaultcharset utf-8 <ifmodule mod_rewrite.c> rewriteengine on rewritebase /test rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?_url=/$1 [qsa,l] </ifmodule> one way avoid modifying rewritebase in different setups use symlinks create same name linked directory every where. , make sure have option set @ top: options +followsymlinks

Chrome Dev Tools: How to trace network for a link that opens a new tab? -

Image
i want trace network activity happens when click on link. problem link opens new tab, , apparently dev tools works per tab open for. "preserve log upon navigation" not help. my current solution move firefox , httpfox not have issue. wonder how developers chrome manage, sounds pretty basic (of course i've searched answer, didn't find helpful). check out chrome://net-internals/#events detailed overview of network events happening in browser. other possible solution, depending on specific problem, may enable 'preserve log' on 'network' tab: and force links open in same tab executing following code in console: [].foreach.call(document.queryselectorall('a'), function(link){ if(link.attributes.target) { link.attributes.target.value = '_self'; } }); window.open = function(url) { location.href = url; };

ruby on rails - Picture disappeared on Heroku -

i deployed first heroku app yesterday, , worked great. in app can upload image, did , see in "show" page. today image disappeared. else seems work fine. application working fine on local machine on heroku, other image not there. what may problem? how can make sure doesn't happen again? heroku not support file uploads. filesystem readonly. you'll have host uploaded files somewhere else (or database, bad option). https://devcenter.heroku.com/articles/read-only-filesystem amazon s3 common choice: http://devcenter.heroku.com/articles/s3 if using gems paperclip or carrierwave uploading, using s3 simple. have set s3 credentials in config file , gem take care of uploading , provide urls uploaded file.

javascript - Rotate google map marker image -

this question has answer here: rotating image / marker image on google map v3 13 answers marker1 = new google.maps.marker( { position: mylatlng, map: map, icon: { path: google.maps.symbolpath.forward_open_arrow, scale: 2, rotation: degree } }); i trying rotate marker image on google map in degree. i using above code nice showing forward_open_arrow code of path: google.maps.symbolpath.forward_open_arrow, want add image here instead of arrow such car image can rotate when vehicle move in direction. have degree of rotation there way put image instead of arraow try this marker1 = new google.maps.marker( { position: mylatlng, map: map, icon: { url: "/path/to/

c# - Check if (partial) view exists from HtmlHelperMethod -

does know if it's possible check if partial view exists within htmlhelperextension? i know it's possible controller using following: private bool viewexists(string name) { viewengineresult result = viewengines.engines.findview(controllercontext, name, null); return (result.view != null); } source: does view exist in asp.net mvc? but can't above in helper, don't have access controller context. thoughts on how this? but can't above in helper, don't have access controller context. oh yes, have access: public static htmlstring myhelper(this htmlhelper html) { var controllercontext = html.viewcontext.controller.controllercontext; var result = viewengines.engines.findview(controllercontext, name, null); ... }

javascript - Jquery datepicker calendar icon positioning -

i'm using jquery-ui datepicker. problem is, library inserts calendar icon straight after input field default. html markup bit different , want calendar icon appear somewhere else in dom, i.e. outside parent container of input field. i tried add own <img/> manually , added class ui-datepicker-trigger , doesn't trigger anything. how can decide icon should appear in dom , has work? this want: <div class="parent"> <input id="datepicker" class="hasdatepicker" type="text" /> </div> <img class="ui-datepicker-trigger" src="images/calendar.gif" alt="..." title="..." /> not (default jquery-ui insertion): <input id="datepicker" class="hasdatepicker" type="text" /> <img class="ui-datepicker-trigger" src="images/calendar.gif" alt="..." title="..." /> many thanks try man

python - Represent a table as object -

is there standard way represent table contains relational data in python ? mean, this: singular plural 1st. make make 2nd. make make 3d. makes make i data accessible both rows , columns, this: 1st. singular -> make 1st. -> make, make plural 3d. -> make plural -> make, make, make i can't see way store data efficiently, without redundancy. better can think of use multiple dictionaries (one per row , 1 per column), each contain many keys there rows or columns associated dictionary itself, plus 1 special key contain associated values. i guess has been addressed, that's why ask. as alternative other answer, can use namedtuple suggested @jamylak: from collections import namedtuple class verb(namedtuple("_verb", # arbitrary class name/tag ["singular1", "singular2", "singular3", "plural1", "plural2", &quo

c++ - How can I clean up properly when recv is blocking? -

consider example code below (i typed example, if there errors doesn't matter - i'm interested in theory). bool shutdown = false; //global int main() { createthread(null, 0, &messengerloop, null, 0, null); //do other programmy stuff... } dword winapi messengerloop( lpvoid lpparam ) { zmq::context_t context(1); zmq::socket_t socket (context, zmq_sub); socket.connect("tcp://localhost:5556"); socket.setsockopt(zmq_subscribe, "10001 ", 6); while(!shutdown) { zmq_msg_t getmessage; zmq_msg_init(&getmessage); zmq_msg_recv (&getmessage, socket, 0); //this line wait forever message processmessage(getmessage); } } a thread created wait incoming messages , handle them appropriately. thread looping until shutdown set true. in zeromq guide states must cleaned up, namely messages, socket , context. my issue is: since recv wait forever message, blocking thread, how can shut down thread safely if message never

sql server - Bulk insert not working for NULL data -

when inserting bulk data table csv file, not working, showing error lie : bulk load data conversion error (type mismatch or invalid character specified codepage) row 2, column 9 column 9 value in csv file null.. how take care of this? from amount of information i'd target table's particular field defined "not null". workaround issue have to: a) modify csv-->add value field(s) have null b) modify target table setting affected fields 'nullable': alter table [tblname] alter column [nulcolname] [vartype such int] null in case go solution , want turn table's status alter again: update [tblname] set [nulcolname]=-1000 [nulcolname] null avoid alter errors, alter table [tblname] alter column [nulcolname] [vartype such int] not null c) pretty 'b' option bit more professional , faster: create temp table based on target table allowing nulls , fields, update temp table's null records after csv import "default value" , co

How do I make a call to the Yahoo hourly weather forecast API? -

i have found yahoo weather forcast helpful. i'm able hourly weather request here yahoo. how can make api request above hourly weather report using yahoo api call http://weather.yahooapis.com/forecastrss?w=2502265 ? this documentation found . you can using rest api's of programming language want use.. give java example. (similar thing applies other languages too.. )' package tests; import org.apache.http.*; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; /** * simple java rest example using apache http library. * executes call against yahoo weather api service, * rss service (http://developer.yahoo.com/weather/). * * try twitter api url example (it returns json results): * http://search.twitter.com/search.json?q=%40apple * (see url more twitter info: https://dev.twitter.com/docs/using-search) * * apache httpclient: http://hc.apache.org/httpclient

apache - will "service httpd reload" reload new php.ini settings? -

i'm trying enable shorthand in php via setting this: short_open_tag = 1 i execute: service httpd reload however changes not take effect. need "service apache2 reload" instead? or "service httpd reload" work load new php.ini settings? thanks! you need service apache2 reload as php.ini settings changes require apache/nginx or whatever server reloaded

r - How to select columns programmatically in a data.table? -

i have following data.table (dt): dt <- data.table(v1 = 1:3, v2 = 4:6, v3 = 7:9) i select subset of variables programmatically (dynamically), using object relevant variable names stored. example, want select 2 columns "v1" , "v3" stored in variable "keep" keep <- c("v1", "v3") if select "keep" columns data.frame, following work: dt[keep] unfortunately, not working when data.table. thought data.frame , data.table identical kind of behavior, apperently aren't. able advise on correct syntax? this covered in faq 1.1, 1.2 , 2.17 . some possibilities: dt[, c('v1','v3'), = false] dt[, c(1,3), = false] dt[, list(v1,v3)] the reason df[c('v1','v3')] works data.frame covered in ?`[.data.frame` data frames can indexed in several modes. when [ , [[ used single vector index ( x[i] or x[[i]] ), index data frame if list. in usage drop argument ignored,

change body color using pure javascript -

hi2all write code change color of webpage when user click div but doesn't work here code what's wrong <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html" /> <meta name="author" content="gencyolcu" /> <title>untitled 1</title> <script type="text/javascript"> var x=document.getelementbyid("m"); x.addeventlistener("click",function{ document.body.style.backgroundcolor = "red"; }); </script> </head> <body > <div id="m">kfjgflg</div> </body> </html> you should use such as: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html" /> <meta name="author" content="gencyolcu" /> <title>unt

jquery - How to enable submit event in form if validation fails -

shopping cart form contains validation form ajax submit. if validation fails, alert() box appears , submit cancelled return false if validation fails, submit method not called anymore. subsequent clicks button ignored. only first click in green lisa ostukorvi button causes alert box. subsequent clicks ignored, submit() event not fire. occurs in ie10, firefox & chrome. how fix this? <script> var request; $(function() { $(".browse-addtocart-form").submit(function(event){ if (request) { request.abort(); } var $form = $(this); var $inputs = $form.find("input, select, button, textarea"); var serializeddata = $form.serialize(); var q = parseint(this.quantity.value, 10); if(isnan(q) || q === 0){ alert('fill quantity'); $(this.quantity).focus(); // todo: why causes submit event not occur on subsequent clicks: return false; } request = $.post('/addtocart', serializeddat

Unable to find plugins in list of available plugins in jenkins -

i have installed jenkins deploying war file tomcat . on typing http://localhost:8080/jenkins in browser, jenkins home page opening means jenkins installed. configured system settings, gave jdk , maven path , save them. install plugins, clicked on jenkins->manage plugins , clicked on available tab not find plugins. tried 3 solutions: configured proxy jenkins going jenkins->manage plugins->advanced (did not find plugins) restarted server, refreshed browser , went jenkins->manage plugins->available (still did not find plugins). so, read somewhere have update plugins forcefully if not updated automatically. so, went jenkins->manage plugins->advanced , clicked tab 'check now' (still did not find plugins on clicking on available tab). finally read somewhere if add plugingroup 'org.jvnet.hudson.tools' settings.xml file of maven, problem may resolved. so, added corresponding code settings.xml: then tried again still not find plugins in

entity framework 4 - Dbcontext with using-clause in Asp.Net Json-Call -

i ran problem when switching local development server local iis server (asp.net mvc4) using following controller-method: public jsonresult getjsondata(string context, string language) { using (keyvaluedbcontext db = new keyvaluedbcontext()) { var entries = u in db.keyvalues ((u.context == context) && (u.language == language)) select u; return json(entries, jsonrequestbehavior.allowget); } } using local server, received data when calling method javascript without problem. method retrieves collection of key-value pairs database repository , sends them client). after switching iis got exception telling me dbcontext had been disposed of (although using clause ends after return-statement). (nb: visual studio not able find jsonserializer.cs reason, when error occurred). switching following version solved problem completely: public jsonresult getjsondata(s

sql - Issue with stored procedure -

i have sybase stored procedure having issue. here if use insert statement directly insert works shown: insert dbo.studentdata ( studid , studletters , studcode , studtelecast , studname , monthcode , reportdate , starttime , endtime , startdatetime , enddatetime , cost , duration , creationtime ) values ( 113 , 'abcd' , 222 , 333 , 'one' , 02 , getdate() , getdate() , getdate() , getdate() , getdate() , 999 , 11 , getdate() ) ; but if use stored proc i'm getting following error : [exec - 0 row(s), 0.000 secs] [error code: 102, sql state: 42000] incorrect syntax near ')'. exec dbo.sp_loadstuddata(113, 'abcd', 222, 333, 'one', 02, getdate(), getdate(), getdate(), getdate(), getdate(), 999, 11, getdate() ) i not able find out issue stored proc got created without errors.

javascript - Upload Base64 Image Facebook Graph API -

i'm trying upload base64 image facebook page using node.js. have managed upload working multipart data etc should read file filesystem (ie. using fs.readfilesync('c:\a.jpg') however, should use base64 encoded image , try upload it, give me following error : {"error":{"message":"(#1) unknown error occurred","type":"oauthexception","code":1}} i have tried converting binary new buffer(b64string, 'base64'); , uploading that, no luck. i have been struggling 3 days now, anyhelp appreciated. edit : if knows how convert base64 binary , upload it, work me. edit : code snippet var postdetails = separator + newlineconstant + 'content-disposition: form-data;name="access_token"' + newlineconstant + newlineconstant + accesstoken + newlineconstant + separator; postdetails = postdetails + newlineconstant + 'content-disposition: form-data; name="message"' + newlineconsta

index column type="timestamp" in solr from cassandra database -

here using dse-3.0.i want index column type="timestamp" name="datetime" in solr cassandra database.what should fieldtype in schema.xml in solr type="timestamp".please me.i have badly need it. thank database output: -- cqlsh:mykeyspace> select * mysolr ; key,124 | date_time,2013-02-11 10:10:10+0530 | body,a chicken in every pot ... | date,dec 15, 1933 | name,roosevelt | title,fireside chat but @ query not gives value of date_time field. query output in solr :-- id,body,title,name,date 124,a chicken in every pot ...,fireside chat,roosevelt,"dec 15, 1933" what missing configure.please guide me proper way. thank you. in versions of solr prior 4.2 there timestamp field in example schema.xml implemented predefined date fieldtype <field name="timestamp" type="date" indexed="true" stored="true" default="now" multivalued="false"/> here da

android - Sending current location to server with locationlistener -

i have service within android app implements locationlistener keep track of users changing location. every time location changed, want send server. so, in onlocationchanged method fetching latitude , longitude. want send them server on network. hence, created new thread (as network operations not allowed on main thread). however, java.lang.nullpointerexception thread. what should do? here's code ..... public class sservice extends service implements locationlistener{ public class localbinder extends binder { splashservice getservice() { return splashservice.this; } } @override public void oncreate() { super.oncreate(); mnm = (notificationmanager)getsystemservice(notification_service); //shows notification shownotification(); } @override public int onstartcommand(intent intent, int flags, int startid) { log.i("sservice", "received start id " + startid + ": " + intent); // sets parameters

database - How to update images or save new images in web in Android -

i getting data server, works fine.image getting display application. but, want take new photo camera or sd card , update images getting web.here , image must save on server , replace old web images new photo take camera or sd card. i did not have more idea behind trick, please give me basic idea.how update current images new images.

regex - How to display the exact search keyword in perl -

i using regex searching directory list of keywords. here current code: if (/$search/i) { printf $out "%s\t%s\n",$file::find::name,$1; } in above code $1 giving keyword phrase. want entire keyword. example: searching "sweep" current output: c:\ac\acfrd\file.sql sweep . file contains word "sweep_id", , want output "sweep_id", not "sweep". try regex: /\b(\w*$search\w*)\b/i it captures search term , optional adjacent word-symbols ( \w - letters, digits, etc.) $1 . captured character sequence surrounded word-boundaries ( \b - punctuation, whitespace, string beginning or ending). the regex above allows additional word-symbols both before , after search term. if want allow additional symbols after search term (as in example), remove first \w* : /\b($search\w*)\b/i if not want rely on perl's definition of "word symbols", replace \w own character class, e.g. (only a

memory - How much RAM C# application can use? -

i have application big datatable objects, big arrays etc. currently memory usage below 2gb. what happen when application produce 4 arrays 1gb size on 32 bit system? will crash? i know 2gb object size limit in clr, many big objects? i tried test it, declared few big arrays, when empty seems not use ram. didn't tried fill them, decided ask here. 64 bit application, including managed ones, can access large memory. 32 bit application have virtual address space of maximum 4gb. in practaice 2gb default. /largeadressaware applicaitons can 3gb /3gb in boot.ini or 4gb when running on wow64. managed application, on x64 cannot , allocate single object larger 2gb. includes arrays. but no matter amount of va available @ disposal: manipulating +2gb datatable object not going work. use storage engine capable of handling , manipulating large amounts of data fast, , capable of intelligent paging. redis , cassandra or traditional rdbmss more suited job. even if de

Does Seneca Z-3AO understand a function 5 code (Modbus RTU)? -

in user manual specify address's of "analog output holding registers", allows implement function codes 3, 6 , 16. ps. want change single coil (bit) in eprflag-register (bit 12), user manual dose'nt specify data address of coil. exemple: bit 12 has coil-number 00002, gives 2-1=1 data address. if "write coils" function not available, may still have possibility read entire register, change desired bit, , write entire register.

Edit text file using sed or awk -

i have sample text file shown below: >chr1 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn >chr10 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn >chr11 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn >chr12 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn >aaex03020170.1 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnntatgtgagaagatagctgaa >aaex03022270.1 dna:chromosome chromosome:canfam3.1:1:1:122678785:1 ref nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnntatgtgagaagatagctgaa >jh373398.1dna:chromosome chromosome:canfam3.1:1:1:12

javascript - Set height of div wrapper by image width size -

going try , re-explain trying here. seems there little confusion around div / img example. in short, trying create wrapper around image stays square, expands in size responsively browser window adjusts. image inside square adjust size within square wrapper (div) fill space. images pretty same width, height varies, , want position on top , hide bottom larger square wrapper. because square wrapper resize window cannot set size actual size div, adjust automatically. hope helps. so here came with. seems work part. var divwidth = $('.photo').width(); $('.photo').height(divwidth); $(window).resize(function(){ var divwidth = $('.photo').width(); $('.photo').height(divwidth); }); anyone have suggestions add? --- original description ---- i'm looking create responsive web page images. unfortunately not images have same height width ratio. thinking of creating wrapper around image set height current width of image, , rest hid

Use a variable in C# path -

i need save .xml file in specific location on computer. location changed based on selection of user. i can user selection (from combobox) variable this: location = (string)combobox1.selecteditem; but can’t use following command store file because of “%location%” part. says “could not find part of path” docsave.save(@"c:\...\...\%location%\...\information.xml"); can me regarding that….? thank you. you should use path class when you're working paths, if want working path multiple parts, use path.combine : string location = (string)combobox1.selecteditem; string dir = "c:\dir1\dir2\%location%\dir4".replace("%location%", location); string filename = "information.xml"; string fullpath = path.combine(dir, filename);

python tkinter: Custom menu while pulling down -

Image
i'm learning creating software python , tkinter. need change menu items different conditions, not find easy way it. well, let me try explain question using example: like shown in figure, have listbox on left , listbox on right. have menu move items around, commands "move right", "move left" , "exchange". following conditions considered: when items selected in left listbox, want command "move right" enabled, shown in figure. when items selected in right listbox, want command "move left" enabled. when items selected in both listboxes, want commands enabled. when no item selected, want commands disabled. i know can work done binding events "listboxselect" , "button-1" functions, , use functions configure menu. complex work when have 5 listboxes in actual software. wondering whether there easy way this, overloading functions in tkinter.menu class (i tried overloading post(), grid(), pack() , place(),

PHP/MYSQL Delete data when expire -

i have custom classifieds website, , in mysql have date_created , date_expire. want make script delete ads when expired. mysql table called: "ads" , has these columns: "id" "name" "email" "ad_headline" "date_created" "data_expirare" (this date when ad expire) here i've tried: http://pastebin.com/gd56bawy what you'd want run cron job every day or ( 0 0 * * * ). you'd create php file in case, within it, run following query: delete ads data_expirare < now();

java - Validate arithmetical formula -

i need validate formula calculate grade of discipline: all identifiers (a1, a2,a3,...) has been based on tests, homeworks, etc. created teachers. below example of common formula: ( (a1+a2+a3) / 3) * (b2+b3) on case, i'm need validate formula structure, like: non closed parenthesis (done); empty parenthesis groups '()' (done); duplicated operators '(a1++a2)'; duplicated distinct operators '(a1 -* a2)'; all identifiers @ formula a1,a1, etc has been informed final user, , doesn't validated. sample of valid formula: (((a1+a2+a3)/3)*2) + (((b1+b2+b3)/3)*3) sample of invalid formula: + (((a1+a2+a3)/3)*2) + (((b1+b2+b3)/3) / 3++) regular expressions regular grammars , need context-free grammar parse kind of stuff (or validate). otherwise, apply heuristics...

signal processing - plot convolution in the time domain with octave -

this plots result of conv vector of new length , t usless include in plot plot(t, z1) %doesn't work! . t = [-5:.1:10]; unit = @(t) 1.*(t>=0); h1 = @(t) (3*t + 2).*exp(-3*t).*unit(t); z1 = conv(unit(t), h1(t)); plot(z1); i want plot of convolved signal function of time. you need add shape argument. here's spec : — function file: conv (a, b) — function file: conv (a, b, shape) convolve 2 vectors , b. the output convolution vector length equal length (a) + length (b) - 1. when , b coefficient vectors of 2 polynomials, convolution represents coefficient vector of product polynomial. the optional shape argument may be shape = "full" return full convolution. (default) shape = "same" return central part of convolution same size a. so convolve this: z1 = conv(unit(t), h1(t), "same"); and you'll same time units original.

Confused about basic SQL schema table issue -

if person can have hobby many sports wants, , every sports can seen hobby many persons possible, how can create db schema table it? it's simple many-to-many realtionship: create table person ( id integer primary key, name varchar(50) not null ) create table sport ( id integer primary key, sport varchar(50) not null ) create table hobby ( personid integer, sportid integer, primary key(personid,sportid), foreign key(personid) references person(id), foreign key(sportid) references sport(id), )

ssis - DELETE in Execute SQL Command Control -

my source , destination tables on different servers , have same schema. need merge them in way if record exists in target , not exist in source should deleted destination. how can achieve in ssis. try : 1.drag oledb command , specify connection in connection manager in dialog box. 2.in component properties write sql command delete rows delete yourtable id = ? 3.in column mappings tab map ? input column id coming previous component update 2 : use lookup after oledb source .configure lookup step 1: select cache mode .generally full cache selected if number of rows less step 2:specify redirect rows no match output step 3:specify connection , write query id's(or joining column ) destination table select id destination step 4: macth id source id destination table , select checkbox id column in rhs. step 5: follow steps written before update configuring oledb command delete rows.make sure select id lookup not source while mapping oledb c

sql server - Specified store provider cannot be found in the configuration -

when publish asp.net mvc 4, ef 5.0, code-first project test or production environment following exception occurs: (error 0175: specified store provider cannot found in configuration, or not valid.) [metadataexception: das angegebene schema ist ungültig. fehler: (0,0) : fehler 0175: der angegebene speicheranbieter kann nicht in der konfiguration gefunden werden oder ist ungültig.] system.data.metadata.edm.loader.throwonnonwarningerrors() +57 system.data.metadata.edm.storeitemcollection.init(ienumerable`1 xmlreaders, ienumerable`1 filepaths, boolean throwonerror, dbprovidermanifest& providermanifest, dbproviderfactory& providerfactory, string& providermanifesttoken, memoizer`2& cachedctypefunction) +206 system.data.metadata.edm.storeitemcollection..ctor(ienumerable`1 xmlreaders) +368 system.data.entity.migrations.extensions.xdocumentextensions.getstoreitemcollection(xdocument model, dbproviderinfo& providerinfo) +361 system.data.entity.migr

client server - Java nio partial read -

my goal send different kind of messages client server, , text based. thing uncertain of how del partial reads here. have sure whole message , nothing more. do have experience that? here have far: private void handlenewclientmessage(selectionkey key) throws ioexception { socketchannel sendingchannel = (socketchannel) key.channel(); bytebuffer receivingbuffer = bytebuffer.allocate(2048); int bytesread = sendingchannel.read(receivingbuffer); if (bytesread > 0) { receivingbuffer.flip(); byte[] array = new byte[receivingbuffer.limit()]; receivingbuffer.get(array); string message = new string(array); system.out.println("server received " +message); } selector.wakeup(); } but have no way of "ending" message , have 1 full message. best regards, o you can never sure won't read more 1 message unless read 1 byte @ time. (which don't suggest). instead read as c

Javascript+Python: sending array to Python script, returning result to Javascript -

i set webpage takes number of facebook status updates via javascript api , sorts them array. i'd send array python script, can language analysis nltk. after suitable result in python, i'd return result script javascript displaying user, etc. sound possible? yes, totally. check out google app engine build sort of functionality. in particular check out these links: nltk on app engine: using python nltk (2.0b5) on google app engine , http://code.google.com/p/nltk-gae/ facebook api on app engine: https://developers.google.com/appengine/articles/shelftalkers i assume want make interactive because mentioned word "user".

Create Dates Array in Javascript -

i'm attempting create array of dates in javascript based on start date , end date. need date format 2013-04-25 my code apparently doesn't work, can't seem figure out why. can assist? //get today's date var today = new date(); today.setdate(today.getdate()); //get date last week -7 var prevweek = new date(); prevweek.setdate(prevweek.getdate() -7); //set initial date parameters var fromdate = prevweek; var todate = today; //set date parameters input parameters function setdates() { fromdate =document.getelementbyid('fromdate').value; todate = document.getelementbyid('todate').value; }; var dates = new array(); //create date array function setarray() { for(i = fromdate.getdate(), <= todate.getdate(), i.setdate(i.getdate() +1)) { dates.push(new date(i)); }; }; //format date array function formdates() { for(i = 0, <= dates.length, i++) { var dd = dates[i].getdate(); var mm = dates[i].g

javascript - grails remotefunction: can't access params -

i've got remotefunction call in javascript function in gsp file: function fncreateentitiesperforcechart() { var interval = $("#entitiesperforcetimeintervalselect").val(); interval = escape(interval); var url = '${createlink(controller: 'federation', action: 'createentitiesperforcechart')}?interval='+interval; $("#entitiesperforcechart").attr("src", url); alert("interval is: " + interval); ${remotefunction(controller: 'federation', action: 'getentitiesperforcetable', params: '\'interval\''+':'+interval, onsuccess: 'fnupdateentitiesperforcetable(data,textstatus)')}; } when check page source, remotefunction creates code: try{dojograilsspinner.show();}catch(e){} dojo.xhr('get',{content:{'interval':null}, preventcache:true, url:'/federationreporter/federation/getentitiesperforcetable

java - Eclipse RCP: command line argument without starting application -

i have rcp application had started in 3.x , have done soft migration 4.x. i need add command line argument options end-user such -version, -help etc. when user types myapp -version in console, not start application, display version number. thank you! i tried out in application class, public object start(iapplicationcontext context) throws exception { string[] args = platform.getcommandlineargs(); int = 0; while (i < args.length) { if (args[i].equals("-v")) { system.out.println("version abc"); return iapplication.exit_ok; } i++; } display display = platformui.createdisplay(); try { int returncode = platformui.createandrunworkbench(display, new applicationworkbenchadvisor()); if (returncode == platformui.return_restart) return iapplication.exit_restart; else

php - Use fputcsv() to insert a row at the top of a csv file? -

pretty simple question. know how use fputcsv() insert row csv inserts @ bottom. there way use insert @ top of csv? i need add header existing csv file. any on great. thanks! fputcsv() inserts data @ file pointer, can rewind() pointer beginning of file. rewind($handle); fputcsv($handle, $fields); alternately, can open file pointer @ beginning: $handle = fopen('yourfile.csv', 'r+'); fputcsv($handle, $fields);

java - Trouble making an executable jar with lwjgl -

when try make executable jar in netbeans error: c:\lwjgl\lwjgl-2.8.5\res directory or can't read. not copying libraries. the res folder holds files jpgs , wavs program relies on function. i'm using lwjgl, part of problem? causing this? if you're trying run .jar file , it's giving issue not ide, should able open jar file winrar or similar program , copy/paste whole res directory jar file. you use following code retrieve file in program (instead of you're retrieving "c:\lwjgl\lwjgl-2.8.5\res": resourceloader.getresource(stringlocationtoresource); this return resource trying get. the file has next src file, , not in it.

r - Mlogit crashes when testing CSV File -

i new forum , r please bear me. try make post detailed possible! the r using version 2.9.2 on mac 10.6.8. i running mlogit model on csv data. have ran analysis on test file obtained on internet contained 9000 rows & 10 columns of numerical data. able coefficients , p values required without problems , in efficient time. however, having learnt basic's using test file tried repeat analysis on data csv. csv has been deliberately formatted in same way test file , have less rows (6000) , less columns (6). though when run same summary on mlogit model freezes , becomes unresponsive. could formatting of file? size smaller don't think it's memory issues. any appreciated. thanks, james you check out formatting possibility opening both csv files in text editor. perhaps 1 comma delimited , other tab delimited.

Why are the rest parameters in JavaScript called so? -

why rest parameters in javascript called so? they called rest parameters because capture the rest of parameters when function invoked. function multiply(multiplier, ...theargs) { return theargs.map(function (element) { return multiplier * element; }); } example https://developer.mozilla.org/en-us/docs/javascript/reference/rest_parameters#browser_compatibility ...theargs captures parameters 2+. in other words, multiplier first parameter , theargs rest .

css - Translate animation fallback to position -

currently i'm using elements position: absolute transitions should use translate instead. how achive fallback when translate not available? without having additional information, i'm assuming you'd use translate when available, , position: absolute when not. found excellent article lists pros , cons, , may solve of woes. http://paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/ moving forward, may want modernizr library, provides awesome tools making cutting-edge features work on older browsers. i've posted link css docs below. http://modernizr.com/docs/#features-css

javascript - How do I redirect the window that opened a popup window to a new page by clicking a button in the popup window? -

i have page opens popup window , in popup window, have link should redirect window opened current window page called privacy.html. i know i'm supposed use window.opener refer window , found other question solution use setinterval. might useful this. how focus on opened window using window.open() anyways code , doesn't work redirect opener window can see i'm trying do. <script type="text/javascript"> function validateemail() { var emailrule = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; if (emailrule.test(document.forms[0].email.value)) { document.getelementbyid("body").innerhtml = "thank signing our newsletter! recieve confirmation email shortly."; settimeout("window.close()", 3000); } else { document.getelementbyid("message

php - Change 'magic_quotes_gpc = On' in web.config -

how change property magic_quotes_gpc = on magic_quotes_gpc = off in web.config file? it's server iis, , can not edit php.ini. i tried adding below htaccess.txt file, doesn't work. php_flag magic_quotes_gpc off php_value magic_quotes_gpc off this work (in php) ini_set('magic_quotes_gpc', 'off');

64bit - Issues when installing .exe file generated using Inno on windows xp 64 bit machine -

i have generated installer(.exe) 64 bit machine using inno 5.5.3. when try run .exe file on windows xp 64 bit machine following error message "this program not support version of windows computer running." however when run same .exe on windows 7 64 bit machine executes fine , installs application. saw similar post here unanswered , couldn't reply question(< 50 reputation). kindly guide me going wrong. , let me know if need more clarification. in advance. an installation can run in 1 of 2 modes: 32-bit or 64-bit. 64-bit mode selected if user running 64-bit version of windows , system's processor architecture included in value of architecturesinstallin64bitmode [setup] section directive. otherwise, 32-bit mode used. there [setup] directive architecturesallowed valid values: 1 or more of following, separated spaces: x86 x64 ia64 it specifies processor architecture(s) setup allowed run on. if directive not specified or blank, setup allow

What is the syntax of the formula argument in R? -

this question has answer here: meaning of ~. (tilde dot) argument? 1 answer in package nnet , following example given: # or ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), species = factor(c(rep("s",50), rep("c", 50), rep("v", 50)))) ir.nn2 <- nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1, decay = 5e-4, maxit = 200) table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = "class")) i not understand how part works: species ~ . , understand kind of formula passed argument not know search more information syntax of formulaes , . represent. please close question if duplicate, not find same question. . represents features/columns except outcome (which written on rhs of ~ ). more info can found here ?formula basically, iris3 data set, formula spe

java - Merging Arraylist of Objects and removing duplicates based on a field value -

i looking best solution below requirements. i have class similar classa below public class classa { protected list<classa.plana> plana; public list<classa.plana> getpriceplan() { if (plana == null) plana = new arraylist<classa.plana>(); return this.plana; } public static class plana { protected string code; protected xmlgregoriancalendar startdate; protected xmlgregoriancalendar enddate; // getters , setters above fields } } and have 2 objects (obj1, ojb2) of classa . requirement merge 2 objects , remove duplicates. example: classa obj1=[plana =[code=aaa, startdate=2010/12/10, enddate=2011/12/10], plana =[code=bbb, startdate=2010/12/10 enddate=<null>]] classa obj2=[plana=[code=aaa, startdate=2011/12/10], plana= [code=cc, startdate=2011/12/10 enddate=<null>], plana= [code=bbb, startdate=2010/12/10 enddate=2011/12/10]] after merging result should like:

mysql - How do I write cursor which is passed to other sql query? -

i have 1 select statement gives me following result masterid date 123 2012-10-15 00:00:00.000 124 2012-12-03 00:00:00.000 453 2012-01-07 00:00:00.000 (output having 1999 rows) now need pass output 1 scalar value function gives takes parameters like mycalculationfunction (@masterid,@date,@previousdate) i want pass above values mycalculationfunction can select function , see values each masterid also need provide previousdate there parameter. so please me create cursor can use. in sql server 2012: select mycalculationfunction ( masterid, [date], lag([date]) on (order [date]) ) mytable m order [date] in earlier versions: select mycalculationfunction ( masterid, [date], ( select top 1 [date] mytable mi

jquery - How to put text in time series chart in Flot? -

i have real time updating time series chart similar one . how can add text chart starting @ time , moves along chart? designating time range in chart belonging condition , text used this. there flot plugin can used? i think answer should , threw fiddle think answers question. jquery/flot: how coordinates of datapoint? for(var k = 0; k < points.length; k++){ for(var m = 0; m < points[k].data.length; m++){ showtooltip(graphx + points[k].xaxis.p2c(points[k].data[m][0]), graphy + points[k].yaxis.p2c(points[k].data[m][1]),points[k].data[m][1]) } } fiddle - http://jsfiddle.net/g3dzp/1/

objective c - How to use JSON for an iPhone app? -

i trying make weather app, found great json weather api online. using nsdata * data = [nsdata datawithcontentsofurl: [nsurl urlwithstring: absoluteurl]]; nserror * error; nsdictionary * json = [nsjsonserialization jsonobjectwithdata: data //1 options: kniloptions error: & error ]; nslog(@"%@", json); nslog([nsstring stringwithformat: @"location: %@", [json objectforkey: @"status"]]); to data, wont work, log returns (null) . can plase explain me how can strings , values of json file? thanks! edit: change code line 3 (including) to: nsdictionary * json = [nsjsonserialization jsonobjectwithdata:data options:0 error:&error]; nsarray *meta = json[@"objects"]; (nsdictionary *adict in meta) { nsdictionary *location = adict[@"location"]; nslog(@"%@", location); } this nslog() s locations in json response . if want city , country once can following: nsdictionary *location = json[@"

php - Insert into MySQL a variable that changes for each row -

while ($row = mysql_fetch_array($sqlquery)) { $fd = strtotime($row['date1']); $sd = strtotime($row['date2']); $dates = floor(($sd - $fd ) / 86400); $price = $dates * 25; } i want insert table $price each row. cannot single insert because $price different each time. "insert `yourtable` ('price') values ('".$price."')"; put in while loop, while ($row = mysql_fetch_array($sqlquery)) { $fd = strtotime($row['date1']); $sd = strtotime($row['date2']); $dates = floor(($sd - $fd ) / 86400); $price = $dates * 25; "insert `yourtable` ('price') values ('".$price."')"; } this means there insert every iteration of while loop, $price being different each time.

converting number to string in lisp -

i tried find lisp function convert between numbers , strings , after little googling fond function same name. when entered (itoa 1) slime printed: undefined function itoa called arguments (1) . how can conversion? from number string: (write-to-string 5) "5" you may transform string numerical notation: (write-to-string 341 :base 10) "341" from string number: (parse-integer "5") 5 with trash (parse-integer " 5 not number" :junk-allowed t) 5 or use this: (read-from-string "23 absd") 23

oracle - Select sum query does not work while implemented in a function/procedure -

i came cross problem when using 2 sum() in function called procedure. results inputted came separate. following tables, function , procedure tried. p.s. - works fine when there single sum(x). drop table match; create table match (m_id varchar2 (4) not null, ht_id varchar2 (4), at_id varchar2 (4), p_f number (3), p_a number (3)); insert match values ('m01','t1', 't2', 2, 0); insert match values ('m02','t1', 't2', 1, 1); insert match values ('m03','t1', 't2', 0, 2); insert match values ('m04','t1', 't2', 0, 2); insert match values ('m05','t2', 't1', 2, 0); insert match values ('m06','t2', 't1', 0, 2); insert match values ('m07','t2', 't1', 1, 2); insert match values ('m08','t2', 't1', 0, 2); temp table (where results stored): drop