Posts

Showing posts from February, 2014

java - Hudson plugin for Yammer-API Stapler Exception? -

i using hudson-yammer plugin sending notification on yammer & uses following jar hudson jar = hudson-core-1.384.jar stapler jar = stapler1.87 jar hudson-yammer plugin = http://code.google.com/p/hudson-yammer/ exception in thread "main" java.lang.noclassdeffounderror: org/kohsuke/stapler/staplerfallback @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:634) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:277) @ java.net.urlclassloader.access$000(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlclassloader.java:212) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:205) @ java.lang.classloader.loadclass(classloader.java:321) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:294) @ java.lang.classlo

zk - what is wrong in my java zkoss program -

updated <?page title="example"?> <window id="music" apply="com.main"> <combobox id="combo" autodrop="true" onchanging="music.suggest()"/> </window> java public class main extends genericcomposer{ /** * */ private static final long serialversionuid = 1l; combobox combo; public void suggest() { combo.getfellow("combo"); combo.getitems().clear(); combo.appenditem("ace"); combo.appenditem("ajax"); combo.appenditem("apple"); combo.appenditem("best"); combo.appenditem("blog"); } } it says null pointer exception y??? i modified code, can give try :) zul <?page title="example"?> <window id="music" apply="com.maincomposer"> <combobox id="combo" autodrop="true"/> </window>

windows - Detect whether app was run via autorun.inf or doubleclick in explorer? -

i have win32 api application residing on usb virtual cd. possible determine whether run windows executing autorun.inf or user double-clicking cd icon in explorer? thanks... there no direct way detect application run autorun.inf . autorun stuff launching application if launched user. however, can specify command line argument in autorun.inf , trigger specific behaviour in application. command line argument retrieved through argv or getcommandline() .

scala - How can I reverse of flow of Option Monad? -

say, have bunch of "validation" functions return none if there no error, otherwise return some(string) specifying error message. following ... def validate1:option[string] def validate2:option[string] def validate3:option[string] i going call them in sequence , 1 returns some(string), stop , return same. if returns none, go next until sequence over. if of them return none, return none. i glue them in "for expression". ... for( <- validate1; b <- validate2; c <- validate3) yield none; however, option flows opposite want here. stops @ none , follows some(string). how can achieve that? you chain calls orelse method on option validate1 orelse validate2 orelse validate3 or run fold on collection of validate methods converted functions val vlist= list(validate1 _, validate2 _, validate3 _) vlist.foldleft(none: option[string]) {(a, b) => if (a == none) b() else a}

php - Very simple MySQL query not working -

i'm trying execute this: $result = mysql_query("insert timesheet (project_no,user,cust_name,notes,duration) values("'".$_post['project']."', '".$_post['user']."', '".$_post['cust']."', '".$_post['notes']."', '".$_post['duration']."'")") or die(mysql_error()); i'm aware of sql injection. can spot issues apostrophes, speech marks etc?? the apostrophes not correct. $result = mysql_query("insert timesheet (project_no,user,cust_name,notes,duration) values('".$_post['project']."', '".$_post['user']."', '".$_post['cust']."', '".$_post['notes']."', '".$_post['duration']."')") or die(mysql_error()); the mistake in beginning in "values" , on closing bracket inside query st

.net - What does ?? mean in C#? -

possible duplicate: what 2 question marks mean in c#? what ?? mean in c# statement? int availableunits = unitsinstock ?? 0; if (unitsinstock != null) availableunits = unitsinstock; else availableunits = 0;

wcf - Silverlight PollingDuplex InnerChannel faulted with multipleMessagesPerPoll (serverPollTimeout) -

im running silverlight client version 4.0.50917.0 , sdk version 4.0.50826.1 i've created simple silverlight client against wcf pollingduplex binding: web.config: <system.servicemodel> <extensions> <bindingextensions> <add name="pollingduplexhttpbinding" type="system.servicemodel.configuration.pollingduplexhttpbindingcollectionelement,system.servicemodel.pollingduplex, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> </bindingextensions> </extensions> <behaviors> <servicebehaviors> <behavior name="sv"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> <servicethrottling maxconcurrentsessions="2147483647"/> </behavior> </servicebehaviors> </behaviors> <bindings> <!-- create polling duplex binding. --&g

