Posts

Showing posts from February, 2013

encoding - imap_open() in PHP is not handling UTF-8 -

i using php imap functions read mailbox receives utf-8 encoded plain text email (generated server). accented characters replaced question mark (?). below code , following 2 attempts @ fixing it. how fix problem? have no control on server generates messages, claim encoded utf-8. mb_detect_encoding says imap_body function returning ascii string, i've found mb_detect_encoding buggy in past. $connection = imap_open( '{localhost:993/ssl/novalidate-cert}inbox', 'xxxxxxx', 'xxxxxxx', 0, 1 ); $result = imap_search( $connection, 'unseen' ); if ( $result ) { foreach ( $result $msgno ) { $body = imap_body( $connection, $msgno ); // ... (code process message) ... imap_mail_move( $connection, "$msgno:$msgno", 'inbox.processed' ); } imap_expunge( $connection ); imap_close( $connection ); } } i tried following convert utf-8, though message utf-8: $current_encoding

Jekyll does not modify files -

i have simple index.html contains {% include t.html %} it copied _site is, without substituting _includes/t.html other substitutions {{ }} not work well. how debug , fix that? one should add front matter file make jekyll process it.

regex - Xpath to find prices in a web page -

i trying extract prices , currency in html page (for exampe this webpage ) using xpath expression. i tried: $x("//*[matches(text(),'^\$\d+\.\d{1,2}')]") in firefox's console prints undefined . solution based on regular expressions. from example, because use matches , deduce use xpath 2 . probably, not supported browser. check xpath version . another version work xpath 1 described below. notice xpath <span> elements looks like: //*[@id="result_0"]/div/div[3]/div[1]/a/span //*[@id="result_1"]/div/div[3]/div[1]/a/span //*[@id="result_2"]/div/div[3]/div[1]/a/span so, need use regular expression id , text span. you can use matches ( xpath2 ) or starts-with ( xpath1 ) first part , text() text span . so, test in browser, use this: $x('//*[starts-with(@id,"result_")]/div/div[3]/div[1]/a/span/text()')

Alfresco custom data list layout -

Image
i have created custom data list in alfresco, , have populated model desired data columns. however, when view list in alfresco share, order off, , there elements have not defined in model. i have searched extensively how fix this, , have not been successful. understand, need define layout in share-config-custom.xml, have attempted below (snippet of added): <config evaluator="model-type" condition="orpdl:orplist"> <forms> <form> <field-visibility> <show id="orpdl:programname" /> </field-visibility> <create-form template="../data-lists/forms/dataitem.ftl" /> <appearance> <field id="orpdl:programname"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> </appearance> </form> </forms> </config> <co

How to assign alias to template function in C++? -

i writing few mathematical functions c++ , have learned use template functions don't have make loads of overloaded copies of simple function different types. have made test program has different types i'm use , runs each 1 through function check work ok. what want assign alias 1 of template functions call different name, can write new functions , run them through test changing alias new function rather going through whole code find , replace change new function want test. i have tried this template <typename t> using b = a<t>; and this template<typename t> constexpr auto alias_to_old = old_function<t>; but both throw errors. please note pretty beginner @ c++ don't use jargon in answers, , clear examples appreciated. thanks!

Setting COM (RDPEncomAPI) property in Delphi -

i've used delphi time, trying com programming , having trouble. apologize if newbie issue, after searching trying lots of things have not been able or set properties of rdpencom rdpsession object. code (including several naive attemps) below. if remove line attempting read properties, remaining code works fine. how can , set portid property of rdpsession.properties ? uses rdpencomapi_tlb; // jwapi ... myrdpsession := cordpsession.create(); if varisnull(myrdpsession) begin application.messagebox('msrdpsession creation failed.', 'error'); result := false; exit; end; try didshare := myrdpsession.open; except showmessage('unable share desktop !'); exit; end; theproperty := 'portid'; activexprop := myrdpsession.properties; //lvalues := activexprop.property_(theproperty); // method not supported //lvalues := activexprop.property(theproperty); // member not found myrdpsession.properties.getproperty(lvalues, myrdpsession.properties.pr

pagination - Paginate using javascript -

