Posts

Showing posts from February, 2013

java - Class for Doubly-Linked List -

i have code class handling doubly-linked list doesn't have empty head or tail node. have modified code obtained supposed doubly-linked list throwing following exception. how prevent exception occurring , changes required remove empty head or tail node? exception in thread "main" java.lang.nullpointerexception @ p4dll.removelast(p4dll.java:105) @ p4dll.main(p4dll.java:197) code: class listnode { object element; listnode next; listnode prev; public listnode( object anelement ) { element = anelement; next = null; prev = null; } public listnode( object anelement, listnode nextptr, listnode prevptr) { element = anelement; next = nextptr; prev = prevptr; } } // end class listnode public class p4dll { private listnode head; private listnode tail; private int size; public p4dll() { head = null; tail = null; size = 0; } pu...

web services - What are some good examples of a WS-Eventing client in Java? -

there few web service frameworks available java: axis2, cxf, jbossws, , metro. have examples of ws-eventing client these frameworks? check out apache savan . it's publisher/subscriber implementation axis2 supports ws-eventing (see sample.eventing.client example client). jbossws has information setting service here , didn't see example client. regarding cxf , metro, i'm not sure if have specific support ws-eventing yet.

c++ - Where to get samples of subauthentication packages for Windows 7? -

i trying create subauthentication package windows 7. no samples available. the authentication packages provided windows support customization using subauthentication packages. subauthentication package dll supplements or replaces part of authentication , validation criteria used main authentication package. example, particular server might supply subauthentication package validates user's password different algorithm or specifies workstation restrictions in different format. you can see this online sample or see subauth sample installed platform software development kit (sdk) .

how do i store the struts2 tag checkboxlist elements in the database? -

if wanted store struts2 tag checkboxlist elements in database ,how save in database .i mean how work checkboxlist tag , like how declare in table .how use ? thanks here several different examples showing how use checkboxlist in action class , view. once checkbox submitted action, you'll have list populated checked string values. can save strings in database in appropriate field type (i.e. mysql char or varchar ).

iphone - MapKit: How can I pan and zoom to fit all my annotations? -

so i've got bunch of annotations spread out on map... dandy. need able set map's position , zoom fit perfectly. how can this? @interface mkmapview (zoomtofit) - (void)zoomtofitoverlays; //animation defaults yes - (void)zoomtofitoverlay:(id<mkoverlay>)anoverlay; - (void)zoomtofitoverlays:(nsarray *)someoverlays; - (void)zoomtofitoverlaysanimated:(bool)animated; - (void)zoomtofitoverlay:(id<mkoverlay>)anoverlay animated:(bool)animated; - (void)zoomtofitoverlays:(nsarray *)someoverlays animated:(bool)animated; - (void)zoomtofitoverlays:(nsarray *)someoverlays animated:(bool)animated insetproportion:(cgfloat)insetproportion; //inset 0->1, defaults in other methods .1 (10%) @end @implementation mkmapview (zoomtofit) #pragma mark - #pragma mark zoom fit - (void)zoomtofitoverlays { [self zoomtofitoverlaysanimated:yes]; } - (void)zoomtofitoverlay:(id<mkoverlay>)anoverlay { [self zoomtofitoverlay:[nsarray arraywithobject:anoverlay] an...

tsql - Using 0x800 in SQL WHERE Clause -

i trying decipher sql statements using, sql profiler, run proprietary application. one of statements is: select id, groups, name, gallery dashboardreports (groups & 0x800) <> 0 , root = 1 order name can explain how clause works? i've never seen clause before , "groups" column contains integer values such 2048,2176,150 , 414. thanks danny this bitwise operation - http://en.wikipedia.org/wiki/bitwise_operation 0x800 in hexadecimal 2048 same writing (groups & 2048) <> 0 this clause telling query filter out records have 12th bit in groups column turned off. 2048 means 12th bit turned on (it makes more sense when @ number binary value). 0000 1000 0000 0000 = 2048 it's convenient way store several on/off values in single column. 150 combination of bits (128 , 32) both these evaluate true: (groups & 128) <> 0 (groups & 32) <> 0 here's quick list of bits , values you: 1 1 2 2 3 4 4 8 5 ...

seo - Getting Good Google PageRank -

in seo people talk lot google pagerank . it's kind of catch 22 because until site big , don't need search engines much, it's unlikely big sites link , increase pagerank! i've been told it's easiest couple high quality links point site raise it's pagerank. i've been told there open directories dmoz.org google pays special attention (since they're human managed links). can speak validity of or suggest site/technique increase site's pagerank? have great content nothing helps google rank more having content or offering service people interested in. if web site better competition , solves real need naturally generate more traffic , inbound links. keep content fresh use friendly url's contain keywords good : http://cars.com/products/cars/ford/focus/ bad : http://cars.com/p?id=1232 make sure page title relevant , constructed for example : buy house in france :. property purchasing in france use domain name describes site ...

css - Div based web design tutorial/book -

i want try use div tags , css instead of tables in web design. can suggest resource can learn using div tags ? it's quite switch tables div's! lot's of stuff learned. smart google , start reading few subjects before coding. think generators , grids not looking for, because need learn basic principles first. google subjects like: css box model css floats css positioning css resets when u start these subjects, workings of divs become bit clearer. real shizzle starts when run inconsistencies browsers , such (thats resets help). thats opinion. :)

android.app.ActivityThread is missing in current sdk -

i found examples in web use android.app.activitythread can't find in android sdk installation (2.1 , 2.2), , neither on android sdk webpage . was activitythread removed current sdk? if so, there alternative? thanks thomas activitythread class in android firmware, has not been part of android sdk since 1.0, afaict. whatever examples either old or designed people modifying firmware.

