Posts

Showing posts from June, 2015

mysql - How to select photos that are in selected albums -

i couldn't figure out how word question, i'm going use typical example. imagine have common design photo albums 3 tables - photos, albums, photo_albums (a lookup table). albums names a, b , c. how find photos in both , c? if table design , want filter on album name. can this: select * photos exists ( select null photo_albums join albums on photo_albums.albumid=albums.albumid photos.photoid=photo_albums.photoid , albums.albumname in ('a','b') ) i think better solution via id if have one. this: select * photos exists ( select null photo_albums photos.photoid=photo_albums.photoid , photo_albums.albumid in (1,3) )

youtube - Can Any one knows how to use yoube upload widget without user login with google account -

please me how implement youtube upload widget without user login google account thanks unless missed question, don't think it's possible. you can't upload youtube without google(youtube) acount put video on.

html - Jquery, get elements with element name starts with a giving string -

how using jquery input text elements whith name starts 'productelement' you use attribute starts with selector [name^="value"] : selects elements have specified attribute value beginning given string. $('input[name^="productelement"]')

c# - passing NVARCHAR value to stored procedure -

i have stored procedure nvarchar parameter this: alter procedure [dbo].[hr_companies_getbyidandname] @companyname nvarchar(100), @lang int = 1 select * companies (@lang = 1 , namelang1 @companyname ) or (@lang = 2 , namelang2 @companyname ) ) i want supply nvarchar value using syntax: dbhelper _helper = new dbhelper(); _helper.storedproc = "hr_companies_getbyidandname"; _helper.addparam("@companyname", "n'%" + company.trim() + "%'", sqldbtype.nvarchar); _helper.addparam("@lang", language, sqldbtype.int); return _helper.gettable(); but returning null . when run query without stored procedure select * companies companyname n'%mycompanyname%' , returns result. how add n using dbhelper addparameter ? i'm not sure dbhelper pass nvarchar type values stored procs, following standard way: var param = new sqlparameter("@companyname ", sqldbtype.nvar...

java - Best way to compare big csv files? -

