Posts

Showing posts from February, 2014

javascript - cannot access 'this' in nested function -

javascript - cannot access 'this' in nested function - this question has reply here: javascript “this” pointer within nested function 5 answers how access right `this` / context within callback? 4 answers so need help i've been stuck on couple of hours now.. the problem i'm creating object called rank. rank needs db calls in mongodb info fill matrix, needs perform more nested function calls on matrix haven't written yet. problem when i'm calling dorank() gets companies , transactions , seems set them in rank when phone call creatematrix can't access 'this' i have tried using .bind(this) on each of functions in dorank() prevents error method doesn't exist when console.log @ end of dorank() results matrix undefined. function rank(d

Execute JavaScript from CSS -

Execute JavaScript from CSS - part of html page. <head> <title>overview</title> <link href="mystyle.css" rel=stylesheet type="text/css"> i know it's unusual question, possible add together javascript code mystyle.css ? edit1: html generated 3rd party software have no command on it. css file static , not alter (i thought add together javascript executed css file). in other words can add together mystyle.css //css declaration... <script src="myjs.js"> it possible in limited ways - see using javascript in css . can write out css rules via javascript: http://davidwalsh.name/add-rules-stylesheets . or can create 2 different css classes , apply them elements via javascript, e.g. jquery's http://api.jquery.com/addclass/ or native javascript equivalent. i'm guessing want utilize variables within css don't have repeat css in several different places? of techniques, if take gue

if statement - Testing whether R command has error or not in ifelse command -

if statement - Testing whether R command has error or not in ifelse command - i want check whether r command has error or not in iflese command. similar next one. wonder how accomplish one. want run next code if there no error in previous r code. ifelse( test= check r command has error or not , yes = false , no = true ) ifelse( test= log("a") # has error , yes = 3 , no = 1 ) you can utilize trycatch this: trycatch({ log(10) 1 }, error=function(e) 3) # [1] 1 trycatch({ log('a') 1 }, error=function(e) 3) # [1] 3 in sec illustration above, first look (which can multi-line, above) throws error, look passed error argument executed. r if-statement

printing - Python: custom print function that wraps print() -

printing - Python: custom print function that wraps print() - how can wrap print() can add together arbitrary strings origin , end of things passed arguments printed? def xprint(*args): print("xxx", *args, "xxx") xprint("hi", "yo", 4) doesn't work. want custom function xprint() work print() add together 'xxx' origin , end of every output. will work python 2 , 3 def xprint(*args): print( "xxx"+" ".join(map(str,args))+"xxx") in [5]: xprint("hi", "yo", 4) xxxhi yo 4xxx python printing wrap

C++ String reaches over several NUL Bytes -

C++ String reaches over several NUL Bytes - i hate inquire because think must trivial. used high-level-languages real problem. i got c++ programme uses pdfium generate image pdf. , have c# programme communicates c++ programme via named pipes. pdf file (which saved byte-array) gets transmitted pipe. , here problem. on 374th position of stream nul byte (00) , im stupid somehow reach info after it. here code: lptstr lpszpipename2 = text("\\\\.\\pipe\\mynamedpipe2"); hpipe2=createfile(lpszpipename2, generic_read, 0,null,open_existing,file_flag_overlapped,null); if(readfile( hpipe2, chbuf, dwbytestoread, &cbread, null)) { pdfdata = chbuf; } dwbytes read size of file , cbread shows right number. pdfdata contains first 373 bytes. checked info beyond 373th position there immediate window don't know how process it. gotta set info char-array. as said, think trivial. although know problem comes from, have no thought how prepare it. many ,

html - Whats the best way to center a form that's relative, the inputs inside float left and contains images -

html - Whats the best way to center a form that's relative, the inputs inside float left and contains images - i'm making form has little images in them either tick or cross. want these appear in text box have added form. site mobile site want form centered on ever sized screen , images in same place. method @ moment feels quite messy , works on little screens unless @ in on phone mess! whats best way this? here stab @ it html <div class="formcontainer"> <form action="contact.php" method="post" class="ajax" id="contactform"> <div class="input"> <input type="text" name="text" placeholder="name" id="name"> <div class="validation"> <img src="check.svg" class="imagevalidation" id="nameimage"> </div&

java - Convert a Python POST request to Android -

java - Convert a Python POST request to Android - i trying utilize illustration of python post api in android project. not have much experience httpsurlconnection think need utilize accomplish this. have looked @ tutorials not sure how integrate python code. python: # highly suggested utilize requests bundle # http://www.python-requests.org/en/latest/ import requests # read in image , build payload image = open("example.jpg").read() info = {"api_key": "kh8hdoai0wrjb0lyea3emu5n4icwyoqo"} files = {"image": open("example.jpg")} # fire off request r = requests.post("http://www.idmypill.com/api/id/", info = data, files = files) # contents returned json string print r.content this have far on trying convert android not sure @ if work or right way go this. // http post request private void sendpost() throws exception { string url = "http://www.idmypill.com/api/id/"; url obj = new url(url);

Use AudioQueue to play PCM audio stream in ios, First is ok,but no voice after 15mins -

Use AudioQueue to play PCM audio stream in ios, First is ok,but no voice after 15mins - i sound info rtmppacket, , utilize audioqueue play in ipad. first, voice fine. after 15mins, there no voice. info ok, , queue playing. don't know why. can help me? thanks. this class used play audio. audioplayer.h #import <foundation/foundation.h> #import <coreaudio/coreaudiotypes.h> #import <corefoundation/corefoundation.h> #import <audiotoolbox/audiotoolbox.h> #include <unistd.h> #define knumberbuffers 3 @interface audioplayer : nsobject { audioqueueref mqueue; audioqueuebufferref mbuffers[knumberbuffers]; audiostreambasicdescription mplayformat; int mindex; @public boolean misrunning; boolean misinitialized; int mbufferbytesize; int pip_fd[2]; uint32 mnum

python - Import nested submodules -

python - Import nested submodules - i have function attach_connection_pinging in module mylib.tools.db . need phone call in mylib/__init__.py : from .tools import db db.attach_connection_pinging() or from .tools.db import attach_connection_pinging attach_connection_pinging() but don't solution, because creates unneeded names in mylib module. my current solution auto-import needed submodules of tools package. mylib/tools/__init__.py : from . import db . import log then in mylib/__init__.py : from . import tools tools.db.attach_connection_pinging() tools.db.make_psycopg2_use_ujson() tools.log.attach_colorsql_logging() well it's best workaround i've found, it's not ideal. ideally nicer, not compiling: from . import tools.db . import tools.log tools.db.attach_connection_pinging() tools.db.make_psycopg2_use_ujson() tools.log.attach_colorsql_logging() is there improve solution? missing anything? you do: from .tools import

jboss5.x - org.jboss.ws.metadata.wsdl.WSDLException_ Invalid default namespace_ null -

jboss5.x - org.jboss.ws.metadata.wsdl.WSDLException_ Invalid default namespace_ null - i have wsdl , have generated code using wsimport. have written code access web service & trying test it. works on tomcat, on jboss 5.1 ga, gives next error: org.jboss.ws.metadata.wsdl.wsdlexception_ invalid default namespace_ null i have spent 3 days figuring out problem no luck. 1 os solutions tried involved jaxws-rt files & working jboss endorsed directory, not sure jars need replaced, still stuck. any help appreciated. i guess fixed issue, in case interested. i had same problem deploying ussd gateway mobicents jain slee, runs on top of jboss 5.1.0 ga. gateway has connect server via soap, chose jax-ws , generated source code wsdl wsimport. way, used similar procedure this one create kid maven project , generate java files jax-ws. failed deploy dependencies embedded on .war file my first approach include dependencies in .war file deployed in jboss. think achieved d

c# - How to specify equivalant of null as default parameter of struct type -

c# - How to specify equivalant of null as default parameter of struct type - how can define function struct parameter can optionally passed, yet able know within function whether passed or not? trying accomplish similar to: function somefunction(string str = null) { if (str == null) { ... } } calling above function no parameter trigger if (str == null)... condition: somefunction(); the above approach doesn't work parameter of type struct. given next struct: public struct mystruct { public int someint; public double somedouble; } this generates error there no standard conversions: public function somefunction(mystruct mystruct = null) { } but when define function as: public function somefunction(mystruct mystruct = default(mystruct)) { } and phone call function with: somefunction(); on entry function mystruct contains 0 someint , 0.00 somedouble . these legit values leaves me without way know if parameter passed function or

javascript - ng change with custom directive -

javascript - ng change with custom directive - javascript code directive angular.directive('uidatepicker', [function() { homecoming { restrict: 'ea', scope: { ngmodel: '=ngmodel', ngchange: '=ngchange' }, templateurl: 'complete/date-picker.tmp.html', replace: true, require: 'ngmodel', link: function(scope, elem, attrs, ngmodel) { if(scope.ngmodel !== undefined) { scope.datepicker = new datepicker(new date(scope.ngmodel)); } else { scope.datepicker = new datepicker(); } scope.ngmodel = scope.datepicker.value; } } }]) javascript code controller angular.controller('main', ['$scope', func

c++ - How to implement OnMove() in MFC? -

c++ - How to implement OnMove() in MFC? - i've created sdi mfc project , i'm trying refresh coordinates of window upon moving of window... here's have far: // todo: add together draw code native info here rect rect; getclientrect(&rect); // window coordinates int left = rect.left; int right = rect.right; int bottom = rect.bottom; int top = rect.top; // print them out cstring l; l.format(l"%d", left); pdc->textoutw(0, 100, l"left: " + l, _tcslen(l)+6); cstring r; r.format(l"%d", right); pdc->textoutw(0, 130, l"right: " + r, _tcslen(r)+7); cstring b; b.format(l"%d", bottom); pdc->textoutw(0, 160, l"bottom: " + b, _tcslen(b)+8); cstring t; t.format(l"%d", top); pdc->textoutw(0, 190, l"top: " + t, _tcslen(t)+5); what do implement onmove() function refreshes these values new ones upon each move/resize of window? c++ visual-studio-2013 mfc

javascript - Assigning/Passing value from Java function to JS/JQuery function -

javascript - Assigning/Passing value from Java function to JS/JQuery function - lets have java function like public int getnumber(){ } which returns value based on it's logic. , have js file like tapestry.validator.amountvalidator = function(field, message) { field.addvalidator(function(value) { if (value != null) { // code here } } }); }; now asking myself possible in js or jquery pass value java function it's function(value) in js , if so, how can achieved? update: suggested abalos answer, tap myself has done 3 out of 4 stages it. providing function deals server side , logic behind it. @injectcomponent private textfield amount; @inject private fieldvalidatorsource fieldvalidatorsource; public fieldvalidator<?> getamountvalidator() { homecoming fieldvalidatorsource.createvalidators(amount, "required,max=" + getbroj()); } now here validator taken logi

ruby - Can I change an object's type inside its own methods? -

ruby - Can I change an object's type inside its own methods? - it great if alter object's class within own methods like: class dog < animal def initialize(color, size) #do stuff end def do_lots_of_stuff #really long involved calculations different classes , methods #and objects can't alter @ point if random_condition self = super_special_dog.new(@color, @size, specialness) end end end class super_special_dog < dog def initialize(color, size, specialness) #do stuff end end is there way convert instance of dog , 'fido', super_special_dog after fido.do_lots_of_stuff called, fido.is_a? super_special_dog homecoming true , other methods/classes can operate on fido super_special_dog 's methods , variables on? i tried above construction , got error can't alter value of self (syntaxerror) . can create super_special_dog based on dog or on animal doesn't matter needs. i can see other que

swift - How to update SKLabelNode color after the node is initiated? -

swift - How to update SKLabelNode color after the node is initiated? - i have sklabelnode in swift-code. need alter label's color during skaction. simply: override func didmovetoview(view: skview) { ... var color = uicolor(red: cgfloat(1.0), green: cgfloat(0.0), blue: cgfloat(0.0), alpha: cgfloat(0.0)) mylabel.fontcolor = color ... } doesn't work. still have somehow update node how? i'm noobie swift , sprite kit. i had similar problem few weeks ago. seek changing color variable following: var color = uicolor(red: 1.0 / 255, green: 0.0 / 255, blue: 0.0 / 255, alpha: 0.0) swift colors sprite-kit sklabelnode

core animation - iOS animateWithDuration complete immediately for hiden/show or even opacity -

core animation - iOS animateWithDuration complete immediately for hiden/show or even opacity - i want animate calayer show while, fade out, here code [_msglayer removeallanimations]; [uiview animatewithduration:10 delay:0 options:0 animations:^ { _msglayer.hidden = false; nslog(@"showing"); } completion:^(bool finished) { nslog(@"showing done, finished=%d", finished); [uiview animatewithduration:10 delay:40 options:0 animations:^ { _msglayer.hidden = true; } completion:^(bool hidefinished) { nslog(@"hiding done, finished=%d", hidefinished); }]; }]; however, animation doesn't work expected, finish immediately 2014-10-26 10:11:28.249 foobar[91761:6827358] showing 2014-10-26 10:11:28.254 foobar[91761:6827358] showing done, finished=1 2014-10-26 10:11:28.255 foobar[91761:6827358] hiding done, finished=1 i see similar questions out there, people hidden not animatable, document says it's animata

java - I'm trying to load 500Mb file (Files.readAllBytes) and I need more than 2 Gb Heap size. Why? -

java - I'm trying to load 500Mb file (Files.readAllBytes) and I need more than 2 Gb Heap size. Why? - i'm trying load 500mb file in memory (files.readallbytes) , need more 2 gb heap size. with default settings have outofmemoryerror: java heap space. when set -xmx1000m doesn't work. works if set @ to the lowest degree -xmx2300m -xmx2300m. why java need such overhead? two possible answers come mind, the library phone call using copying bytes between buffers more once, multiplying amount of memory need. the heap separated logical parts (generations). when allocating 'large' object not fit generation object tenured early. if there not space in old gen, object allocation fail. combine 1 above, , little heap , 1 can see how java nail trouble. the simplest solution both problems memory map file instead, allocate memory off heap , efficient/fast @ reading file in reduces number of os context switches , byte buffer copies involved in reading file.

How to echo #!/ using shell or bash -

How to echo #!/ using shell or bash - this question has reply here: echo “#!” fails — “event not found” 4 answers i trying print #!/ via bash, doesn't print , instead prints following. parth@parth-ubuntu64:$ echo "#!\/" bash: !\/: event not found edited: allow me create 1 more update. how create next work? think should utilize python instead of bash. reason why trying because, want pipe file requires sudo permission. way can execute sudo => sudo sh -c " echo > file " sh -c 'echo \'#!/bin/bash \' ' within double quotes (and history expansion enabled), ! has special meaning. print characters literally, utilize single quotes instead of double: $ echo '#!\/' #!\/ history expansion can disabled in interactive shell using set +h , allows utilize double quotes: $ set +h $ echo "#!\/&q

java - Why is my answer showing as Infinity? -

java - Why is my answer showing as Infinity? - i sort-of new bear me. i creating programme allows user come in in scores of piece of coursework , exam score , total grade calculated. values entered have between 1 , 10. coursework work 40% , exam worth 60%. values 1-10 have converted percentages , believe infinity error occurring. this code (there 'if' , 'else' statements later in code think i'll ok that. ignore final classification @ bottom): import javax.swing.joptionpane; public class question3 { public static void main(string[] args) { string coursework, exam; coursework = joptionpane.showinputdialog("please come in coursework score out of 10:"); exam = joptionpane.showinputdialog("please come in exam score out of 10"); double courseworkdoub, examdoub, courseworkperc, examperc, finalmark; courseworkdoub = double.parsedouble(coursework); courseworkperc = (courseworkdoub

html - Bootstrap: Grid item not inline -

html - Bootstrap: Grid item not inline - i have grid of items split 2 columns using bootstrap, columns collapsed on sm , xs . have visual error on md , lg views 'cabling' item has big margins above , below element. what cause of behavior? bootply link. html: <h2>products &amp; services</h2> <p>please see our products , services below</p> <div class="row grid-headers"> <div class="col-md-6 col-xs-12"> <div class="col-xs-2"><a id="" name="" href="#"><img id="" src="http://baadev-heathrowtelecoms.cs14.force.com/resource/1373023376000/collateral_lan_icon" class="img-responsive" /></a> </div> <div class="col-xs-10"><a id="" name="" href="#"> <h3>managed lan services</h3></a>

Stop an Infinite Loop in Python While Statement -

Stop an Infinite Loop in Python While Statement - i'm working on simple python programme involves creating circle "button" , having user click within circle. if don't click on circle, message comes stating have clicked outside of circle , should seek again. however, on lastly part i'm getting endless loop on code, despite using break. there way help see if there error? thanks! r = 75 while true: # determine if click within circle length = math.sqrt(((x-100)**2) +((y-250)**2)) if length == r or length < r: break # prints if user not click within range print("please click within spin button") x , y never updated within while loop, if outside of circle in first iteration, length remain @ same value (bigger r ), , break statement never executed. also, utilize if length >= r: . no need check 2 conditions separately. (logically, should if length > r: anyway since click on border of circle s

arraylist - Referencing an ArrayListin another class? Java/Android -

arraylist - Referencing an ArrayListin another class? Java/Android - i need help info management. can explain enough. create , instantiate arraylist in class a, want display info in class b. little trickier this, allow me explain steps. i created setters , getters in class a public static void setarray(arraylist<string> list) { classa.mlist = list; } public static arraylist<string> getarray() { homecoming mlist; } while in class a, populate array 1 item, mlist.add("item"). have item in list (mlist), start new activity intent intent = new intent(classa.this, classb.class); startactivity(intent); i purposefully did not finish() activity. in class b, test if info persists printing out first item in array using getter method. system.out.println("data persists? " + classa.getarray().get(0)); everything works fine point. finish() class b, brings me class a. added in onresume() class add together item list (mlist) , the

ios - AVCaptureSession audio doesn't work for long videos -

ios - AVCaptureSession audio doesn't work for long videos - i'm using avcapturesession record video audio. seems work short videos, reason, if record video longer 12 seconds, sound doesn't work. i found solution an reply different question. the issue moviefragmentinterval property in avcapturemoviefileoutput. the documentation property explains these fragments are: a quicktime film comprised of media samples , sample table identifying location in file. film file without sample table unreadable. in processed file, sample table typically appears @ origin of file. may appear @ end of file, in case header contains pointer sample table @ end. when new film file beingness recorded, not possible write sample table since size of file not yet known. instead, table must written when recording complete. if no other action taken, means if recording not finish (for example, in event of crash), file info unusable (because there no

asp.net - How to get search result from the original string after searching with C# -

asp.net - How to get search result from the original string after searching with C# - what i've tried here can show file path contents string in textbox1.text cannot , show string in file. private void search_click(object sender, eventargs e) { string[] filepaths = directory.getfiles(@"c:\users\abcdq\downloads\documents\", "*.pdf", searchoption.alldirectories); (int = 0; < filepaths.length; i++) { string settext = gettextfrompdf(filepaths[i]); if (settext.toupper().contains(textbox1.text.toupper())) { messagebox.show(filepaths[i]); } } } for example: in account.pdf, has: new users? new users, need fill in form right of page next information: back upwards reference – back upwards contract number e.g. dm1234 or rh1234. company name – needs exact name know match back upwards reference. display name – name, automatically filled in when utilize of forms in site. email

java - Get clicked item of array -

java - Get clicked item of array - i've created grid of objects called cell. each cell has next properties: x coordinate y coordinate width height the width of cell equal it's height. every cell has got same width/height. there 9*9 cells, 1 beside another, created algorithm: cells = new cell[9][0]; for(int = 0; < 9; i++) { for(int j = 0; j < 9; j++) { cells[i][j] = new cell(i*cellwidth, j*cellheight); } } the cell's constructor asks x , y coordinates. got grid of cells. when touch screen, know x , y coordinates touched screen. cell touched should run method called istouched. how can find out cell i've touched? i've tried algorithm: public boolean istouched(int zx, int zy) { if((zx >= x && zx <= x+cellsize) && (zy >= y && zy <= y+cellsize)) { homecoming true; }else { homecoming false; } } zx , zy touched coordinates. checks whether touched x axis bigger or equ

Sync the local HTML5 Database with MongoDB -

Sync the local HTML5 Database with MongoDB - what best strategy synchronize local database server one? the thought utilize 100% html5 application, every morning, server database duplicated clients, clients work on indexeddb, untill end of day, clients send info server, , server gather them , save them again, can see, lot of work, there improve way indexeddb or mongodb offer connect each other? if logics in client, don't need mongodb. key-value store rest api , collection query last-modified enough. i had a sample sync app google cloud storage. html5 mongodb indexeddb

gtk - How to create a Gdk.Pixbuf from uint8[] -

gtk - How to create a Gdk.Pixbuf from uint8[] - i have uint8[] (that got gst.mapinfo.data ) represents image (i don't know format jpeg, png, etc) , i want gdk.pixbuf out of it. the issue the pixbuf constructor take uint8[] requires lot of other image info don't have: colorspace, size, etc. note can't utilize pixbufloader because want image created synchronously. try wrapping uint8[] in glib.memoryinputstream , using new pixbuf.from_stream() . gtk vala gdk

What is an SSL certificate chain file? -

What is an SSL certificate chain file? - edit : may have been preferable inquire on server fault, reputation wouldn't allow me post more 2 links. :( i want pages require passwords on website secure, followed this create custom ssl certificate. followed this, because explains how generate self-signed multidomain certificates (the subjectaltname allows me valid certificate example.com , *.example.com, didn't find way this). had mix commands wanted, , think ok did (though i'll detail later in case). have configure apache hear queries on port 443 , provide ssl security on according pages. found this. when defining virtualhost listening on port 443, says : <virtualhost 127.0.0.1:443> sslengine on sslcertificatefile /etc/apache2/ssl/something.crt sslcertificatekeyfile /etc/apache2/ssl/something.key sslcertificatechainfile /etc/apache2/ssl/gd_bundle.crt ... </virtualhost> i think know files need specify sslcertificatefile , sslce

fork - Forking and exiting from child in python -

fork - Forking and exiting from child in python - i'm trying fork process, in kid , exit (see code below). exit first tried sys.exit turned out problem because intermediate function caught systemexit exception (as in code below) , kid didn't terminate. figured out should utilize os._exit instead. kid terminates, still see defunct processes lying around (when ps -ef ). there way avoid these? import os, sys def fctn(): if os.fork() != 0: homecoming 0 # sys.exit(0) os._exit(0) while true: str = raw_input() try: print(fctn()) except systemexit: print('caught systemexit.') edit: not python question more of unix question (so guess results may vary depending on system). ivan's reply suggests should like def handlesigchld(sig, frame): os.wait() signal.signal(signal.sigchld, handlesigchld) while me simple signal.signal(signal.sigchld, signal.sig_ign) also works. and it's true should util

multithreading - Getting LazyInitializationException "could not initialize proxy - no Session" when running a transaction in a background thread -

multithreading - Getting LazyInitializationException "could not initialize proxy - no Session" when running a transaction in a background thread - i have unusual problem: say have 2 entity classes, e.g. container , containedobject . container has @onetomany relationship containedobject . when getting contained objects directly, works fine, when running background thread, "could not initialize proxy - no session". example: @component public class { @autowired private containerrepository _repo; public void doinforeground() { container container = _repo.findone(42l); // suppose 42 exists container.getcontainedobjects().size(); // succeeds } public void submittobackground() { completablefuture<void> f = completablefuture.supplyasync(() -> doinbackground()); } private void doinbackground() { container container = _repo.findone(42l); container.getcontainedobjects().size(); /

php - Query not inserting, but not giving error either -

php - Query not inserting, but not giving error either - i got query , it's not inserting database it's not giving error either. seek { $sth = $db->dbh->prepare("insert users (username,password,email,phone,first_name) values (:username,:password,:email,:phone,:firstname)"); $sth->execute(array(':username' => $username,':password' => $password, ':email' => $email,':phone' => $phone,':firstname'=>$firstname)); } catch(exception $e) { echo $e->getmessage(); exit(); } i've tried inserting query command , works fine. there other insert queries on site , work fine too.. i'm not sure i'm doing wrong here can seek this? try { // prepare statement if (!($stmt = $mysqli->prepare("insert users (username,password,email,phone,first_name) values (?,?,?,?,?)"))) throw new exception("prepare failed: (&

jquery - How to make backtab skip inputs -

jquery - How to make backtab skip inputs - typically when tab go lastly input. if wanted skip input had specific class on it? i have working forwards not backwards. code using effort tab backward: http://jsfiddle.net/cjonp23e/ here code go forward: else if (e.keycode == 9) //tab { jquerytarget.next().focus(); homecoming true; } how can tab backwards in same way? no need jquery . add: tabindex="-1" each button , ignored see fiddle: http://jsfiddle.net/cjonp23e/38/ jquery html tabs backwards

deployment - How to deploy my Symfony2 project into ftp -

deployment - How to deploy my Symfony2 project into ftp - i searched , tried couple of tutorials on net none of them worked me well. tutorials followed symfony2 documentation, dator, hpatoio , capifony. can explain me how can export project server. e.g. www.domain.com/about. helpful me. i have bundle , within bundles controller , twig templates etc set. if have questions please ask. thanks in advance. first off should noted deploying symfony2 app on ftp really bad. makes couple of steps more hard (or impossible) , should avoided. if have ssh access machine @ list of alternative deployment methods below. preparation there few things cannot influence when deploy on ftp. if have no command on next or can not configure them correctly unfortunately have no chance of deploying shared hosting. the php configuration. if settings not set correctly , have no chance of changing them unfortunately lost. any php module may require. same above. if can not install addit

android - Is there any tool in Ruboto like ProMotion in RubyMotion? -

android - Is there any tool in Ruboto like ProMotion in RubyMotion? - i know there many tools/frameworks in rubymotion, such as: bubblewrap, afmotion. (refer to: http://siwei.me/blog/posts/rubymotion-2-must-have-libraries-for-rubymotion-part2 ) , when googled around similar tools in ruboto (ruby on android) didn't see result. could give me clue? lot. there few (none?) ruboto-specific libraries know of, can utilize android tools , libraries in add-on java tools , libraries not target java 7/8 or jni, , can utilize pure ruby gems, , gems targeting jruby. ruboto bundled ruboto/widget dsl creating ui layouts. android rubymotion ruboto rubymotion-promotion

append - Python - Opening a Text File and Appending Lines via raw_input -

append - Python - Opening a Text File and Appending Lines via raw_input - i'm trying add together on code can append lines text file via user input. have far: from sys import argv os.path import exists print "let's read , write file now!" raw_input ("press come in when ready proceed...") script, from_file, to_file = argv print "let's re-create 1 file , set file!" print "i'm going re-create %s %s!" % (from_file, to_file) in_file = open(from_file) indata = in_file.read() print "the input file picked %d bytes long, cool huh?" % len(indata) print "does output file trying create exist? %r" % exists(to_file) print "ready, nail homecoming continue, ctrl-c or command+c abort." raw_input("press come in when ready proceed...") print "are sure want continue?... blow world up. ctrl-c or command+c abort." raw_input("press come in when ready proceed...") print

sql - How to use null in join condition in linq -

sql - How to use null in join condition in linq - i having problem in translating sql statement linq query. have not found way how utilize null in bring together status or. here sample sql statement: select a.* tablea bring together tableb b on (a.id = b.id) or a.id null what equivalent linq statement? looking bring together status same 1 in above sql statement. from in tablea bring together b in tableb on ??? equals ??? select a; i have searched existing post apparently couldn't find 1 on specific issue. thanks. join s pretty picky, can utilize them specific things. however, it's easy same result nested from statements: from in tablea b in tableb a.id == b.id or a.id == null select a; also, depending on info you're trying find, may more appropriate query: from in tablea a.id == null || tableb.any(b => b.id == a.id) select a; sql .net linq

python - Programming with connected hardware -

python - Programming with connected hardware - i think demonstrated example, question general one. using library pyvisa, interfaces gpib devices program. have set python class each instrument, powerfulness supply, might have this: import visa class powersupply: def __init__(self): rm = visa.resourcemanager() self.ps = rm.open_resource('gpib0::12::instr') def getvoltage(self): homecoming self.ps.ask('volt?') def setvoltage(self,v): self.ps.write('volt '+str(v)) ... ps = powersupply() ps.setvoltage(10) unfortunately, there chance rm.open_resource function may not work, or might homecoming none if device not exist @ address (in code wrote function did instead). question is: best practice coding class powersupply ? 1 write exceptions every method test if self.ps exists/is not none , seems there must improve way. there?! one write exceptions every method test if self.ps exists/is not

dns - Linux: getting detailed stats for a single HTTP request? -

dns - Linux: getting detailed stats for a single HTTP request? - i'm writing script determine performance of service client's point of view. to effect, need able determine few stats each http request like: dns lookup time tcp connect time tcp transmission time i'd need millisecond resolution values. what command(s) or perl/python/php libraries give me such information? check out -w alternative of curl(1) . allows things following: curl -s -o /dev/null -w "dns lookup: %{time_namelookup}\ntcp connect: %{time_connect}\ntotal: %{time_total}\n" http://www.serverfault.com dns lookup: 0.004 tcp connect: 0.104 total: 0.206 this means dns looked in 4 ms, before 100 ms later tcp connection ready , 102 ms later info transmitted. linux dns performance http command-line

list - How to get sum of all elements in json using Scala? -

list - How to get sum of all elements in json using Scala? - i have next json- "disks" : [ { "name" : "v2.16", "diskaggregate" : "aggr0", "diskrpm" : 15000, "totalsizebytes" : 1077477376, "vendorid" : "netapp ", "usedbytes" : 1070071808, "disktype" : "fcal", "uuid" : "4e455441:50502020:56442d31:3030304d:422d465a:2d353230:32353836:30303030:00000000:00000000", "portname" : "fc:a ", "raidgroup" : "rg0" }, { "name" : "v4.16", "diskaggregate" : "aggr0", "diskrpm" : 15000, "totalsizebytes" : 1077477376, "vendorid" : "netapp ", "usedbytes" : 1070071808, "disktype" : "fcal", "uuid" : "4e455441:50502020:56442d31:

php - User Level Access in yii can't run well -

php - User Level Access in yii can't run well - i newbie in yii, making website yii framework. first time in making user level access. i've created file ewebuser.php in protected/controllers/, code ` protected function loaduser(){ if ($this->_model === null){ $this->_model= user::model()->findbypk($this->id); } homecoming $this->_model; } function getlevel(){ $user = $this->loaduser(); if ($user) homecoming $user->status; homecoming ''; } } then i've created function namely accessrules in admincontroller. code public function accessrules() { homecoming array( array('allow', 'actions'=>array('index','delete','btnconf'), 'expression'=>'$user->getlevel()="supadmin"' ) ); } ` when type http://localhost/coretankuyii/index.php/admin/inde

Azure Storage: Is there way to retrieve permission info from an SAS Url? -

Azure Storage: Is there way to retrieve permission info from an SAS Url? - in func, sas token input. , need decide if delete permission granted token. i tried parse way: var permission = containersasurl.split('&').where(param => param.startswith("sp=")).toarray(); if (!permission[0].contains('d')) { throw new storageexception(string.format("unable delete files {0}, check storage permissions.", containersasurl)); } but failed url has permission info embedded in access policies. like: https://xxx.blob.core.windows.net/test?sr=c&sv=2014-02-14&si=downloadtoolpolicy&sig=nmczy2dn9uktwiap2qixqlsnzteyod%2faffgawdlfv7g%3d any other route can work on? unfortunately no, @ to the lowest degree checking if delete permission included in sas. @ first thought seek deleting non-existent blob , grab exception , if sas token not have permission 403 error got 404 error in both scenarios i.e. when blob exists , not ex

c# - Excel don't created on local server HRESULT 0x800A03EC -

c# - Excel don't created on local server HRESULT 0x800A03EC - i made programme copies gridview excel. worked on localhost. published on local network still opens pages etc. gets stuck on defining workbook microsoft.office.interop.excel.workbook wbook = excel.workbooks.add(system.reflection.missing.value); and gives system.runtime.interopservices.comexception (0x800a03ec) error. i tried different solutions found net (creating desktop folder in systemprofile system.runtime.interopservices.comexception (0x800a03ec), through administrator windows 7 .net excel .saveas() error exception hresult: 0x800a03ec) didn't solve problem. c# asp.net excel hresult

Will Javascript create space for unasssigned array indices? -

Will Javascript create space for unasssigned array indices? - i have code similar this: var somearray = new array(); somearray[0] = "stuff"; somearray[1] = "things"; somearray[10] = "more stuff"; somearray[20] = "other things"; somearray[100] = "far away stuff"; and on. if this, there memory allocated indices 1-9, 11-19, , 21-99? amount important plenty worry if array added info @ 10,000, or other high number? i know can like somearray["abc"] = "foo"; and treats property on object named somearray, used like somearray.abc = "foo"; so case same? edit: apparently reply bit terse/fuzzy some. as stated, memory allocation behavior in illustration unspecified. is, the ecmascript specification doesn't tell engines how much memory (not) allocate unassigned array slots. what really happens under hood, then, varies lot engine. example, given engine may take pre-allocat

can someone explain this behavior of StringBuffer? -

can someone explain this behavior of StringBuffer? - public class strbuffer { public static void main(string[] args) { stringbuffer sb = new stringbuffer(); //5 sb.append("hello"); //6 foo(sb); //7 system.out.println(sb); //8 } private static void foo(stringbuffer sb) { // todo auto-generated method stub sb.append("wow"); //1 sb = new stringbuffer(); //2 sb.append("foo"); //3 system.out.println(sb); //4 } } in above when print in line8. output "hellowow" .... can 1 explain please? sb.append("wow"); //1 you mutated stringbuffer instance passed in. sb = new stringbuffer(); //2 you assigned local parameter point new stringbuffer instance. has no effect on caller or on old instance. stringbuffer

ant - Publishing to Artifactory using Jenkins -

ant - Publishing to Artifactory using Jenkins - i trying utilize generic jenkins-artifactory plugin deploy contents of jenkins build workspace artifactory. seems fine using next wildcards web\*.msi=>testing\web web\deploymentsettings\*.xml=>testing\web\deploymentsettings database\scripts\**=>testing\database however, when comes moving contents of 'database\scripts' jenkins workspace, empty folders under 'database\scripts' not copied artifactory. non-empty folders copied successfully. of import maintain directory integrity/structure it's must re-create these across. i have considered placing empty text files in empty directories have them re-create on don't want "pollute" package. please help :-) thanks! looks there no workaround -other dummy files in directories. see bugs in jenkins releated handling empty directories. jenkins-7260 clone workspace doesn't re-create empty directories when cloning entire workspa

Android animation linearlayout -

Android animation linearlayout - i have got linearlayout form. form has got 2 fields. effect: two fields, 1 hidden (under top bar). when click button 'ok' linear layout go downwards , display next field (hidden field). how effect? place 2 fields within relativelayout . set property android:visibility="gone" first of them. set property android:layout_below="@id/yourfirstfield" second. add onclicklistener button and, in body on listener in java class, alter visibility of first field visible (i guess it's edittext, edittext.visible ) if want nice effect hiding/showing elements, add together android:animatelayoutchanges="true" relativelayout (the container of both items). this should work!! hope helps!! android animation android-linearlayout objectanimator

python - How to convert normal numbers into arabic numbers in django -

python - How to convert normal numbers into arabic numbers in django - i have list of numbers [1,2,3,....] now want convert them standard arabic numbers using django. is possible? ideas welcome. try function: def entoarnumb(number): dic = { 0:'۰', 1:'١', 2:'٢', 3:'۳', 4:'۴', 5:'۵', 6:'۶', 7:'۷', 8:'۸', 9:'۹', .:'۰', } homecoming dic.get(number) and utilize this: ar_numbers = [entoarnumb(num) num in numbers] python django

xsd - Why does the W3C XML Schema specification allow integers to have leading zeros? -

xsd - Why does the W3C XML Schema specification allow integers to have leading zeros? - recently had illustration in xml message integer fields contained leading zeros. unfortunately these zeros had relevance. 1 argue why in schema definition integer chosen. not question. little surprised leading zeros allowed @ all. looked specs of course of study told me supertype decimal. expected specification don't tell why curtain choices made. question rationale allowing leading zeros @ all? mean numbers don't have leading zeros. on side note guess way add together restriction on leading zeros pattern. my recollection xml schema working grouping allowed leading zeroes in xsd decimals because allowed in normal decimal notation: 1, 01, 001, 0001, etc. denote same number in normal numerical notation. (but don't remember discussed @ length, perhaps reason believing right thing , other wg members had other reasons beingness satisfied it.) you right suggest root of

sql server - Shifting position of sql query results -

sql server - Shifting position of sql query results - i know question seems bit confusing. have query homecoming next result : is there way shift results can have : null values replaced values below ? room service midi has null value, rest shifted. there way replace that. my query : select pc.code, pc.description, case when g.description 'nourriture' , pc.description 'petit dejeuner' coalesce(sum(ta.price),0) when g.description 'nourriture' , pc.description 'banquet' coalesce(sum(ta.price),0) when g.description 'nourriture' , pc.description 'casablanca cafe midi' coalesce(sum(ta.price),0) when g.description 'nourriture' , pc.description 'casablanca cafe matin' coalesce(sum(ta.price),0) when g.description 'nourriture' , pc.description 'casablanca cafe soir' c