Posts

Showing posts from February, 2010

node.js - Using port 80 with Node on Digital Ocean Error: listen EADDRINUSE -

i trying run simplest of node servers on digital ocean server. developed , tested code using port 8080 without problems. however, want use port 80 not need specify port when navigating ip address of server (so default). when change port 80 , run app sudo error: listen eaddrinuse when not have other applications running on server (at all). there way clear port 80 use? i checked here how fix error: listen eaddrinuse while using nodejs? none of suggestions worked. program on server. there no other processes in code listening on port. there no app running on server @ not understand how port in use. help edit. here running netstat returns: active internet connections (w/o servers) proto recv-q send-q local address foreign address state tcp 0 0 192.241.228.76:ssh mobile-166-137-17:62351 established tcp 0 0 192.241.228.76:ssh 199-241-200-214.p:41732 established tcp 0 0 192.241.228.76:9090 199-24

java - LibGDX: Can't seem to draw the objects in an array -

enemy class public class enemy extends sprite{ private vector2 velocity = new vector2(0,0); private float speed = 30, gravity = 30 * 1.8f; public enemy(sprite sprite){ super(sprite); } public void draw(spritebatch spritebatch){ update(gdx.graphics.getdeltatime()); super.draw(spritebatch); } public void update(float delta) { velocity.y -= gravity * delta; sety(velocity.y + speed * delta); } } playscreen class public class playscreen implements screen { private player player; private orthographiccamera camera; private orthogonaltiledmaprenderer renderer; private tiledmap map; private rectangle rightrectangle, leftrectangle, playerrectangle; @override public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); renderer.render(); renderer.getspritebatch().begin(); player.draw(renderer.getspritebatch()); boolean wallleft = leftre

javascript - 'Audio' was used before it was defined -

Image
i have javascript file i'm checking jslint (notepad++ plugin v0.8.2). have following options set: /*jslint indent: 4, maxerr: 9999, white: true, browser: true, devel: true, es5: true, plusplus: true, regexp: true, sloppy: true */ jslint complaining on line: new audio('sounds/ding.wav').play(); ' audio ' used before defined seems doesn't es5? how can make error go away? you should able list audio " predefined " in plugin's options or, mentioned, as global within file that's using it: /*global audio: false */ including false here describes read-only. the error because jslint doesn't acknowledge it possible global browsers: // browser contains set of global names commonly provided // web browser environment. browser = array_to_object([ 'clearinterval', 'cleartimeout', 'document', 'event', 'formdata', 'frames', 'history&

php - How can I display search results on the same page as the search form element? -

i have element contains form: <?php echo $this->form->create('prototypeitem', array( 'url' => array('instance' => $instance['prototypeinstance']['slug']) , 'class' => 'simple-search' , 'action' => '/search' )); echo $this->form->input('search', array( 'label' => 'search', 'type' => 'text' )); echo $this->form->end('search'); ?> <!-- code displaying search results here --> previously, element called on page located @ site.com/realtor-documents/search, , worked fine. however, designer has asked me move search form site.com/realtor-documents, eliminate click. form @ /realtor-documents now, when submit it, still redirects /realtor-documents/search. i'd results appear on same page form, /realtor-documents. how can that? this because of 'action' => '/search' , r

Bash- Extract every smaller path out of a full path -

i'm trying take full path directory , extract every path out of it. example fullpath="/home/me/something/file" /home/me/something/file /home/me/something /home/me /home my attempt haven't been able figure out how bring paths out. ifs=$'/' in $restorepath echo $i if [ -d $i ]; echo dir exists fi done unset ifs couple of issues: you're testing directory, looks you're providing file there no reason unset ifs since change won't propagated parent shell. if want re-set default 1 use later in script, can save old 1 in variable , reset after, or change common ifs=$'\t\n ' try this #!/bin/bash fullpath="/home/me/something/file" ifs='/' in $fullpath; subpath+="$i/" if [[ -e $subpath ]]; echo "$subpath" elif [[ -e