c - malloc cpu cycles -

what cost of malloc(), in terms of cpu cycles? (vista/os, latest version of gcc, highest optimization level,...) basically, i'm implementing complex dag structure (similar linked list) composed of 16b (less common) , 20b nodes (more common). occasionally, have remove nodes , add some. but, rather using malloc() , free(), can move unneeded nodes end of data structure, , update fields algorithm continues. if free node available, update fields; if not, i'll have allocate new one. the problem is, might have 1 free node available while having input, example, 20 nodes worth of data. means: i check available free node the check succeed, , free node updated i check available node 19 more times all checks fail, , malloc() called each time question: worth it? should malloc() , free() usual, or worth keep free nodes available @ end of list, , keep checking if fail , lead malloc() anyway? more concretely, what cpu cost of malloc()?? does matter costs? reall...

sql - Ensure unique value -

i have table unique values within , once stored procedure called, use following code within sub-query random value table: select top 1 uniqueid uniquevalues initiatingid null order newid() asc i have noticed managing , (and i'm guessing 2 calls running simultaneously cause it) retrieve same unique value twice, causes issues within program. is there way (preferably not locking table) make unique values id generation unique - or unique enough not affect 2 simultaneous calls? note, need keep unique values , cannot use guids directly here. thanks, kyle edit clarification: i buffering unique values. that's where initiatingid null about. value gets picked out of query, initiatingid set , therefore cannot used again until released. problem in milliseconds of process setting initiatingid seems value getting picked again, harming process. random implies same value twice randomly. why not using identity columns? i wrote blog post manual id generation da...

stocks - What online brokers offer APIs? -

so i'm getting sick of e*trade and, being developer, love find online broker offers api. great able write own trading tools, , maybe modify existing ones. based on research far, i've found 1 option. interactive brokers offers multi-language api (java/c++/activex/dde) , has decent commission rates boot. want make sure there aren't other options out there should considering. ideas? update: based on answers far, here's quick list... interactive brokers java c++ activex dde excel pinnacle trading c++ perl vb.net excel mb trading i vote ib(interactive brokers). i've used them in past quite happy. pinnacle capital markets trading has api (pcmtrading.com) haven't used them. interactive brokers: https://www.interactivebrokers.com/en/?f=%2fen%2fsoftware%2fibapi.php pinnacle capital markets: http://www.pcmtrading.com/es/technology/api.html

soa - Service Oriented Architecture: How would you define it -

service oriented architecture seems more , more of hot quote these days, after asking around office have found seem many different definitions it. how guys define soa? consider official definition? as martin fowler says, means different things different people. article on topic pretty although isn't quite definition. http://martinfowler.com/bliki/serviceorientedambiguity.html it may explain, difficulty coming concrete definition.

HTML to Markdown with Java -

is there easy way transform html markdown java? i using java markdownj library transform markdown html. import com.petebevin.markdown.markdownprocessor; ... public static string gethtml(string markdown) { markdownprocessor markdown_processor = new markdownprocessor(); return markdown_processor.markdown(markdown); } public static string getmarkdown(string html) { /* todo ask stackoverflow */ } use xslt . if need using xslt , java here's code snippet: public static void main(string[] args) throws exception { file xsltfile = new file("mardownxslt.xslt"); source xmlsource = new streamsource(new stringreader(thehtml)); source xsltsource = new streamsource(xsltfile); transformerfactory transfact = transformerfactory.newinstance(); transformer trans = transfact.newtransformer(xsltsource); stringwriter result = new stringwriter(); trans.transform(xmlsource, new streamresult(...

actionscript 3 - Google Maps in Flex Component -

i'm embedding google maps flash api in flex , runs fine locally watermark on it, etc. when upload server (flex.mydomain.com) sandbox security error listed below: securityerror: error #2121: security sandbox violation: loader.content: http://mydomain.com/main.swf?fri, 12 sep 2008 21:46:03 utc cannot access http://maps.googleapis.com/maps/lib/map_1_6.swf. may worked around calling security.allowdomain. @ flash.display::loader/get content() @ com.google.maps::clientbootstrap/createfactory() @ com.google.maps::clientbootstrap/executenextframecalls() does have experience embedding google maps flash api flex components , settings security settings make work? did new api key registered domain , using when it's published. i've tried doing following in main application component: security.allowdomain('*') security.allowdomain('maps.googleapis.com') security.allowdomain('mydomain.com') this sounds crossdomain.xml related pr...

Playing wave files in Android -

i trying play wave file(voicemail) in android. file downloaded remote server , written sdcard. i use following code play wave file usign mediaplayer class bundled sdk: filedescriptor fd = new fileinputstream(songfile).getfd(); mediaplayer mmediaplayer = new mediaplayer(); mmediaplayer.reset(); try{ mmediaplayer.setdatasource(fd); } catch(illegalstateexception e){ mmediaplayer.reset(); mmediaplayer.setdatasource(fd); } mmediaplayer.prepare(); mmediaplayer.start(); however when run code, following error: command player_set_data_source completed error or info pvmferrnotsupported error (1, -4). note when pull file on desktop machine , copy music folder of htc hero device, music player of device can play file guessing file format compatible android. not su...

project management - How do you balance fun feature creep with time constraints? -

i enjoy programming, usually. tedious stuff easy done , correctly possible can through , not have see again. but lot of coding fun , when in 'zone' enjoy myself. which make mistake of spending time, perhaps adding features, perhaps writing in cool or elegant manner, or doing neat prototypes. how recognize happening before exceeds time frame? what do before starting potentially fun piece of code, or during, on track? when ok let go "hog wild" , enjoy without worrying consequences? -adam keep detailed prioritized feature list/bug list. review balance fun work bugs/features need done.

Calculate code metrics -

are there tools available calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) project , on time produce graph showing trends? on latest project used sourcemonitor . it's nice free tool code metrics analysis. here excerpt sourcemonitor official site: collects metrics in fast, single pass through source files. measures metrics source code written in c++, c, c#, vb.net, java, delphi, visual basic (vb6) or html. includes method , function level metrics c++, c, c#, vb.net, java, , delphi. saves metrics in checkpoints comparison during software development projects. displays , prints metrics in tables , charts. operates within standard windows gui or inside scripts using xml command files. exports metrics xml or csv (comma-separated-value) files further processing other tools. for .net beside ndepend best tool, can recommend vil . following tools can perform trend an...

