Posts

Showing posts from April, 2013

c# - Open a WPF app with parameters in an XML file -

i want open app (wpf based) file contains parameters written in xml format. how can that? thanks.. as lloyd said, in wpf instead of using arguments in project startup class in ie winforms extract commmand line args. can b done whenever in first window ie this: public window1() { initializecomponent(); string[] param = environment.getcommandlineargs(); // parameter in second 1 since first contains executable path or string xmlpath = param[1]; // open , edit xmlpath // .... } then can drag&drop xml want ontop of wpf executable or invoke on commandline: yourexecutable.exe myxml.xml

asp.net mvc - Excel Interop + MVC -

is safe use excel interop inside mvc app? epplus epplus .net library reads , writes excel 2007/2010 files using open office xml format (xlsx). it not require excel installed on server. doesn't use excel libraries, api interface open office xml format (xlsx). xlsx a zip file folder structure , xml files inside describe layout , data of spreadsheet. epplus.codeplex.com . codeplex site has tons of examples plus here's additional blogpost more. just putting here actual answer.

How to open a href link in a FormToolkit of eclipse -

made hyperlink not opening webpage. toolkit = new formtoolkit(parent.getdisplay()); form = toolkit.createscrolledform(parent); form.settext("hello, abhishek eclipse form"); gridlayout layout = new gridlayout(); form.getbody().setlayout(layout); final hyperlink link = toolkit.createhyperlink(form.getbody(), "click here.", swt.wrap); link.sethref("http://www.google.com"); as per above piece of code,how should open webpage in formtoolkit view the hyperlink widget isn't browser link. doesn't know how handle links. work button, in listen click event , need to. you can find examples on how work forms here: http://www.eclipse.org/articles/article-forms/article.html here how listen link activation: link.addhyperlinklistener(new hyperlinkadapter() { public void linkactivated(hyperlinkevent e) { system.out.println("link activated!"); } to repl...

In python, how do I take the highest occurrence of something in a list, and sort it that way? -

[3, 3, 3, 4, 4, 2] would be: [ (3, 3), (4, 2), (2, 1) ] the output should sorted highest count first lowest count. in case, 3 2 1. data = [3, 3, 3, 4, 4, 2] result = [] entry in set(data): result.append((entry, data.count(entry))) result.sort(key = lambda x: -x[1]) print result >>[(3, 3), (4, 2), (2, 1)]

lighttpd - MemoryError with Django while serving a movie file -

in django application, list contents of directory contains movies (of around 400 mb). when try play movie in browser, memoryerror. have movie content inside "media" folder have marked serve statically. i believe movie should have been served directly through web server without passing request django. there error in configuration or there whole different solution available serving movies in case. i using lighttpd django , fcgi. thanks. you running out of memory because read whole file in memory & buffer before serving it. remove static url config django urls.py , configure url served lighthttpd. but best way movies of size best served streaming. take @ media streaming server , see if helps you. may you. streaming movies flowplayer , lighthttpd --sai

iPhone Core Data Recursive relationship -

i try create recursive relationship in core data. have model "menuitem" can contains other "menuitem", reference in too-many-relationship. created "children" too-many-relationship, , "parent" relationship. both relationship inverse of other one. when try compile error : ld: duplicate symbol _objc_metaclass_$_menuitem in /users/mlecomte/dropbox/projects/iphone/emakina/electrabel/xcode/build/electrabel.build/debug-iphoneos/electrabel.build/objects-normal/armv7/menuitem-fa48d8b96953ea4d.o , /users/mlecomte/dropbox/projects/iphone/emakina/electrabel/xcode/build/electrabel.build/debug-iphoneos/electrabel.build/objects-normal/armv7/menuitem-fd173522abe19c3d.o command /developer/platforms/iphoneos.platform/developer/usr/bin/gcc-4.2 failed exit code 1 edit: forget generated object managed class of menuitem. when delete relationship or when dont generate object managed class menuitem compile juste fine. i thank in advance help. re...

java - Ftp file downloaded path has problem? -

i have java code file download through ftp, after download file, goes default path. specified destination path not having downloaded file. why? code is, public class ftpupload1 { public static void main(string a[]) throws ioexception { ftpupload1 obj = new ftpupload1(); url url1 = new url("ftp://vbalamurugan:vbalamurugan@192.168.6.38/ddd.txt" ); file dest = new file("d:/rvenkatesan/software/ddd.txt"); obj.ftpdownload(dest, url1); public void ftpdownload(file destination,url url) throws ioexception { bufferedinputstream bis = null; bufferedoutputstream bos = null; try { urlconnection urlc = url.openconnection(); bis = new bufferedinputstream( urlc.getinputstream() ); bos = new bufferedoutputstream( new fileoutputstream(destination.getname() ) ); int i; //read byte byte until end of stream while ((i = bis.read())!= -1) { // bos.write(i); bos.write(i); } syst...

jQuery selector question -

i need append html this <div id="table_div"> <h1> <font color="grey"> <span>spend</span> </font> </h1> </div> becomes this <div id="table_div"> <h1> <font color="grey"> <span>spend</span> <span>new word</span> </font> </h1> </div> there multiples of these divs, different div ids, selector has begin div id. how can write selector this? give go. .after function appends content after matching elements (see http://api.jquery.com/after/ ) $("#table_div span:last").after("<span>new word</span>");

php - Smarty: print a specific element of an array WITHOUT using foreach loop -

{foreach from=$myarray item=item} {$item.attribute} {/foreach} instead of printing attributes of each element of array, want output 3rd element without using foreach loop, possible? i'm looking below, don't know syntax: $myarray[2].attribute {$myarray[2].attribute} correct. did try it?

JQuery tablesorter: Modify how it sorts empty cells -

i have big table , want sort using tablesorter. problem i'm dealing tablesorter act 0 empty cells when sorting numbers. how can push empty cells bottom? as example, tablesorter sorts that -5 -4 -1 <empty cell> <empty cell> 6 7 15 23 i want sort as -5 -4 -1 6 7 15 23 <empty cell> <empty cell> you can specify own text extraction function: $(table).tablesorter({ textextraction: function (node) { if (node.innerhtml.length == 0) { return "999999999"; // or suitably large number! } else { return node.innerhtml; } } } );

get a spesific html on return jquery ajax post -

$('#form-register').change(function() { var i_username = $('input#input-username').val(); var i_password = $('input#input-password').val(); var i_company = $('input#input-company').val(); var i_phone = $('input#input-phone').val(); $.post("home", { username : i_username, password : i_password, company : i_company, phone : i_phone, register : 'helloworld' }, function(return_data){ $('body').html(return_data); }); }); ok question maybe on $('body').html(return_data); can specific html return data ? example #errordiv contains error list if exist somehow append on page ? or there better way ? thanks looking in, adam ramadhan $(return_data) give html structure and $(return_data).find('#errordiv') give "error div" element

c# - Mapping Header cookie string to CookieCollection and vice versa -

consider web response header: set-cookie: sample=testcookie; domain=.sample.com; expires=tue, 25-jan-2012 00:49:29 gmt; path=/ this header mapped cookiecollection in .net . , when deal cookiecollection converted such header string . i'm looking way purely conversions in 2 way. surely .net has in it's internal library. believe class constructs object model text , vice versa should support 2 methods (here cookiecollection ): // creating cookie collection header text cookiecollection.tryparse(cookieheaderstring, out mycookiecollection); // , getting final header sent request string cookieheaderstring = mycookiecollection.getcookieheaderstring(); how can achieve cookiecollection ? i think looking cookiecontainer . see setcookies method.

c# - ConstraintException but i don't know why! -

i'm getting unhandled constraint exception when run following code particular set of paramaters: using (mysqlconnection connmysql = new mysqlconnection(global.g_connstring)) { mysqlcommand cmd = connmysql.createcommand(); cmd.commandtext = this.query; connmysql.open(); using (mysqldatareader dr = cmd.executereader()) { datatable dt = new datatable(); dt.load(dr); return dt; } however, if run query direct (i.e. not on application using query browser) can't see null values or generate error. it must data specific, if change date range of query works fine. anyone got ideas?! thanks, ben ps query follows: select coalesce(ti.first_name, 'not assigned') 'technician',wo.workorderid 'request id',aau.first_name 'requester', wo.title 'subject', rrs.resolution...

How to save Images that are dowloaded WebView in android -

on loading image url in webview want store doesn't store. this code. uri uri="http://202.87.34.17/mobiledetect/wallpaper/wallpaper_01.jpg"; widget29=(webview)findviewbyid(r.id.widget29); widget29.loadurl(image); save(); try{ string path = environment.getexternalstoragedirectory().tostring(); outputstream fout = null; file file = new file(path, "/sdcard"+image_filename+".jpg"); fout = new fileoutputstream(file); bitmap mbitmap = null; mbitmap.compress(bitmap.compressformat.jpeg, 85, fout); fout.flush(); fout.close(); mediastore.images.media.insertimage(getcontentresolver(), file.getabsolutepath(), file.getname(),file.getname()); } catch (exception e) { e.printstacktrace(); } i not sure, perhaps need wait until image has downloaded before call save function? i'm not experienced android, dont know if continues instantly or waits until image complete before code continues. but t...

Is having an XSD considered good practice when passing XML marshalled objects across the wire? -

i'm using mix of jaxb, jpa, , restful web service pass objects across wire. domain objects contain mix of jpa , jaxb annotations, , i'm able unmarshall domain objects using spring's resttemplate minimum amount of code. remember reading not long ago (may have been answer on so, may have been blog) author argued never rely on annotations in production environment, marshall , unmarshall according schema. still necessary practice? if have .jar annotated beans dependency in 2 projects (e.g. producing restful web service , consuming client), wouldn't introducing generated xsds add set of data requiring maintenance? when using annotated jaxb pojos, when schemas necessary , benefit provide? jaxb represents metadata annotations there no marshal/unmarshal according xml schema. i lead jaxb component ( moxy ) of eclipselink , best know jpa implementation . recommendation developers use combination of jaxb & jpa annotations on model. uses of xml schema: as...

html - Integrating javascript unit tests in an existing webpage -

i have javascript functions test in context of webpage. clear, these javascript functions closely coupled web-page. manipulate kinds of gui related stuff on webpage. unit-test web-page , not javascript functions. i able test functionality in original webpage. however, testing suites qunit require add code page start-up test suite. problem new html web-page not contain code. a trivial solution copy-paste original html page test-suite page. "filthy" solution require me copy html page test-suite-page each time. in c++/java test code include/import original code , needs, in html lack proper include statement. what proper solution this? it seems you're trying perform browser test, , not pure javascript one. check if selenium fits needs. can use interact page , check presence or absence of text, or run javascript code in context of page and, again, check effects.

Android app that just points to a URL -

if build website designed , developed android or droid, possible make app directly point url? or not considered app because open in droid browser etc... you can't create link in android - you'd have make app automatically opens browser , goes specified url when opened. something in oncreate : intent browserintent = new intent("android.intent.action.view", uri.parse("http://www.google.com")); startactivity(browserintent);

c# - Best way to display a group/selection of radiobuttons from the choice of a single radiobutton? -

i have form questions ask if included , if isn't supply reason. so need radio button records database it's value normal have setup radiobuttonfor , if "no"(false) selected group/list of other radiobuttons display. ofc ideal solution if method isn't feasible solution maybe if statement in controller if main radiobutton has value of "yes"(true) set values of x, y , z radiobuttons "no"(false) when records form database. these 2 ideas have on how same end result 1st idea think easiest way perform it's function in jquery i'm new @ struggle come how for 2nd idea it's 1 not ideal , 2 i'm not sure how reference radiobuttons/code if statement said task. any other ideas welcome on how implement them. well, may sound overkill, go both solutions. need javascript script side code right presentation standpoint - , need server-side code validation right too. if implement client-side validation, how system behave if b...

java - Is this the most efficient way to parse the string? -

i have string of form au 12345t or au 12345t1 ; of form alphabet characters(s) followed number ending in 1 or 2 character alpha-numeric string. i using following regular expression me result: ^[a-z|a-z]+|[0-9]+|[a-z|a-z][0-9]? would efficient way parse such string? so example au 12345t , want result separated 3 tokens: au , 12345 , t ; au 12345t1 should au , 12345 , t1 (since ending characters can alpha-numeric , max length 2) this should it: [a-za-z]+\s?[0-9]+[a-za-z0-9]{1,2}? if want separate strings said, put parenthesis around blocks, so: ([a-za-z]+)\s?([0-9]+)([a-za-z0-9]{1,2}?) this have regex return each group individually. all being said, you'll want ensure final one/two character alphanumeric string begins letter, or else you'll have no way of separating second token third token.

bash - grep for multiple strings in file on different lines (ie. whole file, not line based search)? -

i want grep files containing words dansk , svenska or norsk on line, usable returncode (as have info strings contained, one-liner goes little further this). i have many files lines in them this: disc title: unknown title: 01, length: 01:33:37.000 chapters: 33, cells: 31, audio streams: 04, subpictures: 20 subtitle: 01, language: ar - arabic, content: undefined, stream id: 0x20, subtitle: 02, language: bg - bulgarian, content: undefined, stream id: 0x21, subtitle: 03, language: cs - czech, content: undefined, stream id: 0x22, subtitle: 04, language: da - dansk, content: undefined, stream id: 0x23, subtitle: 05, language: de - deutsch, content: undefined, stream id: 0x24, (...) here pseudocode of want: for files in directory; if file contains "dansk" , "norsk" , "svenska" echo filename end what best way this? can done on 1 line? you can use: grep -l dansk * | xargs grep -l norsk |...

how to traverse though a 2d char array searching for words in java? -

i having trouble school assignment , appreciate insight. asked create wordsearch using 25x25 2d char array , somehow go through array developing algorithm search through find 21 pre-defined words. so far have been able create ragged array of words need find , 2d array chars placed in each position. in = new asciidatafile("wordsearch.txt"); display = new asciidisplayer(); int numberwords = in.readint(); wordlist = new char[numberwords][]; (int =0; i<wordlist.length; i++){ wordlist[i] = in.readline().touppercase().tochararray(); } for(int = 0;i<wordlist.length; i++){ display.writeline(" "); for(int j = 0;j<wordlist[i].length; j++){ display.writechar(wordlist[i][j]); } } //done wordlists int gridlength = in.readint(); int gridheight = in.readint(); grid = new char[gridheight][gridlength]; for(int = 0;i<gridlength; i++){ grid[i] = in.readline().tochararray(); } my problem in creating algorithm search though 2d array , match cha...

javascript - onchange not working with radio button -

i have few radio buttons should call hider(something); when change, meaning when checked or unchecked. works, i.e. when checked call js function, however, if they're unchecked due selecting radio button group, not call js script again. do need use else onchange? this radio buttons @ moment: <input name="ostype" type="radio" value="0" onchange="hider(solaris);">solaris <input name="ostype" type="radio" value="1" onchange="hider(linux);">linux my hider function currently: function hider(divid) { if ($(divid).is('.hidden')) { $(divid).removeclass('hidden'); } else { $(divid).addclass('hidden'); } } since question still not answered correctly yet ranks quite high me in google "radio button onchange", here's proper solution still looking. if you're using jquery, use jquery's attribute selector noted flavius stef . op...

c++ - How to format identation for stream operators in Eclipse? -

i'd auto-format stream operator in eclipse in following way: std::cout << "creating cache entry initial data staff = " << std::endl; nmspace::myspecialstream << "some text printed here." << nmspace::endl; essentially, i'd stream operator align on next line first stream operator on previous line. there way similar formatting function arguments function arguments aligned on each line first argument, consider example: void manager::func(nmspace::someverylongtype::sometypewithinthatlongtype arg1, int arg2); wondering if possible streams well?

c# - Problem using Regex.Replace when text containing $ and using \b boundry -

have following problem using regex , $ in string. wondring if can assist. bla in text below random words. string text = "<id='$text1$text2$text3'><div>bla bla bla text3 bla bla</div>"; string pattern = "\btext3\b"; text = regex.replace(text, pattern, "####"); if above, replace both text3. want change value in div element result becomes: <id='$text1$text2$text3'> <div>bla bla bla #### bla bla</div> . thanks in advance! string pattern = @"\btext3\b(?![^<>]*>)"; this quick-and-dirty solution relies on several simplifying assumptions, regexes must if they're used on html. example, assumes there never angle brackets in attribute values. that's legal (in html @ least), it's extremely rare in practice.

django SelectDateWidget Years in reverse -

is there way in can "selectdatewidget" display years in reverse or desc order? my_form_field = forms.datefield(widget=monthyearwidget(years=range(2012,1970))) does not seem work. monthyear widget smaller breakdown gives month , year try years=range(2012,1970,-1) (note -1 step/increment).

msysgit - How should I keep my git project branch up to date with master? -

let's have master branch , project branch, both on our remote origin . work being done in project branch, bug fix needs go master can deployed immediately. when project done, want able squash commits in project single commit , merge master . usually feature branches (that not pushed origin ), keep them date merely rebasing master , going on our merry way, because project own branch on origin , i'm not sure how keep history way want (commits master , new project commits, no merge commits ideally) due safeguards rewriting history on remote branches. deleting remote project , recreating correct history, suboptimal. i'm okay rewriting history on remote project because team of 2 , understand implications , willing ridiculously careful. how accomplish it? you can merge braches in git git checkout project git merge origin/master that merge changes master has project, long came same ancestor.

How to add HTML Markup to a textbox or label Control in a windows form C# -

let's textbox control named messagetb. know if possible following: messagetb.text = "hello <b>world</b>" and have output text show "hello world ". in other words there way enable html markup control? using visual studio. the standard windows forms textbox control can't it. if want formatted text need richtextbox or other control.

functional programming - Erlang print 2 list -

i have 2 list: list1 = [1,2,3]. list2 = ["asd", "sda", "dsa"]. how can print list in following turn: 1 asd 2 sda 3 dsa thank you. 1> lists:zipwith(fun (x1, x2) -> io:format("~p ~p ", [x1,x2]) end, list1, list2). 1 "asd" 2 "sda" 3 "dsa" [ok,ok,ok] 2>

Standards for software functional testing -

what documented standards functional testing exists? i know "standard software component testing" (bs 7925-2), unit testing standard. i need similar functional testing. maybe should search through huge amount of ieee standards . also, check if iso/iec 9126-1:2001 standard work you.

function - Determine how long PHP executed so far -

i need determine how long php function has been running far. what options find out how long php code takes run? i'm using zend framework. call microtime(true) function fetch current time milisecond resolution. <?php $starttime = microtime(true); /*stuff going on*/ echo "elapsed time is: ". (microtime(true) - $starttime) ." seconds";

NHibernate property change tracking -

what best way implement property change tracking nhibernate. i'm migrating application linq-to-sql , implementing in entity so. public class task { partial void onloaded() { originaltitle = title; } public bool originaltitle { get; private set; } public bool titlechanged { { return title != originaltitle; } } } however, there onloaded event method in nhibernate. there way code auto-generated somehow? you can try session event listener: http://www.nhforge.org/doc/nh/en/index.html#events

properties - Function with a property in javascript? -

i have object parameter , has property value . thusly defined var parameter = { value : function() { //do stuff } }; my problem that, in cases, value needs have property of own named length can that? seems putting this.length = foo not work, neither parameter.value.length = foo after object declaration. the problem seems selection of word 'length'. in javascript, functions objects , can have properties. functions have length property returns number of parameters function declared with. code works: var parameter = { value : function() { //do stuff } }; parameter.value.otherlength = 3; alert(parameter.value.otherlength);

ruby on rails - Validation always fails on all fields -

i'm on rails 3. have model called client has name , phone , email . model file looks this: class client < activerecord::base belongs_to :salon belongs_to :address validates_presence_of :name validates_presence_of :phone validates_presence_of :email accepts_nested_attributes_for :address attr_accessible :address_attributes end as can see, name , phone , email required. when go form i'm supposed able create new client , submit it, 3 validations fail, no matter put in fields. here form file: <%= form_for(@client) |f| %> <% if @client.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@client.errors.count, "error") %> prohibited client being saved:</h2> <ul> <% @client.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <%= f.hidden_field :...

audio - How to play sound on phone call with Android? -

it possible programmatically interact phone call? can you, example, play audio caller program? google has not exposed api allows feed data particular ongoing call. can have control on call. check article : here

ruby on rails 3 - Any possible way to set radio_button_tag values by a database set value -

i have radio_button_tag in form, holds various values persons current availability: mike donnall o available o out of office o vacation so open form, , select value, sets value in status table person. however, there's functionality re-open form , update present status, perhaps vacation available. my question is, there anyway @ radio button :checked can modified accept custom method, have found in similar posting, want value foe radio button set value in db. my code far, stab in dark perhaps: view: <% @people.each |p| %> <% @statuses.each |s| %> <%= "#{p.name}" %> <%= "#{s.status_name}" -%><%= radio_button_tag ['person', p.id], ['status', s.id], checked?(p.id) %> <% end %> <% end %> helper: def checked?(person) @person = person @status = status.find_by_sql(['select status_id statuses person_id = ?, @person]) if @res...

measure time .net thread spent waiting for IO -

this continuation how time spent in .net thread? i know how can measure cpu time of thread ( http://www.codeproject.com/kb/dotnet/executionstopwatch.aspx ), don't know how measure io wait of thread. thread waits io, gets interrupted. while other threads executing, io operation of our thread long over, return our thread, stop stopwatch, shows incorrectly large time. ideas on this? do need done in code specifically? if use windbg can use !runaway cpu time of each thread both kernel , user mode http://blogs.msdn.com/b/debuggingtoolbox/archive/2009/08/20/special-command-cpu-time-for-each-thread-with-runaway.aspx . alternatively can use processexplorer. if double click on process can information on thread tab. http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx . alternatively thread on c++ how cpu usage per thread on windows (win32) has information on win32 api calls.

arrays - array_flip():Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() -

i have migrated module drupal7 (on php version 5.3.1) , getting following errors: * warning: array_flip() [function.array-flip]: can flip string , integer values! in drupaldefaultentitycontroller->load() (line 178 of c:\users\akulkarni\desktop\xampp\htdocs\servicecasting\includes\entity.inc). * warning: array_flip() [function.array-flip]: can flip string , integer values! in drupaldefaultentitycontroller->load() (line 178 of c:\users\akulkarni\desktop\xampp\htdocs\servicecasting\includes\entity.inc). * warning: array_flip() [function.array-flip]: can flip string , integer values! in drupaldefaultentitycontroller->load() (line 178 of c:\users\akulkarni\desktop\xampp\htdocs\servicecasting\includes\entity.inc). * warning: array_flip() [function.array-flip]: can flip string , integer values! in drupaldefaultentitycontroller->cacheget() (line 354 of c:\users\akulkarni\desktop\xampp\htdocs\servicecasting\includes\entity.inc). * warning: array_flip() [fun...

c++ - How can I output traffic information (IP, port, etc.) to a log file using Windows Filtering Platform and Windows Driver Development Kit? -

i working on driver using wdk monitor network traffic , output log file. i trying modify inspect example given in winddk directory. it seems can't call printf, fprintf, etc. because of linker error: unresolved external symbol __imp_printf ... is there way output traffic information log file? not linking library somewhere properly? thank you well writing kernelmode drivers have call dbgprint equivalent printf in c. printf(format, params) -> dbgprint(format, params) you have use either windbg or dbgview tool view debug messages. to dump file should first open file createfile function. once handle open , valid, can write using writefile function.

Java BigDecimal alternative library -

this may strike particularly odd must compile several new code against gcj; doesn't support java's bigdecimal. what i'm looking alternative java.math.bigdecimal. can point me in right direction? thanks! it looks gcj compiling against jdk 1.4.2, provides setscale(int scale, int roundingmode) , setscale(int scale) . the code you're trying compile seems have been written jdk 1.5.0 , above. in jdk 1.5.0, setscale(int newscale, roundingmode roundingmode) in addition other two. you can see if there update gcj lets use 1.5. looking @ gcj website , don't see case. says current version "supports of 1.4 libraries plus 1.5 additions." your other option rewrite code calls setscale(int newscale, roundingmode roundingmode) replaced setscale(int scale, int roundingmode) . in 1.5.0, instead of specifing integer value roundingmode (using static ints in bigdecimal ), can specify using roundingmode enum (the older method still maintained backwar...

Is there a similar way to read integer pairs from stdin to vector<pair<int,int> > in C++ -

i wondering if there way slick following copy(istream_iterator<int>(cin), istream_iterator<int>(),back_inserter(v)); to copy pairs of int vector<pair<int,int> > when input given in pairs in order of appearance? thanks. you can – need write own operator >> pair class first. operator whole secret of above call. actual implementation depends on format of int pairs.

asp.net - Query Time out - sporadic -

have asp.net web application querying data sql server 2005 database. have 1 page sporadically timeout. traced code , found sql. running sql through query tool , runs under 2 seconds. default timeout sql server 10 minutes. the fix has been change sql server time out 20 minutes , 10 minutes. page takes 2 seconds query , display. have looked @ possible locking nothing shows cause problem. conclusion reseting of timeout setting killing process. looking ideas can traced. thanks there 2 different timeouts @ play here. connection timeout (specified in connect string , property of sqlconnection), , query timeout (the property sqlcommand.commandtimeout). default values are: connection timeout: 15 seconds. query timeout: 30 seconds. query timeout defined " the cumulative time-out network reads during command execution or processing of results. time-out can still occur after first row returned, , not include user processing time, network read time. " lot...

How to handle UI interaction from view model without user request using MVVM, PRISM, and MEF -

i working on application using wpf, mvvm, prism, , mef. i using combination of navigation request navigate, controllers view management using region manager, , eventing via event aggregator run application in single window. i'm using view first approach similar how stock trader ri works. works great when view model code interact ui (busy indicator) kicked off user, when started behind scenes there can problems. i know may seem poor implementation, think have valid scenario. particular example has login. currently application starts , loads shell. login view loaded main content region of shell. when user clicks "login" busy indicator shown , client application services login executed. when login complete, busy indicator goes away, , screen navigated user's home screen. this works because navigation login , navigation initiated user clicking login button. so have new requirement user can select auto login on login form, such next time user starts ap...

Using People Pickers in an InfoPath repeating section -

i have repeating section contains 3 people pickers loads different data given object. when click use "run query" option load of objects, correctly populated first item. however, instead of loading correct values remaining objects, same values used every other object instead of loading them individually given object. each people-picker in own group when choose value, others aren't affected. however, if have more 1 object visible (by object mean group of fields in repeating section) value corresponding field in people-pickers other objects gets set same value. how can make these objects treated separately?

c# - Making a form be invisible when it first loads -

currently, form's opacity 0%, when loads, should invisible, when form loads, it's visible few seconds. since default opacity set 0% , form's visibility set false before it's opacity set 100%, think form should invisible until tell to. public formmain() { initializecomponent(); this.visible = false; this.opacity = 1.00; } how can make form invisible default? it's possible. have prevent application class making form visible. cannot tinker application, that's locked up. works: protected override void setvisiblecore(bool value) { if (!this.ishandlecreated) { this.createhandle(); value = false; } base.setvisiblecore(value); } this one-time cancellation, next call show() or setting visible = true make visible. you'd need kind of trigger, notifyicon context menu typical. beware load event won't run until gets visible. else works normal, callin...

android - Understanding BaseAdapters and how to use them -

i'm trying set image gridview layout, , involves deriving new class baseadapter class. have been using tutorial on website developer.android.com, still don't quite understand means. please explain me baseadapter? don't understand definition provided android developers website. thanks an adapter used bind data view. see adapterview : an adapterview view children determined adapter. several layout views derive adapterview gridview, listview, , gallery. of course, don't use adapterview , adapter directly, rather use or derive 1 of subclasses. subclasses of adapter may add additional functionality change how should bind data view. baseadapter abstract base class adaptor interface simplify implementing adapters. implement own, framework provides pretty flexible adapters already. popular adapters are: arrayadapter , binds array of data view override getview() inflate, populate, , return custom view given index in array. getview() method ...

How to use anchored pairs with fonts on Android -

background: font files have advanced tables embedded in them allowed glyph substitution, combined forms , anchored pairs. for english speakers, think having 3 characters "1", "/", , "2 , font automatically combines them new glyph looks ½ that small 1/2 if doesn't display correctly you. question: know if android supports these advanced typography tables?

flash - Box2d As3 contact listener problem -

i'm having problem box2d as3 b2contactlistener class. have class named contactlistener extends b2contactlistener , overrides postsolve method. postsolve takes 2 parameters, contact holds info 2 objects have contact, , impulse holds info contact. i'm using impulse parameter decide how hard 2 objects hit , apply damage accordingly. here problem: if make circular, , let roll on static body have ground, drop large object anywhere on ground, circle while in motion contacts repeating impulse way large rolling. causes rolling circular objects break when shouldn't. its if shaking static body , causing massive damage objects hundreds of meters away, affects circles. can shed light on situation? known issue? workarounds? i using box2das3 version 2.1a. update: once body enters weird state of applying damage, circle touches gets tons of large impulses. once non circular come in contact body, no longer has problem. problem not on static objects dynamic , kinematic well. ...

javascript - Is there a more efficient way to write this function? -

function month(num) { if (num == 1) { return "january"; } else if (num == 2) { return "feburary"; } else if (num == 3) { return "march"; } else if (num == 4) { return "april"; } else if (num == 5) { return "may"; } else if (num == 6) { return "june"; } else if (num == 7) { return "july"; } else if (num == 8) { return "august"; } else if (num == 9) { return "september"; } else if (num == 10) { return "october"; } else if (num == 11) { return "november"; } else if (num == 12) { return "december"; } else { return false; } } jquery/javascript. yes, use month number index array of strings (month names).

Javascript API for IOS Iphone 3G for camera access -

is there way access iphone 3g camera via javascript capture photo , utilize photo in html post? came across api called phonegap search on here mentioned iphone 4. hoping find work on 3g , 3gs models. although old question, wanted add feature coming web , implemented in browsers . navigator.getmedia = ( navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia || navigator.msgetusermedia); there w3c specification getusermedia . although gets video, can take still image video stream . there lots of apis coming browser - times ahead!

email - Magento mailing feature in custom script -

i have created custom script import bulk number of customers magento database. client needed each 100 customers import needed mail whats going on , status of importing. so how can use magento mailing functionality can create template send mail magento does. please me i think you're looking along following lines: $store_id = $this->getstoreid(); $template = "import_script_email_template_name"; $from = mage::getstoreconfig(self::xml_path_email_identity, $store_id); $to = array( "name" => "nick", "email" => "the@email.address" ); $template_variables = array( "var1" => "somevalue", "var2" => "someothervalue" ); $mail = mage::getmodel("core/email_template"); $mail->setdesignconfig( array( "area" => "frontend", "store" => $store_id )) ->sendtransactional( $template_name, $from, ...

css - How to center webpage content -

i can't seem solve issue on why 2 divs not centering on page. know because of float: left. life of me, can't figure out how solve problem. can help? here html: <body> <div align="center"> <div id="left" class="left"> left box needs on left of of white box </div> <div id="content" class="content"> right box needs on right side of red box </div> </div> </body> here css: body, div, h1, h2, h3, h4, h5, h6, p, ul, img {margin:0px; padding:0px; } body { font-family: arial, sans-serif; background: #006699; } .content{ width: 300px; float: left; background: #ffffff; height: 300px; } .left{ background: none repeat scroll 0 0 red; float: left; height: 300px; width: 300px; } i know float: left; causing problem don't know how solve it. thanks. wrap them in div set width , margin: 0 auto; ... example change top level div align=...

iphone - Trying to base some code off of Apple's Image Zooming App example, missing some simple Interface Builder knowledge -

i'm trying base part of app off of apple's image zooming example, zooming, scrolling, , orientation of images saved app's sandbox. http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/uiscrollview_pg/introduction/introduction.html i have sort of working now, except when scrollview loads, it's blank. code looks this: @interface photoviewcontroller : uiviewcontroller <uiscrollviewdelegate> { uiscrollview *imagescrollview; uiimageview *imageview; } @property (nonatomic, retain) iboutlet uiscrollview *imagescrollview; @property (nonatomic, retain) uiimageview *imageview; @end @implementation photoviewcontroller @synthesize imageview, imagescrollview; - (void)viewdidload { [super viewdidload]; imagescrollview.bounceszoom = yes; imagescrollview.delegate = self; imagescrollview.clipstobounds = yes; imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image1.jpg"]]; imageview.autoresizingmask = uiviewautor...

dependencies - How to implement variable dependency versions in Maven3 using _profiles_? -

we need build project different versions of deps (in example, postgres 8 , postgres 9). also, our developers have different versions of dbs on computers. i'm tried this: <profile> <id>postgres9</id> <properties> <postgres.driver.version> 9.0-801 </postgres.driver.version> </properties> </profile> <profile> <id>postgres8</id> <properties> <postgres.driver.version> 8.3-603 </postgres.driver.version> </properties> </profile> <dependency> <groupid>postgresql</groupid> <artifactid>postgresql</artifactid> <version>${postgres.driver.version}</version> </dependency> <properties> <postgres.driver.version>8.3-603</postgres.driver.version...

iphone Dev. How can I make my app compatible with iOS 3 and iPads at the same time (iOS 4.2) -

i've been looking around way make application compatible iphones-ios3 , @ same time make compatible iphones , ipads have ios 4.2 i have seen apps on app store claim compatible iphones ios3 , above, , ipads. any idea on how that? how test against different versions , how compile final version gets uploaded on app store. to make app load in both ipad , iphone, make sure have 2 different xibs cater each device, @ application launch, check device whether it's ipad or iphone , load xib file accordingly. ios3 , multitasking unsupported devices call applicationdidterminate method when home button pressed. ios4 onwards, make sure applicationdidenterbackground method implemented support multitasking. uncheck in info.plist file app not support multitasking (not recommended apple), ios call applicationdidterminate instead , app still usable in both ios3 & ios4. cheers.

android - Launch any application on emulator via terminal -

how launch application via terminal or command shell on android emulator engine? example, if want start game, how do via terminal or command shell? anyone appreciated. thanks, sam. you can use am start command trough adb. example browser app floating around internet: am start -a android.intent.action.main -n com.android.browser/.browseractivity

.net 4.0 - How to connect to SQL Server Ce database from C#? -

how connect sql server ce db c# dotnet 4.0 i've heard of system.data.sqlserverce namespace connecting local database unable find in .net 4.0 is there alternate class? you need have included system.data.sqlserverce namespace its in system.data.sqlserverce.dll if namespace doesn't show haven't included refrence dll . add reference dll , should available. if still having problem check out in gac . (on system here: c:\windows\microsoft.net\assembly\gac_msil\system.data.sqlserverce.entity\v4.0_4.0.0.0__89845dcd8080cc91 some answers have mentioned how use it.

perl - How is use local::lib different from use lib? -

i don't understand use local::lib regular use lib doesn't. explain it? local::lib defaults ~/perl5 if don't specify directory (while use lib; no-op). resolves relative paths absolute paths before adding them @inc . ( lib adds relative path as-is.) expands ~ , ~user in directory name. appends /lib/perl5 directory specify. (so use local::lib '/foo'; equivalent use lib '/foo/lib/perl5'; .) prepends dir/bin path, can use scripts installed local modules.

Is there a way for the cache to stay up without timeout after crash in AppFabric Cache? -

first setup used testing purpose: 3 virtual machines running following configuration: ms windows 2008 server standard edition latest version of appfabric cache each 1 has local network share config file stored (i have added machines in each config) the cache distributed not high availibility (we don't have enterprise version of windows) each host configured lead, according documentation @ least 1 host should allowed crash. each machine has website testing installed, , local cache configured one linux machine used proxy (varnish used) distribute traffic testing purpose. that's setup , on problem. scenario testing simulating 1 of servers crashing , bring in cluster. have problem both server crashing , bringing up. steps using test it: direct traffic varnish on linux machine 1 server only. log in make sure there in cache. unplug network cable 1 of other servers (simulates server crashing) now cache timeout , service error. want application still on serve...

apache - Rewrite rule for subdomain and folders -

i need write rewrite rules apache use subdomains. rules should based on: subdomain.domain.com => /home/domain/docs/some_folder/file.php?subdomain=subdomain subdomain.domain.com/edit => /home/domain/docs/some_other_folder/file.php subdomain.domain.com/dashboard/display/id => /home/domain/docs/some_other_folder2/file.php?param1=display&param2=id i using ajax calls on site not going work, understood searching internet. hint on really helps. i appreciate help! in advance. i'm gonna try rewriteengine on rewritebase / rewritecond %{http_host} !^subdomain.domain.com$ rewriterule .* - [l] rewritecond %{http_host} (.*) rewriterule ^$ /home/docs/some_folder/file.php?subdomain=%1 [l,qsa] rewriterule ^edit$ /home/docs/some_other_folder/file.php [l] rewriterule ^dashboard/(\w+)/(\w+) /home/docs/some_other_folder2/file.php?param1=$1&param2=$2 [qsa,l]

import - Oracle imp / exp -

after full oracle export, views preserved when import dump file ? the db version 11g . the utilities imp / exp . the views transferred, not optimized. means have views (ddl available), not populated. can see in documentation in full mode user views says 'yes'

iPhone, PHP, MySQL communication -

a noob here..... i'm looking tutorial on coding in xcode retrieve data mysql server php. clear on want, mysql database on server side, , iphone user can data , not changing it. , native iphone application, not web application. this should common since there many apps using technique still couldn't myself it. have installed mamp on mac. any source learn really appreciated. thanks! the first link in google 'iphone php mysql tutorial' http://icodeblog.com/2009/10/29/iphone-coding-tutorial-creating-an-online-leaderboard-for-your-games/

java - Lucene strange behaviour -

i'm trying start using lucene. code, i'm using index documents is: public void index(string type, string words) { indexwriter indexwriter = null; try { if (dir == null) dir = createandpropagate(); indexwriter = new indexwriter(dir, new standardanalyzer(), true, new keeponlylastcommitdeletionpolicy(), indexwriter.maxfieldlength.unlimited); field wordsfield = new field(field_words, words, field.store.yes, field.index.analyzed); field typefield = new field(field_type, type, field.store.yes, field.index.analyzed); document doc = new document(); doc.add(wordsfield); doc.add(typefield); indexwriter.adddocument(doc); indexwriter.commit(); } catch (ioexception e) { logger.error("problems while adding entry index.", e); ...

java - placing properties in database instead of property file -

java, placing , loading properties database instead of property file better approach ? advantages if place in db. it can centrally shared. if want retrieve particular key don't need load whole data can uniquely obtain value key. dbms reliable file io. advantages of properties file : if data size smaller storing in properties file beneficial.

jquery - How to find out if a tag has a specific class AND id -

have body tag on page has both id , class: <body class="class" id="id"> i'm trying use jquery chance content further down page, based on class , id are. i've had no success, it's worth, here's tried do: if($('body').is('#id1')){ if($(this).hasclass('class1')){ $('ul.nav li.first').html('<h2>special title</h2>'); }else if($(this).hasclass('class2')){ $('ul.nav li.first').html('<h2>other title</h2>'); } }else if($('body').is('#id2')){ if($(this).hasclass('class1')){ $('ul.nav li.first').html('<h2>special header</h2>'); }else if($(this).hasclass('class2')){ $('ul.nav li.first').html('<h2>other title</h2>'); } } anyone have quick way of doing this? i'm terrible @ "if" looping using jquery, have ...

objective c - load a menu from nib -

i have main.xib, main window, main menu, , second menu name "statusmenu" connects nowhere. in application, have nsstatusitem, , want press it, , display secondary menu. how can connect two? thanks create iboutlet status item menu, , when create status item set menu: [statusitem setmenu: statusitemmenu];

PHP Simple HTML DOM Parser -

i started use php simple html dom parser . now i'm trying extract elements surrounded <b> -tag inclduing </b> exsiting html document. works fine foreach($html->find('b') $q) echo $q; how can achieve show elements surrounded <b> , </b> -tags followed <span class="marked"> ? update: i've used firebug css path elements. looks this: foreach ($html->find('html body div#wrapper table.desc tbody tr td div span.marked') $x) foreach ($x->find('html body div#wrapper table.desc tbody tr td table.split tbody tr td b') $d) echo $d; but won't work... ideas? update: to clarify question here sample tr of document starting table , ending table tags. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="desc"> <tr> <th width="25%" scope="col"><div align="cente...