Posts

Showing posts from March, 2012

python - PostgreSQL connection closes unexpectedly when doing a large insert -

i'm populating postgresql table ~11.000.000 rows have been selected before database. i'm using python , psycopg2. whole process takes estimated 1.5 hours complete. however, after ~30 minutes "connection closed unexpectedly" exception. source code looks this: incursor = indb.cursor() incursor.execute("select ...") indb.commit() # (1) close transaction outcursor = outdb.cursor() rows = 0 (col1, col2, col3) in incursor: # incursor contains ~11.000.000 rows outcursor.execute("insert ...", (col1, col2, col3)) # fails after ~30 minutes row += 1 if row % 100 == 0: # (2) write data every 100 rows outcursor.close() outdb.commit() outcursor = outdb.cursor() incursor.close() outcursor.close() outdb.commit() i inserted (1) , (2) after first tries failed, assuming open transaction has upper time limit of ~30 minutes or cursor has upper limit of pending inserts. seems none of assumptions true , error lies somewher

Which questions should one read on stackoverflow? (regarding C++) -

since i'm still learning c++ (and still mean since 5 years :-) ) thought, better way learn hidden details asking it. so, i'm not looking question votes, know, if have ever read article here, think every intermediate c++ programmer should read gain bettter understanding of craft. i cant suggest article can advice 2 amazing books scott meyers ( hope you). never seen better. more effective c++: 35 new ways improve programs , designs effective c++: 55 specific ways improve programs , designs

templates - custom toolbar for sharepoint list -

i try implement custom viewtoolbar list template. create customdefaulttemplate.ascx file under /templates/controltemplates. code in customdefaulttemplate.ascx: <....> <%@ register tagprefix="customsurvey" assembly="hiderespondtosurvey, version=1.0.0.0, culture=neutral, publickeytoken=1d6553d11ff33f7e" namespace="hiderespondtosurvey.code"%> <sharepoint:renderingtemplate id="customviewtoolbar" runat="server"> <template> <wssuc:toolbar cssclass="ms-menutoolbar" enableviewstate="false" id="toolbartbl" buttonseparator="<img src='/_layouts/images/blank.gif' alt='' />" rightbuttonseparator="&#160;&#160;&#160;" runat="server"> <template_buttons> <customsurvey:surveymenu runat="server"></customsurvey:surveymenu> </template_buttons>

https - Multi domain SSL? -

a co-worker told me when visit website on ssl certificate no longer guarantees you're dealing intended recipient. due called "multi-domain ssl certificates". quick google search seems show these exist - under impression ssl provided encryption and authentication. no longer case? surely step in wrong direction? there wildcard certificates, allow hosts in 1 domain covered same cert. they're more expensive issued (since cas wouldn't make money if you'd ordered multiple separate single-domain certs), when need cover multiple hostnames in domain ssl, can quite savings. a issued cert cover @ least 1 host name, www.example.com. , wildcarding, can cover *.example.com. ssl guarantees nothing in way of identification - link encrypted. certificate - self-signed ones. "commercial" certs (theoretically) trustworthy third party saying "we've verified person www.example.com certificate issused www.example.com"

mysql - Having trouble with php and ajax search function -

i still quite new php/ajax/mysql. in anycase, i'm creating search function returning data i'm looking for. in brief, have mysql database set up. php website has search function. i'm trying add link mysql database search rather showing results. in search.php, echo line working fine $string .= not returning anything. i'm trying same echo link mysql php record. missing simple? //echo $query; $result = mysqli_query($link, $query); $string = ''; if($result) { if(mysqli_affected_rows($link)!=0) { while($row = mysqli_fetch_array($result,mysqli_assoc)) { echo '<p> <b>'.$row['title'].'</b> '.$row['post_id'].'</p>'; $string .= "<p><a href='set-detail.php?recordid=".$row->post_id."'>".$row->title."</a></p>"; } } else { echo 'no results :"'.$_get['keyword'].

Excel - Counting unique values that meet multiple criteria -

i'm trying use function count number of unique cells in spreadsheet that, @ same time, meet multiple criteria. given following example: a b c quant store# product 1 75012 banana 5 orange 6 56089 orange 3 89247 orange 7 45321 orange 2 apple 4 45321 apple in example above, need know how many unique stores valid store# have received oranges or apples. in case above, result should 3 (stores 56089, 89247 , 45321). this how started try solving problem: =sum(if(frequency(b2:b9,b2:b9)>0,1)) the above formula yield number of unique stores valid store#, not ones have received oranges or apples. how can add criteria? mine done different way (and works), main reason posting because wondering if second part of formula somehow made array formula making shorter. to this, sort 3 columns on column b smallest largest , since part of array formula, type in formula , [ctrl]+[shift]

jquery - CLEditor dynamic adding text -

i'm using cleditor website i'm working on. i'm trying add dynamic text textarea jquery. i'll using like: $('#mytext').val('here dynamic text'); but doesn't work cleditor. when disabling cleditor works fine however, enabling again text disappears. tried looking on website solution, can't find any. had same problem lately? thanks in advance. $("#input").cleditor({width:500, height:250,updatetextarea:function (){....}})

google app engine - Set operations in Appengine datastore -

