Posts

Showing posts from September, 2010

PyDev's inteactive shell with Django problem -

i'm going through django tutorial , using pydev eclipse plugin development. for interactive testing use "interactive shell django" accessed right click on pydev project -> django -> shell django environment. and here problem encountered ("lemonanas" project name, "polls" app name): >>from lemonanas.polls.models import poll, choice >>poll.objects.filter(id=1) traceback (most recent call last): file "<console>", line 1, in <module> file "f:\python27\lib\site-packages\django\db\models\manager.py", line 141, in filter return self.get_query_set().filter(*args, **kwargs) file "f:\python27\lib\site-packages\django\db\models\query.py", line 561, in filter return self._filter_or_exclude(false, *args, **kwargs) file "f:\python27\lib\site-packages\django\db\models\query.py", line 579, in _filter_or_exclude clone.query.add_q(q(*args, **kwargs)) file "f:\pytho...

c# - Why does casting the same two numbers to Object make them not equal? -

i have following code snippet getting wrong output. class program { static void main(string[] args) { var = 10000; var j = 10000; console.writeline((object) == (object) j); } } i expecting true getting false you boxing numbers (via object cast) creates new instance each variable. == operator objects based on object identity (also known reference equality) , seeing false (since instances not same) to correctly compare these objects use object.equals(i, j) or i.equals(j) . work because actual runtime instance of object int32 equals() method has correct equality semantics integers.

Rails 3 Devise problem -

i've got strange problem project. have rails 3 , devise , running, i've added custom route: match '/users', :to => 'users#index', :as => "all_users", :via => "get" my rake routes returns this: marat@rails:~/projects/test$ rake routes | grep users new_user_session /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"} user_session post /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"} destroy_user_session /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"} user_password post /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"} new_user_password /users/password/new(.:format) ...

internals - Where does Git store the SHA1 of the commit for a submodule? -

i know when add submodule git repository tracks particular commit of submodule referenced sha1. i'm trying find sha1 value stored. the .gitmodules , .git/config files show paths submodule, not sha1 of commit. the git-submodule(1) reference speaks of gitlink entry , gitmodules(5) reference doesn't either. it stored in git's object database directly. tree object directory submodule lives have entry submodule's commit (this so-called "gitlink"). try doing git ls-tree master <path-to-directory-containing-submodule> (or git ls-tree master if submodule lives in top-level directory).

java - Another question, this time regarding breaking a string down for validity -

thanks bunch tip on static of folks answered! feeling little less frustrated now. i not going ask questions step step through whole assignment, want make sure way go 1 of next tasks. have written following, compiles fine (the purpose check string make sure numeric, , user may have entered isbn number or without dashes): private string validateisbn(string booknum) { string[] book; int j=0; ( int i=0;i<booknum.length();i++) if (character.isdigit(booknum.charat[i])) booknum.charat[i]=book[j];j++; i haven't written next part, has allow x last digit in string (which apparently how isbn numbers work). assume if above correct (or close), need check ninth character digit or x, writing like: if book[9] isdigit() || if book[9] == "x" || if book[9] == "x"; is right (isbn numbers 10 numbers or 9 numbers , x @ end)? the last digit of isbn-10 check digit. since method supposed check if entered isbn c...

c# - Add multiple controls to panel in webforms -

i able add multiple label controls panel , display them on onlick event. code have want first time, label simple replaced new label on second onlick event , on. here have far: private void createtasklabel(guid goalid, string goal) { label tasklabel = new label(); tasklabel.id = goalid.tostring(); tasklabel.text = goal.tostring(); taskpanel.controls.add(tasklabel); } so, instance, creates new label uniqueid (handled elsewhere) , places within panel , displays it. when onlick fires again, same label replaced instead of new 1 appearing below it. dynamically created controls not persisted after postback. need keep track of how many controls have generated , regenerate of them each time work how want. basic implementation: list<string> labeidlist = new list<string>(); override saveviewstate(..) { if (labelidlist.count>0) { viewstate["labeldilist"]=labelidlist; } base.saveviewstate(..) } override loadvie...

java - Is there a simple way to match a field using Hamcrest? -

i want test whether specific field of object matches value specify. in case, it's bucket name inside s3bucket object. far can tell, need write custom matcher this: mockery.checking(new expectations() {{ one(query.s3).getobject(with( new basematcher<s3bucket>() { @override public boolean matches(object item) { if (item instanceof s3bucket) { return ((s3bucket)item).getname().equals("bucket"); } else { return false; } } @override public void describeto(description description) { description.appendtext("bucket name isn't \"bucket\""); } }), with(equal("key"))); ... }}); it nice if there simpler way this, like: mockery.checking(new expectations() {{ one(query.s3).getobject( with(equal(methodof(s3bucket.class).getname(), "bucket")), with(equal("key"))); ... }}); ...

