Posts

Showing posts from May, 2012

security - PHP writing to a text file on server -

i have log process writes little custom .txt log file on server when people supply input on particular form (so can keep eye on trying use injection). my question: file plaintext, , not link anywhere in code other php calls file_get_contents , file_put_contents . there way see file? search engine possibly find it? (i understand security obscurity. question how 1 might possibly "unobscure" this.) i understand security obscurity. question how 1 might possibly "unobscure" this. they need able know site’s code structure & logic. if name directory logs stored in other logs/ first decent step. or keep directory named logs/ have nested in directory know such my_cool_stuff/logs . if want sure nobody get’s it, can set apache config rule block directly reading .txt files directly browser, use apache files directive in web site’s apache config or in .htaccess on site: <files ~ "\.(txt|yml|yaml)$"> order allow,deny deny

Using MYSQL Associative Table and JOIN -

here structure of 3 tables: create table `contacts` ( `id` int(11) unsigned not null auto_increment, `name` varchar(99) default not null, primary key (`id`) ) engine=innodb auto_increment=1 default charset=latin1; create table `addresses` ( `id` int(11) unsigned not null auto_increment, `street` varchar(99) default not null, `city` varchar(99) default not null, `state` varchar(20) default not null, `zip` int(9) default not null, primary key (`id`) ) engine=innodb auto_increment=1 default charset=latin1; create table `contacts_addresses` ( `id` int(11) unsigned not null auto_increment, `idcontact` int(9) default not null, `idaddress` int(9) default not null, primary key (`id`) ) engine=innodb auto_increment=1 default charset=latin1; sample data: mysql> select * contacts; +----+----------------+ | id | name | +----+----------------+ | 1 | hank kingsley | | 2 | phil collins | | 3 | sam weisgamgee | | 4 | john johnson | | 5 | dale gi

postgresql - how to get points from linestring postgis -

i have linestring (0 0 , 2 4 , 5 5); i need output in form : x (1st cell) || y (2nd cell) 0 || 0 2 || 4 5 || 5 and same polygon. how ? you can use st_x , st_y in conjunction st_pointn x , y of individual points, , use generate_series create index each point of linestring, eg, with line (select st_geomfromtext('linestring(0 0, 2 4, 5 5)') geom) select st_x(st_pointn(geom,num)) x, st_y(st_pointn(geom,num)) y line, (select generate_series(1, (select st_numpoints(geom) line)) num) series;

plsql - How to run oracle PL/SQL in C++? -

