Posts

Showing posts from August, 2013

Set a jquery cookie on my fancybox onpage load -

this used load fancybox on page load. however, want appeared on new visitors or people visited page 3 days ago. i guess jquery cookie don't know how. jquery(document).ready(function() { $.fancybox( '<h2>hi!</h2><p>lorem ipsum dolor</p>', { 'autodimensions' : false, 'width' : 350, 'height' : 'auto', 'transitionin' : 'none', 'transitionout' : 'none' } ); }); in <head> add <script src="jquery.cookie.js"></script> , then: $(function() { if ($.cookie('mycookie')) { // hasn't been 3 days yet } else { $.fancybox( '<h2>hi!</h2><p>lorem ipsum dolor</p>', { 'autodimensions' : false, ...

Unable to register the DLL/OCX: RegSvr32 failed with exit code 0x5 -

i want install latest texniccenter on windows 7 professional (64-bit). everytime run installer admin rights message: "c:\windows\system32\msxml4.dll unable register dll/ocx: regsvr32 failed exit code 0x5. click retry try again, ignore proceed anyway (not recommended), or abort cancel installation." the file "c:\windows\system32\regsvr32.exe" existing , integrity check microsoft's sfc.exe successful. what can now? nice.

reporting services - Where is the SRC folder for .rdl files in SQL Server 2008 R2 -

this seems should easy have not been able find it. i have rdl files need add report services. don't want go through web interface , load reports 1 @ time. drop files source folder can't seem find it. running r2 without iis installed. there not source folder, publish report in ssrs have upload it, in turn means stored in sql server database (by default called reportserver, think end in table called catalog, last time saw not officially documented microsoft). the news don't have upload rdl files through web interface 1 one. may publish them in 1 single go report designer or report builder, or may write own deployment tool.

cocoa - What are your naming conventions for Objective-C "private" methods? -

inheriting code other developers has made me firm believer in keeping many messages possible out of class' public interface means of class extension. i'm firm believer in adopting special naming conventions private, implementation-specific members of class. being able tell @ glance messages being sent , members being referenced within implementation context not ever intended public use , vice versa. if nothing else, makes overall semantics of class easier me grasp more quickly, , that's worth it. justification aside, i've written boatloads of classes boatloads 2 of private methods, i've never come pattern naming love (like controversial ivar_ convention ivars). notable examples: @interface myclass() // this, know, apple has dibs on one, // , method name collisions nasty. - (void)_myprivatemessage; // suffix version promoted google ivars doesn't translate // method names in objective-c, because of way method // signature can broken several parts. - (v...

ruby on rails - Is there any reason to use a database connection pool with ActiveRecord? -

what benefits using external connection pool? i've heard other applications open connection each unit of work. in rails, example, i'd take mean each request open new connection. i'm assuming connection pool make possible. the benefit can think of allows have 1,000 frontend processes without having 1,000 postgres processes running. are there other benefits? rails has connection pooling built in : simply use activerecord::base.connection active record 2.1 , earlier (pre-connection-pooling). eventually, when you’re done connection(s) , wish returned pool, call activerecord::base.clear_active_connections!. default behavior active record when used in conjunction action pack’s request handling cycle. manually check out connection pool activerecord::base.connection_pool.checkout. responsible returning connection pool when finished calling activerecord::base.connection_pool.checkin(connection). use activerecord::base.connection_pool.with_connecti...

python - How to "hide" superclass methods in a subclass -

i want create subclass "hides" methods on superclass don't show in dir() or hasattr() call , users can't call them (at least not through of normal channels). least amount of "magic" possible. thanks. overriding __dir__ , __getattribute__ method respectively should trick. pretty canonical way kind of stuff in python. although whether should doing entirely different matter. see python docs on customizing attribute access use __dir__ list available attributes (this won't affect actual attribute access) class a(object): def __dir__(self): return [] >>> print dir(a()) [] use __getattribute__ control actual attribute access class a(object): def __getattribute__(self, attr): """prevent 'private' attribute access""" if attr.startswith('_'): raise attributeerror return object.__getattribute__(self, attr) >>> = a()...

Learning C++, What's next? Also what's a recommended compiler? -

i've been spending "inbetween" time @ office looking c++. i'm flash & web developer, working on bunch of flash games, thought time have @ non-web-based languages , see if real games going. i've got hang of how typing works, arrays, outputting using cout, structs, classes , on , on. i seem have found myself stuck in terms of can next. outputting dos window isn't exciting - how started on doing graphical? square moving around on screen, even. simple better in case. as compiler - i've been using devcpp bloodshed; adequate or missing more common compiler somehow? graphics can done using directx in windows, or opengl on every platform. it's whole different discussion upon choose. in addition trying work graphics, try hand @ developing guis. i'd give qt shot. warned though, qt being sold nokia, it's overall known , heavily used framework. or try direct win32 (not i'd suggest unless you're interested). or try winforms...

iOS xcode, Web services, NSURLConnection second call fails -

ipad development, ios 4.3, objective-c, xcode 4.1. i have created wrapper class, used call method on web service. works fine when make first call, fails on subsequent calls. a method in class, "runmethod::", opens nsurlconnection , call asynchronously, wrapper class nsurlconnection delegate. i have read somewhere there's fault android, keeps pool of connections. when try make connection second time fails because previous connection has been kept open, despite code closing it. hence, suspect problem connection remains in pool, , when try make 1 clashes? maybe xcode has similar issue? and symptoms of failure seemingly random 'bad access' on random line in 1 of delegate selectors, suggests has threading - understand http connections operate on own thread. i can provide full wrapper class if need be, ideas? a 'bad access' error indicates you're dereferencing invalid pointer. due improper memory management, such failing retain object....

javascript - When a marker lies behind open infobox - Event mouseover with InfoBox plugin Google Maps API v3 -

i'm having trouble v3 of google maps api , using infobox plugin respect usability issue use case: since map requires custom infobox opened upon hovering mouse on each respective marker, when map has 2 markers on close in proximity, when/if 1 of markers lies behind infobox open after hovering other close-by marker, triggered when mousing on marker (even though it's behind open infobox) , other infobox obstructs currently/previously opened infobox i've followed question , answer process poster here: google maps api v3 event mouseover infobox plugin , have followed recommended code, can't wrap mind around how prevent markers lie behind open infobox not triggered until infobox closed. var gpoints = []; function initializemap1() { var map1milelatlang = new google.maps.latlng(39.285900,-76.570000); var map1mileoptions = { maptypecontroloptions: { maptypeids: [ 'styled'] }, maptypecontrol: false, zoom: 14, ...

Java Polymorphism code "Cannot find Constructor` -

i'm trying explain java polymorphism self i've created project showing family superclass , subclasses are brothers sisters` the thing when compile receive error saying cannot find constructor sisters cannot find constructor brothers could explain me? thanks guys. class family { private string name,age; public family(string name,string age){ this.name = name; this.age = age; } public string tostring(){ return "name : " + name + "\tage " + age ; } } class brothers extends family{ public brothers(string name, string age){ super(name,age); } } class sisters extends family{ public sisters(string name, string age){ super(name,age); } } class familytest{ public static void main(string[] args){ family[] member= new family[3]; member[1] = new sisters("lala",22); member[2] = new brothers("mike",18); } } you have age definded string pass integer it. member[1] = new sisters("lala...

tomcat - request.getSession(false) causes java.lang.IllegalStateException -

when try session request, causes null pointer exception if session expired. given below part of code. exception on third line. public void dofilter(servletrequest req, servletresponse res,filterchain chain) throws ioexception, servletexception { httpservletrequest httpreq = (httpservletrequest) req; httpsession session = httpreq.getsession(false); and here stacktrace : java.lang.illegalstateexception: getlastaccessedtime: session invalidated @ org.apache.catalina.session.standardsession.getlastaccessedtime(standardsession.java:423) @ org.apache.catalina.session.standardsessionfacade.getlastaccessedtime(standardsessionfacade.java:84) @ com.myapp.admin.customercontext.valueunbound(customercontext.java:806) @ org.apache.catalina.session.standardsession.removeattributeinternal(standardsession.java:1686) @ org.apache.catalina.session.standardsession.expire(standardsession.java:801) @ org.apache.catalina.session.standardsession.isvalid(standardsession.java:576) @ org.apache.catali...

Detect Like with Facebook JavaScript API + iFrame -

building app facebook javascript api embedded page using new iframe method. i want detect if have liked current page. use print_r($_request) in php doesn't seem work when using iframe. there option: http://developers.facebook.com/docs/reference/fbml/visible-to-connection/ says deprecated , have never liked method hacky. what way t now? prefer use xfbml + javascript api can use php if required. we've done several times, , seems work pretty well. uses xfbml generate like button widget , js sdk render xfbml , subscribe facebook events . code sample below: edit: since you're looking detect if user fan when page loads, , fb deprecated feature let directly them when canvas loaded passing fb_page_id address query string, you'll need application install user test fan-dom of page. adds lot of friction application, - guess. <?php require 'facebook.php'; // create our application instance (replace appid , secret). $facebook = new facebo...

parallel processing - Vertical and Horizontal Parallelism -

recently working in parallel domain come know there 2 terms "vertical parallelism " , "horizontal parallelism". people says openmp ( shared memory parallelism ) vertical while mpi ( distributed memory parallelism ) horizontal parallelism. why these terms called ? not getting reason. terminology call them ? the terms don't seem used, perhaps because time process or system using both without distinction. these concepts generic, covering more realm of mpi or openmp. vertical parallelism faculty system employ several different devices @ same time. instance, programme may have thread doing heavy computation, while handling db queries, , third doing io. operating systems expose naturally faculty. horizontal parallelism occurs when single device used or operation executed on several similar items of data. sort of parallelism happen instance when running several threads on same piece of code, different data. in software world, interesting example map ...

c# - EF 4.1 Code First Mapping Problem -

all attempts map id of sitepage database column id (sitepages table, id column of type bigint) has failed. keeps looking column sitepage_id map it.. can see doing wrong? related code below; public class site : entitybase<int64> { public virtual string url { get; set; } public virtual ilist<sitepage> pages { get; set; } } public class sitepage : entitybase<int64> { public virtual site site { get; set; } public virtual string url { get; set; } public virtual string html { get; set; } public virtual string text { get; set; } public virtual string language { get; set; } } public abstract class entitybase<t> : icomparable { public virtual t id { get; set; } protected entitybase() : this(default(t)) { } protected entitybase(t id) { this.id = id; if (this.id == null) this.id = default(t); } } public class spellcrawlercontext : dbcontext { public spellcrawlercontext()...

How to correctly write xml document with spaces and new lines inside using CDATA? -

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <codecases> <case1> <codetext> <![cdata[ for(var i=0; i;10;i++) { var x; } ]]> </codetext> </case1> </codecases> this code i'm using, however, when open in browser, doesn't read new lines. doing wrong? with cdata, new lines preserved. issue in case isn't that. if @ source of generated html file (in firefox, via view -> page source or ctrl + u ) you'll see new lines preserved in text. i've tried cdata section myself (via xslt processing). what happened in case browser doesn't care raw new lines, , multiple white-space added in html files. to maintain formatting of text, need wrap content white-space css property set pre ie, html content like, <div style="white-space:pre;"> for(var i=0; i;10;i++) { var x; } </div> usual way of maintaining line brea...

How to check class equality in Python 2.5? -

i've looked through python 2.5 documentation , couldn't find answer this: how check if object same class object? def isclass(obj1, obj2): return obj1.class == obj2.class #doesn't work you can use type(obj1) type(obj2) note try avoid type checking in python, rather rely on duck typing .

input - How do I add a string value of an href using jquery? -

i have input button has href. need add string after last / in href input text box. how can accomplish using jquery? here code: //this search button $('#switch-fighter-search-button-link').attr("href","/fighters/search/"); //this input box var sft = $('$switch-fighter-text').val(); $('#switch-fighter-search-button-link').attr("href","/fighters/search/" + $('$switch-fighter-text').val());

Take existing project and move it into a Ruby on Rails environment -

i have front end of website built. made number of html, javascript, , jquery files. there way take files , move them ruby on rails environment don't need remake everything? sure. create new rails app ( rails new app-name ). copy existing javascript files rails project @ public/javascripts/ . views/html bit more dependent on how want grow. one option create single pagescontroller , not bother resources/models/etc, , put of "views" /app/views/pages/ . don't have rename them .html.erb conventionally see — you can leave them plain html. routes.rb file this: get '/:action', :controller => 'pages', :as => 'page' which afford routes "example.com/hello_world" route pagescontroller#hello_world, rendering "app/views/pages/hello_world.html". if want use erb, can add ".erb" suffix view file , can use page_path helper assemble links: <%= link_to 'hello world demo', page_path('hello...

Oracle: How can I tell what newline (or low-ascii chars) are in my text fields? -

i have data in varchar2 fields contains embedded newline chars (see this question ) however, seems data differs in way stores embedded newline chars - of data goes mid 90's, that's not surprising. how can see characters embedded in fields? i've tried both sqldeveloper , sql*plus. the easiest option select your_column_name, dump( your_column_name, 1013 ) your_table_name that show decimal value of each character stored in column. so, example sql> ed wrote file afiedt.buf 1 select ename, dump(ename, 1013) dmp 2* emp sql> / ename dmp ---------- ------------------------------------------------------- smith typ=1 len=5 characterset=al32utf8: 115,109,105,116,104 allen typ=1 len=5 characterset=al32utf8: 65,76,76,69,78 ward typ=1 len=4 characterset=al32utf8: 87,65,82,68 jones typ=1 len=5 characterset=al32utf8: 74,79,78,69,83 martin typ=1 len=6 characterset=al32utf8: 77,65,82,84,73,78 blake typ=1 len=5 chara...

iphone - Problem with UIPopOverController shrinking in width when navigationController pushes a new view(screenshots included) -

Image
ok have view call homeview. when button pushed on homeview, uipopovercontroller presented in following way: self.studypicker = [[[studypickercontroller alloc] initwithstudyarray:self.studyarray viewnum:butto.tag] autorelease]; uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:self.studypicker]; _studypicker.delegate = self; self.studypickerpopover = [[[uipopovercontroller alloc] initwithcontentviewcontroller:navcontroller] autorelease]; [self.studypickerpopover presentpopoverfromrect:cgrectmake(955,60, 22,10) inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; which works great. nice big popover controller displays tableview data way need it. fyi, in studypickercontroller viewdidload method, setting this: self.contentsizeforviewinpopover = cgsizemake(1000.0, 610.0); which allows me make size of tableview nice , big. the problem experiencing after select r...

php - Image Gallery -- select image which displays first -

i have photo gallery based on jquery scrip[t from: http://coffeescripter.com/code/ad-gallery/ . images stored in mysql database. have page list of galleries, displays first 5 images each gallery. clicking @ of image moves gallery , starts displaying first image. i in such way: if user clicks on second image, displaying should start second image, if user clicks on third image, displaying should start third image etc. here code, have far: /* galleries.php */ <?php $idg = $_get["idg"]; if (file_exists(gallery.'galleries.php') && $idg == '') { require_once(gallery.'list_galleries.php'); } else if (file_exists(gallery.'galleries.php') && $idg != '' ) { require_once(gallery.'view_gallery.php'); } ?> /* list_galleries.php */ <?php $sql_gal = "select id_g, nazwa page_gallery widok=1"; $res_...

php - Migrating a production site with no VCS at all to Git -

i thought throw out there , see if solid advice on this. i've got production site rather large code base , have installed git on it, same test site. , i've got local box point of integration. our team push local box , little gnomes come , take off our different servers - or @ least that's closest i've come implementing git. i don't have slightest clue begin. i've got big, finicky, legacy codebase scared touch on day. git meant starting point of big cleanup process, don't know how started. i thinking of creating bare .git repo based on production docroot (with applicable .gitignore stuff) , cloning on test , development environments, individuals clone off dev , work, pushing dev , somehow magically telling git update docroot when changes bare repo made. i going install git-flow on development (can't work on production server), , push production. since branches @ end of day, figured away not using git-flow on prod/test servers. this seems , ...

encoding - Why does jQuery get() strip out special characters from csv file? -

i'm trying bring in csv javascript munch on , spit out on html page. csv has special characters &half; , × . according firebug, when put breakpoint inside callback of $.get() , looks there special characters missing. replaced sort of whitespace displays question mark or box if copy , past program. i have tried $.ajaxsetup({ datatype: "text" , contenttype: "text/plain; charset=utf-8" }); and other variations. doctype of webpage utf-8. have tried 8859-1. nothing far has worked. edit: placing characters hand html either or using html entity codes works fine. placing them javascript works too. problem reading csv file. edit2: try this. create text file in Öç¼» . create webpage so... <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-ty...

ios - Xcode 4 - Using existing projects -

i have weird problem don't remember ever had in xcode 3. i have head project developing. want use project, when drag .xcodeproj file head project other project, copies .xcodeproj file, without nothing else (groups,source files, etc..). remember on xcode 3 asking if copy or reference new project. nothing. should differently on xcode 4 ? i tried play new workspace, still behaves same. it seems treating .xcodeproj resource image or other stuff. think you'l have open other project want work , drag in files manually. maybe there's better way, try doing :)

java - How do I get a managed bean inside an unmanaged object? -

i have logger bean gets injected everywhere want log this: @logger log log; following this blog. now want able use logger bean in unmanaged object. how make object aware there managed logger out there use? i've read somewhere using applicationcontext bad practice. maybe it's way? if so, best way this? this seems way go..? thanks! if can't make bean managed (by declaring in applicationcontext.xml ), yes, 1 of 2 ways. in web application use webapplicationcontextutils application context. another way use @configurable aspectj weaving, make unmanaged object - managed. prefer first option somehow.

css - webkit-transform problems in chrome 14 -

running 14.0.835.202 m (windows) animations using -webkit-transform doesn't work (for me) in chrome anymore. i did html5 projects earlier year, testing in chrome , safari. when check them now, lot of animations not work in chrome (which has been updated several times since). content disappears while animating , lot of animations not work @ all. i have tried simple scale, doesn't work ... http://nordjyske.it/chrome-bug/ (on browser, div disappears, , reappears halfway through animation. depending on other content on page, disappears throughout duration of animation...) using -webkit-transform-style: preserve-3d; on item or parents seems make things worse :( updated: tested using latest chrome canary build , here animation works. @ videos below: chrome 14: http://www.youtube.com/watch?v=rvhgcmaalhu it's hard issue, sounds gpu related (e.g. -webkit-transform-style: preserve-3d; makes things worse). should test pages out in latest version of ch...

xamarin.android - MonoDroid UI Library -

is there way build .dll library ui components include necessary resource files , linkable other monodroid projects? (except using .jar file , creating jniev proxies controls) there's no way in mono android. thing work creating ui code. if need inspiration, check out runner project on github repository: https://github.com/spiritmachine/nunitlite.monodroid it contains set of ui controls in separate library written in code. it's not ideal, can it.

c - Accessing struct array of unsigned ints -

i have struct has space unsigned ints: typedef struct { unsigned int *arr; } contents; when allocate memory: contents *allocator() { contents *cnt = malloc(sizeof(contents)); cnt->arr = calloc(1, sizeof(unsigned int)); } i later retrieve dereferencing passing in pointer contents , doing: void somefunction(contents *cnt) { unsigned int * arr = cnt->arr; arr[0] >>= 1; // in future 0 replaced loop on array items cnt->arr = arr; } once exit out of function, cnt->arr becomes empty. have memcpy? not understanding how struct laid out? understand cnt->arr = (*cnt).arr thanks! the problem you're doing unsigned int *arr = cnt->arr , declares unsigned int pointer , makes point cnt->arr. once modify array, attempt re-set array - re-assigning pointers, haven't changed contents of array; you've changed pointers . thus, cnt->arr = arr line doesn't change anything. then, "unsigned int *arr" run...

PHP: How to get shockwave .dcr file width and the height? -

as know function getimagesize() works images , swf files. but doesn't support shockwave file (.dcr). so, how can width , height of such file.. i not lingo/director expert, afaik won't able php. .dcr file format not open won't find file format specification make own parser , extract info on own. however, there should way using director movie on client side. eg. load external dcr file inside own director movie (then able read width/height etc of loaded file). own director movie updates database info on specific loaded file can show width/height later on. i've found artice dating 2006 guy suggests same thing: http://director-online.com/forums/read.php?1,20621,20621,quote=1 good luck mate! :)

Android Webview href not working -

i using following code in webview along jquery mobile, works fine in emulator (2.2 ) , on nexus 1 users complaining when click on link error message "problem file: requested file not found". 1 user reported using samsung fascinate "2.2.1" . seems have started when upgraded jquery mobile 1.0b2 , have tried latest 1.0rc still have same issue any insights on might happening ? in activity engine.loadurl("file:///android_asset/book2/www/newindex.html"); in html ( have tried data-ajax="false" ) <link rel="stylesheet" href="jquery/jquery.mobile-1.0rc1.min.css" /> <script type="text/javascript" src="jquery/jquery.mobile-1.0rc1.min.js"></script> <div data-role="page" id="jqm-home"> <div data-role="content" data-theme="e"> <div class="content-primary"> <nav> ...

java - Which one is best IDE of NetBeans to develope a j2me application? -

i new in j2me. had installed netbeans 7.0.1 j2ee , j2se. there ide of netbeans contains complete package of j2me(including both cldc & cdc). i have answered on previous question. netbeans contains java me bundle(cldc , cdc). more info on article, how create midlet application netbeans.

ruby on rails - Setting up a Has_Many :through Association -

on application i'm working on, i'm stuck on setting associations between 3 models ensure referential integrity. have event model, building model, , room model. association in real life pretty intuitive. event can in 1 building , 1 room. building can have multiple rooms. here's have set now. however, how can events specify room if belong buildings, , foreign key room in events table? use has_many :through relationship? practice store both building , room foreign keys in event table, rooms owned buildings? conditional relationship requires building specified before allowing room specified (some buildings have 2 rooms, others have 20, example) sorry i'm unclear on this. in advance help! class event < activerecord::base belongs_to :building end class building < activerecord::base has_many :events has_many :rooms end class room < activerecord::base belongs_to :building end i think best way handle follow...

java - Capture screen with mouse pointer using xuggler -

following code capture screen , make video using xuggler , working fine, generated video not have mouse cursor in it. want capture mouse pointer show mouse activity. can 1 guide me on this. package com.test.video; import java.awt.awtexception; import java.awt.dimension; import java.awt.graphics2d; import java.awt.image; import java.awt.mouseinfo; import java.awt.rectangle; import java.awt.robot; import java.awt.toolkit; import java.awt.image.bufferedimage; import java.io.ioexception; import java.util.concurrent.timeunit; import javax.imageio.imageio; import com.xuggle.mediatool.imediawriter; import com.xuggle.mediatool.toolfactory; import com.xuggle.xuggler.icodec; public class screenrecordingexample { private static final double frame_rate = 5; private static final int seconds_to_run_for = 120; private static final string outputfilename = "c:/mydesktop.mp4"; private static dimension screenbounds; private static graphics2d imagegraphics; ...

extjs - Wrap a database stored image inside an Ext.Img component -

so have images stored in database. kept blobs, not path physical location. can access them via: http://example.com/data/pagemedia?id=%someid% . but when want wrap image in ext.img: ext.create('ext.img', { src: 'http://example.com/data/pagemedia?id=' + someid, renderto: ext.getbody() }); it doesn't render image. it works fine pure html, though: <img src="http://example.com/data/pagemedia?id=%someid%"/> should use ajax request or else , set src dynamically? here working example: ext.create('ext.img',{ src : 'gallery/getimage/' + imageid, renderto: 'cat-img' // in case ext.getbody() }); notice how create image url. if someid js variable , not hardcoded, have write: ext.create('ext.img',{ src : 'http://mysite.com/data/pagemedia?id='+someid, renderto: ext.getbody() });

java - Initialize paypal only once -

i have designed paypal functionality in project this: public class mypaypalactivity extends activity implements onclicklistener{ /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linearlayout mlinlay= new linearlayout(this); setcontentview(r.layout.main); paypal pp = paypal.initwithappid(this, "app- 80w284485p519543t",paypal.env_sandbox); linearlayout layoutsimplepayment = new linearlayout(this); layoutsimplepayment.setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); layoutsimplepayment.setorientation(linearlayout.vertical); checkoutbutton launchsimplepayment = pp.getcheckoutbutton(this, paypal.button_118x24, checkoutbutton.text_pay); launchsimplepayment.setonclicklistener( this); layoutsimplepayment.addview(lau...

autocmd - How to make vim move cursor a character to theright on insertleave? -

since mac os x's terminal.app not support many of vim visual aspects, including cursor change block line when switching insert mode, use osascript accopmlisch similar. in .vimrc file i've written: autocmd insertenter * silent !osascript -e 'tell application "terminal" set current settings of first window settings set 11`j autocmd insertleave * silent !osascript -e 'tell application "terminal" set current settings of first window settings set 12`j where settings set 11 set of terminal setting has line cursor , settings set 12 1 has block cursor. this works quite there 1 small problem.. on insertleave cursor gets moved 1 character left, isn't such big deal can anoying. i tried compensate putting autocmd insertleave h .vimrc , no avail (it gives me error). how should tell vim to: not shift left? if above isn't possible, compensate shifting right before answering question, i'd recommend have in macvim (if ...

c# - Get form source file at runtime from external process in .NET -

Image
i working in large solution (120+ projects). often, need find particular form in large desktop application, consisting of hundreds of forms. for example, might have requirement edit controls on form. we don't know form name, know how navigate form when running application. in order identify form, try find unique text on form, , search source files string. that's not cool. instead, i'd make little tool can identify source file form, or @ least name property of form object. we can't add code solution itself, have make external exe. i not sure if possible. thinking might possible through reflection, i'm no expert on matter. if have ideas how solve problem, great. thanks. i used managed spy this. displays treeview of controls in .net-based client application.when select control, propertygrid shows properties on control.

android - How to trigger a broadcast event manually -

everyone question how creating widget in application. know how add our widgets customizing appwidgetprovider. , adding action follows: system menu -> widget -> widget item(our widget name) however, want gain same effects clicking 1 button, e.g. 'add widget', in application. first thought coming brain trigger broadcast event of adding widget in handler function of 'add widget' button. don't how trigger broadcast event manually. guys, ideas appreciated. wishes jhfu this not supported android, sorry. to more specific, applications not home screens cannot add app widgets home screens.

testing - About use Stubs - Java -

i'm readin http://xunitpatterns.com/test%20stub.html , have questions use of stubs, example, in code shown on page author creates class called timeproviderteststub.java use in test code. have doubts line in test code: timedisplay sut = new timedisplay(); // test double installation sut.settimeprovider(tpstub); do need modify class(sut) recieve 1 object timeprovidertestsub? both stub , real class supposed implement interface, i.e. itimeprovider , , settimeprovider() should take interface parameter. interface must expose methods sut needs interact object, since timedisplay can use object through itimeprovider interface (which allows use stub instead of real object in our tests). in example, sut ( timedisplay ) seems need gettime() method, interface should contain method: public interface itimeprovider { calendar gettime(); } the declaration of stub should be public class timeproviderteststub implements itimeprovider { ... } and declarati...

Add blacklist to facebook fb:comment plugin without relating to a app_id -

i want add blacklist fb:comment plugin, have on website, facebook docs show me how add blacklist app using moderation dashboard . i not have app_id, using plugin this not apply using plugin. code: <script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script> <fb:comments href="example.com" num_posts="2" width="500"></fb:comments> i have meta-tag: <meta property="fb:admins" content="1234567..ect"> i know how add blacklist when having app, when using plugin how can add blacklist, can like <fb:comments blacklist="porn"... </fb:comments> ?? thank help. best regards! this can not done, must associate app_id if want use blacklist

silverlight - is "System.Windows.Browser" not supported in xbox lakeview adk? -

i'm trying port existing silverlight project xbox lakeview. i got compilation error saying "system.windows.browser" not supported in adk , in microsoft.xbox360.adk.targets "system.windows.browser.dll" listed unsupported assemblies. i'm using apis such "system.windows.browser.htmlpage" , "system.windows.browser.httputility". how can work around it? i'm not sure if you've gotten figured out or not, version of adk don't believe supports namespace. if send me yours, i'd more happy lend hand in figuring out what's causing issue.

python - Delete an item from a dictionary -

is there way delete item dictionary in python? i know can call .pop on dictionary, returns item removed. i'm looking returns dictionary minus element in question. at present have helper function accepts dictionary in question parameter, , returns dictionary item removed, there more elegant solution? the del statement removes element: del d[key] however, mutates existing dictionary contents of dictionary changes else has reference same instance. return new dictionary, make copy of dictionary: def removekey(d, key): r = dict(d) del r[key] return r the dict() constructor makes shallow copy . make deep copy, see copy module .

regex - JavaScript regular expression with capturing parentheses -

i have paragraph: <p>first second third</p> and want wrap second word in span so: <p>first <span>second</span> third</p> if this: text.replace(/\s(\w+)\s/, '<span>$1</span>'); the space characters before , after word disappear. why? doing wrong? thought /\s(\w+)\s/ captures word not spaces. see here: http://jsfiddle.net/simevidas/tptzv/ the spaces stripped away because they're part of entire match. capture remembers substitute replacement string via backreferences. if javascript supported both lookahead , lookbehind assertions this: text.replace(/(?<\s)(\w+)(?=\s)/, '<span>$1</span>'); but doesn't, can try capturing spaces (separately word you're wrapping) , putting them in instead: text.replace(/(\s)(\w+)(\s)/, '$1<span>$2</span>$3');

jquery - resetting bxSlider -

i took different direction carousel implemented, opting bxslider instead of jcarousel. image gallery building http://rjwcollective.com/equinox/rishi_gallery/eqgall.php the issue running when reset filters, or select different filter, slider doesn't reset. code inital load: //first load $.ajax({ type:"post", url:"sortbystate.php", data:"city=&gender=&category=", success:function(data){ //carousel $('#thumbs').html(data); //alert("whoa, careful there!"); $('#thumbs').bxslider({auto: false, mode:'vertical', autocontrols: false, autohover: true, pager: false, displayslideqty: 4, speed:800, infiniteloop: true, moveslideqty: 4, ...

ruby - Conditional tests in Rspec? -

is there way group tests conditionally rspec? mean, there way "if variable value, run set of tests. if variable other variable, run other set of tests"? basic example of needed (doesn't work, obviously, should show want). assume user tested defined elsewhere , current user being tested @user. although may have better alternatives that, that's fine. before login_as_user(@user) #this logs them in , brings them homepage tested page.visit("/homepage") end describe "check user homepage" subject {page} {should have_content("welcome, #{@user.name}!")} if(@user.role=="admin") {should have_link("list users"} end end keep in mind have no control on user being tested - cannot create users on fly, example, , no given user guaranteed exist, , don't know offhand combination of roles given user have. need way "run test if these conditions met", rather way create situations every test can run. ...

javascript - Facebook display: 'page' not working with FB.ui and popups are blocked by the browser -

i know iframes not allowed facebook unauthorized applications can't display: 'page' work fb.ui either. display mode working popup. both login , fb.ui dialogs being blocked popup blocker though working on every other website facebook login. popup blocker kicks in when fb.login , fb.ui functions called user click. really, annoying. please me out. <html> <head> </head> <body> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_us/all.js"> </script> <script> function xyz() { fb.init({ appid:'113381182103752', cookie:true, status:true, xfbml:true, oauth:true }); fb.getloginstatus(function(response) { if(response.status=="connected") { document.getelementbyid("status").innerhtml="user connected"; } else if(response.status=="unknown") { fb.login(function(response) { if(response.authresponse) { var token = response.authresponse.acc...

google app engine - Getting an authoritative user id / email in GAE federated login -

when performing authentication using openid federated login on gae, user object has following properties: nickname: http://wordfaire.com/openid?id=103539105724544727060 email: sudhir.j@wordfaire.com from docs, email() returns email address of user. if use openid, should not rely on email address correct. applications should use nickname displayable names. obviously, advice isn't working out well. how can authoritative email handle associate particular openid provided google apps or other domain? need email id because things invitations , sharing / access control function via email ids. if need valid email openid users, ask user supply 1 first time log in, , store along user object. since can create openid provider, it's not safe assume provider has gathered valid address.

java - Apache ActiveMQ configuration -

i'm working on project in need produce messages node.js , consume them using java class. problem node.js uses stomp client pub/sub message queue. , stomp uses own protocol instead of using tcp. on other hand, java client uses tcp it. can set 2 transportconnectors 1 broker? example: <transportconnectors> <transportconnector name="stomp" uri="stomp://localhost:61613"/> </transportconnectors> <transportconnectors> <transportconnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportconnectors> you can add 2 transport connector instances, so: <transportconnectors> <transportconnector name="stomp" uri="stomp://localhost:61613"/> <transportconnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportconnectors> stomp using tcp/ip openwire fyi.

android - GridView with images from DataBase -

i have images in db , put gridview code: public void setnotes() { string[] columns = {notesdbadapt.key_id, notesdbadapt.key_img, notesdbadapt.key_name, notesdbadapt.key_date, notesdbadapt.key_time}; string table = notesdbadapt.notes_table; cursor c = mainnote.mdb.gethandle().query(table, columns, null, null, null, null, null); startmanagingcursor(c); simplecursoradapter adapter = new simplecursoradapter(this, r.layout.file_dialog_row, c, new string[] {notesdbadapt.key_img, notesdbadapt.key_name, notesdbadapt.key_date, notesdbadapt.key_time}, new int[] {r.id.img, r.id.txt, r.id.date, r.id.time}); adapter.setviewbinder(new notesbinder()); gridview.setadapter(adapter); } all ok, but scrolling slow, jerky. seems information takes db every time. how fix it? this method deprecated in api level 11. use new cursorloader class loadermanager instea...

iphone - How to make a 'Pro' version of an Xcode project -

i have made app , i'm planning make 'pro' version of it, want copy xcode project , rename it. i wondering easiest way go doing this. there lot of different references name throughout project , don't want spend ages searching through, updating them all. please can suggest easiest steps take in order copy 'app basic' 'app pro'? or there better/preferred method create 'pro' version of app subtle differences? thanks in advance! the best way create second target in same xcode project. can define 2 preprocessor macros (e.g.: app_version_lite & app_version_pro ) , compile time switching using #ifdef app_version_pro etc. in app delegate can define string application name //.pch extern nssting * const myappname //appdelegate.m #ifdef app_version_pro nssting * const myappname = @"app pro"; #else nssting * const myappname = @"app lite"; #endif you can include files (including resources , classes) in 1 of 2...

scala - Type parameter does not extend given type -

i define generic such type parameter not extend given type. for example, trait mytrait[t <: throwable] { // .... } would define trait type parameter extends throwable. want (not real scala code): trait mytrait[t not(<:) throwable] { // .... } where type type parameter not extend throwable. there way construct such notion in scala? you can such thing using implicits. here's trick miles sabin on scala-language: // encoding "a not subtype of b" trait <:!<[a, b] // uses ambiguity rule out cases we're trying exclude implicit def nsub[a, b] : <:!< b = null implicit def nsubambig1[a, b >: a] : <:!< b = null implicit def nsubambig2[a, b >: a] : <:!< b = null // type alias context bound type not[t] = { type lambda[u] = u <:!< t } // foo not accept t of type unit def foo[t : not[unit]#lambda](t : t) = t

reporting services - SSRS 2005 Charts: Customize line colors using expression? -

is there way change color of specific line items in ssrs chart? example, in data tab using expression within series group or values area, or perhaps variable? i'm not terribly keen on color palette in current chart, wanting areas stick out bit more , not sure how started. thanks. we ensure different departments coloured consistently across reports. in our database have colour field on our department table, in bar graphs following: right click chart body , choose properties click data tab in values section, click edit button click on appearance tab click series style button click fill tab in color text box, put expression want colour be. given have in our department database already, use: =fields!deptcolour.value and our departments coloured same on every bar graph. for line graphs, have same except time put colour expression in color text box on border , line tab on series style dialogue (rather in fill).

php foreach, why using pass by reference of a array is fast? -

below test of php foreach loop of big array, thought if $v don't change, real copy not happen because of copy on write , why fast when pass reference? code 1: function test1($a){ $c = 0; foreach($a $v){ if($v=='xxxxx') ++$c; } } function test2(&$a){ $c = 0; foreach($a $v){ if($v=='xxxxx') ++$c; } } $x = array_fill(0, 100000, 'xxxxx'); $begin = microtime(true); test1($x); $end1 = microtime(true); test2($x); $end2 = microtime(true); echo $end1 - $begin . "\n"; //0.03320002555847 echo $end2 - $end1; //0.02147388458252 but time, using pass reference slow. code 2: function test1($a){ $cnt = count($a); $c = 0; for($i=0; $i<$cnt; ++$i) if($a[$i]=='xxxxx') ++$c; } function test2(&$a){ $cnt = count($a); $c = 0; for($i=0; $i<$cnt; ++$i) if($a[$i]=='xxxxx') ++$c; } $x = array_fill(0, 100000, 'xxxxx'); $begin = microtime(true); test1($x); $end1 = microtime(true); test...

location - android method (distance between()) -

enter code here package tryanabtry.opa; import java.util.list; import android.content.context; import android.graphics.drawable.drawable; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.util.log; import android.widget.toast; import com.google.android.maps.geopoint; import com.google.android.maps.mapactivity; import com.google.android.maps.mapcontroller; import com.google.android.maps.mapview; import com.google.android.maps.overlay; import com.google.android.maps.overlayitem; public class tryanabtry extends mapactivity{ private mapview mapview; private mapcontroller mc; geopoint p, p2, p3, p4; list<overlay> mapoverlays; drawable drawable, drawable2 , drawable3, drawable4; helloitemizedoverlay itemizedoverlay, itemizedoverlay2 , itemizedoverlay3, itemizedoverlay4; /** called when activity first created. */ @override public void oncreat...