Posts

Showing posts from February, 2013

ruby - RSPEC delivers a Name error on my vote spec -

i'm getting name error votes don't quite understand. it's supposed make sure votes values of 1 , -1. i've been receiving lot of nonameerrors in code pretty recently, i'm wondering how should go fixing problems these. require 'rails_helper' describe vote def valid? (@vote == 1) || (@vote == -1) end describe "validations" before good_v = votes.new(value: 1) bad_v = votes.new(value: -1) no_v = votes.new(value: 2) end describe "value validation" "only allows -1 or 1 values" expect(good_v.valid?).to eq(true) expext(bad_v.valid?).to eq(true) expect(no_v.valid?).to eq(false) end end end end it doesn't seem votes method i'm using create vote. wanted use good_v = @post.votes.create(value: 1) , don't think that's working either

php wrong timezone issue in Australia/Sydney -

i want timezone name in australia/sydney (not time) http://php.net/manual/en/timezones.australia.php (timezone set) $t = new datetime('now'); $t->settimezone( new datetimezone('australia/sydney')); echo $t->format("y d m j h:i t"); and result = 2014 tue dec 16 17:54 est http://www.timeanddate.com/time/zones/aedt in url, australia/sydney aedt. why php return est? http://mm.icann.org/pipermail/tz-announce/2014-august/000023.html australia dst timezone abbreviation incorrect when using date_default_timezone_set it version issue.

expandablelistview - Navigational drawer doesn't open when not data network android -

i using navigational drawer showing expandablelistview . every thing working perfect except 1 ... when no data network drawer doesn't opens ( when clicked on drawer icon nothing happens ) there no code explicitly open drawer when network available . mainactivity.java public class mainactivity extends activity implements onquerytextlistener { public int current_theme; /* google analytics*/ button btn_trackevent, btn_trackcrash; easytracker easytracker = null; googleanalytics googleanalytics; standardexceptionparser exceptionparser; /* end google analytics */ /* shared preference */ sharedpreferences sharedexplistview; sharedpreferences.editor editorexplist; /* end of shared preference */ private drawerlayout mdrawerlayout; //private listview explistview; expandablelistadapter listadapter; expandablelistview explistview; list<string> listdataheader; hashmap<string, list<string>&g

android - prevent only 1 view from coming up when keyboard is up -

there 2 views set "align parent bottom" true in activity. 1 textview , other 1 linear layout. want display linear layout when keyboard up, on top of keyboard. issue when tap on edittext, keyboard linear layout on top that.but textview coming up. dont want textview come up.i want linear layout come when keyboard shows. possible?then how?

How to import laravel project from windows to linux? -

Image
i've created laravel project on windows environment worrking fine.. have move project linux environment. i've tried following methods failed. method1 :. created new project on linux using composer create-project laravel/laravel , replaced app directory local instance app directory method2 . moved entire project windows linux (through ftp). in both above methods failed access urls. i'm sure installed correctly on linux machine. when access project on linux /public see success screen you've arrived . but when access view pages public/users/login . i'm getting page not found error. same path working fine under windows. what wrong. i'm newbie in laravel. appreciated. if route works /public/index.php/users/login (and does , see comments) means .htaccess url rewriting isn't working properly. these things can check: public/.htaccess should this .htaccess has enabled on server tutorial

beanstalkd - How can run beanstalkq worker in detached mode in rails -

we have implemented background jobs beanstalkq in rails application. so, have below gem in gemfile. gem 'stalker' now, of below command can start worker. stalk jobs.rb but, @ ec2 server how can run in detached mode. in documentation, there no appropriate solutions. can please us. thanks in advance. you may wish try screen command screen -d -m -s screen_name command the -s option specifies inside screen window following command executed. per -d -m man page recites: -d -m start screen in "detached" mode. creates new session doesn't attach it. useful system startup scripts. something like: screen -d -m -s rails stalk jobs.rb then can list screen sessions with screen -ls and if want attach screen session use screen -x [pid ls command above] and if hit control+a d when in attached session, detach it, or close shell/terminal window. http://www.rackaid.com/blog/linux-screen-tutorial-and-how-t

c# - Access DB - operation must use an updateable query -

