Posts

Showing posts from August, 2013

uilabel - iPhone Problem with custom cell -

i try code it's mistake because have repetition of title , description... can me please? - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; customcell *cell=(customcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if(cell==nil){ cell=[[[customcell alloc]initwithframe:cgrectzero reuseidentifier:cellidentifier]autorelease]; cell.accessorytype = uitableviewcellaccessorynone; } else{ asyncimageview* oldimage = (asyncimageview*) [cell.contentview viewwithtag:999]; [oldimage removefromsuperview]; } nsstring *mediaurl = [[[[self rssparser]rssitems]objectatindex:indexpath.row]mediaurl]; nsstring *noimage=@"http://www.notizie-informatiche.com/wp-content/themes/arthemia/images/imagelogo.png"; if([mediaurl isequaltostring:noimage] == false){ //disegno il frame per l'immagine cgrect frameimmagine; frameimmagine.s...

automation - Get the word under the mouse cursor in Windows -

greetings everyone, a friend , discussing possibility of new project: translation program pop translation whenever hover on word in control, static, non-editable ones. know there many browser plugins sort of thing on webpages; we're thinking how system-wide (on windows). of course, key difficulty figuring out word user hovering over. i'm aware of msaa , automation, far can tell, things allow entire contents of control, not specific word mouse over. i stumbled upon (proprietary) application pretty want do: http://www.gettranslateit.com/ somehow able exact word user hovering on in application (it seems have trouble in few apps, notably windows explorer). grabs text out of custom-drawn controls, somehow. @ first thought must using ocr. when shrink font far down text becomes unreadable blob, can still recognize words perfectly. (and yet, doesn't recognize if change font wingdings. maybe that's design?) any ideas how it's achieving seemingly impossi...

ruby - Cannot load 'paperclip/storage/ftp' when using paperclipftp in Rails 3 -

i've installed paperclip 2.3.3 , paperclipftp 0.1.0. paperclip working fine, attachments saving , great. enter paperclipftp. i've included both gems in gemfile, installed bundle , made sure dependencies satisfied. i've double checked ftp info correct , server working fine. when try attach file using ftp: has_attached_file :photo, :styles => { :small => "204x159#", :original => "460x370#" }, :storage => :ftp, :path => "/:attachment/:attachment/:id/:style/:filename", :url => "http://kickassserver.com/_myfolder/:attachment/:attachment/:id/:style/:filename" i following error: paperclip::storagemethodnotfound in setupscontroller#create cannot load 'paperclip/storage/ftp' i'm thinking paperclipftp isn't being loaded app. there way can check see it's being loaded, or has else experienced this? thanks, matt i have ruby 1.9.2p180 , pr...

asp.net mvc 2 - Is it possible to restrict windows authenticated users in an ASPNet app to specific domains? -

i'm in process of pulling classic asp app mvc2. i'll deploying intranet , have been asked enable support windows authentication. network i'll deploying has few ad domains , i'll need integrate 1 in particular. possible use windows authentication , allow authentication within particular domain? along same lines, it's not uncommon user have account in multiple domains (the account names typically different) - in event user logs in "unsupported" domain i'd kick them login form. possible using windows auth or better off looking alternative? pro tip: whatever don't implement windows authentication via iis. have forms authentication page in mvc app use ldap authentication provider. way avoid differences between how browsers implement windows authentication (only works in ie , that's not great reason).

Camera.Parameters.FLASH_MODE_TORCH replacement for Android 2.1 -