python - What is a general process/concept to determine what to add to PYTHONPATH to resolve import issues? -

i keep running problems unresolved imports in django project (in eclipse w/ pydev). after googling while on given issue can find right thing add pythonpath solve problem. seems i'm missing concept or process can definitively "obviously there should add thing import properly". makes more frustrating i'm following basic django tutorial, i'd expect these things dealt with. in java world pretty clear because can find out library particular package coming from, download , add build path. equivalent concept in python/django world? i not looking solve specific problem here, rather know steps follow, or up, or concept missing. or possibly find out there not 1 , guesswork... i running on ubuntu 10.10, python 2.6 from question assume quite new python, let's start @ beginning. my advice @ traceback django generates , search line looks this: "importerror: no module named somemodule". tells name of missing module. once know name of modu...

algorithm - Eliminating symmetry from graphs -

Image
i have algorithmic problem in have derived transfer matrix between lot of states. next step exponentiate it, large, need reductions on it. contains lot of symmetry. below examples on how many nodes can eliminated simple observations. my question whether there algorithm efficiently eliminate symmetry in digraphs, way i've done manually below. in cases initial vector has same value nodes. in first example see b , c , d , e receive values a , 1 of each other. hence contain identical value, , can merge them. in example spot, graph identical point of view of a , b , c , d . respective sidenodes, doesn't matter inner node attached. hence can reduce graph down 2 states. update: people reasonable enough not quite sure meant "state transfer matrix". idea here is, can split combinatorial problem number of state types each n in recurrence. matrix tell how n-1 n . usually interested value of 1 of states, need calculate others well, can next leve...

comparison - Comparing chars in Java -

