Posts

Showing posts from March, 2012

verification - Can I mix post conditions and recursive functions in Clojure? -

is possible use both recur , post-condition functionality in same clojure function? hoping throw exception using post-condition, clojure appears trying wrap exception throwing code after recur somehow, (just stupid example) functions cannot evaluated. (defn countup [x] {:pre [(>= x 0)] :post [(>= % 0)]} (if (< x 1000000) (recur (inc x)) x)) i'm using clojure 1.3 @ moment. if @ implementation of defn @ https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#l3905 you'll see body of function gets modified tail calls pushed out of tail-position. 1 way around use auxiliary function call recur'd function , put post-condition on instead: (defn- countup* [x] (if (< x 1000000) (recur (inc x)) x)) (defn countup [x] {:pre [(>= x 0)] :post [(>= % 0)]} (countup* x)) (countup 999999) ;=> 1000000 (countup -1) ; assert failed: (>= x 0)

visual studio 2005 - Conditional breakpoint when heap > some limit -

is possible break debugger when allocated memory of attached-to process becomes bigger value? preferrably using visual studio 2005, other ide's/debuggers option. there no direct way it. alternative set ordinary breakpoint somewhere inside crt allocation code, , set break when hit count multiple of 2000. you'll wanted state enough.

who to connect two android emulators runnnig on same machine? -

i on sending data between 2 emulators.they speak port forwarding cant make work .the emulators have id 5554 , 5556.and know listening port of each emulator. what write in order sent message between 2 emuators?? if want send message use emulator's port no sender's no can send sms emulator check out http://learnandroid.blogspot.com/2008/01/sms-emulation-on-android.html

build process - Is it possible to run ILMerge at compile time within SharpDevelop? -

i'd offer .net library (which i'm developing in sharpdevelop ide) single dll. i've been manually using ilmerge merge compiled library , reference libraries together, done automatically. i'd ideally have automatic merge happen within sharpdevelop, without having set external build script. possible? sharpdevelop uses msbuild compile code simplest way create post build step runs ilmerge correct parameters. can create post build step project options under build events tab. alternatively can directly edit project file in notepad.

php - Deleting files in higher directory -

i'm having problems deleting file higher directory, found post , tried no luck....: gotdalife @ gmail dot com 25-sep-2008 02:04 to who's had problem permissions denied error, it's caused when try delete file that's in folder higher in hierarchy working directory (i.e. when trying delete path starts "../"). so work around problem, can use chdir() change working directory folder file want unlink located. <?php > $old = getcwd(); // save current directory > chdir($path_to_file); > unlink($filename); > chdir($old); // restore old working directory ?> here code have: session_start(); if (!isset($_session['agent']) or ($_session['agent'] !=md5($_server['http_user_agent']))){ require_once ('includes/login_functions.inc.php'); $url = absolute_url(); header("location: $url"); exit(); } $folder = $_get['folder']; ...

setjmp/longjmp in C#. Is it possible? -

i ran problem when need goto local scope: if(...) { dosomethinghere(); if (...) goto label; } else if(...) { label: dosomethingheretoo(); } , apparently not possible in c#. yes know using goto considered bad practice, in case easier goto. i'd rather not whole "goto's source of evil" discussion. me more interesting , more general question possibility of setjmp/longjmp in c#. @ possible? first off, think confusing doing "goto" local scope - short jump - long jump - doing goto place entirely outside of current method. classic c-style long jump can thought of in 2 ways: one, it's throwing exception not clean stack frames. two, returning function "wrong" address. none of above possible in c#. c# not support long jumps; have try-catch-finally-throw non-local gotos in clean, structured , safe way. c# not support short jumps outside local variable declaration space inside space. reason because jumping middle of blo...

android - Does Custom PreferenceActivity Need To Define List -

does custom preferenceactivity need define list? if not define list part of content associated custom preferenceactivity, following runtimeexception: your content must have listview id attribute 'android.r.id.list' i trying create custom preferenceactivity shows 2 lists: one list adds selections other list one list allows user move items or down, or delete them (probably context menu) what "preferred" way of doing this? thanks, wts preferenceactivity extends listactivity, assume needs list. when don't understand things preferred way use source® : preferenceactivity edited: i'd take approach: copy preferenceactivity new class. create own layout activity (take @ listactivity docs ). add second listview it. make sure works original preferenceactivity. start adding code second listview.

html - Hyperlink to a network share -

my scenario this: i have 2 network shares (on same network) construct them a href network share. tried make work solutions given here couldn't succeeed. these href links generated on fly thru application , sent html outlook e-mail. wanted link in outlook html e-mail. \\remote_machine_name\sharename1\windows\notepad.exe \\remote_machine_name\sharename2\scandisk.acc so, need make notepad.exe open on remote machine along scandisk.acc open on same remote machine , input notepad.exe. please note remote machines same both notepad.exe , .acc file share names different. btw, i'm thinking of possibility of generating javascript code on fly application , take .acc file input , in javascript method, open notepad.exe , input .acc file it. work? as side note, whenever click on .acc file link in html outlook e-mail, i'm getting warning outlook dialog shows (open, save , cancel). please help. you'll want this: file://///servername/sharename/path/to/file/file...

jqGrid NavBar custom HTML -

