Posts

Showing posts from July, 2013

c# - Async Await to Keep Event Firing -

i have question async\await in c# .net app. i'm trying solve problem in kinect based application me illustrate, i've crafted analogous example: imagine have timer, called timer1 has timer1_tick event set up. now, action take on event update ui current date time. private void timer1_tick(object sender, eventargs e) { txttimervalue.text = datetime.now.tostring("hh:mm:ss.fff", cultureinfo.invariantculture); } this simple enough, ui updates every few hundredths of seconds , can happily watch time go by. now imagine want calculate first 500 prime numbers in same method so: private void timer1_tick(object sender, eventargs e) { txttimervalue.text = datetime.now.tostring("hh:mm:ss.fff", cultureinfo.invariantculture); list<int> primenumberslist = workoutfirstnprimenumbers(500); printprimenumberstoscreen(primenumberslist); } private list<int> workoutfirstnprimenumbers(int n) { ...

.htaccess - Removing index.php in codeigniter xampp for windows -

i tried methods found including on site. did not work redirect. my config.php $config['base_url'] = 'http://'.$_server['http_host']; /* |-------------------------------------------------------------------------- | index file |-------------------------------------------------------------------------- | | typically index.php file, unless you've renamed | else. if using mod_rewrite remove page set | variable blank. | */ $config['index_page'] = ''; rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_uri} ^(.+)/$ rewriterule ^(.+)/$ /$1 [r=301,l] rewritecond %{http_host} ^www.**.ru$ [nc] rewriterule ^(.*)$ http://**.ru/$1 [r=301,l] rewritecond $1 !^(robots\.txt|index\.php|image\.php|favicon\.ico|upload|sotrudnik|generator|links|assets|agents|old|sitemap\.xml|4cc707e99fb15630dc\.html|sitemap_mobile\.xml|yandex_6bfb7e8daf6b3458\.html|holder\.js) rewriterule ^(.*)$ /index.php/$1 [l] this .htaccess ...

javascript - lively load js and css on the head using append -

