Posts

Showing posts from September, 2015

Remove a semicolon in a string by JavaScript -

this question has answer here: how replace occurrences of string in javascript? 35 answers how can remove semicolon ( ; ) string using javascript? for example: var str = '<div id="confirmmsg" style="margin-top: -5px;">' how can remove semicolon str ? you can use replace method of string object. here w3schools says it: javascript replace() . in case following: str = str.replace(";", ""); you can use regular expression: str = str.replace(/;/g, ""); this replace semicolons globally. if wish replace first instance remove g first parameter.

actionscript: can I get the http request URL? -

a.swf loaded in a.html hosted @ http://www.a.com/a.html . i want know, if user browses http://www.a.com/a.html , in actionscript, can http request url? in example want http://www.a.com/a.html . flash: this.loaderinfo.url flex: application.url or application.loaderinfo.url

html - How to make my button into an Image button? -

i have default button. how make button image? when click on button normal thing happens. want image on button. thanks. you may try this: <input type="image" src="image location" alt="submit">

Sharepoint:ListFieldIterator - ExcludeFields property does not work -

i've written new page uses sharepoint's listfielditerator. exclude few fields view , i've found solution using excludefields doesn't work. control displays fields, nevermind what's in excludefields property. couldn't find complaining such problem on internet. there's code (nothing fancy): <sharepoint:listfielditerator id="lfiitemdetails" controlmode="display" runat="server" excludefields="testid" /> listid , itemid set programmatically in oninit. try hash. column want hide called "printorder" changed from: <sharepoint:listfielditerator controlmode="display" templatename="widefieldlistiterator" excludefields="fileleafref;#wikifield" runat="server"/> to <sharepoint:listfielditerator controlmode="display" templatename="widefieldlistiterator" excludefields="fileleafref;#wikifield;#printorder" runat="...

How can i add clickHandler to the <li> tag in GWT? -

i want add clickhandler < li> tag please me ... you use focuswidget once you've got hold of element. there's focuswidget constructor taking single element. after can call addclickhandler

mysql - is this possible to made two primary key in one table -