tcl - problem with utf-8 windows versus Mac -

ok, have small test file contains utf-8 codes. here (the language wolof) fˆndeen d‘kk la bu ay wolof aki seereer fa nekk. digantŽem ak cees jur—om-benni kilomeetar la. mbŽyum gerte ‘pp ci diiwaan bi mu that looks in vanilla editor, in hex is: xxd test.txt 0000000: 46cb 866e 6465 656e 2064 e280 986b 6b20 f..ndeen d...kk 0000010: 6c61 2062 7520 6179 2077 6f6c 6f66 2061 la bu ay wolof 0000020: 6b69 2073 6565 7265 6572 2061 2066 6120 ki seereer fa 0000030: 6e65 6b6b 2e20 4469 6761 6e74 c5bd 656d nekk. digant..em 0000040: 2061 6b0d 0a43 6565 7320 6a75 72e2 8094 ak..cees jur... 0000050: 6f6d 2d62 656e 6e69 206b 696c 6f6d 6565 om-benni kilomee 0000060: 7461 7220 6c61 2e20 4d62 c5bd 7975 6d20 tar la. mb..yum 0000070: 6765 7274 6520 e280 9870 7020 6369 2064 gerte ...pp ci d 0000080: 6969 7761 616e 2062 6920 6d75 0d0a iiwaan bi mu.. the second character [cb86] non-standard coding a-grave [à] found quite consistently in web documents, although in 'real' utf-8...

c# - USB drive programming with .NET -

i working on project need access specific addresses of usb drive (e.g. sector 0), , change bytes. have done parts c# includes user interface, detection of usb drives etc. can me providing links can access specific addresses of usb drives .net? the framework doesn't support this. if attempt create filestream on device throw exception. have use windows api methods directly (p/invoke createfile, deviceiocontrol, etc). make sure read section on physical disks , volumes here: http://msdn.microsoft.com/en-us/library/aa363858.aspx

Tools to create maximum velocity in a .NET dev team -

if self-fund software project tools, frameworks, components employ ensure maximum productivity dev team , "real" problem being worked on. what i'm looking low friction tools job done minimum of fuss. tools i'd characterize such svn/tortiosesvn, resharper, vs itself. i'm looking frameworks solve problems inherient in software projects orm, logging, ui frameworks/components. example on ui side asp.net mvc vs webforms vs monorail. versioning. subversion popular choice. if can afford it, team foundation server offers benefits. if want super-modern, consider distributed versioning system, such git , bazaar or mercurial . whatever do, don't use sourcesafe or other lock-based tools, rather merge-baseed ones. consider installing both windows explorer client (such tortoisesvn ) visual studio add-in (such ankhsvn or visualsvn ). issue tracking. given joel spolsky on site's staff, fogbugz deserves mention. trac , mantis , bugzilla widespread...

c# - Debug.Assert vs. Specific Thrown Exceptions -

i've started skimming 'debugging ms .net 2.0 applications' john robbins, , have become confused evangelism debug.assert(...). he points out well-implemented asserts store state, somewhat, of error condition, e.g.: debug.assert(i > 3, "i > 3", "this means got bad parameter"); now, personally, seems crazy me loves restating test without actual sensible 'business logic' comment, perhaps "i <= 3 must never happen because of flobittyjam widgitification process". so, think asserts kind-of low-level "let's protect assumptions" kind of thing... assuming 1 feels test 1 needs in debug - i.e. protecting against colleague , future programmers, , hoping test things. but don't is, goes on should use assertions in addition normal error handling; envisage this: debug.assert(i > 3, "i must greater 3 because of flibbity widgit status"); if (i <= 3) { throw new argumentoutofrangeexception(...

The Best Way to shred XML data into SQL Server database columns -

what best way shred xml data various database columns? far have been using nodes , value functions so: insert some_table (column1, column2, column3) select rows.n.value('(@column1)[1]', 'varchar(20)'), rows.n.value('(@column2)[1]', 'nvarchar(100)'), rows.n.value('(@column3)[1]', 'int'), @xml.nodes('//rows') rows(n) however find getting slow moderate size xml data. stumbled across question whilst having similar problem, i'd been running query processing 7.5mb xml file (~approx 10,000 nodes) around 3.5~4 hours before giving up. however, after little more research found having typed xml using schema , created xml index (i'd bulk inserted table) same query completed in ~ 0.04ms. how's performance improvement! code create schema: if exists ( select * sys.xml_schema_collections [name] = 'myxmlschema') drop xml schema collection [myxmlschema] go declare @myschema xml set @myschema = ( se...

Is there a good, free WYSIWYG editor for creating HTML using a Django template? -

i'm interested free, wysiwyg html editor compatible django template. ideas? thanks lainmh. but afraid fckeditor used in web app, purpose of editing html. want editor allows me write html django compatible. hope clarifies issue. http://www.fckeditor.net/ ? edit: found this: http://blog.newt.cz/blog/integration-fckeditor-django/

