Posts

Showing posts from May, 2014

regex - regular expressions result multiplicity -

given regular expression "\d" , match each digit in "a123b456" (i.e. 1, 2, 3, 4, 5, 6). given regular expression "\d\d" , same teststring, seems match "12" , "45" - @ least http://regexpal.com/ says, regex evaluator created myself using c++ textbook (which uses boost/regex). why doesn't second 1 match "23" , "56", well, or, if behaviour correct one, why first 1 match each number? why doesn't second 1 match "23" , "56"? because that's overlapping match expecting regex give you. once part of string matched pattern, won't matched again same pattern. so, since 2 been included in previous match 12 , gone. regex move onto next character 3 . , following character, cannot see 3 included part of string matching \d\d . next substring matching pattern found @ 45 . try changing string to: "a1234b456" and 3 matches - 12 , 34 , , 45 . however, can ov

python - AttributeError: 'NoneType' object has no attribute 'endswith' -

i working on python script updates web page. running main script generates error: <res status='-1'><error message="'nonetype' object has no attribute 'endswith'"><![cdata[ traceback (most recent call last): file "/path/to/file/ws_config.py", line xxxx, in run tests = testlist().tests file "/path/to/file/ws_config.py", line xxxx, in __init__ updatetestgroup(none), file "/path/to/file/ws_config.py", line xxxx, in __init__ test = ct.curltest(settings), file "/path/to/file/config_tests.py", line xxxx, in __init__ self.params.path = os.path.join('/', os.path.join(params.dir, params.file)) file "/usr/lib/python2.6/posixpath.py", line 67, in join elif path == '' or path.endswith('/'): attributeerror: 'nonetype' object has no attribute 'endswith' i cannot past code because long. trying understand error lays or part of c

How to send EOF to a process in Java? -

i want run groff in java program. input comes string. in real command line, terminate input ^d in linux/mac. how send terminator in java program? string usage += ".dd \\[year]\n"+ ".dt test 1\n"+ ".os\n"+ ".sh test\n"+ "^d\n"; // <--- eof here? process groff = runtime.getruntime().exec("groff -mandoc -t ascii -"); groff.getoutputstream().write(usage.getbytes()); byte[] buffer = new byte[1024]; groff.getinputstream().read(buffer); string s = new string(buffer); system.out.println(s); or other idea? ^d isn't character; it's command interpreted shell telling close stream process (thus process receives eof on stdin ). you need same in code; flush , close outputstream : string usage = ".dd \\[year]\n" + ".dt test 1\n" + ".os\n" + ".sh test\n"; ... outputstream out = groff.getoutputstream(); out.write(usage.getbytes()); out.clos

how to compare array of chars with arduino -

i want compare text receive gsm board in arduino word misure , reset , reply in different case depending on request arduino jump on ams.flush() without reply nothing. please me //message receiving void receivemsg(float temperature){ char c; char d[200]; int i; { serial.println("message received from:"); // remote number sms.remotenumber(sendernumber, 20); serial.println(sendernumber); // example of message disposal // messages starting # should discarded if(sms.peek()=='#') { serial.println("discarded sms"); sms.flush(); } // read message bytes , print them while(c=sms.read()){ d[i]=c; serial.print(c); // (i=0;i<200;i++){ // d[i]=c;} } serial.println("\nend of message"); // interpreter of message (i=0;i<200;i++){ if (d[i]=='misure') // part of reply message { string t="hello i'

Python sieve prime numbers -

i trying sum of prime numbers using sieve on python 2.7. when run program wind 0 everytime. have no idea why happening. import math,time start=time.clock() def primesieve(limit): final=0 a=[true]*limit a[0]=a[1]=false i,isprime in enumerate(a): if isprime: n in xrange(i,limit,i): a[n]=false in xrange(limit): if a[i]: final=final+i return final print primesieve(2000000) elapsed=time.clock()-start print elapsed for n in xrange(i,limit,i): a[n]=false it should be: for n in xrange(2*i,limit,i): a[n]=false or, more efficiently: for n in xrange(i*i,limit, 2*i): #assuming cleared numbers a[n]=false because otherwise end setting i non-prime, when prime. (the sieve should mark multiples of i non-primes, except i itself!) note iterating on numbers, limit , can safely stopped after reaching sqrt(limit) : import itertools def primesieve(limit): = [true] * limit a[0] = a[1] = false sqrt_limit

SDK Manager not opening in Android Studio -

i installed android studio when click on sdk manager or avd manager button in toolbar cannot opens thing . , when open avd or sdk manager folder c:\program files\android\android-studio\sdk\tools\lib gives error " failed execute tools/android.bat . system cannot find file specified". how can solve problem? sdk manager not launching android studio because have start androidstudio run administrator privileges. failed execute tools/android.bat run android.bat in tools directory of sdk. ex [c:\program files (x86)\android\android-studio\sdk\tools] it start sdk manager.

c# - How to check if Strings all characters in a specific unicode range? -

this question has answer here: is there way check whether unicode text in language? 8 answers hi example have string in sinhala unicode string variable = "සහ"; - correct string string variable = "xසහs"; - incorrect string i want validate if all characters string in specific unicode range belongs specific language. any idea of achiving ? static bool validate(string s, char max, char min) { (int = 0; < s.length; i++) if (s[i] > max || s[i] < min) return false; return true; }

javascript - Check if div is descendant of another -

best way find out if element descendant of another there question, similiar 1 jquery. so, how do in js ? have divs a, b, c, d nested in order. also, not sure if matters, there a, b, c... , another. not single element. there many same id/class. so want see if d has parent(no matter how deep nested, long there parent on top ok) called a. edit: also, had idea check childnodes of "a" , see if "d" 1 of them, couldnt implement it. if can working, itd awesome. // x element checking while (x = x.parentelement) { if (x.id == "a") console.log("found"); }

winapi - Thread-safe GetTickCount64 implementation for Windows XP -

i'm targeting windows xp, , need function similar gettickcount64, not overflow. i couldn't find decent solution correct , thread safe, tried roll own. here's came with: ulonglong mygettickcount64(void) { static volatile dword dwhigh = 0; static volatile dword dwlastlow = 0; dword dwtickcount; dwtickcount = gettickcount(); if(dwtickcount < (dword)interlockedexchange(&dwlastlow, dwtickcount)) { interlockedincrement(&dwhigh); } return (ulonglong)dwtickcount | (ulonglong)dwhigh << 32; } is thread safe? thread safety difficult check correctness, i'm not sure whether it's correct in cases. on windows timer overflow problem in solved (in games) using queryperformancecounter() functions instead of gettickcount() : double getcycles() const { large_integer t1; queryperformancecounter( &t1 ); return static_cast<double>( t1.quadpart ); } then can multiply number reciproc

php - get output of an array and use it mysql query -

i have following php script, selects , insert array user_ids want select. $query = mysql_query(" select `user_id` users (surname '$name%' , name '$surname%') or (surname '$surname%' , name '$name%') "); while($run = mysql_fetch_array($query)){ $user_id = $run['user_id']; $check_friend_query = mysql_query(" select friends_id friends (user_one='$session_user_id' , user_two ='$user_id') or (user_one='$user_id' , user_two='$session_user_id') "); if( mysql_num_rows($check_friend_query) == 1 ){ $array[] = $user_id; } } by using following script, output of user ids have in array: foreach($array $key => $value) { echo "$value </br>"; } in case ouput prints me 5 user ids : 32, 36, 37, 38, 39. all want use these values in following sql query: $sql = " select `name`, `surname`,

XPath contains to target specific type of link path -

i having lot of difficulty constructing xpath query return kinds of url's need. xpath query below works cases however, have been trying tweak returns url actual page name contains 'about' , not url's about found in directory name. current output (bad): https://www.domain.com/about/account.asp desired output: https://www.domain.com/about/about.asp xpath (//a[contains(@href,'about')]/@href)[1] note: because using php xpath engine can utilize xpath 1.0 solution. i appreciate suggestions! many in advance! xpath 1.0's string manipulation capabilities limited, can based on assumptions. eg., if urls end .asp , search /about.asp , or more general /about. . dirty hack cut off starting @ first ? , use last few characters (to allow suffixes of different length .xhtml or .pl ) , search in there: [ contains( substring(substring-before(., '?'), string-length(substring-before(., '?')) - 10), 'about'

c++ - Clang >= 3.3 in c++1y mode cannot parse <cstdio> header -

i have project correctly compiles , runs under g++ 4.8.1 , clang >= 3.3 in c++11 mode. however, when switch experimental -std=c++1y mode, clang 3.3 (but not g++) chokes on <cstdio> header indirectly included way of boost.test (so cannot change myself) // /usr/include/c++/4.8/cstdio #include <stdio.h> // rid of macros defined in <stdio.h> in lieu of real functions. // ... #undef gets // ... namespace std { // ... using ::gets; // <-- error clang++ -std=c++1y // ... } with following error message: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:119:11: error: no member named 'gets' in global namespace on this tutorial on how set modern c++ environment, similar lookup problem max_align_t encountered. recommendation there use sed script surround unknown symbols #ifdef __clang__ macros, seems fragile approach. setup: plain 64-bit linux mint 15 g++ (ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1 ubuntu clang v

xmlhttprequest - How to simulate a AJAX call (XHR) with python and mechanize -

i working on project online homework automatically. able login, finding exercises , filling form using mechanize. discovered submit button trigger javascript function , searched solution. lot of answers consist of 'simulating xhr'. none of them talked details. don't know if screen cap helps. http://i.stack.imgur.com/0g83g.png thanks if want evaluate javascript, i'd recommend using selenium. open browser can send text python. first, install selenium: https://pypi.python.org/pypi/selenium then download chrome driver here: https://code.google.com/p/chromedriver/downloads/list put binary in same folder python script you're writing. (or add path or whatever, more information here: https://code.google.com/p/selenium/wiki/chromedriver ) afterwards following example should work: from selenium import webdriver selenium.webdriver.common.keys import keys driver = webdriver.chrome() driver.get("http://www.python.org") assert "python"

jquery ui spinner strings -

can suggest analog of spinner jquery ui, has ability display strings instead of specific values? in example have 2 widgets, spinner , select, select shows string "foobar" when values -1, want use spinner not bound values ones list. http://jsfiddle.net/andrewboltachev/qk6bn/ i want actual plugin have options these: $('#myspinner').spinner({ 'min': -1, 'values_to_text': function(x) { if (x === -1) return 'foobar'; return x; } });

utf 8 - How do I turn a Unicode code point into a Unicode String? -

i have string representing unicode code point, "272d" . how turn "✭" ? elixir understands unicode: iex> << 10029 :: utf8 >> "✭" iex> "x{272d}" "✭" but need function takes in 4 characters , returns unicode string: def from_code_point(<< code_point :: size(32) >>) ??? end or possibly def from_code_point(<< a, b, c, d >>) ??? end i tried macro: defmacro from_code_point(<< code_point :: size(32) >>) quote "x{unquote(code_point)}" end end but returns "x{unquote(code_point)}" . a unicode codepoint number, first thing need parse string see value represents. can use binary_to_integer/2 (available in r16, r15 you'd need go through binary_to_list/1 , list_to_integer/2 . once have numerical value of codepoint, can plonk in binary (which underlying representation of string) telling elixir number you're passing unicode co

javascript - Extends zepto with jQuery.cssHooks() method -

i want use zepto instead jquery... replace in web jquery zepto including script script window.jquery = zepto inn peace of code color.hook = function( hook ) { var hooks = hook.split( " " ); each( hooks, function( i, hook ) { console.dir(jquery.csshooks) // gives me undefined jquery.csshooks[ hook ] = { set: function( elem, value ) { console.log('es') var parsed, curelem, backgroundcolor = ""; if ( value !== "transparent" && ( jquery.type( value ) !== "string" || ( parsed = stringparse( value ) ) ) ) { value = color( parsed || value ); if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { curelem = hook === "backgroundcolor" ? elem.parentnode : elem; while ( (backgroundcolor === "

c# - Exception when calling methods from console -

i making console app thats gonna invoke methods strings, part ok when comes parameters need help this code, static void main(string[]args) //gets variable void/method string void_name = console.readline(); //making type in case 'program' type type_ = typeof(program); //making route string 'void_name' methodinfo method_ = type_.getmethod(void_name); //getting optional parameters object[] obj = new object[] { "" }; foreach (parameterinfo _parameterinfo in method_.getparameters()) { obj[0] = console.readline(); } foreach (string obj_string in obj) { console.writeline(obj_string); } //calling functions method_.invoke(type_, obj); <-- excep

Create chart using python -

Image
i have list of contents. each content has list of users watched content. want create chart in image below using python. i know radius of circle proportional number of users watched content. distance between circles proportional number joint users. so i'm interested in variant of solving problem (algorithm or existing package). also, maybe knows, how such charts called (the cloud of links?). do have ideas how make it? thanks responses. think useful if describe here how solve problem. here bit of code. first, clustered data using hierarchical/kmeans clusterization. prepare simple dictionary , convert d3-style json. json used html examples on http://bl.ocks.org/mbostock/4063530 . #coding: utf-8 import argparse import json import logging import sys import numpy import pylab sklearn.cluster import kmeans common import init_db_connection numpy import array scipy.cluster import hierarchy logger = logging.getlogger("build2") clustering_type_kmeans = &qu

php - Nginx rewrite some matching rules are not working -

i want move these working rules location = /contact { rewrite ^(.*)$ /index.php?v=contact last; break; } location = /terms { rewrite ^(.*)$ /index.php?v=terms last; break; } location = /faq { rewrite ^(.*)$ /index.php?v=faq last; break; } location = /twitter { rewrite ^(.*)$ /index.php?v2=twitter last; break; } location = /facebook { rewrite ^(.*)$ /index.php?v2=facebook last; break; } location = /login { rewrite ^(.*)$ /index.php?v2=login last; break; } location = /privacy { rewrite ^(.*)$ /index.php?v=privacy last; break; } to this location / { try_files $uri $uri/ =404; rewrite ^/(contact|privacy|terms|faq)$ /index.php?v=$1 last; rewrite ^/(twitter|facebook|login)$ /index.php?v2=$1 last; break; } but thing 'contact','terms','privacy','twitter','facebook' pages working correctly 'privacy' , 'login' pages throwing 404 error . there no other rewrite rules involving 'login' , 'pr

auto increment - Using a SELECT query as column name in MySQL -

values of auto_increment column in table (example). catch however, don't have name of auto_increment field. i'm using following query determine name of field: select column_name information_schema.columns table_name = 'example' , = 'auto_increment' limit 1; i pass result of query, 'string' actual query, , value. if in 1 go, how that, because below query, should give me auto_increment values used, yields above result -namely auto_increment column name. select ( select column_name information_schema.columns table_name = 'example' , = 'auto_increment' limit 1 ) pri example any thoughts appreciated :) many regards, andreas here example of how using prepare , execute : select @s := concat('select `', column_name, '` example e') information_schema.columns table_name = 'example' , = 'auto_increment' limit 1 prepare stmt @s; execute stmt; deallocate prepare stmt;

In php, Number of rows and columns in a 2 D array? -

i have 2 dimensional array unknown number of elements. $two_darray[row][column]; //there unknown integer values instead of row , column keywords if write for loop follows, how can determine how many rows , columns in $two_darray . can please tell me if there library function in php can tell me value inside [????] [????] for($row=0; $row<………; $row++) { for($column =0; $column <………; $ column ++) { echo $two_darray[$row][$column]; } echo “\n end of 1 column \n”; } i need know value of rows , columns in order perform other calculations. foreach ($two_darray $key => $row) { foreach ($row $key2 => $val) { ... } } no need worry how many elements in each array, foreach() take care of you. if absolutely refuse use foreach, count() each array comes up. $rows = count($two_d_array); ($row = 0; $row < $rows; $row++) { $cols = count($two_darray[$row]); for($col = 0; $col < $cols; $col++ ) { ...

Verifying a 3 bit end-around rotation in C++ -

this question has answer here: best practices circular shift (rotate) operations in c++ 15 answers i need 3 bit left end around rotation in c++. so far have: a[i] = (a[i] << 3)|(a[i] >> 5); a unsigned char array. is correct? if not how can fix it? best way test , see if correct? thanks looks fine me. if want test it, work out bunch of inputs , outputs hand , check program produces them. or devise method you're absolutely sure produce results ( eg convert unsigned char binary string, rotate string, convert unsigned char) , compare 2 against 256 possible inputs.

Private Accessor in C# -

i'm little confused accessor's in c#. assumed done private accessor's: private string m_name = { { return m_name; } // not sure if correct. maybe use 'this' set { m_name = value } // not sure if correct } i'm not sure if code above valid. i've not used accessors in c#. instead, documentation states this: class employee { private string m_name; public string name { { return m_name; } protected set { m_name = value; } } } why done, because perspective user can still access private m_name property via name. doesn't defeat point of private (or protected) properties? in first example shouldn't compiler know private , create methods behind scenes (as believe @ compile time)? your first example give stackoverflowexception, need either use separate member store data or use auto properties. to answer question, reason done make property readonly outside of class, allow code running in

arrays - How to call your enum using a for or while method in java.? -

so trying use or while method, print out of objects in main method.(anna, courtney, ashley) public class javaapplication56 { public enum details { anna(" blue ", " blue"), courtney(" red", " black"), ashley(" yellow ", " green"); string haircolor; string eyecolor; details(string haircolor, string eyecolor) { this.haircolor = haircolor; this.eyecolor = eyecolor; } public string gethair() { return haircolor; } public string geteye() { return eyecolor; } } i getting error under main method says bad operand type binary operator. first type int, second type details[]. public static void main(string[] args) { javaapplication56 ja = new javaapplication56(); (int person = 0; person < details.values(); person++) { system.out.println(details.values()+details.); } } } or more simply: // de

javascript - Navigating to Blacklisted URL's and Canceling Them -

i need write firefox extension creates blacklist , whitelist of url's, , checks make sure user wants navigate them whenever user attempts so. i'm doing using main script , content script attach every page (using pagemod); attached listener using jquery every link (with tag "a") executes function using window.onbeforeunload. have 2 questions: how prompt/ask user if did want go site? how stop browser navigating site if user decided not to? right code passes messages between 2 scripts in order accomplish goal; far can tell, can use "document" in content script, , save blacklist/whitelist in main script. i'm using simple-storage save lists, , port module pass messages between scripts. for question 1, i've attempted using confirm(message) positive/negative response user, popup either doesn't show or shows split second gets automatically answered negative response. when in console's error messages, see "prompt aborted user&qu

javascript - Live Validation change output location -

i'm using live validation javascript library , i'm wondering how can use place feedback @ bottom of page. for instance, user input "asdf.com" in <input type="text" id="subdomain-name" name="subdomain-name"> and want live-validation respond "a sub-domain should not include periods." @ bottom of page, because otherwise mess text located after box: http://puu.sh/3ixdc.jpg . i tried create css div , reference span in createmessagespan: function(){ var span = document.createelement('span'); var textnode = document.createtextnode(this.message); span.appendchild(textnode); return span; }, but did not work you can use jquery , html() function. know isn't live validation work. the html <html> <head> <script src="jquery.js"></script> </head> <body> other html here <div id="suggestion"></div> </body> </h

android - ListView null pointer exception when accessing the editText in its children -

i having problem on getting value of edittext in listview. logcat says have nullpointerexception. in doing research found out on code getting index of visible child of listview. can me one? want value of edittext in listview. here code sqlitedatabase db = databasehandler.getwritabledatabase(); db.begintransaction(); int counter = 0; for(hashmap<string, string> map : mylist) { contentvalues cv = new contentvalues(); string string = ""; (int = 0; < lv_attachedfiledata.getcount(); i++) { if (i == counter) { view view=lv_attachedfiledata.getchildat(i); edittext edittext=(edittext) view.findviewbyid(r.id.txt_idesc); string = edittext.gettext().tostring(); cv.put(co

windows clustering - Powershell command to retrieve Failover Cluster Disk Size/Free Space? -

i'm using powershell , attempting retrieve size, , available space, of physical disk resource. i want code run on 1 windows server 2008 r2 box (a monitoring server), , poll resources on 3 remote clusters on same domain. 2 of clusters running windows server 2008 r2, 1 running windows server 2012 (x64). returned data inserted database part of monitoring app. currently code i'm using is: $clusters = "cluster1.domain.local","cluster2.domain.local","cluster3.domain.local" foreach ( $cluster in $clusters) { $resources = get-clusterresource -cluster $cluster | where-object {$_.resourcetype -match "physical disk"} foreach ( $resource in $resources) { $details = get-clusterresource -cluster $cluster -name $resource.name | fc * <how disk size & space $details?> } } the data returned "get-clusterresource | fc *" doesn't include physical disk size or free space, , cannot work out how der

ubuntu - What's the difference between php.ini-production and php.ini-production-dist in /usr/share/php5? -

i've been using same php.ini file on 10 years, periodically merging changes new php versions it. since breezy (5.10), i've more or less followed debian/ubuntu conventions (with modifications), including split between cli , apache versions. as result, have in /etc/php5 has been different distribution provides default. need know differences are. luckily, default ini files still available in /usr/share/php5. understand distro default "production" (which makes sense), see more 1 production file: # ls -l /usr/share/php5/php.ini* -rw-r--r-- 1 root root 66k jul 15 20:44 /usr/share/php5/php.ini-development -rw-r--r-- 1 root root 65k jul 15 20:44 /usr/share/php5/php.ini-production -rw-r--r-- 1 root root 64k jul 15 20:44 /usr/share/php5/php.ini-production-dist -rw-r--r-- 1 root root 64k jul 15 20:44 /usr/share/php5/php.ini-production.cli what know: what exactly purpose of each of these files? in vanilla install, of these end /etc/php5/apache2/php.ini , /etc/php5/

Send value with Onchange and javascript function -

i'm new @ javascript , need submit form when select dropdown list. here sample code : <form action="" method="post"> <select name="car" onchange="this.form.submit()"> <option value="car1">car1</option> <option value="car1">car1</option> <option value="car1">car1</option> </select> <!-- other code --> <input type="submit" name="sentvalue"> </form> this form , when selects dropdown, form automatic submit need sentvalue when automatic submit form. can me capture sentvalue when select dropdown. if want send other data form submit can send in hidden inputs <input type='hidden' name='data1' value='test1' /> <input type='hidden' name='data2' value='test2' /> //etc and if want value of submit button form set value attribute code

iphone - How do I make the bottom bar with dots of a UIPageViewController translucent? -

Image
i'm in process of making tutorial, , i'm trying emulate style of path's tutorial so: http://www.appcoda.com/wp-content/uploads/2013/06/uipageviewcontroller-tutorial-screen.jpg my issue if set delegate method so: - (nsinteger)presentationcountforpageviewcontroller:(uipageviewcontroller *)pageviewcontroller { // number of items reflected in page indicator. return 5; } then stupid black bar under dots: http://i.stack.imgur.com/puedh.png is there way make bar translucent in way thats similar setting uinavigationbar translucent? it easy make work. have make pageviewcontroller taller, , place pagecontrol xib file. trick put pagecontrol in foreground (and other common controls) @ beginning, , update content of pagecontrol pageviewcontroller. here code: - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. self.pagecontroller = [[uipageviewcontroller alloc] initwithtransitionstyle:uipageviewcontrolle

html - An h3 element is not filling a div with a horizontal scroll bar correctly -

Image
here 2 snap shots of problem. see how yellow background of h3 cut off? here jsfiddle here code: <style> .outputdiv { background-color: lightcyan; overflow: auto; border: solid 2px black; width: 500px; } h3 { margin-top: 0px; background-color: yellow; } </style> <div class="outputdiv"> <h3>my title here</h3> <pre> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse </pre> </div> i know add div background color contain h3, h3 block level element. any ideas? even though <pre> block level element, behavior

javascript - z-index not working with a tooltip -

Image
i using tooltip carousel on site . (the 1 @ left) however when hover image, tooltip won't above "next image", though set z-index 500 (it works chrome) . suppose because content page block not parent carousel. here css code tooltip: a.tooltip2 em { display:none; } a.tooltip2:hover { border: 0; position: relative; z-index: 500 !important; text-decoration:none; } a.tooltip2:hover em { z-index: 500 !important; font-style: normal; display: block; position: relative; top: 60px; left: -500px; padding: 5px; color: #fff; /*border: 1px solid #bbb;*/ background-color:rgba(11,88,116,0.9); box-shadow: 0 0 7px 2px #117194; width:400px; } here screenshot can see issue: i hovering image under "prochainement". , &qu

html - validating using jquery in codeigniter -

<div class="label_left"><label>name :</label></div> <div class="text_right"><input type="text" name="usr_name" id="usr_name" value="" size="30" /><br /><br /></div> <div class="label_left"><label>title :</label></div> <div class="text_right"><input type="text" name="usr_title" id="usr_title" value="" size="30" /><br /><br /></div> <div class="label_left"><label>direct line :</label></div> <div class="text_right"><input type="text" name="usr_dline" id="usr_dline" value="" size="30" /><br /><br /></div> <div class="label_left"><label>e-mail :</label></div> <div class=

asp.net - ORA-01861: literal does not match format string","StackTrace":" at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) -

select prodescription.pdc_desc,prodescription.pd_code billdetl,billmast,prodescription billdetl.bmc_slno=billmast.bmc_slno , prodescription.pd_code=billdetl.pd_code , billmast.pt_no='" + hospitalno + "' , billdetl.original_oucode='l002' , to_date(billmast.bmd_date,'dd/mm/yy') =to_date('" + visitdate.toshortdatestring() + "','dd/mm/yy')" above query works in oracle error occurred when connected oracle using asp.net oledb connection it seem oledb connection done machine locale not return date format you're expecting locale dependent toshortdatestring() . try replacing visitdate.toshortdatestring() fixed - non locale dependent - date format, like; and trunc(billmast.bmd_date, 'day') =to_date('" + visitdate.tostring("dd\\/mm\\/yy") + "','dd/mm/yy')"

c# - NullReferenceException when searching for data in DataGridView -

hi i've written code search cardserial in gridview. error : "object reference not set instance of object." foreach (datagridviewrow row in datagridview2.rows) { if (row.cells["cardserial"].value.tostring().equals(textbox2.text)) { datagridview2.rows[row.index].defaultcellstyle.backcolor = color.yellow; } } could tell me what's problem? first check if value in cell not null (if calling tostring on fails) foreach (datagridviewrow row in datagridview2.rows) { var serial = row.cells["cardserial"].value; if (serial != null && serial.tostring().equals(textbox2.text)) { row.defaultcellstyle.backcolor = color.yellow; } }

html - Javascript log into website -

i'm trying make private html document on flash drive when launched, log me website. i've searched , searched , have yet find online same problem, not find help. sites log in using post method of course. know it's possible request page, possible control elements inside of it? any information appreciated. you want make userscript scriptish or make bookmarklet.

Global status of the single schema in mysql -

i need take global status of single schema in mysql. show global status; using above query can entire db status. how can particular schema similar data. show global status; is command getting status of server, not schema. show status provides server status information. check here more

c# - How to get edited value in MVC -

im new in mvc 1. in project im assigning ilist model , using forloop im assigning textbox , dropdox etc... user can change value per there requirement. want, how value present on aspx page in form of ilist when user click on save button present @ top of page. here code im using populating form.... <asp:content id="content1" contentplaceholderid="maincontent" runat="server"> <% using (html.beginform("mycontroller", "editcopyrestaurantmealrate", formmethod.post, new { id = "frmeditcopyrestaurantmealrate" })) { %> <%= html.submit("save services", applicationpermissions.managecontract, new { name = "submitbutton" })%> <table width="100%" class="edit_restaurant_form"> <col width="19%" /> <col width="30%" /> <col width="19%" /> <col width="*" /> foreach (var item in mod

sybase - compare columns for a table in different 2 databases -

i got 1 table in 2 different databases, in database number of columns 284 columns in other databse number of columns 281 columns there 3 columns missing. there query (not tool have found out somthing called compare it ) can find missing columns ? example: database 1 column1 column2 column3 column4 column5 column6 database 2 column1 column2 column3 column5 column6 in above example column 4 missing, there query in sybase can tell me missing column? create 2 temporary tables 2 tables in 2 different databases, suppose #tablecolumns1 , #tablecolumns2 create table #tablecolumns1(columnname varchar(255)) create table #tablecolumns2(columnname varchar(255)) insert #tablecolumns1 select sc.column_name sys.syscolumn sc, sys.systable st sc.table_id = st.table_id , st.table_name = '<databasename1.tablename1>'; insert #tablecolumns1 select sc.column_name sys.syscolumn sc, sys.systable st sc.table_id = st.table

iphone - Zoom UIView and all the contents in it -

i new develop ios frameworks/library. have develop framework zoom pages of ios application. have view based application , elements uibutton , uitextfield in it. when pinch zoom/double tap, uiview , contents should zoomed(pan , zoom) accordingly. my idea create template view, acts normal uiview (i mean can add components , sub views view), has feature pan , zoom. please note components( uibutton , uitextfield ) zoomed accordingly. first of i'd know whether possible. please give me suggestions achieve it. use scrollviews delegate return view zoomed - (uiview *)viewforzoominginscrollview:(uiscrollview *)scrollview { return viewtobezoomed; } also u can control max , min zoom values as self.scrollview.minimumzoomscale=1.01; self.scrollview.maximumzoomscale=5; self.scrollview.zoomscale=1.01;

python - Appending multiple list index into a single list then using join to print them -

hello have script script should take 2 files split them 2 lists after add them in 1 list , write content in 1 file problem 1 of file might have list length on 1+ index of them 5 of them 10 need w.e length of first , second list add them single list , write them in single file without [] , ' between data thank here script import re f = open('firsttext.txt', 'r') d = open('second.txt', 'r') w = open('combination.txt','w') s="" filtred=[] mlines=f.readlines() wlines=d.readlines() line in wlines: wspl=line.split() line2 in mlines: mspl=line2.split() if ((mspl[0]).lower()==(wspl[0])): wspl.append(mspl[1]) print (wspl) s="\t".join(wspl)+"\n" if s not in filtred: filtred.append(s) break x in filtred: w.write(x) f.close() d.close() w.close() get content of each file first, join them. from i

php - How to set custom page as default page for customer account? -

i've got problem can't solve. partly because can't explain right terms. i'm new sorry clumsy question. below can see overview of goal. i logged in customer in site default showing 'dashboard' want set custom page (order history) possible or not ? if yes how ? how can 1 in magento ce1.7 may duplicate question sorry forgive me.. any ideas ? hope help <?php mage::getsingleton('customer/session')->setafterauthurl(mage::geturl("sales/order/history/"));?> or try extension : http://www.magentocommerce.com/magento-connect/custom-login-redirect.html

css - Div nest structure -

Image
i have met problem don't know wrong. code here: <html> <head> <style type="text/css"> #top{ width:100%; height: 78%; background-color: #ccc; } #left{ width: 45%; height: 100%; display: inline-block; background-color: green; } #right{ width:50%; height: 100%; display: inline-block; background-color: pink;} </style> </head> <body> <div id="top"> <div id="left"> <div id="inside">asd</div> </div> <div id="right"></div> </div> </body> </html> if add nothing "inside" div, layout alright , this: but if add tag or few words in "inside" dev .the layout wrong. i'm new html,so don't know problem,who can tell me why happens? i've been driven crazy!!!help~~~~:( you can use float (see other answers), don't have if don't want to.

.net - Updating numbericUpdown on runtime in c# -

Image
i updating numeric updown on runtime such compute value "x" on runtime , set minimum , maximum value of numeric updown. numud.minimum=x/2; numud.maximum=x; but problem is not updating. tried call update() , refresh() function still not working. body can guide me how that. thanks try below code , check if minimum value being displayed set 10 or not. int x = 20; numud.minimum = x / 2; numud.maximum = x; because having feeling value of x must 0 must having feeling values not getting set. looking comments updated answer this... below image show actual , needed code.

php - How to get <pre> tag contents using preg_match_all? -

i need scrap webspage inside <pre> tag contents. using preg_match_all function not working. my scraping website <pre> tag content given below. <pre># mon jul 22 03:10:03 cdt 2013 99.46.177.18 99.27.119.169 99.254.168.132 99.245.96.210 99.245.29.38 99.240.245.97 99.239.100.211 <pre> php file updated $data = file_get_contents('http://www.infiltrated.net/blacklisted'); preg_match_all ("/<pre>([^`]*?)<\/pre>/", $data, $matches); print_r($matches); exit; my php file returns empty array. know preg_match_all function problem. how can pre tag contents. please guide me. edit question i can run @pieter script. returns array() my script given below. <?php $url = 'http://www.infiltrated.net/blacklisted'; $data = new domdocument(); $data->loadhtml(file_get_contents($url)); $xpath = new domxpath($data); $pre_tags = array(); foreach($xpath->query('//pre') $node){

In C, can an address of a pointer be 0? -

i'm reading solution problem in book cracking coding interview (q 1.2). objective there implement function void revers(char* str) in c reverses null terminating string. the solution code looks this: void reverse(char *str) { char* end=str; char tmp; if(str) { while(*end) { end++; } end--; //code reverse } } here, str contains address right? , if(str) evaluate false if str 0 , right? so i'm saying is, there no chance str contain address 0x0000 , evaluating if(str) false ? str indeed contain address (it's pointer char ), , if(str) evaluate false iff str equal null pointer . note null pointer not required standard refer address 0 ; however, standard mandates literal value of 0 when used in pointer context must interpreted compiler address of null pointer -- whatever might be. this means test if(p == 0) guaranteed same if(p == null) . also, conditional if(p) guaranteed same if(p

java - libgdx: Repeat a texture with offset like in HTML/CSS -

i want repeat texture texture should start offset rather 0,0 (uv). set texture.setwrap(texture.texturewrap.repeat, texture.texturewrap.repeat); and draw with backgroundbatch.draw(texture, 0, 0, stage.getwidth(), stage.getheight(), 0, 0, 1, 1); there 2 problems solution: first, texture skewed , i'm not seem able specify offset texture. screen cordinate should 0,0 texture uv should not start 0,0 i want same behaviour background-position in combination off background-repeat in css. best way achieve using parrallaxlayer , parrallaxbackground classes it optimised background operation u dont have worry performance https://code.google.com/p/libgdx-users/wiki/parallaxbackgound

java - Setting the view of PDf file by 75% -

i want pdf file creating using itext-java open 75% view. mean magnification percent should preset 75%. how can done? you have several options influence viewer preferences, writer.setviewerpreferences(pdfwriter.fitwindow); however may see in jdoc there no option directly set zoom level. options have: use open parameter: commandline: acrord32.exe /a "page=8=zoom=75=openactions" "c:\your_document.pdf" url: http://partners.adobe.com/public/developer/en/acrobat/pdfopenparameters.pdf#page=5&zoom=75 set openaction javascript : pdfaction action = pdfaction.javascript("", writer); writer.setopenaction(action); please note 2nd option e.g pdf/a files javascript forbidden and/or may disabled/unsupported viewers.

jquery - Disable class inhernces on particular page ID -

i'm using jquery mobile web app. on project developers override of main jquery mobile classes like: .ui-btn-text .ui-icon .ui-btn-corner-all for example: .ui-btn-text { color:#fff; padding:6px 10px; line-height:10px; font-size:12px; /* settings.... */ } i'm adding new input , automatically inherits overridden class. how can disable inherited on particular page, work jquery mobile classes, example disable #pagetest . just reset original values according jquery mobile's stylesheet . if it's un-minified version of jquery, can found here . here example of in practice . example like #pagetest.ui-btn-text { position: relative; z-index: 1; } the other option use javascript , iterate through each instance of class. using jquery easiest: $('.ui-btn-text').each(function() { $(this).css({ 'position' : 'relative', 'z-index':'1', //etc... }); });

Android - Language change when clicking back -

i have settings section allow users change languages displayed within app. when user chooses different language, activity reloaded change of language can applied. problem is, when user clicks right after changing language, language shown in background activity still same. question is, should apply change of language when activity on background? suppose should detect change in onresume method, i'm not sure is. if have suggestions, please let me know. thank you. after several attempts, have found solution problem. on oncreate method, sharedpreferences contains value of current language, , current language: sharedprefrences languagepref = getsharedpreferences("language",mode_private); string language = languagepref.getstring("languagetoload", locale.getdefault().getdisplaylanguage()); then, in onresume method, assign value of above mentioned variable language local variable, , update value of language . compare these 2 variables - if different

ios - dismissViewControllerAnimated doesnt load viewDidLoad again -

i have tried few things havent worked (more things have thought of). when using [self dismissviewcontrolleranimated:yes completion:nil]; need run viewdidload method of controller going to. how can this? thought maybe in completion however, access viewdidload of class rather of 1 im resuming to. viewdidload method called once. after dismissviewcontrolleranimated called parentviewcontrollers viewwillappear method called. write code viewdidload viewwillappear

sql - how to show images from ftp folder with folder names and images names in asp.net c# -

i beginner in asp.net development. creating web application required show images folder along folder name. such one list containing folder names when 1 folder name selected file names displayed (images names) , in image viewer images displayed 1 one on button click. on next folders. any suggestion, code or useful link highly appreciated. in advance. here want you can use jquery tree view asp.net http://www.programmingsolution.net/useful-js/jquery-treeview.php for jquery try this http://jquery.bassistance.de/treeview/demo/

celltable - How to add a new column with ListDataProvider to GWT Table without to change ohther columns data? -

i have gwt celltable, wich updated database. new values database should added in new column without update other columns. so, after each refresh can see new state in new column , compare old state. example of 1 row (refresh in 10 minutes - after refresh have 1 column more): data_with_timestamp_01:00 after refresh: data_with_timestamp_01:00 data_with_timestamp_01:10 after next refresh: data_with_timestamp_01:00 data_with_timestamp_01:10 data_with_timestamp_01:20 etc. to add new column new data not problem. problem is, after refresh listdataprovider change columns data in table , not last one. can sb me? i think celltable wrong tool requirement. can try update last row : dataprovider.getlist().set(index, dataprovider.getlist().get(index)) ;

powershell - running Install.ps1 everytime with Nuget package update -

i have small question does install.ps1 file runs every time when update installed nuget package or if install same package on installed project? if doesn't thare way can run our power shell script every time after package updated or installed first time? thanks regards

ember.js - setting values of nested objects -

i have simple ember.object has ember.object member topobject = ember.object.extend({ subobject: ember.object.extend({ prop: '' }) }); the question is, can ember set values of nested object if create object loaded data this: topobject.create({ subobject: { prop: 'value'} }); if understanding correct need object property of object, use ember.object.create() subobject create instance. can go out way topobject.create({suboject: {prop: 'value'}}); here little fiddling on objects

Tapestry 4.1 conversation scope. Possible? -

is somehow possible use conversational scope in tapestry 4.1 , hivemind? right now, if user opens same page in 2 different tabs, use same model injected hivemind. if submits data in first page, in fact changes data opened(loaded) in second tab. also seems tapestry components in session scope. because can't use components on same page in different tab. if submiting error this org.apache.tapestry.bindingexception: unable update ognl expression '' of #some_page: target null setproperty(null,....... solution? this not possible without significant hacking of framework , framework has moved on; 4.1 5 years old, , development efforts has been on tapestry 5 (5.3 stable release, 5.4 coming soon).

cuda - thrust copy_if with const source -

my problem in following code: the filter function compiles, , runs should when source not constant (the iterators adjusted accordingly). when change source const, compiler gives me following error first 2 variables of copy_if statement: "the object has type qualifiers not compatible member function". i believe there const not const conversion error somewhere frankly have no idea where. appreciated. #include "thrust\device_vector.h" #include "thrust\copy.h" typedef thrust::device_vector<float>::const_iterator dc_floatiterator; typedef thrust::device_vector<float>::iterator d_floatiterator; typedef thrust::device_vector<int>::const_iterator dc_intiterator; typedef thrust::device_vector<int>::iterator d_intiterator; typedef thrust::tuple< dc_intiterator, dc_intiterator, dc_floatiterator> dc_listiteratortuple; typedef thrust::zip_iterator<dc_listiteratortuple> dc_listiterator;//type of clas