Posts

Showing posts from August, 2014

ios - Why does this loop cause a crash if nothing is found in the array -

i'm totally lost , not sure how phrase question. have loop can see below. if if statement within loop proves true indexpath assigned value, loop completes (there 49 objects in _samplepicture s array)and enters if (found) , loads found data. if the condition not true , nothing found instead of entering if(!found) app crashes. have tried various structures of current coding scheme. removed loop , entered if(!found) supposed to. (ooooodddddddd) this statement in viewdidload , directly above (the if statement not viewdidload ) if statement determines contents of _samplepictures . it may useful know images in array define this: #define img_71 [uiimage imagenamed:@"imagename.jpg"] the array structured in way: _samplepictures = @[@{@"image": img_71, @"title" : @"title of item", @"description" : @"complete description of item"}]; if (fromkitinstructions) { int = 0; nsindexpath *indexpath;

c# - Setting one Datagrid row to be a certain colour -

this problem not intuitive me i'm not entirely sure start. i wanted change fifth row of datagrid have grey background. <telerik:radgridview itemssource="{binding quarterlyinfo, isasync=true}" showgrouppanel="false" selecteditem="{binding selecteditem}"> <telerik:radgridview.rowstyle> <style targettype="telerik:gridviewrow"> <setter property="cal:message.attach" value="[event mousedoubleclick] = [open()]"/> </style> </telerik:radgridview.rowstyle> <telerik:radgridview.columns> <telerik:gridviewdatacolumn header="section" datamemberbinding="{binding sectionnum}"/> <telerik:gridviewdatacolumn header="section info" datamemberbinding="{binding sectioninfo}"/> <telerik:gridviewdatacolumn header="result" datamemberbinding="{binding r

python django - page not found error (404)- static error -

i somehow got application running on django (new python , django) , although page loads default url (127.0.0.1:8000) load css files. produces following error css files directly accessed. page not found (404) request method: request url: http://127.0.0.1:8000/static/css/bootstrap.min.css 'css\bootstrap.min.css' not found you're seeing error because have debug = true in django settings file. change false, , django display standard 404 page. here settings.py page: static_url = '/static/' # template location template_dirs = { os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "templates"), } if debug: media_url = '/media/' static_root = os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "static-only") media_root = os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "media") staticflies_dirs = (

user input - Can Python Accept Ctrl+[char] using raw_input? -

i writing command line interface in python accepts lot of user input. values querying user about, there significant amount of "additional information" display, rather display if user needed how provide value. so thought provide usual raw_input prompt, try accept ctrl-h type sequences output info. can python accept kind of input via raw_input in terminal/shell? there more proper way (preferably in stdlib)? no, python cannot accept kind of input through raw_input . because you're thinking sequences like: ctrl-c , ctrl-z , etc. these not keyboard inputs, these signals processed terminal (not program). you can try set signal handlers you, not reliable solution (regardless of whether you're using python or else). the best solution accepting kind of input either use curses , or use readline (with adjustments configuration handle things ctrl-h ). using readline make life easier, comes cost have license program under gnu gpl (or similar). where

c# - connecting to a database in visual studio for membership -

i have website created. in appdata folder created database (info.mdf). i connected sqlexpress i have added network service available users in sql mngmnt studio. went user mapping , added database. selected db_owner, public , aspnet_membership_fullaccess. did same process local username guess because of way setup database local user shows dbo under users in actual database. i altered web.config say: <?xml version="1.0"?> <!-- more information on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=169433 --> <configuration> <connectionstrings> <add name="membershipconnection" connectionstring="server=machinename\sqlexpress; initial catalog=info;" providername="system.data.sqlclient" /> </connectionstrings> <system.web> <compilation debug="true" targetframework="4.0"/> <authentication mode=&

segmentation fault - LLVM generated vector math assembly segfaulting -