Breakpoints in core .NET runtime? -

i have third party library internally constructs , uses sqlconnection class. can inherit class, has ton of overloads, , far have been unable find right one. i'd tack on parameter connection string being used. is there way me put breakpoint in .net library core itself? in constructors of sqlconnection class, can @ stack trace , see being constructed? barring that, there other way can this? specifically, want tack on application name parameter, our application more identified on server when looking @ connections. edit : well, appears need more help. think i've enabled related symbol server support, , i've noticed directory configured has filled directories contain .pdb files. still, can't actual source sqlconnection class become available. is there definite guide how successfully? and if can't use source level debugging .net framework source code microsoft supplied, try different debugger. mdbg or windbg. edit this explains getting relea...

Learning parsing with C++ -

i want learn basics of parsing c++. for matter thought of simple configuration language might this: /* same comment syntax in c++ keywords: "section" = begins new section block "var" = defines new var ... */ section mysection { // valid: section "mysection" { ... } var somevar = "foo"; section stuff { var things = "data"; }; }; dummy grammar: "section" <section_name> "{" <block> "}" ";" "var" <name> "=" <value> ";" now wonder find beginners tutorial might cover project? the wikipedia entry on recursive descent parsers should started.

Is .NET/Mono or Java the better choice for cross-platform development? -

how less libraries there mono java? i lack overview on both alternatives have pretty freedom of choice next project. i'm looking hard technical facts in areas of performance (for example, i'm told java threading, , hear runtime code optimization has become .net) real world portability (it's both meant portable, what's catch-22 each?) tool availability ( ci , build automation, debugging, ide) i looking experienced in own work rather things google. application back-end service processing large amounts of data time series. my main target platform linux. edit: to phrase question more adequately, interested in whole package (3rd party libraries etc.), not language. libraries, boils down question "how less libraries there mono java"? fyi, have since chosen java project, because seemed more battle-worn on portability side , it's been around while on older systems, too. i'm tiny little bit sad it, because i'm curious c# , i'd lo...

objective c - ObjectiveC/iphone: convert an array of dicts to an array composed of a certain attribute of each dict -

looking succinct way convert array of dicts array composed of attribute of each dict. eg. [ { name => 'visa', value => 'vi' }, { name => 'mastercard', value => 'mc' }] => ['visa', 'mastercard'] this should trick: nsarray *namearray = [yourarray valueforkey:@"name"]; valueforkey: returns array containing results of invoking valueforkey: using key on each of receiver's objects.

android - SoundPool not playing sounds -

i made soundmanager class uses soundpool functions in order loop specific sound, can't figure out why isn't playing sound. public class soundmanager { private soundpool msoundpool; private hashmap<integer, integer> msoundpoolmap; private audiomanager maudiomanager; private context mcontext; public soundmanager() { } public void initsounds(context thecontext) { mcontext = thecontext; msoundpool = new soundpool(4, audiomanager.stream_music, 0); msoundpoolmap = new hashmap<integer, integer>(); maudiomanager = (audiomanager)mcontext.getsystemservice(context.audio_service); } public void addsound(int index, int soundid) { msoundpoolmap.put(index, msoundpool.load(mcontext, soundid, 1)); } public void playsound(int index) { int streamvolume = maudiomanager.getstreamvolume(audiomanager.stream_music); msoundpool.play(msoundpoolmap.get(index), streamvolume, streamvolume, 1, 0, 1f); } public void playloopedso...

Java profiler for IBM JVM 1.4.2 (WebSphere 6.0.2) -

i'm looking java profiler works jvm coming websphere 6.0.2 (ibm jvm 1.4.2). use yourkit usual profiling needs, refuses work old jvm (i'm sure authors had reasons...). can point decent profiler can job? not interested in generic list of profilers, btw, i've seen other stackoverflow theread, i'd rather not try them 1 one. i prefer free version, if possible, since one-off need (i hope!) , rather not pay profiler this. old post, may someone. can use ibm health center free. can downloaded standalone or part of ibm support assistant . suggest downloading isa since has ton of other useful tools such garbage collection , memory visualizer , memory analyzer .

osgi - Default version package gets when Export-Version does not specify version -

in osgi, if not specify version in export-package directive inside manifest.mf, version exported package get? version equal bundle version? zero version (something 0.0.0)? something else? p.s. , here rationale behind logic: https://mail.osgi.org/pipermail/osgi-dev/2010-august/002608.html for export-package version defaults 0.0.0 , , import-package version defaults [0.0.0, infinte] . see chapters 3.5.4 , 3.5.5 of osgi core specification.

html - Best way to create a menu in an ASP.NET website -

