Posts

Showing posts from September, 2014

javascript - onClick and href conflict in Firefox -

i tried implementing html anchor following: <a href="#some-id" onclick="showdiv(event)"> the code of showdiv() : function showdiv(e) { jquery("#container").show(1500); } inside #container there child node id some-id . the function showdiv() shows particular hidden element containing child id some-id . intention make anchor button, , when users click it shows element , directs user child id. works fine in chrome, in firefox show element redirection not work. there anyway can fix this? there similar question here html simple anchor link doesn't work in chrome/firefox think anchor issue firefox doesn't think unique.

How do I build Ruby on Rails? -

i working on research project going analyze several of commits in version control history ruby on rails . see commits pass or fail rails' test scripts. if possible, see commits can built. for example, if analyzing java project, try compile project @ each commit. if compilation process failed, know commit broke build. then, on successful build, run test scripts. i know ruby projects not have build process in same sense java projects because ruby interpreted. error compiler check, syntax error or type error, found @ runtime. because of this, i'm not sure whether rails has build process , if does, process is. does rails have build process or process analogous compiling project in compiled language? yes , no. there setup steps before can run tests. like open source projects if scroll down on readme page @ link included in question, you'll see the contributing section . links need know in order set rails , start either developing, or doing test research projec

How to order ng-repeat with a function a use button to change the order parameter in angularjs -

i have little bug while trying use angularjs table. tr th a(href='', ng-click="predicate = 'id'; reverse=!reverse") id th a(href='', ng-click="predicate = 'number'; reverse=!reverse") th a(href='', ng-click="predicate ='urlglobalcount'; reverse=!reverse") total tr(ng-repeat='url in urllist | orderby:predicate:reverse' ng-init="addone(url)") td {{$index + 1}} td {{url.number}} td {{urlglobalcount(url)}} the funtion urlglobalcount return number $scope.urlglobalcount = function(item) { return *somenumber* }; when try order urlglobalcount it's not working. if change code : tr(ng-repeat='url in urllist | orderby:urlglobalcount :reverse' ng-init="addone(url)") ordering urlglobalcount function w

Get list of users & persons by login with ldap java -

i'm working on app contains official employees information login. i ldap search filter retrieve me information concerning specific users corresspond list of logins provide. a bit select statement in sql : select * ldap login in(my list of login) i'm using basic javax.naming.directory blah blah comming with. // set properties our connection , provider properties properties = new properties(); properties.put( context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory" ); properties.put( context.provider_url, "ldap://myserver.somewhere.com:389"; ); properties.put( context.referral, "ignore" ); // set properties authentication properties.put( context.security_principal, "user name" ); properties.put( context.security_credentials, "password" ); initialdircontext context = new initialdircontext( properties ); the thing far lising object users if directly i'm looking nice :) thanks lot guys :)

javascript - I Need create an html page that reads a XML file in a CD-R. How I can do that? -

i made html website running in cd-r (this manual). have page created , working good, @ moment i'm having problems opening xml file. my question is, possible, since running in cd drive? thank you this have: function testing() { var rawfile = new xmlhttprequest(); rawfile.open("get", "teste.txt", true); rawfile.onreadystatechange = function () { if(rawfile.readystate === 4) { var alltext = rawfile.responsetext; alert(alltext); } else alert("erro no xml"); } rawfile.send(); } this works fine in example: localhost/path want work in path c:\path\ if don't mind modifying source files little bit turning json, use jsonp. here's simple example: <button onclick="go();">click me</button> <script type="text/javascript"> function go() { var scripttag = document.createelement("script")

java - Spark micro framework - save sessions in database? -

