Posts

Showing posts from April, 2011

string array loop print value null java -

i have instantiated string array containing 10 strings. want ask user enter subject name until 10 strings finished, or if user enters "q" quit. once happens, string array elements should printed via printarray method. have far, "null" value displayed each value after "the array elements:" make total of 10 strings. happens if enter "q" after few entries , not ten. i'd rid of "null" values , if user doesn't enter "q", after 10th entry, should display 10 arrays. { // instantiate string array can contain 10 items. string[] array = new string[10]; // read names of subjects array // , count how many have been read in. // there may fewer 10. scanner input = new scanner(system.in); system.out.println("please enter subject name or enter q quit: "); string subject = input.nextline(); int i=0; while (!"q".equals(subject)) { array[i]=subject; i...

ios - Keep incresing memory allocation -

Image
in ios app implemented save videos web. keeps increasing memory usage when downloading videos. have inspect using profile in xcode , saw malloc getting increase per video. not familiar profile stuff. have released receiveddata nsmutabledata variable. - (void) connectiondidfinishloading:(nsurlconnection *)connection { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectry = [paths objectatindex:0]; nslog(@"succeeded! received %d bytes of data",[receiveddata length]); [uiapplication sharedapplication].networkactivityindicatorvisible = no; nsstring *filename = [nsstring stringwithformat:(@"video_%@.mp4"),videourl]; [receiveddata writetofile:[documentsdirectry stringbyappendingpathcomponent:filename ] atomically:yes]; receiveddata = nil; [receiveddata release]; progress.hidden = yes; } app getting down performance. how can fix issue. you have not re...

php - Nginx replace REMOTE_ADDR with X-Forwarded-For -

i quite new nginx, , seems confusing. have server setup perfectly, problem is, since server protected using http proxy; instead of logging real users ip's, it's logging proxy server ip. what tried doing setting $_server['remote_addr']; $_server['x-forwarded-for']; i'm getting undefined index error, i'm guessing have define x-forwarded-for in nginx? not aware how so, have simple setup, it's nginx php. nothing more, nothing less. i've searched on web, can't find information friendly understand. i have access source code, if helps. i've tried many solutions, no avail. the correct way of doing setting real_ip_header configuration in nginx. example trusted http proxy ip: set_real_ip_from 127.0.0.1/32; real_ip_header x-forwarded-for; this way, $_server['remote_addr'] correctly filled in php fastcgi. documentation link - nginx.org

https connection doesn't close java EE -

hello developoing java ee project want have https connection @ registration pages. configured editing server.xml file accordingly tutorials found , works fine. problem won't close. if open page https triggered pages opened after https instead of http? normal way https behaved or doing wrong? heres's content related server.xml: <connector sslenabled="true" clientauth="false" keystorefile="c:\users\mario\.keystore" keystorepass="123456" maxthreads="150" port="8443" protocol="http/1.1" scheme="https" secure="true" sslprotocol="tls"/> and here web.xml of project <security-constraint> <web-resource-collection> <web-resource-name>viewpoint secure urls</web-resource-name> <url-pattern>/user/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confiden...

javascript - How to send parameters from ajax to servlet -

i trying add 2 numbers using servlets , ajax/javascript. getting java.lang.numberformatexception: , values null. can know how pass parameters ajax servlet. sumwithajaxservlet.java public class sumwithajaxservlet extends httpservlet { protected void dopost(httpservletrequest request,httpservletresponse response)throws servletexception,ioexception { printwriter out = response.getwriter(); system.out.println("n1 : "+request.getparameter("n1")); system.out.println("n2 : "+request.getparameter("n2")); int num1 = integer.parseint(request.getparameter("n1")); int num2 = integer.parseint(request.getparameter("n2")); out.println(num1+num2+""); } } index.jsp <script type="text/javascript"> function calc() { var xmlhttp = new xmlhttprequest(); var value1 = document.getelementbyid("n1...

javascript - Stop event propagation for multiple inline functions JS -

i have type of code : <button onclick="fn1();fn2();fn3()">clic</button> i test in fn1 , if true, don't want fn2 , fn3 called. used event.stoppropagation() in fn1 (in cross-browser manner , passing event function) others functions called anyway. can ? try this: <html> <head> <script> function fn1() { alert('fn1()'); return false; } function fn2() { alert('fn2()'); return true; } function fn3() { alert('fn3()'); window.location.assign("http://www.google.com"); } </script> </head> <body> <button onclick="fn1()&&fn2()&&fn3()">click</button> </body> </html> all functions should return boolean use logical operators && inside onclick <button onclick="fn1()&&fn2()&&fn3()">click</button> as can see ...

spring - Bootstrap Popover Button Does Not Display in IE 8 -

there countless issues bootstrap (in case, 2.3.1) components utilized in older versions of ie. issue has whole bunch of other potential wrenches culprit in app environment: jquery + bootstrap known conflicts, java using spring framework, freemarker templates, &c., &c. but issue trying 1 button on bootstrap popover display in ie, , not, though there no issues in chrome, firefox, &c. (i know, shocking, right?). have freemarker template calling data-content populate popover on link, popover 2 <a> tags class of btn : <li class="popout document-toc" id="document-toc"> <a class="reader-sprite toc pop-right" href="#" title="table of contents &amp; notes" data-content="<a href='#' class='btn btn-inverse contents'> <@spring.message "reader.actionbar.toc.contents"/></a> <a href='#' class='btn btn-inverse notes'> <@spring.me...

io - Reading from a Reader multiple times -

i'm building simple caching proxy intercepts http requests, grabs content in response.body, writes client. problem is, read response.body, write client contains empty body (everything else, headers, written expected). here's current code: func requesthandler(w http.responsewriter, r *http.request) { client := &http.client{} r.requesturi = "" response, err := client.do(r) defer response.body.close() if err != nil { log.fatal(err) } content, _ := ioutil.readall(response.body) cachepage(response.request.url.string(), content) response.write(w) } if remove content, _ , cachepage lines, works fine. lines included, requests return , empty body. idea how can just body of http.response , still write out response in full http.responsewriter ? you not need read response second time. have data in hand , can write directly response writer. the call response.write(w) writes response in wire format server...

spring integration - disable Expiring MessageGroup with correlationKey log -

is there way disable log? ask because casusing huges log files 2014-09-19 09:26:12,217 info abstractcorrelatingmessagehandler:571 - expiring messagegroup correlationkey[xxxxx] thanks in advance! guzmán the short answer. should specify lower logging level category: log4j.category.org.springframework.integration.aggregator.abstractcorrelatingmessagehandler=warn

Having Trouble Deleting a Value from a Collect_Select box in Rails 3.2 -

i trying implement delete button/link on views/admin_lookups/index.html.erb page. i able create new value , save category list , category collection_select box . can't delete work though. i've gotten routing errors template errors. application contains admin_lookup model , category model here code far: views/admin_lookups/index.html.erb <%= form_for @admin_lookup |f| %> <div class="field"> <%= f.label(:category_id, :class => "control-label") %> <div class="controls"> <%= f.collection_select(:category_id, category.all, :id, :name, prompt: true) %> </div> </div> <% end %> <% @categories.each |category| %> <ul id="category"> <%= category.name %> </ul> <% end %> <%= form_for @category |f| %> <%= f.label :name, "new name" %><br> <%= f.text_field :name %> <%= f.submit %...

angularjs - Angular JS filtering out used ids from a separate array -

i've got object of articles contain articles on site id in ng-repeat. have array inside products object of attached articles id in repeat. trying show articles not attached product. not sure how iterate on arrays , find matches , exclude them returned object. https://gist.github.com/irthos/0565c66be0ab992adc0a is there way can ng-repeat="article in articles | (except when product.articles.$id === article.$id)"? var app = angular.module('app', []); app.controller('mainctrl', function($scope) { $scope.name = 'world'; $scope.search = 1; $scope.familes = [{ id:1, name: "kruders", kids: [ { name: "zoe" } ] }, { id:2, name: "halifax", kids: [ { name: "mike" } , { name: "jim" } ] }, { id:3, name: "judes", kids: [ ] }] }); <html ng-app="app"> ...

algorithm - Big Omega Analysis -

i've been struggling understand best possible running time of this: for t = 1 n sum = 0 = 1 t sum = sum + x[i] i understand first loop go n times. it's inside loop struggle with. inside loop go n(n+1)/2 first time n(n+1)/2 -1 next time. i'm not sure how translate best running time. i use push in right direction if possible. thank you! in order visualize this, take approach of imagining area filled squares or volume filled dice in more complex cases. each square represents atomic step. steps of iteration of the outer loop put on same row. case, looks this: t=1 # t=2 ## t=3 ### t=4 #### t=5 ##### as can see, these form triangle, who's height n , who's width n. if count squares (n * (n + 1) / 2) have number of iterations of inner loop. multiplying , dropping irrelevant terms gives complexity θ(n*n).

datetime - Change Linux Time to trick System Uptime -

i'm trying test software out, , need have server uptime @ 100 days. current server uptime 3 hours. changed system time using following command date -s "27 feb 2015 12:00:00" and used date command verify time had changed: fri feb 27 12:08:40 cdt 2015 but when type uptime still shows 12:00:51 3:45, 1 user, load average: 0.03, 0.06, 0.05 is there way uptime change other wait until feb of next year? just backup , replace /usr/bin/uptime own script show 100 days uptime.

django - what's wrong with my urls.py in this example? -

i installed userena, , had example working tutorial, added in single line in urls.py, i'm getting error. in example below, added line mapping home function views.py now issue i'm having when go 127.0.0.1/8000, typeerror: string not callable, oddly, if go accounts/signup or accounts/signin, getting template should appearing if go 127.0.0.1/8000. from django.conf import settings django.conf.urls import patterns, include, url django.conf.urls.static import static django.views.generic import templateview accounts import views django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r"^$", 'home'), url(r'^admin/', include(admin.site.urls)), (r'^accounts/', include('userena.urls')), ) here accounts/views.py from django.shortcuts import render django.http import httpresponseredirect def home(request): return render('homepage.html') you need remove quotes in url , imp...

CSS - HTML Text is highlighting where it shouldn't be -

so i'm working on website scratch, put online see issue. basically, when aim cursor towards logo, if aim right of it raise opacity of logo too. want logo brighten when hover on brightens when put mouse anywhere on navbar. thank help! site: http://www.saylorstudios.com/ html: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>saylor studios</title> <link rel="stylesheet" href="css/normalize.css" media="all" rel="stylesheet" type="text/css"/> <link href='http://fonts.googleapis.com/css?family=josefin+sans:300,400,600,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css"/> </head> <body> <div class="background-canvas" style="height: 825px"> ...

osx - run Terminal script that executes one command and while that command is running, opens a new tab and runs another command -

at moment making java application. test have run server , client. so want run using bash script: #!/bin/bash clear gradle runserver osascript -e 'tell application "terminal" activate' -e 'tell application "system events" tell process "terminal" keystroke "t" using command down' gradle runclient problem : server when run does not end until close game, next 2 commands will not execute . how can run them concurrently/simultaneously ? run server in background, kill when script done. here’s example simple http server , client. #!/bin/bash date > foo.txt python -m simplehttpserver 1234 & server_pid="${!}" # automatically terminate server on script exit trap 'kill "${server_pid}"' 0 1 2 3 15 # wait server start while ! netstat -an -f inet | grep -q '\.1234 '; sleep 0.05 done # run client curl -s http://localhost:1234/foo.txt running in tab gets lot trickier; int...

javascript - How to unload jQuery plugins after window resize? -

i have 2 jquery plugins navigation menu, 1 smaller screens , 1 bigger screens, used code: if (screen.width < 1024) { $(document).ready(function() { $("#my-menu").mmenu(); $("#my-button").click(function() { $("#my-menu").trigger("open.mm"); }); }); }; it works @ load page, when resize browser doesnt work, example have put browser size @ smaller 1024px, , when make bigger doesnt stop plugin , when im @ bigger 1024px loads menu plugin bigger screens, when resize browser still working, since bigger screen plugin has not fire function , works automatically. is there way unload plugins @ window resize not while resize, when resizing it's finished (for bigger screen's menu plugin way dont load in smaller screens)? you should use $( window ).resize(function() { //your code here }); full documentation

c# - How to assign model validation error to a key -

in same way can add model validation within controller: modelstate.addvalidationerror([key], "this error message") can add error within model validation using annotations? // demonstration purposes [required(errormessage = "this error message"), adderrormessagetokey = [key]] public string username { get; set; } sometimes it's not appropriate add error message particular property. in application wish show 1 error message. you can put helper every property in viewpage . @html.validationmessage("customerror") and in controller: use tempdata in actionresult tempdata["customerror"] = "this error message";

php - symfony js file URLs without assets/compile for development -

i'm working on symfony2 project , js , css files served compiled version under /assets/compiled/frontend_site_2.css /assets/compiled/frontend_jscript_2.js , actual version of these files under src\projectname\bundle\webbundle\resources\assets\js\jscript.js src\projectname\bundle\webbundle\resources\assets\css\site.js i want view render these urls instead of compiled versions, right 've dump these files running cmd php app/console assetic:dump --watch don't want run command after every single modication, possible? frontend/javascript_block.htm.twig file {% javascripts output='assets/compiled/frontend.js' '@projectnamewebbundle/resources/public/js/jscript.js' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} thanks in dev mode can put list of js files want include in 'javascripts' block, this: {% javascripts '@yourbundle/resources/public/path/to/your_js...

qt - Issue with Focusing the Widget in Touch Screen -

i have qwidget contains line edits. have pop new numpad widget when line edit gets the focus. when click on numpad widget, focus has remained in line edit widget. tried using bool numpadwidget::nativeevent(const qbytearray &eventtype, void *message, long *result) { #ifdef q_os_win if(eventtype == "windows_generic_msg") { const msg *msg = reinterpret_cast<msg *>(message); if(msg->message == wm_mouseactivate) { *result = ma_noactivate; return true; } } #endif return false; } this working fine mouse clicks of numpad widget, using touch screen. when touch numpad widget, there flickering ( title bar flashing effect) on lineedit widget. can please tell me macro have use block focus of widget on touch screen. i tried using wm_touch macro results in no proper output. please help… thanks n1ghtlight reply. tried using wm_gesture mess...

c - what is added first '\n' or '\0' -

when working of character strings. have this: #include <stdio.h> #define maxline 1000 main(){ int c; int i=0; char s[maxline]; while(c=(getchar()) !=eof) { s[i] = c; ++i; } } i want ask after write hello , hit enter break line '\n' adds first after character stream or null terminating character i.e. '\0' visually 1 correct representation of what's happening: (1) hello\n\0 or (2) hello\0\n the way code written, there no nul character added s . since reading input 1 character @ time, if want s nul-terminated you'll need add nul yourself.

javascript choose one date and next automatic set with 3 months diffrence -

please send me suggestions , link related query. i'm newbie in javascript or don't know start. //javascript codes use momentjs when working dates in javascript.. lightweight. http://momentjs.com/ so date 3 month ahead current date pretty easy moment. moment().add(3, "months")

Developing a Chrome Desktop App -

i tutorial on building chrome desktop app. i found ones chrome extensions, chrome apps don't redirecting website - want app any.do, google keep, sunrise calendar: apps work without chrome , in different window, hope can make 1 html-css-js. do know can find documentation that? thanks!! this called "packaged app", , called "chrome app", opposed what's called "hosted app" (link website). the main documentation here . note chrome apps have, in regards, more power, don't integrate browser extensions do. intended behave self-contained. don't work without chrome, have independent windows.

python - PIL: Can't vertically align text accurately despite taking font into account -

i want create simple python script let's me create image file , place word dead-center on canvas. however, while can word align horizontally, can't center vertically. on macos btw. have tried far: import os pil import image, imagedraw, imagefont font_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'fonts') font = imagefont.truetype(os.path.join(font_path, "verdana.ttf"), 80) w, h = (1200,200) msg = "hola" im = image.new("rgb",(w,h),(255,255,255)) draw = imagedraw.draw(im) w, h = draw.textsize(msg, font) draw.text(((w-w)/2,(h-h)/2), msg, font=font, fill="black") im.save("output_script.png", "png") i considered font in textsize calculation. word still appears 5-10% below middle. ideas? textsize seems return size of actual text , not of line. it's smaller ooo xxx ! i think should use 80 — size gave pil — height, although can't guarantee it's correct.

php - is it possible to replace different array value(s) with different keys from different array -

[1] => ooooooo [2] => ooooooo [3] => ooooooo [4] => ooooooo [5] => ------------empty [6] => ooooooo [7] => ooooooo [8] => ooooooo [9] => ooooooo [10] => ------------empty [11] => ooooooo [12] => ooooooo [13] => ------------empty [14] => ooooooo [15] => ooooooo replace array1 above: "------------empty" below array2, keeping keys of array1 [1] => xxxxx [2] => yyyyy [3] => zzzzz so asks me add explanation---a picture paint more thousand words(i believe?) heck should more. had wonderful time last christmas, hope did :) result this: maybe should it's necessity find , replace automaticlly--so no manual or individual inputs. each "---empty" possibly @ different position on every call [1] => ooooooo [2] => ooooooo [3] => ooooooo [4] => ooooooo [5] => xxxxx [6] => ooooooo [7] => ooooooo [8] => ooooooo [9] => ooooooo [10] => yyyyy [11] => ooooooo [12] => ooooooo [1...

html - Why are these divs not horizontally aligned? Why do they line break? -

this html: <div style="border:1px solid blue; margin: auto; height:250px; width:600px;"> <div style="border:1px solid red; height:50px; width:80px;"></div> <div style="border:1px solid red; height:50px; width:80px;"></div> <div style="border:1px solid red; height:50px; width:80px;"></div> <div style="border:1px solid red; height:50px; width:80px;"></div> </div> why red divs not in same horizontal row , how them in same row? ok, divs block elements , use divs containing menus. can add style property called display: inline-block inner divs, , if want divs centered inside container div can use text-align: center . work on type of block elements. <div style="border:1px solid blue; margin: auto; text-align:center; height:250px; width:600px;"> <div style="border:1px solid red; height:50px; width:80px; di...

algorithm - Get time complexity of the recursion: T(n)=4T(n-1) - 3T(n-2) -

i have recurrence relation given by: t(n)=4t(n-1) - 3t(n-2) how solve this? detailed explanation: what tried substituted t(n-1) on right hand side using relation , got this: =16t(n-2)-12t(n-3)-3t(n-2) but don't know , how end this. not can time complexity of recursion, can solve exactly. exhaustive theory behind linear recurrence relations , 1 called here specific case of homogeneous linear recurrence . to solve need write characteristic polynomial: t^2 -4t +3 , find it's roots t=1 , t=3 . means solution of form: t(n) = c1 + 3^n * c2 . you can c1 , c2 if have boundary conditions, case enough claim o(3^n) time complexity.

android - Query last rows from parse.com table? -

i trying query last 20 rows parse.com table. have followed tutorial , generated code below. code returning 20 rows table not last 20 rows. returns first 20 items. how retrieve last 20 rows? parsequery<parseobject> query = parsequery.getquery("activities"); query.setlimit(20); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> scorelist, parseexception e) { } }); it seems need different sort method on parsequery making. can order query results createddate field: // sorts results in descending order created date field query.orderbydescending("datecreated"); so, in code, like: //where "createddate", set name of created date field in table. parsequery<parseobject> query = parsequery.getquery("activities"); query.orderbydescending("createddate").setlimit(20); query.findinbackground(new findcallback<parseobject>() { public void done(list...

