Posts

Showing posts from March, 2014

c# - DataBinding of a ComboBox after InitializeComponent() -

i have 2 combobox on code: <combobox name="comboboxselectcamera" itemssource="{binding path=listcameras}" selectionchanged="comboboxselectcamera_selectionchanged" /> <combobox name="comboboxcities" itemssource="{binding path=listcities}" /> on window have code combobox understand path comes from: <window .... datacontext="{binding relativesource={relativesource self}}" .... > both combos binded 2 listes created on mainwindow : public mainwindow() { initializecitiescombo(); initializecomponent(); // initialize control checks cameras initializecameracontrol(); fillcameraproperties(); datacontext = this; } the first combobox list created before initializecomponent , when combo created, fills specific content. the second combobox list created after initializecomponent , because depend on object loads cameras, and, don't know if that's reaso

Exception encountered when trying to display the length of a string given by a user. MIPS -

i trying compute length of string given user. every time try run code, message "exception occurred @ pc=(a address) followed message :"bad address in data/stack read: (another address). know has stack can't figure out problem. code in mips bello , using qtspim. appreciated. sentence: .space 6 prompt: .asciiz "enter sentence. max 6 characters, plus terminator .\n" .text # start of code section main: # prompt displayed. li $v0, 4 # system call code printing string = 4 la $a0, prompt # load address of string printed $a0 syscall # call operating system perform operation; # $v0 specifies system function called; # syscall takes $v0 (and opt arguments) ##read string, plus terminator, sentence la $t0, sentence li $t0, 6 li $v0, 8 add $v0, $zero, $zero #initialize length 0 loop: lbu $s0, 0($t0) #load 1 characte

vb.net - make button wait for user input before continuing -

i’ve gotten spot of trouble , cant figure way out i’m trying click button , user type input in textboxs, 7 , 8, reuse textboxes 7 , 8 next 2 values, , once done line drawn… private sub button4_click(byval sender system.object, byval e system.eventargs) handles button4.click dim mypen new system.drawing.pen(system.drawing.color.red) dim formgraphics system.drawing.graphics dim x1 integer dim y1 integer dim x2 integer dim y2 integer x1 = textbox7.text y1 = textbox8.text 'clears textbox values... textbox7.text = "" textbox8.text = "" 'set focus textbox7... textbox7.focus() x2 = textbox7.text y2 = textbox8.text formgraphics = me.creategraphics() formgraphics.drawline(mypen, x1, y1, x2, y2) mypen.dispose() formgraphics.dispose() end sub at current textbox's need filled first before button clicked, want otherway around.. dose know how this? ussing vb.net...

node.js - How can I embed a CSRF token in a JavaScript file? -

i have node.js application in have implemented csrf. it's working fine, , when had javascript inline in jade file, used #{token} token javascript. however, i've moved javascript external files, , can't figure out simple way input csrf token code. how can so? you can implant token 1 dom element, say, hidden div. , use javascript element , read token.

javascript - Jquery for customized right click, in my application? -

in application need disable right click , did this. but need customized right click menu contains copy , paste options. is there way or plugin copy , paste options. good answers appreciated.

Jquery UI Tabs with ajax content: Hrefs not working. -

trying use ui tabs replace traditional links. have hit snag getting href attribute resolve specified url upon clicking tabs. below html: <div id = "tabs"> <ul> <li><a href = "#main" >main content</a></li> <li><a href = "<?php echo base_url.'inventory/list' ?>">list</a></li> <li><a href = "<?php echo base_url.'inventory/add' ?>">add</a></li> <li><a href = "<?php echo base_url.'inventory/edit' ?>">edit</a></li> </ul> </div> jquery: <script type="text/javascript"> $(document).ready(function(){ $('#tabs').tabs(); }) </script> html body: <div id = "main"> <?php $this->load->view($main); ?> </div> inspecting ui tabs using firebug shows e.g list

How to redirect localhost:9292/json to localhost:80/ using Nginx reverse proxy? -

server { listen 80; server_name localhost; location / { index index.html; root /users/lin/codes/js/emberjs/yeoman-ember/dist; } location ~* ^/json { root proxy_pass http://localhost:9292; } } the configure kinda works, pass localhost:9292/json localhost/json . but want localhost:9292/json 'localhost' localhost:9292/json/post 'localhost/post' i think need set root or rewrite, has idea? if want pass connections port 9092 80 listening wrong port. change port listening 9092: server { listen 9092; server_name localhost; root /users/lin/codes/js/emberjs/yeoman-ember/dist; location / { index index.html; } location ~* ^/json { proxy_pass http://localhost:80; proxy_set_header x-real-ip $remote_addr; } } try avoid use root inside location block, it's common pitfall explained

ruby array to javascript - Rails -

i trying pass ruby array js view ( js.erb format) doesn't work @ all. var array = "<%= @publishers_list %>"; the variable array set string array's values in it. is there way keep array format ? edit i realized because of array format. [{:label => "name1", :value => value1}, {:label => "name2", :value => value2}] i tried pass simple array like: [1,2,3] and worked fine. the question now: how can pass kind of array ? need keep these hashes in because want put source of jquery autocomplete. var array = <%= escape_javascript @publisher_list.to_json %>

Plone 4.1 commenting does not show up on SunBurst theme -

i have plone 4.1 plone.app.discussion = 2.1.5 , quintagroup.plonecomments. also, have several sites configured commenting globally on simple page. first 1 works should, commenting not show @ all. moreover, second 1 has sunburst theme , gues theme not include plone.comments viewlet, because when used @@manage-viewlets on first site, showed , when used on other 1 - no sign of plone.comments. how can enable viewlet?

c# - Efficient plain text template engine -

i have simple alert system grabs number on web, mix them pre-defined text template alert, , send clients. alert quite simple plain text, not expect other plain text, numbers, simple functions(such ifthenelse), quicker better. there existing open source solutions this? thanks! i use razor engine this. a templating engine built upon microsoft's razor parsing technology. razorengine allows use razor syntax build robust templates a simple example page: string template = "hello @model.name! welcome razor!"; string result = razor.parse(template, new { name = "world" }); and result hello world! welcome razor!

c# - Making graphic object selected -

hi want make graphic object "selected" after click on them. i tryied make selected line: else if (e.originalsource line) { linefocus = true; mojalinia = (line)e.originalsource; rectangle rect_1 = new rectangle { stroke = brushes.black, strokethickness = 1, fill = new solidcolorbrush(color.fromrgb(255, 255, 255)) }; rect_1.width = 6; rect_1.height = 6; canvas.setleft(rect_1, mojalinia.x1); canvas.settop(rect_1, mojalinia.y1); canvas.children.add(rect_1); rectangle rect_2 = new rectangle { stroke = brushes.black, strokethickness = 1, fill = new solidcolorbrush(color.fromrgb(255, 255, 255)) }; rect_2.width = 6; rect_2.height = 6; canvas.setleft(rect_2, mojalinia.x2);

ios - Customization of UIBarButtonItem and interface rotations -

there lot of talks customization of uibarbuttonitem custom view uibutton. it's quite clear. didn't find far though, , surprises me, there no mentioning custom uibarbuttonitems handle interface rotations - common behavior when rotate iphone, bar buttons squeezed vertically. however, if customize uibarbuttonitem in ordinary way (by calling initwithcustomview: method), stay non-squeezed after rotating landscape orientation. there workarounds that? well, i've found solution handling uiapplicationdidchangestatusbarorientationnotification in custom uibarbuttonitem class pretty decent.

Align the child views in center of the ViewPager android -

Image
i need set child view center of viewpager , show part of next , previous views current view sides(like current screen below 1). current view starting @ left side of viewpager(like expected screen below 2). how can achieve that? here code.. myviewpageradapter public class myviewpageradapter extends pageradapter { private activity mactivity; private int mpagecount; public myviewpageradapter(activity activity,int pagecount) { mactivity = activity; mpagecount = pagecount; } @override public int getcount() { return mpagecount; } @override public boolean isviewfromobject(view view, object obj) { return (view ==(view)obj); } @override public object instantiateitem(viewgroup container,final int position) { viewgroup viewgroup = (viewgroup)mactivity.getlayoutinflater().inflate( r.layout.item_view, null); viewgroup.setbackgroundcolor(randomcolor()); textview text

php - Datatables Serverside Processing with Column Filterting using Multiple Tables -

Image
i'm displaying record set using datatables pulling records 2 tables. table a sno | item_id | start_date | end_date | created_on | =========================================================== 10523563 | 2 | 2013-10-24 | 2013-10-27 | 2013-01-22 | 10535677 | 25 | 2013-11-18 | 2013-11-29 | 2013-01-22 | 10587723 | 11 | 2013-05-04 | 2013-05-24 | 2013-01-22 | 10598734 | 5 | 2013-06-14 | 2013-06-22 | 2013-01-22 | table b id | item_name | ===================================== 2 | timesheet testing | 25 | vigour | 11 | fabwash | 5 | cruise | now since number of records returned going turn big number in near future, want processing done serverside. i've managed achieve came @ cost. i'm running problem while dealing filters. from figure above, (1) column value in int ( item_id ), using small modifications inside while loop of mysql

android - Facebook Graph API request error when using HTTP POST / DELETE method -

Image
i'm developing android app integrated facebook sdk. first i'm fetching feeds of facebook page using graph api, working fine. want allow users & post comments against each feed. i'm using following code snippet like bundle parameters = new bundle(); parameters.putstring("access_token", access_token); string response = null; string id = <target feed id>; try { response = facebook.request(id+"/likes", parameters, "post"); } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } log.i("fb output", ""+response); but i'm getting nullpointerexception @ following line: response = facebook.request(id+"/likes", parameters, "post"); please note error occurs only when i'm using "post" or "del

php - get_post() with a specific class only - Wordpress -

i using wordpress cms site i'm building. the page template: <?php get_header(); ?> <!-- class here --> <div id="wrap"> <div id="content" class="column"> <?php if( have_posts() ): while( have_posts() ): the_post(); ?> <div class="post"> <?php the_content(); ?> </div> <?php endwhile; endif; ?> </div> <div id="sidebar" class="column"> <?php get_sidebar(); ?> </div> </div> </div> </div> &nbsp; <div> <?php get_footer(); ?> i need div class of " theslide " called before #wrap (class here) , not call again php follows. can 1 along lines of " get_post if class=theslide " ? thank you. you can use plugin add custom fields post http://wordpress.org/exte

How calculate bandwidth of the WiFi or WiFi signal strength using jquery or javascript -

hello want calculate bandwidth of wifi or wifi signal strength using jquery or javascript. know can calculate strength on server side code want calculate on client side. check website:: think suit wifi connection also http://www.wiseloop.com/demo/javascript-bandwidth-tester and fiddle http://jsfiddle.net/praveen16oct90/tefpc/115/ code this: function showresults() { var duration = (endtime - starttime) / 1000; //math.round() var bitsloaded = downloadsize * 8; var speedbps = (bitsloaded / duration).tofixed(2); var speedkbps = (speedbps / 1024).tofixed(2); var speedmbps = (speedkbps / 1024).tofixed(2); alert("your connection speed is: \n" + speedbps + " bps\n" + speedkbps + " kbps\n" + speedmbps + " mbps\n" ); }

apk size is too big due to adding images in all drawable folders android -

in application, there lots of images, not small button background images, full screen size images in application. due adding different sizes images in 4 drawable folders, application size increasing more expected 18mb due images. best way optimize taken care of not stretch images in screen sizes? know 9 patch image, how use full screen size images 9 patch images? it may best have separate apks each resolution. have @ multiple apk support : for example, can provide 1 apk supports small , normal size screens , apk supports large , xlarge screens.

spawn - Running / spawning commands vs files in c# -

i can in c# following: var pspawn = new process { startinfo = { workingdirectory = @"c:\temp", filename = filetorun, createnowindow = true } }; pspawn.start(); and works fine.... wondering if there way run command (ie: "dir /b") without having encapsulate in batch file? just start cmd.exe , pass arguments required var pspawn = new process { startinfo = { workingdirectory = @"c:\temp", filename = "cmd.exe", arguments ="/k dir /b" } }; pspawn.start(); i have added parameter /k leave command window open so, possible see output of command dir . of course think interested catch output of command. in case work this: stringbuilder sb = new stringbuilder(); var pspawn = new process { startinfo = { workingdirectory = @"c:\temp", filename = "cmd.exe", arguments ="/c dir /b",

javascript - Get child function name in parent function method -

function b extends a, how b function name in parent function a, when call parentmethod() on object of b child function object. function a() { this.parentmethod = function() { //alert('display b function name'); } } function b() { } b.prototype = new a(); var b = new b(); b.parentmethod(); simplest way is: function a() { this.parentmethod = function() { alert(this.constructor.name); } } function b() { } b.prototype = new a(); b.prototype.constructor = b; //add line. var b = new b(); b.parentmethod(); now when call parentmethod display b constructor name.

Firefox builtin pdf viewer doesnt show all characters -

i open pdf file firefox, , doesnt show characters (foreign characters arent shown). when highlight text , copy paste somewhere, shows characters. what causing , how can fix this? edit: after doing more research , testing, think firefox bug. downloaded pdf file firefox > opened on chrome = shows. downloaded pdf viewer addon firefox , viewed pdf file = shows. removed addon = nothing shows again. conclusion - firefox built in pdf viewer bug. try check encoding,maibe in utf-8 instead of latin-1 exemple

iphone - how to push and pop a view through appdelegate to specific place -

this question exact duplicate of: pop , push viewcontroller through appdelegate in ios i have problem in pop view. pop done when on view popped view buttons action disabled can please me. how can pop , push view specific place in ios. have 5 view controller. 1 view -> 2 view -> 3 view -> 4 view -> 5 view and want pop 5 view 2 view through appdelegate? - (ibaction)btnaddquotes:(id)sender { libraryvc *obj =[[libraryvc alloc]initwithnibname:@"libraryvc" bundle:nil]; [self.navigationcontroller poptoviewcontroller:obj animated:yes]; } if index fixed 2 can -(void)gotospecificcontroller { uiviewcontroller *destcontroller = (uiviewcontroller*)[self.navigationcontroller.viewcontrollers objectatindex:2]; [self.navigationcontroller poptoviewcontroller:destcontroller animated:yes]; } or can calculate index of destination controller , replace @ objectatindex method. edit wr

search - Not Getting Popular Searches In Magento Using Code -

how popular search terms on homepage ?? i have referenced following question : getting popular searches in magento so, have used same code given below : $searchcollectino=mage::getmodel('catalogsearch/query')->getcollection() ->setpopularqueryfilter() ->setpagesize($limit); they told using ->getitems() can search terms. but not getting code can be..?? how use code ?? i got top 5 popular search terms following code : $searchcollection = mage::getmodel('catalogsearch/query')->getcollection() ->setorder('popularity', 'desc'); $searchcollection->getselect()->limit(8); foreach ($searchcollection $item) { echo $item->getdata('redirect'); echo $item->getdata('query_text'); }

multithreading - How do I queue perl subroutines to a thread queue instead of data? -

background : in reading how multithread perl script, read ( from http://perldoc.perl.org/threads.html#bugs-and-limitations ) on systems, frequent , continual creation , destruction of threads can lead ever-increasing growth in memory footprint of perl interpreter. while simple launch threads , ->join() or ->detach() them, long-lived applications, better maintain pool of threads, , reuse them work needed, using queues notify threads of pending work. my script long-lived; it's pki ldap directory monitoring daemon running. enterprise monitoring solution generate alarm if stops running reason. script check can reach pki ldap directory, validate revocation lists on both. problem : can find on google shows passing variables (e.g. scalars) thread queue rather subroutine itself... think i'm not understanding how implement thread queue compared how implement thread (without queues). question 1 : how can "maintain pool of threads" avoid perl int

ms access 2007 - How to use 2 connection objects while importing data from one database to another in vb.net -

i using following code select 1 database , need insert database.. please suggest me code: code : 'connection original database have import dim constrorg string = "provider=microsoft.ace.oledb.12.0;data source=" + strpath dim conn_orgdb new oledb.oledbconnection(constrorg) 'connection database have import dim app_path = system.appdomain.currentdomain.basedirectory() dim constr string = "provider=microsoft.ace.oledb.12.0;data source=" + app_path + "mydb.accdb" dim cnnoledb new oledb.oledbconnection(constr) dim strselinv_one string = ("select * inv_one (docu_dt>=@stdt , docu<=@enddt) ") dim comm_inv_one oledb.oledbcommand = new oledb.oledbcommand(strselinv_one, conn_orgdb ) comm_inv_one.parameters.addwithvalue("@stdt", sttime) comm_inv_one.parameters.addwithvalue("@enddt", endtime) dr = comm_inv_one.executereader while dr.read = true dim strinsinv1 string = "insert i

css - Rotation error in overflow div IE 8 -

Image
i have div contains image have rotate whenever user click zoom bottom. once user click link, div holds image display in 100 z-index(to top). image has container in div when zooming in, scrolls bars appers(which means div holds image overflow:scroll;) but here problem: if user zoom image 300, scrolls activate but, once click rotate, x scroll doesnot appear, causes displaying part of image. if image'withd bigger div container, overflow:scroll, x scroll should let me scroll left or right see image entirely. here in-live example: here code: css: #img_container { overflow-x:scroll; overflow-y:scroll; position:relative; width:800px; height:500px; } /*the rotation code*/ #rotate_80deg { filter: progid:dximagetransform.microsoft.basicimage(rotation=1); } html: <div id="image-viewer"> <div id="image_container><img src="src..." /> </div>

csv - Working D3 And Crossfilter for generating graph -

i using jmeter performing load test on web site. , jmeter generates output in form of csv file. i want represent csv data in graph form. generating graph, teacher suggested using d3 , crossfilter. don't know these tools. can me understand how might use d3 , crossfilter creating graph csv file? here's tutorial on creating d3 graph csv file . more specific, you'll have ask more specific question.

c++ - msvcprtd.lib(MSVCP100D.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' -

i created vs 2010 win 32 program (operation system: win 8-64bit) then, tried convert win32 program in x64 doing this: configuration manager -> new solution platform (select x64) -> copy settings win32 the vs2010 created new x64 program based on previous win32 program. however, when tried compile , run x64 program, there single error: msvcprtd.lib(msvcp100d.dll) : fatal error lnk1112: module machine type 'x86' conflicts target machine type 'x64' by renaming both win32 version , x64 version of msvcprtd.lib, found program still using win32 msvcprtd.lib. i checked , found msvcprtd.lib in $(vcinstalldir)lib\amd64. moreover: library directories -> inherited values has included necessary directories (i think): $(vcinstalldir)lib\amd64 $(vcinstalldir)atlmfc\lib\amd64 $(windowssdkdir)lib\x64 i checked 3rd party libraries , dlls program using of x64 version. my question why program still using win32 msvcprtd.lib , how solve problem? in p

Converting PDF to JPG with Imagemagick is really slow after update -

i have several servers set using centos 5 (64bit) , default yum installed versions of ghostscript (v8.70) , imagemagick (v6.2.8) work , quick @ converting pdf files jpg previews. i have removed both im , gs on 1 of servers , installed latest versions ghostscript(v9.0.7) , imagemagick(v6.8.5) source , conversion speed has gone around 0.5 seconds 7.5 seconds same original pdf. i need able run later version of both able use inkcov device working out pages colour in multipage pdfs (up 200 pages). now assuming slowdown due compile options, can't believe later versions slower. have searched around try , find ways of optimising @ compilation stage (changing q8 rather q16 quality etc) nothing seems make difference. thanks

c# - My application will not automatically start with windows - what is wrong here? -

i using following code manage automatic startup of application. application has been set require admin privileges, , indeed, ask them. registrykey rkapp = registry.currentuser.opensubkey("software\\microsoft\\windows\\currentversion\\run", true); if (checkrunonstartup.checked) { rkapp.setvalue("myapp", application.executablepath.tostring()); } else { rkapp.deletevalue("myapp", false); } this not work on system have tested on, except development machine. doing wrong here? instead of writing reg keys create/delete shortcut app in windows startup folder. environment.specialfolder.startup return path. if dead set on reg key option here snippet of code per dotnetthoughts . seems main difference dropped .tostring(). private void registerinstartup(bool ischecked) { registrykey registrykey = registry.currentuser.opensubkey ("software\\microsoft\\windows\\currentversion\\run", true); if (ischecked) {

c# - Removing Duplicates "ABD" "BAD" "DAB" from a list of permutations -

i have rather large list of strings contains duplicates in sense if care if a,b,c in result, not order in. looked many other duplication removal solutions, typically work exact values(which understand since these elements aren't exact dups, more spurious or superfluous results.) have list , didn't create it, changing selection not option. simply sort elements within each item first. listofstrings.select(s => new string(s.orderby(c => c))).distinct().tolist(); you see mean - sort chars. i'll check syntax of momentarily..

c# - Is object eligible for garbage collection if it's created within using-statement and not explicitly bound to a reference? -

i have (illustration only) c# code: using( new system.io.memorystream() ) { system.threading.thread.sleep(1000); } note here memorystream created , not explicitly bound reference. unless there's special treatment because of using statement object has no references , collected before control leaves using statement , maybe before sleep() completes. is memorystream eligible collection before control leaves using statement? no, not. behind scenes, hidden reference memorystream has been created, still alive.

SQL - Change row/column structure of existing query -

i'm die hard excel vba fan , having make transition basic sql based piece of software. have managed adapt existing query needs (still not sure how !) further tweek :) the query is: parameters [date from] datetime, [date to] datetime, [site group] text; select contacts.name, dataprofile.date, dataprofile.totalunits (lookup inner join groups on lookup.lookup_id = groups.lookup_id) inner join (contacts inner join (points inner join dataprofile on points.id = dataprofile.point_id) on contacts.id = points.contacts_id) on groups.link_id = contacts.id (((lookup.lookup_name)=[site group]) , ((dataprofile.date) between [date from] , [date to]) , ((points.type)='electricity') , ((dataprofile.type)=0)) , contacts.group_1=[client group] order contacts.name, dataprofile.date; this produces list of daily totals site day , looks : site.......date.........value site 1....01/01/13...444.7 site 1....02/01/13...861.5 site 1....03/01/13...850.0 etc.

opengraph - og:site_name ignored for facebook comments plugin? -

i'm using facebook's comment plugin, , have point page open graph tags set up. when user makes comment on page using plugin, of og tags used facebook in wall post, except og:site_name, should go in caption of link instead domain of site appearing. example html: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title>my title</title> <meta property="og:type" content="article" /> <meta property="og:site_name" content="my site name" /> <meta property="og:title" content="my title" /> <meta property="og:url" content="http://www.example.com" /> <meta property="og:image" content="http://www.example.com/some_image.png" /> <meta property="og:description" content="this description" /> <meta pro

java - Primefaces Chat Application - web.xml Invalid content was found starting with element -

this question has answer here: cvc-complex-type.2.4.a: invalid content found starting element 'init-param' 2 answers i want implement pf 3.5 chat application on tomcat 7 server. have added dependencies: <dependency> <groupid>org.atmosphere</groupid> <artifactid>atmosphere-runtime</artifactid> <version>1.0.1</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.1</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-simple</artifactid> <version>1.7.1</version> </dependency> however, when implement web.xml : <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"

c# - How to enable autocomplete for a textbox when the autocomplete on form tag is off? -

i have following code snippet in master page (abc.master) <form id="form1" method="post" runat="server" autocomplete="off"> the above master page used number of user controls. on 1 of them want enable autocomplete 1 of textbox. want textbox show values user had entered in past. trying through : <asp:textbox id="textbox1" runat="server"autocomplete="on"></asp:textbox> which doesnt work me. tried autocompletetype not work. pointers appreciable. you can enable autocomplete page usercontrol call using below code. form.attributes.add("autocomplete", "on") you can put code on page load event.

Google autocomplete filtered by business type -

i trying use google maps api give me autocomplete find nearby bars typing in bar looking for. doesn't seem fall user stories of api. having problems figuring out combination of tricks need use accomplish this. the autocomplete function not have granular enough place types (establishment, geocode) filter bars predictions full of gas stations, law offices , graveyards. the nearbysearch granular enough filter type=bar cannot used autocomplete because name , keyword parameters exact matches. when search "craw" zero_results not "crawdaddy's". next thought predictions, radarsearch of same location applying type=bar filter , take predictions in radar results based on reference number. no go either radar search using different reference number autocomplete or not returning nearest type=bay location. so ultimately, asking on fools errand here or there someway implement autocomplete filtered business type? thanks, tal i'm sorry bearer of

java - AlertView that can be shown from background -

i have little problem alert view, idea when app starts, asks on background new data app, after receiving information alertview should shown if there new data. problem comes because alertview shown on main activity launched asynctask, if i'm in other activity, alert appear when come main activity , idea alertview displayed in whatever activity user in. my first thought context send asynctask problem i've tried using getapplicationcontext() app crashes in moment of creating alertview. i'm, looking way display alertview or equivalent on screen wherever on app, 1 have ideas? any idea appreciated you can use broadcastreceiver in every activity contineous monitor background service contineous whenever event occoured using broadcastreceiver display alertbox content received receiver.

import - Best way to export transactions from Rails App into QuickBooks -

i have rails app takes care of bank transactions us. our accountant wants automatically imported quickbooks pro (either online or desktop version). i've read web connector , transaction pro importer , feel don't have enough info make decision. i'd appreciate advice! thanks! for quickbooks windows: if you're developer, , you're comfortable developing soap components, web connector direction go you. there's pretty decent web connector ruby gems out there already: https://www.google.com/search?q=ruby+quickbooks+web+connector if you're not developer and/or don't want develop yourself, transaction pro makes things relatively easy import/export. for quickbooks online: for saas applications, quickbooks online apis good. non-saas applications, have use qbxml gateway quickbooks online, limiting sometimes. in particular scenario (you're not saas app allowing customers connect qb files app) you'd better off quickbooks windows.

internet explorer 8 - How to enable activex controls in ie using javascript -

is there way enable activex controls of internet explorer through javascript ,i searched internet cant find trusted resources , possible enable activex controls through javascript the source got can found here thanks in advance i don't think there way activate them via javascipt or that. think used security measure, i'm not sure. if @ msdn there solution: http://msdn.microsoft.com/en-us/library/ms537508(v=vs.85).aspx if dynamicaly add controls through javascript after dom loaded activated right away.

ruby - How resque checks when to run a job? -

i have found resque: https://github.com/elucid/resque-delayed and can see can schedule delayed job. question is, how check delayed jobs? if have 5000 delayed jobs in 1 month time, hope doesn't check every 10 seconds delayed jobs. so how being done? it not have check delayed jobs. maintains sorted set in redis, jobs being sorted scheduled time. see code at: https://github.com/elucid/resque-delayed/blob/master/lib/resque-delayed/resque-delayed.rb each time daemon awakes, first item of set needs checked (using zrangebyscore command). daemon fetches relevant jobs 1 one, until polling query returns no result, sleeps again. performance further improved fetching jobs n n. implemented using server-side lua script polling query: local res = redis.call('zrangebyscore',keys[1], "-inf", argv[1], 'limit', 0, 10 ) if #res > 0 redis.call( 'zremrangebyrank', keys[1], 0, #res-1 ) return res else return false end in 1 rou

c++ - multi thread programming - ACE_thread_t or ACE_Task -

i want write multi thread process (on linux) using ace. difference between using ace_task , ace_thread_t when implementing threads in c++ ace_thread_t low level handle. implementing multi threaded application using ace implement class derive ace_task or ace_task_base. see ace_wrappers/examples/threads or ace_wrappers/tests lot of examples how this.

postgresql - Rails 3 ActiveRecord save() Method and Autoincrement Primary Key Fields -

Image
i migrated rails site running on 2.2.2 rails 3.1. i noticed now, on rails 3 save() calls (inserts) used work in 2.2.2 don't in 3.1 the id field in database primary key has following properties: not null auto-increment now, when save() method runs on these tables, get: activerecord::statementinvalid (pg::error: error: null value in column "id" violates not-null constraint hmm looked @ generated sql save() creates , indeed it's including id field in column list , assigning nil: pg::error: error: null value in column "id" violates not-null constraint : insert "server_updates" ("action", "created_at", "field_number", "id", "status", "table_number", "value") values ($1, $2, $3, $4, $5, $6, $7) returning "id" so, question how activerecord not include id column when generates sql save() call? i don't want remove not null rule column nor want r

Usage of the C# var keyword -

this question has answer here: will using 'var' affect performance? 11 answers i confused usage var keyword in c# . know, var make code more easier read, speed , memory? a. var = 100; int b = 100; int c; c = 100; b. var lista = new list<obj>(); list<obj>listb = new list<obj>(); list<obj>listc; listc = new list<obj>(); which faster? there dependence on type? how memory allocated in both situation , when memory allocated? which faster? neither, they're same. there dependence on type? i'm not sure you're asking here, there's no difference between of code snippets once compiled, i'll go no. how memory allocated in both situation , when memory allocated? it's same of them. int example it's 32 bits cases. list example 3 allocate 1 word reference, plu

apache2 - Apache with mod_jk Tomcat change DNS Timeout (TTL) -

i'm using gslb app geo-distribution , load-balancing. the app apache --> tomcat througth mod_jk in workers.properties have this: worker.balancing.port=8009 worker.balancing.host =tomcats8009.gslb.domain.com worker.balancing.type=ajp13 worker.balancing.socket_timeout=5 if tomcat gslb (tomcats8009.gslb.domain.com) changes ip x.x.x.x ip y.y.y.y, dns resolution seems cached connector mod_jk , request still asking x.x.x.x . for solving have make "reload" renew resolution y.y.y.y. any idea? there kind of dns caching in apache or mod_jk connector? solutions? thanks. regards. i dont know if there property @ mod_jk level can set @ jdk level. assuming have sun, parameter "sun.net.inetaddr.ttl" ; setting 0 turn off dns caching. not recommended turning off dns caching affect performance.

c++ - Advantage of switch over if-else statement -

what's best practice using switch statement vs using if statement 30 unsigned enumerations 10 have expected action (that presently same action). performance , space need considered not critical. i've abstracted snippet don't hate me naming conventions. switch statement: // numerror error enumeration type, 0 being non-error case // fire_special_event() stub method shared processing switch (numerror) { case error_01 : // intentional fall-through case error_07 : // intentional fall-through case error_0a : // intentional fall-through case error_10 : // intentional fall-through case error_15 : // intentional fall-through case error_16 : // intentional fall-through case error_20 : { fire_special_event(); } break; default: { // error codes require no additional action } break; } if statement: if ((error_01 == numerror) || (error_07 == numerror) || (error_0a == numerror) || (error_10 == numerror

c++ - Using PlayFile apple example with OpenGL freezes OpenGL until playing sound is over -

i working on little app in c++ xcode uses opengl. tried find way add simple sounds app. not succesful openal (alut not available in mac) , couldn't make sfml , sdl work on system. decided try apple's playfile example: http://developer.apple.com/library/mac/#samplecode/playfile/introduction/intro.html#//apple_ref/doc/uid/dts40008651 i can play sounds using example. however, when sound starts playing, opengl freezes, namely animation stops until sound done playing. i checked file playfile.cpp , found line: usleep ((int)(fileduration * 1000. * 1000.)); which think responsible freezing opengl. before line, start playing sound. after line clean buffers. there way can change code, that, sound starts playing, opengl continues tasks, once sound done playing clean buffers? tried use other solutions pointers, clean after playing started, can not make sound out of app. any suggestions? ok, after days of research found way fix problem. used pthread create mu

c++ - segmentation fault in programm with SIMD commands -

what wrong here? when run program, says, segmentation fault (core dumped) . have used simd commands. float function ( point p1, point p2, int dim ) { int k; float result=0.0; float *p3; p3 = (float*) malloc (16); k=dim%4; __m128 *v_p1 = (__m128*)p1.coord; __m128 *v_p2 = (__m128*)p2.coord; __m128 *v_p3 = (__m128*)p3; (int i=0; i<dim/4; i++){ *v_p3= _mm_sub_ps(*v_p1,*v_p2); } for(int i=0; i<dim; i++){ result+=p3[i]; } return(result); } any of simd _ps instructions going require 16 byte aligned data. can tell @ least p3 not aligned , seg fault if not use aligned data. can not run code myself if assign __m128 variables value should okay since should aligned: __m128 v_p1 = _mm_set_ps( ... ); // not sure of argument __m128 v_p2 = _mm_set_ps( ... ); // not sure of argument __m128 v_p3 = _mm_set_ps1(p3) ;

javascript - jQuery get the total position from an id -

i want set focus position on variable #id after ajax reloads content within container. container has overflow:auto; in see scrollbar if content large. after inserting new content, can't focus set on #id i'm giving set on. i first tried set focus on id: <script type="text/javascript"> function setfocus(ulid) { var heightul = $("#"+ulid).offset(); $("#"+ulid).focus(); } </script> later tried total height of id, put offset() on it, $("#"+ulid).offset().top; or $("#"+ulid).position().top; . function setfocus(ulid) { var heightul = $("#"+ulid).offset().top; $("#"+ulid).stop().animate({ scrolltop: heightul }, 'fast'); } but isn't working either. position() 0 in return , offset() returns object's height relative parent. , not total height object positioned within container. the html: <div class="info-container edit" id="info-container-edit&

php - Return value after header -

i use header allow user download file when clicks on button. below code in function. header('content-disposition: attachment; filename='.date("ymd",$date).".removethis"); echo $data; exit(); return true; but dont catch return value when calling function. possible have exit() , yet have return value function? the function exit() terminate program immediately. no code execution expected after exit() ; exit(); // program terminates // not executed return true;

listview - Swipe right display button in android custom list view -

i trying implement, show button on swipe right in custom list view. problem facing right is, implemented onswipetouchlistener found online. able see swipe button. not consistent, mean if swipe right on 1 row, button displaying in other row. tried. i created adapter holding view //transactionadddropviewholder public static final class transactionadddropviewholder { public view moveupbutton = null; public view movedownbutton = null; public view withdrawbutton = null; public view reviewbutton = null; public view approvebutton = null; public view rejectbutton = null; public linearlayout addcontainer = null; public linearlayout dropcontainer = null; public void swipebuttons() { adddroplistview.setontouchlistener(new onswipetouchlistener() { public void onswiperight() { withdrawbutton.setvisibility(view.visible); } public void onswipeleft() { withdrawbutto