Posts

Showing posts from September, 2010

iphone - Changes in Interface Builder are not showing in SImulator or Device -

i have view created using default buttons , background in interface builder. app runs properly. added .png background images view , buttons. build app , run , updates not show. i've tried simple changing text of button or add button , changes not propagating. i've cleaned targets, manually deleted builds in finder, , have shutdown computer. else missing? this might sounds easy - sure linked view view controller in interface builder? i've done before forget link them

iphone - NSMutableAttributedString on iOS 3.1.3 -

i'm dealing odd situation. i'm implementing attributed strings ios application, , had warning going in available ios 3.2 , above. because still support 3.1.3 on iphones, knew had weakly link coretext , compile time os check before using them. i weakly linked framework, out of curiosity used class , ran on 3.1.3 device... , works. missing here, i'm confused why isn't crashing. i'm 100% sure 3.1.3 device, nsmutableattributedstring hidden class on 3.1.3, , work because of dynamic nature of objective-c ? i author of ohattributedlabel class. using it! the behavior have strange, ohattributedlabel uses coretext framework draw nsattributedstrings on screen. as coretext available since ios 3.2, can't see how possible work under ios 3.2, ios 3.1.3…?

wordpress - lightbox not working on IE8 -

hello company bought woo theme wp , lightbox works in firefox not on ie8. i saw post here javascript related, dont want mess until guidance find issue. our site www.fiestatax.com , click on small thumbs in main page using ie appreciated sincerely,jim the images linking cmyk images, ie can't display. save them in rgb format.

optimization - Find maximum of a function -

i need find maximum of function: a1^x1 * const1 + a2^x2 * const2 +....+ ak^xk * constk = qaulity where xk>0 , xk integer. ak constant. constraint: a1^x1 * const1*func(x1) + a2^x2 * const2*func(x2) +....+ ak^xk * constk*func(xk) < budget where func discrete function: func(x) { switch(x) { case 1: return 423; case 2: return 544; ... etc } } k may big(over 1000). x less 100. best method? there techniques nelder-mead optimization (which believe gsl implements), techniques assume sort of special structure (i.e. convexity or continuity). depending on values of function, there may not exist unique optimum or optimum normal downhill method can find.

assembly - Optimizing comparison instruction count (PDP-11) -

for pdp-11, how can change following snippet of assembly it's 2 instructions, yet same work these four? tst r0 blt label cmp r0, #75 bgt label i've never worked pdp-11, have experience way testing , branching works on x86 systems, , looks may similar. on x86 instruction set, "test" instruction equivalent comparison against 0; "less than" flag set if value less 0, etc. i'm going guess #75 means numeric literal in hexadecimal -- 0x75. if assumptions correct, code have there doing 2 signed comparisons: is (signed) value of r0 less 0? is (signed) value of r0 greater 0x75? if instead treat unsigned value, -- assuming pdp-11 systems use 2's-complement encoding -- values negative become values greater or equal 0x8000 (since pdp-11 16-bit system). thus, if unsigned comparison, checking against 0x75 take care of negative values well; smallest possible value becomes 0, acceptable tests here. i'm not sure whether unsigned compar...

c# - Is there a performance degradation when we ALWAYS use nullable value types instead of value types? -

is there performance degradation when use nullable value types instead of value types? as mitch wheat pointed above, no, should not worry this. i'm going give short answer reason now, , later i'm going discover more you're asking: write code correct. profile after writing find points causing grief. when have code uses nullable , have performance reasons , profile , can't find problem yourself, then come ask how make faster. no, overhead of using nullable intents , purposes not degrading. discover more you're asking: performance surprise "as" , nullable types why shouldn't use nullable types in c# c# performance gain returning nullable type sqldatareader alternatives nullable types in c# casting (int?)null vs. new int?() - better? boxing / unboxing nullable types - why implementation? now, having read pages, hope feel more enlightened.

flash - How do I make flex only consume mouse scroll and keyboard events when it's useful, and otherwise pass it on to the browser? -

this one's been irking me while. when i'm using mouse scroll wheel scroll , down in webpage, , flash movie comes path of cursor, scroll wheel stops working. also, when flash movie has focus, can't use browser shortcuts ctrl + l or ctrl + r . i'm writing flex application , i'd find solution, @ least users aren't plagued inconsistency of user interface behavior. i should think there way tell flash propagate such events mouse scroll wheel , keyboard input browser unless occur in element useful, in flex textarea. can't find solutions out there though, nor talking it. specifically, how can make that: when user scrolling mouse, browser scrolls unless mouse on flex container scrollbar, or component wants scroll. when user presses button or combination of buttons on keyboard, propagated browser unless there active keyboard listener, or cursor in text field, etc. communication between browser , flash done via externalinterface. externalinte...

c++ - vector related memory allocation question -

