Posts

Showing posts from April, 2012

java - Installing JGR (GUI for R) on Windows 7 64 bit -

i getting following error when try run jgr-x64.exe on windows 7 64-bit. couldn't install jgr! please re-install r and/or connect internet my packages getting installed at \appdata\local\temp\rtmp886wzb\downloaded_packages is setting environmental variables? any advise on how solve this? for non-standard r library locations, need tell jgr-x64.exe jgr package. instructions on how at: http://www.deducer.org/pmwiki/pmwiki.php?n=main.runningjgrwithanon-standardrinstallation the newest development version of jgr can automatically create script you. can test out doing following: install.packages("jgr",,"http://www.rforge.net",type="source") library(jgr) jgr()

php - Number of gamertags in a table? -

i want print total number of gamertags in table equals rows. $total = mysql_query('select count(*) gamertags'); print $total; the code above prints idk why? resource id #3 i agree other guys, it's explained on that page . here's answer anyway... $result = mysql_query('select count(*) gamertags'); $total = mysql_result($result, 0); echo $total;

Eclipse C/C++ Compilation faile -

hi i'm new eclipse ide c/c++ developer(i'm using eclipse helios c/c++) i've made small program #include<stdio.h> #include<conio.h> main() { printf("hello eclipse c c++"); } and when trying run it, getting error "launch failed. binary not found" though cdt c/c++ installed can body me out? what c compiler using under covers there? people include conio.h invariably using turbo c - don't know why, it's antiquated , can better free compiler (in terms of both cost and freedom) in gcc (should pretty-well standard on linux distro, or hands on mingw if you're running under windows). try following instead: #include <stdio.h> int main (void) { printf("hello eclipse c/c++\n"); return 0; }

right click - Preventing web images from being taken -

i've been looking around see if there exists way prevent viewers using right click options download images upload website. know people can @ image url in page source, , wondering if suggest way prevent them being taken, disabling save image option. this unsolvable problem. as long want people see images, cannot prevent them saving them via number of methods (e.g. screenshots). measures might think of annoy users, without preventing them doing want anyway. consider people watching images have interest in them (otherwise not watch them in first place), there have motive them keep copy. the way reliably prevent people saving images never let them copy them onto computers in first place (and remember: showing on computer entails making copy). one solution invite people place can view image on screen control, , not let them take pictures. think of modern cinemas security people night sights watch spectators , pull out might have been handling camera device.

python - Trouble parsing HTML using BeautifulSoup -

i'm trying use beautifulsoup parse html in python. specifically, i'm trying create 2 arrays of soup objects: 1 dates of postings on website, , 1 postings themselves. however, when use findall on div class matches postings, initial tag returned, not text inside tag. on other hand, code works fine dates. going on?? # store texts of posts texts = soup.findall("div", {"class":"quote"}) # store dates of posts dates = soup.findall("div", {"class":"datetab"}) the first line above returns only <div class="quote"> which not want. second line returns <div class="datetab">feb<span>2</span></div> which want (pre-refining). i have no idea i'm doing wrong. here website i'm trying parse. homework, , i'm really desperate. which version of beautifulsoup using? version 3.1.0 performs worse real-world html (read: invalid html) 3.0.8. code works 3.

django - Foriegnkey issue while submitting the form -

this post extends error while submitting data in form django model.py django.db import models # create models here. class profile(models.model): name = models.charfield(max_length=50, primary_key=true) assign = models.charfield(max_length=50) doj = models.datefield() class meta: db_table= 'profile' def __unicode__(self): return u'%s' % (self.name) class working(models.model): w_name =models.foreignkey(profile, db_column='w_name') monday = models.integerfield(null=true, db_column='monday', blank=true) tuesday = models.integerfield(null=true, db_column='tuesday', blank=true) wednesday = models.integerfield(null=true, db_column='wednesday', blank=true) class meta: db_table = 'working' def __unicode__(self): return u'%s ' % ( self.w_name) view.py # create views here. forms import * django import http django.shortcuts import rend

Jquery filter giving empty results -

why not working. i'm getting empty array. <select id="test"> <option value="bar">foo</option> <option value="bar1">foo1</option> <option value="">foo2</option> <option value="bar3">foo3</option> <option value="bar4" selected>foo4</option> <option value="bar5">foo5</option> </select> $('#test').find('option').filter(function() { this.selected && this.value.length }).get(); you need return condition.

c# - How can I get the executing assembly version? -

