Posts

Showing posts from July, 2012

How to allow desktop applications to invoke methods on a Java application on the same machine -

so i'd able allow other applications residing on same machine call java application. the call either launch app if not running , invoke method or invoke method. ideally communication should language independent calling application written in language. has done before , can suggest things explore/avoid? thanks i'd use tcp , make application daemon. if want application easy other platforms integrate with, should use text based protocol define suit needs. and avoid xml if don't need transport complex structures. (i'd go json if need more complex data transfer). if new socket programming, might help: http://download.oracle.com/javase/tutorial/networking/sockets/

asp.net mvc - Routes not found or constructed incorrectly -

the following routes definition global.asax.cs: routes.add( new namedtypedroute( "feedback-en", routetype.regular, "{culture}/feedback", new routevaluedictionary( new { culture = "en", controller = "feedback", action = "index" } ), null, new multilingualmvcroutehandler() ) ); routes.add( new namedtypedroute( "feedback-sl", routetype.regular, "{culture}/kontakt", new routevaluedictionary( new { culture = "sl", controller = "feedback", action = "index" } ), null, new multilingualmvcroutehandler() ) ); if in view <%: html.actionlink("sl", "feedback-sl")%> | <%: html.actionlink("en", "feedback-en")%> the constructed url points root site (no controller/action information included in constructed link

jquery ajax with async false hangs firefox -

i have code calls $.ajax : $.ajax({ type: "post", url: "/sandbox/graphloader/mock3", async: false, data: {calinput1:dates[0], calinput2:dates[1]}, success: function(data){ data=eval(data); for(var x in data[0]){ //alert(data[0][x]); //fill columns here; } fillpercents(column); }}); now, works in browsers, other firefox. firebug shows getting reply post, unknown error, not displaying data. might problem ? this behavior design. never use async: false . since javascript runs on ui thread, async: false request freeze browser until server replies.

html - What does the (#!) in Twitter URLs do? -

possible duplicate: what's shebang (#!) in facebook , new twitter urls for? what (#!) in twitter urls do? example: http://twitter.com/#!/search/stackoverflow that way make ajax applications crawlable. check out: making ajax applications crawlable

Catastrophic Assertion Failure on Blackberry Simulators with BlackBerry versions 5.0 or above -

using blackberry java plug-in eclipse me , team mate installed blackberry jdks version 4.7, 5.0, 6.0. when comes running project, serious error. if build project version 4.7 runs alright existing simulators.but when build project version 5.0 or 6.0 simulator doesn't start properly. it starts , shows error "catastrophic assertion failure" , closes automatically. same error comes existing simulators 8900, 8520, 9550, 9700(for version 5.0) , simulators 9800(for version 6.0) .only 1 simulator 9630 works blackberry version 5.0 damn damn slow when attached debugger.i have uninstalled , reinstalled stuff still same problem. my project should written in version 5.0 coz needs database api.but not able run it.my team mate has got none of errors mine.the jdk working fine.i have compared settings in system mine still same issue.i have fix bug @ cost. these version details running in system. java version 6 update 22 blackberry java plug-in: 1.1.2.201004161203-16 b

django variable in template -

i m passing varible view ,to template. when m printing {{ subject.i.id }} not working. plz asap. thanks. # view return render_to_response( 'feedback/feedback.html', {'subjects': subject_list, 'n': n, 'list': sub_list, 'i': 0}, context_instance=requestcontext(request)) # template {% s in list %} <div id="{{ subjects.i.id }}"> {% subject in s %} <div> {{ subject }} </div> {% endfor %} </div> {% endfor %} you need template filter work my template filter similar case: import re django import template django.conf import settings numeric_test = re.compile("^\d+$") register = template.library() def getattribute(value, arg): """gets attribute of object dynamically string name""" if hasattr(value, str(arg)): return getattr(value, arg) elif hasattr(value, 'has_key') , va

javascript - Get onclick string with jQuery -

i had extract 2nd parameter (array) onclick attribute on image, jquery returned function onclick , not string value expected. had use native method. quick search says may work browsers ff, not ie. use chrome. <img src="path/pic.png" onclick="funcname(123456,[12,34,56,78,890]);" /> i thought work, it not : var div = $('div_id'); var onclick_string = $(div).find('img').eq(0).attr('onclick'); var onclick_part = $(onclick_string).match(/funcname\([0-9]+,(\[.*\])/)[1]; // reason \d doesnt work (digit) this works var div = $('div_id'); var onclick_string = $(div).find('img')[0].getattributenode('onclick').value; var onclick_part = $(onclick_string).match(/funcname\([0-9]+,(\[.*\])/)[1]; // reason \d doesnt work (digit) is there way of getting 2nd parameter ? why not store in data property? <img src="path/pic.png" onclick="funcname(123456);" data-mydata='12,34,56,7

silverlight 4.0 - How to add child control to Grid in specific position in code? -

suppose define grid in xaml like: <grid x:name="layoutroot" background="white"> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="*"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="*"/> </grid.columndefinitions> </grid> then want add child control grid in column=0, row = 1 in code behind. how implement it? quite late response here go: grid.setrow(yourcontrol, 1); grid.setcolumn(yourcontrol, 1); grid.setrow(othercontrol, 0); grid.setcolumn(othercontrol, 0); the first parameter control you've added grid. second parameter column/row position want add to.

c - OpenGL on Linux: dlopen libGL.so -

most applications (and libraries) using opengl on linux load libgl.so @ runtime using dlopen api, instead of dynamically linking against it. why this? the reason can imagine it's because graphic driver vendor provides different libgl , , 2 different libgl abi incompatible. (well, hum, why should abi incompatible? , if are, why loading them via dlopen fix issue?) anyway, supposing there's reason doing that, i'd well. have link opensource c/c++ code loads opengl functions via dlopen , can include project without needing many tweaks? there 2 main reasons people this: you can give sensible error systems don't have opengl vendors offer many different extensions , sane way support multiple sets of extensions without different binaries per vendor use dlsym check them. glew offers nice way of doing though.

java - Hibernate Validator, custom ResourceBundleLocator and Spring -

i'm trying override default resourcebundlelocator in hibernate validation 4.1. far works perfectly, examples of usage include java code instantiate validationfactory. when using web application spring hibernate validation automatically configured (only suitable hibernate validation *.jar file should exist , automatically used). how can substitute resourcebundlelocator in scenario? not see way of specyfing custom resourcebundlelocator in properties or applicationcontext.xml file. the magic method required job localvalidatorfactorybean#setvalidationmessagesource(messagesource messagesource) . first of all, contract of method:- specify custom spring messagesource resolving validation messages, instead of relying on jsr-303's default "validationmessages.properties" bundle in classpath. may refer spring context's shared "messagesource" bean, or special messagesource setup validation purposes only.

java - is spring framework 3.0 type-safe -

in question asked, raised concern spring framework not type safe. true, or fixed, , can give example means exactly? first of all, "type-safe" mean dependency injection framework. can think of can bean context specifying type, , not bean name. spring 3 allows this. otherwise, type-safety means when can define dependencies type. , can in versions of spring. another thing compile-time safety. spring pre-3.0 when had differentiate between 2 beans share same interface (or supertype) using string-based name. in spring 3.0 can use annotation-based qualifiers (using javax.inject.qualifier ), compile-time safer well. another thing mention use of generics. can have, example @inject list<myservice> in spring.

uinavigationcontroller - core-plot and navigationController -

i using core-plot sdk , trying plot bar chart. i have rootviewcontroller extends uinavigationcontroller, , adding viewcontroller render barchart, here code rootviewcontroller.m - (void)viewdidload { [super viewdidload]; barchartviewcontroller = [[barchartviewcontroller alloc]init]; [self pushviewcontroller:barchartviewcontroller animated:no]; } barchartviewcontroller.m - (void)viewdidload { [super viewdidload]; self.title =@"barchart"; self.navigationcontroller.navigationbar.tintcolor = [uicolor colorwithred:0.4 green: 0.8 blue:0 alpha:1]; self.navigationitem.title = @"barchart"; // , creating barchart , rendering it, works fine. } here navigationbar doesn't appear , title navigationbar. , following code barchartviewcontroller.m -(void)barplot:(cpbarplot *)plot barwasselectedatrecordindex:(nsuinteger)index{ nslog(@"barwasselectedatrecordindex %d", index); detailviewcontroller *detailviewcontroller =

php - Unexpected T_String -

unset($item_row); $item_row = array(); if ($row[1] == "bcp-prod1"){ $row[1] = "bcp-product1"; $item_row['nid'] = 71; $item_row['title'] = 'product1 - title'; } elseif ($row[1] == "bcp-sillyneck"){ $row[1] = "bcp-prod2"; $item_row['nid'] = 77; $item_row['title'] = 'products2 - title 2'; } the error getting is: parse error: parse error, unexpected t_string in import_orders.php on line 89 line 89 $item_row['nid'] = 71; must looking on cause not seeing causing this? the issue because have unclosed single quote ( ' ) somewhere before line. try use syntax-highlighting editor on. it'll debugging since kind of error apparent...

Custom Windows Control library in C# -

Image
how can implement small task features in own custom windows control library below? you need create own designer control. start adding reference system.design. sample control this: using system; using system.windows.forms; using system.componentmodel; using system.componentmodel.design; using system.windows.forms.design; [designer(typeof(mycontroldesigner))] public class mycontrol : control { public bool prop { get; set; } } note [designer] attribute, sets custom control designer. yours started, derive own designer controldesigner. override actionlists property create task list designer: internal class mycontroldesigner : controldesigner { private designeractionlistcollection actionlists; public override designeractionlistcollection actionlists { { if (actionlists == null) { actionlists = new designeractionlistcollection(); actionlists.add(new myactionlistitem(this)); } retur

winforms - Change size of ToolStripMenuItem -

i'm custom drawing menu item in menustrip . problem i'm having menu item insists on sizing based on text, not want (there no text). can set autosize false , explicitly specify size, containing menu ( toolstripdropdown ) still sizes based on text, causes small contain entire menu item. is there straightforward way set size of menu item? it can achieved adding empty image toolstripitem . change size of image give desired size toolstripitem . have done in project below: using system; using system.collections.generic; using system.drawing; using system.windows.forms; public partial class form1 : form { public form1() { bitmap emptyimage = new bitmap(48, 48); toolstripmenuitem m_item = new toolstripmenuitem(system.convert.tostring("all programs",emptyimage); m_item.imagealign = contentalignment.middleleft; m_item.imagescaling = toolstripitemimagescaling.none; m_item.name =

c# - Insert multiple row using the same MySQL connection? -

i wondering how can insert multiple rows mysql database using 1 connection instead of opening , closing multiple connections. data being inserted coming string[] used foreach loop each value. here current non-working c# code: string[] tempfin = table.split(','); string username = null; connection.open(); foreach (object hope in tempfin) { command.commandtext = "insert atable (tried, username) values" + "('" + hope + "','" + username + "')"; command.executereader(); } connection.close(); i open , close connection in foreach loop has been proven unreliable me when inserting large amounts of rows, there way insert multi rows using 1 connection in c#? update: never mind, found problem. using command.executereader() instead of command.executenonquery() the code posted using only one connection. suggest use parametrized query instead 1 using. why isn't code working? can update question error

javascript - What is this assignment construct called? And can you do it in Php? -

i have used following construct in javascript: var foo = other_var || "default_value"; in javascript, if left side falsy, value on right side assigned. it handy, , saves writing longer , unnecessarily explicit ternary expressions. is there name sort of construct ? bonus: there trick in php without using ternary operator? ps: variant throw error if don't truthy value, instead of giving default value: var foo = || alert("foo not set!"); the logical-or (usually || ) operator drastically different in many languages. in (like c, c++ ) works like: "evaluate left-hand side; if it's true, return true, otherwise evaluate right hand-side , return true if it's true or false otherwise." result boolean here. in others (like javascript, python , believe php also) it's more like: "evaluate left-hand side; if it's true, return it, otherwise evaluate right-hand side , return result." result can of type , can co

C program calling shell script -

i have small c program calling shell script myscript.sh. getting value of ret 256. please me in knowing went wrong system call? int main() { int ret; ret = system (myscript.sh); ret >>= ret; if (ret != 0) { printf("ret [%d]",ret); } } working on 64 bit unix operating system , using ksh shell the way system function works on *nix calls fork , child calls 1 of exec functions /bin/sh -c , string passed system in child, turns child process instance of /bin/sh program runs command. parent calls 1 of wait functions, waits /bin/sh exit, same exit status shell script, , system returns value. if @ man pages wait system call(s): main 3 wait you should information gets returns , macro functions make sense of it. the wifexited(stat_val) macro can used test if program exited opposed signal. normal exits involve calling exit system call. if function returns non-zero value can use wexitstatus(stat_val) macro value returned. the wifsigna

ms access - SQL Help : Update a field -

i have 2 tables course , course1 both tables have fields called name , id. table course's id field null. need update course table's id field id of course1, both tables related name field. i using access. thanks prady update [course 1] inner join [course] on course.name = [course 1].name set [course 1].id = [course].id;

javascript - IE8 not displaying images (red x) ... sometimes -

i'm going mad following problem not happen on other browser (chrome, firefox): ie8 cache cleared browser starts opens html/javascript page requests , creates few images dynamically. html page served tomcat server localhost:8084. most of time out of 10 images requested ie displays red x. developer image report (f12) shows images "file size" correct # bytes, yet image still not displayed, or images file size "unknown bytes" , image doesn't work. sometimes 2-4 out of 10 images show , rest fail! sometimes in mad fury of hitting refresh 1 billion times, images show up. the real kicker when put break point in http server, socket isn't opened. ie isn't attempting fetch images server before failing. and if run same code request image somewhere google maps, works in ie without problems. here's javascript code: <script type="text/javascript"> var ctr = 0; function getimage(url) { var img = document.c

bash completion of makefile target -

suppose have simple makefile like: hello: echo "hello world" bye: echo "bye bye" then in bash want like: make h < tab > so can complete to make hello i found simple way creating empty files hello , bye i'm looking more sophisticated . could you're looking for? http://freshmeat.net/projects/bashcompletion/ make [tab] complete on targets in makefile. project conceived produce programmable completion routines common linux/unix commands, reducing amount of typing sysadmins , programmers need on daily basis.

html - Multiple file upload with md5 check before upload -

i building webpage need multi-file upload implementation can hash file before uploading server. the idea users can upload files may or may not exist on server already. save bandwidth want hash file before uploading server, send hash via post, , proceed upload if server responds not have file hash. are there free flash-based implementations (i suppose javascript won't able load file , hash it) may work me? you can read files in javascript, filereader api in html5 job you. next, feed base64 string b64_md5() function provided library: http://pajhome.org.uk/crypt/md5/instructions.html note time consuming if file big. might need webworkers conculation background.

javascript - asp problem, expected '(' -

i error when viewing page in internet explorer webpage error details message: expected '(' line: 152 char: 4 code: 0 <script>/* <![cdata[ */qmad.mwidths=new object();if(qmad.bvis.indexof("qm_mwidths_a(b.cdiv,o);")==-1)qmad.bvis+="qm_mwidths_a(b.cdiv,o);";;function qm_mwidths_a(sub,item){var z;if((z=window.qmv)&&(z=z.addons)&&(z=z.match_widths)&&!z["on"+qm_index(sub)])return;var ss;if(!item.settingsid){var v=item;while((v=v.parentnode)){if(v.classname.indexof("qmmc")+1){item.settingsid=v.id;break;}}}ss=qmad[item.settingsid];if(!ss)return;if(!ss.mwidths_active)return;if(qm_a(item.parentnode)){var t=0;t+=qm_getcomputedstyle(sub,"padding-left","paddingleft");t+=qm_getcomputedstyle(sub,"padding-right","paddingright");t+=qm_getcomputedstyle(sub,"border-left-width","borderleftwidth");t+=qm_getcomputedstyle(sub,"border-right

sql server - Read and Write data from/to BLOB in MS SQL using Visual C++ and OLE DB -

ca me? looking example how insert , data blob in ms sql server 2008. using ole db , visual c++. thanks there's detailed info on topic (the write side anyway) here: sending blob data sql server using irowsetfastload , isequentialstream . most of available samples simplistic , don’t demonstrate varying data length per row or using isequentialstream. in sample, you'll see both techniques in 1 source file. default, sample shows how use irowsetfastload send variable length blob data per row using in-line bindings. in case, in-line blob data must fit in available memory. method has better performance when blob data few bytes few mb, because there no additional stream overhead. larger data, data not available @ once in block, streaming better choice. for readback there background , sample code on msdn here . the sql server native client ole db provider not retrieve large data sql server until requested consumer. con

linq to entities - Asp.net dynamic controls from l2e -

g'day, have aspx page has html stored in sql server 2008 table uses linq entities retrieve & display in placeholder on page. displays correctly except asp button not display. viewing source of page shows button there not on page. page = page.replace("!loginbutton!", "< asp:button id='login' text='login' runat='server' />") how display? thanks. whatever code replacing !loginbutton! .aspx code. not pure html display button. when asp.net render page asp:button converted html <input type="button" ..... appropriate javascript functions(for postback). in case if want see button postback event need write page = page.replace("!loginbutton!", "&lt; intput type='button' id='login' text='login'/&gt;") i hope work.

logging - PHP - measuring database time for a HTTP request -

i want find how time php http request spends in database. rails logger prints out such information (how time spent on rendering, database , app). example: completed in 0.01224 (81 reqs/sec) | db: 0.00044 (3%) | 302 found [http://localhost/posts] is there similar php too? thanks in advance. you can use microtime() , memory_get_usage() test speed memory used (which more important orm's). $time = microtime(true); $memory = memory_get_usage(); ...code here... print (microtime(true)-$time). ' seconds , '. (memory_get_usage()-$memory). ' bytes'; however, database queries should benchmarked @ database level. use mysql query profiler real benchmarking.

sql - Reading most recent values in a join without performing a nested SELECT -

Image
in interest of eliminating many nested queries possible, i'm trying optimize following query: select fp.id, fp.user_id, count(c.id) num_replies, c2.created latest_activity_time, c2.user_id latest_activity_user_id forum_posts fp left join comments c on c.object_id = fp.id left join (select created, user_id comments order created desc limit 1) c2 on fp.id = c2.object_id fp.deleted != 1 group fp.id sorry if find errors...i tried whittling query down relevant parts , might have made mistake somewhere in process so basically, have here table of forum posts , table of comment replies posts. each forum post can have multiple replies. first join used counting total number of replies, , second join used recent reply's information. query this: so, i'm trying figure out how can without having resort nested query. guys can provide extremely useful. thanks! edit : i've adjusted query

Ruby: format number of seconds to formatted time -

possible duplicate: can ruby print out time difference (duration) readily? i have length of time stored number of seconds. there way format either hh:mm format or human readable, such '2 hours, 15 minutes'? easiest adapt code used in rails function: http://apidock.com/rails/actionview/helpers/datehelper/distance_of_time_in_words

php - Getting upload file size before upload -

when user selects file uploaded, there way can exact size of file before upload begins? i'm guessing needs done on client side jquery or javascript. ideas how? this cannot done in pure javascript in current browsers. instead, can use uploadify , uses flash. in non-ie browsers , can use html5 read files on client .

MySQL replication and Django FileField -

i have mysql replication setup, , replicates nicely database data. however, use filefield , imagefield, , have file loaded onto fs. use rsync manually replicate this, there better way? i know of key value storage. project, looking minimize number of technologies involved , stick simple options. i've used rsync before, wondering if others have done have new cool tools (or rsync wrappers) work better. your experiences appreciated. i haven't searched see if has done this, can write own code in django remotely copy file goal server (i.e. sftp). option 1 on front: create own form field extends image , file field uploading. option 2: in form/view, call additional function uploading. option 3: override in django code handle automatically image , file fields (probably not recommended, unless there slick way i'm not thinking of). here's info on using sftp in python: sftp in python? (platform independent) if you're using amazon's cloudfront or buc

Does drupal can set the minimum resolution for upload image? -

i want know drupal can set minimum resolution uploaded images? i found solution set maximum resolution uploaded images. thanks in advance. what using? i have filefield , imagefield modules , can set both minimum , maximum resolution (they're 1 after other in manage fields panel).

add application in windows services -

i want add mysql in windows service list... used commnad line sc create mysql binpath="d:\pentaho\mysql\bin\mysqld.exe" type=share start=auto but doesn't create service in list...how can add mysql in services list this link in installing mysql windows service http://dev.mysql.com/doc/refman/5.5/en/windows-start-service.html

asp.net - Something not quiet right with my linq statement binding to a listview -

i trying bind grouped linq statement asp.net listview. problem when result been returned list view result this. system.linq.enumerable+whereenumerableiterator 1[transactiondetail] 20.5 system.linq.enumerable+whereenumerableiterator 1[transactiondetail] 7.3 my code nothing special list<transactiondetail> transactions = new list<transactiondetail>(); transactions.add(new transactiondetail { purchasedate = datetime.now, transactionamount = 2, transactionid = 1, ispurchase = true }); transactions.add(new transactiondetail { purchasedate = datetime.now, transactionamount = 2.2, transactionid = 2, ispurchase = true }); transactions.add(new transactiondetail { purchasedate = datetime.now, transactionamount = 2.9, transactionid = 3, ispurchase = false }); transactions.add(new transactiondetail { purchasedate = datetime.now, transactionamount = 4, transactionid = 4, ispurchase = true }); transactions.add(new transactiondetail { p

cross browser - Want to reverse the order of click events attached to one element in jquery -

i have 1 scenario want change order of click events attached 1 element. using jquery 1.3.2, used following code reverse order of events $("#button").bind('click',first); var foo = $.data( $('#button').get(0), 'events' ).click; var firsthandler; $.each( foo, function(i,defination) { firsthandler = defination; $('#button').unbind('click', defination); }); $("#button").bind('click',second); $("#button").bind('click',firsthandler); function first() { alert("first"); }; function second() { alert("second"); }; this code works in other browsers(ff, ie, safari) not working expected in chrome. here online version of code please have working code @ online fiddle can guide me ? you can reverse clicks taking .clicks array, copying before removing it, unbinding clicks, re-binding in reverse order, this: var clicks = $('#button').data('events').cl

SQL performance ( MySQL ) -

i have tabel, create table `forum_rank` ( `id` int(11) not null auto_increment, `user_id` int(11) not null default '0', `rank` int(11) not null default '0', `forum_id` int(11) not null default '0', primary key (`id`) ) engine=myisam auto_increment=2 default charset=latin1; now ask perfome best, * or alle felt 2 eg. select * form forum_rank; or select id, user_id, rank, forum_id forum_rank; you should explicitly specify columns. otherwise database engine first have find out table's columns (resolve * operator) , after perform actual query.

junction - List Hard Links of a file (in C#) -

i want write program shows files of other drive hard links. want keep both hardlinks consistent in filename , other things have function/method can list current hard links of file. so example: i have file c:\file.txt , second hard link d:\file.txt. rename d:\file.txt d:\file_new.txt. want able rename hardlink on c drive well. need function returns d:\file_new.txt there following hardlinks: c:\file.txt d:\file_new.txt can rename hard link on c:\ d:\file_new.txt so need hard links of physical file. or: hard links of file addressed hard link. hope can help! edit: oliver noticed hard links can't used on differnt disks. thanks... extend question to: need? junction points? symbolic links? should work files not folders! the following code should work (originally postet peter provost on powershell code repository): using system; using system.collections.generic; using system.io; using system.runtime.interopservices; using system.text; using microsoft.win32.s

java - JPA relations and polymorphism -

i have following class structure (details omitted clarity): for example: @entity class a{ @onetomany private list<b> b; @onetoone private c c; } interface b { } @entity @inheritance abstract class babstract implements b { } @entity @primarykeyjoincolumn class b1impl extends babstract { } @entity @primarykeyjoincolumn class b2impl extends babstract { } i want load b's belonging c. class relates b c. b , c unaware of each others existence , keep way. don't know actual implementing type of b , don't care because use abstract data type b (the interface). implementation can vary on time, example, new implementation of b can added in future in new release. is possible jpa , how do that? can't use targetentity attribute, if i'm correct, because don't know implementing class , don't care. b polymorph. jpa doesnt work interfaces. need make b @ least abstract class entity annotation. can make b totally empty abstract class (exce

Database schema design for MySQL, suggestions? -

so, have chance first "real" database, thinking myself should think about... suggestions? select db (using mysql) select db engine based on needs (using mysql, know myisam vs innodb) create table documention db using column definition (select right datatype) model data normalized referential integrity: primary key (natural or surrogate); composite keys; foreign key which leads me main question, how know if database success @ fit enough? as listing general questions need answered in order go idea working system i'll propose important organize them into 1) logical design (get clean model represents problem space trying model) 2) physical design (which rdbms , storage engine, exact data types, other practical , performance related decisions) you doing of mixing between two. when clean logical model , know relationships between entities modelling physical modelling not hard. edit: there many books deal steps of logical data design, try to:

dependency injection - Castle Windsor cannot find System.Messaging -

i realise question similar this one , unfortunately doesn't quite solve problem. i have console app following in castle config section: <component id="legacymessageformatter" service="system.messaging.imessageformatter, system.messaging" type="msmqlogprocessor.core.services.legacymessageformatter, msmqlogprocessor.core"/> i got exception "the type name system.messaging.imessageformatter, system.messaging not located." when newing windsorcontainer so: var container = new windsorcontainer(new xmlinterpreter()); i've set copy local true on system.messaging. works when hit f5. however, when publish console app , run on production box same issue. cannot see system.messaging dll in applicationfiles folder after install, presumably because thinks it's in gac. i've tried copying dll folder, still no joy. any ideas i'm missing? idea specify system assembly service? try using qual

hibernate - jquery struts2 grid column editable="false" is not passed to server -

i created grid using jquery struts2 grid plugin. have grid column primary key of table set non-editable. when try edit 1 of rows of table in grid, key column not passed server. tried setting editable attribute of key column true that's time sent key server. in showcase, id set non-editable server receives parameter. kindly me out on this. might missing something. here code jsp: <s:url id="adm201_grid" action="adm201grid"> <s:param name="bomid" value="%{bom.bomid}"/> </s:url> <s:url id="adm201_edit_grid" action="adm201editgrid"> <s:param name="bomid" value="%{bom.bomid}"/> </s:url> <s:url id="select_material" action="select_material"/> <sjg:grid gridmodel="gridmodel" caption="bill of materials" href="%{adm201_grid}" datatype="json" pager="true" navigator="true&qu

java - How to know the values of every DataSet on JfreeChart Mouseover or Mouse Click envent -

i want know how can know values of curve(dataset) when standing on over xyplot. i've implement code kwnoing values of scale on axis: int mousex = event.gettrigger().getx(); int mousey = event.gettrigger().gety(); point mousepoint = new point(mousex, mousey); // convert java2d coordinate axis coordinates... chartrenderinginfo chartinfo = chart.getchartrenderinginfo(); point2d java2dpoint = chart.translatescreentojava2d(mousepoint); plotrenderinginfo plotinfo = chartinfo.getplotinfo(); rectangle2d panelarea = chart.getscreendataarea(mousex, mousey); double yy = math.round(plot.getrangeaxis().java2dtovalue( mousepoint.gety(), panelarea, plot.getrangeaxisedge())); stringbuffer stringb = new stringbuffer(); stringb.append("profundidad : " + yy); // x coordinate same subplots rectangle2d dataarea = plotinfo.getdataarea(); list<long> curvas = pista.getcurvas(); (int = 0, j = curvas.siz

How to render an HTML file offline? -

i have collection of html files gathered website using wget. each file name of form details.php?id=100419&cid=13%0d , id , cid varies. portions of html files contain articles in asian language (unicode text). intention extract asian-language text only. dumping rendered html using command-line browser first step have thought of. eliminate of frills. the problem is, cannot dump rendered html file (using, say, w3m -dump ). dumping works if direct browser (at command-line) formed url : http://<blah-blah>/<filename> . way have spend time download files once again web. how around this, other tools use? w3m -dump <filename> complains saying: w3m: can't load details.php?id=100419&cid=13%0d. file <filname> shows: details.php?id=100419&cid=13%0d: non-iso extended-ascii html document text, long lines, crlf, cr, lf, nel line terminators

What is single-click (eval) mode (SharePoint 2010 service applications)? -

i'm writing service application sharepoint 2010. i've implemented microsoft.sharepoint.administration.iserviceadministration in service class. there's method called getcreateapplicationoptions in interface returns spcreateapplicationoptions enumeration. the enumeration has 3 distinct values, e.g. "none". description of "none" reads: service application not created in single-click (eval) mode or shown/created in farm configuration wizard. i'm farm creation wizard, "single-click (eval) mode"? there seems no info around... yes, there not lot of available. based on description, sounds like: single-click (eval) mode applicable when not choose install/configure sharepoint farm yourself. example, when want install on same machine on windows 7. , when not in single-click mode, sharepoint presents config wizard when run central admin first time, after installation.

html - Why do Android and iOS browser render site wider than the device screen width by default? -

i have used following code in site prevent android browser rendering wider screen resolution. it's code found on site while preparing ask question unable find original question again reference. <meta name="handheldfriendly" content="true" /> <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" /> to start with, code worked. browser rendering page 3 time wide screen resolution, , opera mini did same. after inserting these 2 lines <head> , problem went away , page rendered should be. remember answer provided code abnormal width caused webkit rendering engine powered, among others, android , ios browsers. question : know why webkit overrides screen resolution , renders page @ resolution greater can accommodated on screen? it has phone's default viewport settings. not, per se, webkit's doing, rather implementation of browser on device. here default layout widths: s

Circular Reference with python lists -

can explain this? >>> x=x[0]=[0] >>> x [[...]] >>> x x[0] true >>> x[0][0][0][0][0][0][0] [[...]] >>> x in x true what [...]? that's python telling you have circular reference; it's smart enough not enter infinite loop trying print out.

nsstring - iPhone SDK: Errors when replacing string occurrences -

i trying replace occurances of string in few different steps, using: nsstring *doc = [[nsstring alloc] initwithdata:htmldata encoding:nsasciistringencoding]; doc = [doc stringbyreplacingoccurrencesofstring:@"###data###" withstring:cord]; doc = [doc stringbyreplacingoccurrencesofstring:@"###name###" withstring:ride.title]; doc = [doc stringbyreplacingoccurrencesofstring:@"###desc###" withstring:ride.description]; [doc release]; i first getting text file , wanting replace few string me own. but, getting following error when running this: program received signal: “exc_bad_access”. [switching thread 13059] data formatters temporarily unavailable, re-try after 'continue'. (not safe call dlopen @ time.) i not understanding why getting exc_bad_access error. trying release has been released?! nsstring *doc = [[nsstring alloc] initwithdata:htmldata encoding:nsasciistringencoding]; doc = [doc stringbyreplacingoccurrencesofstring:@&qu

C/C++: 2D animation library -

i need write application (among other things) renders 2d animated images, let's suppose it's videogame. figured out videogame-like images can have quite complex structure depends little on program logic, on image itself: it can have several animations (one each state object draw can on) to pass state there acyclic animation too. each animation can made of several frames, each of has got duration. and way store images on disk can complex: the above properties of image, of states , of frames should stored on data file bound image, not hardcoded in program source. the different frames put in same image file, or on different layers of image file, or on different image files. background pixels indicated via separated bitmask or using specific color. and guess actual videogames need lot more parameters don't (don't know, bitmask identify pixels replaced team color or whatever). this makes me think there must library of this. half hour on google didn&

c++ - Perform rounding on integral type, but not fractional type -

in following function looking expression replace isintegral<t> . the intention when t integral type add 0.5f before static_cast implictly floors value (and obtain rounded value), when t fractional type add nothing, , static_cast can reduce precision. t interpolate( t const & prev, t const & next, float interpolation ) { float prevfloat = static_cast< float >( prev ); float nextfloat = static_cast< float >( next ); float result = prevfloat + ( (nextfloat-prevfloat) * interpolation ); return static_cast< t >( result + ( isintegral<t> ? 0.5f : 0.0f ); } use std::numeric_limits<t>::is_integer (it's in <limits> header).

python - How do I use generic views in Django? -

i trying use django's generic views make user registration page. have following code in app's urls.py from django.conf.urls.defaults import * models import ticket urlpatterns = patterns('', (r'^new/$', 'django.views.generic.create_update.create_object', { 'model': user } ), ) now when go url following: templatedoesnotexist @ /new/ auth/user_form.html i have tried making template match keep getting message. advice? also, assumed make template me. put in template file when make it? edit: coming rails mixing templates , views. still stuck think need make function in view. like: def user_form: #stuff you need create template file using format <app_label>/<model_name>_form.html . place template template directory defined in template_dirs in settings file. in template file itself, need use context defined standard modelform. {{ form.name.label_tag }} {{ form.name }}

algorithm - A faster way to compare lists for a common element in Java? -

i have graph (implemented vector) of linkedlists , want connect linkedlists not share common elements. think way right takes o(n^3). have loop iterates through vector, nested loop inside iterates through vector (so can compare each list every other one), inside loop use recursion compare lists. before trying way, tried having while loop inside 2nd loop iterate through each list , use binary search see if 2nd list contains each element, think takes same amount of time or longer. here loop: public void addedges(){ for(int =0; < size()-1; i++){ for(int j = i+1; j < size(); j++){ if(compatible(get(i),get(j),1,1)){ get(i).linkto(get(j)); get(j).linkto(get(i)); } } } } and here recursion: public boolean compatible(row a, row b, int indexa, int indexb){ if(a.get(indexa).getend() == b.get(indexb).getend()){ return false; } else if(a.get(indexa).getend() == 0){ return true; } else if(a.get(indexa).getend() > b.get(indexb).geten

php - Updating different fields based on whether or not other fields have values -

the query below works fine. following: update flag1 = '$uflag' if flag1 empty. update flag2 = '$uflag' if flag1 had value in , flag2 empty. update flag3 = '$uflag' if flag1 , flag2 have values in them , flag3 empty. how this? update submission set votes_up = $votes_up, flag1 = '$uflag' submissionid = $id if want keep query simple, determine sql utilize in php using conditions prior sql's execution.

iphone - Positioning stretched UIImages correctly -

Image
i creating uisegmentedcontrol replacement works own custom images. because separators need different colors on both sides decided give middle item 2 borders. now display uisegmentedcontrol replacement, calculate available width 1 item (frame.size.width / numberofitems). create uibutton custom background image (the stretchable middle segment image). next thing position everything. because 1px separators need visible when select item, give every item 1px larger frame should have. next item overlaps 1px left. segmentrect = cgrectmake(indexofobject * (self.frame.size.width / numberofsegments), 0, (self.frame.size.width / numberofsegments) + 1, self.frame.size.height); using result nearly perfect custom uisegmentedcontrol (retina): now things pretty ok, changes when adding more/less segments. 300px wide control way, each segment gets 25px of space. if change number let's 13, shows up: notice different border between '3' , '4'. (easier spot on non-retina be

jquery - Jqgrid selecting more than one row -

my first question on so! :) in advanced! i'm having problem jqgrid multiple selection functionality. can define single multiple selection key , above shift doesnt select more 1 row collection @ time. any clue on different grid plugin or work around functionality? also, jqgrid have option hide check boxes when multiselect active? welcome on stackoverflow.com! you can find here examples shows live how different settings of jqgrid having multiselect:true works. option documented . you can @ here code implement musliselect behavior standard. tell truth don't tested solution.to hide checkboxes can use $("#list").jqgrid('hidecol','cb'); because checkboxes placed in column name 'cb'. mostly jqgrid used paging feature, not many rows displayed @ once , not real problem select many rows. nevertheless agree keybord support not enough in jqgrid. other important functionality on other side rich, don't see alternative plugin

How to merge to get rid of head with Mercurial command line, like I can do with TortoiseHg? -

Image
my question this: if have 2 heads (branches changes) in mercurial repository, , i'd rid of 1 of them, discard changes branch instead of merging them other, , can't strip out changesets have merge, how can command line client? if have 2 heads in mercurial repository, , use tortoisehg client, repository might this: then can rid of test2 head doing merge , discarding. first update head i'd keep ( test3 in case, in image above current parent of working folder). right-click , select "merge with...": and in dialog pops choose discard changes merge target (ie. branch i'd discard changes from): after merge has gone through, changes in test2 head has been discarded, , can commit. head has disappeared, changeset still part of history. my question this: how can same thing using command line client? can't find matching options hg merge command: hg merge [-p] [-f] [[-r] rev] merge working directory revision ... snipped text options:

C dynamic array initialization problem -

i'm having problem initializing array of structs in c program. here's function gets initialized: void initializebpstructures() { satcountertable = (struct satcountertableentry *)malloc(sizeof(struct satcountertableentry) * counter_count); } counter_count integer global variable , satcountertable declared earlier in c source file static struct satcountertableentry* satcountertable; and if it's relevant satcountertable struct struct satcountertableentry { enum satcounter_state predict_state; md_addr_t tag; }; md_addr_t label unsigned int corresponding memory address the problem when try , compile, following error sim-safe.c:129: error: expected expression before ‘=’ token and array initialization in intitializebpstructures() on line 129. i'm not sure why line problem. ideas? edit: here's additional lines of code around function struct satcountertableentry { enum satcounter_state predict_state; md_addr_t tag; };

c# - Commit Application Settings Changes -

i'm binding user settings bunch of controls on winform dialog has ok/cancel buttons. while works great read in bindings in, commit binding changes if user clicks ok, , not if click cancel. there simplistic setting achieve rather managing reading , committing myself? right now, let's have textbox binds user setting called "country". has "united states" in , if user changes "bolivia", committed typed instead of when ok button pressed. to save settings, add in ok button event handler: properties.settings.default.save(); to reload settings: properties.settings.default.reload(); good luck!

php - Is it possible to track where I am in an array with array_walk_recursive? -

let's have array this: array ( ['one'] => array ( ['wantedkey'] => 5 ['otherkey1'] => 6 ['otherkey2'] => 7 ) ['two'] => => array ( ['otherkey1'] => 5 ['otherkey2'] => 6 ['wantedkey'] => 7 ) ['three'] => => array ( ['otherkey1'] => 5 ['wantedkey'] => 6 ['otherkey2'] => 7 ) ) if apply sth array instances of 'wantedkey': function test_print($item, $key) { if ($key === 'wantedkey') { print $item; } } array_walk_recursive($myarray, 'test_print'); but array_walk_recursive doesn't tell me (afaik) in array....is there way track positi

ruby - How can I send an image on the web in an XMPP (Jabber) message? -

Image
for xmpp interface stack overflow chat , taking html of chat messages , converting valid xml , , setting html child element of xmpp message object. in mac os x jabber client working great! meant when users in chat posted oneboxed image, image show in xmpp client (adium os x): however updated adium latest version , apparently they considered doing security hole , against xmpp specs, , changed behavior . reasoning xmpp should not reveal ip address, , fetch image on http reveal ip address. so chats imageless on xmpp. how can make images work on xmpp? should xmpp component download images , embed them <message> stanzas? can images proxied through xmpp server? or impossibility? adium, ichat , pidgin support xep-0231 , allows send provide binary data, including images purpose. basically, allows specify unique identifier source image, , other client can decide if wants request data in <iq> request. i've been working in python's twisted , meeting fr

c# - this List<string> ListName as a parameter? -

what mean when have list parameter method? public static void killzombies(this list<zombie> zombiestokill, int numberofbullets) { ... } that mean method extension method : the code calling method might little confusing: var zombies = new list<zombie>(); zombies.killzombies(15); in reality, kind of syntactic sugar equivalent to: public static void killzombies(list<zombie> zombiestokill, int numberofbullets) { // code here } with calling code looking like: var zombies = new list<zombie>(); killzombies(zombies, 15);