i assume there's no way so, if had to, how implement set operations on appengine's datastore? for example given 2 collections of integers, how store them in datastore performance intersect , except (all items in not in b) operations? there aren't built in set operations in datastore api. see having 2 options: for smallish sets (hundreds of items) might away doing keys-only queries both set , set b, , doing intersection in application code. precise definition of "smallish" depend on application. for largish sets (millions of items) if know ahead of time intersections you'll want, can calculate them each time insert new record. example, assume have 2 sets , b, , know you'll want query on (a intersects b). whenever insert a, check see if in b. if is, record fact somewhere (either in separate entity type, or boolean property on or b itself). of course, you'll need b's also. with option 1, can have lots of different sets, l

Java swing: Remanence when removing a heavyweight jogl component to add a lightweight component at the same place -

in swing application, when remove jogl glcanvas main component add jpanel @ same place, there display glitches: during time when old component has been removed , before new 1 has been added, remanent images of popup menus have been displayed before on top of glcanvas visible on background of main component. how can avoid this? when adding/removing components visible gui code should like: panel.remove(...); panel.add(...); panel.revalidate(); panel.repaint(); also, the code should execute on event dispatch thread . if code executed within listener on edt. if code executed outside of listener need use swingworker or swingutilities.invokelater().

How to get the actual directory path on windows using .NET? -

my need simple. given windows directory path want actual path. sure terminology wrong, giving example. given c:\documents , settings\all users method should display: c:\programdata on windows 7 c:\documents , settings\all users on windows 2003 this because on windows 7 c:\documents , settings junction referencing c:\users , c:\users\all users yet junction referencing c:\programdata , actual directory. so, question .net api lets me this? thanks. check out this code sample has figured out already. essentially, have use win32 function deviceiocontrol via p/invoke passing fsctl_get_reparse_point dwiocontrolcode parameter. as guy on codeproject says... i find interesting .net framework's fileattributes enumeration includes value fileattributes.reparsepoint there no other built-in support reparse points. there no "native" .net api this, bear in mind of framework wrapper around p/invoke calls anyway, shouldn't fear th

Scroll SlidingDrawer view in Android -

Image
i'm using slidingdrawer show selected facebook contacts. when open, how can make scrollable able see contacts if total width of slidingdrawer's handle + content greater width of screen (eg if there more 6 contacts shown in bottom image shown below)? thanks i'd try putting drawer's content in horizontalscrollview , or using gallery .

.net - Interface programming -

background a developer on team has implemented application reviewing. has used interfaces everywhere. app has typical service layer, data layer , poco objects passed website down db. assumption ioc used (through unity) inject runtime concrete service , data class. pocos have nothing , set methods on public properties. question i understand why interface used @ service , data layer why use interfaces on poco objects? overkill? do poco interfaces serve purpose? if yes, may not overkill. however, if not used, violate yagni principle. however, on more general note, i'm beginning think properties on interfaces design smells , violate law of demeter . i posted some thoughts on better abstractions .

JQuery tabs with Rails: replacing tab content -

i have tab page rendered inside it. good. user clicks button. want output of doing show inside tab. takes user off tabs view entirely. here's tab html in .html.erb file: <div id="tabs"> <ul> <li><a href="urls">manage urls</a></li> ...other tabs... </ul> <div id="urls-tab"> <p> </p> </div> ...other tabs... </div> i have new button on form such: <%= form_tag('urls/someaction_not_new', :method => :post, :id = "top-form") %> ...content... <input type="button" id="new" value="new" onclick="somejavascript()"> <% end %> finally, javascript: $("#tabs").tabs(); function somejavascript() { document.location = "urls/new" } i know javascript doesn't work, , never expected to. need know how build function such loads 'urls/new' outpu

android - Programatically change the layout color of layout -