i trying write app requires led flash go torch mode. problem is, android 2.1 not support mode , therefore cannot support platform yet. wouldn't issue, writing fiance , epic 4g has 2.1 right now. found code samples use undocumented api calls , therefore work on motorola droid , such, not work on epic. have suggestions on find code should me working? i'm finding torch mode working fine on 2.1 had same problem samsung epic , found hack around it. looking @ params returned camera.getparameters() when run on samsung epic, noticed flash-modes claims support are: flash-mode-values=off,on,auto; torch-mode not listed, implying it's not supported. however, found model still accept mode , turn led on! bad news when later setting flash-mode auto or off left led still lit! not turn off until call camera.release(). i guess that's why samsung dont include in list of supported!?! so...the method use toggle torch in camerahelper class is... /*** * attempts ...

Right Arrow meanings in Scala -

in chapter 9 of programming in scala, there example method this: def twice(op: double => double, x: double) = op(op(x)) the author said in book: the type of op in example double => double, means function takes 1 double argument , returns double. i don't understand "double => doulbe" here, in previous chapters, "=>" appears means function literal, , never wrote "type => type", because according scala function literal syntax defination, right part of function literal function body, how can function body "double" ? because has 2 usages. first, use => define function literal. scala> val fun = (x: double) => x * 2 fun: (double) => double = <function1> scala> fun (2.5) res0: double = 5.0 it's pretty easy. question here is, type fun is? "function takes double argument , return double", right? so how annotate fun type? (double) => (double) . well, previous e...

how to update certain parts of text file in java -

i want able update line on text file. error cannot delete file, why error? public class main { public static void main(string[] args) { main rlf = new main(); rlf.removelinefromfile("f:\\text.txt", "bbb"); } public void removelinefromfile(string file, string linetoremove) { try { file infile = new file(file); if (!infile.isfile()) { system.out.println("parameter not existing file"); return; } //construct new file later renamed original filename. file tempfile = new file(infile.getabsolutepath() + ".tmp"); bufferedreader br = new bufferedreader(new filereader(file)); printwriter pw = new printwriter(new filewriter(tempfile)); string line = null; //read original file , write new //unless content matches data removed. while ((line = br.readl...

wildcard - Create rule in makefile for just a set of files -

i writing makefile, , want use generic rule wildcards, like %: bkp/% cp $< $@ but wanted rule valid few specific files. wanted define variable list, example file_list = foo.c bar.c zzz.c and configure rule valid files listed in variable. how do that? you want static pattern rule : file_list = foo.c bar.c zzz.c $(file_list): %: bkp/% cp $< $@ the syntax similar implicit pattern rule using. , yes, it's safer (more predictable).

Rails 3 - Referencing the URL to determine if a Nav Item is class="selected" -

the app can have following urls: /projects/ /projects/3 /projects/3/photos /projects/3/photos/312 i'd know how in rails 3 can @ current url , know of lines above active, can add class="selected" additional exmaple.. if user's browser on: /projects and nav looks like projects - photos - files projects active but if user's browser on: /files projects active and files active (they both apply). ideas? thanks there access params hash, can check params[:controller] or params[:action] anywhere in views. there request.env['path_info'], complete url stored well. as breadcrumb referenced in second part of question, believe there no general way of doing it. there no solid background behind relations between views. site logic constructed across views, there no solid way of determining it. since have files underneath project in particular view, problem? can't highlight project if files selected? edit: implementa...

lisp - capturing cl-fad:walk-directory output for finding files -

i've wrestled hours i'm trying write find file function similar unix command. long , short of boils down not understanding why can't return proper value cl-fad:walk-directory function list (cl-fad here http://weitz.de/cl-fad/ ). i'm trying this: (cl-fad:walk-directory "/tmp/" #'(lambda (file) (format nil "~a" file)))) but '; no value' repl. below substituting 'format nil'... (cl-fad:walk-directory "/tmp/" #'(lambda (file) (format t "~a" file))) prints out files in /tmp/ directory (and below) stdout. haven't been able collect output list. i've tried below no success. (loop f in (cl-fad:walk-directory "/tmp/" #'(lambda (file) (format t "~a" file))) collect (list f))) the walk function doesn't collect return values mapcar, applies. you'll need save output somewhere, perhaps appending global list or stack. ...

java facebook webapp create event date timezone -

java fb api creating facebook web application, create following required params. http://developers.facebook.com/docs/reference/rest/events.create problem start_time , end_time . just assume have date objects without timezone. date startdate = new date(); date enddate = new date(); can guide me how convert require fb format. note: start_time , end_time times input event creator, converted utc after assuming in pacific time (daylight savings or standard, depending on date of event), converted unix epoch time. i believe need convert seconds milliseconds. startdate = (int) (system.currenttimemillis() / 1000l); enddate = startdate + (1*60*60*24); where (1*60*60*24) = 1 day, replace length of event. from results, offset (if required) can worked out , added startdate creation.

vb.net - Windows Forms TableLayoutPanel 2 Rows use all space -

i want tablelayoutpanel 2 rows. second row 200px high. first row rest. if resize, first row resizes. how implement? anchor tlp bottom. click tasks glyph (upper right corner), edit rows , columns, show = rows, select 2nd row , change size type absolute. also note don't need tlp this. use regular panel , dock or anchor controls bottom.

ivalueconverter - WPF BoolToBrushConverter with 4 values and 4 Brushes to return? -

i bind textbox`s brush property isvalid dependency property in usercontrol booltobrushconverter. isvalid need 4 states because need 4 different brushes return converter. there way using strings? instead of bool, work? sure. can convert whatever want whatever want. need implement way how converted. however, if number of states limited 4, suggest using enum instead of strings because makes safer regarding refactoring etc. something should work: internal enum state { state1, state2, state3, state4 } // ... public void convert(object value, ...) { if (value state) { state state = (state)value; switch(state) { case state.state1: return mybrush1; case state.state2: return mybrush2; case state.state3: return mybrush3; case state.state4: return mybrush4; } } return defaultbrush; } btw: depending on scenario...

gtkmm - How to fill Gtk::TreeModelColumn with a large dataset without locking up the application -

i need fill in large (maybe not - several thousands of entries) dataset gtk::treemodelcolumn. how do without locking application. safe put processing separate thread? parts of application have protect lock then? gtk::treemodelcolumn class, or gtk::treeview widget placed in, or maybe surrounding frame or window? there 2 general approaches take. (disclaimer: i've tried provide example code, use gtkmm - i'm more familiar gtk in c. principles remain same, however.) one use idle function - runs whenever nothing's happening in gui. best results, small amount of calculation in idle function, adding 1 item treeview. if return true idle function, called again whenever there more processing time available. if return false , not called again. part idle functions don't have lock anything. can define idle function this: bool fill_column(gtk::treemodelcolumn* column) { // add item column return !column_is_full(); } then start process this: glib::signal_...

java - Spring 3 - Petclinic - ${owner.new} invalid expression in Tomcat 7 -

i have deployed petclinic code spring 3 svn samples repository in tomcat7 , following exception: internal error root cause is: /web-inf/jsp/owners/form.jsp(4,1) "${owner.new}" contains invalid expression(s): javax.el.elexception: [new] not valid java identifier org.apache.jasper.jasperexception: /web-inf/jsp/owners/form.jsp(4,1) "${owner.new}" contains invalid expression(s): javax.el.elexception: [new] not valid java identifier this expression resolves in springsource tc server developer edition 2.0. any ideas why tomcat 7.0.2 has problem it? bozho has ever reported bug: 50147 - static not valid identifier . it boils down to: the important part discussion on page 21 (of el specification). identifier ::= java language identifier java language identifier defined java language specification (jls). identifiers specified in chapter 3.8 of jls indeed confirms identifiers may not keyword. per bug report, need access follows inste...

javascript - Regular expression for url matching -

Image
i have text field have value http://localhost/send/test.php?s/?a=1&o=2 . 3 text boxes . if enter 3 values above url change http://localhost/send/test.php?s/?a=1&o=2&s1=a&s2=b&s3=c . value s1,s2 , s3 not save anywhere . question how check value s1 set ? , how can update value of s1 if change textbox value s1 you can replace using regex url.replace(/&s1=([^$]+|[^&]+)/i, "&s1=newvalue");

Why do we need Deque data structures in the real world? -

can give me example of situation deque data structure needed? note - please don't explain deque is? when modeling kind of real-world waiting line: entities (bits, people, cars, words, particles, whatever) arrive frequency end of line , serviced @ different frequency @ beginning of line. while waiting entities may decide leave line.... etc. point need "fast access" insert/deletes @ both ends of line, hence deque.

Drupal frontend-specific language -

i've installed , configured drupal project in english frontend of site should in dutch. wondering if it's possible configure frontend specific translations. error messages etc. of website (in frontend) should in dutch. if want run site single language, need install , enable it. parts of translation might not completed, might need work 100% translated site. if want run english or language in admin, there module that .

How to redirect to a specific page on successful sign up using rails devise gem? -

how redirect specific page on successful sign using rails devise gem? this page you: http://github.com/plataformatec/devise/wiki/how-to:-redirect-to-a-specific-page-on-successful-sign-in

The benefits of using an object relational database such as Oracle/PostrgreSQL vs a regular Relational database? -

i'm curious major pros/cons of using object relational database on regular relational database are? in circumstances more practical, , object relational databases future? if using orm database, might find easier program interface fetching data (e.g. no need developing special db software layer), there additional overhead since orm generate lot of different methods such rails' activerecord find_by_... . data underneath still stored in relational db. with relational db, advantage is better geared specific problem, data access layer have minimum neccessary functions retrieving stuff. cons need build own db access layer , having produce er diagram future reference , updates db. personally, prefer relational db projects.

android - Is there an easy way to strike through text in an app widget? -

i wondering if there easy way strike text within app widget in android. in normal activity, pretty easy, using textview flags: textview.setpaintflags(textview.getpaintflags() | paint.strike_thru_text_flag); but since in app widget, can use remoteviews... not know if possible anyone know this? thanks! you can use this: remoteviews.setint(r.id.yourtextview, "setpaintflags", paint.strike_thru_text_flag | paint.anti_alias_flag); of course can add other flags android.graphics.paint class.

Drupal Views exposed filter of Author name as a drop down -

this follow question drupal views exposed filter of author name . following question answered , works. can filter view user name. user name entered entered typing in box , box auto completes. rather doing list of users drop down. need 1 user selected. know if possible? you'll need custom module that. i've done drupal 7 way: create module, say, views_more_filters , have views_more_filters.info file this: name = views more filters description = additional filters views. core = 7.x files[] = views_more_filters_handler_filter_author_select.inc files[] = views_more_filters.views.inc (file views_more_filters_handler_filter_author_select.inc contain our filter handler). a basic views_more_filters.module file: <?php /** * implements of hook_views_api(). */ function views_more_filters_views_api() { return array('api' => 3); } then define filter in views_more_filters.views.inc : <?php /** * implements of hook_views_data(). */ function...