i need jquery jqgrid , subgrid. able create subgrid inside jqgrid succesfully. next step add custom option list in main grid navbar somewhere depending on option user selects, different kind of subgrid opens. possible add custom options jqgrid navigation bar? the standard way add custom element in navbar use navbuttonadd method add button. if want add custom html elements have manually respect of jquery function jquery.append . recommend read code of navseparatoradd , navbuttonadd functions.

IE css - last table row to expand to fill remaining height -

given html following, how can last row take remaining height, , have n-1 first rows take height need? this seems work in chrome, not in firefox2 or ie6/7/8. <table> <tr> <td rowspan="5"><div style="border: 1px solid #cdcdcd; width: 100px; height: 300px;"/></td> <td/> </tr> <tr> <td>one</td> </tr> <tr> <td>two</td> </tr> <tr> <td>three</td> </tr> <tr> <td>full</td> </tr> </table> so, idea last row, "full" in it, should tall, , other rows, "one", "two" , "three" should small possible. i've tried stuff putting exact heights on rows, "<tr style="height:20px;"> , i've tried 100% height on last row, no luck far! update: this layout going used varying types of content, , intention table size content. div...

python - Force locale for one function to be UK/English in just one function so that datetime.strftime always returns an English format -

i need write simple python function accepts date in excel format (an integer of days elapsed since 1st jan 1900). convert python datetime.date object, , i'd format shortened string date (e.g. "jan10" or "mar11") - date in mmmyy format. dt.strftime( fmt ) this function works fine on uk & workstations, i've noticed on colleagues pcs set french locale wrong anser: >>> locale.getdefaultlocale() ('fr_fr', 'cp1252') on these machines function above returns formatted date-string in french not desired output. i understand use locale.setlocale function globally re-define locale, not desirable. elsewhere in system there scripts require native-language locale. not wish break else's component re-defining global locale. so can do? short of re-writing string-formatting function, there way can make strftime function produce it's output in uk/us locale without affecting else? platform = python2.4.4 on windows 32bit fy...

c++ - std::priority_queue: Custom ordering without defining comparator class -

i want have priority queue custom ordering, lazy am, don't want define comparator class implementing operator(). i compile: std::priority_queue<int, std::vector<int>, boost::bind(some_function, _1, _2, obj1, obj2)> queue; where some_function bool returning function taking 4 arguments, first , second being ints of queue, , 2 last ones objects needed calculating ordering (const references). (error: ‘boost::bind’ cannot appear in constant-expression) but doesn't compile. more simple std::priority_queue<int, std::vector<int>, &compare> queue; won't compile, compare being binary function returning bool. (error: type/value mismatch @ argument 3 in template parameter list ‘template class std::priority_queue’; expected type, got ‘compare’) any suggestions? this work: std::priority_queue<int, std::vector<int>, boost::function<bool(int,int)> > then pass in bind expression queue's co...

Joomla Moderated FAQs extension -

does know joomla extension moderated faqs ? something can let users ask question. after admin have option moderate question , respond it... please let me know. thanks. assuming users have register ask question, can accomplish allowing user contributed articles. can add customized submission form using chronoforms submits article faq category. user submitted articles should default unpublished give opportunity moderate , answer questions before publishing.

javascript - defer loading elements until Flash gallery’s images from XML file finish loading -

how defer loading of other graphics on page until after images in flash gallery’s images.xml file finished loading? is there way detect this, or able check if flash swf object finished loading? i'm pretty sure swf object loaded/ready document.getelementbyid('flashobject').onload = function(){}; before corresponding images have loaded though, instead of after. you call javascript function inside swf file once know it's time load other images on page. something in lines of: import flash.external.externalinterface; externalinterface.call("loadimages()"); // loadimages javascript function defined inside webpage

To which language is Scala most similar from a functional programming perspective? -

standard ml ocaml haskell some other it similar in power of static type system haskell, though type inferencing severely hampered need support oo-style subtyping. scala lacks higher-rank polymorphism , impredicativity, both of haskell has. on other hand, scala's implicits-based type class mechanism, while more verbose haskell, more flexible. there many axes on compare, of course; scala's evaluation semantics strict , of ml, whereas haskell lazy .

osx - commands in .bash-profile do not work -

i added alias in .bash_profile file in home directory on mac leopard. example, alias preview = "open -a preview" alias lsall = "ls -l" when try run these commands command line, message command not found any idea might doing wrong? thanks! you need lose spaces around = , i.e. alias preview="open -a preview" alias lsall="ls -l" you need name file .bash_profile if want executed automatically when start new shell.

Cant write file I downloaded using curl in C -

i have c code using curl want use download csv file. when use though, instead of getting , writing file disk, writes html of webpage or doesnt write @ all. here code: size_t my_write_func(void *ptr, size_t size, size_t nmemb, file *stream) { return fwrite(ptr, size, nmemb, stream); } void *downloadfile(void *ptr) { curl *curl; curlcode res; file *outfile; char *symbol = (char *)ptr; curl = curl_easy_init(); if(curl) { outfile = fopen(symbol, "w"); char url[100] = "http://finance.yahoo.com/d/quotes.csv?s="; strcat(url, symbol); strcat(url, "&f=npl1"); curl_easy_setopt(curl, curlopt_url, url); curl_easy_setopt(curl, curlopt_writedata, outfile); curl_easy_setopt(curl, curlopt_writefunction, my_write_func); res = curl_easy_perform(curl); curl_easy_cleanup(curl); fclose(outfile); } } as wrote on official doc : the intern...

