Posts

Showing posts from July, 2011

ruby on rails - Could not locate Gemfile or .bundle/ directory - Radiant CMS -

i installed radiant cms sugested on page. gem install radiant terminal says successfully installed 1 gem - sems ok. then try create project: radiant --database postgresql socialize seems fine except undefined local variable or method 'vars' #<rails::generator::commands::create:0x00000001ec6ac0> then cd /socialize , tried bundle install , here got could not locate gemfile or .bundle/ directory so seems serious error. i know there few questions bout no associated cms - i've tried comfortable mexican sofa ( worked fine, since has no templates /layouts switched radiant. )

shift/reduce errors BISON -

i 2 shift/reduce errors when trying compile grammar: program : declaration_list ; declaration_list : declaration_list declaration | declaration ; declaration : var_declaration | fun_declaration ; var_declaration: type_specifier var_decl_list ; scoped_var_declaration: scoped_type_specifier var_decl_list; var_decl_list : var_decl_list "," var_decl_initialize | var_decl_initialize ; var_decl_initialize : var_decl_id ; var_decl_id : id | id "[" int_num "]" ; scoped_type_specifier : type_specifier; type_specifier: int | char ; fun_declaration: type_specifier id "(" params ")" statement | id "(" params ")" statement ; params : | param_list ; param_list: param_list ";" param_type_list | param_type_list ; param_type_list : type_specifier param_id_list ; param_id_list : param_id_list "," param_id | param_id ; param_id : id | id "[" "]" ; statement: expression_stmt | compound...

linux - Scheduling a Python program to sleep within a given time period -

while true: = datetime.datetime.now(); if now.hour >= 22 , now.hour < 3: print "sleep" sleep_at = datetime.datetime.combine(datetime.date.today(),datetime.time(3)) sleep_til = (sleep_at - now).seconds print sleep_til time.sleep(sleep_til) print "wake" else: print "break" break this code should make entire program go sleep @ 10 pm , wake @ 3 am. question is.. work? tried running it.. cannot change system/computer time.. cannot check. reason why posting question because coding using datetime.date.tday , datetime.datetime calling current date.. once again.. want program run before 10pm , sleep between 10pm 3am , rerun after 3am.. can check if right way it? consider (extra-verbose clarity): import time, datetime # create time bounds -- program should run between run_lb , run_ub run_lb = datetime.time(hour=22) # 10pm run_ub = datetime.time(...

ubuntu - Deny a user access to a group-owned folder without removing him from group? -

i have group-owned folder in ubuntu. let's name finance. there 3 users in group, fin1, fin2, finx. these users ones have access folder. how can deny finx access folder without removing him group? you create different group, make supplementary group fin1 , fin2 , not finx , , assign group folder in question , contents. or if that's removing finx group main alternatives see acls , selinux. either 1 of these moving onto rather less trodden ground. both rely on directory residing on file system supports extended file attributes, if supports standard file permission bits, imply does. the acl approach might implemented via command similar this: setfacl --recursive -m d:u:finx:0 -m u:finx:0 /path/to/directory i work acls, may bit off. once it's done, though, new files , subdirectories should inherit same restriction, because command sets in both access acl , default acl.

Python calculator does not calculate -

this question has answer here: how can read inputs integers? 14 answers i have simple calculator app here, meant add 2 numbers make number, different. code: num1 = input() num2 = input() answer = num1+num2 print (answer) #does different instead of adding, puts 2 variables together. example, 2+2, 4. when doing in app, shows 22. reason why? , how can fix it? that's because takes string , not integer values. convert them both int , problem solved. num1 = int(input()) and on.

javascript - Passing an _id and a search query in the string -

using meteor test project. can't figure out how pass id , search parameter when playing sample todo app have. for moment, have in iron router: this.route('team', { path: '/team/:_id', onbeforeaction: function() { this.todoshandle = meteor.subscribe('todos', this.params._id); // filter mongodb search text }}); the thing is, want pass optional search parameter search todos . path: '/team/:_id(/search/:search)?' any ideas how this? from explanation, sounds like control documents published client, rather publishing of them , narrowing down result set on client. in case, suggest first defining publication on server so: meteor.publish('todosbyteamidandsearch', function(todoteamid, searchparameter) { var todoscursor = null; // check teamid , searchparameter existence , set // todoscursor accordingly. if neither exist, return empty // cursor, while returning subset of documents ...

Android SDK component failed to install -