i have table need update user's password username store in session. however, got error: "operation must use updateable query" though have granted users , administrators full control. the following codes: string str = @"provider=microsoft.ace.oledb.12.0;data source=c:\inetpub\wwwroot\myfolder\mydatabase"; using (oledbconnection con = new oledbconnection(str)) using (oledbcommand cmd = con.createcommand()) { cmd.commandtext = "update [users] set [password] = ? username = ?"; cmd.parameters.add("password", oledbtype.varchar).value = request.form["conpassword"]; cmd.parameters.add("username", oledbtype.varchar).value = (string)session["username"]; con.open(); try { cmd.executenonquery(); messagebox.show("your password has been changed successfully."); } catch (exception ex) { response.write(ex.message); } { con.close

sql - How to introduce new concept into database table structure for 0..1 instances? -

i have issue i've encountered new requirements , don't know how best structure database tables. situation follows: i have employees stored in employees table. due increase in production, company has had hire many temporary employees. of these employees, both permanent , temporary employees, have enter data erp system. so, essentially, employees entering "orders" orders table having field named "enteredby". in ideal world, have both of these 2 types of employees stored in employees table. due company's different systems in place , groups within company not talking each other, temporary employees become permanent employees, need way report on of orders "new" permanent employee has done while "temporary employees" , technically "merge" data temporary employee worked on new permanent employee record. not temporary employees become permanent employees. orders have have "employee" attached it, i.e. foreign key

sql - explain differences between two different updates -

i have 2 different update query's, 1 created: update_query = "" update_query = update_query & "update orgbhvtasklist " update_query = update_query & "set taskid = null " update_query = update_query & "where taskid = ? " set cmd = server.createobject("adodb.command") cmd.activeconnection = objcon cmd.commandtext = update_query set paramid = cmd.createparameter("@id", 3, 1, , taskid) cmd.parameters.append paramid cmd.execute my colleague preferred one: update_query = "" update_query = update_query & "select taskid " update_query = update_query & "from orgbhvtasklist " update_query = update_query & "where taskid = "&taskid&" " set objupdate = server.createobject("adodb.recordset") objupdate.cursortype = 2 objupdate.locktype = 3 objupdate.open update_query, objcon objupdate.fields("taskid") = null objupdate.upd

actionscript 3 - As3 When i use Loader,i always get httpstatus code 200 event though the httpstatus code in google chrome is 304 -

in as3, use _loader.contentloaderinfo.addeventlistener(httpstatusevent.http_status, onhttpstatus); to detect httpstatus code of loader . in callback function httpstatus code 200 when httpstatus code show in google chrome 304. in reality, should same thing because these status reponses request sent web server, flash while requested file in cache, 200 http status because in case lazy flash didn't sends request web server , give fake 200 http status. air, situation little bit different because gives 200 http status real 200 , 304 http status ( not modified ) despite air real request every time. to verify can use simple actionscript code : var loader:urlloader = new urlloader(); loader.addeventlistener( httpstatusevent.http_status, function(e:httpstatusevent):void { trace('http status : ' + e.status) } ) loader.load(new urlrequest('http://www.example.com')); flash give 200 http status reachable con

android - libzbarjni.so has text relocations. This is wasting memory and prevents security hardening -