wpf controls - WPF and AutoRedraw -

i have custom wpf line , style. usercontrol resources: <!-- framework properties update --> <solidcolorbrush x:key="mylinebrush" color="lightgreen" /> <sys:double x:key="mylinestrokethickness">1</sys:double> <!-- custom property update --> <sys:boolean x:key="mylineisarrowused">false</sys:boolean> <style targettype="local:myline" x:key="mylinestylekey"> <!-- autoupdates control --> <setter property="fill" value="{dynamicresource mylinebrush}"/> <setter property="strokethickness" value="{dynamicresource mylinestrokethickness}" /> <!-- not autoupdate control --> <setter property="showtext" value="{dynamicresource mylineisarrowused}"/> now, observed when update mylines...

junit4 - NoSuchMethodError: org.hamcrest.Matchers.hasXPath when I run tests in eclipse -

i have unit test uses hamcrest library (1.2). it's important it's 1.2 because want include namespace context in hasxpath matcher. maven project , have dependencies set work correctly. (i make sure use junit-dep , not junit - pain i've confirmed dependency tree correct.) works fine in maven. however, when run same test in eclipse (3.6) following error: java.lang.nosuchmethoderror: org.hamcrest.matchers.hasxpath(ljava/lang/string;ljavax/xml/namespace/namespacecontext;lorg/hamcrest/matcher;)lorg/hamcrest/matcher; @ com.factorlab.ws.obs.meta.phenomonongroupsresourceitest.testgetphenomenongroupsxml(phenomonongroupsresourceitest.java:36) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.junit.runners.model.framew...

jquery - wufoo cross-domain settings? -

is there way turn off cross-domain restrictions wufoo can adjust form fields parent of wufoo iframe using jquery? sounds you're using wufoo "embed form code" option adds iframe page. you should use "full page form code" option instead. -- no iframe. instead, you're embedding entire form within your web page. can use jquery modify it. remember form's submit url wufoo server. docs

android - Custom spinner items not appearing as part of Spinner -

i'm running problem: when use non-trivial type of spinner item, spinner displays drop-down list someplace other on spinner. (note: of description identical https://stackoverflow.com/questions/4188443/android-doesnt-honor-selection-change-with-custom-spinner-items , problem i'm reporting here different. i've split these it's clear direct different replies to) my goal have more fancy display each item in spinner, , started creating layout contains several items, 1 of target textview (lbl2, in case) i attempt set spinner (my eventual goal populate spinner programmatically, i'm not using resources set up) using: spinner spinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = new arrayadapter<charsequence>( this, r.layout.spinner_fancy, r.id.lbl2); adapter.add("item #1"); adapter.add("item #2"); adapter.add("item #3"); spinner.setadapter(...

donot see the option to save the email as a seprate file in sharepoint blog post email enabled list? -

i have requirement client store email seprate file in 1 of blog site have created. when see posts(default blog site) incoming email settings, not see option save .eml file. please me if there workaround this. i'm think need create email receiver . inside email receiver, save .eml file separately. *edit* code article: byte[] binarycontent = null; string mailcontent = string.empty; using (stream stream = emailmessage.getmessagestream()) { using (streamreader sr = new streamreader(stream)) { mailcontent = sr.readtoend(); sr.close(); } binarycontent = encoding.utf8.getbytes(mailcontent); stream.close(); } // overwrite previous files same name spfile file = folder.files.add(url, binarycontent, true);

iphone - Unable to access method in the delegate -

here's how set app. have root view loads subview on top of during viewdidload method. in subview have button that, when clicked, hides , reveals root view. working great, hate having view loaded not in use. tried put method in delegate this: [thelaunch release]; ...where thelaunch subview. this method, located in delegate, called hidethelaunch . then trying call method within subview: [[uiapplication sharedapplication].delegate hidethelaunch]; but says -hidethelaunch not found in protocol . am doing wrong? thanks in advance! you need first cast uiapplicationdelegate specific delegate's type: [((myappdelegate *) [uiapplication sharedapplication].delegate) hidethelaunch];

javascript - How do I select the innermost element? -

in jquery, how descend far possible html tree? for simplicity, have 1 path going downward. (related bonus: how find deepest element multiple downward paths?) <html> <table id="table0"> <tr> <td id="cell0"> <div class"simple"> want change information </div> </td> </tr> </table> </html> i want change innermost html of cell named cell0 don't know names of classes inside. possible select far without knowing these names? thanks much! for single path find element doesn't have child nodes: $('body *:not(:has("*"))'); or, in more specific case $('#cell0 *:not(:has("*"))'); for multiple paths - if there multiple equally nested nodes? solution give array of nodes highest number of ancestors. var = $('body *:not(:has("*"))'), maxdepth=0, deepest = []; all.each( functi...

php - Create labels on pdf -

i want open pdf file in iframe or windows extjs , let user click add labels scripts can use ? im coding extjs / php /mysql use fpdf/fpdfi libraries write on pdf file idea ? please thank simply pointing iframe pdf file works when user has allowed it's web browser embed adobe reader (i'm not sure other pdf-readers support @ all). might common configuration ie users, in other browsers , on other os-es it's not common. another option use service renders pdf web page. example using google docs it's dead easy: <iframe src="http://docs.google.com/gview?url=http://yourdomain.com/file.pdf&embedded=true" style="width:600px; height:500px;"></iframe>

javascript - Two tables from one String variable of HTML -

an ajax query returns html string has 2 tables. i want put table1 into div1 , table2 into div2 if html representing both tables (they're sequential, not nested or funny that) stored in variable twotables , how can use jquery selectors (or other method, although trying avoid direct string manipulation) split variable? edit: data looks like <table id="table1"> ... </table><table id="table2"> ... </table> var $tables = $(twotables); $('#div1').append( $tables[0] ); $('#div2').append( $tables[1] ); example: http://jsfiddle.net/vhazv/ since twotables represents html string of 2 sequential tables, send string jquery object, select each table dom element 0 based index. or use .eq() table wrapped in jquery object. var $tables = $(twotables); $tables.eq(0).appendto('#div1'); $tables.eq(1).appendto('#div2'); here's no jquery version still uses browser's native html p...

c++ - how to add template parameter to global function? -

i'm working legacy code, , trying compile in linux. built in visual studio, compiler didn't keep standards. anyways, i'm going through code fixing , came across templated function declared globally. error: /home/blah/blah;/blah.h:78: error: there no arguments ‘clip’ depend on template parameter, declaration of ‘clip’ must available i have been able fix same error before when in specific scope doing myclass::clip. however, since has no scope, how resolve this? updated: here's declaration of clip function: template<class t> inline t clip( t x, t bot, t top ) { return(( x>=bot && x<=top ) ? x : (( x<bot ) ? bot : top )); } the call clip: src_row = clip( dst_row + h, 0, sr ); //dst_row + h, 0, sr int's... help? //btw, love quick responses, thanks. the call , declaration in different '.h' files put declaration of clip somewhere before template definition caused error. if clip not template, ordinary...

php - isBundle() in Magento? -

how tell if product page set bundle in magento 1.4? can't find way it. this code should work in product page (catalog/product/view.phtml): $product = $this->getproduct(); if($product->gettypeid() === 'bundle'){ // something… }

java - Get classname of type used with extends ArrayList<T>? -

i have following: public class foo<t extends grok> extends arraylist<t> { } how can find class name represented t @ runtime? instance, let's allocate this: foo<apple> foo = new foo<apple>(); is there way can apple class name used in constructor of foo?: public foo() { super(); string classname = this.gettypeclassname(); // "com.me.apple" } i add method set classname, prefer fetch internally user doesn't have it, thank you marcelo's answer explains can't want, due type erasure. however, there other options doing want, this: public class foo<t extends grok> extends arraylist<t> { private foo(class<t> type) { string classname = type.getname(); ... } public static <t extends grok> foo<t> create(class<t> type) { return new foo<t>(type); } ... } this enables clients of class write following, approximately same effort normal constructor g...

c# - Should an IEnumerable iterator on a Queue dequeue an item -

i have created custom generic queue implements generic iqueue interface, uses generic queue system.collections.generic namespace private inner queue. example has been cleaned of irrelevant code. public interface iqueue<tqueueitem> { void enqueue(tqueueitem queueitem); tqueueitem dequeue(); } public class customqueue<tqueueitem> : iqueue<tqueueitem> { private readonly queue<tqueueitem> queue = new queue<tqueueitem>(); ... public void enqueue(tqueueitem queueitem) { ... queue.enqueue( queueitem ); ... } public tqueueitem dequeue() { ... return queue.dequeue(); ... } } i want keep things consistent core implementations , have noticed core queue implements ienumerable same either explicitly implementing ienumerable on class or inheriting iqueue interface. what want know when enumerating on queue should each move next dequeue next item? have used reflector see ho...

How to create a django form with a select list initialized from a dynamic query? -

i'm trying build form select list can initialized tuple parameter pass in on creation of form object. i tried doing following, worked creating form. when try submit form, is_valid() = false error. in example below myrooms variable data i'd dynamically load upon initialization of form. here? class sessioninfoform(forms.modelform): def __init__(self, myrooms = none, *args, **kwargs): super(sessioninfoform, self).__init__(*args, **kwargs) if myrooms != none: self.fields['room'].choices = myrooms class meta: model = sessioninfo fields = ["title", "room", "viewer_limit", "starttime", "endtime", "billing_type", "billing_value"] your forgetting pass same list myrooms when validating results. you have pass both rendering , validating.

google play - Android market app Link -

i want write app launches android market. (the activity should 1 activity) plz refer me android market link or suggestion. uri uri = uri.parse("market://search?q=barcodes"); intent intent = new intent (intent.action_view, uri); startactivity(intent); this example code launch market , search barcodes.

wolfram mathematica - Patterns with Orderless subexpressions -

i need deal patterns f[{a,b}]=... a , b supposed orderless so far i've implemented using default sort[] on subexpressions every time f defined or evaluated. my questions are is robust orderless ? is there better way? ps: example application tree decomposition recursively build quantities subtree[bag1->bag2] bag1 , bag2 orderless sets of vertices answer update michael pilat's answer shows how define rule automatically sort f's subexpressions. alternative solution define custom head bag orderless attribute , use head orderless sublists after answered this question consulted few colleagues agreed following indeed best / typical way handle problem: f[{a_, b_}] := f[{sort[a], sort[b]}] /; not[orderedq[a]] || not[orderedq[b]] in[99]:= f[{{1, 2, 3}, {5, 4, 3}}] out[99]= f[{{1, 2, 3}, {3, 4, 5}}] alternately, replace inner list heads custom head symbol has orderless attribute, , if formatting matters use various formatting techniques ...

css - Some of my text fields and text areas cannot be clicked for data entry -

after applying css 1 of forms, of fields cannot accessed without tabbing them. applying relative positions, padding, , float. cause of problem? when using positioning might have positioned form under other element , click in 1 instead on form. try on top layer. can specifying z-index higher value. input { z-index:2;} or move somewhere else temporarily see if under other element.

Can I use Socket.IO with Django? -

is there way use socket.io http://socket.io/ django? sure can! django arent asyncronous have use socket.io server in parallel normal django server, node.js isnt choice there exists others written in pure python. here blog/tutorial uses gevent socket.io server. http://codysoyland.com/2011/feb/6/evented-django-part-one-socketio-and-gevent/ for similar solution has bit more history can @ orbited, (www.orbited.org)

javascript - Run a Greasemonkey script only once per page load? -

if create greasemonkey script @include * , go site youtube, runs script 20+ times every time refresh. on firefox, not sure chrome. there way prevent this? first, don't want script run in iframes. can block using the @noframes directive works in both greasemonkey , tampermonkey of october, 2014. for older versions, or script engines don't support @noframes , can use code, after metadata block: if (window.top != window.self) //don't run on frames or iframes { //optional: gm_log ('in frame'); return; } second, can wait , fire gm code, once, on page load. wrap in main() , call on load event, so: window.addeventlistener ("load", localmain, false); function localmain () { // code goes here. } third, can exclude sites or pages adding // @exclude directives metadata block. overall, it's best avoid universally included gm scripts, if possible. other methods might set flags or reload page url parameters. th...

javascript - rotate an image multiple times on click with jquery -

i trying rotate image using jquery rotate on multiple mouse clicks. using jquery-rotate plugin, following code rotates image once (transforming canvas in firefox) , no longer rotate on further clicks. $(".drag-and-rotatable img").click(function() { $(this).rotate(45); }); i'm open using other javascript libraries. when rotate(45) , rotating image 45 degrees? (make sure it's not radians, don't use plugin) original rotation, if want keep rotating have keep adding or subtracting degrees: $(function() { // doc ready var rotation = 0; // variable rotation $(".drag-and-rotatable img").click(function() { rotation = (rotation + 45) % 360; // mod 360 isn't needed $(this).rotate(rotation); }); });