the following llvm function takes 3 pointers arrays of 5 doubles , calculates c = a*b + c: define void @my_vector_math(double* %a1, double* %b2, double* %c3) { entry: %0 = bitcast double* %c3 <5 x double>* %1 = load <5 x double>* %0, align 64 %2 = bitcast double* %b2 <5 x double>* %3 = load <5 x double>* %2, align 64 %4 = bitcast double* %a1 <5 x double>* %5 = load <5 x double>* %4, align 64 %6 = fmul <5 x double> %3, %5 %7 = fadd <5 x double> %1, %6 store <5 x double> %7, <5 x double>* %0, align 64 ret void } it compiles down following assembly on machine (64 bit ubuntu 13.10, llvm 3.4): 30: c5 fb 10 42 20 vmovsd 0x20(%rdx),%xmm0 35: c5 fb 10 4e 20 vmovsd 0x20(%rsi),%xmm1 3a: c5 fd 28 16 vmovapd (%rsi),%ymm2 3e: c5 fb 10 5f 20 vmovsd 0x20(%rdi),%xmm3 43: c5 f5 59 cb vmulpd %ymm3,%ymm1,%ymm1 47: c5 ed 59 17 vmul

java - How to find Derivationally Related Forms of a wordnet synset through MIT JWI? -

when retrieving semantic relations of synset through mit java wordnet interface (jwi) can't derivationally related forms. i'm using isynset class method getrelatedsynsets(ipointer p) , list returns empty. as simple test developed class iterates noun synsets of wordnet , tries find synset exposing derivationally related form. surprisingly code can't find single synset relation. here code: public class derivationallytest { private static idictionary dict = null; public static void main(string[] args) throws ioexception { idictionary dict = dicitionaryfactory(); iterator<isynset> = dict.getsynsetiterator(pos.noun); while(it.hasnext()){ isynset synset = it.next(); if(synset.getrelatedsynsets(pointer.derivationally_related).size() > 0){ system.out.println("found one!!!"); } } } public static idictionary dicitionaryfactory() throws ioexception{

html - Center <td> using bootstrap -

Image
i'm trying center inputs inside table , set size td using bootstrap (on angularjs) can't make work ! what have now: <div class="container"> <form class="form" data-ng-submit="salvarpartida()"> <table class="table table-bordered" align="center"> <tr data-ng-repeat="partida in partidas | filter : {fase : fase}"> <td style="height: 30px; text-align: right; font-size: 10pt;">{{partida.time1.nome}} <img data-ng-src="/images/bandeiras/{{partida.time1.imgnumber}}.png" style="vertical-align: middle;"> </td> <td class="col-sm-6"> <div class="col-xs-3" > <input type="text" class="form-control"> </div> <div clas

Get e-sign from echosign widget -

i have added echosign widget in site. want save e-sign in database. how can this? as widget contains on iframe. that's why can't find try it. i want save e-sign when user click on "click e-sign" button. please me this. since have widget must having widget id well. can use apis extract signature form data , store in database. api extract form data widget ( https://secure.echosign.com/public/docs/restapi/v2;jsessionid=34bfbc3886e48e109eb7a36cdb9e91cd.ord-prod-app15#!/widgets/_get_7 )

python - setup.py & pip: override one of the dependency's sub-dependency from requirements.txt -

Image
i'm working on package , in requirements.txt, have dependency: wikipedia now, wikipedia 1.3 uses requests-2.2.1 while package uses 2.3.0 also, 1 expect, wikipedia-1.3's installation depends on presence of it's dependency. but, if start new virtualenv , directly include wikipedia in requirements.txt , gives importerror on requests since @ time setup.py runs, requests-2.3.0's setup.py doesn't execute unless others execute: (ref: in figure attached below, there's no ' running setup.py ' requests after gets unpacked) (for weird reason, wikipedia's setup.py contains 'import wikipedia', in turn imports it's dependencies before they're installed; passes ci test because it's installing requirements separately through pip , running setup.py) to on come situation, i've made setup script consisting of: pip install -r requirements.txt pip install wikipedia pip install -e . this installs requests-2.3.0 , beautifu

Using AsyncTask with android -

