Posts

Showing posts from January, 2011

php - Switching on mysqli over mysql -

i have mysql installed , want work on mysqli new database. does affect previous database in mysql if enable mysqli in phpmyadmin? mysqli -> mysql improved extension . the mysqli extension, or known, mysql improved extension, developed take advantage of new features found in mysql systems versions 4.1.3 , newer. mysqli extension included php versions 5 , later. you have change code have done using mysql . no need change database. mysqli methods use mysql database. this may help

mysql - Haversine Formula works as Normal SQL but not in stored procedure -

Image
i using haversine formula find distance between users. works normal mysql piece of code. when use same in stored procedure not working , throws 0.00 distances. don't know why? this working code: drop temporary table if exists temp_tab; create temporary table temp_tab(temp_id integer not null auto_increment primary key, user_fb_id bigint(20) unique,distance double(15,8) default null) charset=utf8; insert temp_tab (user_fb_id, distance) select * (select user_fb_id, 6371 * acos(sin(radians( 11.01684450 )) * sin(radians(`latitude`)) + cos(radians( 11.01684450 )) * cos(radians(`latitude`)) * cos(radians(`longitude`) - radians( 76.95583210 ))) `distance` `user_login_log` user_id <>'1831820984' having `distance` <= 50 order `activity_at` desc) t1 group user_fb_id; select * temp_tab; normal sql output: stored procedure output: stored procedure: delimiter ;; create definer=`up_beta`@`127.0.0.1` procedure ...

Overriding in C#, making two subsequent method virtual -

it's question of overriding in c#. when use following code: class program { class { public virtual void callme() { console.writeline("this a"); } } class b : { public new virtual void callme() { console.writeline("this b"); } } class c : b { public override void callme() { console.writeline("this c"); } } static void main(string[] args) { obj = new c(); obj.callme(); console.readkey(); } } output: this a and when use: class program { class { public virtual void callme() { console.writeline("this a."); } } class b : { public override void callme() { console.writeline("this b."); } } class c : b { public override void callme() ...

java - How to open local text file with JavaFX WebView -

