Posts

Showing posts from 2011

How does focus works in Flex? -

i try figure out how focus mechanism work in flex. here comes example of mean: let's assume have simple web application, contains custom component extends canvas , implements mx.managers.ifocusmanagercomponent . component overrides focusinhandler , focusouthandler methods , shows feedback on how called (thinner or thicker border). custom component contains text . the source of component is: <mx:canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="100" creationcomplete="cc();" implements="mx.managers.ifocusmanagercomponent"> <mx:script> <![cdata[ import mx.containers.canvas; import mx.controls.text; import mx.controls.textarea; import mx.core.uicomponent; import mx.managers.ifocusmanagercomponent; public function cc():void { text = new text; text.text = "123"; addchild(text); ...

javascript - Changing the size of a Boxy Dialog box -

i'm using boxy jquery plug-in ( boxy plug-in ) , i'm trying change size of box. i've tried this, didn't work: var dialog = new boxy("<div style='left-margin:40px;'><p><b>event name:</b> " + foundtype.name + "</p><p><b>event type:</b> " + foundcategory.name + "</p><p><b>date: </b>" + foundtype.date.todatestring() + "</p><p><b>comments:<br /></b>" + foundtype.details + "</p></div>", { title: "<h><b>detail</b></h>", modal: true, show: false }); dialog.resize(400, 400); dialog.show(); any please? i think problem can't call resize on boxy window before it's displayed. show() first, fire resize() . can put resize call inside aftershow callback in boxy constructor.

Perl - How to change every $variable occurrence of ";" in a string -

very new here gentle. :) here jist of want do: i want take string made of numbers separated semi-colons (ex. 6;7;8;9;1;17;4;5;90) , replace every "x" number of semicolons "\n" instead. "x" number defined user. so if: $string = "6;7;8;9;1;17;4;5;90"; $nth_number_of_semicolons_to_replace = 3; the output should be: 6;7;8\n9;1;17\n4;5;90 i've found lots on changing nth occurrence of haven't been able find on changing every nth occurrence of trying describe above. thanks help! use list::moreutils qw(natatime); $input_string = "6;7;8;9;1;17;4;5;90"; $it = natatime 3, split(";", $input_string); $output_string; while (my @vals = $it->()) { $output_string .= join(";", @vals)."\n"; }

wifi - Blackberry API - WLANInfo.WLANAPInfo -

development environment: - device: blackberry storm2 - ide: eclipse galileo, bb plugin - reference api: 6.0 i trying scan possible wifi access points on 1 minute period directly app not want -connect, authenticate, or add - of access point instance of application or device itself. want read sort of "vector" information (bsid, etc) of access points founded. i have read specific issue , there couple of posts haven't been of help: - scan available wi-fi networks on blackberry - list wifi access points i appreciate on issue, have tried use: - hotspotclient class but have not succeed because not quite sure how work class (knowing abstract class) the last found wlaninfo.wlanapinfo class , think may useful purpose... suggestion on this? thanks i agree using hotspots clients not convenient, requiring user accept out of applicaiton. haven't found solution can build (poor) list of wi-fi's hooking wlanconnectionlistener: wlaninfo.addlist...

asp.net - aspx ajax control toolkit rating -

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/rating/rating.aspx can somehow disable clicking on stars? there readonly attribute can set. link: readonly - whether or not rating can changed

printing - How to intercept data being sent to a printer? -

i'm interfacing application that's sending raw printer file default printer. thing data. i need file somehow can store elsewhere instead. best way this? the best i've thought of write app listens specific port, , set default printer port. would way work? there better way? i ran across , ldp implementation java i'm going modify , use. can access printer , want raw files. http://lpdspooler.sourceforge.net/

Problem with Hibernate/JPA Query and categories -

