Posts

Showing posts from February, 2015

Using windows DDK with C# -

for little background story, work in computer lab , need have easy method disable network protocol bindings on adapters based on pci bus locations. so far have written c# command line utility find them, bus locations, netcfginstanceid, etc. 1 thing haven't figured out how remove bindings on adapters, go through , remove them in registry still show in adapter settings. eventually found out neat utilities in windows ddk, bindview sample program, want take netcfgapi included in bindview sample , use in c# program, problem c++ files. have tried using midl convert them .ddl or .tlb can use pinvoke on know little pinvoke , midl compiler comes errors such "midl : command line error midl1003 : error returned c preprocessor (4)". my question is, there easier way this? , if there not, best way go converting netcfgapi c++ files usable in c#? i write utility in c++ more comfortable using c#. you try compiling stuff c++/cli dll. in project settings under compiler,

make is automatically attempting to link even when I pass -c in my makefile -

i'm new makefiles, apologize in advance if silly question. removed variables makefile because weren't working (gnu make tells me $(myvar) should replaces value of myvar, output of make showing me not happening), apologize ugliness , more 80 character lines. acolibobj = acolibinit acoglobaldefs acolibinterface: $(acolibobj).o acolibinit.o: gcc -fpic -g -c -wall -i/usr/include/dc1394 -o acolibinit.o acocommands/acolibinterface/acolibinit.c acoglobaldefs.o: gcc -fpic -g -c -wall -i/usr/include/dc1394 -o acoglobaldefs.o acocommands/acolibinterface/acoglobaldefs.c when run makefile get: gcc -fpic -g -c -wall -i/usr/include/dc1394 -o acolibinit.o acocommands/acolibinterface/acolibinit.c cc acolibinit.o -o acolibinit gcc: acolibinit.o: no such file or directory gcc: no input files make: *** [acolibinit] error 1 so far can tell, what's happening make trying compile , link, though explicitly added -c flag. when run "gcc -fpic -g -c..." myself (from

c - OpenGL - Frame Buffer Depth Texture differs from Color Depth Texture -

i'm doing shadow mapping in opengl - such i've created frame buffer object render depth of scene view of light. glbindrenderbuffer(gl_renderbuffer, color_buffer); glrenderbufferstorage(gl_renderbuffer, gl_rgba, width, height); glframebufferrenderbuffer(gl_framebuffer, gl_color_attachment0, gl_renderbuffer, color_buffer); glbindrenderbuffer(gl_renderbuffer, depth_buffer); glrenderbufferstorage(gl_renderbuffer, gl_depth_component24, width, height); glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, depth_buffer); glgentextures(1, &color_texture); glbindtexture(gl_texture_2d, color_texture); glteximage2d(gl_texture_2d, 0, gl_rgba, width, height, 0, gl_rgba, gl_unsigned_byte, null); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_clamp); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_clamp); glfra

In Rails 3 how can I select items where the items.join_model.id != x? -

in rails models have: class song < activerecord::base has_many :flags has_many :accounts, :through => :flags end class account < activerecord::base has_many :flags has_many :songs, :through => :flags end class flag < activerecord::base belongs_to :song belongs_to :account end i'm looking way create scope in song model fetches songs not have given account associated it. i've tried: song.joins(:accounts).where('account_id != ?', @an_account) but returns empty set. might because there songs have no accounts attached it? i'm not sure, struggling one. update the result set i'm looking includes songs not have given account associated it. includes songs have no flags. thanks looking. am understanding question correctly - want songs not associated particular account? try: song.joins(:accounts).where(account.arel_table[:id].not_eq(@an_account.id)) answer revised: (in response clarification in comments) yo

asp.net - javascript function "createCallback" called >50 times when I use addClass/removeClass in Firefox -

i'm working on web app in asp.net 2.0 involves several gridview elements. when users click 1 of rows in grid, row needs show selection changing color. each row has attributes set identify record type , unique id: <tr data-elementtype='mytype' data-myid='12' onclick='selectionfunction();'></tr> i accomplish selection through javascript onclick handler on each row calls function that: removes selected class selected row adds selected class new selected row updates value of hidden field new selected unique id server-side code can know element perform action on when button clicked (view, delete, etc). one of these grids has on 700 records in it. in firefox 3.6, selection operation on grid horribly slow (about 2 seconds); in other browsers (even ie 7 , 8) it's not problem. put console.log statements @ start , end of selection function, , in firebug show fast @ end of delay, suggesting it's not selection function slowin

php - The best way to do a 301 redirect with a delay of several seconds? -

what best way 301 redirect delay of several seconds? want original page displayed 5-10 seconds , 301 redirect site. i've found lot of solutions in php on google 1 found delay didn't display original page before redirecting—only empty screen. you can't true 301 redirect delay. http stateless. "301 redirect", want if you're trying make google happy; client sends request, , status code on reply server 301, part of reply you'll use location header , tell new content is. if don't have that, you're not doing 301 redirect. with other answer, you're doing meta refresh on client side, google not like. this how 301, , user doesn't see old page @ all, , have no idea they've been redirected. $location="http://www.yoursite.com/newpage"; header ('http/1.1 301 moved permanently'); header ('location: '.$location);

asp.net - Best Practices when using .NET Session for temporary storage? -

