Saturday 15 September 2012

colors - pdfbox table header colouring not working properly -



colors - pdfbox table header colouring not working properly -

i usind pdfbox , trying colour header of table; had done table drawing correctly using tutorial ' http://fahdshariff.blogspot.in/2010/10/creating-tables-with-pdfbox.html'

the code follows

//draw rows float nexty = y ; (int = 0; <= rows; i++) { contentstream.drawline(margin, nexty, margin+tablewidth, nexty); nexty-= rowheight; } //draw columns float nextx = margin; (int = 0; <= cols; i++) { contentstream.drawline(nextx, y, nextx, y-tableheight); nextx += (colwidths != null) ? colwidths[i] : colwidth; }

i got code colouring follows:

contentstream.setnonstrokingcolor( color.red ); contentstream.fillrect( 10, 10, 100, 100 );

i tried set not working needed. need colour table header only. how can acheive that. please help me guys!!

table colors pdfbox

php - Is it efficient to change cookies and save them into database per request? -



php - Is it efficient to change cookies and save them into database per request? -

i utilize dynamically changing cookies in order maintain user logged in. illustrate, after successful login, login command function saves user session info rememberme table , creates cookies info. info kept in server user_id, key , expiration_date. if user having valid cookie (namely user_id, key , expire time within cookies match info stored in rememberme table) tries access user-only accesible page, server creates new cookie different key, , default-period expiration time , updates info within rememberme table. cycle goes on way. so, user valid cookie maintains logged in , extends session expiration time every request page. question is, how much efficient implement such session management style. create burden server , database?

fyi, utilize php/mysql in amazon ec2 micro windows server development.

why not utilize php sessions? designed tasks this.

http://php.net/manual/en/book.session.php

php mysql session cookies

android - Sending an email using javamail without user interaction - java.net.ConnectException -



android - Sending an email using javamail without user interaction - java.net.ConnectException -

hello attempting create android application sends emails without need user interaction (the user informed of emails beingness sent). using javamail: http://code.google.com/p/javamail-android/downloads/list , next example: http://www.jondev.net/articles/sending_emails_without_user_intervention_%28no_intents%29_in_android getting next errors:

10-07 09:23:10.373: e/mailapp(9173): not send email 10-07 09:23:10.373: e/mailapp(9173): javax.mail.messagingexception: not connect smtp host: localhost, port: 25; 10-07 09:23:10.373: e/mailapp(9173): nested exception is: 10-07 09:23:10.373: e/mailapp(9173): java.net.connectexception: failed connect localhost/127.0.0.1 (port 25): connect failed: econnrefused (connection refused) 10-07 09:23:10.373: e/mailapp(9173): @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:1391) 10-07 09:23:10.373: e/mailapp(9173): @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:412)

code sending email:

