Posts

Showing posts from August, 2012

Logging/tracking in PHP: Scribe, Chukwa, log4php? -

this pretty high-level question requires lot of explaining, i'm in need of lot of explaining. basically i'm developing php application requires lot of logging , tracking. tracking clicks, interactions, performance, etc. etc. under sun. facebook's scribe , yahoo's chukwa both great implementations of this. know little log4php. what want high-level overview of how kind of logging works, in conjunction php application. can stop @ point log gets processed; know want use hadoop/hive processing , storage. i'd low-level looks @ happens within application itself. example, how 1 take behavior of click , send logger? i'd appreciate reading can me started, well. you can buy/get tools or build in-house. buy/get: 1 - tag pages google/yahoo analytics - track pageviews, page flow performance, seo ranking keywords, etc. 2 - tracking , logging user behavior, include clicks, interactions , performance. found nothing better clicktale - http://www.clicktale...

spell checking - What is the best way to implement a FSA/FSM in Java -

i have big finite state automaton 50 states , each state has avg. 3-4 transitions other states. don't think "state pattern" suitable this. fsm tends spellchecker , morphological analyzer agglutinative language. what best way implement fsa/fsm in java or should use open source library. since natural languages not regular (have exception cases), there way make implementation flexible such situations. thanks it seems straightforward implement directed, labelled graph. perhaps there graph libraries java appropriate too, have no experience them leave others make specific recommendations.

What tool do you use for counting lines of source code in Visual Studio Projects? -

i know there quite few line count tools around. there simple that's not part other big package use ? slick edit gadgets has nice report breaking down lines of code, whitespace , comments. plug-in free , relatively small.

jFreeChart: Possbile to combine StatisticalBarRenderer and LayeredBarRenderer? -

i want create chart consists of couples of 2 bars. 1 of them regular bar, second 1 layered , has deviation. (photoshopped): alt text http://dl.dropbox.com/u/1144075/bildschirmfoto%202010-07-23%20um%2011.57.59.png this snippet of code: private static jfreechart createstatisticalbarchart(defaultstatisticalcategorydataset dataset, string charttitle, string domainaxislabel, string rangeaxislabel, list<string> sunndaymap) { categoryaxis xaxis = new categoryaxis(domainaxislabel); valueaxis yaxis = new numberaxis(rangeaxislabel); categoryitemrenderer renderer = new statisticalbarrenderer(); categoryplot plot = new categoryplot(dataset, xaxis, yaxis, renderer); jfreechart chart = new jfreechart(charttitle, new font("arial", font.plain, 10), plot, true); my dataset has mean+standarddeviatin records every second record's deviation being "0", no range indicators displayed. anyone idea how can acc...

Add data to couchdb with jsonp response -

is there way add data couchdb runs on domain , response whether operation or not? know couchdb supports jsonp callback can add data approach? no, cannot this. couchdb's rest api requires post or put request in order insert data, jsonp supports requests. can retrieve data couchdb across domains, updates/inserts/deletes won't work.

How do you stop IIS SMTP Server from sending bounce emails? -

how stop "default smtp virtual server" sending bounce messages email addresses don't have? i.e. i'm using iis' smtp server handle email , if email sent unknown @ mydomain.com bounce email 'address not known' (or that) sent sender. want silently fail. i found article has script can run configure catch-all account on server. emails generate ndr instead directed account. sorry, haven't tested it. basically short answer question no. brett on note, if don't want spend money, or have no budget, , want better email system, try smarter mail can use free 10 users. sure there others out there, have used smarter mail in past successfully.

c++ - g++ duplicate symbol error when working with templates (noob question) -

so i'm trying pick c++, , decided write generic group class using templates, takes type , size template parameters: in group.h: #ifndef __group_h #define __group_h #define max_size 10 /********************************************************** * define group class handles collection of members * of type **********************************************************/ template <class type, int max> class group { private: std::string name; int count, size; type * members[max]; public: group(); group(const std::string & _name); ~group(); // display instance info virtual void show(); // add member void add_member(type &); // list memebers void list(); // name setter/getter void set_name(const std::string &); const std::string & get_name(); }; #endif group.cc: /********************************************************** * class methods group ************...

SQL Server 2005 Encryption, asp.net and stored procedures -