user interface - What is the best practice for text in a dialog box? -

this not technical question still part of development cycle. i'm having word of dialog boxes in program working on , trying handle on best practices making text average end user comprehend. i have 3 core principles think of keep short - yet long enough explain thoroughly avoid personal remarks such "keep in mind", "just know", etc call apple apple - if concept highly technical not dumb down word doesn't encapsulate idea. are these principles go and/or there better add. there various platform specific guidelines, e.g. microsoft wuxi --- dialog text apple the things add: consistency - keep style , tone consistent throughout application. consistency - use same names concepts , elements of app drop everyting can live without - explanations belong online help, don't pack dialog tight, leave room. use simple words . not of users native english speakers. use present tense, active voice avoid exclamation marks avoid m

c# - Why can't I override GetHashCode on a many-to-many entity in EF4? -

i have many-to-many relationship in entity framework 4 model (which works ms sql server express): patient-patientdevice-device. i'm using poco, patientdevice-class looks this: public class patientdevice { protected virtual int32 id { get; set; } protected virtual int32 patientid { get; set; } public virtual int32 physicaldeviceid { get; set; } public virtual patient patient { get; set; } public virtual device device { get; set; } //public override int gethashcode() //{ // return id; //} } all works when this: var context = new entities(); var patient = new patient(); var device = new device(); context.patientdevices.addobject(new patientdevice { patient = patient, device = device }); context.savechanges(); assert.areequal(1, patient.patientdevices.count); foreach (var pd in context.patientdevices.tolist()) { context.patientdevices.deleteobject(pd); } context.savechanges(); assert.areequal(0, patient.patientdevices.count);

java - Guava equivalent for IOUtils.toString(InputStream) -

apache commons io has nice convenience method ioutils.tostring() read inputstream string. since trying move away apache commons , guava : there equivalent in guava? looked @ classes in com.google.common.io package , couldn't find simple. edit: understand , appreciate issues charsets. happens know sources in ascii (yes, ascii, not ansi etc.), in case, encoding not issue me. you stated in comment on calum's answer going use charstreams.tostring(new inputstreamreader(supplier.get(), charsets.utf_8)) this code problematic because overload charstreams.tostring(readable) states: does not close readable . this means inputstreamreader , , extension inputstream returned supplier.get() , not closed after code completes. if, on other hand, take advantage of fact appear have inputsupplier<inputstream> , used overload charstreams.tostring(inputsupplier<r extends readable & closeable> ), tostring method handle both creation , closing of

jquery - Disable click link functionality and mask out a table row -

i'm trying implement functionality when link clicked corresponding anchor table row blanked out , link disabled. is possible using jquery? an example of 1 of table rows be:- <tr class="bcell"> <th scope="row"><a title="bla" class="addlink" id="a_205">adrian&nbsp;apple</a></th> <td>name</td> <td class="bcell"> <span>0&nbsp;/&nbsp;0</span> </td> <td>jt 76 99 44 d</td> <td>12122121212121</td> </tr> so if anchor clicked, row blanked out. this snippet self-explaining: $(".addlink").click(function(){ [..] //$(this) refers clicked anchor //with .parents("tr:first") retrieve //the desired anchor row var anchorrow = $(this).parents("tr:first"); // can wathever want: have anchor row (it's jquery object) // , anchor link [

objective c - changing UILabel text on a subview from main view -

ok, i'm relative noob objective-c/ios programming, more knowledge here can me out. have ipad application using splitviewcontroller template (with core data). created uiviewcontroller (with xib file) called playerviewcontroller. view has several uilabel components on it. i have list of players show in rootviewcontroller ( uitableview ) , when select player, programmatically create playerviewcontroller (in detailviewcontroller), pass nsmanagedobject passed detailviewcontroller, try set text of 1 of labels on playerviewcontroller's view, , add subview detailviewcontroller. all of works great except setting text of label on playerviewcontroller's view. i'm not sure i'm doing wrong. have used nslog confirm nsmanagedobject not nil , nsmanagedobject property i'm trying use has correct text. i'm @ loss here. appreciated. (code follows): this method in detailviewcontroller.m file: - (void)configureview { // update user interface deta