while installing android studio sdk in ubuntu 14.04, 64 bit using wizard; encountered error the following sdk components not installed: sys-img-x86-addon-google_apis-google-21 , tools it occurred during "downloading google apis intel x86 atom system image, api 21, revision3" can please me possible error is.

command line - Passing an argument(filename) to a CLI PHP Script -

i wanting write script in php process text files. know of few ways accomplish this, except 1 way this. want able pass file name, traditional command-line application. for example: php script.php textfile.txt or script.php textfile.txt i assume can done, because pass arguments composer. can't find how in docs or google. can point me in right direction? or point me language supports this(maybe python or groovy, if php not option). in php if run command line can treat value after php argument. inside script.php have access these arguments in $argv array. for following php script: <?php // script.php print_r($argv); then if execute file command line: > php script.php foo bar testfile.txt you following result array ( [0] => script.php [1] => foo [2] => bar [3] => testfile.txt ) see php documentation more information. this simple way create script, if want create advanced command line tool programs recommend using...

c++ - Strange bug that is solved with a cout -

this first time see bug one. have function: double calc_value(string equation, int degree, char _for) { string monom[100]; monomial monomial[100]; double val_sum[100]; memset(val_sum,0,sizeof(val_sum)); for(int = 0; < count_monom(equation); i++) { monom[i] = obt_mon_from(equation,i); monomial[i] = str_to_monomial(equation,i,monom[i],_for); //cout << monomial[i].value; if(monomial[i].member == 2) monomial[i].value *= -1; val_sum[monomial[i].degree] += monomial[i].value; } return val_sum[degree]; } this function part of program solves equations, in case wonder. cannot post entire code because around 600 lines, pretty sure bug in here (anyways, if need more tell me). if compile code gives me wrong solution, if uncomment cout in line 14 , compile , run program gives me correct answer. if run in debug mode gives me correct answer too. i have done little research , think programmers call heisenbug, cannot find it. can me, please? by way, usi...

dictionary - Map reduce java fails at mapping during its first reading -

when i'm trying debug program on simple input, fails @ context.write(text, text) command. why this, , how can fix it? public class taskmapper extends mapper<longwritable, text, text, text> { private text country = new text(); private text browser = new text(); public void map(longwritable offset, text line, context context) throws ioexception, interruptedexception { string[] words = line.tostring().split(" "); country.set(words[1]); browser.set(words[0]); context.write(country, browser); } } the input file is: chrome israel ie israel firefox denmark safari denmark chrome israel

sql server - Why does this T-SQL OUTPUT INTO with FOREIGN KEY hack work? -

the base example lifted no way use tsql output normal foreign key constraints? ; code fails expected. if way constraint defined in example modified below, defining fk constraint with nocheck , check ing it, output run unimpeded. this seems contradict output clause docs . specifically: output_table [the table receiving into] cannot: •have enabled triggers defined on it. • participate on either side of foreign key constraint [emphasis added]. •have check constraints or enabled rules. from relational perspective below could work, action supposed precluded. if fk defined straight "with check" (the default) fails expected. if defined "with nocheck" , enabled "check constraint" it, well, fails fail. it awesome if known, supported feature. or did find bug in sql that's persisted since @ least sql 2008 (i tested 2008 , 2014)? why work? why shouldn't it? risking using it? if object_id ('dbo.forn') not null...

excel vba - compare row's if value of corresponding column's not equal insert them -

i have 2 grouped of columns.one of them subset of another.i want write macro compare them , if not equal insert second 1 first one. algorithm ode: if (code-1)<>(code-2) , (serial-1)<>(serial-2) , (amount-1)<>(amount-2) (code-1)==(code-2) , (serial-1)==(serial-2) , (amount-1)==(amount-2) and want inserted row marked. the table have below: code-1 serial-1 amount-1 code-2 serial-2 amount-2 1 11 111 1 11 111 3 33 333 1 11 11 2 22 22 3 33 33 3 33 333 the result looking below: code-1 serial-1 amount-1 code-2 serial-2 amount-2 1 11 111 1 11 111 3 33 333 1 11 11 1 11 11 2 22 22 2 22 ...

documentation - Flow for conditionals inside sequence diagram -

Image
i need document in uml sequence diagram method setrepresentative . code method: class reptoolcontroller extends pagecontroller { private function setrepresentative($request, $action, $case) { ... $repappconfig = new repappconfig(); $repappconfig = $this->getdoctrine()->getrepository('appbundle:repappconfig')->findoneby(array("app_id"=>$id)); $project_id = $repappconfig->getprojectid(); $company_id = $repappconfig->getcompanyid(); $project = $this->getdoctrine()->getrepository('appbundle:project')->find($project_id); $brand = $this->getdoctrine()->getrepository('appbundle:brand')->findoneby(array("project"=>$project_id)); $company = $this->getdoctrine()->getrepository('appbundle:company')->find($company_id); $territory = new territory(); if(is_numeric($territory_name)) { $...

c# - Make ball Jumping -

i trying make script can move ball, horizontal , vertical. managed working. but want make ball "jump". ended script below, ball launched rocket xd can me out using unityengine; using system.collections; public class playercontroller : monobehaviour { public float speed; public float jumpspeed; public guitext counttext; public guitext wintext; private int count; void start() { count = 0; setcounttext(); wintext.text = " "; } void fixedupdate() { float movehorizontal = input.getaxis ("horizontal"); float movevertical = input.getaxis ("vertical"); vector3 movement = new vector3 (movehorizontal, 0, movevertical); vector3 jump = new vector3 (0, jumpspeed, 0); getcomponent<rigidbody>().addforce (movement * speed * time.deltatime); if (input.getbuttondown ("jump")); getcomponent<rigidbody>().addf...

css - Modernizr is not detecting features within IE8 -

for strange reason, modernizr script not run detection on featuers within ie8 browser, @ least think doesn't. anyway, using cms cannot insert "no-js" class html tag when create page - not seem bother other web browsers (including more recent versions of ie). modernizr able inject classes html tag though "no-js" class not present (thank god). have checked , verified when using various browser implementations of "inspect element". i testing ie8 in virtual box using install vdi modernie. i have specific class when modernizr detects there no support smil svg animation ie8 not seem use it. have div whereby using animated svg file background image. ie8 display background colour of div , not specific modernizr fallback class tells browser use static png file background image. due face using background: cover property not supported (but assume still see png file not stretched out cover dimensions of div. i'll outline css using below: .jumbotr...

c++ - call a function recusively and store it into an int gives me 1? -

this code runs fine , used find largest factor between 2 numbers, wanted know why num prints out (for example 1 1 1 3 @ end of program). confused why can store function int , number? why give 1? #include <iostream> using namespace std; int largestfactor(int number, int start) { if(start == number) return 1; int num = largestfactor(number, start+1); cout << num; if (num ==1 && number % start == 0) return start; return num; } int main() { largestfactor(6,2); }

database - MySQL version 5.6.23 not allowing me to create a new user/grant privileges -

Image
it looks reason i'm having issue because playing drop function , ran drop database mysql , test... think need reset mysql default. what's best way that? instructions here didn't work me. ----my original question--- i'm trying create new user , grant them access in database keep getting syntax error. can't see syntax issues entering. i'm using mysql version 5.6.23. here screenshot of issue: here command entered mysql: grant privileges on simple_cms_development.* ‘simple_cms’@’localhost’ identified ‘mypassword12345’; error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near '‘mypassword12345’' @ line 1 any advice? you using wrong type of quote character, these accented quotes found in word documents. copy , pasted website or similar. i suggest re-typing querying using quote(') key on keyboard. the type of quote want single , down line, rather bending towards q...

Spring Rest API - multiple threads -

i have developed spring rest api takes multipart file in request , uploading them aws s3 location. process taking time , client has wait whole process completed. i not want client wait upload process complete want send image urls in response. can send image urls in response , open thread uploading images s3? you can achieve via springs' deferredresult leverages servlet 3.0 async capabilities. your controller below ( originally posted here tomasz ) @requestmapping("/upload") @responsebody public deferredresult<string> upload() { final deferredresult<string> deferredresult = new deferredresult<>(); runinotherthread(deferredresult); return deferredresult; } private void runinotherthread(deferredresult<string> deferredresult) { // call aws s3 upload , collect response deferredresult.setresult("file uploaded"); } refer tutorial complete working example.

How do you cancel a scheduled YouTube Video (API v3) from publishing? -

i integrating new youtube api cms. when schedule article youtube video attached, send request youtube schedule video published @ same time. my problem after scheduling article, want able set associated youtube video "private" status , undo scheduling. here code attempting this: $listresponse = $youtube->videos->listvideos("status", array('id' => $videoid)); if (empty($listresponse)) { die("can't find video given id"); } else { $video = $listresponse[0]; $videostatus = $video['status']; $videostatus['privacystatus'] = "private"; $updateresponse = $youtube->videos->update("status", $video); $responsetags = $updateresponse['status']['tags']; } how can cancel scheduling? found answer writing question out. achieve trying here, had replace line: $videostatus['privacystatus'] = "private"; with line: $videostatus['publisha...

c# - Adding a Resource in Visual Studio 2013 -

so going extremely basic, i'm not familiar visual studio. i'm working on programming kinect using kinectsdk , want use coding4fun kinect toolkit. i've downloaded , put using coding4fun.kinect.wpf; at beginning of program, doesn't recognize it. question is, should place files , how can add resource project? when googled around, stuck @ "choose global resource file" because don't see anywhere. provide nice step step instruction? go tools -> nuget package manager -> package manager console , enter: install-package coding4fun.kinect.wpf this should install necessary references. here's link nuget documentation . it's best way manage external references in visual studio.

Picking which Python XCode runs scripts on -

i have xcode project runs python scripts during build process. use python packages (beautifulsoup , slimit). setting project on new computer, , used homebrew install python, , pip install 2 packages. unfortunately, when building project getting error traceback (most recent call last): file "/users/supersloth/code/projectname/tools/mergehtml.py", line 7, in <module> import slimit importerror: no module named slimit for while confusing because know slimit there. during research realized computer has 2 versions of python on it io:~ supersloth$ /usr/local/bin/python -v python 2.7.9 io:~ supersloth$ /usr/bin/python -v python 2.7.6 io:~ supersloth$ python /usr/local/bin/python io:~ supersloth$ echo $path /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin io:~ supersloth$ and these 2 versions have different packages installed default python (/usr/local) ['beautifulsoup4==4.3.2', 'pip==6.0.8', 'ply==3.4', 'setuptools==14.3', ...

Python Salary Program Using Conditionals -

i error @ line 19, bonus function , can't figure out why. i'll error other functions too. i've checked spaces, numbers vs. strings, , dom. first problem globals , fixed global comrate `comrate = 0; . i've got debugging blindness. thank guys in advance! def main(): #welcome user , sales number print("welcome bonus qualification calculator! please answer following questions:") name = str(input("what name? ")) sales = float(input("what sales total? ")) jobtime = float(input("how many months have been company? ")) vacationtime = float(input("how many vacation days have taken? ")) #define global vars comrate = 0; compedsalary = 0; bonussalary = 0; finalsalary = 0; #begin calculations bonus(sales, jobtime) vacation(vacationtime) print(str(name) + ", salary based on information provided " + str(format(finalsalary,'.2f')) def bonus(sales,jobtime): #ca...

SugarCRM related Field -

i have sugarcrm 6.5.20 ondemand. in studio. have 1:1 relationship leads leads. trying primary email address of related lead , display in calculated field. it seems calculated field formula should like: related($emails,"email1") when following error: invalid formula: related: unknown field : email1 the dropdown list doesn't list email @ all. how can email? of web searches have proven ineffective. update: i willing make calculated field primary email address of current lead. found 2 variables named $email_addresses , $email_addresses_primary , $emails . there function called valueat. i tried use valueat(1,$emails) , valueat(1,$email_addresses) the validator accepted syntax value empty. can make calculated field off of leads primary email? you won't email field studio's formula calculation. email field stored in separate table , not in module's table. put in layout along other fields of module, not same other fields. ema...

diagramming - What are some techniques for diagraming architectures? -

i working new. started diagraming in way had not seen before, , had hard time following along. mentioned called logical architecture diagram. lead me wonder of popular approaches diagraming software architecture, , when each approach fit? i recommend taking @ simon brown's c4 style. it's simple, effective , promotes collaboration through sketches drawn team on white board can contribute , challenge ideas. for me agile approach making architecture in contrast "ivory tower" architects draw big , hard understand diagrams , throw them development teams. there whole book, called "software architecture developers", describing agile practices designing agile architectures. disclaimer : i'm biased because i've read book, liked , found ideas work in practice.

email - Sending e-mail on Android automatically -

in order send e-mail without user intervention devices (nexus7 & samsung galaxy s5) followed procedures described in send email in service (without prompting user) and http://www.jondev.net/articles/sending_emails_without_user_intervention_(no_intents)_in_android both sent e-mail correctly, end popup message "gmail has stopped" on device, not thrustworthy users of app , makes both solutions unusable. is there solution, or how can rid of error? logcat shows following errors: 03-17 11:44:32.324: i/gmail(2797): sending provider changed intent: intent { act=android.intent.action.provider_changed dat=content://gmail-ls/unread/^i (has extras) } 03-17 11:44:32.341: i/gmail(2797): sending provider changed intent: intent { act=android.intent.action.provider_changed dat=content://gmail-ls/unread/^iim (has extras) } 03-17 11:44:32.365: i/gmail(2797): notifyaccountchanged 03-17 11:44:32.368: i/gmail(2797): getaccountscursor 03-17 11:44:32.369: w/gmail(2797): sync comp...

uitableview - UITableViewCell selection in editing mode. -

i making custom uiviewcontroller want show message when uitableviewcell tapped. create uitableview , set property tableview.allowsselectionduringediting = true even though property has been set true, tableview(:didselectrowatindexpath) not being called display message. why , how fix it? here uitableviewcontroller: class gamelistviewcontroller: uiviewcontroller, uitableviewdatasource, gamelistviewdelegate, uitableviewdelegate { private var _games: [gameobject] = [] var tableview: uitableview {return (view gamelistview).tableview} var gamelistview: gamelistview {return (view gamelistview) } override func loadview() { view = gamelistview(frame: uiscreen.mainscreen().bounds) gamelistview.delegate = self } override func viewdidload() { super.viewdidload() tableview.datasource = self } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return _games.count } func tableview(tableview: uitableview, cellforrowatindexpath...

How determine which object/image was clicked using javascript/html -

essentially, have page 100 image thumbnails being displayed in form: document.getelementbyid('response').innerhtml += "<a href='#'><img src=" + responseobject.items[0].snippet.thumbnails.high.url + " /></a>"; document.getelementbyid('response').innerhtml += "<a href='#'><img src=" + responseobject.items[1].snippet.thumbnails.high.url + " /></a>"; document.getelementbyid('response').innerhtml += "<a href='#'><img src=" + responseobject.items[2].snippet.thumbnails.high.url + " /></a>"; and on. if matters, i'm dealing array of objects made of parsed json. anyway, when user clicks on 1 of images, need call function, showvideo, , need know image item (items[1], items[2]) clicked can pass function , display embedded youtube player item. in rough terms, function might like: function showvideo(itemclicked){ d...

How to efficently create arrays with runs of equal elements in SAS -

case one sample output: `1,1,1,1,2,2,2,2......9,9,9,9,0,0,0,0' a more general case be: the array starts n1 elements valued x1 , followed n2 elements valued x2 ... in sample output, n1 = n2 = n3 = .. = 4 , x1=1, x2=2 ... but don't want create based on element's position in array using if-else statement. here's have done: %let nd = 80; data _t(drop = i); array ap{&nd}; = 1 &nd; if le 4 a[i] = 1; else ....; end; 'other codes' run; case two what if order in array doesn't matter long contains elements need (n1 x1, n2 x2 ...) ? in scenario, easier build array? provided know in advance upper bound how many elements want create, can in array statement - e.g. data _null_; array t{10} (1*1 2*2 3*3 4*4); put t{*}; run; output: 1 2 2 3 3 3 4 4 4 4 n.b. sort of assignment implicitly causes array variables retained. you can nest brackets when creating runs of elements, e.g, data _null_; array t{10} (2*...

knockout.js - How to subscribe to changes Knockout Observable in TypeScript? -

how subscribe changes knockout observable in typescript? data :knockoutobservable<string> = ko.observable<string>(); i need like: data.subscribe(function(e){})?? type script way write javascript. not make difference knockout. so, can write subscribe in following manner (same in javascript) data.subscribe(function(newvalue) { alert(newvalue); });

excel - Turn my text into any color in VBA for length longer than 5 characters -

i want make string turn green color if len bigger 5. here code. can me out, keep getting error: object doesn't support property sub deme() dim lastrow long dim integer = 1 dim cc string dim long lastrow = worksheets("sheet1").range("c1").end(xldown).row - 1 = lastrow cc = worksheets("sheet1").range("c" & i) if len(cc) > 5 worksheets("sheet1").character(cc, i).font.color = vbred end if next end sub it fail on line: cc = worksheets("sheet1").range("c" & i) because range() returns range , cc string. it fail on line: worksheets("sheet1").character(cc, i).font.color = vbred because character() takes 1 parameter. give try: sub deme() dim lastrow long dim integer dim long lastrow = worksheets("sheet1").range("c1").end(xldown).row - 1 = 1 lastrow if len(worksheets(...

singly linked list - Link another structure in C -

i trying data stucture in c. connect structure structure. this: struct room { int roomnumber; struct room * nextroom; struct person * personlist; }*top=null,*temp=null,top1; struct person { int personnumber; struct person *next; }*node=null,temp1; struct room has pointer struct person. having hard time on connecting struct. correct? here function void insert() { int val; printf("enter value: "); scanf("%d",&val); newnode=create_node(val); if(top->personlist==null) { top->personlist=newnode; } else { node->next=newnode; node=newnode; } } insert person room. room created already. create_node() 1 malloc() here's version doesn't use globals, makes functions more general , reusable: #include <stddef.h> #include <stdlib.h> #include <stdio.h> typedef struct person { int personnumber; struct person *next; } person; /* no...

(Android) What have I done wrong in my code while trying to populate a spinner with database info -

i make data show in spinner consists of food objects (name, calories) gets created in main, , make these objects (just name now) show in spinner on activity. activity become part of larger program, , want able allow user ability "count" total amount of calories have eaten added foods selected. now, want able make foods appear can move further along. however, whenever go run it, app crashes no error message stated problem. if knows need do, please help. code below: import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.spinner; import android.widget.toast; import java.util.list; public class mainactivity extends actionbaractivity implements onitemselectedlistener { mydbhandler dbhandler = new mydbhandler(this,...

wpf - wp8 Binding CheckBox to CustomMessageBox via DataTemplate -

i make own control. inside want define data template use in custom message box. in code open dialog can't set start value check box inside it. please me - how correctly bind cbvoiceattchecked variable custommessagebox via datatemplate named voicetemplate xaml: <usercontrol x:class="myproj.rdpcontrol" ... > <usercontrol.resources> <datatemplate x:key="voicetemplate" > <stackpanel margin="32,0,0,0"> <checkbox x:name="cbvoiceatt" content="..." ischecked="{binding cbvoiceattchecked}"/> ... /*other checkboxes*/ </stackpanel> </datatemplate> </usercontrol.resources> <grid x:name="layoutroot"> ... here main control - works </grid> in code public partial class rdpcontrol : usercontrol { public rdpcontrol() { initializecomponent(); //this.datacontext = this; } pub...

c# - How to access enum in Unity AndroidJavaClass -

i'm newbie unity. have android project in eclipse , java class test inside package com.mytestcode . in test there nested class test.login login enum defined enum login {app, web, app_web} . in eclipse, can run fine; package com.mytestcode; import com.mytestcode.test; ... public testmethod(test.login abc) { if(test.login.app == abc){ // } } come unity, have come these errors androidjavaclass test = new androidjavaclass("com.mytestcode.test"); //work fine androidjavaclass test2 = new androidjavaclass("com.mytestcode.test.login"); //return classnotfound error androidjavaobject test3 = new androidjavaclass("com.mytestcode.test.login"); //return nosuchfielderror error androidjavaobject test4 = test.getstatic<androidjavaobject>("login.app"); //return nosuchfielderror error androidjavobject test5 = test.getstatic<androidjavaobject>("test.login.app") //return nosuchfielderror error how can access val...

amazon web services - docker dead but pidfile exists -

i working on docker on aws instance , working fine. on 1 day, docker stopped working. when restarted docker "service docker start", started , "service docker status" returned "docker dead pidfile exists" message , docker commands did not executed. when inspected log file, showed following messages: msg="+job serveapi(unix:///var/run/docker.sock)" msg="listening http on unix (/var/run/docker.sock)" msg="there no more loopback devices available." msg="loopback mounting failed" to start docker, removed pid file /var/run/docker.pid, /var/run/docker.sock , removed docker /var/lock/subsys/docker , restarted docker. no gain. still gives same error on start "docker dead pidfile exists". please help. this ticket related loopback issue. https://github.com/docker/docker/issues/7058 so, please check output losetup -l , ls -l /dev/loop* edit : if ls -l /dev/loop* returns error, cause github ti...

Ambiguity of Remove Method in Java ArrayList -

generally, usage of remove method arraylist in java shown below: arraylist<string> list = new arraylist<string>(); list.add("abc"); list.add("efg"); list.remove(1); //removing second element in arraylist. list.remove("abc"); //removing element value "abc" in arraylist. however, there situation overloading doesn't work. arraylist<integer> numbers = new arraylist<integer>(); numbers.add(1); numbers.add(2); when tried remove element value 2. gives me error: java.lang.indexoutofboundsexception: index: 2, size: 2 @ java.util.arraylist.rangecheck(arraylist.java:547) @ java.util.arraylist.remove(arraylist.java:387) so looks when comes remove number, can't remove element specific value. because computer assume integer value index, not value of element. it subtle error. there other simple way delete element specific integer value? you need use integer object. arraylist<in...

Tornado Sockets PHP/MySql Dialog Confirmation -

i creating application uses combination of tornado web server , symfony. the tornado part uses sockets , queries database every 1000ms , checks see if different stored in cache (sort of redis or memcache) if there different in key value pair triggers javascript query deliver new information symfony application , triggers jquery ui dialog "hey it's turn" , waits input user change mysql database , starts whole process again , sends "somethings changed" message other user. the issue having dialog not trigger because receiving "somethings changed" message blank. i think happening because symfony , tornado both manipulating database "somethings changed" message firing before dialog pops in symfony app what trying figure out way know if specific jquery dialog has been opened during update , if has not been opened send message update again. one idea database update in tornado random number when dialog opens set cookie random number. ...

python ord not working as expected -

so working on move front encoding/decoding assignment software engineering course , when using built in ord() function python 3.3 seems returning wrong value @ point in code. when want encode coding number 1-120 add code number 128. numbers between 121 , 375 use 2 bytes, first being f9 signify following 1 byte part of code number, , second being actual code number (encoded code # - 128). example 121 f9 00. when decoding running issue after reading in f9 , moving code decoding second byte, run issue ord function. my code is: def decode_num(base_num, input_file): if base_num <=248: #coding if code 1 byte code 1-120(will have been coded 248) return base_num-128 elif base_num == 249: #coding if code 2 byte code, first byte of code 121 second_byte=ord(input_file.read(1)) return second_byte+121 it seems work fine until hits coding 134, should f9 0d. ord(input_file.read(1)) call returns 10 instead of 13 should. have confirmed in mtf fil...

php - How to use my own autoloader instead of Composer's for unit testing? -

Image
what bootstrap in phpunit.xml? how can use own autoloader instead of composer's unit testing? directory structure, autoload/ test/ vendor/ composer.json phpunit.xml originals: <?xml version="1.0" encoding="utf-8"?> <phpunit colors="true" bootstrap="vendor/autoload.php"> <testsuites> <testsuite name="application test suite"> <directory>./test/</directory> </testsuite> </testsuites> </phpunit> composer.json, { "require": { }, "require-dev": { "phpunit/phpunit": "*" }, "autoload": { "psr-0": { "stats": "" } } } original test resutl, below own autoload class autoload/classloader.php , <?php namespace myvendor\autoload; class classloader { public function fetch( $directories ) ...

Recursion - Converting Javascript Map into a nested JSON object -

thank in advance help! i'm attempting convert specific javascript map nested json object. sample of map looks like: ["a", ["b", "c"]] ["b", ["e"]] ["c", ["f"]] ["e", []] ["f", []] where key represents parent node, , values in arrays direct children. empty arrays values indicates no children given key. generate output looks like: { "name": “a”, "children": [{ "name": “b”, "children": [{ "name": “e” }] }, { "name": “c”, "children": [{ "name": “f”, }] }] } (this may not well-formed json object typed, illustrative of hierarchical relationship javascript example map demonstrating). additionally, though trivial, keys nor values in arrays assumed sorted. lastly, know lends recursive soluti...

java - parse a date from string gives exception in android -

i want parse string string date ,date of format tuesday march 19,2015 . want parse , format yyyy-dd-mm format. below code gives me exception "unparceble date". code : dateformat df1 = new simpledateformat("yyyy-mm-dd"); try { date1 = df1.parse(currentdate); system.out .println("============my formated date====================" + date1.tostring()); calendar cal = calendar.getinstance(); cal.settime(date1); cal.add(calendar.date, 10); // add 10 days date1 = cal.gettime(); system.out.println("==============added date==============" + date1.tostring()); i have created 1 common function convert date format. have pass old date format, new date format , date. public static string convertdateformat(string oldformat, string newformat, string inputdate) { dateformat thedateformat = new simpledateformat(oldformat); date date = null; try { date = th...

python - How to limit the memory used by a process using psutil? -

i wondering how limit memory used process created using subprocess.popen shell=true , should detect if process uses more memory allotted. preferably looking solution using psutil . using python 3.4 in windows 7.

sql server - select rows from table and check if condition at column in sql -

i have check rows table , check if-else condition each rows table: report columns : sl.no , count , total_count , calls sample data: sl.no count total_count calls ----------- ----------- ----------- ----------- 1 2 6 4 2 2 7 5 3 4 9 3 here have check if condition if total_count > 6 select 'y else select 'n' i correct answer single row. if there multiple row can't check all, check last row of table. use case expression select *, case when total_count > 6 'yes' else 'n' end report

xpages - view daterange , end date not correct -

i'm selecting documents in view daterange. start date alway correct end date isn't. selection goes startdate till last entry. code : var vdaterange = session.createdaterange(sessionscope.selectedstartdate, sessionscope.selectedenddate); var projects:notesview = database.getview('visits_by_date_vb') var viewnav:notesviewnavigator = projects.createviewnav(); var viewentrycollection:notesviewentrycollection = projects.getallentriesbykey(vdaterange); var viewent:notesviewentry = viewentrycollection.getfirstentry(); var output:string = ""; while (viewent != null) { output += "<tr>"; output += "<td>" + viewent.getcolumnvalues()[0]; + "</td>"; output += "<td>" + viewent.getcolumnvalues()[3] + "</td>"; output += "<td>" + viewent.getcolumnvalues()[4] + "</td>"; output += "<td>" + viewent.getcolumnvalues()[5] + "</td>...

shell - Reliable way of finding out debian release name -

i have script needs know release name of debian system (example: trusty, sid, wheezy etc). know can find out if on debian based system looking /etc/debian_version , but: cat /etc/debian_version cat /etc/issue on debian stable produces: root@07156660e2cd:/# cat /etc/debian_version 7.8 root@07156660e2cd:/# cat /etc/issue debian gnu/linux 7 \n \l on ubuntu produces: ```root@a81e3f32b147:/# cat /etc/issue ubuntu 14.04.2 lts \n \l root@a81e3f32b147:/# cat /etc/debian_version jessie/sid ``` how ubuntu's codename (in case 'trusty')? don't want have maintain dictionary of release versions names please. there way in system find information out? thanks! use lsb_release : lsb_release -c

c# - Developing a :NET library started by a MATLAB application -

we developing .net library, has wpf ui. application started matlab application , figured out, things behave different, when start matlab, instead of starting our .net mock application ( application.current null - maybe there other differences). since testing through matlab bit cumbersome (quit matlab, build project in vs, start matlab, set breakpoint in matlab function, run matlab function, attach vs matlab, continue debugging in matlab): how can setup test application, uses our library , behaves our target system - integrates better vs?

playframework - Play Framework 2.3.4 Java Ebean Execution exception[[IllegalStateException: Transaction is Inactive]] -

i use play framework 2.3.4, java8, ebean. ebean transaction code not working. please help. java code ebean.execute(new txrunnable() { public void run() { user user = new user(); user.id = 1; user.save(); } }); server error log is play.api.application$$anon$1: execution exception[[illegalstateexception: transaction inactive]] @ play.api.application$class.handleerror(application.scala:296) ~[com.typesafe.play.play_2.11-2.3.4.jar:2.3.4] @ play.api.defaultapplication.handleerror(application.scala:402) [com.typesafe.play.play_2.11-2.3.4.jar:2.3.4] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$3$$anonfun$applyorelse$4.apply(playdefaultupstreamhandler.scala:320) [com.typesafe.play.play_2.11-2.3.4.jar:2.3.4] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$3$$anonfun$applyorelse$4.apply(playdefaultupstreamhandler.scala:320) [com.typesafe.play.play_2.11-2.3.4.jar:2.3.4] @ scala.option.map(option.scala:145) [org.sc...

Cannot open a file that was created in the temporary folder of an Android app - file does not exist or cannot be read -

when run code below prompt open file appropriate reader file not displayed. i new android app development , appreciated. url url = new url(dwnload_file_path); httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setrequestmethod("get"); urlconnection.setdooutput(true); //connect urlconnection.connect(); file = file.createtempfile("christo", ".pdf"); fileoutput = new fileoutputstream(file); //stream used reading data internet inputstream inputstream = urlconnection.getinputstream(); //this total size of file downloading totalsize = urlconnection.getcontentlength(); runonuithread(new runnable() { public void run() { pb.setmax(totalsize); } }); //create buffer... byte[] buffer = new byte[1024]; int bufferlength; while ((bufferlength = inputstream.read(buffer)) > 0) { fileoutput.write(buffer, 0, bufferlength); downloadedsize += bufferlength; // update progressbar // runonui...