sql - How do you keep a JOIN table performant? -

i'm drawing plans few new features on site, , 1 "solved" using join table. example schema: person table pk personid name age ... personcheckin table pk fk personid pk fk checkinid date ... checkin table pk checkinid checkedinto ... a join run check in data person (connected personcheckin table). since every person check in unlimited number of times, personcheckin table become large. i'd imagine cause performance issues. typical ways handled keep performance high? a join considering best performing means of connecting related tables. depends on query, because might not need join -- joining can inflate record set on parent tables side if there more 1 child record related, means there need either group or distinct. exists or in better choice in such situations... indexes can on column(s) used in join criteria, on both sides of relationship. in example both sides primary keys, typically have best index automatically created w...

c++ - libjingle's XmppPump compilation problem -

i started coding gtalk chat bot using libjingle. i'm having problem getting compiler find xmppclient class called xmpppump class. xmppclient provided libjingle in talk/xmpp/xmppclient.h file, reason it's not working me , has been frustrating me lately. guys able me out! i'm using libjingle-0.5.1 , g++ compiler version 4.4.5. os ubuntu 10.10, 32-bit. here's how i'm trying compile code: g++ -g -werror -dposix -dexpat_relative_path -dfeature_enable_ssl -dhave_openssl_ssl_h=1 -i../include -i../misc/libjingle-0.5.1 -i../misc/libjingle-0.5.1/talk/third_party/expat-2.0.1 -i../misc/libjingle-0.5.1/talk/third_party/srtp/include -l../lib -lpthread -lssl -o ../bin/gtalk_bot.bin ../obj/main.o /usr/local/lib/libglog.a ../misc/libjingle-0.5.1/talk/build/dbg/lib/libjingle.a ../misc/libjingle-0.5.1/talk/build/dbg/lib/libexpat.a ../misc/libjingle-0.5.1/talk/build/dbg/lib/libsrtp.a ../misc/libjingle-0.5.1/talk/build/dbg/lib/libxmpphelp.a here's error message: ../m...