i encountering following bug. i have class foo . instances of class stored in std::vector vec of class b . in class foo, creating instance of class allocating memory using new , deleting object in ~foo() . the code compiles, crash @ runtime. if disable delete my_a desstructor of class foo . code runs fine (but there going memory leak). could please explain going wrong here , suggest fix? thank you! class a{ public: a(int val); ~a(){}; int val_a; }; a::a(int val){ val_a = val; }; class foo { public: foo(); ~foo(); void createa(); a* my_a; }; foo::foo(){ createa(); }; void foo::createa(){ my_a = new a(20); }; foo::~foo(){ delete my_a; }; class b { public: vector<foo> vec; void createfoo(); b(){}; ~b(){}; }; void b::createfoo(){ vec.push_bac...

exception - What does the "Failure to marshal argument(s)" org.jboss.cache.CacheException mean? -

i following exception: org.jboss.cache.cacheexception: java.lang.runtimeexception: failure marshal argument(s) we use distributed jboss cache our web application (on tomcat) i have strong feeling due bad configuration, not sure. edit (correction): use version 3.0.0.ga of jboss cache (core) this caused "swallowed" exception ( notserializableexception ) caught , not logged nor re-thrown our code, jboss exception general , not related

visual c++ - symbol not found for new functions added in vc++ -

in vc++ added new function , when clicking on goto definition showing error symbol not found .for old functions going definitions. visual studio's intellisense stuff takes while update either a) try again in few minutes or b) build application. if build fails should update database used intellisense. if else fails, d/b might corrupted. close visual studio, find , delete <solution>.ncb file , delete it. vs rebuild , should well. usually!

arrays - multiple instances of the same object spaced out using a loop is only creating one -

i had hard time trying word question properly, i'm sorry if seems confusing. i'm using flixel library in flash builder. may not important butcause knows little more me or little as3 see i'm doing wrong. anyway, i'm trying create 10 instances of square object made. have pass x y coordinate place , works. ive tested if do: var testsquare:bgsq; testsquare = new bgsq(0,0); add(testsquare); it works fine , adds square @ 0,0 told to, want add 10 of them move next 1 that's created 25 px right (because each square 25px) my problem ever see 1 square, it's making 1 instance of still. anyone possibly have idea doing wrong? var counter:int = 0; var bgsqa:array = new array; (var ibgs:int = 0; ibgs < 10; ibgs++) { bgsqa[counter] = new bgsq(0,0); bgsqa[counter].x += 25; add(bgsqa[counter]); counter++; } there's lot you're doing wrong here. first off, you're using pseudo-iterator (counter) access array elements ...

Javascript passing and using that function -

i have: var f1 = function(a){ alert(a) } var f2 = function(data, method){ method(data) // problem here, // method f1 not called. there way call method f1? // method f1 might not in scope, method f1 can // in class or this... } f2(a, f1) the question is: there way call f1 f2, passed method? thanks edit: code write here, miss set a. anyway value of 5. edit: yes! tiny stupid error in original code missed up, set value after calling method. hehe try running javascript through debugger. you'll message a not defined because call f2(a, f1) trying pass variable named a haven't declared one. however, code work: var f1 = function(a){ alert(a); } var f2 = function(data, method){ method(data); } var = 'this a'; f2(a, f1); // results in alert('this a')

asp.net - What is the difference between AsyncPostBackTrigger & PostBackTrigger? -

what difference between asyncpostbacktrigger & postbacktrigger? controls inside updatepanel default cause partial page update, controls outside cause postback, using these triggers possible change behaviour required. from http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-asp-dotnet_ajax_extensions.ppt : asyncpostbacktrigger converts postbacks async callbacks typically used trigger updates when controls outside updatepanel post back if childrenastriggers="false", can used specify controls inside updatepanel should call rather post back postbacktrigger lets controls inside updatepanel post back. typically used allow controls post when childrenastriggers="true"

optimization - Best practices to compile an iPhone app optimizing it for maximum speed? -

i wondering people doing in order compile iphone applications optimizing them maximum speed rather size or tradeoff speed versus size. you should always, always profile code before making blanket assumptions or bad particular app. shark nice , able use hardware performance counters on device tell lots of low-level details how application running. on iphone 3gs, compiling thumb-2 doesn't incur performance penalty older thumb instruction set (it has native floating point, in particular). see this other question additional details. you can produce binaries more 1 instruction set in them , though i'm not sure if can "no thumb" arm6 (pre-iphone 3gs) , "thumb ok" arm7 (iphone 3gs, presumably ipad, don't know ipod touches) . edit: possible, brad explaining how. in many cases, optimizing size way optimize speed: squeezing code size, may fit better cpu's instruction cache, avoiding fetches memory. helps more executed tight loops.

javascript - if statement with img.src -

the problem: whenever, if have single '=' variable show , fine.. ignores if statement. if double '=='.. variable doesnt show up, , goes else state. lemme know if u see wrong. var pic1 = document.getelementbyid('team1pic').src; var win1 = document.getelementbyid('wins').innerhtml; if (pic1 == 'pens.jpg') { document.getelementbyid('wins').innerhtml = pittwins; } else { document.getelementbyid('wins').innerhtml = 'no'; } here html go along have <a class="dock-item" id="pens" href="#" onclick="document.getelementbyid('team1pic').src='pens.jpg'"><span>pittsburgh penguins</span><img src="pens.jpg" alt="pittsburgh penguins" /></a>` and <th width="35%" ><img src="" / id='team1pic'></th> i nice see html attached to. the reason single = works == ...

sharepoint - how to get authentication provider status list from IIS. For share point site? -

i need authentication provider status of web application available in iis?. ex: is basic authentication available x site?. through c# or python code try use code this: using (spsite site = new spsite("site_url_here")) { var webapp = site.webapplication; var customzonesettings = webapp.iissettings[microsoft.sharepoint.administration.spurlzone.custom]; bool usebasicforcustomzone = customzonesettings.usebasicauthentication; } here parent spwebapplication specified site , looking iissettings specified zone (because there different settings different zones). spiissettings object contains lot of properties complete task, example, usebasicauthentication.

Directly accessing the NSPopupButtonCell of an NSPopupButton (Cocoa OSX) -

i know not recommended need access nspopupbuttoncell of nspopupbutton. there way this? [mypopup cell]; kind of obvious, when think it. ;) really, tho'; nspopupbutton : nsbutton : nscontrol ; nscontrol has -[cell] , nspopupbutton too. i guess i'm trying say, is; if can't find method object looking @ must have, check superclasses. (or use text completion in xcode , few lucky guesses. ;)

image processing - How to read pixel values of a video? -

i wrote c programs image processing of bmp images, had read pixel values , process them, simple followed bmp header contents , of information of bmp image. now challenge process videos (frame frame), how can it? how able read headers of continuous streams of image frames in video clip? or else, like, example, mpeg format have universal header, upon reading can information entire video , after header, data pixels. i hope convey. has got experience processing videos? any books or links tutorials helpful. a video stream, mpeg, composed number of frames dependent (obviously) duration , frame-rate. read pixel must start called intra frame, not dependent previous frame stream. successive frame frame temporally dependent previous frame, obtain pixel, have decode stream intra frame want. note that, tipically, intra frame inserted periodically give decoder way synchronize stream. useful in context errors can occur. want isn't easy work. have use mpeg decoder , modify ...

c# - Why does VS2010 always break on exception from MethodInfo.Invoke? -

i have try/catch around methodinfo.invoke(o,null), , vs2010 set never break on exceptions, unfortunately debugger continues break inside invoked method. method static, , i've got phone developer beta installed. is bug or developer error? thx!! yes, every exception check-box un-checked breaks on these invoke exceptions. other exceptions work fine. the great news anonymous genius gave me work-around: delegate void voidtest(); voidtest test = (voidtest)delegate.createdelegate(typeof(voidtest), o, method.name); test(); these exceptions land in exception handler expected! =)

winapi - What are alternatives to Win32 PulseEvent() function? -

the documentation win32 api pulseevent() function ( kernel32.dll ) states function “… unreliable , should not used new applications. instead, use condition variables”. however, condition variables cannot used across process boundaries (named) events can. i have scenario cross-process, cross-runtime (native , managed code) in single producer has interesting make known zero or more consumers. right now, well-known named event used (and set signaled state) producer using pulseevent function when needs make known. 0 or more consumers wait on event ( waitforsingleobject()) , perform action in response. there no need two-way communication in scenario, , producer not need know if event has listeners, nor need know if event acted upon. on other hand, not want consumers ever miss events. in other words, system needs reliable – producer not need know if case or not. scenario can thought of “clock ticker” – i.e., producer provides semi-regular signal 0 or more consumers count. , consume...

iphone - i cant Load value into array -

const char *dbpath = [databasepath utf8string]; userarray = [[nsmutablearray alloc]init]; sqlite3_stmt *compiledstatement; if(sqlite3_open(dbpath, &db) == sqlite_ok) { nsstring *querysql = [nsstring stringwithformat: @"select username,fullname,email user" ]; const char *sqlstatement =[querysql utf8string]; if(sqlite3_prepare_v2(db ,sqlstatement, -1, &compiledstatement, null) == sqlite_ok) { while(sqlite3_step(compiledstatement) == sqlite_row ) { nsstring *ausername = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement, 0)]; nsstring *afullname = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement, 1)]; nsstring *aemail = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement, 2)]; // create new animal object data database user *obj_user = [[user alloc] initwithusername:ausername fullname:afulln...

How to make lists automatically instantiate on use in Python as they do in Perl? -

in perl, can this: push(@{$h->[x]}, y); can simplify following python codes according above perl example? if x not in h: h[x] = [] h[x].append(y) i want simplify this, because goes many places in code, (and cannot initialize possible x []). not want make function, because there no 'inline' keyword. any ideas? a elegant way (since python 2.5) use defaultdict "collections" module: >>> collections import defaultdict >>> h = defaultdict(list) >>> h['a'].append('b') >>> h defaultdict(<type 'list'>, {'a': ['b']}) defaultdict dict, provides default value using whichever constructor passed when created (in example, list). i particularly on setdefault dict method, because 1) define variable defaultdict, , no other changes required on code (except perhaps remove previous kludges default values); , 2) setdefault terrible name :p

objective c - Objects' retain counts never go below 1 despite deliberately overreleasing -

i checking on retain count of objects nslog(@"r = %d", [aobject retaincount]; it seems lowest value can "r = 1", if deliberately add "release" calls [aobject release]; the "r = 1" limit holds if try put "release" , "nslog" test codes in object's dealloc method. the cocoa run-time seems neglect releases "r = 1" before crashing "exc_bad_access" @ end of sample program (without gc). my explanation (a guess) need r >= 1 object accessed. , cocoa run-time tries refrain letting object's retain count getting 0 prematurely. can confirm or correct me if wrong? when retain count of object reach 0 (i.e. retain count 1, , release has been called again), it's deallocated instead of bothering final decrement.

javascript - Popup blocker IE8 and security zones -

i have read many posts regarding detection of popup blocker javascript code still have not been able find answer problem having now. the problem when target url external website, browser (ie8) prevents access window object, or in other words javascript code window.open() returns null although popup allowed open up. in contrary, local page of site, javascript returns window object. thus seems there security settings somewhere in internet options prevents grabbing handler of opened window; in case, know how detect javascript? the code using follows , cannot detect situation: var popup = window.open("http://www.externalsite.com&param1=value1", "_blank", ""); if (!popup) { alert('cannot preview page because pop-ups blocked browser'); } else { if (popup != null) { popup.focus(); } } if open window crosses zones , integrity levels (e.g. intranet page running @ medium opens internet page running @ low; or internet site running @ ...

.net - Question about C# 4.0's generics covariance -

having defined interface: public interface iinputboxservice<out t> { bool showdialog(); t result { get; } } why following code work: public class stringinputboxservice : iinputboxservice<string> { ... } ... iinputboxservice<object> service = new stringinputboxservice(); and doesn't?: public class integerinputboxservice : iinputboxservice<int> { ... } ... iinputboxservice<object> service = new integerinputboxservice(); does have int being value type? if yes, how can circumvent situation? thanks yes, absolutely has int being value type. generic variance in c# 4 works reference types. because references have same representation: reference reference, clr can use same bits knows string reference object reference. clr can make sure code safe, , use native code knows iinputboxservice<object> when passed iinputboxservice<string> - value returned result representationally compatible (if such term ex...

java - log4j vs. System.out.println - logger advantages? -

i'm using log4j first time in project. fellow programmer told me using system.out.println considered bad style , log4j standard logging matters nowadays. we lots of junit testing - system.out stuff turns out harder test. therefore began utilizing log4j console controller class, that's handling command-line parameters. // log4j logger config org.apache.log4j.basicconfigurator.configure(); logger logger = loggerfactory.getlogger(console.class); category cat = category.getroot(); seems work: logger.debug("string"); produces: 1 [main] debug project.prototype.controller.console - string i got two questions regarding this: from basic understanding using logger should provide me comfortable options write logfile timestamps - instead of spamming console - if debug mode enabled @ logger? why system.out.println harder test? searched stackoverflow , found testing recipe . wonder kind of advantage using log4j. the logger gives ability defin...

excel - Move 5 columns from one sheet to another but place into one row -

Image
i have 5 columns in data source need pull: line1|line2|line3|line4|line5 ...all data under them. need pull 5 columns new sheet , not rename them, create more columns each record. such as: shop1|add1|citystate1|phone1|web1|shop2|add2|citystate2|phone2|web2| etc. ...with data falling under appropriate columns. columns same sequential each record. screen shots the datasource image data looks now. except copied these columns out of original because there other columns. need 5 columns. the result image how need end up. there hundreds of records going across. headers need sequential shown. have included first several columns these extend horizontally several records.                   sample data a long vertical list of contact information expediently handled direct value transfer. sub moveshiftlaterally_values() dim strhdr string, rw long, cls long, vhdrs variant strhdr = "shop0|add0|citystate0|phone0|web0" worksheets("sheet1...

javascript - Make a textarea all caps? -

i trying make textarea type in caps, if user isn't holding down shift or has caps lock on. ideally accept input no matter , automatically shift caps. of ways thinking of seem kind of clunky , show lowercase before gets converted. any suggestions or strategies? you can use css textarea { text-transform: uppercase; } however, renders on browser. let's if want inject text script or db in textarea caps you'll have use javascript's touppercase(); before injection or form submit. here jsfiddle example: html: <textarea>i javascript</textarea> css: textarea{ text-transform: uppercase; } javascript: var mytextarea = document.getelementsbytagname('textarea'); for(var i=0; i<mytextarea.length; i++){ console.log('textarea ' + + ' output: ' + mytextarea[i].innerhtml); //i javascript console.log('textarea ' + + ' converted output: ' + mytextarea[i].innerhtml.touppercase()); //i javas...

c - Using the read function to read in a file -

gcc 4.4.1 i using read function read in wave file. however, when gets read function. execution seems stop , freezes. wondering if doing wrong this. the file size test-short.wave is: 514k. what aiming read file memory buffer chunks @ time. testing this. many suggestions, #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <unistd.h> int main(void) { char buff = malloc(10240); int32_t fd = 0; int32_t bytes_read = 0; char *filename = "test-short.wav"; /* open wave file */ if((fd = (open(filename, o_rdwr)) == -1)) { fprintf(stderr, "open [ %s ]\n", strerror(errno)); return 1; } printf("opened file [ %s ]\n", filename); printf("sizeof(buff) [ %d ]\n", sizeof(buff)); bytes_read = read(fd, buff, sizeof(buff)); printf("bytes read [ %d ]\n", bytes_read); return 0; } ...

java - How to Exclude properties file from jar file? -

i have java application following project structure: myproject | |----src | | | |--main | | | |--resources | | | |--userconfig.properties | |--log4j.properties | |---target i using maven build project. using maven command build jar file follows: mvn package -dmaven.test.skip=true i want exclude userconfig.properties file jar file have updated pom.xml follows: <excludes> <exclude>**/userconfig.properties</exclude> </excludes> but excludes target folder in compiled code resides. , application won't run because unable find userconfig.properties file. can me? i encountered scenario well. basically, want able run code locally eclipse using userconfig.properties file readily accessible, such inside /src/main/resources . additionally, want provide compiled executable jar external userconfig.properties allows user configure application without cracking jar. ...

How do I use nightly builds of Scala 2.9 with maven? -

recently wanted try of new features in scala 2.9 in small project. use maven building it. how can tell maven use latest nightly build of scala 2.9? if knows how sbt instead of maven, too. you can try repository: http://www.scala-tools.org/repo-snapshots with scala version: 2.9.0-snapshot here snippet pom.xml : <repositories> <repository> <id>scala-tools.org</id> <name>scala-tools maven2 repository</name> <url>http://scala-tools.org/repo-snapshots</url> </repository> </repositories> <pluginrepositories> <pluginrepository> <id>scala-tools.org</id> <name>scala-tools maven2 repository</name> <url>http://scala-tools.org/repo-snapshots</url> </pluginrepository> </pluginrepositories> and sbt : val scalatoolssnapshots = "scala tools snapshots" @ "http://scala-tools.org/rep...

Retrieving the field names from sitecore item -

while searching keyword in sitecore using sitecore.seach returns item name(where located) search keyword. there option field name along item? i use following code: using (indexsearchcontext context = searchindex.createsearchcontext()) { searchhits hits = context.search(searchstring, new searchcontext(siteroot)); var results = hits.fetchresults(0, 100); foreach (searchresult result in results) { try { item item = result.getobject<item>(); if (item != null) { results.addresulttocategory(result, categoryname); } } ... } } if understand goal correctly, want find out exact fields (field names) search string found, right? if that's case, should collection of item fields ( item.fields ), , iterate through checking search string in field value. as far know, sitecore search shell application works same way when displaying results: item taken form searchresult , , field collecti...

Process XML in C# using external entity file -

i processing xml file (which not contain dtd or ent declarations) in c# contains entities such &eacute; , &agrave; . receive following exception when attempting load xml file... xmldocument xmldoc = new xmldocument(); xmldoc.loadxml(record); reference undeclared entity 'eacute'. i able track down proper ent file here . how tell xmldocument use ent file when loading xml file? in versions of framework prior .net 4 use prohibitdtd of xmlreadersettings instance. var settings = new xmlreadersettings(); settings.prohibitdtd = false; string dtd = @"<!doctype doc [ <!entity % iso-lat1 public ""iso 8879:1986//entities added latin 1//en//xml"" ""http://www.oasis-open.org/docbook/xmlcharent/0.3/iso-lat1.ent""> %iso-lat1; ]> "; string xml = string.concat(dtd,"<xml><txt>ren&eacute;</txt></xml>"); xmldocument xd = new xmldocument();...

c# - Quickly Compiling Changes for Couple of Files -

i using .net framework , c# , working on large project. application compile takes forever. currently, don't have time see going wrong. there anyway if change 2-3 files can compile application quickly. it web application. solution has 6-7 other projects. i believe "must" rebuild(what ever got changed) in order changes take effect. also, side note: break modules/assemblies, compile assembly got changed! if existing change in specific assembly build assembly.

c# - performance of linq extension method ElementAt -

the msdn library entry enumerable.elementat(tsource) method says "if type of source implements ilist, implementation used obtain element @ specified index. otherwise, method obtains specified element." let's have following example: icollection<int> col = new list<int>() { /* fill items */ }; ilist<int> list = new list<int>() { /* fill items */ }; col.elementat(10000000); list.elementat(10000000); is there difference in execution? or elementat recognize col implements ilist<> although it's declared icollection<>? thanks the type of variable irrelevant elementat method - far it's concerned, it's declared ienumerable<t> , because that's parameter type is. (both calls bound same extension method.) it's execution-time type of object tested in elementat .

In Javascript, when is a new scope created? (with a new function and in a "with" statement) Are these the only 2 situations? -

in javascript, when new scope created? 2 situations know of are: with new function ( update on 2012/09, think needs function invocation, not function definition) in "with" statement as note, new block (in if-then-else, loops, or beginning block no other reason) won't create new scope. is there third situation new scope created besides 2 situations above? thanks. yes, there third case scope chain augmented (besides let mozilla-extension shog9 mentions), when catch block evaluated: the production catch : catch (identifier ) block evaluated follows: let c parameter has been passed production. create new object if expression new object(). create property in object result(2). property's name identifier, valueisc. value, , attributes { dontdelete }. add result(2) front of scope chain . evaluate block. remove result(2) front of scope chain . return result(5). so basically, new object created, property...

flash - What audio files can you use with SWFOBJECT? -

i'm converting old realmedia audio-only files use swfobject flash player on web. what's best container/format use files? think aac best format, can play *.aac file in flash player? your appreciated. thanks. it depends on version of flash player run, version 9 , later supports adpcm, mp3 , aac. more details on adobe’s website .

haskell - Strange pattern matching with functions instancing Show -

so i'm writing program returns procedure given arithmetic problem, wanted instance couple of functions show can print same expression evaluate when test. trouble given code matches (-) first line when should fall second. {-# options_ghc -xflexibleinstances #-} instance show (t -> t-> t) show (+) = "plus" show (-) = "minus" main = print [(+),(-)] returns [plus,plus] am committing mortal sin printing functions in first place or there way can match properly? edit:i realise getting following warning: warning: pattern match(es) overlapped in definition of `show': show - = ... i still don't know why overlaps, or how stop it. as sepp2k , mtnviewmark said, can't pattern match on value of identifiers, on constructors and, in cases, implicit equality checks. so, instance binding argument identifier, in process shadowing external definition of (+) . unfortunately, means you're trying won't , can't ...

c++ - When and how is DragDetect useful? -

basically need determine if user in process of drag , drop action determine when suppress on zealous default behavior of ctreectrl label editing in extended multi-select tree control. cwnd::dragdetect returns true when user has moved mouse outside of defined rect left button down. thinking of using return value of in ::onmousemove determine if drag operation in progress enable or disable gui effects , actions. sounds , accomplish more taking same mouse point , doing hit test selected item? have hit test drop targets anyway seems wholly unnecessary method. google didn't turn examples of using method , returned no results i'm curious when , if ever useful method or if not intended use. has used before? the intent call dragdetect wm_lbuttondown handler see if user trying drag application. if returns true, start of drag operation; if it's false, not. after return of true start tracking mouse , doing hit tests provide feedback, if any; should @ least ...

hyperlink message in twitter in android -

i want tweet message hyperlink website android application. using twitter 4j api in android app. i.e. example if post message "hello" in twitter, when click hello should redirect other website. possible? you can't add hyperlink word in twitter. turns html text. if put http://yoursite.com text tweet, made link automatically. if put <a href="http://yoursite.com">hello</a> tweet, html displayed text. this true on site , through api.

ruby on rails 3 - Do I need to keep the fields for my polymorphic address in the view to make accepts_nested_attributes_for work? -

i have problem classes posted server not saved , can't figure out why , appreciate in matter. first of take account class has reference address , defines both billing , delivery address. class account < activerecord::base has_many :addresses, :as => :addressable, :dependent => :destroy has_one :billing_address, :as => :addressable has_one :delivery_address, :as => :addressable accepts_nested_attributes_for :billing_address, :allow_destroy => true, :reject_if => missing_attrs?('street_one', 'zip', 'city', 'country_id') accepts_nested_attributes_for :delivery_address, :allow_destroy => true, :reject_if => missing_attrs?('street_one', 'zip', 'city', 'country_id') end now address classes follows class address < activerecord::base belongs_to :country belongs_to :addressable, :polymorphic => true validates_inclusion_of :type, :in =...

ruby - Formtastic, own :as input type -

how can add own field types formtastic ? for exemple, need have custom datetime input, , want this: <%= f.input :start_date , :as => :my_date %> this doesn't work because formtastic doesn't know :my_date (only :boolean, :string, :datetime , on...) but how can add additional input types ? you need add custom input method: class mycustomformtasticformbuilder < formtastic::semanticformbuilder protected def my_date_input(method, options) basic_input_helper(:text_field, :my_date, method, options) end end that's perfect for, new html5 input types. use so: <% form_form @model, :builder => mycustomformtasticformbuilder |f| %> <%= f.input :start_date, :as => :my_date <% end %>

exception handling - Synchronisation in android -

i using media player play sound in pacman game. whenever plays sound give following error. unable resync. signalling end of stream i want ask why type of error comes. there memory problem regarding , how can solve problem. when volume or down device restarted whenever sound played don't know why.

c# - Verifying a specific parameter with Moq -

public void submitmessagestoqueue_onemessage_submitsuccessfully() { var messageserviceclientmock = new mock<imessageserviceclient>(); var queueablemessage = createsinglequeueablemessage(); var message = queueablemessage[0]; var xml = queueablemessageasxml(queueablemessage); messageserviceclientmock.setup(proxy => proxy.submitmessage(xml)).verifiable(); //messageserviceclientmock.setup(proxy => proxy.submitmessage(it.isany<xmlelement>())).verifiable(); var serviceproxyfactorystub = new mock<imessageserviceclientfactory>(); serviceproxyfactorystub.setup(proxyfactory => proxyfactory.createproxy()).returns(essageserviceclientmock.object); var loggerstub = new mock<ilogger>(); var client = new messageclient(serviceproxyfactorystub.object, loggerstub.object); client.submitmessagestoqueue(new list<imessagerequestdto> {message}); //messageserviceclientmock.verify(proxy => proxy.submitmessage(xml), ...

javascript - Make input field background image disappear after text is inputted -

i'd make background image input field disappear once user has typed amount of text in it. there simple way in javascript? can bg disappears while field focused, returns once move on next field. html: call me @ <input name="phone" type="text" class="phone-field" id="phone"> css: .form input { background-color:transparent; } .form input:focus { background-color:#edc; background-image:none; } input.phone-field { background-image: (url/images/phonebg.png); background-repeat: no-repeat; background-position: left 1px; } with jquery, like $('#phone').focus(function(){ var text = $(this).val(); if(text != ''){ $(this).css('background-image', 'none'); } });

php - How do you use version control for plugin/extension development -

i build websites , svn has worked out find in terms of setting repository websites code. going start working on extensions/plugins can used on web applications, such wordpress, magento, or other type of web application. application is, doesn't matter. what looking best way setup repository plugin developing, while being able check out , use in 1 of web applications building for. don't want code of web application added repo, want code has plugin in repo. obviously there standard folders create plugin with, exist inside these other applications , not standalone. have import plugin repo , check out inside of web application structure, ignore files not in repo. how maintain going forward? there new files added application, , might want add files plugin, constant battle of finding ignore? i don't want import plugin, repo, check out, , export it, placing exported version web application , change in web application functionality of plugin fixed or changed, have make sur...

multithreading - Is tesseract 3.00 multi-threaded? -

i read other posts suggesting add multi-threading support in 3.00. i'm not sure if it's added in 3.00 when released. other multi-threading, running multiple processes of tesseract feasible option achieve concurrency? thanks. no. can browse code in http://code.google.com/p/tesseract-ocr/source/browse/ none of current code in trunk seems make use of multi-threading. (at least looking through base classes, api, , neural networking classes)

css - Why does my DIV clip its child DIV when jQuery moves it in IE? -

i have 2 divs, both position:absolute; , 1 inside other. parent isn't in place can set position:relative without layer of complexity (there lot of other elements around i'd have account put needs be, @ top of page, on everything). child element made stick off bottom of parent. in chrome, safari, firefox, works splendidly. in ie, works until jquery moves parent element - @ point parent element clips child, can barely see top of child. feel i've read this, ie clipping child elements, can't seem find answer applies case. it's pretty simple, basically: <div id="parent" style="position:absolute;top:0;left:0;"> [content] <div id="tab" style="position:absolute;bottom:-30px;left:0;width:64px;height:32px;background-image:(...);"></div> </div> <script> $(document).ready( function() { $("#tab").click(function() { $("#parent").animate({"top":...

SQL Server: How can I select everything from a table with a prefix? -

i have following code in long stored procedure, p equals products table: select p.*, etc1, etc2 which give me "productid" , on. i select prefix such as: select p.* p_*, etc1, etc2 which give me "p_productid" , on. is possible do? not unless use dynamic sql. uncommon require such thing though, sure need it? working example create table products (productid int, price money, description varchar(10)); insert products select 1, 12.3, 'apples' insert products select 2, 2.4, 'bananas' create table orderdetails (orderid int, productid int, qty int) insert orderdetails select 11,1, 2 insert orderdetails select 11,2, 4 declare @sql nvarchar(max) select @sql = coalesce(@sql+',','') + 'p.' + quotename(column_name) + ' ' + quotename('p_' + column_name) information_schema.columns table_name = 'products' order ordinal_position set @sql = ' select ' + @sql + ', o.orderid, ...

Website written in C# and ASP.NET MVC is compiling ASCX pages with Visual Basic -

i developing website in asp.net mvc using c#. works fine on machine, when load production server generates error trying present home page. the error caused fact asp system compiling .ascx pages using visual basic, which, of course, not work since of code in c#. how fix this? does production app have following stuff in it's app config? <compiler language="c#;cs;csharp" extension=".cs" warninglevel="4" type="microsoft.csharp.csharpcodeprovider, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089"> <provideroption name="compilerversion" value="v3.5"/> <provideroption name="warnaserror" value="false"/> </compiler> also, have verified master page / views contain <%@ master language="c#" inherits="system.web.mvc.viewmasterpage<yourtype>" %> and <%@ page title="" language="c#"...

UIView drawRect: when you draw a line, the rect area will be clear so the previous drawing is gone -

it quite hard tell upload image show problem: http://i42.tinypic.com/2eezamo.jpg basically in drawrect, draw line touchesmoved finger touches , call "needsdisplayinrect" redraw. found first line done, second line clear rect part, previouse drawing gone. here implementation: enter code here -(void) drawrect:(cgrect)rect{ //[super drawrect: rect]; cgcontextref context = uigraphicsgetcurrentcontext(); [self drawsquiggle:squiggle at:rect incontext:context]; } - (void)drawsquiggle:(squiggle *)squiggle at:(cgrect) rect incontext:(cgcontextref)context { cgcontextsetblendmode(context, kcgblendmodemultiply); uicolor *squigglecolor = squiggle.strokecolor; // squiggle's color cgcolorref colorref = [squigglecolor cgcolor]; // cgcolor cgcontextsetstrokecolorwithcolor(context, colorref); nsmutablearray *points = [squiggle points]; // points squiggle // retrieve nsvalue object , store value in firstpoint cgpoint firstpoint; // declare cgpoint [[points objectatin...

Can you intercept a MMS SMS message and extract the image on Android? -

i want intercept text message has image attached, , save somewhere automatically. can work on android? yes, should possible. can set broadcastreceiver watch android.provider.telephony.sms_received , parse message out of that. there's plenty of examples on web (and questions on stackoverflow). as preventing user seeing original message, see answer: can delete sms in android before reaches inbox?

Why is there no Constant feature in Java? -

i trying identify reason behind constants in java have learned java allows declare constants using final keyword. my question why didn't java introduce constant ( const ) feature. since many people has come c++, in c++ have const keyword. please share thoughts. every time go heavy c++ coding java, takes me little while adapt lack of const-correctness in java. usage of const in c++ different declaring constant variables, if didn't know. essentially, ensures object immutable when accessed through special kind of pointer called const-pointer when in java, in places i'd want return const-pointer, instead return reference interface type containing methods shouldn't have side effects. unfortunately, isn't enforced langauge. wikipedia offers following information on subject: interestingly, java language specification regards const reserved keyword — i.e., 1 cannot used variable identifier — assigns no semantics it. thought reservation of ke...

c# - How to get friends Email id from facebook using asp.net code -

how friends email id facebook using asp.net code you can use facebook api: api: http://wiki.developers.facebook.com/index.php/user:c_sharp http://wiki.developers.facebook.com/index.php/user:asp.net sdk: http://facebooktoolkit.codeplex.com code: http://facebook.codeplex.com others: http://msdn.microsoft.com/en-us/windows/ee388574.aspx

jQuery: array zero vs function get zero: [0] vs get(0) -

is there reason should use $('#x>div').get(1) when instead use $('#x>div')[1] ? there difference? nope, no difference. jquery holds dom nodes in array. $().get(1) === $()[1] --jquery source snippet-- get: function( num ) { return num == null ? // return 'clean' array this.toarray() : // return object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, as can see, .get() no arguments return nodes array. cannot accomplished brackets.

iphone - how can I get animation when going to previous view -

i have used viewcontroller multiple view. when go previous, there no animation have tried below lines of code , -(ibaction)goback { [uiview beginanimations:nil context:null]; [uiview setanimationduration:1]; [uiview setanimationtransition: uiviewanimationtransitioncurldown forview:self.view cache:yes]; [self.view removefromsuperview]; [uiview commitanimations]; } you can't animate method call. can animate properties of view such frame, size, alpha etc. removefromsuperview isn't property, method finds superview , removes originating view array of subviews. you need run animation , send removefromsuperview when animation completes.

css - jQuery, Hiding elements on ready is always jumping on page load. how can this be avoided? -

this code. i can't apply display:none; $(document).ready(function() { $("#leftnav li.navcathead").not(":first").siblings("li").hide().end().end().first().addclass("open"); }); this article may bit: http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content

windows - how to figure out a program's network and system resource usage behaviour? -

when download program want know many behaviour of new program, i.e., connect internet , sending local computer data somewhere, , system resources/functions have been called , new data/settings have been written computer. not windows doesn't notify me these actions, want know myselft, there possibility can that? thanks!! you can use procmon that. process monitor advanced monitoring tool windows shows real-time file system, registry , process/thread activity. the newer version includes network activity monitoring too. in fact should take @ sysinternals suite since there many other tools included in suite process explorer or tcpview can task. as network packet inspection can use wireshark since sysinternals tools don't provide packet content inspection too(they provide connection details , packet lengths).

Reading numeric Excel data as text using xlrd in Python -

i trying read in excel file using xlrd, , wondering if there way ignore cell formatting used in excel file, , import data text? here code using far: import xlrd xls_file = 'xltest.xls' xls_workbook = xlrd.open_workbook(xls_file) xls_sheet = xls_workbook.sheet_by_index(0) raw_data = [['']*xls_sheet.ncols _ in range(xls_sheet.nrows)] raw_str = '' feild_delim = ',' text_delim = '"' rnum in range(xls_sheet.nrows): cnum in range(xls_sheet.ncols): raw_data[rnum][cnum] = str(xls_sheet.cell(rnum,cnum).value) rnum in range(len(raw_data)): cnum in range(len(raw_data[rnum])): if (cnum == len(raw_data[rnum]) - 1): feild_delim = '\n' else: feild_delim = ',' raw_str += text_delim + raw_data[rnum][cnum] + text_delim + feild_delim final_csv = open('final.csv', 'w') final_csv.write(raw_str) final_csv.close() this code functional, there fields, such ...

iphone - Custom tab bars, table views, etc -

this first question here @ stack overflow. i've been looking way ever since started programming ios (which not long ago, month) haven't been able find concrete explanation, decided ask you. i've seen many apps have custom artwork in them (e.g. wooden textures, backgrounds noise, custom table view cells, etc.) , add own apps, there properties can access, example, on tab bar? check out wunderlist or readmore , these 2 great examples of mean. wunderlist made using titanium, editing backgrounds , customizing table view cells , table view backgrounds easier in javascript, if titanium has way of doing there must way of doing natively in objective-c, right? thank in advance, appreciated. there number of ways create custom uitableview , associated cells. as general overview, cocoa love easy custom uitableview drawing blog post pretty , there's more recent (and complex) uitableview construction, drawing , management (revisited) post on same site i...

class - Is it possible to show that a method/operation returns and array of objects (rather than just a single object) in Visio 2007? -

i making particular reference producing static structure (class diagram). notice can set return type particular object, there appears no way select collection of objects returned instead. select class, go properties, find operation, click on properties , you'll see prefix , suffix fields in dialog box. can use these fields modify return expression, example: you can type "col " prefix express collection of objects. you can type "[]" suffix express array of objects. or else.

coldfusion - cfchart ignores my scalefrom value -

i have following codes in page. the style variable holds custom style. <cfchart chartheight="450" chartwidth="550" gridlines="9" yaxistitle="score" scalefrom="20" scaleto="100" style="#style#" format="png" > <cfchartseries query="variables.chart_query" type="scatter" seriescolor="##000000" itemcolumn="myitem" valuecolumn="myscore"/> </cfchart> before begin, please see chart_good.jpg . how want report come up. on x-axis, there 3 items long @ least 1 of them has values. if item not have values (i.e. 2010), there not marker in chart. the problem occurs when 1 item has value. please see chart_bad.jpg . can see, 2008 , 2010 not have values; y-axis scaled 0 100. have tried setting 1 of items (ex. 2008) value of 0 or off chart; scale according off-the-chart value , 2009 value. in short, have have @ least 2 ...

php - Serializing form data with field names that have dots in them -

does serialize function in jquery replace dots ('.') underscores? for example, have form field such as: <input id="project.name" name="project.name" type="text"> when form posted, i'm serializing form data , sending php file save. dots seem converted underscores. normal behavior? jquery doesn't this, the easiest way see test, can see here . it's been loooong time since doing in php me, looks happening server-side. here's simple test: <form> <input id="project.name" name="project.name" type="text" value="test" /> </form> this jquery: alert($("form").serialize()); // "project.name=test" another easy way see what's actually's getting posted firebug , or other traffic inspection tool of choice.

How to get My Site Information from 2 differents Sharepoint -

i've got 2 distinct sharepoint. 1 2007 , other 2010. on 2010, there mysite profile enabled. i'm looking webpart outofbox (because administrator doesn't allow add new webpart in curren t sharepoint) access sp 2007 information (like status, or project assignment) on mysite on sp 2010. are thinking it's possible? thanks in advance julien garcia i don't think can done using ootb webparts have custom webpart solution

vb.net - Autosize object in a form -

how can make autosize form include objects in form designer? do mean controls inside form should autosize when form resizes? set anchor property of controls, if set anchor 4 sides, they'll resize form they're in. if need more advanced can handle forms resizing event , write code in there resize other things @ same time.

sqlite - SQL select descendants of a row -

suppose tree structure implemented in sql this: create table nodes ( id integer primary key, parent integer -- references nodes(id) ); although cycles can created in representation, let's assume never let happen. table store collection of roots (records parent null) , descendants. the goal to, given id of node on table, find nodes descendants of it. a descendant of b if either a 's parent b or a 's parent descendant of b . note recursive definition. here sample data: insert nodes values (1, null); insert nodes values (2, 1); insert nodes values (3, 2); insert nodes values (4, 3); insert nodes values (5, 3); insert nodes values (6, 2); which represents: 1 `-- 2 |-- 3 | |-- 4 | `-- 5 | `-- 6 we can select (immediate) children of 1 doing this: select a.* nodes parent=1; we can select children , grandchildren of 1 doing this: select a.* nodes parent=1 union select b.* nodes a, nodes b a.parent=1 , b.parent=a.id;...