following static html of table. dyanamically insert table based on no of data get(data.length) value ajax call. need insert pagination in 5 tables been allowed , if exceeds 6th, dyanamically pagination should happen values in footer should increase one( << < 1 2 > >> ). <table id="mytable"> <tbody id="tbody"> <td> <tr>sample values</tr> <tr>sample values</tr> <td> </tbody> </table> for(int i=0;i>data.length;i++) { var row = $("#mytable #tbody").append("<td><tr></tr></td>"); } i made use of following script problem here is, pagination didnt happen. not sure of problem exists since beginner js. <script src=../../simplepagination.js> // init bootpag $('#page-selection').bootpag({ total: 10 }).on("page", function(event, num){ $("#content").html(&qu

powershell - How does .Name work for variables? -

param( [parameter(mandatory=$true,position=1)] [string]$filename ) #$filename doesn't include directory or extension $dir = "c:\users\pb\desktop\source" $latest = get-childitem -path $dir | where-object {$_.name -like "*$filename*"} | sort-object lastwritetime -descending | select-object -first 1 -exclude "*import*" $filename = $latest.name $source = "c:\users\pb\desktop\source\${filename}" basically, using .name on $latest make $latest include directory name or include name of file, e.g. $filename equal c:\users\pb\desktop\source\"filename" or "filename" ? in powershell, many other languages, dot-notation used accessing properties of object. in case $latest contains fileinfo object (or directoryinfo object if *$filename* matches folder), has number of properties, instance name , fullname , lastwritetime , attributes , etc. you can display properties of object

wordpress - Two Place Order Button in woocommerce Checkout page -

i having issue in checkout page. getting 2 place order button( click here ). tried fix in form-checkout.php checked in form-pay.php, in wp-content/themes/mytheme/woocommerce/checkout. i checked in wordpress forum got solution remove 2 checkout button cart page, there no solution problem if ( ! defined( 'abspath' ) ) exit; // exit if accessed directly global $woocommerce; wc_print_notices(); do_action( 'woocommerce_before_checkout_form', $checkout ); // filter hook include new pages inside payment method $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', wc()->cart->get_checkout_url() ); ?> <form name="checkout" method="post" class="checkout" action="<?php echo esc_url( $get_checkout_url ); ?>"> <?php if ( sizeof( $checkout->checkout_fields ) > 0 ) : ?> <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>

c - Passing pointers to functions with and without & -

i trying understand when need use address-of operator & when passing arguments reference (for readers mind imprecision please read simulate pass-by-reference ) functions without modifying function itself. give 2 small examples using struct s. in both struct passed reference 1 involves usage of & , other not. explanation in particular case involve usage of malloc() in second example , can guess more experienced opinion. futhermore, question more general: there rule (or rule-of-thumb @ least) when can pass reference without using & ? example 1 #include <stdio.h> #include <stdlib.h> struct author { char *name; int born; int died; char *notable_works; }; void print_struct(struct author *thomas_mann); int main() { struct author thomas_mann; thomas_mann.name = "thomas mann"; thomas_mann.born = 1875; thomas_mann.died = 1955; thomas_mann.notable_works = "der zauberberg&q

sonarqube - Failed sonar migration because table already exists -

i trying upgrade sonarqube 3.7.4 4.5.4 i've updated plugins , new application starts expected. i go /setup url prompted start db migration. fails following error: activerecord::jdbcerror: table 'rule_tags' exists: i've backed v3.7.4 db, , when restore it, can see contains table called rule_tags, has 0 records. restored backup , older plugins in place, v3.7.4 starts again fine. the migration code is attempting create table without checking if exists. anyone know why happening? suspect has earlier failed migration. the table rule_tags created in version 4.2. if it's still present when restoring mysql backup, means restored data not structure. double check command-line restore mysql schema.

python - Programmatically accessing arbitrarily deeply-nested values in a dictionary -