visual studio - Reasonable to remove TestContext from a unit test? -

all unit test classes have been created visual studio 2008 built-in unit test template includes "testcontext" property. far have not used test context , field upsetting resharper , code coverage. is ok remove testcontext or doing indicate unit tests poorly structured? if don't need it, remove it. can introduce again afterwards. i've hardly used too...

jaxb - annotating the addition of an attribute to an element -

i'm upgrading java object has xml representation in spirit: <myobjects> <myobject uid="42" type="someenum"> <name>waldo</name> <description>yada yada</description> <myelement>some_string</myelement> ... </myobject> ... </myobjects> myelement optional - can null in java / omitted in xml. i'm adding field only relevant if myelement has actual value (and keep compatibility previous xml, it's optional in itself) i'm trying avoid this: <myelement>some_string</myelement> <myattr>foo</myattr> and prefer this: <myelement myattr="foo">some_string</myelement> but banging head 2 days on how annotate it. i thought of marking xmltransient , let xmlanyelement catch instead while unmarshalling - seems cause problem when marshalling object java xml. i tried creating xmladapter e...

acts as tree - problem when installing rails plugins -

i'm trying install acts_as_tree plugin, got no error command line still : undefined local variable or method acts_as_tree' #` the vendor/acts_as_tree empty , when try install again : already installed: acts_as_tree (git://github.com/rails/acts_as_tree.git) i'm running rails 2.3.5 on windows aptana 2 , instantrails i missing git

css - Input Boxes not aligning even after setting padding and margins -

i using following css code align input boxes, still nothing seems work: .entryformdiv.input { padding-left: 100px; margin-left: 100px; left: 50px; width: 80px; text-transform: capitalize; } what problem? have added class name on input definitions. edited ** <div id="divbooksentryform" class="entryformdiv" runat="server"> <label id="lblbookname" class="label" runat="server">title of book: </label> <input id="inpbookname" class="input" runat="server" /><br /> <label id="lblauthor" class="label" runat="server">author: </label> <input id="inpauthor" class="input" runat="server" /><br /> <label id="lblpublisher" class="label" runat="server">publisher: </label> <input id="inppublisher" class=...

iphone - How to use UIScrollView with complex picture -

i have complex picture . consists of several layers. each layer picture . example , background picture -> man picture -> gun picture -> foreground picture want drag , use pinch gesture complex picture . can uiscrollview ? what happens if make uiimageviews of complex picture , put them in uiscrollview (i'm assuming you've tried before asking question?) i.e inside view controller : - (uiview *)viewforzoominginscrollview:(uiscrollview *)scrollview { uiimageview *i1 = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"backgoround.png"]] autorelease]; uiimageview *i2 = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"man.png"]] autorelease]; uiimageview *i3 = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"gun.png"]] autorelease]; uiview *v = [[[uiview alloc] initwithframe:[[self view] bounds]] autorelease]; [v addsubview:i1]; [v addsubview:i2]; [v addsubview:i3]; ret...

