Posts

Showing posts from February, 2015

canvas - KineticJS - How to find out which object were dragged? -

is there possibility, how realise, object moved? if had example 5 object on canvase , move 1 object, there information changed since time? thanks attach dragend handler function, event variable has targetnode, node drag event has happened on. node.on('dragend', function (event) { console.log('dragged node: ' + event.targetnode); }

excel - Compare two separate documents VBA -

so want have macro in workbook opens workbook b , c. after goes through column of workbooks b , c , 2 values equal takes value workbook c , pastes column of workbook a. i have written below code, think it's easier way please feel free write own one. thank , please me :) sub reportcomparealta() ' ' reportcomparealta macro ' adds instances column d "alta" dim varsheeta variant dim varsheetb variant dim varsheetc variant dim strvalue variant dim strrangetocheck string dim irow long dim icol long dim wbka workbook dim wbkb workbook dim wbkc workbook dim counter long set wbka = workbooks.open(filename:="g:\reporting\ah_misse_feb2013.xls") set wbkb = workbooks.open(filename:="g:\reporting\ah_misse_mar2013.xls") set wbkc = workbooks.open(filename:="g:\reporting\reportcompare.xls") set varsheeta = wbka.worksheets("localesmallcontratos") set varsheetb = wb

Control points in nurbs surfaces -

so i've read lot nurbs , understand nurbs curves ( wrote small library ). i'm having problem surfaces. can see need 2 sets of control points. problem difference between points in these 2 sets is? can briefly explain or give me link does? i think favorite way of understanding nurbs surfaces (if understand nurbs curves) beads on wire. so, let's @ simpler example of bezier surface (i assume if understand nurbs curves understand bezier curves). a cubic bezier curve has 4 control points. imagine bezier curve smooth horizontal curve. can compute point on curve given parameter value (usually called t).. plug t parametric equation of curve, , point produced. now imagine have 4 horizontal bezier curves, each 1 above other. if plug same parameter value 4 curves, 4 points, 1 each curve. beads on wires. let's call parameter value horizontal curves 's'. take 4 "bead" points , treat them control points of vertical curve. evaluate curve @ p

c# - Strange issues with WebSecurity.InitializeDatabaseConnection() and Azure hosting -

this 1 weird enough make me think overlooking obvious here. i have asp.net mvc4 application sql server 2008 database. using ef code first, code first migrations. mvc membership using simplemembershipprovider. here info regarding current state of things: the database on azure, , has latest migration run on it. i can connect database using connection string have on file, there no issue connection string can see. this has been happening intermittently throughout various publishes of site. i calling websecurity.initializedatabaseconnection("defaultconnection", "users", "userid", "username", autocreatetables: true); in global.asax my ip address allowed on database server. here application_start() method in global.asax: protected void application_start() { websecurity.initializedatabaseconnection("defaultconnection", "users", "userid", "username", autocreatetables: true); /

c# - SQL ODBC adapter out of memory exception -

i connecting , receiving data ibm's series as400 database, using odbc adapters , dataset. i have odbc connection given below: odbccommand cmd = new odbccommand(querystring, conn); // set active query odbcdataadapter rt = new odbcdataadapter(querystring, conn); // active data transfer dataset ds = new dataset(); // create dataset rt.selectcommand.commandtimeout = 180; // set command timeout rt.fill(ds); // transfer data var reader = ds.createdatareader(); // create reader reader.read(); // read while (reader.read()) { ... } and strangely gives system.outofmemoryexception on line rt.fill(ds); if there 1billion rows 130 columns cause error? how can avoid error , recieve data want? if there 1billion rows 130 columns cause error? that seems lot of data , caus

ORA-00904: "CITYCODE": invalid identifier in CREATE TABLE -

so, i'm not sql , trying jsut great 2 tables. 1 called city pk of citycode, , warehouse, uses citycode fk. , i'm not surprised if wrong. these 2 create requests: create table city ( citycode number(2), cityname varchar2(30), population number(7), primary key (citycode) ); create table warehouse ( whid number(2), address varchar2(30), capacity number(7), capacity_used number(7), mgrname varchar2(30), mgrgender varchar2(1), primary key (whid), foreign key (citycode) references city ); then when run these in isql error ora-00904: "citycode": invalid identifier. can find error select statements. thanks :) you need create column references other table. like create table city ( citycode number(2), cityname varchar2(30), population number(7), constraint city_pk primary key (citycode) ); create table warehouse ( whid number(2), a

How to share configuration files across modules in Maven -

i working on java maven project several modules. i facing issues sharing configuration files 1 module dependency. instance have module named utils holds log.properties file , use in module named gui . best practice ? currently put log.properties in config directory maven standard layout suggest it, , not included in jar file. correct ? should put in resources instead ? i use assembly plugin copy common config directory, works well, when try build each module individually config file cannot reached. how can solve ? thanks help, pierre. you should put configuration in src/main/resources/config/ . way included in jar default. maven convention src/main/java , src/main/resources contained in final jar default. making property files directly accessible other modules not practice. should provide service in module owning configuration place files accessed. service able give configurations other modules. otherwise violate single responsibility principle.

java - addding some effect like echo to audio track using AudioTrack of android -

adding effect echo audio track using audiotrack of android, want add echo, robotic effect vice changer app. if (selected_index > 6) { audioeffect effect = new audioeffect(audioeffect.effect_auxiliary /*.effect_type_env_reverb*/ , audioeffect.effect_type_null 0, 0); audioeffect audiotrack.attachauxeffect(effect.getid()); audiotrack.setauxeffectsendlevel(1.0f); //result = true ; effect.release(); audiotrack.release();

Create OpenERP model interaction with HR_Payroll -

i new openerp 7 create own model store student data , need deal objects in openerp 7 example how view basic salary employee in new model or in other words want model access data other model (for example total leaves employee) can simple example ? or if there tutorial or simple book regards, you need use inheritance concept in openerp achieve requirements. can inherit object views, methods per need. need use _inherit attribute inherit object , view, need use inherit_id override existing view. can define relation ship (many2one/one2many/many2many) between objects access data of other model. you can refer links: http://doc.openerp.com/trunk/developers/server/ http://doc.openerp.com/v6.1/developer/index.html#book-develop-link also, find such many examples in official addons code.

curl - 400 Bad Request when adding utf-8 charset to POST request -

i've build api client based on guzzle since version 3.4.2 adds utf-8 charset content-type header. header asana api returns 400 bad request error, while without charset things work fine. this doesn't work on post , put requests: content-type: application/x-www-form-urlencoded; charset=utf-8 this works: content-type: application/x-www-form-urlencoded; using curl simplest example : this 1 fails: curl -u {apikey}: https://app.asana.com/api/1.0/projects -d "name=test" -d "notes=test." -d "workspace={workspace-id}" --header "content-type: application/x-www-form-urlencoded; charset=utf-8" returns 400 bad request output : {"errors":[{"message":"request data must json object, not null"}]} this 1 succeeds: curl -u {apikey}: https://app.asana.com/api/1.0/projects -d "name=test" -d "notes=test." -d "workspace={workspace-id}" --header "content-type:

get android sendevent coordinates scale factor -

i trying write script test application when use sendevent x , y coordinates wrong. when check getevent output can see coordinates multiplied 1.65 how scale factor programmaticly ? on motorola defy cyanogenmod 7.2 (android 2.3.7) can min , max values scanner coordinates returned touch device (and other event types too) through call of getevent -p /dev/input/event3 : ~ # getevent -p /dev/input/event3 getevent -p /dev/input/event3 add device 1: /dev/input/event3 name: "qtouch-touchscreen" events: syn (0000): 0000 0001 0003 key (0001): 0066 008b 009e 00d9 0102 014a abs (0003): 0000 value 0, min 21, max 1003, fuzz 0 flat 0 0001 value 0, min 0, max 941, fuzz 0 flat 0 0010 value 0, min 21, max 1003, fuzz 0 flat 0 0011 value 0, min 21, max 1003, fuzz 0 flat 0 0018 value 0, min 0, max 255, fuzz 2 flat 0 001c value 0, min 0, max 20, fuzz 2 flat 0

c# - Surface offline maps -

i'm developing surface application, came across problem. need develop control next abilities: world map on background (should display continents). i need way find out on continent user touched(interactive background map). any controls can added on top of map control (for example video-player control different regions of map). map control should works in offline mode (without connection internet). i can't find frameworks meet goals. so, know projects/code samples can me achieve goals offline mapping done in many ways, 1 of them download / shapefile continents. (you can search that) . later can use sharpmap display shapefile in wpf application. sharpmap .net framework based open source application enables reading multiple geospatial formats. option read geo-spatial data dotspatial .

Cordova 2.7 - iOS Plugin SQLite exec deprecated -

hello phonegap experts, we have updated our ios app cordova 2.7. error message when using "phonegap ios sqliteplugin (brodyspark / latest version)". the old format of exec call has been removed (deprecated since 2.1). change to: cordova.exec (null, null, "sqliteplugin," open ", [{" name ":" dbname "," callback ":" cb1 "}]); we have tried fix error. had no success. have answer should do? best regards i started today porting phonegap-sqliteplugin-ios latest cordova api: https://github.com/j3k0/phonegap-sqliteplugin-ios it not support batch execution (transactions) yet, db.executesql requests.

visual studio - VS2012 + Nuget: MvcMailer Reference not being added after installing packages -

i have seemingly messed in vs2012 solution , cannot figure out has changed. installing package through "manage nuget packages" window (right-click on "references" in project). install succeeds, however, reference under project not show (as has before) package (in case mvcmailer). now, can stuff in package manager console, scaffold stuff using scaffold mailer.razor usermailer welcome,passwordreset and succeeds. however, when build project ton of errors on mvcmailer related stuff. tried manually adding reference (from ~/packages folder), , shows reference in project still errors. i don't know what's going on. thoughts?

flash - Are persistent sockets persistent across routers and other in between machines? -

how persistent sockets work across routers on web.i planning open persistent flash socket between machine , remote machine. there may several machines in between those. each of these maintain persistent socket continuously? how such scenario scale millions of users on web? there 2 types of socket connections, stream based (like tcp) , datagram based (like udp). even open tcp connection merely entry in routing table of each machine on path source target. open connection not consume cpu power itself, packets sent do. so answer question: yes, every machine in between maintains socket connection fine , scales well.

php - How to get an element from simplexml -

this question has answer here: simplexml node value 2 answers simplexmlelement object ( [smsmessage] => simplexmlelement object ( [sid] => xyz [dateupdated] => 2013-05-02 18:43:19 [datecreated] => 2013-05-02 18:43:19 [datesent] => 1970-01-01 05:30:00 [accountsid] => xx [to] => 09011148771 [from] => xx [body] => hello [bodyindex] => simplexmlelement object ( ) [status] => sending [direction] => outbound-api [price] => simplexmlelement object ( ) [apiversion] => simplexmlelement object ( ) [uri] => /v1/accounts/xx/sms/messages/xyz ) ) i tri

.net - Unable to POST xml with larger base64 image to commerical REST web service -

i've have .net client application sends thousands of images (as simple xml structure 1 of tags holds base64 image string) large commercial web business via rest api. works when source image file smaller approx. 120 kb. larger , "the remote server returned error: (422) unprocessable entity" error. is there might missing on client side. any ideas? thanks.

rest - A way to enforce a unique property in Firebase -

in firebase have number of items of data, in case announcements. each announcement has child property of "id", unique every announcement. there way can enforce id unique when post announcements database via rest? is, if tried add announcement same id twice, second 1 fail. suspect can rules, not sure. thanks, declan the best way achieve identify each announcement id instead of having child property. can use security rule like: ".write": "!data.exists()" if tries write announcement id exists write rule evaluate false , therefore disallowed. you can use push() method generate unique identifiers chronologically ordered.

java - Method Not Displaying Properly -

the method "aboveaverage" in following code not displaying correctly , i've tried can. please explain what's going wrong? my code: import java.util.*; public class dailycatch { private int fishermanid, fisherid; private string dateofsample, date; private double[] fishcaught = new double[10]; private int currweight = 0; private string summary; private double average; private int aboveavg; public dailycatch() { } public dailycatch (int fishermanid, string dateofsample) { fisherid = fishermanid; date = dateofsample; } public dailycatch (int fishermanid, string dateofsample, string weight) { this(fishermanid, dateofsample); readweights(weight); } public void addfish(double weight) { if (currweight > 10) { // array full } else { fishcaught[currweight] = weight; currweight += 1; // update current index of array } } private void readweights(string weightsasstring)

jsf - Navigate to requested page after login -

i know issues has been discussed many times, however, did not manage straight. appreciate if take @ this. so, have following issue: if user wants acces application through link e.g. http://example:8080/kundenportal/protected/post/post.jsf he redirected loginpage(i have phaselistener validate if logged in or not). now, after login, user wants http://example:8080/kundenportal/protected/post/post.jsf, instead redirected http://example:8080/kundenportal/protected/post/start.jsf. how can tell application user should redirected after login? know works through httprequestservlet, after checking if loggedin or not in phaselistener user redirected loginpage, means requesturl loginpage, wrong. here code. this phaselistener: @override public void afterphase(phaseevent event) { facescontext fc = event.getfacescontext(); string currentpage = fc.getviewroot().getviewid(); httpservletrequest origrequest = (httpservletrequest) fc .getexternalcont

javascript - How can I dynamically attach a scripting label to a newly created item in basil.js? -

is there way add scripting labels pageitems created in code, i.e. without using scripting label panel? my code looks this: var tf = b.text("hello world", 200, 200, 300, 300); i'm not familiar basil.js, if @ indesign reference pageitem , you'll notice there function called insertlabel can use insert label pageitem . might want @ label property.

three.js - threejs buffergeometry and wireframe -

is possible have wireframe drawing three.buffergeometry ? don't think threejs supports this, can change _gl.triangles _gl.lines (or lines_strip) in threejs source , result quite odd. http://oi40.tinypic.com/15tsux.jpg (buffer geometry on bottom) there old issue on github no solution provided https://github.com/mrdoob/three.js/issues/1275 what needs done in order enable support wireframes three.buffergeometry ? giving shot in implementing it, not sure needs done. basically what's needed utility converting mesh-formatted buffergeometries line-formatted buffergeometries.

c++ - Nontype template class member specialization -

consider following c++ code: template <int k> struct kdata { float data[k]; }; template<int k> class kclass { public: typedef kdata<k> data; data m_data; data square() { data result; for(int = 0; < k; ++i) result.data[i] = m_data.data[i] * m_data.data[i]; return result; } // specialization k = 2 template<> kclass<2>::data square(); }; template<> kclass<2>::data kclass<2>::square() { data result; result.data[0] = m_data.data[0] * m_data.data[0]; result.data[1] = m_data.data[1] * m_data.data[1]; return result; } int main() { kclass<2> c; c.m_data.data[0] = c.m_data.data[1] = 1.f; c.square(); return 0; } it has 'kcalss' has template data member ('m_data') , method performs computations on data member ('square()'). want make specialization of 'square()' case when k = 2, example. trying comp

c# 4.0 - Nuget autoupdate in website -

for customer trying build webb application can build patches (new versions) , customers can them self click in app update. i have made minor experioments on nuget before , had reference: http://haacked.com/archive/2011/01/15/building-a-self-updating-site-using-nuget.aspx unfortunatly of nuget packages installed , used in project new , not compatible nuget package of autoupdate 0.2.1 uses nuget.core 1.3.20419.9005. so took autoupdate code , upgraded nuget 2.5 , fixed new issues new nuget core (changes in functions/parameters etc.). now works far can se wich package installed, , can see there new version on remote server. howerver when try upgrade local package version on server error: system.entrypointnotfoundexception: entry point not found. this code goes wrong: public ienumerable<string> updatepackage(ipackage package) { return this.performloggedaction(delegate { bool updatedependencies = true; bool allowprereleasevers

iphone - How to know any UI rendering is completed in automation code -

i wanting know button rendered on main window ui or not. button rendering depending on server response result (written in objective c). if server response comes becomes render (visible) otherwise not present there (invisible). , whenever becomes visible tap on further next process. i wrote code uiatarget.localtarget().pushtimeout(200); //my code uiatarget.localtarget().poptimeout(); by above code have wait till 200 sec concern want wait whenever object on screen don't want keep me busy in waiting mode. how write code in automation? thanks ok, might give idea how follow-up: for view implement accessibilityvalue method returns json formatted value: - (nsstring *)accessibilityvalue { return [nsstring stringwithformat: @"{'mybuttonisvisible':%@}", self.mybutton.ishidden ? @"false" : @"true"]; } then somehow can access test javascript: var thisproperty = eval("(" + element.va

c# - Is it possible to get a NullReferenceException with a null coalescing operator and a 'as'? -

i'm moniterring application , got a... nullreferenceexception object reference not set instance of object. the stack trace points accurately line of code : this.modelcontrol = this.modelcontrol creeretablissementmodel ?? new creeretablissementmodel(); is possible this.modelcontrol creeretablissementmodel throw exception before doing ?? ? edit by request... you'll need class member (it's inherited in case) private const string modelcontrol = "modelcontrol"; public object modelcontrol { { return (object)httpcontext.current.session[modelcontrol] ?? new object(); } set { httpcontext.current.session[modelcontrol] = value; } } no, not possible as in combination null coalescing operator throws nullreferenceexception . the exception originates within property. either httpcontext.current or httpcontext.current.session null . you can check setting break point in getter of property.

javascript - Fancybox initiated element -

i have grid in displaying multiple deals. each deal has multiple sub deals. have display sub deals in fancybox popup of respective deal on click event. have store deal id in data attirbute of anchor element. stuck when sending ajax request cannot pass respective deal id since unable element clicked. here code: $('.deal_parent').fancybox({ href : subdealurl, ajax : { type : "get", data : 'deal='+{here want pass deal id dynamically}, }, 'overlayopacity' : '0.2', 'transitionin' : 'elastic', 'transitionout' : 'fade', }); i have tried passing $(this).data('deal') there doesnt worked. try invoking fancybox differently, e.g.: $('.deal_parent').click( function () { // can use $(this) $.fancybox({ href : subdealurl, ajax : { type : "get", data :

security - How to ban IP addresses dynamically on Amazon AWS, with firewall? -

i ban ip addresses dynamically, when software detects malicious activity (hitting 10 page in row in 10 second or specific useragent or ), creates ".txt" file blacklisted ip-s. i have 4 ways go: ban ip firewall, not reach ec2 instance, nor s3. create .htaccess rewritemap, ip list, ban them httpd.conf ban ip @ begining of php reading ip list .txt file (no need connect mysql, feel safer). ban ip @ begining of php, reading ip list mysql. obviously, first 1 ideal, there way accomplish that? unfortunately, new amazon aws. you use aws sdk such boto or command line tools update security groups , s3 iam policies on fly, accomplishing option #1. check out sdk docs more information.

c - Sum of adding the elements of an array gives me the wrong output? -

i using shared memory add elements of array using 2 different child processes out put not wrong. , segmentation fault. int main() { int a[100],i,k,s1=0,s2=0,lim=100; int status1,status2; pid_t pid1,pid2; int perm=s_irwxu|s_irwxg|s_irwxo; int fd=shmget(ipc_private,1024,ipc_creat|perm); if(fd<0) { printf("error"); _exit(0); } int* sum=(int*)shmat(fd,null,0); if(*sum==-1) { printf("error\n"); _exit(0); } *sum=0; for(i=0;i<lim;i++) { a[i]=i; } if((pid1=fork())==0) { for(i=1;i<lim;i+=2) { s1 += a[i]; } exit(s1); } else if((pid2=fork())==0) { for(i=0;i<lim;i+=2) { s2+= a[i]; } exit(s2); } else { printf("the elements of array are\n"); for(i=0;i<lim;i++) printf("%d\t",a[i]); waitpid(pid1, &status1, 0); *sum = *sum+wexitstatus(status1); waitpid(pid2, &status2, 0); *sum = *sum+ wexitstatus(status2); printf("\nsum of member

c# - Async Delegates Callback Pattern leveraging Func -

all - i have sample code async delegates utilizes callback pattern. using standard delegates , code below works fine. wanted convert func delegates (since expecting , int , returning int) reason - seem stuck. can please help. class program { public delegate int somedelegate(int x); static void main(string[] args) { console.writeline("this callback pattern technique asynchronous delegates in threading"); console.writeline(""); somedelegate sd = squarenumber; console.writeline("[{0}] before squarenumber method invoked.", thread.currentthread.managedthreadid); iasyncresult asyncres = sd.begininvoke(10, new asynccallback(callbackmethod), null); console.writeline("[{0}] in main after squarenumber method invoked. doing processing.", thread.currentthread.managedthreadid); console.writeline("[{0}] main method processing completed.", thread.currentthread.managedthreadid

javascript - JQuery navigation tree open/close on click -

i'm not jquery or javascript expert , have little problem website navigation. navigation looks typical windows resource management navigation e.g: title subtitle subtitle subsubtile subtitle title subtitle i want works same typical windows resource management navigation, when click title subtitles able see , when reclick title it's hide clicked title subtitles. with following code able open titles, don't have idea how close them. $( document ).ready(function() { $('#navigation').click(function() { $('#navigation ul li:hover').children('#navigation ul li ul').slidedown(400); }); }) there convenient shorthand in jquery: .slidetoggle() the selected element displayed if it's not, , vica-versa. the other important part is, can use $(this) in event handler. element event handled on. also .children() tree traversal function. means it's results selected relative selected elements c

windows runtime - Uniquely identify a user on WinRT and WP8 using (f.ex.) LiveID? -

i looking way uniquely identify user in winrt , preferably in wp8 well. in wp7 applications, hash of live id this, not sure of how approach in winrt environment. 1 of goals here identify user in windows 8 environment whole. using liveid in 1 form or ok in case. found sources mentioned might require enterprise security permissions (or such) not welcome in windows marketplace. say want identify user based on live id, want automatically , across multiple devices (pc, tablet, maybe wp8). resources should looking for? you can obtain id of each live user if using live sdk . here's code you. private async task<string> getliveuserid() { string id = ""; var auth = new liveauthclient(); var loginresult = await auth.loginasync(new string[] { "wl.signin", "wl.basic" }); if (loginresult.status == liveconnectsessionstatus.connected) { var liveclient = new liveconnectclient(loginresult.session); var mydata =

How could i get the sqlite date delta in SQLAlchemy -

i have sqlite table column final_date in integer type (use date). want calculate number of days column now. in sqlite, can run sql of function (julianday) following. select (julianday(final_date) - julianday('now')) days bond days > 0 109.407374872826 482.407374872826 488.407374872826 .... however, in sqlalchemy, code following can not accurate number of days. today = datetime.today().date() query = session.query( bond.final_date - today ) i wonder whether there effective way apply function julianday sqlalchemy code or whether there alternative native approach in sqlalchemy accomplish this. if have control on database , data - may want update schema define column sqlalchemy.types.datetime . use datetime module make calculations dates. or can use sqlalchemy.sql.func access julianday() sqlite function. from sqlalchemy.sql import func q = session.query( func.julianday( bond.final_date) - func.julianday("now")) row in q.all():

python - Counting same elements in an array and create dictionary -

this question might noob, still not able figure out how properly. i have given array [0,0,0,0,0,0,1,1,2,1,0,0,0,0,1,0,1,2,1,0,2,3 ] (arbitrary elements 0-5) , want have counter occurence of zeros in row. 1 times 6 zeros in row 1 times 4 zeros in row 2 times 1 0 in row => (2,0,0,1,0,1) so dictionary consists out of n*0 values index , counter value. the final array consists of 500+ million values unsorted 1 above. this should want: import numpy np = [0,0,0,0,0,0,1,1,2,1,0,0,0,0,1,0,1,2,1,0,2,3] # find indexes of zeroes index_zeroes = np.where(np.array(a) == 0)[0] # find discontinuities in indexes, denoting separated groups of zeroes # note: adding true @ end because otherwise last 0 ignored index_zeroes_disc = np.where(np.hstack((np.diff(index_zeroes) != 1, true)))[0] # count number of zeroes in each group # note: adding 0 @ start first group of zeroes counted count_zeroes = np.diff(np.hstack((0, index_zeroes_disc + 1))) # count number of groups same num

java - .class expected error in my method and sometimes missing return statement error -

i new java , don't know why piece of code isn't compiling. isn't return result. suggestions? public static char isprime(int x) { for(int y=2;y<x;y++) char result = 'r'; if(x%y==0) result = 't'; else result = 'f'; return result; } or public static char isprime(int x) { char result = 'r'; for(int y=2;y<x;y++) if(x%y==0) result = 't'; else result = 'f'; return result; } if use braces, code this: public static char isprime(int x) { for(int y=2;y<x;y++) { char result = 'r'; } if(x%y==0) { result = 't'; } else { result = 'f'; } return result; } as can see, va

Perl - determining the intersection of several numeric ranges -

i able load long list of positive integer ranges , create new "summary" range list union of intersections of each pairs of ranges. and, want in perl. example: sample ranges: (1..30) (45..90) (15..34) (92..100) intersection of ranges: (15..30) the way think of using bunch of nested if statements determine starting point of sample a, sample b, sample c, etc. , figure out overlap way, it's not possible hundreds of sample, each containing numerous ranges. any suggestions appreciated! the first thing should when need thing take @ cpan see tools available of if has solved problem already. set::intspan , set::intrange on first page of results "set" on cpan. what want union of intersection of each pair of ranges, algorithm follows: create empty result set. create set each range. for each set in list, for each later set in list, find intersection of 2 sets. find union of result set , intersection. new result set. enumerate elemen

How to execute some jQuery or JavaScript code after a redirect has completed -

how can execute jquery/js code jquery/js redirect like... $(location).attr('href','/target_path'); ...or... window.location.href = "/target_path"; ...has finished loading new page? specifically, need pass alert message , insert , display (enclosed in html) on new page. it impossible tell javascript execute code after redirect. however have different options: pass string in redirect url , on "ready" store information in cookie , on "ready" store data using dom storage (namely sessionstorage ) if don't mind smaller browser support

ggplot2 - R circular LOESS function over 24 hours (a day) -

Image
i have data free parking slots on hours , days. here's random sample of 100. sl <- list(emptyslots = c(7, 6, 20, 5, 16, 20, 24, 5, 24, 24, 15, 11, 8, 6, 13, 2, 21, 6, 1, 6, 9, 1, 8, 0, 20, 9, 20, 11, 22, 24, 1, 2, 12, 6, 8, 2, 23, 18, 8, 3, 20, 2, 1, 0, 5, 21, 1, 4, 20, 15, 24, 12, 4, 14, 2, 4, 20, 16, 2, 10, 2, 1, 24, 9, 22, 7, 6, 3, 20, 13, 1, 16, 12, 5, 2, 7, 4, 1, 6, 1, 1, 2, 0, 13, 24, 6, 13, 7, 24, 24, 15, 6, 10, 1, 2, 9, 5, 2, 11, 15), hour = c(8, 16, 23, 14, 18, 7, 17, 15, 19, 19, 17, 17, 16, 14, 17, 12, 19, 10, 10, 13, 16, 10, 16, 11, 12, 9, 0, 15, 16, 21, 10, 11, 17, 11, 16, 15, 23, 7, 16, 14, 18, 14, 14, 9, 15, 2, 10, 9, 19, 17, 20, 16, 12, 17, 12, 9, 23, 9, 15, 17, 10, 12, 18, 17, 18, 17, 13, 10, 7, 8, 10, 18, 11, 11, 12, 17, 12, 9, 14, 15, 10, 11, 10, 10, 20, 16, 18, 15, 21, 18, 17, 13, 8, 11, 15, 16, 11, 9, 12, 18)) a quick way calculate loess function via ggplot2 . sl <- as.data.frame(sl) library(ggplot2) qplot(hour, emptyslots, data=sl,

x++ - Find code that's running in a Batch Job -

on increasing basis, need support our dynamics ax 2009 environment. i'm starting far, please bare me :) i'm trying troubleshoot possible issue batch job. so i'm going in basic/inquiries/batch jobs. from there, can see configured batch jobs. i'm @ loss find class methods/jobs/batches they're calling can browse x++ that's being executed each of them. i went in "view tasks" nothing significant there either. i went in aot/jobs can't find remotely looking "job description" field in basic/inquiries/batch jobs. any pointers ? thanks! when looking @ batch job screen, can click on "view tasks" button. show class name of task. must go aot , navigate classes , find class in class name field. should give starting point.

Mongodb query on date has no results (java) -

my mongodb query not returning results , can't spot why. here relevant contents of data: > db.reports.find({},{enddate:1}) { "_id" : objectid("5182882ae4b032c67674c494"), "enddate" : isodate("2013-05-02t15:37:11.032z") } { "_id" : objectid("51828859e4b032c67674c495"), "enddate" : isodate("2013-05-02t15:37:57.749z") } so have 2 entries dates 2013-05-02 15:37:11-57 i want find entries date less or equal latest date, no results using query: db.reports.find({ "enddate" : { "$lte" : { "$date" : "2013-05-02t15:37:11.032z"}}},{enddate:1}) i generating query in java using: basicdbobject oldreportselector = (basicdbobject) basicdbobjectbuilder.start() .add("enddate", basicdbobjectbuilder.start().add("$lte",mydate).get()) .get(); what doing wrong here? edit add: mydate calculated using: date enddate = new date(

Java MySQL query named parameters? -

is there way have named parameters in java mysql query? like this: select * table col1 = :val1 , col2 = :val2 instead of this: select * table col1 = ? , col2 = ? update: im' using java.sql.* , interested in alternatives capable of this. maybe hibernate choice you. provided query style description, , it's powerful , convenient persistence work you'll feel cool. e.g query query = sesion.createquery("from student s s.age = :age"); query.setproperties(student); see doc: http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/query.html#setparameter(java.lang.string, java.lang.object)

Difference between empty Matlab struct S and all elements S(:) -

my question is: difference between s , s(:) if s empty struct. i believe there difference because of question: adding field empty struct minimal illustrative example: s = struct(); %create struct s(1) = []; %make empty [s(:).a] = deal(0); %works [s.b] = deal(0); %gives error the error given: a dot name structure assignment illegal when structure empty. use subscript on structure. [s(:).b] = deal(0) equivalent [s(1:end).b] = deal(0) , expands [s(1:numel(s)).b] = deal(0) , or, in particular case [s(1:0).b] = deal(0) . thus, deal none of elements of structure, i'd expect work, though still find surprising add field b . maybe particular weirdness, can access through explicitly specifying list of fields, caught error. note if want create empty structure field b , can alternatively write s(1:0) = struct('b',pi) %# pie or no pie won't change though gives 0x0 structure.

c# - "The name 'GRID' does not exist in the current context" error -

list item hey guys have been doing first ever windows forms/c# application , cannot rid of error. i've dragged , dropped data grid view form , renamed grid , problem persists. here code: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.io; //added using system.windows.forms; using system.runtime.serialization.formatters.binary; //added using system.runtime.serialization; //added namespace testowa // name of project { public partial class form1 : form { public form1() { initializecomponent(); } private void initializecomponent() { throw new notimplementedexception(); } [serializable] // allow our class saved in file public class data // our class data { public string name; public string surname; public string city; public string number; } private void savetoolstripmenuitem_click(object sender, eventargs e) { grid.endedit(); savefiledialog sa

jQuery html content of atribute data-x? -

is possible show in qtip2 html content attribute data-x? jquery-this code not work html in attribute data-x $('.icon[data-x]').qtip({ content: { attr: 'data-x' }, position: { my: 'bottom center', at: 'top center' } }); html <span class="icon" href="#" data-x="<strong>html</strong><br>content"></span> you can this: var $icon = $('.icon[x]'); $icon.qtip({ content: $icon.attr('x') });

algorithm - Significance of various graph types -

there lot of named graph types . wondering criteria behind categorization. different types applicable in different context? moreover, can business application (from design , programming perspective) benefit out of these categorizations? analogous design patterns? we've given names common families of graphs several reasons: certain families of graphs have nice, simple properties . example, trees have numerous useful properties (there's 1 path between pair of nodes, they're maximally acyclic, they're minimally connected, etc.) don't hold of arbitrary graphs. directed acyclic graphs can topologically sorted , normal graphs cannot. if can model problem in terms of 1 of these types of graphs, can use specialized algorithms on them extract properties can't obtained arbitrary graph. certain algorithms run faster on types of graphs . many np-hard problems on graphs, of don't have polynomial-time algorithms, can solved on types of graphs. exam