Posts

Showing posts from February, 2012

java - How to use ArrayList while adding something to another Class's constructor ? -

i'm try create 1 simple reservation system, we'll read file, we'll add train, bus, etc., we'll writer output. import java.io.*; import java.util.*; public class company { private static arraylist<bus> bus = new arraylist<bus>(); static int buscount = 0, traincount = 0; public static void main (string[] args) throws ioexception { fileparser(); } public company() { } public static void fileparser() { try { file file = new file(); //i fill later file file2 = new file(); // fill later fileinputstream fis = new fileinputstream(file); fileoutputstream fos = new fileoutputstream(file2); bufferedreader br = new bufferedreader(new inputstreamreader(fis)); bufferedwriter bw = new bufferedwriter(new outputstreamwriter(fos)); string line; while ((line = br.readline()) != null) { string[] splitted = line.split(","); if(spli

bash - ssh wait for script to finish -

i using following script start process on node. main node: for dir in n9 n18 n27 n40 node=compute-2-10 ssh $node "cd $dir ; nohup ./process.sh > watchdog-$dir &" done the thing when connect compute-2-10 see no jobs running. think problem process can not completed since bash doesn't wait finish. correct or need else? i have been using like ssh $node "nohup myprogram > prog.out 2> prog.err < /dev/null &" if redirect 3 i/o should not create issue.

ios - Data passed to prepareForSegue is nil -

i'm trying ingredientviewcontroller update array belongs controller called via segue ( fridgeviewcontroller ) in ingredientviewcontroller fridgemanager nil no matter try the code: fridgeviewcontroller: - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. ingredientviewcontroller *controller = (ingredientviewcontroller *)segue.destinationviewcontroller; [controller setfridgemanager:fridgemanager]; } ingredientviewcontroller: @property (strong, nonatomic) fridgedatamanager *fridgemanager; and in viewdidload fridgemanager nil (and in other method of coarse) synthesize fridgemanager property in ingredientviewcontroller.m @synthesize fridgemanager;

Comparing Matlab and Apache statistics - kurtosis -

Image
hi comparing statistics between matlab , apache functions. here apache functions tested in java. same set of data, different results double array (double[] ) follow: --------------------------------------- matlab vs apache --------------------------------------- max = 0.5451 vs 0.5450980392156862 min = 0.4941 vs 0.49411764705882355 var = 5.4154e-05 vs 5.415357603461868e-5 std = 0.0074 vs 0.007358911334879547 mean = 0.5206 vs 0.5205525290240967 kurtosis = 3.3442 vs 0.35227427833465486 skewness = 0.2643 vs 0.26466432504210746 i checked , rechecked data, each value matlabs same used in java. here can see statistics identical, except kurtosis. is possible kurtosis computed differently matlab , apache library? if so, data should trust then? edit my data subset of image matrix (containing pixels values). each subset compute above statistics. everytime, statistics match except kurtosis. the matlab

sql server - MySQL error code 1005 Can't create table (errno150) - (again) - in all the foreign keys -

background:- yesterday creating small database practice, , created 9 tables, , got error in create table statement of 1 of them. question located here . thankfully told alternative way creating table without foreign key , use alter table statement add foreign key constraint, , worked. today creating database, , getting error in tables contain foreign keys. have tried alternative way of creating table , adding foreign keys alter table statement. doesn't seem help. my research:- i know question has been been addressed before on website, have tried solutions on this , this page, except adding indexes because firstly, don't need them in such small database ( second point in first answer ), , secondly don't know them , want keep simple. none of answers helped. moreover, mentioned here , " if error message refers error 150, table creation failed because foreign key constraint not correctly formed. " please tell me what's wrong foreign key constr

html - Hover over div breaks positioning jquery css -

jsfiddle: http://jsfiddle.net/y78a2/ i have element like <div id="hoverdiv"></div> <div style="margin:0 auto;"> <div class="hover" hovertext="this div 1">div 1</div> <div class="hover" hovertext="this div 2">div 2</div> <div class="hover" hovertext="this div 3">div 3</div> </div> css this #hoverdiv{ display:none; position:absolute; font-size:12px; background: rgba(0,0,0,.6); color: #ddd; border: 1px solid #999; padding:10px; z-index:10000; } jquery this $(document).on('mousemove','.hover',function(e){ var hovertext = $(this).attr('hovertext'); $('#hoverdiv').text(hovertext) .css('top',e.pagey-95) .css('left',e.pagex+10) .show(); }).on('mouseout','.hover',function(){ $('#hoverdiv&#

javafx - JavaFX8 tree tabel view customize separate cells -

in tree-table-view there child items have in turn other child items. need customize, say, text of cells of pseudo-root items. is there way assign css class/style items? update: ok, got working following cellfactory: treetblcolumnname.setcellfactory(new callback<treetablecolumn<filemodel, string>, treetablecell<filemodel, string>>() { @override public treetablecell<filemodel, string> call(treetablecolumn<filemodel, string> param) { treetablecell<filemodel, string> cell = new treetablecell<filemodel, string>() { @override protected void updateitem(string t, boolean bln) { super.updateitem(t, bln); //to change body of generated methods, choose tools | templates. system.out.println(this.gettablecolumn().); label lbl = new label(t); lbl.setstyle("-fx-font-weight: bold; -

does Android SpeechRecognizer can recognize only English? -

i using following code recognize text. @ first invoke dialog choose language recognition. pass argument recognizerintent. unfortunatly, "en-us" recognized on phone(i tried "fr-fr" , "ru-ru"). there have not done or how can narrow list working languages? code public void recognize(view v) { intent detailsintent = new intent( recognizerintent.action_get_language_details); sendorderedbroadcast(detailsintent, null, new languagedetailschecker( context), null, activity.result_ok, null, null); } private class languagedetailschecker extends broadcastreceiver { context contextapp; public languagedetailschecker(context context) { this.contextapp = context; } @override public void onreceive(context context, intent intent) { bundle results = getresultextras(true); arraylist<string> languages = new arr

webserver - Nginx Wild Card Domains -

i have a name domain setup on nginx, have wildcard dns setup on digital ocean. i main domain point is: /usr/share/nginx/html/mission13.io i wildcard domains point respective folders: /usr/share/nginx/html/sub1.mission13.io /usr/share/nginx/html/sub2.mission13.io /usr/share/nginx/html/sub3.mission13.io here have, not sure them point proper location. can change that? server{ listen 80; root /usr/share/nginx/html/mission13.io; index index.php index.html index.htm; server_name mission13.io www.mission13.io *.mission13.io; location / { try_files $uri $uri/ /index.html; } include /usr/share/nginx/conf/mission13.io.conf; location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } } another way please change server name _ search folder host name inside

java - What is the principle ? When Spark deal with data bigger than memory capacity? -

as know , spark use memory cache data , compute data in memory.but if data bigger memory? read source code ,but don't know class schedule job? or explain principle of how spark deal question? om-nom-nom gave answer, comment reason, thought i'd post actual answer: https://spark.apache.org/docs/latest/scala-programming-guide.html#rdd-persistence

java - Remote EJB calling: No EJB receiver available for handling -

i trying connect remote ejb using tutorial , have got no ejb receiver available handling . how connect: public static boolean createcontext() throws servletexception { system.out.println("well-well"); boolean successcreate = false; final hashtable props = new hashtable(); // setup ejb: namespace url factory props.put(context.url_pkg_prefixes, "org.jboss.ejb.client.naming"); props.put("jboss.naming.client.ejb.context", true); // create initialcontext context context = null; try { context = new javax.naming.initialcontext(props); } catch (namingexception e) { e.printstacktrace(); } issapagehome ref = null; try { ref = (issapagehome)context.lookup("ejb:" + "/ejb667//theissapage!" + issapagehome.class.getname()); } catch (namingexception e) {

How to override rate.php in magento enterprise or magento 1.8? -

i need change app\code\core\mage\tax\model\calculation\rate.php if (!is_numeric($this->getrate()) || $this->getrate() <= 0) { to if (!is_numeric($this->getrate()) || $this->getrate() < 0) { so want override file in stead of changing in core folder. please help.... first of need rewrite core magento model in config.xml file of custom module: <config> <modules> <mypackage_mymodule> <version>0.0.1</version> </mypackage_mymodule> </modules> <global> <models> <mypackage_mymodule> <class>mypackage_mymodule_model</class> </mypackage_mymodule> <tax> <rewrite> <calculation_rate>mypackage_mymodule_model_calculation_rate</calculation_rate> </rewrite> </tax> </models>

PHP cookie with same name but different paths -

i want check cookie name "subscription" , there 3 cookies name has different paths follows path 1 / path 2 /customer/checkout/ path 3 /customer/register/ now if want apply if condition if subscription set condition works path 1.how make work 3 paths??? i don't think can reliably check path of cookie in php (or serverside language matter) or @ least browsers don't send path cookie. send key-value pairs. if reliability/cross browser support isn't must, check if path of cookies send request headers. use method <?php foreach (getallheaders() $name => $value) { echo "$name: $value\n"; } ?> http://www.php.net/manual/en/function.getallheaders.php

python - Kivy Subtext in TextInput -

Image
look @ image below , see faint text. is possible add text (i dont need image) in background of textinput field in kivy? the textinput has hint_text property this.

mysql - select one column from one table and other columns from another table -

i have tables : 1. users : user_id, user_name 2. transaction : user_id, transaction_number, transaction_date i want user_id, transaction_number, transaction_date particular transaction_date. first table may contain repeated user_id different dates , may not contain user_id particular date. result must contain user_ids , transaction_number , transaction dates null if user_id has no transaction entries in transaction table. for example : user_id transaction_number transaction_date 1 10 12/04/2013 2 0 12/04/2013 3 0 12/04/2013 it shows there 3 users , user_id 1 have transaction in 12/04/2013. select * transaction right outer join users on transaction.user_id = users.user_id , transaction.transaction_date = 'apr 12 2013 12:00am'

php - Simple cURL request ignored by the server -

for days i'm trying make connection web server remote server via curl, , far failed. try contacted hosting company , said server support curl lib. use simple way testing using codes below. print_r($array); returning array without parameter inside array() when should return parameters. hope can have better understanding of issue , provide answer it, many thanks. send.php in remote server <?php $number= '12345'; $status= 'success'; $msg = 'transaction success!'; $curlhandle = curl_init(); curl_setopt($curlhandle, curlopt_url, 'http://mywebsite.org/test.php'); curl_setopt($curlhandle, curlopt_post, 1); curl_setopt($curlhandle, curlopt_header, 0); curl_setopt($curlhandle, curlopt_postfields, 'number='.$number.'&status='.$status.'&msg ='.$msg); curl_setopt($curlhandle, curlopt_returntransfer, true); curl_setopt($curlhandle, curlopt_ssl_verifypeer, false); curl_setopt($curlhandle, curlopt_ssl_verifyh

ios - Incompatible pointer types sending 'UIImageView' to parameter of type 'UIImage*' (xcode5) -

i error in code line: gpuimagepicture *stillimagesource = [[gpuimagepicture alloc] initwithimage:_imagview]; and error: incompatible pointer types sending 'uiimageview' parameter of type 'uiimage*' does know have do? issue passing argument of uiimageview instead of uiimage solution change code : gpuimagepicture *stillimagesource = [[gpuimagepicture alloc] initwithimage:_imagview.image];

java - Tie instances of a class to another, aside from making one an inner class? -

i'm writing simulation various components, dynamic. logical structure this: class simulation { int getsimulationtime() { ... } class thing1 { ... } class thing2 { ... } container <thing1> box1; container <thing2> box2; ... void addthing1(thing1 thing) { box1.add(thing); } thing1 getthing1() { return box1.getone(); } ... } there @ least 2 nice things structure: the thing1 s , thing2 s have access simulation time without having explicitly carry around simulation s. the type system ensure don't accidentally mix components of 2 different simulations: if write simulation1.addthing1(simulation2.getthing1()); compiler (correctly) reject because thing1 produced not same type thing1 demanded. the problem the actual thing1 , thing2 class definitions large me want shove simulation class, , java doesn't allow inner class definitions pulled out separate files. there alternative way accomplish these obj

ios - NSAutoresizingMaskLayoutConstraint error when UITableViewHeaderFooterView is reused -

i'm getting following error after call insertsections:withrowanimation: , endupdates . error concerns autolayout in custom uitableviewheaderfooterview when header reused dequeuereusableheaderfooterviewwithidentifier: . first time works fine no errors. unable simultaneously satisfy constraints. ... ( "<nslayoutconstraint:0x10b77f9f0 v:|-(8)-[uiview:0x10b77d0f0] (names: '|':wybdetailheaderview:0x10b77e620 )>", "<nsautoresizingmasklayoutconstraint:0x10b77cac0 h=--& v=--& v:[wybdetailheaderview:0x10b77e620(0)]>", "<nslayoutconstraint:0x10b77fa40 v:[uiview:0x10b77d0f0]-(>=4)-| (names: '|':wybdetailheaderview:0x10b77e620 )>" ) attempt recover breaking constraint <nslayoutconstraint:0x10b77fa40 v:[uiview:0x10b77d0f0]-(>=4)-| (names: '|':wybdetailheaderview:0x10b77e620 )> there similar error horizontal constraints. problem nsautoresizingmasklayoutconstraint appears both

Can't avoid triggering Paint on Chrome while working only with CSS transform properties -

i'm trying avoid paint phase on chrome while using requestanimationframe update transform property of element. i've created small demo here (works in chrome): http://jsfiddle.net/es3fm/1/ var div = document.queryselector('div'); function repaint(){ webkitrequestanimationframe(repaint); div.style.webkittransform = "scalex(" + (math.random() * 100) + ")"; }; repaint(); i don't know if behaviour can achieved, if not i'm interested in how can dynamically affect rendering of element in page without triggering paint phase using composite layers phase. i've solved it, position: absolute not create new layer, translatez(0) does, here's fixed version: http://jsfiddle.net/sandro_paganotti/es3fm/2/ var div = document.queryselector('div'); function repaint(){ webkitrequestanimationframe(repaint); div.style.webkittransform = "translatez(0) scalex(" + (math.random() * 100) + ")"; };

Need a formula that incorporates vlookup or similar -

i need formula list of unit #'s in column based upon results of 2 different columns. range approx. 200 rows. example: a b c unit # inspection date 100 pass 4/12/14 101 pass 4/20/14 102 fail 4/23/14 103 pass 4/21/14 the formula @ columns b & c , if said "pass" , date within last week, list unit # (for 200 applicable rows). result in format: 101, 103, etc. thanks help! add 2 more columns, weeknum in col d , extract in col e; add below formulas: d2 : =weeknum(c2) e2 : =iferror(index(a:a,small(if(($b$2:$b$200="pass")*(weeknum(today())-$d$2:$d$200<=1)*($d$2:$d$200>0),row($b$2:$b$200)),row()-row($b$1))),"") the formula in e2 array formula , needs confirmed ctrl+shift+enter. gives unit# of pass items fall previous week or current week. if want list falling in current week, change $d$2:$d$200<=1 $d$2:$d$200<1 .

Java get parameter values through reflection -

i have set of classes similar. i'm using reflection access , invoke choose method below. need able mylist parameter. i've tried using proxies but, i'm beginner java , don't understand how implement , use them. public int choose(list<object> mylist, object card, object color, state state) { int answer = -1; // sort through mylist , set answer index of desired object return answer; } is there better way parameter in java without using aspectj? , if so, provide example? thanks help. class state { } class myclass { public int choose(list<object> mylist, object card, object color, state state) { int answer = -1; system.out.println("mylist has " + mylist.size() + " elements"); (object o : mylist) { system.out.println("element -> " + o); } // sort through mylist , set answer index of desired object return answer; }

MPICH - enable debugging prints from `MPIU_DBG_PRINTF()` -

what right order of configuring , running mpich2 or mpich-3 enable debugging prints, embedded code mpiu_dbg_printf() . used --enable-g=dbg,mem,log configure option, , set environment variable mpich_dbg_output stdout still have no debug prints examples/cpi runs. you might need set few environment variables: mpich_dbg_level verbose mpich_dbg_class all for example: mpiexec -n 2 -env mpich_dbg_output verbose \ -env mpich_dbg_class \ -env mpich_dbg_filename "dbg-%w-%d.log" ./examples/cpi the wiki has more information other things can mpich debugging facility: https://wiki.mpich.org/mpich/index.php/debug_event_logging

Perl inheritance same instance -

i trying build small application base module 'apps' , shared instance module "shared" among modules "view" , "request" data , methods in "shared" module available other modules extends (view, request, apps) same instance, below code example. app.cgi #!/usr/bin/perl use moose; use apps; $app = apps->new; msg(); # exported, works ok $app->msg(); # method works ok $view = $app->view; $view->msg; # view class method, works ok print $app->charset . "\n"; # shared.pm, prints utf8, default $app->charset("windows-1256"); # change utf8 windows-1256 in shared.pm print $app->charset . "\n"; # ok, prints windows-1256 print $view->charset . "\n"; # not ok, same default utf8 exit; apps.pm package apps; use moose; extends qw(shared); sub init { print "true is: " . true()."\n"; } 1; view.pm package view; use moose; extends qw(shared); sub msg {

sockets - How To create the packet and send using java? -

hi getting data gps device, want send response gps device creating packet packet this. no. field type length description 1 smark char 6 flag of message (\r\n*kw\0) 2 packetle short 2 message length 3 cmd short 2 0x8200 4 cerrorcodechar 1 0x00ok, 0x01invalid deviceid 5 send char 2 message end "\r\n" i want crete packet using code. inetaddress ipaddress = receivepacket.getaddress(); string sendstring = "polo"; senddata = sendstring.getbytes(); datagrampacket sendpacket = new datagrampacket(senddata, senddata.length, ipaddress, port); serversocket.send(sendpacket); i trying this. bytearrayoutputstream bytearrypacket = new bytearrayoutputstream(); dataoutputstream dateoutputpacket = new dataoutputstream(bytearrypacket); dateoutputpacket.writechars("\r\n*kw\0"); dateoutputpacket.writeshort(15); dateoutputpacket.writes

gcc - EEPROM write and read unknown directive -

i have problem avr-gcc. have error recurring: undefined reference `__eerd_block' this referred macro eeload(s) , eesave(s) s structure of uint, structs, eccc... the define of eeload(s) , eesave(s) are: #define eeload( s ) eeprom_read_block( &s, s##_eeprom, sizeof(s) ) #define eesave( s ) eeprom_write_block( &s, (void*) s##_eeprom, sizeof(s) ) i know s##_eeprom , or how ## translated, should address, can't figure out how can modify or how make work this. ## used glue 2 tokens. eeload(foo) substituted eeprom_read_block(&foo, foo_eeprom, sizeof(foo)) . you'll find more information ## here here macro itself, foo_eeprom should valid address eeprom space. should have defined somewhere code compile.

find occurences in a double array with jquery -

i had double array in jquery : total_value_year = { {'2014', 1500}, {'2015', 1000}, {'2014', 150}, {'2015', 200}, {'2015', 50}, ... } there 2 years possible, want add value same years. @ end want have theses datas : 2014 => 1650, 2015 => 1250 try http://jsbin.com/sahasira/1/edit total_value_year = [ ['2014', 1500], ['2015', 1000], ['2014', 150], ['2015', 200], ['2015', 50] ]; var arr = {}; total_value_year.foreach( function (item, index) { arr[item[0]] = (arr[item[0]] || 0) + item[1]; } ); console.log(arr["2014"]); console.log(arr["2015"]);

c# - How to make a List of Generic Objects? -

i'm having trouble situation: i've generic class: public class informationsolv<t> { private t _valeur; public string nom { get; private set; } public datetime timestamp { get; set; } ... } i store objects of informationsolv type in collection. so store in list of objects have cast every time want information object. so thought "i should make abstract class , make informationsolv inherit it" so did: public abstract class ainformationsolv { public string nom; public datetime timestamp; } and changed informationsolv this: public class informationsolv<t>:ainformationsolv { private readonly t _valeur; ... } it's not bad, if make list of ainformationsolv objects , store informationsolv objects in it. can access nom , timestamp variables (without cast) of course can't access _valeur neither can put _valeur in ainformationsolv class, because have become generic class , problem same. is there way

c# - VNCSharp remote desktop null reference on disconnect -

i have program allows users log entire computer lab automatically using vncsharp. after code reorganization running issue cant seem solve. following method logs computer after vnc connection has been established. private void rd_connectcomplete_1(object sender, connecteventargs e) { if (action == labloginaction.login) { //give remote desktop control focus rd.focus(); //send control alt delete rd.sendspecialkeys(specialkeys.ctrlaltdel); //wait 1/2 second system.threading.thread.sleep(500); //run through secure windows user name string foreach (char c in converttounsecurestring(windowsusername)) { //type each key, wait 1ms sendkeys.sendwait(c.tostring()); system.threading.thread.sleep(1); } //send tab key press sendkeys.sendwait("{tab}");

java - Amazon EC2 stops working unexpectedly -

i facing problem burning brain. have amazon ec2 instance runs linux ami, installed tomcat7 , deploying webservice in it. webservice connects amazon rds instance have mysql (that use validate user , password). when start tomcat7 service works great, after 1 hour can't log in system. if restart tomcat7 service, works again. why? i don't know problem. can connect database directly project in eclipse, , via command line. i don't know why if restart service, webservice works again. know service hasn't stoped, because can access login page of webapp. i appreciate kind of help, rodrigo araujo. ps: last week, working fine. i've seen such behavior before, tomcat , not ec2. check following: 1- threading configuration (maxthreads , acceptcount). i've seen behavior using blocking connector when currentthreadsbusy > maxthreads. check have enough threads or use non-blocking (nio) connector. 2- check connection pool can reconnect lost connection

javascript - angularJS template url is not loading automatically -

it's loading when type char in input type="search" . page calling 'ajax call' twice. request fire twice on 'single click' or 'onpageload' index.html this html file has search box <div> <div class="input-group"> <input type="search" class="form-control search" ng-model="searchtag" tabindex="1"> <div class="input-group-btn"> <button class="btn btn-default" type="submit" ng-click="search()"></button> </div> <ng-view></ng-view> </div> this search box not attached why silly thing happening?? template url loading in ng-view index.js file: here have defined configuration of routing template url. angular.module("myapp", ['ngroute']) .config(["$routeprovider", function($routeprovider) { $routepr

hibernate subselect performance issue due to redundant load -

user(m:m)books @entity public class user{ @id public int id; @manytomany(fetch = fetchtype.lazy, targetentity = book.class) @jointable(name = "user_book", joincolumns = @joincolumn(name = "user_id"), inversejoincolumns = @joincolumn(name = "book_id")) @fetch(fetchmode.subselect) public list<book> books; } @entity public class book{ @id public int id; ... } loadallactiveusers() foreach user do(user.books) suppose have 1000 users each of them have books (we have 1000 books). when call user.books hibernate trigger query: select book.* association inner join books b on b.id = association.book_id association.user_id in (select u.id users u) this query has result of 1m rows although have 1000 books. because hibernate load user_id , not book_id. if hibernate join of association in clause result limit distinct books , not query duplicate books. select book.* books b.id in (select association.book_id u

java - SimpleDateFormat incorrectly parsing string -

string s = 19.17.38.008000; dateformat f = new simpledateformat("hh.mm.ss.ssssss"); date d = f.parse(s); system.out.println(d); this code running runs fine except when prints prints time 19:17:46. please explain me as side note: string s = 19.17.38.008000; dateformat f = new simpledateformat("hh.mm.ss"); date d = f.parse(s); system.out.println(d); this code print same string correctly minus milliseconds. please tell me missing here. edit: answers think issue here reading 38.008000 .008 seconds sdf reading sss 8000 milliseconds not same thing. ssssss still milli-seconds if put 6 of them. 19:17:38 + 008000 ms 19:17:46 correct, if surprising. afaik java.time library in java 8 supports micro-second (and nano-second) timestamps. thank @meno corrections.

Http request cycle - Apache -

how apache http request lifecycle works ? suppose if there seperate web server , app server, configurations files need have route browser request app server via web server ? please me in understanding process of lifecycle how web , app server role.

mysql - Fetch data from two different tables in one query -

on webserver there databse following 2 tables: tbl_friend tbl_colleague | id | name | first name | place | | id | name | first name | place | ---------------------------------- ---------------------------------- | 1 | xxxx | xxxxxxxxxx | 1 | | 1 | aaaa | aaaaaaaaaa | 1 | | 2 | yyyy | yyyyyyyyyy | 2 | | 2 | bbbb | bbbbbbbbbb | 3 | | 3 | zzzz | zzzzzzzzzz | 1 | | 3 | cccc | cccccccccc | 4 | now want fetch persons tbl_friend , tbl_colleague life in place 1 . have data both tables , here problem: how can fetch data 2 different tables in 1 query? result should this: | id | name | first name | place | ---------------------------------- | 1 | xxxx | xxxxxxxxxx | 1 | | 1 | aaaa | aaaaaaaaaa | 1 | | 3 | zzzz | zzzzzzzzzz | 1 | can use from tbl_friend | tbl_colleague or else? or have use join this? try this: select id, name, first name

ios - How to set state of UIButton in function -

i have loop loops through array of object type note has property fingering set button. the loop: for (int = 0; < [bb_major.scalenotes count]; i++) { valve1.highlighted = no; valve2.highlighted = no; valve3.highlighted = no; valve4.highlighted = no; [scale tutorial:valve1 :valve2 :valve3 :valve4 :bb_major.scalenotes[i]]; } the tutorial method: +(void)tutorial:(uibutton *)button1 :(uibutton *)button2 :(uibutton *)button3 :(uibutton *)button4 :(note *)note { switch ([note.fingering count]) { case 0: break; case 1: button1 = note.fingering[0]; button1.highlighted = yes; sleep(1.0); break; case 2: button1 = note.fingering[0]; button2 = note.fingering[1]; button1.highlighted = yes; button2.highlighted = yes; sleep(1.0); break; case 3: button1 = note.fingering[0]; button2 = note.fingering[1]; button3 =

string - Passing textView to other apps with text properties -

i calling onclicklistner send textview text other apps.. my code is: bshare.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { tf = typeface.createfromasset(getassets(),"fonts/custom.ttf"); textview.settypeface(tf); string strsend = textview.gettext().tostring(); intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, strsend); sendintent.settype("text/plain"); startactivity(intent.createchooser(sendintent, strsend)); } }); now share textview not preserve tf help? thank you.

ios - Example of NSTextContainer with non regular shape? -

Image
hi i'm working new textkit api ios7 , i'm trying produce uitextview irregular shape. far have in view controller: -(void) loadview { self.view = [[uiview alloc] initwithframe:cgrectmake(0,0,320,548)]; nstextstorage *textstorage = [[nstextstorage alloc] init]; nslayoutmanager *layoutmanager = [[nslayoutmanager alloc] init]; [textstorage addlayoutmanager: layoutmanager]; basetextcontainer *textcontainer = [[basetextcontainer alloc] initwithsize:cgsizemake(100, 100)]; [layoutmanager addtextcontainer: textcontainer]; basetextview *textview = [[basetextview alloc] initwithframe:cgrectmake(110,124, 100, 100) textcontainer:textcontainer]; textview.backgroundcolor = [uicolor bluecolor]; textview.editable = yes; [self.view addsubview:textview]; } then in subclassed nstextcontainer , want have mutablepath drawn shape of text container, not sure how accomplish this. have: - (bool) issimplerectangulartextcontainer { return no; }

php - Fetch multiple separated objects. -

$stmt = $db->prepare("select * friend join user on friend.uid=user.uid friend.friendid= ?"); $stmt->bind_param('s',$userid); if($stmt->execute()){ $user = $stmt->get_result(); while ($obj = $user->fetch_object()) { $friends[] = $obj; } echo json_encode($friends); } my above code produced array [{"uid":"2","firstname":"gem","lastname":"tang"},{"uid":"3","firstname":"james","lastname":"lebron"}] but wish 2 object instead. you have array of objects length 2. using javascript can traverse this. var o = [{"uid":"2","firstname":"gem","lastname":"tang"},{"uid":"3","firstname":"james","lastname":"lebron"}]; for(var = 0; < o.length; i++) { var row = o[i]; console.log(row.

c++ how to have same enum members name in different enum names without getting err:redefinition; previous definition was 'enumerator' -

i have config file include in files there have different enums inside each enum there same element names example: config.h enum gameobjecttype { ninja_player }; enum gameobjecttypelocation { none, massage_all, //this componentmadiator ninja_player }; but when try compile project calling enums proper enum name m_pninjaplayer = (ninjaplayer*)gamefactory::instance().getgameobj(gameobjecttype::ninja_player); componentmadiator::instance().register(gameobjecttypelocation::ninja_player,m_pninjaplayer); i getting compilation error: error c2365: 'ninja_player' : redefinition; previous definition 'enumerator' (..\classes\gamefactory.cpp) 2> d:\dev\cpp\2d\cocos2d-x-3.0\cocos2d-x-3.0\projects\lettersfun\classes\config.h(22) : see declaration of 'ninja_player' how can keep in config.h several enums different names same elements names ? the problem old-style enumerations unscoped. can avoid problem (provided comp

c# - how to save chat transcripts in sql server database and retrieve it on another page with formatting? -

i working on chat application in used multiline textbox show messages. first of want give different colors in chat. our user message should in different color , user message should in different color. second thing want want save transcripts of chat conversation formatting user can see anytime. don't know how save transcript database formatting. stucked here. using c# , sql server database. how can that? if break down problem, make easier solve it. instead of taking text textbox. have thought maybe storing xml? if use xml, can use xslt generate nice looking html (but depends on how want use later) you have different options how store in database plain text xml blob please research , ask specific questions if stuck.

google maps - This IP, site or mobile application is not authorized to use this API key with IP authorized -

i'm using google places api requires give list of ips allowed use service. api works great on local machine give this ip, site or mobile application not authorized use api key when use production server. i've added required ips. other ideas might issue or how debug it? i had same issue , found this. on url, requires server key in end , not api key app. so basically, add server key in end of url this: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=serverkey now, obtain server key, follow these steps: 1) go developer console https://code.google.com/apis/console/ 2) in credentials, under public api access , create new key 3) select server key option. 4) enter ip address on field , if have more ip addresses, can add on every single line. note: enter ip address when want use testing purpose. else leave ip address section blank. 5) once done, click

jfreechart - Java Shape Utilities -

Image
how set such kind of points - small circles? know should set render , shapeutilies: render.setseriesshape(numberofserie, shapeutilities.[something here]); what should write circles? documentation here. the shapeutilities class has methods create shapes aren't provided default in java2d. circles though, can use: ellipse2d circle = new ellipse2d.double(-3.0, -3.0, 6.0, 6.0); the circle here centered on (0, 0) - jfreechart relies on because translate position of shape (x, y) when drawing chart.

fpga - VHDL beginner - what's going wrong wrt to timing in this circuit? -

i'm new vhdl , hardware design , wondering if tell me if understanding of following problem ran right. i've been working on simple bcd-to-7 segment display driver nexys4 board - vhdl code (with headers stripped). entity bcdto7segdriver port ( clk : in std_logic; val : in std_logic_vector (31 downto 0); anode : out std_logic_vector (7 downto 0); segment : out std_logic_vector (6 downto 0)); function bcd_to_dec7(bcd : std_logic_vector(3 downto 0)) return std_logic_vector begin case bcd when "0000" => return "1000000"; when "0001" => return "1111001"; when "0010" => return "0100100"; when "0011" => return "0110000"; when others => return "1111111"; end case; end bcd_to_dec7; end bcdto7segdriver; architecture behavioral of bcdto7segdriver sign

php - filter Query data with var from html value input -

if have input on html code <input value="0001" name="call" id="call"> how call value in php script without submit? event onblur or ?? the php file have query : select * table field = (input html value) you need use ajax that. <script> $(document).ready(function() { var value = $("#call").val(); $.ajax({ url: "you file path php code written fetch value database", type:"post", data:{"call":value}, success:function(result){alert(result);} }) }); </script> and on php file. <?php write code sql connection ; $feild_value = $_post["call"]; // can use $feild_value variable in query; select * table field = $feild_value ; //echo query result here echo $query_result; die; ?>

android - WebView shouldOverrideUrlLoading() not called for invalid links -

there 2 types of links in html file: (1) normal link http://www.bbb.com/q?type=normal (2) short link /q?type=short. for first kind, load url. second kind, should prepend fixed address http://www.abc.com before loading url. i trying overriding shouldoverrideurlloading() function in webviewclient. function doesn't gets called second type of link. tried prepending " http://www.abc.com " second type of links in html file. function called when click second kind of link. i think what's happening webview first check if link valid url. if valid function gets called. right? how can solve this? in advance. contentwebview = new webview(context); webviewclient = new webviewclient() { @override public void onpagestarted(webview view, string url, bitmap favicon) { super.onpagestarted(view, url, favicon); } @override public boolean shouldoverrideurlloading(webview view, strin

java - how to remove duplicate objects with same id's in a set -

hashset contains objects,i want remove duplicates objects having same id's the following code.. set<employee> empset=new hashset<employee>(); empset.add(new employee(1,"naresh")); empset.add(new employee(2,"raj")); empset.add(new employee(1,"nesh")); empset.add(new employee(2,"rajes")); //i saw in blog can use hashcode equals method, don't how use in context, please me out import groovy.transform.equalsandhashcode @equalsandhashcode(includes='id') class employee { int id string name } you can remove constructors if @canonical ast used. canonical provides @equalsandhashcode , add includes has used separately again. update if class not modifiable , have list/hasset can use unique closure perform uniqueness. assuming solrdocument mentioned in comment referred employee , have above hashset duplicate ids , below should work: empset.unique { it.id } //this mutates original list emps

javascript - Closure or prototype model for charting library -

for developing javascript charting library, model best prototype or closure?? while developing chart library includes more intraction , animation, encapsulation necessary? like here, function main(){ var w = 100; function chart(){ //main chart rendering } chart.width = function(){} chart.regenerate = function(){} chart.sort = function(){} chart.updatelegend = function(){} chart.startanimation = function(){} return chart; } is valid case use javascript closure this? i know nothing domain, here's example of do: //define 'charts' module var charts = (function () { //chart constructor function chart() { } chart.prototype = { constructor: chart, //public chart api width: function () { /*...*/ } }; //public module members return { chart: chart }; })(); //using var chart = new charts.chart(); if need priviledged members, can rely on closures, not recommend because it's less m

javascript - Prevent Phonegap notification.navigator popups from closing from touch outside of dialog -

i using phonegap build android application , running problems using functionality not documented phonegap. navigator.notification.activitystart('title', 'message'); the above works fine, , using activitystop() opens , closes loading dialog when need to. problem if user touches screen or hits button loading dialog closes. want remain open until done loading document server in background. i running same problem navigator.notification.alert , other functions of navigator.notification . also, prefer not modify native code. know edit phonegap plugin native code achieve this, application cross-platform prefer not native code if possible. i found solution integrated in application , worked. in java file of notification alert following change : => go alert () => dlg.setcancelable(false); good luck

python - Can't connect to Meteor with Pymongo -

i trying connect meteor mongo database through pymongo. here's code: def get_mongo_url(site): # return "mongodb://client-xxxxx:yyyyy@production-db-c1.meteor.io:27017/site" import subprocess p = subprocess.popen(['meteor', 'mongo', '--url', site], stdout=subprocess.pipe, stderr=subprocess.pipe) out, err = p.communicate() print out return out pymongo import mongoclient client = mongoclient(get_mongo_url("mysite.com")) and error (the print statement yields correct url) >> mongodb://client-xxxxx:yyyyy@production-db-c1.meteor.io:27017/site traceback (most recent call last): file "private/test.py", line 46, in <module> client = pymongo.mongoclient(get_mongo_url(meteor_site)) file "/library/python/2.7/site-packages/pymongo/mongo_client.py", line 369, in __init__ raise configurationerror(str(exc)) pymongo.errors.configurationerror: command son([('authenticate', 1), ('u

gnu make - Execution flow of Makefile which includes other makefile -

1) how makefile execution flow works, in case suppose makefile-1 includes makefile-2 , makefile-2 includes makefile-3 ? 2) in case if included makefiles contains rules , variables supposed used 3 - how works ? happens if 1 includes same makefile more once ? 3) use of export variables of included makefile ? - available in of there makefile, what understanding, makefile interpreter(or don't know term suits better here) reads line in makefile, , if there include directive makes variable/rules available in makefile(top level make-which includes other). 4) happens if 2 included makefiles overrides variables or rule of each others ? last included makefile takes priority ? 5) if rule in included makefile calls rule of top level makefile, executes top level makefile entirely (starting first line) ? 6) there 2 kind of assignments in make: i) expanded @ time of use (=) ii) expanded @ time of declaration (:=) how kind of variables handles in multilevel makefiles ? 7)