Posts

Showing posts from July, 2014

java - Why my gadget is not receiving data? -

i have application on appspot. on personal domain account. i have put igoogle gadget on igoogle page of gmail account. i sending ajax request gadget : $(document).ready(function(){ jquery.ajax({ type: "get", url: "http://searcegadget2.appspot.com/requestservlet", success: function(msg){ alert(msg); if(msg.search('tr') != -1){ id = msg.split('</tr>').length - 1; //alert(id); $('#amounttable').append(msg); difference(); }else if(msg.search('form') != -1){ $('#gadget').css('display', 'none'); document.write(msg); }else if(msg.search('http') != -1)

How to sync schema continuously in two databases in Sql Server (for unit testing) -

we have database against run unit tests components require database (for several reasons not mocking dal everywhere). we using sql server 2008 r2 , in development db server have our development database (applicationname_dev) , our testing db (applicationname_ut). the unit tests create test data need , delete afterwards tables could/should empty when no tests running. the problem keeping schema of unit test database date. the best solution me (to limited knowledge) have sql server agent job run once night (or when manually started) drops tables in ut database, generate create script tables, indexes , relationships in dev-database, , run create scripts on ut-database. note don't need insert data. is there way of programmatically (t-sql, smo etc) generating create scripts tables including indexes , relationships ? in management studio can right click database->tasks->generate scripts...->choose objects->tables , scripts want (except "use [applicationn

c# - filtering a list using LINQ -

i have list of project objects: ienumerable<project> projects a project class property called tags . int[] i have variable called filteredtags int[] . so lets filtered tags variable looks this: int[] filteredtags = new int[]{1, 3}; i want filter list ( projects ) return projects have of tags listed in filter (in case @ least tag 1 , tag 3 in tags property). i trying use where () , contains () seems work if comparing against single value. how compare list against list need match on items in filtered list ?? edit: better yet, that: var filteredprojects = projects.where(p => filteredtags.all(tag => p.tags.contains(tag))); edit2: honestly, don't know 1 better, if performance not critical, choose 1 think more readable. if is, you'll have benchmark somehow. probably intersect way go: void main() { var projects = new list<project>(); projects.add(new project { name = "project1", tags = new int[] { 2,

java - Any Idea/guess of how twitter saves its tweets in the database and updates it real-time -

i making twitter type of website (not big twitter:), without using twitter api), have decide kind of database should use , how maintain in consistent state. the main problem: suppose website twitter clone(that make question easier understand), if have user "a" has 100 friends , friends tweet same time "a" logs in @ point in time tweets fetched database, database being updated friends tweets => database in inconsistent state q1> best solution it? maintain 2 database, use multi-threading etc? can explain in detail. q2>what best database particular usage. twitter uses nosql database called cassandra. take closer here: apache cassandra

r - How do you combine multiple boxplots from a List of data-frames? -

this repost statistics portion of stack exchange. had asked question there, advised ask question here. here is. i have list of data-frames. each data-frame has similar structure. there 1 column in each data-frame numeric. because of data-requirements essential each data-frame has different lengths. want create boxplot of numerical values, categorized on attributes in column. boxplot should include information data-frames. i hope clear question. post sample data soon. sam, i'm assuming follow this question? maybe sample data illustrate nuances of needs better (the "categorized on attributes in column" part), same melting approach should work here. library(ggplot2) library(reshape2) #fake data <- data.frame(a = rnorm(10)) b <- data.frame(b = rnorm(100)) c <- data.frame(c = rnorm(1000)) #in list mylist <- list(a,b,c) #in melting pot df <- melt(mylist) #separate boxplots each data.frame qplot(factor(variable), value, data = df,

ssl - Android: opending a keystore as an asset to make an SSLSocketFactory -

have bouncy castle keystore, i'd use connect sslsocketfactory. doing in "desktop" java easy, how do on android. it doesn't seem make difference whether put in assets or res/raw - problem comes when trying open , instantiate instance of keystore (java.security.keystore in case) pass sslsocketfactorys constructor. has had success before? what's best way of "reading" , opening it? pointers or code snippets welcome. many thanks don this should do: import android.content.context; import org.apache.http.conn.clientconnectionmanager; import org.apache.http.conn.scheme.plainsocketfactory; import org.apache.http.conn.scheme.scheme; import org.apache.http.conn.scheme.schemeregistry; import org.apache.http.conn.ssl.sslsocketfactory; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.impl.conn.singleclientconnmanager; import java.io.inputstream; import java.security.keystore; public class myhttpclient extends defau

MongoDB C# offic. List<BsonObject> query issue and always olds values? -

i have not issue during query using 2 criterials id , other. use repository storing data id,iso,value. have created index("_id","iso") performs queries queries returning cursor if use 1 criterial _id, returning nothing if use 2 (_id, iso) (commented code). index affecting response or query method failing? use :v1.6.5 , c# official. sample. //getting data public list<bsonobject> get_object(string id, string iso) { using (var helper = bsonhelper.create()) { //helper.db.repository.ensureindex("_id","iso"); var query = query.eq("_id", id); //if (!string.isnullorempty(iso)) // query = query.and(query, query.eq("iso", iso)); var cursor = helper.db.repository.findas<bsonobject>(query); return cursor.tolist(); } } data: { "_id": "2345019", "iso": "uk", "data": "some data"

ios4 - How to manage screen displaying time in iphone for my app? -

i creating iphone application. in needed keep screen on till 30 mins. if user don't perform task within time light of device in can see scree may down untill user again tap. no matter if light goes dimmed within 30 min should not down? media player if user don't tap on screen can see screen coz moview playing. other screen if user don't interact display light down , user need tap on screen. is there way in iphone sdk. please me out. thanks first of disable dimming use [uiapplication sharedapplication].idletimerdisabled = yes; if want set appropriate amount of time can create nstimer time interval of 30 mins (30*60 sec). when timer fires set [uiapplication sharedapplication].idletimerdisabled = no; if user touches screen invalidate current timer , start new one.

.net - Workflow foundation deserialization from business objects -

i'm studying microsoft wf samples , have found serializing/deserializing workflows not finished hold state. don't workflow process , doesn't need additional data continue different thread or code part. maybe i've missed something. can share examples of saving/loading unfinished workflows if it's possible? maybe alternative workflow frameworks can without serialization/deserialization. example restored business object state. you're thinking far small. there many uses beyond can imagine right now. workflow frameworks (unless use type of object db?) serialize workflow state can continued @ later time. microsoft wf, k2 blackperl , many others this. k2 because can have item going through workflow v1 , right in middle update workflow v2 k2 smart enough know should continue processing item under v1 workflow. maybe i'm missing question seems don't serializes workflow storage.

asp.net - server side event for the button having modal pop up extender -

i have button on calling modal pop extender showing panel. below code: <asp:button id="btnone" runat="server" text="view " onclick=" btnone_click" /> <asp:panel id="test" cssclass="modalwindow" width="100%" scrollbars="both" runat="server"> <table id="tblgv" width="100%"> <tr> <td> <asp:gridview id="gvtwo" runat="server"> </asp:gridview> </td> </tr> <tr> <td> <asp:button id="btnpopupcancel" runat="server" text="close" /> </td> </tr> </table> </asp:panel> <asp:modalpopupextender id="modalpop

android - How to apply large scale landscape images -

im developing application in both landscape & portrait mode normal , high screen resolution devices. i used following folders place normal , high screen resoluiton images for portrait mode drawable-mdpi drawable-hdpi for landscape mode drawable-land normal images where need place high screen resolution images i tried placing in drawable-large-land-hdpi folder these images not taking in layout-land xml files. please let me know.. thanks please try: drawable-land-mdpi drawable-land-hdpi

html - Issue with JQuery onchange() event -

so have drop-down list , text-box: <table> <tr> <td>group name: </td> <td><%= html.dropdownlistfor(m => m.indicationcalculatorgroupid, dropdowndata.indicationsgroup(sessionmanager.company.entityid, icconstants.indicationscalculatorgrouptype), "", new { propertyname = "indicationcalculatorgroupid", onchange = "updatefield(this, false);groupnamechange();" })%></td> </tr> <tr id="newgroupnamerow"> <td>new group name: </td> <td><%= html.textboxfor(m => m.indicationcalculatornewgroupname, new { @class = "economictextbox", propertyname = "indicationcalculatornewgroupname", onchange = "updatefield(this);" })%></td> </tr>

sql - multi-row update table with "different" data -

i think best way explain tell have. i have 2 tables , b both have columns field1 , field2. field 2 not populated in table b i want populate field 2 of table b field 2 of table field 1 of table matches field 1 of table b. something update tableb set field2 = tablea.field2 tablea.field1 = tableb.field1. the reason may seem odd , obscure i'm tyring inital data load form old database new one. please let me know if need clarification it sounds need correlated update update tableb b set field2 = (select a.field2 tablea a.field1 = b.field1 ) exists( select 1 tablea a.field1 = b.field1 ); since every field2 in b null begin with, may able skip exists (in case rows in b don't have match in updated null generating bit of redo). want include update rows there match.

class - C# Inconsistent Accessibility (Multiple Classes) -

i getting inconsistent accessibility problem have 1 class contains list of class namespace ns { public class foo { public foo() { this.bar = new list<bar>(); } private list<bar> bar; } public class bar { public bar() { } } } the error property type ns.bar less accessible property ns.foo.bar the structure application each foo consists of dynamic array (list) of bar. it's not ecommerce best example ecommerce store->categories->products in terms of how data accessed. i don't compile errors , shouldn't either, have tried cleaning or rebuilding project before trying again? since bar public should have no problem using in other class.

layout - How to make the jQuery Sticky Float plug-in react live to page changes? -

i've been looking @ rather wonderful 'stickyfloat' plug-in ( http://plugins.jquery.com/files/stickyfloat_0.htm ) jquery project i'm working on. need keep panel on right of page 'in view' content on left scrolls. stickyfloat plug-in works treat doesn't update calculations if use jquery effect length of content block in sits. is there way might able adjust plug-in make respect live changes content div height? i wrote plugin, , have re-posted , fixed issue of height being changed dynamically after plugin initiated, check out: http://dropthebit.com/74/sticky-floating-box/

mercurial - tortoisemerge with Hg reports all lines as changed -

i'd use tortoisemerge mercurial resolve conflicts, reporting every line in theirs , mine added though not comparing properly here mercurial.ini: [ui] merge = tortoisemerge [merge-tools] tortoisemerge.executable=c:\program files\tortoisesvn\bin\tortoisemerge.exe tortoisemerge.args=/mine:$local /theirs:$other /base:$base -o /merged:$output i'm using hg 1.7.5 what's going on? update: when using kdiff or beyondcompare, base empty. thanks your setup appears correct. this symptomatic of having no copy of file in base revision, in case mercurial acts if file present empty. there couple ways of figuring out what's going on here. if there no copies or renames involved, should able do: $ hg log -r "ancestor(p1(), p2())" ..to determine ancestor of merge, then: $ hg manifest -r <rev> | grep <your file> ..to determine if file in fact present. alternately, can run 'hg merge --debug' or 'hg update --debug'

php - Uploadify IO Error - related to Apache user? -

i using uploadify , have deployed 3 different servers: windows, lamp cgi php , lamp php running module. developed code in windows server , when deployed linux cgi php, uploadify works perfectly. however, when deployed in linux php module, got io error in uploadify. interesting thing have other simple upload code using php , works in linux php module server. anyone here has same experience? related fact user runs apache server apache while owner of directory files uploaded different user. had chmod 777 directory still doesn't work. any helps appreciated. in advance. just got confirmation client, when moved site non https, uploads work properly. reason caused problem using uploadify on https site without proper certificate. thing flash component of uploadify give io error opposed clear , detailed error message. actually got idea possibility of https causing error wordpress forum discussing ajax uploader using flash. thanks comments, believe many possible causes

android - recovering activity state with getLastNonConfigurationInstance generates an unchecked cast warning -

in activity want use 'onretainnonconfigurationinstance' method store of data i've loaded in activity (no views). should speed loading , keep consistent state when orientation changes. since return argument single object , want return 2 items i've come following solution: @override public object onretainnonconfigurationinstance() { hashmap< string, object> data = new hashmap<string, object>(); data.put( "madapter", getexpandablelistadapter() ); data.put( "folderlist", folderlist ); return data; } when collect data in oncreate method with: hashmap<string, object> saveddata = ( hashmap< string, object> ) getlastnonconfigurationinstance(); i unchecked cast warning compiler. assume because compiler cannot determine if hashmap specified types going in object return getlastnonconfigurationinstance. cast objects in hashmap proper datatypes. question this: is safe way pass multiple pieces of data act

sql - What is the recommendation on using NHibernate CreateSQLQuery? -

my gut tells me advanced nhibernate users against , have been looking actual analysis on , have found nothing, i'd answer address these questions: what pros/cons of using it? there performance implications, both or bad (e.g. use call stored procedures?) in scenarios should use/avoid it? should use/avoid it? basically, reasons use/avoid , why? createsqlquery exists reason, executing queries either: not supported hard write using of other methods. of course it's last choice, because: it's not object oriented (i.e. you're thinking of tables , columns instead of entities, properties , relationships) it ties physical model it ties specific rdbms it forces more work in order retrieve entities it doesn't automatically support features paging but if think it's needed particular query, go ahead. make sure learn other methods first (hql, linq, queryover, criteria , get) avoid doing unnecessary work.

css - HTML table, horizontal scroll which tracks headings and vertical scroll- problem with text width -

ok firstly apologies if recognise of earlier posts today. have piece of html wrote, seemed way this. horizontal scroll follows keeps thead aligned tbody move tbody. vertical scroll still keeps thead in view. the way using 2 tables. works , feel free try it. however, have problem way in widths of columns being determined size of text inside them , not width property set. can help? i want width of column mean width of column edit: reason 1200 widths because inside overflow div actual size 8x 150px <script type='text/javascript'> function matchscroll(sourceid, targetid, doifmoz) { if (doifmoz || navigator.useragent.indexof("firefox") == -1) document.getelementbyid(targetid).scrollleft = document.getelementbyid(sourceid).scrollleft; } </script> <div id='headertable' style='width:883px;overflow:auto;overflow-y:hidden;overflow-x:hidden;'> <table border='1'

convert request parameter of array hashes to ruby hashes -

i have following request parameters: "mappings"=>"[{ \"spec_id\" => \"1\", \"item_name\" => \"sku\"}|{ \"spec_id\" => \"2\", \"item_name\" => \" productname\"}|{ \"spec_id\" => \"4\", \"item_name\" => \" price\"}]" i'd know how can parse items in hashes. the first thing mappings = params[:mapping][:mappings].split("|") mappings.each |map| # don't know how create hashes end i prefer split on "," instead of "|" if possible , i'm not 100% sure if request parameter in correct format. if isn't please let me know , change it. to parse string, following: str = "[{ \"spec_id\" => \"1\", \"item_name\" => \"sku\"}|{ \"spec_id\" => \"2\", \"item_name\" => \" productname

How to unset Cookies on static PHP generated CSS / JS files? -

testing site saw cookie score of 81/100 following comment: failed (static object 1 cookies - 36 bytes) - all.css cookie:phpsessid=3ge12i80ghj5gbb2cs41tr7qj5 failed (static object 1 cookies - 36 bytes) - all.js cookie:phpsessid=3ge12i80ghj5gbb2cs41tr7qj5 0.2 kb total in outbound cookies - potential savings = 0.2 kb both files php generated files, combine many other css / js files one. what should unset cookie these statis objects? there php code can add next headers(); can unset cookie on files? suggestions = answers = appreciated! the phpsessid going sent browser every request current domain. doesn't matter file type being requested (.html, .php, .js, .css, etc.). way see using "live http headers" add-on firefox. can see being send each request. to prevent phpsessid being sent, can serve these files different domain or possibly sub-domain. ideal solution use cdn. however, not worry browser sending phpsessid these files. just out of curios

flex - MXMLC throws a java.lang.NullExceptionPointer when compiling in windows (not in mac nor ubuntu) -

i'm running ant compile flex application, , build keeps failing when running on windows command line. other people in team can run same build under mac , linux. this error shown in command prompt: compile-main: [mxmlc] loading configuration file c:\program files (x86)\adobe\adobe flash builder burrito\sdks\3.5.0\frameworks\flex-config.xml [mxmlc] error: null [mxmlc] [mxmlc] java.lang.nullpointerexception [mxmlc] @ flex2.compiler.compilerswccontext.createsource(compilerswccontext.java:353) [mxmlc] @ flex2.compiler.compilerswccontext.getsource(compilerswccontext.java:337) [mxmlc] @ flex2.compiler.api.finddefinition(api.java:2685) [mxmlc] @ flex2.compiler.api.resolvemultiname(api.java:3350) [mxmlc] @ flex2.compiler.api.resolveexpression(api.java:3193) [mxmlc] @ flex2.compiler.api.batch2(api.java:399) [mxmlc] @ flex2.compiler.api.batch(api.java:1117) [mxmlc] @ flex2.compiler.api.compile(api.java:1290) [mxmlc] @ flex2.compiler.api.compile(api.

.net - How to determine whether a TransparentProxy points to a valid instance -

is there way determine whether transparentproxy pointing valid reference? i have iplugin . create new appdomain, load assembly implementation of iplugin , , create instance of implemenation. receive iplugin , under covers transparentproxy . if unload secondary appdomain, instance of iplugin (the 1 proxy points to) gone. proxy still pointing there. program crashes (with no exceptions) when try access proxy. psudeocode: var domain = createdomain("domain"); var assembly = domain.loadassembly("myassembly"); var plugin = domain.createobject("myplugin") iplugin; // plugin transparentproxy myplugin if (plugin != null) plugin.dosomething("123"); unloaddomain(domain); if (plugin != null) // still evaluates true! plugin.dosomething("123"); // program crashes no exceptions well, since no 1 has suggested proper answer, try this: public static bool isvalidreference(marshalbyrefobject obj) { try { obj.eq

linux - How do I find out the IP addresses of PCs that access my Ubuntu machine's WLAN interface, using Java code? -

i limit resource access 1 client @ time. if 2nd unique client tries access pc (which acting server) should not allowed, until previous client done work (or specified time). by tracking ip addresses accessing resource, block/unblock clients accessing or transferring data. is there way develop java application call linux networking apis in order details of these events, including ip address of client? via command line, can see remote ip's accessing each of interfaces using netstat -unt . however, application, better off maintaining list of connected clients in shared database. sure track when connection made or last transmitted data can expire stale data.

codeblocks - Code::Blocks is it alive? -

i ask guys if code::blocks project still being developed? i'm asking because i've downloaded lates ver 10.05 , (much more vs2010) released while ago, , couldn't find info next release. thanks. yes is. at svn logs . latest commit today. didn't find planned release schedule though.

asp.net - how to force textchanged to work onblur? -

possible duplicate: how force textchanged work onblur ?? actually want tabbing in gridview rowwise have done it. problem have done using ontextchange event whenever have tab away. have text , enter tab, works , requirement tab should done without entering text also i'm having code want forcefully onblur event. ??? you write little javascript(using jquery) when onblur event occurs txtchanged event called on client side. like $('#idhere').blur(function() { $('#idhere').change(); });

c# - toolstripmenuitem subitem - double entries -

i trying add event handler dropdownitems of toolstrip. when add event handler, each time event triggered, dropdownitems duplicated. my toolstrip menu items projects, , each project can have multiple tasks. when user clicks on task, event handler triggered, has method starts track time. creates new menu item stop timer. how can configure code prevent duplicate items? thanks in advance, jason private void setupmenu() { ctxmainmenu.items.clear(); //ctxmainmenu.refresh(); _workitemvalid = false; toolstripmenuitem newmenu = null; if (_currentworkitemid > 0) { newmenu = new toolstripmenuitem("stop working on workitem:" + _currentworkitemid); ctxmainmenu.items.add(newmenu); ctxmainmenu.refresh(); } try { //ctxmainmenu.refresh(); foreach (string projectname in checkedprojects.items) { newmenu = new toolstripmenuitem(projectname); //clear menu before buil

jquery - Approach to handle javascript on bigger projects? -

after discovering jquery few years ago, realized how easy make interactive , user friendly websites without writing books of code. projects increased in size, did time required carry out debugging or perhaps implementing change or new feature. from reading various blogs , staying updated, i've read libraries similar backbone.js , javascriptmvc both sound alternatives in order make code more modular , separated. however being far javascript or jquery expert, not not suited tell what's cornerstone in project future ease of maintainability, debugging , development prioritized. so in mind - what's common sense when starting project javascript , jquery stands majority of user experience , data presentation user? thanks lot both backbone.js , javascriptmvc great examples of using framework organize large projects in sane way ( sproutcore , cappuccino nice too). suggest choose standard way of deal data server, handling events dom , responses sever, , view

iphone - Disabling vertical scrolling in UIScrollView -

there option in ib uncheck vertical scrolling on scrollview, doesnt seem work. how can scrollview set scroll horizontally, , not vertically in code rather ib? try setting contentsize's height scrollview's height. vertical scroll should disabled because there nothing scroll vertically. scrollview.contentsize = cgsizemake(scrollview.contentsize.width,scrollview.frame.size.height);

Vertical Scrolling SIlverlight -

how srolling on browser silverlight webpage? . mentioned width = "1800" height= "1800" usercontrol in mainpage.xaml. scrollbar doesnt showup , contents not visible in browser. you're changing width , height on xaml only, need think browser object declaration well, if you're using de basic project template you've object declaration width , height declared 100%. adjust silverlight object screen size (not considering xaml declaration). <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param name="source" value="clientbin/some.xap"/> <param name="onerror" value="onsilverlighterror" /> <param name="background" value="white" /> <param name="minruntimeversion" value="4.0.50826.0" /> <param name="a

c++ cli - Confusing between Native and Managed in CPP/CLI? -

if use /clr mode compile code has somthing following: int x = 3; char ch='a'; int arr[]="hi"; array<int>^ manarr1={44}; array<int>^ manarr2= gcnew array<int> {44}; my questions now: type int mapped system::int32 ?? , char ch ? considerd native or managed type? executed! through msil or not!! we see int arr[] native array, mean executed out of msil? the last question ,, both managed array manarr1 & manarr2 difference between 2 initialization ?? when compiling /clr , entire program converted msil unless use #pragma managed(off) or #pragma unmanaged int equivalent system::int32 char equivalent system::sbyte (not system::char !) both of these types "primitive". managed code sees them managed types , native code sees native types. native arrays use unverifiable msil (same c# pointers, example)

javascript - How to have 2 or more canvas in the same page.. not as layers -

i have page i've 2 canvas. 1 tracking mouse position , simple drawing . both code working not expected. both canvas got pushed down.. displays both canvas uses 1 of canvas display results . why?? here link page canvas , expected output you appending both canvas elements each time. heres area of code it, , quick check put in place. if(flag ===1){ canvasdiv1.appendchild(canvas); }else{ canvasdiv2.appendchild(canvas); } here link full code, , assume going for. http://jsfiddle.net/loktar/r3hyg/

c# - IP address validation -

i'm refactoring code , wanted use ipaddress.tryparse method validate if string valid ipv4 address instead of using regular expressions: public static bool isipv4(string value) { ipaddress address; if (ipaddress.tryparse(value, out address)) { if (address.addressfamily == addressfamily.internetwork) { return true; } } return false; } my unit test failing because these input values return true , parsed following ipaddress objects: value = "0.0.0.0" -> address = {0.0.0.0} value = "255.255.255" -> address = {255.255.0.255} value = "65536" -> address = {0.1.0.0} does make sense? can see 0.0.0.0 technically valid ipv4 address, if makes no sense user enter that. other two? why converted in way , should treat them valid if might not transparent user, maybe forgot enter periods ( 65536 instead of 6.5.5.36 ). any appreciated. it looks docs ipaddress.par

sqlanywhere - How to calculate the hash of a row in SQL Anywhere 11 database table? -

my application continuously polling database. optimization purpose, want application query database if tables have been modified. want calculate hash of entire table , compare last-saved-hash of table. (i plan compute hash first calculating hash of each row , followed hash i.e. hash of hashes) i found there checksum() sql utility function sql server computes hash/checksum 1 row. is there similar utility/query find hash of row in sql anywhere 11 database? fyi, database table does not have coloumn precomputed hash/checksum. got answer. can compute hash on particular column of table using below query: -- select hash(coulum_name, hash_algorithm) -- example: select hash(coulmn, 'md5') mytable

android - where is my app -

i have copied .apk htc phone's sd card. but, cannot see .apk file on phone (only on windows machine) cannot install it? have any how install apk's what apps using try , find it? have sd browser , can't find it? have apk installer? this 1 use, , it's free , works fine: https://market.android.com/details?id=com.android.apkinstaller&feature=search_result

wcf ria services - Why is my WCF RIA context throwing FileNotFound exceptions during unit tests? -

i'm trying write unit tests involving wcf ria entity proxies , when try access entity's parent or child properties through association filenotfoundexception when webcontext class fails load system.xml . for example, have 2 entities defined in web project in entity framework - course , courseunit . course has many courseunit children. i'm not exposing ria contexts or viewmodels, hidden behind interfaces. i'm using moq mock these interfaces , return standard ria entity proxies unit tests. this works fine when i'm testing things like assert.areequal("title", course.title) where course instance of ria proxy. however, if like assert.areequal(0, course.courseunits.count) i following exception filenotfoundexception unhandled user code not load file or assembly 'system.xml, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e' or 1 of dependencies. system cannot find file specified. and if execute code

python - WSGI Exception - Port block -

i should go server fault this, don't know how spell problem, seems port 80 on machine(xubuntu 9.10) blocked something, clue i've got this: django version 1.2.3, using settings 'settings' development server running @ http://0.0.0.0:80/ quit server control-c. error: don't have permission access port. maybe tripped on similar in past? "error: don't have permission access port" that's bottom line. don't have access. port 80 requires privileged process apache. built-in server django not privileged , should not used development.

scala - Contravariance and val -

how , why 'val' , 'case' affect type system? (especially variance) welcome scala version 2.8.1.final (java hotspot(tm) 64-bit server vm, java 1.6.0_22). type in expressions have them evaluated. type :help more information. scala> class e[-a] defined class e scala> class f[-a](val f: e[a] => unit) <console>:6: error: contravariant type occurs in covariant position in type => (e[a]) => unit of value f class f[-a](val f: e[a] => unit) ^ scala> case class c[-a](f: e[a] => unit) <console>:6: error: contravariant type occurs in covariant position in type => (e[a]) => unit of value f case class c[-a](f: e[a] => unit) scala> class f[-a](f: e[a] => unit) defined class f consider this: trait equal[-a] { def eq(a1: a, a2: a): boolean } val e = new equal[option[int]] { def eq(a1: option[int], a2: option[int]) = a1 forall (x => a2 forall (x ==)) } // because equal contra-

mySQL count frequency of one-many links -

suppose have 2 tables: people ======= id name jobs ===== id jobname person_id person may have many jobs. i want count frequency of number of jobs people have. example 10 people have 0 jobs, 15 people have 1 job, 3 people have 2 jobs, 2 people have 3 jobs i able count of number of jobs per person per: select person.id, count(jobs.id) jobcount jobs person.id = jobs.person_id group person.id order trancount personid jobcount 1 1 2 1 3 2 ... but stuck @ summing these frequency. can group them in outer select statement? select jobcount, count(peoplecount) ( select person.id peoplecount, count(jobs.id) jobcount jobs person.id = jobs.person_id group person.id ) frequency group jobcount

mysql - is there any library in java for unit conversion? -

i want use unit conversions kg grams, lit ml, etc.. there java library , my-sql tables, available ? i asked use jscience have populate units in jscience jcombo box or list box.. tel me hod do please ? you can use jscience ... here's example convert kilogram gram:- double gram = measure.valueof(5, si.kilogram).doublevalue(si.gram); system.out.println(gram); here available units:- (unit<?> unit : si.units()) { system.out.println(unit); } the print outs: m/s? f lm c n h j lx k m/s wb m? gy t w kg v Ω s kat pa sr m m? mol bit °c hz s bq sv rad cd by way, i'm using jre 1.4 compatible binary jscience , , need jsr 275 (i pulled maven): <dependency> <groupid>javax.measure</groupid> <artifactid>jsr-275</artifactid> <version>1.0.0</version> </dependency> here're import statements, if cares:- import javax.measure.units.si; import javax.meas

C#: Unable to create DirectX device. Neither Hardware type or Software type works -

i'm trying create directx device through following code: caps devicecapability; int deviceadapter = manager.adapters.default.adapter; try { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.hardware); } catch (exception ex1) { try { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.software); } catch (exception ex2) { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.reference); } } createflags deviceflags = createflags.softwarevertexprocessing; if(devicecapability.devicecaps.supportshardwaretransformandlight == true) { deviceflags = createflags.hardwarevertexprocessing; } mdevice = new device(deviceadapter, devicecapability.devicetype, minvisiblepanel, deviceflags, mpresentparams); the problem works on computers (such work computer), while doesn't on others (to specific, panasonic cf-19 toughbook). i've checked make sure offe

ios - Info.plist value as C++ #define -

in c++ ios project (or other mac os), there simple way of making value available both info.plist settings, , code in form of preprocessor macro? ideally, have this c++ code: #define my_version_string "1.0" info.plist cfbundleversion: ${my_version_string} or alternatively, there way of getting values .plist in c++? (without manually parsing .plist xml.) probably not best solution, use /usr/libexec/plistbuddy utility in build script generate .h file containing define value extracted plist. to output value plist: /usr/libexec/plistbuddy -c 'print :path:to:key' filename.plist

How can I create a user for ASP.Net/Umbraco SQL Membership from iPhone and WCF? -

so have been struggling days now, trying create new user wcf service using umbraco's membership provider. can tell me if i'm out of mind, if impossible do, or if i'm overlooking need add wcf service allow work. wcf script embedded website on iis 7.5 using .net framework 4.0. i can return json strings wcf, such validation of input. , using iphone app. but validates, , try run following lines... membershipcreatestatus status; membershipuser newuser = membership.createuser(email, pw1, email, "n", "n", false, out status); if (newuser != null) { string newuserguid = system.guid.newguid().tostring("n"); memberprofile mp = memberprofile.getuserprofile(email); mp.authguid = newuserguid; mp.firstname = fname; mp.lastname = lname; mp.birthday = bday; mp.displayrealname = intname; mp.displaybirthday = intbirthday; mp.save(); roles.addusertorole(email, "client"); return @"val

how to create a text file in asp.net MVC3 using c# -

i wanna ask how generate or create textfile, becuase want display data in database text. im using c# in asp.net mvc 3 thank much! answer apreciated. if want return data database in text file downloaded user's local computer, create action in controller in sample: using system.io; using system.text; public class somecontroller { // action create text file 'your_file_name.txt' data // string variable 'string_with_your_data', downloaded // browser public filestreamresult createfile() { //todo: add data database string: var string_with_your_data = ""; var bytearray = encoding.ascii.getbytes(string_with_your_data); var stream = new memorystream(bytearray); return file(stream, "text/plain", "your_file_name.txt"); } } then can create actionlink action on view trigger file download: @html.actionlink("download text file", "createfi

opencv - How do I detect small blobs using EmguCV? -

Image
i'm trying track position of robot overhead webcam. however, don't have access robot or environment, have been working snapshots webcam. robot has 5 bright leds positioned strategically different enough color robot , environment isolate. have been able using emgucv, resulting in binary image 1 below. question now, how positions of 5 blobs , use positions determine position , orientation of robot? i have been experimenting emgu.cv.videosurveillance.blobtrackerauto class, stubbornly refuses detect blobs in above image. being bit of newbie when comes of this, i'm not sure doing wrong. best method of obtaining positions of blobs in above image? i can't tell how emgucv in particular, you'd need translate calls opencv emgucv. you'd use cv::findcontours blobs , cv::moments position of blobs (the formula middle points of blobs in documentation of cv::moments ). you'd use cv::estimaterigidtransform position , orientation of robot.

c++ - invalid conversion from `void*' to `char*' when using malloc? -

i'm having trouble code below error on line 5: error: invalid conversion void* char* i'm using g++ codeblocks , tried compile file cpp file. matter? #include <openssl/crypto.h> int main() { char *foo = malloc(1); if (!foo) { printf("malloc()"); exit(1); } openssl_cleanse(foo, 1); printf("cleaned 1 byte\n"); openssl_cleanse(foo, 0); printf("cleaned 0 bytes\n"); } in c++, need cast return of malloc() char *foo = (char*)malloc(1);

templates - C++ using statement in member function scope -

if want use member of template base class template derived class, have bring scope such: template <typename t> struct base { void foo(); }; template <typename t> struct derived : base<t> { using base<t>::foo; }; why can't place using statement local scope, other using statements? template <typename t> struct base { void foo(); }; template <typename t> struct derived : base<t> { void f() { using base<t>::foo; // error: base<t> not namespace } }; the standard (draft 3225) says in [namespace.udecl] : a using-declaration class member shall member-declaration . [ example: struct x { int i; static int s; }; void f() { using x::i; // error: x::i class member // , not member declaration. using x::s; // error: x::s class member // , not member declaration. } — end example ] a using-directive has no such res

ruby on rails - Inheritance from ActiveRecord Object -

lets there activerecord class called user, representative of user table of database. but have different type of users have special functions special variables custom relations (employer has_many companies, employee belongs_to company :) but these users have lot of functionality in common. want create classes each different type of user inherit them user class. user < activerecord::base employer < user employee < user customer < user what best way of doing that? thanks a lot of applications start out user model of sort. on time, different kinds of users emerge, might make sense make greater distinction between them. admin , guest classes introduced, subclasses of user . now, shared behavior can reside in user , , subtype behavior can pushed down subclasses. however, user data can still reside in users table. all need add type column users table hold name of class instantiated given row. active record takes care of instantiating kind o

how to change default indent in macvim -

hey guys i'm learning configure macvim now tab indent 4 character, want change 2, should add macvim configure file? and there beginner guide me learn configure mac vim thanks open $home/.vimrc file in macvim, :edit $myvimrc write following lines, set tabstop=2 set shiftwidth=2 and save. :wq

java - How to plan and design a web application in Struts 1.3? -

i have develop web application college community (with social networking features). how approach problem in struts 1.3 ? can guide me through process right requirement analysis stage , tools should use ? , methodology should use ? , usefull documents should generate during process ? i want project documented throughout , easy maintain in future . why dont try things elgg or socialspring instead of building ground using struts? haven't tried these frameworks myself. should easier using struts-1.3. also, might want use javascript framework jquery.

Node.js: Sending many AJAX requests to begin backend job queues -

preface: i'm trying prefetch content given set of urls asynchronously. i'm needing send node.js app around 40-60 local ajax requests in order add jobs queue ( node-chain-gang ) client-side. right now, have making requests @ once, , either node.js app can't handle or it's not possible many @ once, ends crashing or requests not make through in proper order. i've tried using settimeout in between each request no avail (in timely manner). is there other way of queueing these requests/connections asynchronously client-side? or there more efficient way this? just queuing such small number of requests should not problem node.js. either have come across bug in node-chain-gang or have bug in code. if can narrow down code simpler version same behavior , post here.

c# - WPF Binding nightmares -

so have class public class objectdatamodel { public observablecollection<objectclassa> myobjectcollection; } public class objectclassa { public objecttypea myobject; public bitmapimage mybmp; } now have grid control itemssource wish bind myobject of myobjectcollection . how that? you must expose ur binding target properties not fields (like do). <window> <window.datacontext><local:objectdatamodel/></window.datacontext> <grid> <listview itemssource={binding myobjectcollection}/> </grid> </window>

xslt - Need to display the content -

this input html-body <body class="calibre"> gabriel garcía márquez <p class="calibre1">prêmio nobel de literatura </p> <p class="calibre1"></p> </body> i using xslt1.0. <xsl:message>value=<xsl:copy-of select="xhtml:html/xhtml:body/*"/></xsl:message> produces output empty. how nodes , text.. please me..thanks in advance your input has no namespace. remove namespace in stylesheet.

html - Icon in browser tab -

i made game in silverlight , want while game runs in browser, tab of game icon's game. example when open google website see google's icon on tab. thanx that's called 'favicon' , can find instructions here add site. has nothing silverlight though. have add webpage (i.e. index.html) <link rel="shortcut icon" href="http://www.yourdomain.com/name_of_icon.ico">

Android Alarm What is the difference between four types of Alarm that AlarmManager provides and when to use what? -

i want know difference between rtc, rtc_wakeup, elapsed_realtime, elapsed_realtime_wakeup . want write alarm application set alarm , close application , expect alarm time set. there multiple alarms. right writing emulator later test on device. in emulator, once set alarm , close emulator , restart it, cleared, find rtc, rtc_wakeup , elapsed_realtime. confused. should used elapsed_realtime_wakeup? have not seen tutorial using elapsed_realtime_wakeup. please explain. thanks. you read : http://developer.android.com/reference/android/app/alarmmanager.html you have difference beetween alarms

asp.net mvc 3 - View the Validation summery in the required place -

i have partial view in main view in mvc3. partial view has it's own modelstate.addmodelerror in action method , main view has modelstate.addmodelerror in action method. when code runs , main view error wants displayed, partial view has validationsummery tag, validation summery shows in both places. how fix issu?? thanks. you can jquery $(function(){ var error = ""; $("classnameofvalidationsummarydiv").each(function(){ error = error + $(this).html(); }); $("idofdivwhereuwanttoshow").append(error); }); hope work

sql server - Is there a way to get all the stored procedures that can update a specific column in SQL? -

i've got field in table changed value unexpectedly. clearly, stored procedure caused (i've searched few triggers we're using, , no login has update grants on table in our database), , i'm in process of finding 1 did. if in visual studio, "find references" on field, , task easy. is there equivalent tool sql ? know "find object dependencies" feature of ssms, return stored procedures (and views) using table, not specific field. (and unfortunately table joined in literally thousands of sql queries) the column name 'active', doing text search on database schema not gonna lot either (i've got hundreds of tables such field) so 2 options see : writing complicated regex match updates. writing such regex huge task (because of syntaxix subtleties of sql). using tool this. do know of such tool (or such regex, or way this) ? why clear stored procedure change value? have denied direct table access database logins? access d

css - How to disable webfonts on Safari only -

the webfont i'm using keep crashing on safari, know if it's possible disable browser? not sure if still works have used in past: /*\*/ html>body*.safarihack {font-family: "yourfont"; } /**/ but don't think it's best way :)

c# - Handle usage on Windows CE -

i need monitor handle usage on windows ce box. essentially want able see handle usage on time tell if applications / services leaking handles (which believe are). any example code great. while not looking for, can recommend little tool using called codesnitch ( http://www.entrek.com/codesnitch.html ). instrument code , keep track allocation , de-allocation of resources, including handles. have used clean several of our applications great success. can download 2 week trial version try out.

indexing - mysql fulltext index is used for MATCH() AGAINST but not for = -

my table xm_c created this: create table `xm_c` ( `category_id` char(16) not null default '', `label` char(64) not null default '', `flags` smallint(5) unsigned default null, `d0` date default null, `d1` date default null, `ct` int(6) unsigned default null, `t_update` timestamp not null default current_timestamp on update current_timestamp, primary key (`category_id`), **fulltext key `label` (`label`)** ) engine=myisam default charset=latin1 delay_key_write=1; the fulltext index not used in query below: select * xm_c label = 'tomcruise'; where used here: select * xm_c match(label) against('tomcruise'); mysql> explain select * xm_c match(label) against('tomcruise'); > id | select_type | table | type | possible_keys | key | key_len | ref | rows | **1 | simple | xm_c | fulltext | label | label | 0 | | 1 | using where** mysql> explain select *

windows 7 - How to find out if an installed Eclipse is 32 or 64 bit version? -

how can find out if specific eclipse instance on (windows 7) pc 32-bit or 64-bit version? i've checked screen , maze of dialogs 1 can call there, didn't find clues. also, right-clicking eclipse.exe in windows explorer , opening properties dialog box didn't give hints. hit ctrl + alt + del open windows task manager , switch processes tab. 32-bit programs should marked *32 .

How to Create a Quiz in Excel -

i need create quiz. should consists of questions , possible cases answers. after passing test score must computed , displayed. think, possible in excel. or, maybe special software exists purpose. grateful tutorial or references materials on topic. perhaps u have seen flash embedded in excel. can make quiz gui in flash. , can embedd excel sheet.

sql - Delete all duplicate records from Oracle table except oldest -

i have 2 tables, 1 parent tablea , 1 child tableb. tableb has 1 or more records parent record in tablea. need delete records tableb except earliest date i.e. duplicates in tableb. don't think tablea needs involved in statement i'm including reference. tablea _______ secid, secname 1, sec1 2, sec2 3, sec3 4, sec4 tableb _________ incid, secid, paydate 16, 1, 11/03/2011 17, 1, 11/04/2011 18, 2, 10/01/2011 19, 3, 01/06/2011 20, 3, 01/09/2011 21, 3, 01/12/2011 22, 4, 10/06/2011 so in tableb above need delete records 17, 20, , 21 leaving 1 record each secid. far have below reason it's including earliest record want keep: delete tableb paydate not in ( select min(paydate)from tableb having ( count(paydate) > 1 ) ) you can use rowid , analytics: sql> delete tableb 2 rowid not in 3 (select first_value(rowid)over(partition secid order paydate) 4 tableb)

How to install Java SDK on CentOS? -

i have centos 5, don't know steps install java sdk on linux. where download rpm file , can next install that? then need install tomcat . or there ready-made package all? the following command return list of packages directly related java. in format of java-<version> . $ yum search java | grep 'java-' if there no available packages, may need download new repository search through. suggest taking @ dag wieers' repo . after downloading it, try above command again. you see @ least 1 version of java packages available download. depending on when read this, lastest available version may different. java-1.7.0-openjdk.x86_64 the above package alone install jre. install javac , jdk, following command trick: $ yum install java-1.7.0-openjdk* these packages installing (as dependencies): java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-accessibility.x86_64 java-1.7.0-openjdk-demo.x86_64 java-1.7.0-openjdk-devel.x86_64 java-1.7.0-openjdk-headl

store array of cllocation value in userdefaults iphone sdk -

hi have array of cllocation values, need store array in userdefaults...how do it...? hi these add object array: [am_locationmp.favarray addobject:[am_locationmp.locationdata objectatindex:am_locationmp.indexno]]; where location data array of location placemark values . where maplocationvo class placemark maplocationvo *currentmaplocation; [am_delegate.locationdata addobject: currentmaplocation]; this should enough write it: nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:yourarray forkey:@"clarray"]; [defaults synchronize];

php - Get polygon points mysql -

i have created table in mysql store polygon data: create table geom (g geometry); and inserted polygon it, using following syntax: insert geom (g) values(polygonfromtext('polygon(( 9.190586853 45.464518970, 9.190602686 45.463993916, 9.191572471 45.464001929, 9.191613325 45.463884676, 9.192136130 45.463880767, 9.192111509 45.464095594, 9.192427961 45.464117804, 9.192417811 45.464112862, 9.192509035 45.464225851, 9.192493139 45.464371079, 9.192448471 45.464439002, 9.192387444 45.464477861, 9.192051402 45.464483037, 9.192012814 45.464643592, 9.191640825 45.464647090, 9.191622331 45.464506215, 9.190586853 45.464518970))') ); now how can vertices (points) of polygon in mysql? why asking means, later want find whether point inside polygon. , achieve this, hope need polygon vertices. if want wkt back: select astext(g) geom;

Where Visual Studio SharePoint feature designer store scope? -

visual studio has designer editing definition of sharepoint features. there setting feature scope in designer window. i'm curious value stored on disk. when open *.feature file value missing there. on other hand can see strange encrypted version attribute. see .feature file: <?xml version="1.0" encoding="utf-8"?> <feature xmlns:dm0="http://schemas.microsoft.com/visualstudio/2008/dsltools/core" dslversion="1.0.0.0" id="07abccbd-9471-4780-8ee9-801fe4191e9b" alwaysforceinstall="true" ishidden="true" featureid="07abccbd-9471-4780-8ee9-801fe4191e9b" imageurl="" solutionid="00000000-0000-0000-0000-000000000000" title="myfeature" version="aaeaaad/////aqaaaaaaaaaeaqaaaa5texn0zw0uvmvyc2lvbgqaaaagx01ham9ybl9naw5vcgzfqnvpbgqjx1jldmlzaw9uaaaaaagicagbaaaaaaaaaaaaaaaaaaaacw==" deploymentpath="$sharepoint.project.fi