i have create simple, one-level menu in asp.net website clicking on items result in displaying apt .ascx file on remaining screen area. know suitable method achieve this: asp.net menu control html ul tag html table hyper-links within cells any other way (which wasn't able identify) apologies if it's silly question, experimenting , gradually taking asp.net, wanted learn best practices/usages. thanks help! i recommend using menu control , minimal "lead-in" pages host ascx controls. on used use multiview controls minimize page count (on site can exceed several thousand pages), found method required lot of effort provide hard linking particular section , didn't decrease page count because still have separate ascx each piece of functionality. if have bare-bones aspx page holds master page reference (if used) , registration webusercontrol you're using, keep things brief , controllable. @xiii mentioned, able use sitemap or xml file bind menu o...

Three dimensional arrays of integers in C++ -

i find out safe ways of implementing 3 dimensional arrays of integers in c++, using pointer arithmetic / dynamic memory allocation, or, alternatively using stl techniques such vectors. essentially want integer array dimensions like: [ x ][ y ][ z ] x , y in range 20-6000 z known , equals 4. have @ boost multi-dimensional array library. here's example (adapted boost documentation): #include "boost/multi_array.hpp" int main() { // create 3d array 20 x 30 x 4 int x = 20; int y = 30; int z = 4; typedef boost::multi_array<int, 3> array_type; typedef array_type::index index; array_type my_array(boost::extents[x][y][z]); // assign values elements int values = 0; (index = 0; != x; ++i) { (index j = 0; j != y; ++j) { (index k = 0; k != z; ++k) { my_array[i][j][k] = values++; } } } }

java - How can I run all JUnit tests in one package @ NetBeans? -

i have trillion test packages bazillion tests , want run of packages. must run whole project (some tests takes long complete) or need run every single file manually. how possible run packages in netbeans ? can't find option ... it's not want, netbeans topic, running junit test , says: if want run subset of project's tests or run tests in specific order, can create test suites specify tests run part of suite. after creating test suite run suite in same way run single test class. creating test suite covered in topic creating junit test .

asp.net - Is inline code in your aspx pages a good practice? -

if use following code lose ability right click on variables in code behind , refactor (rename in case) them <a href='<%# "/admin/content/editresource.aspx?resourceid=" + eval("id").tostring() %>'>edit</a> i see practice everywhere seems weird me no longer able compile time errors if change property name. preferred approach this <a runat="server" id="mylink">edit</a> and in code behind mylink.href= "/admin/content/editresource.aspx?resourceid=" + myobject.id; i'm interested hear if people think above approach better since that's see on popular coding sites , blogs (e.g. scott guthrie) , it's smaller code, tend use asp.net because compiled , prefer know if broken @ compile time, not run time. i wouldnt call bad practice (some disagree, why did give option in first place?), you'll improve overall readability , maintainability if not submit practice. conveyed out...

xml - Export ChartFX7 to SVG in Java -

can give example of exporting chartfx7 chart svg? i've tried: bytearrayoutputstream baos = new bytearrayoutputstream(); m_chart.setoutputwriter(new svgwriter()); m_chart.exportchart(fileformat.external, baos); , : bytearrayoutputstream baos = new bytearrayoutputstream(); m_chart.setrenderformat("svg"); m_chart.rendertostream(); both result in null pointer exception. the following outputs xml: fileoutputstream fos = new fileoutputstream(debug.getinstance().createexternalfile("chart.xml")); m_chart.exportchart(fileformat.xml, fos); batik libary can import java libary convert or create svg images. dont know chartfx7 standard way create svg in java.

sql server - FileLoadException / Msg 10314 Error Running CLR Stored Procedure -

receiving following error when attempting run clr stored proc. appreciated. msg 10314, level 16, state 11, line 1 error occurred in microsoft .net framework while trying load assembly id 65752. server may running out of resources, or assembly may not trusted permission_set = external_access or unsafe. run query again, or check documentation see how solve assembly trust issues. more information error: system.io.fileloadexception: not load file or assembly 'orders, version=0.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. error relating security occurred. (exception hresult: 0x8013150a) system.io.fileloadexception: @ system.reflection.assembly._nload(assemblyname filename, string codebase, evidence assemblysecurity, assembly locationhint, stackcrawlmark& stackmark, boolean throwonfilenotfound, boolean forintrospection) @ system.reflection.assembly.nload(assemblyname filename, string codebase, evidence assemblysecurity, assembly locationhint, s...

c# - How can I Trim the leading comma in my string -

i have string below. ,liger, unicorn, snipe in other languages i'm familiar can string.trim(",") how can in c#? thanks. there's been lot of , forth starttrim function. several have pointed out, starttrim doesn't affect primary variable. however, given construction of data vs question, i'm torn answer accept. true question wants first character trimmed off not last (if anny), however, there never "," @ end of data. so, said, i'm going accept first answer that said use starttrim assigned new variable. string sample = ",liger, unicorn, snipe"; sample = sample.trimstart(','); // remove first comma or perhaps: sample = sample.trim().trimstart(','); // remove whitespace , first comma

escaping - Escape characters <%= h("") %> and how to deal with double quote in Ruby on Rails -

this might simple question answer, couldn't find answer. in ruby on rails, thought helper function escape special characters. example: " she's 1 took me "to" " code wise: <%= h("she's 1 took me "to" ") %> however, double quote won't allow me display code on browser , gives me error. i thought h() alias html_escape() , convert following 4 characters < > & " into &lt; &gt; &amp; &quot; is there i'm missing using double quotes? any advice appreciated thanks, d the problem double quote around word to closing double quote opened @ beginning of string. try this: <%= h("she's 1 took me \"to\" ") %> or, avoid having backslashify internal double quotes, use % syntax creating string: <%= h(%[she's 1 took me "to" ]) %>

sql server - Execute an insert and then log in one SQL command -

i've been asked implement code update row in ms sql server database , use stored proc insert update in history table. can't add stored proc since don't control database. know in stored procs can update , call execute on stored proc. can set in code using 1 sql command? either run them both in same statement (separate separate commands semi-colon) or use transaction can rollback first statement if 2nd fails.

parsing - Can I improve this GOLD Parser Grammar? -

i have parse file looks this: versioninfo { "editorversion" "400" "editorbuild" "4715" } visgroups { } world { "id" "1" "mapversion" "525" "classname" "worldspawn" solid { "id" "2" side { "id" "1" "plane" "(-544 -400 0) (-544 -240 0) (-272 -240 0)" } side { "id" "2" "plane" "(-544 -240 -16) (-544 -400 -16) (-272 -400 -16)" } } } i have parser written scratch, has few bugs can't track down , imagine it'll difficult maintain if format changes in future. decided use gold parsing system generate parser, instead. grammar looks this: "start symbol" = <sectionlist> ! sets {section chars} = {alphanumeric} + [_] {property chars} ...

