Posts

Showing posts from January, 2011

playframework 2.0 - Using external URL in Play framework script tag -

how can refer external urls script tag in view? have view html file in play framework project , want refer external urls javascript part. here have! <div id=”twitter_update_list”> <script type=”text/javascript” src=”http://twitter.com/javascripts/blogger.js”></script> <script type=”text/javascript” src=”http://twitter.com/statuses/user_timeline/xxxxxx.json?callback=twittercallback2&count=1″></script> </div> this fails when rendered in browser. how refer external sites? there no such thing play framework script tag, that's straight html script tag. anyway, if have copied code is, problem double quotes, unicode right double quotes, ”, see how slanted right? that's not valid html. replace them ascii double quotes: ". emphasise difference, here side side: ” " if that's not problem, describe mean "fails". there error messages displayed? shown in developer console? can see ...

html - Specify dimensions for canvas element in jQuery -

see below code. how specify width , height within these lines? specifying width , height using css not work. wrapper.append( $('<canvas />', { class: 'canvasclass', id: 'celement' }) ); since canvas accepts width , height attribute try use, wrapper.append( $('<canvas />', { class: 'canvasclass', id: 'celement' ,width:200, height:200 }) );

c++ - Why are there two extra calls to destructor as I have created only two objects and using overloaded assignment operator and increment operator -

#include <iostream> using namespace std; class loc{ int ival; public: loc(int i){ cout<<"inside parameter constructor"<<endl; ival = i; } loc(){ ival = 0; cout<<"inside default constructor"<<endl; } loc operator+(loc ob1){ loc temp; temp.ival = ival + ob1.ival; return temp; } void show(){ cout<<ival; } loc operator++(){ cout<<"inside pre increment"<<endl; ++ival; return *this; } loc operator++(int x){ cout<<"inside post increment"<<endl; ival++; return *this; } loc operator=(loc &ob){ cout<<"inside assignment"<<endl; ival = ob.ival; return *this; } ~loc(){ cout<<this->ival<<endl; cout<<"inside loc destructor...

javascript - Replace a button with another on hover not working jQuery -

i have 2 buttons, , want display 1 button displayed @ time on hover, button replaced , first button on mouseout. i came out following piece of code on hover keeps going , forth between 2 buttons, best way ? $(document).ready(function() { $('.price').on('mouseover',function() { $(this).css('display','none'); $(this).next('.buy').css('display','block'); }); $('.price').on('mouseout',function() { $(this).css('display','block'); $(this).next('.buy').css('display','none'); }); }); <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script...

ruby - How does Twitter Format their Weekly Summary Email and how to format those tweets in email in rails? -

Image
i having twitter application,according application, wanted send tweets user's email address daily using website. problem tweets not formatted in proper twitter format. wanted send them tweets in mail same mail twitter @ end of week(here's what's trending on twitter week.) embedding tweet not working, since javascript not working. see attached image

ebay - FindItemsByKeywordsRequest on Sandbox returns no search items; Finding API -

hi new ebay programming. part of unit testing, running search request on sand box using finditemsbykeywordsrequest. request not return items provides link itemsearchurl. when paste url in browser many items. using same code , same search term able list of items live ebay sites. has came across same issue before?

javascript - Angular js - order by not working on multidimensional array -

i not able sort multi dimensional array using angular js filter, please find code in link below. http://plnkr.co/edit/dpzl1rafhjjog5odf1qc?p=preview <body ng-controller="mycontroller"> <ul> <li ng-repeat="item in items|orderby:items.node_id:1">{{item.node_id}} - {{item.basic.readable_date}}-{{item.node_id}} </li> </ul> </body> orderby works arrays . since you're using object in ng-repeat - i'm quite surprised possible - orderby doesn't anything. have @ this plnkr .

cordova - How can I delay splash screen hide on using PhoneGap? -

Image
i have phonegap app targeting ipad. works on ios 7. updated ipad mini ios 8 , splash screen hides 1-2 seconds of white screen before page loads. i'm guessing there many resources getting loaded before screen render. there way make splash screen visible longer? looked possible in older versions of phonegap i'm not finding recent versions tried in index.html did not create visible difference <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> // wait device api libraries load // function onload() { document.addeventlistener("deviceready", ondeviceready, false); } // device apis available // function ondeviceready() { // safe use device apis settimeout(function() { navigator.splashscreen.hide(); }, 2000); } </script> so opened saf...

c# - How can I use wildcards in a switch statement? -