i trying executing assembly version in c# 3.0 using following code: var assemblyfullname = assembly.getexecutingassembly().fullname; var version = assemblyfullname .split(',')[1].split('=')[1]; is there proper way of doing so? two options... regardless of application type can invoke: assembly.getexecutingassembly().getname().version if windows forms application, can access via application if looking product version. application.productversion using getexecutingassembly assembly reference not option. such, find useful create static helper class in projects may need reference underlying assembly or assembly version: // sample assembly reference class exist in `core` project. public static class coreassembly { public static readonly assembly reference = typeof(coreassembly).assembly; public static readonly version version = reference.getname().version; } then can cleanly reference coreassembly.version in code required.

css float - CSS problem in IE 6 and 7 -

kindly visit following website: property.consultfinman.com you must have seen problem, if using ie 7 or ie 6. page loading fine in ff, ie8, safari , google chrome. in ie7 floats not positioned intended positioned. , in ie6 shuffled. any solution problem (keeping in mind not css guru). thanks many of ie6 bugs caused double margin bug when use float , margin in same direction, ex { float: left; margin-left: 10px; } , ie6 magically double value. need add *display: inline; need use float , margin in same direction. as bottom of design, have no idea why specify background-color: #000000; @ .featured-content this reason why have black background on ie6 , ie7, can't tell bug i'm pretty sure it's float. hope helps.

wix - Features installed to different locations but referencing the same components -

i have product consists of multiple features can installed different locations e.g. feature 1 executable installed in program files , feature 2 website installed in wwwroot. both feature 1 , feature 2 rely on many of same dll's , hence require components containing dll's installed in 2 different locations depending on features installed. is there way achieve without defining every component twice? to provide further complete example of trying achieve, following complete wxs file can compiled using: > candle.exe foobar.wxs > light.exe -ext wixuiextension foobar.wixobj > msiexec /i foobar.msi <?xml version='1.0' encoding='windows-1252'?> <wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> <product name='foobar 1.0' id='e578df12-dde7-4bc2-82cd-ff11862862d5' upgradecode='90f09dd5-e01b-4652-8971-515997730195' language='1033' codepage=&#

.net - Help understanding C# optimization -

i playing c# , wanted speed program. made changes , able so. however, need understanding why change made faster. i've attempted reduce code easier understand in question. score1 , report1 slower way. score2 , report2 faster way. first method first stores string , int in struct in parallel. next, in serial loop, loops through array of structs , writes data buffer. second method first writes data string buffer in parallel. next, in serial loop, writes string data buffer. here sample run times: run 1 total average time = 0.492087 sec run 2 total average time = 0.273619 sec when working earlier non-parallel version of this, times same. why difference parallel version? even if reduce loop in report1 write single line of output buffer still slower (total time .42 sec). here simplified code: using system; using system.collections.generic; using system.linq; using system.text; using system.diagnostics; using system.threading.tasks; using system.io; namespace optimizationqu

qt - C++ Subclassing, Inheritance and Casting -

this specific conundrum hard me explain i'll try best can. in qt framework, there 2 classes: qtreewidget , qtreewidgetitem. i have subclassed qtreewidgetitem: class myqtreewidgetitem : public qobject, public qtreewidgetitem { ... public: int mycustomvariable; } i add qtreewidget doing like: myqtreewidgetitem *item = new myqtreewidgetitem; item->mycustomvariable = 10; tree->addtoplevelitem(item); now, if ever need call tree->toplevelitem(x), qtreewidgetitem*. however, i'm after myqtreewidgetitem* i: myqtreewidgetitem *theitem = (myqtreewidgetitem*)tree->toplevelitem(n); the problem theitem->mycustomvariable no longer equals 10. is there way keep myqtreewidgetitem intact? i don't know qq, try doing proper dynamic_cast<> verify whether object myqtreewidgetitem* (otherwise returns 0), performing pointer conversion (i'm not sure if c-style cast returning address of qobject ). can print out pointers , more insig

Custom tab in android - getting error while using "setIndicator" -

i trying create custom tab in android app , got sample codes code showing errors in setindicator method...here code error getting - method setindicator(charsequence) in type tabhost.tabspec not applicable arguments (textview) package com.myapp; import android.app.activity; import android.graphics.color; import android.os.bundle; import android.view.gravity; import android.view.view; import android.widget.framelayout; import android.widget.linearlayout; import android.widget.tabhost; import android.widget.tabwidget; import android.widget.textview; import android.widget.linearlayout.layoutparams; import android.widget.tabhost.tabcontentfactory; import android.widget.tabhost.tabspec; //custom tabs public class myactivity extends activity { int tabheight = 40; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linearlayout main = new linearlayout(this); main.setorientation(linearlayout.vertical); setcontentview(main); tabhost tab

php - curl http authentication with Zend -

