Posts

Featured post

mysql - stored procedure to display monday or weekday -

i want write stored procedure find out joining date of teachers , if monday should display monday else should display “weekday” the tbl_teacher table ; vchr_teacher_name dat_teacher_doj teena 1982-01-10 lawrence 1979-09-01 mathew 1981-10-13 job 1980-11-12 and need create stored procedure " call check_date(1982-01-10)" results as: day ---------- weekday ---------- i tried : delimiter // create procedure check_date (in dat date,out day varchar(10)) begin select dayname( dat ) day tbl_teachers; end// delimiter ; it's show error as #1172 - result consisted of more 1 row how , find day monday or weekday. i think better served function : drop function if exists `check_date` // create function `check_date` (dat date) returns varchar(10) begin return if(dayname(dat) = 'monday' , 'monday', 'weekday'

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -

here content of build.gradle file: // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { maven { credentials { username artifactoryusername password artifactorypassword } url 'http://test:8081/artifactory/libs-release-local' } mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } allprojects { repositories { maven { credentials { username artifactoryusername password artifactorypassword } url 'http://test:8081/artifactory/libs-release-local' } mavencentral() maven { url 'http://repo1.maven.org/maven2' } jcenter() } } here content of app\build.gradle : apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" lintoptions { abortonerror false

java - Updating to mongo 3.0 -

i working on mongo 2.x , have updated mongo 3.x updated java mongodb client 3.0.3, have js on mongo server needs executed , js requires 2 object parameters done in previous version this: db database = mongoclient.getdb(db); commandresult cr = database.doeval(js, query, collection); // js string, query basicdbobject , collection list<string> need in running same in place of db getting mongodatabase (as getdb has been deprecated) , doeval replaced runcommand you can in code of original doeval method figure out how this, looks like: public commandresult doeval(final string code, final object... args) { dbobject commanddocument = new basicdbobject("$eval", code).append("args", arrays.aslist(args)); return executecommand(wrap(commanddocument)); } that means you'll need like: document commanddocument = new document("$eval", code).append("args", arrays.aslist(args)); return runcommand(commanddocument); note r

Array size in Perl -

i trying run code , getting output as: #!/usr/bin/perl @array = (1,2,3); $array[50] = 4; $size = @array; $max_index = $#array; print "size: $size\n"; print "max index: $max_index\n"; output: size: 51 max index: 50 what explanation this? in perl, array data structure representing list . list has elements . keys list called indexes . first index 0 ( 0 ). you have started array these indexes , valus: index value 0 1 1 2 2 3 if set 50th index value, other indexes in between filled undef , undefined value. you have correctly identified $#array max index, or highest or last index . if force array scalar context , give number of elements, or size . you've got well. , will, Сухой27 said in comment , last index minus one. you can illustrate behaviour if dump out array . use strict; use warnings; use data::printer; @array = (1,2,3); $array[10] = 4; p @array; it output following. again can see index starts @ 0 , , each

apache - setting document root in antoher partition on ubuntu -

i place apache document root inside partition of ubuntu hard drive, keep getting forbidden message, when place home directory woking find, how be? group or owner affected ? here mysite.conf , apache2.conf when place document root in home folder (working) #site-available/mysite.conf documentroot /home/jono/www #/etc/apache2/apache2.conf <directory /home/jono/www/> options indexes followsymlinks allowoverride none require granted </directory> bu when change document root partition keep getting forbidden messasge #site-available/mysite.conf documentroot /media/jono/website_data/www #/etc/apache2/apache2.conf <directory /media/jono/website_data/www/> options indexes followsymlinks allowoverride none require granted </directory> is owner/group access affected ? or there problem ? at last it's working, have grant access www:data accesing whole directory @mark-b, using chown -r www-data:www-data whole directory is

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

i trying add nodes dagre graph through cityscape.js. problem nodes not painted. code have: cy.add({ group: "nodes", data: { id:"n0",name:"n0",weight: 75 }, }); $.ajax(url).done(function(jsontree){ var newnodes=[]; for(var i=1;i<6;i++){ //var child = jsontree.result[i]; newnodes.push( { group: "nodes", data: { id: "n"+i, name:"n"+i}}, { group: "edges", data: { id: "e"+i, source: "n0", target: "n"+i } } ); } cy.add(newnodes); any ideas? have used loaded function reload graph not work. not know if have use specific function reload graph. thank in advance. you need add positions new nodes. cytoscape.js docs : it important note positions of newly added nodes must defined when calling cy.add(). nodes can not placed in graph without valid position — otherwise not displayed. yo