i have switch statement uses string of 3 letters. many cases (but not all) want concern myself first 2 letters. example, want every code begins "ff" handled same: switch(code) { case "ff(?)": // handle break; default: break; } what can here? can utilize wildcard? have consider every ff code? for obvious reasons, don't want have code this, can grow large: case "ffa": case "ffb": case "ffd": // handle do first 2 chars @ switch , not @ case . use default case fall 3 letter cases. it's not cleanest, work. if statements way go if switches don't cut it. switch(code.substring(0, 2)) { case "ff": ... default: switch(code) { case "abc": .... } }

jquery - Validating Dimension text input javascript -

how validate asp textbox javascript. want validate users input 4-1/2 or 80-1/2 or 6/8 or 5. there types of patterns there allowed , contains 1 number. want show alert when input doesn't match. beginner javascript. my code tried. function valid_dimentions(fieldobj) { // regular expression var rgexp = new regexp(""/^[0-9/-]{1,4}$/""); var input = fieldobj.value; if (input.match(rgexp)) alert("the width field format incorrect!"); } i used money , works , used build non working code. function valid_number(fieldobj) { if (fieldobj.value != '' && isnan(fieldobj.value)) { alert('you must enter valid price 0.00 , no $'); fieldobj.select(); fieldobj.focus(); return false; } return true; } ... <asp:textbox id="twidth" type="text" runat="server" placeholder="4-1/2" onchange="valid_dimentions_width(this);" list=...

ios - Swift lastobject equivalent -

what swifts equivalent to [[view.subviews] lastobject] ive tried view.subviews.lastobject but not function exists in swift it exist, think has been renamed (they've done lot of things in swift); try: view.subviews.last

css - Sublime 2 autocomplete html with multiple classes -

i don't know how create html tag multiple classes. each time do, strange result. if want anchor classes "foo" , "bar", , write a.foo.bar it turns into: a.<foo class="bar"></foo> what proper way this? as mentioned mblanc in comments, emmet want. install package control if haven't already open command palette ( ctrl shift p in windows , linux, ⌘ shift p in os x) type pci bring package control: install package , hit enter type emmet , hit enter , wait install, restart sublime. now, in html document, type: a.foo.bar hit tab , , automatically expands to <a href="|" class="foo bar"></a> where | cursor position. type in href , hit tab again, , cursor moves here: <a href="foobar.html" class="foo bar">|</a> so can enter link's text. make sure read through documentation on emmet.io , extremely powerful plugin, , once used co...

c++ - Using unicode character in character literal -

as know '═' give multi-char constant warning. alternative either use 0x2550 or "\u2550" . however, latter requires printing function support \u escape sequence. don't want use hexadecimal everywhere. there language construct can use allow me write '=' when mean uint32_t c = 0x2550 , i.e., '='u . ” know '═' give multi-char constant warning. no. ” alternative either use 0x2550 or "\u2550". no. ” however, latter requires printing function support \u escape sequence. no. ” don't want use hexadecimal everywhere. there language construct can use allow me write '═' when mean uint32_t c = 0x2550, i.e., '═'u. yes. uint32_t c = l'═'; with source encoding supports character. for characters not in basic multilingual plane of unicode gets more involved though, because wchar_t in windows 16 bits, in original unicode.

How to disable Varnish Cache from within a PHP script? -

i distribute php script , lot of people having trouble varnish cache on shared hosting accounts. this code @ top of php script. still "varnish: hit" in response headers (and script doesn't work correctly). header('pragma: no-cache'); header('cache-control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate'); header('expires: tue, 04 sep 2012 05:32:29 gmt'); one hosting provider said impossible disable varnish within php script, setting cache headers above. seems .. .. silly? seems match experience. so there way disable/skip varnish within php? or varnish (by default) ignore these cache headers set php? thanks jens-andré koch - i'll include varnish instructions along php script make ignore no-cache responses: sub vcl_fetch { if (beresp.http.cache-control ~ "(no-cache|private)" || beresp.http.pragma ~ "no-cache") { set beresp.ttl = 0s; } } ...

javascript - Using string.prototype with click -

i'm trying create extension method named .switch() this: string.prototype.switch = function (p) { console.log(this); // should log $obj }; var $obj = $("div"); $("a", $obj).click(function (e) { $obj.switch(0); }); html <div> <a href="#">link</a> </div> and i'm getting error: uncaught typeerror: undefined not function can show me how done? $obj jquery object, not string. if want add functions it, should in way: jquery.fn.switch = function (p) { console.log(this); // should log $obj };

verilog - How do I fix "Error-[ICPSD] Invalid combination of drivers"? -

i trying debug code shown below. new systemverilog , can learn this. let me know of suggestions. **the errors receiving are: error-[icpsd] invalid combination of drivers variable "q" driven invalid combination of structural , procedural drivers. variables driven structural driver cannot have other drivers. "divide.v", 13: logic [7:0] q; "divide.v", 16: divide8bit testcase1(x, y, clk, q, r); "divide.v", 23: q = 8'b0; error-[icpsd] invalid combination of drivers variable "r" driven invalid combination of structural , procedural drivers. variables driven structural driver cannot have other drivers. "divide.v", 13: logic [7:0] r; "divide.v", 16: divide8bit testcase1(x, y, clk, q, r); "divide.v", 24: r = y; **my systemverilog code is: module divide8bit( input logic [7:0] x,y, input logic clk, output logic [7:0] q,r); always_ff @(posedge clk) begin ...

css - How to position jQuery slideshow inside png -

i trying put simple jquery slideshow inside of png mockup of phone simple website our app. using bootstrap , have jumbotron split 2 columns. left side have mockup phone fading screenshots , right side have logo , description. using this slideshow. here js fiddle. here have html <body> <div class="container"> <div class="jumbotron text-center"> <div class="row"> <!-- slideshow left --> <div class="col-md-6"> <div class="fadein"> <img src="img/screenshot1.jpg"> <img src="img/screenshot2.jpg"> <img src="img/screenshot3.jpg"> </div> <div class="phone"> <img src="img/phone.png"> </div> </div> <!-- description right --> <div class="col-md-6"> <h1>√oo...

All Emmet Keyboard Shortcuts In PHPStorm, And Detecting Conflicting Ones -

i've been using brackets while, i've decided move phpstorm. loved emmet menu in brackets selection, navigation, wrapping , incrementing numbers options. kinda lost in phpstorm. don't know if there menu emmet in there!!? or maybe there conflicting keys can't work properly. me please.

java - Duplicates in arraylist not to be printed -

i have arraylist bankcustomers. customers occur more once (this happens if have more 1 account). now want print customers, if occur more once want print them once. heres non working code. prints whole list. how can add code print duplicates once? public void showcustomers() { private arraylist<customer> customers = new arraylist<customer>(); for(customer c: customers) { system.out.println("first name: " + c.getfirstname()); system.out.println("last name: " + c.getlastname()); system.out.println("customer number: " + c.getnumber()); for(account : c.getaccounts()) { system.out.println("account number: " + a.getaccountid()); } } } i prefer not use hashset (if it's not neccesary). i'm trying learn arraylists now. add elements set : for (custo...

swift - Let type in a for in loop -

i'm playing around swift. why possible declare let type in loop? far know, let means constant, i'm confused. func returnpossibletips() -> [int : double] { let possibletipsinferred = [0.15, 0.18, 0.20] //let possibletipsexplicit:[double] = [0.15, 0.18, 0.20] var retval = dictionary<int, double>() possibletip in possibletipsinferred { let inpct = int(possibletip * 100) retval[inpct] = calctipwithtippct(possibletip) } return retval } the lifespan of inpct constant during loop iteration since block scoped: for in 1...5 { let x = 5 } println(x) // compile error - use of unresolved identifier x in every iteration inpct refers new variable. can not assign of inpct s in iteration since declared let : for in 1...5 { let x = 5 x = 6 // compile error }

javascript - How to draw edge label on Sigma.js Graph -

i creating graph using sigma.js library. getting drawn , unable draw edge label on graphs. followed , tried use github library mentioned in following thread : show edge label in sigma.js but not elaborate , couldn't through problem. i use following sample data in json. { "edges": [{"source":"19", "target":"3", "id":"abc"}], "nodes":[ {"label":"a1", "x":-158, "y":-171, "id":"19", "color":"rgb(49,230,186)", "size":15}, {"label":"b1", "x":112, "y":-98, "id":"3", "color":"rgb(138,136,89)", "size":19}] }; how can edge label using sigma.js. provided default feature? if not , steps can take same. if needed, suggestion on alternative js library graphs welcome. you can use plugin https://github.com/jacomyal/s...

python - pip geoip installing in ubuntu gcc error -

i try install geoip in ubuntu in python pip...but there same gcc error pip install geoip gcc -pthread -fno-strict-aliasing -dndebug -g -fwrapv -o2 -wall -wstrict-prototypes - fpic -i/usr/include/python2.7 -c py_geoip.c -o build/temp.linux-i686-2.7/py_geoip.o -fno- strict-aliasing py_geoip.c:23:19: fatal error: geoip.h: no such file or directory compilation terminated. error: command 'gcc' failed exit status 1 how solve problem in ubuntu you need install libgeoip-dev package. $ easy_install geoip searching geoip reading https://pypi.python.org/simple/geoip/ ... py_geoip.c:23:19: fatal error: geoip.h: no such file or directory #include "geoip.h" ^ compilation terminated. error: setup script exited error: command 'x86_64-linux-gnu-gcc' failed exit status 1 returned 1. $ apt-cache search geoip ... libgeoip-dev - development files geoip library ... andrew@refbuntu:~$ sudo apt-get install libgeoip-dev -y [sudo] passwor...

Swift- audio implementation crash: "EXC_BAD_INSTRUCTION" -

i trying put audio app , put in following code , placed mp3 audio file in assets folder, , crashed with: "exc_bad_instruction(code=exc_1386_invop, subcode=0x0)" i use on i'm doing wrong/ need put audio file. code: import uikit import avfoundation class viewcontroller: uiviewcontroller { var audioplayer = avaudioplayer() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. scrollview.scrollenabled = true scrollview.contentsize = cgsize(width:473, height: 112) changer = 0 tapview.hidden = true yoohooview.hidden = true var alertsound = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("untitled", oftype: "mp3")!) //crashes here println(alertsound) // removed deprecated use of avaudiosessiondelegate protocol avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryplayback, error: nil) avaudiose...

Cassandra secondary index issue - returning zero rows -

i have problem in secondary index returning 0 rows in cassandra: i'm following along getting started docs: http://www.datastax.com/documentation/getting_started/doc/getting_started/gettingstartedcql.html based on have following cassandra script /* hello.cql */ drop keyspace test; create keyspace test replication = { 'class' : 'simplestrategy', 'replication_factor' : 1 }; use test; create table users ( user_id int primary key, fname text, lname text); describe tables; insert users (user_id, fname, lname) values (1745, 'john', 'smith'); insert users (user_id, fname, lname) values (1744, 'john', 'doe'); insert users (user_id, fname, lname) values (1746, 'john', 'smith'); select * users; create index on users (lname); /* these queries both return 0 rows ??? */ select * users lname = 'smith'; select * users lname = 'doe'; however... cqlsh < hello.cql users ...

bitmap - Android Take screen shot of view continuously so video can be created -

i using below code take screen shot of view continuously have images in it. able take 12-13 images(bitmap) per second creating video 12-13 images not result in quality. want know how can take 24-25 images(bitmap) per second. can 1 tell me other android related library 24-25 images(bitmaps) can taken in 1 second. below code running 125 times can 24-25 images per second getting 12-13 images. trying 5 seconds check < 126: private void putcapturedbitmaptoqueue() { llcapturearea.setdrawingcacheenabled(true); llcapturearea.builddrawingcache(); bitmap objbitmap = bitmap.createbitmap(llcapturearea.getdrawingcache()); llcapturearea.setdrawingcacheenabled(false); quebitmap.add(new savebitmap(integer.tostring(icountindex), objbitmap.copy(config.rgb_565, false))); objbitmap.recycle(); icountindex++; if(icountindex < 126) { objbitmap = null; putcapturedbitmaptoqueue(); ...

activerecord - Rails: Dynamic Select with Active Record -

i need create dynamic sql select statement city, state combination table called metros least distance set of passed in gps coordinates. note set of passed in gps coordinates variables pull list. in order calculate distance need able pass in latitude , longitude, , using the haversine formula, calculate distance between present row , 291 cities in table metros , select minimum city,state. in rails issue running how create select statement metros table allow passing in variable gps coordinates using active record instead of conventional sql. at present, how far have gotten: metros.select( "major_city , major_state ," haversine(row[latitude], row[longitude], lat2, long2)" 'distance'") .group("major_city,major_state").limit(1).order('distance') row[latitude], row[longitude] passed in variable latitude , longitude (the present row comparing 291 cities/states gps coordinates in metros table ,...

xml - XSLT map different child of a parent node -

i have started using xslt. trying report of xml set one of xml looks below 1 , named (company_a.xml) <company title="abc" > <section> <in-proc uid="hr.xml"> <details> <empname>abcd1</empname> <id>xyz1</id> <empname>abcd2</empname> <id>xyz2</id> <empname>abcd3</empname> <id>xyz3</id> </details> </in-proc> <out-proc uid="manufacturing.xml"> <title>any</title> <details> <empname>abcd4</empname> <id>xyz4</id> </details> </out-proc> </section> </company> xsl used is <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output omit-xml-declaration="yes...

html - how to get responsive equal borders with imgs? -

Image
this tried, borders not equal. .foo{ width: 100%; height: 100%; background: #999; padding-left: 2%; padding-top: 2%; } img{ width: 47%; margin-top: 0; margin-bottom: 2%; margin-right: 2%; padding: 0; } and html: <div class="foo"> <img src="http://s29.postimg.org/z632s2x1z/shark.jpg" alt=""> <img src="http://s29.postimg.org/z632s2x1z/shark.jpg" alt=""> <img src="http://s29.postimg.org/z632s2x1z/shark.jpg" alt=""> <img src="http://s29.postimg.org/z632s2x1z/shark.jpg" alt=""> </div> http://jsfiddle.net/07lwwmgb/ or maybe approach bad demo: http://jsfiddle.net/n64vaahu/ css body { margin: 0; padding: 0; } .foo { width: 100%; height: 100%; background: #999; box-sizing: border-box; padding: .5%; } img { width: 50%; float: left; padding: .5%; ...

Sort Multi-dimensional associative arrays in javascript by range -

i trying sort multi-dimensional array returned api allow people choose range based on beats. to honest stuck api returns. var myobj = [{ title: 'title one', beats: 1 }, { title: 'title two', beats: 2 }, { title: 'title three', beats: 3 }, { title: 'title four', beats: 4 }, { title: 'title five', beats: 5 }, { title: 'title six', beats: 6 }, { title: 'title seven', beats: 7 }, { title: 'title eight', beats: 8 }, { title: 'title nine', beats: 9 }, { title: 'title ten', beats: 10 }]; now trying allow users select range based on beats. so if select 1-4 return. var myobj = [{ title: 'title one', beats: 1 }, { title: 'title two', beats: 2 }, { title: 'title three', beats: 3 }]; and 8-10 return etc etc... var myobj = [{ title: 'title eight', beats: 8 }, {...

mysql - query which creates missing rows based on anther table -

i have many forms users fill out. each form contains list of questions. in first table form id , id's of questions. form_id | question_id 1 | 1 1 | 2 1 | 3 2 | 4 2 | 5 this table has 2 forms 1 has 3 questions , other 2. have second table has answers users have given questions. user_id | form_id | question_id | answer 476 | 1 | 1 | "answer1" 476 | 1 | 3 | "answer2" 693 | 1 | 1 | "answer3" 693 | 1 | 2 | "answer4" 235 | 2 | 5 | "answer5" in example, 2 users have filled out form 1 , 1 user has filled in form 2. none have filled in questions. possible write query combines 2 tables , give me answers user have given including questions didn't answer? i'd results this. user_id | form_id | question_id | answer 476 | 1 | 1 | "answer1" 4...

java - Possible to store encrypted credentials in a PKCS12 keystore? -

i trying find way can ensure security of credentials within system. 1 requirement once passwords encrypted need able provide api can used both java , c projects. 1 way achieve have pkcs12 keystore works not java (unlike jks) other languages. question can pkcs12 keystore used store encrypted passwords? no, pkcs#12 key store cannot used passwords. although officially pkcs#12 allows personal secrets stored in secretbag format of such bag not specified. you'll need define own key store protocol if want store passwords.

ruby on rails - Font Awesome icons shows up as black squares on Heroku -

i'm using font-awesome-sass gem rails project. i followed gem's instructions, , have included @import application.css.scss. i'm using correct rails syntax in html reference icons. works great locally, push staging heroku environment, icons show black squares. here snippet of staging.rb (the staging heroku environment talking about) # code not reloaded between requests. config.cache_classes = true config.eager_load = true # full error reports disabled , caching turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # enable rack::cache put simple http cache in front of application # add `rack-cache` gemfile before enabling this. # large-scale production use, consider using caching reverse proxy nginx, varnish or squid. # config.action_dispatch.rack_cache = true # disable rails's static asset server (apache or nginx this). config.serve_static_assets = true # compress javascripts ,...

Django: How to output error_message in paragraph <p> instead of list <li> format -

i have simple form uses sessionwizardview spread on number of pages. below example of 1 of questions. first_name = forms.charfield(max_length=100, label='what first name?', error_messages={'required': 'please enter first name'}) which renders out <label for="id_0-first_name">what first name?</label> <ul class="errorlist"> <li>please enter first name</li> </ul> <input id="id_0-first_name" maxlength="100" name="0-first_name" type="text" /> can tell me hwo change error output in <p> paragraph </p> format rather <li> list item </li> format? i using django 1.6.2 you can @schillingt suggested , create own error list class. or, if want handle in template, can use like: <form method="post" action="/some-view/"> ... other fields, etc. omitted ... <!-- label , form field --...

multithreading - New thread for each object in C# -

this question has answer here: random number generator generating 1 random number 8 answers i have following code: thread[] threadarray= new thread[3]; myobject[] objectarray = new myobject[3]; (int = 0; < 3; i++) { //create new hotelsupplier object objectarray[i] = new myobject(); //create array of threads , start new thread each hotelsupplier threadarray[i] = new thread(new threadstart(objectarray[i].run)); //store name of thread threadarray[i].name = i.tostring(); //start thread threadarray[i].start(); } i creating 3 objects , 3 threads. of objects stored in array, of threads stored in array. the run method in myobject generates random number between min , max random random = new random(); double min = 50.00; double max = 500.00; double price = random.nextdouble() * (max - min) + min; console....

c# - Odd behavior with yield and Parallel.ForEach -

at work 1 of our processes uses sql database table queue. i've been designing queue reader check table queued work, update row status when work starts, , delete row when work finished. i'm using parallel.foreach give each process own thread , setting maxdegreeofparallelism 4. when queue reader starts checks unfinished work , loads work list, concat list , method returns ienumerable runs in infinite loop checking new work do. idea unfinished work should processed first , new work can worked threads available. i'm seeing fetchqueuedwork change dozens of rows in queue table 'processing' work on few items @ time. what expected happen fetchqueuedwork new work , update table when slot opened in parallel.foreach . what's odd me behaves expect when run code in local developer environment, in production above problem. i'm using .net 4. here code: public void go() { list<workdata> unfinishedwork = workdata.loadunfinishedwork(); ienumera...

asp.net - kindly guide me where i am wrong? -

i have database daily sale recorded. want client outstanding between 2 dates. date_ column in varchar. m not getting required result.through query , when used between query showing wrong data.so solution? kindly select clientid [id],sum(convert(float, total)) [sum] buffalo_milk_sale clientid between 'hd001' , 'hd099' , convert(datetime, date_, 103) >= convert(datetime, '01/09/2014', 103) , convert(datetime, date_, 103) <= convert(datetime, '09/09/2014', 103) group clientid error the conversion of varchar data type datetime data type resulted in out-of-range value. try this select clientid [id],sum(convert(float, total)) [sum] buffalo_milk_sale clientid between 'hd001' , 'hd099' , convert(varchar(10), date_, 111) >= convert(datetime, '01/09/2014', 103) , convert(varchar(10), date_, 111) <= convert(datetime, '09/09/2014', 103) group clientid

php - getting mysql results into Jpgraph -

i'm using jpgraph first time , trying mysql query results array code based on example bargradsmallex4.php. i've tried various syntax not overly familiar mysql_fetch_array() , can't insert data array. appreciated. query has been tested , produces results not query itself. $sql= mysql_query('select agency,current,sum(current) table2 match(agency) against("health" in boolean mode) group agency '); // need data $datay = array(); while($row = mysql_fetch_array($sql)) $datay[] = array( 'current' => $row['sum(current)'], ); // setup graph. $graph = new graph(400,300); $graph->setscale("textlin"); $graph->img->setmargin(25,15,25,25); $graph->title->set('"grad_ver"'); $graph->title->setcolor('darkred'); // setup font axis $graph->xaxis->setfont(ff_font1); $graph->yaxis->setfont(ff_font1); // create bar pot $bplot = new barplot($datay); $bplot->setwidth...

vb.net - Incomplete border around range in excel -

Image
i'm using vb.net automate excel spreadsheet generation. i'm drawing border around range, reason text in first columns hides border. there way of sending text "background", z-index in web, border displays correctly? this relevant line of code: range = sheet.range("b" + (sectionstart).tostring, "m" + (currentline).tostring) range.borderaround(xllinestyle.xlcontinuous, xlborderweight.xlthin) i best bet wrap text in column a, problem lot here @ work , solves issue. try adding: sheet.range(“a:a″).iswraptext = true to code, hope helps!

How can i pass an array to an object during its intialisation in java? this gives me an error num cant be resolved (last line of code) -

as new java...i want know why following code throws error num cant resolved although have declared array , intialised it. trying pass array object during creation of object.... not allowed or there other error in code? import java.util.scanner; public class search { public search(int x[]) { (int i=0;i<10;i++) system.out.println("inside constructer"+x[i]); } public static void main(string[] args) { integer num[] = new integer[10]; scanner sc =new scanner(system.in); system.out.println("eneter 10 integers:"); for(int i=0;i<10;i++) { system.out.println("enter "+(i+1)+" number:"); num[i]=sc.nextint(); } for(int j=0;j<10;j++) system.out.println(num[j]); } search obj=new search(num); } integer , int 2 different things. change integer num[] = new integer[10]; int num[] = new int[10]; int primitive type while integer object wra...

OAuth 2.0 authentication in HTTP Module -

is possible implement oauth(open authorization) 2.0 or 1.0 in http module. why m choosing because, each , every request first reaches http module, request have authenticate is possible ? if yes means , please related link that help me.. yes, possible. in fact mod_auth_openidc apache (and openid connect, protocol built on oauth2). more on scenario here: https://auth0.com/blog/2014/08/22/sso-for-legacy-apps-with-auth0-openid-connect-and-apache/

How to retrieve values from an array in MongoDB using C# -

below in code retrieves elements in form of bsonarray. want fetch numeric value array , use value calculate sum. var fields = "secondary.amount"; foreach (var document in collection.findallas<bsondocument>().setfields(fields)) { foreach (string name in document.names) { bsonelement element = document.getelement(name); console.writeline("{0}", element.value); } } i tried converting bson element int64, int32, double , use numeric value addition runtime error of not able cast bsonarray etc. have idea on how go this? i figured out solution, making following changes , works now: foreach (bsondocument nesteddocument in document["name"].asbsonarray) { total += convert.todouble(nesteddocument["amount"]); }

breadcrumbs - Show end of text when overflow in CSS -

i have breadcrumbs on website ( | symbolises area have it): | home -> thing -> deeper thing | currently, has overflow: hidden set, when becomes long, results in: | home -> thing -> deeper thing -> page long , import| what i'm trying achieve hide beginning of text instead of end, should be: | me thing -> deeper thing -> page long , important title | how that? you can 2 divs , simple javascript this: window.onload = function(){ var inner = document.getelementbyid("inner").offsetwidth; var outer = document.getelementbyid("outer").offsetwidth; if(outer > inner) document.getelementbyid("inner").style.left = 0; } #outer { overflow: hidden; width: 500px; height: 20px; position: absolute; } #inner { white-space: nowrap; position: absolute; right: 0; } <div id="outer"><div id="inner">home...

c++ - OpenGL under QML -

so i've been toying around opengl under qml , have been looking @ supplied example file of same name. kind of understand how it's working here's thing: tried replace opengl shader program in paint() function of example own basic open gl stuff. unable visible on screen. thing able change color of background. i'm wondering how set viewport, camera, , whatever needed have on screen. have (very rusty) experience on opengl in past there's been things freeglut makes life bit easier. pointers or examples (something can put in paint() method observe , learn from) right direction appreciated... edit: here's have in paint() method: void qtopenglviewrenderer::paint() { // following 2 lines fixed problem qopenglfunctions glfuncs(qopenglcontext::currentcontext()); glfuncs.gluseprogram(0); glviewport(0, 0, m_viewportsize.width(), m_viewportsize.height()); glmatrixmode(gl_projection); glloadidentity(); glmatrixmode(gl_modelview); glloa...

list - How to sort values coming from bean using hasmap in java -

hi new here , on task, dont have experience working hashmap actually receiving string next value string value1 = "da45:1|da33:2|da25:3"; actually have map<integer, string> value1 = new hashmap<integer, string>(); i need parse these data , generating map such priority key , device name value example : key1 ----- > da45 key2 -----> da33 key3 -----> da25 please notice need split ":","the number" , pipe thanks in advance helping me import java.util.hashmap; import java.util.map; public class main { public static void main(string[] args) { map<integer, string> map = new hashmap<integer, string>(); string value1 = "da45:1|da33:2|da25:3"; string[] x = value1.split("\\|"); integer key; string value; (int = 0; < x.length; i++) { string[] y = x[i].split(":"); value = y[0]; ...

Read console text from background application in Linux -

i creating application kick off on standard runlevel , run forever. produce console output i'd able read selectively. there "correct" way in *nix? to clear, app kick off background task. want know if after has started, "attach" , read current messages being written console application. don't need history, debugging. the obvious way redirect output of background task log file when start it, , use tailf on when want access it. some_task > logfile & tailf logfile the tailf command let follow being written of log file.

ios7 - MKPolygon using Swift (Missing argument for parameter 'interiorPolygons' in call) -

fellow devs, i'm trying implement polygon overlay on mapview follows: private func drawoverlayforobject(object: mystruct) { if let coordinates: [cllocationcoordinate2d] = object.geometry?.coordinates { let polygon = mkpolygon(coordinates: coordinates, count: coordinates.count) self.mapview.addoverlay(polygon) } } the following error presented: missing argument parameter 'interiorpolygons' in call according documentation: apple docu: mutable pointers when function declared taking unsafemutablepointer argument, can accept of following: nil, passed null pointer an unsafemutablepointer value an in-out expression operand stored lvalue of type type, passed address of lvalue an in-out [type] value, passed pointer start of array, , lifetime-extended duration of call now think approach correct, providing [cllocationcoordinate2d] array. did experience same problem , found workaround? thanks ronny ...

node.js - Grunt - npm module not found -

i'm new grunt , i'm having trouble setting project new plugins. so far have: installed grunt-cli globally installed grunt-init globally downloaded gruntfile template git repository created new directory 'test' , navigated directory in terminal created new grunt project template (grunt-init gruntfile) installed project dependencies (npm install) this works great, want use different uglify plugin so, still in 'test' directory, run: npm install uglify-js --save-dev as i'm not using global flag, plugin downloads test/node_modules directory expected, existing @ test/node_modules/uglify-js. package.json file has been updated additional dependency: "uglify-js": "^2.4.15" i edit gruntfile.js, adding grunt.loadnpmtasks('uglify-js'); and change grunt.registertask('default', ['jshint', 'qunit', 'concat', 'uglify']); to grunt.registertask('default', ['conca...

asp.net web api2 - error when trying to get entity related to entity in webapi 2 -

models: public class dog { [key, databasegenerated(system.componentmodel.dataannotations.schema.databasegeneratedoption.identity)] public guid id { get; set; } [required] public string name { get; set; } public datetime? birthdate { get; set; } public string color { get; set; } public string race { get; set; } public string chipnumber { get; set; } public byte[] photo { get; set; } public virtual icollection<record> records { get; set; } public virtual user user { get; set; } } public class record { public record() { quota = 1; } [key, databasegenerated(system.componentmodel.dataannotations.schema.databasegeneratedoption.identity)] public guid id { get; set; } public datetime? time { get; set; } [required] public string name { get; set; } public string supplier { get; set; } ...

android - Delete Last Item of Share Action Provider -

Image
i have implement shareactionprovider in android application. work fine, want delete icon of last item used, @ right of button, : this configuration : menu : <item android:id="@+id/menu_item_share" android:actionproviderclass="android.widget.myshareactionprovider" android:showasaction="always" android:title="partager"/> activity : menuitem item = menu.finditem(r.id.menu_item_share); mshareactionprovider = (shareactionprovider) item.getactionprovider(); if (mshareactionprovider != null) { mshareactionprovider.setshareintent(mshareintent); } do have idea ? thanks

javascript - radians sometimes flipped/reversed -

i have function should finding middle of 2 radians function mrad(rb,ra){return (rb+ra)/2;} but when plot x , y math.sin , math.cos 2 specified length new coordinates coming out @ polar opposites of intend. for example; if expect new points down , right coming out , left. the coordinates correct apart this! here how plot new x , y xnew=xold-(100)*math.cos(radian); xnew=yold+(100)*math.sin(radian); i guessing might matter if radian b (rb) bigger ra. think happening going full circle in case, whereas should instead doing like function mrad(rb,ra){return (rb-ra)/2;} my questions are is assumption correct? what condition, how tell when rb-ra vs rb+ra , or put better, how tell if 1 radian pointing above or bellow other? it should this function mrad(rb,ra){return ((/*condition*/)?(rb-ra):(rb-ra))/2;} edit to find range have tried express different values find range in radians cannot find more diagonal line http://jsfiddle.net/rollqfs6/ also defined lengt...

Using data in Python code from C++ using Cython -

i'm trying list c++ code in python code using cython. here header (ex.h): namespace c { class c { int id; public: c(int id) { this->id = id; } int getid(); }; typedef std::vector<c> clist; } and source file (ex.cpp): namespace c { int c::getid() { return this->id; } clist getlist(int t) { clist list; (int = 0; < t; ++i) { c c(i); list.push_back(c); } return list; } } so in python code want iterate through clist this...

mongodb - Go mgo new record? -

is possible detect whether i'm working new record or old record using mgo ? an example of mean implemented in rails activerecord: object.new_record? there's no such concept of new/old record mgo. far driver concerned, it's data have in memory. can load data database in in-memory value, in multiple in-memory values, , can save back, under same id or different one, , can save different database under different session. driver asked do. the application can implement own concept of new/old adding field struct , setting appropriate. make field unexported or use field tag bson:"-" prevent mgo storing field. if application relies on database assign document id, application can check id field determine if document new or old.

ios - Xcode 6 - failed to locate or generate matching signing assets -

error: failed locate or generate matching signing assets , failed because of following issues: no matching provisioning profiles found "applications/myapp.app" none of valid provisioning profiles allowed specified entitlements: application-identifier, beta-reports-active, keychain-access-groups. while trying distribute company / in-house app: i've upgraded xcode 5 xcode 6 , normal routine results in above error. how fix this? tried renaming distribution profile, restarting xcode, letting xcode generate it's own files, creating new distribution certificate. now? i able fix problem changing architectures setting. assume problem architectures/valid architectures being incompatible 1 another.