Posts

Showing posts from July, 2012

jquery - Object Doesn't Support This Property or Method. IE8 -

when try running website, ie8 prompts me error: 'object doesn't support property or method. the object according ie8 debugger callback: shard.lefttop(); the first report in callstack(which hope helpful inform) line: c.readystate==="complete" && (c.detachment("onreadystatechange", b),e.ready()). i'm unsure should looking in code error... totally overwhelmed. *edit getting closer source of error: ok guys debugger telling me problem starting straight before call of shard.lefttop(); so, i'll try explain bit. how works in chrome. index.html holds document dot ready function, setting: var shard = new shards( $('div.shard') ); corresponding function in .js file within same directory index.html: function shards( container ){ further down index page calls prototype function expression shard.lefttop(); which looks this: shards.prototype.lefttop = function(){ and stored within .js file , dir. the pr

scilab - Completing a list of possible binary sequences give a binary sequence with gaps -

so, working on program in scilab solves binary puzzle. have come across problem however. can explain me logic behind solving binary sequence gaps (like [1 0 -1 0 -1 1 -1] -1 means empty cell. want possible solutions of given sequence. far have: function p = mogelijkecombos(v) i=1:size(v,1) if(v(i) == -1) aantalleeg = aantalleeg +1 end end i=1:2^aantalleeg //creating combos here end endfunction sorry words in dutch aantalleeg means amountempty mean amount of empty cells hope gave guys enough info. don't need code written, i'd ideas of how can make every possible rendition stuck atm. btw school assignment, assignment way bigger , it's tiny part need ideas on ty in advance short answer you create combos extending code , create possible binary words of length "amountempty" , replacing them bit-for-bit in empty cells of v. step-by-step description find empty cell positions count number of positions you've found (whi

.htaccess - Modrewrite url on index.php -

i created zend framework application , modrewrite worked when did: index.php/dashboard instance, accessing dashboard module. with being said, i'm working on new project (not zend framework) requires url of: http://server/username . i'm on impression need http://server/index.php/username being working method prior zend framework project. i have tried several htaccess solutions, , none have worked. go 404. here i've tried: rewriterule /([a-za-z]+)$ profile.php?name=$1 rewriterule ^/([^/\.]+)$ /profile.php?name=$1 [l] rewriterule ^/index.php/([^/\.]+)$ /profile.php?name=$1 [l] rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] nothing seems working. can help? edit = believe problem apache server. of these rewrite rules should work. i've looked @ httpd.conf , virtual host configurations. insight?

python - Calculating Covariance in Pandas Time Series -

apologies in advance if documented somewhere , failed find it: let's have time series data frame looks this: week_end_date title_short sales 2012-02-25 00:00:00.000000 "bob" (ebk) 1 2012-03-31 00:00:00.000000 "bob" (ebk) 1 2012-03-03 00:00:00.000000 "sally" (ebk) 1 2012-03-10 00:00:00.000000 "sally" (ebk) 1 2012-03-17 00:00:00.000000 "sally" (ebk) 1 2012-04-07 00:00:00.000000 "sally" (ebk) 1 i want calculate covariance in sales in order find users tend move together. know pandas has covariance feature: http://pandas.pydata.org/pandas-docs/stable/computation.html#covariance , i'm not sure how reshape data kind of purpose. am correct in thinking users need set column index, each series vector across time series? have no idea how that. you looking pandas pivot . first do: df.pivot(index='week_end_date', columns

unit testing - How do I add/modify the bundle loader setting in xCode 4.6.2? -

Image
i'm new ios development , i'm running bit of problem. i've inherited app that's 70% complete, there's no tests. want add unit testing target xcode project (v4.6.2) , integrate runs when press cmd-u. i have added new unit testing target. next instruction says modify "bundle loader" setting under "build settings" -> "linker". problem "bundle loader" setting blank , clicking in row not show +/- buttons add setting. how modify bundle loader setting set newly created test target run cmd-u? the unit test target created new projects application unit test. injects test code app setting bundle_loader , test_host in build settings. can create new unit test target , default logic unit test (bundle_loader , test_host not set). if want application unite test should set bundle_loader , test_host to: bundle_loader = $(built_products_dir)/dc wire sizer.app/dc wire sizer test_host = $(bundle_loader) you need change &q

jsf - OverlayPanel inside a Datatable -

Image
i need have overlay panel in each row of datatable changing record on fly. can see below: i don't know why when press save button calls 2 times setter of attribute(str) store new age. first time sets new value, in second set returns null value. 22:32:34,502 info [stdout] (http-localhost-127.0.0.1-8080-3) 31 22:32:34,502 info [stdout] (http-localhost-127.0.0.1-8080-3) here's code: <p:datatable value="#{backbean.l}" var="l" style="width: 300px;"> <p:column> <h:outputtext value="#{l.id}" /> </p:column> <p:column> <h:outputtext value="#{l.nome}" /> </p:column> <p:column> <h:outputtext value="#{l.age}" /> </p:column> <p:column> <p:graphicimage value="/img/icone.png" id="newage&q

Using the Ruby Shoes GUI toolkit, how would I go about being able to edit my GUI in different areas of code -

i'm writing horse race/bet game using shoes , wondering how able change gui in different areas of code. when run this, horse on 1 application , race line on application, want them both on same application. need set actual shoes app variable itself? class horse def initialize() #puts "yoyoyoyo" #@number=i shoes.app{ @icon= image 'horsey.jpg' @icon.left = 100 @icon.top = 50 } end def neigh() #puts "neighhhh" end def racetime() time=rand(100)%20 return time+10 end end class horseicon def initialize(h) @horse= h @imageloc='horsey.jpg' end end class game def initialize(h1, h2) contestants=[h1, h2] shoes.app{ @icon= image 'raceline.jpg' @icon.left = 100 @icon.top = 70 } end def race() end end game= game.new(1,2) seabiscuit= horse.new() you using 2 separate shoes.app classes. think that's problem. judging code

c# - Windows Phone 8 - WebBrowser Control does not perform ajax refresh -

i using webbrowser control in app. control not perform @ ajax refresh panels, preventing partial-refresh load. there missing control? need work part of solution. scripts disabled default on webbrowser control. did set isscriptenabled true ? <phone:webbrowser x:name="browser" isscriptenabled="true" />

java - Converting a Map<String, Object> to a byte[] and back -

alright, have 2 methods should work far can tell gets called itemstack , , serializes it. the serialization entered byteoutputstream , turned byte[] . byte[] turned byte , special separator set bytes in between. each of these bytes (there itemstack[] ) entered byte[] , , stored in byte[][][] . later on, try retrieve itemstack[] byte[] calling method, uses special separator set of bytes separate byte[] byte , convert map<string, object> , itemstack . this must confusing, me, post have below (just 2 methods). if more required, please let me know, , can most-likely it. my problem doesn't work. no errors or anything, reason data not make way through. if has solutions this, please help. maybe way splitting data... or maybe cutting off or adding on bytes string or object. private static byte[] contentstobytes(block block, itemstack[] contents) throws ioexception { byte[] bytes = new byte[] {block.getdata()}; byte[] datasplitter = itemstackdatasplitter.

sql - Inserting record from one column to another column in the same scope or statement -

Image
i have stored procedure populates table: table indicated in code below has identity column primary key column. i append primary key contain leading letters: example: abc123. not possible because primary key column int datatype. so created additional column can insert appended primary key. works except have make new column null , using update statement. something tells me there better way. is there way can without using update after initial insert , have new column categoryid not null ? table code: create table [dbo].[registration] ( [systemid] int identity (100035891, 1) not null, [categoryid] char (13) null, [fname] varchar (30) not null, [lname] varchar (30) not null, [minit] char (1) null, primary key clustered ([systemid] asc) ); stored procedure: create procedure [dbo].[uspinsertregistration] @fname varchar(30), @lname varchar(30), @minit char(1), @categoryid char(13), @systemid int output begin set no

iphone - Async image in button issue -

i have piece of code in function. , looping creating async image inside button. when run it, button not show async image.please tell me what's wrong code. when print nslog url, going , show of image url. // add button uibutton *btn = [uibutton buttonwithtype:uibuttontypecustom]; [btn setframe:cgrectmake(topleft.x,topleft.y,width,height)]; //asyncronous image nsmutablestring *imageurl; if ([[[type objectatindex:btnnumber] objectforkey:@"last_content_image"] isequaltostring:@""] || [[type objectatindex:btnnumber] objectforkey:@"last_content_image"] == nil) { imageurl = [nsmutablestring stringwithformat:@"bank_images/actual/"]; }else{ imageurl = [[type objectatindex:btnnumber] objectforkey:@"last_content_image"]; } nsurl *url1 = [nsurl urlwithstring:imageurl]; nslog(@"url

python - Trouble getting matplotlib to produce plots -

i can matplotlib work in pylab (ipython --pylab), when execute same command in python script plot not appear. workspace focus changes fullscreened terminal desktop when run script, suggests trying plot failing. the following code works in ipython --pylab not in script. import matplotlib.pyplot plt plt.plot(arange(10)) i on mac os x mountain lion. what causing fail when run script not in interactive prompt? i believe need plt.show() .

jsp - a href link used as tooltip not working well -

i using a href link use tool tip struts2 tags . problem due href link, starts behave weird textfields , select struts2 tag. <a style="color: inherit" href="#" title="<s:text name="tooltips.key"/>"> <s:textfield key="key" name="mykey" theme="simple"></s:textfield> </a> for textfields, can't move around cursore in textboxs once select insides them. for select tag, can't select texts drop down list. and keeps appending # end of action once click on href wrapped struts2 tag. <a> tag should not used tooltip. i suggest go css or js this. declare hidden field " tooltips.key " value, show on :hover of <s:textfield> you can use helper this: http://csstooltip.com/

java - Using WindowBuilder Pro the design tab is missing several components -

Image
i'm doing project using windowbuilder pro , has been fine until now. when in "design" tab preview of gui , components view missing lot of components code. here interface when compiled: can see there several components and here design tab: all shown in components section , preview section main tabs component , components contains. couple of days ago components section fine, showed components can see in first image. problem? edit: in case anyone's interested, did messing around , have if-else conditional in constructor seems mess things - without works ok

how to keep a function from returning true twice with jquery -

i not "programmer" html/css hack trying write little jquery widget. not best format question here, know that, open edits , reworking make quality question. widget jsfiddle $(document).ready(function () { function titleinc() { var length = $('#title').val().length; if (length >= 5 && length <= 10) { return true; // if returned true, don't return true again } else { return false; } } $('#title').blur(function () { var current = parseint($('#end_val').val(), 10); if (titleinc) { $('#end_val').val(current + 12); } }); }); basically score keeping tool. challenge if function keeps returning true person gets many points. function checking char value of input. if between 2 values person should points. shouldn't more if go input , retab out. if onchange below/above false if onchange in range true if onchange still ok null any ideas? tr

signals - bash shell: Can a control-c cause shell to write an empty file? -

i have bash shell script. writes out text file. of works find if stop script control-c @ command level. file that's been written such as echo "hello world" >myfile.txt will end being empty. it possible when hit control-c stop shell script running caught @ instance it's opening write file , before puts in it, doesn't chance , leaves empty? if that's case. can in bash shell script exit gracefully after it's written file , before gets chance write file again, because it's doing in while loop. thanks! yes, it's possible end empty file. a solution trap signal that's caused ^c ( sigint ), , set flag can check in loop: triggered=0 trap "triggered=1" sigint while true if [ $triggered = 1 ] echo "quitting" exit fi ...do stuff... done edit: didn't realize though shell's own sigint handling trapped, still pass sigint subprocesses, , they'll killed if don't handle sigint the

php website gives 403 unless i refresh my browser cache -

i have website on live domain. times loads okay gives me 403 forbidden, other users same, tried every best check permissions , every other stuff, yesterday cleaned browser cache , history etc, , bamm, website start working, realized cache problem, solution problem, when clean cache domain starts working, c panel won't load until clean cache. .htaccess, .htaccess has options -indexes , removed confirm myself if problem .. no luck. highly appreciated! it should test machine problem. try on other machine.

asp.net mvc 4 - ModelContext + the "query" returns nothing -

i'm beginner in asp.net mvc4. i've created model table in data base. i've 2 entry in table. i try send entry in controller modelcontext returns null. here code: my controller: enter code herepublic class homecontroller : controller { //connection à la table private annoncemodelcontext db = new annoncemodelcontext(); public actionresult index() { annoncemodel last_annonce = db.annonces.find(2); if (last_annonce == null) { viewbag.message = "pas d'annonce pour le moment"; return view(); } else { return view(last_annonce); } } my views: @model wiki_bird.models.annoncemodel <section id="annonce" class="content-wrapper"> <h1>annonce</h1> <p> @viewbag.message <br /> @html.displayfor(model => model.titre) </p> </sectio

mysql - How to Update one column in a database table using two array values in Php -

here have combined 2 arrays update column called age in employee table. unfortunately values of column not getting updated. bellow $names[] , $ages[] 2 arrays. foreach (array_combine($names, $ages) $e => $f) { $sql = "update `employee` set `age`= '" . $e . "' `a`= '" . $f . "'"; $query= mysql_query($sql); } instead if give print command echo $sql // printing correct command, update `employee` set `age`= '41' `a`= '" . samuel . "' update `employee` set `age`= '46' `a`= '" . sonal . "' i know there problem arrays update sql query don't know how rectify it. that query can written way... $sql = " update employee set age = $e a = '$f'; "; also, (and obviously), don't store someone's age. store dob. , note mysql_ extension deprecated.

php - How to create a "Next Page" link to the "non-displayed" results of mySQL search? -

i have search engine on webpage (php). far, show results on same result page. want limit number of results 20 per page, , create "next page" link... if select top 20 * ... ... show top 20 results... how create <a href="...">nextpage</a> lead results 21 40? have use ajax? <?php<br> // database connection info<br> $conn = mysql_connect('localhost','dbusername','dbpass') or trigger_error("sql", e_user_error);<br> $db = mysql_select_db('dbname',$conn) or trigger_error("sql", e_user_error);<br> // find out how many rows in table <br> $sql = "select count(*) numbers";<br> $result = mysql_query($sql, $conn) or trigger_error("sql", e_user_error);<br> $r = mysql_fetch_row($result);<br> $numrows = $r[0];<br> // number of rows show per page<br> $rowsperpage = 10;<br> // find out total pages $totalpages =

asp.net mvc - MVC3 Razor dynamic form creation and validation -

i have setup page on website admin staff can create competition , add number of fields certains types , can set required or not competition. when competition page loaded questions load dynamically database using editor templates each question type ie text, multi select, multi line text, email there few tables main ones competition, competitionquestions , questiontypes each competition can have multiple questions of different types. the settings on question types have validation type ie email, regularexpression, length etc and questions when added each competition can set required or not now can competition page lead fine dynamically adding questions page editorfor , editor template each type. my problem don't know how manually apply validation required questions , validation based on question type validation settings?

.net - how to convert a datatable to List<long,List<keyvaluepair<string,string>>> in C# -

i have datatable 3 columns says, id, name , value. i want convert datatable list<long,list<keyvaluepair<string,string>>> . the trick id foreign ket table. have repeatative values. i want in c#. thanks in advance. no, not dictionaly.....actualy have 2 classes says, definded as.... public class runparameters { public long runid { get; set; } public list<workflowparameter<string>> workflowparameters { get; set; } public runparameters() { workflowparameters = new list<workflowparameter<string>>(); } } public struct workflowparameter<t> { public string parametername { get; set; } public t parametervalue { get; set; } } i want convert datable list. i cannot use dictionary since want serialize list send across network.... group items in query id , project each item group keyvaluepair : (from r in table.asenumer

ios - NSFetchedResultsController - track changes only to a subset of the properties -

the nsfetchedresultscontroller monitors changes whole managed object that's keeping track of. whenever property modified in current context, instance – controller:didchangeobject:atindexpath:forchangetype:newindexpath: gets called. of course affect performance of uitableview hooked frc, if changes happen frequently. is possible keep track of properties? need take advantage of frc changes more sporadic in time, without receiving notifications each time changing attributes modified. no can't. if need finer grain observation, separate properties different entity.

somebody please explain about strings in c? -

how store 2 strings 1 after other without concatenation (we can increment address) char str[10]; scanf("%s",str); str=str+9; scanf("%s",str); note: here if give first string bala , 2nd hi, should print hi after bala . hi should not replace bala. you cannot increment (or change in other way) array that, array variable ( str ) constant cannot changed. you can so: char str[64]; scanf("%s", str); scanf("%s", str + strlen(str)); this first scan str , scan once more, starting new string right on top of terminating '\0' of first string. if enter "bala" first, beginning of str this: +---+---+---+---+----+ str: | b | | l | | \0 | +---+---+---+---+----+ and since strlen("bala") four, next string scanned buffer starting right on top of '\0' visible above. if enter "hi" , str start so: +---+---+---+---+---+---+----+ str: | b | | l | | h | | \0 | +---+---+-

c# - NullException appears when the page is opened in ASP MVC -

Image
i developing asp.net mvc 3 application using c# , sql server 2005. i have created button appear fieldset when clicked on (and using jquery affect slide down). the fieldset contain form. when have created dropdownlist form,,,i have called list formviewmodel (because using entity framework , code first approach). the problem : when open page, exception appears : nullreferenceexception unhadled user code. object reference not set instance of object. it's related 'postesitems', don't know why demand declaration of object because import viewmodel. this code of view : <%@ page title="" language="c#" inherits="system.web.mvc.viewpage<mvcapplication2.models.flowviewmodel>" %> <% using (html.beginform()) { %> <%: html.validationsummary(true) %> <fieldset class="parametrage"> <legend>gestion de gamme</legend> <div><%:html.label("poste :&

node.js - How do I trigger a real time client update in Rails -

i'm creating online multiplayer board game using rails, , want game able played without having manually refresh page. i'm planning on using websockets or server sent events's update page. haven't decided yet, don't expect make difference question. the thing i'm confused knowing when send update client. example, let's making chess, , player1 took turn. send move server, server save database. how player2's websocket or sse know push info player1's move player2's brower? i know regularly query database see if game has been updated, seems hard scale since every user querying database often. is there easy way wait update database , notified of automatically somehow? or there other solutions? i've looked around online bunch solutions this, haven't gotten concrete ideas. i'm open using library or whatever solve problem long it's free. i've seen paid solutions aren't option. i saw suggest somehow using node.js alongs

How to send by socket C++ compatible struct from Java? -

suppose there written, unchangeable host program, receives such c++ struct socket: #pragma pack(push, 2) struct data { double x; double y; double z; long framenumber; }; #pragma pack(pop) platform: c++ / 32-bit windows application compiled in visual studio 2008 how send such data java socket? have attemted fill bytebuffer putdouble(), , putlong(), putint() assuming long 32-bit, cannot produce valid values. i have generated , sended data randomly, , structure-level bytes assignment looks fine(i can randomize 1 value, example x), cannot produce exact value (propably different double representation?), random stuff sending math.random() * double.max_value; can use google protocol buffers on 1 side (client producing data) solve problem? remember, cannot change server (receiving) side i know can move sending data c++ , use jni, i'm searching simpler solution. i see @ least 2 possible problems here: double representation @ byte-level (like 01234567 , 76543

ios UIScrollview pass scroll event to superview -

i have uiview, , uiview can detect pan gesture move uiview left. add scrollview uiview, , scrollview can move left , right(scroll's method), in scrollview view, add uitableview can scroll , down , uitablecell can detect uitapgesture. if not use uiscrollview, when scroll tableview left(the tableview can not scroll left), uiview can detect pan gesture , move left, if use uiscrollview, when scroll tableview ,the move event detected uiscrollview , can not pass it's superview ,the uiview. how can pass move event uiview if uiscrollview can not scroll because it's contentoffset.x == 0 , can not scroll left, uiview can detect pan gesture , move left. thank you!

Vim exec command in command line, and Vim: Warning: Input is not from a terminal -

vi.sh vim -c "set ft=unix" -c "x" $1 main.sh sh vi.sh file1 sh vi.sh file2 if exec sh vi.sh file1 or sh main.sh , there no warning. but if exec cat main.sh | sh , give: vim: warning: input not terminal . what difference? how can dismiss warning message when run cat main.sh | sh ? in ~/bin/r [ $# -eq 0 ] && set -- -; vim -r "$@" in .vimrc : au stdinreadpost * set buftype=nofile

sentry - how to decrease height of linearlayout which is an image in android -

i want decrease height of image used linearlayout in android.how can that? code below: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="100dp" android:layout_height="100dp" android:background="@android:color/transparent"> <imageview android:id="@+id/icon" android:layout_weight="0.15" android:layout_width="0dp" android:layout_height="48dp" android:layout_gravity="center_vertical" android:padding="5dp" android:scaletype="fitcenter"/> <linearlayout android:id="@+id/details" android:layout_weight="0.75" android:layout_width="0dp" android:layout_height="fill_parent" android:orientation="vertical" android:gravity=&qu

serialization - Input in tr>td>input is not processed with jquery serialize -

i have found solution problem face under last solution provided under link: create html table each tr form anyhow, here fragments code: html: <tr class="a1td"> <td class="style1">12</td> <td class="style1">i_pinz/td> <td class="style1">2013-05-12</td> <td class="style1">2013-05-12</td> <td class="style1"><input type="text" name="name1" value="val1" id="name1" size="50" maxlength="50" placeholder="exampletext" /></td> <td class="style1"><input type="text" name="name2" value="val2" id="name2" size="20" maxlength="32" placeholder="example2" class="cleaninput" /></td> <td class="style1"><input type="text" name="name3&

android - Send MMS programmatically -

i want send mms programmatically used following code intent sendintent1 = new intent(intent.action_send); try { sendintent1.settype("text/x-vcard"); sendintent1.putextra("address","0475223091"); sendintent1.putextra("sms_body","hello.."); sendintent1.putextra(intent.extra_stream, uri.parse(vcffile.tourl().tostring())); } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } startactivity(sendintent1); the problem directing compose message page , requires manually send sms , dont want without notification should send how can it?? somebody please share me answer i found solution works 100%. please refer github project https://github.com/klinker41/android-smsmms . (anyone find usefull please donate author http://forum.xda-developers.com/showthread.php?t=2222703 ). notice, obligatory settings set

Equally distributed icons in an Android Progressbar -

Image
i'm trying sound easy implement. however, doesn't respond expected. i'm using progressbar draw 5 state bar, user can click on of states change behavior of application. progressbar uses drawable (just pay attention background element). <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/background"> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/statusbar_thin" /> </item> <item android:id="@android:id/secondaryprogress"> <clip> <shape> <gradient android:endcolor="#ffeeeeee" android:startcolor="#ffeeeeee" /> </shape> </clip> </item>

LDAP query from Java is slow -

we having performance issues our ldap , out java server. whenever call our ldap query, looks (&(objectclass=person)(department=0128)(departmentnumber=1)) takes 2000 milliseconds, slow us. however if perform search, using same query standard ldap browser (eg. ldap admin program web), takes few milliseconds. our simplified code below : public static void main(string[] args) throws namingexception { hashtable<string, string> env = new hashtable<string, string>(); // nopmd env.put(context.provider_url, "ldap://abc123.muc:389"); env.put(context.security_principal, "cn=myproject,ou=projectusers,dc=com"); env.put(context.security_credentials, "asdf"); env.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); env.put(context.security_authentication, "simple"); ldapcontext ileanldapctx = new initialldapcontext(env, null); //time create context = 40ms string

how to check the UITextField input have uppercase inputs - ios -

how check uitextfield input have uppercase inputs. for example : input girija return true. input girija return false. input girija return true. please guide me. thanks bool hasupperchars = ![[inputtxt lowercasestring] isequaltostring:inputtxt];

python - How to determine which executable from a list is running -

this question has answer here: list running processes on 64-bit windows 5 answers how detect if process running using python on win , mac 2 answers i have path have many executables (around 800). need know if of executables running. because need run build , if executables running cannot recreate them (access error when linker invoked). what run taskkill (i on windows platform) on executables. takes time , i'd know if there's faster/better way. the build scripts written in python other solutions welcome if can integrate them. iulian for similar purposes have used psutil library. hints: list processes psutil.pids() ( reference ) inspect process information process = psutil.process(pid) ( reference ) do process.kill or process.terminate() instal

c# - FileSystemWatcher under mono - watching subdirs -

i have problem. have written wrapper on filesystemwatcher detects changes in root folder , of subfolders. nothing fancy: filesystemwatcher watcher = new filesystemwatcher (); watcher.path = this.root; watcher.includesubdirectories = true; watcher.notifyfilter = notifyfilters.lastwrite | notifyfilters.lastaccess | notifyfilters.directoryname | notifyfilters.filename; watcher.changed += new filesystemeventhandler (watcher_changed); watcher.deleted += new filesystemeventhandler (watcher_deleted); watcher.created += new filesystemeventhandler (watcher_created); watcher.renamed += new renamedeventhandler (watcher_renamed); watcher.enableraisingevents = true; while in .net, under windows, works charm. when ported code mono , ran code under osx, works in root folder. issues have noticed now: events not raised operations within folders existing under root @ time watcher starts paths via eventargs.fullpath property not correct (when copy file path_to_root/some/more/subdirs/some

javascript - Limit Sum Value of Multiple Input Fields -

i need javascript or jquery. i have 3 (3) input fields want filter (sum of 3 fields). the total value of 3 input fields must 100. if user fills more 100, automatically change value total 100. you can see this example <input type="text" name="text1" size="3"> text1<br /> <input type="text" name="text2" size="3"> text2<br /> <input type="text" name="text3" size="3"> text3<br /> <p>the maximum value of total 3 fields above 100.</p> <pre>example 1 : text1 : 20; text2 : 30; text3 : 50; (will automatically filled 50 because total value must 100)</pre> <pre>example 2 : text1 : 37; text2 : 60; text3 : 3; (will automatically filled 3 because total value must 100)</pre> thanks helping me, need :) $(function(){ $('input[name="text1"]').keyup(function(){

ruby on rails - Why resources on collection has different routing helper then regular post -

in routes.rb had resource resources :home_screen_buttons post :update_multiple, :on => :collection end update_multiple helper update_multiple_home_screen_buttons then decided remove resource because need update_multiple method in controller, changed routes.rb to post "home_screen_buttons/update_multiple" it create helper home_screen_buttons_update_multiple instead of update_multiple_home_screen_buttons why has different routing helper name? it makes sense :on => :collection has different helper :on => :member, there other way adding :as => :update_multiple_home_screen_buttons post method same behavior? this how rails this. when match used, maps uri action , creates corresponding helper path controller_action_path when used collection, becomes restful action resource , rails gives logical name relating collection. quoted example here : resources :photos collection 'search' end end generates search_photos_pat

c# - Visual Studio 2012 + 403.7 Error -

i've been spinning wheels few days not making progress, , suggestions i've found far online haven't quite done trick, here goes: i have wcf service ties into... not sure type of web service you'd call on other end, kind of rest-ish. url method looks " https://partner.someservice.com/somemethod.asp ". cram query string args onto end of , post request server. the error in vs shows 403, when i've used fiddler see 403.7. before importing cert browsers saw 403.7 well. can inspect request object , see clientcertificates [1] cert specified, i'm pretty sure getting attached. i've imported .pfx file both machine , local user cert stores. i've run winhttpcertcfg utility number of times in number of ways, following instructions i've seen on msdn , posts. winhttpcertcfg -g -c local_machine\my -s [cert] -a [user/aspnet/auth'd users] winhttpcertcfg.exe -i [cert.pfx] -c local_machine\my -p [pwd] i've imported .pfx file chrome. if h

r - converting a row of data.frame to column names using data.table -

i have large data frame of 5 million rows, 3 columns. transform matrix has rows user_id, id columns, , value cnt. done melt , cast or xtabs(cnt ~ user_id + id, data = foo) however object created large , following error 'dim' specifies large array user_id id cnt 1 1.813e+14 21 1 2 1.559e+14 28 1 6 1.592e+14 71 2 i'm trying use data.table seams handle large data better data.frame, can't figure out how use data.table create contingency table want. 1 have idea how working? i'm thinking of creating , empty matrix appropriate dimensions , fill appropriate indexes. try using built in data.frame co2 : > xtabs(uptake ~ treatment + type, co2) type treatment quebec mississippi nonchilled 742.0 545.0 chilled 666.8 332.1 or using tapply : > with(co2, tapply(uptake, list(treatment, type), sum)) quebec mississippi nonchilled 742.0 545.0 chilled 666.8 332.1 a

How to use Excel formulas in C# -

i want calculate right-tailed probability of chi-squared distribution in c#. excel can calculation using following code = chisq.dist.rt(100,4) where 100 chi-squared , 4 degree of freedom. i want use function in c# calculation; tried adding reference "microsoft.office.interop" not find way use ! i came across topics of how use c# formulations in excel , results in excel, unfortunately not need; need calculation in c# , results in c#. if wanting calculation similar excel calculation, should consider @korolewi's suggested comment. if have use excel's engine, can what previous poster suggested, require instance of excel installed on web server , launch excel each time code executed, etc. bad practice , unsupported microsoft use third party tool aspose.com's cells. set formula, calculate it, , value wookbook without opening excel on server.

mysql - SELECT inside stored proc doesn't work correctly whereas outside it does -

i have simple database follows in mysql: drop table if exists mediavend.itemdetails; create table if not exists mediavend.itemdetails ( itemid bigint unsigned not null, itemtype enum('music', 'movie', 'game') not null, itemmediatype enum('cd', 'dvd', 'bluray') not null, itemname char(100) not null, itemdescription char(200) not null, itemcount bigint not null, machineid bigint not null, primary key (itemid) ); insert mediavend.itemdetails values (1,'music','cd','album 1','some description of 1',100,1), (2,'music','cd','album 2','some description of 2',20,1), (3,'movie','dvd','movie 1','some description of 1',30,1), (4,'movie','bluray','movie 2','some description of 2',40,1), (5,'game','dvd','game 1','some description of 1'

java - Unmarshal a modified xml file -

in java project need unmarshal xml file in order list of objects. the unmarshalling works fine problem encontourned when content of file modified. in fact in project can add new contents file clicking on "addbuton" when want unmarshal time same file (after modification) old list of objects without last elements (i have added file). i verified physical xml file on disk , found last content added. noticed way last list of objects close appli , reopen again, unsuitable. here piece of code: //classe1.java file inifile = new file(proprietesperle.getrepref() + "referential.xml"); fileinputstream fs = = new fileinputstream(inifile); ref = referentiel.unmarshal(fs); treemap map = referentielutil.getapplication( ref ); ... //classe2.java treemap map = new treemap(); list listpl = app.getpl(); //this list unmarshalled xml file listiterator itpl = listpl.listiterator(); while (itpl.hasnext()) { pl pl = (pl)itpl.next(); map.put(pl

distribution - entropy estimation using histogram of normal data vs direct formula (matlab) -

let's assume have drawn n=10000 samples of standard normal distribution. now want calculate entropy using histograms calculate probabilities. 1) calculate probabilities (for example using matlab) [p,x] = hist(samples,binnumbers); area = (x(2)-x(1))*sum(p); p = p/area; (binnumbers determined due rule) 2) estimate entropy h = -sum(p.*log2(p)) which gives 58.6488 now when use direct formula calculate entropy of normal data h = 0.5*log2(2*pi*exp(1)) = 2.0471 what do wrong when using histograms + entropy formula? thank help!! you missing dp term in sum dp = (x(2)-x(1)); area = sum(p)*dp; h = -sum( (p*dp) * log2(p) ); this should bring close enough... ps, careful when take log2(p) might have empty bins. might find nansum useful.

slidetoggle - Javascript, Toggle, Slide -

http://jsfiddle.net/z9zd8/271/ $(function() { $('#toggle1').click(function() { $('.toggle1').toggle(); return false; }); $('#toggle2').click(function() { $('.toggle2').toggle(); return false; }); $('#toggle3').click(function() { $('.toggle3').toggle(); return false; }); $('#toggle4').click(function() { $('.toggle4').toggle(); return false; }); }); i like, open slider. say: have slider 1 open. when open slider 2, close slider 1 . should open slider i hope can me thank you just use jquery code: fiddle demo $("a[id^='toggle']").click(function(){ $('div[class^="toggle"]').slideup(500); $("."+$(this).attr("id")).slidetoggle(500); });

vbscript - Rename files without copying in same folder -

i have files following naming convention. re12356_gj123456789.dat i need rename file re12356_gj123456790.dat without copying files using vbs i.e. need increment 1, everytime when run vbs file. please me. thanks! the filesystemobject has method .getfile(filespec) returns object file filespec. objects have (writable) .name property. .name, modify it, , write/assign new one. to give ideas (looping on files in folder, finding file(s) change, extracting number increment): option explicit dim gofs : set gofs = createobject( "scripting.filesystemobject" ) wscript.quit demomain() function demomain() demomain = 0 ' assume success dim sddir : sddir = gofs.getabsolutepathname(".\") dim revictim : set revictim = new regexp revictim.ignorecase = true revictim.pattern = "^(victim)(\d+)(\.txt)$" dim ofile each ofile in gofs.getfolder(sddir).files if revictim.test(ofile.name) wscript.echo "found:

Data-binding via Dart web-ui in a Bootstrap Popover -

i'm trying use two-way data-binding dart variable inside bootstrap popover no success. code looks like: <!doctype html> <html> <head> <meta charset="utf-8"> <title>test popup</title> <!-- bootstrap --> <link href="resources/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="resources/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"> </head> <body> <button type="button" id="constcon-options-button" class="btn" title="options" rel="popover" data-html="true" data-content=" <div id='constcon-options-form' class='form-horizontal'> <input type='radio' name='veggies' value='kale' bind-value='veg'> kale<br> <input type='rad

warnings - PHP: why is "Strict standards: Declaration of x should be compatible with y" applied to static methods? -

the php warning, "strict standards: declaration of x should compatible y" warns if write code like: class { function foo($x) { .. } } class b extends { function foo() { .. } } this sensible, because object reference " $a " think a , may @ runtime turn out b , dynamically dispatched method call $a->foo(3) may end calling b::foo() wrong number of arguments. my question is: why same warning applied static methods, not dynamically dispatched? class x { static function bar($x) { .. } } class y extends x { static function bar() { .. } } in example, function y::bar() not override x::bar() , there no reason trigger warning, php still does. why? just in java, can call static methods on instance too. there still room confusion.

python - How do I manipulate multiple x-axes to correspond to each other, while on different scales? -

Image
i trying make color magnitude diagram similar to: i have 3 arrays contain exact same number of values. x1 = b-v (-.5 2) x2 = temperature. (30,000 3000) , needs log scale y1 = magnitude (varies based on others) the x1 , x2 , , y1 arrays linked, , plot them in scatterplot. my code: #plots x1 = bv_array #b-v x2 = t_array #temperature y1 = vavg_array #magnitude fig = plt.figure() ax1 = fig.add_subplot(111) #ax1.xlim(-.5,2) ax1.plot(x1, y1,'b--') ax2 = ax1.twiny() ax2.plot(x2, y1, 'go') ax2.set_xlabel('temperature') ax2.invert_xaxis() #ax2.xscale('log') #plt.xscale('log') #plt.scatter(x,y) #plt.scatter(bv_array, vavg_array, s = 1) plt.gca().invert_yaxis() plt.show() if i'm understanding correctly, should able pick single point on right hand edge of graph axes should aligned, , matplotlib take there. ax1 = fig.add_subplot(111) ax1.xlim(-.5,2) # set in axis 1 coords ax1.plot(x1, y1,'b--&#

c - What is the bestway to return a char pointer? -

what best way return or pass strings in char pointers in c? i have function looks this: char *test_getcwd(){ char *cwd; char *ret; if ((cwd = getcwd( ret, pathconf(".",_pc_path_max) )) == null){ perror ( "error on calling getcwd() function" ); }else if (__include_level__ == 0){ puts( cwd ); } free( cwd ); return ret; } should change to: int test_getcwd(const **pass){ char *cwd; char *ret; if ((cwd = getcwd( ret, pathconf(".",_pc_path_max) )) == null){ perror ( "error on calling getcwd() function" ); }else if (__include_level__ == 0){ puts( cwd ); } free( cwd ); *pass = ret; return 0; } or leave or maybe change else? similar questions may have been asked goal find best practice it. the first argument getcwd must either null or pointer existing buffer. clue how design routine. either: accept pointer existing buffer parameter,

ffmpeg conversion for an entire folder? -

ive been using: sudo ffmpeg -i test.mkv -vcodec copy -acodec libfaac -ac 2 -ab 328k test.mp4 for individual files, have many gigabytes of mkvs in folder , conversion @ once , walk away computer. appologize ignorance, new linux , dont understand how bash scripts written or if necessary. also, believe command downsamples dts audio in mkv 2 channel aac. correct 328k highest bitrate can convert to? one way it, assumes @ least 1 mkv file in folder. for inf in *.mkv ffmpeg -i "$inf" -c:v copy -c:a libfaac -ac 2 -ab 328k "${inf%.*}.mp4" done

html - Which are good references for mobile webdev? -

i bit more mobile webdev , searching books or screencasts topic. of course found dozents, don't know choose. does make sense read books design part in it, although won't ever make design, implement them? any suggestions out there, there must have reads? thanks help! edit: searching books, cover themes media-queries , on. have put designs in web pages , improve skills making them mobile friendly. i've found smashing magazine helpful: http://mobile.smashingmagazine.com/ if prefer book format, mobile book collection of articles related mobile design , development , quite good: http://www.the-mobile-book.com/ has chapter on responsive design patterns might find useful.