i need write web application using sql server 2005, asp.net, , ado.net. of user data stored in application must encrypted (read hipaa). in past projects required encryption, encrypted/decrypted in application code. however, encrypting passwords or credit card information, handful of columns in couple tables. application, far more columns in several tables need encrypted, suspect pushing encryption responsibilities data layer better performing, given sql server 2005's native support several encryption types. (i convinced otherwise if has real, empirical evidence.) i've consulted bol, , i'm adept @ using google. don't want links online articles or msdn documentation (its i've read it). one approach i've wrapped head around far use symmetric key opened using certificate. so 1 time setup steps (performed dba in theory): create master key backup master key file, burn cd , store off site. open master key , create certificate. backup certificate ...

Can a Silverlight application use containing HTML styles? -

i'm developing silverlight 4 app has live within existing asp/html based site, has own css stylesheet. want silverlight app share , feel of container application, i'm wondering best way accomplish this. way can think of translate css styles silverlight styles (perhaps automated tool), seems lot of work pretty common use case. is there better way? there existing tools make easier? thanks! creating silverlight styles based on styles of site idea. don't know if there automated tool this, css have long , complex necessary. you might consider modifying existing silverlight theme match site.

c# - postback on click for type ahead drop down -

i have type head drop down list created. had turn autopostback false because otherwise post user typing. want poast when use has made selection. i don't wanna use submit button or that. long story, trust me it's not solution situation. in javascript type ahead when use clicks enter post back. work great. however whast when user click mouse? use onblur event postback. requires clicking outside of drop down list. i want postback happen when click new item. postback when itemchanged, if changed clicking on it. any ideas??? providing using date version of type ahead, library comes set of callback functions available here. to execute callback, pass in via bind method when initialize type ahead. example code: // attach type-ahead class $autocomplete.typeahead({ hint: true, highlight: true, minlength: 1 }, { displaykey: 'value', source: substringmatcher($autocompleted...

web services - DynamicPopulateExtender ,TextArea and line feeds -

i have in page : <textarea id="taeditablecontent" runat="server" rows="5"></textarea> <ajaxtoolkit:dynamicpopulateextender id="dpeeditpopulate" runat="server" targetcontrolid="taeditablecontent" clearcontentsduringupdate="true" populatetriggercontrolid="hlink" servicepath="/content.asmx" servicemethod="editcontent" contextkey='<%=contextkey %>' /> basically, dynamicpopulateextender fills contents of textarea webservice. problem is, no matter how return line breaks, text in text area have no line feeds. if return newlines "br/" entire text area remains empty. if return new lines "/r/n" , text 1 continous line. webservice returns string correctly: <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://rprealm.com/">first line third line fourth line</string...

python regex to match multi-line preprocessor macro -

what follows regular expression have written match multi-line pre-processor macros in c / c++ code. i'm no means regular expressions guru, i'd welcome advice on how can make better. here's regex: \s*#define(.*\\\n)+[\s]+(?!\\) it should match of this: #define foo(x) if(x) \ dosomething(x) but of (shouldn't match next line of code: #define foo(x) if(x) \ dosomething(x) normalcode(); and shouldn't match single-line preprocessor macros. i'm pretty sure regex above works - said, there better way of doing it, , imagine there ways of breaking it. can suggest any? this simple test program knocked up: #!/usr/bin/env python test1=""" #include "foo.h" #define bar foo\\ x #include "bar.h" """ test2=""" #define bar foo #define x 1 \\ 12 \\ 2 \\\\ 3 foobar """ test3=""" #define foo(x) if(x) \\ dosomething(x) """ test4=...

opengl - c++ Having multiple graphics options -

currently app uses direct3d9 graphics, in future i' m planning extend d3d10 , possibly opengl. question how can in tidy way? at present there various render methods in code void render(boost::function<void()> &call) { d3ddevice->beginscene(); call(); d3ddevice->endscene(); d3ddevice->present(0,0,0,0); } the function passed depends on exact state, eg mainmenu->render, loading->render, etc. these oftern call methods of other objects. void rendergame() { for(entity::iterator = entity::instances.begin();it != entity::instance.end(); ++it) (*it)->render(); ui->render(); } and sample class derived entity::base class sprite: public base { idirect3dtexture9 *tex; point2 pos; size2 size; public: sprite(idirect3dtexture9 *tex, const point2 &pos, const size2 &size); virtual void render(); }; each method takes care of how best render given more detailed settings (eg pixel shaders suppo...

Can anyone recommend a Silverlight 2 book? -

even though silverlight2 still in it's infancy, can recommend book started with? 1 has more of developer focus designer one? i have 1 pre-ordered: "programming silverlight 2" jesse liberty , tim heuer. authors both employed microsoft working on silverlight 2, , blogs great, expect book (to released after rtm) date.

java - Most robust way to convert a CVS repository containing Eclipse projects to git? -

i have situation have elderly cvs repository convert git once , while keeping full history etc. all folders @ root of repository contains eclipse projects (either plain or dynamic web projects) including .classpath , .project. use team projectsets check out projects need given task (where project set located in project containing main, , rest library projects). when team projectset checked out, workspace populated. this approach has worked pretty many years (except project set part came 3.5), , work in similar way git if possible, uncertain how. i've played git cvs import failed - due not using modules. how suggest this, , how should work git allow our current usage of shared library projects? have introduce maven , create maven modules our library projects? or ant ivy? edit: i've managed convert our cvs repository subversion suitable cvs2svn invocation , found eclipse recognizes resulting subversion repository nicely. unfortunately after cloning http:/...

c++ - Quick and dirty way to profile your code -

what method use when want performance data specific code paths? this method has several limitations, still find useful. i'll list limitations (i know of) front , let whoever wants use @ own risk. the original version posted over-reported time spent in recursive calls (as pointed out in comments answer). it's not thread safe, wasn't thread safe before added code ignore recursion , it's less thread safe now. although it's efficient if it's called many times (millions), have measurable effect on outcome scopes measure take longer don't. i use class when problem @ hand doesn't justify profiling code or data profiler want verify. sums time spent in specific block , @ end of program outputs debug stream (viewable dbgview ), including how many times code executed (and average time spent of course)). #pragma once #include <tchar.h> #include <windows.h> #include <sstream> #include <boost/noncopyable.hpp> namespace...