c# - Why is .NET ObservableCollection<T> implemented as a class and not an interface? -

in reading observer design pattern, noticed implemented using interfaces. in java, java.util.observable implementation class. shouldn't c# , java versions use interfaces ? scott well, implements inotifycollectionchanged , inotifypropertychanged . however, interestingly, doesn't implement new iobservable<t> interface .net 4.0, might have expected. it arguably useful there generic form of inotifycollectionchanged ... don't know of one.

python - Why does PEP-8 specify a maximum line length of 79 characters? -

why in millennium should python pep-8 specify maximum line length of 79 characters? pretty every code editor under sun can handle longer lines. wrapping should choice of content consumer, not responsibility of content creator. are there (legitimately) reasons adhering 79 characters in age? much of value of pep-8 stop people arguing inconsequential formatting rules, , on writing good, consistently formatted code. sure, no 1 thinks 79 optimal, there's no obvious gain in changing 99 or 119 or whatever preferred line length is. think choices these: follow rule , find worthwhile cause battle for, or provide data demonstrates how readability , productivity vary line length. latter extremely interesting, , have chance of changing people's minds think.

php - html_entity_decode() isn't working properly? -

edit: solved seconds after posting question (sorry!) can't accept answer yet. hi folks, just quick one. have php/codeigniter site , user can edit profile. i'm using ci's xss filtering , active record-based models, data escaped automatically. it naturally displays fine on profile page view, text such "we'll see if works" (the apostrophe in we'll ). when user goes edit page, input box (filled data in db) displays: we&#39;ll see if works i thought around setting value of input box html_entity_decode($query->row('example_database_row')) still doesn't work. misunderstanding here? thanks! jack you can use html_entity_decode($query->row('example_database_row'), ent_quotes) . however, advise against html encoding before insert database. encode when output it. it's better storing raw data in database.

Set the webkit-keyframes from/to parameter with JavaScript -

is there way set from or to of webkit-keyframe javascript? a solution of sorts: var cssanimation = document.createelement('style'); cssanimation.type = 'text/css'; var rules = document.createtextnode('@-webkit-keyframes slider {'+ 'from { left:100px; }'+ '80% { left:150px; }'+ '90% { left:160px; }'+ 'to { left:150px; }'+ '}'); cssanimation.appendchild(rules); document.getelementsbytagname("head")[0].appendchild(cssanimation); just adds style definition header. cleaner/better define though dom if possible. edit: error in chrome old method

linux - AMD 6 Core and compiling open-source projects -

i have been wanting build own box amd 6 core. have used intel based machines , frankly have not done open-source projects. want along systems programming worried if open-source projects (mainly linux based) going problem compile on amd? how difficult porting (if needed) amd intel , vice-versa. thanks. both amd , intel processors use x86 isa . don't compile specific processor, compile isa. unless turn on specific flags (such -march ) while compiling, binary built on 1 processor run on another. to again, there no problem. this not mean processors same. have different performance characteristics, support different motherboard chipsets, , have different feature sets (for instance, iommus or other advanced virtualization features). won't accessing things processor-internal performance registers in everyday life, don't worry it , whichever cpu right desired system configuration , price/performance point.

geotagging - How to map geo location based on one or all of these services -

i'm looking solution map 1 or of following flickr, twitter, vimeo, exif, keywords or whatever google maps. i'm trying show map of location updating social sites. if each of services want supports georss , can build such map 0 coding whatsoever! because google maps supports mapping georss feed directly. have type url of rss feed georss data within, box on google maps. here's example of feed what's harm? website mapped in google maps. now mention several services there, each of whould presumably have own georss feed. need merge feeds before handing resulting feed google maps. there variety of ways this, 1 quick point-and-click way via yahoo pipes . search "merge feed" or "merge rss" on there , can find many examples can copy , modify. yahoo pipes has functionality add georss coding feeds don't have already. use bring in data blog posts , son on might not georss. under "operators" "location extractor" wi...

c# - How do I turn a web-based calculator into a callable program? -

there free, online calculator on web page want access c# program. calculator simple -- html table. there no javascript or flash. want able turn page method can call. method presumably call web page, enter appropriate numbers, read result, , return result. what best way this? i try loading web page webbrowser class, if it's server side calculator should figure out get/post parameters give input , choose desired functionality (you analyzing html source) , request answer page. if client side calculator, should use dom parser (look @ htmldocument class). if calculator simple, consider re-implementing or try find pre-written component, think should easier (you have javascript source in case of client side calculator).

Two column layout with one having a fixed width in CSS -

i want nice 2 column layout using css float's. column#1 160 px column#2 100% (i.e. rest of space). i want place col#2's div first, layout looks like: <div id="header"></div> <div id="content"> <div id="col2"></div> <div id="col1"></div> </div> <div id="footer"></div> what has effect? neither of above work. div#col2 { width: 160px; float: left; position: relative; } div#col1 { width:100%; margin-left: 160px; } that's assuming column 2 should appear left sidebar, col 1 main content.

How to modify loop variable in ruby? -

for in (0..5) if(i==0) i=4 end puts end in above program excepted output - 4 5 but instead - 4 1 2 3 4 5 so conclude loop variable isnt changing. how can change it? can tell me? actually, in program need save current state of loop , retrive later on next start program resumes same point left. the way you'll able modify loop variable use while loop: x = (2..7).to_a = 0 while (i < x.length) = 4 if == 0 puts x[i] = + 1 end output: 6 7 in for loop, you've discovered, can modify loop variable , value hold iteration of loop. on next iteration, retrieve next element range specified modified value overwritten.

