Posts

Showing posts from February, 2014

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

GridView Android -

is there event let know reach last data in gridview? have lot of data in server, want load data every 100 data, if user keep scrolling until end of 100th data, want load 100 data , put in gridview. or there other solution? thanks. one solution check position in getview method of adapter, , load data if position somewhere near end.

delphi - dunit test result messages in hudson -

i using hudson ci server delphi 2010 projects. xmltestrunner.pas unit writes dunit test result xml file used hudson xunit plugin report test results. xunit plugin shows failures no messages: stacktrace message: +++++++++++++++++++ stack trace: in hudson project configuration @ "publish testing tools result report" choose "nunit-version n/a (default)" tesing tool, because there no dunit option in list , xml files looks similar nunit format: <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <test-results total="123" notrun="0" date="20.12.2010" time="09:19:24"> <test-suite name="helloworldtestsuite" total="46" notrun="0"> <results> <test-case name="testcase.helloworldtest" execute="true" success="false" time="0,003" result="failure"> <failure name="etestfailu

ruby on rails - do i need to reinstall thinking sphinx for mysql if it was previously installed for postgres? -

i installed sphinx couple of months postgres project , have project uses mysql. tried remedy this line in environments.rb: thinkingsphinx.database_adapter = :mysql and generated development.sphinx.conf project: source article_core_0 { type = mysql sql_host = localhost sql_user = *** sql_pass = *** sql_db = ***_development sql_sock = /tmp/mysql.sock sql_query_pre = update `articles` set `delta` = 0 `delta` = 1 sql_query_pre = set names utf8 sql_query_pre = set time_zone = '+0:00' sql_query = select sql_no_cache `articles`.`id` * 6 + 0 `id` , `articles`.`title` `title`, `articles`.`content` `content`, group_concat(distinct ifnull(`tags`.`tag`, '0') separator ' ') `tag`, group_concat(distinct ifnull(`customer_categories`.`name`, '0') separator ' ') `category`, concat_ws(' ', `users`.`first_name`, `users`.`last_name`) `created_by_user_name`, `articles`.`id` `sphinx_internal_id`, 3448190970 `class_crc`, 0 `sphinx_

Availability of BridgeConnect in Magento -

one of our clients thinking of buying enterprise edition, due requirement of using exact crm services magento. today, utter astonishment, i’m not finding inclusion of ” bridgeconnect ” module in either ” enterprise ” or ” professional ” editions. can please highlight, whether magento still provides ” bridgeconnect ” module ” enterprise ” or ” professional ” editions? if module not being provided, when magento provide module? or, magento planning provide better solution module, instead of ” bridgeconnect ” module? this urgent us, , very grateful quick responses. appreciated. you can try use adeptia or jitterbit (or other etl system) connect magento api. both offer generic export/import options (files, db, ftp, webservices) , have plugins integrate various 3rd party platforms. way bridgeconnect (ebridge software) worked - offered ready-made connectors various platforms. magento allows quite extend api can add webservices missing current core api (eg creating order in m

networking - Network layers (from Computer Networks, Tanenbaum) -

"the purpose of each layer offer services higher layers, shielding layers details of how offered services implemented." now purpose of each layer offer services higher layers. how highest layer, there no more layers offer services to, either sentence isn't correct, or it's missing. well, service above human readable data. whether webpage or email, layer above human or @ least parser in browser. 1 can layer layer on top anyway, done in twitter api, it's messages being sent , forth across http example. how 7 osi layers not clear cut used be.

Create a Simple Delphi IDE Expert -

Image
i want create simple ide expert delphi 7, in following image: i've verified links gave question ota api newsgroup dead, , of documentation unavailable (broken links). can give starting point this? this not easy task, trying create own expert. takes extensive knowledge of delphi open tools api (toolsapi.pas) \ some places start learn how create expert and/or use of open tools api http://www.davidghoyle.co.uk/wordpress/?p=11 http://www.gexperts.org/otafaq.html http://www.gexperts.org/otafaq.html#sample http://www.gexperts.org/otafaq.html#projectgroup http://www.gexperts.org/otafaq.html#resource there lots more found google search of delphi 7 + open tools api good luck!

c# - edmx connection string -

i developing application uses edmx dataaccess. realized each edmx file have own connection string in configuration file. there way share 1 connection string edmx files? no - there isn't. and reason. connection string in entity framework contains more regular connection strings (e.g data source / database name). it contains crucial information different components of model, including csdl, unique model . perhaps explain if planning share connection string between different edmx's, why need seperate edmx's in first place? if looking @ way dynamically create connection string @ entityconnectionstringbuilder.

embedded linux - Create text file with the name as System date -

hi want create text file name system date... example---28/04/2008:9:11:50.txt file name should allocated on dynamically..... can u provide c code this.. plese me... use strftime calcule name of file: http://www.thinkage.ca/english/gcos/expl/c/lib/strfti.html

android - force close the application -

i new android , stuck issue. i want know how force close application programmatically , restart again. trying because stuck outofmemmoryerror want free memory , restart app again. please guide me if wrong. restarting app avoid or repair outofmemoryexceptions bad idea. should start work on memory issue instead of weird things when occur. you should heal disease instead of medicate symptoms.

how to Add a Button on the home screen in android? -

i want add button on home screen , want code in click event of button. have application has activate button,as activate button clicked want button gets created on home screen , want code database queries in click event.i have created application,now want place button on home screen.how do that. thanks in anticipation. i don't think can create button on home screen on-the-fly coding. in book, way button on home screen if user adds widget.

jquery datepicker + Html.TextBoxFor -

i have question regarding jquerydatepicker , textboxfor() method. have asp.net form in use them create , edit object. use same form editing , creating. looks this: <script> $(function () { $("#datepicker2").datepicker( { dateformat: 'yy.mm.dd' }); }); </script> <div class=demo><%= html.textboxfor(m => m.distribution.todate, new { id = "datepicker2", type = "text" })%></div> it works fine, question is, how format date when use edit? create it's okay, because display empty textbox , if select date, in correct format. in edit, first displays whole datetime value, , select date, displays 1 way want. how do it, display way want beginning? i tried so: <%= html.textboxfor(m => m.distribution.todate.toshortdatestring(), new { id = "datepicker2", type = "text" })%> but gives error. any suggestions? <script langu

c - fopen does not return -

i used 'fopen' in c program open file in readonly mode (r). in case observed fopen call not return. not return null or valid pointer - execution gets blocked @ fopen call. patch of file absolutely correct (i have verified that) , there no permission related issues. can please tell reason kind if behavior. kind of appreciable. there related gcc or glibc? edit here sample code printf("%s %d\n",__function__,__line__); if ((fp = fopen(argv[1], "r")) == null) { printf("%s %d\n",__function__,__line__); return; } printf("%s %d\n",__function__,__line__); when run code, first print (before calling fopen) , after program halts. fopen not complete it's operation. file simple configuration file '.conf' extension , file can opened other means vi, cat etc. there should not nfs related issue. filesystem ext3. thanks in advance, souvik here's few reasons: you've corrupted memory somewhere, , bets off wh

php - Facebook api search. -

i'm new studying facebook api search. use code, resault empty. can me? thanks. <form action ="index.php" method ="post"> <input type="text" value="what is?" name="search" style="color:#999;text-align:center;" onfocus="if (value =='what is?'){value =''}" onblur="if (value ==''){value='what is?'}"/> <input type ="submit" value="ok" /> </form> <?php function callfb($url) { $ch = curl_init(); curl_setopt_array($ch, array( curlopt_url => $url, curlopt_returntransfer => true )); $result = curl_exec($ch); curl_close($ch); return $result; } $url = "https://graph.facebook.com/oauth/access_token?client_id=api_id&redirect_uri=my_url&client_secret=my_secret"; $access_token = callfb($url); $access_token = substr($access_token, strpos($access_token, "=")+1,

http - Ways to send a message from the server to the web browser at any time? -

i'm in situation want able notify visitor website of event occurring @ server. think: website visitor waiting export or report takes long time , running in background on server, need notify visitor when export done. or website visitor waiting chat message sales rep, need notify visitor when message sent them. i can think of few ways this: keep http connection server open forever continually polling http server every second check if there new messages write java applet holds connection open java server process none of these seem particularly graceful solutions... there better way this? http client-server protocol doesn't allow server initiated communications. there number of workarounds scenario , have come of them. the common , low tech technique polling. can see on on-line travel agencies when search flight. keeping connection open until times out , opening waiting server send called comet , implemented in many ways, java applet. the

Difference between Java EE and Spring framework -

i striving know difference between java ee , spring framework. please me on this. java ee standard, official, specification full featured enterprise application framework stack. includes stuff object-relational mapping, security, web applications, database connectivity, transactions... on top of java ee specifications there javaee implementations/application servers like: jboss, glassfish, websphere, weblogic. spring on other hand, framework doing lots of stuff on java ee specifications, in own form. don't follow java ee specifications , apis that. include web framework, transaction management, security , several other solutions java ee offers.

javascript - JQuery Selector code validation for list of select options -

i'm having situation 3 select box there in form <form> <select name="select1"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="select2"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="select3"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> </form> on submitting form have check atleast 1 of select box value should "a". is there 1 line selctor query jquery['form'].find('select val=="a"').length() . thanks, nithish. if understand right, , want know if @ least 1

.net - Should CodeContracts replace the regular ArgumentExceptions? -

could start using codecontracts instead of: if (xxx == y) throw new argumentexception("bla bla"); how work if develop library , library users not use codecontracts? assuming code using code contracts run through binary rewriter, throw exceptions code posted. re-writer goes through code , replaces contract code argument checking etc. it's kinda aspect oriented programming. injects code handle situations after you've compiled it. if don't use code contracts not benefit of having static analysis performed designed @ contract , warn them might error based on contract , code. code contracts

posix - C: read in more than one file -

hey guys using posix api system calls read , write , open , etc. can open, read, write file , copy contents output file. how go copying more 1 file output file using related system calls only? i have: filein = open(argv[1],o_rdonly,0); to open 1 file.(which argv1 i'd know how argv2 , argv3 etc.) i tried : j=0; filein = open(argv[j],o_rdonly,0); but prints out contents of argv0 outputfile. i stuck on next stage more 1 file. (i have eof loop after 1 file exits-how make continue next file). please me how approach next stage? thanks. background argv[0] name of program. argv[1] 1 st command line parameter. argv[2] 2 nd command line parameter. etc. so: start loop @ 1 , instead of 0 (i.e., j=0 incorrect). be sure close file after reading , before opening next file. algorithm think algorithm before writing code. set counter index of first argument. open file. assign handle open file. read file contents. write (if required) fil

.net - How can I prevent users from entering data into DataGridViewComboBoxCells? -

i have project uses number of datagridview controls. of cells of datagridviewtextboxcell persuasion. declare controls so: dim mycell datagridviewcell later specify whether datagridviewtextboxcontrols or datagridviewcomboboxcells so: mycell = new datagridviewtextboxcell ...or... mycell = new datagridviewcomboboxcell none of places in code require ability users enter own values in combo boxes. is, either hard-coded or values gathered other data within application. currently, users can highlight combo box control defined shown above , begin typing like. example, have 1 combo box offers user selection of integers between 1 , 9. can highlight combo box cell , enter "hello, world!" if i'd like. what take disable ability? i'm sure there's property, have yet find it. have searched internet, , have found ability have user-entered values added list , stream of data-binding tutorials. thank in advance! c check here edit i should have

c# - Getting the current logged in user (FullToken Context) -

i have problem, is... start programm right click -> run administrator. means programm running in administrative context. windowsidentity.getcurrent().name; if try user name way user started programm admin.. example "administrator", need name of current logged in user example: bob can me out? :) you try using wmi (system.management.dll) owner of explorer.exe process. string getexploreruser() { var query = new objectquery( "select * win32_process name = 'explorer.exe'"); var explorerprocesses = new managementobjectsearcher(query).get(); foreach (managementobject mo in explorerprocesses) { string[] ownerinfo = new string[2]; mo.invokemethod("getowner", (object[])ownerinfo); return string.concat(ownerinfo[1], @"\", ownerinfo[0]); } return string.empty; } this relies on fact explorer process single instance don't end possibility of having several explore

types - Is there a prefered way to specify a text column in SQLite? -

since sqlite engine not truncate data store in text column, there advantage in being specific column sizes when define schema? prefer this: create table contact( id integer primary key, name varchar(45), title varchar(10) ); over this: create table contact( id integer primary key, name text, title text ); why? are there advantages not being specific? the advantage of using varchar(x) is compatible other database systems - if remember correctly, text isn't standard sql datatype. other being more standards-compliant, there indeed no difference whether use text or varchar. more info @ http://sqlite.org/datatype3.html

.net - CompositionTarget.Rendering event for Windows Form? -

this code in wpf: compositiontarget.rendering += new eventhandler(update); compositiontarget.rendering += new eventhandler(draw); i translate windows form. can this? thank you. the closest equivalent form.paint event. isn't match, each control in winforms gets own event. fundamental difference between wpf , winforms. child control may need paint (compare control.invalidate) without parent ever getting event.

problem regarding crystal reports -

actually when drag fields database onto report , when run report, first row data shown i.e. if courseid field dragged onto report , when run should show courseid1 , below courseid2. but, shows courseid1. know silly thing, i'm new crystal reports, i'm unable solve it. so, please me out...thanks in advance... make sure dragging field details section of report. if in header or other section, may first row.

How to find all instances of a procedure (or function) in SQL Server 2005/2008 -

i modified procedure , takes greater number of parameters. how can find every place procedure called can update number of arguments proc passed? i tried this: select * syscomments text '%modified-procedure-name%' but i'm still finding other places proc called query did not return. use sys.sql_modules: select object_schema_name(m.object_id) + '.' + object_name(m.object_id) sys.sql_modules m m.definition '%whatever%' sys.sql_modules.definition nvarchar(max). other similar views have nvarchar(4000) columns, text split on multiple rows.

PHP performance question -

wondering better performance. site viewed people logged in , people not. site same users logged in except have more privledges. wondering more efficient. //option one if(isloggedin()){ write whole web site plus content logged in user can access } else { write whole website again, minus content logged in users can access. } //option 2 write website content , inset login function wherever need restrict access, function called few different times. i wondering if better performance using option 1 because function first checked once, , wouldn't need checked again, if user logged in first chunk loaded, if user not logged in, ignore first chunk , load second chunk. both. you don't want check isloggedin() everytime (especially if it's going hit database) because slow. don't want have 2 versions of html either because it's unmaintainable. check once @ top , set variable (or use session variable , check that). in html use if statements against variab

c# - IEnumerable parser class design -

i'm creating class can read dicom file. binary file filled lot of objects. want create solid class can this. i've designed following. using system; using system.collections.generic; using system.linq; using system.text; using system.io; namespace medicom { public class ddocument : ienumerable<ddataelement> { /// <summary> /// creates new ddocument file. /// </summary> /// <param name="path">the path of file load </param> /// <returns>an ddocument contains dicom information file</returns> public static ddocument load(string path) { return ddocument.load(new filestream(path, filemode.open)); } /// <summary> /// creates new xdocument instance using specified stream. /// </summary> /// <param name="stream">the stream contains dicom information.</param> /// <return

html - Javascript: Client side filling in Input fields on Server side -

(i'm scripting in windows, use in windows 7 gadget) hi there, i'm trying log in page on server machine client machine using serverxmlhttp request. i'm wondering if there's way fill in input fields in server's input fields , making server run authorization on information, , return new url. however, right main question have how go logging in? also, tried passing log in information in parameters , didn't seem work out well. this.requests[1].open("post", "https://" + this.address, true); this.requests[1].setrequestheader("content-type", "application/x-www-form-urlencoded"); this.requests[1].send("username=user&password=pass"); according http://it.toolbox.com/wiki/index.php/sending_serverxmlhttp_login_credentials looks username , password 4th , 5th parameters respectivly in open function. so... this.requests[1].open("post","https://"+this.address, true, "user_name&qu

vb.net - TabControl.SelectedIndex being changed, but SelectedIndexChanged even not firing -

all, i have tabcontrol in application started behaving strangely. background... this program converted vb6 vb .net 2008, , used refer forms using class names. in other words, might have form class called frmfoo. in code program might see: frmfoo.show() or frmfoo.userdefinedproperty = true during recent changes, created variables represent instances of forms these: public myform frmfoo myform = new frmfoo myform.show() in doing so, removed code form's load event handler , put in form's constructor. when form loads, or when document loaded , should influence tabcontrol's selected index, following not fire selectedindexchanged event. myform.tbsform.selectedindex = valuereadfromfile ...or... myform.tbsform.tabs(valuereadfromfile).select sorry wordy, there's more. if open form , @ tabcontrol verify it's been set properly, works it's supposed to. misbehaving tabcontrol contained within tabcontrol, have click parent tabcontrol see it

cocoa - NSOpenPanel from C++ boost thread -

i'm invoking nsopenpanel thread created boost c++. the panel behaves erratically , doesn't respond mouse, clicking on objects nothing sometime when clicking on top level combo box improve response. do i've run separate runloop i'm doing runmodalfordirectory should take care of running own loop. i've created separate objc class performselectoronmainthread show panel in main thread still behavior same. [ps performselectoronmainthread:@selector(showopenpanel) withobject:nil waituntildone:yes modes:[nsarray arraywithobject:nsrunloopcommonmodes]]; i've tried waituntildone:no , running cfrunloopruninmode isn't helping either. - (bool) showopenpanel { nsopenpanel *op = [nsopenpanel openpanel]; [op setallowsmultipleselection:yes]; [op settitle:@"choose file"]; [op setmessage:@"choose file importing."]; [op setfloatingpanel:true]; bool result =[op runmodalfordire

Delphi 2007 DBX Access Violation in dbxmys30.dll -

i'm trying use dbexpress components in delphi 2007 connect mysql database getting error reads "access violation @ address 0b86e258 in module 'dbxmys30.dll'. read of address 00000000". i have tsqlconnection using mysql drivers , setup connect mysql 5.1 database. can set active without problem. the problem arises when try data database using number of components. more specific, have tsqltable object. set sqlconnection parameter tsqlconnection created , set table name table in database. when try set active true error. happens in design mode @ runtime. happen other dbx component try data database. i'm running windows 7 64 bit mysql 5.1 client , server. can run queries on database using mysql query browser without issues. any appreciated. thanks! you have version incompatibility, version of 'libmysql.dll' you're using incompatible version dbx driver built against. this thread on embarcadero forums suggests use version '5.0.27&#

Java Socket know when request to gmail -

i'm trying create application event (java) raise machine gets connected gmail onto login page (https://www.google.com/accounts/), i'm trying build socket listen particular httprequest. can create serversocket listens port, specific ip adress (gmail login page can have many different ips), not host... got idea ? thank ! this should started: http://gforgeek.blogspot.com/2005/04/simple-packet-sniffer-using-java.html edit: i checked , think you're going have hard time accomplishing because gmail runs on https once packet sniffer running you're going have decrypt ssl communications. i'm not sure that's possible.

c# - Full size Silverlight application dimensions -

how can set dimensions of root layout in xaml 100% width , height of <object> tag houses silverlight app. i have tried specifying 100%, width , height properties take unit literals (exact pixels). there way can have silverlight app take available space in <object> tag? right (this change in version next of silverlight), pretty way figure out dimensions in javascript on page, pass silverlight object . one other option use silverlight/javascript inter-op api

c++ - enable_shared_from_this - empty internal weak pointer? -

i'm using enable_shared_from_this<base> , inherit base . when trying use shared_from_this() in derived 's constructor (not initializer list), exception. turns out internal weak pointer null , doesn't point this @ all. how can happen? other use case of works fine. don't know start. looked down @ source code of enable_shared_from_this , , looks me pointer nullptr. you cannot call shared_from_this() in object's constructor. shared_from_this() requires object owned @ least 1 shared_ptr . object cannot owned shared_ptr before constructed. i guess internal weak pointer set when shared_ptr takes ownership of object first time. before point, there no reference count struct weak pointer can reference.

c++ - MS Crypto API behavior on Windows XP vs Vista/7 -

i'm trying understand how public key imported pem format (sample included in code below) across xp, vista , windows 7. sample code import key on both xp , windows vista/7, not same way. on windows xp, string "(prototype)" required in cryptographic provider's name, , allows call cryptimportpublickeyinfo pass. on windows 7, "(prototype)" provider apparently present, not support call cryptimportpublickeyinfo, confusing. what might correct implementation between these operating systems? necessary detect xp , request name "(prototype)" , , without other operating systems? possible that still fail on xp systems? or, there way detect confusing behavior , select whichever cryptographic provider support necessary call? output on windows 7: analyzing cryptographic support for: "microsoft enhanced rsa , aes cryptographic provider" cryptacquirecontext success. cryptacquirecontext.1 success. cryptstringtobinar

c# - How to make a menu pop up after mouse release -

hi using c# , taoframework opengl , glut here buildmenu() private static void buildmenu() { submenu1 = glut.glutcreatemenu(selectmessage); glut.glutaddmenuentry("new game(n)", 1); glut.glutaddmenuentry("reset(r)", 2); glut.glutaddmenuentry("quit(q)", 3); glut.glutattachmenu(button); //**makes menu pop once button pressed.** } how can make pop after mouse release?? using glut? can't (or lot of headaches). solution? don't use glut. glut started in-situ framework demonstrating simple opengl programs. it's neither part of opengl nor flexible (as found out). , it's unmaintained. either use real toolkit, there lot of them: qt, gtk, wxwidgets, fltk, fox... or if you're focused on doing opengl may suggest using glfw , better glut, you'll have draw menus (using opengl).

c# - Binding to ObservableCollection from Custom Control -

i have custom control observablecollection... in generic.xaml, have control template defined there , bind listbox there observablecollection of own custom control (inotifypropertychanged implemented), different normal since we're not binding view model. is possible? if want bind control in control template (listbox in case) object in custom control (observablecollection in case), should define object dependency property in custom control , use 'templatebinding' bind object in control template. i wondering if indeed custom control want , not user control.

iis - Unable to commit WebAdministration changes in Azure Web Role -

i have azure web role running in new 1.3 sdk , having permissions issues when trying make changes iis using microsoft.web.administration.servermanager . whenever execute commitchanges() throws error: an unauthorizedaccessexception "cannot write configuration file due insufficient permissions". my servermanager code executing in onstart method of roleentrypoint . my understanding purpose of moving full iis support in 1.3 have greater control on configuration of our application, including creating new iis sites on fly if desired. make sure role running elevated privileges.

encryption - Node.js and crypto library -

i'm having weird issues node's crypto library. wrote simple aes testing script: var cipher = crypto.createcipher('aes-256-cbc','inmbuvp6z8') var text = "123|123123123123123"; cipher.update(text,'utf8','hex') var crypted = cipher.final('hex') var decipher = crypto.createdecipher('aes-256-cbc','inmbuvp6z8') decipher.update(crypted,'hex','utf8') var dec = decipher.final('utf8') when console.log(dec), it's null. reason if set test "123|123123", works. why "123|123123" work "123|123123123123123" doesn't? you need store return cipher.update cipher.final sure have everything. cipher.update "returns enciphered contents, , can called many times new data streamed": http://nodejs.org/docs/v0.2.5/api.html#cipher-update-247 cipher.final "returns remaining enciphered contents". i think append results each call this: var

Transforming xml to xml using xslt encoded hierarchy problem xslt v1 -

in input xml file have got encoded hierarchy in elements attribute "lp": <element lp="1"/> <element lp="1.1"/> <element lp="2"/> <element lp="3"/> <element lp="3.1" /> <element lp="3.2" /> <element lp="3.2.1" /> how transform xml data <element lp="1"> <element lp="1.1"/> </element> <element lp="2"/> <element lp="3"> <element lp="3.1"/> <element lp="3.2"> <element lp="3.2.1"> </element> </element> there way xslt2.0, have assumed xslt1.0 here. one thing not xml not strictly valid, because lacks root element. purposes of answer, have assumed root element called elements to achieve this, think need function determine 'level' of element. can done counting number of full stops in @lp attribute. i

c# - Creating a WiFi application -

i have write application shares data on wireless ad hoc network. and have no idea how this. @ c# thinking choose c# writting application first question- how read data received on wifi or how send data on wifi... means there port should read/write? second question- protocol management stuff done adapter or application should that? and suggest reading should go for! read basics of wifi , how works , all! regards! you need start reading native wifi windows xp sp3/win2k/vista/7.

python - Is this parallel calculation using the new concurrent.futures lib OK? -

i submitted following, runs ok me, have single core machine , take documentations comment spread on more cores if had them; automatically. from concurrent import futures import math numbers = [ 112272537195293, 112582718962171, 112272537095293, 115280098190773, 115797840077099, 1099726829285419] def lowest_factor(n): if n % 2 == 0: return 2 sqrt_n = int(math.floor(math.sqrt(n))) in range(3, sqrt_n + 1, 2): if n % == 0: return return n def main(): print( 'for these numbers:\n ' + '\n '.join(str(p) p in numbers) ) futures.processpoolexecutor() executor: low_factor, number = min( (l, f) l, f in zip(executor.map(lowest_factor, numbers), numbers) ) print(' mnimal prime factor %d of %i' % (low_factor, number)) if __name__ == '__main__': main() it looks ok me running in python 3.2b1 (r32b1:87064, dec 5 2010, 19:08:18), welcome criticism others. p.s

php - preg_replace not doing what I expect -

i have following paterns in paragraph of text , need replace nothing, disappears paragraph. the sendtence contains consultants [45416,2010-05-11] need remove [] , within these [] , not characters within [] anything i tried below removes [] $par = preg_replace('/[\[*\]]/','',$par); you can do: $par = preg_replace('/\[.*?\]/s','',$par); explanation: / - start delimiter \[ - literal [ .*? - non-greedy \] - literal ] / - end delimiter s - modifier make . match newline to make replacement bit faster can do: $par = preg_replace('/\[[^\]]*\]/s','',$par); explanation: / - start delimiter \[ - literal [ [ - start of character class ^ - char class negator ] - end of character class \] - literal ] / - end delimiter

about upload iPhone video to Youtube -

how set video format of iphone camera captured? think can mov,mp4, h.2x , because iphone can play it, can not find api set video format recording ..... also want upload video youtube, know can find open source code purpose, think feature commonly , must done other coder....just want save time purpose .. thanks use gdata enough

c# - Referencing a static class from an array? -

i have list of numbers, , each number same should act same. have static classes each number if change class, of numbers references to. the way numbers accessed via wrapper function, i'm not referencing array directly, e.g.: map.getblock(x,y).accesstostaticclassmembers; so, how go this? i'm not sure want. sounds you're trying ensure there 1 instance in memory each number. if that's case, what's wrong this: static public class objectmapping { static dictionary<int, object> dictionary = new dictionary<int, object>(); static public object getobjectfornumber(int x) { object o; if (!dictionary.containskey(x)) { o = createobjectfornumberthefirsttime(x); dictionary.add(x, o); return o; } return dictionary[x]; } } of course, left out things such thread safety , creation of objects in first access, on own.

How do I get the XML root node with C#? -

i know it's possible xml node using c# if know node name, want root node can find out name. possible? update : i'm using xmltextreader read in url of file , loading xmldocument object. i'm trying avoid linq xml, if there's another, better way i'm student. root node documentelement property of xmldocument xmlelement root = xmldoc.documentelement if have node, can root node xmlelement root = xmlnode.ownerdocument.documentelement

Jquery check for integer? -

i have code: jquery(function( $ ){ // if no speed set (when loading page) set default speed if (!$movespeed) { var $movespeed = 4000; } // move damn autocue $('a.godown').click(function(){ alert($movespeed); $.scrollto('#footer', $movespeed); return false; }); $('a.goup').click(function(){ alert($movespeed); $.scrollto('#header', $movespeed); return false; }); // speed settings autocue $('a.changespeed').click(function(){ $movespeed = $(this).attr('speed'); return false; }); }); </script> and if changespeed clicked, alert box shows changed given number aint integer, there way convert variable in integer? thx :) $('a.changespeed').click(function(){ $movespeed = parseint($(this).attr('speed'),10); return false; }); javascript parseint function

java - Oracle jdbc driver: implicit statement cache or setPoolable(true)? -

oracle jdbc driver 11.2.x: should rely on implicit statement cache or should invoke setpoolable(true) on each created statement? differences, advantages , disadvantages of both methods? statement caching improves performance caching executable statements used repeatedly, such in loop or in method called repeatedly. when enable implicit statement caching, jdbc automatically caches prepared or callable statement when call close method of statement object. invoking setpoolable(true) on each created statement caches statement. i'd you're better off relying on implicit statement cache. here's oracle's documentation on statement , result set caching oracle 11.2.

Chat client in iPhone App -

if create application iphone, how can notified of chat messages receive? receiving messages server happens through push notification or application has poll server in regular time interval. i guess each time new message comes server send notification app, , once app receives notification, app pulls message server. is understanding correct? look xmpp protocol/servers :) therein lies answer. theres iphone framework called xmppframework help.

Searching unsorted array in perl? -

i have array with... lets 100 elements. want check see if of elements matches particular string. example: @array = ('red','white','blue'); i want know if array contains string 'white' 1 of elements. i know how foreach loop , comparing each element , but... there easier (faster) way looping through whole array? -thanks it won't faster looping, can use grep within perl. $ perl -e "@array = ('red','white','blue'); print grep(/^white$/, @array);" white

redirect wordpress calls to a page -

i'm not sure best way this. have set page so: www.myblog.com/page1 is possible to, specify request of subpages under page1 redirected single page? if had page1.php 1 of pages, url prefixed with: www.myblog.com/page1/... wordpress use file generate page. basically, have custom content want fetched php, , depends on subpage being loaded. format of custom content same, 'arguments' differ. there way within wordpress? , if not, should should start looking implement this? thanks try modifying .htaccess file , rewriting url requests /page1/page2 rewrite /page1=?page=page2 or that

jquery - failed to load resource -

im trying set simple mp3 player: <script language="javascript"> $(document).ready(function() { $('a.media').media( { width: 300, height: 20 } ); }); </script> and <a class="media" href="piano.mp3">piano</a> but following error: failed load resource i have followed tutorial @ http://jquery.malsup.com/media/audio.html , , if click view source , clikc on piano.mp3 chrome opens built in media player , plays song, link , location correct... anyone got clue? i reckon need download mediaplayer.swf since it's default player mp3 files (according docs)

php - Add rows to database based on images in folder -

this follows on question had earlier cleaning database can see here: remove row database if image not on server i have mysql database table in following format: id: 1 date: 2010-12-19 image: 5d61240f-7aca-d34b-19-12-10-15-36.jpg caption: merry xmas i want create php script checks through /gallery/ folder on server , every image in gallery folder isn't listed in database want create new row it's filename in image column. id sequential, date needs last modified date of file using filetime() , needs in yyyy-mm-dd format. caption column can blank these files we're adding. script appreciated. thanks! // list of allowed image extensions $image_exts=array('png','jpg','ico','gif','bmp'); // ... // function store image file db function db_add_image($image){ $name=mysql_real_escape_string(basename($image)); mysql_query("insert `table` (`id`,`date`,`image`,`caption`) values (null,'".date(

ruby on rails 3 - Use Arel for a nested set & join query and convert to ActiveRecord::Relation -

i have model organisations (nested set). have model people. person can have person deputy. organisation owned person. organisation visible owning person or deputy. i retrieve organisations visible given person, ie. organisations owned person or owned people, given person deputy: o = arel::table.new(:organisations) p = arel::table.new(:people) pd = p.where(p[:id].eq(3).or(p[:deputy_id].eq(3))).project(:id) op = o.join(p).where(o[:person_id].in(pd)).project("distinct organisations.*) there better way formulate last join, split query people , deputies query of organisations visible people , deputies. the last join returns arel::selectmanager (for there seems no useful documentation anywhere). is there way convert selectmanager activerecord::relation benefit whole concept of "closure under composition"? how self join above query on organisations again obtain descendants of organisations visible person or deputy? know sql fail selectmanager self join on organi

android - send TCP messages from two different threads -

i have 2 threads need send tcp messages using same stablished connection. have object lets tcpsender use booth threads. how can design software in order not have concurrency problems , lost messages? thanks! you model producer/consumer each thread injects messages tcpsender whenever ready , tcpsender maintains fifo queue of messages. insertions queue locked (within tcpsender ) , processed in-order. there thread consuming messages when queue not empty locking each time message removed queue. two immediate benefits can support arbitrary number of producers , blocking limited inserting queue , not sending messages (from point of view of producer, is).

r - How do I identify which Sweave code chunk gives an error? -

when running sweave emacs-ess, errors provided code chunk number. there easy way navigate among code chunks number? otherwise, difficult identify. i don't use emacs-ess (i use eclipse/ statet) shows code chunks being processed label (each code chunk starts <<label="some text"... code chunks include labels ?

vb.net - Nunit Assertion for an empty intersection between collection -

i've looked around, , can't quite figure 1 out, , multitude of trial , error attempts have been useless. i have list of user names (we'll call 'original list') 1 object returning have list of user names (we'll call 'filtration list') object returning i testing method returns of items original list not in filtration list. ideally want like assert.that(returnedlist, has.no.members.in(filtrationlist)) so far thing can iterate on filtrationlist , do assert.that(returnedlist, has.none.equalto(filtereduser)) with nunit can create custom constraint. if want verify 2 collections intersection, can create this: public class intersects : collectionconstraint { private ienumerable _collection2; public intersects(ienumerable collection2) : base(collection2) { _collection2 = collection2; } public static intersects with(ienumerable arg) { return new intersects(arg); } protected overr

javascript - Passing $(this) selector into nested functions -

so have script in place needs go through each p tag within parent div class name of entry-content , translate each 1 using google translate api. so when user clicks link translate page english spanish function run: function spanish() { $(".entry-content p").each(function(){ var text = $(this).html(); google.language.detect(text, function(result) { google.language.translate(text, "en", "es", function(result) { if (result.translation) { alert($(this).html()); //outputs null $(this).html(result.translation); //doesn't work } }); }); }); } the problem when iiget inner function $(this).html() comesback null , not able change current elements html in order change new translated text. so guess question is: how pass current selected element nested functions? thanks you may store in local variable the value of this relate contex

Django app throws spurious exception when importing views from third-party app -

i'm working on django app throws viewdoesnotexist exception when trying import modules third-party app (solango, specific). "occasionally", mean enough annoying, minority of requests. solango on app's pythonpath , can imported reliably through console. error never happens during local development, maybe has server setup (the app uses apache + mod_wsgi in daemon mode). here's stack trace showing error occurring in admin (although occurs on pretty every page on site): traceback: file "/home/nybooks/ve/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) file "/home/nybooks/ve/lib/python2.5/site-packages/django/contrib/admin/sites.py" in root 445. return self.index(request) file "/home/nybooks/ve/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_

c# - Modelling Classes based off versioned XSD files -

i'm coding standard defined in xml. standard has provided me 2 xsd's must support. breaking changes in backwards compatibility. question general 1 in best practice implement these. went down path of using "xsd.exe" generate class files model xml in typed manner. brought me conclusion there not way version class files in c# other overriding methods not clean me since changes pretty significant in terms of properties ect. so initial idea use standard xml parsing in each versioned processor , not worry typed models, write lot more code( , less clean code ) in process. second idea version model , processor names xsd version ( tag in xml ) id have class named "equipment_1_0" , "equipment_1_1" , use factory return me proper type de-serialize seems hacky. and final idea turn here because these seems issue many people have addressed before. insight or resources can point me in terms of best practices in situation? thanks i suggest usi

set a message in drupal -

i need 1 of 2 things in drupal have ability set info message specific user view next time login. message show in standard $messages variable. looked see if drupal_set_message() had capabilities didn't find it run function everytime page loaded info cause drupal_set_message sent i prefer second option, if has suggestions. i place code in hook_init(). of drupal has been loaded , available on every page load. within that, query list of messages form database , funnel them drupal_set_message(). $messages variable stored in session, need call drupal_set_message() @ time want show message. storing need present message different challenge, , depends on how determine message needs set. if based on elapsed time, can skip custom coding , go straight rules--defining triggers , actions based on user login date. if more dynamic messaging scheme, need notify users of events have happened in absence, might use write code based around message module or it, allow record m

c# - Connecting to SQLExpress from a service -

we've got service running local system. should possible use integrated security connect sqlexpress instance service? tries login "nt authority/anonymous logon" , fails connect. connection string data source=.\sqlexpress;initial catalog=example;integrated security=true what need setup on sqlexpress handle this? i suggest running service in account dedicated service. way can shape security, limiting damage if service compromised. means know account give sql server , can shape security in there too.

python - Installing Graphviz on Os X 10.5.8 -

i'm trying install graphviz 2.14.1 on osx 10.5.8 installed graphviz universal binary here: http://www.ryandesign.com/graphviz/ $ svn co https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz - fingerprint: 43:8e:fa:75:00:60:67:07:fd:04:3c:e7:bf:25:86:fd:66:b3:f6:cb (r)eject, accept (t)emporarily or accept (p)ermanently? t pygraphviz/pygraphviz pygraphviz/pygraphviz/graphviz.i pygraphviz/pygraphviz/graphviz.py pygraphviz/pygraphviz/tests pygraphviz/pygraphviz/tests/graph.txt pygraphviz/pygraphviz/tests/attributes.txt pygraphviz/pygraphviz/tests/__init__.py pygraphviz/pygraphviz/tests/test.py pygraphviz/pygraphviz/tests/layout_draw.txt pygraphviz/pygraphviz/graphviz_wrap.c pygraphviz/pygraphviz/__init__.py pygraphviz/pygraphviz/release.py pygraphviz/pygraphviz/agraph.py pygraphviz/install.txt pygraphviz/doc pygraphviz/doc/source pygraphviz/doc/source/contents.rst pygraphviz

java - How do you customize how JAXB generates plural method names? -

we using jaxb generate java classes , have encountered few cases generated plural method names not correct. example, expect getphysicians getting getphysicien . how customize how jaxb pluralizes specific methods? the schema: <xs:complextype name="physician"> <xs:sequence> ... </xs:sequence> </xs:complextype> <xs:complextype name="physicianlist"> <xs:sequence> <xs:element name="physician" type="physician" minoccurs="0" maxoccurs="unbounded"/> </xs:sequence> </xs:complextype> the generated java code: ... public class physicianlist { ... @xmlelement(name = "physician") protected list<physician> physicien; ... public list<physician> getphysicien() { if (physicien == null) { physicien = new arraylist<physician>