i'm still relatively new .net , asp.net mvc, , have had few occasions nice store information retrieved db temporarily can used on subsequent server request client. have begun using .net session store information, keyed off of timestamp, , retrieve information using timestamp when hit server again. so basic use case: user clicks 'query' button gather information system. in js, generate timestamp of current time, , pass server request on server, gather information db on server, use unique timestamp client key session store response object. return response object client user clicks 'generate report' button (will format query results excel doc) pass same timestamp #2 down server again, , use gather query results #4. generate report w/o additional db hit. this scheme have begun use in case use session temporary storage. generating timestamp in js isn't secure, , whole things feels little... unstructured. there existing design pattern can use this,

Sync Framework Deletes not being applied on client -

heres scenario: concerned sqlcesyncclient applying deletes, inserts, updates. have cases row may de-referenced table, , deleted. example, imagine this: i have 2 tables; customer, , area, of customer.area references area.name foreign key constraint insert area values('australia') insert customer values('customer1','australia') -- sync happens. client gets 2 inserts. update customer set area = 'new zealand' area = 'australia' delete area name = 'australia' -- sync happens. client gets 1 update , , 1 delete the sqlceclientsyncprovider tries apply delete first , fails because of referential integrity constraints on client. my first question is: why on earth did boys @ microsoft code syncclient process deletes first when breaks referential integrity rules? shouldn't apply deletes last???? my next question is: have managed reverse order inspecting code , writing whole applychanges method myself... when deletes not applie

c# - ADSF Secured Web Application Calling Web Services -

i have active directory federation services 2.0 setup , ready work, have scenario falls outside pretty i've read on enabling relying party application. 2 scenarios documented involve a) passive authentication web site or b) using thick client that's authenticated calling web services. my scenario follows: have web application calls wcf services via net.tcp data access. need use adfs 2.0 secure each wcf call secure token. i can't use use passive method of authenticating adfs web site (security restrictions outside control). so question is, possible manually request secure token adfs via web site, use same token call wfc service methods? have @ http://travisspencer.com/blog/2009/03/caching-tokens-to-avoid-calls.html . in blog post described how cache security tokens wcf service calls. i think should possible "inject" fetched token in described "cachesecuritytokenprovider".

c# 4.0 - Creating reusable code modules (e.g. C++ style classes, headers) in C# -

in c++, can create usable code modules creating class, , giving out header , implementation files developers want use class. i want in c# have little experience c# language. need create class can reused c# programmer in visual studio 2010. know referencing dlls 1 way use other peoples' classes. need create dll achieve want accomplish? or there other, better ways? for example, let's create cow class can "moo". in c++, uses class include cow.h, instantiate cow object mycow, , call mycow.moo(). how can achieve simple task in c#? thanks time , patience. yes, create class library project , share resulted dll's. other developers need add reference dll , after they're free use public objects library.

Windows Socket Programming in C -

i taking networking class professor literally reading book class. needless have no idea doing. our semester project copy code our text book , make client-server network. literally copying code teh book no modifications. the book had mistakes in code (missing semicolons, paranthesis) managed @ least compile code. however, run bunch of link errors. example: error 1 error lnk2019: unresolved external symbol impsendto@24 referenced in function _main c:\users\documents\visual studio 2010\projects\client_server\client_server\client_server\server.obj client_server i looked error code , think code trying link definitions not existent in header files. have tough time fixing lnk errors vs syntax errors. said have no idea how go fixing this. sending code server side, ran same errors on client side. include <stdio.h> include <string.h> include <winsock2.h> include <winsock.h> include <stdint.h> include <time.h> int main(void) { int s; int len

plugins - Rails 2.3.11 Administrator Gem -

this first question here in stackoverflow :) i've been searching best plugin administrator rails 2.3.11 app. can create own have rush project decided use these kinds of plugin. i searched rails_admin , active_admin . there both think that's rails 3 only . i need find admin plugins rails 2.3.11 . your ideas welcome :) thanks! give typus try. works on rails 2.3 , quite popular, although author isn't planning on maintaining 2.3 version anymore. https://github.com/typus/typus/wiki/requirements

javascript - Is it possible to dynamically insert a value of an object parameter? -

