Posts

Showing posts from April, 2014

regex - How to replace src with regular expression and jquery -

i have following output. <img width='70' height='70' class='centreimg' src="http://localhost/aktivfitness_new/assets/images/centre/centre1.jpg" /> there same outputs centre2.jpg etc. want replace centre1.jpg hover.jpg when hover. but when use following becomes centre1hover.jpg $(".centreimg").mouseover(function() { var hoverimg = $(this).attr("src").match(/[^\.]+/) + "hover.jpg"; ... something wrong match(/[^.]+/) + "hover.jpg part. how can this? thanks in advance. don't think easier: var newsrc = oldsrc.replace(/[^\/\.]+\./, 'hover.'); anyway: shouldn't use javascript hovers =) if there way: use it. not bad practice, it's not user friendly: when image loads when hover, user see 'flash' because entire image still has loaded = not pretty.

android - Custom class ImageView written text ends up behind setImageBitmap -

hi custom imageview setting bitmap this, in constructor. setimagebitmap(btm); in ondraw method im writing text like canvas.drawtext text showed , can move text around using ontouchevent. but text behind bitmap. i thought setimagebitmap(btm) part of canvas?? ide! when draw bitmap in ondraw this, screen black!! canvas.drawbitmap(bitmap, 0,0, null); if want imageview displays text , you're handling ondraw, why not draw bitmap manually canvas in ondraw? way have control on order of drawing. draw image canvas first , text, , text no longer obscured image.

java - Can I user ModelAttribute in parent abstract class for controllers -

example: class commoncontroller { @modelattribute("refs") public list getref() { ... } @modelattribute("refs2") public list getref2() { ... } } class mycontroller extends commoncontroller { @requestmapping("/my") public string request() { return "/my"; } } the modelattribute objects available on page? why wouldn't recommend it? for example - have 2 controllers create , edit. they use same references getting through @modelattribute , instean copy past better create parent class controllers. class referenceparentcontroller { @modelattribute("refs") public list getref() { ... } @modelattribute("refs2") public list getref2() { ... } } class create extends referenceparentcontroller { ... } class edit extends referenceparentcontroller { ... }

javascript - Jquery load(): body class not retrieved -

when use jquery's .load() function load next pages body not retrieve class of body of page. there way achieve this? thank :) here code: $(document).ready(function () { if(navigator.standalone){ $('a').live("click", function (e) { var link = $(this).attr('href'); if ($(this).hasclass('noeffect')){ } else { e.preventdefault(); $("body").load(link); }; }); } else { window.scrollto(0, 0.9); } }); so putting body inside body? not sure that'll work expected! some html helpful, i'm guessing problem is. in pages loading body, put them inside div instead of body tag. should avoid body inside body problem. edit: what do regular ajax call new html. remove current body, , append stuff ajax call html. i've never tried that, if can't change html getting back, it's best thing try.

winforms - Key press events in C# -- Moving a PictureBox -

i attempting move picturebox(picuser) , down via key press events. newer c# , able via vb. such confused problem following code: private void picuser_keydown(object sender, system.windows.forms.keyeventargs e) { if (e.keycode == keys.w) { picuser.top -= 10; } } there no "error" code, picturebox doesn't move. a picturebox has no keydown event. has previewkeydown instead , requires picturebox have focus. i suggest use keydown of form host picturebox instead , use same exact code: public form1() { initializecomponent(); this.keydown += new system.windows.forms.keyeventhandler(this.form1_keydown); } private void form1_keydown(object sender, keyeventargs e) { if (e.keycode == keys.w) { picuser.top -= 10; } }

Extract items list from XML in python -

in python, best way extract list of items following xml? <iq xmlns="jabber:client" to="__anonymous__admin@localhost/8978528613056092673206" from="conference.localhost" id="disco" type="result"> <query xmlns="http://jabber.org/protocol/disco#items"> <item jid="pgatt@conference.localhost" name="pgatt (1)"/> <item jid="pgatt@conference.localhost" name="pgatt (1)"/> </query> </iq> i use lxml xpath, it's not working in case. think problems due namespaces. i'm not set on lxml , open using library. i solution robust enough fail if general structure of xml changes. i'm not sure lxml can use expression //*[local-name()="item"] pull out item elements regardless of namespace. you might want take @ amara xml processing. >>> import amara.bindery >>> doc = amara.bindery.pars

Unable to host a Service Bus WCF Host in IIS on Azure -

i have worker roles send out multicast messages using azure service bus. 2 of consumers of these messages websites hosted on azure. know there issues hosting service bus wcf endpoints in iis when running on premise. i've followed microsoft's advice , configured service host programmatically . one of websites has been using technique quite while. uses hosted web core (it developed before full iis option on azure) , initialises service host part of roleentrypoint.onrun() . i'm trying move site using full iis. because in full iis roleentrypoint runs in different process site , service host needs access static variables in site i've moved initialisation of service host global.asax application_onstart . code works fine when running website under iis locally , runs fine when running in compute emulator, once deploy cloud wcf host never seems receive messages. haven't been able catch errors occurring. has else out there deployed this?

C# - Resize image canvas (keeping original pixel dimensions of source image) -

my goal take image file , increase dimensions next power of 2 while preserving pixels (aka not scaling source image). end result original image, plus additional white space spanning off right , bottom of image total dimensions powers of two. below code i'm using right now; creates image correct dimensions, source data scaled , cropped reason. // load image , determine new dimensions system.drawing.image img = system.drawing.image.fromfile(srcfilepath); size szdimensions = new size(getnextpwr2(img.width), getnextpwr2(img.height)); // create blank canvas bitmap resizedimg = new bitmap(szdimensions.width, szdimensions.height); graphics gfx = graphics.fromimage(resizedimg); // paste source image on blank canvas, save .png gfx.drawimageunscaled(img, 0, 0); resizedimg.save(newfilepath, system.drawing.imaging.imageformat.png); it seems source image scaled based on new canvas size difference, though i'm using function called drawimageunscaled(). please inform me of i'm

objective c - Casting between uint8_t * and char *. What happens? -

what happens when casting between these 2 in relation termination character? in c99 objective-c. i assume char 8 bits on system in answer. if architecture uses unsigned char char type absolutely nothing happen. if architecture uses signed char char type negative values of char wrap around causing possibly unexpected results. never happen termination null character. please note, "casting" nothing happens, tell compiler interpret location in memory differently. difference in interpretation create actual (side)effects of cast.

iphone - How to POST from Restkit + iOS to Rails -

my rails app has post model "name" property. i'm trying create new post ios using restkit. here's ios code. nsdictionary* params = [nsdictionary dictionarywithobject:@"amazingname" forkey:@"name"]; [[rkclient sharedclient] post:@"/posts" params:params delegate:self]; and here's server log running on same machine started post "/posts" 127.0.0.1 @ tue may 10 15:39:14 -0700 2011 processing postscontroller#create json parameters: {"name"=>"amazingname"} mongodb blog_development['posts'].insert([{"_id"=>bson::objectid('4dc9be92be2eec614a000002')}]) completed 406 not acceptable in 4ms as can see, server gets request, name doesn't saved db. nameless post gets created. wrong ios code? it works when switch forkey:@"name" forkey:@"post[name]"

Where and how can I install twitter's Python API? -

i went twitter's api, redirected me google code, , website wasn't there. alternative twitter apis, plus tutorials? thanks! try tweepy: http://code.google.com/p/tweepy/ you can tutorial wiki page @ same google code link. to install easy_install, run easy_install tweepy to install git: git clone git://github.com/joshthecoder/tweepy.git cd tweepy python setup.py install to install source, download source http://pypi.python.org/pypi/tweepy run like: tar xzvf tweepy-1.7.1.tar.gz cd tweepy-1.7.1 python setup.py install

operating system - What is the difference between the kernel space and the user space? -

what difference between kernel space , user space? kernel space, kernel threads, kernel processes , kernel stack mean same thing? also, why need differentiation? the really simplified answer kernel runs in kernel space, , normal programs run in user space. user space form of sand-boxing -- restricts user programs can't mess memory (and other resources) owned other programs or os kernel. limits (but doesn't entirely eliminate) ability bad things crashing machine. the kernel core of operating system. has full access memory , machine hardware (and else on machine). keep machine stable possible, want trusted, well-tested code run in kernel mode/kernel space. the stack part of memory, naturally it's segregated right along rest of memory.

Where to acquire jar that provides scala.tools.nsc.MainGenericRunner -

i lift project have file called liftconsole.scala . generated project creation script , contains following import _root_.bootstrap.liftweb.boot import _root_.scala.tools.nsc.maingenericrunner object liftconsole { def main(args : array[string]) { // instantiate project's boot file val b = new boot() // boot project b.boot // run maingenericrunner repl maingenericrunner.main(args) // after repl exits, exit scala script exit(0) } } it seems purpose of file let user interact console within project. i'd that, never able because cannot find jar maingenericrunner. know it? my goal able initialize console project settings can execute project specific code. it part of scala-compiler.jar . can find rest of scala distribution. add project: val scalacompiler = "org.scala-lang" % "scala-compiler" % "2.8.1"

r - How to delete specific rows with while? -

i'm beginner in r , need help: in database, big since i'm working micro-data, want remove rows when there specific value of column...i trying implement function that....but i'm having problem if condition(true/false problem). example, want remove row when column disc in line "l", did function: dellinhas<-function(x){ n<-nrow(x) i<-1 while (i<=n) { if (x[i,]$disc=="l") {x<-x[-(i:i),]} i<-i+1} dadosprmm<-x } where x database. doing wrong? use subscripting: x[x$disc != "l",] and try website basic data manipulation issues: http://www.statmethods.net/

iphone - Can I change property UIReturnKeyType of UITextField dynamically? -

we can set property of uitextfield "send", "search", "go", etc.: @property(nonatomic) uireturnkeytype returnkeytype but setting while using uitextfield doesn't change @ all. i want behavior: when uitextfield empty, let returnkeytype "return", otherwise let returnkeytype "send". normally returnkeytype , other properties checked when keyboard displayed, not monitored later updates. try calling reloadinputviews on text field after changing returnkeytype , should instruct refresh keyboard settings.

iphone - Trying to animate backgroundcolor on a uilabel to achieve a 'fade' effect, but it applies instantly -

i'm trying animate backgroundcolor on uilabel achieve 'fade' effect. code looks this: uilabel *lbl = ... uicolor *oldcol = lbl.backgroundcolor; lbl.backgroundcolor = [uicolor bluecolor]; [uiview animatewithduration:1.0 animations:^(void) { lbl.backgroundcolor = oldcol; }]; but instantly reverts original colour. tried below, isolate problem: lbl.backgroundcolor = [uicolor bluecolor]; [uiview animatewithduration:1.0 animations:^(void) { lbl.backgroundcolor = [uicolor greencolor]; }]; and instantly goes green. ideas? background color of uilabel isn't animatable. see how animate background color of uilabel? possible workaround.

objective c - Exact Same Application Work in One Computer Doesn't Work in the Other -

i , friend have project files connected dropbox. code same. then, when execute nsentitydescription *entity = [nsentitydescription entityforname:@"business" inmanagedobjectcontext:[bnutilitiesquick managedobjectcontext]]; i got something. same code set entity nil in friends' computer. the badgernew.xcdatamodeld that's used create managedobject changed. team have reset iphone simulator , deleted application iphone simulator whole thing created new again. doesn't work. not enough information give terribly useful answer. however, dropbox horrible way share project. if have multiple people working on same codebase, should using revision control tool of kind; svn , git being popular these days. grab source friend's computer , drop on own. diff two; opendiff mysource myfriendssource . see differs. if nothing differs (unlikely), there different in configuration of 2 machines.

python - What does INSTALLED_APPS setting in Django actually do? -

what actually do? branched out project 1 app 6 different apps , forgot update installed_apps part of settings file. still works though didn't list new apps in. supposed happen? need include apps in installed_apps ? yes. installed_apps helps django sync database, run tests, urls work , more related issues. maybe installed apps still works because main 1 calls others imports, django app nothing more simple python module imported when called in settings file, that's why invalid syntax error after run development server because import won't work invalid syntax.

python - Creating Reusable Django Apps? -

i of django beginner , have been trying decouple applications as possible , build in small re-usable pieces possible. trying follow james bennett's strategy of building re-usable apps . in mind, came across problem. let's had app stores information movies: the code this: class movie(models.model): name = models.charfield(max_length=255) ... now, if wanted add ratings, use django-rating , add field model: class movie(models.model): name = models.charfield(max_length=255) rating = ratingfield(range=5) ... this inherently mean movie app dependent on django-ratings , if wanted re-use it, no longer needed ratings, still have install django-ratings or modify , fork off app. now, around use try/except import , define field if successful, movie app explicitly tied rating in database table definition. it seems more sensible separate 2 models , define relationship in ratings model instead of movie. way dependency defined when use rating, not needed

javascript - Hover won't work when show/hide non-parent&child element -

i have code this <ul id="mainmenu"> <li><a href="#">mainlink1</a></li> <li><a href="#">mainlink2</a></li> <li><a href="#">mainlink3</a></li> <ul> but want 'mainlink2' has submenu, don't want place child because when set submenu 'absolute' can't fit width screen , center create div outside 'ul' ... <div> <ul id="submenu"> <li>sub1</li> <li>sub2</li> <li>sub3</li> </ul> </div> when call javascript .hover can't see submenu. try add class "submenu" remember index of mainmenu , when match add class show submenu, when not hover remove class. hover function can't when leave mouse main menu submenu hide. try this: html: <ul id="mainmenu"> <li><a href="#">mainlink1</a>

android - Remove Ads or Hide AdView -

i'm trying hide ads admob after 2 minutes, i've done is, after 2 minutes, i'll stop requesting fresh ad , hide adview, have written if (adview.getvisibility() == adview.visible) adview.setvisibility(adview.gone); what's happening ad becomes invisible still occupies space, not releasing it. , want release space. any ideas, in advance. if (adview.getvisibility() == adview.visible) adview.setvisibility(view.gone);

c++ - loop is not working with secant method -

my program wrote find roots of equation finished, have run in small problem. nested loop using assign varying values of velocity , angle equations not working. somewhere either in loop or in call secant of fx there mistake missing. keeps giving me same numbers root, number of iterations , f(x). if me find mistake appreciate :) #include<iostream> #include<cmath> #include<iomanip> #include<fstream> using namespace std; // declaration of functions used void secant(double, double, double, double, double, double, double, double, double&, int& ); double fx( double, double, double, double, double, double, double); const double tol=0.0001; // tolerance convergence const int max_iter=50; // maximum iterations allowed // main program int main() { int iteration; // number of iterations double kr, uc, q, b, radians; double x0, x1; // starting values x double root; // root found secant method const double pi = 4.0*atan(1.0);

How to Redirect to particular view in Session_End method in Global.asax using asp.net mvc -

how redirect particular view in session_end method in global.asax using asp.net i tried using response.redirect("~/home/index") giving error "response unrecognized in global.asax". you can't this. session_end fired without actual http context. user might have closed browser long before event gets fired there redirect to. request , response objects not available. conclusion: don't this.

windows phone 7 - Saving a custom object using IsloatedStorageSettings -

i'm trying save object in isolatedstoragesettings save high scores game, whenever try save updated copy of object c# seems think object hasn't changed. tried creating custom equals function highscores class doesn't seem help. any idea i'm doing wrong? thanks public bool addorupdatevalue(string key, object value) { bool valuechanged = false; // if key exists if (isolatedstore.contains(key)) { // if value has changed if (isolatedstore[key] != value) //this keeps returning false { // store new value isolatedstore[key] = value; valuechanged = true; } } // otherwise create key. else { isolatedstore.add(key, value); valuechanged = true; } return valuechanged; } //this located inside highscores class public bool equals(highscores newhighscores) { (int = 0; < highscores.length; i++) { if (!highscores[i].name.equals(

Installing a .NET control in the visual studio toolbox -

we use project installing .net controls in visual studio toolbox: http://vstudiotoolbox.codeplex.com/ . approach requires run vstudio in background resulting in slow operation. noticed many other component manufacturer can install control instantly. what other approaches exist? thanks. i wrote tutorial article on how this: visual studio toolbox control integration i found project on codeplex quite obsolete , updated work visual studio 2012. other approaches include: toolbox controls installer (tci) package - quickest , easiest way vsi , vsix packages vspackage - powerful, , complicated way i have discussed updating , uninstallation in article well.

c# - Does it make sense to pass a "reference type" to a method as a parameter with 'ref' key? -

possible duplicate: c#: use of “ref” reference-type variables? hi, does make sense pass "reference type" method parameter 'ref' key? or nonsense reference type not value type? thanks! it lets change reference variable itself , in addition object it's pointing to . it makes sense if think might make variable point different object (or null ) inside method. otherwise, no.

java - Possible to get reference to a View without setting the ContentView of an Activity -

i want able reference relativelayout in same way as relativelayout relative = (relativelayout)findviewbyid(r.id.relative); but without setting contentview of activity . think may have infalter ? ultimate aim , add child view of custom view object. yes, can use layoutinflater. example: layoutinflater inflater = (layoutinflater)getsystemservice(context.layout_inflater_service); view mv = inflater.inflate(r.layout.yourlayout, null); and could... relativelayout relative = (relativelayout)mv.findviewbyid(r.id.relative);

Instead of bullets,is it possible to get image before string in android -

i have string value before string image bullets?how that? you can use <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <imageview android:id="@+id/img_bullet" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:layout_marginleft="5dip" android:background="@drawable/bullet"/> <textview android:id="@+id/tv_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_alignparentright="true" android:gravity="right" android:layout_marginright="5dip" android:layout_margintop="5dip&q

sharepoint - Infopath 2007 browser form code not working in MOSS 2007 -

i have sharepoint 2007 (moss) server , want publish infopath form managed code it. i have published alot of infopath forms in past, , working fine. the problem is, code put in form, not running in sharepoint site, in infopath application preview. any ideas? the code simple 1 change datasource location , adds filter here: http://edgedev.blogspot.com/2008/09/bending-infopath-and-sharepoint-to-your.html i think published form document library. know infopath codes runs on "form library" document libraries. try it, p.s.: , must publish "administration approved form"

ubuntu - SSH connect to EC2 instance of natty operation timeout -

novice has been trying ssh ec2 5 hrs straight. make anymore unfriendly newbies? trying 4-5 different tutorials no avail. i've saved cert , pk in .ec2 folder , keypair in .ssh folder. many variables here (port authorize needed?, ubuntu uni/multiverse needed?, syntax issue?). ideas guys? ssh -v -v -i *****.pem ubuntu@ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com openssh_5.2p1, openssl 0.9.8l 5 nov 2009 debug1: reading configuration data /etc/ssh_config debug2: ssh_connect: needpriv 0 debug1: connecting ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com [xx.xx.xx.xx] port 22. debug1: connect address xx-xx-xx-xx port 22: operation timed out ssh: connect host ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com port 22: operation timed out do have port opened in security group ? - if not allow port 22 ip's want connect.

iphone - How to remove editinng mode by touching on tableview? -

if click on edit button, see red stop signs. how remove when user touch on tableview or tableview cell? please me in advance use setediting method of uitableview . - (void)setediting:(bool)editing animated:(bool)animate like below [mytableview setediting:no animated:yes];

eclipse - Android: How to find out why app launch failed? -

i attempting launch simple test app on android emulator (developing in eclipse 3.6 on windows). here logcat result: [2011-05-11 11:35:49 - androidtest] android launch! [2011-05-11 11:35:49 - androidtest] adb running normally. [2011-05-11 11:35:49 - androidtest] performing androidtest.androidtestactivity activity launch [2011-05-11 11:35:49 - androidtest] automatic target mode: preferred avd 'htc_incredible' available on emulator 'emulator-5554' [2011-05-11 11:35:49 - androidtest] uploading androidtest.apk onto device 'emulator-5554' [2011-05-11 11:35:49 - androidtest] installing androidtest.apk... [2011-05-11 11:38:40 - androidtest] failed install androidtest.apk on device 'emulator-5554! [2011-05-11 11:38:40 - androidtest] (null) [2011-05-11 11:38:41 - androidtest] launch canceled! how can determine why launch failed? this looks eclipse console output , not logcat. logcat output might provide clue goes wrong. i know experience adb does

javascript - Setting PHP variables from AJAX/Json -

at moment have code: index.php var refreshid = setinterval(function() { $.ajax({ url: ("http://www.example.co.uk/erc/user_data.php?imei="+incallingnum), datatype: "json", //the return type data jsonn success: function(data){ // <--- (data) in json format $('#right-side').html(data.rightside); $('#caller').html(data.caller); $('.location').html(data.location); $('.battery-level').html(data.battery); //parse json data } }); }); user_data.php $profile = array(); $profile['rightside'] = $rightside; $profile['caller'] = $caller; $profile['nextofkin'] = $nextofkin; $profile['location'] = $location; $profile['battery'] = $battery; echo json_encode($profile); this works fine add information div tags, need take php variable user_data.php file , use in index.php file. possible send/capture php variables in way? e.g. in user

Looking for (free) Java code editor (IDE) for Windows -

not open-ended list requirements. must have native ui (or @ least .net backend can java don't care) must work ant (basic functionality enough, long shows ant's output , double-clicking on [javac] errors inside ant outputs jumps referenced line ) must have code completion (including source code , third party .jar s, no jfc classes) extras (function lot): showing classes , methods in treeview alert undefined symbols before compiling unicode support some form of integration javadoc style documentation (reading jfc , other on-line documentation made javadoc) i think these pretty down-to earth requirements. why don't use eclipse? could've listed 200 more extras in requirements...

java - would it work to run scala with vaadin? -

im thinking of starting out scala , got question. in our application layer use vaadin. possible work scala in vaadin project (using eclipse) ? if yes, there nice books or tutorials? if no, why fail? thx marthin vaadin work flawlessly jvm language , scala no exception. i'm working on scala vaadin project (sorry, nothing public yet) using eclipse scala ide beta plugin , works great. you can find more info using google, eg. this recent article .

c# - Detect Key in KeyUp event -

i have textbox on form i'm trying detect keys user types in. textbox multilined wordwrap on. don't want user press enter key (as want text entered on 1 line, wrapped) used following code: private void txtplain_keypress(object sender, keypresseventargs e) { if (e.keychar == (char)13) { messagebox.show("enter keys not allowed"); e.keychar = (char)0; } } this worked fine in tests, when tested ctrl+enter didn't work i'm not sure how detect control key. googling found need use keyup/down events have following code: private void txtplain_keyup(object sender, keyeventargs e) { //if (e.keydata == (keys.control | keys.enter)) { if (e.keycode == keys.enter || (e.keycode == keys.enter && e.control)) { messagebox.show("enter keys not allowed:"); //e.keyvalue = keys.none; } } the first commented out line didn't work reason if explain why useful. the problem keyup/down event

sql - Junction Tables: Changing many-to-many to one-to-many in Entity Framework model -

Image
i've got set of tables below: positionshiftpattern positionshiftpatternid positionid employeepositionshiftpattern employeepositionshiftpatternid employeepositionid templateshiftpattern templateshiftpatternid week weekid positionshiftpatternjunction positionshiftpatternid weekid employeepositionshiftpatternjunction employeepositionshiftpatternid weekid templateshiftpatternjunction templateshiftpatternid weekid so positionshiftpattern, employeepositionshiftpattern , templateshiftpattern each have junction week, one-to-many relationships inbetween. obviously ef map relationships between positionshiftpattern, employeepositionshiftpattern , templateshiftpattern , week many-to-many , create navigation properties each table directly week. is possible change many-to-many relationships one-to-many relationships (e.g. each week should map single shiftpattern)? i'm trying achieve mutual exclusion

tree - Fast, templated, C++ Octree implementation -

i've been searching high , low (mostly on google) fast, efficient, templated (ie. stl-like properties) octree implementation, without success. want use in context of 3d scene graph. does such thing exist, or people roll own? i'm hoping friends @ stackoverflow know find one. check 1 out: http://svn.pointclouds.org/pcl/trunk/octree/ updated link: https://github.com/pointcloudlibrary/pcl/tree/master/octree

deployment - Forcing deploy/loading of a .Net "linked-list" referenced assembly -

multiple times problem has haunted me, , sorry if title not clear, hard succinctly explain mean. i'm building asp.net application uses nhibernate , sqlite. since want able change implementation of datalayer i've separated nhibernate , sqlite assembly, references nhibernate , system.data.sqlite. copy local set true. the problem system.data.sqlite isn't deployed test-directory. exception "the requested provider ... ", when reference system.data.sqlite directly in test-project works fine. i've tried old trick creating static class private methods references type in assembly, works nhibernate.bytecode, seemingly not system.data.sqlite! internal sealed class forceload { /// <summary> /// method required statically refer nhibernate.bytecode.castle otherwise dynamically loaded, /// , not copied when publishing project. should never called. :) /// </summary> public static void ensurebyteproxyassemblyisloaded() {

Is there a logging plugin for Eclipse with functionality like Apache Chainsaw? -

i'm searching eclipse plugin allows me view log files apache chainsaw does. in addition i'm hoping such plugin allow me click on given logging message , automatically jump line of source code logging message generated. is such plugin available eclipse? not apache chainsaw still have @ these: http://code.google.com/a/eclipselabs.org/p/logviewer/ log file viewer eclipse http://sourceforge.net/projects/logfiletools/ http://workingdeveloper.net/node/1 if want use standard eclipse log viewer in application have @ link: http://www.vogella.de/blog/2009/08/17/eclipse-rcp-error-view/

Following functionality - database design problem - Rails 3 -

i need following functionality in app (twitter like). 1 user can fallow other user. have model user, , tried self many-to-many relation, don't know how implement in model. can explain me example how this? michael hartl's tutorial has entire section on follower relationships. recommend reading better understanding of self many-to-many relations. helped me lot: http://ruby.railstutorial.org/chapters/following-users you use gem acts_as_follower , abstracts of design details out you: https://github.com/tcocca/acts_as_follower

sql - How to check that an auction is finished - Triggered PHP processing -

i have few ideas here need , wanted second opinions really. i writing small auction site in php/sql, have come against hurdle. when item finishes, ebay, need able tell it's finished , send out emails has won , has sold it. the way can think of schedule piece of code keep checking auctions have ended surely there better way? please kind share sql script query highest bidder based on bidding end date (how know bidding over) , award product highest bidder

Rails button_to or link_to image -

noob needed. creating chore chart children should online version of: http://learningandeducationtoys.guidestobuy.com/i-can-do-it-reward-chart chores listed down y-axis , days (sun, mon... ) on top x-axis. boxes kids click , receive stars completed chores. the chores/index.html.erb table ugly code (sorry): listing chores <table> <th><%= "" %></th> <th><%= "sun" %></th> <th><%= "mon" %></th> <th><%= "tues" %></th> <th><%= "wed" %></th> <th><%= "thurs" %></th> <th><%= "fri" %></th> <th><%= "sat" %></th> <% @chores.each |chore| %> <tr class="<%= cycle('list-line-odd', 'list-line-even') %>"> <% ##todo.. fix sure link "post" action &qu

c++ - Time Consumption of FlushViewOfFile (Windows) and msync(Linux) -

good morning, we interested in time consumption of flushviewoffile , msync . quoting unmapviewoffile documentation : to minimize risk of data loss in event of power failure or system crash, applications should explicitly flush modified pages using flushviewoffile function. are flushviewoffile() , msync() expensive operations? reason asking in our application, may not need minimize risk of data loss in event of system crash. thank you, they expensive in sense move cached file memory disk. use memory mapped files avoid doing that! normal strategy flush infrequently program requirements allow.

user controls - opacity usercontrol c#.net 3.5 -

why not user control have 'opacity' property? how can use set property on user control? for winforms to make usercontrol transparent, have give ws_ex_transparent style, override onpaintbackground method draw background opacity , , invalidates parent redraw control whenever need update graphics

python - Problem with sqlAlchemy model -

so have following situation. have class datatypes has following structure: class datatype(base): __tablename__ = 'data_types' id = column(integer, primary_key=true) type_name = column(string) fk_result_storage = column(integer, foreignkey('data_storages.id')) parentdatastorage = relationship("datastorage", backref=backref("datatype", cascade="all,delete")) def __init__(self, name, resultid): self.type_name = name self.fk_result_storage = resultid now relationship defined here works. have specific data types created dynamically trough introspection , need deleted cascaded also. created this: t = table('data_' + obj.__name__.lower(), *t[:-1], **t[-1]) mapper(obj, t, *args, **kwargs) model.base.metadata.create_all(dao.engine) this works fine , tables created needed. want add relationship similar 1 datatype class. tried this: t = t('data_' + obj.__name__.lower(), *t[:-

Iterate and process child elements with jquery - proper use of $(this) -

i'm trying jquery find pairs of elements, take value of one, process , make value of next one, rinse , repeat. $(function() { $("div").each(function() { var longurl = $(this).attr("href"); $(this).html("processed "+longurl); }); }); <div class="long" href="plop"></div> <div class="short" href="plip"></div> <div class="long" href="plopouze"></div> output : processed plop processed plip processed plopouze so works, since selects divs, somehow proving each() can handle multiple objects ; fail understand how select $(this) objects using class selector, $(this).(.myclass) (in case $(this).('.short') ) not work..? if want check if $(this) has class .short can use $(this).is('.short') .

Communication between PHP and Python -

i'm trying build web interface python scripts. thing have use php (and not cgi) , of scripts execute take quite time finish: 5-10 minutes. possible php communicate scripts , display sort of progress status? should allow user use webpage task runs , display status in meantime or message when it's done. currently using exec() , on completion process output. server running on windows machine, pcntl_fork not work. later edit : using php script feed main page information using ajax doesn't seem work because server kills (it reaches max execution time, , don't want increase unless necessary) i thinking socket based communication don't see how useful in case (some hints, maybe? thank you you want inter-process communication . sockets first thing comes mind; you'd need set socket listen connection (on same machine) in php , set socket connect listening socket in python , send status. have @ this socket programming overview python documentation

c++ - error: use of deleted function -

i've been working on c++ code friend has written , following error have never seen before when compiling gcc4.6: error: use of deleted function ‘gamefsm_<std::array<c, 2ul> >::hdealt::hdealt()’ implicitly deleted because default definition ill-formed: uninitialized non-static const member ‘const h_t floppokergamefsm_<std::array<c, 2ul> >::hdealt::h’ edit: comes part of code using boost msm: boost webpage edit2: there no = delete() used anywhere in sourcecode. generally speaking, error mean? should looking when type of error occurs? i don't think other answers mentioning =deleted; syntax correct. error message says default constructor has been deleted implicitly . says why: class contains non-static, const variable, not initialized default ctor. class x { const int x; }; since x::x const , must initialized -- default ctor wouldn't initialize (because it's pod type). therefore, default ctor, need define 1 (and must

asp.net - How do I convert a boolean from true/false to yes/no on a Telerik ASP .NET MVC Grid -

i able change display value of non-editable column on non-editable telerik ajax grid in asp.net mvc. column in question boolean value sot display conversion yes=true , no-false. i did little experimenting , found works. not sure if hold on editable column in case column not editable. <% html.telerik().grid<someclass>() .name("somegrid") .columns(columns => { columns.bound(o => o.reportingperiodshortdescription); columns.bound(o => o.closed) .clienttemplate("<#=closed ? 'yes' : 'no' #>") .title("closed") .width("4em"); }) .footer(false) .render(); %>

Difficulty Understanding C Pointer Syntax -

given following c definitions: #define sync_byte_1 0x5a #define sync_byte_2 0xa5 and pointer declaration: uint8 *pcommanddata; pcommanddata = getcommandbufferpointer( lingo_general, stringlength + 3 ); what following 2 lines of code doing pointer? *pcommanddata++ = sync_byte_1; *pcommanddata++ = sync_byte_2; i don't understand use of * , ++ in instance. if pointer's address being incremented shouldnt * replaced & ? pcommanddata pointer piece of memory. first line *pcommanddata++ = sync_byte_1; sets value @ address 0x5a , , increments pointer pcommanddata next address. next line *pcommanddata++ = sync_byte_2; works similarly: sets value pcommanddata points to, 0xa5 , , increments pointer next address. perhaps picture useful. before either line executes, memory in neighborhood of wherever pcommanddata points might this: | | +--------+ pc

RVM/Rails installation error on ubuntu 11.04 -

after upgrading ubuntu 11.04 having problem rvm. following tutorial: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#top git installed ok, when follow instructions on rvm website apparently it's ok too, when close terminal , open new 1 , type ruby -v or rvm -v example got message "rvm not installed". what should do? after googling found: http://ygamretuta.me/2011/05/09/install-rvm-in-ubuntu-11-04-and-mac-osx-snow-leopard/ which worked me (ubuntu 11.04, x64) edit .bashrc file instead of ~/.bash_profile file favorite editor vim .bashrc add bottom: if [[ -s "$home/.rvm/scripts/rvm" ]] ; source "$home/.rvm/scripts/rvm" ; fi hope helps guys!

java - LinkedBlockQueue can't pass Watchable -

i want ask i'm doing .. linkedblockingqueue<whatch_directory> queue = new linkedblockingqueue<classes.watchable.whatch_directory>(); queue.put(classes.watchable.whatch_directory.create_watchable("dir")); but down classes.watchable etc function watchable class down him isn't showing, still watchable running. if understand you're asking, you're creating whatch_directory class somewhere else, trying make linkedblockingqueue of such things , using factory method create_watchable() create one. if so, appears whatch_directory extending watchable interface (based on other questions). seems code should become more like: class whatch_directory implements watchable { public static watchable create_watchable(string s) { // definition goes here } } linkedblockingqueue<whatch_directory> queue = new linkedblockingqueue<whatch_directory>(); queue.put(whatch_directory.create_watchable("dir"

regex - Regular expression circular matching -

using regular expressions (in language) there way match pattern wraps around end beginning of string? example, if want match pattern: "street" against string: m = "et stre" it match m[3:] + m[:2] you can't directly in regexp. can arithmetic. append string itself: m = "et stre" n = m + m //n = "et street stre" if there odd number of matches in n (in case, 1), match 'circular'. if not, there no circular matches, , number of matches in n double of number of matches in m .

iphone - AdMob not showing ads in iOS simulator -

i trying use admob on app (built ios 4.0) i've added sample code available in tutorial http://code.google.com/mobile/ads/docs/ios/fundamentals.html following (i've changed adunitid): // create view of standard size @ bottom of screen. bannerview_ = [[gadbannerview alloc] initwithframe:cgrectmake(0.0, self.view.frame.size.height - gad_size_320x50.height, gad_size_320x50.width, gad_size_320x50.height)]; // specify ad's "unit identifier." admob publisher id. bannerview_.adunitid = @"xyz"; // let runtime know uiviewcontroller restore after taking // user wherever ad goes , add view hierarchy. bannerview_.rootviewcontroller = self; [self.view addsubview:bannerview_]; [self.view bringsubviewtofront:bannerview_]; gadrequest * request = [gadrequest request]; // initiate generic

variables - Javascript scope question: Can't change element via 'this' obj passed to function, but I can using longhand approach -

revised question (see below original): here example of simple ajax load event binding on element within loaded content: sotest.htm <!doctype html> <html> <head> <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script> <script> function changebg(obj) { alert('color 1: should turn red'); jquery(obj).css('background-color','red'); alert('color 2: should turn green'); jquery('#' + jquery(obj).attr('id')).css('background-color','green'); } jquery(document).ready( function() { jquery('.loadedcontent').load('sotest2.htm'); jquery('body').delegate(&

java.util.Date and the UTC problem -

i know has been hot topic on time... can't find suitable answer. i have current utc time in ms, need compare current time in machine (so should match). long myutctime = .....; // reflects utc time // mydate in utc, ok, agree date mydate = new date(); // when use gettime() localtime in ms, although not in utc! in dst long milis = mydate.gettime(); // here 60 minute difference long difference = milis - myutctime; how can this? thanks in advance. edit: don't need calendar or anything. i'm not showing information user, want use utc times, , date supposed in utc date mydate = new date(); long milis = mydate.gettime(); should equivalent simpler: long milis = system.currenttimemillis(); both should return the difference, measured in milliseconds, between current time , midnight, january 1, 1970 utc quick check in linux box: # cat x.java public class x { public static void main(string[] args) { system.out.println( (new java

oop - C++: Copy object data in member function of base class -

suppose have 2 classes a, , b. b derived a. has no data members, b has 2 integer members. if define method in class a, following: void copyfrom( const a* other ) { *this = *other; } and call in child class, integer data member copied? no. known slicing problem . this true if overload operator= in both a , b : *this = *other ever resolve a::operator=(const a&) or b::operator=(const a&) being called.

Maven Android instrumentation test output -

as experiment, trying use maven build google android market licensing library, sample, , test projects. here pom.xml test project: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>etherwalker.example</groupid> <artifactid>license_test</artifactid> <version>0.0.1-snapshot</version> <packaging>apk</packaging> <name>license - instrumentation tests</name> <parent> <groupid>etherwalker.example</groupid> <artifactid>license_parent</artifactid> <version>0.0.1-snapshot</version> </parent> <dependencies>

iOS Network Packet Analyzer app -

i need start developing ios application need capture , analyze network traffic connecting devices. replacing java based desktop application same thing using jpcap: http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html from can find out, jpcap uses c/c++ library job done. problem running not knowing how can use jpcap in ios applications since java based though based on c/c++ objective-c superset of. if can give me ideas on how can done or if there other api's native objective-c, appreciate it. thanks

c# - How to associate an event with a menuitem in WPF using VS2008? -

i in process of learning wpf (i don't know yet). know how associate menu subitem event directly editing xaml but, i'd know how same thing using visual studio. for instance, consider following xaml snippet: <menu dockpanel.dock ="top" horizontalalignment="left" background="white" borderbrush ="black"> <menuitem header="_file"/> <separator/> <menuitem header ="_exit" mouseenter ="mouseenterexitarea" mouseleave ="mouseleavearea" click ="fileexit_click"/> i'd able associate "_exit" menuitem appropriate event handlers mouseenter, mouseleave , click using visual studio instead of manually editing xaml text. trying accomplish using "items" collection editor but, seems allow editing of subitem's properties , not events. there editor/dialog/etc a

django - Starting multiple celery daemons automatically using Jenkins -

i have ubuntu server set 5 different django sites running on it. these used testing, each developer has own site , database 1 site integrated code updated when features ready. jenkins used update each site github whenever changes pushed repository. we added django-celery our dependencies can processing on uploaded files asynchronously. each site needs own celery queue uses correct settings (database, upload directory, etc.) particular site. i want restart each celery server whenever code changes can latest changes automatically. have update script within our git repository jenkins runs whenever updates site. when try start celery daemon within script, celery starts, shuts down again @ end of script. here's copy of update script: #!/bin/bash # delete *.pyc files find $workspace -name '*.pyc' | xargs rm # update database […] # run automated tests python code/manage.py test <project> --noinput test_status=$? # refresh repo's public website touch

vim smart tabbing -

in emacs, whenever tab pressed, cursor moves appropriate location on current line. however, in vim, not happen, tab given length , go far every time press tab. there way enable "smart tabbing" in vim? i'm not sure behavior expect, it. :set smarttab also consider setting: :set smartindent :set autoindent

symfony1 - Why is my functional test getting the meta tag http-equiv='refresh' and then quitting? -

when run simple functional test (for example) users/signin page, i'm getting this: <html><head><meta http-equiv="refresh" content="0;url=https://localhost/index.php/users/signin"/></head></html> and functional test stops. happens in other functional tests too, not on every request. other tests run fine, when gets request in test, response (with requested url in content attribute), , stop. any ideas on why might happening? these functional tests used work, got project development company , don't have idea of where start looking changes. of course can diffs on files version control, don't know start. leads! argh, found quicker thought. the ssl filter turned on, , needs disabled test environment. had removed test environment app.yml. test: disable_sslfilter: true

arrays - How can I write a multidimensional JSON object in JSP and pass the JSON object back to JavaScript? -

i trying write multidimensional object or array in jsp , pass ajax call javascript. now, decoding json object using ajax have figured out (jquery json). so, i'm on front. but lost on creating multidimensional json object or array in jsp. i have been looking @ json-simple json plugin jsp (http://code.google.com/p/json-simple/). , it's not plugin, have been unable find examples of multidimensional json objects or array examples in jsp. like, example it's one-dimensional: //import org.json.simple.jsonobject; jsonobject obj=new jsonobject(); obj.put("name","foo"); obj.put("num",new integer(100)); obj.put("balance",new double(1000.21)); obj.put("is_vip",new boolean(true)); obj.put("nickname",null); system.out.print(obj); i json object have result this: { "results": [ { "address_components": [ { "long_name": "1600", "short_name": &quo

java - What is the {L} Unicode category? -

i came across regular expressions contain [^\\p{l}] . understand using form of unicode category, when checked the documentation , found following "l" categories: lu uppercase letter uppercase_letter ll lowercase letter lowercase_letter lt titlecase letter titlecase_letter lm modifier letter modifier_letter lo other letter other_letter what l in context? taken link: http://www.regular-expressions.info/unicode.html check unicode character properties section. \p{l} matches single code point in category "letter". if input string à encoded u+0061 u+0300, matches without accent. if input à encoded u+00e0, matches à accent. reason both code points u+0061 (a) , u+00e0 (à) in category "letter", while u+0300 in category "mark".

git - ssh_exchange_identification -

my windows 7 system cygwin behind corporate firewall, installed corkscrew , config file reads user git hostname ssh.github.com port 443 proxycommand /d/cygwin/bin/corkscrew http://x.x.x.x 80 %h %p /c/users/ad cd/.ssh/id_rsa. but when git clone ssh://git@github.com:443/rails/rails.git , error cloning rails... ssh_exchange_identification: connection closed remote host fatal: remote end hung unexpectedly there few problems corkscrew config. the first problem (and real problem) first argument corkscrew should hostname, not uri. drop http:// prefix. second argument lets corkscrew know proxy on port 80. another problem corkscrew uses username:password authfile authorizing proxy, not rsa key. last argument rsa private key, not authfile. other that, rsa public key not registered github.

c++ - Is this const_cast undefined behavior? -

i wondering whether following undefined behavior // case 1: int *p = 0; int const *q = *const_cast<int const* const*>(&p); // case 2: (i think same) int *p = 0; int const *const *pp = &p; int const *q = *pp; is undefined behavior reading int* if int const* ? think undefined behavior, thought adding const in general safe, i'm unsure. qualification-wise, it's fine. each expression split statement: int *p = 0; // ok int **addrp = &p; // ok int const *const *caddrq = addrp; // ok, qualification conv. according §4.4/4 int const *q = *caddrq; // ok note rules of const_cast (§5.2.11/3) identical of qualification conversion, without requirement of being monotonically increasing in qualification. in case, because you're ever adding qualifications const_cast unnecessary. concerning aliasing, don't think it's issue, here, or @ least it's not intended be. like mentioned, there's new bullet in c++0x list of allowed access

Wordpress removing the list container <ul> from the custom menu output -

any suggestions on how rid of ul tag wrapped around li tags in custom menu here at http://www.blueoceanportfolios.com/careers/ the custom menu outputted nested tags around like <ul id="menu-home" class="navleft"><li><a href="http://www.blueoceanportfolios.com/careers/">home</a></li> <li><a href="http://www.blueoceanportfolios.com/careers/?page_id=18">about</a></li> </ul> i trying take out tags , passed container => false parameter before outputting custom menu mentioned @ wordpress codex, below code again. $args = array( // 'menu' => 'primary', // 'sort_column' => '', 'container' => 'false', //'container_id'=>'myid', 'menu_class' => 'navleft', 'walker' => new my_walker() ); wp_nav_menu( $args ); try 'container' => fals