i used zend rest controller developing web service, , need authenticate users before can access page. for this, iam planning use http authentication curl, this: curl_setopt($ch, curlopt_userpwd, "myusername:mypassword"); and call curl page this: curl -u myusername:mypassword http://localhost/controller/action/page.xml i have big doubt. do need store usernames , passwords in .htpasswd file? if so, how need retrieve parameters , validate them ? if use .htaccess webserver silently handle you. can assume (unless have made mistake) person authorised. but if want use http auth , user name , password use in own login system need write script thats being called shown here. http://php.net/manual/en/features.http-auth.php apart sending through username , password curl has nothing it. acts http client, webbrowser is. how perform auth comes down trying achieve. http auth simple authentication system. dc the link gave shows how it. page calling must s

iphone - EXC_BAD_ACCESS while adding data to array, using 2 NSOperations simultaneously -

i have: 1) starting 2 asynchron nsurlrequests simultaneously 2) 1 of 2 requests has loaded xml data, nsoperationqueue used start xml parser. hereby, parseoperations work excatly in apple's lazytableimages example. inforequesthelper.m // ... case getblogentries: { blogparseoperation *parser = [[blogparseoperation alloc] initwithxmlstring:result delegate:self]; parser.tag = helper.requesttag; [queue addoperation:parser]; // start "parseoperation" [parser release]; break; } case gettweets: { twitterparseoperation *parser = [[twitterparseoperation alloc] initwithxmlstring:result delegate:self]; parser.tag = helper.requesttag; [queue addoperation:parser]; // start "parseoperation" [parser release]; break; } // ... 3) when parsing finished parser:didfinishparsing: fires. inforequesthelper.m - (void)parser:(parseoperationbase *)parser didfinishparsing:(nsarray *)entries { // save data, remove complet

java - Using EJB default interceptor to match on parameters -

i'd create ejb default interceptor acts on business method contains set of parameters, doesn't need match exactly. there's classic method of matching parameter set, i.e: <assembly-descriptor>. <!-- method interceptor apply sendbookingcancellationmessage emailsystembean --> <interceptor-binding> <ejb-name>mybean</ejb-name> <interceptor-class>someinterceptor</interceptor-class> <method> <method-name>overloadedmethod</method-name> <method-params> <method-param>int</method-param> <method-param>java.lang.string[][]</method-param> </method-params> </method> </interceptor-binding> </assembly-descriptor> but i'd instead match on method takes int , string[][] , whatever else, instead of exact two. know if can done? on glassfish v3, using wildca

How to access inner elements of a WPF custom control that doesn't implement the AutomationPeer class? -

recently came know article - http://blogs.msdn.com/b/patrickdanino/archive/2009/11/11/custom-controls-and-ui-automation.aspx -that controls in wpf responsible exposing uia items themselves, , newly added functionalities of custom control aren’t available uia until exposed through implementation of corresponding automationpeer class. @ work have been assigned automation of ui testing of wpf application employs large number of toolbars. problem is, through microsoft ui automation library can access toolbars (apparently developed custom control) automationelements, cannot access buttons inside them – count of children/descendant collection return 0. when using coded ui test, tests fail , shows following error message: test method cam2qdummytest.codeduitest2.codeduitestmethod1 threw exception: microsoft.visualstudio.testtools.uitest.extension.failedtoperformactiononblockedcontrolexception: control blocking control. please make blocked control visible , retry ac

java - Move/Copy XMLBean object to another Bean -

<xml-fragment> <currentclinicalnote> <patientfamilyhistory disordername="currentcn" id="23423"/> <patientfamilyhistory disordername="currentcn1" id="23424"/> <patientfamilyhistory disordername="currentcn1" id="23424"/> </currentclinicalnote> </xml-fragment> i have xmlbean above, want replace node[@id=23423] new same type node. how can that? below sample code tried work.. xmlcursor xmlcursor = cursor.execquery(namespace + pathexpression1); i found node above code, have node in cursor, how replace another? any replies appreciated. dom3 not yet implemented in xml beans,so need work dom nodes directly fetch finding first child in cursor.

symfony1 - How to let the user choose the upload directory? -