.net - Calculate factorials in C# -

how can calculate large factorials using c#? windows calculator in win 7 overflows @ factorial (3500). programming , mathematical question interested in knowing how can calculate factorial of larger number (20000, may be) in c#. pointers? [edit] checked calc on win 2k3, since recall doing bigger factorial on win 2k3. surprised way things worked out. calc on win2k3 worked big numbers. tried !50000 , got answer, 3.3473205095971448369154760940715e+213236 it fast while did this. the main question here not find out appropriate data type, bit mathematical. if try write simple factorial code in c# [recursive or loop], performance bad. takes multiple seconds answer. how calc in windows 2k3 (or xp) able perform such huge factorial in less 10 seconds? there other way of calculating factorial programmatically in c#? have @ biginteger structure: http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx maybe can implement functionality. codeproject has im

cocoa - What are common pitfalls of timestamp based syncing? -

i implementing first syncing code. in case have 2 types of ios clients per user sync records server using lastsynctimestamp , 64 bit integer representing unix epoch in milliseconds of last sync. records can created on server or clients @ time , records exchanged json on http. i not worried conflicts there few updates , same user. however, wondering if there common things need aware of can go wrong timestamp based approach such syncing during daylight savings time, syncs conflicting another, or other gotchas. i know git , other version control system eschew syncing timestamps content based negotiation syncing approach. imagine such approach apps too, using uuid or hash of objects, both peers announce objects own, , exchange them until both peers have same sets. if knows advantages or disadvantages of content-based syncing versus timestamp-based syncing in general helpful well. edit - here of advantages/disadvantages have come timestamp , content based syncing. please

c# - Blocking functions in XNA -

i'm coding rpg engine in xna. engine executes series of scripting commands has block until next scripting command. how can this? for example: // interact npc named in string 'name' string interactfunc = string.format("{0}_interact", name); system.reflection.methodinfo info = factory.script.gettype().getmethod(interactfunc); if (info != null) info.invoke(factory.script, new object[]{this}); //this may run following script command npc 'bob' public void bob_interact(npc bob) { bob.say("well worked."); bob.say("didnt it?"); } //the command looks public void say(string text) { talkgui gui = new talkgui(this, text); factory.game.guis.add(gui); factory.focusedgui = gui; } now need script wait until first talkgui has been dismissed before running next script command. what's best way this? maybe run script functions in own thread or something? you don

java - What is "objectName" in Spring's ObjectError class? -

the class org.springframework.validation.objecterror has method getobjectname(), returns "the name of affected object". name? name of class? identifier someclass@732dacd1 ? ... for top-level objects, it's name supplied initiator of validation process. example: foo foo = ...; errors errors = new beanpropertybindingresult(foo, "myfoo"); errors.reject(...); // produces objecterror objectname = "myfoo" for nested object nested path, i.e. property name appended top-level object's name. in case of spring mvc databinding, top-level object name model attribute name.

javascript - JSON and Tumblr -

okay, i'm trying create "order posts type" using jquery json data... post types works in chrome, safari, ff. in ie, video / audio posts not display (perhaps embedding?) when filter through posts using json. does have clue what's going on?! here's code: <script> $('#order_by ul li').find('a').click(function() { var posttype = this.classname; var count = 0; bycategory(posttype); return false; function bycategory(posttype, callback) { $.getjson('{url}/api/read/json?type=' + posttype + '&callback=?', function(data) { var article = []; $.each(data.posts, function(i, item) { // = index // item = data particular post switch(item.type) { case 'photo': article[i] = '<div class="post_wrap"><div class="photo"><a href="' + item.url + '" title="view full post" class="type_icon"

