Posts

Showing posts from 2011

java - Dispatching an event for a closed socket -

i'm doing event disconnect client. here code: public void run(){ while(isconnected()){ system.out.println("asd"); } serverlistener.clientdisconnect(clientid); } public boolean isconnected(){ if(socket.isclosed() || !socket.isconnected() || socket.isinputshutdown() || socket.isoutputshutdown()){ return false; } return true; } the problem have results: isclosed = false isconnected = true isinputshutdown = false isoutputshutdown = false and when client disconnects, have same result: nothing happens. that correct. flags tell did. you haven't closed connection, connected once, haven't shutdown input or output. the way know if connection closed when fail read socket. (or selector notifies you) note: because other end has closed connection, doesn't mean want close. imagine have http request , server sends response , closes connection. want connection close if haven't read data, @ ra

ios - how to mock a property of an object conforming to a protocol and mocked by OCMock? -

i'm following examples in test driven ios development , in 1 case there unit test ensures delegate gets 'dumbed down' version of error method. without going many details here relevant objects: communicator: object responsible making network calls manager: instructs communicator make calls , pushes result delegate. delegate: manager delegate conforms stackoverflowmanagerdelegate protocol. gets results , processes it. so test is: @implementation questioncreationtests { @private stackoverflowmanager *mgr; } - (void)testerrorreturnedtodelegateisnoterrornotifiedbycommunicator { mockstackoverflowmanagerdelegate *delegate = [[mockstackoverflowmanagerdelegate alloc] init]; mgr.delegate = delegate; nserror *underlyingerror = [nserror errorwithdomain: @"test domain" code: 0 userinfo: nil]; [mgr searchingforquestionsfailedwitherror: underlyingerror]; xctassertfalse(underlyi

Android WebView ZoomManager.onSizeChanged NullPointerException -

i getting webview exception on class, doesn't specify line. here exception: java.lang.nullpointerexception @ android.webkit.zoommanager.onsizechanged(zoommanager.java:955) @ android.webkit.webviewclassic.onsizechanged(webviewclassic.java:5634) @ android.webkit.webview.onsizechanged(webview.java:2147) @ android.view.view.sizechange(view.java:14400) @ android.view.view.setframe(view.java:14375) @ android.webkit.webview.access$701(webview.java:239) @ android.webkit.webview$privateaccess.super_setframe(webview.java:1778) @ android.webkit.webviewclassic.setframe(webviewclassic.java:5610) @ android.webkit.webview.setframe(webview.java:2141) @ android.view.view.layout(view.java:14286) @ android.view.viewgroup.layout(viewgroup.java:4562) @ android.widget.framelayout.onlayout(framelayout.java:448) @ android.view.view.layout(view.java:14289) @ android.view.viewgroup.layout(vi

Google Directions API error -

when use following url: http://maps.googleapis.com/maps/api/directions/json?origin=cais%20do%20sodre&destination=gare%20do%20oriente&sensor=false&mode=transit i'm getting result { "routes" : [], "status" : "invalid_request" } but works on google maps. doing wrong? when use transit mode in directions request, there additional required parameters : either arrival_time or departure_time parameter must specified time request transit directions. this returns response me: http://maps.googleapis.com/maps/api/directions/json?origin=cais%20do%20sodre&destination=gare%20do%20oriente&sensor=false&mode=transit&arrival_time=12

amazon ec2 - Using docker behind a proxy on an EC2 instance -

i'm trying run docker inside ec2 vm instance. instance behind http proxy. far can tell docker install went okay. here instance information linux ip-x-x-x-x 3.8.0-31-generic #46~precise1-ubuntu smp wed sep 11 18:21:16 utc 2013 x86_64 x86_64 x86_64 gnu/linux the docker version i've docker version 0.6.3, build b0a49a3 when try run simple docker command hangs long time. $sudo docker run -i -t ubuntu /bin/bash unable find image 'ubuntu' (tag: latest) locally pulling repository ubuntu i've feeling has http proxy settings. i tried setting proxy in different ways. for example based on this tried still doesn't work. $sudo http_proxy=http://proxy.xyz.com:8080 docker run -i -t ubuntu /bin/bash unable find image 'ubuntu' (tag: latest) locally pulling repository ubuntu any idea missing here? you need running docker daemon http_proxy environment variable, since pulling of images happens through daemon. if you're on ubuntu, can