my code ok, no problem.i did not use onpostexecute() method. code run , layout show fine. want use onpostexecute method showing ui. how can use onpostexecute in code? because code looping , adding value in listview. can not understand how can use onpostexecute in code. please me ! private class asynccaller extends asynctask<void, void, void> { progressdialog pdloading = new progressdialog(mainactivity.this); @override protected void onpreexecute() { super.onpreexecute(); //this method running on ui thread pdloading.setmessage("\tloading..."); pdloading.show(); } @override protected void doinbackground(void... params) { //this method running on background thread don't update ui frome here //do long running http tasks here,you dont want pass argument , u can access parent class' variable url on here try {

php - Yii resumable implementing -

i have task implement resumable in yii , , implemented upload control, never resumable before. public function actionupload() { $model=new user; if(isset($_post['user'])) { $model->attributes=$_post['user']; $model->image=cuploadedfile::getinstance($model,'image'); if($model->save()) { $model->image->saveas('upload/'.$model->image->name); $this->redirect(array('view','id'=>$model->uuserid)); } } $this->render('upload',array('model'=>$model)); } the task chunk file in small pieces. example: 1 file can 1 gb. , try send file rest service. see sample server implementation in php i copy-paste here essential part of code, provided on page: /** * * check if parts exist, , * gather parts of file * @param string $dir - temporary directory holdin

Powershell, R, Import-Csv, select-object, Export-csv -

i'm performing several tests using different approaches cleaning big csv file , importing r. this time i'm playing powershell in windows. while things work , accurate when using cut() pipe(), process horribly slow. this command: shell(shell = "powershell", "import-csv in.csv | select-object col1, col2, etc | export-csv new.csv") and these system.time() results: user system elapsed 0.61 0.42 1568.51 i've seen other posts use c# via streaming taking couple of dozens of seconds, don't know c#. my question is, how can improve powershell command in order make faster? thanks, diego there's fair amout of overhead in reading in csv, converting rows powershell objects, , converting csv. doing through pipeline way causes 1 record @ time. should able speed considerably if switch using get-content -readcount parameter, , extracting data using regular expression in -r

validation - Creating better error messages in the View for Rails -

Image
i experimenting simple people/new page practice showing error messages. right now, below set-up, error messages display okay little awkward because text says "firstname can't blank", "lastname can't blank" , forth. want text "first name can't blank" , "last name can't blank" (with spaces), i'm assuming error messages following attribute names defined in model, , there's no way change explicitly. so how can change that? can not achieve change without making changes particular partial? (shared_error_messages) thanks, screenshot of new view below. people_controller.rb class peoplecontroller < applicationcontroller def new @person = person.new @people = person.all end def create @person = person.new(person_params) if @person.save redirect_to new_person_path else render 'new' end end private def person_params params.require(:person).permit(:fi

Recurse with PowerShell's Get-ChildItem -

this seems should simple, , i'm sure is, i've not cracked best way should done. i want search through folder structure returning folders meet following conditions. folders contain .msi files, don't include executable files. folders contain .exe files, don't include .msi files. folders contain both exe , msi files. each of these piped column in csv file. my problem can't work out how return folder names include 1 file type, exclude another. know on paper seems simple using -include *.msi , -exclude *.exe , etc., command such gci -recurse -include *.msi -exclude *.exe includes folders containing msi , exe folder want folder containing msi's returned. i using following directory structure test msi only msi , exe exe only does make sense? i experimenting | directory -notcontains *.exe , kinds of similar things, none of them worked way wanted or expected. unfortunately include , exclude work recurse parameter. won't able ex

postgresql - SQL Query - excluding rows where one value of a column with multiple values matches -

i have set of tables follows. (this simplified, several of these tables have other columns, i've tried pare down) website id | _____________________________________ 10001 10002 10003 domain names name | website_id _____________________________________ surfinglikewoah.com | 10001 surfinglikewoah.net | 10001 ihatesurfing.com | 10002 surfinghatesme.net | 10003 promotion redemptions promo id | website_id _____________________________________ 0001 | 10001 0002 | 10001 0003 | 10001 0002 | 10002 promo codes promo id | code _____________________________________ 0001 | test 0002 | super-discount 0003 | double-discount and i'm trying filter out accounts have promotion "test" - however, because these websites associated multiple promotion redemptions, wrong rows still appear in results. note: i'll filtering ba

Compare/Difference of two arrays in bash -

is possible take difference of 2 arrays in bash. great if suggest me way it. code : array1=( "key1" "key2" "key3" "key4" "key5" "key6" "key7" "key8" "key9" "key10" ) array2=( "key1" "key2" "key3" "key4" "key5" "key6" ) array3 =diff(array1, array2) array3 ideally should : array3=( "key7" "key8" "key9" "key10" ) appreciate help. if strictly want array1 - array2 , then $ array3=() $ in "${array1[@]}"; >     skip= >     j in "${array2[@]}"; >         [[ $i == $j ]] && { skip=1; break; } >     done >     [[ -n $skip ]] || array3+=("$i") > done $ declare -p array3 runtime might improved associative arrays, wouldn't bother. if you're manipulating enough data matter, shell wrong tool. for symmetric dif

python - How to pass a variable to unicode/raw (ur"") conversion function -

i have no problem performing following function when taking actual text: in [7]: str = ur"foo 20\n40%" in [8]: str out[8]: u'foo 20\\n40%' but in actual case word "foo 20\n40%" stored in variable mystring . whats way that? tried failed: in [13]: mynewstr = ur(mystr) --------------------------------------------------------------------------- nameerror traceback (most recent call last) <ipython-input-13-0379c497611f> in <module>() ----> 1 mynewstr = ur(mystr) nameerror: name 'ur' not defined if source string consists of ascii characters example does, it's easy: mynewstr = unicode(mystr) otherwise need know encoding of original string bytes , use convert unicode. e.g. if know source utf-8: mynewstr = mystr.decode('utf-8') e.g. >>> print mystring foo 20\n40% >>> unicode(mystring) u'foo 20\\n40%' >>> mystring.decode('utf-8'

java - How to print out an X using nested loops -

i have searched through find simple solution problem. i have method called printcross(int size,char display) it accepts size , prints x char variable receives of height , width of size. the calling method printshape(int maxsize, char display) accepts maximum size of shape , goes in loop, sending multiples of 2 printcross method until gets maximum. here code not giving me desired outcome. public static void drawshape(char display, int maxsize) { int currentsize = 2; //start @ 2 , increase in multiples of 2 till maxsize while(currentsize<=maxsize) { printcross(currentsize,display); currentsize = currentsize + 2;//increment multiples of 2 } } public static void printcross(int size, char display) { (int row = 0; row<size; row++) { (int col=0; col<size; col++) { if (row == col) system.out.print(display); if (row == 1 && col == 5)

Windows Store app 8.1 Xaml pausing/resuming download using http classes -

i'm trying use http classes pause/resume download , pausing easy using cancellation token , how can resume download? i have used background downloader class , had lot of issues in resuming , had many other issues handle downloads. here code: using windows.web.http; using windows.web.http.filters; private async void foo(storagefolder folder, string filename) { uri uri = new uri("http://localhost"); var filter = new httpbaseprotocolfilter(); filter.servercredential = new windows.security.credentials.passwordcredential(uri.tostring(), "foo", "bar"); var client = new httpclient(filter); httprequestmessage request = new httprequestmessage(httpmethod.post, uri); request.headers.add("range", "bytes=0-"); // hook progress handler. progress<httpprogress> progresscallback = new progress<httpprogress>(onsendrequestprogress); var tokensource = new cancellationtokensource(); httpresponsemessage response = await cl

zend 2 form filters not working -

i'm trying use zend\filter forms ensure data correctly formatted. have typical input (text) named 'parent_id' apply filters : 'filters' => array( array('name' => 'zend\filter\int'), array('name' => 'zend\filter\null', 'options' => array('type' => \zend\filter\null::type_integer)), ), after that, use custom validator on field needs check 'parent_id' value via $context. public function isvalid($value, $context = null) { var_dump($context); } when dump var $context, this: array(2) { ["parent_id"]=> string(0) "" ["target_id"]=> string(1) "1" } i checked execution order , filters running before validator, why don't : ["parent_id"]=> null or ["parent_id"]=> int(something) ? thank !

osx - Subl shortcut not found in command line -

trying sublime text 2 work on command line (mac os x) using "subl" command. followed these simple instructions: https://www.sublimetext.com/docs/2/osx_command_line.html when $ subl ~/.bashrc error: -bash: subl: command not found . however, if use full path or $ ~/bin/subl ~/.bashrc , file open in sublime. what cause shortcut "subl" not found? need set somewhere (bashrc, bash_profile, etc)? if add ~/bin path environment variable, bash should able find subl : export path=~/bin:${path} add line .bashrc if want subl available in every new bash session.

Return ColumnNames from Select query in SQL Server? -

Image
first written select query join retrieving required columns. after using top 0 got required columns. come this, i dont want records. need result of column names this, sample code: select top 0 *tablename*.* *tablename* (some joins , conditions) tablename => contains dynamic columns (after doing joins) inspired on @tony hopkinson suggestion select c.name sys.tables t inner join sys.columns c on c.object_id = t.object_id t.name = @table

mysql - Select data from one table which is connected to another 2 tables -

Image
i have 3 tables: emplyees, jobs , departments what i'm trying achieve number of emplyees 1 department. i tried something: select count(emplyees.id) emplyees inner join job on (job.id = emplyees.job_id) inner join department on (department.id = 2) but returns number of emplyees departments. advice please? an exists clause allow limit existence of without having worry whether or not employee has other jobs, keep count easy figure. also, since thing need department id, can leave table out , filter dept_id field of job table. select count(id) employees exists ( select 1 job id = employees.job_id , dept_id = 2 )

c# - Fetch Outlook Calander Mails -

in inbox there calendar mail(meeting request calendar).when application fetching mail of calendar mail inbox throwing following error unable cast com object of type 'system.__comobject' interface type 'microsoft.office.interop.outlook.mailitem'. operation failed because queryinterface call on com component interface iid '{00063034-0000-0000-c000-000000000046}' failed due following error: no such interface supported (exception hresult: 0x80004002 (e_nointerface)). public void getoutlookemails() { oapp = new outlook.application(); ons = oapp.getnamespace("mapi"); foreach (outlook.mapifolder folder in ons.folders) { getfolders(folder); } } public void getfolders(outlook.mapifolder folder) { if (folder.folders.count == 0) { try { if (folder.defaultitemtype == outlo

java - JUnit run suite -

i wrote maven-junit project run through eclipse. have package 5 classes: 1. junittest1.java 2. junittest2.java 3. adapter.java, 4. junittestsuite.java 5. testrunner.java the code in junittestsuite class import org.junit.runner.runwith; import org.junit.runners.suite; import org.junit.runners.suite.suiteclasses; @runwith(suite.class) @suiteclasses({ junittest1.class, junittest2.class }) public class junittestsuite { } the code in testrunner class is: import org.junit.runner.junitcore; import org.junit.runner.result; import org.junit.runner.notification.failure; public class testrunner { public static void main(string[] args) { result result = junitcore.runclasses(junittestsuite.class); (failure failure : result.getfailures()) { system.out.println(failure.tostring()); } system.out.println(result.wassuccessful()); } } when run project junit test, there 4 test running, 2 tests under suite , each of tests separately; meaning each test ran twi

c++ - Problems with ID2D1bitmap -

i'm trying save id2d1bitmap file according how save id2d1bitmap png file can done in windows 7? without platform update? i unhandled exception. (aceess violation reading) @ : if (succeeded(hr)) { hr = m_pwicfactory->createbitmap( sc_bitmapwidth, sc_bitmapheight, guid_wicpixelformat32bpppbgra, wicbitmapcacheonload, &pwicbitmap ); } i've declared m_pwicfactory & m_pdirect2dfactory as: id2d1factory* m_pdirect2dfactory; iwicimagingfactory *m_pwicfactory; can 1 explain me problem? i'm pretty sure you've null m_pwicfactory (because post you've linked doesn't contain code). did initialize first before usage? done member function , called before other operations require factory performed. hresult createdeviceindependentresources() { hresult hr; // create direct2d factory. hr = d2d1createfactory(d2d1_factory_type_single_threaded, &m_pdirect2dfactory); if (succ

sorting - Filtering block data in Excel by rows ( weather forecast data from National Weather Service) -

i need data weather forecasts period of several years 18 cities. can obtain data national weather services problem excel file contains data cities , data presented in blocks. got data in uncompressed format here: http://www.mdl.nws.noaa.gov/~mos/archives/mex.html . example, here data january 2006: https://www.dropbox.com/s/lf552bgbwdyusli/01.2006.xlsx . need information min , max temperature 18 particular cities, means need first 5 rows of data each city. data cannot sorted columns , cannot transposed contains text cells. wondering whether there faster way select data need searching each particular city , copy , pasting data in new worksheet. method fine if had couple of files of data, have around 100 of them. thank help!

Cannot use map in factory pattern using c++ -

i trying create basic type wrapper project , want use factory create types depending on user input. to illustrate code boolean type class typeboolean :public generictypewrapper<bool>, public itypewrapper { public: typeboolean(bool b = false) { this->setvalue(b); } std::string gettypename() { return "boolean"; } static itypewrapper* __stdcall create(){ return new typeboolean(); } }; the generictypewrapper class getters , the setters , itypewrapper class abstract class gettypename function in it now problem factory using createtypefunction = std::function<itypewrapper*(void)>; class typefactory { private: static std::map<std::string, createtypefunction> creationfunctions; typefactory() { std::vector<std::string> listoftypenames = { "boolean" }; std::vector<createtypefunction> listofcreatefunctions = { typeboolean::create() }; (unsigned int = 0; < listoftypenames.size(); i++) {

c++ - What changes introduced in C++14 can potentially break a program written in C++11? -

introduction with c++14 (aka. c++1y ) standard in state close being final, programmers must ask backwards compatibility, , issues related such. the question in answers of this question stated standard has appendix dedicated information regarding changes between revisions. it helpful if these potential issues in mentioned appendix explained, perhaps of formal documents related mentioned there. according standard : changes introduced in c++14 can potentially break program written in c++11? note : in post consider " breaking change " either, or both, of; 1. change make legal c++11 ill-formed when compiled c++14 , and; 2. change change runtime behavior when compiled c++14 , vs c++11 . c++11 vs c++14 , standard say? the standard draft ( n3797 ) has section dedicated kind of information, describes (potentially breaking) differences between 1 revision of standard, , another. this post has used section, [diff.cpp11] , base semi-el

opengl 2.0 - openGL2.0: How to disable vertex shaders? -

i trying capture traces game glinterceptor use doesn't support vertex shaders. research suggests disable vertex shaders , use default vertex shader no information how it. so, how can disable vertex shaders? here code: pp.fx #define disable_fog #define disable_lighting technique default { pass p0 { vertexshader = vertexshaders/diff-tex.vs; pixelshader = pixelshaders/pp.ps; #ifdef enable_twosided enableculling = false; #endif #ifdef disable_depth_test enabledepthtest = false; #endif #ifdef enable_additive enabledepthmask = false; enableblending = true; blendfuncsrc = one; blendfuncdst = one; #endif #ifdef enable_multiplicative enabledepthmask = false; enableblending = true; blendfuncsrc = dst_color; blendfuncdst = zero; #endif #ifdef enable_alpha_blending enabledepthmask = false; enableblending = true; blendfuncsrc = src

asp.net mvc - Draw2d C# MVC Post JSON to Controller -

i working draw2d library allows exporting of json when try cannot export mvc. not issue draw2d rather lack of knowledge me how work. generate json looks below [ { "type": "dbtable", "id": "662b1fb8-5eb8-47a5-9f81-e48efb0d31bd", "x": 80, "y": 59, "width": 99, "height": 107, "cssclass": "dbtable", "bgcolor": "#dbddde", "color": "#d7d7d7", "stroke": 1, "alpha": 1, "radius": 3, "name": "default autoattendant", "entities": [ { "text": "0", "id": "0c4c5414-1f35-4247-a4b7-38297aa0e5ff" }, { "text": "1", "id&qu

tomcat - neo4j : Limited queries sent in java -

for website developed under tomcat, connect program database neo4j. connection done through jdbc. program right local, , database on remote server. when start tomcat, first check if specifics nodes presents, , if not, creates them. there 135 nodes. problem : after ten, program stops, , stay in infinite loop. assume should close something, what? here code : private resultset sendcommand(string command) throws sqlexception { try(statement statement = _neo4jconnection.createstatement()) { return statement.executequery(command); } } and function call code (all functions based on same structure) public static long createnode(nodelabel labelname) { try { resultset rs = getinstance().sendcommand("create (n:"+labelname+") return id(n)"); long result= rs.next()?rs.getlong("id(n)"):null; rs.close(); return result; } catch (sqlexception e)

javascript - D3 quick chained transition inconsistency -

when chain transitions small duration, skips first one. not consistent. 10ms doesn't work, 5ms does. used setinterval random duration in demo trigger http://jsfiddle.net/83rec/ . code in question: .attr('fill', 'red') .style('opacity', 0) .transition() .duration(duration) .style('opacity', 1) .transition() .attr('fill', 'green') when duration starts in <10ms range when starts failing. bug in d3 or logic failure on part? browser timing loops typically 16.667 ms. time less subsumed next event.

asp.net - Web.config - Specify default error page for errors -

i know can specify error pages according error type: 404 , 500 , ... what i'm looking default error page error did not specify page for. example - if add a <error statuscode="404" responsemode="executeurl" path="/.../404.aspx"/> and 500 occurs - want go anyerror.aspx . how do that? you need specify 'defaultredirect' attribute in customerrors section of web config. see displaying custom error page (c#) . e.g. <customerrors mode="on" defaultredirect="~/errorpages/error.aspx" />

Zipper to iterate over list in Scala -

this follow-up previous question . can use iterator, fold , zip , foreach , others iterate on list in scala. wonder if there use cases zipper appropriate. suppose need read-only access without concurrency. could give such example , explain why zipper best choice? one of many neat things zippers have comonad instance, allows solve class of problems elegantly. here's quick example off top of head. suppose we've got sequence of numbers , want simple form of smoothing exponential moving average, new value each position in list average of current value , other values, more distant neighbors contributing less. this isn't terribly hard thing compute imperatively, if use zipper , comonadic cobind it's not far one-liner: import scalaz._, scalaz._ val weights = stream.from(1).map(1.0 / math.pow(2, _)) def sumneighborweights(neighbors: stream[double]) = neighbors.fzipwith(weights)(_ * _).sum def smooth(data: nonemptylist[double]) = data.tozipper.cobind

XS PPCODE not behaving -

i'm working on calling third-party dll perl project using xs, under cygwin on windows using g++. 1 of dll functions takes struct argument , returns main results in pointer struct. pass in flat list of 28 integers , populate first struct. call function. want flatten resulting struct list of 54 integers. (this seems lot of integers, dll function quite complex , takes long time run, think it's worth it. unless has better idea?) this close working. can tell results sensible. there 2 bizarre problems. when print out same variables, different results depending on whether it's in 'for' loop or not! show below. i've stared @ long now. i "out of memory" first xpushs. here xs code. #include "extern.h" #include "perl.h" #include "xsub.h" #include "ppport.h" #include "dll.h" module = bridge::solver::dds_if package = bridge::solver::dds_if prototypes: enable void solveboard(inlist) sv *

java - Exception occur when refresh page in Tomcat JSR 356 websocket -

i have serverendpoint class: @serverendpoint(value = "/websocket", configurator = servletawareconfig.class) public class websocketendpoint { @onopen public void onopen(session session) { system.out.println("onopen"); } @onclose public void onclose(session session) { system.out.println("onclose"); } @onmessage public void onmessage(string message, session session) { system.out.println("onmessage"); } @onerror public void onerror(throwable t) throws throwable { system.out.println("onerror"); } } when refresh page, onerror invoked , exception t contains next description: java.util.concurrent.executionexception: java.net.socketexception: broken pipe what can reason? i meet same exception when use chrome or chromium open page. (it never occurs when use firefox). i'm not sure if using chrome too. guess because of v8 engine. my solution

c# - How to find the exact time left -

i working on reminder app , have taken 2 properties 1 date in datetime format , time of type string .my problem not able exact hours , min , sec when user set reminder future date how subtract future time current time can exact hours , min , sec left. please me out thank here model class private datetime _date=datetime.today.date; public datetime date { { return _date; } set { timespan tp = value - datetime.now; if (tp.totaldays>0) { remainingdays = (int)tp.totaldays; //timespan ts = value- system.timespan.fromhours(time); //string.format("{0}:{1}", system.math.truncate(ts.totalhours).tostring(), ts.minutes.tostring()); remaininghours = (int)tp.totalhours; remainingmin = (int)tp.minutes; remainingsec = (int)tp.seconds; setproperty(ref _date, valu