hi want know is possible make primarykey in 1 table in mysql. if yes please tell me concept behind this. because have seen table in 2 primary key there no auto increment set you can have 1 primary key, but: you can combine more 1 column primary key (maybe it's have seen) the primary key don't needs auto-increment, has unique you can add more 1 index 1 or more colums speed select-statements (but slow down insert / update) those indexes can marked unique, wich means don't let insert second row same content in index-fields (just primary key)

datasource - Problem with query as a new data source in Cognos PowerPlay -

normally can add query new data source in cognos powerplay (i'm running powerplay version 7.3), when try cannot select queries access database. dropdown menu shows existing queries in database empty. when add table new data source works fine, , tables shown in dropdown. previously worked fine queries too, won't work. know if it's cognos error or system configuration on pc causes error appear? i didn't find answers question, did come workaround solution problem. the trick create new ms access database (fx called workarounddatabase) , create query has same name original query in mother database (the name of query wanted add data source in first place). then first create new data source links query in workarounddatabase. secondly right-click on data source , change path mother database. since names of queries same data source links query in mother database (which wanted, byt couldn't directly because of cognos powerplay bug). this procedure works f...

php - Enabling $_GET in codeigniter -

i've been trying figure out how enable $_get in ci. it appears framework deliberately destroys $_get array, , enabling requires serious tinkering core classes. can why is, , how overcome it? mind you, i'm looking keep uri parsing , routing way are, have $_get available well. add following library application libraries. overrides behaviour of default input library of clearing $_get array. allows mixture of uri segments , query string. application/libraries/my_input.php class my_input extends ci_input { function _sanitize_globals() { $this->allow_get_array = true; parent::_sanitize_globals(); } } its necessary modify configuration settings. uri_protocol setting needs changed path_info , '?' character needs added list of allowed characters in uri. application/config/config.php $config['uri_protocol'] = "path_info"; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?'; it possibl...

Java - static factory method and switch statements -

i dealing set of message objects, each of has unique identifier corresponding them. each message can constructed either map, or bytebuffer (the messages binary, know how transfer , binary representation). the current implementation constructing these messages follows: public static message frommap(int uuid, map<string, object> fields) { switch (uuid) { case first_message_id: return new firstmessage(fields); . . . default: // error return null; } } public static message frombytebuffer(int uuid, bytebuffer buffer) { switch (uuid) { case first_message_id: return new firstmessage(buffer); . . . default: // error return null; } } now, josh bloch's effective java talks item 1: consider static factory methods instead of constructors, , seems place pattern useful (clients don't directly access constructors of message subtypes...

javascript - using respond_to format.js to replace the content of a textarea on rails -

i have saved text in create controller. if it's not stressful, i'd populate textarea on page saved text along displaying error message fields (which what's happening). i've used things replace_html before, don't know if there's easy way textarea or text field ids , replace value of text. i'm going javascript nice know rails shortcut. edit: wasn't in right mindset because app uses extjs , trying figure out how way. text box ext status bar (same here : http://www.extjs.com/deploy/dev/examples/statusbar/statusbar-demo.html ) doesn't created until page finished loading. when try enter commnands first poster suggested, "setvalue not function". playing firebug on page can set value after loading using (whatever method through ext or scriptaculous).value = "lol" none of page update things work this. in render |page| can use "page <<" pass inline js can invoke setvalue on texfield element prototype: pa...

.net - Does ASP.NET worker process still return data in chunks of 31kb -

does asp.net worker process still return data in chunks of 31kb this msdn article written in may 2004 specifies following. when using asp.net process model, asp.net worker process sends responses client, first sends them through iis in 31-kilobyte (kb) chunks. applies .net framework 1.1, change in future versions. more 31-kb chunks asp.net has send through iis, slower page runs. can determine how many chunks asp.net requires page browsing page, viewing source, , saving file disk. determine number of chunks, divide page size 31. has architecture been changed since 2.0, 3.5 , 4.0? if whats new chunk size each of new versions of .net? [edit] been more 2 weeks since posting still no correct reply :( , please not provide speculative answers i think real question - matter? original article horribly written make think does. 31kb chunks returned worker process iis on 1 system, did not mean 31kb chunks returned client. iis processes...

flex pagination example help -

i've found flex paging example i'd working, can't seem running. the example files can found here: http://blogs.adobe.com/tlf/2008/12/actionscript-pagination-exampl.html i've downloaded , imported project flex. seem have error prevents example running. here error appears the definition of base class displayobjectcontainercontroller not found. – paginationwidget.as method marked override must override method. – paginationwidget.as here's things at: did install flex builder in directory? in path? on removable or network drive? do have flex builder or flash cs4 professional textlayout plugin? have appropriate example download setup?

sql server - XSS Attack on the ASP.NET Website -

i in big trouble. please help!!!!!!!!!! my website has been attacked malicious script < / title> < script src = http : // google-stats50.info/ur.php >. script appended column(s) of table automatically. have removed script. after few hours, re-appeared in tables. time < / title> < script src = http : // google-stats49.info/ur.php >. my client complaining script. technology used asp.net 1.1, sql server 2005. please help. thanks in advance!!!!!! when render text database can use 2 ways avoid script. user server.htmlencode(datafromdatabase) ; use microsoft anti-cross dll library have similar function more options. last ms anti-xss library now 3.1. how using video how pass script. on contact or other forms. on browser reference on statistics , when browse site, keep log , when go see log script running. hope help.

browser - HTML5 audio codecs, support for other formats besides OGG -

i started tinkering around html5 , interested in audio tag. though 1 thing came attention, appears ogg format supported in firefox! i understand because mp3 , other codecs proprietary software , require license use. how html5 audio (and video) going catch on if can use ogg?? or not world hooked mp3 or apple's aac. and further hinder things seems mozilla natively supporting ogg. so i'm curious. why can't firefox, , other browsers, use system installed codecs playing media? why have installed browser, or depend on technologies flash? seems bad design me. perhaps, i'm naive this, whole codec war nuisance. can point me information, laws, , other information regarding why browsers can't use system installed codecs? hear other users opinions well. thanks! edit in case comes off not being programming question, want clarify me issue directly affects web programmers. example, in case of audio support, have use flash? or these issues handled in html5. seem thi...

Communicating between Android and PC (C#) -

i want create application in android communicates server application (written in c#, doesn't matter version of .net) on pc via tcp/ip. best approach here? i thinking kind of rpc-like soap or xml-rpc. want keep server application light , simple possible. , think in c# rely on webserver set rpc server. better communicate directly via tcplistener? i had pretty luck using tcp/ip , udp android , windows (java & c# respectively). used more brutal approach tcplistener c# pretty similar @ high level. recommend giving shot , seeing outcome, chances it's going more lightweight in terms of processing , bandwidth xml approach.

javascript - Lone developer but lots of xhtml css jquery work? Should i use any version control system? -

would useful single user single pc or overkill? can save time , increase productivity version control system? if answer yes free version control system best me , how can save time that? i work home , office both. both places i've internet access. want access source both places. update: can keep source on free hosting? don't want keep on pc. need save , update. of course should use version control system. using vcs not team development , sharing code, having history of source code , being able go older version @ time (or maintain older versions while development goes on). never want think how worked before once using one. personally, think subversion easy setup , use when using subversion client tools such tortoisesvn, ankhsvn, visualsvn , on. if looking hosted solution, there lots of questions covering topic, e.g: https://stackoverflow.com/questions/111292/free-version-control-services

user interface - WPF forcing GUI update using Dipatcher -

i need show custom control (a clock rotating hands) , replace mouse cursor, problem if write: me.gridscreen.visibility = visibility.visible ' operations takes 1 second me.gridscreen.visibility = visibility.hidden (gridscreen grid contains user-control) obviously can see nothing, because update of ui happens @ end of procedure. have tried me.updatelayout(), doesn't work. i have tryed use dispacker in many way none works :-( this lost attempt: (ucurclock usercontrol, gridscreen grid placed @ top-level in window, trasparent background, contains usercontrol) private sub showclock() dim thread = new system.threading.thread(addressof showclockintermediate) thread.start() end sub private sub hideclock() dim thread = new system.threading.thread(addressof hideclockintermediate) thread.start() end sub private sub showclockintermediate() me.dispatcher.begininvoke(dispatcherpriority.normal, _ new action(addressof showclockfinale)) end sub priv...

python - Comments (#) go to start of line in the insert mode in Vim -

whenever want add comment indented line in vim, hit shift - o (open new row above current, switch insert mode) , start typing python comment (using # ). hash magically moved start of line (no indentation) , have click tab few times. anyone know how work around it? i suppose have set smartindent in .vimrc see :h smartindent when typing '#' first character in new line, indent line removed, '#' put in first column. indent restored next line. if don't want this, use mapping: ":inoremap # x^h#", ^h entered ctrl-v ctrl-h. when using ">>" command, lines starting '#' not shifted right. i believe don't need smartindenting while coding python. remove settings or add following .vimrc: au! filetype python setl nosmartindent

jquery - select option hover is not working in IE -

i wrote little code tooltips in multiple select box, code working file in ff not in ie :( ex: $('#select > option').mouseover(function(){ alert($(this).text()); }); can me? onmouseover not fire option elements in internet explorer. in fact, no mouse or keyboard events fire option elements. see msdn documentation events available: http://msdn.microsoft.com/en-us/library/ms535877(vs.85).aspx edit - same true of google chrome (and safari too).

css - overriding border of parent div with border of child span -

i have div has row of tabs nested within follows: <div class="container"> <div class="menu"> <span class="tab" /> <span class="activetab" /> <span class="tab" /> </div> </div> when tab active, need display border around it. container div has border; however, needs lighter. have this: .container {border: 1px solid lightgray;} .activetab {border: 1px solid gray;} it seems because container parent of active tab, border has priority, want active tab's darker border show instead. tried both borders , outlines. help! first of all, not sure why you're putting dot before class names in html tag..does work? should <div class="container"> , .container{....} in css. if you're trying make css menu i'd recommend use unordered list, thats pretty standard: <div class="container"> <ul class="m...

Disable individual Python unit tests temporarily -

how can individual unit tests temporarily disabled when using unittest module in python? individual test methods or classes can both disabled using unittest.skip decorator. @unittest.skip("reason skipping") def test_foo(): print('this foo test case.') @unittest.skip # no reason needed def test_bar(): print('this bar test case.') for other options, see docs skipping tests , expected failures .

c# - In .NET web services, how can the SoapException.Message property be easily readable? -

i writing asp.net web service , throwing soapexception message: throw new soapexception("bang!", soapexception.clientfaultcode); when create asp.net client, , request label display soapexception.message property, displays message similar following: system.web.services.protocols.soapexception: bang! @ webserviceexception.webservice1.helloworld() in [directory]\webservice1.asmx.cs:line 23 is there easy way presented message bang! rather entire string? or should use regular expressions? if configure web service turn on custom error messages, stack trace not present in soap fault, in turn mean client not see it. in web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> ... <system.web> ... <customerrors mode="on"/> ... </system.web> ... </configuration>

java - Final method mocking -

i need mock class final method using mockito. have wrote @test public void test() { b b = mock(b.class); doreturn("bar called").when(b).bar(); assertequals("must \"overrided\"", "bar called", b.bar()); //bla-bla } class b { public final string bar() { return "fail"; } } but fails. tried "hack" , works. @test public void hacktest() { class newb extends b { public string barfortest() { return bar(); } } newb b = mock(newb.class); doreturn("bar called").when(b).barfortest(); assertequals("must \"overrided\"", "bar called", b.barfortest()); } it works, "smells". so, right way? thanks. there no support mocking final methods in mockito. as jon skeet commented should looking way avoid dependency on final method. said, there ways out...

JQTouch on Android 2.2 has issue with TextField -

we have built android application using jqtouch. gui built html , javascript. found there issue runing our app on android 2.2 the textfield doesn't respond touch selection, wherease problem doesn't happen on 1.5 android device. i suspect problem caused jqtouch.css , becase if disable importing jqtouch.css, textfield respond well. i wondering if came accross same problem. or there solution problem, becase know nothing web programming (css) , don't know how fix it.

Performance penalty of persistent variables in MATLAB -

recently profiled matlab code , shocked see following in heavily used function: 5.76 198694 58 persistent constants; 3.44 198694 59 if isempty(constants) % initialize constants in other words, matlab spent 9 seconds, on 198694 function calls, declaring persistent constants , checking if has been initialized. represents 13% of total time spent in function. do persistent variables carry of performance penalty in matlab? or doing terribly wrong here? update @andrew tried sample script , very, perplexed output: time calls line 6 function has_persistent 6.48 200000 7 persistent constants 1.91 200000 8 if isempty(constants) 9 constants = 42; 10 end i tried bench() command , showed machine in middle range of sample machines. running ubuntu 64 bits on intel(r) core(tm) i7 cpu, 4gb ram. that's standard way of using persistent variables in matlab. you're doing you're supposed to. there...

What program to write pdf including other pdf on Linux from Python? -

on ubuntu server, want create pdfs include other static pdfs. have tried using reportlab pypdf. ideally use reportlab whole thing, in order import pdfs requires pagecatcher has large recurring fee. so use pypdf merge page created reportlab , other pdfs. problem though looks fine in acrobat , foxit, part of 1 of pages prints garbled on xerox 7400 color printer. can't figure out issue, willing buy more integrated solution if existed , reasonably priced. thought pdf creator pilot until saw windows only. so there reasonably priced ($1k or less) solution or different suggestion? i have had lot of success java library itext . have great library of samples pretty think of doing pdf files. example concatenating pdf files , sounds need: http://itextpdf.com/examples/index.php?page=example&id=123 . there pdfbox great java based pdf manipulation library. i realize looking python based solution there may not many other options. if using jython interpreter instead of cpy...

HttpURLConnection disconnect doesn't work in Android -

the method disconnect httpurlconnection seems not work properly. if execute following code: url = new url("http:// ..."); connection = (httpurlconnection) url.openconnection (); connection.setrequestmethod("post"); connection.setrequestproperty("content-type", "application/x-www-form-urlencoded"); connection.setusecaches(false); connection.setdoinput(true); connection.setdooutput(true); connection.connect(); // code connection.disconnect(); connection.setdoinput(false); // -> illegalstateexception i illegalstateexception when call method setdoinput . exception says: already connected it sounds you're trying reuse connection? i.e. altering request properties after you've disconnected server, ready make connection. if case, create new httpurlconnection object.

php - Post text from a text area -

i have form user types paragraphs text area , takes them page after submit. how can pass whatever typed page after submit? text area might have linebreaks , if use query string pass data, gives me error. current code pass field: <?php if(isset($_post['form'])) { $title = $_post['title']; $body = $_post['body']; header("submitform.php?title=$title&body=$body"); ?> <html> ...html form... it doesn't work when text area has line breaks in it. i suggest installing wysiwyg editor make easier you, assume add time learning curve. the simplest tips can give set css attribute textarea: white-space:pre when gets submitted, line breaks sent well. on server side, need use nl2br() function, when gets saved on db or wherever store them, line breaks converted html breaks. for additional reference, had similar question last year.

initialization - What are primitive types default-initialized to in C++? -

when use initialization list: struct struct { struct() : membervariable() {} int membervariable; }; the primitive type ( int , bool , float , enum , pointer) member variable default-initialied . value gets implementation defined or same implementations? you not correct. object not default-initialized value-initialized . , value well-defined int = 0, bool = false, float = 0.0f, enum = (enum type)0, pointer = null pointer pointer member = null member pointer note 0 in range of values enumeration, if doesn't contain explicit enumerator vaue, it's safe initialize enumeration variable value. in particular pointer data members, representation used in practice not all-zero bits. in so-called c++ itanium abi used @ least gcc , clang, pointer data members have all-one bits null representation.

c# - WPF grid layout and cell content margins -

i working on wpf control content grid. relatively new wpf wondering if below right way go this. i placed 2 labels in grid, both in same column adjacent rows: <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:class="untitledproject8.window1" x:name="window" title="window1" width="200" height="200"> <grid x:name="layoutroot"> <grid horizontalalignment="left" verticalalignment="top" width="100" height="100"/> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="*"/> </grid.rowdefinitions> <label grid.row="0" content="1.23" fontsize="18" horizontalalignment="center" verticalalignment="bottom"/> <label grid.ro...

workflow foundation - WF4 is it possible to create a designer for a composite activity? -

i know how hook designer activity nativeactivity or codeactivity designer attribute on class. so: [designer(typeof(parallelactivitydesigner))] i hookup designer composite activity (composed of activities in xaml file), possible @ all? three known ways far: have code-beside .xaml.cs file, , use [designerattribute], in question [designerattribute] editing xaml file manually using metadata registration register custom attributes @ design time, easiest in rehosted scenario, possible using .design.dll inside vs also. (ref workflow beta2 forum details of first 2)

CakePHP pages_controller always uses default layout -

i have static page want serve made .ctp in /views/pages/ directory. problem it's using default layout not want use. tried making own pages_controller , passing $layout var not work. there has way tell /pages/ use layout.ctp. no? few things check make custom pages_controller.php define variable $layout , set layout want. make sure layout exists in views/layout/

sql - Calling multiple stored procedures in .net, how to do it? -

i need call stored procedure multiple times, i'm using informix. know if calling procedure multiple times same connection same generating string multiple calls stored procedure , executing query. this example of code: ifxcommand cmd = new ifxcommand("storedata", myconn); cmd.commandtype = commandtype.storedprocedure; (int = 0; < lbim; i++) { cmd.parameters.add("id", ibm.data.informix.ifxtype.varchar, 255).value = info.id; cmd.parameters.add("descripciondescuentoimpuesto", ibm.data.informix.ifxtype.varchar, 255).value = info.data[i].value; try { ifxdatareader myreader = cmd.executereader(); if (myreader.read()) { boolean aux = (boolean)myreader[0]; myreturn = aux; } myreader.close(); } catch (ifxexception ex) { } cmd.parameters.clear(); } the problem each stored procedure returns true or false. thanks for performance reasons best approach prepare command before loop. ins...

python - Creating a website to communicate with an embedded device -

i'm working on project i'm trying control embedded device through internet facing website. idea is user can go website , tell device preform kind of action. action on website translated series of cli commands , sent device. communication potentially go both ways in future, right i'm focusing on server-to-device. the web server lamp stack using python (django) , device i'm trying communicate beagle board running elinux. there 1 device existing @ time communicating server. i have functional parts written on server , device side, i'm having bit of trouble figuring out how write communication layer. 1 of big issues device mobile , moving locations every few days. so, can't guarantee static ip address device. networking programming knowledge pretty minimal don't have great idea on start. does have ideas/resources on how can start developing kind of communication? thanks! you can register dynamic host name using provider dyndns , have device ...

objective c - Autocomplete search example for iPhone -

can point me in direction of how implement "autocomplete" search interface on iphone. assuming need use nstimer periodically check has been typed , submit partial string data source , display those. i need connect existing web service returning json a tutorial or sample code preferred. thanks this stack overflow answer you. if using uisearchdisplaycontroller , not need use nstimer poll search field, changes search field fire delegate methods you. in delegate methods, may apply new search predicate based on contents of field, , refresh data fetch , display possible words.

actionscript - Make an object react to a sound in Flash -

i have speaker , need speaker moves sound. need simulate real world speaker vibration generated low , mid frequencies. does not have soo realistic whant know how can play sound , son mumerical value usefull apply numerical size transformation speaker. cheers! you can detect amplitude of sound in as3 using soundmixer.leftpeak , soundmixer.rightpeak methods: there's nice example here ...

performance - Java Efficiency: Object Assignment & Method Call vs. Inline Method Call -

i'm working on application 3d viewport refreshes 30 times second (or @ least tries render fast). unfortunately, code complicated enough converting test performance effect take quite while, 2 conditions i'd comparing follows: objecttorender p = objectstorender.get(i); p.render(); as opposed to: objectstorender.get(i).render(); i'm sure sounds severe case of micro-optimization but, noted above, code being called , has 0 outside factors influence performance (disk i/o, network, etc). the objectstorender.get(i) part of code might optimised using iterator loop on objects render: iterator.next().render(); or, if list of objects stable, convert objecttorender[] once , index directly: objectstorender[i].render();

Why final and abstract only modifiers can be used with a local inner class in java? -

hi know why final , abstract modifiers used local inner class in java.... can elaborate on this? there's great example of usage of abstract inner classes @ o'reilly, please @ @ 'hierarchies of inner classes' section: http://onjava.com/pub/a/onjava/excerpt/hardcorejava_chap06/index.html

git - Creating directory/file name rules for .gitignore -

i'd set rules in .gitignore whereby directory or file name containing "_nogit" ignored. examples: ../videos_nogit/... bigvideo_nogit.mp4 assets/_nogit/bigvideos... thanks-- if have line in .gitignore file not have slashes in it, git treats shell glob pattern. thus, adding *_nogit* .gitignore ignore of files. see gitignore man page .

jquery - execute a javascript function if the user is not active on the page? -

i'm looking javascript or jquery function execute function newalert() if user not active on page, ( maybe event check cursor position or ) i make auto check using settimeout , want function check availability of user in gmail chat, when receiving new im , not watching gmail page, plays bleep sound. thanks try using window.onblur event, or can have timer running continuously , when mouse position same x amount of milliseconds, execute function. example: var lastx, lasty = 0; var act_timeout = null; function doaction() { alert( 'not active' ); return false; } function move( e ) { if( e.clienty == lasty && e.clientx == lastx ) { act_timeout = settimeout( doaction, 5000 ); return; } lastx = e.clientx; lasty = e.clienty; act_timeout = cleartimeout( act_timeout ); } window.onmousemove = move; window.onblur = doaction;

Tomcat and proxy request -

i configure default tomcat installation (running on "localhost" @ port "8080") proxy server in browser , try connect http://www.google.com . i expect either error message saying tomcat not configured proxy server or should contents of google website. instead index.html page of tomcat installation. what going wrong? tomcat doesn't know it's supposed proxy request. knows browser showed , asked something, this: get http://www.google.com/example http/1.1 [plus other headers] with apache httpd, might have configuration such when request shows host that's not itself, acts proxy request. tomcat not used proxy. tomcat used behind reverse proxy request may "www.google.com" may relayed tomcat site it's supposed serving. tomcat's standard configuration pretty accepts host specified own, , adopts purpose of creating absolute references itself, assumption if request got it, legitimate. can of course alter behavior configurat...

vb.net - Visual Basic add to Array dynamically and sort -

still having trouble can please help? this needs written in visual basic here statement main part of program... mylist.foreach(addressof processlink) what statement says following.... "for each item in arraylist "mylist" send item sub program "processlink" note processlink going receive multiple groups of data arralist "mylist" processlink takes each value sent , turns "p.myname" , p.myvalue" i need processlink add these values array. , each time receives batch of data arraylist "mylist" add values same array. processlink sort array based on "p.value" i need processlink output name value pairs in array , output result as... response.write("<tr><td>" & p.myname & "</td><td>" & p.myvalue & "</td></tr>") what should code in processlink like? i really reccomend using generic object lists rather arrays. o...

plsql - Will Static sql (as opposed to Dynamic SQL) invalidate other packages in Oracle -

hi if write custom package nothing static sql in it, invalidate other package. (other third party packages shipped wrapped code). a co worker suggests re write custom package in dynamic sql, , not see problem. find hard believe because third party packages not dependent on custom package, compiled package should stay compiled, regardless. -thank you it invalidate packages included custom package dependency. you should able prove co-worker (and yourself) in test environment.

wpf - Setting Window background color using resource -

i need use resource set color of main window in wpf application. since resource declaration comes after window declaration (i importing resource dictionary), can't use background property in window object. so, thought set background way: <window.resources> ... </window.resources> <window.background> <solidcolorbrush color="{staticresource windowbackgroundbrush}" /> </window.background> my syntax bit off, since object won't take brush resource color property. what's fix? help. try this <window.background> <staticresource resourcekey="windowbackgroundbrush" /> </window.background>

java - How do I create an Atom representation with Restlet? -

i want create atom xml representations rest resources using restlet. should (can i?) use rome or use atom extension restlet? what's best way go this? thanks in advance. the best way suits needs best :) if want , running fast, may prefer use helper library. here suggest take @ apache abdera . the part may of concern helper libraries number of external dependencies. if deal breaker you, may want consider write code yourself.

performance - How slow is too slow for unit tests? -

michael feathers, in working legacy code , on pages 13-14 mentions: a unit test takes 1/10th of second run slow unit test... if [unit tests] don't run fast, aren't unit tests. i can understand why 1/10th second slow if 1 has 30,000 tests, take close hour run. however, mean 1/11th of second better? no, not (as it's 5 minutes faster). hard fast rule isn't perfect. thus when considering how slow slow unit tests, perhaps should rephrase question. how long long developer wait unit test suite complete? to give example of test speeds. take @ several mstest unit test duration timings: 0.2637638 seconds 0.0589954 0.0272193 0.0209824 0.0199389 0.0088322 0.0033815 0.0028137 0.0027601 0.0008775 0.0008171 0.0007351 0.0007147 0.0005898 0.0004937 0.0004624 0.00045 0.0004397 0.0004385 0.0004376 0.0003329 the average 21 of these unit tests comes 0.019785 seconds. note slowest test due using microsoft moles mock/isolate file system. so example, if unit test su...

r - Set default port number in HTML help -

well, title quite self-explanatory... possible set default port number r's html help? each time start html help, port number gets changed. from help(startdynamichelp) : details: function starts internal http server, runs on loopback interface (‘127.0.0.1’). if ‘options("help.ports")’ set vector of integer values, ‘startdynamichelp’ try ports in order; otherwise, tries 10 random ports find 1 not in use. can disabled setting environment variable ‘r_disable_httpd’ non-empty value. so looks can try override via options("help.ports") , appropriately set. randomization appears feature.

Java Command Line Jar File -

i've created few .jar files (using eclipse's export feature), guis. want create .jar file strictly command-line; possible? there no such thing "gui jar" or "command line jar". if want program work on command line, read , write system.in , system.out or files rather using swing or awt. if on other hand asking how create jar on command line, command is, not surprisingly "jar". in jar cf foo.jar com/my/foo/*.class

Struts2: interceptor and parameters -

i have done pages struts 2.(j2ee project) ok until try add interceptor. it seems interceptor delete properties of class action , parameters send jsp url like: action?param=xxx here interceptor: public class sessioninterceptor extends abstractinterceptor{ @override public string intercept(actioninvocation invocation) throws exception { return invocation.invoke(); } here struts.xml: <action name="movefc_showfjt" class="struts2.showfjtaction" method="movefc"> <interceptor-ref name="sessioninterceptor"></interceptor-ref> <result name="input" type="dispatcher">jsp/showfjt.jsp</result> <result name="success" type="dispatcher">jsp/showfjt.jsp</result> </action> in class action, public class showfjtaction extends actionsupport { private string param; private personne p; param proper...

xml - Parsing iCalendar data with XPath/XSLT -

i working xml driven cms, , before run off , either write or implement module parses ical format, wondering if there way parse using xslt or ideally xpath expression, built in function of cms. well, initial problem it's not xml format. icalendar files tagged text: begin:vcalendar version:2.0 prodid:-//hacksw/handcal//nonsgml v1.0//en begin:vevent dtstart:19970714t170000z dtend:19970715t035959z summary;language="en_us":bastille day party end:vevent end:vcalendar so, parsing xpath , xslt challenging. however, there xml representation of icalendar. can find information in xcal basic spec. example above (from spec) looks like: <?xml version="1.0" todo_namespace="foo"?> <icalendar xmlns:xcal="urn:ietf:params:xml:ns:xcal"> <vcalendar> <version>2.0</version> <prodid>-//hacksw/handcal//nonsgml v1.0//en</prodid> <vevent> <dtstart>19970714...

bit shift - How do I translate the >>> operator in JavaScript to VB.NET? -

i doing code conversion javascript vb.net . stuck >>> operation. see sample code , attempt below: javascript: function test(a, b) { return (a << b) | (a >>> (32 - b)) } my attempt in vb.net: private function test(byval integer, byval b integer) integer return ((a << b) or (cushort(a) >> (32 - b))) end function what doing wrong? you should use cuint instead of cushort. cushort gives ushort 16-bit in size. in javascript bit operations done in 32-bit, a should converted 32-bit unsigned type — uinteger.

outlook - Parse email address -

i writing vba code in outlook 2007 extract email address emails. i able read body whole through variable how extract email address variable? one method described here . sstring = "my1@email.com xxx my2@email.com yyy my3@email.com" asstring = split(sstring, " ") = 0 ubound(asstring) if asstring(i) "*@*.*" semail = semail & "," & asstring(i) end if next msgbox mid(semail, 2)

sharepoint custom EditForm.aspx not reading the correct item ID? -

i made custom editform.aspx when click on item in list edit, gets data first item in list, every time. title gets right information, custom list form doesn't. checked parameters , there listitemid has querystring(id) location, correct. know why custom list form isn't showing right record? really appretiate help. i'm not sure how created custom page, following guide works me: http://www.cjvandyk.com/blog/articles/how%20do%20i%20-%20customize%20the%20newform.aspx%20or%20editform.aspx%20of%20my%20sharepoint%20list.aspx

Comparison mobile devices as dev. platforms iPhone, Blackberry Windows Mobile -

i trying compare 3 above mentioned platforms , considerations 1 needs think when programming in order create kind of code base run on three. this have collected iphone - great if else write similar other two. only 1 application can run @ given time. i.e. why sqllite database loaded file app instead of traditionally having kind of server connect to. only 1 fixed size window 480x320 pixels runs in sandbox, when app deployed sandbox created "around" app, app can read/write files within area. low-level access phone restricted. since program can stopped @ time (see point 1) needs considered when designing app, @ time must app able write current state disk can resume later. if takes longer 5 seconds app aborted. 128mb ram, half of 64mb available app. there typicall 4gb storage (depends on model), no virtual memory, if memory running out app may aborted. edit: clear, not after platform/os best developer, interested in spec. comparison know can expected if 1 has 3 tar...

Android ListView with multiple select and custom adapter -

i have listview custom adapter. listview allows multiple select, somehow it's not recognising when item selected. i've made adapter items extend checkable, still getcheckeditempositions() returns array of falses. i guess there's fundamental i'm doing wrong, have been unable far find examples of multiple select listviews adapter not arrayadapter using default layout multiple selects. any appreciated. code below: main class: listview = (listview) findviewbyid(r.id.cardlist); tca = new textcardadapter(minflater); listview.setadapter(tca); adapter: public class textcardadapter extends baseadapter { private int count = 0; private list<checkablecard> cardlist = new arraylist<checkablecard>(); private layoutinflater minflater; public textcardadapter(layoutinflater inflater) { this.minflater = inflater; } @override public int getcount() { return count; } @override public object getitem(int position) { return cardlist.get(positio...

How to import data from a file into a single column of a SQL Server database? -

i have simple table 1 column (+ key column). column varchar(n) type. import data text file. file looks this: string1 string2 . . . stringz i don't know how generate script insert these values table. or there simplier tool import in such scenario? update : sorry forgot have column in table , value must set same int rows. thanks help. there several approaches writing own little utilty it, using bcp or other built in tools. easiest approach use import data wizard - in ssms right click on database want import into, choose tasks , import data.

visual studio 2008 - COM+ sniffing/spying, is it possible? -

i'm writing replacement visual studio add-in we've got third party. add-in has 1 function i'm having trouble replacing however. interfaces program of theirs (which still need) starting it, telling pid of visual studio , letting other program call visual studio add-in via com+. so, question, how can reverse engineer conversation between add-in , other app? don't have source third party add-in/app have legal rights i'm doing reverse engineering isn't problem. presumably since add-in com+, can determine public interface. have duplicate in add-in. write dummy add-in logs calls , parameters. might start. if have legal rights, option may contact third party details/documentation.

Horizontal scrolling with the scrollwheel in Eclipse -

i've been trying find way scroll text horizontally scrollwheel in eclipse, similar way can in textpad. in textpad if hold ctrl while scroll vertically scroll horizontally. know if there configurable setting somewhere in eclipse allow this? i've looked on "keys" setting page without being able find it, , google/stack overflow searches haven't turned me. thanks. i guess depends more on os on eclipse. instance on mac os it's shift + scrolling.

if statement - PHP if/else switch not working -

goal: trying rollover button state remain "on" when url equals "enhanced.php". problem: button state not remain "on" when url equals "enhanced.php". (button acts correctly rollover) sidemenu.php sidemenu.php used php include on pages (i don't know if makes difference <?php $script = $_server['script_name']; //set default state off , turn on if on current url. $enhancedstate = off; $pos = strpos($script, "enhanced.php"); if($pos === true) { $enhancedstate = on; } ?> <div class="sidemenu"> <a href="enhanced.php" onmouseout="mm_swapimgrestore()" onmouseover="mm_swapimage('image1','','/images/button_on_01.gif',1)"> <img src="/images/button_<? echo $enhancedstate; ?>_01.gif" name="image1" border="0"> </a> anyone see reason why button state not stay ...

How do I dump output of an external command to a new buffer in Vim? -

:enew lets me create new buffer , :.! <command > lets me dump output of external command buffer. can combine 2 1 liner? thanks. '|' used chain commands in vim. so :enew | .! <command> should want

ruby - how to remove the " quote from string? -

possible duplicate: ruby code modifying outer quotes on strings? this string: msgid """we couldn't set account, sorry. please try again, or contact ""admin (link above)." i want remove double quotes except first , last one. how may that? this assuming strings of "msgid..." format shown above , inteded output 'msgid "text here"': >> str.gsub(/(msgid )"{1,}(.*) "{1,}(.*)"/, '\1"\2 \3"') => "msgid "we couldn't set account, sorry. please try again or contact admin (link above)."" >> puts str.gsub(/(msgid )"{1,}(.*) "{1,}(.*)"/, '\1"\2 \3"') msgid "we couldn't set account, sorry. please try again or contact admin (link above)."

php - CakePHP Auth retrieve extra data -

i learning cakephp, excuse me i using cakephp 1.2.5 auth component userscontroller. user model contains 2 tables: class user extends appmodel { var $name = 'user'; var $belongsto = 'company'; } when login() called, see data being retrieved in sql log (left join being executed), model seems correct, auth stores data users table , drops else. how can retrieve company data later on without doing query? or if you're not comfortable modifying core library me, do... on userscontroller.login action function login() { if ($this->auth->user()) { $session->write('company', $this->user->company->findbyid($this->auth->user('id'))); $this->redirect($this->auth->redirect()); } } you can access company details using $this->session->read('company.name') on controller , $session->read('company.name') on views. don't forget add session componen...

iphone - Is it safe to use the "hash" method to track NSURLConnections in memory? -

my question related discussion: http://www.cocoabuilder.com/archive/cocoa/202211-how-to-get-nsurl-form-nsurlconnection.html i sending several nsurlconnections transmit data , need able tell specific connection failed or succeeded. there nsurldelegate methods (didfailwitherror, etc) return related nsurlconnection. problem there no nsurlrequest returned in delegate methods (and there no nsurl accessor in nsurlconnection). the solution i've implemented maintain nsmutabledictionary pairs url string sent result of nsurlconnection's "hash" method. i've tested , seems work - hash of nsurlconnection returned in delegate method same hash nsurlconnection sent initially. my question: safe this? there better key use hash? i'm asking because in naive understanding, hash somehow associated address of object in memory, , seems possible backgrounding app or turning phone off , on may change value things rewritten memory. thanks much! i use asihttpreques...

android - How to get an APK into the market with an extra certificate... because I lost my first keystore -

my keystore has gone missing. deleted mistake, can't find in recycling bin. keystore in bin folder, not place files automatically deleted when publishing i know details previous keystore. except maybe date of expiry. i want put update onto market, because new certificate different, won't let me. i hoping add additional certificate current published file accept updated version new certificate. similar described here. how sign apk more 1 certificate? i skip first line in above description because signed through eclipse, when second line zipexception due "invalid entry compressed size (expected x got y bytes)" is there way put second certificate on apk? is there way recreate original keystore information know? i'm not yet ready believe, have submit update new application. if you've lost private key you'll unable recover , sign future versions of app. the certificate fields text. thing proves identity developer private key, random...

c# - Using string constants in implicit conversion -

consider following code: public class texttype { public texttype(string text) { underlyingstring = text; } public static implicit operator string(texttype text) { return text.underlyingstring; } private string underlyingstring; } texttype text = new texttype("something"); string str = text; // ok. but want able following, if possible. texttype textfromstringconstant = "someothertext"; i can't extend string class texttype implicit operator overload, there way assign literal string class (which handled method or something)? string reference type when developed c# had use way string literal class. hope it's not hardcoded language. public static implicit operator texttype(string text) { return new texttype(text); }

python - Communicating to server with queries through stream. What is the right way? -

i'm writing first network application. manipulates jabber client , communicates service iq-stanzas. details not important. this interaction works through twisted xmlstream (python language). typical situations described here: http://juick.com/help/api/xmpp/ short, can send "query" , server relies me "result". i implemented basic actions "send message", "do action on message received". problem in operating stream. better use deferreds request data server? , how return result place needed? you can through code here: http://bitbucket.org/boh/tmp/src/56c131cd1e62/juick_app/twisted_app.py tried make minimalistic. to pair response reply, use iq.id attribute. can store few deferreds in cache indexed id , run them when reply. since xmpp tcp-based, replies in right order anyway. can cap cache , run deferred's errback if deferred has been in cache while.

c++ - exception handling -

i following core dump msg: terminate called after throwing instance of 'std::out_of_range' what(): basic_string::substr abort - core dumped i reading 14 digit hexadecimal number large file. periodically notice there these blank lines (well not sure is. how handle exception? maybe try catch thingy? looks below: 123456789abcde 123456789abcde 123456789abcde 123456789abcde i not sure hidden symbol occupying space causing issues , not sure how handle this..any ideas? maybe sample of how handle it? you need post more code exception looks you're reading file line line , storing line in std::string , calling std::string::substr() extract 14 characters want. assuming code looks this: std::string str; /* lines stored in string */ std::string substring; /* extracted substring stored here */ /* read file line line */ // ... substring = str.substr( index, 14 ); //extract 14 characters starting @ 'index' change to: if( str.size() ...

Is there any difference between String and string in C# like int and Integer in Java? -

possible duplicate: string vs string in c# i understand there difference between integer , int in java, similarly realised string , string kinda works in c# too, there differences in these 2? datatype vs class object? no. string alias string. same as: int ==> int32 double ==> double and others.

python - Django RegexField Letters and Numbers only -

i need regexfield in django form accept letters , numbers, , nothing else. i've tried this, didn't work: myfield = forms.regexfield(label=("my label"), max_length=31, regex=r'[a-za-z0-9]', error_message = ("this value must contain letters , numbers."), i not @ using regular expressions. can tell me doing wrong here , how fix it? regex=r'[a-za-z0-9]', is 1 letter. do want more 1 letter? use repeat regex=r'[a-za-z0-9]+', there numerous tutorials on regular expressions. please google "regular expression tutorial."

c# - change ForeColor of Form -

how change forcolor of form, have set forecolor red form still displays in whte text. how change this. refering title bar text color the title bar "non client" area of form. non-client area of form managed windows api, , not .net. cannot changed setting property on form. change color of title bar text, need custom painting. search google terms like: non-client area painting winforms. need make calls win32 api directly work. can ideas here: http://geekswithblogs.net/kobush/articles/customborderforms.aspx , http://customerborderform.codeplex.com/wikipage?title=painting%20nonclient%20area&referringtitle=home it easier in day (that is, when there no .net), since directly used win32 api. did it, fun. and, have since learned such things ok learning ; imo recommend don't "misuse" putting in "real" application. windows has , feel, , , feel should under user's control, not developer's.

ruby - Update a String Attribute in Rails -

i trying update string attribute in database. i tried using update_attribute isn't working. works integer attributes not string attributes. how solve ? edit code example: @post = post.find(params[:post_id]) @comment = @post.comments.create!(params[:comment]) @comment.update_attribute(:commenter,user.find_by_id(session[:user_id]).name) first off, there reason save name string in database? go through association name. @comment.user.name i suggest add user_id comments table , use: @comment.user = user.find_by_id(session[:user_id]) or @comment.update_attribute(:user_id, session[:user_id]) to update commenter.

documentation generation - Does Perl have something like Java/PHP Docs? -

does perl have perl docs generator? java docs or php documenter? yes, it's called perldoc you write documentation in source, javadoc. briefly, "=item" bulleted item, e.g. function or parameter "=over" goes down level of identation, "=back" goes level. use "=cut" want switch perl code. here example of like: =item $b->add_module ( %options ) initialize module. module repository or branch of repository. valid options =over =item id id of module =item repo url of repository. subversion repositories supported. =back =cut sub add_module($%) { simply pass perl code through perldoc program formatted documentation.

xml - IRS E-File API? -

i've been trying understand how irs e-file works. know if it's public api, , if so, can information on it? google has not been helpful. it looks page has list of documentation efile process: http://www.irs.gov/taxpros/providers/article/0,,id=97657,00.html

ajax - Extract part of HTML document in jQuery -

i want make ajax call html-returning page, extract part of html (using jquery selectors), , use part in jquery-based javascript. the ajax retrieval pretty simple. gives me entire html document in "data" parameter of callback function. what don't understand how handle data in useful way. i'd wrap in new jquery object , use selector (via find() believe) part want. once have i'll passing off javascript object insertion document. (this delegation why i'm not using jquery.load() in first place). the get() examples see seem variations on this: $('.result').html(data); ...which, if understand correctly, inserts entire returned document selected element. not suspicious (doesn't insert <head> etc?) it's coarse want. suggestions on alternate ways welcome. you can use standard selector syntax, , pass in data context selector. second parameter, data in case, our context. $.post("getstuff.php", function(data){...

apache commons io - Reading a specific line from a text file in Java -

is there method read specific line text file ? in api or apache commons. : string readline(file file, int linenumber) i agree it's trivial implement, it's not efficient specially if file big. string line = fileutils.readlines(file).get(linenumber); would do, still has efficiency problem. alternatively, can use: lineiterator = ioutils.lineiterator( new bufferedreader(new filereader("file.txt"))); (int linenumber = 0; it.hasnext(); linenumber++) { string line = (string) it.next(); if (linenumber == expectedlinenumber) { return line; } } this more efficient due buffer. take @ scanner.skip(..) , attempt skipping whole lines (with regex). can't tell if more efficient - benchmark it. p.s. efficiency mean memory efficiency

c# - How can I take a picture from screen? -

i want write program shows 1 pc's screen others... presentation systems. how can take picture current screen? .net exposes functionality via screen ( system.windows.forms ) class. // surface focusing upon rectangle rect = new rectangle(); // capture screens in windows foreach (screen screen in screen.allscreens) { // increase rectangle accommodate bounds of screens rect = rectangle.union(rect, screen.bounds); } // create new image store capture bitmap bitmap = new bitmap(rect.width, rect.height, pixelformat.format32bppargb); using (graphics g = graphics.fromimage(bitmap)) { // use gdi+ copy contents of screen bitmap g.copyfromscreen(rect.x, rect.y, 0, 0, rect.size, copypixeloperation.sourcecopy); } // bitmap has screen capture

python - PyQt 4.7 - ImportError after installing on Windows -

i've been trying install pyqt 4.7 on vista, getting importerror when try do: from pyqt4 import qtcore, qtgui . importerror: dll load failed: specified module not found. i've checked system path, , c:\python31\lib\site-packages\pyqt4\bin on there. i can't run of examples, designer, assistant , linguist run fine. i using activepython 3.1, if makes difference. , haven't had previous version of pyqt installed. edit: i've copied qtcore4 , gtgui4 dlls c:\python31\lib\site-packages\pyqt4 . fixes of examples, still can't use example browser. are sure there \bin directory version of pyqt? running pyqt 4.4, , binaries right in: c:\python31\lib\site-packages\pyqt4 which have path pointing too. sounds pyqt4 installed improperly... did run this? python setup.py install there shouldn't bin there...

Explain piece of C# code and conversion to VB.NET -

yesterday asked question . rubens farias answered pointing piece of code wrote. following part of cannot compiled ms visual studio 2010 professional beta 2. byte[] buffer = encoding.utf8.getbytes( string.join("&", array.convertall<keyvaluepair<string, string>, string>( inputs.toarray(), delegate(keyvaluepair item) { return item.key + "=" + httputility.urlencode(item.value); }))); it gives these errors in visual studio. unfortunately rubens doesn't reply anymore. so have following questions / requests: i don't understand piece of code, please explain happening exactly. please explain how part has te rewritten in order "work" in vs. please explain how should convert vb.net. have tried using online converters no avail. keyvaluepair requires 2 type arguments. in delegate declaration says keyvaluepair item , no type arguments. chang...

python - Random is barely random at all? -

Image
i did test randomness of randint: >>> random import randint >>> >>> uniques = [] >>> in range(4500): # can see optimistic. ... x = randint(500, 5000) ... if x in uniques: ... raise exception('we duped %d @ iteration number %d' % (x, i)) ... uniques.append(x) ... traceback (most recent call last): file "<stdin>", line 4, in <module> exception: duped 887 @ iteration number 7 i tried 10 times more , best result got 121 iterations before repeater. best sort of result can standard library? the birthday paradox, or why prngs produce duplicates more might think. there couple of issues @ play in op's problem. 1 birthday paradox mentioned above , second nature of generating, not inherently guarantee given number not repeated. the birthday paradox applies given value can occur more once during period of generator - , therefore duplicates can happen within sample of values. effect...