for reason, load css , scripts on head tag using "append" e.g. $("head").append('<script type="application/javascript" src="core/js/main.js"></script>'); i'm pulling html contents asynchronously ("ajax way") , due contents have specific styles , script functions needed thats why load script , css along it. here's code (refer below) $.ajax({ url : 'page_loader.php', datatype: 'html', data : { page_name : 'test' }, type: 'get', beforesend : function(){ //show spinner $("#spinner").show(); }, success : function(data){ //before load contents, load css first $("head").append('<link rel="stylesheet" type="text/css" href="core/css/main.css" />'); //load pulled html contents div has id of ajax_page $("#ajax_page").html(data); ...

curl - Strange "JPEG datastream contains no image" with PHP -

i getting remote image , checking size of it. sometimes strange error saying jpeg datastream contains no image , narrowed down it's happening @ step, in fact it's happening @ imagecreatefromstring . problem? issue image? or need increase kind of memory setting in php.ini or..? function ranger($url) { $headers = array( "range: bytes=0-32768" ); $curl = curl_init($url); curl_setopt($curl, curlopt_httpheader, $headers); curl_setopt($curl, curlopt_returntransfer, 1); $data = curl_exec($curl); curl_close($curl); return $data; } $url = $prod['image1']; $raw1 = ranger($url); $im = imagecreatefromstring($raw1); $width = imagesx($im); $height = imagesy($im); you need follow these 3 steps solve problem: as error message states, not have image. need determine why not have image. start running var_dump($raw1) take @ algorithm in general. after step should know why not have image expected one. ? user val...

html - Bootstrap alert's taking up two lines -

just wondering if there way can have bootstrap alert text display on 1 line without taking entire width of page: http://codepen.io/euanr/pen/jdqyrp as can see in codepen, alert taking 2 lines, if remove position: absolute; alert take entire width page. code: html: <div class="topleft"> <div class="alert alert-danger fade in"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times; &nbsp;</a> <div class="innermessage"> error: fields must filled! </div> </div> </div> css: .topleft { position: absolute; top: 20px; left: 10px; padding: 5px; } .innermessage { padding-right:2px; } just change .innermessage width 225px, , adjust accordingly alert message width. .innermessage { padding-right:2px; width: 225px; } .topleft { position: absolute; top: 20px; ...

ruby on rails - Running multiple apps on multiple ports through rack -

i trying run 2 apps on 2 instances of thin on different ports like in config.ru run app1, port: 3000 run app2, port: 4567 how can ? since it's 2 apps, can't start them simultaneously in 1 config.ru. if they're separated 2 apps, start them like # app1 thin -r config.ru -a 127.0.0.1 -p 3000 start # app2 thin -r config.ru -a 127.0.0.1 -p 4567 start or specify port in config.ru first line directly, take app1 example #\ -p 3000 ... ... run app1

JSOUP login and parsing -

i need database size value tab. url: http://www.try-phpbb.com/31x/ucp.php?mode=login need logged in twice. failed @ once. trying no success: connection.response res = jsoup .connect("http://www.try-phpbb.com/31x/ucp.php?mode=login") .data("username", "administrator") .data("password", "administrator") .method(connection.method.post) .execute(); i guess need more info username , password send along in form. in html of website shows login form contains hidden fields, including input name sid . seems id generated server, need login page first, read out sid (and maybe session cookies) , send along post request. should trick. 1) login page 2) read cookies, read out sid. network tab in chrome shows site sets following cookies: phpbb3_ascraeus_90541803_u=1; phpbb3_ascraeus_90541803_k=; phpbb3_ascraeus_90541803_sid=befc4716f8061a422407f4f7...

javascript - Get div value using jquery or js -

a have e3 , e2 divs, , parent div e . there many e divs on page. how can e3 div value when click on div e2 ? thanks. there no value attribute div. innerhtml through javascript. var divvalue = document.getelementbyid('e3').innerhtml;

java - How can a random value be spreaded with a given probability? -

for ai i'm using random values decide action perform next (only when there nothing rule based do). of actions should picked more others. the idea define group of probabilities , pick action probs 2 twice action 1, action 4 5 times higher probability. action prob 0 1 1 2 (twice 1) 2 2 3 2 4 5 (5 times morer 1) is there wellknown algorithm behaviour or more mathematical approach? my test implementation awkward. prefer avoid inner loop. public static void main(string[] args) { int[] counts = new int[5]; int[] props = { 1 ,2 ,2 ,2 ,5 }; int sum = 0; (int = 0; < props.length ; i++) { sum += props[i]; } ( int = 0 ; < 100 ; i++ ) { int rand = (int) (math.random() * sum); ( int j = 0 ; j < props.length ; j++ ) { if ( rand - props[j] <= 0 ) { counts[j] = counts[j] + 1; } } } ( int j = 0 ; j < props.length ; j++ ) { ...

ios - Create Map Pins from XML/Array -

i'm working on project grabs bunch of traffic-cameras xml file , and shows them in app. have got tableview , running, working (click on cell, opens detailview , shows traffic-image). however, want display cameralocations on map, users can press pin want see camera of (and sends them detailview show camera). i'm not sure how make work, ideas? i got longitude , latitude coordinates. link xml file: http://webkamera.vegvesen.no/metadata it in norwegian but, lengdegrad = longitude , breddegrad = latitude. this want achieve (photoshop screenshot): https://gyazo.com/93d885606efd6e6369018243b64d47e8 i don't know if right place ask, please if know :-) thanks in advance to use xml data: add xml file project , use nsxmlparser read it. to create annotations on map: create annotation class based on mkannotationview , that: class annotation: nsobject, mkannotation { var coordinate: cllocationcoordinate2d var title: string? // optionally add s...

Can PHP PDO Statements accept the table or column name as parameter? -

why can't pass table name prepared pdo statement? $stmt = $dbh->prepare('select * :table 1'); if ($stmt->execute(array(':table' => 'users'))) { var_dump($stmt->fetchall()); } is there safe way insert table name sql query? safe mean don't want do $sql = "select * $table 1" please see following: http://us3.php.net/manual/en/book.pdo.php#69304 table , column names cannot replaced parameters in pdo. in case want filter , sanitize data manually. 1 way pass in shorthand parameters function execute query dynamically , use switch() statement create white list of valid values used table name or column name. way no user input ever goes directly query. example: function buildquery( $get_var ) { switch($get_var) { case 1: $tbl = 'users'; break; } $sql = "select * $tbl"; } by leaving no default case or using default case returns error message ens...

swift - NSXMLParser: How to return the parseError if .parse() returns false? -

in swift, have been experimenting nsxmlparser . in general confident concepts , implementation. therefore have, example, function myfunc() include call .parse() method. in event .parse() method returns false how can use delegate function parser(parser: nsxmlparser, parseerroroccurred parseerror: nserror) return parseerror directly myfunc() ? how can access error? i know print error. , can see assign value variable class level scope. guessing there better of getting it. func myfunc() { // ... myxmlparser!.delegate = self if myxmlparser!.parse() != true { // ... } } and implement delegate functions func parser(parser: nsxmlparser, didstartelement elementname: string, namespaceuri: string?, qualifiedname qname: string?, attributes attributedict: [string : string]) { // ... } func parser(parser: nsxmlparser, foundcharacters string: string) { // ... } func parser(parser: nsxmlparser, didendelement elementname: string, namespaceuri: str...

javascript - Using add-hoc angular directive in an external html -

this should simple can't done right. have custom angular directives working fine, , i'm intended use in external (other domain/server/port) html. first, included scripts working directives webapp: <script data-main="http://localhost:9000/vassets/javascripts/main.js" src="http://localhost:9000/vassets/lib/requirejs/require.js"> </script> then tried use 1 of them in external html: <div custom-directive attrib="abcd"></div> problem template associated directive cant loaded, since declared as: templateurl: '/vassets/partials/customdirective.html' and of course can't found when external html loaded. there alse issues regarding cross site. it clear i'm not including external directives (and importing source) correctly. one thing can done in directives, instead of referencing external template, can place template inside directive itself. like: template: '<div>templa...

The images are displayed different with PHP and HTML -

i have website , built function displays photos. the problem when display gallery php function ... <?php function gallery_1() { $picture_ids = array( 1,10,100,101,102,103, 104,105,106,107,108,109, 11,110,111,112,113,114, 115,116,117,118,119,12, 120,121,122,123,124,125, 126,127,128,129,13,130, 131,132,133,134,135,136, 137,138,139,14,140,141, 142,143,144,145,146,147, 148,149,15,150,151,152, 153,154,155,156,157,158, 159,16,160,161,162,163, 164,165,166,167,168,169, 17,170,171,172,173,174, 175,176,178,18,19,2, 20,21,22,23,28,29, 3,30...

oauth 2.0 - jhipster oauth2 client secret -

i've been experimenting jhipster. i've configured app work oauth2. purpose have client secret in application.yml according several articles have found on topic, client secret should kept secret @ times. example, check https://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified the client secret must kept confidential. if deployed app cannot keep secret confidential, such javascript or native apps, secret not used. i've noticed though generated auth.oauth2.service.js contains secret in plain text: return { login: function(credentials) { var data = "username=" + credentials.username + "&password=" + credentials.password + "&grant_type=password&scope=read%20write&" + "client_secret=mysecretoauthsecret&client_id=myapp"; return $http.post('oauth/token', data, { headers: {...

android - TileMap occupy same physical space independent of screen density? -

i have been reading lately , don't understand how should manage tilemap occupies same physical space independent of screen density. tiles: 48x32 pixels. tilemap: 10x10 tiles. how can achieve in devices map occupies 480x320 pixels of screen? possible? do have put tiles of different sizes? mdpi: 48x32 pixels. hdpi: 72x48 pixels. and on? trying things getting me more confused, please clarify me. as rule, should never deal in px anything. use dp (display pixels), because automatically scale different densities.

javascript - What do back end/server-side languages actually do? -

after grasping fundamentals of html, javascript (frontend) , css, wanted learn backend programming, is, languages do, etc. unfortunately couldn't find sources of information (links welcome!). have few questions. i confused backend programming in general. exaclty needed create web app or multiplayer web game. for example, if learned node.js need learn mysql/sql create multiplayer game (air hockey game player profile) . what python/php? i don't understand roles languages play in end. e.g: if wanted have global hi-score menu on game. ※would have have database? ※would have use end language? i have heard socket.io website not helpful people don't know stuff (like me!) don't have idea - framework, plugin, language etc. - or does. - on website says: socket.io enables real-time bidirectional event-based communication. i have no idea means! explanation helpful! ※ need end programming language or node.js use socket.io? i feel these important ...

Python mechanize returns HTTP 429 error -

i trying automated task via python through mechanize module: enter keyword in web form, submit form. look specific element in response. this works one-time. now, repeat task list of keywords. and getting http error 429 (too many requests). i tried following workaround this: adding custom headers (i noted them down website using proxy ) looks legit browser request . br=mechanize.browser() br.addheaders = [('user-agent', 'mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/41.0.2228.0 safari/537.36')] br.addheaders = [('connection', 'keep-alive')] br.addheaders = [('accept','text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8')] br.addheaders = [('upgrade-insecure-requests','1')] br.addheaders = [('accept-encoding',' gzip, deflate, sdch')] br.addheaders = [('accept-language','en-us,en;q=0.8')]` since blocked response coming every 5...

office365 - What browser / browser engine do Office Add-ins use? -

so trying started developing office 365 add-ins (previously apps office), , wondering browser or browser engine office uses when renders app. tried using javascript's navigator.appcodename , navigator.appname , due problem described here renders method useless. browser or engine office add-ins use render apps? it depends on office being used. if it's on windows desktop, office add-ins use internet explorer load hosted webpage in office. ios, rely on native webview control. if on office online, use sandboxed iframe, in ever browser open office online with. if you're trying determine browser office running in, believe sniffing user agent string work you.

python - Leading or trailing whitespace and pandas value_counts vs boolean selection -

i working dataframe created csv file downloaded county's sheriff's department. data located here , can read in using read_csv() . dataframe contains information incidents reported , acted upon sheriff. 1 of columns city in incident occurred, , i'm trying create table , graph showing change in number of incidents area (larkfield) on time. when use panda's value_counts function using "city" input, get in [86]: compcounts = soco['city'].value_counts() in [96]: compcounts[0:10] out[96]: santa rosa 55291 windsor 31711 sonoma 28840 guerneville 9309 boyes hot springs 8006 petaluma 6103 el verano 5969 geyserville 5822 larkfield 5398 forestville 5312 dtype: int64` there 5398 reports area ('larkfield'). when try subset of dataframe area, using larkfieldcomps = soco[soco['city'] == "larkfield...

powershell - Difference between -NS and -NAMESERVER -

i writing script create necerassary dns records of zone in powershell. going through documentation, saw 2 properties add-dnsserverresourcerecord command . 1 -ns , , other -nameserver . can please explain me difference between two? , 1 use set ns records zone? see in docs, not alieses each other. -ns switch parameter tells cmdlet adding ns record dns. -nameserver how pass value of ns record. essentially -ns required on ns parameter set (because that's how parameter set gets chosen). -nameserver available in ns parameter set, , required in set because it's value need set. so set ns records zone, need both. this similar relationship between -ptr , -ptrdomainname .

angularjs - Lose cookie/session when reload page -

i have 2 separate applications: angularjs client working on http://localhost:8080 nodejs api server working on http://localhost:3000 nodejs api server gives json data client (and not give html pages). i store information autentificated user in sessionstorage. the problem: when login system , reload page, lost information user in sessionstorage. here angularjs auth service: module.exports = function($http, $location, $cookies, $alert, $window) { $window.sessionstorage.setitem('currentuser', json.stringify($cookies.get('user'))); $cookies.remove('user'); return { login: function(user) { return $http.post('http://localhost:3000/api/login', user).success(function(data) { $window.sessionstorage.setitem('currentuser', json.stringify(data)); $location.path('/fillprofile'); $alert({ title: 'cheers!', content: 'you have logged in.', placement: 't...

css - vertically justified flexbox elements -

the old display:box had ability justify element vertically, n number of elements h defined height, arrange justified ( vertically ) in relation parent element. is there way of achieving using current dislpay:flex system? you looking flex rule justify-content: space-between; . put on parent element , align items first 1 touches start of container, last 1 touches end of container, , rest of space distributed between elements. you can use align-items align elements in direction perpendicular flex direction. example if flex-direction column (vertical), justify-content justify items vertically , align-items align them horizontally. conversely if flex-direction row (horizontal), justify-content justify items horizontally , align-items align them vertically. more info here: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

android - ExpandableListView click handling -

two questions: i want allow user long-click on child items if they're in first group of expandable list view. under other group, should not allowed. how can this? i want user allowed long-click group items except first one. i'm going handling both questions in expandablelistviews onitemlongclicklistener. currently have: @override public boolean onitemlongclick(adapterview<?> parent, view view, int position, long id) { if (bunchesexplistview.getpackedpositiontype(id)==expandablelistview.packed_position_type_group) { // long click on bunch bunchlongclickdialog bunchlongclickdialog = new bunchlongclickdialog(); bundle bundle = new bundle(); bundle.putint("group_position", position); bunchlongclickdialog.setarguments(bundle); bunchlongclickdialog.show(getfragmentmanager(), "bunch_long_click_dialog"); } return true; } this tells if i'm clicking group, doesn't check group being...

user interface - JavaScript: Getting the right UI element in a list of them -

i building ui in javascript involves adding column of checkboxes: for (var key in processandportlist.list) { if (processandportlist.list.hasownproperty(key)) { var datarow = mytable.insertrow(-1); var datacell = datarow.insertcell(-1); datacell.textcontent = key; datacell = datarow.insertcell(-1); datacell.textcontent = processandportlist.list[key].port; var terminationcheckbox = document.createelement('input'); terminationcheckbox.type = "checkbox"; terminationcheckbox.id = key; terminationcheckbox.checked = processandportlist.list[key].markedfortermination; terminationcheckbox.onchange = function() { var ischecked = terminationcheckbox.checked; markfortermination(key, ischecked); }; var terminatecell = datarow.insertcell(-1); terminatecell.appendchild(terminationcheckbox); } } the problem comes in associating correct...

php - Static variable is sometimes not storing correctly -

i'm using php generate nonce (unique key) content security policy on site. idea nonce generated first time requested, nonce returned each time after (within single http request). code i'm using class csp { private static $nonce = null; public static function nonce () { if (!isset(self::$nonce)) { self::$nonce = bin2hex(openssl_random_pseudo_bytes(15)); } return self::$nonce; } } it's being called by \namespace\csp::nonce(); the function called several times on each request, , returns different values. example, function called both while sending http headers , while generating page body content, , (probably more 1 in 20 times), different value being sent in http header , in body of response, triggering content security policy (so bad things happening). also, unrelated, when tried use static:: rather self:: , unable set variable. can't find documentation on this, i'm not sure whether it's feature or not. i'm using php ...

angularjs - Cannot find module 'destroy' -

i using "yo angular-fullstac" , getting below error when running "grunt server" or "grunt serve --force" command. idea why happens? how fix it? running "autoprefixer:dist" (autoprefixer) task file .tmp/app/app.css created. file .tmp/app/app.css.map created (source map). running "express:dev" (express) task starting background express server debugger listening on port 5858 module.js:338 throw err; ^ error: cannot find module 'destroy' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object.<anonymous> (d:\projects\newmm\node_modules\express\node_modules\s end\index.js:8:15) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17) running "wait...

How do Iterators work on a List in C++? -

this confusion have how iterators work on list in c++. please correct me if wrong. a list (in c++) under hood double linked list. know structure of doubly linked list-a data area , pointer next , previous nodes. every node in doubly linked list has address in memory. when declare iterator on on list, points address. when derefence iterator, how data value? the iterator's dereference operator defined return (a reference to) value contained in node. example defined this: template<t> t& list<t>::iterator::operator *() { return this->node_pointer->value; }

c++ - Boost.Asio: SSL Server and Client. Server SIGSEGV and Client Short Read error -

i have built ssl samples of boost , have run them no obvious problems. have written own code using http server , ssl examples references. when run code got error client: handshake failed. error: short read and server: debug: connectionmanager::connectionmanager() debug: server::server(boost::asio::io_service&, short unsigned int) debug: std::__cxx11::string server::hpasswordhandler() const debug: void server::startaccept() debug: connection::connection(boost::asio::io_service&, boost::asio::ssl::context&, connectionmanager&) debug: boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp> >::lowest_layer_type& connection::socket() debug: void server::haccept(const boost::system::error_code&) debug: void connection::start() debug: void server::startaccept() debug: connection::connection(boost::asio::io_service&, boost::asio::ssl::context&, connectionmanager&) debug: boost::asio::ssl::stream<boost::asio::b...

Jhipster deployment to aws failing - No Solution Stack named '64bit Amazon Linux 2015.03 v1.4.1 running Tomcat 8 Java 8' found -

i trying deploy application built using jhipster on aws following steps mentioned in document - http://jhipster.github.io/aws.html it fails. see printed on command prompt. create s3 bucket bucket exists upload war s3 war uploaded successful create database database created successful waiting database (this may take several minutes) database available @ jdbc:mysql://urltodb:3306/ create/update application x no solution stack named '64bit amazon linux 2015.03 v1.4.1 running tomcat 8 java 8' found. can please me resolving problem here. thanks in advance, ankit the issue should fixed in new jhipster release, check following bug https://github.com/jhipster/generator-jhipster/issues/789#issuecomment-133468642

sql - Why "SELECT COUNT(DISTINCT <Column>) FROM <Table>" return 0? -

i have run query above columns in massive table (billion rows) , fine except couple returning 0. how possible? count(distinct) can return 0 under 2 circumstances. first values column/expression evaluate null . second where clause (or join ) filters out rows. if have no where or join , values null <columnb> .

ruby on rails - connect() to unix:/app_path/shared/sockets/unicorn.[app].sock failed. No such file or directory -

i deployed rails app using capistrano gem on ubuntu 14.04. using nginx, unicorn. i've followed steps in deployment http://requiremind.com/deploying-a-rails-app-on-your-own-server-the-ultimate-guide/ seems not working. message "we're sorry, went wrong." verified nginx up sudo netstat -plutn | grep :80 output tcp 0 0 0.0.0.0:80 0.0.0.0:* listen 27525/nginx and here /var/log/nginx/error.log *7 connect() unix:/home/user/apps/my_app/shared/sockets/unicorn.2doto.sock failed (2: no such file or directory) while connecting upstream, client: client_ip_address, server: , request: "get / http/1.1", upstream: " http://unix:/home/user/apps/my_app/shared/sockets/unicorn.2doto.sock:/ ", host: "server_ip_address" but file unicorn.2doto.sock exists in location. , not sure why isn't working! unicorn.rb file app_dir = "/home/user/apps/my_app" shared_dir = "#{app_dir}/shared" root = ...

json - AngularJS Not Setting Correct Content-Type In Http POST -

so trying upload mp3 file nodejs server. seeing file data , correctly, know model right, every time send http post, invalid json error. confusing because have set content-type both undefinded , multipart/form-data , regardless when console still see in request header content-type set application/json. here code using upload: template: <form> <div class="form-group"> <label name="type-label" for="type">type</label> <select name="type" ng-model="data.type"> <option value="music">music</option> <option value="image">image</option> <option value="video">video</option> </select> </div> <div class="form-group"> <label name="name-label" for="name">name</label> <input type="text" name="name" ng-model="data.name...

javascript - Attempting to simulate a wheel event [Firefox] -

to clarify example, want simulate scroll event @ center of open window. should affect reasonably main scrolling element on given page. here relevant pages https://developer.mozilla.org/en-us/docs/web/api/wheelevent/wheelevent https://developer.mozilla.org/en-us/docs/web/api/mouseevent/mouseevent#values and here's i've tried. scroll_evt = new wheelevent('wheel', { deltay: 10.0, deltamode: wheelevent.dom_delta_line, clientx: content.innerwidth/2, clienty: content.innerheight/2 }); -> wheel { target: null, buttons: 0, clientx: 520, clienty: 320, layerx: 0, layery: 0 } however, despite no errors, dispatching event seems not have effect. window.dispatchevent(scroll_evt); -> true so i'm left wonder: there critical property i'm missing in initializer? window appropriate target event? i'm out of ideas. update this works. https://developer.mozilla.org/en-us/docs/mozilla/tech/xpcom/reference/interface/nsidomwindowu...

module - How to extract .rar files in node.js? -

i trying extract .rar files using node.js in windows 8.1. there way this? thanks in advance var unrar = require('unrar'), fs = require('fs'), archive = new unrar('t.rar'); archive.list(function(err, entries) { (var = 0; < entries.length; i++) { var name = entries[i].name; var type = entries[i].type if (type !== 'file') { fs.mkdirsync(name) } } (var = 0; < entries.length; i++) { var name = entries[i].name; var type = entries[i].type; if (type !== 'file') { continue; } var stream = archive.stream(name); try { fs.writefilesync(name, stream); } catch (e) { throw e; } } }); please check unrar may *this script tested on linux ubuntu

algorithm - List of all edge disjoint paths in a tree -

in generic tree represented common node structure having parent , child pointers, how can 1 find list of paths have no overlapping edges each other , terminate leaf node. for example, given tree this: 1 / | \ 2 3 4 / \ | / \ 5 6 7 8 9 the desired output list of paths follows: 1 2 1 1 4 | | | | | 2 6 3 4 9 | | | 5 7 8 or in list form: [[1, 2, 5], [2, 6], [1, 3, 7], [1, 4, 8], [4, 9]] obviously path lists , order can vary based on order of processing of tree branches. example, following possible solution if process left branches first: [[1, 4, 9], [4, 8], [1, 3, 7], [1, 2, 6], [2, 5]] for sake of question, no specific order required. you can use recursive dfs algorithm modifications. didn't language use, so, hope c# ok you. let's define class our tree node: public class node { public int id; public bool usedonce = ...

php - How to Pass value to Bootstrap model in laravel? -

i trying pass value bootstrap model, each of rows edit button displays last row id. how can display edit button on each of rows? here sample of code: @foreach($data $cat_values) <tr> <td><input type="checkbox" class="checkthis" /></td> <td>{{$cat_values->cat_name}}</td> <td>{{$cat_values->cat_desc}}</td> <td>{{$cat_values->cat_slug}}</td> <td>{{$cat_values->created_at}}</td> <td>{{$cat_values->updated_at}}</td> <td><p data-id="{{$cat_values->id}}" data-placement="top" data-toggle="tooltip" title="edit"> <button data-id="{{$cat_values->id}}" class="btn btn-primary btn-xs edit-page" data-title="edit" data-toggle="modal" data-target="#edit" > <span class="...

android - How to put 2 ListView and put TextView in TableView after Listview? -

i have 2 listview in 1 activity example: [tablerow - 4 textview in 1 row] [listview1] [tablerow - 4 textview in 1 row] [listview2] i tried: linearlayout , set vertical ; layout_weight ; relativelayout ; android:width ="0dp"; layout_below / above sometimes, listview overlap, second tablerow not displayed. may know how solve ? here activity xml file. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.bus"> <tablerow android:id="@+id/table1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/border" android:gravity="center_horizontal"> <textview android:id="@+id/tvleaving" andr...

php - yii2 model validating but form not storing data in database -

when validate form $model->validate() validation works perfect when data filled in form still not saving data database , not redirecting. tell me solution. below code controller's code of actioncreate() : public function actioncreate() { $model = new clientusers(); if($model->load(yii::$app->request->post())) { // && $model->validate() //get file instance $imagename = $model->first_name . '_' . yii::$app->security->generaterandomstring(); if ($model->file = uploadedfile::getinstance($model, 'file')) { $model->profile_pic = '../../user_uploads/' . $imagename . '.' . $model->file->extension; $model->file->saveas('../../user_uploads/' . $imagename . '.' . $model->file->extension); } $model->created_date = date('d-m-y h:m:s'); $model->updated_date = date('d-m-...