Image
is possible open local text file javafx webview ? have try following code not working. how can make enable this? thanks. webview wv = new webview(); wv.getengine().setcreatepopuphandler(new callback<popupfeatures, webengine>() { @override public webengine call(popupfeatures p) { stage stage = new stage(stagestyle.utility); webview wv2 = new webview(); stage.setscene(new scene(wv2)); stage.show(); return wv2.getengine(); } }); wv.getengine().loadcontent("<a href="file:///c:\users\dev\infor.txt">open file</a>"); stackpane root = new stackpane(); root.getchildren().add(wv); scene scene = new scene(root, 300, 250); primarystage.settitle("hello world!"); primarystage.setscene(scene); primarystage.show(); yes, can open local text file javafx webview. sample app: import javafx.application.application...

oracle - To insert a value in a String -

i have requirement manipulate string required value. i need change actualstring99 actualstring_99 . passing actualstring99 function , returning actualstring_99 in following way. select 'value' actual, regexp_replace('value', '[[:digit:]]') string, regexp_replace('value', '[[:alpha:]]') digit, concat(concat(regexp_replace('value', '[[:digit:]]'),'_'),regexp_replace('value', '[[:alpha:]]')) required dual; passing value as actualstring99 . have other simple way (using or without using regular expression) out calling function? to prepend underscore before numerical part of string, can use regexp_replace backreference. select regexp_replace('actualstri...

bluetooth lowenergy - connecting issue with android ble -

i have issue ble getting disconnecting, below code changes based on answer earlier used response show data ble device phone , but after code change can not data device think has "enable_indication_value" , "enable_notification_value" can call both @ same time public void setcharacteristicnotification(bluetoothgattcharacteristic bluetoothgattcharacteristic, boolean flag) { if(mbluetoothadapter == null || mbluetoothgatt == null) { log.w(tag, "bluetoothadapter not initialized"); } else { mbluetoothgatt.setcharacteristicnotification(bluetoothgattcharacteristic, flag); bluetoothgattdescriptor bluetoothgattdescriptor = bluetoothgattcharacteristic.getdescriptor(uuid.fromstring(samplegattattributes.client_characteristic_config)); if(bluetoothgattdescriptor != null) { bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_notification_value); mbluetoothgatt.writedescriptor(...

r - Change label in ggpairs upper panel -

Image
do know how change labels in upper panel in ggpairs ( ggally package)? found how change size, font not label. here want shorten label ("set" pour setosa etc...). tried put in labels=c("set", "ver", "vir") or upper=list(params=list(size=8),labels=c("set", "ver", "vir")) doesn't work. ggpairs(iris, columns=c(2:4), title="variable analysis", colour="species", lower=list(params=list(size=2)), upper=list(params=list(size=8))) conceptually same @mike's solution, in 1 line. levels(iris$species) <- c("set", "ver", "vir") ggplairs(<...>) here's another, more flexible proposal if have many levels , not want abbreviate them hand: trim levels desired length. levels(iris$species) <- strtrim(levels(iris$species), 3) ggplairs(<...>) and way, width parameter vectorized: rm(iris) strtrim(levels(iris$species), c(1, ...

math - Write a calculator for the identity sin² + cos² = 1 -

here's wrote: public class math { public static void main (string[] args){ double degrees = double.parsedouble(args[0]); double s = math.sin(degrees); double c = math.cos(degrees); double x = s*s + c*s; system.out.println(x); } } i want enter number args[0] goes sin() , cos() . want add 2 variables making equal 1, because sin² + cos² = 1 . doing wrong? edit: made changes code s*s + c*c , i'm still getting same error. i'm getting error: 2 errors found: file:... [line: 4] error: cannot find symbol symbol: method sin(double) location: class math file:... [line: 5] error: cannot find symbol symbol: method cos(double) location: class math you not squaring each term calculating , printing sin(x) + cos(x) . replace double x = s + c; with double x = s*s + c*c; and should right behaviour.

r - How to convert my spatiotemporal NetCDF data to spatial data? -

i beginner in r. , totally struck problem. can download netcdf file link below take look. https://drive.google.com/file/d/0byy3oaw62eshbkf6vwnfukrymmm/view?usp=sharing ^this netcdf atmospheric data file 8 variable , 8 dimension. here,my variables of interest are: timsid number of site (its include urban site, rural site etc.) urban :: number of urban sites [urban 3 row 250 column matrix. row1 number of urban sites , row2 latidude, row 3 longitude.] time :: data collected 1 march 2012 may 2012 [encoding 'time' yyyymmddhh] pm10 :: hourly particulate matter concentration measured @ every station of every site i need work these 4 variables large data set. i have separate data of pm10 values @ urban sites "1 march 2012". (actually need find in timsid variable sites urban sites , match corresponding pm10 value urban sites 01 march 2012.) for example, in timsid, different type of sites exist urban, rural etc named 111121,111122,111123,111124 urban s...

php - POST works on Postman, but not with CURL -

Image
using postman, send post (my username , password filled in): https://ssl.reddit.com/api/login?api_type=json&user=xxx&passwd=xxx&rem=true i receive response containing modhash , cookie. then, send second post postman to: https://en.reddit.com/api/comment?api_type=json&text=7/1/15test&thing_id=t1_csa56v2 with following headers (xxx has been confirmed , filled in): user-agent: xxx cookie: reddit_session=xxx x-modhash: xxx this provides correct response, when try same thing curl in php, responds user_required. once again, have confirmed cookie , modhash correct. $name = 't1_csa56v2'; $text = 'newest test 7/2/15 12:20am'; $url = 'https://en.reddit.com/api/comment'; $modhash = 'xxx'; $cookie = 'xxx'; $headerfields = array ( 'user-agent' => 'xxx', 'cookie' => 'reddit_session='.$cookie, 'x-modhash' => $modhash ); $postfields = array ( 'api_ty...

How do I configure jboss log4j to avoid logging into server.log and instead write to a separate log file for a specifc java package? -

problem:- configure jboss log4j log separate log file above referenced java package -- resolved needed advise on solution configure jboss log4j avoid logging server.log specific java package environment:- app server (jboss eap 5.1) configured , running on oracle linux vm through oracle virtualbox manager. my approach:- i able configure jboss log separate file modifying jboss-log4j.xml have new appender (mytestlogs) , category package(com.mytestpackage) reference new appender. cannot avoid jboss logging server.log package. my jboss-log4j.xml:- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- ================================= --> <!-- preserve messages in local file --> <!-- ================================= --> <!-- time/date based rolling appender --> <appender name="file" class="org.jboss.logging.appender.dailyrollingfileappender"...

why `ifroom` does not work - android studio -

hi there try set ifroom in menu item. can see in code try possible senario (please see each showasaction item <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <item android:id="@+id/action_forward" android:title="forward" android:icon="@drawable/ic_action_arrow_forward" android:showasaction="ifroom" ></item> <item android:id="@+id/action_zoom_in" android:title="zoom in" android:icon="@drawable/ic_action_zoom_in" android:showasaction="ifroom|withtext" ></item> <item android:id="@+id/action_home" android:title="home" android:icon="@d...

c# - Unable to get method SyntaxTree.ParseFile in new nuget of Roslyn? -

i have installed nuget roslyn install-package microsoft.codeanalysis -pre i'm still unable method syntaxtree.parsefile want pass code in .cs file any clue why ? how can pass file here? the api changed little bit, 1 way : var path = @"c:\...\somefile.cs"; using(var stream = file.openread(path)) { var syntaxtree = csharpsyntaxtree.parsetext(sourcetext.from(stream), path: path); }

javascript - get json_encode data without an index number -

i'm passing db values using json _encode() . below query , works okay. but when add additional data array number in front of output data. $sql = "select item, price, availability items category = :category order item desc"; $stmt= $connect->prepare($sql); $stmt->execute(array(':category'=>"fruits")); $rslt = $stmt->fetchall(pdo::fetch_assoc); foreach ($rslt $val){ $data[] = $val; } $data['additional'] = $someadditionaldata; echo json_encode($data); current output: {"0":{"item":"lychee"},"1":{"item":"ornage"},"2": "item":"apple"},"additional":abc} my question is, how output without index numbers (as below) [{"item":"lychee"},{"item":"ornage"},{"item":"apple"},{"additional":"abc"}] php chooses se...

paypal - what time format is this and how to convert it to unix time in php? -

2015-07-01t23:06:30z got paypal api. have never seen format before t , z stand for. how can convert unix time in php? that's date/time in iso8601 format. t delimiter marking start of time field, , z (commonly spoken 'zulu') common shorthand gmt or utc. it's directly supported php can use strtotime() echo strtotime("2015-07-01t23:06:30z"); // 1435791990 iso8601 reference

database - How do I setup keywords in this case? -

i making db hold drawings / files / notes or links these items. i'm making program let user type in keyword , give them links drawings/ files/ or notes. i'm not sure how store keywords , still have fast enough work. example table main id area type specific file keywords 1 rx1 icc tester .. lock, sg1, va2, cn1, cn2, sgp, vu, boof 2 rx1 ecu tester .. sg1 , ba3, yys, yyz, yyx, lock 3 rx3 ecu control .. sg2, sg3, va2, yys etc.... so user select area type specific, , type in keyword results. there 10,000 rows. , keywords anywhere 1 200. second can done in ms access db? know access has limits it's have installed , used working with. don't keep keywords in main table. instead, keep keyword table , filetokeyword table many many relationship. have no limit number of keywords each item. your primary key table should both columns (fileid, keywordid) , search 3-table join. i answered similar question yesterday tab...

c - io_submit() blocks until a previous operation will be completed -

i'm using linux kernel aio through libaio , , have submit next reading operation before previous 1 completed. problem io_submit() blocks time and, can deduce interval, waits previous operation completed. i know can enqueue several operations single io_submit() , not option me, because don't know how next read operation when it's time submit first one. is working me, or everyone? in second case, may ask if i'm looking feasible, or have fallback threaded model?

c# - Can't connect to camera show login loop -

i go project smart parking. have problem when connect ip of camera, call function connect() , show login screen , when login success must show form way. but, when login successfull, show login screen again , loop. here code: if write code in event formload actived. event formactived broken. in form way : axlivex1 control of camera geovision. public void opencamera(bool position, string username, string password, string ipaddress) { try { if (!position) { axlivex1.ipaddress = ipaddress; axlivex1.username = username; axlivex1.password = password; axlivex1.defaultcam = 11; axlivex1.connect(); } } catch (exception ex) { #if debug debug.writeline(ex.tostring()); #endif } } private void frmway_a...

php - Angularjs Form input text is always undefined -

here form <form> <input class="text_box1" type="text" name="email" ng-model="forget.email" > <button style="width:auto" class="sign_up" ng-click="doforget(forget)">get password</button> </form> inside app.js have .when('/forget', { title: 'forget', templateurl: 'resources/views/forget.php', controller: 'authctrl' }) and inside authctrl controller tried console of input value. $scope.doforget = function (customer) { console.log($scope.email); }; but getting console undefined always. how can value ? no need define email just $scope.forget={}; and value in controller $scope.forget.email

xml - How can I write a namespace agnostic XPath query using XPath axes -

let's have xml presented below: <ns1:test xmlns:ns1="http://www.w3.org/tr/html3/" xmlns:uml="http://www.w3.org/tr/html4/"> <uml:class name="test1"> <uml:modelelement.stereotype> <uml:stereotype name="afv"/> </uml:modelelement.stereotype> </uml:class> <uml:class name="test2" > <uml:modelelement.stereotype> <uml:stereotype name="afv"/> </uml:modelelement.stereotype> </uml:class> <uml:class name="test3" > <uml:modelelement.stereotype> <uml:stereotype name="rcs"/> </uml:modelelement.stereotype> </uml:class> <uml:class name="test4" > <uml:modelelement.stereotype> <uml:stereotype name="dfk"/> </uml:modelelement.stereotype> ...

vector - How to find the appropriate rotation of a pentagon for fitting into a LibGDX hex-tessellated sphere? -

i've got tricky question today involves lot of vectors. i'm trying keep them straight. have shape (mostly hexagons 12 pentagons): http://i.imgur.com/wdswecf.jpg and want place 12 pentagon meshes 12 spots. start creating 12 meshes @ origin (the center of shape) , using following code rotate , move them position. (int = 0; < 12; ++i) { vector3 pentpoint = pentpoints.get(i); // center of each pentagon. modelinstance pent = pents.get(i); vector3 direction = (pentpoint).cpy().sub(new vector3(0, 0, 0)) .nor(); direction.set(direction.x, direction.y, direction.z); pent.transform.settorotation(vector3.y, direction); pent.transform.settranslation(pentpoint);} now, need. results in this: http://i.imgur.com/ch5jhb8.jpg . forgetting scaling now, can see pentagon rotated improperly. doesn't line slot. know can fix rotation using pent.transform.rotate(vector3.y, *value*); based on value ea...

javascript - is there any Yii widget "Radio Button Set "? -

i'm using bootstrap in project , want radio button set 1 in following link . <?php $radio = $this->beginwidget('zii.widgets.jui.cjuibutton', array( 'name'=>'checkbox-btn', 'buttontype'=>'buttonset', 'htmltag'=>'span', )); ?> <input type="checkbox" id="check1" value="1" /><label for="check1">checkbox 1</label> <input type="checkbox" id="check2" value="2" /><label for="check2">checkbox 2</label> <input type="checkbox" id="check3" value="3" /><label for="check3">checkbox 3</label> <?php $this->endwidget();?> but doesn't seem work, renders normal radiobuttonlist unsure emoticon searched in yiistrap, yiiwheels, zii , yiibooster , couldn't find widget similar " radios buttons". should include jquery ui ? pre...

AngularJS + ASP.NET MVC: routing URLs without corresponding physical view -

context have web app using angularjs asp.net mvc. aims replicate file-system structure through urls, this: http://(site1)//rootfolder//nfolders//file for views in angular, using stateprovider , different states associated existing views in disk (.cshtml files). the problem issues when request file or folder browser , try serve virtual view doesn't exist. have been able achieve full postback , hacks, making complete reload on each file/folder request. question : there way of achieving in angular? other way, request different urls don't have either corresponding physical view file or state in stateprovider, handling them angular , customizing specific view deal disk routes requested url? re-edit have: a fixed root view website: http://website several root projects name: http://website/site1 http://website/site2 .... http://website/siten each site may have different files , folders accesible via url: http://website/site1/folder1/folder2/.../folde...

java - Getting Null from post data from jsp -

<center> <form class="form-horizontal" action="${pagecontext.servletcontext.contextpath}/largelandmarklistget" method="post"> <div class="form-group"> <label class="control-label col-sm-2" for="sllrid">sllrid:</label> <div class="col-sm-10"> <input type="text" class="form-control" id="sllrid" placeholder="enter sllrid..."> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">submit</button> </div> </div> </form> </center> that particular definition of action in jsp. strin...

alternative to function within function in php -

so have function call/return to/from ajax. can see, there multiple places return data , stop script if conditionals met. (obviously) far less concise if had function passed error message , returned/encoded json, while stopping main function continuing. problem not know how best structure sort of thing in php, given functions within functions aren't used. sorry long code piece... not sure how else describe issue. sincere (or other unrelated tips even). appreciated. public function mask_as_user() { $this->load->model('user_model', '', true); $email = $this->input->post('email'); //there should front-end validation here too, if not permitter, dont allow proceed. if (strpos($this->session->userdata('user_type'), 'permitter') === false) { $return['status'] = 'error'; $return['message']= 'you not admin.'; header('content-type: application/json...

jmeter - How to save specific data from response data to csv file -

in webservices test plan, sending soap request create user , sends username , unique id in response data. want save username , uniqueid csv file. could let me know how can achieve that? you can extract data using regex post processor , save variable. simple data writer, flexible data writer, save results file these can write predefined variables, responses file in fixed or little bit customizable format won't let write custom variables. for writing file need use beanshell processor. sample code be, username = vars.get("username"); password = vars.get("password"); f = new fileoutputstream("/path/user_details.csv", true); p = new printstream(f); this.interpreter.setout(p); print(username + "," + password); f.close();

python - inplace removal of quotes from list of list -

i changed list orig_list=['"jason","hello1,hello2,hello3","somegroup2","bundle1","loc1"', '"ruby","hello","somegroup","bundle2","loc2"', '"sam","hello3,hello2","somegroup3,somegroup4","bundle2","loc3"'] new_list=[x.split(",") x in orig_list] new_list=[['"jason"', '"hello1', 'hello2', 'hello3"', '"somegroup2"', '"bundle1"', '"loc1"'], ['"ruby"', '"hello"', '"somegroup"', '"bundle2"', '"loc2"'], ['"sam"', '"hello3', 'hello2"', '"somegroup3', 'somegroup4"', '"bundle2"', '"loc3"']] what intent [[...

regex - Redirect Traffic to new webfolder. URI Redirection on Linux -

there bunch of website files in main web root directory /var/www. want able move these sub folder clean www folder. the problem when moved files subfolder website looses track of css, png, jpg , many other files , links on website. currently sites avaiable in apache2 looks this <---/etc/apache2/sites-available----> rewriteengine on rewriterule !/.(js|htm;|ico|pdf|css|doc|xls|xml)$ /index.php i moved sites contents folder. structure looks like /var/www/livesite when debugging in webbrowser example warning appears cannot locate http://192.168.1.5/resources/imgs/file.png though images resides in http:/192.168.1.5/livesite/resources/imgs/file.png create /var/www/.htaccess file rule: rewriteengine on rewriterule ^(resources/.+)$ /livesite/$1 [l,nc,r=301]

python - Password prompt in pycharm -

i trying prompt user password in pycharm, without echoing password in console output. i have tried use getpass module, echo back. how this, or make getpass not echo password in pycharm? here's bit of digging code: getpass first tries manipulate tty, throws exception >>> os.open('/dev/tty', os.o_rdwr|os.o_noctty) oserror: [errno 6] device not configured: '/dev/tty' it tries manipulate stdin, throws exception: >>> sys.stdin.fileno() attributeerror: stdin instance has no attribute 'fileno' does know of way make either work?

mysql - SQL different table or store as text in same table -

i have dilemma can't seem put rest. on page have list of objects. each of objects slider - aribnb - https://www.airbnb.com/s/london--united-kingdom?source=ds in db store information object (it has other info except slides), i'm thinking, easiest store url slides block of text. url | other_field ----------------------- url1,url2 | other stuff then handle there in either front end or backend converting them array etc. the second approach create separate table i'd store each url , id of object url belongs on separate row url | obj_id ------------- url1 | id1 url2 | id1 url3 | id2 ............. . i'd group_concat( distinct x) , return them me block of text. i'd same thing splitting them up. long story short, store them field in initial table or in separate table, each being it's own row. advantages , disadvantages either approach? me seems easier have them text in same table, i'm inexperienced in this, need advice. edit: final usab...

javascript - chrome app add local script and script from url -

i'm starting chrome app. things doesn't work security reason. <script src='https://code.jquery.com/jquery-1.11.0.min.js'></script> <script src='app.js'></script> so how add 2 kind of script app? tried different things in manifest file none of them have been successfull the simplest way avoid security issues download jquery-1.11.0.min.js , place in script directory. ensure won't have security soap issues. include files this: <script src='/example_local_directory/jquery-1.11.0.min.js'></script> <script src='/example_local_directory/app.js'></script>

css - wanting to position the image that appears when a different image is hovered over -

so wanting change position of image appears hover effect. right image kind of goes under first image holds hover effect. struggling hardcore. have tried positioning , floating , simple left:90px or right:90px image shows upon hovering doesn't budge. here jsfiddle. images broken can jist. https://jsfiddle.net/k0fvbcno/ appreciated. <div id="pain1"> <img class="pain1" src="images/painspot.png"> <img class="shoulder" src="images/shoulder.png"> </div> <div id="pain2"> <img class="pain2" src="images/painspot.png"> <img class="back" src="images/back.png"> </div> <div id="pain3"> <img class="pain3" src="images/painspot.png"> <img class="hip" src="images/hip.png"> </div> #pain1 { position: absolute; left: 710px; top: 220px; margin:...

python - Date Conversion Django Error -

i have date here fri jun 19 02:27:25 pdt 2015 db , trying convert pdt utc first converting datetime object this: date_time = datetime.datetime.strptime(date, '%a %b %d %h:%m:%s %z %y'); when run python file directly, works, when code executes thru django framework, error. valueerror: time data 'fri jun 19 02:27:25 pdt 2015' not match format '%a %b %d %h:%m:%s %z %y' i have feeling because of timezone, because have many more date formats don’t contain timezone , conversion them works fine. suggest workaround this. this error raised because datetime module not recognize time-zones, use dateutil module instead of datetime similar below: from dateutil.parser import parse parse('fri jun 19 02:27:25 pdt 2015')

json - Getting a Server-Side JsonParseException / Char code 31 on Index Creation via Nest -

good afternoon, i struggling bit index creation requests towards hosted elastic search service (facetflow), more precisely, es server returns jsonparseexception , returns http 500 response , nest client (correctly) reports index creation request have failed (non valid/not acknowledged etc) i sniffed http traffic via fiddler , gets sent on following: post https://myhostedesinstance.west-eu.azr.facetflow.io/users-dev http/1.1 accept: application/json content-type: application/json accept-encoding: gzip,deflate authorization: basic <cutforobviousreasons> host: myhostedesinstance.west-eu.azr.facetflow.io content-length: 891 { "settings": { "index": { "number_of_replicas": 0, "number_of_shards": 1 } }, "mappings": { "user": { "_all": { "enabled": false }, "_ttl": { "enabled": false }, "properties...

php 5.5 - Downgrade class php 5.6 to 5.5 -

i founded class stack object layers , closures server isnt running on php 5.6 yet. , wondering how can convert ...$parameters because cant fix replacing call_user_func_array() buildcoreclosure() method throw errors example because closure isnt array... class stack { /** * method call on decoracted class. * * @var string */ protected $method; /** * container. */ protected $container; /** * middleware layers. * * @var array */ protected $layers = []; public function __construct(container $container = null, $method = null) { $this->container = $container ?: new container; $this->method = $method ?: 'handle'; } public function addlayer($class, $inner = true) { return $inner ? array_unshift($this->layers, $class) : array_push($this->layers, $class); } public function addinnerlayer($class) { return $this->addlayer($c...

javascript - Making grids using JS or JQuery -

i'm new js , have been working through lessons via odin project. i'm on first js/jquery project , i'm having trouble project: how use js/jquery user input number between 1-16 , grid pop out size of page. i.e. user types in 3 , 3x3 grid size of webpage comes out? or user types in 16 , 16x16 grid comes out? i prefer not straight out answer, maybe if point me in right direction starter code? i'm guessing best approach create div , use .append() function? need little more direction here. here cryptic response require. i've included fill-in-the-blanks , left out how expand table fill screen. hint: use $(window).height()/$(window).width() size of screen. $('#grid').change(function(){ $('table').remove(); var code = "<table>"; (var = 0; < $('#grid').val(); i++) { code += "???"; (var j = 0; j < $('#grid').val(); j++) { code += ...

python - Why does hash(None) change across different platforms and in different calls? -

i'm facing weird behavior hash function on python. when run following command on mac os (10.10) different values different calls. $ python -c "print hash(none)" -9223372036579216774 $ python -c "print hash(none)" -9223372036582852230 in other hand when run same thing on ubuntu 14.04 get: $ python -c "print hash(none)" 596615 $ python -c "print hash(none)" 596615 for me looks like, in os x, python using memory address somehow , ubuntu not. can see hash function implementation dependent. shouldn't based on "value" of none only? numbers represent? why behave differently on same python version on different os? none.__hash__ correlates _py_hashpointer hashing function. pointer of object used hash. none beeing singleton safe use, not deterministic. pointer cast adequate integer type p hash value calculated following: (p >> 4) | (p << (8 * sizeof_void_p - 4)) referring comment in source code...

c# - How and where to implement the IDispatchMessageInspector -

based on question: how use idispatchmessageinspector in wcf service? i still confused on implement methods execute code "do something" inspected message. from reading idispatchmessageinspector appears need have class implements idispatchmessageinspector has these 2 methods afterreceiverequest , beforesendreply . however, not understanding or how use methods. for example if wanted modify element in inbound request message before dispatched operation. is done in class create servicebehavior implements servicecontract interface?

database - MySQL import is incomplete -

i have sql file (6gb) result of mysqldump. want import new database on same server. i needed change basic text references within db used sed make replacements in dumped sql file. whenever import dumped sql file resulting database missing last several tables. frustrating because takes hour import sql file , problem near end of import. does have suggestions why import stop @ same table every time? this point @ import stops every time -- table never created. -- table structure table `port_schemas` -- drop table if exists `port_schemas`; /*!40101 set @saved_cs_client = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `port_schemas` ( `extension_id` int(11) not null, `version_id` varchar(20) not null, primary key (`extension_id`,`version_id`) ) engine=myisam default charset=utf8; /*!40101 set character_set_client = @saved_cs_client */; -- -- dumping data table `port_schemas` -- lock tables `port_schemas` write; /*!40000 alter ta...

Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes -

what process , update in primefaces p:commandxxx components , execute , render in f:ajax tag? which works @ time of validation? update attribute rather updating value component end? process attribute bind value model? @this , @parent , @all , @form in both attributes? the example below working fine, little confused in basic concepts. <p:commandbutton process="@parent" update="@form" action="#{bean.submit}" value="submit" /> <p:commandxxx process> <p:ajax process> <f:ajax execute> the process attribute server side , can affect uicomponent s implementing editablevalueholder (input fields) or actionsource (command fields). process attribute tells jsf, using space-separated list of client ids, components must processed through entire jsf lifecycle upon (partial) form submit. jsf apply request values (finding http request parameter based ...

javascript - Maintain scroll position when using Response.Redirect(Request.RawUrl) -

i maintain scroll position when using: response.redirect(request.rawurl) the reason because have button in gridview updates value in grid. after clicking button want update value in gridview, needs response.redirect(request.rawurl) want maintain scroll position. this not work either: maintainscrollpositiononpostback="true" i have tried other javacript methods , not work well, since refreshing page. how this? i fixed it. i replaced response.redirect(request.rawurl) gridview1.databind()

What is the Google App Engine equivalent of Android's 'Application' class? for dependency injection -

android lets extend application , great place store our singletons can reused throughout different pages (actiivities) in app. what google app-engine's equivalent of this? i using dagger, , don't want create new object graph every endpoint. one option (although i'm no means sure it's best) self-inject cloud endpoints class (through static field injection). presumably you're initialising object graph in servletcontextlistener there, before endpoint methods called. dagger 1.x supports staticinjections on module annotation (to you) apparently no longer supported in 2.x.

Local storage in a stream Java 8 -

i want write stream method may need ignore several concurrent values based on "lastgoodversion" can't find way share value within stream. below i'd do. suggestions on how accomplish this? [edit don't this, it's not how java streams work] i don't think possible using java 8 streams. possible solution want use helper function may this: private static <t> stream<t> progressivefilter(stream<t> stream, bipredicate<t, t> predicate) { list<t> list = stream.collect(collectors.tolist()); list<t> result = new arraylist<>(); t previousvalue = null; (t entry : list) { if (previousvalue == null) { previousvalue = entry; } else { if (predicate.test(entry, previousvalue)) { result.add(previousvalue); } else { previousvalue = entry; } } } i...

java - Calculating Carry Flag -

i writing x86 interpreter in java , have python script tests implementations of x86 instructions against real counterparts using nasm. according test flags set correctly, besides carry flag. interesting part is: long result; switch (op) { case add: result = math.abs(x) + math.abs(y); if (result > u_max) registers.carry_flag = true; else registers.carry_flag = false; break; where u_max 4294967295l (all 32 bits set). answers found didn't realize carry , overflow 2 different things. so, how can implement carry flag correctly in java? all absolute value business unnecessary , frankly confusing , has edge-case math.abs(integer.min_value) negative (not weird when down it, doesn't code expects it), can calculate carry in simpler ways . for example using old "result unsigned less 1 operand". result of course x + y (as int ), signedness irrelevant addition. java 8, can use integer.compare...

jquery - Nested Confirm Pop Ups not working -

i want display 1 more same confirmation pop on click of yes button not working, code : $.confirm({ text: "are sure want delete ?" confirm: function() { $.confirm({ text: "we going delete ?" confirm: function() { }, cancel: function() { } }); }, cancel: function() { } }); i'm using jquery-confirm.js this. i need alternative implement functionality or solution problem. as @pmandell said, configuration object invalid. need commas after each attribute of javascript object so: $.confirm({ text: "are sure want delete ?", confirm: function() { $.confirm({ text: "we going delete ?", confirm: function() { }, cancel: function() { } }); }, cancel: function() { } });

javascript - Selecting options in angular-ui type ahead has no effect -

here html markup: <script type="text/ng-template" id="typeaheadtemplate.html"> <span bind-html-unsafe="match.model.project_desc | typeaheadhighlight:query"></span> </script> <div ng-show="commentmain.commenttype == 'project'" id="commentprojectother" class="btn-group animate-slide-vertical" style="margin-bottom: 7px; margin-left: 7px;"> <input type="text" ng-model="commentmain.project" placeholder="select name of project" typeahead-on-select="commentmain.comment.project_id = $model.project_id || null" typeahead="project projects in commentmain.getprojects($viewvalue)" typeahead-loading="loadingprojects" typeahead-template-url="typeaheadtemplate.html" class="form-control...