mongodb - Meteor Publish Distinct Values of Field in Collection -

i'm stuck on pretty simple scenario in meteor: i have huge collection of things many fields, of them containing quite bit of text. i want create page searching collection. one of fields each item in collection has "category". i'd give user ability filter category. for that, need publish distinct values of category field in collection. i can't figure out way without publishing whole collection takes way long. how can publish distinct categories , use them fill dropdown? bonus question , related: how publish count of items in collection without publishing whole collection? a starting point make easier normalize categories separate database collection. however assuming not possible or practical, best (though imperfect) solution publish 2 separate versions of collection, 1 returns categories field of entire collection , returns fields of collection selected category only. following: // server meteor.startup(function(){ meteor.publish(

python - How to write on new string uses byte 'wb' mode? -

i'm working in 'wb' mode array of bytes for in range(len(mas)): message.write(mas[i]) after have write data file on new line, example '\n' in 'w' mode for in range(3): message.write(str(i)) message.write("\n") >>>0 >>>1 >>>2 >>>3 how can this? to write string binary file you, "\n" wb mode, must first encode calling string.encode('utf-8') or other encoding need. for example, write message binary file: with open("a.txt", "wb") f: line = str(0) + "\n\n" f.write(line.encode('utf-8')) this write 0\n\n . write numbers 0 3, followed blank lines: with open("a.txt", "wb") f: in range(4): line = str(i) + "\n\n" f.write(line.encode('utf-8')) encoded newlines printed newlines correctly, following lines equivalent: open('a.txt', 'w').writ

c# - EF Code First 6.1 Change ID from Int to Long -

i'm working on application using asp.net mvc 4, c# , entity framework code first. there 1 model (table) growing rather large , i'm worried identity column run out of values (int32.maxvalue) in next year or so. i'm looking way change identity int long. in past when tried this, ef wouldn't let me unless if dropped table , recreated it. not option since site live , there live data in table. is there way this? far web searches , stackoverflow searches have not given me hints on how this. requires code-first migrations: 1) update model 2) create migration 3) write custom sql in generated migration drop pk , every fk references it. can quite messy have figure out names. put above altercolumn. 4) write custom sql re-add pk , fks , put under altercolumn. 5) reverse in down script. fyi, isn't possible azure sql. in case must create new table.

How to run and repeat functions in same time in jQuery -

i use 2 functions. first 1 going load files folder 'img', other 1 going display them. basicyly first 1 must repeat every 30s load new images if appear. other going show images time... problem begun when displayimages function want show them not exist yet in #listing div... $(document).ready( function() { setinterval(loadimages(),30000); settimeout(displayimages(),2000); }); function loadimages() { $.ajax({ url: "./img", success: function(data) { $('#listing').html(''); $(data).find("a:contains(.jpg)").each(function(){ // loop through var images = $(this).attr("href"); $('#listing').append('<img src="img/'+images+'">'); }); } }); } function displayimages() { $('#listi

python - Attempting to transpose a matrix using python3 -

i know missing pieces produce matrix cannot seem find mistakes start. i have 3 tasks. 1) show empty matrix like. 2) show original matrix(4x3). 3) transpose matrix 3x4. import sys scanner import * def creatematrix(size): if size == 0: return [] else: return [0] + creatematrix(size -1) def printgrid(gridlist): row in gridlist: print (str(row)+"\n") def nrows(g): return len(g) def ncols(g): return len(g[0]) def printmatrix(g): in range(0,nrows,1): j in range(0,ncols,1): print("the original matrix is:",g[i][j]) print('') print('') def printmatrixtranspose(g): j in range(0,ncols,1): in range(0,nrows,1): print("the transposed matrix is:",g[i][j]) print('') print('') def readinput(filename,grid): s = scanner(filename) r = s.readtoken() while r != "": r = int(r) c = s.r

ruby on rails - Getting data out of MatchData got as a result from match function -