i want run sql script c++ program. code goes this: int main() { //..... sql_stmt = "insert t1 values ('qwerty');\ninsert t1 values ('dothar');"; sql_stmt = "declare\nrollback_check_counter number;\n" "begin\n" "rollback_check_counter :=1;\n" "savepoint sp_1;\nif rollback_check_counter = 1 then\n" "begin\n"+sql_stmt+"exception\n" "when program_error then\n" "rollback_check_counter :=0;\n" "rollback sp_1\n" "when others then\n" "rollback_check_counter :=0;\n" "rollback sp_1\n" "end;\n" "end if;\n" "commit;\n" "end;"; try { connection *conn = env->createconnection(user,passwd); //error prone statement *stmt = conn->createstatement(); stmt->setsql(sql_stmt); row_count = stmt->

java - Web Service Authentication with Digital Signature/ Certificate in Android -

we're trying authenticate soap web service in android through digital signature (cryptography mechanism) , digital certificates. in normal j2ee application, achieved apache cxf along wss4j (implements primary security standards). however in android, we're consuming soap web servcies through stubs generated through easywsdl. apache cxf jars aren't supported in android , can't rely on them. kindly let me know how authenticate web service in andorid?

spring - Play Framework and Java8 -

i have 1 java 8 project , project dependency of play web app. whenever try instantiate classes rom java 8 project in play 2.2.3 web app, gives me following error: play.playexceptions$compilationexception: compilation error[error: cannot access mongooperations] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(playreloader.scala:304) ~[na:na] @ play.playreloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(playreloader.scala:304) ~[na:na] how should let play compile code java 8 when 'play "run 8080"' ? why play isn't able access class in java 8 project ? fyi: java_home pointing java 8. here how build.sbt looks like. note 'content-aggregator' local artifact installed in local maven repo. name := "web" version := "1.0-snapshot" resolvers += "maven central" @ "http://repo1.maven.org/maven2" librarydependencies ++= seq( javajdbc, j

android - How to make TranslateAnimation smooth? -

there's scanner line in captureactivity. want add translateanimation , let line move top of "hot area" bottom, it's not smooth @ all. don't know why? here's code snippet framelayout.layoutparams linearparams = new framelayout.layoutparams(framelayout.layoutparams.wrap_content,framelayout.layoutparams.wrap_content); linearparams.width = width; mimageview.setlayoutparams(linearparams); mimageview.invalidate(); mimageview.setvisibility(view.visible); mtranslateanimation.setduration(3000); mtranslateanimation.setrepeatcount(animation.infinite); mimageview.startanimation(mtranslateanimation); any ideas?

ios - PFFile location on disk -

i've read in multiple places on parse forums , stackoverflow pffile contents saved disk after downloaded. saved? how can access raw contents? for context, i'm using avfoundation , doesn't play nsdata or nsinputstream . right i'm fetching file parse , writing contents of nsdata temp directory. untested attempt @ getting cache location pffile: nsstring *home = nshomedirectory(); nsstring *library = [home stringbyappendingpathcomponent:@"library"]; nsstring *docs = [library stringbyappendingpathcomponent:@"private documents"]; nsstring *parse = [docs stringbyappendingpathcomponent:@"parse"]; nsstring *staging = [parse stringbyappendingpathcomponent:@"pffilestaging"]; nsstring *file = [staging stringbyappendingpathcomponent: [nsstring stringwithformat:@"%p_%@", pffileobj, pffileobj.name]];

form's Label Style modification in rails 4 -

i fresher in ror , in application want form's label initial started capital. aware default takes first word's initial capital not aware how give second word's initial capital. let me clear example... i tried code label : = f.label :campaign_title giving output: campaign title expected output: campaign title #title's initial should capital 't' if used %label without form object works don't want that.. here's question.. if want first initial small then? like.. name instead of name .. know doesn't make difference know if there trick.. in advance.. :) try this <%= f.label :campaign_title, "campaign title" %> you can pass custom value second parameter of label helper

regex - Dealing with square brackets in regular expressions in Notepad++ -

i'm converting csv file database of geeklog cms wordpress posts. unfortunately, contains soms 'autotags' (similar 'shortcodes' in wordpress), square brackets. i want replace several hundreds of them normal html code search+replace in notepad++ can't find way deal square brackets. this 'autotag' geeklog: [story:theslugofthepost13122005 anchor text of post] i've found out can convert "[story" part <a href=" regex "\[]story" can't find way find/select/convert rest of autotag. woud appreciated! set replace options regular expression : i used this: (from make out post): find what: \[story:(\w+)\s+((\w+\s*)+)?\] replace with: <a href="$1">$2</a> it replaces [story:theslugofthepost13122005 anchor text of post] with <a href="theslugofthepost13122005">the anchor text of post</a> edit just clarify, main problem not escaping square brackets, deno

javascript - Given an array of objects how do I sort the objects by a property in depth n -

i have array of objects wish sort grouping property data , string telling me property group by(eg: 'organization' or 'organization.name') i need write function takes in data looks beforedata , returns afterdata input : beforedata = [ {'name':'john doe', 'id':1, 'organizations':[{'id':12, 'longname': 'group a'},{'id':13, 'longname': 'group b'}]}, {'name':'foobar', 'id':2, 'organizations':[{'id':13, 'longname': 'group b'},{'id':14, 'longname': 'group c'}]}, {'name':'kristine bell', 'id':3, 'organizations':[{'id':12, 'longname': 'group a'}]}, {'name':'adrian p', 'id':4, 'organizations':[{'id':12, 'longname': 'group a'}]} ] output: afterdata = [ { 'group': 'grou

javascript - Storing id in arrays and using it for printing -

i new coding. trying make barcode scanning app , can scan multiple barcodes. trying store data in array code[] , printing data in html. have defined code[] array , counter in different js file as localstorage["counter"]=0; var code = new array(); localstorage.setitem("code", json.stringify(code)); ` and here page5.html file . in following code myvalue value getting different code. problem myvalue1 . trying call function again , again different value of myvalue1 , store in array code[] <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script language="javascript" type="text/javascript" src="/js/jquery.js"></script> <link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.0rc2.css" type="text/css" charset="utf-8" /> <s

sql server - Displaying decimal places -

i'm writing report, in need display decimal places necessary for example 123.0000 should displayed 123 123.4670 should displayed 123.467 235.4345 should displayed 235.4345 does know if possible? there 2 option. one way if using sp , convert in db side. you can cast or convert float simple select cast (123.4670 float), cast (123.000 float) or if using tables, use format function modify =format(fields!cul1.value, "#,##0.##")

javascript - Sticky footer without page wrap -

following fiddle works fine if content above footer wrapped in page-wrap , on less content footer sticks bottom else there scroll. there way make fiddle in way should not depend on page-wrap , have apply css on footer only. requesting because there on 50 pages made in way , adding ss footer. have change header file footer. http://codepen.io/chriscoyier/pen/uwjjr * { margin: 0; } html, body { height: 100%; } .page-wrap { min-height: 100%; /* equal footer height */ margin-bottom: -142px; } .page-wrap:after { content: ""; display: block; } .site-footer, .page-wrap:after { /* .push must same height footer */ height: 142px; } edited: http://jsfiddle.net/bwtwl/1178/ add code jquery: $('.page-wrap').css('min-height',($(window).height()-142)+'px'); and css: /* mostly: http://ryanfait.com/sticky-footer/ */ * { margin: 0; } html, body { height: 100%; } .page-wrap { /* equal footer height */

javascript - FileUploaded function return thumbnail after upload -

i used api called plupload , want return thumbnail images after files uploaded. every time upload image return it's thumbnail , put in div or after ajax called return images uploaded. code: html: <div class="well" id="prevcap"> javascript: plupload uploader.bind('fileuploaded', function(up, file) { self._handlefilestatus(file); self._trigger('uploaded', null, { up: up, file: file } ); if (uploader.files.length == (uploader.total.uploaded + uploader.total.failed)) { var prev = '<img class="img-thumbnail" src="./assets/images/upload_tmp/'+ file.name +'">'; $("#prevcap").append(prev); } }); this working returns 1 image last image uploaded. i'm thinking of how can return filenames or image file ajax. or there other way return image uploaded. i'm newbie in javasript , plupload.

jquery autocomplete dynamic source from data attribute -

there few topics on same subject, non satisfied me! i want define source of autocomplete through data attribute, so: <input data-behaviour='autocomplete' data-source='/path/to/source'> i'm unable programmatically through source method: $ -> $('[data-behaviour~=autocomplete]').autocomplete source: (req, resp) -> return $(this).data('source') here non-working snippet play with... edit: workaround i've found set through create method: $ -> $('[data-behaviour~=autocomplete]').autocomplete create: (event, ui) -> $(this).autocomplete( "option", "source", $(this).data('source') ) check snippet but don't approach, i'm pretty sure better can done i'm not familiar coffeescript; jquery ui automplete have source option allow make custom stuff; in case can use third option (function) using request , setting response parameter. fu

capybara - First scenario is failing every time in Scenario Outline in Cucumber -

whenever run feature file html report output file, 1st scenario in scenario outline failing everytime. when make same scenario outline first scenario in feature file getting passed, make test case flow weird in feature file. any idea why happening , how overcome? my cucumber version "1.3.15" scenario outline: validation of links when click "<link>" link should in "<link>" page examples: | link | | tv | | email |

Getting Variable from Applescript and using in Python -

is there easy way use applescript like: set thetext text returned of (display dialog "please insert text here:" default answer "" title "exchange python" icon 1) and use "thetext" variable in python? you can run python script command line input applescript: --make sure escape if needed set pythonvar "whatever" set outputvar (do shell script "python '/path/to/script' '" & pythonvar & "'") ned's example has python calling applescript, returning control python, other way around. in python access list of parameters: import sys var_from_as = sys.argv[1] # 1rst parameter cause argv[0] file name print 'this gets returned applescript' # gets set outputvar

How to compare these 2 python tuple of tuples of unequal length and output another tuple based on the comparison? -

i have tuple of tuples; tup1= ( ('aaa', 2), ('bbb', 3) ) i have tuple; tup2 = ('aaa', 'bbb', 'ccc', 'ddd') i want compare tup1 , tup2 . based on comparison, want create tuple of tuples this; outputtup = ( ('aaa', 2), ('bbb', 3), ('ccc', 0), ('ddd', 0) ) the logic this. every element inside tup2 , matching element in tup1. if there matching element(example 'aaa') in tup1, copy outputtup ('aaa', 2). if there no matching element (example 'ccc'), assign value of 0 , append outputtup ('ccc', 0). how can done in python 2.7? thanks. this works output want: tup1 = ( ('aaa', 2), ('bbb', 3) ) tup2 = ('aaa', 'bbb', 'ccc', 'ddd') dic = dict( tup1 ) tri in tup2: dic[tri] = dic.get(tri,0) print tuple(dic.items()) #(('aaa', 2), ('bbb', 3), ('ccc', 0), ('ddd', 0))

ns 3 - ./waf command not working -

i using ns-3.16 in ubuntu 12.04. i'm new python ns3. when run ./waf (or other waf command) produces following code: waf: entering directory `/home/hp/ns-3.16-git-master/build' waf: leaving directory `/home/hp/ns-3.16-git-master/build' traceback (most recent call last): file "/home/hp/ns-3.16-git-master/.waf-1.6.11-30618c54883417962c38f5d395f83584/waflib/scripting.py", line 97, in waf_entry_point run_commands() file "/home/hp/ns-3.16-git-master/.waf-1.6.11-30618c54883417962c38f5d395f83584/waflib/scripting.py", line 151, in run_commands run_command(cmd_name) file "/home/hp/ns-3.16-git-master/.waf-1.6.11-30618c54883417962c38f5d395f83584/waflib/scripting.py", line 143, in run_command ctx.execute() file "/home/hp/ns-3.16-git-master/.waf-1.6.11-30618c54883417962c38f5d395f83584/waflib/scripting.py", line 345, in execute return execute_method(self) file "/home/hp/ns-3.16-git-master/.waf-1.6.11-30618c548

c - Performance worsens when using SSE (Simple addition of integer arrays) -

i'm trying use sse intrinsics add 2 32-bit signed int arrays. i'm getting poor performance compared linear addition. platform - intel core i3 550, gcc 4.4.3, ubuntu 10.04 (bit old, yeah) #define iter 1000 typedef union sint4_u { __m128i v; sint32_t x[4]; } sint4; the functions: void compute(sint32_t *a, sint32_t *b, sint32_t *c) { sint32_t len = 96000; sint32_t i, j; __m128i x __attribute__ ((aligned(16))); __m128i y __attribute__ ((aligned(16))); sint4 z; for(j = 0; j < iter; j++) { for(i = 0; < len; += 4) { x = _mm_set_epi32(a[i + 0], a[i + 1], a[i + 2], a[i + 3]); y = _mm_set_epi32(b[i + 0], b[i + 1], b[i + 2], b[i + 3]); z.v = _mm_add_epi32(x, y); c[i + 0] = z.x[3]; c[i + 1] = z.x[2]; c[i + 2] = z.x[1]; c[i +

java - Tomcat file access restriction/allowance per IP -

is there way restrict/allow access specific file on tomcat ips? if there no direct way this, workaround? i'd appreciate help. use filter , ip request . in case request comes behind firewall, you'll firewall's ip.

php - when ever i want to route to my site i get sessions table not found -

i'm working on laravel , have problem when try migrate table brings old error saying there exist table migrated months go. , when want create session table hold user sessions won't migrate , have problem routing. it says: pdoexception thrown when trying read session data: sqlstate[42s02]: base table or view not found: 1146 table 'euael.sessions' doesn't exist and when want migrate session table error: php fatal error: cannot redeclare class addownertotvshow in /var/www/app/database/migrations/2014_05_05_090225_add_owner_to_tvshow.php on line 34 error in exception handler: stream or file "/var/www/app/storage/logs/laravel.log" not opened: failed open stream: permission denied in /var/www/vendor/monolog/monolog/src/monolog/handler/streamhandler.php:70error in exception handler: stream or file "/var/www/app/storage/logs/laravel.log" not opened: failed open stream: permission denied in /var/www/vendor/monolog

arrays - Javascript elegant way to split string into segments n characters long -

as title says, i've got string, , want split segments n characters long. for example: var str = 'abcdefghijkl'; after magic n=3, become var arr = ['abc','def','ghi','jkl']; is there elegant way this? var str = 'abcdefghijkl'; console.log(str.match(/.{1,3}/g)); note: use {1,3} instead of {3} include remainder string lengths aren't multiple of 3, e.g: console.log("abcd".match(/.{1,3}/g)); // ["abc", "d"] a couple more subtleties: if string may contain newlines ( which want count character rather splitting string ), . won't capture those. use /[\s\s]{1,3}/ instead. (thanks @mike). if string empty, match() return null when may expecting empty array. protect against appending || [] . so may end with: var str = 'abcdef \t\r\nghijkl'; var parts = str.match(/[\s\s]{1,3}/g) || []; console.log(parts); console.log(''

android - Removing all content of specific folder -

i trying remove content of device folder on hardware press not happening? here trying: @override public void onbackpressed() { deletefilefromdirectory(); finish(); } public void deletefilefromdirectory() { file mediastoragedir = new file( environment .getexternalstoragepublicdirectory(environment.directory_pictures), "mycameraapp"); if (mediastoragedir.exists()) { isdeleted = mediafile.delete(); system.out.println("file deleted :" +isdeleted);//gives false } else system.out.println("directory not exist"); } documentation says must empty ... should do? if path contain file can delete path contain folder folder must empty, first of have delete files folder , delete particular folder. here sample code. public void deleterecursive(string strpath) { file fileordi

css - Needing background image to end repetition at start of footer -

basically, right have multiple images 1 @ background image body (being blue square) , need to end @ start of footer, underneath footer black no matter do, doesn't seem help. here's example http://bit.ly/1nkiee1 (on postimage) i thought maybe if ended body tag, started footer tag wouldn't doesn't seem fix anything. css .nav { background-image: url(image/top.png); background-repeat: repeat-x; } body { background-image: url(image/blue.png); background-repeat: repeat; background-size: contain; background-color: #000000; } footer { background-image: url(image/footer.png); background-repeat: repeat-x; background-color: #000000; font-size: 14px; text-decoration: none; text-shadow: #000000 1px 1px; padding: 45px; } thanks in advance - shy ♥ don't give background property body instead of use div inside body upto footer , give these properties div example html : <nav>......</nav> <div class="containe

android - onCreate method called twice on orientation change -

why oncreate method inside resourcelistfragment called twice on orientation change? after first call app crashes because getactivity() inside onpostexecute returns null , tried changing: new httptask(this).execute(""); to if(savedinstancestata == null) new httptask(this).execute(""); then on second call savedinstancestate null, mactivatedposition listview.invalid_position . i'm using layout aliases activity_list replaced activity_twopane. mainactivity public class mainactivity extends activity implements tablistener, onnavigationlistener { /** * whether or not activity in two-pane mode, i.e. running on tablet * device. */ private boolean mtwopane = false; resourcereservationapp app = (resourcereservationapp)getapplication(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list); mtwopane = getresources().getboolean(r.bool.has_two_panes

javascript - google maps v3 waypoints -

im using following code show directions , waypoints waypoints not showing, if use waypoints: [{location: "(39.424504, -76.596594)", stopover: true}] show waypoint, cant make work array. i have used alert(waypts[0].location); , array gets values. var start = document.getelementbyid('start_cord').value; var end = document.getelementbyid('end_cord').value; var waypts = []; makerequest('get_waypoint.php', function(data) { var data = json.parse(data.responsetext); var latit; var longi; (var = 0; < data.length; i++) { latit = parsefloat(data[i].lat); longi = parsefloat(data[i].lon); waypts.push({location: new google.maps.latlng(latit, longi), stopover: true}); } }); var request = { origin: start, destination: end, waypoints: waypts, optimizewaypoints: true, travelmode: google.maps.travelmode.driving }; directionsservice.route(request, function(response, status) {

Android Listview with Search filter -

i trying make listview search android.i using simplecursoradapter on ontextchanged have found error adapter cannot resolved or not field.how can resolve error .i using simplecursoradapter .i not able use adapter.getfilter().filter(cs); listview lv; cursor cursur1; edittext search ; int textlength=0; arrayadapter<string> adapter1; @suppresswarnings("deprecation") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.fragment_main); search = (edittext) findviewbyid(r.id.inputsearch); final string [] from={contactscontract.commondatakinds.phone.display_name,contactscontract.commondatakinds.phone.number,contactscontract.commondatakinds.phone._id}; int [] m={android.r.id.text1,android.r.id.text2}; lv=getlistview(); lv.setchoicemode(listview.choice_mode_multiple); cursur1=getcontentresolver().query(contactscontract.commondatakinds.phone.content_uri, null, null, null

security - How can I determine (and then amend) BizTalk Server Operator permissions for viewing WCF-BasicHttp bindings? -

how can determine (and amend) biztalk server operator permissions viewing wcf-basichttp bindings? the issue users in biztalk server operators group, , when @ binding of wcf-basichttp send port, see presume default values ... open 1min, send 1min, etc. but if member of biztalk server adminstrators checks binding, actual values seen ... open 2min, etc. i'm presuming operator group permissions through biztalk.explorerom and/or stored proc's isn't correct reading values ... making change , expected "permission denied ..." so how track down data is, or in case, isn't coming from? and how update provide read-only? edit: and check, had him export bindings , compared export, , xml same ... except element missing export operator transport types, i.e. smtp, file, wcf-sql, etc. not wcf-basichttp unfortunately, can't change scope of of built in groups can do. admittedly, have never used biztalk server operators group i'm not sure sho

How to track changes (and most important read) really big files in Java efficiently -

i have big log file in text form, created 3rd party app. unfortunately file 150mb, others may have bigger files, depending on day started logging. since file created 3rd party application can't modify in way (remove of it's oldest content example). what want keep track of file size , notified when there new line added (thus size of file altered) , read line (it last line). i know when want keep track of changes, doesn't have constant update, when user has application minimized in tray. essentially, want notify user changes in state of application when dcan't see them. now tracking differences in size of file using file file = new file("filepath"); file.length(); as far understand doesn't load file memory it's not of performance drop. if right what efficient way read last line of file? replace efficiency "as low performance drop possible". don't mind 2 or 3 seconds delay between actual event being logged file , user bei

javascript - Make flex work offline without a web server -

we have existing app uses javascript , embeds flash/flex. require make whole thing work offline @ short notice , wonder fastest way make flex work offline is. offline app in mind window brings web browser js files stored locally. flex app loads mp3 files , data files server. there way make flex load files file system automatically without user having web server setup? know can done air prefer not that. if forced use air, possible embed air application in web page same way embed flex app? flex app embedded seamlessly shown here: go www.eyespeakpro.com click on "free trial" after choosing gender. 2 click on "conversation in daily life" course, click on first lesson, click "go" ignore lesson , click on speech bubble 2nd left in bottom right corner. brings flex app, , if watch network traffic can see files being downloaded if click right arrow next sentence etc. thanks. you can run swf file offline. due security, swf file not allowed load

javascript - BackboneJS - get specific value from collection using _.max method -

i want specific value model inside collection. collection sorted id (contest_id) served database , gets delivered json. so, json looks like: data : [{ "contest_id" : "3", "artist" : { "artist_name": "some name", "artist_cover" : "some image.jpg" } }, "contest_id" : "1", .... }] now, have glued together: var contestimage = _.max(this.collection.tojson(), function(cnt){ return cnt.contest_id; }); i highest contest_id, want how proceed when want grab image? , display it? thanks in advance... the max method should available directly backbone collection (although it's underscore method, it's mixed backbone's collections), means can simplify code bit. something should trick: var model = this.collection.max(function (cnt) { return cnt.contest_id; }); var contest_id = model.get('contest_id'); the first se

Java SSL Client/Server random values -

i need access ssl server/client randoms exchanged during ssl/tls handshake can use them @ later time in encapsulated protocol. how access these values in java? i've had @ sslsocket.gethandshake() doesn't seem expose values. there's no api call in jsse let access directly. you can see through -djavax.net.debug=ssl (" client nonce "), that's not accessible within application. you via reflection on private members, this bad idea (like use of reflection using private members on private api). going dependent on version , implementation of java you're using too. field handshakerfield = sslsocket.getclass().getdeclaredfield( "handshaker"); handshakerfield.setaccessible(true); object handshakerobj = handshakerfield.get(sslsocket); system.out.println(handshakerobj); // start handshake *after* you've got hold of handshaker object, // otherwise null. sslsocket.starthandshake(); class

ios7 - Fullscreen camera in iPhone 5s -

Image
i create camera overlay custom view , m trying have camera in fullscreen applying scale , translation. work great in iphone 5 doesn't in iphone 5s. try many portions of codes still not found problem. code : if ([[uiscreen mainscreen] bounds].size.height == 568) { cgaffinetransform translate = cgaffinetransformmaketranslation(0.0, 71.0); cgaffinetransform scale = cgaffinetransformscale(translate, 1.333333, 1.333333); imagepicker.cameraviewtransform = scale; } by way tests in ios 7. thank's help. put line of code in custom camera oveylay class. works me in iphone5s. cgsize screensize = [[uiscreen mainscreen] bounds].size; int heightoffset = 120; float cameraaspectratio = 4.0 / 3.0; //! note: 4.0 , 4.0 works float imagewidth = floorf(screensize.width * cameraaspectratio); float scale = ceilf(((screensize.height + heightoffset) / imagewidth) * 10.0) / 10.0; self.imagepickercontroller.cameraviewtra

javascript - Django: Jquery click function not working in Ajax -

i have been working through tango django exercises cut teeth django. done having problem ajax part . ajax function auto_add page not being called. idk problem since other functions being called. on shell prompt, there no call ajax function @ all. needed. pertinent code attached. same on website link above. static/rango-ajax.js $('.rango-add').click(function(){ var catid = $(this).attr("data-catid"); var title = $(this).atrr("data-title"); var url = $(this).attr("data-url"); $.get('/rango/auto_add_page/', {category_id: catid, url: url, title: title}, function(data){ $('#pages').html(data); me.hide(); }); }); templates/rango/category.html {% if user.is_authenticated %} <button data-catid="{{category.id}}" data-title="{{ result.title }}" data-url="{{ result.link }}" class="rango-add btn btn-mini btn-info" type="butt

Using Bundle in an activity in Android -

i have intermittent issue in using bundle. have created widget , when user clicks widget widget opens mainscreen , bundle value there. part working fine without issue. the problem when open mainactivity screen directly (by clicking icon in homescreen) getting nullpointerexception in place have declared bundle. once error not able open app unless force stop or clear data. the same code working fine on samsung s3 running 4.3, nexus one, galaxy nexus too. getting issue in kitkat 4.4.4.. i not sure why going inside bundle when haven't put in bundle. here have done in mainactivity bundle bundle = getintent().getextras(); if(bundle != null) { string callfromwidget = bundle.getstring("callfromwidget"); log.e("!null","why coming inside bundle " +callfromwidget); if(callfromwidget.equalsignorecase(res.getstring(r.string.widget))) { //do } } else { //update database there nothing bundle } here logs: 06-27 15:55:26.824

c++ - Integrate boost::asio into file descriptor based eventloops (select/poll) -

if want integrate stuff boost::asio eventloop based on file descriptors (select/poll), how can achieve it? other libraries asynchronous functions offer hand out file descriptor becomes readable there work done, can integrate select/poll of eventloop , let call processing callback of library (like single shot event processing). a great example asynchronous name resolver in thread pool, discussed in this question . several of objects in boost asio library expose native_handle scenarios this.

java - app crash when reading SharedPreferences Android -

i can't figure out problem is. code works fine when don't call getprefsgps() method. the method geocoding location working 2 days ago stopped showing city name...again don't know why! here code import java.io.ioexception; import java.util.list; import java.util.locale; import android.app.activity; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.location.address; import android.location.geocoder; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.view.animation.scaleanimation; import android.widget.button; import android.widget.imageview; import android.widget.relativelayout; import android.widget.textview; public class gps extends activity { textview tvlat; textv