i have hibernate/jpa data model lets me place objects (myobj) various categories (mycategory). each category may have 0 or more subcategories, , categories not instead have classification (myclassification) assigned them. data model looks this: public class myobj { … protected mycategory category = null; … } public class mycategory { … protected myclassification classification=null; protected list<mycategory> childcategories=null; protected mycategory parentcategory=null; … } public class myclassification { … } i'd able query myobj instances based on classification, category, or subcategory. example, if have 3 classifications (classa, classb, , classc), , 6 categories (e.g. categorya1, categorya2, categoryb1, etc. name corresponds classification) , each of categories have 3 subcategories (e.g. subcata1, subcata2, subcata3, subcatb1, etc.) i'd queries this: all myobj instances in classification classa (regardle...

hunit - What is the Haskell syntax to import modules in subdirectories? -

what haskell's syntax importing modules in directory? i'm getting started haskell , want practice writing simple functions tdd style hunit. i'm having trouble figuring out how structure files, though. example comes hunit seems flat directory structure. i'd have tests , hunit code in different folder actual code. i'd appreciate quick example import statement , suggestion how might structure files. if matters, i'm using ghci , notepad++ coding right now. you don't haskell source code; instead tell compiler look. usual method in .cabal file. see the cabal user guide details. want "hs-source-dirs" parameter. alternatively can pass path directly compiler. however, cabal better method. each pathname in "hs-source-dirs" parameter specifies root of module hierarchy. if import module called "data.foo.bar" compiler looks file relative pathname "data/foo/bar.hs" in each directory given "hs-source-...

scala - How do add values of selective rows from a list in an functional style? -

i solved problem in imperative style, looks ugly. how can make better (more elegant, more concise, more functional - scala). rows same values previous row, different letter should skipped, other values of rows should added. val row1 = new row(20, "a", true) // add value val row2 = new row(30, "a", true) // add value val row3 = new row(40, "a", true) // add value val row4 = new row(40, "b", true) // same value previous element & different letter -> skip row val row5 = new row(60, "b", true) // add value val row6 = new row(70, "b", true) // add value val row7 = new row(70, "b", true) // same value previous element, same letter -> add value val rows = list(row1, row2, row3, row4, row5, row6, row7) var previousletter = " " var previousvalue = 0.00 var countskip = 0 (row <- rows) { if (row.value == previousvalue && row.letter != prev...

ios - Cloning the Photo.app? -

i need have scrollview or regular view of thumbnail images of images in resources folder of app. , when user touches thumbnail, show different view touched image in full size. how accomplish this? there tutorials, or easy ways it? check out ktphotobrowser .

lua - How can I change every index into a table using a metatable? -

i'm trying write metatable indexes table shifted 1 position (i.e. t[i] should return t[i+1] ). need because table defined using index 1 first element, have interface program uses index 0 first element. since reading programming in lua, think can accomplish want proxy table, can't seem working. far, have this: t = {"foo", "bar"} local _t = t t = {} local mt = { __index = function(t, i) return _t[i+1] end } setmetatable(t, mt) however, not create expected result. in fact, doesn't return values @ (every lookup nil ). there better way this, or missing something? t = {"foo", "bar"} local _t = t t = {} local mt = { __index = function(t, i) return _t[i+1] end } setmetatable(t, mt) print(t[0]) outputs "foo" me when run here: http://www.lua.org/cgi-bin/demo

ruby on rails 3 - How to specify multiple values in where with AR query interface in rails3 -

per section 2.2 of rails guide on active record query interface here : which seems indicate can pass string specifying condition(s), array of values should substituted @ point while arel being built. i've got statement generates conditions string, can varying number of attributes chained either , or or between them, , pass in array second arg method, , get: activerecord::preparedstatementinvalid: wrong number of bind variables (1 5) which leads me believe i'm doing incorrectly. however, i'm not finding on how correctly. restate problem way, need pass in string method such "table.attribute = ? , table.attribute1 = ? or table.attribute1 = ?" unknown number of these conditions anded or ored together, , pass something, thought array second argument used substitute values in first argument conditions string. correct approach, or, i'm missing other huge concept somewhere , i'm coming @ wrong? i'd think somehow, has possible, short of generating...

How is dvcs (git/mercurial) branching and merging support better than svn's? -

lots of articles on dvcs systems claim superior branching , merging support 1 reason move svn dvcs systems. how these systems branching , merging differently makes better? historically, difference between merge-tracking in git , svn this: git has merge-tracking, , until version 1.5, svn didn't. @ all. if wanted make merge had specify changes merged, , if merged 1 branch more once, have manually keep track of revisions had , hadn't been merged, , manually select changes hadn't been merged yet, avoid conflicts. luck if ever cherry-picked changes. beginning version 1.5 (released in 2008), if client, server, , repository up-to-date, svn capable of acting lot more intelligently; uses properties keep track of branch came , changes have been merged it. upshot in many cases can svn merge branchname , have right thing happen. due "bolted on" nature it's still not fast , not entirely robust . git, on other hand, has handle merge scenarios because of dv...

php - jQuery Cookie plugin doesn't really seem to be setting a cookie -

my code sets cookie javascript (using cookie plugin jquery), makes ajax call php script needs read cookie. appears jquery cookie plugin has bug, because php script isn't able read cookie. furthermore, when in resources panel of chrome, don't see cookie under relevant domain. additionally, if set cookie using standard document.cookie method of javascript, cookie appear in resources panel , php script able read it. main reason want use jquery plugin because cookie value i'm setting has line breaks, , jquery cookie plugin seems handle elegantly. it's value going stored in mysql database, , line breaks automatically converted (br) , (p) tags when output. jquery cookie plugin seems give me value want... not in real cookie! anyway, here's code i'm using. feel free tell me how maintain linebreaks need without using jquery cookie plugin rather trying figure out what's going wrong plugin/my implementation of plugin. javascript: $.cookie('flavor',...

Creating a scope in Rails 3 based on a has_one :through relationship -

rails 3.0.3 , ruby 1.9.2 i have following class class item < activerecord::base belongs_to :user has_one :country, :through => :user .. end so itema.country yields "united states" the question how created (named) scope items owned users when try like: scope :american, where('countries.name' => 'united states').includes([:user, :country]) then item.american keeps coming empty when item.first.country => 'united states' incidentally, in rails 2.3.4 version had: named_scope :american, :include => {:user, :country}, :conditions => { 'countries.printable_name' => 'united states' } and worked advertised. you forgot pluralize table names, think ordering of include , may matter. it's recommended use join instead when specifying conditions on associations so: scope :american, joins(:users, :countries).where('countries.name' => 'united states') if you'd pr...

Django embedded ManyToMany form -

i need special section form can't imagine how now. i'll try make myself clear. suppose got model "sale". that's naturally set of products being sold. don't want select products on manytomany, want have 2 charfields "name" , "price", , "add" button besides. when fill these fields , press "add", there ajax action put row box below them. same thing if want remove 1 of rows clicking in "remove" button in row. that's manytomany field in such way can insert them "on-the-fly". i'm open other solutions well. thanks. if suits you, whole thing done javascript. create handlers create/edit/delete. create renders blank form , validates/saves post, adding new item sale should belong to. edit/delete should follow obviously. i make handlers render html partials, using javascript pull html dom , alter data posts server. assuming models, class sale(models.model): items = models.man...

mysql - Weighted conditions in the WHERE clause of a SQL statement -

i want search records particular field either starts string (let's "ar") or field contains string, "ar". however, consider 2 conditions different, because i'm limiting number of results returned 10 , want starts condition weighted more heavily contains condition. example: select * employees name 'ar%' or name '%ar%' limit 10 the catch is if there names start "ar" should favored. way should name merely contains "ar" if there less 10 names start "ar" how can against mysql database? you need select them in 2 parts, , add preference tag results. 10 each segment, merge them , take again best 10. if segment 1 produces 8 entries, segment 2 of union product remaining 2 select * ( select *, 1 preferred employees name 'ar%' limit 10 union select * ( select *, 2 employees name not 'ar%' , name '%ar%' limit 10 ) x ) y order preferred limit 10

Rails 3: Caching to Global Variable -

i'm sure "global variable" hair on of everyone's neck standing up. i'm trying store hierarchical menu in acts_as_tree data table (done). in application_helper.rb, create html menu querying database , walking tree (done). don't want every page load. here's tried: application.rb config.menu = nil application_helper.rb def my_menu_builder return myapp::application.config.menu if myapp::application.config.menu # menu building code should run once myapp::application.config.menu = menu_html end menu_controller.rb def create # whatever create code expire_menu_cache end protected def expire_menu_cache myapp::application.config.menu = nil end where stand right on first page load, database is, indeed, queried , menu built. results stored in config variable , database never again hit this. it's cache expiration part that's not working. when reset config.menu variable nil, presumably next time through my_menu_builder, detect ...

multithreading - Thread inside Application vs. Server process -

i have site takes particularly long process request (and that's not defect). 99% of time it's pretty quick because doesn't processing. i want show message says "loading" when site takes long process request. site uses mod_wsgi , apache. way see it, respond saying 'loading' before completing processing , 1 of 2 things right before: -spawn (daemon) thread take care of processing. -communicate through socket other process , tell take care of processing (most send request http://localhost:8080/do_processing ). what pros , cons of 1 approach vs other? using separate process better. not have hard @ suggested in answer can use existing system doing such celery (http://celeryproject.org/). relying on in process threads not idea unless going implement internal job queueing system of own prevent blowing out of number of threads. also, in multiprocess server configuration cant guaranteed request comes same process , not easy status of running ope...

Android Progress Dialog -

i have widgetprovider around milliseconds. takes in intent, , kicks off service takes maybe noticeable time. wanted display user during delay progress bar block user, broadcastreceiver/widgetprovider seems wrong place start progress bar. should issue progress bar in case? service maybe? service might not part of ui @ all? where should issue progress bar in case? from ui perspective, choice have in app widget itself. progressbar 1 of valid widgets have in app widget layout. in terms of updates remoteviews of app widget display/update/remove progressbar , service in whatever background thread using "noticeable time".

c# - OpenGL v1.1: Off-screen rendering or render directly to bitmap -

i'm using opengl c#, using csgl12 interface our project. i'm attempting draw number of 4-point free-transformed images onto bitmap in memory. is there way either: directly render bitmap on memory, or, render off-screen instance, , convert bitmap? need know how setup off-screen instance conversion. either method must work on remote desktop, virtual machine, , on panasonic cf-19 toughbook (i.e. opengl v1.1). if possible, providing example code related tremendously. you know, opengl-1.1 outdated nowadays. crappiest gpus on market can opengl-1.4 now. 1 thing should know first is, opengl has been designed getting pictures on screen, although nature of output backend keept abstract in specification. if want use opengl render 3d stuff accelerated, don't render bitmaps. fall software rasterization mode, extremely slow use pbuffer or framebuffer object. framebuffer objects straigtforward use. pbuffers little bit tricky. in windows need take detour on cr...

r - Include unused factor levels in facets with ggplot2 -

is there way include panel unused levels of factor used in faceting? the reason want because i'm arranging several separate plots in rows showing different measures, each row having same number of facet_grid panels in columns. each plot should line column. but when data 1 of rows missing data particular facet level, number of panels different , columns not line up. example, notice last row missing "mathematics ii" panel: example plot http://dl.dropbox.com/u/14792859/ggplot2%20facet%20levels.png the work-around can think of include dummy data-point missing facet levels, love hear there easier/cleaner way. as ben bolker mentioned, appears bug in ggplot2 caused bug in plyr. slated fixed in upcoming plyr 1.5 release. ggplot2 mailing list thread plyr fix in meanwhile, worked around issue creating single plot , using facet_grid, rows specifying different measures plotted. problem can't specify different scale_fill_manual 2 bottom panels, use...

Is there a way to determine the setting of the Ring/Silent switch on the iPhone -

i trying figure out code whether ring/silent switch on ring or silent. there way determine program. thanks i did more searching , found same question here how detect iphone on silent mode . for completeness, here answer neil worked me? cfstringref state = nil; uint32 propertysize = sizeof(cfstringref); audiosessioninitialize(null, null, null, null); osstatus status = audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &state); if (status == kaudiosessionnoerror) { return (cfstringgetlength(state) == 0); // yes = silent } return no; it should noted not work if headphones connected. "headphone". reported coob.

c# - How to access a checkBox inside a repeater Header? -

i have repeater has checkbox in headertemplate <asp:repeater id="myrepeater" runat="server"> <headertemplate> <table> <tr> <th> <asp:checkbox id="selectallcheckbox" runat="server" autopostback="true> . . . i'm wanting know how can value of checkbox in code behind. ideas? inside itemdatabound method call findcontrol("checkboxid") , cast checkbox void myrepeater_itemdatabound(object sender, repeateritemeventargs e) { if (e.item.itemtype == listitemtype.header) { checkbox cb = (checkbox)e.item.findcontrol("selectallcheckbox"); bool ischecked = cb.checked; } } or anytime: checkbox cb = (checkbox)myrepeater.controls.oftype<repeateritem>().single(ri => ri.itemtype == listitemtype.header).findcontrol("selectallcheckbox");...

facebook - Trouble with <fb:like> page title, like count, and page url -

i have set of pages in site using fbml method of inserting fb recommend button. problem every page on site shows exact same recommend count ("557 people recommend page" though installed button), , when i've tried recommend myself, shows in news feed wrong page title, wrong url, , of course, every recommend button on site incremented. here code: og tags (i replaced these anonymous values protect client looking have idiot developer) ;) : <meta property="og:title" content="xxx page title"/> <meta property="og:type" content="movie"/> <meta property="og:url" content="http://abc.xyz.com/path/to/my/page/"/> <meta property="og:site_name" content="xxx site name"/> <meta property="fb:admins" content="xxx facebook id"/> <meta property="og:description" content="xxx short description"/> ...then ins...

mysqli - Cannot pass parameter by reference PHP prepared statement problem -

i trying make query prepared statement retrieve information , make query information received first query, receiving error: cannot pass parameter reference is there way around this? this code: $dbh = getdbh(); $stmt = $dbh->prepare("select small info user = ?"); $stmt->bind_param("s",$userid); $stmt->execute(); $stmt->bind_result($small); $stmt->fetch(); $stmt->close(); $stmt = $dbh->prepare("insert method(small) values(?)"); $stmt->bind_param("s",$small); $stmt->execute(); $stmt->close(); i think may have got work adding return $small; after $stmt->fetch(); although have not had time test actual values, not recieving errors, unsure if code stops @ return $small; or if continues execute, may able rewrite function , return value.

java - Synchronizing on SimpleDateFormat vs. clone -

we know dateformat classes not thread safe. have multi-threaded scenario dateformats needs used. can't create new instance in new thread simpledateformat creation seems expensive(the constructor ends calling "compile" costly). after tests 2 options left me are: external synchronization - dont want this cloning in each thread - don't know whether there catches? any suggestions? if guys have faced before, direction did take. note : similar question asked before, closed pointing apache package. can't use new libraries this. , have read similar question on so what if created class format dates using fixed size pool of precreated simpledateformat objects in round-robin fashion? given uncontested synchronization cheap, synchronize on simpledateformat object, amortizing collisions across total set. so there might 50 formatters, each used in turn - collision, , therefore lock contention, occur if 51 dates formatted simultaneously. edit 201...

ruby - Parse ticks to datetime -

how can convert tick, such 1298011537289 datetime in ruby? the value need convert coming javascript date.now() call, it's in milliseconds per ruby docs : mytime = time.at(1298011537289) or since you're using milliseconds rather seconds: mytime = time.at(1298011537289 / 1000) but remove sub-second precision, retain it: mytime = time.at(rational(1298011537289, 1000))

objective c - Retrieve images asynchronously using UISlider in iPhone -

how retrieve images asynchronously , put on uiimageview in iphone programming ? till doing synchronously, delay in retrieving images more, hence take faster approach. i used nstimer & nsthread , control not entering them.. no idea why happening so.. can please me out? thank in advance. suse have @ post suggests using egoimageview loads images asynchronously. use class , works great me.

Flash vs. After effect vs. premiere -

i'm confused differences between flash, after effect , premiere usage of each program , when need use 1 of them? if 1 can thankful thanks in advance taken wikipedia: adobe premiere pro real-time, timeline based proprietary video editing software application. (my note: along windows movie maker lines i've never used statement may bit off) adobe flash (formerly macromedia flash) multimedia platform used add animation, video, , interactivity web pages. flash used advertisements , games. more recently, has been positioned tool "rich internet applications" ("rias"). and: adobe after effects digital motion graphics , compositing software published adobe systems. main purpose film , video post-production: combining multiple video sources in various ways (compositing), correcting brightness, color, , unwanted camera motion, adding visual effects, , many similar tasks.

javascript - I want Pause and Resume for this jquery animation -

$(document).ready(function() { settimeout("wave()", 0); }); function wave(){ $("#wave1") .animate({left:"100px", top:"400px" },2000) .animate({left:"200px", top:"0px" },2000) .animate({left:"300px", top:"400px" },2000) .animate({left:"400px", top:"0px" },2000) .animate({left:"500px", top:"400px" },2000) .animate({left:"600px", top:"0px" },2000) .animate({left:"500px", top:"400px" },2000) .animate({left:"400px", top:"0px" },2000) settimeout("wave()") } is there way somehow pause/resume animation in jquery? try plugin http://plugins.jquery.com/project/pause-resume-animation

Should I use JavaDoc deprecation or the annotation in Java? -

there @ moment, 2 ways mark code depreacted in java. via javadoc /** * @deprecated */ or annotation: @deprecated this problem - find bit declare both, when marking method deprecated when using eclipse. want use 1 of them. however using annotation give compiler actual useful additional information? but using annotation, cannot state why method deprecated - can javadoc, , deprecating method without specying why bad. so, can use 1 of them? or should learn specify both? you should use both. annotation allows compiler display warning whenever deprecated method used, , javadoc explains why. both important. as per oracle's java annotations tutorial : when element deprecated, should documented using javadoc @deprecated tag...

PHP script to split large text file into multiple files -

i struggling create php script split large text file multiple smaller files based on number of lines. need option increment split, starts 10 lines on first file, 20 lines on second , on. here 1 function scripts: <?php /** * * split large files smaller ones * @param string $source source file * @param string $targetpath target directory saving files * @param int $lines number of lines split * @return void */ function split_file($source, $targetpath='./logs/', $lines=10){ $i=0; $j=1; $date = date("m-d-y"); $buffer=''; $handle = @fopen ($source, "r"); while (!feof ($handle)) { $buffer .= @fgets($handle, 4096); $i++; if ($i >= $lines) { $fname = $targetpath.".part_".$date.$j.".log"; if (!$fhandle = @fopen($fname, 'w')) { echo "cannot open file ($fname)"; exit; } ...

filter types for background color using css -

i want set background color 2 colors. in tag @ left , right white color , @ center main color in css2 should use different elements colored (why not divs?). solution come html rather css. if want use css, should @ css3 gradients, although css3 not cross-browser-friendly solution.

c# - "Base abstract generic class is a bad choice in most situations." Why? (Or Why not) -

i have seen on comment blog post: base abstract generic class bad choice in situations is true, if not why? what insight(s) leads statement? "most situations" outrightly vague. generic abstract class (or interface) bad idea if common ancestor between descendants of such class system.object (as noted other commenters of question). otherwise (as in, if have meaningful common ancestor), it's idea if want "rename" or "specialize" members. consider example: // meaningful common ancestor working classes. interface iworker { object dowork(); } // generic abstract base class working classes implementations. abstract workerimpl<tresult> : iworker { public abstract tresult dowork(); object iworker.dowork() { return dowork(); // calls tresult dowork(); } } // concrete working class, specialized deal decimals. class computationworker : workerimpl<decimal> { override decimal dowork() { ...

java - Restrict the classes that may implement an interface -

generally speaking, possible restrict classes may implement interface? more specifically, can generic interface foo<t> restrict implementations descendants of t : interface foo<t> {} class baz extends bar implements foo<bar> {} // desirable class baz extends bar implements foo<qux> {} // undesirable the context foo<bar> objects should castable bar objects in type-safe way. having exhausted other sources of information, have strong hunch isn't possible—but delighted if prove otherwise! if ability cast not strictly necessary, adding additional method interface might suffice: public t gett() if implementations extend t , can return this implementation of method.

javascript - how do i loop through different iframes? -

i designing site company , stuck on how load 1 iframe , have next 1 queuing displayed.how write script loops through different iframes after time? thanks, lee for (var i=0;i<self.frames.length;i++) { var buttons = self.frames[i].document.getelementsbytagname("button"); // stuff buttons } hope work

iphone - How to display list of audio files and play when particular file is selected and also want to show the audio player during playing? -

i new iphone development , want develop view in application in which, view open list of audio files display , when select play should play showing audio-player on screen. create tableview displaying list of audio files.avaudioplayer used play audio.before should refer link , avaudioplayer class reference start further. hereafter, post question more specifically.. regards renuga

file - Problem Running Ant Script In Netbeans 6.1 -

i tried import ant script. , successful. when compile it. got error: run-selected-file-in-src: java.io.filenotfoundexception: ..\sounds\voice.wav (the system cannot find path specified) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(fileinputstream.java:106) @ com.sun.media.sound.wavefilereader.getaudioinputstream(wavefilereader.java:205) @ javax.sound.sampled.audiosystem.getaudioinputstream(audiosystem.java:1162) @ simplesoundplayer.<init>(simplesoundplayer.java:35) @ simplesoundplayer.main(simplesoundplayer.java:12) exception in thread "main" java.lang.nullpointerexception @ java.io.bytearrayinputstream.<init>(bytearrayinputstream.java:89) @ simplesoundplayer.main(simplesoundplayer.java:16) d:\windows\my document\latihan\java\allsrc\ch04src\nbproject\ide-file-targets.xml:7: java returned: 1 build failed (total time: 0 seconds) this folder structure roo...

git - Fetching remote remotes and remote remote branches -

i'd fetch remote branches of remote repository. so, example, in situation — $ cd alpha $ git remote beta $ git branch -a master remotes/alpha/master $ cd ../beta $ git remote gamma $ git branch -a master remotes/gamma/slave — i'd fetch gamma 's slave branch alpha repository going through beta . presumably add gamma remote of alpha , use gamma/slave new branch's refspec. don't want create local tracking branch. don't have filesystem access beta or gamma , unlike in example. this sort of thing can done $ git clone --mirror , there way in already-existing repo? it looks setting non-default refspec me partway there. for example, consider setup : initialize gamma $ (mkdir gamma; cd gamma; git init; touch readme; git add readme; git commit -m 'initialized slave.'; git branch -m slave; echo) initialized empty git repository in /tmp/test-git/gamma/.git/ [master (root-commit) 0cebd50] initialized slave. 0 files changed, 0 ...

r - Convert an irregular time series M-D-Y hh:mm:ss to regular TS filling with NA -

i had read previous post cannot obtain want. need obtain serie 16 intervals day (least first , last day, in these cases intervals start/end first/last observation). observed variables located in corresponding inteval , na otherwise. my data follows: [ya , yb observed variables] mdyhms ya yb mar-27-2009 19:56:47 25 58.25 mar-27-2009 20:38:59 9 81.25 mar-28-2009 08:00:30 9 88.75 mar-28-2009 09:26:29 0 89.25 mar-28-2009 11:57:01 8.5 74.25 mar-28-2009 12:19:10 7.5 71.00 mar-28-2009 14:17:05 1.5 70.00 mar-28-2009 15:13:14 na na mar-28-2009 17:09:53 4 85.50 mar-28-2009 18:37:24 0 86.00 mar-28-2009 19:19:23 0 50.50 mar-28-2009 20:45:50 0 36.25 mar-29-2009 08:44:16 4.5 34.50 mar-29-2009 10:35:12 8.5 39.50 mar-29-2009 11:09:13 3.67 69.00 mar-29-2009 12:40:07 0 54.25 mar-29-2009 14:31:48 5.33 35.75 mar-29-2009 16:19:27 6.33 71.75 mar-29-2009 16:43:20 7.5 64.75 mar-29-2009 18:37:42 8 ...

c# - WCF Secured Using Membership Provider, but getting certificate error -

i've created custom membership provider , trying use secure wcf service. but, getting error: the service certificate not provided. specify service certificate in servicecredentials. i don't want use x509 certificate. how can working? here service config: <?xml version="1.0"?> <bindings> <wshttpbinding> <binding name="wshttpbinding1" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647"> <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" /> <security mode="message"> <message clientcredentialtype="username"/> </security> </binding> </wshttpbinding> </bindings> <service...

Change from const to property and static context (C#) -

i had public class that: public class classn { public const int someint = 16; ... } this called somewhere else using int myint = classn.someint now have change 16 more dynamic , looks this: public int someint { { //this method not static , cant changed static return getintdynamically(); } } of course call not working anymore, because of static context. cant create new instance of classn ... option not violate coding rules? thanks if getintdynamically not static , can't made static, have no other option create instance of classn .

Can't get error messages for model submit to one controller show with another Rails 2.3.2 -

i have read on other people's posts , still can't head wrapped around problem having. thought ask. i have form gets uploading avatar. form displayed :controller => 'board', :action => 'show' <% form_tag("avatar/upload", :multipart => true ) %> <%= error_messages_for :avatar %> ... this works great. problem can't error messages display. the upload handled :controller => 'avatar', :action => 'upload' if params_posted?(:avatar) image = get_image(params) @board = board.find(session[:board_id]) @avatar = avatar.new(@board.id, image) if @avatar.save # ??? end end now part have trouble with. know can't redirect_to or lose error_messages_for @avatar , no error messages doing render problem because have routes. in routes.rb have following: map.connect 'board/celebrating/:id/:name', :controller => 'board', :action => 'show' so want know how d...

Need mysql query to get students PASS, FAIL and COUNT in single query -

i having table below: id studentname marks 1 x 60 2 y 25 3 z 50 here pass marks 50 , above my output should be id studentname marks status totalcount 1 x 60 pass 2 2 y 25 fail 1 3 z 50 pass 2 here total count of pass 2 total number of fail 1. how can done using mysql query. thanks in advance.... select a.id,a.studentname,a.marks,b.status,b.totalstatus students a, (select count(1) totalstatus,if(marks>=50,'pass','fail') status students group if(marks>=50,'pass','fail')) b b.status = if(a.marks>=50,'pass','fail'); this works !!! tried !!! lwdba@localhost (db test2) :: create table students -> ( -> id int not null, -> studentname varchar(10), -> marks int not null, -> primary key (id) -> ); quer...

long integer - Java - Can't make ProjectEuler 3 Work for a very big number (600851475143) -

resolution: turns out there (probably) "nothing wrong" code itself; inefficient. if math correct, if leave running done friday, october 14, 2011. i'll let know! warning: may contain spoilers if trying solve project euler #3. the problem says this: the prime factors of 13195 5, 7, 13 , 29. what largest prime factor of number 600851475143 ? here's attempt solve it. i'm starting java , programming in general, , know isn't nicest or efficient solution. import java.util.arraylist; public class improved { public static void main(string[] args) { long number = 600851475143l; // long number = 13195l; long check = number - 1; boolean prime = true; arraylist<number> allprimes = new arraylist<number>(); { (long = check - 1; > 2; i--) { if (check % == 0) { prime = false; } } if (prime...

data binding - databinding combobox in Dataform Silverlight using MVVM in Update -

i have master/detail – datagrid/dataform , after select item shows in dataform update, have problem databinding or populating combox departments , set selectedemployee.departmentid selectedvalue. here 2 questions now: 1. in employeeviewmodel code doesn’t work , question why? private observablecollection<department> _departments; public observablecollection<department> departments { { return _departments; } set { _departments = value; raisepropertychanged("departments"); } } but code works fine private observablecollection<department> _departments; public observablecollection<department> departments { { if (_departments == null) { _departments = new observablecollection<department> { new department() ...

iphone - UITableViewCell indentation centering imageView? -

Image
does know of reason why indentation of uitableviewcell center cell's uiimageview horizontally? in theory (and judging screenshots , apps i've seen in past), imageview should align right, keeping consistent space 2 labels. in case (screenshot below), doesn't. default uitableviewcell uitableviewcellstylesubtitle style. clues? i've been looking @ quite while , can't seem figure out. update: apparently uitableviewcellstyledefault doesn't have issue - imageview's right-aligned (single) label. why there difference between 2 styles beyond me. (green/blue areas added illustrate issue) how uitableviewcell draws contentview not how draw subviews in uiview. not modify frame property of imageview, textlabel , detaillabel. guess gets views graphic references , dealing custom drawing. which means, there no control. unfortunately have need customizations. enough have custom content view, not subclass whole table view cell class.

c# - adding my own control to the toolbox -

does know why can't add subclass inherits control ajaxcontroltoolkit toolkit? explicitly implemented icomponent didn't have since icontrol in parent implements icomponent already. i'll compile code, , try add dll "doesn't contain controls" error. know specific error there wasn't elsewhere. [system.componentmodel.designercategory("component"), toolboxdata("<{0}:tabpanelwithdatabinding runat=server></{0}:tabpanelwithdatabinding>")] public class tabpanelwithdatabinding : tabpanel, icomponent, idisposable { //all meat stuff } because base class " tabpanel " has attribute [toolboxitem(false)] . filter control assembly. can try adding attribute control true argument.

php - Delay at end of page load when using mssql -

i have working installation of mssql, php on windows 2003, sql server 2008 express. got connection working right, connection database quick disconnection slow. delays final loading of page 5 seconds, though page loaded in few milliseconds. i think php/mssql not releasing connection database quickly. main problem here javascript yui scripts wont run until page thinks loaded. i've tried closing connection don't need no avail. anyone know setting set fix it? you can call php flush () function make content generated script still in php or apache buffer flushed. also, if used mssql_pconnect establish persistent connections ms sql database, connection never closed when php script exists, suppose mssql_close not hold script anymore.

flash - Cu3er SWF Font -

i have free cu3r slider , need embed font of mine. tried sifr no succes. have settings can make xml file cu3er? thank you! here’s way of embedding fonts flash: go library, right-click , choose "new font ..." under "name" field type name of font, example: "myfont". select font & style respective drop down menus. click "advanced > linkage" , check "export actionscript" , "export in first frame". click ok. open 'actionscript panel' , in first frame register font typing following code: function getfontnames():array { return ["myfont"]; // list of export names of embedded fonts } stop(); publish swf flash player 9 actionscript 3.

objective c - I want to flash an UIImageview on the iPad, how do I do that? -

i want let uiimageview flash several times. currently don't know how that. actual code: -(void)arrowsanimate{ [uiview animatewithduration:1.0 animations:^{ arrow1.alpha = 1.0; arrow2.alpha = 1.0; arrow3.alpha = 1.0; nslog(@"alpha 1"); } completion:^(bool finished){ [self arrowsanimate2]; }]; } -(void)arrowsanimate2{ [uiview animatewithduration:1.0 animations:^{ arrow1.alpha = 0.0; arrow2.alpha = 0.0; arrow3.alpha = 0.0; nslog(@"alpha 0"); } completion:^(bool finished){;}]; } later on call this: for (int = 0;i < 10; i++){ [self arrowsanimate]; } this gives me 10x alpha 1, , 10x alpha 0. in middle see 1 animation. suggestions? thanks. there simpler way achieve flashing animation using 1 animation block: aview.alpha = 1.0f; [uiview animatewithduration:0.5f delay:0.0f options:uiviewanim...

python - Django django-admin-tools DashboardModule - HTML Content -

the django-admin-tools says, can use html (or) text in children. it's escaping given html tags. tags have been displayed given without rendering. self.children.append(modules.dashboardmodule( title = 'example', children = ['<b>bold example</b>',], )) edit template admin_tools/dashboard/module.html and add {% autoescape off %} {% endautoescape %}