Posts

Showing posts from September, 2014

refactoring - Tool for 'Flattening' (simplifying) C# Source -

refactoring - Tool for 'Flattening' (simplifying) C# Source - i need provide re-create of source code 3rd party, given it's nifty extensible framework repurposed, i'd rather provide less oo version (a 'procedural' version want of improve term) allow minor tweaks values etc not reimplementation using total flexibility of how structured. the code makes utilize of usual stuff: classes, constructors, etc. there tool or method 'simplifying' still 'source' using plain variables etc. for example, if had class instance 'myclass' initialised this.blah in constructor, same done variable called myclass_blah manipulated in more 'flat' way. realise things polymorphism not possible in such situation. perhaps obfuscator, set 'super mild' setting accomplish it? thanks my experience nifty extensible frameworks has been shops have own nifty extensible frameworks (usually more one) , not steal them vendor-provide...

osx - non-digit file error -

osx - non-digit file error - i trying update head revision using smartsvn v6 professional version. getting error update head: first line of '/folders/.svn/entries' contains non-digit file '/folders/.svn/format' not exist how prepare above error? i got error of times. solved need create new folder , checkout whole project there works. thats not preferred way... do utilize command line version of subversion client? or client besides smartsvn? i think happen when mix different workcopy version. to check workcopy version, see question: how determine svn working re-create layout version? osx svn smartsvn

testing - Sinon JS "Attempted to wrap ajax which is already wrapped" -