i must application, compares big csv files, each 1 having 40,000 records. have done application, works properly, spends lot of time in doing comparison, because 2 files disordenated or have different records - must iterate (40000^2)*2 times. here code: if (nomfich.equals("car")) { while ((linea = br3.readline()) != null) { array =linea.split(","); spliteado = array[0]+array[1]+array[2]+array[8]; filereader fh3 = new filereader(cadena + lista2[0]); bufferedreader bh3 = new bufferedreader(fh3); find=0; while (((linea2 = bh3.readline()) != null)) { array2 =linea2.split(","); spliteado2 = array2[0]+array2[1]+array2[2]+array2[8]; if (spliteado.equals(spliteado2)) { find =1; } } ...

Reverse Singly Linked List Java -

can tell me why code dosent work? want reverse single linked list in java: method (that doesnt work correctly) public void reverselist(){ node before = null; node tmp = head; node next = tmp.next; while(tmp != null){ if(next == null) return; tmp.next = before; before = tmp; tmp = next; next = next.next; } } and node class: public class node{ public int data; public node next; public node(int data, node next){ this.data = data; this.next = next; } } on input 4->3->2->1 got output 4. debugged , sets pointers correctly still dont why outputs 4. node next = tmp.next; while(tmp != null){ so happens when tmp == null? you got it, though. node before = null; node tmp = head; while (tmp != null) { node next = tmp.next; tmp.next = before; before = tmp; tmp = next; } head = before; or in nicer (?) naming: node reversedpart = null; node current = head; while (c...

ios - SimpleLogin facebook wont login -

i'm using firebase simplelogin facebook login, there seem issue. i'm not sure how debug this. seem issue here? *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[__nsplaceholderdictionary initwithobjects:forkeys:count:]: attempt insert nil object objects[0]' *** first throw call stack: ( 0 corefoundation 0x02c331e4 __exceptionpreprocess + 180 1 libobjc.a.dylib 0x029b28e5 objc_exception_throw + 44 2 corefoundation 0x02bf9376 -[__nsplaceholderdictionary initwithobjects:forkeys:count:] + 390 3 corefoundation 0x02c26c29 +[nsdictionary dictionarywithobjects:forkeys:count:] + 73 4 app 0x000257b5 parseuserdata + 373 5 app 0x000982a6 __38-[loginviewcontroller actionfacebook:]_block_invoke + 358 6 app 0x00148647 __89-[firebasesimplelogi...

ada - GNAT GPS on the fly syntax checking and getting the best out of the IDE -

i've started using gps coding ada @ work - have tips getting best out of ide? or plugins should aware of? for example there way enable on fly syntax/type checking - of sorts in eclipse/visual studio errors underlined go? also people's general opinions on gnat workbench compared gps? thanks matt the gps not have of background syntax checking , design. idea behind gps is compiler decides code correct , code not correct. means if want know if code correct or not have compile it. on windows computer short cut key shift+f4 , compile specification or body file editing. pressing f4 compile whole project. save time using shift+f4. another interesting feature gps uses cross-reference (xref) information when navigation through code. example, let's find places in code specific subprogram called. in gps (gnat pro), right click on subprogram interested in press find references. in gps gnat libre version don't have menu when right clicking in code. in case go n...

objective c - How to remove GPPSignInButton's default style (text, G+ image) to add your own in iOS -

Image
we're using ggpsigninbutton log goopleplus service. want have custom , feel button, couldn't find way turn off text , image show button automatically when tell uibutton of kind gppsigninbutton. here's how looks when add own design inside otherwise empty button gppsigninbutton: the way i've been able make disappear pretty patchy: (first wire button iboutlet called gplusbutton) [self.gplusbutton.subviews[0] removefromsuperview]; i tried using own button, , when pressed calling manually [[gppsignin sharedinstance] authenticate] method seems result in incorrect login (for example, login token isn't saved key chain google+ later uses silently authenticate me). does know of better way design own style button? btw appears supported web sign in buttons . just don't use gppsigninbutton! idea of calling authenticate directly correct - make sure configuring shared instance (including delegate , on) before calling authenticate.

android - To check if user Is Logged in or not -

i using sharedpreferences check if user logged in or not. if user not logged in, taken login activity (or) info activity. my code follows. this in login activity. sharedpreferences settings = getsharedpreferences(prefs_name, mode_private); sharedpreferences.editor editor = settings.edit(); editor.putboolean("logged", true); // set false when user logged out editor.commit(); // commit edits! i have checking code in main activity looks follows sharedpreferences settings = getsharedpreferences(prefs_name, mode_private); boolean loggedin = settings.getboolean("logged", true); if (loggedin != true) { // toast.maketext(this,"you logged in !!",3000).show(); /* intent = new intent(this,login.class); startactivity(i);*/ intent intent = new intent(mymainscreen.this, registered.class); startactivity(intent); } else { // toast.maketext(this,"you not logged in !!",3000).show(); intent intent = new intent(my...

sql - How to use in db MySQL decimal? -

i need insert in table tbl_range of mysql database decimal value: 1866752.0 and set field 'range' in table tbl_range : create table `tbl_range` ( `range` decimal(10,5) default null, `id` int(11) not null auto_increment, primary key (`id`) ) engine=myisam default charset=latin1; but in query insert i've error: [err] 1264 - out of range value column 'range' @ row 1 you have change: range decimal(10,5) default null, to range decimal(15,5) default null, because 1st parameter indicates total number of digits including decimal values. if putting (10,5) can insert upto 99999.99999. required value greater that.

python - Using partial with groupby and apply in Pandas -

i having trouble using partial groupby , apply in pandas. perhaps not using right? data = {'a':[1,1,2,2],'b':['y','y','n','y'], 'c':['y','y','n','y']} df = pandas.dataframe(data) def county(columnname, group): return len(group[group[columnname] == 'y']) df.groupby('a').apply(partial(county, 'b')) attributeerror: 'functools.partial' object has no attribute '_ module _' welcome@welcome-thinkcentre-edge72:~$ python python 2.7.3 (default, feb 27 2014, 19:58:35) [gcc 4.6.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import pandas >>> functools import partial >>> data = {'a':[1,1,2,2],'b':['y','y','n','y'], 'c':['y','y','n','y']} >>> df = pandas.dataframe(...

file - Waiting for finish reading a data in javascript -

i using d3.js read data tsv file,but found there strange in procedure,i read data , push each line array called dataset , want calculate variable total using loop,but seems fail(there no datum in dataset),maybe because javascript going on without waiting finish reading file.the code here: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>this te</title> </head> <body> <script src="http://d3js.org/d3.v3.min.js" type="text/javascript" charset="utf-8"></script> <script src="fun.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var dataset = new array(); var parsedate = d3.time.format('%y-%b-%e').parse; d3.t...

jboss5.x - Using both XA and non-XA datasource for the same database -

there places in our project need use xa transactions. in of project regular non-xa datasource do. i've been wondering, need define 2 versions of datasource, xa , non-xa, same database? i'm afraid xa transactions costly, therefore i'd avoid them if possible. that's reasonable approach if worried performance, 2pc commit protocol can 4 times slower. of course needs qualified this depends on number of resource managers participating in xa txn 2pc more expensive requires more roundtrips. in addition transactions can go in-doubt state when failure occurs, locks records changed part of transaction until recovered. not using xa can avoided.

asp.net - Enabling /Disabling ButtonField of GridView using Checkbox -

i have grid view one column itemtemplate column has checkbox field. other 2 columns databound columns. 1 column buttonfield of button type. i want button set disabled mode once checkbox checked should enabling particular row button field. in this? my sample try .aspx file <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:email_notificationconnection %>" selectcommand="select [customer_name] [customer]"></asp:sqldatasource> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datasourceid="sqldatasource1" enablemodelvalidation="true"> <columns> <asp:boundfield datafield="customer_name" headertext="customer_name" sortexpression="customer_name" /> <asp:templatefield> ...

objective c - Sending string of text from iPhone to PC -

all need when press button on app, string of text (eg. "text1"), pc vb.net application can interpret it. can done in simple way? pretty if iphone app store data on webpage 30 seconds vb.net application take data. cheers! ps: before down-voting this, please comment! you need use service similar parse , iphone app can send data servers free (so long not making many requests) , vb.net program can pull data. have sdk's ios , .net

php - How to select child by name with DOMXpath? -

my current code is: $dom = new domdocument(); $dom->loadxml($data); $xpath = new domxpath($dom); foreach ($dom->childnodes $node) { echo $node->nodename . "\n"; } which outputs: xml-stylesheet #comment wsdl:definitions is possible somehow (for example domxpath ) directly (without looping childnodes name) xml-stylesheet node? example: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="../../../ver20/util/onvif-wsdl-viewer.xsl"?> <!-- copyright (c) 2008-2012 onvif: open network video interface forum. rights reserved. recipients of document may copy, distribute, publish, or display document long copyright notice, license , disclaimer retained copies of document. no license granted modify document. document provided "as is," , corporation , members , affiliates, make no representations or warranties, express or implied, including not limited to, warra...

java - How can I inject from a field? -

i use spring , can inject method. @bean ilogger loggerservice() { return new ilogger() { public void log() { system.out.println("logger!"); } }; } but i'd inject field: @ ??? annotation ilogger logger = new ilogger(){ public void log() { system.out.println("logger!"); } }; can possible? annotation should use? this not possible. in spring javaconfig beans in @configuration must produced methods of class

css - FontAwesome Firefox issues with certain fonts -

see screenshot: http://awesomescreenshot.com/0242jcea3a certain fontawesome icons don't display in firefox @ all, others do. name few of ones don't load: youtube vimeo instagram video play button we using latest cdn version (//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css). running firefox 28. html page charset utf-8 also. no idea what's causing this, it's annoying bug, when works fine in chrome , safari etc. i've tried loading font locally instead of on cdn, , unfortunately didn't fix issue. i've tried below htaccess code: <filesmatch ".(ttf|otf|woff)$"> header set access-control-allow-origin "*" </filesmatch> there no security/console errors showing in firefox either? any appreciated :) maybe base64 encoding you're looking for. font awesome doesn't offer feature.. can try icomoon app ( http://icomoon[dot]io/ ). firefox 27.0 mac os x 10.8 screenshoot http://...

javascript - Where to put the image file in node.js? -

i have following directory structure in linux 3 files in it: /home/nikhil/test_img/ server.js page.html pic.jpg this simple node.js hello world setup without using express or other library code server.js var http = require("http"), fs = require('fs'); var path = require('path'); var root = path.dirname(require.main.filename); var filepath = path.join(root + '/page.html'); var port = 8889; function onrequest(request, response) { fs.readfile(filepath, function (err, html) { if (err) { throw err; } response.writehead(200, {'content-type': 'text/html'}); response.write(html); response.end(); }); } http.createserver(onrequest).listen(port, function () { console.log("server has started @ port " + port); }); this creates server displays page.html on request localhost:8889 code page.html <html> <head><title>page</tit...

xslt - Page numbering problems with xsl:fo and apache fop -

i have following (part of) xsl:fo template <fo:root font-size="11pt" font-family="arial"> <fo:layout-master-set> <fo:simple-page-master master-name="a4-portrait" page-height="29.7cm" page-width="21.0cm" margin-top="1cm" margin-left="1.5cm" margin-right="1cm" margin-bottom="1cm"> <fo:region-body /> <fo:region-after region-name="footer" extent="15mm"/> </fo:simple-page-master> <fo:simple-page-master master-name="a4-landscape" page-width="29.7cm" page-height="21.0cm" margin-top="1cm" margin-left="1cm" margin-right="1cm" margin-bottom="1cm"> <fo:region-body /> <fo:region-after region-name="footer2" display-align="bottom" extent="0cm"/...

python - How to plot 2 subplots from different functions in the same window(figure)? -

for specific reasons have 2 functions, each of them creates plot in 2 different windows. possible unify 2 plots in 1 window, without unifying functions? thanks! edit: have 2 involved functions , database: function 1 in file1.py plots 2d-line plot: plt.figure("test12") ax=plt.subplot(111) ax.plot(array[:,10]) in file2.py theres other function, plots filled contour: plt.figure("test13") ax = plt.subplot(111) ax.contourf(x,y,data) plt.gca().set_aspect('equal') if use plt.show as usual, result 2 different windows. re-factor function take axes object draw argument: def fun1(ax): ax.plot(range(5)) def fun2(ax): ax.plot(range(5)[::-1]) fig, ax = plt.subplots(1, 1) fun1(ax) fun2(ax) plt.draw()

Escalante sbt plugin fails with missing org.apache.maven.wagon#wagon-provider-api;1.0!wagon-provider-api.jar -

i'm trying escalante-sbt running without luck far. tried sbt 0.13.1 scala 2.10.3. had same issue in question , nothing worked me. in last attempt cloned sbt-escalante example not working. [info] resolving org.scala-sbt#sbt-launch;0.13.1 ... [warn] [not found ] org.apache.maven.wagon#wagon-provider-api;1.0!wagon-provider-api.jar (1794ms) [warn] ==== jboss repository: tried [warn] http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/wagon/wagon-provider-api/1.0/wagon-provider-api-1.0.jar [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: failed downloads :: [warn] :: ^ see resolution messages details ^ :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: org.apache.maven.wagon#wagon-provider-api;1.0!wagon-provider-api.jar [warn] :::::::::::::::::::::::::::::::::::::::::::::: sbt.resolveexception: download failed: org.apache.maven.wagon#wagon-provider-api;1.0!wagon-provider-api.jar i sbt-escal...

javascript - how to view json file data in view source code -

Image
let suppose have json file and can read file in script this $(document).ready(function () { $.ajax({ type: "get", url: "package.html", datatype: "json", success: function (data) { var t = ''; (var = 0; < data.yeardata.length; i++) { var mainstorytitle = data.yeardata[i].players; (var j = 0; j < mainstorytitle.length; j++) { var storytitle = mainstorytitle[j].name; var topstorycontent = mainstorytitle[j].description; var storyimage = mainstorytitle[j].image; t = t + '<div class="content">'; t = t + '<article class="topcontent">'; t = t + '<header class="top" id="top1"><...

javascript - jquery $.ajax() not working in application hosted server -

i working on ci app...having little bit problem in jquery $.ajax.its working fine in localhost in hosted server of time not working <?php $this->load->helper('url'); ?> var generate = '<?php echo site_url('pingenerator'); ?>'; function generate_pin(){ alert(generate);//testing purpose var package = $("#packagetype").val(); var times = $("#noofpins").val(); $.ajax({ 'url' : generate, 'type' : 'post', 'data' : {'packagetype' : package,'noofpins' : times }, 'success' : function(data){ var container = $('#pin_generator_msg'); alert('ajax complete');//testing purpose container.html(data); } }); } url works fine when copy peasting in add bar... $.ajax not calling @ all adding both scripts jquery-1.10.2.min.js , jquery.smart...

ios - Adjust width of UILabel based on its contents -

i had on before asking question. questions adjusting height of uilabel , not width. tried alternative methods did not work such [label sizetofit]; . possible adjust width of label based on text? create label in uitableviewcell in story board. want able adjust width based on text assigned. dont want resize font size. i set text of label in cellforrowatindexpath . examples great please. thanks in advance :) update 1: have custom cell making in storyboard not programmatically. set contents of each cell in cellforrowatindexpath , example, mylabel.text = recipe.name . name label quite small, extend width based on length of text, not truncate tail or shrink size of text. update2: have lot of other uielements in cell. have label in top left, top right, bottom left, bottom right, , picture in middle, there default 120 because have background color. set small there not huge amount of empty space in label. get size of string: //replace flt_max maximum height/width wa...

Android monkeyrunner - check if screen contains an image or specific color -

i have android app wanted automate/stress-test. made image-based automation script in scar divi , run against app installed on bluestacks. want change genymotion, because bluestacks slow. i have environment set (genymotion+image app +adb installed , working). rewrited script in python , used in monkeyrunner, but... besides sending gestures, clicks , waits, missing image recognition functionality. found out can compare 2 screen shots imagemagic, that's not need. i need check whether button, or @ least if specific color on screen. point me right direction this? i'd grateful examples :( monkeyrunner indeed offer pretty decent image based test methods. show below how take sub-image displayed screen of device. can save sub-image and/or compare reference image first need take screenshot of current screen of device # take screenshot image = device.takesnapshot() then can take sub-image. example, sub-image button on screen verify button exists on screen....

fonts - Setting no antialias on the sublime sidebar -

in editor part easy turn off antialias, have add in user settings folowing statement: "font_options": [ "no_antialias" ], but how should on/for side bar? unter directory "theme - default" there configuration file named "default.sublime-theme". i've tried there following: { "class": "sidebar_container", "font_options": [ "no_antialias" ] }, but not work. can me further?

php - qtranslator not supporting hindi fonts? -

i have installed qtranslator plugin , included hindi language , added hi_in.mo file in language folder of qtranslator plugin. when create content in hindi not supporting hindi fonts kruti 010 , etc. if supports such fonts have that? if not supports can make support fonts? working on blog post put contents in english , hindi. there texts hindi fonts not supported in content box blog, content written in kruti dev font. this might solve problem: actually need convert page content "kruti dev" "unicode" font recognized major translator's like goggle translator, qtranslator etc.. so doing translation need visit on on-line converter tool : online "kruti dev" "unicode" converter and post text in given text field , convert unicode here can upload doc file, if page size long. now converted text content can use in wp site page. happy coding!!!

objective c - Issues while merging the videos using AVMutableComposition -

i have been working on merging of videos single video using avmutablecomposition , have got required output.but i'm getting 2 different types of issues while merging the videos. 1) couldn't set custom frames videos using avmutablevideocompositionlayerinstruction. 2) while playing merged video, first merged video been vanished(removed) after been stopped. other videos staying correctly after stopped in respective location. please suggestion solution.. 1) if want change frame merged video, should set avmutablevideocomposition render size 2) if play first , second video @ same time, duration of merged video biggest duration both videos, in case should handle difference,place kind of placeholder @ end of first video(can last frame of video)

Glassfish JDBC Connection Pool Properties URL and Url parameters -

when configuring glassfish jdbc connection pool, there 'url' , 'url' parameters. wonder what's purpose of 'url' one. pool works if configure 'url' only. curious, why two? just keep 1 of them , delete second. prefer "url" takes care java syntax convention (camelcase)

c# - I want to use a time out in my mini program -

i have mini program read excel file. well, sometimes, program doesn't work , keep remaining nothing. so, want catch this, , if program delay more 5 minutes, want stop process. so, how can ? i try this, doesn't work atimer = new system.timers.timer(2000); atimer.enabled = true; atimer.start(); read_file(f, sdir, pathout, pathlogout);

ios - How to use AFNetworking to POST data to Parse.com -

i'm having problem using afnetworking parse.com. i'm trying post data db no luck. i'm not familiar networking stuff , i'm using learning exercise. i've gotten command work know db set correctly , working posting matter. i'm using afnetworking 2.2.0 post simple test string parse backend. here code have command works: -(void)getparsedata{ afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; [manager.requestserializer setvalue:ksdfparseapiapplicationid forhttpheaderfield:@"x-parse-application-id"]; [manager.requestserializer setvalue:ksdfparseapikey forhttpheaderfield:@"x-parse-rest-api-key"]; [manager.requestserializer setvalue:@"application/json" forhttpheaderfield:@"content-type"]; [manager get:@"https://api.parse.com/1/classes/some_data/" parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"json: %@", responseobject); }...

Excel: select column in range by column index - no vba -

i have cell a1, , below 4 columns. cell a1 right contains number 2. 2 | | b | c | selected | | 12 | 44 | 88 | 44 | | 43 | 55 | 99 | 55 | | 54 | 66 | 11 | 66 | which formula should put 'selected' column display there values of second column? a1 cell control values displayed there. basically, i'm looking similar functionality vlookup, except there no lookup , takes range a4:c4 , selectes column number a1. you can use index() that. let's 12 , 44 , 88 in columns a, b , c respectively, , on row 4. in first cell under selected , can put this: =index(a4:c4, 0, a$1) and can drag down remaining rows. index takes whole row (hence 0 ) , column value in a$1 range a4:c4 .

Find the closest value in a matrix matlab -

how can find closest element in matrix in matlab? suppose have matrix of size 300x200 , want find value , index of element in matrix closest element given. does know how can done in matlab? know how given array can not figure out how done matrix. a smaller case might understand - code %%// given big matrix, taken matrix of random numbers demo a1 = rand(10,5); %%// replace 300x200 matrix %// demo, let assume, looking element happens closest element in 4th row , 5th column, verified @ end element = a1(4,5)+0.00001; %%// element in search %%// find linear index of location [~,ind] = min(reshape(abs(bsxfun(@minus,a1,element)),numel(a1),[])); %%// convert linear index row , column numbers [x,y] = ind2sub(size(a1),ind) output x = 4 y = 5 as can seen, output matches expected answer. extended part: if have set of search numbers, can process them closeness efficiently using bsxfun . shown below - code %%// given big matrix, taken matrix of ra...

How to get values from posted html form using javascript -

i have 2 html forms , posting input data 1 html form html form.i want retrieve values of variables posted using form 1 on form 2. <form name ="form1" id ="form1" method ="post" action = "form2.html> <input id ="sendtoform2" type ="hidden" value ="send form2"/> </form> my question how value of hidden variable sendtoform2 on form 2 once posted form 1 form 2 using javascript. you can't use post method because plain html page not have http headers html page code , url (with query string). what can use get instead of post parse query string extract them: <form name ="form1" id ="form1" method ="get" action = "form2.html> <input id ="sendtoform2" type ="hidden" value ="send form2"/> </form> then in form2.html can use function (from this post on so) parse query string: function getparamete...

decimal - Display trailing zero for price in jquery -

hopefully can this. looking add final 0 decimal part of price in price calculator written. the calculator starts user selecting standard "sign up" fee of €25.50 , selecting other packages increase price. at moment, standard price displays €25.5. costs = jquery('.cost-container').text(); total = number(costs) + (25.50).tofixed(2); i got code looking @ following similar query: how add trailing 0 price jquery currently, if enter 25.511 value, result displays 25.51, shows code sort of working, issue when second decimal place 0 not display. can spot wrong? cheers damien try costs = jquery('.cost-container').text(); total = ( number(costs) + 25.50 ).tofixed(2);

PHP SoapClient - How to Structure Soap Header -

using soapclient in php 5.3.28 create soap header looks like: <soap:header> <ns:requestparams size="large" color="blue" brand="xyz"> </soap:header> if construct header this: $params = array('requestparams' => array('size' => 'large', 'color' => 'blue', 'brand' => 'xyz'); $header = new soapheader(namespace, 'requestparams', $params); $client = new soapclient(null, array("location" => "https://endpoint-url", "uri" => "http://namespace-uri", "soap_version" => soap_1_2, "trace" => 1)); $client->__setsoapheaders($header); $result = $client->__soapcall(some soap call here); echo $client->__getlastrequest() . "\n"; the header is: <env:header> <ns2:...

java - trying to make object of class and then to display.setCurrent(Class) but not working -

i trying make new object startgame , show in gamemidlet class, whenever click on ok button display content of startgame , screen doesn't show anything, instead showing same gamemidlet menu. please me find bug is. thank in advance. public class gamemidlet extends midlet implements commandlistener, itemcommandlistener { gamecanvas gamecanvasnew; display display; startgame startgame; command restartcommand; vector mgamecanvaslist; gamecanvas gamecanvassecond; private form formmenu; private command exitcommand; private command okcommand; private command exitcommandgame; private stringitem menuitem; private stringitem sinewgameitem; private stringitem siresume; private stringitem siexit; public void startapp() { formmenu = new form("start menu", new item[] {getnewgameitem(), getresumeitem(), getexititem()}); display = display.getdisplay(this); display.setcurrent(formmenu); } public void pauseapp() { } public void destroyapp(boolean unco...

ios - transparent background of the view presentViewController -

i using presentviewcontroller display popup on click of button in viewcontroller. getting black background. need transparent background. tried following, uiview v1 = [[uiview alloc] init]; v1.alpha = 0.0f; v1.backgroundcolor = [uicolor clearcolor]; [self.view addsubview:v1]; uiview v2 = [[uiview alloc] initwithframe:10,10,270,270]; v2.backgroundcolor = [uicolor whitecolor]; [v1 addsubview:v2]; this displays popup, blanks out screen later. can please me. in advance. regards, neha if testing on iphone, presentviewcontroller hides parent view once presented view presented, request isn't valid. if on ipad, presentviewcontroller can have effect want setting modalpresentationstyle property of presented viewcontroller uimodalpresentationformsheet

c++ - pass non uniform array to shader -

i have idea of fragment shader ckecks if current fragment inside polygon. vertex values of polygon supposed transfered shader array of floats. problem uniform array of floats gets dropped (location = -1) since not directly used shader. i don't know how pass array shader other method uniform values. can direct me better solution? tia. edit: (better explanation) i have array of float values represent vertices of polygon. compute min max array , pass 2 (min/max) vectors geometry shader produces quad under polygon. now, fragment shader supposed take array of polygon vertices , analyze each fragment if inside polygon. if inside, draw color, if outside draw other color. vertex: in vec3 inposition; void main(void) { gl_position = vec4(inposition, 1.0); } geometry: layout(lines) in; layout(triangle_strip) out; layout(max_vertices = 4) out; uniform mat4 u_proj; void main() { vec4 pos0 = u_proj * gl_in[0].gl_position; vec4 pos1 = u_proj * gl_in[1].gl_posit...

javascript - Spring Security without Spring Tag Library (JSTL) -

we having typical web application uses spring security , jsps. use standard spring security tag library show/hide, allow/restrict parts of web pages based of user roles. now going change jsp part , write complete javascript based client. is there way similar functionality provided tag library javascript. if not, things should worry in implementing our own mechanism in javascript. thanks, ish if question "does spring security have javascript equivalent jsp tags" answer "no". obvious difference javascript runs on client whereas jsp executed on server, can't rely on hiding sensitive information using javascript library insecure. a javascript client fundamentally different , security implemented in api expose allow retrieve data server. consist of security contstraints applied urls , server-side methods, rather having display technology, in ways simpler test , reason jsp security, since decoupled actual display code.

php - How do I install PostgreSQL driver on Apache? -

i need able connect (ubuntu + apache) web server remote postgresql database, unfortunately, version of php on web server doesn't have php_pgsql.dll library , throws error if try , uncomment section of php.ini. i've searched internet , found lots of advice on how install postgresql on server, don't need run database service on web server, need allow php connect remote service. can give me step-by-step noob guide installing driver? try this: sudo apt-get install php5-pgsql

php - foscommentbundle keeps creating new entries instead of saving the old one -

Image
problem: the foscommentbundle saves comments everytime refresh page, create new entry in thread table instead of saving on record page. example, if page slug http://johnson.localhost/app_dev.php/page/whats-up-baby , new record created everytime reresh page, table looks this: notice slugs same! here's how expect work: but refresh, starts creating new entries like: i'm displaying form this: {% include 'foscommentbundle:thread:async.html.twig' {'id': post.id} %} and i'm using yaml, here thread , commment yaml files. johnson\blogbundle\entity\thread: type: entity table: null id: id: type: integer id: true generator: strategy: auto lifecyclecallbacks: { } johnson\blogbundle\entity\comment: type: entity manytoone: thread: targetentity: johnson\blogbundle\entity\thread inversedby: comments table: null id: id:...

c# - Constructor not found? -

somehow constructor in 1 of classes isnt being found parameters... has experienced this? here code , how calling it: movefiles class: class movefiles { #region variables //variables public string strsrcpath, strdstpath, strfdrname, strnewdestfldrpath = ""; main frm = new main(); #endregion #region constructor //constructor - accepts path , store value private void movefiles(string strsourcepath, string strdestpath, string strfldrname) { strsrcpath = strsourcepath; strdstpath = strdestpath; strfdrname = strfldrname; } #endregion etc.... then here calling it: //move files based on source path, destination path, , folder name movefiles movefile = new movefiles(strsrcpath, strdestpath, strfoldrname); movefile.startmove(); the place of calling gives me error constructor doesn't take 3 arguments.... anyone have issue , how did fix it? or blind , there sometihng going on there? ...

Selecting text and show meaning as pop up in android eclipse -

i want make book app, , define or translate every sentence in it. thing want know how make translation appear pop text every single textview click on it. example "how you" in textview , after click , hold on pop menu appear translate option. it depend on how want look. toast , context menu or dialog.

Last.fm java API - get all members from a group -

i working java api of lastfm. i want extract users group, belgium. how create new group , extract members? group mygroup = new group(); paginatedresult<de.umass.lastfm.user> users = mygroup.getmembers("belgium", key);) it gives me error on first line: group() has private access. this bit strange. how should call constructor , don't have pass group name during construction? thanks insights! you correct group has private constructor, , cannot use it. looking @ source code method called public static paginatedresult<user> getmembers(string group, int page, string apikey) in de.umass.lastfm.group lets users, , static, can access without creating group object first. do like paginatedresult<de.umass.lastfm.user> users = group.getmembers("belgium", key);

Determining if any duplicate rows in two matrices in MatLab -

introduction problem: i'm modelling system have matrix x=([0,0,0];[0,1,0],...) each row represent point in 3d-space. choose random row, r, , take following rows , rotate around point represented r, , make new matrix these rows, x_rot. want check whether of rows x_rot equal 2 of rows of x (i.e. 2 vertices on top of each other), , if case refuse rotation , try again. actual question: until have used following code: x_sim=[x;x_rot]; if numel(unique(x_sim,'rows'))==numel(x_sim); x(r+1:n+1,:,:)=x_rot; end which works, takes on 50% of running time , considering if in here knew more efficient way it, since don't need information unique . p.s. if matters typically have between 100 , 1000 rows in x . best regards, morten additional: x -matrix contains n+1 rows , have 12 different rotational operations can apply sub-matrix x_rot: step=ceil(rand()*n); r=ceil(rand()*12); x_rot=x(step+1:n+1,:); x_rot=bsxfun(@minus,x_rot,x(step,:)); x_rot=x_rot*rot(:,:,:,r...

ios - Selenium Webdriver crash on Close Method in C# -

i try navigate url window iphone (browser). string str = "http://192.168.2.160:3001/wd/hub"; iwebdriver webdriver = new remotewebdriver(new uri(str), desiredcapabilities.iphone()); system.threading.thread.sleep(1000); webdriver.navigate().gotourl("http://www.yahoo.com/"); webdriver.close(); it has been crashing when fires close method. please suggest made mistake. stack trace: @ openqa.selenium.remote.remotewebdriver.unpackandthrowonerror(response errorresponse) @ openqa.selenium.remote.remotewebdriver.execute(string drivercommandtoexecute, dictionary`2 parameters) @ openqa.selenium.remote.remotewebdriver.close() @ windowsformsapplication1.form1.button1_click(object sender, eventargs e) in f:\testing\selenium\windowsformsapplication1\windowsformsapplication1\form1.cs:line 32 @ system.windows.forms.control.onclick(eventargs e) @ system.windows.forms.button.onclick(eventargs e) @ system.windows.forms.button.onmouseup(mouseeventargs me...

java - RMI - Does client side have to have definitions of used classes on server side? -

i have simple client-server application using rmi. server side supposed generate sort of pdf (itext) file, , client should display it. while trying generate pdf on server side invoking proper method of own common remote interface, classnotfoundexception thrown on client side . caused by: java.lang.classnotfoundexception: com.itextpdf.text.exceptionconverter (no security manager: rmi class loader disabled) i thought, using rmi using black box - client invokes method, , receives response, without knowlage of how done, common class both sides remote interface. more on thought allow me shrink required dependencies on client side minimum. is mandatory client have server's libraries in classpath work? edit: strange fact there no exceptions cought , logged on server side. if add server side project dependency client, works fine. just guess here, it's not catching , handling exceptionconverter on server side , it's propagating client has no definition it. ...

Python 3.3 Writing A String From A List To A txt File -

i trying write string list text file on new lines the string stored in list follows name:emailaddress:mobilenumber i have repr in class prints out readable string screen if user wants print contacts screen print follows: name - email address - mobile number i can write text file name - email address - mobile number but want write text file follows: name email address mobile number i'm not sure how strip out "-" the code have far follows: file = open("staffdata.txt", "w") contacts in stafflist : file.write(str(contacts) + "\n") file.close() any guidance me appreciated if understood correctly, like: with open("staffdata.txt", "wt") file: contacts in stafflist : file.write("\n".join(str(contacts).split(' - ')) + "\n") edit: according last question update, every field goes in different line

Changing ruby version disables rails and bundler -

i'm following along michael hartl's r-o-r tutorial. having hit problem, got advice on grab hartl's reference code github, i've done. however, when following instructions reference code set in tmp directory, can either rbenv version 2.1.1, in case conflict gem file, or go ruby version 2.0.0-p451 in gem file, in case neither bundler nor rails run. following (for example) - dans-macbook-air:sample_app_rails_4 dan$ rails ruby version 2.1.1, gemfile specified 2.0.0 dans-macbook-air:sample_app_rails_4 dan$ rbenv local 2.0.0-p451 dans-macbook-air:sample_app_rails_4 dan$ rbenv rehash dans-macbook-air:sample_app_rails_4 dan$ bundler install rbenv: bundler: command not found `bundler' command exists in these ruby versions: 2.1.1 dans-macbook-air:sample_app_rails_4 dan$ i change ruby version in gemfile, i'm trying track down bug want replicate original exactly. thanks reading - ideas? when installed rails etc, working ruby 2.1.1 - has caused problem? ...

android - Get standard layout attributes -

i extended class imageview , added custom parameters. succeed these custom parameters code, using method context.gettheme().obtainstyledattributes() . what need access standard parameters of imageview object, such android:src , android:background . know exist class android.r.styleable.* use parameters, class has been deprecated (and not visible anymore). can access android parameters? while i’m not sure how extract parent values typedarray , you’re able access them appropriate getters, e.g.: public class myimageview extends imageview { public myimageview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); final typedarray array = getcontext().obtainstyledattributes(attrs, r.styleable.whatever); try { // custom attributes here } { array.recycle(); } // parent attributes final drawable background = getbackground(); final drawable src = getdraw...

java - Having issues with Handler in Android -

i creating handler reason if statement not trigger . log printing out correct value right before if statement . mhandler = new handler() { @override public void handlemessage(message msg) { string s=(string)msg.obj; s = s.trim(); log.v("mhandler reply", s); if(s == "ok"){ dialog.dismiss(); } } }; here log 03-24 09:02:53.707: v/mhandler reply(7331): ok why not working? use equals() method instead of == operator string comparison follows... if(s.equals("ok")){ dialog.dismiss(); } to more information check how compare strings in java?

javascript - Dojo: adding a button dynamically -

i'm trying add dijit button node failing error: failed execute 'appendchild' on 'node': new child element null. the code is var output = dom.byid(this.baseclass + 'displayvalues'); var btndelete = new button({ label: "delete" }, "btndelete"); btndelete.startup(); domconstruct.place(btndelete, output); the output element valid can add bunch of span tags if want same sort of code i can add buttons kind of code var node = domconstruct.todom('<li>' + name + '|' + value + '<button type=\"button\" onclick=\"this._removeitem(\'' + name + '\');\">x</button></li>'); but in case can't find on click method this, parent or no modifier. in case document says not kind of thing because of memeory leaks does have pointers might going wrong. many help second argument button constructor may either id of html element, or domnode objec...

javascript - Hiding data that's currently in an element -

i have table posts display info following query: select post_id posts i put of these results html elements this: <?php echo '<div class="result" id="' . $post_id . '"></div>'; ?> i don't want $post_id public (since it's being put id), need able post_id when clicks .result div use show more data when clicked on through javascript , php: $(document).on("click", ".result", function(event) { event.preventdefault(); $.ajax({ url: 'get_more_info.php', type: 'post', data: { post_id: $(this).attr('id') }, success: function(data) { console.log(data); } }); }); how can keep post_id hidden public, when clicks on .result element? you can keep array of id's in session variable , choose on server side based on position of clicked div in general parent (e.g. ajax sends position of generated div , ...

ios - How can I add default left arrow in leftBarButtonItem? -

i used third party code (menu) in application change navigation controller button title. therefore used code this: self.navigationitem.hidesbackbutton = yes; self.navigationitem.leftbarbuttonitem = [[[uibarbuttonitem alloc] initwithtitle:@"geri" style :uibarbuttonitemstylebordered target:self action:@selector(mycustomback)] autorelease]; this code work fine there no default left arrow image in ios 7, rectangle button created in ios 6. how can add default left image (not custom) in button? you need own arrow image. create regular uibutton custom style , background image (arrow) set action, create uibarbuttonitem , put button custom view;

android - How to display total day count and set default? -

i give total 10 days.i need result today count 10, tomorrow reduce 1 day show count 9,hereafter regularly reduce values 1. i tried display default day count, can't idea, can .pls give ideas how viewed day count. save "today + 10" in sharedpreferences. @ every run, current day , subtract value saved.

How Could I transform XML into XSL without getting error, using JAVA xml API -

i tried convert xml file html using xslt format got error rror: 'namespace prefix 'vuln' undeclared.' fatal error: 'could not compile stylesheet' the xml file started <?xml version='1.0' encoding='utf-8'?> <?xml-stylesheet type="text/xsl" version ="2.0" href="nvdxslt.xsl"?> <nvd xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xmlns:scapcore="http://scap.nist.gov/schema/scap-core/0.1" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" > <entry id="cve-2007-5333"> <vuln:vulnerable-software-list> <vuln:product>cpe:/a:apache_software_foundation:to...