i've been trying figure out haven't been able find answer relates issue. i wondering if possible dynamically enter value of object parameter input box? example: <form name="myform"> <input type="visibile" name="formvar" value=""> </form> <object id="myobject"> <param name="color" value="{input destination}" /> i'm wondering if possible dynamically add values "input destination" thanks once object created (when page loaded), param s passed object. aren't able change "input destination" after that. you delay creation of object till input changed followings. <form name="myform"> <input type="visibile" name="formvar" value="" onchange="createobject(value)"> </form> <script> function createobject(value) { document.gete

security - AES-256 encryption in PHP -

i need php function, aes256_encode($datatoecrypt) encrypt $data aes-256 , 1 aes256_decode($encrypteddata) opposite. know code should functions have? look @ mcrypt module aes-rijndael example taken here $iv_size = mcrypt_get_iv_size(mcrypt_rijndael_128, mcrypt_mode_cbc); $iv = mcrypt_create_iv($iv_size, mcrypt_dev_urandom); $key = pack('h*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3"); # show key size use either 16, 24 or 32 byte keys aes-128, 192 # , 256 respectively $key_size = strlen($key); echo "key size: " . $key_size . "\n"; $text = "meet me @ 11 o'clock behind monument."; echo strlen($text) . "\n"; $crypttext = mcrypt_encrypt(mcrypt_rijndael_128, $key, $text, mcrypt_mode_cbc, $iv); echo strlen($crypttext) . "\n"; this decrypt function

configuration - Android, Orientation Question with Tabhost and it's Very strange -

everyone. i have created tabhost , there 4 buttons on it. i set android:configchanges="orientation|keyboardhidden" on every activity in menifest file. and override onconfigurationchanged method listen event when screen oriented. now there "bug", , don't know how solve it. when click on 1 of 4 buttons(for example, a, b, c, , d), , rotate tablet's orientation portrait landscape, activity fine. onconfigurationchanged method works. but when click b button on landscape mode, portrait state still kept(i want b button's onconfigchanged method called, doesn't). in word, if changed orientation, , click tab button, activity's onconfigurationchanged method won't called. how can solve problem? lot. you cant call onconfigchanged() view or kind of callback, called device, far know. have no ideas besides comment.

java - How to know that all of the member variables of an instance have not been set? -

let's created instance in java of class person public class person { private string name; private int age; // lot of other member variables // set here } how know whether instance @ least have 1 of member variables being set (without checking of variables 1 one? for example : person person = new person(); person person1 = new person(); person1.setname("john"); i need know person instance has not set variables. person1 has set @ least 1 variable. what can think solving create boolean flag being changed true in every set method, or create method checking variables 1 one. but wonder if there's way more elegant this. this 1 way done (not recommended production because doesn't check javabean style variables). with have call helper.hassomethingbeensetted with object parameter. package com.intellij.generatetestcases.javadoc; import java.lang.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; imp

css - floating link hover background problem -

on navigation have links have link floated right. , when hover on right link dont want happen when hover..but adds background right beside last link on left, because it's floated. how make no background appear on hover floated link? ive tried making class on :hover make background none nothing changes. i have jsfiddle because confusing lol http://jsfiddle.net/r3bbm/ edit: doesnt happen in chrome, other browser does well, floating image inside link, not <a> tag. try putting floatr class on <a> tag instead. make .floatr:hover{background:none;}

javascript - assigning dynamically to document.getElementById from an array string -

var urlname=new array("total","pub"); var query = window.location.search.substring(1); (var i=0;i<vars.length;i++) { document.getelementbyid("'"+urlname[i]+"'").innerhtml = pair[i]; } how can assign urlnames dynamically? you don't need quotes around urlname[i] since it's string: var urlname = ["total","pub"]; (var i=0;i<urlname.length;i++) { document.getelementbyid(urlname[i]).innerhtml = pair[i]; }

linux - How can I direct output from a program to fill a form on a webpage? -

my 1d barcode scanner appears input device in linux allowing me fill web page form barcode scans if manually typing input. need replicate 'scan--put data web form' behaviour using 2d barcodes read webcam , extracted command line utility. utility i'm using (zbarcam), prints detected code stdout whenever barcode detected---very nice! need somehow redirect stdout stream current web page in browser can fill in text box data. seems simple redirection problem can't figure out how make work. perhaps there way make utility act 'virtual' input device? i go way. first send output of app temp location, file automatically updated everytime read new barcode. zbarcam <params> > /tmp/barcodeoutput then create script 1 automatically using ajax , jquery refresh contents. index.php <html> <head> <title>jquery ajax</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jq

memcheck - Understanding Valgrind o/p -

i running memcheck using valgrind. o/p ==3091== 204 bytes in 17 blocks lost in loss record 1,406 of 2,299 what mean ? what guess there 204 bytes memory loss but meant 17 blocks ? and how know how many time memory leak happened same function ? complete stack trace of valgrind ==3091== 204 bytes in 17 blocks lost in loss record 1,406 of 2,299 ==3091== @ 0x4a05e1c: malloc (vg_replace_malloc.c:195) ==3091== 0x4ca304: fs_get (fs_unix.c:38) ==3091== 0x4e58c1: cpystr (misc.c:74) ==3091== 0x4d130f: ip_nametoaddr (ip_unix.c:178) ==3091== 0x4d15f4: tcp_open (tcp_unix.c:192) ==3091== 0x4d41a5: cc_connect_http_proxy (proxy.c:164) ==3091== 0x4d4b0c: cc_connect (proxy.c:571) ==3091== 0x4d506d: ssl_open (osdep.c:353) ==3091== 0x4e56c3: net_open_work (mail.c:6240) ==3091== 0x4e558a: net_open (mail.c:6196) ==3091== 0x4fba04: imap_open (imap4r1.c:841) ==3091== 0x4d9cb1: mail_open_work (mail.c:1355) it means there 17 different calls mallo

c# - Refresh icon for button -

Image
i need find image refresh button in ie can use button. button refresh data on 1 of forms. where can find image , how make appear on button? google friend. mybutton.image = new bitmap(pathtoimagefile); or assign image property through property sheet in visual studio ide. more possible icons here (which ie style... though never specified version of ie). , here !

java - Regarding arraylist upcasting -

in general decalre arraylist can declare below. arraylist obj = new arraylist(); this correct only. in our code not this.we below list obj = new arraylist(); why this? why upcasting ? and while upcasting restricting functionality. specific reason declare arraylist or linkedlist this? yes - because unless need specific functionality exposed via concrete type, it's idea refer more general type. way, if ever decide use different implementation, know you're not tied specific current implementation. can later change single statement: list<string> list = new arraylist<string>(); to (say) list<string> list = new linkedlist<string>(); and know still compile. of course behaviour can change in terms of performance, thread safety etc - case anyway. you're expressing don't need members specific arraylist<string> , can important when reading code later. all of particularly relevant when comes picking return type

php - redirecting specific page using htaccess -

i want redirect http://example.com/sites-related-to-australia-0.html . in "australia" , "0" parameters. how can using htaccess? i'm using php. any appreciated, thanks! it this: rewriterule ^sites-related-to-(\w+)-(\d+)\.html$ /somewhere_else.php?place=$1&pos=$2 [l] /sites-related-to- first part of url the next piece (a block of 1 or more word characters signified (\w+) (you can replace more specific (australia|united kingdom|france))) captured later $1 the piece after next hyphen captured digit (\d) , stored $2 load page somewhere_else.php variables place=$1 , pos = $2 (both defined earlier). [l] means last redirect rule effects particular pattern.

java - Increase the size of the arrows on the JSpinner -

how increase size of arrows on jspinner. for vertical increase: increase jspinner's height. horizontal increase: use special layout manager takes width of arrows , sets bounds according it. jspinner has 3 components inside: first 2 , down arrows, third 1 text field.

help creating schema sql for hsqldb -

i quite new database programming , trying create java program access hsqldb (version2.2.5) using hibernate.i have 3 classes in program mapped 3 tables given below. i wanted create one-to-one mapping between saleorder , bill. also, create schema db, tried sql create statements. 2 tables saleorder , bill have each other's id fk.to avoid dependency error between tables during create,i used alter table add constraint statements now,i want use drop table statements @ beginning of script.i used following alter table saleorder drop constraint fk_so_bill; alter table saleorder drop constraint fk_so_buyer; alter table bill drop constraint fk_bill_so; alter table bill drop constraint fk_bill_buyer; drop table buyer if exists; drop table saleorder if exists; drop table bill if exists; this however, causes problem when run first time(since altered tables don't exist.).i not find 'if exists' clause alter table in hsqldb ..so solution?should run create table scripts

calculating combination in java -

possible duplicate: combinatoric 'n choose r' in java math? is there method in java can use class can calculate ncr without coding myself? which means if i, example, give 5 , 3 parameter of combination related method return me 10. i want know class method included , how use it. i believe djna right combinatorics not appearing in jdk 6. perhaps in future version of java platoform might see it. often common algorithms such can found in apache commons libraries. can in commons math: http://commons.apache.org/math/apidocs/index.html . but if need ncr on numbers, rather sets, can steal code koders: http://www.koders.com/java/fidb0df1a89f0472f6f4039af61944ba2d072af6032.aspx .

wordpress - wp_enqueue_script in action hook wp_print_scripts -

in wordpress documentation page function wp_enqueue_script , written: note : function not work if called wp_head action, tags output before wp_head runs. instead, call wp_enqueue_script init action function (to load in pages), template_redirect (to load in public pages only), or admin_print_scripts (for admin pages only). do not use wp_print_scripts (see here explanation) . do not use wp_print_scripts action want highlight, simple google search on "how include javscript in wordpress". find of examples using wp_print_scripts action call wp_enqueue_script . , seems ok it. so missing or misunderstanding here? edit the codex has been modified. says: this function not work if called wp_head or wp_print_scripts actions, files need enqueued before actions run. see usage section correct hooks use. yeah, been there lots of times. short answer guys print script requests wrong or folks suggest faster not use wp_enqueue_script load dynamically mode

c# - How to write simple async method? -

using latest ctp5 async/await keywords, wrote code, apparently cannot compile: class program { public class myclass { async public task<int> test() { var result = await taskex.run(() => { thread.sleep(3000); return 3; }); return result; } } static void main(string[] args) { var myclass = new myclass(); //the 'await' operator can used in method or lambda marked 'async' modifier error ??!! int result = await myclass.test(); console.readline(); } } what th reason of "the 'await' operator can used in method or lambda marked 'async' modifier error?" (i've selected line visual studio point me to) i don't know if can mark main async, need include async keywo

delphi - Focus next control on enter - in overridden KeyUp -

i have custom class extends tedit: tmytextedit = class (tedit) private ffocusnextonenter: boolean; public procedure keyup(var key: word; shift :tshiftstate); override; published property focusnextonexnter: boolean read ffocusnextonenter write ffocusnextonenter default false; end; in keyup procedure do: procedure tmytextedit.keyup(var key: word; shift: tshiftstate); begin inherited; if focusnextonexnter if key = vk_return selectnext(self twincontrol, true, false); end; but isn't moving focus next control. tried if key = vk_return key := vk_tab; but isn't working either. missing? selectnext selects next sibling child control, ie. need call on edit's parent: type thackwincontrol = class(twincontrol); if key = vk_return if assigned(parent) thackwincontrol(parent).selectnext(self, true, false);

javascript - For .. in loop? -

i'm losing here.. extremely confused how loop works. from w3 schools: var person={fname:"john",lname:"doe",age:25}; (x in person) { document.write(person[x] + " "); } person object properties right? how properties being accessed brackets? thought arrays? why work, , shouldn't this?: var person=[]; person["fname"] = "john"; person["lname"] = "doe"; person["age"] = "25"; (x in person) { document.write(person[x] + " "); } there 2 ways in have access object's properties: obj.key obj['key'] the advantage of second method can provide key dynamically, e.g. obj[x] in example. obj.x literally mean x property (i.e. obj['x'] ), not want. arrays work brackets, brackets not limited arrays. arrays under hood objects, designed numeric keys. can still add properties non-numeric keys them, that's not designed for.

javascript - How to implement textarea that will restore your typing when asking a question after you close and reopen it

implement html5 storage? upload server session? which better approach? html5 storage? yes can, won't supported old browsers. ways of doing are: store draft cookies every n seconds. store draft @ server side using ajax requests every n seconds.

c# - Graphics.FillRectangle() didn't work -

graphics gp = graphics.fromhwnd(p2ppic.handle); solidbrush sb = new solidbrush(color.dodgerblue); lock (gppalette) { gpp.fillrectangle(sb, arectangle); } p2ppic picturebox object in c#; these main code ,and code run, did not take effect can tell me why? depends have placed code. picturebox own painting.

javascript - jquery nav bar slidetoggle issue -

i'm new jquery , far have got code toggle , slide html menu. heres code <script type="text/javascript"> $(document).ready(function () { $('li').each(function(){ $('li.menuheader').hover(function(){ $('ul.submenu').slidetoggle('slow', function(){}) }); }); }); </script> </head> <body> <div id="navbar"> <ul> <li class="menuheader">test1 <ul class="submenu"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> </li> <li class="menuheader">test2 <ul class="submenu"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> </li> <li class="menuheader&qu

c++ - Analyze Network events with xperf -

i have written small tcp-client/server-thing testing xperf- networkttrace capabilities. seems did wrong xperf. when use xperf kernel group network or diag+networktrace shows me "casual" stuff , nothin tcp/udp-reads , writes... anyone got clue of how these information xperf? (did not find helpful via google) i found out, send , receive-actions logged under "generic events" section, marks. you can find them "easily" if post-process etl-log human readable file , search tcpread/write udpread/write tcpdisconnect/connect/accept etc...

c++ - Reading from ifstream won't read whitespace -

i'm implementing custom lexer in c++ , when attempting read in whitespace, ifstream won't read out. i'm reading character character using >> , , whitespace gone. there way make ifstream keep whitespace , read out me? know when reading whole strings, read stop @ whitespace, hoping reading character character, avoid behaviour. attempted: .get() , recommended many answers, has same effect std::noskipws , is, spaces now, not new-line character need lex constructs. here's offending code (extended comments truncated) while(input >> current) { always_next_struct val = always_next_struct(next); if (current == l' ' || current == l'\n' || current == l'\t' || current == l'\r') { continue; } if (current == l'/') { input >> current; if (current == l'/') { // explicitly empty while loop while(input.get(current) && current != l'\n'

c# - Making Update Progress Panel in the center -

i have query regarding update progress panel. want fit update progress panel in middle of screen! can suggest me, idea of making so?? you can using css <style type="text/css" media="screen"> /* commented backslash hack ie5mac \*/ html, body{height:100%;} /* end hack */ .centerpb{ position: absolute; left: 50%; top: 50%; margin-top: -30px; /* make half image/element height */ margin-left: -30px; /* make half image/element width */ } </style> and have progress bar in div <div class="centerpb" style="height:60px;width:60px;" >progress bar here</div> reference: http://www.sitepoint.com/forums/1243542-post9.html http://www.search-this.com/2008/05/15/easy-vertical-centering-with-css/

objective c - CoreData Multithreading Proper Store Deletion -

ok, here's situation: i've got app requires user-account. while you're doing stuff writing new comments, creating new posts or reading thread, every call server runs on separate thread. more specifically: new thread created, makes call server, gets answer server , saves items answer core data store. in order this, every thread creates own insertioncontext, share same storecoordinator. but there's 1 problem: when logout account, have delete store, if logs in account, stuff other account isn't in coredatastorage anymore. but in order delete store, have make sure there aren't background threads running anymore, because once try to save stuff, sure crash app, since store isn't valid anymore. clarify: these background threads nsoperations put in nsoperationqueue , executed there. now coredata gives nsoperationqueue function called "cancelalloperations" according documentation, running operations aren't killed, send cancel message... h

directx - Drawing lines with rounded endings with Direct3D -

is there way draw line using id3dxline round endings? trying draw curve number of line segments, getting empty areas line segments connecting. performance here essential. thanks! any other fast way draw thick curved line using d3d? you best off using circular texture (with antialiasing around edges) , drawing half texture @ either end of line. can render strip through center of texture whole way along rectangle surrounding line before finishing off other half of texture @ other end. give effect after tad more involved calling "drawline" or whatever ...

selenium - Selenium_CaptureEntirePageScreenshot_PHP -

want captureentirepagescreenshot while entering catch block. runs when screenshot saved on c:// of remote instance. want save on server instance, able add these screenshots hudson report. is saving on remotre machine / server not possible? its on server hudson, bromine installed. php used , want solution in php. you can use hudsonserverip/pathtosaveinhudsonworkspace filename save screenshot in hudson workspace.

PHP create folder with specific path and permissions -

i need way in php create folder if not exist. so code have first read available folders, if specific folder not exist should create it. the logic of code be: $foldername = "user1"; if($foldername exists) { exit; }else{ create folder $foldername , chmod 777 } how php , linux server + apache? $foldername = "user1"; if ( !file_exists($foldername) ) { mkdir($foldername); } in if statement check if folder not exist (yes - file_exists function) , if not, create folder. 777 chmod default.

Sorting nvarchar column SQL Server 2005 -

when sorting nvarchar column in sql has numeric value, sql server returns bad sorting , don't know why! is there particular way sql server sorts varchar columns having numeric values? thanks this has fail-safe take account non numerical values, , place them @ end of result set. select [nvarcharcolumn] [table] order cast(isnull(nullif(isnumeric([nvarcharcolumn]),0),2147483647) int)

programming languages - What are the Uses of Python? -

i'm new here, forgive me if wrote wrong here... which-all fields can python used , extent? can python used make softwares(with gui, different platforms ) , web apps? update*- want make simple software ( works , enjoyment , little of web dev. ) i'm asking question i'm confused between ruby, asp, php , python web development , want know if python should better learn before c++ ( although can understand c++ learning ) * ides , web frameworks python? me , refer few free ebooks , web-pages learn. , 1 better?2.xx or 3.xx? thanks in advance! john this type of question bit of hornets nest since mileage may vary , largely dependent on opinion. i'll show few usecases. you can use python near all. tutorial of python start. you start out learning python 3.x advised near real-world stuff still in python 2. read article learn more pick. python used web development through lot of frameworks django , pylons , flask . can use python make guis qt , gtk , tk

python - Problems accessing Tkinter widgets in a list -

i'm trying write small program have list of labels , entry-fields using python , tkinter (see code below). adding widgets no problem. however, when want use method of 1 of instances (like insert() on 1 of entry-fields) can't figure out way it. my code looks this: from tkinter import * import random root = tk() attributes = {'strength':10, 'dexterity':10, 'constitution':10, 'intelligence':10, 'wisdom':10, 'charisma':10} entries = [] labels = [] = 0 in attributes: labels.append(label(root, text = a, justify = left).grid(sticky = w)) entries.append(entry(root).grid(column = 1, row = i)) = i+1 root.mainloop() and have tried simple entries[i].insert("text insert") and e = entry e = entries[i] e.insert... but hasn't helped. i've seen other examples of people trying use object in list, , seems doing did in first attempt. have missed something? thanks entry(root).grid() returns n

background-position question -

on this page i"ve been working on forever , have column headed "bid x ask": http://www.sellmycalls.com/so-bg-pos.png in each of cell backgrounds there supposed bar chart conveys ratio of numbers in cell each other. so in each cell have background-color: gray; , background-image:all-white;. can't position (plenty big enough) image on gray background. in fact, in current incarnation, image doesn't show @ all. how can set background-position of image? top <td> in column styled way: <td class="main_td bxa bxa_val" style="background-color: #ecf1ef; background-image:url('http://www.sellmycalls.com/pics/cell/bxa-white.png'); background-repeat:repeat-x repeat-y; background-origin: 0px 0px; background-attachment:fixed; background-position:53px 0px; -moz-background-position:53px 0px; -webkit-background-position:53px 0px; -khtml-background-position:53px 0px; -o-

Android Maps Intent - Extra Parameters -

right now, i'm launching google maps application following call: string geoaddress = "maps.google.com/maps?q="; geoaddress += latlong[0] + "," + latlong[1]; intent = new intent(android.content.intent.action_view, uri.parse(geoaddress)); startactivity(i); which open , place marker @ specified position on map. have 2 questions: 1) how can place multiple markers of have longitude/latitude? 2) how can start maps application other modes (terrain/satellite/etc.)? thanks! you can add multiple links on map using overlays,and u can see googlemapview example in http://developer.android.com/resources/tutorials/views/hello-mapview.html . here can understand use of overlays. read following links , download code link(for further reference) https://github.com/jgilfelt/android-mapviewballoons https://github.com/jgilfelt/android-mapviewballoons#readme 2.to change views use following functions, mapview.setsatellite(true); mapview.sets

javascript - How to Change CSS direction property of the input field automaticly if the user can use an language rtl or ltr -

example: if use arabic language text field direction rtl , if want write new text , switch english language direction inside text field (`text-align: left) ltr automatically you use global html5 attribute dir value of auto here, so: <input type="text" dir="auto" /> from specification: the auto keyword, maps auto state indicates contents of element explicitly embedded text, direction determined programmatically using contents of element (as described below). note : heuristic used state crude (it looks @ first character strong directionality, in manner analogous paragraph level determination in bidirectional algorithm). authors urged use value last resort when direction of text unknown , no better server-side heuristic can applied. http://www.w3.org/tr/html5/elements.html#the-dir-attribute as quote suggests, better find out on server side direction should used, can use if have no way of knowing it.

sql - C# - Attach file saved in database to an email -

how can add 1 or more files saved in ms sql database email? know how attach files saved in directory or fileupload control. my datable fields such: col1: email_id - int col2: file_name - varchar col3: file_content - image so sql select statement prety simple: select file_name, file_content attachments email_id = 333 i can't figure how attach them emails afterwards. thanks! sqlcommand cmdselect=new sqlcommand("select file_name, file_content " + " attachments email_id=@id",this.sqlconnection1); cmdselect.parameters.add("@id",sqldbtype.int,4); cmdselect.parameters["@id"].value=333; datatable dt = new datatable(); this.sqlconnection1.open(); sqldataadapter sda = new sqldataadapter(); sda.selectcommand = cmdselect; sda.fill(dt); if(dt.rows.count > 0) { byte[] barrimg=(byte[])dt.rows[0]["file_content"]; string str

javascript - Get Pixel height of Centimetre unit CSS -

we're writing our own web app , need user have (fairly) accurate visualisation of printed documents on-screen . i'm using centimetre unit in css try , replicate a4 page. i need work out actual pixel height assigned following: max-height: 27cm; is possible in javascript? need pixel height because need compare offsetheight max-height. well, due screens of differing size, resolution, , ppi, wouldn't possible display real life sized view of page consistent across screens. not unless find size of pixels themselves, not believe possible via js.

.net - WCF SOAP Idempotent -

i might getting myself confused here want service idempotent. is, receiving same request more once not change state of system. makes sense me when receiving messages in disconnected integration system. example, receiving messages on msmq , having form of service dealing messages being received. want service in consistent state if receives 10 duplicate messages. what struggling head around standard wcf soap service performs crud operations. idempotency question come affect if asynchronous call? syncrhonous call nature idempotent? looking @ crud operations, 1 not idempotent create. can have duplicate create calls wcf? thanks i guess depend on define (in domain) duplicate. once defined can run checks before creating record. e.g. have person firstname , lastname , etc... duplicate person identified firstname + lastname . what kind of duplicate messages expect service receive? same client 'clicking submit button twice'? or 2 different clients trying update record

windows - How can I get the username of the person who initialised the file in ruby? -

how can username of person initialised file in ruby? i'm using windows xp. , ruby 1.9.2 try this: require 'etc' file.stat("myfile").uid -> 666 example puts 'my file owned by', etc.getpwuid(uid).name

javascript - HTML5 Upload via XHR fails in Chrome -

i using xhr upload file works great in ff fails in chrome. an error thrown says upload failed: 0 means xhr.status comes 0 - i'm not sure means? no other status recorded. //check if have xhr / file support if (typeof file != "undefined" && typeof (new xmlhttprequest()).upload != "undefined") { var xhr = new xmlhttprequest(); xhr.upload.onprogress = function(e){ if (e.lengthcomputable){ uploadstarted = true; var loaded = (e.loaded / e.total) * 100; showprogress(loaded); } }; xhr.onreadystatechange = function(){ if (xhr.readystate == 4){ if (xhr.status == 200){ uploadcomplete(); } else { alert("upload failed: " + xhr.status); } console.log("status",xhr.status); } }; var formelement = document.getelementbyid("configform"); xhr.open("p

c# - Problem with inheritance -

i created class: public class abortablebackgroundworker : backgroundworker { private thread workerthread; protected override void ondowork(doworkeventargs e) { workerthread = thread.currentthread; try { base.ondowork(e); } catch (threadabortexception) { e.cancel = true; //we must set cancel property true! thread.resetabort(); //prevents threadabortexception propagation } } public void abort() { if (workerthread != null) { workerthread.abort(); workerthread = null; } } } here how use it: backgroundworker1 = new abortablebackgroundworker(); //... backgroundworker1.runworkerasync(); if (backgroundworker1.isbusy == true) { backgroundworker1.abort();//this method unavailable :( backgroundworker1.dispose(); } another small question..will code cancel backgroundworker? the method unavailable b

java - How to initialize tab content when app is initialized -

i have app has 2 tabs. each tab loads xml file (fairly large, maybe 400 item rss file). by default tab doesn't xml until it's clicked on. wanted way load when app first opened. here main view: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); resources res = getresources(); // resource object drawables tabhost tabhost = gettabhost(); // activity tabhost tabhost.tabspec spec; // resusable tabspec each tab intent intent; // reusable intent each tab // audio feed intent = new intent().setclass(this, audiofeed.class); spec = tabhost.newtabspec("audio").setindicator("", res.getdrawable(r.drawable.ic_tab_audio)) .setcontent(intent); tabhost.addtab(spec); // video feed intent = new intent().setclass(this, videofeed.class); spec = tabhost.newtabspec("video").setindicator(&q

jquery contextMenu + .live -

i using plugin called jquery contextmenu having trouble making work elements loaded via ajax after dom has loaded. know how can working .live? i've made modification of original jquery.contextmenu.js script. i've replaced .each() .live("mousedown", ...) , deleted appropriate mousedown binding (you can make diff of code , original changes). you can code http://pastebin.com/jbcar6g1 works me.

windows phone 7 - WP7 Push Notification - Power Management -

microsoft documentation says if battery power of device critically low app not receive push notifications. if battery power low not critically low app receive raw notifications. in these 2 cases erroroccurred event received, have show error message user explaining has happened. fine displaying error message when battery level low? if you're not receiving messages on phone, how app know inform user. if isn't running. when restarting app shoudl check (and if necessary re-establish) channels. if it's appropriate let user know there problem , has been fixed. and/or previous notifications failed should so.

c# - Stream with openWrite not writing until it is closed -

i have stream writer opens using webclient.openwrite call. simplified case, assume reader reading multiple of datachunksize. using (stream writer = mywebclient.openwrite(myuristring) { using (filestream reader = new filestream(myfilename, filemode.open, fileaccess.read) { for(int = 0; < reader.length; += datachunksize) { byte[] data = new byte[datachunksize]; reader.read(data, 0, datachunksize); writer.write(data, 0, datachunksize); } reader.close(); reader.dispose(); } writer.close(); writer.dispose(); } my data size of 2 datachunksizes. however, not send data (no data received) until writer.close() call called, sends first datachunksize worth of data...the second datachunksize of data never sent. how can send after every write call? tried adding writer.flush() did not help. thanks. i think issue because last chunk perhaps not full length expect (datachunksize).

c# - ReactiveUI and Caliburn Micro together? -

i've been doing prototype work on new silverlight application using caliburn micro our mvvm framework. team has been happy it. in order address issues throttling requests services, suggested reactiveui's reactivecollections , implementation of inotifypropertychanged. does have experience around using 2 together? since both mvvm frameworks, there's bit of overlap, wonder if might more trouble it's worth try , make them work together. some of things caliburn micro are: the convention based binding, etc...very nicely done in our opinion. bootstrapping. way handled, it's easy extend when need to, out of box stuff works many of our use cases. composition/screen management. rob's notion of conductors, screens, etc. flows nicely us. the reactiveui stuff has drawn (at least initially). the reactive collections , inotifypropertychanged stuff. particularly ability throttle reactions. reactive's asynchronous stuff seems bit cleaner deal rob's c

Yahoo Boss API (version 1) shut down for good? -

it looks yahoo boss api terms of service has changed exclusive pay go model , " key terms ? query suggestions " has been discontinued altogether according boss v2 features matrix can confirm original v1 server shut down , there no more access v1 server's "key terms ? query suggestions"? i'm asking because key terms query not returning data of today. i've got search query , api on original boss network that, prior today returned related keywords given input string. today, not answer. update: roger's answer below. appears boss api has been shut down (at least in version 1). i'm looking lsi search script asap. hire build one, let me know. yes, version 1 of boss disabled on july 20th, replaced version 2, for-pay only: http://tech.groups.yahoo.com/group/ysearchboss/message/3570

c# - ASP.NET Forms Authentication and Active Directory Impersonation -

i'm writing web application (in c#) need logon web page using different credentials user logged on locally windows. page executes process on web server executes user has logged web page. user logging web page authenticated against active directory. i've used windows authenication , asp.net impersonation launch processes on web server, , can create site uses forms authentication against ad, can't find article explains how run process impersonating user have logged on using forms authentication ad. whenever run give me error because it's trying run 'nt authority\iusr'. know of articles, or can give me code examples? thanks in advance, rich take @ proecessstartinfo - can setup security etc. (if thread running impersonated can of necessary info system.threading.thread.currentthread / currentprincipal ) , call preocess.start .

iphone - Problem with savin data! -

i have uitableview , checklist. want able save data when user leaves view. when view opened want there saved data. when saved data mean table view able add , delete cells want able save checkmarks. please provide me way or idea on how this? i know can save data with: nsuserdefaults * defaults = [nsuserdefaults standarduserdefaults]; and save data defaults, need know how on saving table view's cells add , or deleted! know how save checkmarks! thank you, kurt i suggest using either core data, or nscoding. nscoding allows encode object nsdata, , reload replica of object nsdata. for instance, saving , loading array of strings through nscoding this: nsarray * array = [nsarray arraywithobjects:@"this", @"is", @"a", @"test"]; nsdata * encoded = [nskeyedarchiver archiveddatawithrootobject:array]; // save encoded data file... // load encoded data file... nsarray * decodedarray = [nskeyedunarchiver unarchiveobjectwithdata:en

android - Custom Content Provider for Multiple tables -

can in writing custom content provider multiple tables. can write single table multiple table did not find example. a near duplicate of existing answer. compare this question , answer , discussing use of left join inside contentprovider. note that, in all, expected use of contentproviders use single tables each path in content uri. it's still seen out of norm use join or index multiple tables in 1 call. not it's bad, there aren't many people thinking in terms.

jQuery and Mootools conflict -

i know there many post hot use jquery mootools, doing wrong. the original head mootools + jquery: <head> <?php css(); ?> <meta name="viewport" content="width=device-width" /> <meta content="text/html; charset=<?php print $this->getconfig('charset'); ?>" http-equiv="content-type" /> <?php if(($this->getconfig('log_file') != null && strlen($this->getconfig('log_file')) > 0) || ($this->getconfig('thumbnails') != null && $this->getconfig('thumbnails') == true && $this->mobile == false)) { ?> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript" src="http://www.livadi.gr/ib/sources/js/mootools.js"></script> <script type="text/javascript"> //<![cdata[

pdf - Installation button using AS3.0 in Flash -

i havent seen question asked here yet, makes me wonder if common question @ all! out there knows! i'm creating catelog business work , index page has done in flash (i have no acess old program used). how cd cat works (at least old ones have) put disc in, auto launches, , index pops up. on index there 3 links, install, view, , website (pluss exit button). install button when pressed launches instalshield wizard begins download pdf files cat (right catelog comprised of index page, , pdf files. if click 'view' button goes pdf index of companies products.) , link website. when whole thing done installing, there 2 icons on desktop: 1 brings website , 1 opens downloaded copy of cd cat. pdf files though. i have no idea program used in creating origional catelog index, , tried contacting person did doesnt remember (this several years ago , left nothing me go on). i'm entirely new flash, learning, , creating download button daunting me. dont know begin! if spare info or