phpMyAdmin - Status Monitor - System Resources not updating -

i have upgraded phpmyadmin 3.3x 4.0.7. working great - except nifty status --> monitor --> system resource charts. database charts working fine. i've checked online resources , can't find reference configuration parameter or specific permissions need changed in order enable these. any ideas on how enable "system cpu usage", "system memory", , "system swap" monitor charts? os: centos 6.4 | php: 5.3.27 | database: mariadb 5.5.32 | phpmyadmin: 4.0.7 fixed! tyron's script revealed problem: error message thrown when attempting access /proc/meminfo , /proc/stat files via script (and phpmyadmin) open_basedir restriction in effect. file(/proc/meminfo) not within allowed path with clue, able tweak account's php.ini settings (this cpanel server, used php open_basedir tweak ) , voila! data available. thank you!

php - db insert returning gibberish values with numeric value -

assuming host issue, don't see how reading wrong (works on locahost) i returning array called $result , instance of loop, $v telephone number $k = 'phone'; $v = '(555) 555-1212)'; i have tried $result[$k] = preg_replace('/(\w*)/', '', $v); i have tried $result[$k] = preg_replace('/[^0-9]/', '', $v); i have received values $v of -198040413 1260583916 expected result 5555551212 echoing results page both cases gives expected result, not preg_repalce issue, must db issue i know not int limit issue, using varchar(10) testing problem host arvixe.com using php 5.3.27 , have had other conflicts them, preg_replace should pretty straight forward code (you think) found issue, insert i inserting varchar using i type, changing s type fixed it // not work bind_param('i', $phone); // work bind_param('s', $phone); when inserting varchar field

python - Change default return value of a defaultdict *after* initialization -

is there way change default_factory of defaultdict (the value returned when non-existent key called) after has been created? for example, when defaultdict such as d = defaultdict(lambda:1) is created, d return 1 whenever non-existent key such d['absent'] called. how can default value been changed value (e.g., 2) after initial definition? assign new value default_factory attribute of defaultdict. default_factory : this attribute used __missing__() method; initialized first argument constructor, if present, or none , if absent. demo: >>> dic = defaultdict(lambda:1) >>> dic[5] 1 >>> dic.default_factory = lambda:2 >>> dic[100] 2

python using any() and all() to check if a list contains one set of values or another -

my code tic tac toe game , checking draw state think question more useful in general sense. i have list represents board, looks this: board = [1,2,3,4,5,6,7,8,9] when player makes move int moved on replaced marker ('x' or 'o'), have checks in place winning state, can't check draw state, none of list values ints winning state has not been set. the code have far: if any(board) != playerone or any(board) != playertwo: print 'continue' elif all(board) == playerone or playertwo: print 'draw' the if statement works, elif not, think problem 'or' operator, want check is: if every item on board either playerone marker or playertwo marker, if make code: elif all(board) == playerone or all(board) == playertwo: i checking see if every place on board playerone or every place on board playertwo, won't be. so how check if board taken combination of playerone markers , playertwo markers? all , any functions take i

java - Hibernate only saving 2 of 3 values in database -

i trying create entity called muziekstuk entitys called instrument , componist created join-table 3 foreign keys id's of muziekstuk instrument , componist. muziekstuk , instrument created , componist select dropdown this action code: muziekstukdaoimpl reg = new muziekstukdaoimpl(); componistdaoimpl com = new componistdaoimpl(); int componistid = integer.parseint(mcomponist); componist componist = (componist) com.getbyid(componistid); instrument i1 = new instrument(minstrument1, integer.parseint(maantal1)); muziekstuk muziekstuk = new muziekstuk(mtitel,mgenre,componist,i1); reg.save(muziekstuk); it make new instrument , muziekstuk in join table id of componist null :s know why? here rest of code: muziekstuk: @entity @table(name = "stud1630651.mfmuziekstuk") public class muziekstuk { @id @generatedvalue(strategy=generationtype.auto, generator="my_entity_seq_gen") @sequencegenerator(name="my_entity_seq_gen"

