Posts

Showing posts from September, 2013

java - How to invoke a method by a string in singleton -

i have singleton class, string method's name, , want invoke method class. class foo { private static foo instance; private string name; private foo() { } public static getinstance() { if(instance == null) instance = new foo(); return instance; } public foo setname(string name) { this.name = name; return this; } private void bar() { system.out.println("a"); } public void execute() { // invoke "name" method here } } foo.getinstance().setname("bar").execute(); how can this? use foo.getclass().getmethod(name, null).invoke(this, null) . you'll need change second parameter getmethod if have several methods same name different signatures, , invoke if method accepts parameters.

C++ in Xcode pausing -

this first post. new programming, , c++ thought might try , make program allows user submits block of text (max 500 characters), allows them enter 4 letter word , program return amount of times picks word in text. using x-code , keeps making green breakpoint , pausing program @ 'for' loop function. code shown below: #include <iostream> #include <string> #include <math.h> #define space ' '(char) using namespace std; //submit text (maximum 500 characters) , store in variable string text; string textquery(string msgtext) { { cout << msgtext << endl; getline(cin, text); } while (text.size() > 500); return text; } //query word search , store variable string word; string wordquery(string msgword) { cout << msgword << endl; cin >> word; return word; } //using loop, run through text identify word int counter = 0; bool debugcheck = false; int searchword() { (int = 0; < text.size(); i++) { char ch_1 = text.at(

php - mysqli_num_rows() boolean error -

while running code, shows error mysqli_num_rows() expects parameter 1 mysqli_result, boolean please me find solution: if(!empty($email_id) && !empty($password)){ $query="select 'email_id' 'user_details' 'email_id'='$email_id' , 'password'= '$password'"; $con=mysqli_connect("localhost", "root", "","idukki"); $query_run = mysqli_query($con,$query); $query_num_rows = mysqli_num_rows($query_run); if($query_num_rows == 0) { echo'invalid email , password combination'; } else if($query_num_rows == 1) { $user_id = mysqli_result($query_run,0,'email_id'); } } when type of error regarding mysql first thing should print out sql , test in phpmyadmin, if passes in phpmyadmin have error in script, if not bad sql

javascript - Chrome.storage.sync.get not storing value in local variable -