windows - Testing network interrupts in software -

i have network c++ program in windows i'd test network disconnects @ various times. options? currently am: actually disconnecting network wire of computer using ipconfig /release using cports program close out socket completely none of these methods though ideal me, , i'd emulate network problems more easily. i connects fail, socket reads fail, , socket writes fail. great if there utility use emulate these types of problems. it nice able build automated unit tests while emulated bad network up. you might want abstract network layer, , can have unit tests inject interesting failure events @ appropriate points.

java - Standard JSON representations -

we building webservice consumes , produces json. problem: kind of confused how represent specific details of object. example: specify empty element or null element null in json the question ask our self how represent object when properties null. example: car object , color , make properties, null. we represent car : { "color": null, "make" : null } some people argue should represented car : null so lets say, car : null right way it. car not exact representation of domain object. piece of domain object, lets call big car. make car view object in kind of translator. find painful way of checking each field in car object , if null, set car null, jackson jaxb provider can render null. know that's not right way it. can suggest alternative?? is there 1 place can check, there view object children null?? , set null. which way more consumable?? if understand correctly there 3 different situations trying represent. 1 there no c...

jQuery form with .load()ed elements ignores them -

thanks reading. i have form few elements in it. inside form div.graph . when form submitted, div .load() 'd result, includes additional form elements, such page selector. form submitted repeatedly part of updated each time via .load() . it's submitted so: /* ... */ // build form info necessary. formaction = './stats_chart.php?cb='+math.random(); formdatajson = $('#frmstats').serializearray(); // hide current report, , blank out div. chartitem.find('.graph').load(formaction, formdatajson, function(){/* etc... */}); the results so: /* ... bunch of crap */ <select id='pageselector' name='pageselector'> <option value='1'>1</option> </select> the problem if submit form, .load() results, , submit again, elements .load() 'd aren't present in either formdatajson , or form post. seems not recognized serializearray() . any ideas what's going on? have name attribs of elements, ...

video - How to do Flash pseudo-streaming? -

i need build starts serving h.264 encoded video flash player halfway through file (to support skipping point in video has not been buffered yet). currently, videos in flv container format, transcoding option. managed re-write file header , metadata information given byte offset. works older videos, not h.264 encoded files. suspect because video tags inside file have altered, not feasible (it take processing power). what "proper" way it? the flash player can start playing h.264 video once it's downloaded moov atom. existing pseudo-streaming providers give flv header - either first 13 bytes of file or hardcoded 1 - , serve file given offset. if want make h.264 pseudo-streamer, you'll need have output flv header, moov atom, , serve rest of file given offset. if don't use flv container, won't need flv header, you'll still need moov atom. unfortunatley, don't think you'll able use moov atom file on disk; information contains won...

iphone - Storing an image and display it when I launch the app again -

hey guys, have questions ask: i wanna ask how can store image next time when user open app , app show image choose it? the image taken either photo library or camera photo don't think can path photo , store path right? anyway can ? you convert image nsdata , store nsdata in plist file @ applicationdidfinishlaunching. nsdata *data = uiimagejpegrepresentation(your image, 1);

c - confusion about static variables -

i have confusion in concepts of static integer.when initialize static integer in main function i.e static int i; now static integer assigned value 0.now in next step: i++; i becomes 1. now program terminates. want know program produce on its' next run. also, happen if entire program closed? understand first line static int i; next value when function next run should retain value of when run. if so, advantage of making variable static? variable have time limit or can stored forever? value if ran function again? in c, "static" means variable has local scope within global storage. the scope of variables in c block. in other words variables can used inside block declared. , keep values until block ends, being lost after that. example: { int a; // can used here { int b; // , b can used here { int c; // a,b , c can used here } //just , b can used here. c not available anymore } // can u...

Elixir/SQLAlchemy equivalent to SQL "LIKE" statement? -

i'm using mysqlicious type schema described here simple tagging system. i've read alternative implementations of tagging schema in 4 different threads, , suits needs best. a collection of entries have tags "apple banana orange" , "strawberry banana lemon", , i'm trying find elixir/sqlalchemy equivalent statement to select * table tags "%banana%"; i haven't been able find such way structure class.query.filter/filter_by() command, , can't see similar method in documentation either module. there simple way this? or should use raw sql. extra question: disadvantage of mysqlicious schema case may wish search "%apple%" have "pineapple" returned. there high level way deal test case? or should include leading space in each query? n.b: care, first experience databases, may overlooking core advantages of schema mentioned in other threads. application logging sentence or 2 task completed, columns [taskid, tags, no...

c# - Trying to save output from RenderPartial to a Javascript variable and use it later -