java - Why string.matches("^[A-Z0-9\\-\\_]+") not working when i am giving value of string by manipulating another string, -

string astr="test-1-tv_50"; system.out.println(astr.matches("^[a-z0-9\\-\\_]+")); //true. but why not working..? string astr1= "$local:test12-1-tv_50 xs:boolean"; int strtindex=astr.indexof(":"); int endindex=astr.indexof("as"); string extractedstr=astr1.substring(strtindex+1,endindex); //test12-1-tv_50 system.out.println(extractedstr.matches("^[a-z0-9\\-\\_]+")); //false. why giving result false.??? there's trailing space in extractedstr . so contains "test12-1-tv_50 " (not there's space after final 0). you can either replace endindex astr.indexof(" as") (starting space) or call trim() on extractedstr : string extractedstr=astr1.substring(strtindex+1,endindex).trim();

Generate PDF using jquery ajax -

i working phalcon php framework. want send data displayed in div tag(it result of search)to controller function, , controller generate pdf file. but, pdf file not generating. here view: var imenica = "ja se zovem nedim omerbegovic"; $.ajax({ url: '<?php echo $this->url->get("test/creatingpdf");?>', type: 'post', datatype: '', data: {imenica:imenica}, success: function(data){ alert(data); } , error: function(){ alert("greska"); } }); }); and here code controller: public function creatingpdfaction(){ $this->view->disable(); $string =$_post['imenica']; $this->view->setvars(array('ime'=>$string)); $loader = new \phalcon\loader(); $loader->registerclasses( array( "mpdf"=> "c:/wamp/www/phalcon1/mpdf

networking - Data transfer between servers -

assuming have 2 bunch of servers, first 1 dedicated front , other one, dedicated process information fronts. best way transfer data fronts process servers; i tried different techs on small amount of data: tried dump data files , retrieve them process servers... that's ok secure because never lose data, uses lot of disc write capacity. also tried sockets cool but sincerely still don't know best way treat huge data stream between servers. can point me in right direction? i best option use persistent queue, rabbitmq. way if receiving servers go down transfer not lost , transfer continue when receiving server pulls data off queue

c - Seg faulting when getting user input? -

so building shell , 1 command implementing prompt. take argument , set prompt, if no argument entered ask user input , use that..... that's worded terribly here's example: [shell] prompt code code[shell] ls code[shell] .... or [shell] prompt please enter prefix: (user input goes here, code again) code[shell] now first situation works fine, when try prompt no arguments, asks user input, when enter it, seg faults , i'm not sure why. this code have far: void prompt(char *target) { if(!target) { printf("please enter prefix: "); scanf("%s", &target); } char *result = malloc(strlen(shell) + strlen(target) + 1); strcpy(result, target); strcat(result, shell); shell = result; } any ideas?? maybe simple mistake on part seems should work. by way, in code, "shell" macro char arrray "[my_shell]: ". the problem statement: scanf("%s", &target); you need p

php - script not working on the server but works fine on the localhost -

i have problem script,i made login script enter username , password , working on localhost(i.e can login in , out having access admin panel) uploaded on server confusing part when try log in right username , password not accessing admin panel , showing me access denied message session not being set on server while working on local host.. secondly created news page can view news showing there no posts show on localhost working home.php enter username , password <?php if(isset($_cookie['testsite'])){ header('location: enter.php'); }else{ echo" <html> <head> </head> <body> <center>please login...</center> <div align='center'> <form method='post' action='login.php' id='generalform'> <table border='1' width='25%'> <tr><td>name: </td><td><input type='text' name='name' maxlength='15'/></td>

iphone - Taking thumbnail image from video always returns null -

i trying first thumbnail video. i tried following: one avurlasset *asset = [[avurlasset alloc] initwithurl:[nsurl fileurlwithpath:_moviepath] options:nil]; avassetimagegenerator *gen = [[avassetimagegenerator alloc] initwithasset:asset]; gen.appliespreferredtracktransform = yes; cmtime time = cmtimemakewithseconds(0.0, 600); nserror *error = nil; cmtime actualtime; cgimageref image = [gen copycgimageattime:time actualtime:&actualtime error:&error]; uiimage *thumb = [[uiimage alloc] initwithcgimage:image]; cgimagerelease(image); nslog(@"the error %@: image %@: url %@: ",error,_mainthumbnail,[nsurl fileurlwithpath:_moviepath] ); however, log is: the error (null): image (null): url file:///private/var/mobile/applications/d1293bdc-ea7e-4ac7-ad3c-1ba3548f37d6/tmp/trim.6f0c4631-e5e8-43cd-bf32-9b8f09d4acf1.mov: two avurlasset *asset=[[avurlasset alloc] initwithurl:[nsurl fileurlwithpath:_moviepath] options:nil]; avassetimagegenerator *generator = [[a

c# - Water physics. Where to start? -

i've been searching on google advise or way, started water physics in way or shape. making game in unity 3d requires cartoonish water physics smooth. i know theres alot of plugins , libraries out there, wanted code myself, more experience developer in general. so basicly, question is. should start, if want make water physics/flow? can recommend tutorials, articles etc? most water physics models use implicit surfaces, driven particles , springs. it's same cloth different parameters. for 2d, it's easier - here's starting point: http://freespace.virgin.net/hugo.elias/graphics/x_water.htm

java - How do I use the navigation drawer to select a viewpager -

i'm new android app development , i'm working on project school. from understanding far, can use navigation drawer swap out ui fragments. made nav drawer that's working far based on tutorial given here: https://developer.android.com/training/implementing-navigation/nav-drawer.html i'm trying have switch views each item that's selected. made view pager fragment activity , want program replace view view pager upon selecting 4th item in nav drawer (index 3). added switch statement in fragment class determine layout load. here's activity nav drawer: package com.mkge.mkg; import android.content.res.configuration; import android.os.bundle; import android.support.v4.app.actionbardrawertoggle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.widget.drawerlayout; import android.view.layoutinflater; import android.view.menu; import android.view.me

php - png images automatically named alphabetically -

i have string 100 characters long. want form .png image each character of string. here code $grid_ch = "pknhvjayclgcoljwkriwnykoticrnxuxizumpefpshaamhfboimlkvidqksoatlltiicyestieihaasdqpltdwhldxsvcqrhsboj"; $grid_ch_arr = str_split($grid_ch); foreach($grid_ch_arr $k=>$v){ header("content-type: image/png"); $image = imagecreatetruecolor(20, 30); $fill = imagecolorallocate($image, 255,255,255); $text_color = imagecolorallocate($image, 0,0,0); $border = imagecolorallocate($image, 255,255,255); imagefilltoborder($image, 0, 0, $border, $fill); imagestring($image, 5, 2, 2, $v, $text_color); $image_path = "../images/" . $v . ".png"; imagepng($image,$image_path); echo $v . ","; } my problem images formed a.png till z.png. why images being named english alphabets , not characters string. tried echoing characters @ end of the script , working fine. please help. if want files named 1.p

node.js - Express.js vhost subdomain set up -

trying set connect's vhost middleware. love help. i've got normal express.js app, node_modules, public, views , routes directories. i've added directory next holds express.js app. i've added line top level app (tedxgramercy): app.use(express.vhost('chatter.tedxgramercy.com', require('./chatter/app.js').app)); and line chatter app: var app = exports.app = express(); the chatter app calls listen on port 8000, main (top level) app calls listen on port 3000. don't know if that's right. when launch app (node app) runs fine , can access both apps on localhost:3000 , localhost:8000 respectively, when deploy server, subdomain http://chatter.tedxgramercy.com doesn't work. any pointers? have change dns point other port or something? it's simple, tricky setup. first, main app.js : var vhost = require('vhost'); app.use(vhost('chatter.tedxgramercy.com', require('./chatter/app').app)) app.use(r

html - What code should I write for the reverse $(window).scroll function in jquery for scrolling upwards? -

i find code window scroll function , appended code, working great when scrolling down i.e. have image fading out while scrolling down, when scroll again, image absent because of previous effect. so plz me this. html part:- <div id="blog"> <img src="trans_blog.png">//i want image fade in , out. </div> jquery part:- $(document).ready(function(){ $("#blog img").fadein(2000); $(window).scroll(function(){ $("#blog img").fadeout("slow"); }); }); this code should trick. fadeout element goes out of view, , fadein comes back $(window).scroll( function(){ $('#blog img').each( function(i){ var top_of_window = $(window).scrolltop(); var this_bottom = $(this).position().top + $(this).height(); if(top_of_window > this_bottom){ $(this).fadeout(); } else { $(this).fadein(); } });

c# - Access JSON fields with numeric keys -

i want access address of pictures in json, field name number , in c# number not valid name variable... my json: { "id":3441, "name":"test", "address": { "1":"url.com\/45.jpg", "2":"url.com\/23.jpg", "3":"url.com\/65.jpg", "4":"url.com\/789.jpg", }, "count":2 } my code in c#: ( hrmlresult json) dynamic stuff1 = newtonsoft.json.jsonconvert.deserializeobject(htmlresult); string address= stuff1.address; //it works string allpics = stuff1.pic; //it works firstpictextbox.text= stuff1.pic.1; //compiler error secondpictextbox.text = stuff1.pic[2]; //runtime error what should do?! thank all... you have create model object properties, in found json you're expecting. then, number properties, can use jsonproperty attribute name property number, example: class mymodel { [jsonproperty("

OpenCv with Android Camera Surfaceview -

i trying develop image recognition android application... using customized camera using surface view.... as here in android capture images ... want process captured images using opencv , how can captured image , convert mat ? there way save captured image temporary ? in advance i assume have added opencv library project successfully. here sample code using opencv4android. public class samplecameraframeaccessactivity extends activity implements cvcameraviewlistener2, ontouchlistener{ private static final string tag = "samplecameraframeaccessactivity"; protected camerabridgeviewbase camerapreview; protected mat mrgba; protected baseloadercallback mloadercallback = new baseloadercallback(this) { @override public void onmanagerconnected(int status) { switch (status) { case loadercallbackinterface.success: { log.i(tag, "opencv loaded successfully"); // mopencvcameraview

java - how to change letter to number -

actually beginner in java i want know how print program show me word letter in same time for example i love = 1 l0v3 winter coming = w1nt3r 1s c0m1ng this have change (a = 4, e = 3, = 1, o = 0,) import java.util.scaneer; public class question2 { public static void main(string[]args) { scaneer keyb = new scanner(system.in); system.out.println("enter string :"); int string letter = = 4, e = 3, = 1, o = 0; there's method string.replaceall(string regex,string replacement) want. example usage: string word = "winter"; word = word.replaceall("i","1"); system.out.println(word); //outputs 'w1nter'. keep in mind case-sensitive (so replacing doesn't replace a). things made more efficient using better regular expressions , caching regular expression too, won't go deep you're beginner. feel free google "java cache regex".

php - Notice: Unknown: Skipping numeric key 1 in Unknown on line 0 -

i have following code: include 'includes/connect.php'; $sp= "clot"; $selectall = mysqli_prepare($connection, "select count prices category = ? order ppu limit 11"); mysqli_stmt_bind_param($selectall, 's', $sp); mysqli_stmt_execute($selectall); $resulttotal = mysqli_stmt_get_result($selectall); $x=1; while($row = mysqli_fetch_array($resulttotal, mysqli_assoc)){ $_session[$x] = $row['count']; $x++; } $y=1; while(isset($_session[$y])){ if($y==11){ $_session['nextstart'] = $_session[$y]; unset($_session[11]); } else{ echo($y); echo("<br>"); echo($_session[$y]); echo("<br>"); $y++; } } which outputs expected string of numbers (1, 17, 2, 18...) error message(ten times, key 1, key 2, key 3, , on): notice: unknown: skipping numeric key 1 in unknown on line 0 looking error up, answer find putting array superglobal cause this. don

android - Drag and Drop Items from Listview into Activity -

Image
in app, want user able follow list of instructions able put link installed android apps widget creating. in widget, when user taps widget opens new activity contains of apps. add new app links activity, want user able pull out kind of scrolling tab hold list of of applications have on device (i know how this). user able press , hold on app listview , drag droppable area in widget hold app. please note picture below better idea of mean (sorry poor quality): how turn listview object able this? have make listview have touch listener attribute , make droppable area have drag event, sure of (somewhat looking around on how make things drag , droppable). how this? ideas or comments on improvements appreciated! you use setonitemlongclicklistener set listener waiting long click when fired begin drag process.

java - JSOUP - doc cannot be resolved and doc cannot be resolved to a variable -

i'm attempting implement jsoup query i'm getting error stating "doc cannot resolved" , "doc cannot resolved variable" know i'll need call doc before can use i'm not sure how yet - it's first time building parser jsoup - i'm sure it's pretty simple - need quick pointer. public class mainactivity extends activity { textview tv; string url = "http://microsoft.com"; string tr; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); tv = (textview) findviewbyid(r.id.textview01); new mytask().execute(url); } private class mytask extends asynctask<string, void, string> { progressdialog prog; string title = ""; @override protected void onpreexecute() { prog = new progressdialog(mainactivity.this); prog.setmessage("l

Simple if statement in bash doesn't work -

i learning little bit of bash in linux , can't understand why doesn't work. simple if statement , read command keep window opened. happens when execute .sh file terminal's window opens second , closes back. can't see message or check whether there's error or why doesn't work. if remove if block can see message , window remains opened. code inside file count=99 if [ $count -eq 100 ]; echo "count 100" else echo "count not 100" fi read -p "press enter continue" nothing i tried many other ways of using if structure seems none works use dos2unix utility convert text file created on windows correct format linux. see this wikipedia page more details. install if necessary: $ sudo apt-get install dos2unix <snip> setting dos2unix (5.3.1-1) ... $ run on script: $ dos2unix if.sh dos2unix: converting file if.sh unix format ... $

How to insert Ruby array items into SQLite? -

i want execute insert strings within ruby file has following array: names_arr = ["jack", "susan", "peter"] in same ruby file, i've required sqlite3 gem , have code: names_arr.each |each_name| db.execute('insert users (name) values ("#{each_name}");') end i expecting in "users" table: id name 1 jack 2 susan 3 peter instead, i'm getting this: id name 1 #{each_name} 2 #{each_name} 3 #{each_name} it's clear i'm not interpolating properly, i've tried lot of different things , can't figure out i'm wrong. i using sqlite3 , ruby. you have several problems in code: names_arr.each |each_name| db.execute('insert users (name) values ("#{each_name}");') end you're trying use ruby's string interpolation inside single quoted string string interpolation works in double quoted strings (and heredocs, %q{...} strings, regex literals, ...).

f# - Is FSharp.Data.DesignTime .NET 4.5 only? -

i'm using fsharp.data.1.1.10 in .net 4.0 project, , when add fsharp.data nuget, creates packages\fsharp.data.1.1.10\lib\net40 directory puts fsharp.data.dll , fsharp.data.designtime.dll . according telerik justdecompile, fsharp.data.dll .net 4.0 dll, fsharp.data.designtime.dll .net 4.5 dll though resides in net40 subdirectory. so, fsharp.data.designtime .net 4.5 only, or bug? yes, fsharp.data.designtime .net 4.5, doesn't mean projects have .net 4.5 also, it's design time component, , shouldn't reference it, fsharp.data.dll edit: in fsharp.data 1.1.x designtime dll being added mistake when referencing nuget package, in 2.x fixed

Letters to Numbers with C++ chars -

say have char extracted string ( str.at(i) ), how convert char number such a=0, b=1, c=2... z=25? thanx in advance assuming string in a-z range, char_value - 'a' . this assumes letters consecutive. 'b' == 'a' + 1 , 'c' == 'a' + 2 , etc. in ascii, assumption correct.

java - Distance between two coordinates -

i trying distance between coordinates, , doesn't seem work reason. grateful if help! output: the distance point point b 0.0. distance point point b 0.0. distance point point b 0.0. distance point point b 0.0. distance p1 p2 4.242640687119285 distance p1 p3 12.727922061357855 package gc01; public class point { private final double x; private final double y; private double distance; public point(){ x=0.0; y=0.0; } public point(double x, double y) { this.x=x; this.y=y; } public double distanceto(point a, point b) { double dx = a.x - b.x; double dy = a.y - b.y; distance = math.sqrt(dx*dx + dy*dy); return distance; } public string tostring(){ return "the distance point point b " + distance +"."; } public static void main(string[] args){ point p0 = new point(); point p1 = new point(0.0,0.0); point p2 = new point(3.0

simulating an SD card in Android emulator for Camera pictures -

hey guys mimicking camera on android emulator webcam. ask insert sd card before using camera. wondering if possible create 'virtual' in sense sd card camera can work? under emulator options specify sd storage area of 20mb not sure why not working? here how accessing camera: ..listener...onclick...{ intent takepictureintent = new intent(mediastore.action_image_capture); startactivityforresult(takepictureintent, camera_pic_request); } public void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == camera_pic_request) { if (resultcode == result_ok) { bitmap bm = bitmapfactory.decodefile(imagepath); imageview image = (imageview) findviewbyid(r.id.gimg1); image.setimagebitmap(bm); } else if (resultcode == result_canceled){ } } ..... } thoughts suggestions appreciate! david update: i had update 20mb higher storage

javascript - Search and copy text from Source page -

i wondering how possible search , copy code webpage source using javascript. for example : <td>valid date: </td> <td style="padding-right: 10px;">11/2013</td> so need grap text "11/2013" making automated tool using phantomjs automate work me. finished script in connecting webpage , accessing webpages need. how search , grap info , assign them array. p.s. have full webpage source assigned variable

bluetooth - How can I permanently pair a Wii Balance Board with an Ubuntu PC? -

i have wii balance board, i've written weight-measuring script ( detailed here ). however, can't board pair computer. i don't want have put in sync mode every time, it's time-consuming, won't accept pin code enter. tried "000000" , host's address in reverse hex (if host 00:11:22:33:44:55 , tried pin "$554433221100" bluez, same board's address, neither worked). using built-in ubuntu bluetooth wizard fails horribly, though, as, no matter pin specify, generates random one, asks me enter , fails half second later. tried above bt-device utility. has managed pair balance board (or wiimote) ubuntu (or anything/find pin, really)? it turns out bluez 4.101 doesn't support hex pin codes. patching appropriate code , recompiling worked.

sql - how can we delete one value out of two values from table? -

is possible this?i have table 2 rows , 1 column.both rows have same value.no primary key there.can delete 1 row? here's 1 way row_number() , common table expression : with cte ( select *, row_number() on (partition id order id) rn yourtable) delete cte rn = 1; sql fiddle demo

HTML5 video/audio player on mobile Safari (iOS 7 & iOS 10) excludes cookies -

i have noticed html5 video/audio player (applecoremedia) on mobile safari on ios 7 excludes cookies, first-party cookies. not sessions cookies included in http-header. makes impossible relay on cookie authorization when playing video clip in mobile safari on ios 7. all cookies included correctly running ios 6 on ios 7 no cookies included in http-header of applecoremedia. can 1 else confirm issue on ios 7? steps reproduce is: create cookie on web page. play html5 video clip on same web page using mobile safari in ios 7. check server logs applecoremedia , cookie. update 2016-09-20: video player in ios 10 (applecoremedia) not able read session cookies. cookies set expire date readable video player. for ios10, if respond 403 forbidden, applecoremedia somehow try again time missing cookies. if have code redirects login page when session cookie missing, video not work on ios 10.

php - $wpdb->get_results($query); Returns NULL with variable $query - Same query works hardcoded -

i've been trying debug script month. rest of program built , 1 thing not work. issue $query variable, returns null unless hard code - isn't possible search form. i've tried adding '\n', i've tried putting in returns, i've changed " ' beginning. i've tested rest of code outside of block , works. i've run tests on block can see commented out echo statements below. test fine. $query string built function returns correct data when hard coded or in database browser. i'm stuck! please. [code snippet] if(isset($_post['submit'])) { // define list of fields $fields = array('lastname', 'firstname', 'dob', 'city', 'telephone', 'email', 'user_id'); $conditions = array(); // loop through defined fields foreach($fields $field){ //echo "field ".$field."\n"; // if field set , not empty if(isset($_post[$fie

html - `#parent span` style is overriding the `.child span` style -

i have case have .menu within #header , when accessed .menu 's children via css selector .menu a , using #header a instead. i expecting .menu a override #header a closer a element. why isn't happening? i'm assuming has being class compared id based on example below. in example, there way override #red span css within .blue span without otherwise restricting parent style? by "good way" suppose mean flexible. example .blue element created php framework used in many places (possibly not within id styled parent element, or possibly within parent styled on different id). here example . except #green still red: html: <div id="red"> <span>red</span> <div class="blue"> <span>blue(class) - should blue</span> </div> <div id="green"> <span>green(id) - should green</span> </div> <div class="green">

perl - Why is '\t', returned from "backtick" call, expanded to tabulator? What all characters are expanded? -

if run simple perl script (on linux, bash), $to_run = q(echo '\t'); $res = `$to_run`; print $res i expect \t printed - is, backslash character , "t" character. indeed, if run in bash echo '\t' i see \t . however, perl script prints tabulator. why tabulator expanded in $res ? characters expanded that? and, importantly, how stop expanding? backticks evaluated using /bin/sh , regardless of whatever shell may want use, , it's posix xsi-conformant version of echo implemented sh that's converting \t tab. try out running echo '\t' inside sh . for avoiding behavior, trying using printf '%s\n' instead of echo in backticks.

android - Understanding Layouts dimensioning -

Image
i'm coming android after lonnng break , feel i've lost modjo it. i'm trying build day-planning relative layout populate events later. here content view of activity : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <scrollview android:layout_width="600dp" android:layout_height="fill_parent" > <relativelayout android:id="@+id/day_main_relative" android:layout_width="match_parent" android:layout_height="wrap_content" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" >

ruby on rails - Why am I getting an error when I bundle install without using "sudo" -

recently have noticed trying bundle without "sudo" command results in like: could not find gem 'faye (~> 1.0.0) ruby' in gems available on machine. but using sudo bundle install works champ. why computer doing this? note i don't know information provide, feel free request anything. with "sudo" command executed root user. when executed this, includes environment variables set differently, because needed in context of root user. this might what's happening here, since possibly path variable (or other environment variable) different in sudo-environment, can find gem looking for. while in normal execution environment, can not find it, since path set differently. hope helps :)

java - loan payment calculator, how to implement multiple methods. Trouble developing method to interact with main method -

the idea of assignment have multiple methods interact each other. asking user loan amount, interest rate , duration of loan. program supposed have 1 method calculates monthly rate, 1 method calculates , returns monthly payment , method print loan statement (amt borrowed,annual interest rate, number of months, , monthly payment). i not receiving errors in editor program asks 3 inputs user , not print loan statement. suggestions? public class carloan { /** * @param args command line arguments */ public static void main(string[] args) { // declare variables main method double loanamount;//double value loan amount double annualinterestrate;//double value interest rate int numberofmonths;//int value number of months double monthlypayment; scanner keyboard = new scanner(system.in); system.out.println("please enter amount of loan."); loanamount = keyboard.nextdouble(); system.out.println("please enter annual interest rate de

What report will be produced with these SAS codes -

given sas data set work.one: x y z - - -- 1 27 1 33 1 b 45 2 52 2 b 69 3 b 70 4 82 4 c 91 the following sas program submitted: data work.two; set work.one; x y; if first.y; run; proc print data=work.two noobs; run; i don't understand first. , last. after statement 2 variables. if it's y; if first.y; know what's going on in data step. now, seems bit more complicated. two contain records one first record each new value of y , or each new value of x (if additional records). so, first record 1 a , 1 b , 2 a , 2 b , 3 b , 4 a , , 4 c . basically, in compound by statement, each time variable's value changes, variable and every variable right in statement sets first. 1 (true).

Displaying custom fonts in SVG for iOS Chrome and Safari -

i'm using svg custom fonts google, i'm hosting myself. here's the svg file following code: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="430" height="590"> <defs> <style type="text/css"><![cdata[ @font-face { font-family: 'fjalla'; src: url('http://build-podcast.com/fonts/fjalla.eot'); src: url('http://build-podcast.com/fonts/fjalla.eot?#iefix') format('embedded-opentype'), url('http://build-podcast.com/fonts/fjalla.woff') format('woff'), url('http://build-podcast.com/fonts/fjalla.ttf') format('truetype'), url('http://build-podcast.com/fonts/fjalla.svg#fjalla') format('svg'); font-weight: normal; font-style: normal; } text { font-family: fjalla, sans-serif; font-weight: bold; fill: #4b5568; } ]]> &