javascript - wordpress show selected item -

i pulling pages using query_posts populate dropdown menu. lets assume list populate following fields option1, option2, option3 , option4 now if have selected option3 , page changes this, how display selectedindex? <select name="speedc" id="speedc" onchange='document.location.href=this.options[this.selectedindex].value;'> <option value=""> <?php echo attribute_escape(__('v&auml;lj en fr&aring;n listan')); ?></option> <?php $pages = get_pages('include=11,13,15,17,38'); foreach ($pages $pagg) { $option = '<option value="'.get_page_link($pagg->id).'">'; $option .= $pagg->post_title; $option .= '</option>'; echo $option; } ?> </select> you want use wordpress function is_page() is_page('id') where 'id' id have fetched. more information, chec...

inheritance - Ruby- read the value of a variable in another class? -

i have following class def initialize @var = 0 end def dosomething @var+=1 end end class b < def initialize super end def func puts @var end end the problem when call = a.new a.dosomething b = b.new the value @var returns 0 how change code return "new" value of var (1)? quick answer, if understand classes, inheritance , objects : replace @var (an instance variable, , therefore different in a , b ) @@var (a class variable, , therefore same in instances of class a ). otherwise, question indicates have fundamental misunderstanding of what's going on classes, objects , inheritance. your code following: defines class, called a . blueprint can create objects. declares when object of type a created, object should given it's own private copy of attribute, called var , set 0 . declares objects of type a can asked dosomething , increases value of object's var 1. defines class called b , special...

indexing - Data structure to represent piecewise continuous range? -

say have integer-indexed array of length 400, , want drop out few elements beginning, lots end, , middle too, without altering original array. is, instead of looping through array using indices {0...399} , want use piecewise continuous range such as {3...15} ∪ {18...243} ∪ {250...301} ∪ {305...310} what data structure describe kind of index ranges? obvious solution make "index mediator" array, containing mappings continuos zero-based indexing new coordinates above, feels quite wasteful, since elements in sequential numbers, few occasional "jumps". besides, if find that, oh, want modify range bit? whole index array have rebuilt. not nice. a few points note: the ranges never overlap. if new range added data structure, , overlaps existing ranges, whole thing should merged. is, if add above example range {300... 308} , should instead replace last 2 ranges {250...310} . it should quite cheap loop through whole range. it should relatively cheap query val...

java - GWT: Unable to find GWTModule/gwt/xml.gwt.xml -