Fatal error: Allowed memory size of 419430400 bytes exhausted (tried to allocate 251268854 bytes) in /home/apartmen/php/HTTP/Request.php on line 1012 -

ok, know how question has been asked , all. but, heres thing. i'm using ini_set('memory_limit', '400m'); the file i'm trying transfer (to amazon s3) 245mb the error msg weird, says allowed mem of 400mb exhausted when trying allocate 239mb.. isnt other way round? the script i'm using library out there, communicate amazon s3 help please! edit ok heres code, can see i'm not doing much, script i'm using.. here: http://belgo.org/backup_and_restore_to_amazo.html ini_set('memory_limit', '400m'); require 'lib/s3backup.php'; $bucket = 'thebucketname'; $bucket_dir = 'apts'; $local_dir = "/home/apartmen/public_html/transfer/t/tr"; $s3_backup = new s3_backup; $s3_backup->upload_dir( $bucket, $bucket_dir, $local_dir ); "allowed mem of 400mb exhausted when trying allocate 239mb.." means php trying allocate additional 239mb of memory (when added memory allocated script) pushe...

xml - set size of image with xsl -

i have xml contains img tag <xml> <img src="/path/to/file.jpg" orginalwidth="150" /> </xml> i want have: <img src="/paht/to/file.jpg" size=size /> where size minimum of orginalsize , 100px this transformation : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:param name="pmaxsize" select="100"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="@orginalwidth"> <xsl:attribute name="size"> <xsl:value-of select=".*not(. > $pmaxsize) + $pmaxsize*(. > $pmaxsize)"/> <xsl:text>px</xsl:text> </xsl:attribute> </xsl:templa...

