Posts

Showing posts from July, 2012

nhibernate - Ignore column using mapping by code in HNibernate -

i'm using mapping code in nhibernate. got class several properties. 1 of them not related columns in db still has getter , setter. i use conventionmodelmapper not modelmapper. first 1 assumes properties mapped. how can tell nhibernate ignore it? why not map properties want , leave ones not needed mapped check this you can manage persistence of conventionmodelmapper following: mapper.beforemapproperty += (mi, propertypath, map) => { // code here using mi, propertypath, , map decide if want skip property .. can check property name , entity name if want ignore }; a better answer be: mapper.ispersistentproperty((mi, declared) => { if (mi.declaringtype == typeof (yourtype) && mi.name == "propertynametoignore") return false; return true; ...

visual studio 2008 - Integrating CUDA 4.0 into existing VS2008 project -

i wrote simple raytracer in c++ , want add cuda project. edited .vcproj manually , added cudart build rule can't work. nvcc invoked cuda compiles ok, seems host compiler doesn't recognize of cuda types , kernel syntax. my cuda version 4.0 rc2, can compile , run other cuda projects. please help. got deadline on head. you need ensure cuda code in .cu files such compiled nvcc, since nvcc understands cuda keywords.

iphone - Delegate for "View" for Push Notification -

is there delegate gets called when tap on "view" button of push notification alert. when app inactive. yes there is. application:didfinishlaunchingwithoptions: . apple docs: if action button tapped, system launches application , application calls delegate’s application:didfinishlaunchingwithoptions: method (if implemented); passes in notification payload (for remote notifications) or local-notification object (for local notifications). if application icon tapped, application calls same method, furnishes no information notification. here reference: local , push notification programming guide @ handling local , remote notifications section.

bash - trac-admin deploy not working -

i'm trying use trac-admin deploy command. sudo trac-admin /home/****/repository deploy /home/****/trac_temp/ after entering password get: error: command not found anyone know i'm doing incorrectly? looks "trac-admin" not found root shell. try use full path: /path/to/.../trac-admin

javascript - Hide scroll bar even when the cursor hovers the div -

i have div text scrolled , down 2 simple buttons & js. wish totally disable scroll bars never appear on screen, if crosser above them. how approach problem? thank shani add overflow: hidden css rule div.

Android USB device mode commands -

hi searching cannot find android usb device mode commands. not looking host mode in android, device mode commands. not find in developer.android site. can help? thanks in advance. the usb interface not part of android sdk. custom firmware can manipulate usb, of course, , can learn more @ http://source.android.com .

spring ws clientinterceptor example -

i need add custom soap header out going soap message in spring ws 2.0 client. i using client interceptor follows..... public class mywebserviceclientinterceptor implements clientinterceptor { private qname qname = new qname(web_service_namespace, soap_header_part); private string testtext = "<username>myuser</username><role>everything</role>"; @override public boolean handlerequest(messagecontext context) throws webserviceclientexception { soapmessage soapmessage = (soapmessage) context.getrequest(); soapheader soapheader = soapmessage.getsoapheader(); soapheaderelement newheader = soapheader.addheaderelement(qname); newheader.setactororrole(my_soap_actor); newheader.settext(testtext); return true; } } i have confirmed interceptor called, header doesn't seem added. meant doing sort of "commit" apply header message ???? no, don't need type of com...

Inner-mosts Lists in Python -

this question has answer here: list of lists changes reflected across sublists unexpectedly 13 answers why? equal, initially. same operation hey different structures. why 2 methods of constructing nested lists give different results? >>> lll=[[[[[]]*2 in xrange(2)] b in xrange(2)]] >>> ll=[[[[[]]*2]*2]*2] >>> lll [[[[[], []], [[], []]], [[[], []], [[], []]]]] >>> ll [[[[[], []], [[], []]], [[[], []], [[], []]]]] >>> ll==lll true >>> ll[0][0][0][0]=1 >>> lll[0][0][0][0]=1 >>> ll==lll false #why? structure [ [ [ [ [], [] ], [ [], [] ] ...

objective c - How can I build this static C library to work with iPhone -

i have been trying c library built iphone project. library provided me makefile. when build library running make , adding static lib project linker complains library build x86_64 architecture , cannnot linked i386. so.. edited make file build library i386. project compiles , links without problem application terminates due to: detected attempt call symbol in system libraries not present on iphone: fcntl$unix2003 called function irc_connect in image kadechat. if encountering problem running simulator binary within gdb, make sure 'set start-with-shell off' first. i did lot of googling , seems might bug version of sdk (but im not sure). so.. want run application on device since, apparently, simulator not work. problem cannot library build target architecture. file built unsupported file format not architecture being linked (armv7) i edited make file again try , build library device's target architecture. i made following edits in makefile: cc...

