Posts

php - SQL Left join Many to Many, only display distinct ID in left table -

tablea id name 1 peter 2 mary 3 john tableb id event 1 eventa 2 eventb 3 eventc tablec id aid bid 1 1 1 2 1 3 3 2 1 i doing this select distinct a.id, b.id tablea left join tablec c on a.id = c.aid left join tableb b on c.bid = b.id it shows 1 peter eventa 1 peter eventc i want output follows 1 peter eventa eventc how that? many thanks. amendment: actually displaying records below: 1 peter eventa eventc from suggestion works fine, wanna add hide show function. function reversedisplay(d) { if(document.getelementbyid(d).style.display == "none") { document.getelementbyid(d).style.display = "block"; } else { document.getelementbyid(d).style.display = "none"; } } select distinct a.id, b.id, b.event from tablea a left join tablec c on a.id = c.aid left join tableb b on c.bid = b.id $lastid = ""; while($row = mysql_fetch_array($rs)) { if ($lastid != $row[0]){ ...

angularjs - Ionic app not working on mobile device -

i have created ionic application, accessing data different domain. in order make work, have done following @ server side(express): app.use(function(req, res, next) { res.header("access-control-allow-origin", "http://localhost:8100"); res.header("access-control-allow-methods", "get,put,post,delete,options"); res.setheader('access-control-allow-headers', 'x-requested-with,content-type, authorization, access-control-allow-origin, access-control-allow-headers'); res.header("access-control-allow-credentials", "true"); next(); }); as seen, have set origin localhost:8100, making application work , run on browser. however, when create .apk file , install on mobile device, not working i.e. data not coming. could please me out issue. issue arising because of origin specified ? if yes, there solution same. do have cordova whitelist plugin. if yes , check access origin settings in config.xml , meta tag ...

php - Javascript onBlur - Magento Billing Email -

on magento onepage checkout want place onblur event on billing:email input, here code: <div class="field col-md-6"> <div class="input-box"> <input type="text" onblur="showme()" name="billing[email]" id="billing:email" value="<?php echo $this->escapehtml($this->getaddress()->getemail()) ?>" title="<?php echo $this->__('email address') ?>" class="form-control input-text validate-email required-entry" /> </div> <script language="javascript" type="text/javascript"> function showme() { alert('hello'); } </script> </div> i expecting showme() function fire nothing happens, have done wrong?

node.js - Have to run sudo npm install -g everytime -

i getting started on command line application node, have noticed every time make change index.js file have run "sudo npm install -g" relfect change. example index.js #!/usr/bin/env node console.log("hello"); under package.json "bin": { "movie": "index.js" }, if run "movie" terminal prints out "hello". now if change print statement under index.js console.log("world") , run "movie" terminal prints outs "hello" rather "world". if "sudo npm install -g" , run "movie" command, picks "world". i not sure why happening? use npm link instead of npm install . create symlink on directory can use testing if intalled locally on directory.

java - Read an xml file from a servlet -

i can't load correctly file xml servlet: that's code: try{ documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); document doc = db.parse("db.xml"); } catch (exception ex) { ex.printstacktrace(); out.print("file not found!"); } the db.xml inside classes folder class , java file... if have xml file in root folder of war file, can read using real path context application folder. string contextpath = request.getsession().getservletcontext().getrealpath("/"); in way, can use context class loader in multi-module environment : classloader classloader = thread.currentthread().getcontextclassloader() document doc = db.parse(classloader.getresourceasstream(contextpath+ "/db.xml")); in environments, additional slash not necessary.

python - Pandas sum column with scalar results in zeros -

i summing column of pandas dataframe scalar , result column full of zeros. weird thing return zeros , won't. if tell me wouldn't believe it, that's why made video showing result: https://dl.dropboxusercontent.com/u/15853805/pandas%20bug.mp4 can explain me black magic? loosing trust on pandas , need work. ok code can similar error: import pandas pd import numpy np pdb import set_trace pdb _ in xrange(100): data = np.random.randint(1,100000,1000000) df = pd.dataframe(data,columns=['column']) scalar = np.random.randint(1,100000) df.column += scalar if df.column.max()==0: pdb() my data variable gets full zeros. memory issues? if data smaller doesn't happen, need process big data in safe way! >> print pandas.__version__ 0.17.1 >> print numpy.__version__ 1.10.1 python 2.7.11 |anaconda 2.4.1 (64-bit) the problem version of numexpr=2.4.4 updating numexpr=2.4.6 fixes problem. github issue: https://git...

android - Which Facebook application security Settings shall I disable / enable -

i'm using facebook sdk in android application, count on fb sdk user logged application , grant application needed permissions, , know fb sdk offers user login dialog whether android facebook application installed or not. my question is, options should enable / disable based on info provided above application secured as possible? p.s: have no experience on web programming or dealing sending / receiving data servers, , no experience in creating oauth flows, these options confusing me. p.s -2: set these options in picture based on facebook security tool check recommendation secure app, , based on reading login security facebook login security options (click here see options picture) and confused me more , though disabled ( client oauth settings ), facebook security check tool informs me: **state parameter used on embedded browser oauth login:** *it looks you're using embedded browser oauth login flow. use state parameter guard against cross-site request forgery. se...