this question has answer here: checking dictionary using dot notation string 4 answers i'm working on python script i'm given lists of strings of format: ['key1', 'key2', 'key2.key21.key211', 'key2.key22', 'key3'] . each value in list corresponds entry in dictionary, , entries structured 'key2.key21.key211' , correspond (in example), key 'key211' nested within 'key21' , nested inside 'key2' . the above list corresponds dictionary: x = { 'key1' : 'value1', 'key2' : { 'key21' : { 'key211': 'value211' }, 'key22' : 'value22' }, 'key3' : 'value3' } the names not regular key(n)+ ; can of form fo

python - Runing a script in background will hang the subprocess -

i running script launches run_app.py >& log.out in run_app.py, start few subprocesses , read stdout/stderr of subprocesses through pipe. can run script fine if try put background by: run_app.py >& log.out & the run_app.py hang on reading data subprocess. seems similar thread: ffmpeg hangs when run in background my subprocess write lot might overflow pipe_buf. however, redirecting&writing stdout/stderr file. there suggestions might prevent hanging when put script background while able save output in file instead of redirecting them /dev/null? when background process running, standard i/o streams still connected screen , keyboard. processes suspended (stopped) if try read keyboard. you should have message saying like: stopped (tty input) . have been sent shell's stderr. normally redirecting stdin covers problem, programs access keyboard directly rather using stdin, typically prompting password.

jquery - Getting javascript var from database record in Smarty -

i'm working on prestashop page file extension ".tpl". javascript code auto complete this: var currencies = [ { value: 'afghan afghani', data: 'afn' }, { value: 'albanian lek', data: 'all' }, { value: 'algerian dinar', data: 'dzd' }, { value: 'european euro', data: 'eur' }, { value: 'angolan kwanza', data: 'aoa' }, { value: 'east caribbean dollar', data: 'xcd' }, { value: 'vietnamese dong', data: 'vnd' }, { value: 'yemeni rial', data: 'yer' }, { value: 'zambian kwacha', data: 'zmk' }, { value: 'zimbabwean dollar', data: 'zwd' },]; while have foreach example below: {foreach from=$currencies item=currency} {$currency.name} {$currency.code} {/foreach} how output currencies value foreach ? tried code: var currencies = [ {foreach from=$currencies item=currency} { value: '{$currency.name}&

scala - Assigned variable not passed to a map function in Spark -

i'm using spark 1.3.1 scala 2.10.4. i've tried basic scenario consists in parallelizing array of 3 strings, , mapping them variable define in driver. here code : object basictest extends app { val conf = new sparkconf().setappname("simple application").setmaster("spark://xxxxx:7077") val sc = new sparkcontext(conf) val test = sc.parallelize(array("a", "b", "c")) val = 5 test.map(row => row + a).saveastextfile("output/basictest/") } this piece of code works in local mode, list : a5 b5 c5 but on real cluster, : a0 b0 c0 i've tried code : object basictest extends app { def test(sc: sparkcontext): unit = { val test = sc.parallelize(array("a", "b", "c")) val = 5 test.map(row => row + a).saveastextfile("output/basictest/") } val conf = new sparkconf().setappname("simple application").setmaster("spark://xxx

javascript - Send existing LCOV file to SonarQube -

because of way project built, can't use sonarqube run coverage on project. have javascript coverage working karma , other tools. these tools output valid lcov file. everything else i've found requires have sonarqube run coverage , generate lcov file. i able upload lcov file sonarqube , have use that. possible? if so, how? not sure understand question, if how feed sonarqube lcov report, need provide path - absolute or relative project base directory - lcov report via project property "sonar.javascript.lcov.reportpath". see http://docs.sonarqube.org/display/plug/javascript+plugin "code coverage" paragraph. is answers question ?

knockout.js - How to call a nested function from out side knockout js -

i learning knockout js. still understanding not clear. apologized ask kind of question. see code first see trying achieve. here jsfiddle link http://jsfiddle.net/tridip/vvdvgnfh/ <button data-bind="click: $root.printproduct()">print product</button> <table id="table1" cellspacing="0" cellpadding="0" border="0"> <tr> <th style="width:150px">product</th> <th>price ($)</th> <th>quantity</th> <th>amount ($)</th> </tr> <tbody data-bind='template: {name: "ordertemplate", foreach: lines}'></tbody> </table> <script type="text/html" id="ordertemplate"> <tr> <td><select data-bind='options: products, optionstext: "name", optionscaption:"--se