ios - UIKeyboardFrameBeginUserInfoKey & UIKeyboardFrameEndUserInfoKey -

in managing keyboard documentation : uikeyboardframebeginuserinfokey key nsvalue object containing cgrect identifies start frame of keyboard in screen coordinates. these coordinates not take account rotation factors applied window’s contents result of interface orientation changes. thus, may need convert rectangle window coordinates (using convertrect:fromwindow: method) or view coordinates (using convertrect:fromview: method) before using it. uikeyboardframeenduserinfokey key nsvalue object containing cgrect identifies end frame of keyboard in screen coordinates. these coordinates not take account rotation factors applied window’s contents result of interface orientation changes. thus, may need convert rectangle window coordinates (using convertrect:fromwindow: method) or view coordinates (using convertrect:fromview: method) before using it. what meaning of start frame , end frame ? difference between them? ...

multithreading - Get the TThread object for the currently executing thread? -

i want function getcurrentthread returns tthread object of current executing thread. know there win32 api call getcurrentthread, returns thread id. if there possibility tthread object id that's fine. the latest version of delphi, delphi 2009, has currentthread class property on tthread class. this return proper delphi thread object if it's native thread. if thread "alien" thread, i.e. created using other mechanism or on callback third party thread, create wrapper thread around thread handle.

python - how to get started with google app-engine? -

i m starting build python application in windows platform using google appengine whats steps debug , run application on windows use aptana . once you've installed that, run it, go plugins tab , pydev. pydev has inbuilt support google app engine - can create app engine project, , run or debug it. see these posts more details: http://pydev.blogspot.com/2009/05/testing-on-pydev-146-google-app-engine.html http://pydev.blogspot.com/2009/05/pydev-146-released-google-app-engine-on.html

java - Multiple transaction managers with @Transactional annotation -

we have base generic manager inherited managers. base manager annotated @transactional annotations. there 2 groups of transactional services: x.y.service1.* - have managed transactionmanager1 x.y.service2.* - have managed transactionmanager2 how can transactions configured without nessesity override transactional methods , specify transaction manager? @transactional(readonly = true) public abstract class genericmanagerimpl<d extends igenericdao, t extends baseobject, pk extends serializable> implements igenericmanager<t, pk> { protected d dao; @autowired public void setdao(d dao) { this.dao = dao; } @transactional(readonly = false) public void save(t object) { dao.save(object); } @transactional(readonly = false) public void remove(t object) { dao.remove(object); } } @service class usermanagerimpl extends genericmanagerimpl<iuserdao, user, long> implem...

Onscreen keyboard covers up EditText on QVGA800 skin(resolution) in android 1.5 -

in android 1.5 sdk, qvga800 skin(resolution), added 8 edittext in linearlayout. when 8th edittext box tapped, onscreen appears. however, layout doesnt move enough, mean, moves still covers edittext box being typed. how solve ? main class : package com.i; import android.app.activity; import android.os.bundle; import android.widget.edittext; public class myclass extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); edittext txt1=(edittext)findviewbyid(r.id.txt1); edittext txt2=(edittext)findviewbyid(r.id.txt2); edittext txt3=(edittext)findviewbyid(r.id.txt3); edittext txt4=(edittext)findviewbyid(r.id.txt4); edittext txt5=(edittext)findviewbyid(r.id.txt5); edittext txt6=(edittext)findviewbyid(r.id.txt6); edittext txt7=(edittext)findviewbyid(r.id.txt7); edi...

PHP session and multiple mixed PHP/HTML sections in one page -

if have page multiple <?php ... ?> sections interspresed pure html sections. notice $_session varible set in 1 <?php ... ?> section not available in on same page. so, what's best practise? 1) call session_start() first line of each <?php ... ?> section? 2) have 1 <?php ... ?> section covers whole page? if so, have wrap each html section in echo , annoying of html form elements. maybe heredoc them? it's first time try sort of thing, not first 1 - what's accepted best practise? edit: aplogies, stupid fault. 1 of sections php started <? , not <?php if have page multiple sections interspresed pure html sections. notice $_session varible set in 1 section not available in on same page. the sections of php tags <?php ... ?> have nothing session. make sure put: session_start() on top of page.

css - What is the point of @import? -

can explain benefits of using @import syntax comparing including css using standard link method? it allows keep logic css file spread on multiple physical files. helps in team development, example. useful when have lot of css files want separate functional areas (one grids, 1 lists, etc), let have accessible in same logical file.

database - MySQL Limit with Many to Many Relationship -

given schema implementing tags item itemid, itemcontent tag tagid, tagname item_tag itemid, tagid what best way limit number of items return when selecting tags? select i.itemcontent, t.tagname item inner join itemtag on i.id = it.itemid inner join tag t on t.id = it.tagid is of course easiest way them back, using limit clause breaks down, because duplicate of items each tag, counts toward number of rows in limit. my second solution uses mysql function group_concat() combine tags matching item comma-separated string in result set. select i.itemcontent, group_concat(t.tagname order t.tagname) taglist item inner join itemtag on i.id = it.itemid inner join tag t on t.id = it.tagid group i.itemid; the group_concat() function mysql feature, it's not part of standard sql.

php - How to set up your own PEAR Channel? -

i looking instructions on how setup pear channel our project can deploy pear installer. have searched web while , cannot find straightforward information. followed this tutorial while, having hell of time getting work. know how this? there simpler way? it looks 1 of few people want this. tutorial linked appears latest (!) package still somewhat in development . documentation in package non-existent. looks it's write docs. or maybe contact greg beaver ; author of package , blog post linked to. wrote book pear (albeit in 2006.) amazon writeup mentions this: next, learn how set own pear channel distributing php applications, both open-source , proprietary closed-source php applications can secured using technology built pear installer .