css vs dreamweaver templates -

what difference in performance between css templates , dreamweaver templates , or same. need know 1 gets indexed quicker google. want move website 1 best templates quick uploads , ftp linkups linkmanagement tools please advise thanks this why despise dreamweaver , alike... dreamweaver creates websites, consist of html , css code, , maybe javascript. html : "glue". it's structure browsers read. css : "perty stuff". it's browsers read determine how make page (colors, layout, etc.). since dreamweaver makes websites, dreamweaver template helps dreamweaver make websites, implies follows above structure. templates style site , might provide basic functionality, have nothing uploads. might bloated , cause slow loading times, that's dependent upon template. in end, dreamweaver template more or less css + html .

xamarin.ios - Why is Exception StackTrace null in MonoTouch 4 running on device? -

i've updated mt 4.0.1 3.2.6. seems exception reports no longer contain stack traces when running on device. i have exception handler attached appdomain.currentdomain.unhandledexception use save exception report file. on simulator in both debug & release modes, unhandledexceptioneventargs.exceptionobject.stacktrace set. on device in both debug & release modes property null. i have tried checking "emit debugging information" in "compiler" section of project options. have tried adding "--nosymbolstrip" mt build args. have tried llvm both enabled , disabled. any ideas? not able update in app store until we're confident exception reports receive contain necessary diagnostic info. what information exceptionobject.tostring() provide? should include error message , stack trace. know has been working me, b/c used submit bug novell. also, might want wrap try-catch around app startup in static void main() , appdomain.unhandlede...

Read Cookies from BlackBerry -

is there way download cookies desktop, can read them? right using mds-stand alone simulator os 5.0.0 blackberry 9520, , after cookies saved, go simulator's directory pull dump file, i.e. research in motion\blackberry smartphone simulators 5.0.0\5.0.0.741 (9520)\9520-fs.dmp then binary editor can view cookies content (user, password etc). is there simpler way this? i find wireshark useful speeding sort of thing, view cookie contents , other api information in packet trace arrives. in case using https can still view packet information using software charles proxy .

Excel VBA: cannot Sum() over Range() -