Is it necessary to call EndInvoke in the callback from an EventHandler.BeginInvoke (C# .Net 3.5) -

i'm setting wcf client , server scenario needs reliable , scalable , part of i'm trying make multithreaded. admittedly don't have extensive multithreading experience. on client, callback server (in case "onmessage") fires client-side event should passed off in background. have client's callbackbehavior concurrencymode set single (at least, now). in order reply callback, rather calling handler normal (either handler(sender, eventargs, or handler.invoke...) i'm calling handler.begininvoke. everything works fine, in callback i'm wondering if need explicitly call endinvoke or if can nothing (here's lack of multithreading experience showing). public void onmessage(message message) { eventhandler<messageeventargs> handler = onservermessage; if (handler != null) handler.begininvoke(this, new messageeventargs(message), completehandler, handler); } public void completehandler(iasyncresult result) { ((eventhandler<mess

sql server - Background processing of Sql Queries -

i .net background , forwarded steps sql server. want know how statement works select x,y,z tbldemo x > what understand sql compiler [if any], compile right side first [just .net] , produce bit result, i.e. if x > something, produce true. after select x,y.z run , filtered clause. i asking question because want learn sql in same way know .net. might question sounds weird you. please let me know how know how sql working on these queries. this fascinating topic (to me @ least). article should you: http://blog.sqlauthority.com/2009/04/06/sql-server-logical-query-processing-phases-order-of-statement-execution/

winapi - Transparent PNG file in a Pure C++/Win32 Application -

i have pure c++/win32 vs2005 desktop application. during wm_paint response, when paint window, i'd able project transparent png image onto window. any pointer appreciated. gdiplus has been part of windows since windows xp @ least, , can decode jpeg, png , gif files ease. a newer api dealing image files windows image component . 1 of samples covers using wic decode image , gdiplus perform alpha aware painting.

mysql - Should I duplicate data in my DB? -

i have mysql db containing entry pages of website. let's has fields like: table pages: id | title | content | date | author each of pages can voted users, have 2 other tables table users: id | name | etc etc etc table votes: id | id_user | id_page | vote now, have page show list of pages (10-50 @ time) various information along average vote of page. so, wondering if better to: a) run query display pages (note heavy queries 3 tables) , each entry query calculate mean vote (or add 4th join main query?). or b) add "average vote" column pages table, update (along vote table) when user votes page. nico use database it's meant for; option far best bet. it's worth noting query isn't particularly heavy, joining 3 tables; sql excels @ sort of thing. be cautious of sort of attempt @ premature optimization of sql; sql far more efficient @ people think is. note benefit using option there's less code maintain, , less chance

Difficult with AutoPlay and AutoRun in Windows -

i feel pretty dumb @ moment, several days now, have been confounded autoplay , autorun features of windows. in essence, have developed software deployed via optical media (e.g., cd-rom, dvd-rom). in perfect world, our client wants user able pop in cd , off races. we have explained them actual autorun , autoplay features of windows subject individual user's settings on or computer. said, on own machine, have been unable detect , use "autorun.inf" file. the software installed using .msi file launched vbscript. because .vbs file not directly executable, wrote simple bootstrapper executable called setup.exe. here simple "autorun.inf" file: [autorun] open=setup.exe that's it. no big deal. if manually double-click setup.exe, proceeds expected. however, if copy of necessary setup files disc (real or virtual drive) , insert media, not have option in autoplay "install or run program..." i have tried tweaking system autoplay settings in

jquery - PartialView and unobtrusive client validation not working -

i'm using asp.net mvc3 rc , i'm using unobtrusive jquery validations described brad wilson on his blog . works great when send form (in ajax) server, server side validations , return same row (that included in partial view) if model state isn't valid. 2 problems : 1st : when return partialview in action, unobtrusive attributes aren't rendered. found "non elegant" way when it, client validations broken. after return action, if call jquery.validator.unobtrusive.parse() on updated row, $("form").valid() return true if it's not case. 2nd : want rendered view render string on server can send in jsonresult (ex: myjsonresult.html=renderpartialtostring("partialname",model) ). has reference, there's view (editinvitation) : <td> <%= html.hiddenfor(x=>x.id,new{id="id"}) %> <%= html.hiddenfor(x=>x.groupid,new{id="groupid"}) %> <%: html.textboxfor(x => x.name, new { id

database - PostgreSQL 9: could not fsync file "base/16386": Invalid argument -

i'm trying test small postgresql setup, cobbled quick local install. however, when i'm trying create personal db createdb, chokes on errors (notably, starts base/16384 first time, , increments each time run it). know what's going on here, or if there's trivial config missed cause this? thanks, , time-critical, please respond if know anything. thanks! updates: i'm running on centos 5 server, apologies don't have many further details (it's shared account on server). uname -a has following output: linux {omitted} 2.6.18-194.11.4.el5 #1 smp tue sep 21 05:04:09 edt 2010 x86_64 x86_64 x86_64 gnu/linux i installed postgresql source from: http://wwwmaster.postgresql.org/download/mirrors-ftp/source/v9.0.1/postgresql-9.0.1.tar.bz2 built in home directory , installed prefix=$home/local/pgsql. here's terminal readout me attempting create user's db on fresh data setup: [htung@{omitted}:~]$ killall postgres log: autovacuum launcher

ASP.NET DataGridView paging with server-sided paging -

i passing pagenumber , pagesize stored procedure, returns page of data. returns record count total number of records if returned of them @ once. generally, how hook datagridview enable paging? it seems expectation resultset contain complete dataset. many of properties expect able set, recordcount, appear read only. could give me general pointers? i created similar solution once, , adjusted gridview (not sure if mean datagrid or gridview) use server-side paging. code post here , since there's no option attachments here, can download code http://www.raskenlund.com/downloads/gridview.zip

jquery - rails, Chrome Error Message on AJAX request -

i'm making ajax request server, , keep getting error message in chrome: jquery-1.4.3.min.js:31uncaught syntaxerror: unexpected token < threadss:-1resource interpreted image transferred mime type text/html. i'm using rails 3. seen this?

MATLAB - multiple return values from a function? -

i'm writing 2 functions in matlab, initialize function , function insert items array treating doubly-linked list. however, initialize function returns "ans =" , initialized array. how can have set values of other variables? here's code: function [ array, listp, freep ] = initialize( size ) array = zeros(size, 3); listp = 0; freep = 1; end matlab allows return multiple values receive them inline. when call it, receive individual variables inline: [array, listp, freep] = initialize(size)

jQuery give response after an ajax request -

$(document).ready(function(){ $("form#fbox").submit(function(){ var msg = $("input#ibox").val(); $.get("foo.php", {m: msg}, function(data){ $('#display').html(data); }); return false; }); }); i have jquery script wherein creates post request "invisibly" after submitting form. not refreshing page. problem how can response of foo.php or rather put in foo.php give response? for example inputted 'hello' , how can display 'hi' on #display ? xd you have foo.php echo whatever content want go inside element corresponds #display -- no more, no less. work: echo 'hi';

python - How to find the set of entities more recent than the last one with children -

i have 2 sqlalchemy model objects designated thus: class specinstance(base): spec_id = column(integer, foreignkey('spec.spec_id')) details = column(string) class spec(base): spec_id = column(integer) spec_date = column(datetime) instances = relationship(specinstance, backref="spec", cascade="all, delete, delete-orphan") i looking query return spec objects have spec_date greater recent 1 instances. example, given objects these: spec(spec_id=1, spec_date='2010-10-01') spec(spec_id=2, spec_date='2010-10-02') spec(spec_id=3, spec_date='2010-10-03') specinstance(spec_id=2, details='whatever') i want query return spec 3. spec 2 ineligible because has instances. spec 1 ineligible because it's older spec 2. how do this? i'm not testing code since i'm pretty sure work , setting env overhead. in plain sql, 1 subquery. in sqlalchemy, subqueries created in manner: sq = session.

Passing around member functions in C# -

mostly comes handy c# delegates store object member function. there way, store -- , pass parameters -- member function itself, old pointer-to-member-function in c++? in case description less clear, give self-contained example. and, yes, in example insistence pass around member functions totally pointless, have more serious uses this. class foo { public int { get; set; } /* can done? public static int apply (foo obj, ???? method, int j) { return obj.method (j); } */ public static int applyhack (foo obj, func<int, int> method, int j) { return (int) method.method.invoke (obj, new object [] { j }); } public static readonly foo _ = new foo (); // dummy object applyhack public int multiply (int j) { return * j; } public int add (int j) { return + j; } } class program { static void main (string [] args) { var foo = new foo { = 7 }; console.write ("{0}\n", foo.applyhack

python - Get process name by PID -

this should simple, i'm not seeing it. if have process id, how can use grab info process such process name. under linux, can read proc filesystem. file /proc/<pid>/cmdline contains commandline.

jquery - how to make a function live -

i have enter function makes form submit on enter. problem form not exist until click button appends body. there way make $.enter function live? in advance suggestions. //submit function function submit_chatbox(){ alert('yo'); } $.enter('#message',submit_chatbox); jquery.enter = function(element,callback) { jquery(element).bind('keypress', function(event) { var code=event.charcode || event.keycode; if(code && code == 13) {// if enter pressed callback(event.target); event.preventdefault(); //prevent browser following actual href }; }); }; to make use .live() , this: jquery.enter = function(element,callback) { jquery(element).live('keypress', function(event) { var code=event.charcode || event.keycode; if(code && code == 13) {// if enter pressed callback(event.target); event.preventdefault(); //prevent browser following actua

java - Spring MVC and JSR 303 - Manual Validation -

i'm using spring mvc 3 , jsr 303. have form backing object has beans of different types in it. depending on request parameter value, i'll have choose bean validate , save. can't use @valid validation since bean validate not known until runtime. i able inject javax.validation.validator controller, i'm not sure how validate bean , store errors in bindingresult/error in "spring way". i need in handler method, rather initbinder method, because of request mapping. [edit] the problem i'm having validate(object, errors) doesn't recognize nested beans. bean validate accessed through foo.getbar().getbean(), foo form backing object. when validate(foo.getbar().getbean(), errors) , following error message. jsr-303 validated property 'property-name' not have corresponding accessor spring data binding has done before? thanks. just guess, have tried errors.pushnestedpath("bar.bean"); // path nested bean validate(fo

android - Center two buttons horizontally -

i try arrange 2 buttons (with images on them work fine) next each other , center them horizontally. that's have far: <linearlayout android:orientation="horizontal" android:layout_below="@id/radiogroup" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center"> <button android:id="@+id/allow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/radiogroup" android:layout_gravity="center_horizontal" android:drawableleft="@drawable/accept_btn" android:text="allow"/> <button android:id="@+id/deny" android:layout_width="wrap_content" android:layout_height="wrap_

sqlite - Updating prepopulated database in Android -

i lost last 3 hours trying this. im making app ship db filled populated tables not change on clients devices. managed putting in assets folder , copying stream of bytes appropriate data folder on phone. problem when wish update database, cant work. delete db in data folder on phone (from code), copying new database fails, or copied db has appropriate size no tables in it. how this? or there simpler way? can open db directly assets (it simplest way if can, cant find how access path assets code)? here code using: public class databasehelper extends sqliteopenhelper { private static final string db_path = "/data/data/com.project.mydb/databases/"; private static final string db_name = "mydb.db"; private static final string db_table = "words"; private static final int db_version = 6; private static final string tag = "databasehelper"; int id = 0; random random = new random(); private sqlitedatabase myda

RSS feeds in new twitter -

does know find rss feeds in new twitter? cannot find rss icon , source of page points "your twitter favorites" though on page of user want rss feed from... simple know, bugging me no end! 2014 edit: it looks twitter has retired rss feeds, , exports data json: what output formats api v1.1 support? api v1.1 support json only. we’ve been hinting @ time now, first dropping xml support on streaming api , more on trends api. xml, atom, , rss infrequently used today, , we’ve chosen throw our support behind json format shared across platform. consequently, we’ve decided discontinue support these other formats. historical context, when built api major languages did not have performant, vetted libraries supporting json - today do. orignal 2010 answer: here various feed urls (using account "twitter" these examples): http://twitter.com/statuses/public_timeline.rss http://twitter.com/statuses/user_timeline/twitter.rss http://tw

iphone - TTXMLParser Sample Code? -

is famaliar how use ttxmlparser. can't find documentation or sample code on it. is sax or dom? does support xpath? can extract cdata elements? i have application uses several three20 modules shame have use parser. the main documentation i've found ttxmlparser in header file . comment there gives overview of ttxmlparser does. ttxmlparser shouldn't thought of xml parser in way thinking of -- in sense, questions such "is sax or dom" , "does support xpath" aren't directly applicable. instead, think of ttxmlparser convenience class take xml , turn tree of objective-c objects. example, xml node: <mynode attr1="value1" attr2="value2" /> would turned objective-c nsdictionary node mapped key "attr1" value "value1" , key "attr2" key "value2". ttxmlparser internally uses nsxmlparser (which sax) build tree, you, user of ttxmlparser, don't have sax-like stuff.

sql - How can I return a row if its ID is not found in another table? -

i have 2 tables in ms sql 2008 database, listings , listingtype, want create select statement give me rows listing not have listingid in listingtype table. i'm confused how start statement. example sql statement - lot more explained, should able i'm asking it. select listing.title, listing.mls, coalesce (pictures.pictureth, '../default_th.jpg') pictureth, coalesce (pictures.picture, '../default.jpg') picture, listing.id, listing.description, listing.lot_size, listing.building_size, listing.bathrooms, listing.bedrooms, listing.address1, listing.address2, listing.city, locations.abbrev, listing.zip_code, listing.price, listing.year_built, listingtypematrix.listingtypeid listing inner join locations on listing.state = locations.locationid left outer join listingtypematrix on listing.id = listingtypematrix.listingid left outer join pi

Python string replace for UTF-16-LE file -

python 2.6 using python string.replace() seems not working utf-16-le file. think of 2 ways: find python module can handle unicode string manipulate. convert target unicode file ascii, use string.replace(), convert back. worry may cause loss data. can community suggest me way solve this? thanks. edit: code looks this: infile = open(inputfilename) s in infile: outfile.write(s.replace(targettext, replacetext)) looks loop can parse line correct. did make mistakes here? edit2: i've read python unicode tutorial , tried below code, , worked. however, wondering if there's better way this. can help? thanks. infile = codecs.open(infilename,'r', encoding='utf-16-le') newlines = [] line in infile: newlines.append(line.replace(originaltext,replacementtext)) outfile = codecs.open(outfilename, 'w', encoding='utf-16-le') outfile.writelines(newlines) do need close infile or outfile? you don't have unicode file. there

asp.net mvc 2 - MVC2 Entity Framework - Update Model -

first of all, developer on planet attempting use mvc vb? have searched tons of forums , read many posts , asks question gives example in c#. anyway, i've got out of way, i've got simple database table (user) columns (userid, username, firstname, lastname). using entity framework , on edit view, i'm changing value (username) , clicking save. in edit http post, tell return index , value not saved. although, in constructor http post, return object , shows new value...but value doesn't make db...any help? my controller: function edit(byval id guid) actionresult 'get user dim usr = (from u in db.users u.userid = id select u).single return view(usr) end function <httppost()> _ function edit(byval id guid, byval usrinfo user, byval formvalues formcollection) actionresult ' dim usr user = db.users.single(function(u) u.userid = id) if modelstate.isvali

java - Debugging maven tests with netbeans? -

i'm trying debug maven tests in netbeans 6.9.1. know how go doing this? reason ask because if run tests using maven, pass. however, if debug tests using netbeans (right click test class -> debug test file) tests fail because have surefire set handle tests, , netbeans seems use own test runner. noticed surefire has debug option, how go using netbeans, i.e. have stop on breakpoints in netbeans? thanks help. i not sure that: but may try with... pom.xml <project> ... <!-- <scope>test</scope> --> <!-- jus comment out line , try --> ... -saligh

In jQuery, does it make sense to add selector context when specifying the ID? -

i found piece of code in jquery plugin: $("#"+id,$t.grid.bdiv).css("display","none"); the second parameter $() changes context of search, right? still make sense include it, since line searching id? doesn't jquery search whole document when specifying id? update: @casablanca - sure calls native getelementbyid() ? because changed line document.getelementbyid('id').style.display = "none" , performance became faster (since line inside loop). tested using ie8 way. it seems necessary. did quick test here anyway. finding is, jquery (unsurprisingly) doesn't care #id unique or not. in code: alert($("#test", ".test2").html()); this returns within test2 , correct, , if put: alert($("#test").html()); i.e. without context, returns within test1 what guessing reason behind plugin writer mentioned, prevent used plugin , accidently use same id 1 using there. ensures no matter type i

how to use dictionary two way in c# -

public static dictionary<int, string> dic = new dictionary<int, string>() { {1,"anystring1"}, {2,"anystring2"}}; i need use this string str= dic[1]; // possible int a=dic["anystring1"]; // dream that not dictionary meant do. can think of definition , instantly find matching word in favorite dictionary in o(1) time? if want class type of functionality (a bidirectional dictionary) have build (or google 1 of many implementations on internet).

syntax - Why c functions can be defined this way? -

possible duplicates: what useful c syntax? what strange function definition syntax in c? static void add_shopt_to_alist (opt, on_or_off) char *opt; int on_or_off; { ... } what's syntax : (opt, on_or_off) char *opt; int on_or_off; ?

asp.net - ffmpeg fails to convert an uploaded video file whose size greater than 14mb when executed through c#.net -

i converting videos flv using ffmpeg.exe through c# , process gets stuck , conversion fails if file size exceeds 14mb . i've tried run ffmpeg directly through command prompt , works fine regardless of size . my conversion code follows: outputfile = savepath + "swf\\" + withoutext + ".flv"; filargs = string.format("-i {0} -ar 22050 -qscale 1 {1}",inputfile,outputfile); process proc; proc = new process(); try { proc.startinfo.filename = spath + "\\ffmpeg\\ffmpeg.exe"; proc.startinfo.arguments = filargs; proc.startinfo.useshellexecute = false; proc.startinfo.createnowindow = false; proc.startinfo.redirectstandardoutput = true; proc.startinfo.redirectstandarderror = true; proc.start(); string stdoutvideo = proc.standardoutput.readtoend(); string stderrvideo = proc.standarderror.readtoend(); } { proc.waitforexit(); proc.close(); } when tried manually stop running process stde

php - How to print text to an existing pdf file? -

i have created new pdfs many times using zend , php. have patient form in pdf format , have fill form using application. how can print text on existing pdf file have text. possible ? thanks i haven't done it, seems possible. see zend_pdf::load() , example. seems ought able load pdf, manipulate it, , save save somewhere. last time had this, zend_pdf wasn't around, , ended using fpdf/fpdi , ugly worked fine.

java - How to use XSLT recursion to convert any xml data to a html table view: -

for given xml, need generate html table represent values in xml. need recursion keyn, if valuen text print it. if valuen xml, print (nested)table it's value. think lack of understanding of how use xslt recursion correctly base of question. appreciated. input: <root> <key1> text value </key1> <key2> <a> aaa </a> <b> bbb </b> </key2> <keyn> valuen </keyn> <root> output: <table border="1px"> <tr> <td> key1 </td> <td> text value </td> </tr> <tr> <td> key2 </td> <td> <table border="1px"> <tr> <td> </td> <td> aaa </td> </tr> <tr> <td> b </td> <td> bbb </td> </tr> </table> </td> </tr> <tr>