jquery - Using Regex with JqueryUI Validate -

i trying add regex validation jqueryui validator following guidance of jquery validate: how add rule regular expression validation? $.validator.addmethod( "regex", function(value, element, regexp) { var re = new regexp(regexp); return this.optional(element) || re.test(value); }, "please check input." ); and $("#textbox").rules("add", { regex: "^[a-za-z'.\\s]{1,40}$" }) the regex include ^(\d+(?:(?: \d+)*\/\d+)?)$ which can seen @ http://regex101.com/r/cb3fq1/2 when enter regex jquery, no entries pass. how entered $("#textbox").rules("add", { regex: "^(\d+(?:(?: \d+)*\/\d+)?)$" }) is because wrapping in string , syntac conflicting? inexperienced @ regex , not sure how go trouble shooting this. please advise me if see error is. thank you. you need double escape backslashes since you're entering regex string: $...

how can use category for post in to wordpress using c# -

hi program post wordpress using c# have problem. when post first on program 1 ok second time in have posted second post use 1 of first time category before have select. codes in category section same this: string[] category; private void btnsend_click(object sender, eventargs e) { int index = listbox1.selectedindex; if (index == -1) { messagebox.show("please select category"); } else { } see picture information

ruby - Installing a modified gem? ( install gem from custom github/branch globally) -