when try compile eclipse dynamic web application uses gwt, following error message: [error] unable find 'gwtmodule/gwt/xml.gwt.xml' on classpath; typo, or maybe forgot include classpath entry source? i can't figure out causing problem. eclipse build path contains next other gwt-unrelated jars/libs gwt sdk (2.1.0). my gwtmodule.xml: <?xml version="1.0" encoding="utf-8"?> <!doctype module public "-//google inc.//dtd google web toolkit 2.1.0//en" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/src/gwt-module.dtd"> <module> <inherits name="com.google.gwt.user.user" /> <source path="client"/> <entry-point class="gwttest.ui.client.testui" /> </module> the environments classpath variable not set, because of this problem i encountered similar problem new gwt project, there project compiled - error messag...

objective c - NSOperationQueue: Can't add UIBarButtonItem in the Toolbar on Main Thread -

in uiviewcontroller want add uibarbuttonitem in toolbar, new button doesn't appear. doing wrong? - (void)dologin:(nsstring *)name password:(nsstring *)password { // 1.: start thread: nsinvocationoperation *invoperation = [[nsinvocationoperation alloc] initwithtarget:self selector:@selector(backgroundtasklogin:) object:request]; [self.opqueue addoperation:invoperation]; } - (void)backgroundtasklogin:(nsstring *)request2 { // 2.: jump in main thread in show cancel button in den toolbar: [self performselectoronmainthread:@selector(showcancelbutton) withobject:nil waituntildone:no]; } - (void)showcancelbutton { // 3.: add new cancel-button in toolbar: uibarbuttonitem *tempbuttoncancel = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemcancel target:self action:@selector(cancellogin)]; nsmutablearray *mybuttons = (nsmutablearray *)self.toolbaritems; nslog(@"count buttons: %d", [self.toolbaritems count]); // debugger: 2 [mybuttons add...

jqGrid - how to change title based on colModel sortable property -