How do I use full text search across multiple tables, SQL Server 2005 -

i have full text catalog 2 tables in it. tablea has 4 columns (a1, a2, a3, a4) of wich 3 indexed in catalog, a2,a3,a4. a1 primary key. tableb has 3 columns (b1, b2, b3, b4), 2 of indexed in catalog, b3 , b4. b1 pk of table, b2 fk tablea. i want like select *, (fttablea.[rank] + fttableb.[rank]) total_rank tablea inner join tableb on tablea.a1=tableb.b2 inner join freetexttable(tablea, (a2,a3,a4), 'search term') fttablea on tablea.a1=fttablea.[key] inner join freetexttable(tableb, (b3,b4), 'search term') fttableb on tableb.11=fttableb.[key] but not work... can single table work, eg. select *, (fttablea.[rank] + fttableb.[rank]) total_rank tablea inner join freetexttable(tablea, (a2,a3,a4), 'search term') fttablea on tablea.a1=fttablea.[key] but never more 1 table. could give explanation and/or example of steps required full-text search on multiple tables. your query returns records, if both , related b contains search text. you n...

visual studio - Debug a Windows Mobile 5 Application on a Physical Device -

i'm trying debug , test application dell windows mobile device using visual studio 2008. can connect device , deploy on device using activesync. problem i'm having when debugging, after project deployed on device, breakpoints never hit , application runs on device. visual studio hangs there , nothing. don't know what's wrong it... frustrating...help me!! thanks!! make sure have of latest service packs both studio , compact framework installed on pc. you're got mismatch in versions.

iphone - CoreData best practices -

i'm using coredata in latest iphone app. find complex @ beginning guess best choice when need store objects in iphone app ( http://inessential.com/2010/02/26/on_switching_away_from_core_data ). is there best practices when using coredata in iphone app? example, don't want controllers deal nsmanagedobjectcontext need when want make requests. define class coredata requests? i create dedicated object manage core data stack , related objects , behaviors. useful because there lot of boiler plate core data can make generic base manager class , use subclass each app. call appnamedatamodel. i prefer hide managed object context inside datamodel object. forces other objects in app ask datamodel object access core data stack gives encapsulation , safety. usually, create methods in datamodel class return fetches entities e.g. -(nsfetchrequest *) entitynamefetch; ... , have performfetch method in datamodel. in use, controller ask fetch entity, configures fetch , ask ...

math - Python: unsigned 32 bit bitwise arithmetic -

trying answer post solution deals ip addresses , netmasks, got stuck plain bitwise arithmetic. is there standard way, in python, carry on bitwise and, or, xor, not operations assuming inputs "32 bit" (maybe negative) integers or longs, , result must long in range [0, 2**32]? in other words, need working python counterpart c bitwise operations between unsigned longs. edit: specific issue this: >>> m = 0xffffff00 # netmask 255.255.255.0 >>> ~m -4294967041l # wtf?! want 255 you can mask 0xffffffff : >>> m = 0xffffff00 >>> allf = 0xffffffff >>> ~m & allf 255l

Java print time of last compilation -

i'm looking embed piece of code print out time when current class last compiled. how can implemented in java? there no direct support in java, since there no preprocessor. closest equivalent "build-date" attribute in jar manifest. many build systems add attribute default, or provide means add it. you can read manifest of jar @ runtime date. answer so question describes how read values jar manifest. the alternative use resource filtering add date properties file, read @ runtime. quite ad-hoc, non-standard , if have many jars, different compilation times, becomes difficult manage, unless can factor common part of how jars built.

string - Does xslt have split() function? -

how split string based on separator? given string topic1,topic2,topic3 , want split string based on , generate: topic1 topic2 topic3 in xslt 1.0 have built recursive template. stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="text/text()" name="tokenize"> <xsl:param name="text" select="."/> <xsl:param name="separator" select="','"/> <xsl:choose> <xsl:when test="not(contains($text, $separator))"> <item> <xsl:value-of select="normalize-space($text)"/> </item> ...

java - Iterating through a Collection, avoiding ConcurrentModificationException when removing in loop -

we know can't this: for (object : l) { if (condition(i)) { l.remove(i); } } concurrentmodificationexception etc... apparently works sometimes, not always. here's specific code: public static void main(string[] args) { collection<integer> l = new arraylist<integer>(); (int i=0; < 10; ++i) { l.add(new integer(4)); l.add(new integer(5)); l.add(new integer(6)); } (integer : l) { if (i.intvalue() == 5) { l.remove(i); } } system.out.println(l); } this, of course, results in: exception in thread "main" java.util.concurrentmodificationexception ... though multiple threads aren't doing it... anyway. what's best solution problem? how can remove item collection in loop without throwing exception? i'm using arbitrary collection here, not arraylist , can't rely on get . iterator.remove() safe, can use this: list<string...

css - Parent div is blocking cursor focus from child divs in IE7 -

here's idea: have div element, #content_wrapper, encompasses 3 floated divs, #left_column, #nav, , #content. here's styles on #content_wrapper: #content_wrapper { float:left; background: url("images/bg-tan.jpg") repeat-y left center; position:relative; } however, in internet explorer 7 #content_wrapper seems steal cursor child elements. whenever hover on #content_wrapper, cursor switches beam , i'm unable click on of links or text inside div. thoughts? update: i've tried following fixes, none of have worked. applying fixed width elements, including parent , top level children apply position: relative elements , z-index using !important on above properties in case adding "zoom" property parent , child divs adding "overflow" property parent div #content_wrapper { position: relative; z-index: -1; width: 1010px; } edit: setting z-index of #content_wrapper -1. why it's happening. rid of or set posi...