c# - Connection was not closed. Connection's current state is open -

it gives error connection not closed. connection's current state open. please out code. private void combobox1_selectedindexchanged(object sender, eventargs e) { sqlconnection con = new sqlconnection(@"data source=.\sqlexpress;attachdbfilename=c:\users\vicky\desktop\gym management system\fitness_club\vicky.mdf;integrated security=true;connect timeout=30;user instance=true"); try { con.open(); sqlcommand cmd = new sqlcommand("select * [plan] plantype='" + combobox1.text + "'", con); sqldatareader dr = cmd.executereader(); while (dr.read()) { string amount = dr.getstring(1); textbox5.text = amount; } con.close(); } catch(exception ex) { messagebox.show(ex.message); } } you should using using blocks managing objects. private void com

php - .ajax() not responding after keyup event -

this jquery/ajax problem. jquery/ajax responding keyup event alert(loc) showing result of value inputted number textbox. the essense of program data database in array form after encoding json via php , display result inside textbox. however, reaching .ajax function, not display inside success section. @ end, there no response or error. used jsonlint see if there error, gave code dont understand. afte using mozilla firebug step through jquery, still did not show message. this html,php,jquery codes verification. js: $(document).ready(function() { $('#number').keyup(function() { //keyup event responds var loc = $('#number').val(); alert(loc); //display result number textbox $.ajax({ //skips ajax function datatype: "json" url: "/php/barry.php", data: ({loc : loc}), async: false, type: "get", contenttype: "application/json; charset=utf-8 success: function(data) { $.ea

arduino - Measure max rate of ADC samples in one second -

does have code snippet measure max rate of adc samples achievable in 1 second. understand there millis()function in arduino. unsigned long start, finsihed, elapsed; void setup() { serial.begin(115200); } void loop() { int sensorval = analogread(a0); serial.println(sensorval); serial.println("start..."); start = millis(); serial.println("finished"); elapsed = finished - start; serial.print(elapsed); serial.println(" milliseconds elapsed"); serial.println(); } if trying figure out maximum number of times can process , adc in 1 second should try besides printing out value every time! for instance use loop counts 1 every 10,000 times have read e.g. start = millis() for(int = 0; < 10000; i++){ analogread(a0); } finish = millis() total = start - finish print("this trail took "); print(total); print(" miliseconds!"); coincidentally 10,000 number of times data sheet here tells arduino can run

android - CWAC CAMERA-switching Front-Back camera not working -

i have integrated [cwac-camera][1].i trying switch between , front camera clicking on button using below code not working.i can see default camera.where going wrong? private boolean isbackcam=true; f = new camerafragment(); builder=new simplecamerahost.builder(new democamerahost(getapplicationcontext())); f.sethost(builder.usefullbleedpreview(true).build()); handleswitchcamera=(imagebutton)findviewbyid(r.id.handleswitchcamera); handleswitchcamera.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { if(isbackcam) { isbackcam=false; builder.usefrontfacingcamera(true); } else { isbackcam=true; builder.usefrontf

Sphinx Wordforms Unexplained Behavior -

i added following our sphinx wordforms list , rebuilt index: emery paper > glasspaper emerypaper > glasspaper sand paper > glasspaper sandpaper > glasspaper all our product descriptions in index read "glasspaper" think correct. however, while can search "emery paper" , "sand paper", if search "emerypaper" or "sandpaper" no results. does have explanation this? dictionary somehow intervening because these compound words don't exist?

Regex newbie: How to isolate 'num-num-num' in a string -

i'm sure super simple question many of you, i've started learning regex , @ moment can't life of me isolate i'm after following: june 2015 - won / void / lost = 3-0-1 i need solution isolate 'num-num-num' part @ end of string work positive integers. thanks help edit so line of code scrapy spider i'm writing produces line above: tips_str = sel.xpath('//*[@class="recent-picks"]//div[@class="title3"]/text()').extract()[0] i've tried isolate part i'm after with: tips_str = sel.xpath('//*[@class="recent-picks"]//div[@class="title3"]/text()').re(r'\d+-\d+-\d+$').extract()[0] no luck though :( the regex capture is: \d+-\d+-\d+$ it works follows: \d+- means: capture 1 or more digits (the numbers [0-9] ), , "-". $ means: should @ end of line. translating full regex pattern: capture 1 or more digits, hyphen, 1 or more digits, hyphen, 1

windows - Find folder named with lowest number in a directory , conditional statement on the command line -

i'm new conditional statements command lein, i'd write batch file server running windows server 2003 similar task this, statement find lowest numbered folder (including subdirectories) , copy external drive attached server. suppose if have folders names 9, 10, 11,... 1023. guess command copy folder (once determined , found) like: xcopy source:\dir\subdir\9 destination:\dir\subdir\9 /s /e /t basically, there's large number of files added drive daily , has moved archive on external monthly. how go writing if statement finding folder named of lowest number? i don't understand lowest numbered folder has added files, i'll assume know doing. you imply want copy added files, don't want xcopy /t option. i've added /i option xcopy assumes destination folder. the logic identifying lowest folder simple: 1) set low highest possible number in batch (i used hex notation) 2) list directories, using findstr restrict list integer names 3) proce

c# - Async webBrowser for filling out Form -

i need let webbrowser navigate several different similiar url's of 1 website, fill out form, click on send button, , read next site find out if previous step successfull or not. on success loop have stop. fist stuck @ getting webbrowser.navigate("url"); work in loop. since page need time load have asynchronous. i new whole asyncronous stuff, need help. i have found solution on https://stackoverflow.com/a/15936400/4972402 took , put code filling out form , clicking submit button. public partial class form1 : form { public struct webbrowserawaiter { private readonly webbrowser _webbrowser; private readonly string _url; private readonly taskawaiter<string> _innerawaiter; public bool iscompleted { { return _innerawaiter.iscompleted; } } public webbrowserawaiter(webbrowser webbrowser, string url) { _url = url;

asp.net mvc - Allowing commas in decimal values using Fluent Validation -

i using fluentvalidation validate data in mvc project. have decimal value entering on page, if comma included in validation fails it. example "12,000.00". how can fluentvalidation accept such values? i got work creating custom binder decimal values. should work regardless of validation tool you're using. see link on how that: http://haacked.com/archive/2011/03/19/fixing-binding-to-decimals.aspx/

python - How to apply filter condition on two embedded field in django mongoengine? -

i using django mongoengine. tried query top solve this. tried raw query not success. { "_id" : objectid("556fe5c338a01311c4c4d1c1"), "uuid" : "5c8ae1dfcb1d060d5a951d96d4798a84cdf090e9", "snapshot_values" : [{ "key" : "gender", "value" : "female", }, { "key" : "marital_status", "value" : "married", }], }, { "_id" : objectid("556fe5c338a01311c4c4d1c1"), "uuid" : "5c8ae1dfcb1d060d5a951d96d4798a84cdf090e9", "snapshot_values" : [{ "key" : "gender", "value" : "female", }, { "key" : "marital_status", "value" : "unmarried", }], }, { "_id" : objectid("556fe5c338a01311c4c4d1c1"), "uuid" : "5c8ae1dfcb1d060d5a951d96d4798a

asp.net mvc - Angular binding model property to ng-click not passing value to MVC controller method -

i have calendar events on it, each having distinct eventid. when user clicks event, triggers angular controller method in turn gets data event via mvc controller , displays on page. have button on page when clicked should open modal edit details of data being displayed , using data binding set url modal window. data-ng-click attribute of button looks this: data-ng-click="app.modal.openmodalwindow({ template: '[my url here]/?eventid={{vm.eventid}}' })" in markup see this: data-ng-click="app.modal.openmodalwindow({ template: '[my url here]/?eventid=18' })" but when click button, browser trying following (from chrome network tab in dev tools): get [my url here]/?eventid={{vm.eventid}} 500 (internal server error) if take url markup or hard-code eventid works fine know not openmodalwindow i'm thinking sort of binding issue. have placed {{vm.eventid}} on page , know getting set properly, somehow not getting model. the error gettin

mysql - Many-to-many relationship with compound primary key constraint -

i got requirement many-to-many relationship design in dbms other constraints. there 2 tables, t1 , t2 t1.id , t2.id primary keys respectively. t1 , t2 has many-to-many relationship, natural design add third table t3 foreign keys. e.g., t3: id t1_id (foreign key refereed t1.id) t2_id (foreign key refereed t2.id) another requirement pair(t1.id, t2.id) should have one-to-one relationship t4.id . add t5 primary_key(t1.id, t2.id) ? or can directly using t3's t1_id, t2_id compound primary key? need fast scan whether pair(t1.id, t2.id) has entity in t4 , i.e., pair(t1.id, t2.id) has one-to-one relationship t4.id . appreciate if give me hints. if have enforce one-to-one relationship between (t1.id,t2.id) , t4.id , seems indicate (t1.id,t2.id) unique. if that's case, if (t1.id,t2.id) should unique in t3 , make primary key t3 . you add foreign key reference t4 , , make unique no more 1 row in t3 can related t4 . or, can make foreign key

Perl find duplicates in first column and convert to unique auto incremented value -

i have tab delimited text file (test.txt) looks following: steve ran 100 200 300 steve sit 50 30 20 steve steal 40 60 70 bill ran 10 20 90 bill 14 15 30 john 34 38 29 john ran 10 40 60 john down 60 70 80 john yep 40 69 80 i need replace duplicate values in column 1 unique identifier, i.e. steve => name_1, bill => name_2, john => name_3, etc. order of text file important, read line line? here's have far... use strict; use warnings; use autodie; open $fh, "<", 'test.txt'; while (<$fh>) { @row = split(/\s+/,$_); print "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\n"; } close $fh; exit; my desired output be: name_1 ran 100 200 300 name_1 sit 50 30 20 name_1 steal 40 60 70 name_2 ran 10 20 90 name_2 14 15 30 name_3 34 38 29 name_3 ran 10 40 60 name_3 down 60 70 80 name_3 yep 40 69 80 whenever duplicates need removed,

matlab - Run Simulink model parallel -

Image
i run complex simulink model in parfor loop on many cores different data. however, didn't have success yet created simple model , tried run parallel same data. the model looks this, adding 2 signals: code: function result = add (x, y) result = x + y; the script run model following: if matlabpool('size') == 0 matlabpool('open',4); end parfor = 1:4 data=ones(1,20); x=timeseries(data); y=timeseries(data); output = sim('model_test','stoptime','5'); result = output.get('res'); end however, following error occurs: i don't understand why variables not existing. know paralell computing critical in terms of variable access, didn't have success simulink parallel running yet. can please explain error me , how solve it? thank much! answer am304 : thank you, answer helped me in way know how change constants set_param in parfor loop , understand why doesn't work timeseries. timeseries still s

javascript - JS - Comparing length of words in string, ignoring non-letter chars -

this coderbyte js challenge. goal write function takes in string , returns longest word in string. if 2 words same size first word returned. input never empty. example, input = "fun&!! time" result in: output = "time" this question has been asked before , although original question involved using variety of string methods , regexp. js (and programming noob) , find approach non-intuitive, , trying assess whether alternate method feasible approach problem: function longestword(sen) { var count = ''; var max = 0; //loops thru string & tallies letters in sequences (i = 0; < sen.length; i++) { if ((sen.charat(i) >= 'a' && sen.charat(i) <= 'z') || (sen.charat(i) >= 'a' && sen.charat(i) <= 'z')) { count += sen.charat(i); //conditional tracks longest letter string date if (count.length > max){ max = count;

tomcat8 - Flyway unable to scan for sql migrations in class path after upgrade to tomcat 8 -

our application have been working fine flyway 3.0 , tomcat 7. using sql based migrations in class path. recently trying upgrade our application use tomcat 8. after doing so, flyway unable find sql migrations in our class path. have been using war deployment unpackwar = false. information only, using unpackwar = true, problem no longer reproducible. i have tried debug flyway code base , have been trying figure out differences prior upgrading tomcat 8 , after upgrading tomcat 8. 1 key difference found inside classpathscanner.getlocationurlsforpath(), used find location of war file prefixed file: protocol, tomcat 8, finding location of war file prefixed jar: protocol. doesn't seem problematic. however, leads code inside jarfileclasspathlocationscanner.findresourcenamesfromjarfile() being executed. inside method, jar elements entry names come out "web-inf/classes/our_path/schema/v1.0.sql", etc location specified our_path/schema/v1.0.sql. since there's condition,

java - Why static variable is shared among the threads -

in posts have read - if 2 threads(suppose thread 1 , thread 2) accessing same object , updating variable declared static means thread 1 , thread 2 can make own local copy of same object(including static variables) in respective cache, updating thread 1 static variable in local cache wont reflect in static variable thread 2 cache . static variables used in object context updating 1 object reflect in other objects of same class not in thread context updating of 1 thread static variable reflect changes threads (in local cache). but when run below code snippet public class statcivolatile3 { public static void main(string args[]) { new examplethread2("thread 1 ").start(); new examplethread2("thread 2 ").start(); } } class examplethread2 extends thread { private static int testvalue = 1; public examplethread2(string str) { super(str); } public void run() { (int = 0; < 3; i++) { try {

java - Combining a static array with a dynamic ArrayList -

i want combine static array (such int[] ) dynamic array such arraylist<string> for example, know count of houses: 10 (fixed), don't know count of humans live in house. count change dynamically, list . is there option create datatype can fulfill both criteria? an arraylist dynamicly sized data structure backed array. sounds me have array of house each house has list<human> field. house[] homes = new house[10]; and class like class house { private list<human> people = new arraylist<>(); public list<human> getpeople() { return people; } } then total count of people in homes might use like int count = 0; (house h : homes) { count += h.getpeople().size(); }

resize() fires on page load (jQuery, Firefox) -

the alert() in code below fires on page load shouldn't. why it? jquery(window).bind("load", function() { jquery(window).resize(function() { alert('hi'); }); }); you can simple use jquery(document).ready(function(){ jquery(window).resize(function() { alert('hi'); }); }); it work me well

R: constructing a data frame with many columns using paste() -

col1 <- c(1, 2, 3) col2 <- c(4, 5, 6) col3 <- c(7, 8, 9) on 1 hand data.frame(col1, col2, col3) gives col1 col2 col3 1 1 4 7 2 2 5 8 3 3 6 9 on other hand paste0("col", 1:3, collapse=", ") gives [1] "col1, col2, col3" question: possible construct data frame using data.frame(paste0("col", 1:3, collapse=", ")) ? if have string have objects pasted together, can use strsplit split string , values mget . return list output. wrap data.frame convert 'data.frame` data.frame(mget(strsplit(str1, ', ')[[1]])) data str1 <- paste0("col", 1:3, collapse=", ")

database - Wordpress - Upgrading Disqus Comments causes 404 error, permission denied -

i'm trying install discus wordpress website. when go configuration page, message "upgrade disqus comments - need upgrade database continue." button upgrade. when click on upgrade, 404 error page, following error message. forbidden don't have permission access /moshop/wp-admin/edit-comments.php on server. additionally, 404 not found error encountered while trying use errordocument handle request. i tried changing permission of edit-comments.php 664 777, tried other combinations, problem still present. the .htaccess file in wordpress's root directory follows. # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /moshop/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /moshop/index.php [l] </ifmodule> # end wordpress thanks in advance reply can get.

x-editable trigger in angularjs controller -

frankly need auto focus next field in angularjs xeditable form. it's available in jquery xeditable form exactly this thanks in advance.

html - Disable button if txtbox validates -

edit solved! @peter campbell pointing me in right direction (and doing of leg work me there). code changed this: if string.isnullorempty(output) exists = false else exists = true end if if string.isnullorempty(output) return string.empty dim c gpcuser if typeof httpcontext.current.session("customer") gpcuser c = ctype(httpcontext.current.session("customer"), gpcuser) if c.accountno > 0 return "" end if by moving if statement sets 'exists' boolean before return statements, still fire correctly , validate emails properly, correctly disable button well. end edit i have page checks customer's email address see if it's in our database. if is, page should ask customer log-in email instead of continuing new account, doesn't prevent them continuing. i disable continue button if email address in system can't figure out (i'm store's new web developer , there