Posts

Showing posts from January, 2011

sql - Querying in rails on attr_encrypted column -

i have ruby on rails app , using attr_encrypted gem encrypt user info. has salt , iv 2 way encrypted. gem intercepts dynamic find_by assist querying, not sufficient query case care number of results. is there way query table return results match given secret ? here example. have users table , has encrypted secret attribute. table has encrypted_secret , encrypted_secret_iv , , encrypted_secret_salt . if user gave secret of "abd123", how can query table see how many others have used "abc123" secret? you save additional secret_hash of unencrypted secret. if 2 records have same secret have same secret_hash too. add following model: scope :by_secret, ->(secret) { where(secret_hash: digest::md5.hexdigest(secret) } before_save :generate_secret_hash private def generate_secret_hash self.secret_hash = digest::md5.hexdigest(secret) end after that, can query this: yourmodel.by_secret('abd123').count warning storing md5...

matlab - How to pass values into a matrix with discontinuous index in parfor loop -

i have met problem when passing values specific position in matrix in parfor loop. example: array2 = zeros(6,3); ind = [1,3,5]; parfor i=1:3 array1 = [1,2,3;4,5,6]; % generated function x(i); array2(ind(i):ind(i)+1,1:3) = array1(1:2,1:3); end one function calculate , generate different array1 different i. want save results array2. when used simple loop, worked well. when tried apply parfor loop, error came: error: variable array2 in parfor cannot classified. can provide way circumvent problem? many thanks!

javascript - Uncaught ReferenceError: timerFunc is not defined -

function timerfunc() { alert("howdy"); settimeout("timerfunc()",5000); } timerfunc(); this simple function seems causing kind of trouble, idea why? i'm getting "uncaught referenceerror: timerfunc not defined " error on chrome use function name without quotes: function timerfunc() { alert("howdy"); settimeout(timerfunc, 5000);//<-- quotes removed } timerfunc(); you can use setinterval repetitive task: function timerfunc() { alert("howdy"); } timerfunc(); setinterval(timerfunc, 5000);

security - java.util.PropertyPermission when a applet error occurs -

i writing java applet implement bt streaming , kind of errors occurs. following java error details: java.lang.runtimeexception: java.lang.reflect.invocationtargetexception @ com.sun.deploy.uitoolkit.impl.awt.awtappletadapter.runonedtandwait(unknown source) @ com.sun.deploy.uitoolkit.impl.awt.awtappletadapter.instantiateapplet(unknown source) @ sun.plugin2.applet.plugin2manager.initappletadapter(unknown source) @ sun.plugin2.applet.plugin2manager$appletexecutionrunnable.run(unknown source) @ java.lang.thread.run(unknown source) caused by: java.lang.reflect.invocationtargetexception @ com.sun.deploy.uitoolkit.impl.awt.oldpluginawtutil.invokeandwait(unknown source) ... 5 more caused by: java.security.accesscontrolexception: access denied ("java.util.propertypermission" "user.home" "read") @ java.security.accesscontrolcontext.checkpermission(unknown source) @ java.security.accesscontroller.checkpermission(unknown sou...

gtk How to highlight the next line of textview? -

i have highlight second line (arr[ii+1]). i'm tryng remove previous tag 2 iterators , add highlight new line others 1 : sprintf(buffers,"%s",arr[ii]); if(cuno==0) { gtk_text_buffer_get_end_iter(buffer, &ei); gtk_text_buffer_insert(buffer, &ei, buffers, -1); gtk_text_buffer_get_end_iter(buffer, &ei); gtk_text_buffer_insert(buffer, &ei, "\n", -1); cuno++; } sprintf(buffers2,"%s",arr[ii+1]); gtk_text_buffer_create_tag(buffer, "gray_bg","background", "gray", null); gtk_text_buffer_get_end_iter(buffer, &ei2); g...

Usage of function type congruent lambda expressions in Java 8 -

i struggle definition , usage of stream.collect(supplier<r> supplier, biconsumer<r,? super t> accumulator, biconsumer<r,r> combiner) method in java 8. the method signature includes biconsumer typed parameters. biconsumer functionalinterface defines 1 functional method accept(object, object) . far understand can use lambda expression congruent functional interface. but example mentioned in stream.collect javadoc e.g. list<string> aslist = stringstream.collect(arraylist::new, arraylist::add, arraylist::addall); i not understand why arraylist.add(e e) (single parameter) congruent biconsumer.accept(t t, u u) method (two parameters) , can used accumulator function in collect method. as see have lack of understanding , appreciate explanation. the accumulator biconsumer's 2 parameters (1) list , (2) item add it. this: list<string> aslist = stringstream.collect( arraylist::new, arraylist::add, arraylist::addall )...

Creating User in dotnetnuke and Assign Role using c# -

Image
i'm trying create user programatically using c# in dnn. when ever execute code below, throws object reference error. tried breaking code , found out not getting inside if (result == usercreatestatus.success) statement. whenever point mouse result instant, shows invalid password message. thing have used same code before somewhere else , working fine. copied used earlier on keeps showing same error. please there i'm missing? //generating 8 char passwor random adomrng = new random(); string rndstring = string.empty; char c; (int = 0; < 8; i++) { while (!regex.ismatch((c = convert.tochar(adomrng.next(48, 128))).tostring(), "[a-za-z0-9]")) ; rndstring += c; } string space = " "; userinfo ouser = new userinfo(); ouser.portalid = this.portalid; ouser.issuperuser = false; ouser.firstname = session["fname"].tostring(); ouser.lastname = session["lname"].tostring(); ouser.email = session["email"].tostring(); ouser.usernam...

Need help to control LCD screen with Raspberry and Python -

i have lcd connected raspberry , controled python code i'd write word (like typewriting), letter after letter i've tried different possibility no success. , i'm stucked. need help here code control writing on lcd : # send centred test lcd_byte(lcd_line_1, lcd_cmd) lcd_string("sentence one",2) lcd_byte(lcd_line_2, lcd_cmd) lcd_string("sentence two",2) lcd_byte(lcd_line_3, lcd_cmd) lcd_string("sentence three",2) lcd_byte(lcd_line_4, lcd_cmd) lcd_string("sentence four",2) not tested , guess should started import time def typewriter_like(sentence, lcd_line, delay=1): i,letter in enumerate(sentence): lcd_byte(lcd_line, lcd_cmd) lcd_string(sentence[:i+1], 2) time.sleep(delay) # use typewriter_like("sentence one", lcd_line_1)

How to populate parse.com table via uploading csv/json file using javascript -

i need upload cvs/json file directly parse table populate data (bulk insert) client side website as per parse documentation , seems below curl command can upload file it's not clear how point specific parse table. is there equivalent code snippet call below curl command java script need make call client side website accept cvs/json file input , load data curl -x post \ -h "x-parse-application-id: x4ja65sbrnuk88zgbaqgiur9fwdnvk1qzsszehzu" \ -h "x-parse-rest-api-key: eqvlrkxqrsbilubm6py3vvlzkm9a4v0n63cpwrqa" \ -h "content-type: text/plain" \ -d 'hello, world!' \ https://api.parse.com/1/files/hello.txt that rest call upload file storage in parse. won't let import database. because want run programmatically website, you'll have use rest apis. you'll need run through each object want insert, , make rest api call insert in database. can save api hits batching them together, in blocks of 50. there manual s...

css - How can I show in HTML a file? -

i have next problem, want make tutorials , want use github save files , website show code raw file. the file can html, css, javascript, python , more. for example 1 of files on link . think code in html can be: <iframe src="https://raw.githubusercontent.com/tonylattke/python_helpers/master/10_0_importing_files.py"></iframe> but doesn't work. time , appreciate help <object data="mpsc syllabus.pdf" type="application/pdf" width="100%" height="100%"> </object> i think solve problem. please dont forget tick answer right if works you.

jQuery UI datepicker and mobile "wrapper" -

i have tried use mobile "wrapper" jquery ui datepicker based on that page working code (part of wordress template) looks like: header: <link type="text/css" href="/css/custom-theme/jquery-ui-1.8.18.custom.css" rel="stylesheet" /> <script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script> part of html: <script> jquery(document).ready(function() { jquery("#datastart").datepicker({ mindate: '+2d', changemonth: true, changeyear: true, dateformat: 'mm/dd/yy', onselect: function(date){ var dates = date.split('/'); var lastdate = new date(dates[2], dates[0], 0); var y = lastdate.getfullyear(), m = lastdate.getmonth(), d = lastdate.getdate(); m = ('0'+ (m+1)).slice(-2); jquery('#dataend').val(m+'/'+d+'/'+...

Background changing not working on Windows Phone 8 -

i want change background image on windows phone 8 app. following code not work: <phone:panorama.background> <imagebrush imagesource="/panoramaapptest;component/assets/background.png"/> </phone:panorama.background> you should try image source. this; <phone:panorama.background> <imagebrush imagesource="/assets/background.png"/> or <phone:panorama.background> <imagebrush imagesource="../assets/background.png"/> </phone:panorama.background> actually don't know problem's location name.

r - %dopar% or alternative method to speed up sequential stochastic calculation -

i have written stochastic process simulator speed since it's pretty slow. the main part of simulator made of for loop re-write foreach `%dopar%. i have tried doing simplified loop i'm running problems. suppose for loop looks library(foreach) r=0 t<-rep(0,500) for(n in 1:500){ s<-1/2+r u<-runif(1, min = 0, max = 1) if(u<s){ t[n]<-u r<-r+0.001 }else{r<-r-0.001} } which means @ each iteration update value of r , s and, in 1 of 2 outcomes, populate vector t . have tried several different ways of re-writing foreach loop seems each iteration values don't updated , pretty strange results. have tried using return doesn't seem work! this example of have come with. rr=0 tt<-foreach(i=1:500, .combine=c) %dopar% { ss<-1/2+rr uu<-runif(1, min = 0, max = 1) if(uu<=ss){ return(uu) rr<-rr+0.001 }else{ return(0) rr<-rr-0.001} } if impossible u...

mysql - Add a dummy row when the query returns at least one result -

i have seen few sql questions regarding "how add row when none exists" or "how return dummy row when no result found", can't figure out way opposite result. objective here add row whenever there's @ least 1 result found. however, when no result found, nothing should returned. given following users table: id username ------------------ 1 bob 2 alice and dummy row (which isn't stored in db) : id username ------------------ 0 dummy here result i'm trying get: # query: find users id 1. id username ------------------ 1 bob 0 dummy # query: find users id 3. (empty set) # query: find users id 0. (empty set) of course, dummy row added once (and not once per actual record). now, working following query... select * ( select * users id = 1 union select 0, 'dummy' ) yet, adds dummy row in cases, when first sub- select returns empty set. there way add row when necessary? note: my...

python - Error building uwsgi with pip in virtual environment -

i getting errors when try install uwsgi in virtual environment in centos vps. ultimately, cannot install uwsgi. i using : pip install uwsgi and : pathtovirtualenv/bin/pip install uwsgi i following output on terminal: wwwthecanonworks@thecanonworks.com [~]# ~/thecanonworks/env/bin/pip install uwsgi downloading/unpacking uwsgi downloading uwsgi-2.0.8.tar.gz (775kb): 775kb downloaded running setup.py (path:/home/wwwthecanonworks/thecanonworks/env/build/uwsgi/setup.py) egg_info package uwsgi installing collected packages: uwsgi running setup.py install uwsgi complete output command /home/wwwthecanonworks/thecanonworks/env/bin/python2.7 -c "import setuptools, tokenize;__file__='/home/wwwthecanonworks/thecanonworks/env/build/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ry9jum-record/install-record.txt --single-vers...

change string to customize format on SQL -

i have string format saved on table.the format - `11/apr/2014 2:30:00 pm-11/apr/2014 4:00:00 pm`. using format want return customize format while running stored procedure. format should be- `9.00 10.00 am`. this i'm trying : substring(leavemanagement.employeeleavetransaction.period, 12, 5) + substring(leavemanagement.employeeleavetransaction.period, 20, 3) + ' ' + substring(leavemanagement.employeeleavetransaction.period, 36, 5) + substring(leavemanagement.employeeleavetransaction.period, 44, 3) but returns wrong format if original string have 11/apr/2014 12:30:00 pm-11/apr/2014 4:00:00 pm can me this.i trying using query seelct substr(col_name,instr(col_name,' ',1,1)+1,5)|| substr(col_name,instr(col_name,' ',1,2),3) || ' ' || substr(col_name,instr(col_name,' ',1,3),5) || substr(col_name,instr(col_name,' ',1,4),3) table_name

Xpages error sending email from application -

in of document in application have button sends email document email in input field. it worked, reason, don't know why, not working anymore. this ssjs have in button onclick method: if(docinfo.isnewnote()){ docinfo.save(); } var thisdoc = docinfo.getdocument(true); var tempdoc = database.createdocument(); tempdoc.replaceitemvalue("form", "memo"); tempdoc.replaceitemvalue("sendto", thisdoc.getitemvalue("destinatar")); tempdoc.replaceitemvalue("subject", "title"); var tempbody:notesrichtextitem = tempdoc.createrichtextitem("corp"); thisdoc.save(true,true); tempbody.appendtext("some text:") tempbody.addnewline(2); tempbody.appendtext(facescontext.getexternalcontext().getrequest().getrequesturl().tostring() + "?action=readdocument&documentid=" + thisdoc.getuniversalid()); tempdoc.send(); thisdoc.recycle(); ...

hadoop - Apache Pig: filter based on tupple member content -

i'm learning apache pig , have encountered issue realise wish. i've object (after doing group by): mlset_1: {group chararray,mlset: {(key: chararray, text: chararray)}} i'd generate key when pattern (pattern_a) appears in text , pattern (pattern_b) not appear in text field 1 key. i know can use mlset.text tupple of text values specific key i'm still having same issue on how filter on list of items tuple. here's example: (key_a,{(key_a,start),(key_a,stop),(key_a,unknown),(key_a,whatever)}) (key_b,{(key_b,stop),(key_b,whatever)}) (key_c,{(key_c,start),(key_c,stop),(key_c,whatever)}) i'd keys lines "start" appears , "unknown" not appears. in example key_c result. thanks in advance ! here's code might out. solution nested foreach here: c = foreach mlset_1 {f1 = filter mlset (text == pattern_a); f2 = filter mlset (text != pattern_b); generate group, count(f1) cnt1, count(f2) cnt2;}; d = filter c (cnt1 > 1 , cnt...

javascript - PDFObject library: catching error - or how to know when my PDFObject is empty -

i have question use pdfobject library. ( http://pdfobject.com/ ) (i use angularjs in front end) //this html code: <div id="boxpdf"></div> //here code in controller var pdfurl = '/myurl/myrestservice/'+iddocument; var mypdf = new pdfobject({ url: pdfurl, pdfopenparams: { width: "100%", height: "1500" }, id: 'myidobject' }); mypdf.embed('boxpdf'); the code works, annoying thing if send backend empty pdf, library anyway shows gray box. i'd catch exeption , don't show gray box example. how can mypdf , understand if full or empty? attention , sorry bad english, igor sorry, not possible use javascript determine whethe...

Easy way to transform XPath with contains to equals check? -

is there easy way transform xpath query (as string), like: my/x/path[contains(sub/path, 'text')] to xpath query uses equals instead of contains ? such can use same query, 1 time contains , time equals ? unfortunately there no "equals" function in xpath... you might differentiate between 2 options via flag: my/x/path[ ($wantcontains , contains(sub/path, 'text')) or (not($wantcontains) , sub/path = 'text') ]

vim plugin - Vim commands containing `r` cause me to replace -

i'm using vim , python-mode extension, i'm having hard time using commands contain r . it's causing vim replace characters instead of executing desired command. here vim docs python-mode - let g:pymode_rope_organize_imports_bind = '<c-c>ro' so i'm doing ctrl-c r o , said, it's replacing ever character i'm under letter o . what missing? it seems mapping not being interpreted vim, sees ctrl-c, default aborts current action, replace command r (see :help r ) followed "argument". you check if mapping defined :map <c-c> . if correctly defined may terminal handling ctrl-c directly , not passing vim, stated in vim faq 20.5 - why mapping key not work? . in case follow instructions on vim faq 20.4 - not able create mapping key. wrong? , in special: 1) first make sure, key passed correctly vim. determine if case, put vim in insert mode , hit ctrl-v (or ctrl-q if ctrl-v remapped paste operation (e.g. on w...

testing - Jmeter deviation vs throughput -

can give some.explanation on how interpret deviation vs.throughput? 1000++ deviation result means poor performance of web under test? , how can web under test performs good? base on.throughput result? how? and listener best tracing load/performance of thousand users lastly possible check cpu/ram usage of server while pwrforming test standard deviation quantifies how response time varies around mean, or average. not advisable judge system performance based on standard deviation. in reality gives how system fluctuating. deviations should minimum i.e. less 5%. thoughput defined number of requests processed per second. it better use throughput factor judge system/application performance. higher throughput means system performance again depends on choice. critical systems low response time more required high throughput. throughput states how concurrent transactions system can process per second might mean high response time. if response time increases beyond limit s...

bluetooth lowenergy - BTLE Corebluetooth iOS Transfer an array -

i playing apple sample code btle_transfer https://developer.apple.com/library/ios/samplecode/btle_transfer/introduction/intro.html in sample, ios device "a" sends ios device "b" "text" (nsstring) when b (central) subscribe characteristic of "a" (peripheral). (the data cut in pieces sent piece until received on other side) i modified code transfer image using uiimagejpegrepresentation method , working fine (but takes long when size of image on 2 ko) now try transfer array of different objects text, image. i have tried code below in didsubscribetocharacteristic method (peripheral manager side): nsarray *myarray; myarray = [[nsarray alloc]initwithobjects:@"text1", @"text2", nil]; _datatosend = [nskeyedarchiver archiveddatawithrootobject:myarray]; where _datatosend nsdata sent and code below in didupdatevalueforcharacteristic method (central side - peripheral delegate): nsarray *my2array = [nskeyedunarchiver u...

java - "Failed to export application" in Eclipse 4.4.1 for Android with ADT 23.0.4 -

Image
when want export android app eclipse, export process starts after few seconds (when whole process should take minute) fails. following error message appears: failed export application that's eclipse telling me. i'm using ecliipse 4.4.1 android development toolkit 23.0.4.1468518. when right-click app, choose "android tools" , "export unsigned application package", fails again, more verbose error messages: as can see, says: 'android release export' has encountered problem. failed export application and strangely, lists file bin/$1$1.class apparently cannot found. there's no obvious reason why file shouldn't found, however. only when delete folders bin , gen , clear project, works. once -- , after every successful run on device or export apk, have repeat step described before. any ideas why happens? lot in advance! i had multiple issues export application package in eclipse before. switching projec...

java - App wont run on Eclipse emulator -

i trying check app have coded in eclipse. reason on emulator unable load. doesn't gives info other "unfortunately app has stopped". couldn't figure out why through logcat. if appreciate it. here java code : package net.androidbootcamp.quickhealthysnackideasapp; import android.support.v7.app.actionbaractivity; import android.content.context; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.baseadapter; import android.widget.gridview; import android.widget.imageview; import android.widget.toast; public class mainactivity extends actionbaractivity { integer[] snacks = {r.drawable.snack1, r.drawable.snack2, r.drawable.snack3, r.drawable.snack4,r.drawable.snack5}; imageview pic; @override protected void oncreate(bundle savedinstan...

java - SFTP via JSch is throwing error 4: Failure -

i facing peculiar issue while trying sftp file windows unix server. error "stack trace" - 4: failure @ com.jcraft.jsch.channelsftp.throwstatuserror(channelsftp.java:2846) @ com.jcraft.jsch.channelsftp.checkstatus(channelsftp.java:2459) @ com.jcraft.jsch.channelsftp._sendclose(channelsftp.java:2465) @ com.jcraft.jsch.channelsftp._put(channelsftp.java:683) @ com.jcraft.jsch.channelsftp.put(channelsftp.java:475) @ com.jcraft.jsch.channelsftp.put(channelsftp.java:365) i have searched lot on other forums not root cause. have observed 1 more thing - file name, trying sftp, *.xml when change *.xml sftp "successful". weird not identify issue. trying using jsch java api. have seen same issue while trying winscp front end. it common openssh sftp server return code 4 (failure) many different reasons, without giving details . you have check sftp server log find more.

java - Localing the app makes dialogues look too small -

Image
after translated app, made possible users change locale. doing made dialogues show small. why? how can fix it? code localizing: locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); code showing dialog: final dialog dialog = new dialog(mcontext); dialog.settitle(context.getresources().getstring(r.string.rate) + app_title + "!"); linearlayout ll = new linearlayout(mcontext); ll.setorientation(linearlayout.vertical); textview tv = new textview(mcontext); tv.settext(context.getresources().getstring(r.string.if_you_enjoy_using) + app_title + context.getresources().getstring( r.string.please_take_a_moment_to_rate_it_thanks_for_your_support)); tv.setwidth(240); tv.setpadding(4, 0, 4, 10); if (locale.getdefault(...

asp.net - AsyncPostBackTrigger in nested repeater -

good day everyone, this first post in here , thank great efforts in forum have gaind lot of skills. i have smalle issue 2 nested repeaters. basically, have dropdownlist in child repeater contains rating values , every time dropdownlist changed in child repeater new percentange calculated , presented in label in parent repeater. cause full postback frustrating when going through many dropdownlists. question how reflect new calculated percentange in label without postback. have tried use asyncpostbacktriggers no luck. suggestions appreiciated <asp:repeater id="rptparent" runat="server"> <itemtemplate> <asp:label id="lblavg" runat="server" text='<%# eval("trialscore")%>'></asp:label> <asp:repeater id="rptchild" runat="server"> <itemtemplate> <asp:dropdownlist id="lstrate" runat="server" onselectedindexchanged="lstrate_selectedindexch...

Revit API : "PickObject" not displaying dialog window -

i did written here , got problem __window__.topmost = true . (so, i'm running directly shell) here complete code : def test(self) : __window__.hide() sel = __revit__.activeuidocument.selection pickedref = sel.pickobject(objecttype.element, "please select group"); __window__.show() __window__.topmost = true return pickedref indeed, if that, got error message saying 'return' outside function. if change 'return' line else, elem = element.getgeometryobjectfromreference(pickedref) , says there unexpected indent (of course checked indentation, should ok normally). finally, if comment __window__.topmost line, got no error message. do experience problems ? but biggest issue in end, select element, see no dialog window popping expected message "please select group"). come ? guess "topmost" command brings shell on top, doesn't come that... any clue ? thanks lot ! i answered comment in french o...

php - Create image from mysql text data -

i trying wtire webpage user submits 2 strings of data database gets navigated new page print 1 of strings of text image , other plain text. have written code not working. have on github @ https://github.com/yukisho/keytrades , dbinfo.php holds database name , login info. i stumbled across code ninja , believe can manipulated work need if code not work fixes. have done as knowledge holds , need help. https://www.codeofaninja.com/2011/02/how-to-resize-and-print-image-file-from.html

performance - Branch alignment for loops involving micro-coded instructions on Intel SnB-family CPUs -

Image
this related, not same, question: performance optimisations of x86-64 assembly - alignment , branch prediction , related previous question: unsigned 64-bit double conversion: why algorithm g++ the following not real-world test case. primality testing algorithm not sensible. suspect any real-world algorithm never execute such small inner-loop quite many times ( num prime of size 2**50). in c++11: using nt = unsigned long long; bool is_prime_float(nt num) { (nt n=2; n<=sqrt(num); ++n) { if ( (num%n)==0 ) { return false; } } return true; } then g++ -std=c++11 -o3 -s produces following, rcx containing n , xmm6 containing sqrt(num) . see previous post remaining code (which never executed in example, rcx never becomes large enough treated signed negative). jmp .l20 .p2align 4,,10 .l37: pxor %xmm0, %xmm0 cvtsi2sdq %rcx, %xmm0 ucomisd %xmm0, %xmm6 jb .l36 // exit loop .l20: xorl %edx, %edx movq %rbx, %rax divq %rcx testq %rdx, %rdx je ...

javascript - Angular $resource always calls success callback -

i have issue angular $resource. use our api server cors enabled. no matter error code server returns (tried 500, 422, 409) resource calls success callback. action in controller: @spacepostsservice.save { spaceid: @space._id }, @post, @_createsuccess, (errors)=>¬ @_createerror(errors, form) where spacepostsservice: spacepostsservice = $resource postsurl, {},¬ query:¬ isarray: true¬ method: 'get'¬ responsetype: 'json'¬ transformresponse: (data, headers)->¬ results = data.results || data¬ results = [results] unless _.isarray(results)¬ results does have idea doing wrong? ps. readability purposes didn't show code, spacepostservice factory , it's injected in controller. finally i've found issue. turns out had global interceptor defined in other place: ajaxinprogress = request: (config)-> $rootscope.$broadcast 'ajax:in-progress' config response: (response)-> $root...

java - Buissness validation logic -

is there nice solution validate domains after changing? for example: in our buisiness case got users domain object. userglobal has expiration timeframe ( activefrom , activeto ). when admin changing timeframe needs check serval other domains bankdataexpiration timeframes, contract timeframes etc.... today use big ugly block checks in 1 class. some pseudo code: public class usersservice { public void onuserchange(users users) { checkcontracts(); checkbankdata(); // other validation checks.... } } after whole ugly check thing, possible data should change automatically. example of timeframes cut. but of hurts "single responsibility principle" , unreadable , unmaintainable. there nice , clever solution out there, didn't find yet? we thought interface checking , validation autowired via spring beans. got trouble hibernates session handling. changed reletad data in session error apeard, user changed data , tries revalidate it....

matrix - gl_ModelViewMatrixInverseTranspose in threejs -

in attemp write own custom shader (i using three.shadermaterial ), need set webgl's built-in gl_modelviewmatrixinversetranspose uniform (as seen on http://mew.cx/glsl_quickref.pdf ). noticed uniforms automatically passed shader, instance gl_modelviewmatrix , gl_projectionmatrix accounted for, threejs' modelviewmatrix , projectionmatrix respectively. gl_modelviewprojectionmatrix , on other hand, seems missing, noticed examples can computed inside shader projectionmatrix * modelviewmatrix . question is: manually compute gl_modelviewmatrixinversetranspose inside shader starting modelviewmatrix (and if so, how?) or there unform (possibily merged inside definition of three.shadermaterial three.uniformsutils.merge ) handles it? cheers. in three.js shader inverse transpose of modelviewmatrix called normalmatrix . it automatically passed shaders don't need work it. // = inverse transpose of modelviewmatrix uniform mat3 normalmatrix; for reference here bu...

Should I use Greensock entirely instead of JQuery? -

i aware of performance gain when use greensock. want use it. however, confused because use 1) jquery if , else statements 2) jquery addclass, toggleclass, removeclass 3) jquery on click 4) jquery on scroll can greensock or use both in combination? searched didnt find answers online. i appreciate advice. greensock animation platform. it's awesome @ bascially 2 things: tweening, , sequencing tweens. literally in dom, or attribute can tweened greensock. but once start getting functionality, you're outside of greensock's featureset. question is, what's preferred flavor of javascript? use greensock extensively plain vanilla js maximize speed. there's no reason not use jquery if helps code faster. keep in mind: 1) greensock , jquery play nicely together. there's no reason not use tweenlite animation , if you're seeing performance gains, , jquery logic. 2) sounds of functionality you're looking pretty basic. might okay ...

json - How to echo the cURL result in PHP? -

here url→ https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=snoopy&rsz=1 and php code <?php $url = "https://ajax.googleapis.com/ajax/services/search/images?"."v=1.0&q=snoopy"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); $body = curl_exec($ch); curl_close($ch); $json = json_decode($body); ?> i wanna echo of image urls result (for example: http://img2.wikia.nocookie.net/__cb20110331075248/peanuts/images/6/62/snoopy.gif ) but have no idea how echo them. hope me, thanks! in order echo exact result use: echo $body; //echoes json string if want echo exact link, echo this: echo $json->responsedata->results[0]->url; //echoes http://img2.wikia.nocookie.net/__cb20110331075248/peanuts/images/6/62/snoopy.gif or can foreach() twice (or once...) echo $res->url directly :) choise!

Unable to install GDB with python support -

the thing is, want have python support in gdb installation. when ran ./configure --with-python with make in gdb source file directory, however, "make" exited following information: checking whether use python... yes checking python... (cached) /home/tools/tools/../bin/64//python checking python2.7... no configure: error: python missing or unusable" note returned information possible indicates "make" program trying find python intallation in "/home/tools/tools/../bin/64//python" directory, which, not default python installation of account. i've set $path variable make "python" command pointing python installation of own, resides under home directory. why this? can help? thousand thanks. ps. there's 1 thing i'm not sure, since want have script automatically run in ".gdbinit" file, seems python script. supporting script equal making gdb able debug python script?? i had same problem. using pyt...

c# - SQL Syntax error on ASP.NET site -

i'm doing website using asp.net , using mysql database. filling in drop down list doing simple select command, i've done @ least 20 times in project alone, keeps giving me error. i've filled 1 drop down list , using selected choice fill next drop down list, won't accept data first list. the sql is: select equipname seniorschema.checkout active=0 , email =hsnyder1@unca.edu; i've tried lastname instead of email, checked , double checked spelling, still doesn't work can figure out? is email value stored string ( varchar )? if syntax same mssql, think problem it's missing quotes. select equipname seniorschema.checkout active=0 , email ='hsnyder1@unca.edu'

linux - Detect underlying platform/flavour in Cmake -

does know cmake variable or hook or can give me underlying platform name/flavour name on getting executed ? e.g. linux-centos linux-ubuntu linux-sles i know cmake has "cmake_system" variable doesn't differentiating flavours of linux e.g. appreciated. edit : read can done using lsb_release command ? the following snippet populates lsb_release_id_short cmake variable information underlying linux system: find_program(lsb_release lsb_release) execute_process(command ${lsb_release} -is output_variable lsb_release_id_short output_strip_trailing_whitespace ) on ubuntu, example, yields ubuntu .

ruby on rails - Heroku: git push staging local-branch:master -

we have local feature branches, github origin branch , heroku staging , production remote branches. as local features become ready review larger audience we'd push them staging : $ git push staging local-branch-name:master fetching repository, done. git@heroku.com:app-staging.git ! [rejected] local-branch-name -> master (non-fast-forward) error: failed push refs 'git@heroku.com:app-staging.git' hint: updates rejected because pushed branch tip behind remote hint: counterpart. check out branch , integrate remote changes hint: (e.g. 'git pull ...') before pushing again. hint: see 'note fast-forwards' in 'git push --help' details. part of me wants --force issue git push -f remote taboo. pull in changes "hint" says given branches push staging short lived , may have little each other seems unnecessary , confusing. what proper procedure sharing staging server on heroku? you're using git on staging server d...