how configure rdbms (mysql) session store spark framework (the java micro web framework available @ http://sparkjava.com/ )? the reason ask want user sessions remain valid if jetty, spark runs on, has restarted. actually there option store sessions in database. use ebean orm, can other orm pure sql. assume have user class , usersession class. what should check whether there active session. if exists , has no user bound — pass authentication. if not exist — check if jsessionid cookie exists , has record in usersession table. if there such session retrieve user, create new session , bind user it. two class listings below pretty self-explanatory. call user.getauthenticateduser() every time tries access uri authenticated users. call user.addauthenticateduser(req, user) @ successful login attempt. user class: @data @entity @table(name = "users") public class user { private static final string user_session_id = "sessionid"; @id

java - Can I use some kind of assisted Inject with Dagger? -

with google guice or gin can specify parameter not controlled dependency injection framework: class someeditor { @inject public someeditor(someclassa a, @assisted("stage") someclassb b) { } } the assisted parameter stage specified @ time instance of someeditor created. the instance of someclassa taken object graph , instance of someclassb taken caller @ runtime. is there similar way of doing in dagger? because factories separate type of boilerplate optimize away, dagger leaves sister project, autofactory . provides " assisted injection " functionality guice offers via factorymodulebuilder , benefits: you can keep using autofactory guice or dagger or other jsr-330 dependency injection framework, can keep using autofactory if switch between them. because autofactory generates code, don't need write interface represent constructor: autofactory write brand new type compile against. (you can specify interface implement, if you'

C++ Bitwise XOR ^ Not Working -

the c++ xor ^. if i: a ^ b it should xor b however when values 4246661 0 4246661 ^ 0 it prints: 4246661 when should 0. edit: wow going off of online xor calculator giving me weird results.. sorry am missing something? xor result 1 if 1 , 1 of 2 values 1, meaning: 0 xor 0 0 0 xor 1 1 1 xor 0 1 1 xor 1 0 so, ( 4246661 xor 0 ), ( 0b10000001100110010000101 xor 0b0 ) result 0b10000001100110010000101 ...no problem here! anything xor 0 result anything

compiler construction - When does the lexical analyzer returns the token to the parser? -

i have studied parser calls lexical analyzer , lexical analyzer returns token happen @ once or concurrently lexical analyzer reads lexemes , returns token parser. we lexer returns parser token lexer stores in symbol table parser gets token symbol table ,but how refer it? you seem misunderstanding symbol table is. lexer transfers stream of bytes stream of lexemes , not handle symbol table @ (except when parsing c language, information symbol table handled parser fed lexer in lexer hack: http://en.wikipedia.org/wiki/the_lexer_hack ). handling symbol table job of parser. in practice, lexer may consist of function returns lexical token. so, if lexer implemented in way, token passed parser return value lexer function. you should try using lex/yacc (or flex/bison). implementing parser of own , seeing kind of code tools generate make understand how lexer , parser working together. i'm sure there plenty of tutorials lex/yacc on internet.

javascript - I failed to slide screen animation in QML -

i want slide menu screen on root rectangle. menu screen comes left side, ok couldn't send again. window { visible: true id: root width: 460; height: 640 color: "white" property int duration: 3000 property bool menu_shown: false rectangle { id: menu_screen width: parent.width; height: parent.height color: "#303030" radius: 10 x: -460; sequentialanimation { id: anim_menu numberanimation { target: menu_screen properties: "x" to: -160 } } } rectangle { id: click_button width: 50; height: 50 color: "#303030" scale: m_area.pressed ? 1.1 : 1 radius: 5 x: 5; y: 5; sequentialanimation { id: anim_button numberanimation { target: click_button properties: &qu

ios - Dynamic sections and rows in UITableView -

i have task , list, 2 entities in database. task-->one one-->list list-->one many-->task. i have uitableview want show list sections , tasks rows in sections, if thery connected relation in database. something this: ---------- section1-- row1 row2 ---------- section2-- row 3 row 4 row 5 ---------- section3-- row 6 ---------- section 4-- row 7 row 8 and on. any suggestion how it? have no idea... the comment nsfetchedresultscontroller correct solution. in fetch request of fetched results controller use entity task . when creating controller, set sectionnamekeypath @"list" , or whatever called to-one relationship in task entity.

c# - Using LINQ to convert array object[,] to array -

Image
i have information external system return me in following format: i required convert information object[,] array split on "|". i'm been using linq in vb information: dim vsapdatatemp(,) object = local_saptabledata.data dim vlinq = tempresult in vsapdatatemp select value = array.convertall(tempresult.tostring.split(rfc_delimiterchar), function(vval) cobj(vval.tostring.trim)) dim vnewsapdata() object = vlinq.toarray but i'm moving c# , i'm stuck following error: when using code: var vsapdatatemp = local_saptabledata.data; local_saptabledata.freetable(); fw.gccleaner(); local_saptabledata = null; var vlinq = (from tempresult in (vsapdatatemp object[,]) select string strvalue = array.convertall(tempresult.split(stcvariables.strsaprfcdelimiterchar), vval => (vval object).tostring().trim())); var vnewsapdata = vlinq.toarray<string>(); what

ruby on rails - Rspec + Cancan error -

admin_spec.rb it "checks access user" visit rails_admin_path login(:user) #helper method expect(page).to raise_error(cancan::accessdenied) end console output failure/error: login(:user) cancan::accessdenied: not authorized access page. but test still red. why , how fix it? have taken @ article? testing abilities in cancan instead of visiting url, maybe can use can? method determine if :user allowed visit rails admin path. i'm assuming you're using devise? if so, found other article may helpful . suggest including block allow devise test helpers. alternatively, switch cancancan (that's use) , works easier (since cancan no longer supported): context 'sign_in' scenario 'with valid information should redirect administration dashboard', :js => true sign_in_with sign_in_url, registered_user.email, 'validpassword', 'admin_user' expect(page).to have_content('site administratio

sql - DB2 date format day leading zero -

how can remove leading 0 day in query? it returns e.g. "mar 02" when use this: select varchar_format(mydatefield, 'mon dd') mytable i need "mar 2" there doesn't seem particular format days without leading zeros. so, 1 option is: select replace(varchar_format(mydatefield, 'mon dd'), ' 0', ' ')

shape - How do I draw a star in Java? -

i want draw star off of points. issue is not showing lines little star. missing here? making each point, making lines, setting color, , not show star. show frame thinking issue not frame actual bulk of code. guys suggest trying? public class starclass implements icon { static jframe frame; public static void main(string[] args) { jframe frame = new jframe(); frame.setsize(400, 400); frame.settitle("my star"); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); } @override public void painticon(component c, graphics g, int x, int y) { graphics2d g2 = (graphics2d) g; //points point2d.double pt1 = new point2d.double(100, 10); point2d.double pt2 = new point2d.double(125, 75); point2d.double pt3 = new point2d.double(200, 85); point2d.double pt4 = new point2d.double(150, 125); point2d.double pt5 = new point2d.double(160, 190); po

php - Angularjs $http post didn't pass param? -

Image
i've been debugging hours. tried set header etc no luck! my controller $http({ url: 'http://myphp.php/api.php', method: "post", data: {'wtf':'test'} }) .then(function(response) { console.log(response); }, function(response) { // optional // failed } ); and php <?php echo "test"; echo $_post["wtf"]; ?> in network tab how not sure what's wrong man, exhausted, i'm stuck hours! why $_post['wtf] didn't echo? $http serializing data json in request body php's $_post looking key/values parsed posted form data. these 2 different mechanisms posting data need choose 1 , use mechanism on both sides. you have 2 options solve this: in php code, parse request body json data , use object retrieve data. see this stackoverflow question more information. modify $http request post data form data. see this stackoverflow question more inform

bash - python stdout to file does not respond in real time -

write simple python script test.py: import time print "begin" time.sleep(10) print "stop" in bash, run python test.py > log.txt what observe both "begin" , "stop" appear in log.txt @ same time, after 10 seconds. is expected behavior? you need flush buffer after printing. import sys import time print "begin" sys.stdout.flush() time.sleep(10) print "end" sys.stdout.flush() or in python 3: # can done in python 2.6+ # __future__ import print_function import time print("begin", flush=true) time.sleep(10) print("end", flush=true)

Making a button appear in Android when a condition is fulfilled -

as title says i'd know best method generating button upon condition being fulfilled in code. in case, i'd clicking on particular imageview "s02" make button appear in activity. i know can make alertdialogs appear using code this: alertdialog alertdialog = new alertdialog.builder(this).create(); alertdialog.settitle("title"); alertdialog.setmessage("message"); alertdialog.setbutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { // code code code code code } }); i tried substituting button alertdialog on first line couldn't use builder on button. also, should create button in separate section of code make appear when condition set, or should put button's functionality in code creating button? putting button in xml layout , making appear when needed easiest route. if i

ios - How to delete a bunch of NSData in NSUserDefault -

i stored setting peripheral connected ios device, want add button user delete peripheral, means must delete setting related peripheral. the store simple using nsdata: nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsdata *encodedobject = [nskeyedarchiver archiveddatawithrootobject:self.appdelegate.defaultbtserver.selectperipheralinfo]; [defaults setobject:encodedobject forkey:self.appdelegate.defaultbtserver.selectperipheralinfo.uuid]; [defaults synchronize]; but how delete setting related selectperipheralinfo.uuid? found nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults removeobjectforkey:application.defaultbtserver.selectperipheralinfo.uuid]; cannot work. it looks might not using same key add , remove data. add, used: self.appdelegate.defaultbtserver.selectperipheralinfo.uuid but remove data used: application.defaultbtserver.selectperipheralinfo.uuid if values of expressions aren't same, won't able re

javascript - How To Access Function From Outside AngularJS -

i have absolutely never used angularjs - able handle parts of else's script - lost newb idea of accessing functions outside of class? or whatever called 0_o - have tried - lost. the script im working on this: app.controller("searchformcontroller", function($scope,$http){ $scope.getsomedetails = function(filter){ alert("you doing stuff in function"); } }) the function typically called form outside of script - this: <select id="transmissions" name="transmission" ng-model="transmission" ng-change="getsomedetails(true)"> when above form element selected - function getsomedetails called properly. now want call same function text link instead. have tried: <span onclick="getsomedetails(true)">get details </span> not sure doing wrong - i want call same function using text link? thanks help. app.controller("searchformcontroller", function

c++ - Compiler acts as if a preprocessor directive isn't defined -

i have header file , cpp file (error.h, error.cpp). cpp file performs check on preprocessor directive fails. error.h: /* optional macros: ae_exit_at_error ae_console_write_at_error */ #pragma once extern void aeerror(const char *str, int code=1); extern void aeassert(bool b, const char *failstr = "assertion failed"); error.cpp: #include "error.h" #include <stdexcept> #ifdef ae_console_write_at_error #include <iostream> #endif void aeerror(const char *str, int code) { #ifdef ae_console_write_at_error std::cout << str << std::endl; #endif throw std::runtime_error(str); #ifdef ae_exit_at_error std::exit(code); #endif } void aeassert(bool b, const char *failstr) { if(!b) aeerror(failstr); } main.cpp: //define both macros: #define ae_console_write_at_error #define ae_exit_at_error #include "error.h" //rest of code //... both std::cout << str << std::endl; , std

Sending ByteArray using Java Sockets (Android programming) -

i have java code sends string socket. can use same code android. public class gpcsocket { private socket socket; private static final int serverport = 9999; private static final string server_ip = "10.0.1.4"; public void run() { new thread(new clientthread()).start(); } public int send(string str) { try { printwriter out = new printwriter(new bufferedwriter( new outputstreamwriter(socket.getoutputstream())), true); out.println(str); out.flush(); } catch (unknownhostexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } catch (exception e) { e.printstacktrace(); } return str.length(); } class clientthread implements runnable { @override public void run() { try { inetaddress serveraddr = inetaddres

c++ - Finding a prime numbers between 1 - 239 using embedded loop -

i unable figure out how find of prime numbers between 1 , 239 using embedded loop. here code have far know on right track not know go here not returning right output #include <iostream> using namespace std; int main() { int n, x, y, is_prime; n = 0; while (n < 239) { n++; is_prime=1; x=2; while (x < n) { y = n % x; if (y == 0) {is_prime = 0; x = n;} else x++; } if (is_prime = 1) cout << n; cout << endl; } system("pause"); return 0; } you're close. here's working code, if assignment, try work out yourself, , peek @ answer if you're stuck. #include <iostream> using namespace std; bool isprime(int n){ //first check if n equals 2 or n divisible 2 if (n == 2) return 1; if (n%2 == 0) return 0; //start @ 3, check odds, , stop @ square root of n (int = 3; * <= n; i+=2){ if (n%i == 0)

php - How find words and strip the words after it? -

$string = 'hello world php bla bla..'; how keep 'hello world php', finding if string contains 'is', , remove characters after it? i can't use substr because occurrence of 'is' not consistent, may repeatable. how catch first one? you can use explode: <?php $string = 'hello world php bla bla..'; $string = explode(' ', $string); echo $string[0]; ?> read more at: http://php.net/manual/en/function.explode.php

objective c - Parse JSON Post with ISODate Object mongoDB - Node.js -

i'm trying parse json document mongodb isodate...but field string , not isodate. how can send json isodate without change node.js post method receive json , save in collection - (nsdictionary*) todictionary { nsmutabledictionary* jsonable = [nsmutabledictionary dictionary]; nsstring *dataeventoiso = [nsstring stringwithformat:@"isodate(%@)",self.dataevento]; safeset(jsonable, @"name", self.name); safeset(jsonable, @"placename", self.placename); safeset(jsonable, @"location", self.location); safeset(jsonable, @"details", self.details); safeset(jsonable, @"imageid", self.imageid); safeset(jsonable, @"categories", self.categories); safeset(jsonable, @"_id", self._id); safeset(jsonable, @"usuarioid", self.usuarioid); safeset(jsonable, @"status", self.status); safeset(jsonable, @"emailusuario", self.emailusuario); safe

How is context used in a class usage? -

the line of code giving me fits is: this.databasehandler = new databasehandler(mainactivity. i have module in project , line project trying incorporate. believe need line , having trouble getting idea of context parameter used here. yes, line incomplete because can not finish it. whole structure or thinking wrong? import android.app.activity; import android.content.context; import android.os.bundle; import android.os.asynctask; import com.table.tablemainlayout; import com.example.tablefreezepane.databasehandler; public class mainactivity extends activity { final string tag = "mainactivity.java"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); /* loads next module */ setcontentview(new tablemainlayout(this)); } } public class asyncinsertdata extends asynctask<string, string, string> { databasehandler databasehandler; string type; long timeelapsed; protected asyncinsertdata(string type){ t

operating system - From Kernel Space to User Space: Inner-workings of Interrupts -

i have been trying understand how h/w interrupts end in user space code, through kernel. my research led me understand that: 1- external device needs attention cpu 2- signals cpu raising interrupt (h/w trance cpu or bus) 3- cpu asserts, saves current context, looks address of isr in interrupt descriptor table (vector) 4- cpu switches kernel (privileged) mode , executes isr. question #1 : how did kernel store isr address in interrupt vector table? might done sending cpu piece of assembly described in cpus user manual? more detail on subject better please. in user space how can programmer write piece of code listens h/w device notifications? this understand far. 5- kernel driver specific device has message device , executing isr. question #3 :if programmer in user space wanted poll device, assume done through system call (or @ least understood far). how done? how can driver tell kernel called upon specific systemcall can execute request user? , happens, how

ruby on rails - param is missing or the value is empty: answer -

i'm new ruby on rails , i'm not understanding i'm doing wrong. have form submitting question multiple choice trivia game question supposed saved question database table , 4 answers saved answer table question_id foreign key. whenever click submit button valid data entered fields, keep getting error, "param missing or value empty: answer" block of code in questions controller: def answer_params params.require(:answer).permit({:question_id => [@question.id]},:answer_text, :correct) end here full class questions_controller.rb: class questionscontroller < applicationcontroller def new @question = question.new @answer1 = answer.new @answer2 = answer.new @answer3 = answer.new @answer4 = answer.new end def create @question = question.new(question_params) if @question.save @answer1 = answer.new(answer_params) @answer2 = answer.new(answer_params) @answer3 = answer.new(answer_params) @answer4 = answer.new(answ

c - i++, i=i+1 and i+=1 which one is faster? -

this question has answer here: incrementing: x++ vs x += 1 5 answers i'm curious know 1 run fastest in cpu among i++ , i+=1 , i=i+1 , how can measure execution time? well, @ first mankind invented following record. i = i+1; then along achievments in hardware mainkind invented following record i += 1; and @ last due progress in computer sciences mankind invented following records ++i; and i++; all these 3 forms of records expressions of same set of machine instructions.(with minor exception ++i , i++ when parts of more complex expression):) , set of machine instructions not depend on level of compiler optimization.:) p.s. of course discussing these operators fundamentals types. there no sense discuss these operators user-defined types because can overloaded in various ways.

ios - How to save an emoji into database? -

i've string holds 🆎 emoji , wants store sqlite database, string coming server, string can in combinations of, emojis, emojis + text, , text. how handle , store each string i'll server. i've code, store / retrive texts database , working fine. when got emoji in texts, changing output, , instead of emoji showing me random characters this, üÜé. how handle case? as per answer sqlite stores text data unicode string. previosly retriving text this, nsstring *text = [nsstring stringwithformat:@"%s",sqlite3_column_text(statement, 0)]; i changed this, nsstring *text = [nsstring stringwithutf8string:(const char *)sqlite3_column_text(statement, 0)]; and working fine now.

c++ - invalid operands to binary expression ('double' and 'double') -

// returns random element rho=[0,n-1] based on fitness int roulette_wheel(double fitness[], int n){ double f_sum=0.0, r, f, temp; int k=0; (int j=0; j<n; n++) { f_sum=fitness[j]; } r=rand()%f_sum+1.0; //(invalid operands binary expression ('double' , 'double')) f=1.0/fitness[k]; while (f<r) { k++; f=f+1.0/fitness[k]; } return k; } i don't know why part says invalid operands... thought codes right. once again, reiterating comments above clarity: you cannot use modulo on floating-point numbers. a function called fmod(), however, can give remainder of 2 floating point numbers.

functional programming - scala pass type parameter function as a parameter of another function -

suppose,i have function, take 2 values , function parameters. def ls[s](a: s, b: s)(implicit evl: s => ordered[s]): boolean = < b def myfunction[t](a: t, b: t, f:(t,t)=>boolean) = { if (f(a, b)) { println("is ok") } else { println("not ok") } } myfunction(1, 2, ls) the ide don't give error message,but when try compile , run,the compliter give message: error:(14, 19) no implicit view available s => ordered[s]. myfunction(1, 2, ls);} ^ so,is there way pass type parameter function parameter of function ? firstly works: myfunction[int](1, 2, ls) myfunction(1, 2, ls[int]) from understanding scala compiler tries resolve type t of myfunction . it finds first , second argument , happy assign int (or supertype) best match. but third argument says can parameter! scala compiler must comply , decides t any . causes s of type any , there no implicit view any => ordered[any] you must not

javascript - No graph displayed using Highcharts -

i have written following javascript code generate column graph using highcharts, no graph displayed. problem here? checked syntax errors, not find any. <div id="container1" style="width:100%; height:400px;"></div> function create_graph() { var xaxislabels = ['a ', 'b', 'c', 'd', 'e']; var yaxistitle = 'average'; var xaxistitle = 'xtitle'; var graphtitle= 'title'; var pvalues = [1,2,3,4,5]; var nvalues = [1,3,4,5,7]; chart = new highcharts.chart ({ chart: { height: 600, width: 1200, renderto: container1, type: 'column' //reflow: false }, title: { text: graphtitle }, xaxis: { categories: xaxislabels }, yaxis: { min: 0, title: { text: yaxistitle } },

file - Read a selected text from every line using python -

i have file contains string like [{"resourceid": "sid-14e51598-bee7-45e0-9974-a38b07ce6892"}] [{"resourceid": "sid-a5b57deb-c024-4d89-ad99-86fc340a6742"}] [{"resourceid": "sid-3775c783-4491-44b9-904c-1763c080e9c6"}] [{"resourceid": "sid-8f636b07-3010-4d27-9e9b-08db1d25ac96"}] i want sid-8f636b07-3010-4d27-9e9b-08db1d25ac96 every line using python. how can this? if file example named test.txt: #!/usr/bin/env python # -*- coding: utf-8 -*- import json open('test.txt') fh: line in fh: data = json.loads(line) print data[0]['resourceid']

Is there a way to know when an echoSign document has been successfully signed in real time? -

i'm still new @ echosign api , still @ learning phase. hit roadblocks i'm seeking help. so have form, echosign document. echosign widget. script(below) attached form document body. <script type='text/javascript' language='javascript' src='https://secure.echosign.com/public/embeddedwidget?wid={widgetid}'></script> is there way particular widget throw event if signed widget ( using current user session ). i'm not sure if thats possible. i know retrieve information's api using get /widgets/{widgetid}/agreements . there way form knows event real time? thanks in advance. looking forward. i think asking callback mechanism alert system whenever agreement created out of widget. during creation of widget through api can specify callbackinfo url echosign ping system final signed copy. here detailed description of request parameter - callbackinfo (string, optional): publicly accessible url adobe sign http operation ev

java - Netbeans - Custom new project -

how add custom project in netbeans' new project -> choose project -> categories menu? i'm talking project similar java -> java app , custom classes. i hope netbeans project type module tutorial you're looking for

Android Studio Can't find Drawable Resource -

package com.sarham.kabs.fruity; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.app.actionbardrawertoggle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toast; public class mainactivity extends actionbaractivity implements adapterview.onitemclicklistener{ private drawerlayout drawerlayout; private listview listview; private string[] planets; private actionbardrawertoggle drawerlistener; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); drawerlayout = (drawerlayout)findviewbyid(r.id.drawerlayout); listview = (listview)findviewbyid(r.id.drawerlistview); planets = getresour

java - Jackson mapper to persistence object -

i writing junit complex hierarchy application need test service input large , complicated persistence object. big decided initialize jsonn string. problem because has large inheritance tree getting difficult jackson de serializing it. there why instruct jackson annotation not automatic serializing , explicit. want ignore filed , getters/setters except 1 @jsonproperty annotation solved using following config getmapper().setvisibilitychecker(getmapper().getdeserializationconfig().getdefaultvisibilitychecker() .withcreatorvisibility(jsonautodetect.visibility.none) .withfieldvisibility(jsonautodetect.visibility.none) .withgettervisibility(jsonautodetect.visibility.none) .withisgettervisibility(jsonautodetect.visibility.none) .withsettervisibility(jsonautodetect.visibility.none));

php - Cart items in magento -

i want display cart items in magento. it's display on basis on product qty, want display them on number of product added cart. e.g. if added 1 product of 1kg , other product of 0.500grms in header displays 1.5 items, want display 2 items. any suggestions? magento version 1.9.0.1 there config setting field under system > configuration > sales > checkout > cart link 2 options: "display number of items in cart" , "display item quantities". choose second option , displaying issue solved.

django response to POST with 500 -

i'm trying make s server interact web server using django. other server , post server. working now, other server post server, django return 500. here code piece: views.py: import wx import logging def u_wx(request): iwx = wx.wx() logger = logging.getlogger(__name__) logging.error('in wx process') if request.method == 'get': logging.error("wx validate") return iwx.server_validate(request) else: logging.error("wx post") return iwx.wx_post_process(request) urls.py: urlpatterns = django.conf.urls.patterns('', django.conf.urls.url(r'^wx/$', views.u_wx), ) wx.py: class wx: def wx_post_process(self, request): return django.http.httpresponse('hello') when server, u_wx called , 'if' block run. when post it, u_wx no called @ all. django gives following message: [21/mar/2015 18:50:57] "post /wx?signature=xxxx&timestamp=xxxx&nonce=xx

class - What is the difference between old style and new style classes in Python? -

what difference between old style , new style classes in python? there ever reason use old-style classes these days? from http://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes : up python 2.1, old-style classes flavour available user. concept of (old-style) class unrelated concept of type: if x instance of old-style class, x.__class__ designates class of x , type(x) <type 'instance'> . reflects fact old-style instances, independently of class, implemented single built-in type, called instance. new-style classes introduced in python 2.2 unify concepts of class , type . new-style class user-defined type, no more, no less. if x instance of new-style class, type(x) typically same x.__class__ (although not guaranteed – new-style class instance permitted override value returned x.__class__ ). the major motivation introducing new-style classes provide unified object model full meta-model . has number of immediate ben

How to make variable values persistent between function calls in c / c++ -

i have following szenario. calling functions in dll ibm notes application (lotusscript). one of functions uses type structures , encounter problems on 64bit. values in type can passed function byref, need pass values byval. so decided have single arguments in function header every value. far, good. have around 43 arguments, ls can handle 31 ... next idea call i.e init_reg_person_info(arg1,arg2, ... ) before make call function registers new user. init_reg_person_info(arg1,arg2, ... ); init_reg_id_info(arg1,arg2, ... ); register_user(); in c, have function ( know, 1 argument, testing ) /*====================================================================================*/ /* function: bcc_initregpersoninfo */ /*====================================================================================*/ status lnpublic bcc_initregpersoninfo(char *firstname){ try { //extern char *reg_person_in

string - Python does not skip "if [strg] or [strg] in variable" -

this question has answer here: why `a == b or c or d` evaluate true? [duplicate] 1 answer i'm writing simple text-based game in python 2.7. in code below, if user answers different "run" or "nothing," arrested() function still kicks in. i'm pretty sure problem in line of code: if "run" or "nothing" in answer: because if provide 1 string, follows: if "run" in answer: the program runs beautifully, calling remote_spot() if answer not contain "run". whole code following: def facing_cops(): print "there several cars might serve stake-outs cops. do?" answer = raw_input("> ") if "run" or "nothing" in answer: arrested("cops got suspicious. arrested, along drug dealer.") else: remote_spot() what think matter?

c# - Multiple particle emittion locations -

i following tutorial on particle systems in xna: http://rbwhitaker.wikidot.com/2d-particle-engine-1 , fine tutorial, can't find easy way have particles emit multiple locations properly. tried put particleengine.emitterlocation = new vector2(mouse.getstate().x, mouse.getstate().y); , particleengine.update(); in loop every place want appear, speeds particles (since being "updated" multiple times per update). way fix this? thanks! edit: clarify, want know how make particles emit multiple locations, not why updating multiple times per update

c# - Why is the Up() method abstract and the Down() method virtual in the DbMigration class -

if @ signature of abstract class dbmigration in system.data.entity.migrations namespace: public virtual void down(); public abstract void up(); you'll see down() marked virtual , up marked abstract . difference between virtual , abstract abstract function can have functionality in it . what kind of functionality can up() function have default , why isn't case th down() function. you need override up() while overriding down() optional. makes sense database migration instructions. see what difference between abstract function , virtual function? .

android - How to upload video on youtube with title and description -

how upload video title , description via intent.i tried via intent example how upload video youtube in android? can set video.how set title , descriptions video?thanks. here peace of code video videoforshare = mlistvideos.get(position); contentvalues content = new contentvalues(4); content.put(mediastore.video.videocolumns.date_added, system.currenttimemillis() / 1000); content.put(mediastore.video.media.mime_type, "video/mp4"); content.put(mediastore.video.media.data, videoforshare.getvideoname()); contentresolver resolver = mcontext.getcontentresolver(); uri uri = resolver.insert(mediastore.video.media.internal_content_uri, content); if (uri == null) uri = resolver.insert(mediastore.video.media.external_content_uri, content); intent sharingintent = new intent(android.content.intent.action_send); sharingintent.settype(&q

java - Does MaltParser actually provide an option for returning probabilities of Parse trees? -

while looking @ source code of malt parser has class liblinear.java(jar file) , calls java version of liblinear toolkit; don't find option/way return probability despite information that, in principle training model using liblinear(by default in malt parser) logistic regression(-s 0) should produce probability score of parsed trees. the main concern is: integration of liblinear , malt parser working smoothly without affecting each other expected operations? working separately liblinear give me probability output datasets. liblinear-train -s 0 train_scale //training data using logistic regression model liblinear-predict -b 1 test_scale train_scale.model test_scale_output //labels , classes , probability outputs. here -b 1 extract out probabilities of each datasets. reference: https://stackoverflow.com/questions/28791352/how-to-get-probability-score-of-parsed-sentences-using-malt-parser malt parser works based on transition system , 2 or 3 stacks. @ each

javascript - Full Calendar not showing some rows when slot duration is set while rendering -

Image
i'm trying figure out why full calendar not showing rows. tried setting slotduration 5, 10 minutes in case, works in 15, 30 minutes doesn't. saw while rendering applies .fc-minor class on adjacent rows not showing. does know why it's happening ? var calendaroptions = { header: { left: 'prev today', center: 'title',//'agendaweek,agendafourday', right: 'next, month, agendaweek, agendaday' }, columnformat: 'ddd d/m', eventcolor:"#208454", timezone: 'australia/sydney', slotduration: '00:30:00', ... } i had below property set in custom.scss preventing rendering of adjacent events correctly. .fc-slats td { height: 1px !important; }

python - Pythonic way to modify list element if condition is met -

i have this: mylistoflists = [["descra",true,3],["descrb",true,5],["descrb",true,65],..] for each element in list need set mylistoflists[element][1] false if mylistoflists[element][2] <= 30 . mylistoflists should become: [["descra",false,3],["descrb",false,5],["descrb",true,65],..] what best approach in python that? there lots of ways it, depending on mean "best approach in python". 1 of them: for in mylistoflists: if i[2] <= 30: i[1] = false since "best" mean: fast, memory efficient, readable etc can check method suits needs. for example check speed can use timeit , compare various solutions. what "best" should not mean, " unnecessarily complex ".

osx - PhoneGap server starts on local interface -

i have little problem. when start phonegap serve [phonegap] starting app server... [phonegap] listening on 127.94.0.1:3000 but phonegap app listen 192.168.1.102:3000 en0, not lo0. if ifconfig lo0 down — phonegap serve sarts on correct ip. how can change listen ip phonegap server or set priority en0? os x yosemite use.

c# - How to aill cause it to ces when I try to d -

my program crashes when try decimal calculation starting decimal point. example, ".9" cause crash whereas "0.9" works fine. here's code: private void textbox1_keypress(object sender, keypresseventargs e) { if (!char.iscontrol(e.keychar) && !char.isdigit(e.keychar) && (e.keychar != '.')) { e.handled = true; } if ((e.keychar == '.') && ((sender textbox).text.indexof('.') > -1)) { e.handled = true; } if (e.keychar == convert.tochar(keys.return)) { textbox2.text = area1.tostring(); } } private void textbox1_textchanged(object sender, eventargs e) { if (textbox1.text == string.empty) { textbox2.text = " "; } else diameter1 = double.parse(textbox1.text); area1 = (math.pi * math.pow((di

xaml - Multiple Language Support in WP8 app -

Image
for wp8 app want provide support several languages. i'm using *.resw files in order store language specific text needed xaml elements. defined default language (en-us) within *.appxmanifest. regarding project's file organization, created several language files used different groups of information, e.g. button context ("appbarbuttons.resw") or pivot header ("pivotheader.resw"). but i'm not quite sure if best solution. if there elements on different pages, same x:uid property? so question is, should stick solution or shall create language file each page individually, , how can let user choose specific language (only if available app of course) programmatically? create 1 .resw file per language. creating 1 per form going become difficult solution maintain on time, if share terms between forms. use x:uid notation in xaml when possible makes life easier. found following video microsoft on languages in windows phone quite helpful ... htt

c# - When i use ExecuteScalar command returns an empty object -

what wrong code? when use block of code in visual studio 2008 c# curid output value "" , have 2 values in database should return 2... also when run query select ident_current('tablename') directly in sql server management studio, returns correct value. string curid = ""; cmd = new sqlcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = "select ident_current('@tblname')"; cmd.parameters.addwithvalue("@tblname", tablename); cmd.connection = con; object obj = cmd.executescalar(); curid = obj.tostring(); edit commandtext this: cmd.commandtext = "select ident_current(' " + tablename + "')";

android: Recyclerview for Fragments? -

i have followed tutorial on recyclerview here . but wondering if build more complex behaviour using fragments inside recyclerview instead of plain old views . using fragments can make reusable item complex behaviour can placed in other places , can more flexible. is possible , if , how ? recyclerview view repeats lot different data, it's designed use in long scrolly lists because inflating (constructing) view object takes effort, recycling takes view scrolled off top of screen, fills new data , puts @ bottom. i wouldn't have thought using fragment work well, whenever scroll list it'll need re-created , run various setup methods quite expensive. , if make doesn't have (setretaininstance()) you're not getting wouldn't view. if that's you're getting @ yes create fragment, set up, mark retained , keep reference hangs around in memory re-attach other parent @ other time. if have change contents , re-build you're not gaining much.

multithreading - Must these short methods be synchronized in Java? -

consider following static helper public class dbutil { private static final logger logger = logmanager.getlogger(dbutil.class); public static void closeall(resultset rs, statement stmt, connection conn) { close(rs); close(stmt); close(conn); } public static void close(connection connection) { if (connection != null) { try { connection.close(); } catch (sqlexception e) { logger.error(null, e); } } } public static void close(statement statement) { if (statement != null) { try { statement.close(); } catch (sqlexception e) { logger.error(null, e); } } } public static void close(resultset resultset) { if (resultset != null) { try { resultset.close(); } catch (sqlexception e) { logger.error(null, e

Cannot update Eclipse Luna -

i click help -> check updates , go through wizard , following error: an error occurred while collecting items installed session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). no repository found containing: osgi.bundle,org.springsource.ide.eclipse.commons.browser,3.6.4.201503050855-release no repository found containing: osgi.bundle,org.springsource.ide.eclipse.commons.gettingstarted,3.6.4.201503050855-release no repository found containing: osgi.bundle,org.springsource.ide.eclipse.commons.quicksearch,3.6.4.201503050855-release no repository found containing: osgi.bundle,org.springsource.ide.eclipse.dashboard.ui,3.6.4.201503050855-release no repository found containing: osgi.bundle,org.aspectj.runtime.source,1.7.0.20120703164200 no repository found containing: osgi.bundle,org.eclipse.contribution.weaving.jdt.source,2.2.0.e37x-release-20120704-0900 no repository found containing: org.eclipse.update.featur

android - How to change the Typeface of the Title/Subtitle of an Actionbar? -

i want customize typeface of title , subtitle of actionbar. placed desired ttf-file in asset folder , loaded typeface saying typeface font = typeface.createfromasset(getassets(), "ardestine.ttf"); it's easy apply typeface views button or textview etc., how can apply actionbar , cannot find setter-method? or have use getactionbar().setcustomview(view) in order achieve this? you can create spannablestring in desired typeface , set string title of actionbar. string name = "....."; // string here spannablestring s = new spannablestring(name); s.setspan(new typefacespan(getapplicationcontext(),bold_font_filename, getresources().getcolor(r.color.white), getresources().getdimension(r.dimen.size16)), 0, s.length(), spannable.span_exclusive_exclusive); actionbar.settitle(s);