i have array of custom objects in it. objects have parameter called name concatenation of 2 strings having delimiter in between. eg: name some@data 'some' first string , 'data' , @ delimiter. my intention update name parameter objects inside array such param have 'data' (i.e. remove 'some@') , store objects inside array after updating. below code: final_array = array1.select |object| object.name = object.name.match(/@(.*?)$/) end when print object.name.match(/@(.*?)$/) gives me output as: #<matchdata "@data" 1:"data"> out of output, how "data" matchdata. tried object.name.match(/@(.*?)$/)[1] didn't work. or need change regex? i use #each , #gsub methods: array.each |object| object.name = object.name.gsub(/^.+@/, '') end

mysql - list out most matching ids first, others later -

currently developing "different" style of search. have following table id keywords 1 apple orange mango grapes watermelon 2 apple mango 3 orange 4 orange grapes apple 5 grapes 6 grapes mango apple 7 watermelon apple orange and search field text-box ore or more fruit names can mentioned, example apple grapes i need results in following manner: first search first fruit (apple) in above table, matching ids be 1, 2, 4, 6, 7 then search second fruit (grapes) in above table, matching ids be 1, 4, 5, 6 as can see above, apple , grapes appeared @ following ids 1, 4, 6 i need query shell give me matching ids first, other later 1, 4, 6, 2, 7, 5 if doing parsing in php each word, can try: select k.* table k order (find_in_set($keyword1, replace(keywords, ' ', ',')) > 0 + find_in_set($keyword2, replace(keywords, ' ', ',')) > 0 + find_in_set($keyword3,

osx - Ruby-1.9.3 failing on make OS X 10.10 Beta -

i trying use hombrew install metasploit-framework on macbook pro (running os x 10.10 beta) can pen-test server. however, metasploit has lot of trouble working ruby 2 , later (i have spent hours trying see if fix metasploit work ruby 2) figured need install ruby 1.9.3. thus, opened terminal , ran: rvm install ruby-1.9.3 this output of above command. please ignore /-\| characters because rvm's spinning animation appears in console when installing. error running './configure --prefix=/users/ericmarkmartin/.rvm/rubies/ruby-1.9.3-p547 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --without-tcl --without-tk --disable-install-doc --enable-shared', showing last 15 lines of /users/ericmarkmartin/.rvm/log/1403754271_ruby-1.9.3-p547/configure.log [2014-06-25 23:44:47] ./configure current path: /users/ericmarkmartin/.rvm/src/ruby-1.9.3-p547 gem_home=/users/ericmarkmartin/.rvm/gems/ruby-2.1.2 path=/users/ericmarkmar

php - MYSQL: select multiple records from other table for each row -

i have 3 tables - users, items, , relations (each user have more 1 item): users: user_id | user_name 1 | alex 2 | john 3 | louis items: item_id | item_name 1 | item 1 2 | item 2 3 | item 3 relations: item_id | user_id 1 | 1 2 | 1 1 | 2 3 | 2 2 | 3 3 | 3 3 | 1 etc.. so need query can users (that's easy) items each user (it's more crazy). so result need this: [1] => ( 'name' => alex, 'items' => ( [1] => ( 'name' => 'item 1' ) [2] => ( 'name' => 'item 2' ) ) ) [2] => ( 'name' => john, 'items' => ( [1] => ( 'name' => 'item 1' ) [2] => ( 'name' => 'item 3' ) ) ) i've been playing join couple of hours still can't it. thank help!

primefaces fileupload doesn't work in ie8 -

the problem occurs in ie8, after click upload button hangs , progress bar doesn't go away, works fine in firefox. i'm using primefaces 4.0 , jsf 2.0 <p:fileupload id="getcompelementcomponentid" label="browse" fileuploadlistener="#{applicationaction.addupload}" mode="advanced" dragdropsupport="false" multiple="true" sizelimit="52489260" filelimit="30" allowtypes="/(\.|\/)(jpg|doc|docx|txt|xls|xlsx|pdf|gif|rtf)$/"> </p:fileupload> thanks, appreciated th

c++ - SDL, How can I make the background picture render? -

i had render problem, fixed that. problem is, picture won't show up. know picture gets loaded because have error handler if isn't loaded. know code messy, need picture show up. #include <sdl/sdl.h> #include <stdio.h> #include <iostream> #include <fstream> #include <string> using namespace std; const int fps = 60; sdl_window *window; int main(int argc, char **argv) { sdl_init(sdl_init_everything); window = sdl_createwindow("", 300, 100, 1024, 800, sdl_window_opengl); if (window == null) { cout << ("could not create window: %s/n", sdl_geterror()); return 1; } sdl_renderer *renderer = sdl_createrenderer(window, -1, 0); int x = 0, y = 0; sdl_surface *screen; sdl_surface *background = sdl_loadbmp("hockeyrink.bmp"); if(background == null) { sdl_showsimplemessagebox(0, "background init error", sdl_geterror(), window); }

python - Because I have data in the output of standard error with some git commands? -

if ret 0, because have data on standard error output (stderr)? #!/usr/bin/env python subprocess import call f = open('/tmp/err.log','wb') ret = call[(['git', 'checkout', 'master'], stderr=f) if ret == 0: print 'success!' this occurs in git commands. in example in master branch. i having trouble grasping question think asking "if return code of 0 why have data in stderror" edit question not sure. the answer think question is: stderror not mean there error in command. for example, fetching --progress flag git send output stderror https://www.kernel.org/pub/software/scm/git/docs/git-fetch.html

java - Is it better to use Android's built-in frame-by-frame animation methods or create your own? -

i have downloaded several example android games, , of them not use android's animation methods. have seen several posts on site , other sites prefer not use android's animation methods, never explain why . so, better not use android's animations games? i not recommend using android's animation classes games. reason operate on views not lightweight enough high performance games require. views designed buttons, text, , images stay still, positioned in organized layouts , , not images move on place. 2 best approaches making games android are: using canvas class. note work simple 2-d sprite-based games, tends quite slow. it's relatively easy beginners learn. using opengl es . works pretty game - it's fast , can both 2-d , 3-d games. be warned, complicated , not recommend beginners use opengl es! if new programming games, recommend buying book on topic such mario zechner's excellent book "beginning android games" (look on amazon)

javascript - buffer animation google maps not showing -

i make buffer animation in google maps. when run in web no working. use javascript , php make . this php code: <html> <head> <title>google map</title> <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=aizasyd21hditqz1rba2uu8z9i922vpfp5dgdze&sensor=false"></script> <script type="text/javascript"> $(document).ready(function() { var map; var mycity = new google.maps.latlng(51.5120, -0.12); var bigone = new google.maps.latlng(51.5120, -0.12); var smallone = new google.maps.latlng(51.5120, -0.12); var options = { zoom: 14, center: mycity, scalecontrol: true, maptypeid: g

Listing items from one controller in another controller's template in Ember.js -

i'm making cocktail recipe app in ember, , i'd display list of existing ingredients inside template creating new recipe. here routes: app.router.map(function() { this.route('drinks', {path: '/drinks'}); this.route('drink', {path: '/drinks/:drink_id'}); this.route('newdrink', {path: '/drinks/newdrink'}); this.route('ingredients', {path: '/ingredients'}); this.route('ingredient', {path: '/ingredients/:ingredient_id'}); this.route('newingredient', {path: '/ingredients/new'}); }); here's template making new drink: <script type="text/x-handlebars" id="newdrink"> <h3>create new drink.</h3> <p>{{input type="text" classnames="form-control" placeholder="enter new drink." value=newdrinkname action="createdrink"}}</p> <p>{{input type="text" classnames=&qu

Reason to have Android 4.0, 4.0.1, 4.0.2 all same API level? -

i confused 1 simple thing why google naming android (4.0, 4.0.1, 4.0.2) platform version under same sdk level (14). mean mentioned platform version don't have additional os level functionality or may have os level different functionality, google did not exposed user. what , how should take these platform , sdk level nomenclature? please 1 explain. although not programming issue. if question not suitable here, please move concerned group. thanks, they minor updates , not full fledged api releases. numbers indicate os version. know version , api level version history in wikipedia.

plsql - Oracle Bind Variables, Procedures and a headache -

i wondering if can point me in right direction. have spent last little while trying work out how use bind variables in block code declares. issues every time try run code block in sql developer, returning error "bind variable "disp" not declared. in non-block piece of code can results expecting. following know works , results for: var disp varchar2(200); begin test_procedure('test', 100, :disp); end; / print :disp the above code returns me value, test100. however, if try move block of code, use single line in external application (java or php) start running trouble. have far is: declare disp varchar2(200); begin test_procedure('test', 100, :disp); end; / print :disp when run above getting: bind variable "disp" not declared i have tried few different approaches using var inside declare box trying reference procedures variable definitions, none working me you don't prefix local variable name colon.

json - Removing title from select query in PHP -

is there way select table in sqlite without printing column headers? the following code using: select realpow, timestamp powerdata; //to loop through table , fetch data real power while($res = $results->fetcharray(sqlite3_assoc)){ $equal[] = $res; } echo json_encode($mearray,json_numeric_check); result: [{"realpow":50,"timestamp":1391990400},{"realpow":200,"timestamp":1392422400}, {"realpow":100,"timestamp":1394409600},{"realpow":150,"timestamp":1395273600}, {"realpow":140,"timestamp":1397952000},{"realpow":130,"timestamp":1398384000}, {"realpow":120,"timestamp":1400544000},{"realpow":90,"timestamp":1402358400}, {"realpow":100,"timestamp":1402790400}] i want remove "realpow:" & "timestamp:". here code modified: select realpow, timestamp powerdata;

How to store HTML form data in xml using javascript/Jquery? -

i have 1 registration page in app, if registration happen means need save username , password in xml file. on each registration registerinfo.xml updated <person></person> .how can that, let's xml follows, registerinfo.xml: <?xml version="1.0" encoding="utf-8"?> <registerinfo> <person usrname="vinod" pswd="chawla" ></person> <!-- if registration happen need create on person tag iwth username , password attribute--> </registerinfo> html: <!doctype html> <html> <head></head> <body> username: <input name="" id="username" value="" type="text" data-mini="true"><br> password: <input name="" id="password" value="" type="password" data-mini="true"><br> <input id="btndefaultsms" type="submit" value="regis

visual studio 2010 - Dynamic file paths in Talend job -

i using talend open studio v5.4 data integration. here brief description of job created in talend: i have created job name refresh_bfo_tabl e connects salesforce.com , fetches data account , opportunity tables , data populates local database named ofotaccdb . in local database there 2 tables bfo_account , bfo_opportunity gets populated data retrieved salesforce. now, connecting salesforce have used oauth2.0 authentication. have provided consumersecret, consumerkey, redirect uri in talend tsalesforcecomponent configuaration , jobs running talend. as of v5.4, talend open studio supports oauth2.0 component tsalesforceconnection. in configuration of oauth2.0, talend asks following credentials: salesforce webservice url= https://test.salesforce.com/services/oauth2 consumer key= 3mvg98rqvesxrgq6mxmniwk2uxkxenoakb4df._jbihtl5pidt3ue17yzu_oewyx3wv.7ylxli5nsnl55_y06 consumer secret=5550378321918973123 callback host=localhost callback port=8443 token file=e:/ofot_works

missing folder in repository after git add -

i'm using folder containing software development kit (sdk), , tried git folder in laptop use git remote. used git add * . seemed worked well, received no error or warning. cloned remote folder, , tried compile, got error saying files missing. turned out folder missing in git. any idea did wrong ? cd /home/ubuntu/backup mkdir yamit cd yamit git init git add * git commit -m "first backup" git remote add yamit /home/ubuntu/backup/yamit.git git push -u yamit master whenever have missing resource after git add, can check if part of .gitignore git check-ignore (git 1.8.4+): git check-ignore -v path/to/missing/ressource simply modify .gitignore removing line ignore resource need. then add , commit again. if don't want modify .gitignore file, git add -f . # or git add -f path/to/missing/* that can force ignored resources added index anyway.

socket.io - One redis channel per user? -

i trying understand socket.io code uses gevent , redis pub/sub. apparently subscribe method waits message on channel. can have (tens of) thousands of channels, 1 channel each pushing notifications , chats 1 user? channels meant that? def _sub_listener(socketio, chan): """ method block , listen new messages published redis, since using coroutines method can block on listen() without interrupting rest of site """ red = redis(redis_host) red.subscribe(chan) in red.listen(): socketio.send({'message': i}) i looking same thing. through searching found forums says redis can handle upto 10k channels efficiently. have not got absolute answers on happens if channel exceeds 10k. i'm trying go ahead shared channel. here sample algorithm/implementation uses shared channel.

javascript - How to focus invalid element by DOM position from the array of Elements? -

i doing validation. in validation wherever element not valid, pushing array. while user click on submit button, focus on element not it's array position. instead dom position. the issue because, server sending id front end. while send id , not form element order. any idea please? simply, sort pushed element it's dom position focus... here focus approach: this.validate = function () { $.each(this.elements, function (i,elem) { var element = $(elem); var prop = string(element.get(0).type).touppercase(); var result = that.validateone({"prop":prop,"elem":element}); }); if(that.validateresut.length) that.validateresut[0].focus(); //it focusing last element or mid time.. focus dom position } thanks in advance. live demo(example) you can try code sorting. later can append accordingly: obj.sort(positionsort); //call function passing array of elements. functi

javascript - Defining global objects using YUI Doc -

how define global variable using yui doc. can't find suitable comment tag define global object , properties. best way it. below defined object: var glob = glob || { breakpoints: { mainnavigation: 840 }, animation: { speed: { slow: 1000 } } };

Entity framework 5: Handle DataTime column -

we have created table few columns along 1 datetime column 'createon' in sql server 2008 r2 express. not want user set createdon column value. instead while insertion or updation of record, database date should picked , used fill column. please suggest solution.

html - Drawing lines in <li> tag -

i have li element looks this: | link | i want become solid line: |----link----| here link code: http://jsfiddle.net/sh9hy/ i have tried putting hr tag inside li element , making hr inline failed. problem im having need line wrap around text. im clueless on one. here's alternative . <hr/><span>link</span> li span { background-color: #fff; color: #000; } hr { border: none; color: #000; background-color: #000; height: 1px; margin-top: 9px; position: absolute; display: block; width: 100%; z-index: -1; }

pointers - Pass value pointed by non-const iterator by reference c++ -

i have std::set<mytype> container i'm getting function of class, i.e. have somethig this: typedef std::set<mytype, comparemytype> mytypeset; // singleton class class myclass { ... public: mytypeset& getmyset() { return myset_; } ... private: mytypeset myset_; ... } then in other place i'm using container: myclass obj; mytypeset& myset = mtyobj->getmyset(); mytypeset::iterator itbeg = myset.begin(); // i'm trying call f function f(*itbeg); where f function has signature below: void f(mytype& param); i'm getting compilation error this: note: candidates are: void f(mytype&) error: no matching function call f(const mytype&) how can fix this? in advance. without knowing details environment, i'm guessing system's implementation of set attempts "safe" aliasing iterator const_iterator (so don't try modify set items via iterator, dangerous because might cha

Meaning of ScopeGroupId in custom theme liferay -

when scopegroupid set in liferay 6? there way can change while adding portlets dynamically custom theme? groupid typically current site displayed , typically same scopegroupid . however, content in liferay can "subscoped" individual pages. can find in configuration screen of several portlets. thus, data not associated directly site (aka group), subscope of site. hence scopegroupid. typically theme doesn't change willingly, it's content being shown passes current scope theme.

android - Removing notificationbar for kiosk mode -

i trying build android app in kiosk-mode in android 4.2.2 (jelly bean). have achieved till make application full screen , handled home , buttons. however, problem is, want remove status/notification bar. don't want user access other settings through it. have tried out many ways including usage of different flags available in android windowmanager having screen devoid of notification bar. however, none helpful that. i have read apps surelock serve purpose. therefore, @ least know there can done, except rooting, remove notification bar. can please me on this?

css - alternative of text-justify:newspaper html -

i have paragraph, text-align:justify . due words difference between words increase much. there property text-justify:newspaper; breaks words make them relevantly spaced. not supported browser except ie. there alternative property. or best way justify them. fiddle here in case, best way keep text-align:left; applying fixed width (either in percentage or pixels) achieve looking for. for instance, element.style { text-align: left; width: 220px; } fiddle demo hope helps. ps: width: 220px; illustrative value. can change per scenario.

wpf - Login view - Login button is not disabled initially based on CanLogin value, untill we click it for the first time. -

i started looking caliburn micro 2.0.0 , started simple login page implementation. page xaml looks this <stackpanel grid.column="1" grid.row="1"> <stackpanel orientation="horizontal" margin="2"> <textblock text="login name" width="100"/> <textbox x:name="loginname" width="200" /> </stackpanel> <stackpanel orientation="horizontal" margin="2"> <textblock text="password" width="100"/> <textbox x:name="password" width="200" /> </stackpanel> <button x:name="login" content="submit" width="100" ma

Get local notification while app is forced closed in android -

in facebook android app notifications while app forced closed. works because there push notification implemented. have implemented local notification in app , want app notify if app forced closed. how can implement it. void shownotify() { charsequence details = "notification raised"; int reqcode=0; intent notificationintent = new intent(context, notifylistactivity.class); // notificationintent.putextra("clicked", "notification clicked"); notificationintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); // open 1 activity // on launch. pendingintent pintent = pendingintent.getactivity(context, reqcode, notificationintent, pendingintent.flag_update_current); notificationmanager nm = (notificationmanager) context .getsystemservice(context.notification_service); notificationc

svn+ssh:// keep tunnel open -

i using program uses svn extensively, every file checks out opens new svn+ssh session. connecting server supports svn+ssh, no other protocol. i thinking of setting ssh tunnel before using svn (svn://svn.cern.ch/....) don't want use proxy server, want create ssh tunnel using svn server itself. ssh tunnel equivalent command for: svn co svn+ssh://user@svn.cern.ch/reps/.... i think should like: ssh user@svn.cern.ch -l 3690:svn.cern.ch:3690 -fn svn co svn://localhost/reps/... any suggestions?

javascript - Failed to execute 'pushState' on 'History' error when using window.history.pushState function -

i'm using window.history in javascriptmvc application enable back/forward/refresh functionality each controller. every time load new controller i'm using window.history.pushstate add new state history. , on back/refresh i'm using saved state , reuse data build controller again. the whole idea works fine excepting 1 issue on specific scenario. i'm getting following error: failed execute 'pushstate' on 'history': object not cloned. the same data added without problem on other scenario. can cause error? assistance. https://developer.mozilla.org/en-us/docs/web/guide/api/dom/manipulating_the_browser_history "the state object can can serialized. because firefox saves state objects user's disk can restored after user restarts browser, impose size limit of 640k characters on serialized representation of state object. if pass state object serialized representation larger pushstate(), method throw exception. if need more space

xml - Java Hibernate - IllegalArgumentException -

i have these 2 classes - letadlo , letiste (plane , (home)airport). while saving data db, using java , hibernate , i'm getting exception: 16285 [thread-2] error org.hibernate.property.basicpropertyaccessor - illegalargumentexception in class: mapy.letiste, getter method of property: id org.hibernate.propertyaccessexception: illegalargumentexception occurred calling getter of mapy.letiste.id @ org.hibernate.property.basicpropertyaccessor$basicgetter.get(basicpropertyaccessor.java:198) @ org.hibernate.tuple.entity.abstractentitytuplizer.getidentifier(abstractentitytuplizer.java:227) @ org.hibernate.persister.entity.abstractentitypersister.getidentifier(abstractentitypersister.java:3876) @ org.hibernate.persister.entity.abstractentitypersister.istransient(abstractentitypersister.java:3584) @ org.hibernate.engine.foreignkeys.istransient(foreignkeys.java:203) @ org.hibernate.engine.foreignkeys$nullifier.isnullifiable(foreignkeys.java:159) @ org.hibe

2D data binning with overlapping in python -

i have data in xyz type. example: x = numpy.arange(100) y = numpy.arange(100) z = numpy.random.random_sample((100,)) i bin data, example, overlap lengths of dx = 2 , dy = 2 . did is: nx = len(x) ny = len(y) bin_data = np.zeros((nx, ny)) in range(nx): j in range(ny): a, b, c in zip(x,y,z): if (x[i] < a) , (a < x[i] + dx): if (y[j] < b) , (b < y[j] + dy): bin_data[i,j] += c for these small data program runs well. takes me time if data big. can please recommend faster algorithm bin data overlapping in python. know numpy.histogram2d quite fast, not work overlapping binning. i thing make algorythm faster moving zip outside of 2 other loops, imho longest operation : for a, b, c in zip(x,y,z): in range(nx): j in range(ny): ... then, in exemple, make use of x[i] == , y[j] == j (i add +1 because have strict < ) : for a, b, c in zip(x,y,z): in range(a - dx + 1, a):

Add whitespace to CSV number in PHP -

i have system takes excel file, manipulation , exports csv file ready import else. everything works except numbers; when csv file import final system numbers show 1e+11 example. i have previous csv file works , difference can see when open in notepad there whitespace after number e.g 123456643567 ,872871643567 ,465435654356 whereas new file doesn't have whitespace after number e.g 123456643567,872871643567,465435654356 this difference can see can presume causing problem, don't know how add white space in. if try , append whitespace end numbers surrounded speech marks , still doesn't work e.g "123456643567 ","872871643567 ","465435654356 " is there way add in or there else @ work causing issue? edit: for reference, below code have read in excel file using phpexcel: // identify type of $file $file_type = phpexcel_iofactory::identify($file); // create new reader of type has been identified $reader = phpexcel_iofactory::c

I can't use RBAC on xenserver -

i hope use role based access control function managing user on xenserver. i have server(xenserver 6.2) , ad server(windows 2008 r2). ad server installed windows 2008 r2, ad , dns. then, clicked join domain button on xencenter users tab. and, input domain, user name, password. domain qualified domain name ( e.g. aaa.bbbbbb.com) username 'administrator' (default user). but, can't success. show error. 'xenserver unable contact domain server enable external authentication. check settings correct , route server exists.' how can use rbac function? the 3 important things check: the clock of xenserver , ad server synchronised. use same ntp server both of them. xenserver , ad server both using same dns server. all necessary ports (53, 88, 123, 137, 139, 389, 445, 464, 3268) not blocked firewall also, see xenserver admin guide, in section configuring active directory authentication: http://support.citrix.com/servlet/kbservlet/download/383

How Google's Gmail app on iPhone disable notifications? -

my question can seems weird, realize when receive push new mail gmail app , open gmail on web page, notification disappear. can explain me how working ? this related this question , though it's not exact duplicate. this can implemented apple push notifications. your server has maintain each user list of device tokens of devices belonging user (iphones, ipads, etc...). when user reads message on 1 platform (whether via web browser or via mobile application), can execute api call on server notify user read message. then server can send follow-up push notification devices belonging user "badge"=0 (and without "alert" , "sound" fields), , notification cleared lock screen , app icon.