in create view: <script type="text/javascript"> var tabcontent = "<% html.renderpartial("productedit", new web.model.product()); %>"; </script> unfortunately seems break. @ least quotes (") aren't escaped (\"). how "inject" results of renderpartial js? instead of storing variable, can put in placeholder, this: <div id="tabcontent" style="display: none;"> <% html.renderpartial("productedit", new web.model.product()); %> </div> then when want use it, via .innerhtml , this: var myvar = document.getelementbyid('tabcontent').innerhtml; this useful in other scenarios, if want clone it, etc...it depends how intend use it, i've found more useful approach in cases.

How do I see the list of open files within Emacs? Or browse a directory within Emacs? -

most text editors have navigation pane lets see files have open. or pane lets browse file directory. how do in emacs? try ctrl-x followed ctrl-b (in emacs terminology c-x c-b ) list buffers.

visual studio 2008 - Branching and Merging in VSTS -

how effective merging when folders , projects have been renamed in solution? we've had lots of success tfs 2005 when comes file deletes/renames, few specific exceptions, namely: files have been renamed in both source , target branches (this trivially solved click on "ignore server changes"); files have been renamed in target branch deleted in source branch. recall 1 case merge not work no matter tried, , forced "revert" change on source branch , re-do after merge. supposedly tfs 2008 solves lot of these issues, aside occasional merge hickups tfs stable, , hierarchical merges lot simpler , quicker svn.

c# - ASHX image handler works with chrome, not IE8 -

i've created code retrieve image file system using ashx handler. code displays image correctly in chrome, broken image in ie: public class imagehandler : ihttphandler { private int? qs_imageid { { int? temp = null; if (httpcontext.current.request.querystring["imageid"] != null) temp = ha.utility.datahelper.parsedbint(httpcontext.current.request.querystring["imageid"]); return temp; } } private bool qs_thumbnail { { bool thumbnail = false; if (httpcontext.current.request.querystring["thumbnail"] != null) { if (httpcontext.current.request.querystring["thumbnail"].equals("1")) thumbnail = true; } return thumbnail; } } public void processrequest(httpcontext context) { if (qs_imageid.hasvalu...

jQuery Validation Plugin - Submit only after checking a variable -

i have done small validation myself , end either - myvalid = true or mayvalid = false. how can add check validation doing on form using validation plugin? you can use .addmethod() add custom validation methods validation plugin. http://docs.jquery.com/plugins/validation/validator/addmethod#namemethodmessage update: here's example can test: http://jsfiddle.net/w8esu/ html <form id='theform'> <input id='test_field' name='test_field' value='jquery' /> <br> <input id='test_field2' name='test_field2' value='prototypejs' /> </form>​ jquery // add validation method validator plugin // can applied rule whatever fields // want. way custom validation // integrated functionality of plugin $.validator.addmethod( "mustincludejquery", function(value, element) { return value.tolowercase().indexof('jquery') > -1...

javascript - How to force browser to reload cached CSS/JS files? -

i have noticed browsers (in particular, firefox , opera) zealous in using cached copies of .css , .js files, between browser sessions. leads problem when update 1 of these files user's browser keeps on using cached copy. the question is: elegant way of forcing user's browser reload file when has changed? ideally solution not force browser reload file on every visit page. post own solution answer, curious if has better solution , i'll let votes decide. update: after allowing discussion here while, have found john millikin , da5id 's suggestion useful. turns out there term this: auto-versioning . i have posted new answer below combination of original solution , john's suggestion. another idea suggested scdf append bogus query string file. (some python code automatically use timestamp bogus query string submitted pi .). however, there discussion whether or not browser cache file query string. (remember, want browser cache file , use on future visi...

Pie3d flash charts -

is there free flash library use generate pie3d charts inside as3 project? http://developer.yahoo.com/flash/astra-flash/charts/ pie3d. thanks, szymon take @ amcharts has 3d pie , it's free long don't mind small link in corner.

css - element's z-index value can not overcome the iframe content's one -

i have div , iframe on page div has z-index: 0; the iframe has content popup having z-index of 1000 z-index: 1000; however, div still overshadows popup in ie (but works fine in firefox). does know can do? explorer z-index bug in general, http://www.quirksmode.org/ excellent reference sort of thing.

performance - How to identify unused css definitions -

are there approaches identify unused css definitions in project? bunch of css files pulled in , i'm trying clean things bit. take @ firefox extension dust-me @ https://addons.mozilla.org/en-us/firefox/addon/dust-me-selectors/ .

cryptography - Crypto/X509 certificate parsing libraries for Python -

any recommended crypto libraries python. know i've asked similar in x509 certificate parsing libraries java , should've split question in two. what need ability parse x.509 certificates extract information contained in them. looking around, i've found 2 options: python openssl wrappers ( http://sourceforge.net/projects/pow ) pyopenssl of two, pyopenssl seems "maintained", i'd feedback on might have experience them? you might want try keyczar mentioned me in other post, since library has implementations both python , java. make easier use in both contexts. a word of warning: have not used library 8(, please take grain of salt.

latex - How to order citations by appearance using BibTeX? -

by default (using plain style) bibtex orders citations alphabetically. how order citations order of appearance in document? there 3 answers question. use unsrt bibliography style, if you're happy formatting otherwise use makebst (link) tool design own bibliography style and personal recommendation: use biblatex package (link) . it's complete , flexible bibliography tool in latex world. using biblatex , you'd write like \documentclass[12pt]{article} \usepackage[sorting=none]{biblatex} \bibliography{journals,phd-references} % journals.bib , phd-references.bib bibtex databases \begin{document} \cite{robertson2007} \cite{earnshaw1842} \printbibliography \end{document}

asp.net - Dealing with IOExceptions with XmlWriter.Create() and XmlDocument.Load() in separate threads -

i have inherited code involves scheduled task writes data (obtained external source) xml files, , website reads said xml files information presented visitor. there no synchronization in place, , needless say, scheduled task fails write file because open reading. the heart of writer code is: xmlwriter writer = xmlwriter.create(filename); try { xmldata.writeto(writer); } { writer.close(); } and heart of reader code is: xmldocument thedocument = new xmldocument(); thedocument.load(filename); (yep no exception handling @ either end) i'm not sure how best approach trying synchronize these. far know neither xmlwriter.create() nor xmldocument.load() take parameters regarding file access modes. should manage underlying filestreams myself (with appropriate access modes) , use .create() , .load() overloads take stream parameters? or should catch ioexceptions , sort of "catch, wait few seconds, retry" approach? provided web site not need write xmldoc...

activerecord - rails find: using conditions while including same table twice via different named associations -

i have posts sent users other users. there 2 models - :post , :user, , :post has following named associations: belongs_to :from_user, :class_name => "user", :foreign_key => "from_user_id" belongs_to :to_user, :class_name => "user", :foreign_key => "to_user_id" both :user , :post have "is_public" column, indicating either single post and/or entire user profile can public or private. my goal fetch list of posts public , recipients have public profiles. @ same time, "include" both sender , recipient info minimize # of db calls. challenge "including" same table twice via named associations, in "conditions" need make sure filter recipient's "is_public" column. i can't following because "conditions" not accept association name parameter: post.find(:all, :include => [ :to_user, :from_user ], :conditions => { :is_public => true, :to_user => { :...

ios - How do I access SQLite database instance on iPhone? -

i'm developing iphone app uses built-in sqlite database. i'm trying view , open database via sqlite3 command line tool can execute arbitrary sql against it. when run app in simulator, .sqlite file creates located @ ~/library/application support/iphone simulator/user/applications/ . how can see file on physical iphone? in xcode select window->organizer , expand node next application in applications section on phone. select black downward pointing arrow next application data , save file anywhere on desktop. sqlite database should in there somewhere. as how go getting on phone once done have no clue.

javascript - Jquery .Get() pulls NULL in Internet Explorer -

i have problem ajax call in jquery. works on chrome, ff, , safari, not ie. in fact in ie nothing happens @ all, no errors, no data loaded. here code: $(document).ready(function() { $.ajaxsetup({ cache: false }); $.get("shoppingcart2.aspx", { }, function(data) { //query jq object values alert(data); alert($(data).find('#items').text()); var inti = parseint(($(data).find('#items').html())); with alert data find data page making call from, unfortunately data.find methods pull null ie. i'm not sure if it's code or browser, stuck. thank help. edit: did add in cache: false command, still have no luck. cannot understand why won't work in ie. try (once in page/external js, before ajax calls): $.ajaxsetup({ cache: false }); ie likes cache hell out of things, , if testing , had no content there @ 1 point, chances ie holding onto it. using $.ajaxsetup() , and telling de...

How to capture console output from a service C#? -

we have c# service deployed remote customer system. application writes substantial amount of "diagnostic" information console (i.e. console.writeline()). service isn't "doing should." how can capture console output service in application? a winform version application can loaded @ customer location. it, unfortunately, functions correctly. update: we able change change service, prefer not make major changes @ time. we logging msmq, "important" events. service interact msmq normal operations. or, @ least, should. service doesn't seem pulling items msmq when winform version does. so, writing messages going console problematic. are able change service code at all ? if so, using console.setout write file instead obvious first port of call. change using proper logging library next release :)

java - Limiting Dependency on Spring Without Losing Power of Framework -

simplified architecture of web projects war spring dependency injection (most use xml) jar dao domain the problem: spring 3 , 2.5+ annotations building repositories , services has become easier wire together. however, because @service conceptually belongs in jar far more war, , auto-wired repositories, , transactional classes, do. how people work it's expected not have "spring dependencies" in actual jar classes, i've found in multiple companies goal. obviously know cannot remove spring dependencies if want use annotations , transactions, since spring classes, there best practice people use limit liability if there changes spring, or there projects use older spring versions in war included in jar? i'm assuming must common problem, if not, please ask , elaborate annotation based dependency injection (very convenient) violation of separation of concerns. dependency describe result of this. if avoid sho...

How do I search TFS for a word without 'getting' the project? -

this question has answer here: find in files: search code in team foundation server 12 answers i have occasion search function name in project haven't retrieved team foundation server (tfs) , don't want retrieve. there way search function name (any word) on tfs? does answer question? find in files: search code in team foundation server good luck, martin.

java memory management -

i'm c++ programmer , i'm playing around java after finding jpa few of current applications god send. haven't touched java since university , i'm having problem running out of heap space. i'm using code below main part of not-very-serious test of jdbc/jpa/lucene keep on getting random outofmemory exceptions. entitymanager em = emf.createentitymanager(); query q = em.createquery("select p product p" + " p.productid = :productid"); connection con = drivermanager.getconnection("connection string"); statement st = con.createstatement(); indexwriter writer = new indexwriter("c:\\temp\\lucene", new standardanalyzer(), indexwriter.maxfieldlength.limited); resultset rs = st.executequery("select productid product order productid"); while (rs.next()) { int productid = rs.getint("productid"); q.setparameter("product...

javascript - What does the plus sign do in '+new Date' -

i've seen in few places function fn() { return +new date; } and can see returning timestamp rather date object, can't find documentation on plus sign doing. can explain? that's + unary operator, it's equivalent to: function(){ return number(new date); } see: http://xkr.us/articles/javascript/unary-add/ and in mdn: https://developer.mozilla.org/en-us/docs/web/javascript/reference/operators/arithmetic_operators#unary_plus

r - Model Fit statistics for a Logistic Regression -

i'm running logistic regression model in r. i've used both zelig , car packages. however, i'm wondering if there simple way model fit statistics model. (pseudo r-square, chi-square, log liklihood,etc) assume glm1 ist model , samplesize n = 100 . here goodness-of-fit-measures: r2<-1-((glm1$deviance/-2)/(glm1$null.deviance/-2)) cat("mcfadden r2=",r2,"\n") r2<-1-exp((glm1$deviance-glm1$null.deviance)/2*n) cat("cox-snell r2=",r2,"\n") r2<-r2/(1-exp((-glm1$null.deviance)/n)) cat("nagelkerke r2=",r2,"\n") aic<- glm1$deviance+2*2 cat("aic=",aic,"\n") in way have overview of how calculating gof-measurements.

.net - How to make consistent dll binaries across VS versions? -

for instance, winsock libs works great across versions of visual studio. having real trouble provide consistent binary across versions. dll compiled vs 2005 won't work when linked application written in 2008. upgraded both 2k5 , 2k8 sp1, results haven't changed much. works ok. when include c# app, c# app gets access violation errors, classic c++ application works fine. is there strategy should know when provide dlls ? first, dont pass other plain old data accross dll boundries. i.e. structs fine. classes not. second, make sure ownership not transferred - i.e. structs passed accross dll boundry never deallocated outside dll. so, if dll exports x* getx() function, there corresponding freex(x*) type function ensuring same runtime allocated responsible de-allocation. next: dlls link static runtime. putting project comprimising dls several 3rd parties, each linked , expecting different runtimes, potentially different runtime expected app, pain, potentially forcing i...

debugging - Could "attach source" be made easier for popular Java libraries? -

Image
i run obstacle when debugger steps classfile without corresponding source. finding difficult: you have search site hosting respective project, , find ``download source'' page (for instance, last time searched jpa api, , took me hours obtain sources). or, might required check out revision control. you need know exact version using. otherwise debugger might step comments , empty lines :) there no convention packaging source code—some projects include in jar itself; provide separate zip file; others put in src/ subfolder within zip. i know maven has capability of downloading source repository , including in src paths when ide config file generated. maven's repo poor in terms of content—few libs have source uploaded. why complicated when can made straightforward? have central repo relates classfile (or hash thereof) source file compiled (or link it). maybe rather huge repo, pretty structured. ide plugin query fetch what's needed automatically. have y...

How do I get asp.net 3.5 validator messages to take up space in a form only when displayed? -

my form in asp.net 3.5 set inside html table, , rendering enough space display validator error messages attached textboxes, checkboxes, etc. in each row. my table 3 columns, column 1 labeling each control, column 2 holding controls themselves, , column 3 being reserved validator controls. column 3 pushing whole row taller when have longer error message, , makes form elements display odd spacing in between them. i'd have more uniform form elements, need keep of longer validator error messages. how form display without spaces , adjust when message needs displayed? do have validators set use display property of dynamic? allow them shown when needed.

Hidden features of Windows batch files -

what of lesser know, important , useful features of windows batch files? guidelines: one feature per answer give both short description of feature , example , not link documentation limit answers native funtionality , i.e., not require additional software, windows resource kit clarification: refer here scripts processed cmd.exe, default on winnt variants. (see also: windows batch files: .bat vs .cmd? ) line continuation: call c:\windows\system32\ntbackup.exe ^ backup ^ /v:yes ^ /r:no ^ /rs:no ^ /hc:off ^ /m normal ^ /l:s ^ @daily.bks ^ /f daily.bkf

mpmovieplayercontroller - Playing movie in iPhone 3.1 and 4.0 -

in iphone 3.1 used following code play movie: movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; movieplayer.moviecontrolmode = mpmoviecontrolmodedefault; movieplayer.backgroundcolor = [uicolor blackcolor]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(playbackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:movieplayer]; [movieplayer play]; for reason not work anymore in iphone 4.0 (go apple!). how should play movie in iphone 4.0 while retaining backward-compatibility iphone 3.1?

jquery - ajax and security controller -

i'm using jquery ajax post , when success data , replace items works if add security controller that [authorize] public actionresult ......... if user logged in go ok when user not logged or not authorized should redirected login page as i'm using ajax , not ordinary post user not redirect log in window? can solve problem? or how can know user isn't authorized before post java display alert tell user log in or role didn't match? i think these 2 questions can provide enough info set in right direction. asp mvc [authorize] return post instead of get more control on asp.net mvc's authorize; keep ajax requests ajaxy

sql - How to plot Polyline Area, i.e. service coverage area, and also check to see if visitor's address lies within that area using Google Maps API and PHP? -

i owner of business building new website application. partner programmer doing development , neither 1 of has real in-depth experience google map api or it's polyline/polygon area capabilities. we need easy way capture inputs within our user admin area our locations can enter service coverage area info i.e. 1st street north of jones blvd, or 5 mile radius location address, etc. , have google map api plot polyline borders. then, visitors our site need able see info when view google map 1 of our locations , see if service address falls within service area or not. need set flag somehow trigger notification visitor address not eligible service or delivery. if can assist (example php code interface suggested apis preferred , ideal don't understand complexities of google api, polyline coordinate capture tool, etc), appreciated, have struggled figure out how create in php , more importantly how integrate our existing site. update: thank answer codemeit...how recommend capt...

coldfusion - super() type functionality on ORM CFC -

when use cf9's orm feature , generate explict setter orm cfc, there anyway call default funcitionailty of orm cfc after have done work needed in method. example looking this. obviosuly code not run , , super wrong concept since orm cfc isnt inherting anything, thats type of functionality looking for. public void setmovie(string movie){ if(movie == "inception"){ ormcfc.super().setmovie("greatest movie ever made") }else{ ormcfc.super().setmovie(movie) } in model cfc orm can specify additional "decorator" functions. component persistent="true" table="movie" schema="dbo" output="false" { /* properties */ property name="movieno" column="movieno" type="numeric" ormtype="double" fieldtype="id" ; property name="name" column="name" type="string" ormtype="string" ; /* decorator */ public void...

matrix - library for matrices in c++ -

i have lot of elements in matrix , when access them manually takes pretty long time eliminate bugs arising wrong indexing... there suitable library can keep track of e.g neighbors,the numbering, if element in outer edge or not , on. e.g. va= 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 now write function says like for every neighbor element @ index 12(which 41) i recognize elements @ index 8 (31) , 13 (42). right i'm using vectors ( vector<vector<int>>v; )but code gets pretty difficult , clumsy both write , read since have these annoying if statements in every single function. example: (int i=0;i<matrixsize;i++) if ((i+1)%rowsize!=0){//check it's not in outer edge. //do } what approach suggest? can boost::multiarray me here in way? there other similar? update:: i'm looking more template can access elements template can matrix arithmetichs. there this: http://osl.iu.edu/research/mtl/ or this: http://www.ro...

How to host a rooted namespace extension in Windows Explorer -

there method create namespace extension rooted in particular folder. it involves creating folder name like: my custom nse.{785ee551-dee1-4f57-a8c9-0ef76f346a29} and windows explorer automatically host nse of clsid @ location. but life of me cannot find syntax anymore. used on msdn in namespace extension documentation, , listed 3 ways namespace windows explorer - 1 of them. what's syntax - it's driving me crazy! i found it. there 3 ways namespace extension "my computer" specifying namespace extension's location a) add entry registry \software \microsoft \windows \currentversion \explorer \(virtual folder name) \namespace \{785ee551-dee1-4f57-a8c9-0ef76f346a29} where " virtual folder name " can 1 of mycomputer desktop controlpanel networkneighborhood networkneighborhood\entirenetwork remotecomputer b) create folder named my custom...

iphone - i want to call an image to be displayed in a view -

hi wanted display randomly selected images in view. below example of code using generate random numbers displayed in lable. ( around way code , im aware there more concise approach code this. im doing way particular reason wont go now). wish replace the code in each case have code calls image displayed in view nsstring *title = nil; nsstring *path = nil; int number = arc4random() % 12; switch(number) { case 0: namel.text = @"1"; break; case 1: namel.text = @"2"; break; case 2: namel.text = @"3"; break; case 3: namel.text = @"4"; break; case 4: namel.text = @"5"; break; case 5: namel.text = @"6"; break; case 6: namel.text = @"7"; break; case 7: namel.text = @"8"; break; case 8: namel.text = @"9"; break; case 9: namel.text = @"10...

.net - Submit changes of only one entity -

if select many rows 1 table 1 instance of datacontext. , changes in properties in rows, can submit changes database 1 of selected rows? yes can. first need isolate entities want undo changes. then, can use datacontext class override entities values database. myentity e1, e2, e3 // changed entities ... // keep changes e3 list<myentity> undolist = new list<myentity>(); undolist.add(e1); undolist.add(e2); mydatacontext.refresh(refreshmode.overwritecurrentvalues, undolist); mydatacontext.submitchanges(); edit: you can track changed objects in datacontext this: myentity changedentitytosubmit; // first need know entity need submit. list<object> allchangedentities = new list<object>(mydatacontext.getchangeset().updates); allchangedentities.remove(changedentitytosubmit); mydatacontext.refresh(refreshmode.overwritecurrentvalues, allchangedentities); mydatacontext.submitchanges(); this code considering updates. might need consider changes in in...

receiving data over a python socket -

i'm making program retrieves decently large amounts of data through python socket , disconnects when information finished sending. i'm not sure how this all examples on web of tcp clients have while 1: data = sock.recv(1024) but creates infinite loop receive data via socket, not? i need figure out size of message coming in , loop through in buffer-sized increments full message. , after message has finished sending, disconnect, although think connection closed other end. nice thanks you've missed important part of examples - lines follow "recv()" call: while 1: data = conn.recv(1024) if not data: break conn.send(data) conn.close()

javascript - How to turn off caching on Firefox? -

during development have "clear cache" in firefox time in order make use latest version of javascript files. is there kind of setting (about:config) turn off caching javascript files? or, if not, files? enter "about:config" firefox address bar , set: browser.cache.disk.enable = false browser.cache.memory.enable = false if developing locally, or using html5's new manifest attribute may have set following in about:config - browser.cache.offline.enable = false

c# 3.0 - linq help - newbie -

how come work public iqueryable<category> getcategories(int postid) { subnusmvcrepository<categories> categories = new subnusmvcrepository<categories>(); subnusmvcrepository<post_category_map> postcategorymap = new subnusmvcrepository<post_category_map>(); var query = c in categories.getall() join pcm in postcategorymap.getall() on c.categoryid equals pcm.categoryid pcm.postid == 1 select new category { name = c.name, categoryid = c.categoryid }; return query; } but not public iqueryable<category> getcategories(int postid) { subnusmvcrepository<categories> categories = new subnusmvcrepository<categories>(); subnusmvcrepository<post_category_map> postcategorymap = new subnusmvcrepository<post_category_map>(); var query = c in categories.getall() ...

Google docs : does it exist some models in HTML or other webformat to publish a spreadsheet? -

i've tested api of google interact google doc (calendar, spreadsheet, etc) , runs correctly. however, wonder if there framework implements model in html or other web format publish/visualize calendar or spreadsheet within web page. goal integrate spreadsheet/calendar web page , user can modify values of spreadsheet/calendar. does exist similar request? for spreadsheets , google answer publishing: embedding spreadsheet in blog or webpage explains have do. last sentence important: if want embed form in website or blog, click more actions button @ top of editor, , select 'embed' option drop-down menu. but don't forget steps listed above this. for google calendar , there's embed on website - google calendar , answer google, contains slideshow shows have do.

c++ - Posting to a URL with wxWidgets -

does have sample code showing how post url using wxwidgets? documentation , discussion forums imply it's possible methods in wxhttp low-level compared find in .net , scripting languages perl , ruby. have create http request myself , send server via socketoutputstream? missing something? i came across similar problem , ended using curl instead it's cross platform , easy use. tim

javascript - How do I get jQuery to apply an effect to each item in an .each() loop before it finishes? -

i have following list: <div id="test">test</div> <ul> <li>foo</li> <li>bar</li> <li>sta</li> <li>cko</li> </ul> and following jquery code: $(document).ready(function() { $('li').each(function(index) { $('#test').text($(this).text()); $('#test').show("drop", { direction: "down" }, 500, function() { $("#test").delay(1000).hide("puff", {}, 100); }); }); }); logically, should change contents of div test foo , apply drop , puff effect, change contents bar , apply effect, , on. when run it, entire .each loop finishes before effects started, last element cko shows first , gets animated 4 times. how can make each item effect , move on next one? you need add first function on queue if want happen in order of queue, (using .queue() ), this: $(function() { $(...

user interface - Macro/Scripting language for non-developers with a simple GUI-based editor -

we wish provide people able add logic accounts(say, given few arguments, how compute particular result). so, essentially, tantamount writing simple business rules support conditionals , expressions. however, challenge provide them simple online editor can create logic (preferably) visual means (drag/drop expr-tree nodes maybe -- kinda y! pipes). does know of scripting/macro/domain-specific language lets people this? challenge visual editor, since don't wish invest in developing ui editing. basic requirements be: 1. embedded language, or run securely (no reboot -n or <junk-dangerous-command> >> ~/.bashrc ) 2. accessible users without coding background (no need of advanced features) 3. preferably have simple gui based editor create logic programs accessible non-developers (kinda spreadsheets) 4. ability generate compile-time warnings (invalid code) (type safety?) 5. ability embed data before execution available interpreter (eg., name , birthday , amount ) a...

parsing - PHP YAML Parsers -

does know of yaml parser php? if so, pros , cons of library? last updated : july 26th, 2017 here's summary of state of yaml in php: wrappers c libraries: you'll want these if need sheer speed: php-yaml : wrapper libyaml . available pecl extension; 1 on php's docs . syck : binding syck; available pecl extension. (dated, see below) pure php implementations: sfyaml : symfony's yaml component. can see authors' motivations here . wanted " easy use, fast, unit tested , had clear error messages ." spyc : yaml parser without dependencies at time of writing, latest versions release dates aforementioned libraries , versions of yaml spec (1.2 latest version) support are: php-yaml 1.3.0 2016-09-24 yaml 1.1 [php 5] php-yaml 2.0.0 2016-09-24 yaml 1.1 [php 7] syck 0.9.3 2008-11-18 yaml 1.0 sfyaml 3.3.5 2017-06-15 yaml 1.1, of 1.2 spyc 0.6.2 2017-02-24 yaml 1.1