Posts

Showing posts from July, 2011

iphone - NSXML Parsing through objective C -

i working on xml parsing through objective c. getting trouble following part. please me out. using nsxmlparser class , delegates. how trace out "url", "type", "height" these tags below xml code. <image url="http://d.img.com/a/r/rids/20110203/i/r32323.jpg? x=130&amp;y=91&amp;q=85&amp;sig=bjdeybrqfsyuuzj.ffwa8g--" type="image/jpeg" height="91" width="130"/> implement delegate function - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict and inside nslog(@"url: %@", [attributedict valueforkey:@"url"]); etc.

ssrs 2008 - How do I make wildcards work in a like operator in SQL Server reporting services? -

i have added filter expression using operator. put in value field? parameter named @test , i'd filter function %@test% in sql. want act %@test% can pass '' values query. i got work adding filter expression operator , setting value this: ="*" + parameters!roles.value + "*" to values pass ''.

security - Whats a valid strategy for a secure image upload from a flash client? -

i'm creating flash application post images url saving disk/display later. wondering suggested strategies making secure enough upload verified coming application , not random form post. is reliable enough check referring location realizing don't need bulletproof security, or perhaps setting authentication headers better strategy though seems unreliable have read. the application , server script reside on same domain , in java - there way check 'session' or that? another thought had sort of simple hashed key type system, hard-code key flash application , pass server based on - server know key , able verify if value passed based on that? thanks advice , examples - naive in area -b the app public app, authenticating users not option. after more research thinking using hard coded salt key on both ends, sending md5 hash of base64 encoded image bytearray+salt matched on server side. thoughts on strategy? your question can generalized 'how can sure im...

asp.net - MaintainScrollPositionOnPostback not working with javascript:__doPostBack -

hi have gridview , records can long. have command field update records. when click "edit" command button makes javascript postback. javascript:__dopostback('gridsubcategories$ctl02$ctl00',''); even set maintainscrollpositiononpostback="true", after postback page not scrolling previous point. can do?

c# - samsung api how to call -

does knws how call it? public struct smiaccelerometervector { public float x; public float y; public float z; } i want x,y,z values , paste label. samsung's documentation unclear on exact dll contains these functions, believe this: public struct vector { single x; single y; single z; } [dllimport("smisdk.dll", setlasterror=true)] public static extern int smiaccelerometergetvector(out vector vector);

How to load an image in active document? (Photoshop Scripting) -

i new photoshop scripting. i want load image image (from hard disk) active document new layer positioning. how can done? can please share code? thanks you can open photoshop file dialog searching image , adding layer file = app.opendialog();//opens dialog,choose 1 image if(file[0]){ //if have chosen image app.load(file[0]); //load documents backfile= app.activedocument; //prepare image layer active document backfile.resizeimage(width,height); //resize image given size i.e 640x480 backfile.selection.selectall(); backfile.selection.copy(); //copy image clipboard backfile.close(saveoptions.donotsavechanges); //close image without saving changes doc.paste(); //paste selection document doc.layers[0].name = "backgroundimage"; //set layer's name } there example of making calendar photoshop javascript extension (.jsx). please check here

CSS inheritance, aliases and other cool stuff -

