Posts

Showing posts from January, 2010

java - @OneToOne Relationship on Spring mcv -

i'm tired of trying things , don't have results. user has 1 country , country has many user. problem when make new user. don't have idea problem. i have user bean: @entity @table(name="usuarios") public class usuario { @id @generatedvalue @column(name="id") private integer id; @column(name="nombre", nullable=false) private string nombre; @onetoone @joincolumn(name = "id_pais") private pais pais; /* getters & setters */ .... } the country bean: @entity @table(name="paises") public class pais { @id @generatedvalue(strategy = generationtype.auto) @column(name="id") private integer id; @column(name="nombre") private string nombre; @onetomany(mappedby="pais") private set<usuario> usuarios; /* getters & setters */ } the controller: @controller @requestmapping(value = "/usuario&qu

how to install a R package from github manually or offline -

i try download tsdyn package github (it not yet updated on cran) proxy prevents me connect github. library(devtools) install_github("matthieustigler/tsdyn", ref="dev94", subdir="tsdyn") downloading github repo matthieustigler/tsdyn@dev94 erreur dans function (type, msg, aserror = true) : failed connect api.github.com port 443: connection refused then downloaded .zip , tried install package .zip , got error : erreur dans read.dcf(file.path(pkgname, "description"), c("package", "type")) : impossible d'ouvrir la connexion de plus : message d'avis : in read.dcf(file.path(pkgname, "description"), c("package", "type")) : impossible d'ouvrir le fichier compressé 'tsdyn-master/description', cause probable : 'no such file or directory' i don't understand since can find description file in repository. think trying connect internet not allowed profession

How to create a text file using a bamboo task -

i started on old project using maven, , move bamboo ci. executing tests, needs local configuration file. moment, these files stored in our git not optimal. know if there tasks creating text file in local build repository. content of text file must editable in task configuration panel. as workaround, use script task, not optimal... so if understand correctly, you're trying inject runtime values needed testing within bamboo plan configuration. if you're trying do, why not pass needed runtime values bamboo variables , access them usual environment variable. hope helps,

C++ assembly function call pushes base pointer twice -

using visual studio, have made simple class in c++ called watertank, has member function: double watertank::getcapacity() const{ return capacity; } when run code: watertank wt = watertank(100); double capacity = wt.getcapacity(); the double capacity = wt.getcapacity(); generates following assembly: push ebp mov ebp, esp mov ecx, 0f2e320h call watertank::getcapacity(0f21073h) fstp qword ptr ds:[0f2e330h] cmp ebp,esp call _rtc_checkesp (0f250b0h) pop ebp ret and assembly generated double watertank::getcapacity() const body is: push ebp mov ebp,esp push ecx mov dword ptr [this],0cccccccch mov dword ptr [this],ecx mov eax,dword ptr [this] fld qword ptr [eax] mov esp,ebp pop ebp ret now, see it, when calling wt.getcapacity() function, base pointer pushed onto stack , base pointer updated current stack p

git - View a repository on every commit -

i want view repository first commit , kinda on press of button or may command ,transit next commit (the whole repo).i run code @ of commits . there tool or group of command so. i couldnt phrase question enough please comment. i run programs @ specific commit. this m doing understand design procedure of developer.(eg .how whole project put ?). i share readme of project based on idea . a code reader leverages power of github's commit feature animate process of code writing.it works tutor making each commit level reach , @ 100 % complete clone of given repo. in tutor mode can see next step , understand write code. new programmers learn how develop large applications , think in such pragmatic way. program , m more thinking of desktop application try make web app. that git filter-branch able do: --tree-filter <command> this filter rewriting tree , contents --index-filter <command> this filter rewriting index. similar tree filter not che

mmenu: How to select correct submenu on page load/refresh -

i have website mmenu. there submenu. entering submenu displays entries. select submenu , content loads in #content. (jquery/ajax browser history api). but if hit refresh or enter url manually, i'm starting on main menu , need re-enter submenu. have seen on http://mmenu.frebsite.nl/tutorial/ there way enter submenus automatically on page load. how work? there function can call? the last li tag submenu must have following class: .mm-selected should working.

mono - Monodeveloper run current project -

how can make mono developer run ( ctrl+f5 ) current project i'm on, in solution more 1. in solutions startup options can choose run specific project or multiple @ same time. there option run "current selection" in visual studio ? in solution window can right click project , select either run item or start debugging item . run item run without debugger, whilst start debugging item run debugger.