i trying programatically change layout color of relative layout (tried linear layout didn't change), cannot change it. also trying debug app doesn't help, there not message related tag. the application stood still after layout colored initially. package com.test.intentdemo; import android.app.activity; import android.graphics.color; import android.os.bundle; //import android.os.systemclock; import android.widget.relativelayout; import android.util.*; import java.lang.thread; public class intentdemo extends activity { /** called when activity first created. */ relativelayout llayout; public static final string tag="myactivity"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); llayout = (relativelayout) findviewbyid(r.layout.main); if (log.isloggable(tag,0)) { log.e(tag,"error before"); lo

c - select for reading after a fork -

how select reading being handled on linux systems in case process forked after opening udp socket? - possible in kind of program: so = open socket fork for(;;) { select() reading on socket recv } two packets wake 1 of processes (in case arrive before waiting process notified / exits select) , second 1 of packets not received? or can assume udp, every packet wake process or leave flag set? each processes, parent , child, has fie descriptor same socket. per file descriptor attributes independent (e.g. blocking, being able close socket). in scenario indeed feasible legal 1 of processes, example waken , read data socket before other 1 getting select.

iphone - Pushing an upgrade to an app approved for sale but not released to AppStore -

i have app approved sale has release day set month now. want add feature before release date. can push upgrade in during time when app approved non-live? can push upgrade in during time when app approved non-live? yes. can push release date of new approved version further in future, , send apple yet version new features review, replace version in standby it's approved. way current version never hit app store.

MySQL: how can I see ALL constraints on a table? -

i'm learning sql , bothers me, seem unable find constraints on table. created table with create table t2 (a integer not null primary key, b integer not null, constraint c1 check(b>0), constraint fk1 foreign key(a) references t1(a)); and added constraint with alter table t2 add constraint c2 check (b<20); i tried see (four) constraints with show table status tenn #-->the name of database 't2'; and then show create table t2; and then select * information_schema.key_column_usage table_name='t2'; and finally select * information_schema.table_constraints table_name='t2'; but none of these shows 4 constraints. tell me how see of them? thanks lot! select column_name, constraint_name, referenced_column_name, referenced_table_name information_schema.key_column_usage table_name = 'table checked';

merge - Implementing Disjoint Set System In Python -

what have far largely based off page 571 of "introduction algorithms" cormen et al. i have node class in python represents set: class node: def __init__(self, parent, rank = 0): self.parent = parent self.rank = rank this implementation going use list of nodes forest (i open better ways store sets). initialize() returns list of nodes, store in variable set , pass other functions. find searches through forest value , returns set appears in. chose use for s in range(len(set)): in recursion shrink list of sets being passed in set[s:] . def find(set, value): s in range(len(set)): if value != set[s].parent: set[s].parent = find(set[s:], set[s].parent) return set[s] merge merges sets in forest finding them , promoting higher ranked set. def merge(set, value1, value2): set_val_1 = find(set, value1) set_val_2 = find(set, value2) if set_val_1.rank > set_val_2.rank: set_val_2.parent = set_va

.net - VB.NET cross compatibility with C# -

i have c# project generic interface public interface imyfoo<t> { void dosomething(t instance); } i have c# project interface inherits several imyfoos public interface imybar : imyfoo<type1>, imyfoo<type2> { ... } everything works fine in c# land (including scenario below doesn't work in vb). i have vb .net project references c# library. i have instance of imybar , try use follows: dim instance mytype1 = ... dim bar imybar = ... bar.dosomething(instance) ' generates compile error: ' 'dosomething' ambiguous across inherited interfaces 'imyfoo(of mytype1)' , 'imyfoo(of mytype2)'. what's up? can directcast , works fine...but i'd rather not directcast(bar, imyfoo(of mytype1)).dosomething(instance) you're going have cast : unlike other types, derive single base type, an interface may derive multiple base interfaces. because of this, interface can inherit identically named type member differen

storing a Book using SQL Server -

hi , thank attention i'm working on database system project , must implement digital library using sql server. i dont know how can store book 1000 pages (page page , serching ability) in sql server i thinking creating table 1000 columns ntext type,but think isn't wise way. could me suitable method problem. i going store multipage image books , voice books thank you. 1000 columns? no rather 1000 rows in table such as: table bookpage: bookid int pageid int pagetext ntext you have table book: table book: bookid int title nvarchar author nvarchar

ruby on rails - What is the best way to implement a parent applications controller or namespace controller in backbone.js? -

example apps james yu's ( http://www.jamesyu.org/2011/01/27/cloudedit-a-backbone-js-tutorial-by-example/ ) provide excellent examples of how integrate rails backbone, if want 10 controllers? or 30? i having trouble understanding question is. building backbone.js-based client rails 3 backend. new backbone.js too, our app structure conforms link referenced: index.html js +- app.js +- controllers +- controller.js +- controller1.js ... +- controllern.js where augment backbone.controller object few methods , strategies specific our app. in general, each controller has own set of client-side routes responsible , focused on those. use minimum number of routes minimize cases have support bookmarking mean we'd have spin whole app again. your client not have mirror server's view of world. best practice customize experience client application , compartmentalize server dependencies. really not sure if answers question, since have no answer far...

c# - converting a string to a list of integers -

i have visual studio 2008 c#.net 3.5 application have string list of numbers separated semicolon. string num_list = "1;2;3;4;201;2099;84" i convert list<int> . there easier way this? list<int> foo = new list<int>(); foreach (string num in num_list.split(';')) foo.add(convert.toint32(num)); thanks, paulh list<int> foo = num_list.split(';').select(num => convert.toint32(num)).tolist();

nhibernate - Invalid index n for this SqlParameterCollection with Count=m -

i'm getting nasty error in castle active record (wrapped around nhibernate) when try save class: invalid index n sqlparametercollection count=m i know error caused property being mapped multiple times in class i'm not sure how around it. have 2 child classes both map class in question using same column (ipaddressnumber). ipaddressnumber primary key of class, results in nhibernate trying map ipaddressnumber property 3 times (just guess.) here class: [activerecord(lazy=true)] public class deviceconfiguration : usersdatabase<deviceconfiguration> { [primarykey] public virtual long ipaddressnumber { get; set; } [belongsto("ipaddressnumber", lazy = fetchwhen.oninvoke)] public virtual vehicle vehicle { get; set; } [belongsto("ipaddressnumber", lazy = fetchwhen.oninvoke)] public virtual jbusconfiguration jbusconfiguration { get; set; } } any appreciated... i ended having remove se

google app engine - Idiomatic List Wrapper -

in google app engine, make lists of referenced properties this: class referenced(basemodel): name = db.stringproperty() class thing(basemodel): foo_keys = db.listproperty(db.key) def __getattr__(self, attrname): if attrname == 'foos': return referenced.get(self.foo_keys) else: return basemodel.__getattr__(self, attrname) this way, can have thing , thing.foos , legitimate out of it. problem comes when says thing.foos.append(x) . not save added property because underlying list of keys remains unchanged. wrote solution make easy append keys list: class keybackedlist(list): def __init__(self, key_class, key_list): list.__init__(self, key_class.get(key_list)) self.key_class = key_class self.key_list = key_list def append(self, value): self.key_list.append(value.key()) list.append(self, value) class thing(basemodel): foo_keys = db.listproperty(db.key) def __

SQL Server find datediff between different rows -

i trying build query analyzes data in our time tracking system. every time user punches in or out, makes row recording punch time. if punch in @ 9:00 , punch out @ 5:00 there 2 rows date stamps recorded accordingly. need query iterate on rows @ sum datediff between workingpunch_ts (the timestamp column) in hours. each row have identifier signifies if punch punch in, or punch out ( inout_id , 1 in, 2 out). so example if had id | workingpunch_ts | inout_id ---------------------------------------------- 123 | 2011-02-16 09:00:00.000 | 1 124 | 2011-02-16 17:00:00.000 | 2 that yield 8 hours. need repeat process every pair of rows in table. thoughts on how accomplish this? in hours, sure select empid, cast(datediff(d,0,workingpunch_ts) datetime), sum(case when inout_id = 2 1 else -1 end * datediff(mi, datediff(d,0,workingpunch_ts), workingpunch_ts))/60.0 hours clock workingpunch_ts between '20110201' , '20110228 23:59:59.999' group e

Converting a basic Cocoa application to a document-based application -

my team , have been working on existing, non-document-based cocoa application. our first cocoa app, although we've done number of ios apps far. the app should document-based, though, i've begun trying convert it. things here & there don't seem working. example, file -> open menu item permanently disabled (although got file -> save menu item enabled; wouldn't). in addition, can click red x close window, although file -> close menu item disabled; however, when close window via x button, dealloc method in nsdocument implementation (spdocumentinfo) not invoked. created sample, brand-new document-based app comparisons; when close window there, spdocument implementation's dealloc method indeed invoked (as i'd expect.) concerns me. i made lot of changed project here , there; include: made spdocumentinfo extend spdocument in .h file: @interface spdocumentinfo : nsdocument <nswindowdelegate> implemented following in spdocumentinfo: - (n

java - How to deserialize an PHP array with GSON -

in php serialize array json_encode try read on android device gson. android crashes fatal exception. can't work of examples i've seen. think caused json string. starts index of array (19 , 17 in example below), , haven't seen examples of type of json string. examples have seen start property names , not index / cpunter. here's json example: {"19":{"id":"1262","username":"abc","telnr":"0123456789","created":"sun, 08 aug 2010 10:29:06 +0200","email":"e@mail.com","code":null},"17":{"id":"1259","username":"cdef","telnr":"9876543210","created":"sun, 08 aug 2010 10:29:06 +0200","email":"mail@domain.com","code":null}, among many other combinations tried following 2 examples: type listtype = new typetoken<list<st

php - MVC frameworks, API layers, and Authentication/Permissions -

i asked question earlier, may have been vague or broad warrant answer. i've since reconsidered approach , question. i'm working on framework specific application in mind, keeping re-usability @ forefront. key element of framework exposing api layer, json driven remote interaction. my issue in planning out comes authentication/permissions . if i'm designing mvc style architecture in mind, yet want permit usage via api layer, should authentication/permissions check take place? the web access layer same api layer, difference being output method (html vs. json), figured common business logic layer 2 make sense. requests normalized data structure, , sent business logic. business logic kicks out result data structure (query results, failure, success, etc.) either fed template engine, or serialized json. it appears me permissions check needs performed in common business logic layer, there better place incorporate mvc/api framework? i don't know else elaborate @

jquery - Check if element is in the fadeIn or fadeOut state ('action') -

i need stop(cancel) current .fadein(5000) , start same fadein beginning, once button clicked (otherwise next fadein start after 5000). how can check, if div actively fading , how can cancel (i assume .hide())? use .stop() . don't need test if fadein running, if not, stop has not effect. you still have hide though. like: $('selector').stop(true).hide().fadein(5000);

c# 4.0 - C# - user32.dll - GetWindowRect problem -

[dllimport("user32.dll")] [return: marshalas(unmanagedtype.bool)] static extern bool getwindowrect(handleref hwnd, out rect lprect); [structlayout(layoutkind.sequential)] public struct rect { public int left; // x position of upper-left corner public int top; // y position of upper-left corner public int right; // x position of lower-right corner public int bottom; // y position of lower-right corner } foreach (process pr in process.getprocesses()) { rect rc; getwindowrect(???, out rc); what should put " ??? " ? . tells me have put handleref object not know how handleref object process method. if need window coordinates window in process, there other ways window handle don't require enumerating processes. for winforms windows, use handle property. system.windows.forms.control ... handle property @ msdn for wpf applications, use windowinterophelper system.windows.interop ... windowinterop

silverlight 4.0 - MVVM / User Controls & View = ViewModel convention -

laurent of mvvm light fame introduced me mvvm, , convention of 1 view has 1 view model. rule of thumb user controls? 1 viewmodel each user control? when creating view leveraging more 1 user control, create viewmodel aggregate user control view models? thanks in advance input. richard in mvvm projects have tended suggest: 1 viewmodel per usercontrol viewmodel aggregates these together. that aggregating viewmodel viewmodel window rather usercontrol - though isn't necessary , may more result of preferences , history , fact work in wpf. the 1 place don't have seperate viewmodel usercontrol create specific reusable usercontrols - things buttons specific visual effects, or custom sliders. that reflected in project structure - have 2 standard folders usercontrols (which not have viewmodels) , views either windows or usercontrols, , have viewmodels.

python - Using BeautifulSoup to find all elements starting with a given letter -

if want find <p> elementswith id=test beautifulsoup, use : for item in soup.findall('p', {"id": "test"}): how find every element id starting specific letter - let's "t"? i tried "t*" doesn't work. try: import re item in soup.findall('p', {"id": re.compile('^t')}):

assembly - machine code template for immediate addressing -

what machine code language immediate addressing.. if machine code template register adddressing is opcode(6 bits) d(1 bit) w(1 bit) mod(2bits) reg(3bits) r/m(3bits) total 16 bits. m using intel 80386 intel microprocessor! there few changes format immediate operands. (possibly always) high bit of opcode 1 instructions immediate operands. d bit replaced x (extension) bit. if operands 8-bit (w=0), x bit ignored. if operands not 8-bit , x=0, immediate value same size operand size. if x=1, immediate 8-bit number sign-extended current operand size. next, reg field replaced opcode extension, different depending on instruction in use. finally, immediate value added end of instruction, in little endian. for more information see http://www.c-jump.com/cis77/cpu/x86/lecture.html , sections 21 , 37.

css - Is there a single jquery ui package that include all the themes available on the official website? -

i want try different themes, need themes. official web site provide package include base , theme. is there single jquery ui package include themes available on official website? thanks. this link: http://blog.jqueryui.com/2010/02/jquery-ui-download-builderthemeroller-status/ appears have zip files contain themes i'm not sure if latest version of jquery ui .

android - How do you store the contents of a POJO in the preference store? -

i looking find way store value of pojo (containing strings, booleans, ints) in preference variable can retrieve key used when store it. pojo contains many string / boolean / int attributes, don't want store them each individually. problem i'm running preference variable types string, boolean, float, , int. there way convert pojo string retrieve per it's key , convert pojo, sort of casting it> 1) populate pojo 2) convert pojo string 3) store string in preference store key value (normal preference store stuff) 4) when needed, retrieve data preference store string , convert pojo. not elegant solution but: bytearrayoutputstream outputstream = new bytearrayoutputstream(); objectoutputstream = new objectoutputstream(outputstream); objectoutputstream.writeobject(instance); objectoutputstream.flush(); val = base64.encodebase64string(outputstream.tobytearray())); to deserialise: byte[] data = base64.decodebase64(datastr); objectinputstream objectinputstream = n

Passing on unique session variables to the resumerviewer.php page -

<?php //get data session_start(); $button = $_get['submit']; $search = $_get['search']; if (!$button) echo "you didnt submit keyword"; else { if (strlen($search)<=2) echo "search term short"; else { echo"you searched <b>$search</b><hr size='1'>"; //connect database include("connect.php"); // bit of filtering $search = strtoupper($search); $search= strip_tags($search); $search = trim ($search); $keywords = $getrow['preferedlocation']; //explode our search term $search_exploded = explode(" ",$search); foreach ($search_exploded $search_each) { //construct query $x++; if ($x==1) $construct .= "preferedlocation '%$search_each%'"; else $construct .= " or pre

web applications - Which web framework should I choose? -

i java developer. want develop web site own. want choose rapid web application framework. have experience of spring mvc. wondering if should choose web framework. here list of want: rapid develop easy secure easy validate easy communicate db(mysql or nosql) i have heard ruby,python,groovy , scala. should include these choices? how effort these take? should invest time on these or stay in java world? please kindly give me advices. thanks lot. if you're willing consider python (sounds are), should check out web2py . it's primary goals ease of use, rapid development, , security . more on security here , here if "easy validate" mean input/form validation, has great forms , validation system . for easy , portable database communication, has database abstraction layer works sqlite, postgresql, mysql, oracle, mssql, firebird, db2, informix, ingres, , google app engine (i.e., bigtable), partial support couchdb. it's easy set , try out -

android - ProgressDialog shown behind another dialog -

my custom dialog has list takes long time obtain. load in separate thread launched in onpreparedialog using asynctask. prior calling asynctask.execute invoke progressdialog. problem when dialog called first time (oncreatedialog invoked), progressdialog shown behind (empty) dialog. how can show progressdialog in hr front? when dialog dismissed , shown again, display order correct. public class myactivity extends activity { fileselectdlg fileselectdlg = null; layoutinflater inflater; arraylist<string> filelist; @override public void oncreate(bundle savedinstancestate) { inflater = layoutinflater.from(this); } @override protected dialog oncreatedialog( int id ) { fileselectdlg = new fileselectdlg( ); return fileselectdlg; } @override protected synchronized void onpreparedialog( int id, dialog dialog ) { fileselectdlg.update_dlg_view( -1 ); } public class fileselectdlg extends dialog { private context context; private baseadapter

iphone - UIAnimator message sent to deallocated instance -

hey guys, i'm getting crazy. *** -[uianimator removeanimationsfortarget:]: message sent deallocated instance 0x5ba13d0 it happens in different moments, when scroll tableview, when switch filter (a uisegmentedcontrol). help me, i'm getting crazy guys :) how can fix? i solved same problem. thought related uianimation, related uitableviewcell, instead. found starting point looking @ article. http://marius.me.uk/blog/2011/mar/fixing-uianimator-removeanimationsfortarget-crash/ good luck , let me know!

extjs - sencha touch keeps content and overlays it -

i have got problems: http://www.burning-emotions.at/shop/ 1234567 user pwd 1234567 when changing between tabs, keeps content , overlays it,...is bug of sencha touch or doing wrong? when tapping on next tab in handler hide previous panel using hide() function , show() required panel

jqgrid - jquery datepicker not sending data on using .serialize() -

when trying use .serialize() method send data server not working jqgrid rows selected... you should try follow link ...it may you.. jquery datepicker not sending data on using .serialize() populating grid

c++ - Where can I find a RPC which implemented with: boost + protobuf -

are there rpc framework implemented with: boost + protobuf? , has protobuf plugin can used generate rpc code framework. or there open source implementations can refer to, please tell me. thanks. i find through question there 1 : rcf (remote call framework) it seems can use boost.asio , protocol buffers . have not used myself. my2c

javascript - How would I check too see if "Checkbox" is checked,if so show element? -

<script> function validate(chk){ if (chk.checked == 1) document.getelementbyid('texttoshow').style.display="block"; else alert("you didn't check it! let me check you.") chk.checked = 1; } </script> <input type="text" value="hey" style="display:none"><input oncheck="validate(this.id)" type="check"> output: document.getelementbyid('texttoshow') null this code check if checkbox checked , if so, show css hidden textbox. how make so in manner? there few things wrong here. first lets fix html elements. this needs id: <input type="text" value="hey" style="display:none" id="texttoshow"> here need pass element instead of (non-existent) id. should onclick instead of oncheck <input onclick="validate(this)" type="check"> if you're putting more 1 statement in if or else

java - Is there a way to get SAXParser to ignore content of certain elements when parsing? -

i have xml of format: ... <to>"paul mccartney" <paul.mccartney@hotmail.com></to> <from>"john lennon" <john.lennon@yahoo.com></from> ... the saxparser throws exception gets email addresses. thinks <paul.mccartney@hotmail.com> xml element , throws , exception encounters @ symbol. there anyway ignore content of elements in java sax? you try overriding org.xml.sax.helpers.defaulthandler.error() , , similar methods, if you're using defaulthandler? see javadoc of org.xml.sax.errorhandler : http://download.oracle.com/javase/6/docs/api/org/xml/sax/errorhandler.html but in way, xml invalid. shouldn't way. preprocess , replace < &lt; , > &gt; or wrap whole <to/> , <from/> content <![cdata[ ]]> block...

Updating innerHTML with HTML from a php function? (using xajax) -

i'm updating innerhtml of div through xajax (when click link) when assign html in function itself, not when call different function. to explain // sake of testing $output=rand(20,40); // add new html container through $output $ajax_resp->assign('div_container','innerhtml', $output); return $ajax_resp; this works fine. when call function through clicking link, container updates random number. when change $output to $output=$compile->show('text'); which (simplified) function show($var) { echo $var; } it not show it. function show works outside of xajax. suggestions? function show($var) { echo $var; } this function doesn't return anything, echo's value screen. however, functions want return value, can work it. basically, when do $output=$compile->show('text'); it no input show method, because show doesn't return value. think if change following: function show($var) { return $var; } it

asp.net - Error '2035' ('MQRC_NOT_AUTHORIZED') While Connecting to MQ -

i getting error while connecting ibm mq. know because of privileges, there way check connection ibm mq? please suggest. the 2035 suggests connection getting qmgr. if had wrong channel name, host or port 2059. 2035 means connection made listener, found channel of name requested , attempted connection. if want test past point necessary either authorize id using connect or put authorized id in mcauser attribute of channel. for detailed explanation of how wmq security works on client channels, see wmq base hardening presentation @ http://t-rob.net/links .

javascript - jquery.validate: multiple fields add up to value -

this question has answer here: jquery validate: how add validation checks sum of multiple fields? 1 answer i'm working on form user enters total, enters more values other fields represent dividing of total. example: <input type="text" name="total" /> <input type="text" name="portion[1]" /> <input type="text" name="portion[2]" /> <!-- , on --> <input type="text" name="portion[n]" /> if user enters 123.45 total, need fill out portions 1 - n such values add 123.45. each portion field required positive number or 0 other restrictions on them. the jquery.validate plugin has equalto validation method, can seem cope single field, rather set. is there way to define validation rule validate total of group of fields against total field get single mes

sql - MySQL replace all whitespaces with - -

how remove whitespaces row? see here alot of same question answers ar use replace option. replace work strip 1 spaces, not all. ex: b c become a-b-c thanks. this can achieved following mysql function: select replace( table.field, ' ', '-' ) table; this should replace whitespace -

windows xp - WinCE 6.0 on VMWare Player - access host USB Bluetooth dongle -

i made wince 6.0 r2 image , load vmware player 3.1.3. host operating system windows xp sp3. followed article , worked fine (the article uses vmware workstation, worked fine vmware player). my final goal virtual machine wince use bluetooth usb dongle attached windows xp host computer. in wince image had added support bluetooth usb in mike hall's post . want mention had included support usb host when created bsp, , usb drivers checked. when go in wince -> control panel -> bluetooth device properties, bluetooth manager launched. if try make "scan device" getting following error: bluetooth hardware error 10050 (controller not present) but dongle attached vmware player , disconnected host, theoretically transport layer controlled virtual machine , wince can talk ehci of usb. can give me hint follow? suggestions welcome. i have no idea whether stuff described @ http://www.codeproject.com/kb/windows/bth4devemul.aspx required in case... there free

Delphi Ansistrings -

i have case here, going migrate on delphi 2011 xe delphi 7, , surprise many components have problems due ansistrings, in delphi xe japanese / chinese characters, unit use pcsc connector , seem discontinued/abandoned original developper. basically want easy way read strings again little modification original code possible.. also if there tutorials out there on how makae components ansistring ready 2009 , newer me also @plastkort, delphi >= 2009 capable of reading , handling ansistring. meaningless characters if somehow hard-cast ansi data unicode, possibly hard-casting pointer pchar. if had convert else's code unicode i'd start searching pchar, char , string , looking @ places other types hard casted types. that's because types changed meaning: in non-unicode delphi char 1 byte, it's 2 bytes. the conversion isn't necessary difficult, need understand problem you're facing , need have understanding of code you're converting. , it's l

c# - Adding validation with MVC 3 & jQuery Validator in execution time -

i have form validation rendered c# when page loaded, rendered fields so: <input autocomplete="off" class="input-validation-error" data-val="true" data-val-number="the field idade must number." data-val-range="message here" data-val-range-max="25" data-val-range-min="16" data-val-required="the idade field required." id="content_myfieldid" maxlength="3" name="content.myfieldid" value="0" type="text"> and i'm trying put new html object equals example jquery, new field not validated when submit form. have way add validation in field using jquery? ps: don't want use manual method so: $("#field").rules("add", { required: true, messages: { required: "required input" } }); because have rules in input field, want apply it. feels bit of hack, here's how i've done it. //

android - Low Level Text Engine for Tablet OS -

background: develop software viewing specialized academic content complex layout requirements (complex footnotes, tables, images, non-standard character sets, etc.) in desktop version accomplished wpf's low-level textformatter , in web app accomplished flash's fte (not tlf, underlying engine). both of these low-level engines produce text lines of specified width , formatting, can arranged form pages. we port application ipad , android tablets. @ moment leaning towards using air android/packager iphone reuse of our existing as3 codebase. however, want explore option of going native on each platform. my question is: ios , android offer comparable low-level text engine capable of: line breaking in varying widths bidirectional text kerning, ligatures, etc. multiple embedded fonts inline , floating images text selection/highlighting anything else necessary produce complex layouts assuming not offered native apis (and @ least looking on android sdk seems case), th

ruby - How can I install the YR weather gem? -

i trying install yr.no weather api gem here having problems adding repository. i tried gem sources -a http://irbno.rubyforge.org/ results in following error: error fetching http://irbno.rubyforge.org/: bad response not found 404 (http://irbno.rubyforge.org/specs.4.8.gz) i on windows xp ruby 1.9.2 , have updated latest version of rubygems (1.5.2) ruby -v returns `ruby 1.9.2p0 (2010-08-18) [i386-mingw32]` whilst gem sources -l returns *** current sources *** http://rubygems.org/ http://gemcutter.org any thoughts? problem repository or setup? the correct uri rubyforge rubygems repository http://gems.rubyforge.org/ , not http://irbno.rubyforge.org/ . however, rubyforge rubygems repository shut down long time ago , migrated rubygems.org, uri redirect http://rubygems.org/ (as http://gemcutter.org/ btw). since have repository uri in rubygems sources, don't need anything. may ask found information http://irbno.rubyforge.org/ correct uri rubyforge r

visual studio - VS Team: A concrete example of the use of the TestContext property using Microsoft Unit Testing Framework? -

while writing tests week new project, encountered testcontext property using microsoft unit testing framework available visual studio team system. i wondering: 1. how property used concretely? 2. in other words, purpose? 3. has concrete example provide ease understanding? i have written many tests far in career, , have never ever found use particular property. any clue anyone? thanks in advance! =) this property can used run parametrized tests, if have constants don't want hardcode in test project want load , share among tests. default populated useful information, path test running. then 1 of key run same test several times different values. mstest framework can used link test project database or csv file , run tests once rows in said db. called data driven testing , you'll find many sample on net. here one how to.

virtualization - Virtualizing Wrap Panel WPF - free solution? -

i know duplication of is there (good/free) virtualizingwrappanel available wpf? , answer there not work need it. example: when click on item in partial view, takes me item below it, or when refresh items let changes take effect on ui behind scenes, scrolls top. has found good, free (or cheap) solution since last year? now know there option @ http://www.binarymission.co.uk/products/wpf_sl/virtualizingwrappanel_wpf_sl.htm , works how need it, prefer not spend grand 1 project. if 200-300 have bought $900 1 control in 1 project (so far), can't justify. any suggestions appreciated! anthony f greco use one: http://virtualwrappanel.codeplex.com/ . here's how use it: xmlns:local="clr-namespace:mywincollection" ... <local:virtualizingwrappanel ..../>

visual studio 2008 - crystal report paging issue -

m using visual studio development tool crystal report...in tht not able go on 3rd page..i mean in report viewer paging works till page 2...then if try go on next page reloads 2nd page only..please me out are sure there third page? (i'm being serious, not sarcastic) with crystal, viewer component either works or doesn't. if it's loads report, can't think of reason "lost". i've worked crystal in lot of environments, , i've never seen you're describing. if can't go page, it's processed every record.

Mystified about making a PHP double-query dynamic list work. Using PHP 5.3.5 -

i'm trying create dynamic list (5 row results) in php first getting data 1 table using resulting var latest uploaded "image_links" (just 1 each of 5 artists) table -- echo out. the code here gives me 1 row latest image. when comment out "// latest image link uploaded ///" section of code 5 rows of different artists want but, of course, w/o images. tried (among bunch of things) mysql_result() w/o while statement didn't work. so missing? thanks allen //// first artists followed //////////////// $query= "select * followartist user_id = $user_id "; $res = mysql_query($query); $num = mysql_num_rows($res); if($num>0){ while($row = mysql_fetch_array($res)){ $artist_name = $row['artist_name']; $artist_id = $row['artist_id']; $date_lastsent = $row['date_lastsent']; $date_artposted = $row['date_artposted']; $date_noteposted = $row[

Serial communication via scilab on linux -

i trying use scilab project , need pass on values robot via serial port. had done on matlab. have ported scilab don't know how pass parameter through serial port. on sclilab site there modules, work under windows http://atoms.scilab.org/

java - How to insert data into JTable? -

i write code showing strings in table. but doesnt shown , has no effect. what problrem? public pamnel() { initcomponents(); string[] columnnames = {"first name", "last name", "sport", "# of years", "vegetarian"}; object[][] data = { {"kathy", "smith", "snowboarding", new integer(5), new boolean(false)}, {"john", "doe", "rowing", new integer(3), new boolean(true)}, {"sue", "black", "knitting", new integer(2), new boolean(false)}, {"jane", "white", "speed reading", new integer(20), new boolean(true)}, {"joe", "brown", "pool", new integer(10), new boolean

Overriding default ASP.Net MVC scaffolding HTML -

each time use visual studio generate display-template using scaffolding this: <fieldset> ... <div class="display-label">property</div> <div class="display-field">@model.property</div> ... </fieldset> is there way change template use html definition list instead? <dl> ... <dt>property</dt> <dd>@model.property</dd> ... </dl> i know use displaytemplates, want generated code default in projects. take @ following post: http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx . describes customizing templates. while written mvc 1 still applies

quartz graphics - QGraphicsTextItem mouseDoubleClickEvent -

i new guy qt. question confuses me. code in mainwindow follows: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) { qgraphicsview *view = new qgraphicsview; qgraphicsscene *scene =new qgraphicsscene; graphicstextitem *item = (graphicstextitem*)scene->addtext(qstring("hello world")); item->setpos(100,100); scene->additem(item); qgraphicsitem *i = scene->itemat(120,110); view->setscene(scene); view->show(); } class graphicstextitem inherits qgraphicstextitem , protected method mousepressdown reimplemented follows: void graphicstextitem::mousedoubleclickevent(qgraphicsscenemouseevent *event) { qdebug()<<"mousedoubleclickevent happens"; qgraphicstextitem::mousedoubleclickevent(event); } the application can works normally, when give graphicstextitem object double click, nothing happens mousedoubleclickevent in class graphicstextitem. be expecting response! i searched

visual studio 2010 - Is possible to revert an ASP.NET pre-compilation? -

i have created web site, , i'll publish it... i wanna know if access ftp , download pre-compiled website can "revert" dll compilation, , re-create code behinds! is possible? if possible, how can protect code? it's possible decompile assemblies. there's not 100% safe way protect code. can obfuscate assemblies. makes harder, it's still possible to code.

php - Wordpress Widget Show Pages within Pages -

i'm looking wordpress widget (or code snippet) when displayed on page display sub pages. example page set 1 --- page 1 --- page 2 page set 2 --- page 3 so if places on page set 1 display page 1 , 2 any suggestions? if understand query correctly, don't need plugin. try pasting sidebar.php file of theme after opening <ul> tag. <?php // subpage support $children = wp_list_pages('title_li=&child_of='.$post->id.'&echo=0&depth=1'); if ($children) { ?> <li> <h2>more</h2> <ul> <?php echo $children; ?> </ul> </li> <? } ?> if haven't already, might create child theme protect changes future upgrades.

string - changing data in a struct in python -

i pretty new in python, , have problem don't know how solve. for example, have struct members such administrator, berit, etc: default_data = { 'administrator': { 'name': 'admin', 'pw': 'secret', 'is_author': false, 'is_admin': true } 'berit': { 'name': 'berit', 'pw': 'apa', 'is_author': false, 'is_admin': false } this data accessible via method method: def defaultdata(): """provides default data gruyere.""" return copy.deepcopy(default_data) i want md5 hash on passwords not in plaintext, have no idea how access fields such 'pw' , reassign new value in python. here's guess might be: stored_data = data.defaultdata() member in stored_data: field in member: if field=='pw': 'pw' = md5.new(salt+pw).hexdigest() // how access value? the v

buttonclick - javascript linking onclick to a .js to a file -

i created .js file, , included in html pages by: <script type="text/javascript" src="yourexternalfile.js"></script> how call function of .js file using onclick = "...." ? i know like: <input type="button" value="exit" onclick="javascript: ???;" > but can't figure out... if using jquery, can this, <input type="button" onclick="javascript: $.getscript('../scripts/yourfilepath' , function (){ youfunctioncall() ; } );" /> this download js file when button cliked , shall execute function called within.