testing - Sinon JS "Attempted to wrap ajax which is already wrapped" - i got above error message when ran test. below code (i'm using backbone js , jasmine testing). know why happens? $(function() { describe("category", function() { beforeeach(function() { category = new category; sinon.spy(jquery, "ajax"); } it("should fetch notes", function() { category.set({code: 123}); category.fetchnotes(); expect(category.trigger).tohavebeencalled(); } }) } you have remove spy after every test. take @ illustration sinon docs: { setup: function () { sinon.spy(jquery, "ajax"); }, teardown: function () { jquery.ajax.restore(); // unwraps spy }, "test should inspect jquery.getjson's usage of jquery.ajax": function () { jquery.getjson("/some/resource"); assert(jquery.ajax.calledonce); asse...

python - How to use scripts to excecute django commands -

python - How to use scripts to excecute django commands - hi created website in django. , have used web hosting provider has django, python , sql installed. not have ssh alternative or command prompt in file manager. how can utilize script excecute commands after uploading site server . i want file created updatedb.sh or updatedb.py . can tell me how utilize scripts lone host django site live. it possible have django views execute lines like: import os os.system("python manage.py syncdb") in theory site working that. however, this poor strategy deployment. aside hassle of having os.system lines every time want anything, if entire site breaks? you'd using convoluted hacks basic maintenance. if web hosting provider doesn't back upwards kind of command line or give other options setting django, it's time find new web hosting provider. might recommend heroku, supports django , lets deploy using git. (it free amount of use). python d...

iphone - Returning a BOOL value from alertview delegate method: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -

iphone - Returning a BOOL value from alertview delegate method: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex - i added tabbar controller on mainwindow.xib displaying 5 tabs , have tab bar controller's delegate method: shouldselectviewcontroller in app delegate returns boolean value (yes or no). in delegate method, showing alert user (if user going tab 1 other tab). alert contains 2 buttons: ok , cancel. if user clicks on ok, want delegate method homecoming yes (so user can go other tabs) , if user has selected cancel (in case wants remain on tab 1 only), want method homecoming no. so, want shouldselectviewcontroller method stop executing till time alert nowadays on screen. there way can homecoming bool alert view's delegate method may, in turn, returned shouldselectviewcontroller or threading solution may of utilize situation?? try this in .h uiviewcontroller *tmpcontroller; in .m -(bool)tabbarcontrol...

android - WebView ignore Javascript that invokes PUT/DELETE Http method -

android - WebView ignore Javascript that invokes PUT/DELETE Http method - i have web view in it's html/javascript makes http phone call put/delete methods. calls seems ignored (i test them on chrome , work fine). any idea? here's js code within webview: var req = new backbone.model(auth); $.ajax({ type: put, url: 'some_url', data: json.stringify(req) }); note ajax phone call jquery. the reason webview ignored phone call because of caching. seems put/delete calls cached. here's did solve this: $.ajax({ type: methode, url: 'some_url?d' + new date().gettime(), data: json.stringify(req), }); as can see added new date() object creation in order overcome caching mechanism. thanks guy helping out. should check out blog @ http://blog.guya.net/ javascript android http webview http-put

css3 - css background transition in opera goes through black -

css3 - css background transition in opera goes through black - i'm getting css3 transitions (about time!) , witness unusual behavior in opera 11.60. i utilize transition alter element background:none background:#fff . however, transition goes through black/dark gray before reaching target. now, can understand why happens - opacity , color animated @ same time, , since color used none , opera regards #000 . looks bug me. is there way prepare this, save turning off transitions in opera elements background:none ? how trying transition background: rgba(255,255,255,0) background: rgba(255,255,255,1) ? (that’s white 0 opacity white total opacity.) see e.g. http://jsfiddle.net/tajmg/ css3 opera css-transitions

Java SSL code throwing NoSuchAlgorithException -

Java SSL code throwing NoSuchAlgorithException - i'm working on project want add together ssl to, created simple client/server test implementation see if worked , nosuchalgorithmexception. next server code throwing exception: import java.io.*; import java.net.*; import java.security.keymanagementexception; import java.security.keystore; import java.security.keystoreexception; import java.security.nosuchalgorithmexception; import java.security.securerandom; import java.security.unrecoverablekeyexception; import java.security.cert.certificateexception; import javax.net.ssl.*; public class sslserver { private static final int port = 5555; public static void main(string[] args) { securerandom sr = new securerandom(); sr.nextint(); seek { //client.public keystore file holds client's public key (created keytool) keystore clientkeystore = keystore.getinstance("jks"); clientkeystore.load(n...

asp.net mvc 3 - Application_End being called too early/frequently -

asp.net mvc 3 - Application_End being called too early/frequently - i using temporary database in project disposed on application_end : protected void application_end() { if (_db != null) _db.dispose(); } the problem application_end seems called whilst browsing through web project - seems when edit object in db, alter made, database disposed, , time redirected index - new db has been created , shows unchanged object if nil had happened. shouldn't application_end beingness called when session ended or after amount of idle time? could tell me how may able ensure application_end called when finished using application? the problem application_end seems called whilst browsing through web project that happens when appdomain unloaded. while debugging happen everytime recompile project normal because everytime recompile assembly in bin folder beingness regenerated , asp.net recycles application domain. when deploy application in iis happen more rare...

knockout.js - Extending knockout observable array -

knockout.js - Extending knockout observable array - i'd add together "arraycollection" functionality ko.observablearray(); i.e removeitemat(index)//dispatches item removed event additem(item)//dispatches item added event etc i notice in of ko examples handled in model. have rich model typed collections nest in collection/array itself. is approach advisable ko? extending observablearrays easy , reasonable thing do. the easiest way accomplish add together functions ko.observablearray.fn . there doc page technique here: http://knockoutjs.com/documentation/fn.html this little bit different after, here nice implementation of dictionary in ko may of involvement you: https://github.com/jamesfoster/knockout.observabledictionary knockout.js

objective c - remove sprites with animation, different z order -

objective c - remove sprites with animation, different z order - how remove sprites on top of each 1 different z order? the code i'm using is: - (void)removeselectedsprite:(cgpoint)touchlocation { ccsprite * newsprite = nil; (ccsprite *sprite in selectedspritesarray) { if (cgrectcontainspoint(sprite.boundingbox, touchlocation)) { newsprite = sprite; break; } } if (newsprite) { ccsprite *fixedsprite = [ccsprite spritewithspriteframename:@"animation_01.png"]; fixedsprite.position = ccp(newsprite.contentsize.width/2,newsprite.contentsize.height/2); [newsprite addchild:fixedsprite]; nsmutablearray *animframes = [nsmutablearray array]; for(int = 1; <= 5; ++i) { [animframes addobject: [[ccspriteframecache sharedspriteframecache] spriteframebyname: [nsstring stringwithformat:@"animation_%02d.png", i]]]; } ccanimation ...

actionscript 3 - Getting swf boolean parameters -

actionscript 3 - Getting swf boolean parameters - i have swf phone call as /swfuploader/upload.swf?single=true then in actionscript 3 read in value. it's not working. here's test code (the first block taken http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html ): var keystr:string; var valuestr:string; var paramobj:object = loaderinfo(this.root.loaderinfo).parameters; (keystr in paramobj) { valuestr = string(paramobj[keystr]); trace(keystr + " = " + valuestr); } var issingle:boolean = this.loaderinfo.parameters.single boolean; var issingle1:boolean = this.loaderinfo.parameters['single'] boolean; var issingle2:boolean = loaderinfo(this.root.loaderinfo).parameters['single'] boolean; var issingle3:boolean = loaderinfo(this.root.loaderinfo).parameters.single boolean; trace(issingle + ", " + issingle1 + ", " + issingle2 + ", " + issingle3); and frustratingly resulting 2 lines traced...

WebSphere Message Broker MQMD Report -

WebSphere Message Broker MQMD Report - when set mqmd.expiry , mqm.report (= mqro_expiration_with_full_data) in message broker, messages go if expire? should grab them in mqinput node? if so, how differentiate between these , other errors? i found answer: you have set mqmd.replytoq in message header. way homecoming queue 1 time expire. (keep in mind message thrown out when mqget performed on queue (just moving comments in case misses it.) websphere message websphere-mq messagebroker

How to write a simple C# script to copy file to directory one level up? -

How to write a simple C# script to copy file to directory one level up? - trying write simple c# script re-create file directory 1 level up. here have, sending error, "script.onactivate()" not code paths homecoming value. and code: using system; using system.collections.generic; using system.componentmodel; using system.drawing; using system.text; using system.text.regularexpressions; using system.io; using system.windows.forms; using system.globalization; class script : copyfile { public static bool onactivate() { copydatafile("script/file.js", "../file.js"); } } solved! using system; using system.io; class script : copyfile { public static void onactivate() { fileinfo myfile = new fileinfo("script/file.js"); myfile.copyto(myfile.directory.parent.fullname + "\\" + myfile.name); } } this moves file.js directory 1 level "script/" ...

Is this a good way to implement a search feature in my Rails application that uses dbpedia and SPARQL? Is there a better way to do this? -

Is this a good way to implement a search feature in my Rails application that uses dbpedia and SPARQL? Is there a better way to do this? - i'm trying set "movie search" application using ruby on rails 3. i'm pulling info dbpedia using sparql (rdf , sparql/client). want potential user able search movie, view results, , click view page generate on film contains more info (both dbpedia , own local database). this first time using huge info set , sparql , i've noticed it's slow, , guess can't helped. still much utilize info source though. i have rails app set utilize mongodb, thinking can utilize cache of dbpedia info users don't need wait query every single time. i'm stuck on best way implement this. current thought along these lines: on first search ever, store details each result in local database (probably basic film info such title, overview, year, alternate titles) when user search, next occurs: run search query on...

java - Does volatile mean it is thread safe -

java - Does volatile mean it is thread safe - in java, when want ensure compiler should not optimization keeping local re-create of variable, create variable volatile. using variable volatile ensures threads not utilize local re-create of variable utilize variable stored in main memory. but, mean volatile variable thread-safe? how differ in case of primitive type , in case utilize user defined object? volatile means value fresh; if thread set new object variable before you, see object. it not alter behavior of value; cannot magically create object thread-safe. java thread-safety compiler-optimization

sql - How to structure a query with a large, complex where clause? -

sql - How to structure a query with a large, complex where clause? - i have sql query takes these parameters: @searchfor nvarchar(200) = null ,@searchinlat decimal(18,15) = null ,@searchinlng decimal(18,15) = null ,@searchactivity int = null ,@searchoffers bit = null ,@startrow int ,@endrow int the variables @searchfor , @searchactivity , @searchoffers can either null or not null. @searchinlat , @searchinlng must both null, or both have values. i'm not going post whole query boring , hard read, clause shaped this: ( -- filter activity -- (@searchactivity null) or (@searchactivity = activities.activityid) ) , ( -- filter location -- (@searchinlat null , @searchinlng null) or ( ... ) ) , ( -- filter activity -- @searchactivity null or ( ... ) ) , ( -- filter has offers -- @searchoffers null or ( ... ) ) , ( ... -- more stuff ) i have read bad way construction query - sqlserver has problem working out efficient execution pl...

CLI/Testing: Language for testing command line interfaces -

CLI/Testing: Language for testing command line interfaces - what best (probably, scripting) language testing command line interfaces (cli) ? tried expect, not object oriented , hence not convenient testing multiple connections simultaneously. tests should run on linux , windows platforms. i've been having great success @ using vbscript / jscript (via windows script host) unit testing harness both console applications , activex com objects. then, moment there interactive elements, scale html applications (via mshta). testing command-line-interface

xml - How to save twitter feed entries to a django model? -

xml - How to save twitter feed entries to a django model? - so, here twitter feed want save model: #stackoverflow. able each entry in feed dictionary using feedparser. , info looks this: { 'author': u'stackfeed (stackoverflow)', 'author_detail': { 'href': u'http://twitter.com/stackfeed', 'name': u'stackfeed (stackoverflow)'}, 'authors': [ { 'href': u'http://twitter.com/stackfeed', 'name': u'stackfeed (stackoverflow)'}], 'content': [ { 'base': u'http://search.twitter.com/search.atom?lang=en&q=stackoverflow', 'language': u'en-us', 'type': u'text/html', 'value': u'how inject single mill instance multiple repositories , unit of work using ninject?: first, have ... <a href="http://t.co/vyqlswj5">http://t.c...

c# - Is it possible to read cross domain cookie? -

c# - Is it possible to read cross domain cookie? - is possible read cross domain cookie in c#? if possible how can read cookie, cookie set in 1 domain "dev-001" , cookie in domain "localhost" i used request.cookies["userinfo"].values it shows null value. is there possibilities.because it's our requirement. info available in cookie. can't read no, that's not possible. cookies cannot shared cross domain. huge security flaw. c# asp.net

javascript - Highcharts - how to have a chart with dynamic height? -

javascript - Highcharts - how to have a chart with dynamic height? - i want have chart resizes browser window, problem height fixed 400px. this jsfiddle example has same problem. how can that? tried using chart.events.redraw event handler resize chart (using .setsize), guess starts never-ending loop (fire event handler, calls setsize, fires event handler, etc.). just don't set height property in highcharts , handle dynamically long set height on chart's containing element. can fixed number or percent if position absolute. highcharts docs: by default height calculated offset height of containing element example: http://jsfiddle.net/wkkad/149/ #container { height:100%; width:100%; position:absolute; } javascript highcharts

web services - AbstractMethodError: gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub -

web services - AbstractMethodError: gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub - everyone, i'm fresh man in building webservice applications. using this example access ncbi (national center biotechnology information) webservice api. getting error below when seek , access data. does know how solve issue? log4j:warn no appenders found logger (org.apache.axis2.description.axisoperation). log4j:warn please initialize log4j scheme properly. exception in thread "main" java.lang.abstractmethoderror: gov.nih.nlm.ncbi.www.soap.eutils.eutilsservicestub$egqueryrequest.serialize(ljavax/xml/namespace/qname;ljavax/xml/stream/xmlstreamwriter;)v @ org.apache.axis2.databinding.adbdatasource.serialize(adbdatasource.java:90) @ org.apache.axiom.om.impl.llom.omsourcedelementimpl.internalserialize(omsourcedelementimpl.java:695) @ org.apache.axiom.om.impl.util.omserializerutil.serializechildren(omserializerutil.java:563) @ org.apache.axiom.om.impl.llom.omelem...

Algorithm to smooth numbers with variable input time -

Algorithm to smooth numbers with variable input time - i have app accepts integers @ variable rate every .25 2 seconds. i'd output info in smoothed format 3, 5 or 7 seconds depending on user input. if info came in @ same rate, let's every .25 seconds, easy. variable rate confuses me. data might come in this: time - data 0.25 - 100 0.50 - 102 1.00 - 110 1.25 - 108 2.25 - 107 2.50 - 102 ect... i'd display 3 sec rolling average every .25 seconds on display. the simplest form of doing set each item array time stamp. array.push([0.25, 100]) array.push([0.50, 102]) array.push([1.00, 110]) array.push([1.25, 108]) ect... then every .25 seconds read through array, front, until got time less now() - rollingaveragetime . sum , display it. .shift() origin of array. that seems not efficient though. wondering if had improve way this. why don't save timestamp of starting value , accumulate values , number of samples until timestamp...

jquery - Dynatree - How To Transform The json Coming From Server? -

jquery - Dynatree - How To Transform The json Coming From Server? - i'm looking help dynatree plugin. i need transform json coming server create dynatree compatible (i'm not allowed on server side), this below apparently doesn't work: initajax: { url: '/admin/tenant/jsontree', data: { tenantid: 1 }, success: function(data) { // modifications info returned server // , homecoming formatted info } } and couldn't find callback in documentation. question is: possible initial transformation callbacks or should looking other plugins? thank in advance have @ 'loading custom formats' in docs: http://wwwendt.de/tech/dynatree/doc/dynatree...

c# - Example of using Websocket in .Net 4.5 -

c# - Example of using Websocket in .Net 4.5 - i trying build sample app uses web sockets in .net 4.5. based on illustration in here: http://blog.davidpadbury.com/2011/01/13/wcf-websockets-first-glance/ i have vs11 developer preview installed on windows 7. i not figure out namespace websocketsservice belongs to. of great help if can point me resource has finish details websockets working in .net. thanks. mk did download , install wcf websockets prototype html5 labs? the namespace microsoft.servicemodel.websockets in assembly microsoft.servicemodel.websockets.dll . 1 time install prototype library should able find assembly. c# websocket

Use .csv as data source with PHP -

Use .csv as data source with PHP - with php want pull in text comma separated csv file (my array) on server. dependent on text (title) pulled page variable. i.e. <div><?php echo $item->title;?> <div>prices £[php cost here]</div> where 'title' in echo (above) spain. so csv have: spain, 250 france, 350 germany, 150 spain beingness 'title' , '250' beingness [php cost here] want pull in. so if kingdom of spain 'title' beingness pulled in, grab cost of 250. i.e. spain prices £250 hope makes sense... thanks just example. assumning have file info called pricelist.csv . $pricelist = array(); if (($handle = fopen("pricelist.csv", "r")) !== false) { while (($data = fgetcsv($handle, 1000, ",")) !== false) { $pricelist[] = $data; } fclose($handle); } echo '<pre>'; print_r($pricelist); echo '</pre>'; will ...

Saving Box2D shapes -

Saving Box2D shapes - as part of save/load game code, need save state of box2d bodies in world. when , load , recreate them there quick pop of bodies separate each other. i've double , triple checked save game info , correct. for each body, i'm saving world position, angle, angularvelocity , linearvelocity. there more need save? i'm wondering if it's not possible save state of box2d world. i using c++ box2d code in ios. there dump function of b2world . set info world log file. can see log file , understand have save. ps: did not tried function myself box2d

asp.net - how to insert newline in string in c# after some particular digit? -

asp.net - how to insert newline in string in c# after some particular digit? - i programming code in have come in text in particular format only. i.e. 2 10 5 kdsfj ejkd kjdf 7 8 sdkj dsjklf ckjsd dksj and on but have come in info form text file having whole string 2 10 5 kdsfj ejkd kjdf7 8 sdkj dsjklf ckjsd dksj6 12 kjd ekjr fkjdr fdkj but want suppy text given above format. bold letters saparable points. want programme can add together newline after character or space followed digit ? how can ? the reply going form of regex regex.replace(inputstring, @"([a-za-z])(\d)", "$1" + environment.newline + "$2"); where input source line file, , pattern matches specific criteria. above replace end with: 2 10 5 kdsfj ejkd kjdf 7 8 sdkj dsjklf ckjsd dksj 6 12 kjd ekjr fkjdr fdkj your additional comments clarified line breaks when joined previous character; although still not sure why 2 ends on own line? c# asp.net st...

java - JFrame serialisation with LookAndFeel -

java - JFrame serialisation with LookAndFeel - i trying serialize jframe containing jdesktoppane several jinternalframes. encountered problem lookandfeel because reason not possible serialize swing component crossplatform lnf different one. wrote test programme in order figure out possibilites: public static void main(string[] args) { seek { jframe f = new jframe(); f.setbounds(200,200,200,200); jtree tree = new jtree(); f.add(tree); f.setvisible(true); uimanager.setlookandfeel( uimanager.getcrossplatformlookandfeelclassname()); swingutilities.updatecomponenttreeui(f); objectoutputstream oop = new objectoutputstream( new fileoutputstream(new file("test.serialized"))); oop.writeobject(f); } catch(ioexception e) { e.printstacktrace(); } grab (classnotfoundexception e) { // todo auto-generated grab block e.printstackt...

Mapping a new motion in Vim with a required parameter -

Mapping a new motion in Vim with a required parameter - i have been looking map new "motion" in vim takes parameter. for example, know ciw "cut within word" , set insert mode, looking having custom action replace c (for illustration s ) takes movements iw requires parameter. a trivial illustration be: given line in text file and execute in normal mode (given cursor on first column) siw* surround first word * so: *given* line in text file i know, first-class surround.vim plugin does. giving illustration here, , looking reply how mappings above work. i tried playing onoremap , opfunc can't seem them play way want. so combination of motions plus operator pending mappings. here illustration implementation of command described in question, illustrative purposes. nnoremap <silent> s :set opfunc=surround<cr>g@ vnoremap <silent> s :<c-u>call surround(visualmode(), 1)<cr> function! surround(v...

Format GWT Mobile ListPanel like a table -

Format GWT Mobile ListPanel like a table - i have next code in ui-binder. <m:listpanel selectable="false"> <m:listitem> <g:label ui:field="sortlabel"></g:label> <m:dropdownlist ui:field="sortdropdown" /> </m:listitem> <m:listitem> <g:label ui:field="donelabel"></g:label> <m:flipswitch ui:field="displaydone" value="false"/> </m:listitem> </m:listpanel> i want dropdownlist , flipswitch in same vertical alignment. flipswitch little bit much on right side. unfortunately listpanel (which extends panelbase ) not back upwards alignment. oversight. used flowpanel isn't capable of providing alignment without css hacks alter structure. in order them aligned, could: make own panelbase does back upwards alignment using type of panel in place of flowpanel _panel , create own listpanel extends new panelbas...

java - Does ZXing project checks any of elements in ISO 18004 in section Annex K? -

java - Does ZXing project checks any of elements in ISO 18004 in section Annex K? - when reading qr standard iso 18004, in section annex k (page 91), analyzes parameters of decode, symbol contrast, “print” growth, axial nonuniformity, , unused error correction, comes symbol grade. know if zxing library checks of these 5 elements? no, these not part of decoding, part of print verification process. not implemented in project. java zxing

php - Disabling the user to change the source of the HTML page -

php - Disabling the user to change the source of the HTML page - in homepage, display pictures of members. and, of these pictures have href tag directs page profile page. page, profile.php, gets relevant info href, like <a href= "profile.php?name=james stone"> however, url shows in url if user alter url's "name" part as, "abc", site tries person name abc. in conclusion, site tries display non-existent person "abc" results in lots of errors. how can disable users alter url? sorry, cannot command user can alter in html source. your approach managing non existent urls wrong. instead, should create error page, if user not exist , display "user not exist". php html

android - Change the background image of a button -

android - Change the background image of a button - i using 2 buttons, 1 next news , 1 previous news. in activity when on first news button should set image gray image , when move forwards previous news button should alter gray image colored one. when reach @ lastly news next button should alter gray image. this xml file. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffffff" > <textview android:id="@+id/tv_submitdate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:text="medium text" android:textcolor="#000000" android:padding=...

Automatically create date sequences with different starting dates in R -

Automatically create date sequences with different starting dates in R - i can create desired date sequences using next code: datetwoweeks1 <- seq(as.date("2010/8/6"), as.date("2011/8/5"), = "2 weeks") datetwoweeks2 <- seq(as.date("2010/8/7"), as.date("2011/8/5"), = "2 weeks") datetwoweeks3 <- seq(as.date("2010/8/8"), as.date("2011/8/5"), = "2 weeks") however, automate creation of date sequences 14 different starting dates. have 1 time series starting on 6th of august 2010, next time series starting on 7th, on until 19th of august 2010. how can automate this? tried using "paste" function couldn't next code work: for (i in 6:19){ timetwoweeks[i] <- seq(as.date(paste("2010/8/", i)), as.date("2011/8/5"), = "2 weeks") } any direct help or linkage other websites/posts appreciated. here go: timetwoweeks <- lapply(a...

c# - My button needs two clicks instead of one -

c# - My button needs two clicks instead of one - i working on little app in c# refreshes web page until conditions met. have "fire" = start refreshing button , "stop!" button supposed stop operation. problem takes 2 tries click stop button instead of 1. below code: updated code timer. still think there can improve utilize of timer, think doesn't update every sec after first 2-3 refreshes or doesn't refresh @ all. there flaw in code can't detect? private void firebuttonclick(object sender, eventargs e) { seek { if (webbrowser1.url.tostring().startswith("some url")) { _stopped = false; _timer.tick += new eventhandler(refreshbrowser); _timer.interval = (1000) * (1); _timer.enabled = true; _timer.start(); } else { messagebox.show("you must logon first."); return; } } grab (exce...

c# - Unusual SQL/Data issues -

c# - Unusual SQL/Data issues - we have study has been giving serious issues, decided set console application in order troubleshoot issues. the study simple single select sql, returning approximately 25 columns, , our date range can 3-6 months, returning around 10k rows, not talking lot of data. here whats happening, when study runs, timing out our website, in console, takes anywhere 13-18 mins finish, wait seems happen @ da.fill(ds); now here unusual thing, runs approximately 1-3 seconds within sql server management studio, , when our delphi developers create similar application, few seconds run, happens using .net we tried changing dataset loading datareader, using code.. using (var dr = _command.executereader()) { if (dr.hasrows) { int = 0; while (dr.read()) { var startread = datetime.now; console.write("{2}\t{0}\t{1}\t", dr.getint32(0), dr.getstring(1), i); var tookread = datetime.now.subtract(startread); conso...

html - Scrolling effect on Android after embedding youtube videos with Iframe -

html - Scrolling effect on Android after embedding youtube videos with Iframe - i making slider 3 different videos. have problems regarding youtube videos embedding if embed videos using object parameter, works fine on each , every device except on mac. applied alternative embedded videos using iframe, fine everywhere problem occured is, scrolling effect of screen has stopped working on android phones. have tried applying js codes still stuck on android. url design follows if wants test design on end: http://g-axon.com/minisite/ please provide proper solution if have any. try not setting divs class onebyone_item display:none . setting them display:none remove them render dom. and dont need since container overflow:hidden anyway.. android html iframe mobile-website embedding

asp.net - Check for DbNull in C# -

asp.net - Check for DbNull in C# - i finding difficulties in validating next if(personds.person[0].idfk!= dbnull.value) this compile time error - cannot applied operands of type 'system.guid , 'system.dbnull' i think should check: if(personds.person[0].isidfknull()) c# asp.net sql-server

python - Why is .append() slower than setting the value in a pre-allocated array? -

python - Why is .append() slower than setting the value in a pre-allocated array? - i'm trying speed part of code involves looping through , setting values in big 2d array. 1 of suggestions seek pre-allocating array rather using .append() pointed out in python .append() amortized o(1) operation. however when tested using next code: import time x = list() z = list() t1 = time.time() in range(10000): z.append([]) j in range(10000): z[i].append(0) t1 = time.time() in range(10000): x.append([]) j in range(10000): x[i].append(1) print(time.time()-t1) t1 = time.time() in range(10000): j in range(10000): z[i][j] = 1 print(time.time()-t1) i consitently pre-allocated array taking 3-4 seconds less array isn't preallocated (~17s compared ~21). in code causing .append() based function take longer replacing value in pre-allocated array? consider following: from dis import dis def f1(): x = [] in range(10000): x.ap...

javascript - jQuery hover functions IE error -

javascript - jQuery hover functions IE error - i've been having difficulty jquery hover functions. proberbly result of staring @ same code far long, perhaps can help. i have next function: $("#div1").mouseover(function () { $("#div2:hidden").show(); }); $("#div1").mouseout(function () { $("#div2:visible").hide(); }); which have tried as: $("#div1").hover(function () { $("#div2:hidden").show(); }, function() { $("#div2:visible").hide(); }); neither work @ in ie. write using mouseover, hover, mouseout or other "mouse" function causes errors in ie. other browsers perfect , what's more annoying works in ie, instance on occasion first , sec time work - error. any help fantastic! it works fine here: http://jsfiddle.net/u89de/1/ your first code wrong. improve using: $('#div1').mouseover(function() { //...

shell - regex of string -

shell - regex of string - i want set value of percentcomplete in jobstatus in variable utilize later in shell script. info goes txt file , continually prints these 2 paragraphs updating data. want able percentcomplete. have cat txt file don't know regular look utilize percentcomplete (the 1 within jobstatus). <batchstatus name="" submissiontime="1/23/12 10:00:26 am" sentby="mike" timeelapsed="43 second(s)" timeremaining="4 minute(s)" timeelapsedseconds="43" timeremainingseconds="294" percentcomplete="12" resumepercentcomplete="0" status="processing" batchid="fd66dc21-6aa4-47fb-a3f0-7300c7bdab8a" /batchstatus> <jobstatus name="file.mov" submissiontime="1/23/12 10:00:26 am" sentby="mike" jobtype="compressor" priority="highpriority" timeelapsed="43 second(s)" timeremaining="4 minute(s)...

fancybox - Simple jQuery show(); hide(); confusion -

fancybox - Simple jQuery show(); hide(); confusion - i have jquery code: <script type="text/javascript"> $(function() { $(".one-edition img").hover(function() { $(this).next(".editions-info-text").show(); }, function() { $(this).next(".editions-info-text").hide(); }); }); </script> which, if image under div one-edition hover'd on shows info text div, , when hovered out, disappears - easy. however, i'm trying work using fancybox gallery so: <div class="grid_3 one-edition"> <a href="images/latest/mo20.jpg" rel="editions-1"><img src="http://placehold.it/200x250"></a> <a href="images/latest/mo20.jpg" rel="editions-1"></a> <a href="images/latest/mo20.jpg" rel="editions-1"></a> <div class="editions-info-text"> <...

nfc - Android Application Record compatibility with pre-ICS -

nfc - Android Application Record compatibility with pre-ICS - there's new method in ndefrecord allows writing androidapplicationrecord ndefmessage. not necessary in pre ice-cream-sandwich, since if want handle specific uri nfc tag in application (like defined in intent-filter) not delivered application, unless define record. createapplicationrecord(string packagename); this not available kind of compatibility bundle (i didn't find one), implementaion simple. first add together ndefrecord want readable nfc device (remember uri can formatted/shortened uri_prefix_map ) ndefrecord[] nr = new ndefrecord[2]; nr[0] = new ndefrecord(ndefrecord.tnf_well_known, ndefrecord.rtd_uri, new byte[0], uribytes); add aar in next place static final byte[] rtd_android_app = "android.com:pkg".getbytes(); if (android.os.build.version.sdk_int >= android.os.build.version_codes.ice_cream_sandwich) nr[1] = ndefrecord.createapplicationrecord("your.package.name...

How does Skype works in imo.im and im+ services? -

How does Skype works in imo.im and im+ services? - how skype works in imo.im , im+ services? guesses? i think there 3 ways: runing many copies of skype client each connecting client on server runing many copies of runtime skypekit each client on server reverse-engineering of skype protocol... (yes know 1 , 2 illegal) has information? probably kind of sip-skype hardware gateway? http://shop.skype.com/phones/#pbx-systems lists some. just guess possible legal ways though. reverse engineering science skype protocol not seem realistic me - guys paranoid obscurity , alter protocol details quite often. skype

How to make First letter upper case on objective-c? -

How to make First letter upper case on objective-c? - i'm developing iphone app. want show user's first letter of name upper case , rest lower case. how do on objective-c? if there 1 word-nsstring, utilize method -capitalizedstring nsstring *capitalizedstring = [mystr capitalizedstring]; // capitalizes every word otherwise, multi word strings, have extract first character , create character upper case. objective-c

django : how to confirm registration without email verification -

django : how to confirm registration without email verification - i wnat confirm registration without email verification how can config? and, django-registration views? can alter registration views? thank you. you utilize django-social-auth create users register social business relationship (which has been verified already). have added bonus of beingness much quicker sign via. you can see registration views here. if want alter them, re-create urls django-registration's urls.py , set them own urls.py , link them new views.py file , wrap registration views own custom code. django email registration config verification

php - Validate number from id card from all countries -

php - Validate number from id card from all countries - anyone knows function or regular look validate id number of id card countries? i found regular expression, validates id number kingdom of spain need validate id number countries. ^((([a-z]|[a-z])\d{8})|(\d{8}([a-z]|[a-z])))$ thanks. you cannot validate id numbers countries 1 regular expressions becouse each country has different policy illustration in country validated ^\\d{14}$ a.e., 14 numbers. what can associate each country regex pattern , validate id depending on country. php javascript mysql html

objective c - Converting from UIImage/CGImage to Leptonica Pix structure -

objective c - Converting from UIImage/CGImage to Leptonica Pix structure - i want utilize leptonica library in ios application image processing , have troubles figuring out how leptonica's pix construction uiimage . suggest following: uiimage *image = [uiimage imagenamed:@"test.png"]; ... cfdataref imagedata = cgdataprovidercopydata(cgimagegetdataprovider([image cgimage])); const uint8 *rasterdata = cfdatagetbyteptr(data); can suggest how correctly convert info leptonica's pix structure: /*-------------------------------------------------------------------------* * basic pix * *-------------------------------------------------------------------------*/ struct pix { l_uint32 w; /* width in pixels */ l_uint32 h; /* height in pixels */ l_uint32 d; /* depth in bits ...

HTTP Error 405.0 - Method Not Allowed using Jquery ajax get -

HTTP Error 405.0 - Method Not Allowed using Jquery ajax get - i'm developing form in user must insert username. want check on blur username of user valid: i added script: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> in html: <input name="username" type="text" onblur="checkusername()"> script: function checkusername(){ var usn = document.getelementsbyname('username')[0]; if(usn.value != "") { var html = $.ajax({ type: "get", url: "checkusername.php?", data: "usr=" +usr.value async: false, datatype: "text"}).responsetext; if(html == "si") { usn.sty...

asp.net - mono 4.0 xsp4 and mod_mono: method arguments are incompatible -

asp.net - mono 4.0 xsp4 and mod_mono: method arguments are incompatible - i've have fresh install of ubuntu server 11.10 mono , and mod_mono , i'm trying asp.net site running (requiring .net 4.0) unhelpful stack trace: server error in '/' application method arguments incompatible description: http 500. error processing request. stack trace: system.argumentexception: method arguments incompatible @ system.delegate.createdelegate (system.type type, system.object firstargument, system.reflection.methodinfo method, boolean throwonbindfailure, boolean allowclosed) [0x00000] in <filename unknown>:0 @ system.delegate.createdelegate (system.type type, system.object firstargument, system.reflection.methodinfo method) [0x00000] in <filename unknown>:0 @ system.web.httpapplicationfactory.addhandler (system.reflection.eventinfo evt, system.object target, system.web.httpapplication app, system.reflection.methodinfo method) [0x00000] in <filename un...

java - Better way to handle Uncaught Exceptions in ForkJoinPool Tasks/action -

java - Better way to handle Uncaught Exceptions in ForkJoinPool Tasks/action - what improve way handle exceptions(uncaught) while using forkjoinpool submit tasks ( recursiveaction or recursivetask )? forkjoinpool accepts thread.uncaughtexceptionhandler handle exceptions when workerthread terminates abruptly(which anyways not under our control) handler not used when forkjointask throws exception. using standard submit / invokeall way in implementation. here scenario: i have thread running in infinite loop reading info 3rd party system. in thread submit tasks forkjoinpool new thread() { public void run() { while (true) { forkjointask<void> uselessreturn = forkjoinpool.submit(recursiveactiontask); } } } i using recursiveaction , in few scenarios recursivetask. these tasks submitted fjpool using submit() method. want have generic exception handler similar uncaughtexceptionhandler if task thr...

Handling Reading/Writing Files in PHP? -

Handling Reading/Writing Files in PHP? - it's been while since i've touched php, , i've been working in c# while. need file reading/writing, i'm not sure start. i've been spoiled visual studio's code-completion , real-time error checking, , it's bit hard going on such weakly-typed language. in php, what's returned when reading file, , needs written when writing? i need work file in hex, decimal fine too. there way read in way string? there several ways read , write files: you can create handler fopen() function. the other way file_get_contents() , function returns content. , file_put_contents() set info file. as illustration of handler, here logging stuff: if (!is_writable($this->file) && $name !== self::core_log) { self::getinstance(self::core_log)->log(sprintf('couldn\'t write file %s. please, check file credentials.', $name)); } else { $this->handler = fop...

javascript events - Using facebook connect in CodeIgniter -

javascript events - Using facebook connect in CodeIgniter - i trying add together facebook connect on website experiencing lot of issues since facebook moved oauth 2 protocol. i users log in facebook business relationship , then, store info in database. so using javascript sdk grab “auth.login” event , redirect fb_login method utilize facebook php sdk. but here first issue, of time, “auth.login” event not grab listener , method not called. here “listener” javascript code. <div id="fb-root"></div> <script type="text/javascript"> window.fbasyncinit = function() { fb.init({ appid: '<?php echo $this->config->item('facebook_app_id'); ?>', status: true, cookie: true, xfbml: true, oauth: true }); fb.event.subscribe('auth.login', function(response) { [removed] = "<?php echo site_url('donateur/fb_signin'); ?>"; });...

asp.net - Call method in ListView EmptyDataTemplate -

asp.net - Call method in ListView EmptyDataTemplate - i have simple listview emptydatatemplate. in emptydatatemplate, there linkbutton visble property value look calls method in code behind. problem linkbutton visible regardless of whether method returns true or false (my method isn't beingness called set breakpoint on it). come across this? what's happening here? e.g. <asp:listview id="peoplelistview" runat="server" ...> ... <emptydatatemplate> sorry, no people view.<br /> <asp:linkbutton id="newbutton" runat="server" visible='<%# editpermitted() %>'>new record</asp:linkbutton> </emptydatatemplate> </asp:listview> in code behind, have method: protected bool editpermitted() { homecoming false; } i don't think can set scriplets <% %> within of server controls. you need grab rowdatabound event, , set l...

javascript - firebug: does firebug script debugging work on https links? -

javascript - firebug: does firebug script debugging work on https links? - i trying debug js. js part of https site , see firebug debugger doesn't work. there missing here. please help! javascript firebug

Pick any kind file via an Intent on Android -

Pick any kind file via an Intent on Android - i start intentchooser apps can homecoming kind of file currently utilize (which copied android email source code file attachment) intent intent = new intent(intent.action_get_content); intent.addcategory(intent.category_openable); intent.settype("*/*"); intent = intent.createchooser(intent, "file"); startactivityforresult(i, choose_file_requestcode); but shows "gallery" , "music player" on galaxy s2. there file explorer on device , appear in list. photographic camera app show in list, user can shoot image , send through app. if install astro file manager respond intent, too. customers galaxy sii owners , don't want forcefulness them install astro file manager given have basic sufficient file manager. any thought of how accomplish ? pretty sure saw default file manager appear in such menu pick file, can't remember in app. thanks ! not photographic camera other fi...

Facebook - Add Page Tab -

Facebook - Add Page Tab - trying transfer ap main profile on facebook: https://apps.facebook.com/gavinwynne/ did prepare button missing https://www.facebook.com/dialog/pagetab?app_id=370018013025352&next=https://www.gavinwynne.co.uk/facebook/index.html/ but error = add together page tab application not back upwards integration profile. any thought guys ? you need add together page tab platform official documentation can found here: https://developers.facebook.com/docs/pages/tabs facebook-apps facebook-page

c# - Casting null doesn't compile -

c# - Casting null doesn't compile - accidentally @ work wrote next line of code: string x = (object) null; // var x = (object)null , changed var string instead of // object x = null; this gave me compilation error similar this: can't cast source type object target type string why? isn't null bunch of zeros pointing "nowhere" memory address, no matter type is? the question here "why compiler not take business relationship fact knows assigned value constant reference known null?" the reply is: why should it? what's compelling benefit of taking info account? deliberately said "i want look treated though of type object", , can't assign value of type object variable of type string. what's benefit of allowing in case? the code seems me highly bug; certainly compiler should telling rather allowing it. c# .net compiler-construction null

php - Web based compiler -

php - Web based compiler - i have been working on project, create website read files(c/c++ text file) , compile code written on it. how can utilize compiler on server? if $_post['code'] contains cpp code. can following. $code = do_sanitizing($_post['code']); $filename = "cfile".time().".c"; // set contents in file file_put_contents($filename, $code); // compile $output = system("/usr/bin/gcc $filename 2>&1"); echo $output; note: type of compiling , running programs afterwards has unsafe security flaws. you must sanitize user input the c source code may crash compiling process the output programme might contain code unsafe server. php c++ html c