how should fix code because throws: "the object doesn't support property or method" sub macro1() workbooks("output.xls").sheets("sheet1").activate activesheet.range("b4") = _ workbooks("input.xlsx").sheets("sheet1").sum(range("d40:d50")) end sub above code works fine when adjusted as: sub macro2() workbooks("output.xls").sheets("sheet1").activate activesheet.range("b4") = _ workbooks("input.xlsx").sheets("sheet1").range("d40") end sub however it's not acceptable solution because want sum() on range() described in macro1(). worksheet doesn't have sum function, try using worksheetfunction instead: sub macro1() workbooks("output.xls").sheets("sheet1").activate activesheet.range("b4") = _ application.worksheetfunction.sum(workbooks("input.xlsx")...

actor - How can I use a TypedActor in a Java application? -

i try implement typedactor in java following examples on typed actors (java) . i'm struggling. have added akka-actor-1.1-m1.jar , akka-typed-actor-1.1-m1.jar , scala-library.jar wasn't enough. got errors in eclipse added aspectwerkz-2.0.jar , aspectwerkz-core-2.0.jar build path. i try use typedactor custom constructor. but error @ compilation: exception in thread "main" java.lang.nosuchmethoderror: org.codehaus.aspectwerkz.proxy.proxy.newinstance([ljava/lang/class;[ljava/lang/object;zz)ljava/lang/object; @ akka.actor.typedactor$.newinstance(typedactor.scala:596) @ akka.actor.typedactor$.newinstance(typedactor.scala:634) @ akka.actor.typedactor.newinstance(typedactor.scala) @ com.example.actor.actortest.main(actortest.java:12) here code baseactor : import akka.actor.typedactor; public class baseactor extends typedactor implements baseservice { private string str; private int num; public baseactor(string str, int num) { ...

How can I access the internal LDAP-directory of Websphere Portal 6.1? -

i'd access internal user directory of websphere portal 6.1 server outside (say, ldap-browser on same machine). there ldap interface usable that? websphere portal default uses database user registry until configure security.

iphone - iOS Root View Controller's viewDidAppear: called while splash screen (Default.png) still on screen -

in ios app want run series of operations in root view controller after has appeared on screen. however, seems ios app calling viewdidappear while splash screen (i.e. showing default.png image) still on screen , before root view controller laid out on screen. i've tried same code in viewdidload well, , had same problem. how can force code run once root view controller on-screen? in viewdidload use [self performselector:@selector(loaddata) withobject:nil afterdelay:.5]; and use code inside loaddata method...

c++ - How does node.js/[my own library/plugin] run on v8? -

does use libraries this: http://code.google.com/p/v8-juice http://ui.ajax.org/#o3 https://github.com/tsa/vu8 or has written own libraries? if v8 written executing javascript, why node.js libraries use c code? filesystem/event stuff? if so, why necessary, doesn't v8 need events , filesystem stuff itself? if want work database supports c api, how go doing that? right i'd write v8-juice plugin. node.js includes own embedded version of v8 (not sure if customized or not, be). javascript provides no interface things file system i/o, embedder (in case node) have provide native code objects expose functionality. browser same thing dom , network features, way. if want work database supports c api, how go doing that? you'd need node.js extension (a native code plugin). if lucky, has made on database system, if not, @ source code similar extension how written. , here an introduction article . you'd need familiar writing v8 extension, because nod...

Zend router config xml, shortcut? -

i have xml this <configdata> <routes> <home type="zend_controller_router_route"> <route>home</route> <defaults> <controller>index</controller> <action>index</action> </defaults> </home> </routes> </configdata> now works i'd give each rout shortcut add in bootstrap this.. $router->addroute('shortcut_key',$route); how can in config xml? on bootsrap.php... protected function _initroutes() { $routefile = new zend_config_xml(application_path.'/routes.xml'); $router = zend_controller_front::getinstance()->getrouter(); $router->addconfig($routefile); return $router; } where routes.xml file xml file containing routes , must inside application folder

ios - CAAnimation trouble -

i planning on using caanimation switch views confused on how this. know caanimation works using , value how move uiview using tovalue , fromvalue . lets want mimic uinavigationcontroller 's pushviewcontroller , how using caanimation mentioned above? thanks!!! if use simple animation, can use uiview apis, beginanimations:context: about caanimation , can sample doc reference

javascript - Advice on using display:none to hide elements and also remove them completely from DOM -

i using css media queries on site , have used display: none hide elements. although trick in terms of hiding element still remains in dom. there methods can use remove element dom also? element.parentnode.removechild(element) universal method remove dom nodes from. the jquery method: $("selector").remove() example: <body> <div id="foo"></div> </div> javascript: var element = document.getelementbyid("foo"); element.parentnode.removechild(element); jquery equivalent: $("#foo").remove(); result: <body></body>

retrieving user id in cakephp view -

i'm trying retrieve user id in cakephp view, what's best practise achieve that? since auth->user('id') usable in controller, what's used in views? edit : i fixed using in controller: $id = $this->auth->user('id'); $this->set("user_id",$id); then in view of controller retrieve $user_id. use session helper . var $helpers = array('session'); // controller // view $this->session->read('auth.user'); // returns complete user record $this->session->read('auth.user.email'); // returns email logged in user

r - Remove NA values from a vector -

how can remove na values vector? i have huge vector has couple of na values, , i'm trying find max value in vector (the vector numbers), can't because of na values. how can remove na values can compute max? trying ?max , you'll see has na.rm = argument, set default false . (that's common default many other r functions, including sum() , mean() , etc.) setting na.rm=true you're asking for: d <- c(1, 100, na, 10) max(d, na.rm=true) if want remove of na s, use idiom instead: d <- d[!is.na(d)] a final note: other functions (e.g. table() , lm() , , sort() ) have na -related arguments use different names (and offer different options). if na 's cause problems in function call, it's worth checking built-in solution among function's arguments. i've found there's usually 1 there.

perl - How do I test a Test::Builder test? -

i'm writing module test::builder . want write test tests test when it's failing . unfortunately failing test in test makes test fail, , whole test suite fails. how can test failing tests? don't cause test suite fail. code examples appreciated test::builder::tester included in test::builder/test::simple distribution , contains functions testing kind of test module uses test::builder (test::simple, test::more, , great majority of well-behaved recent test modules).

javascript - Dynamically calculate a div width -

here sample divisions: #grandparent { width: 100px; } #parent { overflow: auto; height: 100px; } .child { overflow: hidden; margin-left: 10px; } <div id="grandparent"> <div id="parent"> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> <div class="child">1000000000000000000000000</div> </div> </div> the <div class="child"> width value 10 pixels less <div id="parent"> width value. how can calculated width value given ...

java me - J2ME Insert a list element into a new form TextField -

i want insert element of list 1 new form's textfield , change value. possibe? if not, possible change element of list @ selecting , type new value? thanks! if correctly understand you, looking way manipulate javax.microedition.lcdui.list. in order "edit" value need use getselectedindex() (list option selected user editing) getstring(int elementnum) . you can display in textfield editing. before "adding" list need delete old element delete(int elementnum) , can insert in position new value insert(int elementnum, string stringpart, image imagepart)

Calling perl script from Java servlet -

i'm trying call perl script java servlet on tomcat 7. have set context.xml , web.xml can run .pl file going http://localhost:8080/test/cgi-bin/test.pl , can run perl directly within java so: string[] cmdarr = new string[]{"perl", "-e", "print \"content-type: text/html\n\n\";$now = localtime();print \"<h1>it $now</h1>\";"}; if (cmdarr != null) { process p = null; runtime rt = runtime.getruntime(); try { p = rt.exec(cmdarr); // throws ioexception returnvalue = p.waitfor(); // throws interruptedexception } catch (ioexception xio) { throw new runtimeexception("error executing command.",xio); } catch (interruptedexception xinterrupted) { throw new runtimeexception("command execution interrupted.",xinterrupted); } inputstreamreader isr = new inputstreamreader(p.getinputstream()...

wpf - WinDbg Help Pls -

i'm pretty new using windbg, application started having issues, on windows 7 machines (it runs fine first time pc started crashes or disappears silently each time after). i got mdmp file, find myself lacking on how best extract data need it. got following analysis (might doing wrong)... can shed light on issue or if i'm running analysis incorrectly: 0:000> !analyze -v ******************************************************************************* * * * exception analysis * * * ******************************************************************************* getpageurldata failed, server returned http status 404 url requested: http://watson.microsoft.com/stageone/star_exe/1_0_0_0/4dbad268/kernelbase_dll/6_1_7600_16385/4a5bdaae/e0434352/00009617.htm?retriage=1 ...

Excel VBA: Copying Pictures from image controls to activeX objects -

i have series of images need display multiple times on both forms (via image controls) , on worksheets (via activex image controls). know keep files externally , use loadpicture method; there want avoid if possible. i know save , load- again rather not use external file write perform task. ideally, stay embedded , hidden within file itself. i think there maybe solution in using clipboard- couldn't syntax work. object embedded in same location(s); never moves or changes size or other properties (beyond .visible). simple like; sheet1.oleobjects("toimage").object.picture = frm1.fromimage.picture **edit: ** think i've found solution this; still have related question. i worked out want if embed series of activex images on sheet; reference them in actual controls / objects want. so; sheet1.oleobjects("toimage").object.picture=sheet1.oleobjects("fromimage").object.picture or frm1.controls("toimage").picture = sheet1.oleob...

javascript - Coffeescript/jQuery Pattern: Caching Data Across Events -

i have list of items abstracts, , can made expand via ajax on click. i'v written following code in coffeescript: current_open_row = null $('li.faq-item').live 'click', (event) -> $.post("/faqs/update_rows", {old_row_id: current_open_row, new_row_id: $(this).attr('id')}, (data) -> replace_items data , 'json') current_open_row = $(this).attr('id') this doesn't read smooth coffeescript , find myself thinking, "what have done better," in particular, instantiating current_open_row variable outside scope of click handler feels strange. not doing this, of course, causes new instantiation upon entry handler, undefined. other refactoring $(this).attr('id') variable, there jumps out ugly, suboptimal, unreadable, etc., or pretty way of it? thanks! well, first off, think you'll find switching camelcase eventually... know many people prefer readability_of_underscores, every librar...

ruby on rails - ActiveRecord: Handling DB races among workers -

i have rails 3 project running on top of postgresql 9.0. use case: users can request follow artists name. this, submit list of names rest resource. if can't find artist name in local collection, consult last.fm information them, , cache information locally. process can take time, delegated background job called indexartistjob . problem : indexartistjob run in parallel. thus, possible 2 users may request add same artist @ same time. both users should have artist added collection, 1 artist should end in local database. relevant portions of artist model are: require 'services/lastfm' class artist < activerecord::base validates_presence_of :name validates_uniqueness_of :name, :case_sensitive => false def self.lookup(name) artist = artist.find_by_name(name) return artist if not artist.nil? info = lastfm.get_artist_info(name) return if info.nil? # check local db again corrected name. if name.downcase != info.name.downcase artist =...

Problems Implementing Analytics Custom Variables (Bounce Rate goes to zero) -

i'm having trouble implementing google analytics custom variables on site. problem bounce rate goes 0 when using them. i'm using asynchronous implementation , split code version (http://code.google.com/apis/analytics/docs/tracking/asyncusageguide.html#splitsnippet) track pageview. so, code looks this: <script type="text/javascript"> var _gaq_custom_variables = _gaq_custom_variables || []; _gaq_custom_variables.push(['_setaccount', 'ua-22770314-1']); </script> <!-- rest of page content --> <script type="text/javascript"> _gaq_custom_variables.push(['_setcustomvar', 1, // slot 'variable name', // variable name 'value', // variable value 3 // scope. ]); </script> <script type="text/javascript"> _gaq_custom_variables.push(['_trackpageview']); (f...

Redirect after clicking on the Facebook login button, even if already logged in Facebook -

i have standard facebook login button on homepage , don't want people automatically log site facebook account, if user clicks login button. if user not logged in facebook, popup appear asking him credentials , redirected loggedin.html after that. <div id="fb-root"></div> <fb:login-button perms="email"></fb:login-button> <script> window.fbasyncinit = function() { fb.init({ appid : 'xxxxxxxxxxxx', status : true, cookie : true, xfbml : true }); fb.event.subscribe('auth.login', function() { window.location = "loggedin.html"; }); }; (function() { var e = document.createelement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_us/all.js'; e.async = true; document.getelementbyid('fb-root').appendchild(e); }()); ...

css - Is it possible to inline LESS stylesheets? -

for example, possible like: <style type="text/less"> #foo { .bar { font-weight: bold; } } </style> this has been possible since july 2010, , works today's less 1.2.0 version. see initial diff added support this .

concatenation - perl parsing command-line arguments -

i need write perl program accept command lines arguments can concatenated e.g. myperl.pl -l -c -d same myperl.pl -lcd the constrains couldn't use build in modules such "getopts", know of else realize easily. i agree, should use modules. anyway, here's 1 attempt can build upon: use strict; use warnings; @opts = grep /^-\w+/, @argv; print "(1) @opts\n" if @opts; @normalized = sort grep /\w/, map { split /(-|)/ } @opts; print "(2) @normalized\n" if @normalized;

c++ - Vector print out wrong value -

hi got question following code. copy char string, read out of file vector , print out vector on screen. program copy string out ouf textfile vector gives out last element of vector. did wrong here?? : #include <fstream> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #include <sstream> #include <vector> #include "mbusread.h" using namespace std; int main() { int dev_nr; int anzahl; ifstream addr; string buffer; string dev_no; stringstream devss; char *reg_no_c = new char [buffer.length()+1]; char *start_reg_c = new char [buffer.length()+1]; char *adresse_c = new char [buffer.length()+1]; char *id_c = new char [buffer.length()+1]; char *zeit_c = new char [buffer.length()+1]; addr.open("addr.xml", ios::in); //addressendatei auslesen //anzahl suchen { getline(addr, buffer); } while(strcmp (buffer.c_str(), "<anz...

ios - Accessing dictionaries in PList for UITableView -

Image
i'd create simple reference app lists group of people, job title, , portrait. have far list of people , job title. works alright, think should have done differently. from reading other posts, suppose should using dictionaries. how plist looks: and how important bits of code look: @implementation rootviewcontroller @synthesize staffarray, subtitlearray; - (void)viewdidload { [super viewdidload]; nsstring* path = [[nsbundle mainbundle] pathforresource:@"staffdata" oftype:@"plist"]; nsdictionary *dict = [nsdictionary dictionarywithcontentsoffile:path]; nsmutablearray *tmpnamearray = [dict objectforkey:@"root"]; self.staffarray = [[nsmutablearray alloc] initwitharray:tmpnamearray copyitems:yes]; nsmutablearray* tmpsubtitlearray = [dict objectforkey:@"subs"]; self.subtitlearray = [[nsmutablearray alloc] initwitharray:tmpsubtitlearray copyitems:yes]; } - (nsinteger)tableview:(uitableview *)tableview numbe...

jQuery: how to select the last N columns of each row in a table? -

i have table 6 columns. want run function on last 3 columns of each row (excluding header row). have following selector working: $('table.listviewtable > tbody > tr:gt(0)').find('td:gt(2)') .each(function () { runmyfunction($(this)); }); is there way in 1 selector (ie, without intermediate find )? update: i've tried $('table.listviewtable > tbody > tr:gt(0) td:gt(2)') and $('table.listviewtable > tbody > tr:gt(0) > td:gt(2)') but did not work. returned 4th, 5th, , 6th columns of 2nd row , columns of subsequent rows. here go: $('table.listviewtable td:nth-child(n+4)') live demo: http://jsfiddle.net/simevidas/qj3tp/1/ (i'm assuming you're using th elements header cells.)

apache2 - Can actual PHP code be causing a segmentation fault in Apache, and if so how? -

i have apache 2.2.14 installed php version 5.3.2 , libapache2-mod-php5 version 5.3.2-1ubuntu4.7 on ubuntu 10.04 x64. getting segmentation faults rather in apache2 error logs. after getting apache dump crash log , running through gdb seems culprit php module. it's crashing on specific bit of code. here output gdb: core generated `/usr/sbin/apache2 -k start'. program terminated signal 11, segmentation fault. 0 0x00007ff2b3acaec3 in _zend_mm_free_canary_int (heap=0x7ff2b9035b10, p=0x6d48358fae6de187) @ /build/buildd/php5-5.3.2/zend/zend_alloc_canary.c:2090 2090 /build/buildd/php5-5.3.2/zend/zend_alloc_canary.c: no such file or directory. in /build/buildd/php5-5.3.2/zend/zend_alloc_canary.c a @ frame 0, innermost frame, yields this: (gdb) dump_bt executor_globals.current_execute_data [0xb79f0c10] get() /var/www/somedirectory/settingsfile.inc:18 [0xb79f09f0] get() /var/www/somedirectory/securityfile.inc:10 [0xb79ef068] __construct() /var/www/somedirectory/p...

How can I replace sub-strings of a large string based on a dictionary in Python? -

i have long string (a "template") containing "replacement points" in form of %mark% (there can more occurences in string single given marker too). want replace these markers, controlled python dictionary (it not contain % signs markers), like: rep_dict = { "title": "this title", "content": "here content" } the problem: simple call of replace() method 1 one not solution: previous replacement may contain 1 of these marks, must not replaced! the solution should fast enough, since have large templates, , need replace many of them within big loop. have ugly , long implementation many find() 's, counting offsets in original string during replacament process, etc. have hope there nicer, more compact, , quicker solution. the easiest solution is import re re.sub(r'%(.+?)%', lambda m: rep_dict[m.group(1)], your_template) not fast enough? said 'do not use regex' , obey? parsing template using c...

function - Unbound local variable problem in Python -

i've got following code snippet: def isolation_level(level): def decorator(fn): def recur(level, *args, **kwargs): if connection.inside_block: if connection.isolation_level < level: raise isolationlevelerror(connection) else: fn(*args, **kwargs) else: connection.enter_block() try: connection.set_isolation_level(level) fn(*args, **kwargs) connection.commit() except isolationlevelerror, e: connection.rollback() recur(e.level, *args, **kwargs) finally: connection.leave_block() def newfn(*args, **kwargs): if level none: # <<<< error message here, unbound local variable `level` if len(args): if hasattr(args[0], 'isolatio...

actionscript 3 - Flash player ( debugger ) - show again the errors -

i have pressed "dissmiss all" button inside debugger window of flash player, , stoped permanently showing me errors on page. how resume showing errors inside flash debug window ? in personal windows folder (documents , settings\your name), may find mm.cfg file. modify following line: suppressdebuggerexceptiondialogs=0

javascript - Accessing an elements event handlers with jQuery -

how can access elements event handler's jquery. the following link seems indicate access them via $(element).data('events') accessing functions bound event handlers jquery but method doesn't seem work anymore. $(element).data('events') still works me. see here in jq 1.5.2: http://jsfiddle.net/jaaulde/f82ky/1/

html - Tooltip alignment -

how can change css so, tooltip shows right left? opposite of now. http://jsfiddle.net/q55c8/ thank you! write : .tooltip span.info { display:none; position: absolute; white-space:nowrap; border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0,0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); font-family: calibri, tahoma, geneva, sans-serif; margin-left: 0; z-index: 1; top:20px; right:0; } check http://jsfiddle.net/sandeep/q55c8/5/

perl - "Modification of a read-only value" on while loop with implicit $_ variable -

i don't understand why following piece of perl code #!/usr/bin/perl -w use strict; use warnings; strange($_) qw(a b c); sub strange { open file, '<', 'some_file.txt' or die; while (<file>) { } # line 10 close file; } is throwing following error modification of read-only value attempted @ ./bug.pl line 10. is bug? or there should know usage of magic/implicit variable $_ ? the while (<fh>) construct implicitly assigns global variable $_ . this described in perlop : if , if input symbol thing inside conditional of while statement (...), value automatically assigned global variable $_, destroying whatever there previously. (...) $_ variable not implicitly localized. you'll have put local $_; before loop if want happen. the error thrown because $_ aliased constant value ( "a" ). you can avoid declaring lexical variable: while (my $line = <file>) { # $line }

sql - How to set primary key on a field in fusion table -

i have table named "testing". fields in table id,name , description. want make id field primary key i.e. unique values should entered in field. thanks, himanshu when create table in addition column names specify in create table statement, google fusion tables create column named rowid contains automatically-assigned, unique id number each row.

objective c - How can I pass values from obj-C to a quartz composer view? -

in .xib application i'm working on, have quartz composer viewer object (qcview) in window. have patch controller (qcpatchcontroller). patch controller has own class files in xcode, aren't doing right now. following apple docs, able bind values within .nib file if edited text field, pass value published input on qc document. unfortunately, these docs nothing how pass values programatically. how can pass values (in code) qc patch? thanks in advance! you should able use -setvalue:forkeypath: . example: [patchcontroller setvalue:@"foo" forkeypath:@"patch.stringinput.value"];

jquery - Issue with applying fadeIn and FadeOut -

i have created 7 html pages , code below used refersh , move subsequent page. have added bit of jquery fadein section of page called main. when webpage loads, , fades out before moves next page. problem encounter that, section have not faded out moves up. there way make section not fading remain in position? $(document).ready(function() { var intervalid = window.setinterval(fade_effect, 4000); $("#main").css("display", "none").fadein("slow"); function fade_effect() { $("#main").fadeout("slow"); } }); i suggest fade out point opacity low, cannot seen human eye, vampire or otherwise....ok, may have gone overboard that, whatevs: var fade_effect = function() { $("#main").fadeto("slow", 0.001); }; $(document).ready(function() { var intervalid = window.setinterval(fade_effect, 4000); $("#main").css("disp...

sql server - Sql query optimization using IN over INNER JOIN -

given: table y id int clustered index name nvarchar(25) table anothertable id int clustered index name nvarchar(25) table somefunction does math returns valid id compare: select y.name y dbo.somefunction(y.id) in (select anothertable.id anothertable) vs: select y.name y join anothertable on dbo.somefunction(y.id) on anothertable.id question: while timing these 2 queries out found @ large data sets first query using in faster second query using inner join . not understand why can explain please. execution plan generally speaking in different join in join can return additional rows row has more 1 match in join -ed table. from estimated execution plan though can seen in case 2 queries semantically same select a.col1 ,dbo.foo(a.col1) ,max(a.col2) dbo.foo(a.col1) in (select col1 b) group a.col1, dbo.foo(a.col1) versus select ...

Convert a .c file, that was created on a Mac, to Windows -

is there way convert .c file created on mac compatible vs2010? or stuck having re-type code hand? thanks! you try mac2dos .

php - Change HTML language from en-US in to en-GB in WordPress? -

this may sound simple , trivial question, i'm using following tag in wordpress theme header file: <html <?php language_attributes(); ?>> which outputting: <html dir="ltr" lang="en-us"> i wish change lang attribute "en-gb" blog , language posts written in british english (en-gb) can't find parameter set in wordpress admin settings, , there isn't value in wp_options database table either, leaves me believe setting lang value must sort of dark art? define language attribute using: define ('wplang', 'en-gb'); you can more information on @ http://codex.wordpress.org/installing_wordpress_in_your_language

java - How to test memory used considering garbage collector? -

i testing sorting algorithm, , test average used memory testing 1000 random vectors. problem when run 20 random vector inside loop, garbage collector run , lose calculation. should please? don't want test manual 1 one =x. for(int j = 0; j < 1000; j++) { int vetoriginal[] = generate(); for(int = 0; < 10; i++) { int vetparateste[] = vetoriginal.clone(); long memoriainicial = runtime.getruntime().freememory() / 1024; mergesort(vetparateste); somamemoriakb += memoriainicial - runtime.getruntime().freememory()/1024; } } system.out.println("average memory used: " + somamemoriakb / (1000* 10)); ok, i'm little late here , have solved now, in case else wants know, easiest way prevent gc cleaning object keep reference in object. every object create add sort of container array/hash/vector/list or whatever language supports. eg: var items array[0..numberofitems] (var = 0; < numberofitems; i++) { var v...

.net - How do I force loading of a specific assembly into every application domain of an MVC 2 application? -

i have loosely coupled code depends on specific assembly being loaded current application domain: assembly assembly = appdomain.currentdomain.getassemblies().where( candidateassembly => candidateassembly.fullname.startswith("microsoft.windowsazure.serviceruntime")).singleordefault(); and code executed inside mvc 2 application , yields null reference because assembly not loaded current application domain. call code assembly, introduce strong dependency of application code on assembly , no longer have loose coupling. i need force iis (or whatever else) load assembly application domain before code runs. tried write implementation of ihttpmodule , list in web.config, doesn't help. so far tried add assembly under <system.web><compilation><assemblies> , looks works, i'm not sure whether it's reliable. how force loading specific assembly application domain without introducing dependency in code? this wrong way , can caus...

Mysql Slow Query Optimization -

i have shopping cart continually logs slow queries one... # query_time: 4 lock_time: 0 rows_sent: 50 rows_examined: 454403 select sql_calc_found_rows products.*, descr1.product product, min(prices.price) price, group_concat(if(products_categories.link_type = 'm', concat(products_categories.category_id, 'm'), products_categories.category_id)) category_ids, cscart_seo_names.name seo_name cscart_products products left join cscart_product_descriptions descr1 on descr1.product_id = products.product_id , descr1.lang_code = 'en' left join cscart_product_prices prices on prices.product_id = products.product_id , prices.lower_limit = 1 ...

linq - Recursively remove items from Tree -

i have treeview following structure: var mytree = myrepository.gettree(); where object folder structured in way: public class folder { public string name { get; set; } public list<folder> folders { get; set; } public folder parent { get; set; } } assuming repository returning me structure: myfolder -mychild01 -mychild02 -mysubchild01 -mychild03 -mysubchild02 i need recursively read items in tree , if item has name containing '02' have remove item tree. final result should be: myfolder -mychild01 -mychild03 i see how using recursive linq anonymous delegate or recursive function. there's number of approaches take this. the easiest thing take functional approach , rebuild tree recursively excluding folders match pattern. static folder filtered(folder root, func<folder, bool> predicate) { return new folder { name = root.name, parent = root.parent, folders = ...

ios4 - AVAssetWriter startWriting fails on iPod Touch 3rd Gen / OS 4.2.1 -

my app creates mp4 file. i've verified code have works on following devices: ipad (os 4.3.2) iphone4 (os 4.2.1) iphone 3gs (os 4.2.1) .. init fails on ipod touch 3rd gen running os 4.2.1. this related another question on here, i'm seeing on a different ios device , i've included init code here. other question, i've tried different pixel formats bitrates, avassetwriter's status changes avassetwriterstatusfailed after calling startwriting function. any ideas appreciated. know mp4 creation possible on device because i've downloaded app fine on same device code fails on. here minimal code video setup. #import "avfoundation/avfoundation.h" #import "avfoundation/avassetwriterinput.h" #import "avfoundation/avassetreader.h" #import "foundation/nsurl.h" void videosetuptest() { int width = 320; int height = 480; // setup codec settings. int nbitspersecond = 100000; nsdictionary *codecsett...

Detecting Chrome Saved Input Information with Jquery? -

i'm using jquery develop placeholder text on input fades when input gets focus, , disappears when users types. part works fine. so, avoid conflict saved text, wrapped code in: if(!$($input).val()) { ...create placeholder, set rules fading it, etc... } if user has saved password example, in firefox, browser detect input has value , not create placeholder text. in chrome, however, chrome not load saved value until after page 'done' loading... means detects input empty, creates placeholder text, , after page loaded, places saved value in input--leading placeholder , password being on top of each other. how can detect chrome filling out form avoid unfortunate overlap? in end, noticed chrome doesnt trigger sort of event upon autofilling, if wait until window.load , check if input has -webkit-autofill can check them then. can see i'm using debouncer (ben alman - http://benalman.com/projects/jquery-throttle-debounce-plugin/ ) wait further 200 millisec...

How to remove duplicates (nodes with the same fields) from drupal 7 view? -

for example: have products diff colors. want colors. if add view fields color field duplicates (colors) in output. needs realize group field_color_value in sql-query. i don't understand @ want do. example, colors? (terms, item text listbox field...). without having information can tell in view's style settings (click on gear icon next style), can group fields have in view's field section.

ASP.NET MVC 3 WebGrid Sort Order Image -

i working webgrid, , have image or character "^" "v" in header showing column sort order. how can this? this code of 1 of webgrids: <div id="contenedor-gridactividad"> @{ webgrid gridactividad = new webgrid(model.actividaddiaria, ajaxupdatecontainerid: "contenedor-gridactividad", rowsperpage: 20); } @gridactividad.gethtml( fillemptyrows: true, alternatingrowstyle: "fila-alternativa", headerstyle: "encabezado-grid", footerstyle: "pie-grid", mode: webgridpagermodes.all, firsttext: "<<", previoustext: "<", nexttext: ">", lasttext: ">>", columns: new[] { gridactividad.column("contrato", header: "contrato...

c# - Intercepting dependencies in MEF -

is possible intercept dependency requests in mef before handled mef? this useful implementing decorators , advanced lifetime management. something like... catalogue.addinterceptor<iexpensiveservice>(b => ... return pool ...); or even... catalogue.addinterceptor<iexpensiveservice>(b => new decorator(b())); (where 'b' underlying mef resolution func resolving service) not out of box, can write own exportprovider or composablepartcatalog implementation this. mefcontrib appears have implemented that, take @ interceptingcatalog . see (possibly outdated) blog post it.

php - doctrine storing the resultset? -

i'm new doctrine , i'm running problem. here is: i have following model/entity: <?php namespace models; /** @entity @table(name="teams") @haslifecyclecallbacks */ class team { ... /** @onetomany(targetentity="teammember", mappedby="team") */ private $members; ... function getteamsileadforgame($user, $game) { $q = $this->doctrine->em->createquery("select t, tm models\team t join t.members tm tm.user = ?1 , t.game = ?2 , tm.is_leader = ?3 order t.name asc"); $q->setparameter(1, $user); $q->setparameter(2, $game); $q->setparameter(3, 1); try { return $q->getresult(); } catch (\doctrine\orm\noresultexception $e) { return null; } } } as can see, there link teammember entity. in function wrote, i'm trying teams current user has is_leader flag set 1. this query executes fine , result expect be. now onto problem. further down in controller try following: ...