php - Convert special characters to HTML character codes -

i'm developing cms customer , needs edit stuff , use special characters such ç , ® . however, don't want him have enter character codes &reg; . knows way automatically convert characters using php? you can use htmlentities() that. php -r 'echo htmlentities("®Ã§", ent_compat, "utf-8"), "\n";' &reg;&ccedil; to turn entities readable text, use html_entity_decode(): php -r 'echo html_entity_decode("&reg;&ccedil;", ent_compat, "utf-8"), "\n";' ®Ã§ if you're not using unicode, omit charset name or give correct charset.

build process - What's an easy way to detect modified files in a Git workspace? -

during make, create string fields embedded in linked output. useful. other complex sed / grep parsing of git status command, how can determine if files in workspace have been modified according git ? git ls-files -m to find have browsed through git -a .

nlp - Stop-word elimination and stemmer in python -

i have large document , want stop-word elimination , stemming on words of document python. know of shelf package these? if not code fast enough large documents welcome. thanks nltk supports this.

c# - .NET Memory usage by module -

i have silverlight application , using wcf communicate backend sql server using entity framework. i want know portion of application using memory. tools can use uncovering memory usage? clr profiler - excellent free tool - can used generically .net application have never used silverlight before cant comment ui part. red gate's ants memory profiler - excellent paid tool including support silverlight. have used ants profiler in multiple asp.net projects including wcf services , have found easy use , worth money paid it.

asp.net mvc - Mvc .net Session Expiration issue -

hi working on mvc.net. in application have done after 15mnts have displayed popup on screen warn session expire. , if user click on "ok" button async request sent server refresh session. not refreshing session. reason? can body has idea handle this? it if post code you're using (to send async request, , code runs on server side). as shot in dark, if you're using sort of web service, might need explicitly turn on session support, eg: [webmethod(enablesession=true)] public void ping() { }

iphone - Using Current Location from Location Manager in a Google Maps openURL? -