data structures - Skip list on java extending AbstractMap -

i need implement skip list in java. know how skip list works, need extend abstractmap. class skiplist like public class skiplist<k extends comparable<k>,v> extends abstractmap<k,v> { public skiplist(int levels) { // ... } // ... } i don't understand how need extend abstractmap skiplist used fast search, o(logn) time complexity. standard jdk has no implementation of it. while concurrentskiplistmap implemented using skiplist data structure, can refer source code: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/concurrentskiplistmap.java#concurrentskiplistmap here example: https://codereview.stackexchange.com/questions/71432/custom-skiplist-implementation-in-java

javascript - update by id not working in mongoose -

i have code in making new connection using mongoose , using schema also. connection made , im getting attributes collection. after want update in collection, , not working.. have following code console.log("id : "+content._id); alert.findbyidandupdate(content._id, { $set: { status: true } }, function(error, result) { console.log(result); if (error) console.log(error); else { console.log('alert updated'); } }); it shows alert updated status remains false.. result 1st console id : 55096a5f91169c8e1673af20; , 2nd console alert updated thanks , regards in advance your code looks perfect, id looks it's correct , code don't return erros, so, have checked schema see if contains "status" field? looks can create , edit new documents schema not equal on both sides, application data layers. more info here: https://github.com/automattic/mongoose/issues/1060 hope i've helped.

Flyway usage: what exactly is the migration concept? -

i looked @ flyway samples , documentation , tried understand if useful in environment. following conceptual detail unclear me: how flyway manage changes between database versions? not compare database life-instances (see answer here: can flyway find out , generate migration files datamodel? ) in detail setup looks this: create sql create , insert scripts when coding (automatically , manually). means every version of database represented number of insert/create statements. in world execute these scripts through database tool (sqlplus oracle). each run setup database _from_scratch_ (!). can put these same scripts 1 1 inside "migration" path of flyway? happens if target database way older last "migration step" did (or flyway did not yet exist when installed)? update: i got input flyway user: it seems each "migration" (version of database) has hand-written sql/java code , contains "updates" previous "migration" of database.

collaboration - Remote Website JavaScript library -

i looking javascript library allow me invite people "session" 1 person leader , other person spectator. spectator sees leader sees on website. awesome if script allowed switch roles (who leader , spectator). i googled lot , found togetherjs, looking for. problem togetherjs there quite lot of problems forms (as 2 people click on same stuff , on). there library out there, more "remote desktop" solution web pages?

c# - How to remove a constraint on table using entity framework db migrations -

i'm trying alter type of table column int long . altercolumn("dbo.files", "size", c => c.long(nullable: false)); it's throwing error on migration: the object 'df__files__size__1fcdbceb' dependent on column 'size'. alter table alter column size failed because 1 or more objects access column. how remove constraint in entity framework... migration, put in?

How do I get meaningful error messages for nested scala unit equality matchers? -

i want assert equality in scalatest of case classes contain array. (so built-in equality matchers case classes not applicable.) example: case class example(array: array[double], variable: integer) test stub: val = example(array(0.1, 0.2), 1) val b = example(array(0.1, 0.2), 1) should equal (b) fails expected. implement equality trait: implicit val exampleeq = new equality[example] { def areequal(left: example, right: any): boolean = right match { case other: example => { left.array should contain thesameelementsinorderas other.array left.variable should other.variable true } case _ => false } } which works. other option implement equality trait == @ places of "should be" , in case false @ 1 place return false, else true. problem both when running test error message both "example" objects not equal (if not) see in element differ. how achieve this? thank help! [update] in practice example

rssi - Trying to use the AT command with an Huawei E3531 -

i want read rssi of huawei e3531. found documentations show easy way informations using @ command. problem can't connect huawei e3531. mean, works modem. have connection. when looking device in dev, find 2 devices ("sdb" , "sgm") seem 2 disc, nothing serial port. so tried somethin found: -after plugged huawei, find idvendor , idproduct doing lsusb. -they sudo modprobe usbserial vendor=0x"idvendor" product=0x"idproduct" -and when dmesg can read: [ 1038.498282] usbcore: registered new interface driver usbserial [ 1038.498299] usbcore: registered new interface driver usbserial_generic [ 1038.498312] usbserial: usb serial support registered generic normally should have like: usb 1-1: generic converter attached ttyusb0 i think have not possible see sdb , sgm mac, doing ubuntu. , if enable wifi, modem cannot connect ( not see sdb , sgm) if need here first part of dmesg: [ 742.756888] usb 3-1: usb disconnect, device number 6 [ 74

javamail - Unable to read BCC field of sent mails in java -

i facing 1 problem while extracting bcc address incoming mail. here sample code used. public emailvo dumpenvelope(message m) throws exception { emailvo emailvo = new emailvo(); if ((addresses = m.getrecipients(message.recipienttype.bcc)) != null) { emailvo.setbcc(this.getaddresses(addresses, "bcc")); } } i getting null value in bcc. while debugging found bcc recipient's name in header field not able access header. code issue or there specific setting while sending mail not include bcc fields? you can check message object contains details mails. bcc part of mail hidden, per knowledge can retrieve information mail headers. address[] addresses = m.getheader("your header name here"); this give details regarding particular header tag in mails. for e.g. address[] addresses = m.getheader("delivered-to"); this tag give information recipients of mail, include bcc. you can add custom headers

mysql - Google App Engine API - Failed to Load Databases - Cloud SQL -

i have google app engine php website mysql database. the website works , database works correctly. have connected database instance application , can access mysql client (and can perform queries). but when access google cloud sql api via google app engine developers console (on google developer console website) database fails load. for example: i select correct application/database instance. go on 'google cloud sql' api , 'sql prompts' get: failed load databases. any reasons why happening? , how load database? or why won't database load in first place? are trying access link [1] load database in browser.if yes might browser issue or multiple login problem. [1] https://console.developers.google.com/project/app-id/sql/instances

java - Invoking Drools from EJB -

i trying wrap head around issue far unable too. invoking drools simple session ejb, passing in serializable 'fact'. reason trying decipher drools refuses fire rules(or not see fact don't know). have taken below steps: -i have configured dump directory creates java sources rules. tells me drl compiled correctly. -i invoke same in simple test program same 'fact' , drl file drools fires , validates fact. what missing in ejb approach? suggestions welcome! tia

Run TestCase from java and display results on Eclipse JUnit view -

i defined classes with, each one, several public methods @test annotation. methods follow same behavioral pattern (retrieve ressources ids, test if empty, log, call real test each line on resource). so, i've externalized behavior in abstract class instanciate on each method, this: @test public void sometest(){ new basictestpattern("x","y","z"){ // parameters retrieve resources @override protected void testline(){ somecheck1(); somecheck2(); } }.run(); } this solution eliminate 10-30 lines per test method. now, want go further custom annotation, that: @testpattern(param1="x",param2="y",param3="z") public void sometest(){ somecheck1(); somecheck2(); } finally created little framework retrieve methods new annotation in order instanciate basictestpattern , execute it. executed in testcase subclass, that: testcase junit_test = new testcase(){ @override public void runtes

angularjs - Angular-JS strict-DI doesn't like injecting resolved results from $routeProvider -

i hit problems minifying angular code turned on ng-strict-di one problem seems reside in way resolve promise on route in app.js config .when('/:userid', { templateurl: 'views/main.html', controller: 'myctrl', resolve : { mydependency : function(cache, model, $route){ return cache.getcached( $route.current.params.userid); } } }) then inject resolved promise myctrl controller angular.module('myapp') .controller('myctrl',[ 'mydependency', '$scope', '$rootscope', '$timeout', function (mydependency, $scope, $rootscope, $timeout) { etc... however error angular [error] error: [$injector:strictdi] mydependency not using explicit annotation , cannot invoked in strict mode the problem appears traceable resolve definition in app.js because can change name of 'mydependency' there in resolv

Python: Using a multidimensional multiprocessing.manager.list() -

this might not intended use, know how use multidimensional manager.list(). can create on fine, this: from multiprocessing import manager test = manager.list(manager.list()) however when ever try access first element of test list returns element's value , not proxy object test[0] # returns [] , not proxy, since think python running __getitem__. is there anyway me around , use manager.list() in way? the multiprocessing documentation has note on this: note modifications mutable values or items in dict , list proxies not propagated through manager, because proxy has no way of knowing when values or items modified. modify such item, can re-assign modified object container proxy: # create list proxy , append mutable object (a dictionary) lproxy = manager.list() lproxy.append({}) # mutate dictionary d = lproxy[0] d['a'] = 1 d['b'] = 2 # @ point, changes d not yet synced, # reassigning dictionary, proxy notified of change lpr

ios - Converting UTC date format to local nsdate -

i getting server string date in utc time zone , need convert local time zone. my code: let utctime = "2015-04-01t11:42:00.269z" let dateformatter = nsdateformatter() dateformatter.timezone = nstimezone(name: "utc") dateformatter.dateformat = "yyyy-mm-dd't'hh:mm:ss.sss'z'" let date = dateformatter.datefromstring(utctime) println("utc: \(utctime), date: \(date)") this prints - utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 11:42:00 +0000) if remove dateformatter.timezone = nstimezone(name: "utc") it prints utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 08:42:00 +0000) my local time zone utc +3 , in first option utc in second option utc -3 i should get utc: 2015-04-01t11:42:00.269z, date: optional(2015-04-01 14:42:00 +0000) so how convert utc date format local time? something along following worked me in objective-c : // create dateformatter utc time format ns

Finance - Exchange's order matching algorithms - What if the orders don't match? -

the order matching algorithms popularly used electronic financial exchanges include fifo or pro-rata or other variants. use case order amount matches or within margin of tick happy-path scenario. want know how these algorithms operate when order amount don't match? scenario 1 - if partial fill happens , out of 100 order, 50 orders gets filled. residual order book hold remaining 50. happens these 50? how long have wait? scenario 2 - if buy order $50, , no sell order comes in below $60. happen these kind of orphaned orders?

Android App is not searchable by tablets on Google Play -

when uploaded apk, got warning on developer console: design app tablets your apk not seem designed tablets. i know there questions targeting same issue cases different, i'm putting here permissions & features i'm requesting in androidmanifest.xml hoping more specific answer case: <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.read_profile" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-p

c# - SpecFlow: System.FormatException: Input string was not in a correct format -

i getting following error when running tests using specflow: system.formatexception: input string not in correct format. and took me while work out why happening. it ended being because had omitted single quotes in 1 of step definitions, example: [then(@"something adds quantity of (.*)")] when should have been [then(@"something adds quantity of '(.*)'")] note single quotes around (.*)

html - IE Flexbox - Child Element does not stretch when using min-height on parent -

please have @ pen: http://codepen.io/anon/pen/zyzlmg what should make red .section element fill blue .container element. works in chrome , ff, not in ie. when setting height instead of min-height , works, need min-height because contained elements might exceed increase size of container. is there way make work? to fix that, needed wrap min-height element in flexbox row. http://s.codepen.io/boomerang/cf5b323f92549ea4b9e9aa3afcee9fc41427899803437/index.html#https://github.com/philipwalton/flexbugs#3-min-height-on-a-column-flex-container-wont-apply-to-its-flex-items not beautiful because have add element "styling", works.

How to create a UIImageView in swift programatically in a separate function? -

i want programatically create image view in function. hold background of image view , logos - in other image views can function , wan't have same thing on each one. i created blank swift file , put following in it: import foundation import uikit func background() { var imageview : uiimageview imageview = uiimageview(frame:cgrectmake(10, 50, 100, 300)); imageview.image = uiimage(named:"image.jpg") self.view.addsubview(imageview) } the error got on self.view.addsubview(imageview) line. error message use of unresolved identifier 'self' . tried removing word self line said instead view.addsubview(imageview) use of unresolved identifier 'view' . my question doing wrong? thanks edit: so have changed now, correct? import foundation import uikit class myviewcontroller: uiviewcontroller { func background() { var imageview : uiimageview imageview = uiimageview(frame:cgrectmake(10, 50, 100, 300));

PHP Parse XML response with many namespaces -

is there way parse through xml response in php, taking account namespaced nodes , convert object or array without knowing node names? for example, converting this: <?xml version="1.0" encoding="iso-8859-1"?> <serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service" xmlns:com="http://www.webex.com/schemas/2002/06/common" xmlns:att="http://www.webex.com/schemas/2002/06/service/attendee"> <serv:header> <serv:response> <serv:result>success</serv:result> <serv:gsbstatus>primary</serv:gsbstatus> </serv:response> </serv:header> <serv:body> <serv:bodycontent xsi:type="att:lstmeetingattendeeresponse" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <att:attendee> <att:person> <com:name&g

html - Jquery dialog not working on mouseover -

i have div that, when hovered supposed transform div jquery ui dialog. <a href="#"><div class="btn button" id="btn button" value="">click here dialog!</></a><br><span class="tooltip">rgba(66, 222, 57, .8);</span> <div id="are-you-sure" title="dialog">here is!<br><br></div> <script> $('#btn').mouseover(function(){ $('#are-you-sure').dialog(); }); </script> i have of necessary stylesheets , scripts linked page, dialog still doesn't work. ideas? from mdn: https://developer.mozilla.org/en-us/docs/web/html/global_attributes/id this attribute's value must not contain white spaces . browsers treat non-conforming ids contains white spaces if white space part of id. in contrast class attribute, allows space-separated values, elements can have 1 single id defined through

MySQL: detecting a text "NULL" or 0 field and changing it to proper NULL -

i have following bit of code update table_one set field_one = case when field_one = 'null' or field_one = 0 null else field_one end so want see if field has string "null" or 0 (0) value. if should set null within database. the issue i'm having it's setting null in fields while other fields okay. is there wrong code? update table_one set field_one = null field_one = 'null' or field_one = '0'

java - JRadioButton and component changes -

Image
i created jdialog box has 2 radio button change jlabel whenever clicked other button(for example: monthly salary when click full time button , hourly pay when click part time button) so questions how do that? create actionlistener radiobutton , create jpanel inside the actionperformed class? i think best way go create action listener button. when 1 selected change text monthlabel.settext("monthly salary");

sql - Detecting if data exists for OleDB COUNT query -

i'm trying pull data access database. as is, code works, , gives no errors... however, can't seem able display messagebox if record doesn't exist. returns empty string. using dbcon = new oledbconnection("provider=microsoft.ace.oledb.12.0;" & "data source = '" & application.startuppath & "\res\t500g.accdb'") dbcon.open() dim query1 string = "select sum(total) [t500] pro=@pro" dim cmd1 oledb.oledbcommand = new oledbcommand(query1, dbcon) cmd1.parameters.addwithvalue("@pro", comboboxbp.selecteditem.tostring) dim reader oledb.oledbdatareader reader = cmd1.executereader while reader.read() textbox1.text = reader.getvalue(0).tostring end while reader.close() dbcon.close() end using i've tried using if reader.hasrows then display result in textbox, else show messagebox etc, doesn'

How does namespacing work at lower levels with form_for in rails? -

my model 'posts' isn't namespaced. my controller namespaced admin/posts_controller.rb , it's new method looks so: class admin::postscontroller < applicationcontroller ..... def edit @post = post.find( params[:id] ) end why work: <%= form_for [:admin, @post] |f| %> but not this: <%= form_for @post |f| %> how form_for mapping @posts variable? why autofill form text-areas when namespace there? a valid @post variable being passed view in both cases.

jquery - How to pass variables to a function and return some of their properties javascript -

i have drop down menu , when select element want see list of information element. drop down , selection work since have lot of options (more showing) try make function return information element selected don't repeat code. function give me error message:"cannot read property 'top_1' of undefined" console.log(obj.top_1) works fine. var obj = { top_1 :"bla", top_2 :"bla bla", objdetail_1 :{ top_1 :"bli", top_2 :"bli bli", name1:"aaa", name2:"aaaa" }, objdetail_2 :{ top_1 :"blo", top_2 :"bli blo", name1:"bbb", name2:"bbbbb" } }; $(document).ready(function() { $('.mystuff li ul li').click( function(event){ $(document).find('#description').css('visibility', 'visible'); var idelement = $(this).attr('id'

string - Bash extract after substring and before substring -

say have string: random text before authentication_token = 'pywastsemjrmqwjyczpz', gravatar_hash = 'd74a97f i want shell command extract after "authentication_token = '" , before next ' . so basically, want return pywastsemjrmqwjyczpz . how do this? use parameter expansion: #!/bin/bash text="random text before authentication_token = 'pywastsemjrmqwjyczpz', gravatar_hash = 'd74a97f" token=${text##* authentication_token = \'} # remove left part. token=${token%%\'*} # remove right part. echo "$token" note works if random text contains authentication token = '...' .

reactjs - React Transition group not firing -

i tried create simple transition react transition group, can't work- transitions aren't working. did used unique key. for example did simple 2 image fade in fade out component: var reactcsstransitiongroup = react.addons.transitiongroup; var image = react.createclass({ getinitialstate: function () { return ({imglink: 'http://belaumi.com/wp-content/uploads/2014/11/3d-animated-frog-image.jpg', status: 1}) }, update: function () { console.log(this); if (this.state.status==1) { this.setstate({ imglink: 'http://www.codefuture.co.uk/projects/imagehost/demo/di/kxy1/image-b%c3%a9b%c3%a9-facebook-8.jpg', status:2}) } else { this.setstate({ imglink: 'http://belaumi.com/wp-content/uploads/2014/11/3d-animated-frog-image.jpg', status:1}) } } , render: function () { return ( <div> <div classname='container'>

java - How to read string data from JAXBElement<byte[]> -

i have web-service returns data in below xml form <epsbinaryex xmlns="http://eprise"> <errorstring>no error</errorstring> <errornum>1</errornum> <data>ajhsdjasjajadjhgasd</data> </epsbinaryex> class epsbinaryex has getdata() method below public jaxbelement<byte[]> getdata() { return data; } my aim read data tag's content base64 string. calling webservice , trying read element in following way pswebservice service = new pswebservice(); pswebservicesoap soap = service.getpswebservicesoap(); epsbinaryex base64data = soap.getuploadeddocument(token, pageid); system.out.println(base64data.getdata.getvalue()); this gives offset address output. tried using arrays.tostring(base64data.getdata().getvalue()) , (new string(base64data.getdata().getvalue()) well. first method gives me array of numbers , second method displays non-readable characters. can please me out in reading data

r - How do I write a loop to run and save outputs from a glm with multiple predictors -

i trying create function in r run glm on number of different columns of data in 1 matrix using predictors second matrix , write results matrix csv file. have managed single predictor glm using: x<- matrix(sample(10,100,t),10) colnames(x)<- c("f5", "f10", "f15","f20","f25","f30", "f35", "f40", "f45","f50") # matrix dependant variables y<- matrix(runif(10, min=1, max= 50)) #the matrix predictor m<-matrix(nrow=dim(x)[2],ncol=9) #the matrix store output in colnames(m)< c("species","intercept","slope","pval.i","pval.b","disp","dev.null","dev.res","dev.expl") #the headings of output file names species ns<-colnames(x) (k in 1:dim(x)[2]){ glm1<-glm(x[,k]~y,family=poisson) #calculate glm print(g1<-summary(glm1)) #print output in file # filling rows in results table m[k,

javascript - Cannot return string from value of element in protractor test -

so i'm trying string value returned value of element on resolution of promise. want pass raw string value function i'm building inside protractor test. this element: <div style='hidden' > <input id="group-sendgrid-hidden-input" ng-model='groupcode' value='dangyo' > </div> i'm looking way @ either model value or attribute value (either work). model value might better. this attempt resolve promise here , return result: // first element driver object var groupcode = element(by.id('group-sendgrid-hidden-input')); // next resolve promise provided element groupcode.getattribute('value').then(function(value){ console.log( 'should string: ' + value); return value; }); here console.log( 'should string: ' + value); returns null value , nothing can seems resolve this. i'm sure i'm doing wrong because new protractor , seems simple. else experience behavior?

javascript - $routeParams undefined when passing to new view & controller -

fairly new angularjs , webapi here, , figure best way learn doing. apologies in advance if question seems simple - i've spent day flipping through stackoverflow , tried them all. i have separate master & detail view, both own controller. trying pass selected id through details controller can query database using id, though getting "undefined" on $routeparams. i'm unsure if missing simple, or whether i'm approaching correctly. the controller doesn't seem when inject '$routeparams' either. my app.js module: var app = angular.module("projectdashboardmodule", ["ngroute"]); app.config(['$routeprovider', '$locationprovider', function ($routeprovider, $locationprovider) { $routeprovider .when("/", { templateurl: "/home/index" }) .when("/project", { templateurl: '/project/index', controller: 'projectcrudcontroller' }) .when("/pro

c++ - pthread_cleanup_pop error on Windows- make it compilable -

code: void clean(void *message) { cout<<"exiting "<<(char*)message<<endl; } void *func2(void* arg) { char *message = "func2"; pthread_cleanup_push(clean,(void*)message); int status; int count=0; pthread_setcancelstate(pthread_cancel_enable,&status); for(;;){ if(count%3467==0) { sleep(3); pthread_testcancel(); } else if(count%67==0) { cout<<"func 2 running"<<endl; } else {} count++; } pthread_cleanup_pop(0);//error pointing here } when try compile , getting error cancel.cpp:45:5: error: second operand conditional operator of type 'v oid', third operand neither throw-expression nor of type 'void' pthread_cleanup_pop(cleanup_pop_arg); i not able find what's problem code. c

R how to extract specific elements in a data frame consisting of character lists -

i have data frame labels consisting of 3 rows of 1 column this: labels labels(n) 1 text, commission20120125 2 text, council2015mmdd 3 text, parliament20140312 with: labels[1,] [[1]] [1] "text" "commission20120125" and: labels[2,] [[1]] [1] "text" "council2015mmdd" and: labels[3,] [[1]] [1] "text" "parliament20140312" is there "simple" way access "text" , put in vector, this: c("commission20120125", "council2015mmdd", "parliament20140312") as solution far manually do: l1 <- as.vector(labels[1,]) l1 <- unlist(l1) l1 <- str_extract(l1, "[a-z][a-z]+[0-9]+") l <- l1[2] and on every raw. you may try sapply(labels[,1], '[',2) #[1] "commission20120125" "council2015mmdd" "parliament20140312" data labels

cq5 - AEM6. XML import to JCR(Oak) -

during migration site cq5.4 aem6 i've faced problem in importing xml data jcr. on cq5.4 used "content loader tool"(http(s)://[host]:[port]/crx/loader/index.jsp ) load xml jcr. starting cq5.6.1 tool deprecated , gone. aem6 doesn't have also, same several crx:xml* primary node types(crx:xmlcharacterdata, crx:xmldocument, crx:xmlelement, crx:xmlnode). i've tried re-import data programmatically, below sample groovy script importxml(); def importxml(){ fileinputstream inputstream = new fileinputstream("c:/data.xml "); // xml file session.importxml("/content/xmlnode", // destination jcr node inputstream , javax.jcr.importuuidbehavior.import_uuid_create_new); session.save(); } but import result, lost sibling data. imported data has 1 node on each layer in jcr. reason oak doesn't support same name siblings (sns). http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/introduction-to-oak.html http://j

unicode - write() in python/spyder -- 'charmap' codec encoding character u'\u0142' --- UnicodeEncodeError -

i'm having little trouble program (python 2.7) , after checking other similar questions on website, still can't find solution. show attempted solutions/thoughts. i'm not sure if matters dataset i'm working yelp challenge dataset. don't plan on submitting work yelp challenge. first load json file pandas dataframe. following code in order take text (100k reviews), lowercase it, stem it, join stemmed text 1 line/observation, , write text file: reviews = df.text.tolist() reviews = [x.lower() x in reviews] revsub=reviews[0:100000] lrev = [[stem(word) word in re.compile("\w+",re.unicode).split(sentence)] sentence in revsub] testt = [" ".join(review) review in lrev] f2 = open("yelpreviewsparagragh.txt", "w") f2.write("\n".join(str(x) x in testt)) f2.close() which gives following error: f2 = open("yelpreviewsparagragh.txt", "w") f2.write("\n".join(str(x) x in testt)) f2.close() t

jquery - JavaScript Calculate total price of items -

please me type total price of selected items. here jsfiddle <section id="items"> <div class="item">monitor <span class="price">100$</span></div> <div class="item">mouse <span class="price">20$</span></div> <div class="item">keyboard <span class="price">60$</span></div> </section> <section id="basket"> <p>total price:<span class="total_price"></span></p> </section>` check demo var total = 0; $("#items").on('click', ".item", function() { $(this).appendto("#basket"); gettotal() }); $("#basket").on('click', ".item", function() { $(this).appendto("#items"); gettotal() }); function gettotal(){ total = 0;

CakePHP 3.x: all routes to the plugin -

this not real question, need confirmation know if understand i'm studying (the routes of cakephp). i have plugin myplugin . default, requests should directed plugin, wish plugin name doesn't appear in url. for example: /pages should resolved as: ['controller' => 'pages', 'action' => 'index', 'plugin' => 'myplugin'] the same should apply "admin" prefix. for example: /admin/pages should resolved as: ['controller' => 'pages', 'action' => 'index', 'plugin' => 'myplugin', 'prefix' => 'admin'] in short, have imagine if application (so except myplugin ) has no controller. i studied routes (particularly this , this ) , know if code correct: router::defaultrouteclass('inflectedroute'); router::prefix('admin', function ($routes) { $routes->plugin('mecms', ['path' => '/&

git - how stash is applied - is it merged -

i've had conflict during stash apply . in this question told clean directory not enough applying stash without conflicts. in order figure out why conflict occured need know process git goes through when applying stash. know stash creates 2 commits may assume applying stash is, in fact, 3-way merging. right? stashing takes dirty state of working directory — is, modified tracked files , staged changes — , saves on stack of unfinished changes can reapply @ time. read more here

javascript - Google Calendar API not pulling in start/end dates with one feed and pulling in start/end dates for past events with another feed -

i'm trying create "simple" (i'm hesitant use word) upcoming event list start and/or end date using google calendar api , using js parse through json feed. here's first json feed managed get: https://www.google.com/calendar/feeds/actsi%40emory.edu/public/basic?orderby=starttime&sortorder=ascending&futureevents=true&alt=json after reading documentation on bunch of sites how pull in start/end dates, became apparent json wasn't supplying data needed able pull feed. also, reoccurring events shows start date when event put calendar - not date that's coming falls on. i did more research , produced second feed: https://www.googleapis.com/calendar/v3/calendars/actsi%40emory.edu/events?orderby=starttime&singleevents=true&&key=aizasyasrqz4dqvd9jsgt2ygagjxpk2tez1cbvs this 1 has start , end dates, whatever reason, dates 2008-2010 , nothing afterwards (again, need upcoming events). have js working pulling out title , start/end date

java - android eclipse lock screen app full screen -

before sorry bad english. i search lot site not found answer.sorry i make lock-screen app.(for android 4.0+) make " service " call " broadcast receiver ". in " broadcast receiver " happen : if(screen_off) else if(screen_on) else if(boot_completed)) i start main activity (my main lock-screen application). until moment thing work , device lock , unlock correctly. but there problem. 1 : how set app default lock-screen app? 2 : when device lock if press " home button "," back button "," recent button ", transfer home screen , lock-screen go recent normal application , access device without security. 2-1 : in android 4.0+ can not override " home button ". my solution problem 2: search in developer.google , find below method draw "view" on other apps permission : <uses-permission android:name="android.permission.system_alert_window"/> windowmanager = (windowman

mapreduce - What is the number of reducer slots on GCE Hadoop worker nodes? -

i testing scaling of mapreduce jobs on google compute engine's hadoop cluster, , finding unexpected results. in short, i've been told behavior may explained having multiple number of reducer slots per each worker node in hadoop cluster. can confirm number of reducer slots per worker node (worker vm) mapreduce jobs on gce's hadoop cluster? using hadoop2_env.sh deployment. https://groups.google.com/a/cloudera.org/forum/#!topic/oryx-user/afiu2pe2g8o provides link background discussion behavior experiencing, additional details if desired. thanks! in bdutil , number of reduce slots function of total number of cores on machine , environment variable cores_per_reduce_task , applied inside configure_hadoop.sh : export num_cores="$(grep -c processor /proc/cpuinfo)" export map_slots=$(python -c "print int(${num_cores} // \ ${cores_per_map_task})") export reduce_slots=$(python -c "print int(${num_cores} // \ ${cores_per_reduce_

javascript - Dynamically populate listview in jQuery mobile based on if file exists on phone -

this start of code. populates unordered list json file. tried using cordova filereader without luck. document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { alert("got deviceready"); var reader = new filereader(); var filesource = cordova.file.externaldatadirectory; $.getjson( "links.json", function( data ) { $.each( data, function( key, val ) { var $li = $("<li><a href='#'>"+val.title+"</a></li>"); reader.onloadend = function(evt) { if(evt.target.result == null) { $li.find("a").on("click", function(){ downloadpdf(val.title,val.url); }); } else { $li.find("a").on("click", function(){ openpdf(val.title); }); } }; // going check if file exists reader.reada

Attempt to invoke virtual method 'void android.widget.ListView.setAdapter -

i trying make list view contains pictures , text within fragment on viewpager tabs, can swipe left or right bring fragment. i'm relatively new android may doing wrong. can build project fine when emulator runs crashes (log displayed @ bottom of page). i created separate application , able create list view, when try combine within fragment so, doesn't work. here following code mainactivity.java import java.util.arraylist; import java.util.list; import java.util.locale; import android.app.listfragment; import android.content.intent; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmenttransaction; import android.support.v4.app.fragmentpageradapter; import android.os.bundle; import android.support.v4.view.viewpager; import android.view.gravity; import android.view.layoutinflater; import android.view.menu;