i have form used upload images in blog engine. files uploaded web/uploads , i'd add "choice" widget let users pick list of folders, instance 'photos', 'cliparts', 'logos'. here's form class imageform extends baseform { public function configure() { $this->widgetschema->setnameformat('image[%s]'); $this->setwidget('file', new sfwidgetforminputfileeditable( array( 'edit_mode'=>false, 'with_delete' => false, 'file_src' => '', ) )); $this->setvalidator('file', new mysfvalidatorfile( array( 'max_size' => 500000, 'mime_types' => 'web_images', 'path' => 'uploads', 'required' => true ) )); $this->setwidget('folder', new sfwidgetformchoice(array( 'expanded' => false,

php - calculate values on basis of text box entry -

i have 1 row of text boxes generated php loop , mysql id. <input class="text_field1" id="<?php echo $i ?>" name="q_<?php echo $row['pid']; ?>" type="text" style="width:150px" /> <input disabled="disabled" class="text_fieldd" id="p_<?php echo $row['pid']; ?>" name="p_<?php echo $row['pid']; ?>" type="text" value="<?php echo $row['pprice'] ?>" /> <input disabled="disabled" class="text_fieldd" id="t_<?php echo $row['pid']; ?>" name="t_<?php echo $row['pid']; ?>" type="text" /> what want is when enter value in text box class text_field1, want calculate total in text box name t_.... (qty * price ,p_....) i try code works little bit not want , jquery code is $('.text_field1').bin

Python CookieJar - Cookies Set By Google Analytics -

i'm little bit confused situation. i'm working on script login website. i'm using cookiejar , login method working fine. if try display cookiejar content: for index, cookie in enumerate(cw.cj): print index, ':', cookie i cookie as: 0 : <cookie c4csessid=tqb2qn92du8i9k5r4vnpd83i73 www.example.com/> but in firefox if i'm looking domain (in fact, w/out www) in cookies editor, can see google analytics ones (__utma, __utmc, etc). how can capture cookies in cj? goal able modify __utmb cookie content. (i can ff want script also) thanks i think cookie once tracking code on page has executed (in response google server). it's javascript, you'll need find way either interpret javascript in code, or mimic request tracking code issues. interpreting javascript out of context of browser prove tricky, suspect tracking code needs access dom, doesn't have if page urllib example.

regex - ASP.NET regular expression -

i have following regex (?<!<[title|h1|a][^>]*>[^<]*)(?<!<[meta|img][^>]*[^/>])(someword) i using above replace words url. i.e. the new product x will become the new <a href="/productx">product x</a> its working expected. doing negative behind don't replace things in tilte, h1 , anchor tags. need extend if there bold tag within anchor tag not match.i.e. <a href="/something">the new <b>product x</b></a> should not replaced. way have negative lookbehind finds bold tag , matches. want skip if inside . interested need search page returns results <a href="/something"><b>searchterm</b> other text</a> any appreciated the short answer can't write good, single regular expression want. there special cases cause false positives. there better ways want. being said, if you're still going regex solution, might closer want: (?<!<(?:t

java - HashMap for enum as key -

i had posted similar question before also. got clarification doubts well. still need more. hashmap initialized enum object key , threadpool instance value. confused of how initialize hashmap every object been called other process ..to make clear : program, mythreadpoolexcecutorpgm.java initializes hashmap progran additionhandler.java requests thread hashmap passing threadpoolname (enum). getting "no thread available hashmap" message. please me. below given code: public class mythreadpoolexcecutorpgm { enum threadpoolname { dr, br, sv, miscelleneous; } private static string threadname; private static hashmap<threadpoolname, threadpoolexecutor> threadpoolexecutorhash; public mythreadpoolexcecutorpgm(string p_threadname) { threadname = p_threadname; } public static void fillthreadpoolexecutorhash() { int poolsize = 3; int maxpoolsize = 3; long keepalivetime = 10; threadpoolexecu

html - bulleted list having links of pdf file -

what coding have write if want show links of .pdf files in bulleted list , when click on link , open pdf file? <html> <head> <title>some links</title> </head> <body> <ul> <li><a href="first.pdf">first file</a></li> <li><a href="second.pdf">second file</a></li> <li><a href="third.pdf">third file</a></li> </ul> </body> </html>

java - Upload video to Facebook, with RestFB -

im trying upload video restfb, tried 2 days, still cant it, can me this? done. i know can upload video method video.upload , , must send request facebook video server, create class videolegacyfacebookclient , , put there server, tried make new execute method, wich take inputstream binaryattachement video, , try make code: inputstream is=new datainputstream(new fileinputstream(new file("/home/hagen/testing.avi"))); postid = facebookclient.execute("video.upload", null, string.class,is, parameter.with("title", "my test video"), parameter.with("description", "this description")); what wrong, can me? restfb 1.6.5 may fix problem; http://restfb.googlecode.com/svn/tags/restfb-project-1.6.5/changelog says: added support new video upload api endpoint via https://graph-video.facebook.com , fixed multipart filename bug broke video uploads.

php - Can you see what is in memcached? -

i'm using memcached extension in php5 application. we're running lamp stack on ubuntu maverick (10.10). we're using memcached series of things, 1 of persisting user session among multiple applications. my question is, there utility or ui see inside memcached server? this invaluable tool during development. you try harun yayli's memcache.php or this variation on memcache.php

asp.net - Panel.FindControl() method isn't finding a control that has been added to it -

consider following code, adding 2 textboxes same id (oops): protected void page_load(object sender, eventargs e) { string textboxname = "textbox1"; panel p = new panel(); textbox t = new textbox(); t.id = textboxname; p.controls.add(t); if (p.findcontrol(textboxname) == null) // <-------******* { textbox t2 = new textbox(); t2.id = textboxname; p.controls.add(t2); } page.form.controls.add(p); } the code designed stop adding same id twice. however, panel.findcontrol() method not finding control added in previous line of code. am using in wrong way? i mean - sure - manually iterate through controls in next level, like: string textboxname = "textbox1"; panel p = new panel(); textbox t = new textbox(); t.id = textboxname; p.controls.add(t); textbox t2 = new textbox(); t2.id = textboxname; bool duplicatefound = false; foreach( control c in p.controls ) { if(c.id == textboxname)

iphone - Show multiple locations on google map -

Image
i want access google maps in iphone show multiple locations of branch-centers in 1 city/area, help? please have @ following image. thanks, this blog help, specially maps, see following link- click here

jquery - Javascript ajax scripts in <head>? -

i have 2 html page (main , details): main page consists of table , empty div. when user clicks 1 table row, empty div filled via ajax page (details page). on details page want load google map. page operational (standalone), not via ajax. so here problem: use google maps have include script in head of html: <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> if include in details page, works fine standalone. doesn't work when try via ajax main page. google server hangs, , doesn't progress. on other hand, if include in main page, ajax works fine, details page not operational on own, since missing vital include. i'd leave in details page, since has more logic there. there way can load script in main page, details page? generally best approach javascript including , ajax? keep in main page? or there mechanism load main page, keep code in ajaxed pages? btw. i'm using jquery, not im

ipad - Can I have a file with the same name in 2 folders inside iphone's document directory? -

i checked , understood can create folders different name inside documents directory. my doubt have created 2 folders, folder1 , folder2. possible have file named rock.pdf inside each directories? both files different having same name. of course. same file name in different folders fine.

c++ - Apache qpid setDelay -

does apache qpid-cpp messaging api support delayed delivery of message in activemq? textmessage message = session.createtextmessage("test msg"); long time = 60 * 1000; message.setlongproperty(scheduledmessage.amq_scheduled_delay, time); no, not supported (current version 0.10). if you'd see included in future version, recommend creating feature request in qpid jira if 1 doesn't exist yet.

why in c# we need to initialize primitive type variable? -

this question has answer here: initialization of instance fields vs. local variables 7 answers why in c# need initialize primitive type variable -- static void main(string[] args) { int a; console.writeline(a); } throws compile time error ... in order prevent potential coding mistakes, c# not allow use local variable until compiler can prove has been initialized.

floating point - Why "decimal.Decimal('0') < 1.0" yields False in Python 2.6.5 -

in python 2.6.5 following expression yields false: >>> import decimal >>> decimal.decimal('0') < 1.0 false is there rationale explaining why comparison of decimal against float should behave this? from documentation of decimal module : changed in version 2.7: comparison between float instance x , decimal instance y returns result based on values of x , y. in earlier versions x < y returned same (arbitrary) result decimal instance x , float instance y. so looks bug/missing feature , need upgrade.

javascript - Web page Optimization -

i'm creating new dinamic site test , learn web optimization... site index for html,css,js (exept jquery-min linked google server) files i've created php file concatenate more files, remove unused spaces, , compress using gzip: compressed css - compressed js if(extension_loaded('zlib')){ob_start('ob_gzhandler'); /*...php code read files , remove comments/spaces*/ if(extension_loaded('zlib')){ob_end_flush();} for main images, collapsed every image one for facebook button, replace iframe after page load using jquery, i'd same adbrite advertises don't know how.. if try replace, or inject code html after loading, page disapper , remain adv... someone help? can tell me if i'm doing (for optimization) , can improve thanks... it's start, shouldn't compress dynamically. costly , end slower delivering content uncompressed. use gzip/deflate , compress javascript files minifier yui , google's closure compiler

java me - Are there any MIDP 3.0 based devices? -

it's been while release of midp 3.0 spec. there device supports specifications ? i don't believe there commercially-available midp 3.0 phones available yet. java me benchmark list shows midp 2.1 highest supported version. motorola, spec lead, not list midp 3.0 phones , nor nokia .

linker - Linking Objective-C project on Windows -

i have compiled 2 classes (etudiant.m) , (main.m) , obtain successufully 2 .o files (etudiant.o) , (main.o). when linking command : gcc -c -o prog -wno-import etudiant.o main.o -lobjc i got : gcc.exe : etudiant.o : linker input file unused because linking not done gcc.exe : main.o : linker input file unused because linking not done can me find out how solve linking issues ?? thx in advance. don't use -c . tells gcc frontend not perform linking. so, instead of gcc -c -o prog -wno-import etudiant.o main.o -lobjc just gcc -o prog -wno-import etudiant.o main.o -lobjc

java - using netbeans, can i decipher d design of a form from the code (javaframe forms)? -

i got java code jframe form. using code wud netbeans construct form. i tried replacing d new form file in d saved project directory using d existing java form file, d code replaced , not form. so plz help you not able designer view of netbeans if form (jframe) not designed netbeans. still can use netbeans, sophisticated text editor. should quite easy though design replica nb-designer, if have specifications, if take @ source code have been given or have image of form.

visual studio 2010 - Detecting File Changes in TFS -

using source control explorer tfs in visual studio, there way detect local changes files (or new files in directory hierarchy) weren't first checked out? we have highly disconnected setup @ current client whereby accessing tfs means being on specific vpn, breaks connections other things (such internal database servers , web access). time file needs modified need connect, check out, disconnect, leads feel derailing mental context switch developer (especially when working lot of files , not knowing ahead of time ones going need modified). we can work locally , select "overwrite" time visual studio asks want various non-checked-out files. there way detect files have been changed (or @ least made writable) when want sync server? or maybe i'm going wrong? backing step, what's ideal way work on solution that's bound disconnected tfs source control? since david's suggested might work in comment, here instructions disabling remote gateway on

sitecore6 - Change template on a cloned item in Sitecore 6.4 - does clone lose its inheritance? -

if create cloned item in sitecore 6.4, change template slighty edited copy of original item's template, inheritance parent of clone broken? e.g: basetemplate | | itemtemplate -> itemtemplate2 item1 (from itemtemplate) | item1 clone (change template itemtemplate2) will clone still clone (recieving values parent), or become fledged item? ref: sitecore cms 6.4: cloning when change data template clone or cloned item, fields same ids maintain values, fields different ids lose values, if have same names. considering clone not fledged item (because there option unclone item, in turn does create fledged item clone), changing template not "break" clone construction.

java - Swing: detect mouse move on generalpath -

i'm drawing splines using generalpath follow: generalpath path = new generalpath(); path.moveto(x0, y0); path.curveto(x0 + 100, y0, x1 - 100, y1, x1, y1); ((graphics2d) g).draw(path); basically, draws spline looks cable, or wire, between point (x0;y0) , point (x1;y1). p0 -- \ \ `-- p1 the drawing okay, detect when mouse moves hover spline. problem contains(point) method not seems want. returns true if point inside area between spline , direct line between (x0;y0) , (x1;y1). in example above, return true whole "stars" area: p0 ----------- *********\ ******\ ***\ *\* \******* `------------- p1 but want detect when point located on spline. is there way achieve want ? any ideas appreciated ! edit: found explanation of problem in documentation, not me find solution: the contains , intersects methods consider interior of shape area encloses if

ruby on rails - Will Paginate: How change default page in links -

i have 2 partial. first have common will_paginate in second will_paginate need change links (default url) generated will_paginate. please need answer. thanks try this will_paginate(@some_collection, :params => { :controller => "foo", :action => "bar" })

header - How does http "multipart/x-gzip" work? -

i have been struggling figure out "multipart/x-gzip" work? if sender tends send multipart gzipped file recipient, data first zipped, partitioned , put , inflated(uncompressed) @ recipient? or data first partitioned zipped , sent recipient? each partition uncompress-ion done , real data put together? google answer friend : http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/ nice video explain on google code: http://code.google.com/speed/articles/gzip.html

c# - How to find out If user has made any changes in row inside table. Asp.net MVC -

i have table code this. <% using (html.beginform()) {%> <table> <tr> <th>title</th> <th>author</th> <th>date published</th> </tr> <td> <%: html.textboxfor(m => m.title) %> <%: html.validationmessagefor(m => m.title) %> </td> <td> <%: html.textboxfor(m => m.author) %> <%: html.validationmessagefor(m => m.author) %> </td> <td> <%: html.textboxfor(m => m.datepublished) %> <%: html.validationmessagefor(m => m.datepublished) %> </td></table> <input type="submit" value="create" /> <% } %> inside model: public class book { public string title { get; set; } public string author { get; set; } public datetime datepublished { get; set; } } if user change value in table how track row value

java - Why for-each loop does not allow increment Integer? -

i mean in code: list<integer> list = new linkedlist(); list.add(1); list.add(2); list.add(3); (integer : list) i++; system.out.println(list.get(0)) returns 1 not 2. in for-each loop java creates new object (i) , copies fields value object in list? integer s immutable. your code changes i variable point brand-new integer instance larger value. the original integer instance in list not (and cannot be) changed.

RackSpace Email API Examples (prefer ColdFusion or PHP) -

i'm looking detailed examples of how use rackspace email api add new domains customer, add emails domain, , how create customer. advice or tips appreciated. there couple of rackspace-related projects on riaforge. not need, may helpful starting point of api integration.

python - SQLAlchemy bug? I'm not sure -

from sqlalchemy import create_engine sqlalchemy import table, column, integer, string, metadata, foreignkey sqlalchemy.orm import mapper, sessionmaker sqlalchemy.ext.declarative import declarative_base bottle import route, post, get, request import os base = declarative_base() class user(base): """table login details""" __tablename__ = 'login_table' id = column(integer, primary_key=true) username = column(string) password = column(string) email = column(string) def __init__(self, username, password, email): """create object containing info of user""" self.username = username self.password = password self.email = email def __str__(self): """return string representation""" return self.username def __repr__(self): """return object representation""" retu

active directory - Can I impersonate a client authenticated with forms auth and establish a trusted connection to SQL Server? -

here i've been trying do build asp.net mvc 3 application forms authentication , active directory membership. web server , database different physical servers hence double hop. i thought answer older article on constrained delegation , protocol transition ? far, have not been able technique work. i'm testing dev machine (windows 7, iis7) web server before deploying windows 2008 (iis7) in production setup. windows 2008 make difference? what works , fails i'm able login forms auth , ad membership. seem working fine. when try make database call using code: public void asuser(action action) { using (var id = new windowsidentity(user.identity.name + @"@example.com")) { windowsimpersonationcontext context = null; try { context = id.impersonate(); action.invoke(); } catch (exception ex) { // ex.message type initia

C# Daylight saving DateTime switch -

i have events triggered whenever daylight switches happen. i when spring/fall switches going happen using timezone.currenttimezone.getdaylightchanges(year) this returns me 2 datetimes: 1. start datetime spring cutover 3. end datetime fall cutover. the spring forward works fine. but fall 1 end time 2.00 cst. when subtract second 1.59.59 cst. event gets fired hour later. need set trigger 1.59.59 cdt. how construct datetime? you looking set 1 second before start of time change. convert utc, subtract delta , second. datetime fall; //set 2:00 cst daylighttime time; //filled getdaylightchanges() call. datetime falladjusted = fall.touniversaltime().subtract(time.delta).addseconds(-1);

video - Analyzing camera feed under OSX -

i looking way programmatically analyze video feed external usb webcam under osx. since haven't done low level programming before kind of lost on start. how can access webcam feed , grab image data process further? @ point trying understand basic concept , not looking language-specific solutions. sample code highly appreciated. i'd appreciate if point me in right direction , me started. thank in advance! thomas use opencv . and check previous answer on subject if looking code example display webcam images. converts video feed grayscale , displays them on window: opencv 2.1: runtime error if want display frames, replace else block this: else { cvshowimage("colored video", color_frame); } in case wandering how manipulate pixels of frame: int width = color_frame->width; int height = color_frame->height; int bpp = color_frame->nchannels; (int i=0; < width*height*bpp; i+=bpp) { if (!(i % (width*bpp))) // print empty l

Signing an app, but not publishing on Android market -

the android system has flag called "unknown sources" allows install applications non-market sources. if sign application described on android developer website (i.e. certificate created using private keys got google), , decide not publish application on android market, host on own site. will application considered non-market android system ? still install "unknown sources" option turned off ? "unknown sources" allows installation of applications via download links (.apk files browser) , has nothing code signing. applications need signed , should zipalign'd before posting them. unlike other platforms (like blackberry), requirement application signed using private key control or own. recommend against using keys not own. if use private key other people can obtain, other people can post updates application system trust. the short answer no, not install via own web site "unknown sources" disabled on device.

html - JQuery loop through checked boxes and populate div -

<div id="termsheetpopup"> <input type="checkbox" name="summaryinformation">summary information<br /> <input type="checkbox" name="swaplegs">swap legs<br /> <input type="checkbox" name="amortizationoptions">amortization options<br /> <input type="checkbox" name="economicresults">economic results<br /> <input type="checkbox" name="amortizationschedule">amortization schedule </div> <div id="printing"> </div> so looking @ above code, termsheetpopup div turn jquery dialog. when user clicks dialog 'generate' button, want jquery tell me names of of checkboxes checked (the name element of them), can use names populate div printing . each of names correspond partial view want render within div. also, if have time, how render partial view dynamically using jquer

jquery - JavaScript; How do I declare a variable global? -

http://jsfiddle.net/borayeris/6kvyb/ <ul> <li>foo</li> <li>bar</li> </ul> <script> $('li').each(function(index) { var qq=$(this).text(); alert(index + ': ' + qq); }); alert(qq);// asking one. </script> you've declared qq inside scope of function. once function exits, qq doesn't exist anymore. if want have alert qq, need declare outside of function. keep in mind contain last value assigned it. var qq; $('li').each(function(index) { qq=$(this).text(); alert(index + ': ' + qq); }); alert(qq); // alert 'bar'

How can I either work with the ruby on rails flash hash manually, or create my own "custom" hash for error messages? -

in rails 3 project, i'm trying create consistent error/success message display dialog go in header of page. have displaying flash messages when set controllers, this: <% if flash.length > 0 %> <% flash.each |key, value| %> <% if key == "error" %> <div class="notice error"><%= value %></div> <% elsif key == "success" %> <div class="notice success"><%= value %></div> <% else %> <div class="notice regular"><%= value %></div> <% end %> <% end %> <% end %> but, want able send custom messages dialog come link_to tags, example: <% if [certain variable set] %> <% message = hash.new %> <% message[type] = "specific message sent link" %> <%= link_to [link option one] %>

Asp.Net Google style file upload -

does knows of user control can work file upload google has? want use select files upload, upload start , progress bar work, , user can continue next field has fill in page file uploaded in background. willing pay. free better. thanks i used ajaxuploader great results. 1 of demos gmail style . runs $99 1 domain.

security - secure script action in php -

hi want ask security of "script action" in example <form method="post" action="chek_user.php" enctype="multipart/form-data"/> and action $username= htmlentities($_post['username']); $mdp=htmlentities(md5($_post['pass'])); if($user->check_login($username,$mdp)==0) { $_session["ip"]=$_server["remote_addr"]; $_session["user_agent"]=$_server['http_user_agent']; $_session["timestamp"] = time(); if (isset($_post['remembre'])) { $expire = time() + 24*3600; setcookie('user', $_session['user'], $expire); } header('location:indes.php'); } else if ($user->check_login($username,$mdp)==-2) { echo 'no'; } never use setcookie() setup session state. should have session_start() in header file. never use md5() extremely brok

iphone - Find text in NSArray -

i have several custom objects in nsarray, need search through objects , fnd index of object has property matches string. should using each loop? need relatively fast search each time new character entered in textfield. nspredicate neat, overkill (and won't give index of found object; object itself). the paired array approach, work, feels odd me (probably because it's using paired array). i either use for() loop (and break; when found looking for), or use block enumerator: __block nsinteger indexofmatchingobject = nsnotfound; [myarray enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { if ([[obj property] doeswhatimlookingfor]) { indexofmatchingobject = idx; *stop = yes; } }]; or different variant: nsinteger indexofmatchingobject = [myarray indexofobjectpassingtest:^(id obj, nsuinteger idx, bool *stop) { return ([[obj property] doeswhatimlookingfor]); }];

how do I get git to show me which branches are tracking what? -

i know can git branch --all , shows me both local , remote branches, it's not useful in showing me relationships between them. how list branches in way shows local branch tracking remote? very porcelain command, not if want scripting: git branch -vv # doubly verbose! note git 1.8.3, upstream branch displayed in blue (see " what branch tracking (if anything) in git? ") if want clean output, see arcresu's answer - uses porcelain command don't believe existed @ time wrote answer, it's bit more concise , works branches configured rebase, not merge.

curl - Git post-receive hook not working -

my setup windows xampp server, curl enabled, , git , hudson installed. hudson polls git every minute changes, , if finds them, creates build. use build testing server. works fine. i set post-receive hook on central remote repository runs force build function of hudson. i've created post-receive file called "post-receive" in hooks directory in central git repository, 1 pushed developers' local branches. each push own branch on central repository. want run post-receive build after every push, instead of having hudson poll git every minute. when open shell remote server , run "post-receive" in hooks folder, runs. isn't being called when people push local repository copies central one. maybe i'm not explaining right, it's how understand git. the post-receive code 2 lines: #!/bin/sh curl http://myserver.com:8080/hudson/job/myjobname/build?token=mytoken again, when open shell , run this, works, when pushes it, nothing happens, until m

objective c - Display NSImage on a CALayer -

i've been trying display nsimage on calayer. realised need convert cgimage apparently, display it... i have code doesn't seem working calayer *layer = [calayer layer]; nsimage *findericon = [[nsworkspace sharedworkspace] iconforfiletype:nsfiletypeforhfstypecode(kfindericon)]; [findericon setsize:(nssize){ 128.0f, 128.0f }]; cgimagesourceref source; source = cgimagesourcecreatewithdata((cfdataref)findericon, null); cgimageref finalicon = cgimagesourcecreateimageatindex(source, 0, null); layer.bounds = cgrectmake(128.0f, 128.0f, 4, 4); layer.position = cgpointmake(128.0f, 128.0f); layer.contents = finalicon; // insert layer root layer [mainlayer addsublayer:layer]; why? how can work? from comments: actually, if you're on 10.6, can set calayer's contents nsimage rather cgimageref... if you're on os x 10.6 or later, take @ nsimage 's cgimageforproposedrect:context:hints: method. if you'r