thread emailsendthread = new thread(new runnable() { @override public void run() { while (true) { seek { thread.sleep(100); } grab (interruptedexception e1) { // todo auto-generated grab block e1.printstacktrace(); } if (sendemail == true) { seek { mailsender m = new mailsender("firstname.surname@gmail.com", "password"); string[] toarr = {"example@email.com"}; m.setto(toarr); m.setfrom("firstname.surname@gmail.com"); m.setsubject("this email sent using mail service javamail wrapper android device."); m.setbody("email body."); seek { m.send(); if(m.send()) { toast.maketext(mainactivity.this, "email sent successfully.", toast.length_long).show(); } else { toast.maketext(mainactivity.this, "email not sent.", toast.length_long).show(); } } catch(exception e) { //toast.maketext(mailapp.this, "there problem sending email.", toast.length_long).show(); log.e("mailapp", "could not send email", e); } } grab (exception e) { log.e("email", "error", e); } seek { thread.sleep(100); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } sendemail = false; } } } });

i have substituted email username , password illustration ones in code. send email execute sendemail = true;

you can send mails using smtp server. if smtp server not @ device running application, need provide address of smtp can send email. expected application not send email if smtp details not correct.

android email gmail javamail javax.mail

javascript - 'unsafe-eval' on chrome extension -



javascript - 'unsafe-eval' on chrome extension -

i trying run following:

chrome.tabs.oncreated.addlistener(function (tab){ if (tab.url.indexof(".salesforce.com/") != -1 || tab.url.indexof(".force.com/") != -1) { chrome.tabs.executescript(tab.id, { "file": "loadscript.js" }, function () { console.log("script executed .. "); }); } else { var wrongtab = chrome.i18n.getmessage("wrongtab"); console.log(wrongtab); alert(wrongtab); } });

which should (in theory), on page load run loadscript.js file.... loadscript.js file follows, should append file running page, not background page @ moment:

/* create scriipt element in head of html , set /soap/ajax/31.0/connection.js in src */ var connectjsurl = "/connection.js"; function loadscript(url, callback) { var head = document.getelementsbytagname("head")[0]; var script = document.createelement("script"); script.src = url; var done = false; script.onload = script.onreadystatechange = function() { if (!done && (!this.readystate || this.readystate == "loaded" || this.readystate == "complete")) { done = true; callback(); script.onload = script.onreadystatechange = null; head.removechild(script); } }; head.appendchild(script); } loadscript(connectjsurl, function() { console.log("script confirmed...") }); /* check see if file have been appended correctly , works correctly */ var jsfile = "chrome-extension://" + window.location.host + connectjsurl; var req = (window.xmlhttprequest) ? new xmlhttprequest() : new activexobject("microsoft.xmlhttp"); if (req == null) { console.log("error: xmlhttprequest failed initiate."); }; req.onload = function() { seek { eval(req.responsetext); } grab (e) { console.log("there error in script file."); } }; seek { req.open("get", jsfile, true); req.send(null); } grab (e) { console.log("error retrieving info httpreq. browsers take cross-domain request http."); };

i still newbie chrome extensions , .js excuse me if have made stupid error :)

all getting following: refused evaluate string javascript because 'unsafe-eval' not allowed source of script in next content security policy directive: "script-src 'self' chrome-extension-resource:".

to prevent cross site scripting google has blocked eval function.

to solve add together code manifest.json

"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"`,

please comment if need farther explanation

javascript google-chrome-extension

graph databases - How to realize a nested tree in Neo4j? -



graph databases - How to realize a nested tree in Neo4j? -

i getting started neo4j , graph databases , wondering if nested hierarchical trees utilize case neo4j. mutual illustration nested set of comments. example:

- article - comment 1 on article - comment 2 on comment 1 - comment 3 on comment 1 - comment 4 on comment 3 - comment 5 on article

as understand it, article , comments each nodes. , each comment have parent-child relationship. getting direct comments on article (1 , 5) easy. how retrieving whole set?

please excuse utilize of layman terms. figured improve way trying utilize appropriate words while confusing everyone.

well, because trees graphs using graph database store tree seems exclusively appropriate me. perform best depend on info access patterns, trees specialization of graphs.

yes, in case "elements in tree" nodes, , "nesting" relationships. here's how might mock example:

create (root:article {label: "article"}), (c1:comment {label: "comment 1"}), (c1a:comment {label: "comment 2 on comment 1"}), (c1b:comment {label: "comment 3 on comment 1"}), (c1b1:comment {label: "comment 4 on comment 3"}), (c2:comment {label: "comment 5 on article"}), (root)<-[:reply]-(c1), (c1)<-[:reply]-(c1a), (c1)<-[:reply]-(c1b), (c1b)<-[:reply]-(c1b1), (root)<-[:reply]-(c2);

this creates bunch of nodes , relationships, mimicking construction provided. here i've chosen utilize :reply connect things.

now, "getting everything" means traversing of :reply relationships created:

match p=(a:article {label: "article"})<-[:reply*1..]-(otherthing) nodes(p) nodes homecoming nodes[length(nodes)-2] inresponseto, nodes[length(nodes)-1] commentorreply;

what query traverse number of :reply links (starting root "article"). looks @ nodes in path, , returns lastly item (commentorreply) , in response (the sec lastly item).

the result looks this:

+-------------------------------------------------------------------------------------+ | inresponseto | commentorreply | +-------------------------------------------------------------------------------------+ | node[18]{label:"article"} | node[19]{label:"comment 1"} | | node[19]{label:"comment 1"} | node[20]{label:"comment 2 on comment 1"} | | node[19]{label:"comment 1"} | node[21]{label:"comment 3 on comment 1"} | | node[21]{label:"comment 3 on comment 1"} | node[22]{label:"comment 4 on comment 3"} | | node[18]{label:"article"} | node[23]{label:"comment 5 on article"} | +-------------------------------------------------------------------------------------+

so that's how traverse entire tree.

edit - it's worth, "variable length path matching", in query above bit: <-[:reply*1..]- me 1 of top 3 selling points graph database. it's exactly graph dbs create easy, of other alternatives relational create tortuously painful exercise. if need sort of thing (like here, assembling entire tree) claim argues graph db because you're using in area of fundamental strength.

neo4j graph-databases

javascript - AngularJs filter:$viewValue is not handling html escaping -



javascript - AngularJs filter:$viewValue is not handling html escaping -

if type in box, you'll see:

alabama missing text in bracket alaska fine arizona displays fine 1 time selected shows &lt; , &gt;

any thought on how prevent filter sanitizing or (best) utilize proper encoding , decoding of html characters?

http://jsfiddle.net/zjpwe/64/

<div class="container"> <div ng-controller="mainctrl" class="row-fluid"> <form class="row-fluid"> <div class="container-fluid"> <input type="text" ng-model="selected" typeahead="state state in states | filter:$viewvalue" /> </div> </form> </div> </div>

...

angular.module('myapp', ['ui.bootstrap']) .controller("mainctrl", function ($scope) { $scope.selected = ''; $scope.states = ['alabama <where this>', 'alaska [this ok]', 'arizona &lt;select me&gt;']; });

one not-so-beautiful way solve issue apply filters sanitize array elements, , unsanitize them when selected.

http://jsfiddle.net/pwu0r81m/

$scope.$watch('selected', function() { $scope.selected = $scope.selected.replace(new regexp('&lt;', 'g'), '<').replace(new regexp('&gt;', 'g'), '>'); }); angular.module('myapp') .filter('sanitizer', function(){ homecoming function (items) { var filtered = []; angular.foreach(items, function(item){ filtered.push(item.replace(new regexp('<', 'g'), '&lt;').replace(new regexp(">", 'g'), "&gt;")); }); homecoming filtered; } });

javascript angularjs

php - Script does not work, shows no errors -



php - Script does not work, shows no errors -

i made little script 'cache' copies of websites, , far can tell appears coded fine, when run in browser, not work , shows no errors.

my code:

<?php //display errors please error_reporting(e_all); ini_set('display_errors', 1); //get random string $length = 5; $string = ""; $characters = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789"; //thanks code stackoverflow while ($length > 0) { $string .= $characters[mt_rand(0,strlen($characters)-1)]; $length -= 1; } $random = $string //get url request if(isset($_get['link'])) { $link = $_get['link']; $data = file_get_contents("http://$link"); //send info html file file_put_contents("/cache/$random.html","$data"); echo "cached successfully.<br>link: http://example.com/cache/$random.html"; } ?>

there syntax error in code posted,

$random = $string

should be

$random = $string;

its thought check php files errors after edit them. 1 way (if on linux/unix system) run php command

php -l filename.php

you utilize online compiler (what did code)

http://writecodeonline.com/php/

php

html - How to preserve spaces in text input field when echoing php variable -



html - How to preserve spaces in text input field when echoing php variable -

i've got:

<input type="text" name="location" value=<?php echo $cand['location']; ?>>

when $cand['location'] "east london", textbox says "east" , ignores after first space.

how can have text input hold echoed strings spaces in it?

solved:

<input type="text" name="location" value="<?php echo $cand['location']; ?>">

php html

MSP430 Interrupt routines with msp-gcc won't compile -



MSP430 Interrupt routines with msp-gcc won't compile -

i using newest ccs msp-gcc compiler. next code

#pragma vector=usci_a1_vector __interrupt void usci_a1_isr(void) {...isr}

which newest officially supported method ti of declaring isr-s not working, next complier messages:

warning: ignoring #pragma vector [-wunknown-pragmas] #pragma vector=usci_a1_vector ^ error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' __interrupt void usci_a1_isr(void)

i have tried different methods, like:

interrupt(usci_a1_vector) usci_a1_isr(void) { //code goes here}

which gives error:

c:/ti/ccsv6/ccs_base/msp430/include_gcc/msp430f5529.h:5328:33: error: expected declaration specifiers or '...' before '(' token #define usci_a1_vector (47) /* 0xffdc usci a1 receive/transmit */ ^ ../uart_printf.c:40:11: note: in expansion of macro 'usci_a1_vector' interrupt(usci_a1_vector) usci_a1_isr(void) ^

this seems work though:

__attribute__((interrupt(usci_a1_vector))) void usci_a1_isr(void){ //code goes here }

what missing here?

there no c standard interrupt routine declaration (a real pitty). each compiler has it's own way it.

ti relased redhat msp430 gcc lastly month , had no time take it. old mspgcc branch lastly illustration should valid.

mspgcc provides include file improve compiler interop:

#include <isr_compat.h> isr(usci_a1, usci_a1_isr) { // code goes here }

important: remove '_vector' tail isr name

take @ isr_compat.h file. designed work compilers on market. maybe it's thought borrow project, if there's nil similar on compiler suite.

gcc interrupt msp430

stored procedures - MySQL Error - understanding it -



stored procedures - MySQL Error - understanding it -

has seen sort of error , means?

i have stored procedure running cursor through 502 records , passes through loop, inserts table, in essence re-create , paste entering 239 of these records , error

1265 info truncated column 'v_tagmembersf' @ row 5 1265 info truncated column 'v_tagmembersf' @ row 6 1265 info truncated column 'v_tagmembersf' @ row 7 1265 info truncated column 'v_tagmembersf' @ row 10 1265 info truncated column 'v_tagmembersf' @ row 11 1265 info truncated column 'v_tagmembersf' @ row 12 1265 info truncated column 'v_tagmembersf' @ row 13 1265 info truncated column 'v_tagmembersf' @ row 14

the stored procedure cursor

open cur1; -- start loop -- datasetloop: loop -- values of each column our variables declared in stored procedure fetch cur1 v_datetime, v_val, v_numindex, v_tagname, v_tagindex, v_tagmembersf, v_tagmemberminval, v_tagmembermaxval; if v_tagmembersf = null set v_tagmembersf = 1; end if; -- check if v_val null first -- insert new_tempdata.looper (incremented, tagnameinserted) values (v_datetime, v_tagname); commit; if done leave datasetloop; end if; end loop datasetloop; close cur1; insert new_tempdata.looper (incremented, tagnameinserted) values (123456789,'id29sp'); end

does have thought might doing?

this error mean new_tempdata.looper table cant store info trying insert. check length of fields incremented , tagnameinserted, must same v_datetime & v_tagname;

mysql stored-procedures insert cursor truncate

c++ - std::bind(): bind lambda with rvalue reference as argument -



c++ - std::bind(): bind lambda with rvalue reference as argument -

i playing std::bind , rvalue references, still don't figure out how works, have next code:

class dog { public: dog(const string &name) : name_(name) { cout << "dog::ctor" << endl; } string getname() { homecoming name_; } private: string name_; }; auto bind_fun = bind([](dog &&d){ cout << d.getname() << endl; }, dog("dogabc")); bind_fun();

when commenting out bind_fun(), or if lambda takes dog& rather dog&&, code run fine expected output. when bind_fun() left uncommented, next compile time error:

test3.cpp:109:3: error: no matching function phone call object of type 'std::__1::__bind<<lambda @ test3.cpp:108:17>, dog>' f(); ^ /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1749:9: note: candidate template ignored: substitution failure [with _args = <>]: implicit instantiation of undefined template 'std::__1::__bind_return<<lambda @ test3.cpp:108:17>, std::__1::tuple<dog>, std::__1::tuple<>, false>' operator()(_args&& ...__args) ^ /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1758:9: note: candidate template ignored: substitution failure [with _args = <>]: implicit instantiation of undefined template 'std::__1::__bind_return<const <lambda @ test3.cpp:108:17>, const std::__1::tuple<dog>, std::__1::tuple<>, false>' operator()(_args&& ...__args) const ^ 1 error generated.

my questions are:

why bind_fun() can not called(won't compile) when lambda takes rvalue reference? what difference between using reference , rvalue reference arguments lambda here?

the specification std::bind rather dense. in brief, plain bound argument (not bind expression, not reference_wrapper, , not placeholder) passed bound function std::forward<vi>(tid) vi tid cv &, cv cv-qualifiers of phone call wrapper, tid type decay_t<ti>, ti type passed bind, , tid "an lvalue of type tid constructed std::forward<ti>(ti)", , ti argument passed bind.

applying call, see ti dog , ti dog("dogabc"). tid dog, , vi cv dog &, means std::forward<vi>(tid) lvalue, , compiler complains because lambda takes rvalue reference parameter, , rvalue reference parameter cannot bind lvalue.

c++ c++11 lambda stdbind

routes - Laravel / Host Setup for Multi-TLD -



routes - Laravel / Host Setup for Multi-TLD -

basically ive written out 5 times, still dont know how ask, here goes...

i want 2 domains, example.net , example.info have registered. want them point 1 application i'm building, utilize laravel route 2 different domains there own pages... here i've tried , problems i've ran into...

** #1 domain forwards **

uploaded app example.net , forwarded .info domain .net domain. , tried...

route::group(array('domain' => 'example.info'), function() { route::get('/', function(){ homecoming 'info page!'; }); }); route::group(array('domain' => 'example.net'), function() { route::get('/', function(){ homecoming 'net page!'; }); }); route::get('/', 'homecontroller@index');

problems

laravel domain routing doesnt seem recognise domains without subdomains, eg '{subdomain}.example.net' work, 'example.net' , 'example.info' wont?

when domain forwarding, http_host show .net , not .info, cant utilize if or switch statement in routes file

alternative soloution

the soloution can think of utilize host's shared hosting setup have 2 individual sites, each appropriate domains pointing them , set ide upload both sites?

surely there improve way tho?

any help great, im pretty new if maintain simple please, thanks... jimmy

this seems work php artisan routes looks bit wrong.

http://ryantablada.com/post/multi-tld-routing-in-laravel

i having problem having code pick lastly tld in list. this, although not perfect, seems best reply have found far.

laravel routes hosting multiple-domains tld

javascript - Hide dynamic google map markers with checkbox selection -



javascript - Hide dynamic google map markers with checkbox selection -

i attempting create filter dynamic markers on google map. user selects markers filter various check box selections relating each marker category.

i advice on current code hoping quite close. aware there number of similar questions on here although seem follow xml google map tutorial not next , have taken json / $.each route rather generating xml , loops set markers position.

from reading related questions, have tried create array groups markers category , based on check boxes selected should hide or unhide these markers.

currently when run code checkboxes frozen on check , not uncheck. when remove onclick html issue resolved, although doesn't phone call funtion.

i javascript error togglegroup function not defined. don't understand why supposed defined checkbox id.

js

var customicons = []; customicons["1"] = 'img/32x32/border_edits/automotive.jpg'; customicons["2"] = 'img/32x32/border_edits/barpub.jpg'; customicons["3"] = 'img/32x32/border_edits/cinema.jpg'; var markergroups = { "1": [], "2": [], "3": [] }; $(document).on("pageshow","#map-page",function(){ if (navigator.geolocation) { navigator.geolocation.getcurrentposition(success); } else { error('geo location not supported'); } function success(position) { var coords = new google.maps.latlng(position.coords.latitude, position.coords.longitude); var options = { zoom: 16, center: coords, maptypecontrol: false, navigationcontroloptions: { style: google.maps.navigationcontrolstyle.small }, disabledefaultui:true, zoomcontrol:true, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid("map"), options); var marker = new google.maps.marker({ position: coords, icon: 'img/gps_marker.jpg', map: map, }); $.post( "getrow.php?getjson", function( info ) { var info = json.parse(data); console.log(data); $.each(data, function(index, value){ var id = value.site_id; var type = value.prime_category; var point = new google.maps.latlng(value.lat, value.lon); var name = value.site_name; var address = value.site_address; var icon = customicons[type] || {}; var marker = createmarker(point, name, address, type, id); }); }); function createmarker(point, name, address, type, id) { var marker = new google.maps.marker({ map: map, position: point, icon: customicons[type], id: id }); markergroups[type].push(marker); var html = "<b>" + name + "</b> <br/>" + address; google.maps.event.addlistener(marker, 'click', function() { infowindow.setcontent(html); infowindow.open(map, marker); }); homecoming marker; } function togglegroup(type){ if($('#'+type).is(':checked')){ for(var i=0;i<markergroups[type].length;i++){ markergroups[type][i].setvisible(true); } } else{ for(var i=0;i<markergroups[type].length;i++){ markergroups[type][i].setvisible(false); } } } } });

html

i have checkboxes in jquery mobile dialog page linked in header of map page

<div data-role="page" id="map-page"> <div data-role="header" id="appheader" data-position="fixed"> <h1> <a href="#preferences" data-role="button" class="ui-btn-right" data-rel="dialog" data-icon="gear" data-iconpos="notext" data-inline="true"></a> </h1> </div> <div id="appcontent"> <div id="map"> </div> </div> </div> <div data-role="page" id="preferences"> <div data-role="header"> <h1>filter</h1> </div> <div data-role="content"> <div class="ui-grid-a"> <div class="ui-block-a"> <label for="1">automotive</label> <input type="checkbox" id="1" onclick="togglegroup(this.id)" checked> <label for="3">cinema</label> <input type="checkbox" id="3" onclick="togglegroup(this.id)" checked> <label for="5">dining out</label> <input type="checkbox" id="5" onclick="togglegroup(this.id)" checked> </div> </div> </div> </div>

css

html, body { margin: 0; width: 100%; height: 100%; } #appcontent{ width: 100%; height: 100%; } #map{ position: absolute; top: 40px; left: 0px; right: 0px; bottom: 0px; } #appheader{ position: absolute; top: 0px; left: 0px; right: 0px; height: 40px; background-color: #00a2e8; }

any help , advice appreciated.

i managed resolve problem. rather phone call function onclick of each checkbox in html. used $(":checkbox").change phone call function , utilize this.id define marker's type. @clayton leis suggestion.

js

function createmarker(point, name, address, type, id) { var marker = new google.maps.marker({ map: map, position: point, icon: customicons[type], id: id }); markergroups[type].push(marker); var html = "<b>" + name + "</b> <br/>" + address; google.maps.event.addlistener(marker, 'click', function() { infowindow.setcontent(html); infowindow.open(map, marker); }); homecoming marker; } $(":checkbox").change(function togglegroup(){ var type = this.id; if($('#'+type).is(':checked')){ for(var i=0;i<markergroups[type].length;i++){ markergroups[type][i].setvisible(true); } } else{ for(var i=0;i<markergroups[type].length;i++){ markergroups[type][i].setvisible(false); } } });

one remaining problem have checkboxes on dialog page using jquery mobile in html. when page closed refreshes html resets checkboxes. seems known problem dialog pages in jquery mobile when set checkbox code in map page code above works perfectly. help everyone.

javascript jquery html google-maps google-maps-api-3

ios - iOS8 : Custom Keyboard - Open Camera with AVCaptureVideoPreviewLayer in the background of keyboard -



ios - iOS8 : Custom Keyboard - Open Camera with AVCaptureVideoPreviewLayer in the background of keyboard -

it posible open avcapturevideopreviewlayer in background of ios8 custom keyboard ? tried code

avcapturesession *session = [[avcapturesession alloc] init]; avcapturedevice *videodevice = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; if (videodevice) { nserror *error; avcapturedeviceinput *videoinput = [avcapturedeviceinput deviceinputwithdevice:videodevice error:&error]; if (!error) { if ([session canaddinput:videoinput]) { [session addinput:videoinput]; avcapturevideopreviewlayer *previewlayer = [avcapturevideopreviewlayer layerwithsession:session]; previewlayer.frame = self.bounds; nslog(@"open %@",nsstringfromcgrect(self.bounds)); [self.camview.layer addsublayer:previewlayer]; [session startrunning]; } } }

it inquire permission utilize photographic camera not open photographic camera in background of keyboard. please help me. thanks.

ios keyboard ios8 ios8-extension

java - How to make Rss News Reader application in android ....? -



java - How to make Rss News Reader application in android ....? -

i have sample code parsing info xml , in xml parsing sax,doc,and xml pull parser best xml parser ,what json parser...? , how parse news feeds through json parser.please reply examples

public class mainactivity1 extends activity { private string finalurl="http://downloads.bbc.co.uk/podcasts/worldservice/globalnews/rss.xml"; private handlexml obj; private textview title,link,description; private linearlayout mweatherinfoslayout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent = getintent(); finalurl = intent.getstringextra("url"); setcontentview(r.layout.activity_main_activity1); mweatherinfoslayout = (linearlayout) findviewbyid(r.id.weather_infos1); fetch(); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); homecoming true; } public void fetch(){ obj = new handlexml(finalurl); obj.fetchxml(); mweatherinfoslayout.removeallviews(); while(obj.parsingcomplete) { if(obj.gotit) { final linearlayout forecastinfolayout = (linearlayout) getlayoutinflater().inflate(r.layout.feedlist, null); final textview tvweather1 = (textview) forecastinfolayout.findviewbyid(r.id.textview_forecast_info1); final textview tvweather2 = (textview) forecastinfolayout.findviewbyid(r.id.textview_forecast_info2); final textview tvweather3 = (textview) forecastinfolayout.findviewbyid(r.id.textview_forecast_info3); final textview tvweather4 = (textview) forecastinfolayout.findviewbyid(r.id.textview_forecast_info4); tvweather1.settext(obj.gettitle()); tvweather4.settext(obj.getpubdate()); tvweather2.settext(obj.getlink()); string string = obj.getdescription(); string[] parts = string.split("<"); string part1 = parts[0]; tvweather3.settext(part1); mweatherinfoslayout.addview(forecastinfolayout); obj.setgotit(); } } } }

change handlexml class accordingly.

public class handlexml { private string title = "title"; private string link = "link"; private string description = "description"; private string urlstring = null; private xmlpullparserfactory xmlfactoryobject; public volatile boolean parsingcomplete = true; public handlexml(string url){ this.urlstring = url; } public string gettitle(){ homecoming title; } public string getlink(){ homecoming link; } public string getdescription(){ homecoming description; } public void parsexmlandstoreit(xmlpullparser myparser) { int event; string text=null; seek { event = myparser.geteventtype(); while (event != xmlpullparser.end_document) { string name=myparser.getname(); switch (event){ case xmlpullparser.start_tag: break; case xmlpullparser.text: text = myparser.gettext(); break; case xmlpullparser.end_tag: if(name.equals("title")){ title = text; } else if(name.equals("link")){ link = text; } else if(name.equals("description")){ description = text; } else{ } break; } event = myparser.next(); } parsingcomplete = false; } grab (exception e) { e.printstacktrace(); } } public void fetchxml(){ thread thread = new thread(new runnable(){ @override public void run() { seek { url url = new url(urlstring); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setreadtimeout(10000 /* milliseconds */); conn.setconnecttimeout(15000 /* milliseconds */); conn.setrequestmethod("get"); conn.setdoinput(true); // starts query conn.connect(); inputstream stream = conn.getinputstream(); xmlfactoryobject = xmlpullparserfactory.newinstance(); xmlpullparser myparser = xmlfactoryobject.newpullparser(); myparser.setfeature(xmlpullparser.feature_process_namespaces, false); myparser.setinput(stream, null); parsexmlandstoreit(myparser); stream.close(); } grab (exception e) { } } }); thread.start(); } }

java android xml json rss

c# - Suppress build warnings for generated code behind of Web Site Visual Studio project -



c# - Suppress build warnings for generated code behind of Web Site Visual Studio project -

is there way suppress specific build warnings generated code behind of web site visual studio project?

because project web site type project (has no project file) not possible globally suppress warnings under properties -> build -> suppress warnings.

and since aspx file beingness dynamically generated/compiled, using #pragma warning disable not possible @ all.

working solution next lurker's help:

<?xml version="1.0"?> <configuration> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="microsoft.csharp.csharpcodeprovider, system, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" warninglevel="4" compileroptions="/nowarn:108,109"> <provideroption name="compilerversion" value="v4.0"/> <provideroption name="warnaserror" value="false"/> </compiler> </compilers> </system.codedom> </configuration>

there section in web.config file options suppressing warnings set. see reply here: set suppress warnings website. there links pages have specific values.

c# asp.net visual-studio msbuild web-site-project

java 8 - Running GWT application on apache tomcat 8 -



java 8 - Running GWT application on apache tomcat 8 -

i'm developing gwt(2.6.0) application eclipse kepler, java 7 & external tomcat server 7. external web server upgraded latest tomcat 8. i'm sure i've changed configurations correctly in eclipse debugging environment, when want start server in debug mode jsp compilation error & can't start debugging. gwt 2.6 compatible tomcat server 8.0? , java 8 back upwards gwt?

1.- yes gwt works tc 8.0

2.- java 8 back upwards available in gwt-3.0.0, in 2015 q1. there patches coming gwt master trunk related this. https://gwt-review.googlesource.com/#/c/9260/

gwt java-8 remote-debugging tomcat8

java - How do I make JNDI names compatible with both GlassFish and WildFly -



java - How do I make JNDI names compatible with both GlassFish and WildFly -

i developing java ee 7 application , have requirement application deployed onto application servers running either glassfish 4.0 or wildfly 8.1.0. issue i've got glassfish , wildfly utilize different formats jndi names can't see how create application compatible both.

in glassfish persistence.xml file references info source jdbc/mydatasouce, in wildfly info source needs java:/jdbc/mydatasource.

the same true classes annotated @resource. in glassfish annotation class using javamail @resource(name = "mail/mymailsession"), deploy onto wildfly need @resource(name = "java:mail/mymailsession").

i know unpack ear , jar files manually edit files such persistence.xml can't classes have been annotated @resource.

is there way can allow complied application deployed onto glassfish , wildfly without maintaining 2 different versions of code? i'm assuming reply lies application specific deployment descriptors can't find examples cover these 2 scenarios.

can point me in right direction please?

you can modify wildfly jndi names , strip undesired prefixes respective jndi names find to the lowest degree mutual denominator in both app servers. next works me glassfish , jboss 7.1. since expect wildfly backwards-compatible jboss in regard, guess it'll work wildfly well.

persistence

inject as:

@persistencecontext(unitname="testpu") private entitymanager entitymanager;

or via ejb-jar.xml:

<persistence-context-ref> <persistence-context-ref-name>entitymanager</persistence-context-ref-name> <persistence-unit-name>testpu</persistence-unit-name> <injection-target> ... </injection-target> </persistence-context-ref>

the corresponding persistence.xml:

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="testpu" transaction-type="jta"> <jta-data-source>datasources/testds</jta-data-source> <class>org.jeeventstore.persistence.jpa.eventstoreentry</class> <properties> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.connection.charset" value="utf-8"/> <property name="eclipselink.logging.level" value="fine"/> <property name="eclipselink.logging.level.sql" value="fine"/> <property name="eclipselink.logging.parameters" value="true"/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> </properties> </persistence-unit> </persistence>

(note simple jta-data-source jndi name)

here's glassfish-resources.xml file used specify derby database on deployment, similar setup can used mysql or postgres.

<resources> <jdbc-resource pool-name="arquillianembeddedderbypool" jndi-name="datasources/testds"/> <jdbc-connection-pool name="arquillianembeddedderbypool" res-type="javax.sql.datasource" datasource-classname="org.apache.derby.jdbc.embeddeddatasource" is-isolation-level-guaranteed="false"> <property name="databasename" value="target/databases/derby"/> <property name="createdatabase" value="create"/> </jdbc-connection-pool> </resources>

and settings jboss standalone.xml:

<datasource jta="true" jndi-name="java:/datasources/testds" pool-name="testds" enabled="true" use-ccm="false"> <connection-url>jdbc:postgresql://localhost/test_db</connection-url> ... </datasource> resources

i have not injected javamail component on glassfish, similar datasoruce settings, might worth seek strip "java:" part @resource annotation well.

@resource(name = "mail/mymailsession")

and configure wildfly such that mail service resource available @ "java:mail/mymailsession" jndi location.

injection via ejb-jar.xml

another alternative manually inject fields via ejb-jar.xml file, , utilize build tool such maven re-create either of ejb-jar-glassfish.xml or ejb-jar-wildfly.xml desired ejb-jar.xml @ assembly time.

in 1 of our projects utilize mixed approach avoid burden xml configuration: configure little number of "provider" beans via ejb-jar.xml inject, e.g., persistence context persistencecontextprovider, , utilize cdi inject persistencecontextprovider ejbs via @ejb, found without farther configuration since reside in same ear.

java java-ee glassfish jndi wildfly

android - Setting ActionBar Elevation on pre-5.0 devices with AppCompat -



android - Setting ActionBar Elevation on pre-5.0 devices with AppCompat -

i want remove shadow actionbar , read this:

getsupportactionbar().setelevation(0)

however didn't seem work on pre 5.0 devices. bug? not using toolbar. regular actionbar library.

if using actionbar (not toolbar) should able remove shadow below using style:

<style name="myapptheme" parent="theme.appcompat.light"> <item name="android:windowcontentoverlay">@null</item> </style>

android android-actionbar material-design appcompat

html - Rewrite Rule htacces searches for css in wrong folder -



html - Rewrite Rule htacces searches for css in wrong folder -

when add together htaccess rewrite rules, paths scr attributes intern use, beingness shifted. first rule css works fine when adds sec variable in link css files , script files called out of wrong folder.

options +followsymlinks rewriteengine on rewritebase /jellyfish_rework/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]*)$ index.php?p=$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]*)/([^/]*)$ index.php?p=$1&t=$2 [l]

in first rule, works perfect. illustration when link 1 variable (the p variable page) works should be. link in case ends beingness http://localhost/jellyfish_rework/blog. , css , scripts beingness called

<link href="css/jellyfish.css" rel="stylesheet" type="text/css"> link css style sheet.

however, when t (stands title) variable filled in, when illustration trying find specific post in blog, whole links change. chrome console output on http://localhost/jellyfish_rework/artikel/lancering-van-onze-nieuwe-website following:

get http://localhost/jellyfish_rework/artikel/css/font-awesome.min.css lancering-van-onze-nieuwe-website:23 http://localhost/jellyfish_rework/artikel/css/jellyfish.css lancering-van-onze-nieuwe-website:24 http://localhost/jellyfish_rework/artikel/css/bootstrap.min.css lancering-van-onze-nieuwe-website:22 http://localhost/jellyfish_rework/artikel/css/animate.css lancering-van-onze-nieuwe-website:25 http://localhost/jellyfish_rework/artikel/js/custom/knob.js lancering-van-onze-nieuwe-website:168 http://localhost/jellyfish_rework/artikel/js/bootstrap/bootstrap.min.js lancering-van-onze-nieuwe-website:166 http://localhost/jellyfish_rework/artikel/js/custom/wow.min.js lancering-van-onze-nieuwe-website:167 http://localhost/jellyfish_rework/artikel/js/custom/jellyfish.js lancering-van-onze-nieuwe-website:169

why adding /article/ relative path of scripts , css? , how can prepare this?

you running problem due utilize of relative urls in css/js/images. can prepare 1 of ways:

use absolute path in css, js, images files rather relative one. means have create sure path of these files start either http:// or slash /.

otherwise seek adding in page's html header: <base href="/" /> every relative url resolved url , not current url.

html css .htaccess

ruby on rails - No route matches [GET] /users -



ruby on rails - No route matches [GET] /users -

edit: resource , controller has been pluralized, feedback wrote in comments. problem still persists.

i'm new rails , i'm trying create rest api in rails 4. i've got routing error when seek execute request on user ressource : http://api.localhost:3000/users

no route matches [get] "/users"

but, when execute command 'rake routes' on terminal, can see there /users route:

api_users /users(.:format) api/users#index {:subdomain=>"api"} post /users(.:format) api/users#create {:subdomain=>"api"} new_api_user /users/new(.:format) api/users#new {:subdomain=>"api"} edit_api_user /users/:id/edit(.:format) api/users#edit {:subdomain=>"api"} api_user /users/:id(.:format) api/users#show {:subdomain=>"api"} patch /users/:id(.:format) api/users#update {:subdomain=>"api"} set /users/:id(.:format) api/users#update {:subdomain=>"api"} delete /users/:id(.:format) api/users#destroy {:subdomain=>"api"}

here content of route.rb file:

rails.application.routes.draw # create rousources in subdomain api namespace :api, path: '/', constraints: { subdomain: 'api' } resources :users end end

and users_controller.rb file:

module api class userscontroller < applicationcontroller def index @users = user.all render json: users, status: 200 end end end

any suggestion?

edit: resource , controller has been pluralized, feedback wrote in comments. problem still persists.

rails determines subdomain of url taking part host address in front end of sec dot right. in illustration utilize host api.localhost. rails determine empty subdomain that.

therefore suggest configure domain api.my_app.dev in hosts file. allow rails determine right subdomain part api host.

after did local server should respond to: http://api.my_app.dev:3000/users

btw. chose tld dev, because default if utilize tool pow.

ruby-on-rails ruby routes

javascript - CodeIgniter PHP: change value in database when checkbox is mark/unmark -



javascript - CodeIgniter PHP: change value in database when checkbox is mark/unmark -

ok, manage somehow value of checkbox, have issue.

this view, rssfeeds.php

<?php foreach( $feeds $row ) : ?> <div class="row"> <div class="col-md-2 col-sm-3 text-center"> <a class="story-title"><img alt="" src="http://www.solostream.com/wp-content/uploads/2014/06/20140110080918_0555.jpg" style="width:100px;height:100px"></a> <label class="checkbox-inline"> <input type="checkbox" class="chkbox" value="chkbox_<?php echo $row->category; ?>_<?php echo $row->id; ?>"> mark read </label> </div> <div clas="col-md-10 col-sm-9"> // here feeds.... </div> </div> <?php endforeach; ?>

i have script, take checkbox value, , send controller:

<script> $(document).ready(function(){ $(document).on('click','.chkbox',function(){ var id=this.value; $.ajax( { type: "post", context: "application/json", data: {id:id}, url: "<?php echo site_url('rssfeedreader/markreadunread'); ?>", success: function(msg) { // should here ?.... } }) }); }); </script>

in controller, load model alter value on database, 0 or 1( meaning read or unread).

the problem nil alter on table... need set in .succes function in ajax ? what.. ? need alter 1 value in database....

@james-lalor has reply looking for, i'll expand upon it.

you can give inputs same name (radio buttons, checkboxes) have them interact each other. in case of radio buttons it's required have same name mark , unmark others. in case utilize <input name=example[]> note [], means when ajax post (or post) send values checked array.

so next james' suggestion, <input name="checkbox[<?php echo $row->id?>]" can post using $.post(url, data, callback), easiest way set form, assign form id, serialized post. like:

<form id="rss_form" method="post" action="javascript:rssupdate();"> <input name="checkbox[<?php echo $row->id?>]" type="checkbox"/> <input type="submit" value="submit"/> </form> <script> function rssupdate() { $.post(url/to/post/to, $("#rss_form").serialize()); } </script>

javascript php mysql ajax codeigniter

google app engine - Go wrap httprouter to have logger? -



google app engine - Go wrap httprouter to have logger? -

i have next httprouter handler want customize can inject own logger functions.

router := httprouter.new() router.handle("get", "/mysite", mylogger(handler1))

and mylogger like:

var logger = log.new(os.stdout, "[log] ", 0) func mylogger(fn func(w http.responsewriter, r *http.request, param httprouter.params)) func(w http.responsewriter, r *http.request, param httprouter.params) { homecoming func(w http.responsewriter, r *http.request, param httprouter.params) { start := time.now() logger.printf("%s %s", r.method, r.url.path) fn(w, r, param) logger.printf("done in %v (%s %s)", time.since(start), r.method, r.url.path) } }

and myhandler like:

func myhandler(w http.responsewriter, r *http.request, _ httprouter.params) { .... }

is there way can wrap httprouter handler not have pass handler mylogger function? want in go appengine context:

func appenginehandler(c appengine.context, w http.responsewriter, r *http.request, _ httprouter.params) { ... c.infof("here's log") }

without having used httprouter bundle before, appear need alter function signature you're attempting wrap.

so, firstly, alter declaration of fn argument in method:

func mylogger(fn func(c *myapp.context, w http.responsewriter, r *http.request, param httprouter.params)) // ^^^^^ have take context of own

..then create , pass context handler in wrapper:

c := &myapp.context{ your: arguments, here: true } fn(c, w, r, param) // ^^ - pass context in

then alter signature of handler:

func myhandler(c *myapp.context, w http.responsewriter, r *http.request, _ httprouter.params) { // utilize c here }

google-app-engine http logging go

javascript - get the value of the child element of directive -



javascript - get the value of the child element of directive -

i have these directive

app.directive("myarticle",function($timeout){ homecoming { restrict: "e", replace: true, templateurl: "templates/article.html", link: function(scope, element, attrs) { element.getval() } , scope: { cat: "=", mainurl: "=" } } });

here directive template

<div class="span2 "> <a href="#/cat/{{cat.id}}"> link cat</a> </div>

the jquery getval function

(function($) { $.fn.getval = function() { this.each(function() { var url =$(this).find("a").attr("href"); console.log(url); }); }; })(jquery);

the function long , tried simplify can

what expected render "#/cats/1" rendered "#cats/{{cat.id}}"

so how can value of look not look self

you have utilize ng-href (instead of href) in template:

<div class="span2"> <a ng-href="#/cat/{{cat.id}}"> link cat</a> </div>

and wrap getval() method in $timeout retrieve href attribute after digest cycle:

$timeout(function() { element.getval(); })

ps: don't know trying accomplish reading attributes values template scope not best practice. improve thought build href attribute in directive utilize straight in view (like scope.carurl = '#/cat/' + cat.id' , <a ng-href="{{caturl}}">)

javascript jquery angularjs angularjs-directive

CPU scheduling and kernel-level threads -



CPU scheduling and kernel-level threads -

my textbook mentions next sentence:

on operating systems back upwards them, kernel-level threads - not processes - beingness scheduled operating system.

i understand cpu scheduling, sentence not create sense. mean scheduler programme allocates cpu kernel-level threads according specific algorithms?

aren't kernel-level processes scheduled? or not exist in operating systems back upwards kernel-level threads?

when referring threads , processes in operating scheme context, process means thread own memory space , thread means thread shares it's memory space other threads.

so process context-switches have higher cost thread context-switches, because there higher over-head when switching process context.

kernel

javascript - Filename not being used as AWS S3 name -



javascript - Filename not being used as AWS S3 name -

i using expressjs , trying post image aws s3 can used throughout app. have been next tutorial , while able upload image, filename beingness given default_name every single time , don't believe file format beingness attached string give file proper image format. when @ s3upload.js script provided in tutorial, notice default_name ths standard name provide files, i'm not sure why accepting file without using title.

events-create.ejs (where have upload):

<!doctype html> <html> <head> <% include ../partials/head %> </head> <body> <% include ../partials/navigation %> <div class="grid" id="create-event-container"> <div class="col-1-1"> <div id="create-event"> <h1><i>create event</i></h1> <input type="file" id="files"/> <p id="status">please select file</p> <div id="preview"><img src="/images/event-placeholder.png"></div> <form action="/admin/events/create" method="post"> <input type="hidden" id="speaker-image" name="speakerimage" value="/images/event-placeholder.png" /> name: <input type="text" name="name"><br> title: <input type="text" name="title"><br> company: <input type="text" name="company"><br> website: <input type="text" name="url"><br> <input type="submit" value="submit"><br> </form> </div> </div> </div> <script type="text/javascript" src="/js/s3upload.js" async></script> <script> console.log("s3 function launched"); function s3_upload(){ var status_elem = document.getelementbyid("status"); var url_elem = document.getelementbyid("speaker-image"); var preview_elem = document.getelementbyid("preview"); var s3upload = new s3upload({ file_dom_selector: 'files', s3_sign_put_url: '/sign_s3', onprogress: function(percent, message) { status_elem.innerhtml = 'upload progress: ' + percent + '% ' + message; }, onfinishs3put: function(public_url) { status_elem.innerhtml = 'upload completed. uploaded to: '+ public_url; url_elem.value = public_url; console.log(public_url); preview_elem.innerhtml = '<img src="'+public_url+'" style="width:300px;" />'; }, onerror: function(status) { status_elem.innerhtml = 'upload error: ' + status; console.log(status_elem.innerhtml); } }); } /* * hear file selection: */ (function() { var input_element = document.getelementbyid("files"); input_element.onchange = s3_upload; })(); </script> </body> </html>

routes.js:

var express = require('express'); var router = express.router(); var event = require('./models/eventsmodel'); var http = require('http'); var path = require('path'); var aws = require('aws-sdk'); var aws_access_key = process.env.aws_access_key; var aws_secret_key = process.env.aws_secret_key; var s3_bucket = process.env.s3_bucket; router.get('/sign_s3', function(req, res){ aws.config.update({accesskeyid: aws_access_key, secretaccesskey: aws_secret_key }); var s3 = new aws.s3(); var s3_params = { bucket: s3_bucket, key: req.query.s3_object_name, expires: 60, contenttype: req.query.s3_object_type, acl: 'public-read' }; s3.getsignedurl('putobject', s3_params, function(err, data){ if(err){ console.log(err); } else{ var return_data = { signed_request: data, url: 'https://'+s3_bucket+'.s3.amazonaws.com/'+req.query.s3_object_name }; res.write(json.stringify(return_data)); res.end(); } }); }); router.route('/admin/events/create') .post(function(req, res){ var events = new event(); events.name = req.body.name; events.title = req.body.title; events.company = req.body.company; events.url = req.body.url; events.speakerimage = req.body.url; events.save(function(err){ if (err) res.send(err); res.redirect(303, '/events'); }); }) .get(function(req, res){ event.find(function(err, events){ if (err) res.send(err); res.render('pages/events-create.ejs'); }); });

s3upload.js:

(function() { window.s3upload = (function() { s3upload.prototype.s3_object_name = 'default_name'; s3upload.prototype.s3_sign_put_url = '/signs3put'; s3upload.prototype.file_dom_selector = 'file_upload'; s3upload.prototype.onfinishs3put = function(public_url) { homecoming console.log('base.onfinishs3put()', public_url); }; s3upload.prototype.onprogress = function(percent, status) { homecoming console.log('base.onprogress()', percent, status); }; s3upload.prototype.onerror = function(status) { homecoming console.log('base.onerror()', status); }; function s3upload(options) { if (options == null) options = {}; (option in options) { this[option] = options[option]; } this.handlefileselect(document.getelementbyid(this.file_dom_selector)); } s3upload.prototype.handlefileselect = function(file_element) { var f, files, output, _i, _len, _results; this.onprogress(0, 'upload started.'); files = file_element.files; output = []; _results = []; (_i = 0, _len = files.length; _i < _len; _i++) { f = files[_i]; _results.push(this.uploadfile(f)); } homecoming _results; }; s3upload.prototype.createcorsrequest = function(method, url) { var xhr; xhr = new xmlhttprequest(); if (xhr.withcredentials != null) { xhr.open(method, url, true); } else if (typeof xdomainrequest !== "undefined") { xhr = new xdomainrequest(); xhr.open(method, url); } else { xhr = null; } homecoming xhr; }; s3upload.prototype.executeonsignedurl = function(file, callback) { var this_s3upload, xhr; this_s3upload = this; xhr = new xmlhttprequest(); xhr.open('get', this.s3_sign_put_url + '?s3_object_type=' + file.type + '&s3_object_name=' + this.s3_object_name, true); xhr.overridemimetype('text/plain; charset=x-user-defined'); xhr.onreadystatechange = function(e) { var result; if (this.readystate === 4 && this.status === 200) { seek { result = json.parse(this.responsetext); } grab (error) { this_s3upload.onerror('signing server returned ugly/empty json: "' + this.responsetext + '"'); homecoming false; } homecoming callback(result.signed_request, result.url); } else if (this.readystate === 4 && this.status !== 200) { homecoming this_s3upload.onerror('could not contact request signing server. status = ' + this.status); } }; homecoming xhr.send(); }; s3upload.prototype.uploadtos3 = function(file, url, public_url) { var this_s3upload, xhr; this_s3upload = this; xhr = this.createcorsrequest('put', url); if (!xhr) { this.onerror('cors not supported'); } else { xhr.onload = function() { if (xhr.status === 200) { this_s3upload.onprogress(100, 'upload completed.'); homecoming this_s3upload.onfinishs3put(public_url); } else { homecoming this_s3upload.onerror('upload error: ' + xhr.status); } }; xhr.onerror = function() { homecoming this_s3upload.onerror('xhr error.'); }; xhr.upload.onprogress = function(e) { var percentloaded; if (e.lengthcomputable) { percentloaded = math.round((e.loaded / e.total) * 100); homecoming this_s3upload.onprogress(percentloaded, percentloaded === 100 ? 'finalizing.' : 'uploading.'); } }; } xhr.setrequestheader('content-type', file.type); xhr.setrequestheader('x-amz-acl', 'public-read'); homecoming xhr.send(file); }; s3upload.prototype.uploadfile = function(file) { var this_s3upload; this_s3upload = this; homecoming this.executeonsignedurl(file, function(signedurl, publicurl) { homecoming this_s3upload.uploadtos3(file, signedurl, publicurl); }); }; homecoming s3upload; })(); }).call(this);

i came across same issue, how tackled within node controller:

aws.config.update({accesskeyid: aws_access_key, secretaccesskey: aws_secret_key}); var s3 = new aws.s3(); // set extension switch(req.query.s3_object_type) { case 'image/png': var ext = '.png'; break; case 'image/gif': var ext = '.gif'; break; case 'image/jpg': case 'image/jpeg': var ext = '.jpg'; break; } // rename file var name = math.floor(new date() / 1000); // set s3 var s3_params = { bucket: s3_bucket, key: 'blog/'+name+ext, expires: 60, contenttype: req.query.s3_object_type, acl: 'public-read' }; // send s3 s3.getsignedurl('putobject', s3_params, function(err, data){ if(err){ console.log(err); } else{ var return_data = { signed_request: data, url: 'https://'+s3_bucket+'.s3.amazonaws.com/'+name+ext }; res.write(json.stringify(return_data)); res.end(); } });

so can see pretty simple solution problem, check extension , rename file. hope helps.

javascript node.js amazon-web-services express

how can I use opencv to run the java code -



how can I use opencv to run the java code -

i have opencv10.05 installed in laptop , working on tracking c++. have 1 project have run code in java opencv. possible utilize same opencv10.05 or need install whole steup?

opencv comes own java bindings. need cmake, ant, , opencv src code build it.

javacv 3rd party wrapper, unfortunately based on opencv's deprecated 1.0 c-api, have programme java, in c years ago. mixed blessing..

opencv

html - CSS3 Animations on hover -



html - CSS3 Animations on hover -

i trying website here gallery section near bottom, can point me in right direction of how this?

i have tried looking @ css getting no where.

thanks,

this may helpful you:

http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/

idea same, need modify effects.

your illustration linking svg file, defined blur effect.

<filter id="blur"> <fegaussianblur stddeviation="10"> </filter>

you can read more technique here:

https://developer.mozilla.org/en-us/docs/web/css/filter

html css3 animation

c# - nested array initializer is expected -



c# - nested array initializer is expected -

i'm trying create array holds 6 strings in 1 row, , many other rows after that. code:

string[, , , , , ,] conj = new string[,,,,,,] { {"aimer", "aime", "aimes", "aime", "aimons", "aimez", "aiment"}, };

i'm getting error "a nested array initializer expected". i've never made array big before, , couldn't find searching google why i'm getting error , need prepare this.

thanks help!

you trying initialize multi-dimensional rectangular array (7 dimensions!).

so...

// 1d array containing 2 elements: int[] r1d = { 1 , 2 , } ; // 2x3 array containing 6 elements: int[,] r2d = { { 1 , 2 , 3 , } , { 4 , 5 , 6 , } , } ; // 2x3x4 array int[,,] r3d = { { { 1 , 2 , 3 , 4 , } , { 5 , 6 , 7 , 8 , } , { 9 , 10 , 11 , 12 , } , } , { { 13 , 14 , 15 , 16 , } , { 17 , 18 , 19 , 20 , } , { 21 , 22 , 23 , 24 , } , } , } ;

one might see pattern developing here. should able take here (hint: you're going have curly braces nested 7 deep).

note each initializers must of same rank, lest compiler upset. instance, if say:

int[,,] r3d = { { { 1 , 2 , 3 , 4 , } , { 5 , 6 , 7 , 8 , } , { 9 , 10 , 11 , 12 , } , } , { { 13 , 14 , 15 , 16 , } , { 17 , 18 , 19 , 20 , } , //{ 21 , 22 , 23 , 24 , } , } , } ;

the compiler whines , says, an array initializer of length '3' expected. that's because initializer x3d[0,1] initializers inconsistent.

c# arrays visual-studio

php - PDO ORDER BY COUNT -



php - PDO ORDER BY COUNT -

i need pdo query top 20 searched terms (returning search-term , number of times used).

this sql want (tested in phpmyadmin) . . .

select searchterm, count(*) rowcount table grouping searchterm order rowcount desc limit 20

. . . pdo returns rowcount 1.

i 've read loads of related posts, can't seem adapt solutions problem (probably because don't understand pdo enough).

didn't want post pdo code i'm using wrapper i've built (that works great) , think need start scratch problem . . . here (sanitised wrapper) . . .

$query = $this -> db -> prepare ( select searchterm, count(*) rowcount table grouping searchterm order rowcount desc limit 20); $query -> execute (); $return = $query -> fetchall(pdo::fetch_assoc);

could give me output of ? , i'll edit answer. utilize pdo grouping first column:

$query = $this->db->prepare("select `searchterm`, count(*) `rowcount` `table` order rowcount desc limit 20"); $query->execute(); $return = $query->fetchall(pdo::fetch_column|pdo::fetch_group);

just show me var_dump($return)

php pdo

Screen Sharing on webRTC -



Screen Sharing on webRTC -

is possible capture desktop screen sharing through webrtc.. know captures screen on browser tab possible capture whole desktop screen navigating through files on computer or opening , viewing files pdf etc..

currently, "stateless" screen capturing available in rtcweb implementations (both chrome & firefox). e.g.

install chrome extension , seek this demo

above demo capture screen of "any" opened application's screen. though, such screen capturing api fails capture screens of full-screen game applications.

more info available here:

https://developer.chrome.com/extensions/desktopcapture (https+getusermedia+postmessage)

regarding remote desktop sharing web-browser, has pile more security risks associated compared screen sharing. ui/security aspects tough deal with, , feature susceptible social engineering science -- phone call: "this google/dell/computer-management; we've detected machine has virus on it; browse , we'll assist in removing it" -- etc. ref

webrtc desktop-sharing

android - recyclerview No adapter attached; skipping layout -



android - recyclerview No adapter attached; skipping layout -

just implemented recyclerview in code, replacing listview.

everything works fine. objects displayed.

but logcat says

15:25:53.476 e/recyclerview﹕ no adapter attached; skipping layout

15:25:53.655 e/recyclerview﹕ no adapter attached; skipping layout

for code

artistarrayadapter adapter = new artistarrayadapter(this, artists); recyclerview = (recyclerview) findviewbyid(r.id.cardlist); recyclerview.sethasfixedsize(true); recyclerview.setadapter(adapter);`` recyclerview.setlayoutmanager(new linearlayoutmanager(this));

as can see have attached adapter recycleview. why maintain getting error?

i have read other questions related same problem none helps.

can create sure calling these statements "main" thread (for illustration within oncreate method). phone call same statements "delayed" method. in case resultcallback, same message.

in fragment, calling code below within resultcallback method produces same message. after moving code onconnected method within app, message gone...

linearlayoutmanager llm = new linearlayoutmanager(this); llm.setorientation(linearlayoutmanager.vertical); list.setlayoutmanager(llm); list.setadapter( adapter );

android recyclerview

java - MalformedInputException in Tomcat using gzip on the client side? -



java - MalformedInputException in Tomcat using gzip on the client side? -

i'm creating soap webservice client spring , cxf. client works, i'm trying enable gzip compression (because owner of soap webservice told me back upwards http compression):

@autowired private bus bus; bus.getininterceptors().add(new gzipininterceptor()); bus.getoutinterceptors().add(new gzipoutinterceptor());

this produces next xml request:

headers: {accept=[*/*], accept-encoding=[gzip;q=1.0, identity; q=0.5, *;q=0], content-encoding=[gzip], soapaction=["..."]}

looks fine far. http 500 error back. might wrong? error on side, or on webservice side?

xml response: headers: {content-type=[text/html;charset=utf-8], server=[apache-coyote/1.1], transfer-encoding=[chunked], vary=[accept-encoding], x-cnection=[close]} http status 500 - input length = 1 server encountered internal error prevented fulfilling request. java.nio.charset.malformedinputexception java.nio.charset.coderresult.throwexception(coderresult.java:277) sun.nio.cs.streamdecoder.implread(streamdecoder.java:338) sun.nio.cs.streamdecoder.read(streamdecoder.java:177) java.io.inputstreamreader.read(inputstreamreader.java:184) org.apache.tomcat.util.buf.readconvertor.read(b2cconverter.java:252) org.apache.tomcat.util.buf.b2cconverter.convert(b2cconverter.java:134) org.apache.catalina.connector.inputbuffer.realreadchars(inputbuffer.java:374) org.apache.tomcat.util.buf.charchunk.substract(charchunk.java:379) org.apache.catalina.connector.inputbuffer.read(inputbuffer.java:388) org.apache.catalina.connector.coyotereader.read(coyotereader.java:93) com.interes.hostproxy.newskies.servlets.newskieshostproxyservlet.dopost(newskieshostproxyservlet.java:275) javax.servlet.http.httpservlet.service(httpservlet.java:643) javax.servlet.http.httpservlet.service(httpservlet.java:723) total stack trace of root cause available in apache tomcat/6.0.41 logs.

java spring web-services tomcat soap

javascript - Find value in - from ajax -



javascript - Find value in <li> from ajax -

i calling ajax via function. when ajax has been completed, unable find value in <li>

a function utilize ajax:

function findlist(postcode) { $.getjson("/list/" + postcode, function(data) { if (data.length > 1) { $.each (data, function (index, element) { if (element != "address") { $('#order-list-form').append($("<li></li>").attr("value",data[index].value).text(data[index].name)); } }); } }); }

if page loaded, find value $("#postcode").val() , execute findlist(), 1 time has been completed, need find value dus123 in <li> has been populated via ajax , add together class selected-address - don't seem work.

if ($("#postcode").val() != "") { // execute ajax findlist( $("#postcode").val() ) // not working here // when ajax completed, want find find value in <li> , add together class selected-address $("#order-list-form li").find('value="dus123").addclass("selected-address"); }

the selector in phone call find not valid. search attributes, need wrap them []:

$("#order-list-form li").find('[value="dus123"]').addclass("selected-address");

however, since you're setting attribute straight on li element itself, need find attribute on element, not on kid element above selector doing:

$('#order-list-form li[value="dus123"]').addclass("selected-address");

another issue due way requests sent , processed ajax, line of code run before ajax request has completed, , before element has been appended document. prepare have 2 options. quick , dirty way, create ajax request synchronous, i'll leave research getjson , ajax methods find out how do.

the second, , more right way, either run line of code within success function in phone call getjson:

function findlist(postcode) { $.getjson("/list/" + postcode, function(data) { if (data.length > 1) { $.each (data, function (index, element) { if (element != "address") { $('#order-list-form').append($("<li></li>").attr("value",data[index].value).text(data[index].name)); } }); } $('#order-list-form li[value="dus123"]').addclass("selected-address"); }); }

or can allow findlist function take callback, , utilize that:

function findlist(postcode, callback) { $.getjson("/list/" + postcode, function(data) { if (data.length > 1) { $.each (data, function (index, element) { if (element != "address") { $('#order-list-form').append($("<li></li>").attr("value",data[index].value).text(data[index].name)); } }); } callback(); }); } if ($("#postcode").val() != "") { findlist( $("#postcode").val(), function() { $('#order-list-form li[value="dus123"]').addclass("selected-address"); }); }

javascript jquery ajax

java - Call inner asynctask from parent fragment -



java - Call inner asynctask from parent fragment -

i want phone call inner asynctask located in fragment. want phone call asynctask parent fragment hosting fragment asynctask. parent fragment includes viewpager multiple fragments. know have utilize interface , tried doesn't work.

interface

public interface onfragmentbuttonlistener { void onmybuttonclicked(); }

fragment

public class fragmentqueue extends sherlockfragment implements onfragmentbuttonlistener { ... @override public void onmybuttonclicked() { new loadqueuetask().execute(); } }

parent fragment

public class parentfragment extends sherlockfragment{ ... refresh.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { ((onfragmentbuttonlistener)getactivity()).onmybuttonclicked(); } }); }

error

11-12 23:15:14.115: e/androidruntime(31864): java.lang.classcastexception: nl.name.projectname.projectname cannot cast nl.name.projectname.onfragmentbuttonlistener 11-12 23:15:14.115: e/androidruntime(31864): @ nl.name.projectname.fragments.parentfragment$loadinfotask$1.onclick(parentfragment.java:323) 11-12 23:15:14.115: e/androidruntime(31864): @ android.view.view.performclick(view.java:4445) 11-12 23:15:14.115: e/androidruntime(31864): @ android.view.view$performclick.run(view.java:18446) 11-12 23:15:14.115: e/androidruntime(31864): @ android.os.handler.handlecallback(handler.java:733) 11-12 23:15:14.115: e/androidruntime(31864): @ android.os.handler.dispatchmessage(handler.java:95) 11-12 23:15:14.115: e/androidruntime(31864): @ android.os.looper.loop(looper.java:136) 11-12 23:15:14.115: e/androidruntime(31864): @ android.app.activitythread.main(activitythread.java:5146) 11-12 23:15:14.115: e/androidruntime(31864): @ java.lang.reflect.method.invokenative(native method) 11-12 23:15:14.115: e/androidruntime(31864): @ java.lang.reflect.method.invoke(method.java:515) 11-12 23:15:14.115: e/androidruntime(31864): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:796) 11-12 23:15:14.115: e/androidruntime(31864): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:612) 11-12 23:15:14.115: e/androidruntime(31864): @ dalvik.system.nativestart.main(native method)

it looks trying phone call onmybuttonclicked on parent activity, rather kid fragmentqueue instance. in onclick method, need reference fragmentqueue instance, , phone call onmybuttonclicked. this:

refresh.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { fragment fragment = getfragmentmanager().findfragmentbytag("fragmentqueue"); if (fragment instanceof fragmentqueue) { ((fragmentqueue)fragment).onmybuttonclicked(); } } });

note work, have set fragment tag "fragmentqueue" when build fragment (either in xml or code).

java android android-fragments interface android-asynctask

r - sapply as.Date function to change the time variable from integer to date does not work -



r - sapply as.Date function to change the time variable from integer to date does not work -

my question have 3 columns of integers representing dates. if utilize

as.date(x,origin="1970-01-01")

for each individual column, works. however, if utilize sapply

sapply(data,function(x)as.date(x,origin="1970-01-01"))

it not work. ideas how solve problem efficiently? reproducible codes below

data=data.frame(time1=c(10189,11655,10914,12013,10934),time2=c(11758,10696,9784,10725,11225)) sapply(data,function(x)as.date(x,origin="1970-01-01"))

the result not alter @ all. utilize

as.date(data$time1,origin="1970-01-01")

it can work.

use lapply:

> lapply(data,function(x) as.date(x,origin="1970-01-01")) $time1 [1] "1997-11-24" "2001-11-29" "1999-11-19" "2002-11-22" "1999-12-09" $time2 [1] "2002-03-12" "1999-04-15" "1996-10-15" "1999-05-14" "2000-09-25"

and if want output info frame can utilize as.data.frame():

> as.data.frame(lapply(data,function(x) as.date(x,origin="1970-01-01"))) time1 time2 1 1997-11-24 2002-03-12 2 2001-11-29 1999-04-15 3 1999-11-19 1996-10-15 4 2002-11-22 1999-05-14 5 1999-12-09 2000-09-25

r date sapply as.date

c - How to print a single character from an array of strings using printf? -



c - How to print a single character from an array of strings using printf? -

let's have

char *names[] = { "tom", "jerry" };

and want print "e" in "jerry" using printf. first instinct was

printf("%c\n", *names[5]);

but when applied i've been learning pointers, realized total junk code because 5 refers nonexistent 5th pointer in names, not "e" in "jerry". pointers contained in names ever refer memory addresses of first characters in respective strings.

so seems need add together 1 byte names[1] point to, , print "e" in "jerry". i'm not sure how this, or whether it's allowed in c.

what best way accomplish this? give thanks in advance.

i think you're looking printf("%c\n", names[1][1]);.

c arrays pointers

c++ - OpenCL and OpenCV conflict -



c++ - OpenCL and OpenCV conflict -

in our project decided migrate opencl enhance image processing. after migration project didn't work. so, tried minimal code opencl , determinded if opencv in utilize project dosn't work.

for example

int main(){ cv::mat mat; std::vector<cl::platform> all_platforms; cl::platform::get(&all_platforms); std::cout <<"fertig."; homecoming 0; }

crashes @ cl::platform::get().

terminate called after throwing instance of 'cl::error' what(): clgetplatformids

i compiled with

gcc test.cpp -lopencl -lopencv_core -lopencv_highgui

if allow out little commandline "cv::mat mat" fine. so, what's problem?

i using intel opencl driver: 1.2-4.4.0.117.

c++ opencv opencv3.0

ios - Delivering IPA for testing purpose -



ios - Delivering IPA for testing purpose -

my client demanding ipa file of app. , have provided me development provisioning profile only. dont want me utilize own developer account. else need generate ipa? please help me out generating that. thanks

alongwith provisioning profile, you'll need .p12 of developer business relationship certificate created for.

so... they'll need export developer business relationship certificate's private key .p12 file. can done via keychain access , can opt have or no password while exporting it.

then, need import p12 own keychain access. that's it.

finally, go app's build settings , specify code signing identity whatever p12 imported , provisioning profile provided.

archive , export :)

ios

model - Node.js - Mongoose path validation failing - TypeError: Cannot call method 'validate' of undefined -



model - Node.js - Mongoose path validation failing - TypeError: Cannot call method 'validate' of undefined -

i have next mongoose schema , path validaion:

var locationschema = new schema({ userid: { type: number, required: true }, location: { type: [{ type: "string", required: true, enum: ['point', 'linestring', 'polygon'], default: 'point' }], coordinates: { type: [number], required:true } }, tags: [{ type: string, index: true, required: true }], create_date: { type: date, default: date.now } }); locationschema.path('location.coordinates').validate(function(coordinates){ homecoming coordinates && coordinates.tostring().match(/([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/g); }, 'invalid latitude or longitude.');

when start app get:

locationschema.path('location.coordinates').validate(function(coordinates){ ^ typeerror: cannot phone call method 'validate' of undefined

can advise why failing? note validate path('location'), starts fine.

to define field in embedded object named type, need define type using explicit object notation or mongoose thinks it's defining type of parent object instead:

var locationschema = new schema({ userid: { type: number, required: true }, location: { type: { type: [{ type: "string", required: true, enum: ['point', 'linestring', 'polygon'], default: 'point' }]}, coordinates: { type: [number], required:true } }, tags: [{ type: string, index: true, required: true }], create_date: { type: date, default: date.now } });

node.js model mongoose typeerror

c# - From Free/Pro to In-App Purchase -



c# - From Free/Pro to In-App Purchase -

i have app published in windows phone store more 2 years. started development on app @ windows phone 7 times there no in-app purchase available. best-practice publish 2 separate apps, 1 free version (most of times ad-served) , pro app kind of trial functionality.

in order both 2 different xap packages created 2 separate build configurations different pre-build , post-build actions. build is:

(pre-build) re-create wmappmanifest file free/pro (with adjusted product name, guid, ...) properties folder of project build app (post-build) rename app bundle app-name.{free/pro}.xap (post-build) re-create xap bundle separate folder

as in-app purchase out long , maintaining 2 different apps @ same time time-consuming (although it's 100% same code free/trial/pro conditions) move away 1 app in store free , contains in-app purchase enable pro-features.

now questions are:

what think best way that. there best practice didn't find? one concern have reviews pro app lost can't move them free app have pro bundle in-app purchase. best practices on this? alternatively, there way create 2 xap app packages without copying wmappmanifest time?

it's hard reply question - here goes resource - friend of mine, 1 time gave gave me link nice research made wesley de bolster, described on blog.

he described method allowing differentiate old paid users new users - main thought recipe currentapp.getappreceiptasync() , retrive date of purchase it. after can compare date of app's new version 1 obtained recipe. can allow old users utilize features without buying iap's. haven't tested procedure seems idea.

going question, here do:

focus on pro app - there users paid app, don't disappoint them make pro app free 1 iap's implement wesley's method allow old users utilize features without paying 1 time again provide info in old free app there new 1 new features, developed further. may provide methods taking advantage of roamingsettings exchange info between apps.

c# windows-phone-7 windows-phone-8 in-app-purchase windows-phone-8.1

html - my responsive site does not respond when I make the screen bigger -



html - my responsive site does not respond when I make the screen bigger -

i want create website responsive it's not responding min-height changes want. want alter colors when reachers breakingpoint can analyze css , html , see wha's wrong.

thanks,

css:

@media screen , (min-width: 480px) { body {background: navy; } } @media screen , (min-width: 660px;) { body { background: darkgreen;} }

html:

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>dalexis peguero | designer </title> <link rel="stylesheet" href="normalize.css"> <link href='http://fonts.googleapis.com/css?family=changa+one|open+sans:400italic,700italic,800italic,400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="main.css"> <link rel="stylesheet' href="responsive.css"> </head> <body> <header> <a href="index.html" id="logo"> <h1>dalexis peguero</h1> <h2>designer</h2> </a> <nav> <ul> <li><a href="index.html">portfolio</a></li> <li><a href="about.html" >about</a></li> <li><a href="contact.html" class="selected">contact</a></li> </ul> </nav> </header> <div id="wrapper"> <section> <h3>general information</h3> <p>i not looking new design work, available when sense confident skills. </p> <p>please reach me email or facebook when it's not emergency, if need urgent consultation phone call me.</p> </section> <section> <h3> contact details </h3> <ul class="contact-info"> <li class="phone"><a href="tel:555-5555">555-5555</a></li> <li class="mail"><a href="mailto:dalexispeguero@gmail.com">dalexispeguero@gmail.com</a></li> <li class="twitter"><a href="http://twitter.com/intent/tweet?screen_name=nickrp">@dpeguero</a></li> </ul> </section> <footer> <a href="http://twitter.com/nickrp"><img src="img/twitter-wrap.png" alt="twitter logo" class="social-icon"></a> <a href="http://facebook.com/dalexisp"><img src="img/facebook-wrap.png" alt="facebook logo" class="social-icon"></a> <p>&copy; 2014 dalexis peguero. </p> </footer> </div> </body> </html>

this might problem:

<link rel="stylesheet' href="responsive.css">

you not closing quote in rel, alter this:

<link rel="stylesheet" href="responsive.css">

with not closed, not load resposive.css file

plus have wrong semicolon here:

@media screen , (min-width: 660px;)

remove it, should this:

@media screen , (min-width: 660px)

html css

java - Can I use array reference at setOnClickListener(new OnClick(){}); -



java - Can I use array reference at setOnClickListener(new OnClick(){}); -

i coding android application, , ended sec activity.

public class oneboardactivity extends activity { //omitted @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_board); turn=true; statetext=(textview)findviewbyid(r.id.statetext); mover[0][2]=(button)findviewbyid(r.id.mover13); mover[0][3]=(button)findviewbyid(r.id.mover14); mover[0][4]=(button)findviewbyid(r.id.mover15); //omitted 1 time again for(i=0;i<7;i++){ for(j=0;j<7;j++){ if(i<=1 && j<=1 || i>=6 && j<=1 || i<=1 && j>=6 || i>=6 && j>=6){ moverstate[i][j]=-2; continue; } mover[i][j].setonclicklistener(new onclicklistener(){ //line 92 @override public void onclick(view v) { // todo move state movebystate(i,j); } }); //omitted lastly time

...and code ended without syntax errors. but, when ran application , got activity out, application resulted "unfortunately, ..." error.

this logcat:

10-16 04:09:56.641: e/androidruntime(1230): fatal exception: main 10-16 04:09:56.641: e/androidruntime(1230): process: com.truefalseapps.solitaire, pid: 1230 10-16 04:09:56.641: e/androidruntime(1230): java.lang.runtimeexception: unable start activity componentinfo{com.truefalseapps.solitaire/com.truefalseapps.solitaire.oneboardactivity}: java.lang.nullpointerexception 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread.access$800(activitythread.java:135) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread$h.handlemessage(activitythread.java:1196) 10-16 04:09:56.641: e/androidruntime(1230): @ android.os.handler.dispatchmessage(handler.java:102) 10-16 04:09:56.641: e/androidruntime(1230): @ android.os.looper.loop(looper.java:136) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread.main(activitythread.java:5017) 10-16 04:09:56.641: e/androidruntime(1230): @ java.lang.reflect.method.invokenative(native method) 10-16 04:09:56.641: e/androidruntime(1230): @ java.lang.reflect.method.invoke(method.java:515) 10-16 04:09:56.641: e/androidruntime(1230): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 10-16 04:09:56.641: e/androidruntime(1230): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 10-16 04:09:56.641: e/androidruntime(1230): @ dalvik.system.nativestart.main(native method) 10-16 04:09:56.641: e/androidruntime(1230): caused by: java.lang.nullpointerexception 10-16 04:09:56.641: e/androidruntime(1230): @ com.truefalseapps.solitaire.oneboardactivity.oncreate(oneboardactivity.java:92) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activity.performcreate(activity.java:5231) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 10-16 04:09:56.641: e/androidruntime(1230): @ android.app.activitythread.performlaunchactivity(activitythread.java:2159) 10-16 04:09:56.641: e/androidruntime(1230): ... 11 more

does mean can't utilize array reference @ setonclicklistener(new onclick(){}); ? if can, npe come from?

they many cases mover[i][j] null

button mover[][] = new button[7][7]; int = 0; int j = 0; for(i=0;i<7;i++) { for(j=0;j<7;j++) { if(i<=1 && j<=1 || i>=6 && j<=1 || i<=1 && j>=6 || i>=6 && j>=6) { continue; } system.out.println("setting mover["+i+"]["+j+"]"); } }

it's giving

setting mover[0][2] setting mover[0][3] setting mover[0][4] setting mover[0][5] setting mover[1][2] setting mover[1][3] setting mover[1][4] setting mover[1][5] setting mover[2][0] setting mover[2][1] setting mover[2][2] setting mover[2][3] setting mover[2][4] setting mover[2][5] setting mover[2][6] setting mover[3][0] setting mover[3][1] setting mover[3][2] setting mover[3][3] setting mover[3][4] setting mover[3][5] setting mover[3][6] setting mover[4][0] setting mover[4][1] setting mover[4][2] setting mover[4][3] setting mover[4][4] setting mover[4][5] setting mover[4][6] setting mover[5][0] setting mover[5][1] setting mover[5][2] setting mover[5][3] setting mover[5][4] setting mover[5][5] setting mover[5][6] setting mover[6][2] setting mover[6][3] setting mover[6][4] setting mover[6][5]

however, setting these 3

mover[0][2]=(button)findviewbyid(r.id.mover13); mover[0][3]=(button)findviewbyid(r.id.mover14); mover[0][4]=(button)findviewbyid(r.id.mover15);

when mover[0][5] happens, throws nullpointerexception

java android