the other day randomly browsing web , found program lets write css aliases , other cool stuff (which can't remember right now). as example, remember can this: .myclass { background-color: red; greenfont } where greenfont defined somewhere else somekind of alias greenfont { color: green; } then program generate resulting css based on alias , other stuff. does has used this? or did dreamed it? cannot find :p sorry reply such old thread 1 check out less http://lesscss.org

image - Weird behaviour with for loop in JavaScript -

i have image table has 2 columns , 20 rows. when executing loop, rows working okay except first row, displays first image on left. it's weird; there wrong order of execution? var image= []; var rows=5; (var = 0; < test.length; i++) { var avatar = test[i].image; // profile image if(i % 2 === 0){ image[i]= titanium.ui.createimageview({ top:row, image:avatar align:right }); win.add(image[i]); //trying increase image row =row+200; } else if(i % 2 === 1) { image[i]= titanium.ui.createimageview({ top:row, image:avatar align:left }); win.add(image[i]); } } i=0, i%2=0, show image (supposed right), row+=200; i=1, i%2=1, show image (left side), row stays same i=2, i%2=0, show image (right side), row+=200 0%2 = 0, , represents right side image, , goes next line. need play around increment row , side lo...

html - How can I get reason of page unloading in javascript's onunload event, in IE? -

there may different reasons of page unloading: 1 user closes current window. 2 user navigates location. 3 clicks back, forward, refresh, or home button. 4 user submits form, , browser starts unload current page , load page results of form submitting. (assuming current window form's target). 5 , on... can somehow know in onunload handler reason of unloading p.4, i.e. moving page results of form submitting? define flag when submiting form, not solve problem. because response (on form submit) web server takes time, browser doesn't unload current page , waits response server. , during waiting user may close window or navigate anywhere. , need know whether indeed moving results page or else...? you hijack of events. for example links, add event handler on links saves href attribute, performs require, sets window.location href had stored in variable.

What are the best tools for Sql Server version control -

after reading this post, , suggestion use team edition database professionals , want know there equivalent sql server 2008 / visual stuio 2010 ultimate. i'm looking tool need thing jeff mention in his article: create test data. schema comparison. data comparison. database unit testing. refactoring. integrated t-sql editor, first class language construct in ide, c# , vb.net. for full details on article: http://www.codinghorror.com/blog/2006/12/is-your-database-under-version-control.html it seems visual studio 2010 (and 2008) have strong approach issue. don't know if best option exist, good. here getting started , walkthrouge learn how start using it. vs 2010 premium , ultimate have built in (expand database development link) http://www.microsoft.com/visualstudio/en-us/products in short, database project gets checked source control, , deploy production database project. if looking used outside of vs2010 redgate has beta http://www.red-ga...

java - BaseAdapter in ListActivity isn't displaying the correct items -

i have listactivity in trying display imageview under list. i'm attempting creating own baseadapter , using 2 different methods inside getview method, 1 list , 1 imageview . managed imageview displayed under list how want it, problem having list isn't displayed correctly. for reason item in list isn't on screen until user scrolls down gets populated wrong data so: ----top screen------ | item 1 | | item 2 | | item 3 | | item 4 | ----bottom screen--- | item 1 | <--items not on screen show | item 1 | <--as item 1 once user scrolls | image view | what should so: ----top screen------ | item 1 | | item 2 | | item 3 | | item 4 | ----bottom screen--- | item 5 | | item 6 | | image view | my custom baseadapter private class mycustomadapter extends baseadapter { private static final int type_item = 0; ...

svn - How can apparently nested Subversion working copies be coalesced? [Equivalently: How do I add the parent directory to source control?] -

i have partially checked-out tree of sources. these incorrectly checked out commands this: > svn co --depth=empty svn://repos/trunk . > svn co --depth=infinity svn://repos/trunk/project project > svn co --depth=infinity svn://repos/trunk/test test of course, commands should have been like > svn co --depth=empty svn://repos/trunk . > svn --set-depth=infinity project > svn --set-depth=infinity test the resulting symptoms are: > svn st ? project ? test although > svn info path: . url: svn://repos/trunk repository root: svn://repos repository uuid: 01234567-89ab-cdef-0123-456789abcdef revision: 1234 node kind: directory schedule: normal depth: empty > svn info project path: project url: svn://repos/trunk/project repository root: svn://repos repository uuid: 01234567-89ab-cdef-0123-456789abcdef revision: 1234 node kind: directory schedule: normal (curiously, symptoms don't arise if first command svn co --depth=immediates svn://...

c# - Left outer join in LINQ is showing exception -

i getting following exception: the null value cannot assigned member type system.int32 non- nullable value type. below linq statement questionid primary key in table: var questionviewsdata = questionviews in objdc.sc_questionsviews join questions in objdc.sc_questions on questionviews.questionid equals questions.questionid qs questions in qs.defaultifempty() questionviews.createddate.date == new datetime(2010, 4,27) select new { selected =(questions == null ?-1:questions.questionid), questiointitle = questions.title, votescount = questions.votescount }; change line where questionviews.createddate.date == new datetime(2010, 4,27) to where questionviews.createddate == new datetime(2010, 4, 27) as test run where questionviews.createddate > new datetime(2010, 4, 26) n.b. if include .date in linqpad c# statement receive following error message , removing .date allows state...

sql - Concatenate a Varchar and int -

this question has answer here: how concatenate numbers , strings format numbers in t-sql? 10 answers i need concatenate varchar , int in t-sql , ! select ('varvalue' + cast(32 varchar))

google chrome os - Are users able to view source of web apps on ChromeOS? -

if yes, there way compile (not obfuscate) js code deployment in chromeos? from looking @ codebase using chromium.org git browser, appears google haven't gone out of way remove "view page source" menu item version of chrom(e|ium) shipped in chrom(e|ium) os. of course, there's nothing prevent them hiding option in ui, or removing feature #ifdef -ing out, though.

Access environment variables from Python -

i set environment variable want access in python application. how value? environment variables accessed through os.environ import os print os.environ['home'] or can see list of environment variables using: os.environ as might need see complete list! # using return `none` if key not present rather raise `keyerror` print os.environ.get('key_that_might_exist') # os.getenv equivalent, , can give default value instead of `none` print os.getenv('key_that_might_exist', default_value) python default installation on windows c:\python . if want find out while running python can do: import sys print sys.prefix

How to update model in the database, from asp.net MVC2, using Entity Framework? -

i'm building asp.net mvc2 application, , using entity framework orm. having troubles updating object in database. every time try entity.savechanges(), ef inserts new line in table, regardless of want update, or insert done. tried attaching (like in next example) object entity, got {"an object null entitykey value cannot attached object context."} here's simple function inserts , updates (it's not vehicles, it's simpler explain this, although don't think effects answers @ all)... public static void insertorupdatecar(this vehicles entity, cars car) { if (car.id == 0 || car.id == null) { entity.cars.addobject(car); } else { entity.attach(car); } entitet.savechanges(); } i tried using attachto("cars", car), got same exception. anyone has experience this? if updating existing record should have entitykey within object instance providi...

css - IE shows my image only 1 pixel high -

please check out example, first in ff, chrome or safari: [demo link removed] you notice large image. scale resize window. fluid image inside fluid container. check in ie8 or ie7. 1 pixel high :( i suspecting ie requires sort of width fix give base dimension, playing around giving image min-height of 75%, or min-width of 75% in case concerns portrait image. indeed gives height needed, however, breaks resize feature. min-height of 75%, resize window narrow width see mean, lose aspect ration of image. why oh why can't ie respect these liquid widths , heights? ps: thinking haslayout fixes, removed ie8 , doesn't seem work in earlier versions specific case either. simply removing entire height attribute on image fixes in ie, firefox, chrome.

Best explanation of Ruby blocks? -

what best explanation ruby blocks can share? both usage , writing code can take block? i offer own explanation this answer , modified: "blocks" in ruby not same general programming terms "code block" or "block of code". pretend moment following (invalid) ruby code worked: def add10( n ) puts "#{n} + 10 = #{n+10}" end def do_something_with_digits( method ) 1.upto(9) |i| method(i) end end do_something_with_digits( add10 ) #=> "1 + 10 = 11" #=> "2 + 10 = 12" ... #=> "9 + 10 = 19" while code invalid, intent—passing code method , having method run code—is possible in ruby in variety of ways. 1 of ways "blocks". a block in ruby very, method: can take arguments , run code those. whenever see foo{ |x,y,z| ... } or foo |x,y,z| ... end , blocks take 3 parameters , run ... on them. (you might see upto method above being passed block.) because blocks special part of ru...

C# Deferred Property Setting -

i working on project need queue number of property changes. let have: public class foo { string bar { get; set; } int bar1 { get; set } } i want have code looks like: //store value set actions in queue foo.setvalue(bar, "abc"); foo.setvalue(bar1, 123); //preview changes foreach(item change in foo.changequeue) { console.write(change.propertyname.tostring()); console.write(change.value.tostring()); } //apply actions foo.commitchanges(); what best way accomplish this? "type-safe" version uses callbacks. not automatically remove duplicate-settings. not use reflection , property-name errors fail on compilation. method expanded require "name" , remove duplicates using dictionary backing (as per akash's answer) or allow "setter" return value (such success or failure or old value, or whatnot). interface setter { void apply(); } class setter<t> : setter { public t data; public action<t> setf...

c# - POST Multiple Parameters to WCF Service -

i'm trying understand wcf, questions may dumb. believe have firm understanding of "get" operations. i'm working on "post" operations. question is, can write wcf service operation, webinvoke, accepts multiple parameters? or, when post data, accept single serialized parameter? thank you! yes, post have passed in using common understanding of data, aka "data contract". in wcf, typical approach here you'd create contract class (just off-my-head example, not 100% working)) [datacontract(namespace="http://yournamespace.com")] public class mycontract { [datamember(order=1)] public string mydata1 { get(); set{};} [datamember(order=2)] public string mydata2 { get(); set{};} } then you'd specify wcf operation accept contract type parameter [webinvoke(method="post")] public string dosomethingfrompost(mycontract posteddata) { } on client, you'd serialize data xml/json matches contract. aga...

save - iPhone App : Storing / Saving personal preferences once per App -

i want store / save personal preference settings email, phone number app. have few forms send info email id. want know email & phone number of user can contact person if need be. don't want users keep entering email id & phone no. everytime in each form. it's wise take these inputs (email & phone) once per device / per app installed on device. i trying use .plist purpose. have no success. how do it? example code (or) links? thanks. appreciate help. you might want check out nsuserdefaults : // storing values nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults]; [prefs setobject:@"foo@bar.com" forkey:@"usermail"]; [prefs synchronize]; // reading values, after application restart nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults]; nsstring *mail = [prefs stringforkey:@"usermail"];

jqgrid xml generating empty cell -

i'm using code generate xml jqgrid's data: var grid = $("#gridtable"); var datafromgrid = grid.jqgrid ('getrowdata'); var xml_string = '<rows>\n' + xmljsonclass.json2xml ({rowtest:datafromgrid}, '\t') + '</rows>'; when cell inside grid empty inside xml tag "_empty_string" , how can change empty xml tag (like this: <cell1></cell1> ) while generating ? thank's in advance. the easy way append code following line xml_string = xml_string.replace(/>__empty_string_<\//g, "><\/"); it cut __empty_string_ strings.

gwt2 - TabLayoutPanel with scroll -

i'm using tablayoutpanel in gwt application, attached rootlayoutpanel of page. inside each tab have scrollpanel, used display flextable. is possible make tablayoutpanel grow vertically, user can scroll entire page using browser scroll bar, instead of using internal scrollpanel ? just add new style tablayoutpanel: this.addstylename("tab-style-content"); and define in css as: .tab-style-content .gwt-tablayoutpanelcontent { overflow: auto; } thus, property overflow overwritten in gwt-tablayoutpanelcontent , scrollbar shown automatically.

ajax - Using JavaScript/JSON in your Ebay listings to post user selected options back to you -

i seeing ebay users create listings data dynamically sent , fetched external sources. can shipping calculator or variants have provided product in drop-down list. see example here somehow data sent php page returns postcode image also upgrade drop down lists seem send json objects php page etc. anyone know involved in solution , if there's guide/script resource ebay listings out there let me know how this? thanks... see did -> opened link posted, opened listing description firebug, found js script withing listing description, not complicated one. guess need @ script learn did there. guess uses jsonp or similar techique. can use iframe b.t.w

Objective-C; typedef objc_object as substitute for id without pointer; -

in objective-c id typedef: typedef struct objc_object { class isa; } *id; so can declare (and initialize) variable e.g. this: // using id id po_one = @"one"; compiles fine. since name types in own scheme , since dislike implied pointer in id typedef want add own typedef (with o object) this: typedef struct objc_object o; so variable declaration (with initialization) like: // using o o * po_two = @"two"; this compiles warning: initialization incompatible pointer type as far understand typedefs thought latter should equivalent to: // using struct objc_object struct objc_object * po_three = @"three"; which again compiles fine. it's astonishing that: po_two = po_one; po_two = po_three; both compile without warnings. so tried: typedef struct objc_object * po; to see whether works without warning if include pointer (being thing want avoid - test reasons) see whether typedef outside of structure definition ...

architecture - What is the best folder stucture in TFS for reporting service projects -

i'm looking on deciding useful folder stucture strategy reporting service projects in tfs. 1 have suggestions on way should stucture tfs? should project per report or should 1 reporting project multiple folders under main contain report projects? i.e. senario 1 (separate projects each report project) $reportproject1 $reportproject2 $reportproject3 senario 2 (main report project in tfs , subfolders report projects) $reportingservices ------src ---------project1 -----------reportproject1 files ---------project2 -----------reportproject2 files ---------project3 -----------reportproject3 files i lean towards fewer team projects, better. reports fall logical "packages"? have absolute need manage them separately? flexible enough work single project on multiple projects? when scoping team projects - regardless of type of solutions stored within them - try come best balance between granularity , deployability. remember, if going set work item ...

Recommendations for a simple 2D graphics python library that can output to screen and pdf? -

i'm looking easy-to-use graphics lib python can output screen pdf. so, use code draw stuff (simple prims ovals, rectangles, lines , points) screen , when things good, have output pdf. you can use python imaging library drawing images can displayed in various uis, e.g. displaying jpg. then, use reportlab . here's example shows how use reportlab image. i'm not sure mean drawing "screen", i.e. if you're working specific ui toolkit. if it's acceptable draw , display pdfs without using intermediate image (jpg, etc), might consider pyx library, makes quite simple graphics pdfs.

Schedule Python Script - Windows 7 -

i have python script run @ regular intervals. running windows 7. best way accomplish this? easiest way? you can in command line follows: schtasks /create /sc hourly /tn pythontask /tr "path_to_python_exe path_to_python_script" that create hourly task called 'pythontask'. can replace hourly daily, weekly etc. path_to_python_exe like: c:\python25\python.exe. check out more examples writing in command line: schtasks /? otherwise can open task scheduler , through gui. hope helps.

authentication - What is a hardware-id? -

some forums regularly visit sell premium programs, , prevent them being leaked use hardware-id authentication. is, first send program run grab hwid, tell them hwid, store in database, send actual program. if hwid isn't in database, program won't run. hardware-id, , how generated? why hwid different depending on programmer sends me hwid-grabber? a hardware id (hopefully) unique identifier generated serial numbers present in such things cpu , network card. there no standard algorithm, why varies between individual developers. a previous question discussed algorithms. how fast hardware-id in c#?

jQuery custom selection -

i'd extend jquery selection treats given selection value id. for example, when $("foo.bar") , jquery try select elements tag name foo , class bar, want jquery select element id of foo.bar . instead of having escape dots , prepend # each time, i'd add jquery function can $("id:foo.bar") . is possible jquery? if so, can show me examples? thanks. if replace id selection attribute filter, have test every element on page id instead of using document.getelementbyid . if want little more convenience, create own wrapper. can use jquery's namespace if want: jquery.byid = function(id){return $(document.getelementbyid(id));}; $.byid('foo.bar').addclass('something');

winforms - Free Charting Library for Visual C++ 2008 -

can suggest free charting libraries visual c++ 2008 windows forms application. http://www.codeproject.com/kb/graphics/zedgraph.aspx written in c#, can used .net language in windows forms.

.net - Getting the SyncSession.SyncNewReceivedAnchor -

i trying sync new received anchor stored in server side database. purpose store time stamp in have received data client. achieve using following command: sqlcommand selectnewanchorcommand = new sqlcommand(); string newanchorvariable = "@" + syncsession.syncnewreceivedanchor; selectnewanchorcommand.commandtext = "select " + newanchorvariable + " = getutcdate()"; selectnewanchorcommand.parameters.add(newanchorvariable, sqldbtype.datetime); selectnewanchorcommand.parameters[newanchorvariable].direction = parameterdirection.output; selectnewanchorcommand.connection = serverconnection; this.serverprovider.selectnewanchorcommand = selectnewanchorcommand; and once receive th anchor using in following way: sqlcmdtransactionmaster.parameters.add("@" + syncsession.syncnewreceivedanchor, sqldbtype.datetime); output should "current date" getting following date "1753-01-01 12:00:00.000" this date d...

How to adjust row height in datagrid at runtime in C# .net? -

how adjust row height in datagrid @ runtime in c# .net? loop through rows , change it, example: foreach (datagridviewrow row in datagridview1.rows) { row.height -= 2; }

Access to related Objects inside a model propery -

i run problems django models. example code better word: class cart(models.model): updated_at = models.datetimefield(auto_now=true) created_at = models.datetimefield(auto_now_add=true) def __unicode__(self): return u'date %s;'%(self.created_at) def __str__(self): return self.__unicode__() def _total_items(self): """ totale n di oggetti """ = 0 in self.items.all: += i.quantity return total_items = property(_total_items) class item(models.model): cart = models.foreignkey(cart) quantity = models.positiveintegerfield() def __unicode__(self): return u'product %s'%(self.id) def __str__(self): return self.__unicode__() but, when call cart property here's in python console: >>> a.total_items traceback (most recent call last): file "<console>", line 1, in <module> file "models.py...

java - intellij icon over project files -

intellij has placed no entry signs on java files (red circles line through) searched around cannot find why? know please. it's maven project if makes difference it means files aren't part of project settings. how did create project? i'm not sure version of intellij you're using - run 9.0.1. i'd recommend opening project structure (icon right of "wrench" or ctrl+alt+shift+s), click on "modules", , designate directory .java files located source directory (it'll change blue color).

osx - Apply a Quartz filter while saving PDF under Mac OS X 10.6.3 -

using mac os x api, i'm trying save pdf file quartz filter applied, possible "save as" dialog in preview application. far i've written following code (using python , pyobjc, isn't important me): -- filter-pdf.py: begin from foundation import * quartz import * import objc page_rect = cgrectmake (0, 0, 612, 792) fdict = nsdictionary.dictionarywithcontentsoffile_("/system/library/filters/blue \ tone.qfilter") in_pdf = cgpdfdocumentcreatewithprovider(cgdataprovidercreatewithfilename ("test .pdf")) url = cfurlcreatewithfilesystempath(none, "test_out.pdf", kcfurlposixpathstyle, false) c = cgpdfcontextcreatewithurl(url, page_rect, fdict) np = cgpdfdocumentgetnumberofpages(in_pdf) ip in range (1, np+1): page = cgpdfdocumentgetpage(in_pdf, ip) r = cgpdfpagegetboxrect(page, kcgpdfmediabox) cgcontextbeginpage(c, r) cgcontextdrawpdfpage(c, page) cgcontextendpage(c) -- filter-pdf.py: end unfor...

asp.net - Get Value from thick box control -

i have hidden field on thick box, when close thick need value of hidden field, when close thick box method calls function tb_remove(parent_func_callback) { parent.document.getelementbyid('hdf').value// need value of hidden field here please tell me how can hidden field value on thick box? e.g have page abc, click on heyperlink page abc, page xyz open thick box, on xyz thickbox have hidden field name hdf, click on close button of thick box, tb_remove called that's in thickbox.js file, need value of hdf here in js file use in abc page. thanks well if understand question correctly, 'hdf' id of hidden field, value then... if have misunderstood let me know. i assume thick box mean want control inside iframe or similiar... here's how. var hdfval = $('#myiframeid').contents().find('#hdf').val(); or simply, need value of control id... var hdfval = $('#hdf').val();

asp.net mvc - How to redirect HTTP to HTTPS in MVC application (IIS7.5) -

i need redirect http site https, have added below rule getting 403 error when tried using http://www.example.com , works fine when type https://www.example.com in browser. <system.webserver> <rewrite> <rules> <rule name="http https redirect" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" redirecttype="found" url="https://{http_host}/{r:1}" /> </rule> </rules> </rewrite> </system.webserver> you can in code: global.asax.cs protected void application_beginrequest(){ if (!context.request.issecureconnection) response.redirect(context.request.url.tostring().replac...

c# - C++ socket select() function returns 0 with many connections -

i have code server sends udp message contains tcp port number clients. server waits incoming tcp connections clients. however, select() function returns timeout many connections. can figure out might problem. any , comments on code below appreciated. in advance help. void initialise( void ) { m_tcp_listensocket = getlistensocket(); highsock = m_tcp_listensocket; setnonblocking(m_tcp_listensocket); struct timeval timeout; timeout.tv_sec = m_timeout; timeout.tv_usec = 0; // send udp messages clients not connected (int = 0; < udp_connections.size(); i++) { // clients not connected if ( tcp_connections[i]->isconnected() ) { continue; } // making message: 'server_address:server_port'. char l_str_server_port_number[6]; sprintf ( l_str_server_port_number, "%d", tcp_connections[i]->get_server_port_number ()); struct hostent *host; if( (host = gethostbyname( m_host_name...

What window messages are triggered when window comes to foreground? -

what windows messages triggered (wm_xyz) when application window goes background foreground (or invisible/minimized visible/maximised)? there's complex interaction involving: wm_nchittest wm_ncactivate wm_activateapp wm_activate wm_mouseactivate wm_setfocus wm_showwindow wm_ncpaint wm_paint and others, depending on details of situation you can learn lot using spy++ (which comes visual studio). if can provide more detail on you're trying do, can point right subset of messages. learn more specific message, search message/notification msdn, e.g., "msdn wm_paint".

How can a Firefox extension inject a local css file into a webpage? -

i'm writing firefox extension needs inject css file webpages. css file bundled extension, can access using chrome url chrome://extensionid/content/skin/style.css i'm trying inject css when page loaded: var fileref = document.createelement("link"); fileref.setattribute("rel", "stylesheet"); fileref.setattribute("type", "text/css"); fileref.setattribute("href", "chrome://extensionid/content/skin/style.css"); document.getelementsbytagname("head")[0].appendchild(fileref); however, css isn't loaded , firebug shows 'filtered chrome url' message instead of file content, when inspect link element created. if try load css file external server, everything's fine. is there way load css file bundled extension? use resource: instead of chrome: ?

php - Howto see if form fields are identical in Zend framework -

this question has answer here: zend_form: how check 2 fields identical 4 answers in zend framework (1.10) want check if 2 input fields identical have following code in form: $this->addelement('password', 'password', array( 'label' => 'wachtwoord:', 'required' => true ) ); $this->addelement('password', 'verifypassword', array( 'label' => 'bevestig wachtwoord:', 'required' => true, ) ); i tryed "identical" validator, did'nt got work. you can use custom validation filter accomplish this. http://framework.zend.com/manual/en/zend.form.elements.html the documentation outlines describing, under note: validation operates on filtered values class called my_validate_passwordconfirmation

java - Can't find /lib/libJOCL-linux-x86.so -

i have nvida graphic card , use serious computations. downloaded driver nvida webside , installed jocl bindings. downloaded 1 of demo programs , compiled it. program not run because: > error while loading native library > "jocl-linux-x86" base name "jocl" > operating system name: linux > architecture : i386 architecture bit > size: 32 stack trace attempt > load library resource: > java.lang.nullpointerexception: no > resource found name > '/lib/libjocl-linux-x86.so' @ > org.jocl.libutils.loadlibraryresource(libutils.jav > a:139) @ > org.jocl.libutils.loadlibrary(libutils.java:83) > @ org.jocl.cl.<clinit>(cl.java:47) @ > joclsample.main(joclsample.java:50) > stack trace attempt load > library file: > java.lang.unsatisfiedlinkerror: no > jocl-linux-x86 in java.library.path @ > java.lang.classloader.loadlibrary(classloader.java > :1681) @ > java.lang.runtime.loadlibrary0(runtime.java:840...

java - AudioRecord PCM data of no use? -

i have recorded using mic in android app , plays when using audioplayer class having streamed data in. problem want append wav header data can played outside of application. pretty sure methods create header work after playing around in hex editor other audio files, leads pcm data recorded not being useful raw data in wav file? can shed light on this? can import pcm/wav file audacity raw file , plays when try opening wav noise, again hinting pcm data @ fault. recording settings: int frequency = 22050; int channelconfiguration = audioformat.channel_configuration_mono; int audioencoding = audioformat.encoding_pcm_16bit; header variables: byte[] clipdata = data; long mydatasize = clipdata.length; long mysubchunk1size = 16; int mybitspersample= 16; int myformat = 1; long mychannels = 1; long mysamplerate = 22050; long mybyterate = mysamplerate * mychannels * mybitspersample/8; int myblockalign = (int) (mychannels * mybitspersample/8); long mychunk2size = mydatasize * mychann...

php - joining / merging two arrays -

i have 2 arrays this, mysql data retrieved 2 different servers: $array1 = array ( 0 => array ( 'id' => 1, 'name' => 'somename') , 1 => array ( 'id' => 2, 'name' => 'somename2') ); $array2 = array ( 0 => array ( 'thdl_id' => 1, 'otherdate' => 'spmethings') , 1 => array ( 'thdl_id' => 2, 'otherdate' => 'spmethings22') ); how can join / merge array looks this $new_array = array ( 0 => array ( 'id' => 1, 'name' => 'somename', 'otherdate' => 'spmethings') , 1 => array ( 'id' => 2, 'name' => 'somename2', 'otherdate' => 'spmethings22') ); it possible i'm misunderstanding, you're looking for? for ($i = 0; $i < count($array1); $i++){ ...

ssl - Set ssl_allowed/ssl_required for all pages in Rails 2? -

i found ajax calls not working on rails site when page using ssl/https. worked around adding ssl_allowed :action1, :action2, :actionn to controllers involved. i foresee being pain , prone bugs in future, i'll indubitably forget add action ssl_allowed list. is there way turn on ssl_allowed / ssl_required globally in [ssl_requirement][1] gem, actions of every controller in site? tried adding following applicationcontroller, did not work: ssl_allowed :all if you'd rather not depend on forked plugin, can override ssl_allowed? in controller: class applicationcontroller < actioncontroller::base ... private def ssl_allowed? true end end edit: not thought did. instead of disabling redirects http pages not specified ssl_required, short circuts whole redirect process nothing. bad. code: def ensure_proper_protocol return true if ssl_allowed? if ssl_required? && !request.ssl? redirect_to "https://...

wpf - How to merge two RenderTargetBitmap instances? -

hey, guys. need merge 2 rendertargetbitmaps of same size one. how that? thanks. wyh not create third rendertargetbitmap , render in both images created rendertargetbitmap_a , rendertargetbitmap_b. something like: ... image imga = new image(){source=rendertargetbitmapa}; image imgb = new image(){source=rendertargetbitmapb}; rendertargetbitmapdest.render(imga); rendertargetbitmapdest.render(imgb); ...

linq to sql - Applying Domain Model on top of Linq2Sql entities -

i trying practice model first approach , putting domain model. requirement pretty simple: usersession can have multiple shoppingcartitems. i should start off saying going apply domain model interfaces linq2sql generated entities (using partial classes). requirement translates 3 database tables (usersession, product, shoppingcartitem productid , usersessionid foreign keys in shoppingcartitem table). linq2sql generates these entities me. know shouldn't dealing database @ point think important mention. the aggregate root usersession shoppingcartitem can not exist without usersession unclear on rest. product? defiently entity should associated shoppingcartitem? here few suggestion (they might incorrect implementations): public interface iusersession { public guid id { get; set; } public ilist<ishoppingcartitem> shoppingcartitems{ get; set; } } public interface ishoppingcartitem { public guid usersessionid { get; set; } public int productid { get; set;...

.net 2.0 - NativeWifi and Windows XP SP2/SP3 -

i'm using native wifi api , function wlangetnetworkbsslist . i aware that function not available in windows xp sp2 , sp3. tried installing hotfix supposedly allow access function did not work. so there wireless 0 configuration .net wrappers out there? or more basically, how list of basic service set (bss) entries of wireless network or networks on given wireless lan interface without use of function? did have @ how metageek's inssider it. it's c#, , open source (apache license , available on github) . this app gorgeous , useful. there @ least 3 versions. inssider inssider 2 inssider forlinux i've got vintage xp sp3 here , works pretty well. however, not think relies on wlangetnetworkbsslist api (it's close physical interface , besides, i'm using intel wifi management stack (so zeroconf service stopped) , inssider still works).

sql server - Auto-complete editor for SQL statement -

is there plugings or text editor auto-complete sql statement? using sql server management studio (ssms) 90% of time, of time have type select with(nolock) blahblah. trying find more efficient way. thanks. sql prompt redgate or built in in sql 2008. latter pale imitation of redgate addin

java - Jogl - set 'cliping area' -

is possible set 'clipping bounds' in jogl? in java/swing set clipping bounds , drawing/rendering outside bounds ignored. opengl (for jogl wrapper) has concept of clip plane. can set number of clip planes in scenes (at least six, more), , outside them won't drawn. these planes specified in 3d, , clip calculation done in 3d. look gl.glclipplane(...) if looking clipping in 2d in screen space, gl.glviewport(...).

javascript - CssSandpaper library error - rules object empty -

i've got problem csssandpaper script. once run on 1 of site's pages, following error: "rules null" in ff, "error: 'rules.length' null or not object" in ie, "uncaught typeerror: cannot read property 'length' of null" in chrome, so object 'rules' undefined. here css div (id="texttransform"): #texttransform { border: 1px solid green; -sand-transform: rotate(90deg); width: 23px; height: 74px; } has of ever had such issue? appreciated. thanks two things me caused "uncaught exception error" in combination csssandpaper.js , other required scripts css sandpaper library. html5doctor.com reset stylesheet typekit js removing both of removed error

Write text onto image in Java -

is there java library write text images, same php's gd library . here's yet example .

c# - Run an async function in another thread -

i'm evaluating async ctp. how can begin execution of async function on thread pool's thread? static async task test() { // something, await } static void main( string[] args ) { // there more elegant way write line below? var t = taskex.run( () => test().wait() ); // doing more in same thread t.wait(); // waiting more single task, example } i'm new (my virginal post) stack overflow, i'm jazzed you're asking async ctp since i'm on team working on @ microsoft :) i think understand you're aiming for, , there's couple of things you're doing correctly, there. what think want: static async task test() { // something, await } static void main(string[] args) { // in ctp, use task.runex(...) run async method or async lambda // on .net thread pool var t = taskex.runex(test); // above shorthand var t = taskex.runex(new func<task>(test)); // because c# auto-wraps methods delegates...

c# - How to Execute Page_Load() in Page's Base Class? -

i have following performancefactsheet.aspx.cs page class public partial class performancefactsheet : factsheetbase { protected void page_load(object sender, eventargs e) { // stuff data extracted in factsheetbase divperformance.controls.add(this.data); } } where factsheetbase defined as public class factsheetbase : system.web.ui.page { public mypagedata data { get; set; } protected void page_load(object sender, eventargs e) { // data that's common implementors of factsheetbase // , store values in factsheetbase's properties this.data = extractpagedata(request.querystring["data"]); } } the problem factsheetbase's page_load not executing. can tell me i'm doing wrong? there better way result i'm after? thanks we faced similar problem, need register handler in constructor. :) public class factsheetbase : system.web.ui.page { public factsheetbase()...

c# - how could I store data within a GUID -

i have application want represent users session (just small pieces of data here , there) within guid. 16 hex characters (so 16^16 possible values) string , want 'encode' data within guid. how can achieve this? after ideas , implementations here, ive not yet decided on best mechanism yet. i encryption involved if possible... thanks lot mark edit: thanks so far everyone, think must have left out way information on this. ill try clarify. i'm not using guid's in traditional sense, not guid's in globally unique, series of 16 characters, each hex value, hence 16^16 possible byte values. this restriction enforced environment, , our desired achievement encrypt data of users session (which theoretically duplicated chance, which, trust me, ok), such data bit-flags identifying products in group of products, etc... i hope makes sense, ill start reading steganography :) thanks guys! the point of guid is generated , globally unique. once start hack...

windows - piping findstr's output -

windows command line, want search file rows starting with: # nnn "<file>.inc" where nnn number , <file> string. i want use findstr, because cannot require users of script install ack. here expression came with: >findstr /r /c:"^# [0-9][0-9]* \"[a-za-z0-9_]*.inc" all_pre.txt the file search all_pre.txt . so far good. want pipe command, example more . >findstr /r /c:"^# [0-9][0-9]* \"[a-za-z0-9]*.inc" all_pre.txt | more the result of same output previous command, file name prefix every row (all_pre.txt). then comes: findstr: cannot open | findstr: cannot open more why doesn't pipe work? snip of content of all_pre.txt # 1 "main.ss" # 7 "main.ss" # 11 "main.ss" # 52 "main.ss" # 1 "build_flags.inc" # 7 "build_flags.inc" # 11 "build_flags.inc" # 20 "build_flags.inc" # 45 "build_flags.inc(function called b)...

php safe output -

i'm trying make "remember fields" thingy, if there 1 error won't have fill in whole form again. how can make output safe? example: <input type="text" name="email" value="<?php echo (isset($_post['email'])) ? htmlspecialchars($_post['email']) : ''; ?>" /> if types in " ' " (without quotes) example get: warning: mysql_result() expects parameter 1 resource, boolean given in c:\wamp\www\pages\register.php on line 55 so tried: <input type="text" name="email" value="<?php echo (isset($_post['email'])) ? mysql_real_escape_string($_post['email']) : ''; ?>" /> then adds lot of //////. what should do? i'm noob yes. thought htmlspecialchars made user input safe? it depends on context. htmlspecialchars() friend in html. mysql_real_escape_string() friend in mysql. update you run $_post throug...

C# LINQ TimeSpan Average Days -

i learning linq , want linq query equivalent of following code. the ienumerable list contains sorted list of dates: oldest newest. the code below derives timespan s subtracting array's zeroth element date array's first element date, first element date 2nd, 2nd 3rd , on. timespan.days averaged elsewhere in code. i trust linq query not require construction of array. ienumerable<datetime> structure used data source. ienumerable<datetime> list; // contains sorted list of oldest newest dates // build datetime array datetime[] datesarray = null; timespan ts; list<int> dayslist = new list<int>(); datesarray = (from dt in list select dt).toarray(); // loop through array , derive timespan subtracting previous date, // contained in previous array element, date in current array element. // start loop @ element 1. (int = 1; < list.count(); i++) { ts = datesarray[i].subtract(datesarray[i - 1]); // ts timespan type...

PHP date outputting incorrect month -

if pass example ?month=$04 in url , echo $date keep receiving january , not should (april). if echo out $month 04 correct. code have been using: if (isset($_get['month']) && $_get['month']!='') { $month = $_get['month']; $date = date('f', $month); } echo $date; for life of me can't figure out why it's not outputting correctly. appreciated. look @ you're doing here: date('f', '04'); the second parameter date() timestamp, starting january 1st, 1970. doing specifying january 1st, 1970, 00:00:04 hours midnight. what want achieved e.g. so: $timestamp = strtotime ("2000-$month-01"); // 2000-04-01 april echo date('f', $timestamp);

string - How can I print "\t" (as it looks) in Java? -

i want print backslash t in java. whenever try, actualy takes \t operator. double backslash didn't work. how can that. escape backslash adding another, example system.out.println("this tab \t , not \\t"); if doesn't work, there might else wrong in code - please post if doesn't you.

php - Create a shopping cart rule in Magento based on product attributes -

i have products (needles) in category. of them sold in packs of 100 , in packs of 500. quantity of needles in box set product attribute. want apply cart rules based on total number of needles in cart. f.x. 10% if buy 1000-2000 needles, regardless of combination of 500/100-packs. don´t think can done vanilla magento (ce 1.4.2.0) , haven´t found module it. have tried magento forum, no luck there. point me in right direction? you have single "needles" product , set it's "qty increments" 100. if wanted, say, 700 needles order 700 , staff responsible picking out box of 500 , 2 of 100. make discount possible wouldn't allow different skus stock control difficult.

Javascript failing because the dom has been altered? -

these 2 javascript functions work on unaltered dom elements. delete_route function fails when asked delete elements appended dom via second function. clarity, looking @ elements parts[0] option - created spliting > id on "_". why javascript apparently seeing difference between "native" dom objects , inserted objects? //handle delete events function delete_route (parts) { if (parts[0] == "field") { var select_container = "container_"+parts[2]; var getcontainer = document.getelementbyid(select_container); getcontainer.parentnode.removechild(getcontainer); } else if (parts[0] == "option") { var optionid = parts[0]+"_"+parts[2]+"_"+parts[3]; var getoption = document.getelementbyid(optionid); getoption.parentnode.removechild(getoption); } } //handle new events function new_route (parts) { var highest_number = -1; if (parts[0] == "field") { } else if (parts[0] ...