in barcode scanner application, using zbar lib scanning barcode. thowing runtime exception outofmemoryerror. anybody please resolve issue. logcat: 2-16 13:06:01.635: w/linker(15501): libzbarjni.so has text relocations. wasting memory , prevents security hardening. please fix. 12-16 13:06:06.483: e/art(15501): throwing outofmemoryerror "failed allocate 53654136 byte allocation 16777216 free bytes , 47mb until oom" 12-16 13:06:06.483: e/androidruntime(15501): error reporting crash 12-16 13:06:06.483: e/androidruntime(15501): java.lang.outofmemoryerror: failed allocate 53654136 byte allocation 16777216 free bytes , 47mb until oom 12-16 13:06:06.483: e/androidruntime(15501): @ java.lang.abstractstringbuilder.enlargebuffer(abstractstringbuilder.java:95) 12-16 13:06:06.483: e/androidruntime(15501): @ java.lang.abstractstringbuilder.append0(abstractstringbuilder.java:125) 12-16 13:06:06.483: e/androidruntime(15501): @ java.lang.stringbuffer.append(stringbuffer.j

javascript - How to exit / return from class as null -

usually in other languages looks nullreferenceexception, don't know how in js, beginner knowledge of c# - not js <script> var x = new fooclass(null); function fooclass(foo) { if(foo===null) return; // return type "fooclass" // want return tell // class wrong initialized, maybe exception? alert(foo); // show script continues } </script> yes. exactly. can throw exception stating error message if(foo === null) throw "null not allowed" // throw exception message more throw on mdn

c++ - Pass a reference to std::ifstream as parameter -

i'm trying write function ifstream& argument. void word_transform(ifstream & infile) { infile("content.txt"); //etc } which gave me error: type 'ifstream' (aka 'basic_ifstream ') not provide call operator. can please me what's wrong? call operator function operator()( params ) allowing use syntax myobject( params ) . so, when write infile(...) , trying call operator. what trying open file, use open method: void word_transform(ifstream & infile) { infile.open("content.txt",std::ios_base::in); if ( infile.is_open() ) infile << "hello"; infile.close(); } but, commented, not make sense pass infile reference such function. may consider: void word_transform(istream& infile) { infile << "hello"; } int main() { ifstream infile; infile.open("content.txt",std::ios_base::in); if ( infile.is_open() ) word_t

c# - ASP.NET Identity 2.0, self hosted OWIN, NTLM and application roles persistance -

i'm trying hands on asp.net identity 2.0 , there aspects i'm not finding answers to: here's setup: webapi 2 self hosted nowin (i need full signalr server's not running 2012 r2) a custom ntlm implementation asp.net identity 2.0 own identitydbcontext<> what's working far: the webapi the custom ntlm authenticationhandler<> (i can access user.identity in apicontrollers adding claims my actual question the claims add identity aren't persisted database don't survive application restarts, nor correctly linked actual windows identity 2 "sessions" of same user can have different claims. what expected asp.net identity 2.0 creates sort of "local (application) user" once i'm authenticated (from successful ntlm handshake) application claims stored. i'm pretty sure there's plumbing code missing somewhere, can't find where. after amount of fiddling around solutions following: create p

angularjs - How to get data from related tables like in django rest framework browsable API -

i need populate form through angularjs should data api. api should return data user table , data static tables (plan, country) related user table through foreign key. serializers: class countryserializer(serilizers.modelserializer): class meta: model = country queryset = country.objects.all() fields = ('id','name') class planserializer(serializers.modelserializer): class meta: model = plan queryset = plan.objects.all() fields = ('id','details') class userserializer(serializers.modelserializer): plan = planserializer() conutry = countryserializer() class meta: model = user fields = ('name','plan','role','country',) my user model: class user(models.model): name = models.charfield(max_length = 60) role = models.foreignkey(user_role, null = true, blank = true) plan = models.foreignkey(plan, null = true, blank = true) coun

css - Circular animation in javascript, greensock tweenlite -

i have point drawn in canvas (html5). want point animate in circular path. i saw example using time differences set x , y variables, in respect time. of variables , formulas used quite vague, have forgotten physics, d*mn. have researched quite bit on circular motion, can understand of it. here codepen on how done. basically here parts have identified far: this.orbit = 100; // radius of circular orbit this.radius = 5; // orbiting object's radius this.velocity = 50; // yeah velocity without direction, should speed (agree?) var angle = 0; starting angle of point in orbit inside canvas's quadrant, set x , y coordinates respect coordinates of canvas first center of canvas dividing width , height 2 adding product of orbit's radius , position of x , y respect initial position in orbit(angle), , since math trigonometric functions uses radians, should multiply quotient of pi , 180 . this.x = _width / 2 + this.orbit * math.cos(angle * math.pi / 180) this

arraylist - Java Collection not working, Help needed -

i working on beginners project learning java. project add, list , delete person. type 1 add person type 2 list person type 3 delete person. i using arraylist collections work on project. the first question is using collections aproach? if yes declaring arraylist globally while iterating can see it's not storing data. my code follows. import java.util.*; public class operationclass implements operationinterface { string id; string fname; string lname; arraylist<string> person=new arraylist<string>(); public static void main(string args[]) { new operationclass().operation(); } public static void operation() { int a; scanner in = new scanner(system.in); system.out.println("enter 1 adding new record"); system.out.println("enter 2 see list of records"); system.out.println("enter 3 delete record"); system.out.prin

Android make check in or check out button with style -

Image
i need make style following screen shot plz need !!!! i have tried using make custom style <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/buttion_inner_icon" android:state_checked="true"/> <item android:drawable="@drawable/buttion_inner_icon" android:state_checked="false"/> </selector> but not want please me make view same screen shot you have setted same drawable when state_checked = true , state_checked = false. you must have 2 differents drawables.

java - How to get ActionForm in Struts2? -

i migrating struts 1 app struts2 , trying minimize code changes required. need know how access actionform in struts2 action class. below current code , getting npe when trying access actionform . public class deptbuildingnewaction extends actionsupport implements servletrequestaware, servletresponseaware, modeldriven<deptbuidingformbean> { private httpservletrequest request; private httpservletresponse response; private deptbuidingformbean form; public void setservletrequest(httpservletrequest httpservletrequest) { this.request = httpservletrequest; } public void setservletresponse(httpservletresponse httpservletresponse) { log.debug("inside setservletresponse"); this.response = httpservletresponse; } public deptbuidingformbean getmodel() { log.debug("inside getform"); return form; } public void setmodel(deptbuidingformbean form) { log.debug("inside setform"); this.form = form; } what best way actionform o

Trying to Convert VB.Net to C# ViewState Issue -

vb.net code if viewstate("lstsetting") isnot nothing username = viewstate("lstsetting")("email") password = viewstate("lstsetting")("psw") mhost = viewstate("lstsetting")("host").tostring.split(":")(1) mport = viewstate("lstsetting")("port").tostring.split(":")(1) end if password = trim(dec(ondecrypt(trim(password)))) c# code if (viewstate["lstsetting"] != null) { username = viewstate["lstsetting"]("email"); password = viewstate["lstsetting"]("psw"); mhost = viewstate["lstsetting"]("host"); //.tostring.split(":")(1) mport = viewstate["lstsetting"]("port"); //.tostring.split(":")(1) } password=strings.trim(modcommon.dec(modcommon.ondecrypt(strings.trim(password))));` error: method name expected... error displayed here viewstate

java - add a new entity -One-To-Many relation -

i define following entities : baseentity , magasin , article : @entity(name = "magasin") @table(name = "magasin") public class magasin extends baseentity { private static final long serialversionuid = 1l; @basic @size(min=5, max=100, message="the name must between {min} , {max} characters") private string name; @onetomany(cascade=cascadetype.all, mappedby="magasin") @valid private set<article> article; public string getname() { return name; } public void setname(string name) { this.name = name; } public set<article> getarticle() { return article; } public void setarticle(set<article> article) { this.article = article; } } @entity(name="article") @table(name="article") public class article extends baseentity { private static final long serialversionuid = 1l; @manytoone private magasin ma

Grails: Generic hibernate version for plugin -

i wonder if knows simple way of managing hibernate within plugin plugin becomes compatible variations of hibernate configuration within various types of grails default applications. line 21 has hibernate :hibernate4:4.3.5.4 appears work fine grails 2.4.2 apps on grails 2.4.4 apps runtime ":hibernate4:4.3.6.1" this causes issues. just wondering if there way of making more generic work grails pre 2.4 apps.. this should work: ":hibernate:$grailsversion"

osgi - How to add a bundle manifest to an existing maven dependency? -

i using adobe xmp core dependency within maven file <dependency> <groupid>com.adobe.xmp</groupid> <artifactid>xmpcore</artifactid> <version>5.1.2</version> </dependency> the manifest.mf of bundle not suited osgi deployment, no bundle specific information provided. need add following lines manifest.mf bundle-classpath: . bundle-version: 5.1.2 bundle-name: xmpcore bundle-manifestversion: 2 bundle-symbolicname: com.adobe.xmp.xmpcore export-package: com.adobe.xmp;version="5.1.2", com.adobe.xmp.impl;version="5.1.2", com.adobe.xmp.impl.xpath;version="5.1.2", is there way of unpacking maven artefact , exchanging provided manifest via maven dependency plugin or different way? for runtime enhancement use pax url wrap project . if have bundle in environment add wrap: url-schema bundle installation auto-wrap bundle on fly.

angularjs - Angular recursive directive with functions -

new angular , trying wrap head around these scopes. want functions inherited infinetly down tree. code below have , works first level, after i'm sort of lost. ideas? <tree get-branch="getbranch(parent, $event)" show-menu="showmenu(parent)" family="i"></tree> $scope.getbranch = function (parent, $event) {... $scope.showmenu = function(parent) {... app.directive("tree", function (recursionhelper) { return { restrict: "e", scope: { getbranch: "&", showmenu: "&", family: '=' }, template: '<a ng-right-click="showmenu({ parent: family })" ng-click="getbranch({parent:family, $event:$event})" >{{ family.alias }}</a>' + '<ul ng-if="family.iscategory">' + '<li ng-repeat="child in family.children" ng-class="{category: child.iscategory}&

web services - How to handle Internal Server Error in REST API using JAVA? -

i have create class handle runtime exception throws during service call , code @override public response toresponse(webapplicationexception exception) { response response=exception.getresponse(); if(response.getstatus()==400) return response.status(response.status.bad_request).entity("invalid data format. please enter data in xml format").build(); else if(response.getstatus()==403) return response.status(response.status.forbidden).entity("you not authorize access resource").build(); else if(response.getstatus()==500) return response.status(response.status.internal_server_error).entity("internal server error has occured.please check wheather have passed valid data or not").build(); else if(response.getstatus()==404) return response.status(response.status.not_found).entity("invalid url. please enter valid url").build(); else if(response.getstatus()==415) return response.status(re

php - MongoDB update sub document issue -

i'm having mongo structure this, "campaigns":[{ "summary" : [ { "postcode" : [ { "id" : "71", "name" : "recall 1", "qty" : 3, "history" : [ { "timestamp" : "2014-12-16 11:15:32", { "timestamp": "2014-12-16 11:15:53" } ] } ] }, { "postcode" : [ { "id" : "72", "name" : "recall 2", "qty" : 1, "history" : [ { "timestamp" : "2014-12-16 11:15:53" } ] } ] }] i'm trying i) increment qty of postcode.id : 72 ii) insert timestamp

python - Is it possible to print report from only a specific tree in OpenERP7? -

i did report using rml. created next reports.xml file: <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <report auto="false" id="event_extended_meeting_attendance_checking" model="event.meeting.registration" name="event_extended.meeting_attendance_checking" rml="event_extended/report/event_meeting_attendance_checking.rml" string="meeting attendance list" /> </data> </openerp> now, when open event.meeting.registration view (tree or form), option print > meeting attendance list appears there. problem don't want print report form view, , more, model has 2 different tree views, , i'd print 1 of them. how can achieve that? if wasn't possible, how can show orm exception message when user clicks on option , stop process? any appreciated. thank you! when crea

path - Setting up environment variable in linux -

while installing uima got steps in readme file * set java_home directory of jre installation use uima. * set uima_home apache-uima directory of unpacked apache uima distribution * append uima_home/bin path * please run script uima_home/bin/adjustexamplepaths.bat (or .sh), update paths in examples based on actual uima_home directory path. script runs java program; must either have java in path or set environment variable java_home suitable jre. i opened /etc/environment , perfomed changes: path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/uima_home/bin" java_home="/usr/lib/jvm/java-7-openjdk-i386" uima_home="/root/desktop/karim/software/uima/uima_sdk_1.4.5" after executed: uima/uima_sdk_1.4.5/bin# ./documentanalyzer.sh which gave error: ./documentanalyzer.sh: 2: .: can't open /bin/setuimaclasspath.sh documentanalyzer.sh code : #!/bin/sh . "$uima_home/bin/setuimaclass

Bare minimum set up for PhoneGap/Cordova development on Linux using PhoneGap Build -

so played little phonegap 3 years ago. writing basic html , javascript , pushing github repo. phonegap build pull repo , build me apk install phone. fast forward 3 years , node has been introduced make process little slicker. except modified hello world app include button barcode scan using: phonegap plugin add com.phonegap.plugins.barcodescanner and tried use barcode scanner adding button following onclick event (added pre-existing app object): buttonpressed: function() { alert("clicked"); cordova.plugins.barcodescanner.scan( function (result) { alert("we got barcode\n" + "result: " + result.text + "\n" + "format: " + result.format + "\n" + "cancelled: " + result.cancelled); }, function (error) { alert("scanning failed: " + error); } ); } if use phonegap developer app on android

css - Do Modernizr tests include browser-prefixed functionality? -

when testing functionality using modernizr, this: if (modernizr.csstransforms) { $("#somediv").addclass('rotate'); } does modernizr test return true earlier browsers support prefixed applications of rule, e.g. -mz-transform , or test standard transform ? read documentation can't find reference check. the goal apply transforms if browser supports them. give example. supposing .rotate class applies css 2d transform: .rotate {transform:rotate(30deg)} would class need include prefixed transforms, or modernizr not account them? there's no point adding in prefixed versions if modernizr isn't looking them. .rotate {-moz-transform:rotate(30deg); -ms-transform:rotate(30deg); -o-transform:rotate(30deg); -webkit-transform:rotate(30deg); transform:rotate(30deg)} modernizr tests against prefixed , prefixed versions. still need apply of css rules, however, since modernizr telling supports it, not

php - Deploy updates for code igniter web application -

i have web application written on code igniter , ready release. i'm looking ways "automatic" updates clients. now there going versions of application on users choose update , when it. i'm curious on how update files user. used before using framework used make zip file of new-edited files store on ftp , on user side when updated unziped file , replace ones on side. for database schema , other updates intend keep file required queries , run during update. should go way or there other can implement on code igniter? more straight forward road? also i'm still figuring out part user have update version 1.0.0 1.0.3 (2 or 3 versions apart) , requirements on files side on database also. thank you if willing put under version control git, can use phploy push latest change server through ftp. check out on github: https://github.com/banago/phploy disclaimer: i've written phploy

Access 2003: Conditional formatting based on table -

i have ms access 2003 crm system sets follow actions. need use conditional formatting ensure don't select weekend date or bank holiday / annual leave. i've tried conditional formatting next action date following expression suggested designer: dlookup(“[offdates]”, “[tbloffdates]”, “[offdates]=#” & [the form control name] & “#”) however isn't working. see links below context: http://i.imgur.com/vvgexw1.jpg http://i.imgur.com/gpxrwct.jpg i thought simpler have flag when matches date it's not working. ideas? thanks in advance.

reporting services - jasper reports - passing empty parameter values from one subreport to the next -

i creating nested sub-report passing parameters below: main report --> subreport1 --> subreport2 main report passes parameter subreport 1 subreport1 passes parameter b subreport 2 if during execution, parameter b has no value (i.e. sql query not return value @ parameter b), report execution stops @ point. if there subsequent values of parameter there non-empty query results parameter b, report not executed. how ensure report execution continues when parameter b empty? using ireport designer report design. thanks in advance venkatesh you need @ least 1 record sub report continue executing suggest modify sql query return empty row if 0 rows matches. check out question more details on how accomplish this: https://dba.stackexchange.com/questions/41067/getting-select-to-return-a-constant-value-even-if-zero-rows-match

c++ - Metaprogramming with std::is_same -

is possible following compiles without template specialization? template <class t> class { public: #if std::is_same<t,int> void has_int() {} #elif std::is_same<t,char> void has_char() {} #endif }; a<int> a; a.has_int(); a<char> b; b.has_char(); yes. make function templates , conditionaly enable them using std::enable_if : #include <type_traits> template <class t> class { public: template<typename u = t> typename std::enable_if<std::is_same<u,int>::value>::type has_int() {} template<typename u = t> typename std::enable_if<std::is_same<u,char>::value>::type has_char() {} }; int main() { a<int> a; a.has_int(); // ok // a.has_char(); // error } the solution the other answer might not feasible if class big , has got many functions need regardless of t . can solve inheriting class used these special methods. then, can specialize base class only.

ios - Dismissing view and routing to root view after successful login for PFUser -

i having trouble dismiss pfloginview after successful login. appears login successful, view not dismissing , routing root view. below loginviewcontroller, subclassing pfloginviewcontroller: class loginviewcontroller: pfloginviewcontroller { override func viewdidload() { super.viewdidload() self.navigationitem.hidesbackbutton = true self.navigationcontroller?.navigationbarhidden = true } func loginviewcontroller(controller: pfloginviewcontroller, didloginuser user: pfuser) -> void { self.dismissviewcontrolleranimated(true, completion: nil) self.navigationcontroller?.poptorootviewcontrolleranimated(true) } } i'd appreciate if experience parseui.framework help. poptorootviewcontroller automatically dismisses current viewcontroller, should sufficient: func loginviewcontroller(controller: pfloginviewcontroller, didloginuser user: pfuser) -> void { self.navigationcontroller?.poptorootviewcontrolleranimated(true) }

Generate artifical sales data series in R with arima model & add noise -

i'm extremely new r , pretty new time series analysis. have been looking answer online can't seem find it. i need generate artificial time series represent sales data of product x. need make few variations. independent series (i can excel), , series ar(1) rho= 0.8, , added noise level. for ar(1), know can use ar.sim<-arima.sim(model=list(ar=c(.8)), n=52) ar.sim this generates 52 data points along lines of [1] -2.080871400 -1.327156528 -0.672868162 0.521280151 -0.200243250 [6] 0.808095642 2.208014641 4.266957623 1.682261358 0.796715498 question 1: how make start level, e.g. 300 products sold? thought n.start seems else.. add 300 everytime? seems wrong.. question 2: how can add noise series?

Unable to apply skip, limit and order clauses in Neo4j using rest cypher -

i using neo4j 2.1.5 using dependency neo4j-rest-graphdb:2.0.1 in grails , query db using restapi restapi = new restapifacade("http://localhost:7474/db/data") restcypherqueryengine rcqer=new restcypherqueryengine(restapi) i created parameter list map<string, string> paramval = new hashmap<>(); paramval.put('limit', 10); paramval.put('skip', 0); paramval.put('order', 'name'); my query looks this string query = "match (c:mylabel) return id(c) id, c.name name skip ${param}.skip limit ${param}.limit; execute query this result = rcqer.query(query,org.neo4j.helpers.collection.maputil.map("param",paramval))" this shows error invalid input '.': expected whitespace, limit, load csv,..... works perfect when parameters used in where clause. result not in order while using order by clause, , works without error. please let me know missing or if there limitation there. in advance.

c# - Post Json Data using volly library to wcf rest service -

i migrating asynctask volley.in application want json data wcf rest service.my code below stringrequest postrequest = new stringrequest(request.method.post, url, new response.listener<string>() { @override public void onresponse(string response) { // response log.d("response", response); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { // todo auto-generated method stub if(error.networkresponse != null && error.networkresponse.data != null){ volleyerror error2 = new volleyerror(new string(error.networkresponse.data)); error = error; } log.d("error", "error => " + error.tostring()); }

Strange Behavior of call javascript -

Image
i'm studying javascript, , found example on book function saynameforall(label) { console.log(label + ":" + this.name); } var person1 = { name: "nicholas" }; var person2 = { name: "greg" }; var name = "michael"; saynameforall.call(this, "global"); saynameforall.call(person1, "person1"); saynameforall.call(person2, "person2"); this outputs: "global:michael" "person1:nicholas" "person2:greg" i understand how call works, output of saynameforall.call(this, "global"); isn't global:michael global:result . this code http://jsfiddle.net/rho3zyb4/ you're running code in jsfiddle, aren't you: http://jsfiddle.net/4g8q9yor/ - jsfiddle has assigned iframe name javascript outputs result - you're getting dom iframe name. create file on local machine , you'll see correct output or try elsewhere: http://js.do/code/48143 output

javascript - Scatter Chart in analog clock -

Image
i have json data array this: var data=[ {"someproperty":"number","time":"2014-12-11t09:24:39.000z"}, {"someproperty":"number","time":"2014-12-11t09:27:39.000z"}, {"someproperty":"number","time":"2014-12-11t09:30:39.000z"}, ..... ] i need draw circle each 1 in array (with radius of "someproperty") , put them in analog clock according time. found picture similar problem here: but no code :( i use d3.js it. succeeded in doing using rotate circles on circumference , intersect each other. want put them across radius in order avoid collision. see examples of collision detection http://bl.ocks.org/mbostock/1747543 don't see there option control x,y position want. if read question right, "someproperty" provide radius value, , "time" provides angle. i suggest transforming these datum polar coordnates described her

java - Why can't we set the value of static final variable in static block through class name -

this question has answer here: why isn't qualified static final variable allowed in static initialization block? 2 answers for example, consider code snap below: public static final int a; public static final int b; static { = 8; // it's working test.b = 10; // compilation error test.b cannot assigned. } why can't use test.b = 10; inside static block of test class itself? without class name it's working fine. is there reason behind this? a static final variable must initialized before use. may initialized either directly @ declaration time, or in static block. but when use class.var = x not seen initialization assignation. with jdk 7, error cannot assign value final variable . that explains why works if remove final keyword class test { static final int = 2; // initialization @ declaration time stati

osx - clang, change dependent shared library install name at link time -

related, not answer question: how modify install name of .dylib @ build time on osx, have dynamic library provided packager manager, installed in non standard directory, install_name filename. example: $ root=$pwd $ mkdir $root/foo $ cd $root/foo $ echo 'int foo(int a, int b){return a+b;}' > foo.c $ clang foo.c -dynamiclib -install_name libfoo.dylib -o libfoo.dylib i don't want change (absolute path, @rpath, ...) install_name of libfoo.dylib using install_name_tool -id . now link program library, example: $ mkdir $root/bar $ cd $root/bar $ echo 'int foo(int,int); int main(){return foo(2,4);}' > main.c $ clang main.c -l../foo -lfoo the program can't run: $ ./a.out dyld: library not loaded: libfoo.dylib referenced from: $root/bar/./a.out reason: image not found trace/bpt trap: 5 because: $ otool -l ./a.out ./a.out: libfoo.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libsystem.b.dylib (

webcam - Net Connection Connect Failed in php Video Recorder -

Image
i using php video plugin of http://www.videowhisper.com/ capture video webcam , save in php. working fine on live demo when download , run in local machine or upload server , run got following error

regex - Parse custom HTML list tags in C# or Java -

i have text this: this simple line [olist] [#]this line 1 [#]this line 2 [olist] [#]this line 2.1 [#]this line 2.2 [#]this line 2.3 , continues here [/olist] [#]this line 3 [/olist] line how can parse in c# html below this simple line <ol> <li>this line 1</li> <li>this line 2 <ol> <li>this line 2.1</li> <li>this line 2.2</li> <li>this line 2.3 , continues here</li> </ol> </li> <li>this line 3</li> </ol> line i splitting , concatenating sub lists not being handled properly. update: - sample code this doing. var html = replacelist(customhtml,"olist","ol"); private static string replacelist(string text, string key, string tag) { var itemtmpl = getlistentry(text, key); while (itemtmpl != null) { var

Extension method information from Roslyn -

i trying using roslyn extract various method call information give source file. elaborate - want find method invocations happen inside input file. one problem hitting extension methods. consider linq method aggregate , sum etc. how can figure out invocationexpressionsyntax method being invoked extension method , not simple member method of class. the source file input can expected compile - meaning getdiagnostics() not have errors. ---- code property mentioned @kevin in answer ---- var methodinfo = model.getsymbolinfo(invocation); if (methodinfo.symbol != null) { var msymbol = (imethodsymbol)methodinfo.symbol; if (msymbol.reducedfrom != null) { // extension method ! } } you can find actual static extension method instance invocation of extension method using imethodsymbol.reducedfrom property.

asp.net - Debugging a copied web site in Visual Studio 2012 debugs the original -

i have quick question debugging in visual studios 2012, have copied old website had wanted have 1 similar, have changed name, database connection , iis app pool/site. assumed had taken references of old websites name , have searched through entire solution references when press debug in vb2012 loads old website up. is there path need change fix or there else need do. also, nice know debug working see how process works. the problem in project properties -- web--- had change project server url pointed pointing site had cloned