when mouse hovers on each column i'd tooltip indicate whether column sortable. able change title attribute this: $("#list .ui-th-column").each(function(i) { var issortable = % 2; $(this).attr('title', issortable ? "not sortable" : "click header sort."); }); i'd replace demo expression 'i % 2' check of colmode's sortable property, can't figure out how value of colmodel's sortable property. colmodel: [ { name: 'name', index: 'name', width: 100, sortable: true }, { name: 'note', index: 'note', width: 200, sortable: false } ] i've tried .getgridparam , .getcolprop don't think syntax i'm using correct. to value of sortable property other property column definition can following: var grid=$("#list"); var propsname = grid.jqgrid('getcolprop','name'); var propsnote = grid.jqgrid('getcolprop','note...

iphone - Storing NSMutableArray filled with custom objects in NSUserDefaults - crash -

edit: here working version. able retrieve object within nsmutablearray after saved , loaded nsuserdefaults via nscoding. think it's important mention, not need de-archive array, content. can see, had not store nsdata of freeze object, nsdata of array: // class "freeze" @interface freeze : nsobject <nscoding> // nscoding-protocoll important!! { nsmutablestring *name; } @property(nonatomic, copy) nsmutablestring *name; -(void) initstring; @end @implementation freeze @synthesize name; -(void) initstring { name = [[nsmutablestring stringwithstring:@"some sentence... lalala"] retain]; } // method nscoding-protocol - (void)encodewithcoder:(nscoder *)encoder { //encode properties, other class variables, etc [encoder encodeobject:self.name forkey:@"name"]; } // method nscoding-protocol - (id)initwithcoder:(nscoder *)decoder { self = [super init]; if( self != nil ) { //decode properties, other class vars ...

How to run linux program in java under windows? -

how can run linux binary under windows? there emulation jar or run linux program under windows java program code runtime.getruntime().exec()? in cases tool cygwin can you. btw if wish run windows program under linux can use wine.

c# - TextWriterTraceListener on background thread -

i've got 3rd party component uses traceswitch functionality allow me output traces of what's going on inside. unfortunately, running switches in verbose mode, textwritertracelistener consumer (outputs file) slows down application much. it isn't critical traced data written immediately, there way data written on lower priority thread? perhaps task? edit upon further investigation, seems merely turning on switches without attaching listener causes slowdown. i'm going hold of component provider. would still interesting hear answer though. write own extension tracelistener. in extension, put trace strings onto list<string> , when count gets high enough, write list out file , clear list start again. flush list on dispose(). this can extended use thread pool queue new task actual write. this doesn't guarantee improve performance. if sure io slowing things down.

javascript - IE returns wrong z-index -

so here z-index issue in ie7 have ran into. found explanation of problem else without fix. when have positioned element inline z-index of 0, javascript doesn't return correct z-index. if z-index set element in stylesheet return z-index instead. same result using jquery too. make html file following: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $('button').click(function(){ alert($('#mainbox').css('zindex')); }); }); </script> <style type="text/css"> #mainwr { position: relative; z-index: 2; border: 1px solid #333; width: 200px; height: 200px; } #mainbox { z-index: 1; border: 1px solid #555; width: 100px; height: 100px; position: absolute; top: 50px; left: 50px; }...

jquery - Problem with Ajaxed Wordpress and internal # Links -

i use ajax load #article content single.php page template filterable image navigation is. the content loads fine , filter navigation works. when try copy&paste link new tab deeplinking won't work. i figured out problem filterable navigation filters adding #foo url. if remove function/plugin works. the ajax adds event listner internal links except few defined hereby: $(document).delegate("a[href^='"+siteurl+"']:not([href*=/wp-admin/]):not([href*=/wp-login.php]):not([href$=/feed/])", "click", function() { location.hash = this.pathname; return false; }); i tried adding internal links filter in there, had no success :not[(href^=#)] , similiar because don't know logic. i need exclude links #portfolio-filter li a you add class of links don't want include, like: $('#portfolio-filter li a').addclass('ignore'); and work $('a[class!="ignore"]') selector.

audio - Mixing multiple sound clip -

i'm trying mix 6 sound clips together. imagine each clip single guitar string pluck sound , want mix them produce guitar chord. here, clip array of real numbers in range [-1,1], each number mono sample. double mixed_sample = mix(double sample1, ..., double sample6); please, implement mix ! you have got kidding. mixing simple addition of signals. double mix(double s1, double s2, double s3, double s4, double s5, double s6) { return (s1 + s2 + s3 + s4 + s5 + s6); } next step provide individual channel gains. double variable_mix(double s1, double s2, double s3, double s4, double s5, double s6, double g1, double g2, double g3, double g4, double g5, double g6) { return (s1*g1 + s2*g2 + s3*g3 + s4*g4 + s5*g5 + s6*g6); } of course, kind of pain in ass code, , parameter-passing overhead eat alive, have do.

java - How to extend c3p0 ComboPooledDataSource -

ok have resource in tomcat 5.5 in server.xml database connection this: <resource name="jdbc/myapp" auth="container" type="com.mchange.v2.c3p0.combopooleddatasource" driverclass="com.microsoft.sqlserver.jdbc.sqlserverdriver" maxpoolsize="100" minpoolsize="5" acquireincrement="5" user="username" password="password" factory="org.apache.naming.factory.beanfactory" jdbcurl="jdbc:sqlserver://localhost:1433;databasename=mydatabase;autoreconnect=true" /> has tried extend above combopooleddatasource? problem database password in clear text. idea first encrypt password , place encrypted key in server.xml. have decrypting utility can decrypt key before trying connect database. i found example solution problem org.apache.tomcat.dbcp.dbcp.basicdatasourcefactory, i'm not using connection pool. i'm using c3p0. tried before c3p0? yes, can...

c++ - std::set and its front_insert_iterator -

i know can this: std::vector<double> vec; std::back_insert_iterator<std::vector<double> > it( back_inserter(vec) ); = 4.5; but i'd similar (in syntax ) std::set (and use front_insert_iterator instead of reference set , use set::insert ). possible, or forced use reference o set? maybe should use std::merge and/or std::set_intersect (this allow error reporting in case of duplicates)? approach? thanks! you don't push_back or push_front set , because (conceptually) set sorted associative container. can this, though: #include <cstdlib> #include <set> #include <iterator> using namespace std; int main() { typedef set<int> myset; myset si; insert_iterator<myset> it(si, si.begin()); *it = 1; *it = 2; } edit: note begin() iterator initialized not elements put. rather, hint stl start looking put item. edit2: as per comments below, wanted way check "disposition" of inser...

python - Getting a PasteScript error when I try to serve an existing Pylons app -

i'm trying serve existing python 2.5 pylons application on os x snow leopard. i've installed python 2.5 , set default python installation, installed paster, , installed version of pylons app needs (0.9.6.1) other eggs... when cd main folder , "paster serve development.ini" following: file "/usr/local/bin/paster", line 5, in <module> pkg_resources import load_entry_point file "/system/library/frameworks/python.framework/versions/2.5/extras/lib/python/pkg_resources.py", line 2603, in <module> file "/system/library/frameworks/python.framework/versions/2.5/extras/lib/python/pkg_resources.py", line 666, in require file "/system/library/frameworks/python.framework/versions/2.5/extras/lib/python/pkg_resources.py", line 565, in resolve pkg_resources.distributionnotfound: pastescript==1.7.3 i have done "easy_install pastescript==1.7.3" , still error. there obvious i'm missing? help? thanks in...

c - Do I need to worry about Valgrind reporting errors outside the scope of my application? -

when running valgrind's memcheck tool, many hundreds of thousands (or more, since valgrind cuts off @ 100k) of small invalid read statements, e.g.: ==32027== invalid read of size 1 ==32027== @ 0x3ab426e26a: _io_default_xsputn (in /lib64/libc-2.5.so) ==32027== 0x3ab426cf70: _io_file_xsputn@@glibc_2.2.5 (in /lib64/libc-2.5.so) ==32027== 0x3ab42621fa: fwrite (in /lib64/libc-2.5.so) ==32027== 0x4018ca: starch_gzip_deflate (in /home/areynolds/trunk/utility/applications/bed/starch/bin/starch) ==32027== 0x401f48: compressfilewithgzip (in /home/areynolds/trunk/utility/applications/bed/starch/bin/starch) ==32027== 0x4028b5: transforminput (in /home/areynolds/trunk/utility/applications/bed/starch/bin/starch) ==32027== 0x402f12: main (in /home/areynolds/trunk/utility/applications/bed/starch/bin/starch) ==32027== address 0x7febb9b3c on thread 1's stack these statements refer calls functions outside of application (" starch ") , appear part of libc ....