Posts

Showing posts from April, 2015

Bootstrap DatePicker with Bootstrap Modal Dialog -

i trying use bootstrap datepicker within bootstrap modal dialog box (bootstrap 3.0). date picker not displayed @ when using chrome browser displays in internet explorer when confirm or alert statement inserted indicated in code below. var getdate = function () { bootstrapdialog.show({ title: "go date", message: '<div><input id="startdate" type="text" /></div', draggable: true, closable: false, cssclass: 'login-dialog', buttons: [{ label: "return date", action: function (dialogref) { alert($("#startdate").val().tolocalestring()); dialogref.close(); } }] }); // code works on ie9, ie10 , ie11 following line confirm(); var dp = $("#startdate"); dp.datepicker({ f

linux - Formatting text in BASH -

i absolute beginner shell scripting. task make script, show functions used in file (caller , callee). have used objdump, grep, awk etc. output: 000000000040090d <usage>: 000000000040095d <failure>: 400970: e8 98 ff ff ff callq 40090d <usage> 000000000040097f <strton>: 4009bc: e8 9c ff ff ff callq 40095d <failure> 00000000004009c6 <main>: 400a0e: e8 6c ff ff ff callq 40097f <strton> 400a26: e8 32 ff ff ff callq 40095d <failure> 400a41: e8 39 ff ff ff callq 40097f <strton> 400a59: e8 ff fe ff ff callq 40095d <failure> 400a9a: e8 fe ff ff callq 40095d <failure> 400aae: e8 cc fe ff ff callq 40097f <strton> 400ac2: e8 b8 fe ff ff callq 40097f <strton> 400ad1: e8 87 fe ff ff callq 40095d <failure> 400afe: e8 fe 01 00 00 callq 400d01 <set_timeout>

javascript - Prevent Postback with custom jQuery confirm implementation on asp:LinkButton -

i have linkbutton executes on server , changes page. historically, i've had confirm message box executes onclientclick ensure user navigate away. so far looks this: asp.net : <asp:linkbutton runat="server" id="changepage" text="change page" onclientclick="confirm('are sure want change page?');" onclick="navigate" > change page </asp:linkbutton> html output : <a id="maincontent_changepage" onclick="confirm('are sure want change page?');" href="javascript:__dopostback('ctl00$maincontent$changepage','')" > change page </a> this works fine this. trouble i'm trying replace confirm boxes prettier jquery-ui implementation this: window.confirm = function (message, obj) { $('<div/>') .attr({ title: 'webpage confirm'}) .html(message) .dialog({

html - User resizable div - is it possible to drag&drop resize divs? -

i have following code: #test { height: 100px; width: 100px; padding:5px; border: 1px solid blue; } <div id="test"> lorem ipsum </div> does function exist achieves <div> ? user can edit height , width similar textarea <div> use moar jquery ui resizable plugin: include jquery (min.js, ui.js, ui.css) in website , use .resizable() function. the jquery ui resizable plugin makes selected elements resizable (meaning have draggable resize handles). can specify 1 or more handles min , max width , height. $(function() { $("#test").resizable(); }); #test { height: 100px; width: 100px; padding: 5px; border: 1px solid blue; } <script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script><link href=//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css rel=stylesheet><script src=https://code.jquery.com/ui/1.12.1/jquery-ui.js>&

javascript - Need to append text to beginning of input field. -

in following code, send text server, want username appended beginning of field. ideas on how can done? prototype solution below. function chatsend(){ console.log(input.value) input.value = name+":"+input.value; // $.ajax({ type: "post", url: "https://api.parse.com/1/classes/chats", data: json.stringify({text: $('input').val()}), success:function(message){ } }); } did not work? wrote , works fine: chatsend($('.inp')); function chatsend(input){ console.log($(input).val()) $(input).val("username" + ":" +$(input).val()); console.log($(input).val()) } fiddle demo

android - Show a pop-up dialog at the end of the game on SurfaceView -

i want pop dialog box when user completes game show points , time. read runonuithread , tried implement solution in code, not working. following error: "can't create handler inside thread has not called looper.prepare()" . i have bool variable called gamecompleted in surfaceview class, when becomes true call method showdialoggamecompleted() implemented in activity class. wrong? my activity class: public class canvastutorial extends activity { final context context = this; dialog dialog; /** called when activity first created. */ @targetapi(build.version_codes.honeycomb_mr2) @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.play_layout); } // method call surfaceview class in order show dialog public void showdialoggamecompleted() { dialog= new dialog(context); dialog.setcontentview(r.layout.custom); dialog.settitle("puzzle complet

go - Recursion, and not ending the recursion by return statement -

i doing binary search in tree , expect find recursion end when result true. have result of true if gets true value , runs return statement, seems continue run , reach value of false how make program end when finds value , returns? http://play.golang.org/p/miwqrvo_xo package main import "fmt" type tree struct { left *tree value int64 right *tree } func newt(val int64) *tree { return &tree{ left: new(tree), value: val, right: new(tree), } } func (t *tree) insert(val int64) *tree { if t == nil { return &tree{nil, val, nil} } if val < t.value { t.left = t.left.insert(val) } else { t.right = t.right.insert(val) } return t } func (t *tree) find(val int64) bool { fmt.printf("%v , %v\n", t.value, val) fmt.printf("%v\n", t.value == val) if fmt.sprintf("%v", t.value) == fmt.sprintf("%v", val) { fmt.println("true , return true") return true } if

actionscript 3 - Programatically create grid in flex -

i'm trying learn flex right , i'm having troubles. want create new grid not in xml. want create in script section. this code wrote: <?xml version="1.0" encoding="utf-8"?> <mx:canvas xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:flextras="http://www.flextras.com/mxml" width="1500" height="700"> <fx:declarations> <!-- placer ici les éléments non visuels (services et objets de valeur, par exemple). --> </fx:declarations> <fx:script> <![cdata[ import flash.sampler.newobjectsample; import mx.containers.grid; import mx.containers.griditem; import mx.containers.gridrow; import spark.components.button; import spark.components.grid

cocoa touch - iOS multiple pangestureRecognizer -

i have view baseview , add panregconizer named : basepan; add tableview on baseview, when scroll point (assume bottom) disable scroll , userinteractionenabled = no; hope basepan continue handle touch events , move tableview pan point. seems when disable scroll whole touch event cancel system. method pass touch base down view or panregconizer, i tried make view(tview) on base view , add second panregconizer on tview; when pan on it, basepan doesn't job, how transit touch event multiple regconizers, know touchbegin touchmove touchend passed next responder. nowadays , panregonizer seems easier use , recommended apple.

algorithm - Determinate the closest bounding border (graph theory and geometry) -

Image
example figure point a : { x : x a ; y : y a ; neighbors : { b, j } } point b : { x : x b ; y : y b ; neighbors : { a, c } } point c : { x : x c ; y : y c ; neighbors : { b, d, g, h } } etc. input set of verticies (points, cartesian coordinate system). some verticies connected others. there no edge's intersection on input. question how find closest bounding border given point (for example 1 of green points 1, 2, 3)? can use connected verticies. solution point 1 { a, b, c, d, e, f, g, i, j }. ( not { a, b, d } – there no edge between { b , d } , { d , }). solution point 2 { c, d, e, f, g }. solution point 3 { c, g, h }. my idea find intersection of vertical line (this line goes through question point) , edge (between 2 verticies). know 2 verticies now. how continue?? can use algorithm graph theory situation? first, there 3 corner cases in idea, must dealt with: the vertical line intersects above , below, must c

opengl - glsl multi light, best practice of passing data (array of structs?) -

working myself step step trying figure out more multi lights in glsl. read tutorials far none seems have answer this. lets have such struct lighting: struct lightinfo { vec4 lightlocation; vec3 diffuselightcolor; vec3 ambientlightcolor; vec3 specularlightcolor; vec3 spotdirection; float ambientlightintensity; float specularlightintensity; float constantattenuation; float linearattenuation; float quadraticattenuation; float spotcutoff; float spotexponent; }; uniform lightinfo glight; my first idea make uniform lightinfo glight[numlights]; but read lot passing data way shader wouldn't work, since can't location of that. have admit didn't try myself yet, found couple of pages mentioning this, it's not wrong - or maybe outdated information? the other idea make just: uniform[numofarg

oracle - Does importing Django.db.Models affect the way cx_Oracle connects to other databases? -

i have django app uses cx_oracle backend using oracle db here in our office, uses cx_oracle directly, connect other remote oracle databases (our customers). of remote databases ( same few ) cannot connected after have created sub-class of django.db.models ( found out through trial-and-error ) if don't import models, or if change django db "oracle" else, works fine , can connect of remote databases. in django model code seems affecting cx_oracle in global way. here's 1 clue have: used wireshark compare successful connection unsuccessful connection, , found unsuccessful connection attempt did include looked sort of "handshake" coming server initially, client sent lot of "alter session...nls_date_format", , many other "nls" settings, etc. after server never responds. nsl not there during successful attempts. the confusing part of "bad" databases ( few have problem ) of alter session commands during connection. &quo

.htaccess - Hacker (Multiple IP's) attacking one page (lib.php) with a variable attached, what to do? -

i have in main website root file... lib.php so hackers keeps hitting website different ip addresses, different os, different everything. page redirected our 404 error page, , 404 error page tracks visitors using standard visitor tracking analytics allow see problems may arise. below example of landing pages shown in analytics hackers, except 200 hits per hour. each link bit different using variable set page url goto. mysite.com/lib.php?id=zh%2f78jqrm3qloe53kzd2vbhtpfayhtovbijvl2nnwye%3d mysite.com/lib.php?id=wy%2ffnhab2obcah0tcsaeprmfy1ugmhgxmiwvqt2m6wk%vd mysite.com/lib.php?id=wy%2ffnhab2obcah0tcsaeprmfy1ugmhgxmiwvqjhgewk%t% mysite.com/lib.php?id=jy%2ffnhab2obcah0tcsaeprmfy1ugmhgxmiwvqt2mfgk%bd i not think need file http://www.mysite.com/lib.php should need it? when visit mysite.com/lib.php redirected custom 404 page. how can stop best? thinking using .htaccess, not sure best setup? this part of asprox botnet. http://rebsnippets.blogspot.cz/asprox key thing

uialertview - passing multiple data to database -

i have 2 buttons bring different alert views in same view pass different values on database, both work individually. problem if click on button 1 , after button 2, button 2 details don't sent over, , vis versa. don't know how fix this, ideas? code im using: -(void) addnewcomment:(nsstring*) newcomment withname:(nsstring *) routeid{ if (newcomment != nil){ nsmutablestring *poststring = [nsmutablestring stringwithstring:postcommenturl]; [poststring appendstring:[nsstring stringwithformat:@"?%@=%@", snewcomment, newcomment]]; [poststring appendstring:[nsstring stringwithformat:@"&%@=%@", srouteid, routeid]]; [poststring setstring:[poststring stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:poststring]]; [request sethttpmethod:@"post"]; postconnection = [[nsurlconnection alloc] initwithrequest:reques

python - Celery pool types and concurrency -

i having hard time putting how multi-threading concurrency works in celery. it looks default type use -p eventlet . assuming -p threads not work because of gil, , there no concurrency in practice. but looks (from example here ) can't specify -p eventlet , start firing tasks away, have initiate parallel tasks via celery.group . , according this , multiprocess worker never consume messages in parallel. so, sum up, looks have true parallelization of tasks, have use multiprocessing. can use eventlet, have modify how tasks run. tasks firing @ random in response external triggers, don't know in advance when , how many need create - doesn't can use eventlet use case. is correct? i've started experimenting using eventlet pool myself, can tell far, no, need not use group() call tasks take advantage of concurrency. think it's coincidence used example. 2 concepts play nice together, though. i'm still getting eventlet concurrency tasks applied separat

Converting string date to Java.sql.date -

this question has answer here: convert string date java.sql.date [duplicate] 2 answers please advise how can convert date getting in string form java.sql.date form.. string dateimp = abcobject.getabcdate(); java.sql.date sd = at last want convert date gettung in string form java.sql.date //this convert string date simpledateformat formatter = new simpledateformat("dd-mmm-yyyy"); string dateinstring = "7-jun-2013"; try { date date = formatter.parse(dateinstring); system.out.println(date); system.out.println(formatter.format(date)); } catch (parseexception e) { e.printstacktrace(); } /* below code snippet convert java util date sql date use in databases */ java.util.date utildate = new java.util.date(); java.sql.date sqldate = new java.sql.date(utildate.gettime());

jQuery Animation not getting stopped -

fiddle please take @ above fiddle. want make blinking led stop ( opacity 1 ) animating once click on stop! button. weirdly enough, doesn't work time. animation keeps on rolling if stop button clicked. things tried : .stop() .stop(true) .finish() .clearqueue().stop() .clearqueue().finish() any clue may wrong.? thanks! it seems work using clearqueue() , finish(), see if it's fit needs: $('#start').click( function(){ animation(); }); $('#stop').click(function() { $led = $('.led-green'); $led.animate({opacity: 1},100, function(){ $led.clearqueue(); $led.finish(); }); }); function animation(){ $('.led-green').animate({opacity: 0.5}, 500) .animate({opacity: 1}, 500, function(){ animation(); }); } you can check fiddle here

r - getAnywhere("timestamp") finds two functions from within Rstudio -

i trying call timestamp function in rstudio seem calling version other 1 want. getanywhere shows there 2 definitions: > getanywhere(timestamp) 2 differing objects matching ‘timestamp’ found in following places package:utils namespace:utils use [] view 1 of them > timestamp function(...) .rs.callas(name, hook, original, ...) <environment: 0x0000000005f42030> > timestamp() ##------ thu mar 06 15:08:51 2014 ------## > utils::timestamp function (stamp = date(), prefix = "##------ ", suffix = " ------##", quiet = false) { stamp <- paste0(prefix, stamp, suffix) .external2(c_addhistory, stamp) if (!quiet) cat(stamp, sep = "\n") invisible(stamp) } <bytecode: 0x0000000005f447a8> <environment: namespace:utils> calling ut

ios - Custom UICollectionViewLayout: Get size of a certain cell -

i'm building custom uicollectionviewlayout client based on design specifications achieve , flow want. there issue i'm running involves size of cell in i'm positioning. it is possible cells can of different sizes , layout style i'm going requires specific spacing requirements cells don't overlap each other, means during overloaded -layoutattributesforitematindexpath: in layout i'd peek items size can set , used in calculations properly. the issue i'm having appears uicollectionview depending on method set size of cells because until set attributes method use fetch size cell result in cgsizezero . is i'm going have design around? sizes cells in storyboard aren't accessible (at least methods i'm aware of) haven't been able ot solve other use specific width/height (which works 1 of 2 possible cells) test , write layout code. ultimately: how fetch size of uicollectionviewcell in uicollectionviewlayout use in calculations? . edit

entity framework update foreign key throws exception if AutoDetectChangesEnabled set false -

i have table , b : id name bid b : id type in table has data record reference b1,now want update reference b2. in unitofwork if set autodetectchangesenabled = true it's work ok, set autodetectchangesenabled = false reason want speed throw exception this: changes database committed successfully, error occurred while updating object context. objectcontext might in inconsistent state. inner exception message: referential integrity constraint violation occurred: property value(s) of 'goodskind.goods_kind_id' on 1 end of relationship not match property value(s) of 'enrolmenttype.goods_kind' on other end." how cand do? i had error well. problem me have complex type. when changed master record (let's person) wanted change complex type list contact information(s). when tried save them both in 1 screen got error. check if fill ids on screen master record , complex type records. check if posted server (if use in example mvc

python - Tornado + Momoko. Restart corrupted connection -

we're using tornado 3.2 + momoko 1.1 + pgpool. after restarting pgpool - have restart tornado. if don't restart tornado - have errors these: [e 140322 19:23:32 web:1305] uncaught exception post /api/user/balance/ (127.0.0.1) httprequest(protocol='http', host='127.0.0.1:3001', method='post', uri='/api/user/balance/', version='http/1.0', remote_ip='127.0.0.1', headers={'host': '127.0.0.1:3001', 'connection': 'close', 'content-type': 'application/x-www-form-urlencoded', 'content-length': '55', 'accept-encoding': 'gzip'}) traceback (most recent call last): file "/projects/application_new/env/lib/python2.7/site-packages/tornado/web.py", line 1192, in _stack_context_handle_exception raise_exc_info((type, value, traceback)) file "/projects/application_new/env/lib/python2.7/site-packages/tornado/web.py"

python - Apply a function to each row of a ndarray -

i have function calculate squared mahalanobis distance of vector x mean: def mahalanobis_sqdist(x, mean, sigma): ''' calculates squared mahalanobis distance of vector x distibutions' mean ''' sigma_inv = np.linalg.inv(sigma) xdiff = x - mean sqmdist = np.dot(np.dot(xdiff, sigma_inv), xdiff) return sqmdist i have numpy array has shape of (25, 4) . so, want apply function 25 rows of array without loop. so, basically, how can write vectorized form of loop: for r in d1: mahalanobis_sqdist(r[0:4], mean1, sig1) where mean1 , sig1 : >>> mean1 array([ 5.028, 3.48 , 1.46 , 0.248]) >>> sig1 = np.cov(d1[0:25, 0:4].t) >>> sig1 array([[ 0.16043333, 0.11808333, 0.02408333, 0.01943333], [ 0.11808333, 0.13583333, 0.00625 , 0.02225 ], [ 0.02408333, 0.00625 , 0.03916667, 0.00658333], [ 0.01943333, 0.02225 , 0.00658333, 0.01093333]]) i have tried following d

Python Django - How can I use different db for different apps and users? -

i have following situation: one db storing users data - let's "auth" app one common db data common users - call "common" db while registering, each user should have new db created "user" db in general there 2 apps: auth , app2. how can create new database , setup connection while registering new user?

visual c++ - Overriding CDocument OnFileSave() -

how do this? if please kindly include code message map , function itself, appreciated. edit: more wondering how onfilesave() links onsavedocument(lpcstr lpszpathname) how onfilesave lpszpathname? you don't need special override onsavedocument(...) it's virtual function in cdocument, derived class can declare virtual bool onsavedocument(lpctstr lpszpathname); in it's header, implement in document. nothing needed in message map. onsavedocument called framework part of onfilesave handler in base class id_file_save. lpszpathname refers m_strpathname when called onfilesafe, set when opening file or calling setpathname. if it's empty when saving, user prompted file name.

c# - MVC 4 Async Action isn't handling multiple requests between wait -

i trying test mvc4 async controller actions have read here: http://www.asp.net/mvc/tutorials/mvc-4/using-asynchronous-methods-in-aspnet-mvc-4 below controller: public class homecontroller : asynccontroller { // // get: /home/ public async task<actionresult> index() { writeonfile("here dude. time: " + datetime.now.tostring("hh:mm:ss:fff")); await task.delay(10000); return view(); } private void writeonfile(string text) { using (mutex mutex = new mutex(false, "tempfile")) { mutex.waitone(); using (var writer = new streamwriter(@"d:\temp\temp.txt", true)) { writer.writeline(text); } mutex.releasemutex(); } } } i testing opening 5 browser tabs pointing ~/home/index , refreshing them @ once. below output getting: here dude. time: 09:09:04:108 here dude. time: 09:09:14:129

java - Concurrent container access? -

Image
right i'm experimenting basic game concepts in java. @ moment, display 2 boxes: 1 player can move arrow keys, , "enemy" jitters around randomly. right now, i'm fixing player's ability shoot little squares in direction of mouse whenever click left mouse button. it's structured right now, have 4 classes - jpanel holds "game" logic, jframe holds panel, entity class simple representation of physical object position, size, , speed methods moving it, , projectile class extends entity class special move method moves 1 step along path calculated initial , destination points given projectile's constructor. the problem i'm having trying update position of projectiles. have timer running update positions of non-player controlled objects, , actionperformed() method of jpanel has call every existing projectile's move() method. right now, when projectile created put projectile array arbitrarily large size, making sure start @ [0] when array full.

ios - How to persist entities in the received order in Core Data? -

Image
assume have entity, post , data received remote server in following order: post 93 post 42 // meaning of life, heh :) post 53 post 100 post 6 what best way persist data disk in order received can fetched again in same order later when user offline? keep in mind posts returned ever changing, objects being removed, etc. there more 1 way achieve want. 1) make entity, e.g. postsfromserver, add one-to-many relationship, e.g.. called posts. choose relationship order. order automatically same sequence input of post. 2) without using relationship, add idnumber attribute post entity. idnumber representing sequence of input of post. have entity called currentidnumber, storing next idnumber coming post. before post input db, read currentidnumber , put value idnumber attribute. increment currentidnumber 1. when fetch post entity, use idnumber in sortdescriptor sort order of array return. good luck

jquery - Show on hover div center when screen resolution low -

Image
i'm creating menu using div, shows div when mouse over. high resolutions shows div on right side, in low resolution need show div left side or center, here attached image of high resolution. and here codes , demo http://jsfiddle.net/9xpdb/ please me resolve this. thanks adding position relative , left: 0px display text way left. modified code in demo , worked. http://jsfiddle.net/9xpdb/3/ .trigger:hover +div { display: block; position: relative; left: 0px; } <link rel="stylesheet" media="screen , (max-device-width: 600px)" href="small-device.css" /> if load css separate stylesheet , apply link tag above, can specify loading new stylesheet created low resolutions (ex: width less 600px)

android - Date picker. How to set it for different State -

i have created date picker. fragment: import java.util.calendar; import my.project.mysimplecal.mainactivity.datedialogfragmentlistener; import android.app.datepickerdialog; import android.app.dialog; import android.app.dialogfragment; import android.content.context; import android.os.bundle; import android.widget.datepicker; public class datedialogfragment extends dialogfragment { public static string tag = "datedialogfragment"; static context mcontext; static int myear; static int mmonth; static int mday; static datedialogfragmentlistener mlistener; public static datedialogfragment newinstance(context context, datedialogfragmentlistener listener, calendar now) { datedialogfragment dialog = new datedialogfragment(); mcontext = context; mlistener = listener; myear = now.get(calendar.year); mmonth = now.get(calendar.month); mday = now.get(calendar.day_of_month); bundle args = new bundle(); args.putstring("title", &q

php - Find last character in multi-dimensional associative array and delete it -

i have associative array in foreach this: foreach ($marray $avalue) { foreach ($avalue $key => $value) { echo $html->find($key,$value) } } it gives me output: bobby johnny now last character y did: echo substr($thestring, -1); but gives me: yy because multi-dimensional array gives me last characters in each array. can last character on page y (..and delete it)? $last_char = ''; foreach ($marray $avalue) { foreach ($avalue $key => $value) { if(substr($html->find($key,$value), -1) == 'y'){ $last_char = $html->find($key,$value); } } } echo $last_char;

java - Android Youtube V3 Simple API 403 Error: accessNotConfigured -

while trying grab simple json feed of playlist encountered error. i didn't want include youtube library such small snippet, opted grab json manually using: https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&key=<api_key>&playlistid=<playlist_id> but kept receiving: { "error": { "errors": [ { "domain": "usagelimits", "reason": "accessnotconfigured", "message": "access not configured. please use google developers console activate api project." } ], "code": 403, "message": "access not configured. please use google developers console activate api project." } } i had enabled api via console i had gotten key using both debug.keystore , release.keystore the package name correct, sha1's solution use key browser applications instead of android key. , don't forget use https leave re

javascript - jquery file upload progress bar inaccurate -

i using jquery file upload ( http://blueimp.github.io/jquery-file-upload/ ) plugin. my code: $('#fileupload').fileupload({ url: 'server/index.php', datatype: 'json', dropzone: $('#dropzone'), }).bind('fileuploadprogress', function (e, data) { var progress = parseint(data.loaded / data.total * 100, 10); $('.progress-bar').css('width', progress + '%'); }); when file upload, progress bar inaccurate. every time when upload no matter size file is, progress bar stuck @ around 10% until file upload finish, directly goes 100%. why behave that? how can fix display progress? thank you. i'm having file progress bar issue too. odd thing same implementation works on site have developed, not on another. odd may be, struggled hours trying find out going on. read problem somewhere , blueimp here says tested fine using similar setups, , mentioned had proxy. don't have proxy, checked on com

android - waking up device in an activity started by AlarmManager -

i have app starts full screen activity @ given time (based on user settings). need wake device when happens user can see activity. use alarmmanager schedule these events , seems work fine (i didn't notice missed alarm event), however, on devices happens screen doesn't turn on. in case if manually wake device can see activity there , it's running didn't turned on screen. can't reproduce every time, works, doesn't. there devices work fine time. can see problem on different os versions it's not specific sdk guess. an example how set alarmmanager: intent myintent = new intent(context, alarmactivity.class); myintent.putextras(extras); pendingintent pintent = pendingintent.getactivity(context, id, myintent, pendingintent.flag_update_current); alarmmanager alarm = (alarmmanager) context.getsystemservice(context.alarm_service); alarm.set(alarmmanager.rtc_wakeup, system.currenttimemillis() + timeinmillis, pintent); here use in oncreate of alarmactivity:

linux - Play framework 2.2.1 app terminates with a strange Killed message -

i running play app written in scala working postgresql via slick in development mode. new relic agents installed both on play , on server. system ubuntu 12.04.3 x64 on vps. has 1 gib of ram , play refused start after brought wordpress site on machine, added swap file , worked sort of fine. every once in while play application stops weird killed message on console. no error messages precede one, log clean before termination. application.log doesn't contain abnormal either. after linux console glitches: enter not create prompt on new line , pressing not bring previous command console, pressing followed enter restarts app. know cause of problem. what's in /var/log/syslog ? sounds linux out-of-memory killer me.

php - How can I get Wordpress user ID? -

i want use twitter follow button site authors on posts. the twitter structure here: <a href="https://twitter.com/twitterapi" class="twitter-follow-button" data-show-count="false" data-lang="en">follow @twitterapi</a> yes, works place must generic. should import wordpress $user->id in structure. how can this? you can use get_current_user_id() in wordpress. to author of current post try following <a href="https://twitter.com/<?php esc_attr_e(get_the_author()) ?>" class="twitter-follow-button" data-show-count="false" data-lang="en">follow @<?php echo get_the_author() ?></a>

android - SwipeListView only one item opened at a time -

this question refers swipelistview component found here: https://github.com/47deg/android-swipelistview after trying out several implementations , fixes found on web decided modify sources little. i post here since know it's known issue , versions found proved have issues eventually. swipelistviewtouchlistener.java has suffered following changes: ... /** * create reveal animation * * @param view affected view * @param swap if change state. if "false" returns original * position * @param swapright if swap true, parameter tells if movement toward * right or left * @param position list position */ private void generaterevealanimate(final view view, final boolean swap, final boolean swapright, final int position) { int moveto = 0; if (opened.get(position)) { if (!swap) { moveto = openedright.get(position) ? (int) (viewwidth - r

android - how to get only item details to next activity to edit -

in list of bluetooth devices item names renamed , stored in database.when app starts should check database , if uuids same should display item list names.when click on item , goes next activity , click on settings option edit name of item , comes , first activty.it changes name names in listview changed edited name , names same got. protected void onlistitemclick(listview l, view v, int position, long id) { final bluetoothdevice device = mledevicelistadapter.getdevice(position); if (device == null) return; log.v("_____________log", "localdevicename : "+mbluetoothadapter.getname()+" localdeviceaddress : "+mbluetoothadapter.getaddress()); log.v("___________log", "localdevicename : "+mbluetoothadapter.getname()+" localdeviceaddress : "+mbluetoothadapter.getaddress()); uuid deviceuuid = new uuid(device.hashcode(), ((long)device.hashcode() << 32) ); log.v("__________device uuid______

arrays - PHP: array_diff count issue due to multiple similar name -

how can match similar words in array_diff count problem of multiple name single words tv-television,inches-inch,mobile-mobile phones,mobile-phones.so create wrong percentage in array_diff count example : $str1 = "samsung television 21 inches led bh005de"; $str2 = "samsung 21 inch led tv"; $arr1 = explode(' ', $str1); $arr2 = explode(' ', $str2); $differencecount = count(array_diff($arr2, $arr1)); in above str1 , str2 contain television,tv , inches,inch words..how can solve problem the obvious way use synonyms that: $str1 = "samsung television 21 inches led bh005de"; $str2 = "samsung 21 inch led tv"; //synonyms: $syns = [ 'tv' => ['tv', 'television'], 'inch' => ['inch', 'inches'] ]; //replace: $str1 = array_reduce(array_keys($syns), function($c, $x) use ($syns) { return $c = preg_replace('/\b'.join('\b|\b

javafx - Is Sodium for Java a good fit for using it with Scala+ScalaFX? -

after watching this talk decided try make scala/scalafx app in reactive style. naturally, after talk, thinking using java implementation of sodium library task. unsure, however, how compatible scala? would sodium java way build reactive scalafx app or should more suitable framework task ? here more specific question people tried combination: what difficulties ( if ) did arise when combining sodium java scala/scalafx ?

SQL Server Select Get Single Row From Another Table -

needing sql server select query here. i have following tables defined: usersource usersourceid id name dept sourceid 1 1 john aaaa 1 2 1 john aaaa 2 3 2 nena bbbb 1 4 2 nena bbbb 2 5 3 gord aaaa 2 6 3 gord aaaa 1 7 4 stan cccc 3 source sourceid description rankorder 1 fromhr 1 2 fromtemp 2 3 others 3 need join both tables , select row rank smallest. such resulting row be: usersourceid id name dept sourceid description rankorder 1 1 john aaaa 1 fromhr 1 3 2 nena bbbb 1 fromhr 1 6 3 gord aaaa 1 fromhr 1 7 4 stan cccc 3 others 3 tia. edit: here's have come far, seem missing something: with tablea as( select 1 usersourceid, 1 id, 'john' [name], 'aaaa' [dept], 1 sourceid union select 2, 1, 'john', 'aaaa', 2 union sel

java - How to debug a "ArrayIndexOutOfBoundsException" in my rail fence cipher program? -

here entire program encryption , decryption using rail fence cipher. arrayindexoutofboundsexception in last 4th line. please me understand , fix error. import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; /* * change template, choose tools | templates * , open template in editor. */ /** * * @author pratheesh */ public class test { public void encrypt2(string line,int rail) { int shift=0,p=0,itr; for(int i=0;i<rail;i++) { p=i; if(i==0||i==rail-1) shift=((rail-2)*2)+2; itr=1; while(p<line.length()) { system.out.print(line.charat(p)); if(i!=0&&i!=rail-1) { shift=((rail*itr-itr)-p)*2; } p+=shift; itr++; } } } public void decrypt2(string line,int arr[]) { int ptr[]=new int[arr.length+1]; int p1=0,p2=0,p3=0,c=1; boolean chk=true; system.out.print(li

ASP.NET WebApi how to route the controller to a different name -

have basic thing - need expose post api such mobile/api/pswdrec wanna bind passwordcontroller avoid dull name. it's webapi areas , i'm trying both attribute routing , maphttproute . neither works far. public class passwordcontroller : mobileapicontrollerbase { //[route("api/mobile/pswdrec/")] public restresponsemessage post(usercredentialsmodel credentials) { return restresponsemessage.ok(); } } checked client side , requests proper json requests. it's starting work when change name of controller pswdreccontroller . is there other way "rename" controller? working on mvc years stuck on simple issue :) helping out ;) edit: public class mobileapiarearegistration : arearegistration { private static iwindsorcontainer _container = new windsorcontainer(); public override string areaname { { return "mobileapi"; } } public override void registerarea(are