i'm new ruby , have searched , tried several gems read .doc & .docx files. yomu seems best it's super slow. seems due server mode. i've come across modification this. can't seem figure out how install modified yomu gem on original on system. you can set git , branch in gemfile gem (see documentation ) # gemfile gem 'yomu', :git => 'https://github.com/jeremybmerrill/yomu.git', :branch => 'feature/servermode'

linux - ELF files and additional symbols -

i'm reading elf file format , i've noticed small hello world test program written in c++ contains additional initialization in _start symbol: 0000000000400770 <_start>: ... 40077f: 49 c7 c0 60 09 40 00 mov $0x400960,%r8 400786: 48 c7 c1 f0 08 40 00 mov $0x4008f0,%rcx 40078d: 48 c7 c7 5d 08 40 00 mov $0x40085d,%rdi ... 40077f __libc_csu_fini . 4008f0 __libc_csu_init . 40085d main . shouldn't _start main ? why not? happen if removed both of calls 40077f , 40008f0 , replaced nop ? basically, significance of requiring libc? looking @ glibc source code : /* these functions passed __libc_start_main startup code. these statically linked each program. dynamically linked programs, module come libc_nonshared.a , differs libc.a module in doesn't call preinit array. */ void __libc_csu_init (int argc, char **argv, char **envp) { /* dynamically linked executables preinit array e...

ms access - SQL Show fields that match WHERE statement otherwise show the others -

these parameters working , can entries show match item 'dress shirt' don't know how show others if don't match 'dress shirt'. have been trying use and/or can't show right. "show lastname, firstname, phone , total amount of customers have had order item named "dress shirt". show lastname, firstname , phone of other customers. present results sorted lastname in ascending order , firstname in descending order." select lastname, firstname, phone, totalamount customer, invoice, invoice_item customer.customerid = invoice.customernumber , invoice.invoicenumber = invoice_item.invoicenumber , item ='dress shirt'; try this: select lastname, firstname, phone, totalamount customer inner join invoice on customer.customerid = invoice.customernumber left join invoice_item on invoice.invoicenumber = invoice_item.invoicenumber , invoice_item.item ='dress shirt' ; access might insist on parent...

mysql - How to group_concat() and group by with null values? -

i have 2 tables this: publications publications id | publications field id | publications description 1000 | 1 | john 1000 | 2 | 2014 1000 | 4 | aa@... 1000 | 6 | 123-456-789 id = 1000 means 1 book , detail description (author name, year, e-mail,tel) registry publications field id | component 1 | author name 2 | year 3 | date 4 | e-mail 5 | price 6 | tel registry means book's format table i want merge 2 tables this: publications id | publications description 1000 | john,2014,null,aa@..,null,123-456-789 null means book(id=1000) 's field id 3 , 5 null so, use left join: select registry.publications field id,component,publication...

Unable to resolve the error in IronPython script embedded in Spotfire -

Image
hi new python , spotfire. unable resolve below error. code import system system.io import filestream, filemode spotfire.dxp.application.visuals import tableplot spotfire.dxp.data.export import datawritertypeidentifiers import clr clr.addreference("system.windows.forms") system.windows.forms import savefiledialog savefile = savefiledialog() #gets file path user through filedialog savefile.filter = "xls format (*.xls)|*.xlsx|*.xls|*.xlsx" savefile.showdialog() savefilename = savefile.filename print "savefilename=", savefilename stream = filestream(savefilename, filemode.create) #export table data file viztable.as[tableplot]().exportdata(datawritertypeidentifiers.excelxlsxdatawriter, stream) stream.dispose() when run above code below error. system.missingmemberexception: 'nonetype' object has no attribute 'exportdata' the above code used export data excel sheet using spotfire tool. please suggest me viztable empty be...

Javascript profiling iOS 8 Safari -

i'm attempting fix performance issues in our html5 game under ios 8. i've got yosemite beta, , safari 8.0 on mac. seem have lost js profiling tool. according ios developer center: to start profiling manually, click record button in top right of profiles pane, , select start javascript profile in resulting menu. (from here ) on safari 8, don't menu option, starts recording timeline. has moved to? it seem if profiling has been replaced "records"-section provide of same info, although not of it. as mentioned in comments, in order find records section click timelines, javascript & events in timelines show "records" in lower left corner.

sql - find and replace from another table mysql -

i need find , replace multiplie strings table "phrases" using table "dict" i have code like: update phrases, dict set phrases.name = replace(phrases.name, dict.source, dict.translate) phrases.name <> replace(phrases.name, dict.source, dict.translate) pharses table example: id | name | .. | .. 1 | macbook wht comput | .. 2 | lenova blck god nb | .. dict table example: id | source | translate 1 | wht | white 2 | god | 3 | lenova | lenovo 4 | blck | black 5 | comput | computer 6 | nb | notebook i need phares this: id | name | .. | .. 1 | macbook white computer | .. 2 | lenova black notebook | .. it replace 1 string @ once in row, have 3-10 strings replace. how code can changed replace strings in rows? create function , use update create or replace function translate_phrases_name(phraseid numeric) returns character varying $body$ declare phrasesstring character varying; newphrasesstring character ...

Crashing bug in iOS8 with UICollectionview, related to UIApplicationAccessibility -

i have app displays uicollectionview on page, works fine in ios7 crashes hard in ios8 tracelog points uicollectionviewaccessibility , uiapplicationaccessibility, though have no code touches accessibility @ all. i have managed isolate problem , put small app reproduces crash here. http://github.com/beno/ios8bug i find hard comprehend code kind of glaring bug ship, looks did. have filed bug apple, no response far. more info or workaround appreciated. sample trace: thread 1queue : com.apple.main-thread (serial) #0 0x0343d385 in cfhash () #1 0x0109c264 in nskeyvalueaccessorhash () #2 0x03436373 in cfbasichashfindbucket () #3 0x0346294b in cfsetgetvalue () #4 0x0109f316 in -[nsobject(nskeyvaluecoding) valueforkey:] () #5 0x10ba246e in -[nsobject(uiaccessibilitysafecategory) safevalueforkey:] () #6 0x10d1f359 in -[uicollectionviewaccessibility _accessibilitydescendantelementatindexpathisvalid:] () #7 0x10d1f376 in -[uicollectionviewaccessibility _accessibilitydescendant...

paypal - Rest C# capture error response in Payment.Create() -

i'm following rest sample (paymentwithcreditcard) , can't figure out how actual error code. payment pymnt = new payment(); pymnt.intent = "sale"; pymnt.payer = payr; pymnt.transactions = transactions; try { apicontext apicontext = configuration.getapicontext(); payment createdpayment = pymnt.create(apicontext); catch (exception ex) { // how can error code?? } how can tie general exception list of error codes ( https://developer.paypal.com/docs/classic/api/errorcodes/ )? thanks.

node.js - Converting Gulp tasks into Npm's script -

i have been using gulp while , discovered way run of gulp tasks such browserify/watchify/less via package.json's scripts. example: "scripts": { "watch": "npm run watch-js & npm run watch-less & npm run watch-server", "watch-js": "watchify app/js/main.js -t -o static/bundle.js -dv", "watch-less": "nodemon --watch app/less/*.less --ext less --exec 'npm run build-less'" } since browserify/watchify/less native npm packages know how can reproduce/convert (without writing custom bash/zsh scripts) other gulp tasks such gulp-rev , gulp-s3 work npm's scripts ? you can call specific gulpfile tasks cli. throw npm scripts. tasks can executed running gulp <task> <othertask> . running gulp execute task registered called default . if there no default task gulp error. https://github.com/gulpjs/gulp/blob/master/docs/cli.md#tasks

vb.net - Get the text from a check box list -

i have check box list in winform . if check box list selected want value passed string: for integer = 0 cbxlstpancakes.items.count - 1 if cbxlstpancakes.getitemchecked(i) dim currentpancake string = cbxlstpancakes.selecteditem.tostring else 'do if not checked. end if next now i'm confused if you're using strings vs. bound datasource. datasource, give 1 of these try. if care checked items, it's little easier: '=== if care checked items (assuming used databound control) each dr datarowview in cbxlstpancakes.checkeditems dim currentpancake string = dr.item(0) '--> todo: correct column datasource messagebox.show(currentpancake) next if care both checked , unchecked items, should able access them way (should work either bound or unbound): '=== if care both checked , unchecked items integer = 0 cbxlstpancakes.items.count - 1 if cbxlstpancakes.getitemchecked(...

objective c - How can I detect a simulated iOS device's screen size? -

how can detect simulated device's screen size , device name when app running in simulator? i'm simulating iphone 6 & 6 plus on ios 8. answers have tried return "simulator" device name, https://github.com/duhovny/devicehardware , , similar ones. thanks! the following returns cgrect holding size of device's screen in points. [[uiscreen mainscreen] bounds]; note following return size of screen without status bar. try think of frame rectangle application's window. [[uiscreen mainscreen] applicationframe];

c++ - const FILE*& getSequenceFilePointer() const; ECLIPSE -

in .h file .cpp program have following. file *sequence_file_pointer_; //holds file pointer file itself told eclipse generate getters , setters , interesting result. const file*& getsequencefilepointer() const; after thought knew pointers addresses , constants, see them give me this. understand constant on left return constant file pointer, don't understand constant on right , ampersand between file* , getsequencefilepointer() . help? class configuration { public: const file*& getsequencefilepointer() const; private: file *sequence_file_pointer_; //holds file pointer file } they taught me use ampersand if needed reference only, not copy, classes/structures. when want return class, int or whatever, copied stack, , can in other function. if want give reference only, example did not create object needed returned within function, pass 4 or 8 bytes, doesn't have copy bunch of memory. so bit weird. seems bug. pointer atomic (it's unsigned lon...

asp.net - update panel not binding data -

i have gridview when click on cell populates gridview sessions parameter passed gridview1 gridview2 placed update panel gets parameter gridview1 updates rebind gridview2 gridview not rebinding when updated <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <ig:webdatagrid id="webdatagrid2" runat="server" width="400px" autogeneratecolumns="false" datasourceid="sqldatatesting2"> <columns> <ig:bounddatafield datafieldname="pressname" key="pressname"> <header text="pressname" /> </ig:bounddatafield> <ig:bounddatafield datafieldname="minwidth" key="minwidth"> ...

postgresql - Get all Rails records from an array of IDs -

i have array of record ids ["303", "430", "4321", "5102"] . want records match these ids, using sql: acceptable_ids = ["303", "430", "4321", "5102"] @users = user.where("is_awesome = true , id in acceptable_ids) gives error: activerecord::statementinvalid (pg::syntaxerror: error: syntax error @ or near "[" what correct way write query users ids match acceptable_ids ? note: i aware of user.find(acceptable_ids) , can't use since constructing sql query select, where, , join clauses. you this. @users = user.where("is_awesome = true , id in (#{acceptable_ids.join(', ')})") i'm sure i've seen simpler way can't recall @ moment... above should work. edit however, can see vociferous comments not popular answer, should @ of alternatives linked , listed, e.g. # raise exception if value not found user.find( [1,3,5] ) # not raise excep...

java - "no viable alternative at input n" and "mismatched input" -

i have following class public class droolsobjectrule { private string backend; private long time; private long avgtime; private boolean allow=true; private string message; //set //get } my rule rule "rule_3_increment_more" salience 3 when $drol: droolsobjectrule(backend == "ad1" && (2 * $drol.avgtime) > $drol.time) [this line 33] $drol.setmessage("rule 3"); end when run code following error caused by: java.lang.illegalargumentexception: [33,48]: [err 101] line 33:48 no viable alternative @ input '2' in rule "rule_3_increment_more" in pattern droolsobjectrule [33,79]: [err 102] line 33:79 mismatched input ')' expecting '(' in rule "rule_3_increment_more" in pattern droolsobjectrule in pattern $drol.time any idea? the rule works correctly in 5.3.0, 5.6.0, 5.5.0, 6.0.0 , 6.1.0. if use older version, stick legac...

java - HashMap - getting all the values associated with a key -

i created hashmap each key contains arraylist value. i'm having trouble understanding how fetch arraylist associated key , values stored in it. see below error getting when running program. import java.io.bufferedreader; import java.io.filereader; import java.io.ioexception; import java.util.arraylist; import java.util.hashmap; import java.util.iterator; import java.util.scanner; public class flights { private hashmap<string, arraylist<string>> flights = new hashmap<string, arraylist<string>>(); private void readflights(string filename) { try { bufferedreader bf = new bufferedreader(new filereader(filename)); while (true) { string line = bf.readline(); if (line == null) { break; } if (!line.isempty()) { string fromcity = line.substring(0, line.indexof("-")); string tocity = line.substring(line.indexof(">") + ...

qt - How to update uic? -

Image
i'm using on linux qt user interface compiler version 4.7.4 with but when try use theme icon like here errors uic: error in line 366, column 37 : unexpected attribute theme file 'textfinder.ui' not valid i read problem during conversion xml files generate h files. i guess updating fix this. help? qt 4.7.x doesn't support icon themes. your options are: remove theme gui, or upgrade qt 4.8.6 if maintaining old project. (however, if starting new project, should upgrade qt 5.3.2 instead)

How to Get Buffer for Road in Arcgis Android? -

Image
i developing 1 application using arcgis . here want implement buffer both point , line segments (road). here buffer point using method geometryengine.buffer(geometry1,mmapview.getspatialreference(), meters, null) where road if single segment able draw buffer.i unable draw buffer multiple segments. please give me solution this.i want my code polygon = geometryengine.buffer(geometry1, mmapview.getspatialreference(), meters, null); withingeometry = geometryengine.project(polygon, mmapview.getspatialreference(), mmapview.getspatialreference()); simplefillsymbol sls = new simplefillsymbol(color.transparent); sls.setalpha(75); graphic graphics= new graphic(withingeometry,sls); buffergraphiclayer.addgraphic(graphics); mmapview.addlayer(buffergraphiclayer); there 2 options should produce result want, both involving geometryengine.union(geometry[], spatialreference) method...

list - c# How to iterate through the file system and assign numbering -

i have problem doing head in. i want iterate through local pc folders, including directories, , calculate numbering system against each folder in file system hierarchy. the root folders should calculate 1,2,3 etc. if there 3 sub-folders in folder 1 calculated numbers should be: 1.1, 1.2,1.3 if there 3 sub-folders in sub-folder above calculated numbers should be: 1.1.1, 1.1.2, 1.1.3 if there 3 sub-folders in folder 2 (a root folder) calculated numbers should be: 2.1, 2.2, 2.3 or expressed in way: 1 root folder 1.1 root sub folder 1 1.1.1 sub folder 1.1.2 sub folder 1.2 root sub folder 2 1.2.1 list item 1.2.2 list item etc. etc. this logic should applied folders , sub-folders. output example 1.1.1 | "c:\root\folder1\folder1\" what have far appears work ok in situations can fail in other situations: private string rootpath = @"c:\folderhierarchy\"; private string foldersequencecountbase = ""; priv...

html5 - Cross-browser datepicker format in asp.net mvc -

Image
to chrome , other browsers support html5 date natively show datepicker need put these attributes on date property in model: [datatype(datatype.date)] [displayformat(applyformatineditmode = true, dataformatstring = "{0:yyyy-mm-dd}")] public datetime? { get; set; } for other browsers use datepicker jquery ui. i have set datepicker use dd.mm.yyyy format, dd.mm.yyyy. it works long users clicks field , chooses date, when there data in field server-side shown in yyyy-mm-dd format , not chosen default value when datepicker opened. how show dates in dd.mm.yyyy format when has sent server in yyyy-mm-dd format work native html5 datepicker? <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <link href="content/themes/base/jquery-ui.css" rel="stylesheet" /> <script src="scripts/jquery-1.10.2.js"></script> ...

shell - for loop splits double quoted word into two words if there is a space in between -

the following command works expected. $ in "foo bar" "baz qux"; echo $i; done foo bar baz qux i expecting output of following commands same. isn't. $ list='"foo bar" "baz qux"'; in $list; echo $i; done "foo bar" "baz qux" what can when iterate on $list , iterate twice, once "foo bar" , once more "baz qux" . please provide answers work on posix shells. going use concepts learnt answer in shell script. i suggest reading here document instead: list="foo bar baz qux" while read -r i; # quote parameter expansions, in case # starts or ends whitespace, or contains multiple runs # or whitespace, or pattern metacharacters * or ? echo "$i" done <<eof $list eof

php - zend left join count not working -

ia have problem count in multi joins $query = $this->select() ->setintegritycheck(false) ->from(array('u' => 'users')) ->join(array('c' => 'clients'), 'u.id = c.user_id', 'count(c.user_id) clientscount') ->join(array('emails' => 'u_emails'), 'u.id = emails.user_id', 'count(emails.user_id) emailscount') ->join(array('sms' => 'u_sms'), 'u.id = sms.user_id', 'count(sms.user_id) smscount') ->where('u.id=?', (int) user_id)->group('u.id'); i think can out of problem: $this->select() ->from(array('u' => 'users'), array( 'clientscount' => new zend_db_expr("(select count(*) clients clients.user_id = u.id)"), 'emailscount' => new zend_db_expr("(select count(*) emails emails.user_id...

php - Data not getting saved to Mysql database after adding a column -

i created simple registration form using tutorial since added column last name form not saving data in sql database here code files registration.php <html> <head> <title> registration form</title> </head> <body> <form method='post' action='registration.php'> <table width='400' border='5' align='center'> <tr> <td align='center' colspan='5'><h1>registation form</h1></td> </tr> <tr> <td align='center'>first name:</td> <td><input type='text' name='fname' /></td> </tr> <tr> <td align='center'>last name:</td> <td><input type='text' name='lname' /></td> </tr> <tr> <td align='center'...