function getbugval() { var bugval = ""; chrome.storage.sync.get('bugid', function (obj) { console.log(obj.bugid); bugval = obj.bugid; console.log(bugval + "<- val inside sync"); }); console.log(bugval + "<- val outside sync"); return bugval; } if call getbugval() return value keeps indicating empty string instead of actual value chrome.storage.sync.get. bugval not saving string value. console.log(bugval + "<- val inside sync"); yields correct value within inner function call. thoughts? yep. that's how async code works. you'll have use callbacks. work. function workwithbugval(val) { // stuff } function getbugval(callback) { var bugval = ""; chrome.storage.sync.get('bugid', function (obj) { console.log(obj.bugid); bugval = obj.bugid; callback(bugval); }); } getbugval(workwithbugval);

sqlite error near '''' syntax error data input -

i using sqlite3 , trying put data database. create table club( cl_id int primary key not null, naam text not null, adres varchar(200) not null, dtm_opricht text not null ); create table stadion( sta_id int primary key not null, cl_id int references club(cl_id), naam text not null, adres varchar(200) not null, capaciteit int not null, dtm_bouw text not null ); create table technischdirecteur( td_id int primary key not null, cl_id int references club(cl_id), naam text not null, adres varchar(200) not null, salaris real not null, nationaliteit text not null, geslacht text not null, dtm_geboorte text not null ); everything going fine pu

android - Capture image from web page using regex -

i writing simple program capture image resources web page. image items in html looks like: case1:<img src="http://www.aaa.com/bbb.jpg" alt="title bbb" width="350" height="385"/> or case2:<img alt="title ccc" src="http://www.ddd.com/bbb.jpg" width="123" height="456"/> i know how handle either case separately, take first 1 example: string capture = "<img(?:.*)src=\"http://(.*)\\.jpg\"(?:.*)alt=\"(.*?)\"(?:.*)/>"; defaulthttpclient client = new defaulthttpclient(); basichttpcontext context = new basichttpcontext(); scanner scanner = new scanner(client .execute(new httpget(uri), context) .getentity().getcontent()); pattern pattern = pattern.compile(capture); while (scanner.findwithinhorizon(pattern, 0) != null) { matchresult r = scanner.match(); string imageurl = "http://" +

asp.net mvc 5 - How to remember the login in MVC5 when an external provider is used -

in our mvc5-application owin, use additional local accounts external logins (google). when user logs in local account, can activate option remember him, has not log-in every time newly. when logs in google-account, every time must click newly on external login-button google. is there built-in option activate “remember me”-option external logins? or there secure way add feature? you need set ispersistent true accomplish when sign in user identity (you want add kind of remember me checkbox external flow well) authenticationmanager.signin(new authenticationproperties { ispersistent = <rememberme> }, <useridentity>);

java - Error cannot be resolved to a variable -

error: exception in thread "main" java.lang.error: unresolved compilation problem: guess cannot resolved variable @ hw2.demo.getuserguess(demo.java:80) @ hw2.demo.play(demo.java:23) @ hw2.demo.main(demo.java:15) code private static char[] getuserguess() { scanner input= new scanner(system.in); char [] user = new char [array_size]; (int =0; i<array_size; i++){ system.out.println("plz enter color guess b g r y o p"); char c=input.next().charat(i); user[i]=c; //... i beginner @ java

c - Segmentation fault Core dumped on virtual machine -

in function, created following char array. char key1[500]=""; i looping through index "i" in function , copying values of inputfilearray global variable through index initialindex (a global index). key1[i++]= inputfilearray[initialindex++]; this statement resulting in error segmentation fault(core dumped) when run. btw, worked fine on machine in compiled using visual studio c++ editor. error when try run on ubuntu 13.10 on virtual machine. appreciate answers. this statement resulting in error segmentation fault(core dumped) when run. learn use debugger (usually gdb on linux). may want start here . run program under debugger, , verify i < 500 , that initialindex < sizeof(inputfilearray) . this worked fine on machine yes, bugs that: code works fine ( appears work fine) on 1 machine crashes on next.

PHP file search lists directory as file -

the following script searching documents/files in specified path. works quite except fact when subfolder has subfolder, lists file/makes clickable. not want. want script show files in each folder (including files in subdirs). hope explanation not messy, haha. since i'm not able post screenshot try explain. current folder structure: vbfiles/ -dir1/ -subdir1/ -filesubdir1.doc -subdir2/ -filesubdir2.doc -dir1file1.doc -dir1file2.doc -dir1file3.doc -dir2/ -subdir3/ -filesubdir3.doc -subdir4/ -filesubdir4.doc -dir2file4.doc -dir2file5.doc -dir2file6.doc result(what want remove marked "<-- no" :)): found 14 file(s) dir1 dir1file3.doc dir1file2.doc subdir1 <-- no subdir2 <-- no dir1file1.doc subdir1 filesubdir1.doc subdir2 filesubdir2.doc dir2 subdir3 <-- no dir2

opengl - how to get inverse of modelview matrix? -

i transformed vector multiplying model view matrix. glgetdoublev( gl_modelview_matrix, cam ); newx=cam[0]*tx+cam[1]*ty+cam[2]*tz+cam[3]; newy=cam[4]*tx+cam[5]*ty+cam[6]*tz+cam[7]; newz=cam[8]*tx+cam[9]*ty+cam[10]*tz+cam[11]; how inverse of model view matrix reverse transformation? what have in posted code isn't correct way of applying modelview matrix. opengl uses column major order matrices. calculation need this: newx=cam[0]*tx+cam[4]*ty+cam[8]*tz+cam[12]; newy=cam[1]*tx+cam[5]*ty+cam[9]*tz+cam[13]; newz=cam[2]*tx+cam[6]*ty+cam[10]*tz+cam[14]; for inverted matrix, can use generic matrix inversion algorithm, @datenwolf suggested. if can make assumptions matrix, there easier , more efficient methods. typical case know transformation matrix composed of rotations, translations, , scaling. in case, can pick matrix apart these components, invert each, , reassemble them inverted matrix. since rotations, translations , scaling trivial invert, can done simple math.

ios - Delete NSManagedObject and later refresh tableView doesn't work correctly -

i have 2 nsmanagedobject (person , car) , relationship "not inverse" between them. relationship not inverse. i have 2 viewcontrollers, first 1 has tableview shows each instance of person object , second has table view shows every car of person. first view controller shows name of person , number of cars of person. all works fine issue appear when try delete car of person. think remove object correctly: [_person removecarssobject:car1]; but issue appear when being in second view, remove car, , go first view: number of cars doesn't refresh , app crashes. when add car , go second view works , 'number of cars' increases. when run app again, car deleted. why think way delete object correct. i've realized app works number of cars going take value 0, otherwise app crashes. i hope can me, thank you! update: i’ve changed code, , reload data of table view in - (void)viewwillappear:(bool)animated{ this way can see proper data in table view, bu

count - top ten customer by the amount they spend in Hiveql -

i have 95904 rows(transactions) in table transaction_records in hive there 9999 distinct customers want know top ten customers amount spend have following fields: txnno int txndate string custno int amount double category string product string i tried using: select custno, sum(amount) (select txno, custno, amount, category, product transaction_records group custno); failed: parseexception line 1:112 mismatched input '<eof>' expecting identifier near ')' in subquery source this doesnt work, new hiveql know query it? try this: select custno, sum(amount) s transaction_records group custno order s desc limit 10;

python - What does base value do in int function? -

i've read official doc https://docs.python.org/2/library/functions.html#int , still confused. i've tried command on terminal, find rules, still not quite clear it. hope more knowledge can explain further. below examples , findings: int('0', base=1) valueerror: int() base must >= 2 , <=36 int('3', base=2) valueerror: invalid literal int() base 2: int('3', base=4) 3 int('33', base=4) 15 int('333', base=4) 63 int('353', base=4) valueerror: invalid literal int() base 4: i find 2 rules here: the single string numbers must smaller base number. the int() return number equals (n)*(base^(n-1)) + (n-1)*(base^(n-2)) + ... + 1*(base^0) are there other hidden rules this, , kind of problem base designed solve? it says - converts string integer in given numeric base. per documentation, int() can convert strings in base 2 36. on low end, base 2 lowest useful system; base 1 have "0" symbol, pretty

number formatting - PHP number_format not working properly -

i have variable: $out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s$newline", ___('tax'), am_currency::render($this->{$prefix . '_tax'}, $this->currency)); which time being equals 4000. need formatted this: 4,000 changed code below: $out .= $indent . sprintf("{$total_space}%-{$column_total}s{$space}%{$price_width}s$newline", ___('tax'), am_currency::render(number_format($this->{$prefix . '_tax'}), $this->currency)); however, dont know why 4 instead. happened other zeros? tried different values such 1214.92 example , in cases output leaves out last 3 digits. this render function: static function render($value, $currency = null, $locale = null) { return (string)self::create($value, $currency, $locale); } public function __tostring() { $format = array_key_exists($this->currency, $this->formats) ? $this->formats[$this->curr

mysql - Advanced search form to query a database in any criteria using PHP -

i found php class seems me advanced search of database. here is: <?php class search { var $table; var $field1; var $field2; function queryrow($query){ //define database settings define("host", "xxxxxxxx"); define("login", "xxxxxx"); define("senha", "xxxxxxx"); //define database name define("data", "xxxxx"); //conection routine try{ $host = host; $data = data; $connection = new pdo("mysql:host=$host;dbname=$data", login, senha); //$connection->setattribute(pdo::attr_errmode, pdo::errmode_exception); $result = $connection->prepare($query); $result->execute(); return $result; $this->connection = $connection; }catch(pdoexception $e){ echo $e->getmessage(); } } function close($connection){ $connection = null; } function query($

ruby - How to yield 2 blocks in 1 method -

how can yield 2 diferent blocks in same method the example code: def by_two(n,a) yield n yield end proc1 = proc {|x| p x * 2} proc2 = proc {|x| x + 100} by_two(10, 300, &proc1, &proc2) the error such - main.rb:7: syntax error, unexpected ',', expecting ')' by_two(10, 300, &proc1, &proc2) any suggestions , wrong? thanks blocks lightweight way of passing single anonymous procedure method. so, by definition , there cannot 2 blocks passed method. it's not semantically impossible, isn't possible syntactically . ruby does support first-class procedures in form of proc s, however, , since objects other object, can pass many of them want: def by_two(n, a, proc1, proc2) proc1.(n) proc2.(a) end proc1 = proc {|x| p x * 2} proc2 = proc {|x| x + 100} by_two(10, 300, proc1, proc2) # 20 # => 400 since introduction of lambda literals in ruby 1.9, proc s syntactically lightweight blocks, there not big difference an

java - Using Scanner, and nextLine for ending programm -

i supposed create program keeps reading user input command line until user types quit shall use indexof position of space characters. i tried following: import java.util.scanner; import java.lang.string; public class aufgabe6b { public static void main(string[] args) { scanner scanner=new scanner(system.in); string a; system.out.println("bitte eingabe machen!"); while(true){ a=scanner.nextline(); if("quit".equals(a)){ break; } } system.out.println(a.indexof(" ")); } } while a.indexof giving me position of first " " founds, still have issue scanner , quit. if type: hello test quit, doesnt quit. if type quit, breaks of queue. if type quit hello ist test, doesnt quit. i supposed use indexof , scanner nextline method. possible, did wrong? one option be: while(true) { a=scanner.nextline(); int j = a.indexof("quit&quo

php - Accessing value of indirectly related models -

i displaying cgridview below cdetailview on view.php page company model. have problem in displaying values in cgridview using company details. company model has array of companyaddresses used carraydataprovider cgridview. $config = array(); $dataprovider = new carraydataprovider($rawdata=$model->companyaddresses,$config); $this->widget('zii.widgets.grid.cgridview', array( 'dataprovider'=>$dataprovider , 'columns'=>array( //'id', array('header'=>'sn.', //'value'=>'++$row', // may nt work pagination below work 'value'=>'$this->grid->dataprovider->pagination->currentpage * $this->grid->dataprovider->pagination->pagesize + ($row+1)', ), 'address', array( 'nam

java - Problems with static and non static -

i have problems non-static variables referenced static context , don't know, how change methods solve it. the first 1 one, supposed spawn bullet @ position shooter has @ moment of firing: world.addobject(new bulleth(), (int)posx , (int)posy); also trigger removing bullets, when leave world doesn't work: if(posx<0 || posx> getworld().getwidth() || posy <0 || posy > getworld().getheight()){ world.removeobject(this); i appreciate it, if me these problems , make me understand, how can circumvent error. //edit class hero import greenfoot.*; import java.util.list; import java.awt.rectangle; public class hero extends alive { private double mspeed = 100.0; private long framebegin = 0; private double posx; private double posy; private boolean isjumping = false; private double maxjumptime = 0.35; private double jumptime = 0; private double jspeed = 250.0; private double fspeed = jspeed; private boole

c++ - std::queue memory deallocation does not work -

i have basic class push member 1 thread , pop another.but debugged memory leak validator see memory not freed , validator show leak issue @ pushing stage.in class have array not dynamic. my_class{ int my_var1; int my_var22; int my_array[100000]; my_class& operator=(const my_class& old){ if(this!=&old){ var1=old.var1; var2=old.var2; memcpy(my_array,old.my_array,size) //size fixed same 100000 } my_class(const my_class &copy){ *this=copy; } }; //here reading data udp , copy array var1; my_class var1; my_class var2; int udp_array[]; //thread 1 while(haspendingdata()){ udp_array.fill(); //my_array filled after loop } //than mem_cpy(var1.my_array,udp_array,size); my_mutex.lock(); std::my_queue.push(var1); my_mutex.unlock(); //thread 2 my_mutex.lock(); var2=my_queue.front(); my_queue.pop(); my_mutex.unlock();

asp.net - 500.19 - Internal Server Error ISS website -

i tried creating new web applications... i have been using vs 2010 developing website i make use of wsp builder package dlls, pages, scripts , images solution package , deploy in web applications. i trying mvc web app running in iis. unfortunately, absolutely stuck on error: http error 500.19 - internal server error the request page cannot accessed because related configuration data page invalid. module: iis web core notification: unknown handler: not yet determined error code: 0x80070005 config error: cannot read configuration file due insufficient permissions config file: \\?\c:\users\dev.fuji\desktop\mywebiste\web.config request url: http://xxx.xxx.xxx.xxx logon method: not yet determined logon user: not yet determined config source -1: 0: i not quite sure else do. why got error, search youtube worked why not me.. done. maybe** because before server done else in place... new worker in department...so miss installment part in video.. make error? have reinstall

php - Wordpress include plugin in post page -

hi trying use advanced layer slider in wordpress post page. code pasted in header.php file works on pages, not posts, can see shortcode showing though in top of posts page. there anyway include code needed plugin easily? thanks in advanced, james sorry formatting single.php <?php global $avia_config; /* * get_header basic wordpress function, used retrieve header.php file in theme directory. */ get_header(); $title = __('blog - latest news', 'avia_framework'); //default blog title $t_link = home_url('/'); $t_sub = ""; if(avia_get_option('frontpage') && $new = avia_get_option('blogpage')) { $title = get_the_title($new); //if blog attached page use title $t_link = get_permalink($new); $t_sub = avia_post_meta($new, 'subtitle'); } if( get_post_meta(get_the_id(), 'header', true) != 'no') echo avia_title(array('heading'=>'strong', 'title' => $t

what does unchecked exception mean in java -

well, book got below lines: java defines several exception classes inside standard package java.lang. general of these exceptions subclasses of standard type runtimeexception. since java.lang implicitly imported java programs, exceptions derived runtimeexception automatically available. furthermore, need not included in method's throws list. so, doesnt mean dont need try catch block? i have done following code, showing error: exception in thread "main" java.lang.arithmeticexception: / 0 @ arithcls.main(arithcls.java:10) code: import java.lang.*; public class arithcls { public static void main(string[] args) { int a=20; int b=0; int c = a/b; system.out.println("after code"); } } an unchecked exception 1 not checked ;-p no, in seriousness, it's exception compiler/jvm not force code check for. these (always?) runtime exception, such nullpointerexception . a runtime exception exception can't anticipate an

ios - Shortest way to get digit number from a value -

let's have number 134658 , want 3rd digit (hundreds place) "6". what's shortest length code in objective-c? this current code: int thenumber = 204398234; int thedigitplace = 3;//hundreds place int thedigit = (int)floorf((float)((10)*((((float)thenumber)/(pow(10, thedigitplace)))-(floorf(((float)thenumber)/(pow(10, thedigitplace))))))); //returns "2" there better solutions, 1 shorter: int thenumber = 204398234; int thedigitplace = 3;//hundreds place int thedigit = (thenumber/(int)(pow(10, thedigitplace - 1))) % 10; in case, divides number 100 2043982 , "extracts" last decimal digit "remainder operator" % . remark: solution assumes result of pow(10, thedigitplace - 1) exact. works because double has 16 significant decimal digits , int on ios 32-bit number , has @ 10 decimal digits.

javascript - ReferenceError: item is not defined in Azure insert script -

i using following code in insert perform push notifications. todoitem table contains imageurl , channel table has channl uris. reference code here- http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-store-dotnet-get-started-push-vs2012/ the following code insert script in todoitem table var azure = require('azure'); var qs = require('querystring'); var appsettings = require('mobileservice-config').appsettings; function insert(item, user, request) { // storage account settings app settings. var accountname = appsettings.storage_account_name; var accountkey = appsettings.storage_account_access_key; var host = accountname + '.blob.core.windows.net'; if ((typeof item.containername !== "undefined") && ( item.containername !== null)) { // set blob store container name on item, must lowercase. item.containername = item.containername.tolowercase();

How to write a SQL Server query to summarise table data? -

i need sql server query. have table this: user_id display_name username updated_on -------------------------------------------------------------------- 2012772 user1.username 450958885 2012772 user1.displayname 451124897 2155281 user2.username 451045840 2162145 user3.username 451147363 2162145 user3.displayname 451147423 and need output below: if display name user present render along updated_on else render username , updated on. user_id display_name_computed updated_on ---------------------------------------------------- 2012772 user1.displayname 451124897 2155281 user2.username 451045840 2162145 user3.displayname 451147423 the sql should select statement. no temp tables or table variables usage. no delete statements usage. here go select use

networking - Representation of Network topology in python -

this code class switches https://github.com/osrg/ryu/blob/master/ryu/topology/switches.py#l429 the member variables of particular interest me in class switches following. self.dps = {} # datapath_id => datapath class self.port_state = {} # datapath_id => ports self.ports = portdatastate() # port class -> portdata class self.links = linkstate() # link class -> timestamp self.is_active = true these member variables ryu uses cache topology details.i trying figure out how topology can represented using following variables. 1) dps dictionary maps datapath_id datapath class? - can explain me datapath_id , datapath class? 2) port_state dictionary maps datapath id ports - per understanding on switch without vlan ports belong same datapath id? in case of switch vlan ports on switch can have multiple datapath id's. understanding correct? 3) ports again dictionary maps port class portdata class? - m

iOS base64 issue -

the base64 string av/u+hkoahxhdycrntxxyigtdzedmoc6zt+fu7kqpylayb8cxwrgjblwvna7iyyah50lv87ebhe9pqsxjz/3a07c9yc251jaglfoe/2s0kihllmuse8q+lf/ezro2iq9wo6vmtd+itkp421cbqlull0fzur5lwqmqw2x/oyzhi3/9ho4jqfd8ge022p0ottwgvepqmtlwjus4nqlym+i9ohxz41kqgc0rtf9gs7srihugvk8o8xnciemuomnmxflqdcpgswmzpkwhxs79yjujyphc409/iktk6mwmzc/omtytxeguqpdoeenwf8f7inxbolpydbdhd7zlv/mc+skspfc0mnpdlyul0e3ztloquolmjugct3z1apdo4dlbqny7hlnusb01o/dmumnrakpsth/jsbbctit8jggjkpt8ab7/oo6cnohdtdy1t7yxqo0zlxulrbymhl0sj9cng3mq/eaalvdhxezs9agkudo4gjmhdkff+if3i2/yfegydcyakvjfuasam5s7qjlrbkhjtqydrwwqbk+15ejxhfufdcgm64xngvsrko1luj7tcnlvk330wclicylz25jfmdujqpagdenbkdht7w3inebv+g0jpgh4vz2jnlv5vjto5ml5z7mgkooo2npmqmsobvkiq== and using nsdata *plaindata = [plainstring datausingencoding:nsutf8stringencoding]; nsstring *base64string = [plaindata base64encodedstringwithoptions:0]; nslog(@"%@", base64string); to decode base64 sting result base64sting null. there wrong base64 sting? thank in advance. try this

How to extend TextField to access model in Ember.js -

i writing form post in ember.js. attr binding , condition support boolean value other expression. action didn't take arguments. i want error show when input focus , input valid. in simple way, should in focus-in , focus-out property. many field, have write 2 action each input. i want write reusable view that, don't know how change model's value in view. any 1 know that? erp.fromfieldview = ember.textfield.extend({ attributebindings: ['type', 'value', 'size', 'pattern', 'name', 'min', 'max', 'accept', 'autocomplete', 'autosave', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'list', 'multiple', 'pattern', 'step', 'width', 'error

Save ontology file OWL API -

i saving owl file shown in owl api example file. file file = file.createtempfile("sample", "saving"); owlontologyformat format = manager.getontologyformat(ontology); owlxmlontologyformat owlxmlformat = new owlxmlontologyformat(); if (format.isprefixowlontologyformat()) { owlxmlformat.copyprefixesfrom(format.asprefixowlontologyformat()); } manager.saveontology(ontology, owlxmlformat, iri.create(file.touri())); i tried following code. file file = new file("sample.owl"); owlontologyformat format = manager.getontologyformat(ontology); owlxmlontologyformat owlxmlformat = new owlxmlontologyformat(); if (format.isprefixowlontologyformat()) { owlxmlformat.copyprefixesfrom(format.asprefixowlontologyformat()); } manager.saveontology(ontology, owlxmlformat, iri.create(file.touri())); both methods failed save file. please help. edit: following codes creating ontology , manager manager = owlmanager.createowlontolog

send parameters of form via URL -

i have form this: <form rel="search" action="/archives"> <input name="keyword" type="text" value="search..." /> <input type="submit" value=submit" name="submit" /> </form> when user click on submit...i want sent parameters url... exact url: http://examole.com/archives/keyword or alternative way... . is possible? edit i try change above code this: <form rel="search" action="/archives" method="get"> <input name="keyword" type="text" value="search..." /> <input type="submit" value="submit" /> </form> the result: http://127.0.0.1/archives?keyword=search... how can change url this: http://127.0.0.1/archives/search... yes, can. use method="get" <form method="get" rel="search" action="/archives"

vb.net - Trying to get a data from sql database: what to enter into textbox -

i have text-box named txtitemcode , when type item-code text box want to display corresponding data grid-view or text boxes. but it's not firing code, don't know wrong, search in google , keep change codes , got 1 still not working. pasting code here.. public sub selectitem(byval itemcode string) try sql.opendbconnection() dim strsql string = "select itemcode 'item code',itemname 'item name' tblitemmaster itemcode='itemcode'" 'sqlconn.close() dim da new sqldataadapter(strsql, sql.sqlconn) dim ds new dataset da.fill(ds, "tblitemmaster") dgvpurchaseorder.datasource = ds.tables("tblitemmaster") sql.sqlconn.close() catch ex sqlexception msgbox(ex.message, msgboxstyle.critical, "sql error") catch ex exception msgbox(ex.message, msgboxstyle.critical, "gener

amazon web services - How to set EC2 tags on AWS Opsworks -

i've been using various community cookbooks set stack. i'm aware aws opsworks sets tags (stack name, layar name), need set tags myself. there doesn't appear way set them through opsworks api, i'll assume need use cookbook/recipe set them somehow. is there existing method/cookbook so, or need go , learn chef? the lwrp listed on : https://github.com/opscode-cookbooks/aws - works. add in recipe tags required specific instances. lwrp : aws_resource_tag

sql - Invalid Identifier with Joins -

i don't tend ask questions regarding errors 1 happening me on every report doing. there fundamentally wrong approach , need solution , explanation if possible. need convert multiple reports , on getting error in 1 way or another. here code. i getting invalid identifier on: inner join unit_instance_occurrences uio on uio.offering_organisation = ou.organisation_code what don't understand ou identifier has been defined. here full code: select pu.calocc_code, ou.fes_full_name, pu.uio_id, uio.fes_uins_instance_code ||' '||uio.long_description crse_desc, ebs_tutorgroupslist_sel(pu.id,pu.uio_id) grp, pu.person_code, p.forename, p.surname, upper(p.surname) ||', '||p.forename||' ('||pu.person_code||')' student, pu.progress_code, pu.progress_status, pu.progress_date, marks.absent, marks.late, marks.not_expected, marks.present, marks.notified_absence, marks.blanks, sum( marks.absent+ marks.late+ marks.no

knockout.js - Knockout js Binding to drop down list -

i learning knockout js yesterday only. seeming new me. somehow managed it. let saving country list, state list database using knock out js. have done first task saving country list. problem started in second page saving state list. here binding countries drop down list in state.aspx page, after dont understand how proceed. let me give code: <div id="state_container"> <table border="0" cellpadding="0" cellspacing="0" class="form" data-bind="with:statemodel" width="300px"> <tr> <td> <span>statename&nbsp; </span> &nbsp;<input type="text" name="statename" data-bind="value:statename" /> </td> </tr> <tr> <td> <span>short name</span> <input type="text&q

c++ - init a thread which is a member variable inside of an constructor -

i trying write resourcecach should have thread loads , unloads objects of different types. started idea of having thread member variable , list wich std::string s represent path files load / unload. there method called work() should executed thread. enaugh talk. the question is: how init thread inside of constructor? .h class resourcecach { public: resourcecach(); ~resourcecach(); void init(); bool stopthread(); void load(std::string path); void unload(std::string path); private: thread m_worker; // ptr? reference? right? vector<std::string> m_toload; vector<std::string> m_tounload; void work(); }; and cpp should (this not work) resourcecach::resourcecach() { init(); } resourcecach::~resourcecach() { } void resourcecach::init() { m_worker(resourcecach::work, "resourcecach-thread"); } void resourcecach::work(){ } bool resourcecach::stopthread(){ if (m_worker.joinable()) { m_worker.jo

android - How to stop an activity from starting while checking if a user is logged in? -

i trying achieve following when user starts app: 1- if user not logged in show login screen. 2- if user created account , there valid token show start screen. to end have implemented custom authenticator based on tutorial found here http://www.udinic.com/ . the code works, issue shows current activity ui briefly switches add account ui provided accountauthenticator. how can fixed this? this code: @override public void onstart(){ super.onstart(); gettokenforaccountcreateifneeded(accountgeneral.account_type, accountgeneral.authtoken_type_full_access); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); maccountmanager = accountmanager.get(this); } /** * auth token account. * if not exist - add , return auth token. * if 1 exist - return auth token. * if more 1 exists - show picker , return select account's auth token. * @param accounttype * @param authto

c# - How to put a MessageBox to display my Fibonacci sequence vertically -

here's finished code, need little advice , how insert desired messagebox. needs display finished sequence vertically, thanks. using system; using system.collections.generic; using system.linq; using system.text; using system.windows.forms; class program { public static double fibonacci(double n) { double = 0; double b = 1; (double = 0; < n; i++) { double sum = a; = b; b = sum + b; } return a; } static void main() { (double = 0; < 12; i++) { console.writeline(fibonacci(i)); } } } if want show messagebox, try: static void main() { list<double> nums = new list<double>(); (double = 0; < 12; i++) { nums.add(fibonacci(i)); } messagebox.show(string.join(system.environment.newline, nums)); } a console application can display messagebox if you've included right libraries, , looks include system.windows.forms , should set. although honestly

Highcharts: Not plotting correctly with Y-Axis label formatter -

when use y-axis label formatter, points don't plot correctly. point "6.8" plotting above 6.8 line. also, y-axis ticks not equal intervals (7.8, 7.5, 7.3, 7.0, 6.8, 6.5). removing label formatter clears issue. know work-around can keep label formatter? with label formatter: http://jsfiddle.net/3tkdt/1/ without label formatter: http://jsfiddle.net/3tkdt/2/ label formatter: yaxis: { labels: { formatter: function () { return highcharts.numberformat(this.value, 1); } } } using numberformat function on y-axis labels wasn't idea. rounding tick marks , representing intervals incorrectly. removed label formatter.

mysql - Select query issue with join -

Image
hello please me one, stent table bal table with stent_size 20 both table, current_status = co_qc_comeplete , status = added, 5 records, instead in select query got 50 recrods.. confused.. i want 5 records of stent table join of bal table , want 5 records bal table. can me create select query one.. thanks in advance.. edit : select * stent sd left join bal bd on sd.stent_size = bd.stent_size sd.current_status = "co_qc_complete" , sd.stent_size = "20" , bd.status = "added" select * stent sd left join bal bd on sd.stent_size = bd.stent_size sd.current_status = "co_qc_complete" , sd.stent_size = "20" , bd.status = "added" returns 50 records because takes of bal (10 records shown) , joins stent (5 records shown) stent_size = stent_size. (each bal record paired 5 stent records) there nothing unique data save ids, can trouble when joining these tables. thinking little more, , th

Android MVC Framework -

i know if know android framework conventional applications. example, framework rails can see mvc pattern. see answer here overview of android's limitations, give idea of why mvc pattern on android has not yet emerged: http://www.quora.com/is-there-any-standard-mvc-framework-in-android-application-development-if-not-is-it-worth-developing-one after having posted answer have gone ahead , built fully-featured app using single-activity architecture. allowed past major ux limitations mentioned while being able have arbitrary complexity in controller hierarchies (parents children sub-children etc.). overall worked out great, have build out specialized components (ie: custom stack mechanism) store/restore state in way plays nicely android's own activity/fragment lifecycle patterns. there limitations around fragment animations had pull our hair out @ times, required more custom component workarounds. ie: animations show both outgoing , incoming fragment on-screen @ same