it's been while since i've done java syntax not greatest @ moment. i want check char variable 1 of 21 specific chars, shortest way can this? for example: if(symbol == ('a'|'b'|'c')){} doesn't seem working. need write like: if(symbol == 'a' || symbol == 'b' etc.) if input character , characters checking against consecutive try this: if ((symbol >= 'a' && symbol <= 'z') || symbol == '?') { // ... } however if input string more compact approach (but slower) use regular expression character class: if (symbol.matches("[a-z?]")) { // ... } if have character you'll first need convert string before can use regular expression: if (character.tostring(symbol).matches("[a-z?]")) { // ... }

Dynamic string parsing in Powershell -

i'm trying unusual powershell parsing. basically, have literal string contains name of variable. tell powershell "hey, i've got string (may) contain 1 or more variable names--dynamically parse it, replacing variable names values" here's textbook way understand parsing works: ps c:\> $foo = "rock on" ps c:\> $bar = "$foo" ps c:\> $bar rock on and if change value $foo: ps c:\> $foo = "rock off" ps c:\> $bar rock on no surprises here. value of $bar parsed assigned, , didn't change because value of $foo changed. ok, if assign $bar single quote? ps c:\> $foo = "rock on" ps c:\> $bar = '$foo' ps c:\> $bar $foo that's great, there way powershell parse on demand? example: ps c:\> $foo = "rock on" ps c:\> $bar = '$foo' ps c:\> $bar $foo ps c:\> some-parsefunction $bar rock on ps c:\> $foo = "rock off" ps c:\> some-parsefunc...

uinavigationcontroller - iPhone In-Call Status Bar not resizing 'More' View -

when toggle in-call status bar morenavigationcontroller displayed in uitabbarcontroller, morenavigationcontroller not resize other views. is can change in code or bug in sdk? i'm using ios 4.2 sdk. under normal circumstances, in-call status bar cannot appear while app running. fact can in simulator artificial.

php - how to design custom template in socialengine4 framework? -

Image
as new socialengine4 having trouble in designing custom template. want convert html/css template socialengine4 module. example: suppose template , want design socialengine4. how can create custom layout above template ? how can create custom common page elements header, footer ? what directory structure file structure above 2 points. note: need create manually not layouts provided default in admin panel. under article creating own theme , socialengine documentation provides necessary details create own theme scratch.

c# - "Items collection cannot be modified when the DataSource property is set." -

having issue program adds files through form txt file issue doesn't fstream i'm thinking doesn't have deal i'm not sure problem means. lstemployees.items.add("no records found."); the error message tells have set "datasource property" on "lstemployees". go "lstemployees" properties , remove datasource - or if want keep datasource, don´t try add "your own" items "lstemployees", won´t accepted.

parsing - Counting total sum of each value in one column w.r.t another in Perl -

i have tab delimited data multiple columns. i have os names in column 31 , data bytes in columns 6 , 7. want count total volume of each unique os. so, did in perl this: #!/usr/bin/perl use warnings; @hhfilelist = glob "*.txt"; %count = (); $f (@hhfilelist) { open f, $f || die "cannot open $f: $!"; while (<f>) { chomp; @line = split /\t/; # counting volumes in col 6 , 7 31 $count{$line[30]} = $line[5] + $line[6]; } close (f); } $w = 0; foreach $w (sort keys %count) { print "$w\t$count{$w}\n"; } so, result like windows 100000 linux 5000 mac osx 15000 android 2000 but there seems error in code because resulting values aren't expected. what doing wrong? it seems you're not adding counts - overwrite last count os count last line os. $count{$line[30]} = $line[5] + $line[6]; should be $count{$line[30]} += $line[5] + $line[6]; as additi...

Anyone submitted or know of an application in the Mac App Store that uses launchd? -

just wondering if has sucessfully submitted app or know of app exists in mac app store uses launchd. thanks. is there any way ask apple, directly , stuff this? submitting dummy app - in off chance rejected - ain't way know if launchd or not permitted in app-store. (apple) have rejected app being useless or lame, lol! official guidelines so not comprehensive , in terms of technical limitations - , cant life of me find official channel speak app store "people". after hyping launchd like crack past 5 years, obnoxious if apple indeed has blanket policy against apps make use of functionality... launchd, freaky is... pretty damn good, , imo, requirement every piece of software "does" useful. humph. follow up.. although not answer specific question, it shines light on subject ... "it launchd responsible capturing exit status of mas apps, , why store_helper , storeagent launched when use ‘open foo.app’, not when calling binary ...

how to auto-ident in Textmate similar to Emacs -

how auto-indent in textmate similar effect of code under emacs: (defun set-newline-and-indent () (local-set-key (kbd "ret") 'newline-and-indent)) (add-hook 'c-mode 'set-newline-and-indent) i.e. don't want hit return, tab indent. want hit return , have textmate automatically indent correct location based on language. thanks hints. textmate should automatically. if if doesn't, can create custom macro, command, or snippet in bundle editor you. first find out scope of caret position ( bundles -> bundle development -> show scope ). should source.ruby string.quoted.double.ruby . then create snippet contains newline , tab. then assign snippet mentioned scope , assign shortcut. if done correctly, shortcut should trigger bundle item in assigned scope instead of inserting new line. look inside bundle editor @ css -> properties {}(}) bundle item example.

html - jQuery toggle problem: animates twice -

i have me mystic problem jquery "toggle" method. click once, animates twice. go see yourself! demo page source pasted below, (link disappear when have solved this). html: <ul class="topnav"> <li><a>about us</a></li> <li><a href="javascript:void(0)" class="sublink">store</a></li> <li class="subnav"><a href="javascript:void(0)">hours</a></li> <li class="subnav"><a href="javascript:void(0)">products</a></li> <li><a href="javascript:void(0)">@the moment!</a></li> <li><a href="javascript:void(0)">contact</a></li> </ul> css a{ text-decoration: none; color: black; } a:hover{ color: #cede43; } ul.topnav{ list-style: none; margin: 0; padding: 20px; float: left...

android - The relationship between Phonegap's "onBodyLoad()/onDeviceReady()" functions and Jquery's "$(document).ready()" -

i using phonegap + jquery mobile in android, confused phonegap's "onbodyload()/ondeviceready()" functions , jquery's "$(document).ready()". in phonegap documents: phonegap consists of 2 code bases: native , javascript. while native code loading, custom loading image displayed. however, javascript loaded once dom loads. means web application could, potentially, call phonegap javascript function before loaded. the phonegap deviceready event fires once phonegap has loaded. after device has fired, can safely make calls phonegap function. typically, want attach event listener document.addeventlistener once html document's dom has loaded. in jquery doc: while javascript provides load event executing code when page rendered, event not triggered until assets such images have been received. in cases, script can run dom hierarchy has been constructed. handler passed .ready() guaranteed e...

How to get source package with aptitude on linux? -

i can source packages using apt-get source , there way using aptitude ? downloaded .deb package python2.6 using aptitude , unzipped using ar. aptitude download python2.6 ar xv python2.6_2.6.5-1ubuntu6_i386.deb i downloaded python source using apt-get sudo apt-get source python2.6 the contents of both downloads different. why ? aptitude download python2.6 retrieves binary package python2.6 . apt-get source python2.6 retrieves source package generates binary package python2.6 . source downloads include original source tarball, debian diff , signed certificate file.

richtextbox - C# writing a code editor issues -

so i'm writing simple code editor language like. have syntax hilighting going well. problem if go before text have written, screws whole hilighting past pointer. here code, apologies posting much: public partial class form1 : form { public string mainfontname = "courier new"; public int mainfontsize = 12; public color mainfontcolor = color.black; [dllimport("user32.dll")] // import lockwindow remove flashing public static extern bool lockwindowupdate(intptr hwndlock); public regex codefunctions = new regex("draw_line|draw_rectangle|draw_circle"); public regex codekeywords = new regex("and|for|while|repeat|or|xor|exit|break|case|switch|if|then|with|true|false"); public form1() { initializecomponent(); codeinput.font = new font(mainfontname, mainfontsize, fontstyle.regular); } private void codeinput_textchanged(object sender, eventargs e) { codeinput.font = new ...

class - Java Question, From a C++ Programmer -

i'm learning java, , i'm on packages hump, things going smoothly. can draw similarities between things i'm learning things know @ least concept of. on earth going on following bit of code? form of constructor, or anonymous object? something obj = new something() { private static final int num = 3; public void meth() { // w/e } }; /** * notice there's 1 thing in isn't defined: * still needs public abstract void triggerevent(); */ public abstract static class topbutton extends jpanel implements mouselistener { protected buttonpanel parent; private string text; public topbutton(buttonpanel bp, string text) { parent = bp; this.text = text; addmouselistener(this); } public void mouseclicked(mouseevent e) { triggerevent(); } public void mouseentered(mouseevent e) { } public void mouseexited(mouseevent e) { } public void mousepressed(mouseevent e) { } public void mousereleased(mo...

c - Implementing pipelining in a Linux shell -

i'm trying develop shell in linux operating systems project. 1 of requirements support pipelining (where calling ls -l|less passes output of first command second). i'm trying use c pipe() , dup2() commands redirection doesn't seem happening (less complains didn't receive filename). can identify i'm going wrong/how might go fixing that? edit: i'm thinking need use either freopen or fdopen somewhere since i'm not using read() or write()... correct? (i've heard others who've done project using freopen() way solve problem; if think better, tips going direction appreciated.) here's execute_external() function, executes commands not built-in shell. various commands in pipe (e.g. [ls -l] , [less]) stored in commands[] array. void execute_external() { int numcommands = 1; char **commands; commands = malloc(sizeof(char *)); if(strstr(raw_command, "|") != null) { numcommands = separate_pip...

I need to create a PDF file on the client side using GWT. How do I do that? -

this based on can tell me possible generate pdf files using javascript? me, pdf and/or xls. also can create single txt file using gwt because know javascript doesn't have rights client-side security reasons? gwt using javascript on client side , if want create pdf on client, must provide pdf server, example java-servlet.

regex - Replace sequential repeating tags with one of that tag in Ruby -

i'm trying replace multiple sequential <br> tags 1 <br> tag using ruby. for instance: hello <br><br/><br> world! would become hello <br> world! you could regular expression, like: "hello\n<br><br/><br>\nworld".gsub(/(?im)(<br\s*\/?>\s*)+/,'<br>') to explain that: (?im) part has options indicating match should case-insensitive , . should match newlines. grouped expression (<br\s*\/?>\s*) matches <br> (optionally whitespace , trailing / ) possibly followed whitespace, , + says match 1 or more of group. however, should point out in general it's not idea use regular expressions manipulating html - should use proper parser instead. example, here's better way of doing using nokogiri : require 'nokogiri' document = nokogiri::html.parse("hello <br><br/><br> world!") document.search('//br').each |node| ...

javascript - onChange="document.myform.submit() and PHP while loop -

i have following code , on it's own works fine, need have in php while loop there may hundreds of records. not work, meaning not submit form. any code, or other ideas work appreciated. needs write mysql db new value. please note less newbie javascript. thanks <form action="home.php" method="post" name="status"> <input type="hidden" name="record_number" value="<? echo $r['record_number']; ?>"> <input type="hidden" name="submit" value="cstatus"> <select name="statuscode" type="dropdown" style="font-size: 8pt; width: 60px" onchange="status.submit();"> <? if($r['statuscode']) { echo "<option value='".$r['statuscode']."'>".$r['statuscode']."</option>"; } ?> <option value='open'>open</optio...

floating point - Max value can stored in Java float with two digit precision (2 digit accuracy)? -

how find max 2 decimal precision vale can stored in float ? from understanding, in 32 bit float have 24(23+1) storing number excluding exponent. 2^24 max value store ? thanks in advance. sriraman 2^24 largest integer can store accurately. largest 2 decimal places value can store without loss of precision. 2^24/100. note: 0.1 & 0.01 cannot stored accurately rounding can value without error. taking question literally, largest value 0.00. ;) the largest value 2 digits of precision close float.max_value, don't think mean.

How do I override Activerecord gem with my own in rails? -

we've found error in code multi-schema databases in activerecord (we're positive it's error, atleast ;). we've patched file , submitted pull request rails core etc. however, deploy our fix , not await inclusion of our fix in next release of rails. our app hosted on heroku. question: how specify in gemfile should pull activerecord gem not default location but, example, repository @ github ? thanks , time, erwin you can add :git parameter git path gemfile: gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git" it described @ http://gembundler.com/

c# - Aero-Style Windows Explorer Bar for .NET -

good morning, i looking free implementation of windows explorer menu bar introduced aero theme in vista... talking bar below address bar when open explorer (and in case don't have old menu bar visible default) says, instance, "organize" or "open control panel"... aware of such control .net? thank much. i'm not sure need free control when can original toolstrip control mimic appearance pretty close. here's how did it: drag toolstrip control form open properties , change gripstyle hidden, rendermode system, autosize false, and set size larger height, (34 pretty close 1 in explorer) add padding (i chose 5 on all) open items property , add dropdownbutton , select change displaystyle text change text "organize" change autosize false change height 28 or close click ok , go events toolstrip enter function name paint event (or double click) , enter code snippet below private void toolstrip1_paint(object sender, ...

mysql - Add auto_increment to primary key in SQL -

i have table named column b defined int not null primary key , there 4-5 foreign keys point column already. syntax of alter make primary key column auto_increment ? alter table auto_increment=1

Regex.match in C# performance problem -

hi use regex.match in c# phase text file line line. find spend more time(about 2-4 secs) when line cant match patten. spend less time(less 1 sec) when match. can tell me how can improve performance? this regex i'm using: ^.*?\t.*?\t(?<npk>\d+)\t(?<bol>\w+)\t.*?\t.*?\t.*?\t.*?\t.*?\t.*?\t.*?\t.*?\t.*?\t\s*(?<netvalue>[\d\.,]+)\t.*?\t.*?\t(?<item>\d{6})\t(?<salesdoc>\d+)\t(?<acgidate>[\d\.]{10})\t.*?\t.*?\t.*?\t.*?\t.*?\t(?<delivery>\d+)\t\s*(?<billquantity>\d+)\t.*?\t(?<material>[\w\-]+)\tiv$ performance problems show when regex can't match due catastrophic backtracking . happens when regex allows lot of possible combinations match subject text, of have tried regex engine until may declare failure. in case, reason failure obvious: first, you're doing shouldn't done regex, rather csv parser (or tsv parser in case). if you're stuck regex, though, still need change something. problem delimite...

asp.net mvc 3 - jqGrid and Google Chart API -

Image
is possible add graphs using google chart api or other graph 1 column of jqgrid? if possible, how? need filter each row of jqgrid , show graph of particular row in last column of jqgrid. you use custom formatter: <script type="text/javascript"> $(function () { $('#mygrid').jqgrid({ url: '@url.action("data")', datatype: 'json', colnames: [ 'foo', 'bar', 'chart' ], colmodel: [ { name: 'foo', index: 'foo' }, { name: 'bar', index: 'bar' }, { name: 'chart', index: 'chart', formatter: chartformatter }, ] }); }); function chartformatter(el, cval, opts) { return '<img src="' + el + '" alt="chart" title="" />'; } </script> <div style="height: 500p...

ruby on rails 3 - query not working in heroku -

i run on local machine works fine...but when upload heroku error 500 when wrong settings controller class settingscontroller < applicationcontroller before_filter :confirm_logged_in def company @company = user.company @user_id = session[:user_id] @user_name = session[:name] @companies = company.where(:user_id => @user_id) end end setting view <% @companies.each |company| %> <div id="media"> <span class="lop"> <%= image_tag company.logo.url (:small) %> </span> <% end> i check heroku logs get...any ideas 2011-02-18t01:09:24-08:00 app[web.1]: started "/settings/company" 69.137 .99.169 @ fri feb 18 01:09:24 -0800 2011 2011-02-18t01:09:24-08:00 app[web.1]: processing settingscontroller#company html 2011-02-18t01:09:24-08:00 app[web.1]: /app/928a2790-dfe4-4726-8793-1fa99837495b/ home/app/views/settings/company.html.erb:14: warning: don't put space be...

PHP getting Twitter API JSON file contents without OAuth (Almost have it) -

hey guys, have script working fine oauth, accidentally nuked 350 api hits stupid while statement :( i'm trying data twitter api without oauth, can't figure out (still pretty new), heres have <html> <body> <center> <hr /> <br /> <table border="1"> <tr><td>screenname</td><td>followed back?</td></tr> <?php //twitter oauth deets $consumerkey = 'x'; $consumersecret = 'x'; $oauthtoken = 'x'; $oauthsecret = 'x'; // create twitter api objsect require_once("twitteroauth.php"); $oauth = new twitteroauth($consumerkey, $consumersecret, $oauthtoken, $oauthsecret); //get home timeline tweets , stored array $youfollow = $oauth->get('http://api.twitter.com/1/friends/ids.json?screen_name=lccountdown'); $i = 0; //start loop print our results cutely in table while ($i <= 20){ $youfollowid = $youfollow[$i]; $resolve = "http://api.twitter...

dwarf - Getting value of stack pointer while stack unwinding with dwarf2 -

in dwarf2 debugging format, stack unwinding supported of cfi(call frame information) present in .debug_frame section. precisely table keeps rule every register value in previous frame. however, of these rules relies on fact registers saved on stack @ location. not true getting value of stack pointer in previous frame register when there no frame-pointer. in such cases, stack pointer may not saved on stack managed incrementing , decrementing value. however, there no way in dwarf2 (or dwarf format in general) indicate register value expression on current value. so, question is, how can 1 value of stack pointer during stack unwinding dwarf2 debugging format (when no frame-pointer there). -bv it seems dwarf3 supports dw_cfa_val_offset such case. so, can used record value of sp in previous frame based on arithmetic expression on current value. possible solution save stack pointer on stack (will work dwarf2). can done @ -o0 optimization level code efficiency not importan...

What are the prerequisites for learning WCF? -

i working on .net; want learn wcf. there topics required before going wcf? because somewhere saw wwf necessary, it? want go through wcf tutorial .. please suggest me right path thank you the book recommend , running in wcf learning wcf michele leroux bustamante. covers necessary topics, , in understandable , approachable way. teach - basics, intermediate topics, security, transaction control , forth - need know write high quality, useful wcf services. learning wcf http://ecx.images-amazon.com/images/i/51rz7yhbyxl._bo2,204,203,200_pisitb-sticker-arrow-click,topright,35,-76_aa300_sh20_ou01_.jpg the more advanced topics , more in-depth @ wcf covered programming wcf services juval lowy. dives technical details , topics , presents "the bible" wcf programming. completed third edition , covers wcf in .net 4 , appfabric , azure service bus, too. programming wcf services http://ecx.images-amazon.com/images/i/41h2u13a9bl._bo2,204,203,200_pisitb-sticker-arrow-clic...

c++ - Why upon explorer window closing several GetClipboardData are launched? -

i m developping little soft notify users when pasting content in unauthorized applications, hook getclipboarddata so. working fine when copy content word example, click on internetexplorer, open explorer window , close it, getclipboarddata launched explorer. can me understand behavior ? in advance regards it common receive unexpected clipboard events applications, microsoft, when things closing windows or doing makes application stop , think: "hey, maybe left crap on clipboard, i'd better clean up, maybe re-post plain text without ole stuff, maybe did that, can't remember, i'll again." it's sort of ocd build everthing. pop-up saying "you've placed large amount of data on clipboard, make available other applications" when quit program. that's same thing. basically, they've put bunch of formats on clipboard require "delayed rendering" pasteable. , app worried leaving invalid data on clipboard, has re-post data wi...

Acrobat SDK C# tutorial -

could me start developing pdf viewer,reader aid of acrobat sdk. if can give me clear guidance(tutorial). thank yohan the developer centre @ adobe first point start with. go to: http://www.adobe.com/devnet/acrobat.html

Creating a plugin bundle for iOS using XCode -

how create plugin bundle ios in xcode? when try create new project, in "choose template new project" under ios can see types "application" , "library". there 1 template under "library", "cocoa touch static library". dynamic linking not allowed apple ios projects (only against ios-provided libraries), why can't find corresponding project. if try use dynamic linking, app gets rejected.

SVN EXPORT to Remove From Source Control -

i trying remove folder source control. want leave local folder alone , have no longer associated repository. according other answered questions, svn export way remove folder source control. , enter svn export path1 path2 , omit path2: prompt>svn export /var/www export complete. prompt> however when run prompt>svn info /var/www it gives me same info path: /var/www url: https://someurl/somefolder repository root: https://...... etc. i looking say: "var/www not working folder" or "var/www not under source control" and have issued export command still appears under source control. you need delete subversion metadata. hidden folder called .svn in folder , in each subfolder - delete these , they'll no longer working copy. just svn export won't work because overwrite existing files in place not delete .svn folders still exist on disk. delete folder re-export in place. to clear: solution removes association repository fo...

python feedparser <georss:point>55.32967 10.236263</georss:point> -

i trying universal feedparser parse <georss:point>55.32967 10.236263</georss:point> it's not working. have tried accessing item['georss'] , item['georss:point'] , item['point'] resulting in keyerror . i have tried follow can feedparser parse geo-rss it's still not working i had @ keys each entry , found georss:point tag listed georss_point , can call coordinate value entry either feed.entry[i].georss_point or feed.entry[i]['georss_point'] .

performance - Best folder structure for storing image in filesystem? -

i in process of creating website small company, catalog page shows categories , listing of products. have images each product, stored in 1 folder per product, each folder containing small, medium , large version of file (for use in diff. places). is recommended/more efficient combine small, medium , large images in 1 folder each, when catalog listing dynamically created using php / mysql server (shared hosting) doesn't have in 10 different folders, there 1 image each? would notice 10 items per page/request? (total of 500 products?) how images created , prepared? mean image software stores 1 size per folder. if kept there's no intermediate step necessary move/copy images. guess efficiency not different. may ask if use framework site?

how to zoom in and zoom out an image on clicking button in iphone -

i have image in imageview placed in scrollview., zoom in , out performed on pinches, now, want zoom in , out on clicking buttons placed zoom in , zoom out. how it? there option? if knows please tell me. thanks in advance. you can set zoom scale of scroll view programatically based on tap of button. simple implementation: - (ibaction)zoomin:(id)sender { if(scrollview.zoomscale < scrollview.maximumzoomscale) { scrollview.zoomscale = (scrollview.zoomscale + 0.1); } } - (ibaction)zoomout:(id)sender { if(scrollview.zoomscale > scrollview.minimumzoomscale) { scrollview.zoomscale = (scrollview.zoomscale - 0.1); } }

linux - strlen in assembly -

i made own implementation of strlen in assembly, doesn't return correct value. returns string length + 4. consequently. don't see why.. , hope of do... assembly source: section .text [global stringlen:] ; c function stringlen: push ebp mov ebp, esp ; setup stack frame mov ecx, [ebp+8] xor eax, eax ; loop counter startloop: xor edx, edx mov edx, [ecx+eax] inc eax cmp edx, 0x0 ; null byte jne startloop end: pop ebp ret and main routine: #include <stdio.h> extern int stringlen(char *); int main(void) { printf("%d", stringlen("h")); return 0; } thanks you not accessing bytes (characters), doublewords. code not looking single terminating zero, looking 4 consecutive zeroes. note won't return correct value +4, depends on memory after string contains. to fix, should use byte accesses, example changing edx dl .

Way to check redundant code in C# -

is there tool or way can check how can optimize code? removing redundancy? using vs 2010 thanx i don't know removing redundancy, resharper has nice code analysis features can identify unused code blocks. can make suggestions cleaner code, it's not 100% accurate.

mysql - SQL, PHP - Close a sleeping connection -

Image
good day all. have little problem: how close sleeping connections database? when issue query query executed connection remains on sleep mode 2-3 seconds. problem generate queries faster closed. is there way force connection close before entering in sleep mode? or workaround. thank help. note: connections not permanent, close, slow... note 2 - mysql_close(): command issued @ end of query. still query goes sleep mode before close. attach print screen in min. notice sleeping connections... closed in 1-3 secs... generate queries faster. need skip sleep wasted time. are using mysql_pconnect() ? if not, should not happen if close every connection made database. edit : similar issue ?

java - Dozer bidirectional mapping (String, String) with custom comverter impossible? -

i have dozer mapping custom converter: <mapping> <class-a>com.xyz.customer</class-a> <class-b>com.xyz.customerdao</class-b> <field custom-converter="com.xyz.dozeremptystring2nullconverter"> <a>customername</a> <b>customername</b> </field> </mapping> and converter: public class dozeremptystring2nullconverter extends dozerconverter<string, string> { public dozeremptystring2nullconverter() { super(string.class, string.class); } public string convertfrom(string source, string destination) { string ret = null; if (source != null) { if (!source.equals("")) { ret = stringformatter.wildcard(source); } } return ret; } public string convertto(string source, string destination) { return source; } } when call mapper in 1 direction (...

jQuery .html(), .append() doesn't work on multiline markup -

i have trying .html() or .append() function render markup returned third party plugin via ajax call. the ajax response (which coming fine) looks like: <div> <!-- start third party markup --> <div> <img id="img1" usemap="#dnc_map_43" src="charts/solution_id_6/dnc-vvvgdwwl.png?634336319915542170" style="height:294px;width:628px;border-width:0px;" /> <map name="dnc_map_43" id="map1"> <area shape="poly" coords="0,274,628,274,628,294,0,294" href="http://www.dotnetcharting.com" alt="visit .netcharting licensing options , more information." title="visit .netcharting licensing options , more information." /> <area shape="poly" coords="381,26,616,26,616,56,381,56" href="http://www.dotnetcharting.com...

iphone - ImagePicker in view hierarchy problem -

i can't figure out effective , "elegant" method doing task. problem definition is: want display several views, 1 of them imagepicker camera roll source. the hierarchy looks similar this: main view ---> picker ---> image processing view when user tap "back button" ui has allow backward displaying. i have tried several options: 1. a) main view presents picker view modally. b) in didfinishpickingmediawithinfo delegate method dismiss picker modal view , after invoke presentmodalviewcontroller image processing view. sample code: - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage* pickedimage = [info valueforkey:uiimagepickercontrollereditedimage]; lastviewcontroller* vc = [[lastviewcontroller alloc] init]; vc.mainimage = pickedimage; [self dismissmodalviewcontrolleranimated:no]; [self presentmodalviewcontroller:vc animated:no]; } problem that, doesn...

bash - Script to rename files using a sha1() hash of their filename -

i'm building website , hash filenames of images. how can create bash script file renames every file in directory sha1 of old filename ? i've tried : #!/bin/bash file in * if [ -f "$file" ];then newfile="openssl sha1 $file" mv "$file" $newfile" fi done but doesn't work :( edit based on suggestions here tried : #!/bin/bash file in old_names/* if [ -f "$file" ];then newfile=$(openssl sha1 $file | awk '{print $2}') cp $file new_names/$newfile.png fi done this rename files, i'm not sure has been used hash file name. did extention hashed ? did path ? info i use php's sha1() function display images : echo "<img src=\"images/".sha1("$nbra-$nbrb-".secret_key).".png\" />\n"; the code examples in answers far , in edit hash contents of file. if want create filenames hashes of previous filename, not including path or exten...

multithreading - onBackPressed and threads in android -

i've got thread running in listactivity and takes long data internet, maybe user wants quit , go back. however, when press button, shows previous view, thread still remains in execution. i override onbackpressed() method , set breakpointm while debugging see doesn't go through it, don't know else do... any idea? thank you here code. basically, don't know why doesn't execute onkeypressed() if goes previous activity when y press button... code edit // package + imports public class listavideosactivity extends listactivity implements runnable { private progressdialog pd; private context mcontext; private view header; private view footer; private vibrator vibrator; private boolean firstime = true; private thread thread; private long playlistid; private string playlisttitle; protected int headerdrawable; private playlist plist; public static final string tag_pl_id = "id_playlist"; publ...