been looking while today can't seem head around how users current location google maps url open google maps app directions populated. i've taken code tutorial , added app. need "start" lat/lng below ibaction open google maps app. - (void)locationupdate:(cllocation *)location { // lat/lng of user (needs sent ibaction btndirections) cllocationcoordinate2d start = { location.coordinate.latitude, location.coordinate.longitude }; } the below ibaction "get directions" button. - (ibaction) onbuttonclick:(id) sender { if(sender == btndirections) { cllocationcoordinate2d destination = { 52.48306771095311, -1.8935537338256836 }; nsstring *googlemapsurlstring = [nsstring stringwithformat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", newlocation.coordinate.latitude, newlocation.coordinate.longitude, destination.latitude, destination.longitude]; ...

jquery autocomplete plugin - options list won't close after it's been scrolled - Chrome only -

i'm using jquery autocomplete plugin (http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) , it's fine in firefox i'm having problem in chrome. list of options appears longer can displayed @ once has scrollbar down side. once have scrolled list scrollbar, list no longer closes when click outside of it. i'm stumped - can tell me how can fix or diagnose why it's not closing? cheers, max edit - same issue can seen in autocomplete demo on page: http://jquery.bassistance.de/autocomplete/demo/ both of these cases chrome (6.0.472.62 beta in linux, seen in windows). case 1 - working normally: type 'a' in first input. see list appear. move mouse down 'adelphi'. move mouse sideways out of list - "adelphi" should still highlighted. click on blank part of page- list disappear. case 1 - broken: type 'a' in first input. see list appear. scroll list down till "amsterdam" visible. move mouse down ...

java - Why does ScheduledExecutorService not expose methods to run at a particular time -

if want schedule @ recurring task aligned specific date make sense use scheduledexecutorservice . has no method pass in firstrundate + subsequent delay scheduleatfixedrate method. know can out initial delay myself there reason isn't provided api? internally ses implemented using triggertimes (which want pass in). based on documentation: all schedule methods accept relative delays , periods arguments, not absolute times or dates. simple matter transform absolute time represented date required form. example, schedule @ future date, can use: schedule(task, date.gettime() - system.currenttimemillis(), timeunit.milliseconds). beware expiration of relative delay need not coincide current date @ task enabled due network time synchronization protocols, clock drift, or other factors. it looks if deseign decision. known date class has problems. example timetask's public void scheduleatfixedrate(timertask task, date firsttime, long period) not account day light...

flex - Data Grid not displaying data in array collection -

my data grid displaying stale data, rather real time data available in it's data provider (array collection). i've tried refeshing data in collection, has no effect. below code, see problem? <mx:accordion/> <fx:script> <![cdata[ private var _griddata:arraycollecton = new arraycollection; [bindable] public function griddata():arraycollection { return _griddata; } public function set griddata(value:arraycollection):void { _griddata = value; } public function loadgriddata():void { // imgcollection data returned server var tempcollection:arraycollection = new arraycollection(); (var i:int = 0; < imgcollection.length; i++) { var img:object = new object(); img.id = imgcollection.getitemat(i).imgid; img.url = "http://..." + imgcollection.getitemat(i).imgid; img.caption = (imgcollection.getitemat(i).imgcaption == null) ? "": imgcollection.getitemat(i).imgcaption; ...

C: How does nested braces for array of struct initialization work? -

struct mystruct s[10] = {{0}}; this appears initialize array of structs 0. how nested braces syntax work? any fields not specified initialized zero. here have array of structs. you're initializing first element of array structure initializer initializes first element of structure zero. rest of first structure , rest of array elements 0 too. it's nice idiom.

How to search "tags" in MySQL? -

if have table on db called product_tags 2 fields: tag_id , tag_name here schema: create table `product_tags` ( `tag_id` int(11) not null auto_increment, `tag_name` varchar(255) not null, primary key (`tag_id`), unique key `tag_name` (`tag_name`) ) engine=myisam auto_increment=84 default charset=utf8 say here tags in it: yellow gold yellow diamond white gold rose gold band diamond blue diamond pink diamond black diamond and want search on string " yellow gold diamond band " i want pull following tags: yellow gold band diamond because tags in string. yellow , diamond both in string not yellow diamond tag should ignored. -additionally if possible if did search " yellow gold blue diamond band " i want pull following tags: yellow gold band blue diamond the diamond tag ignored because blue diamond tag match. how can this? edit: select * product_tags p instr('yellow gold diamond band...

Ruby: Split binary data -

i want split data chunks of let's 8154 byte: data = zlib::deflate.deflate(some_very_long_string) what best way that? i tried use this: chunks = data.scan /.{1,8154}/ ...but data lost! data had size of 11682, when looping through every chunk , summing size ended total size of 11677. 5 bytes lost! why? regexps not way parse binary data. use bytes , each_slice operate bytes. , use pack 'c*' convert them strings output or debug: irb> data = file.open("sample.gif", "rb", &:read) => "gif89a\r\x00\r........." irb> data.bytes.each_slice(10){ |slice| p slice, slice.pack("c*") } [71, 73, 70, 56, 57, 97, 13, 0, 13, 0] "gif89a\r\x00\r\x00" [247, 0, 0, 0, 0, 0, 0, 0, 51, 0] "\xf7\x00\x00\x00\x00\x00\x00\x003\x00" ...........

c++ - convert a console app to a windows app -

(its long story) have large complex project file containing windows program. unfortunately project built console app. program compiles , links ok when runs brings console instead of collection of windows hoping for. looked @ command line , saw "/subsystem:console" whereas should "/subsystem:windows". have no idea how change command line. there box can tick in project setting somewhere make change? right-click project, properties, linker, system, change subsystem setting. you'll have change main() method winmain(). , you'd better create windows or there won't at.

Validate/clean a FileField on a non-model form in Django? -

i'm trying validate filefield extension type. i'm having trouble getting clean method field pickup posted value. from django.forms.forms import form django.forms.fields import filefield django.forms.util import validationerror class testform(form): file = filefield(required=false) def clean_file(self): value = self.cleaned_data["file"] print "clean_file value: %s" % value return none @localhost def test_forms(request): form = testform() if request.method == "post": form = testform(request.post) if form.is_valid(): print "form valid" return render_to_response("test/form.html", requestcontext(request, locals())) when run code, i'm getting following output: clean_file value: none form valid in other words, clean_file method not able file data. likewise, if returns none, form still valid. here form html: <form e...

python - Specify Framework Version on OSX -

i compiling program embeds python, in particular python v3.1. on system have several versions of python framework: 3.1, 2.5, 2.6. when pass "-framework python" g++ when compiling, g++ seems pull in version 2.6 (lives @ "/system/library/frameworks/") instead of version 3.1 (lives @ "/library/frameworks/"), resulting in error. both paths in framework search path, evident attempting same compilation in verbose mode (passing in -v g++). although seem simple thing, have not been able find mention of in documentation g++, ld or xcode. currently, accomplish successful compilation moving /system/library/frameworks/python.framework /system/library/frameworks/python.framework.moved, un ugly, temporary solution. so, know best way of resolving issue? in particular, able compile program against correct version of python framework, regardless of other versions installed on system. thanks. try first changing current symlink in python framework in /lib...

oop - Why protected and private attributes are accessible by same class rather than by the same object? -

for example, have class man if man.age protected, don't see why chucknorris (instance of class man ) can change protected/private attribute age of object jackbauer (another instance of class man ). shouldn't able (imo). in mind, value of protected/private attribute supposed belong object itself, not class ... i need explanation think, i'm confused. matthieu right. cucknorris can jackbauer.age but there no problem on that. if referencing man instance attributes inside man, means coding man class, know doing. the problem if pass me man class , access man attributes out knowing how man class coded. setters , getters may doing business logic don't know , don't need know. 1 coded mam know.

jquery - JavaScript opacity Anti-aliasing bug in Internet Explorer -

i have encountered annoying bug internet explorer on javascript animation made. have greyscale image of city skyline fades opacity 0, revealing full-color skyline. it looks great in other browsers, ie reveals artifacts. friend told me because of weird bug animating opacity javascript in ie. anti-aliasing , assumed black background? don't know. easiest fix - change images gifs. since you're city image doesn't have gradients, advantage of alpha channel support in png format not need. should work way ie6.

objective c - Make my Cocoa app respond to the keyboard play/pause key? -

is there way make app respond play/pause button on mac? edit: using suggested code,i console message: could not connect action buttonpressed: target of class nsapplication why be? i accomplished in own application subclassing nsapplication (and setting app's principal class subclass). catches seek , play/pause keys , translates them specific actions in app delegate. relevant lines: #import <iokit/hidsystem/ev_keymap.h> - (void)sendevent:(nsevent *)event { // catch media key events if ([event type] == nssystemdefined && [event subtype] == 8) { int keycode = (([event data1] & 0xffff0000) >> 16); int keyflags = ([event data1] & 0x0000ffff); int keystate = (((keyflags & 0xff00) >> 8)) == 0xa; // process media key event , return [self mediakeyevent:keycode state:keystate]; return; } // continue on super [super sendevent:event]; } - (void)mediakey...

WaveFront OBJ converted from LightWave taking forever to render on iPhone -

i'm working on project need render 3d human body on ios device. 3d object built in adobe lightwave , 7.4mb. opened in blender , exported obj/mtl pair 5.5mb , 4kb, respectively. using jeff lamarche's wavefront loader (linked below) starting point figure out opengl es , check out performance , whatnot, stuck object in there (in place of obj/mtl pair he'd been using) , ran in simulator. of course, crash on startup, decided performselectorinbackground it. half hour later, it's still loading. i'm guessing file way detailed draw kind of performance expectation on device 600mhz processor. there way lower quality these files easily? or, if performance issues have arisen particular loader, enlighten me? thanks, will http://iphonedevelopment.blogspot.com/2009/03/wavefront-obj-loader-open-sourced-to.html will, i don't know if can solve problem, may able point in right direction. did project client loading 3d model exported blender using sio2 3d engine...

Android: onPrepareDialogBuilder, onClick & setItemChecked -

i've spent on week trying figure out way limited multi selection preference list. nothing i've tried works. i'm ready give on android if seemingly simple hard. i've been programming long time , don't remember being beaten badly this. have assume not understanding basic. hope can point me in right direction. here simplest code can think off should work. not clear checkbox when setting false, i've tried true well. why doesn't work? if not work, will? any appreciated. @override protected void onpreparedialogbuilder(builder builder) { charsequence[] entries = getentries(); charsequence[] entryvalues = getentryvalues(); if (entries == null || entryvalues == null || entries.length != entryvalues.length ) { throw new illegalstateexception( "listpreference requires entries array , entryvalues array both same length"); } // added wjt since loading entries values after...

vba - Excel summary of many excel files data into one report excel -

i have number of excel files containing filled survery, have 1 master document have summary result of each. thus imaging have each file row input: name - address - data... i open each of files, , copy data selected cells master file. i have figured out can create invisible instance of excel, not shown user. how can copy/paste data assume a1 sheet? sub combine() fpath = "c:\test\" fname = dir(fpath & "*.xls") dim xl excel.application set xl = createobject("excel.application") xl.visible = false dim w workbook dim remotebook workbook set remotebook = xl.workbooks.open(fpath & fname) xl.quit end sub i new in vba, access way seems quite complicated, there easier way values excel files? realy wish have simple solution. what more annoying vba macros in survey files can disable on openning user not prompted? thanks! those @ least 4 questions in one, let's see can :-) first, there no need create ...

shell - How do I list one filename per output line in Linux? -

i'm using ls -a command file names in directory, output in single line. like this: . .. .bash_history .ssh updator_error_log.txt is there built-in alternative filenames, each on new line, this: . .. .bash_history .ssh updator_error_log.txt use man ls see if ls supports -1 option (that "one" digit, not lowercase letter "l" - @slashmais), e.g. http://docs.oracle.com/cd/e19082-01/819-2239/6n4hsf6oc/index.html ... -1 prints 1 entry per line of output. gnu/linux's ls support it, use: ls -1a

php - Codeigniter: Compare a MySql Datetime with Current Date -

i need compare mysql datetime current time, datediff show messange if mysql datetime, less 30 days today. i'm using codeigniter, , tried lot of helpers, , lots of thing, can't work. some people says better save in database timespan, don't know wich 1 best aproach. thanks in advance! edit: i'm looking ci code, or mysql code, or both, work. doesn't matter current date (could mysql or server time). also, have needed code on view, , controller, need model code it, or mysql code select datediff(curdate(),your_mysql_date_field) your_table

bash - How can you redirect a script's output through a process? -

i want redirect bash script's output through logging program. specifically, apache's logrotate utility. redirection needs set within script itself. if redirection done on command line, while executing script, this: myscript | logrotate -l $logfile.%f 86400 2>&1 here pseudo-code goes inside script accomplish output redirection, not work: exec >(logrotate -l $logfile.log.%f 86400) 2>&1 you can using named pipe. pipe=/var/run/myscript/pipe mkfifo "$pipe" logrotate -l "$logfile.%f" 86400 < "$pipe" & exec > "$pipe" also, regarding 2>&1 redirection -- make sure understand applied. in first example it's applied logrotate, while in second "example" applied script.

c# - How to Log Console Screen into a Text File? -

possible duplicate: mirroring console output file i've console application in c# , want log text file every text appears on screen. how ? unfortunately thread closed despite of comment mirroring console output file . accepted post answer thread not correct. why cannot ask question again? i'm using console interactively , want copy of text on console in text file. sos c:\>yourconsoleapp.exe > yourtextfile.txt edit: assumes console app requires no user input.

Getting frame width of UIPickerView -

how frame width dimensions of uipickerview? need calc total view width - frame width on both left , right sides of uipickerview. in other words, view.frame.size.width or view.bounds.size.width minus widths of both left , right sides of picker.

winforms - Chemical symbol support on a textbox -

i developing application needs kind of subscript , superscript support display text refers chemical formula, if in textbox (winforms) , want example show water formula, appear h20 rather h(subscript 2)o (sorry coudn't find how here). how done? thanks. run windows charmap.exe applet. tick advanced view checkbox , in search box type "two". should see "subscript two" glyph, unicode codepoint '\u2082'. click select , copy. switch code or properties window , type "h" + ctrl+v + "o" "h₂o".

sql - MySQL's now() +1 day -

i'm using now() in mysql query. insert table set data = '$data', date = now() but want add 1 day date (so date should contain tomorrow). possible? you can use: now() + interval 1 day if interested in date, not date , time can use curdate instead of now: curdate() + interval 1 day

64bit - Io does not compile on Mac OS X Snow Leopard -

i followed instructions in readme, simple cd build cmake .. make install the problem occurs after make install command. io not compile, because of module cffi. ld complains libffi.dylib not 64-bit, , won't link .o files, , because of that, complains or symbol not defined, etc. ld: warning: in /opt/local/lib/libffi.dylib, file built i386 not architecture being linked (x86_64) how can solve this? there way compile io in 32-bit, passing parameters make, cmake or editing file? makefile has entry cffi addon. delete it? can 64-bit libcffi? library provides api access lower-level function calls higher level languages, i+m not sure replacing 32-bit 1 64-bit one, may break macruby or other stuff. able build cffi , possible addons may work in system, able more stuff: interested in objective-c bindings, guess may require cffi. on mac, can compile 32-bit setting cmake_osx_architectures = i386 in cmake cache. run "cmake-gui ." in build tree, , change cmake_osx_a...

jquery find previous li and change css -

i'm trying write script allow me change css of previous li on hover. here's structure: <ul id="mainlevel"> <li><a href="/" class="mainlevel" id="active_menu">home</a></li> <li><a href="/" class="mainlevel">about us</a></li> <li><a href="/" class="mainlevel">products</a></li> <li><a href="/" class="mainlevel">projects</a></li> <li><a href="/" class="mainlevel">suppliers</a></li> </ul> here's have far: jquery("#mainlevel li a").hover(function() { jquery(this).prev("li a").css("background", "#f0f"); }); but it's not working.. appreciated :) the following seems work: $(document).ready( function() { $('li a').hover( function(){ ...

64bit - Is there a way to install windows server 2003 x64 over a VM? -

i have been trying install produces error saying processor not compatible x64. tried vmware player , microsoft virtual pc. read disabling virualization it's not working. by enabling virtualization bios setup of main machine worked! problem installing x64 guest os vmware server

PHP Editor in Linux -

possible duplicate: php editors ubuntu hi friends i'm have installed ubuntu in pc php development , dont want switch windows , problem wont able fine php editor linux dreamweaver in windows there application can use in linux (ubuntu) please let answer me possible. you can install eclipse , netbeans

algorithm - Determine if two chess positions are equal -

i'm debugging transposition table chess variant engine pieces can placed (ie. not on board) . need know how i'm hitting key collisions. i'm saving piece list in each table index, along usual hash data. simple solution determining if 2 positions equal failing on transpositions because i'm linearly comparing 2 piece lists. please not suggest should storing board-centric instead of piece-centric . have store piece list because of unique nature of placable , captured pieces. pieces in states occupying overlapping , position-less location. please @ description of how pieces stored . // [piece list] // // contents: location of pieces. // values 0-63 board indexes; -2 dead; -1 placeable // structure: black pieces @ indexes 0-15 // white pieces @ indexes 16-31 // within each set of colors pieces arranged following: // 8 pawns, 2 knights, 2 bishops, 2 rooks, 1 queen, 1 king // example: piece[15] = 6 means black king on board in...

routing - Rails newbie: How to add routes to a rails 3 engine? -

i'm trying write first rails 3 gem - works well, except routes - can't seem them working. it's possible simple error - mentioned, it's first experience engines. gem very, basic - literally 1 scaffold my gem's config/routes file: class actioncontroller::routing::routeset resources :frogs end ...and when try start server, following error: /home/john/.rvm/gems/ruby-1.9.2-p0/gems/cancandevise-0.1.0/config/routes.rb:3:in <class:routeset>': undefined method resources' actiondispatch::routing::routeset:class (nomethoderror) any suggestions appreciated. @ present moment, gem nothing more basic rails-generated 'frog' scaffold cheers, - jb @marcgg, believe that's syntax regular rails app, think he's talking engine. @unclaimedbaggage, engine/gem routes file should this: rails.application.routes.draw |map| resources :frogs end i made example engine touches on common setup issues encountered w...

Get LatLon from Google with Mootools Request.JSONP -

i trying fetch latlon data request google. request.jsonp request works fine , returns data perfect, @ onsucces returns 'invalid label' error. here script: var g = {} var googleurl = 'http://maps.googleapis.com/maps/api/geocode/json?address='; g.google = function(id){ var address = '500-504 w 20th st, new york, ny 10011, usa'; var thisurl = googleurl + address + '&sensor=true'; new request.google(thisurl, { onsuccess: function(data) { console.log(data); } }).send(); } request.google = new class({ extends: request.jsonp, options: {}, initialize: function(thisurl, options) { this.parent(options); this.options.url = thisurl; }, success: function(data, script) { this.parent(data, script); } }); the response looks like: { "status": "ok", "results": [ { "types": [ "street_address" ], but fir...

c# - OledbDataReader is not retriving all the colums -

hey guys i'm have little problem in retrieving data table here's code: if column in db table empty exception thrown... string cmdtext = "select member_id,disp_id,mobile_no,tm,pm,lm,due_date recharge"; string updatestatus = "",hepupdatestatus=""; oledbcommand cmdfinalupdate = new oledbcommand(cmdtext, conn); oledbdatareader updatereader = cmdfinalupdate.executereader(); if (!updatereader.hasrows) // condition creating problem messagebox.show("no data pending updation"); else { try { while (updatereader.read()) { program.memberid = convert.toint64(updatereader.getint32(0)); program.dispid = updatereader.getstring(1); program.mobile = ...

debugging - how to initialize my ldap connection like a doctrine connection in the bootstrap.php file in zend-framework -

i want use ldap server db. create persistence classes in models directory extend zend_ldap won't have write crud operations how can initialize ldap connection in bootstrap.php file e.g. database connection using doctrine can initialized this, want same ldap connection protected function _initdoctrine() { $autoloader = zend_loader_autoloader::getinstance(); $autoloader->registernamespace('doctrine'); $this->getapplication()->getautoloader() ->pushautoloader(array('doctrine', 'autoload')); spl_autoload_register(array('doctrine', 'modelsautoload')); $manager = doctrine_manager::getinstance(); $doctrineconfig = $this->getoption('doctrine'); $manager->setattribute(doctrine::attr_auto_accessor_override, true); $manager->setattribute(doctrine::attr_autoload_table_classes, true); doctrine_core::loadmodels($doctrineconfig['models_path']); $conn = doctrine_...

regex - PHP How to extract part of given string? -

i'm writing search engine site , need extract chunks of text given keyword , few words around search result list. ended that: /** * function return part of original text * searched term , few words around searched term * @param string $text original text * @param string $word searched term * @param int $maxchunks number of chunks returned * @param int $wordsaround number of words before , after searched term */ public static function searchterm($text, $word=null, $maxchunks=3, $wordsaround=3) { $word = trim($word); if(empty($word)) { return null; } $words = explode(' ', $word); // extract single words searched phrase $text = strip_tags($text); // clean text $whack = array(); // chunk buffer $cycle = 0; // successful matches counter foreach($words $word) { $match = array(); // there named parameters 'pre', 'term' , 'pos' if(pre...

c# - ASP.NET MVC - Overriding an action with differing parameters -

i have controller inherits base controller. both have edit (post) action take 2 arguments: on base controller: [httppost] public virtual actionresult edit(idtype id, formcollection form) and in derived controller: [httppost] public actionresult edit(int id, someviewmodel viewmodel) if leave exception because there ambiguous call. however, can't use override on derived action, because method signatures don't match. there can here? as addition developer art's answer workaround be: leave base method , in derived class implement base method , annotate [nonaction] [nonaction] public override actionresult edit(idtype id, formcollection form) { // nothing or throw exception } [httppost] public actionresult edit(int id, someviewmodel viewmodel) { // implementation }

Problem when #import C++ Header File in iPhone/iPad Project -

i have c++ class use in iphone/ipad project . created file in different ways (like "new file" => c++) , error same. when compile project without having #import (of .h c++ class), it's ok. but #import header file in 1 of header objective-c file, error : error: vector: no such file or directory or error: expected '=', ',', ';', 'asm' or ' attribute ' before ':' token" i tried setting different values file type (of c++ class) in file info, renaming objc class in .mm etc, doesn't seem work. so must have missed importing .h c++ class in objc header file, :p ^^ solution vlad 1°) include header c++ file : #ifdef __cplusplus #include "triangulate.h" #endif 2°) renaming objc file in .mm , in file info (right clic) setting file type sourcecode.cpp.objcpp thanks helping ! vincent note: xcode requires file names have “.mm” extension objective...

regex - Regular Expression Match for Google Analytics Goal Tracking -

i have coupon request form on every page on website, when coupon form submitted taken same page on additional "?coupon=sent" parameter added query string. able track page url wiht ?coupon=sent on end goal. currently, have this: /[^.] [.php] [\?coupon\=sent]+ which not seem doing trick. ideas? use one: /\?coupon=sent/

c# - Background operation and blocking main form -

here scenario: on form have list of direcotories, button , control display multiline text. in loop try find files in each directory , delete them. when file deleted want add text multiline control. problem when text added can not else. form blocked , if try do anytching stops responding. files deleted using backgroundworker private void backgroundworker1_dowork(object sender, doworkeventargs e) { //this datatable directories , other info maindataset.czyszczeniedatatable czyszczenie = e.argument maindataset.czyszczeniedatatable; czyscpliki(czyszczenie, reportprogress); } private void czyscpliki(maindataset.czyszczeniedatatable czyszczenie, reportprogressdel del) { directoryinfo dir = null; fileinfo[] files = null; bool subfolder = false; string katalog = ""; string maska = ""; string[] maski = null; long total=0; string dirs; string files; long filelen;...