Posts

Showing posts from April, 2011

Retuning a GMail script to prevent "Exceeded maximum execution time" -

i use gmail account receive status updates devices have listed in google spreadsheet user , serial number. status update email have serial number of device in it's email subject , sent once week per device. due number of devices (600+), pretty constant influx of status updates various devices every day. i'm trying setup script search inbox , create list of devices haven't received status update email prompt me figure out why device isn't reporting in. i've modified script found online at: http://forums.mozillazine.org/viewtopic.php?f=46&t=2740775 . works obtaining device serial number listed in spreadsheet , searching inbox email subject serial number sent within past 15 days. script works fine when spreadsheet has 200 items, beyond start getting "exceeded maximum execution time" error , need 600+ items , more time goes on. had add utilities.sleep(1000) line avoid "service invoked many times in short time: gmail ratemax" error. there

java - Power Mockito test ServletOutputStream -

i trying test printed servlet output stream using power mockito can't find way it. here have far routing routingmock = powermockito.mock( routing.class ); httpservletrequest httprequestmock = powermockito.mock( httpservletrequest.class ); httpservletresponse httpservletresponsemock = powermockito.mock( httpservletresponse.class ); powermockito.when( httprequestmock.getpathinfo() ).thenreturn( "/users" ); servletoutputstream outputstreammock = powermockito.mock( servletoutputstream.class ); powermockito.when( httpservletresponsemock.getoutputstream() ).thenreturn( outputstream ); routingmock.doget( httprequestmock, httpservletresponsemock ); can me figure out how access data written outputstreammock? thanks as far know , experience power mockito. have fill in data in output stream , return it. like in below statement, output stream; fill in data i.e. write needed data stream , return. powermockito.when( httpservletresponsemock.ge

Python sep= ", " But Only Want It 2nd Time Onwards -

so making basic text game progress learning python. offer choices trying print choices list , have these lines of code: hubchoices = ["fight","shop","upgrade stats"] print("you can,"hubchoices[0].capitalize(),,hubchoices[1].capitalize(),hubchoices[2].capitalize(), sep= ", ") the output receive this: you can, fight, shop, upgrade stats is there way have sep= ", " work after first comma more this: you can fight, shop, upgrade stats (and way capitalize first letter of every word .capitalize()) try str.join : print("you can %s" % ','.join([c.capitalize() c in hubchoices]))

ios - Registration of Xcode Project to Bluemix -

imfclient.sharedinstance().initializewithbackendroute each time try line in xcode 6, getting error: 'use of unresolved identifier imf client' is there way resolve this? you have make sure have imported correct header files configured frameworks/pods correctly. seems using swift add instructions below: 1) make sure have configured pod file correctly. below standard pod file using imf services, need include resources need (imfcore in case above): source 'https://github.com/cocoapods/specs.git' # copy following list , remove dependencies not need pod 'imfcore' pod 'imfgoogleauthentication' pod 'imffacebookauthentication' pod 'imfurlprotocol' pod 'imfpush' pod 'imfdata' 2) terminal, go project folder , install dependencies following command: pod install 3) open {appname}.xcworkspace instead of .xcproject. .xcworkspace has of pods , decencies configured correctly after pod install has been compl

javascript - Exclude some file extension from upload dialog -

i need allow select file dialog accept file type except specific type, example need make dialog displays except .exe files, i see question exist , have answer. please check bellow link validation of file extension before uploading file var _validfileextensions = [".jpg", ".jpeg", ".bmp", ".gif", ".png"]; function validate(oform) { var arrinputs = oform.getelementsbytagname("input"); (var = 0; < arrinputs.length; i++) { var oinput = arrinputs[i]; if (oinput.type == "file") { var sfilename = oinput.value; if (sfilename.length > 0) { var blnvalid = false; (var j = 0; j < _validfileextensions.length; j++) { var scurextension = _validfileextensions[j]; if (sfilename.substr(sfilename.length - scurextension.length, scurextension.length).tolowercase() == scurextens

VBA-enabled Excel 2010 workbook will not close when any other workbook is open -

i have finished excel workbook utilizes fair amount of vba. spreadsheet able perform of intended functions, , there no issues when workbook open in excel. however, when other workbook open (unrelated files included), workbook not close. clicking on red "x" in top right corner not anything, , no error messages shown. in order close it, other excel windows must closed beforehand. while not detract functionality of workbook itself, enough people using want avoid bringing inconvenience of having close other workbooks have open before being able close one. so, have ideas causing happen? have code workbook_close() event, designated private , located within thisworkbook part of spreadsheet. i'm confused why sheet no vba involved prevents 1 closing. please let me know if there can clarify, thank you. edit - here code workbook_beforeclose() event: private sub workbook_beforeclose(cancel boolean) if me.saved = false me.save call prepareworkbook end sub sub preparewor

html - Unexpected CSS Behavior? -

while playing around divider lines take full height of container without parents height, stumbled across below scenario. can 1 figure out why setting dividers position:absolute , display:inline-block not cause them float way left of parent container expected? why inline? html <div class="wrapper"> <div class="box"></div> <div class="divider"></div> <div class="box"></div> <div class="divider"></div> <div class="box"></div> </div> css .wrapper{ width:100%; text-align:center; position: relative; } .box{ display: inline-block; width: 150px; height: 100px; background: red; margin: 0 0 0 5px; } .divider{ display: inline-block; position: absolute; top: 0; bottom: 0; width: 1px; background: black; } jsfiddle that's because both left , right auto . then, according §10.3.7 , [if] 'lef

angularjs - ng-repeat to create the hyperlink -

i have issue create list of hyperlink using ng-repeat. have user.spaces has array of objects like user.spaces [ {device_name: 'phone1', id : '11111' }, {device_name: 'phone2', id='22222' ] , want create list of device_name's hyper link below list of devices : phone1 phone2 and here code in .html file <div ng-if="usercontroller.inedit" class="form-group"> <label class="col-sm-4">{{'user.workspace_user' | translate}}:</label> <div class="col-sm-8"> <tr ng-repeat="space in user.spaces track $index"> <td><a href ng-click="gotospace(space)" id="linkspaces_{{$index}}" >{{space.device_name}}</a></td> </tr> </div> </div> didn't result want list of device's hyper links. suggestions need change in .html file make works in advance, kim using angu

javascript - ExtJS property grid reload after render -

i have property grid : periods.each(function(record){ var temppropgrid = me.getview().add( { xtype:'propertygrid', width: 80, header: false, title: 'prop grid', //for reason headers not hiding, may need deal using css //hideheaders: true, enablecolumnresize: false, sortablecolumns: false, namecolumnwidth: 1, source: record.data, sourceconfig: { periodscrummaster: { editor: ext.create('ext.form.combobox', { tdcls: 'red', store: team, querymode: 'local', displayfield: 'personname', valuefield: 'personname', listeners: { 'expand' : function(combo) { var gridvalues = this.up('propertygrid').getsource();

objective c - Using AppKit With SpriteKit -

since i've learned objective c i've used spritekit project template. i've had tiny bit of exposure ios development , i'm looking use appkit elements (buttons, etc) in os x spritekit project menu creation, overlays or having more flexibility in terms of placing items on screen. possible , if so, how? along lines of layering views (nsview overtop of skview) or that? it's same ios. can use nswindowcontroller , nsviewcontroller hold skview , place elements above view. in case ended using sprite kit of ui because didn't want have mange 2 separate interfaces. i recommend don't use sprite kit template instead use default cocoa app template because uses newer interface technologies make designing interface easier , more similar ios.

social networking - Importing non-rectangular data as rectangular in R -

i need load social network data each user has unknown , potentially large number of friends, stored text file of following format: userid: friendid1, friendid2, ... 1: 12, 33 2: 3: 4, 6, 10, 15, 16 into two-column data.frame: userid friendid 1 1 12 2 1 33 3 3 4 4 3 6 5 3 10 6 3 15 7 3 16 how in r? reading, filling , reshaping inefficient requires keep in memory many columns full of na . related questions here , , here . if have colon delimiter, use read.table header = false data r, consider using csplit "splitstackshape" package. mydf <- read.table("test.txt", sep = ":", header = false) mydf ## v1 v2 ## 1 1 12, 33 ## 2 2 ## 3 3 4, 6, 10, 15, 16 library(splitstackshape) csplit(mydf, "v2", ",", "long") ## v1 v2 ## 1: 1 12 ## 2: 1 33 ## 3: 3 4 ## 4: 3 6 ## 5:

java - String data from a Scanner through a PrintWriter -

i trying pass data string printwriter while simultaneously reading bufferedreader between 2 classes named server.java , client.java. problem having trouble handling exceptions being thrown block of code reads data scanner object (marked below). client.java package root; /** * @author noah teshima */ import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printwriter; import java.net.inetaddress; import java.net.socket; import java.util.scanner; public class client { private socket clientsocket; private bufferedreader bufferedreader; private inputstreamreader inputstreamreader; private printwriter printwriter; private scanner scanner; public static void main(string[] args) { new client("localhost", 1025); } public client(string hostname, int portnumber) { try { this.clientsocket = new socket(hostname, portnumber); this.bufferedreader = ne

objective c - Moving to Safari web page from iOS app -

i've heard friend apple has stopped accepting applications might move web page outside app(in safari). true? i'm talking method: uiapplication.sharedapplication().openurl(myurl) sorry dumb rather looking questions, couldn't find information online... apple added restrictions canopenurl and, mistakenly, openurl in ios 9. must declare url schemes (except system handled, http ) can used these methods, in other case these methods return error, and, probably, reason app rejection. these changes announced on this session

ios - How to put a Bar button item to the bottom of a toolbar? -

Image
i have toolbar @ top of app. changed height programmatically make bit bigger. var consth = nslayoutconstraint(item: toolbar, attribute: nslayoutattribute.height, relatedby: nslayoutrelation.equal, toitem: nil, attribute: nslayoutattribute.notanattribute, multiplier: 1, constant: 64) toolbar.addconstraint(consth) but have problem when add bar button items via storyboard, automatically centers them vertically. standard items stay @ bottom. how solve? [please answer in swift] you should hook bar button items using iboutlets, can add spacing using edge insets: barbutton.imageinsets = uiedgeinsetsmake(0,10,0,0)

sql server - How do I merge many similar tables? -

i have many tables have identical structure , similar table names , looking way merge few columns them new table 2 additional columns: auto-generated integer pk, , name of source table. e.g., uniqueid sourceid, xcoord, ycoord, zcoord, sourcetable i managed create table containing list of tables want use, don't know next. select [name] pointtables [surveys].[sys].[tables] [name] '%coorddb' not clear problem. columns name of tables same? want insert pointtables? you can create table: create table pointtables( uniqueid int identity , xcoord int , ycoord int , zcoord int , sourcetable varchar(50) after that, can insert table of sp_executesql command , concatenation declare @command nvarchar(max) select @command = 'insert pointtables(xcoord,ycoord,zcoord,sourcetable) select [xcoord],[ycoord],[zcoord],'''+name+''' '+name sys.tables name '%coorddb%' execute sp_executesql @command

How to marshall byte* from C.dll in C# -

i have 2 functions trying call c# shares similar signatures: bool read (byte len, byte* databuf) bool write (byte len, byte* databuf) from doc: databuf destination of transmitted data what shall use in c# call? byte[] mybytearr[0] p/invoke assistant suggested system.intptr don't have hardware test yet, trying many of calls right when have. thanks. for read function use: [out] byte[] buffer for write function use: [in] byte[] buffer [in] default , can omitted not hurt explicit. the functions therefore be: [dllimport(filename, callingconvention = callingconvention.cdecl)] static extern bool read(byte len, [out] byte[] buffer); [dllimport(filename, callingconvention = callingconvention.cdecl)] static extern bool write(byte len, [in] byte[] buffer); obviously you'll need allocate array before passing unmanaged functions. because byte blittable marshaller, optimisation, pins array , passes address of pinned object. means no copying per

python - Matching parts of two csv files to return certain elements -

hello looking index match in excel new python data sets far large excel now i dumb question right down as possible cause data contains alot of irrelevant information problem csv (has 3 basic columns) name, date, value csv b (has 2 columns) value, score csv c (i want create using python; 2 columns) name, score all want enter date , have rows in csv match "date" , "score" associated "value" row in csv in csv b , returning in csv c along name of person. rinse , repeat through every row any appreciated don't seem getting far here working script using python's csv module : it prompts user input date (format m-d-yy ), reads csva row row check if date in each row matches inputted date. if yes, checks if value corresponds date current row of matches of rows in csvb . if there matches, write name csva , score csvb csvc . import csv date = input('enter date: ').strip() = csv.reader( open('csva.csv',

jquery - How to arrange div as a dock panel? -

Image
i need know how make following divs aligned , resized according below requirement. area a area need stayed on top given height. height of area wont changed. area b height of area b changed between 0 - min-height. when height of b 0, area c should stretched fill area b well. height of area b increased min-height x (x > min-height) . in situation area c should shrink down give space area b. area c area c filling area of page. need adjust height according area b. area d area d stayed @ bottom of page , height not changed. i know possible achieve above css? or need use jquery. if it's possible css? know how?. ( i know how jquery ) *i'm using css3/html5 update i've added jsfiddle also i'm not quite sure question fit question conditions. if not, pls delete this depends on how far need browser support, typical use case flex box . keep in mind flex box new css feature. work fine on evergreen browsers, not work on ie 8 , 9. see here . i&

c++ - Error C2661, having an issue constructing with 5 parameters, SFML 2.3 -

i using sfml 2.3, visual c++. compiler error receiving "error c2661: 'tree::tree' : no overloaded function takes 4 arguments". here tree class constructor. class tree : public rectangleproperties { public: tree(float x, float y, sf::vector2f size, sf::vector2f origin, int rotation); tree() {}; ~tree(); ... tree::tree(float x, float y, sf::vector2f size, sf::vector2f origin, int rotation) { rect.setorigin(origin); rect.setsize(size); rect.setposition(x, y); rect.setfillcolor(branches); rect.setrotation(rotation); } later, , time call constructor through here: squares.emplace_back(tree.initialpos_x, tree.initialpos_y, tree.size, tree.origin, tree.rotationvalue); earlier supplying 4 parameters. worked out fine, until realized implementation required 5. when ran issue having now. things have tried: cleaning , rebuilding solution creating new solution, , rebuilding it. sorry, mistake on

Store App Memory Management -

noticed when navigating page on , on 200+ times frame.navigate(type) memory app process continues grow huge amount. page starts become sluggish once process reaches 100 mb ~50 clicks. from can tell, page instantiated every time navigated (the page constructor hit). though page small, app can grow towards ~1gb of memory. obviously user not going navigate same page 200 times, app long lived , there many pages, have concern issue. are there techniques preventing kind of memory growth? please make sure you've used lots of "using" statements in code , use page_unloaded or onnavigatedfrom(navigationeventargs e) events clean heavy objects , other resources you're using on pages. or if can convert app mvvm model page cache , consume less memory.

Sessions in Google Analytics vs BigQuery - discrepancies -

i detecting discrepancies between total number of sessions in data on google analytics , bigquery. calculating in bq, use following: select date, exact_count_distinct(concat(fullvisitorid, string(visitid))) sessions [mydata] the results obtained query these: query results row date sessions 1 20150601 1269258 2 20150602 1269299 3 20150603 1131770 in google analytics, numbers of sessions per day are: day index sessions 6/1/2015 1113088 6/2/2015 1112203 6/2/2015 993178 is there reason difference?

How to make Google make in center when using double Tap and pinch to zoom in android? -

i have search google map center while zooming using double tap , pinch zoom. have found 1 solution here , double tap zoom solution. touchablewrapper public class touchablewrapper extends framelayout { gesturedetectorcompat mgesturedetector; public touchablewrapper(context context) { super(context); mgesturedetector = new gesturedetectorcompat(context, mgesturelistener); } private final gesturedetector.simpleongesturelistener mgesturelistener = new gesturedetector.simpleongesturelistener() { @override public boolean ondoubletap(motionevent e) { log.e("gesturedetector", "executed"); //notify event bus (i using otto eventbus of course) have received double-tap event on map, inside event bus event listener eventbus_singleton.getinstance().post(new eventbus_poster("double_tapped_map")); return true; } }; @override publi

ios - In Swift, how do I iterate through every cell in a UITableView and then get its properties? -

i have generic uitableview , want go through every visible cell. how can in swift? i'm using in 1 of projects: let cells = self.tableview.visiblecells as! array<uitableviewcell> cell in cells { // @ data } here's answer, it's in objective-c: how can loop through uitableview's cells?

web - Json Object in development? Is it decided in front-end or back-end? -

i working on web-app layout getting generated after getting json backend. object recieved backend quite complicated , requires loop around object quite few times layout. and same happening while posting data backend. what feel if follow front end layout generate json object post data , if object structure backend changed, layout generation not need loops. so json object backend gives or should according front-end? for example backend giving [ { "keyid": "value", "attr1": "value1", "attr2": "value2" }, { "keyid": "value", "attr3": "value3", "attr4": "value4" } ] but easy front end receive , send object in format below: { "keyid": "value", "attr": { "attr1": "value1", "attr2": "value2", "attr3": "value3&qu

html - Firefox absolute position bug -

i'm having problem absolute position in firefox. works different chrome, ie or opera. i'm talking navigation here http://mapylasky.xdiv.cz/ in browsers expect firefox in 1 line. in firefox not in place. .menu-item{ position: absolute; color: #000; } .menu-item .icon{ position: absolute; background-image: url('<?php echo get_template_directory_uri(); ?>/img/menu/menu-icons.png'); } .menu-item .desc{ position: absolute; font-size: 16px; } .container{ width: 1100px; margin: 0 auto; position: relative; } .menu-item .icon{ height: 56px; } .menu-item.prvni{ left: 11px; top: 21px; } .menu-item.prvni .icon{ width: 193px; height: 92px; background-position-x: 452px; } .menu-item.prvni .desc{ left: 0px; top: 0px; } html <div class="navigation-background"> <div class="container"> <a href=&quo

php - Keep multi-character delimiter -

i have string $string = "hi!n!my!n!name!n!is!n!bob"; i want split '!n!' i've tried like: $splitstring = preg_split("!n!", $string,-1, preg_split_delim_capture); but removes instances of 'n' instead of !n! if print_r array, it'll like: array( [0]=>hi! [1]=>!my! [2]=>! [3]=>!ame! [4]=>!is! [5]=>!bob ) it split every occurrence of 'n'. not !n! (a 3 character delimiter) wanted. does know how solve this? in advance you need delimiters (e.g. / ) in regular expression: $splitstring = preg_split("/!n!/", $string,-1, preg_split_delim_capture);

java - Delay in loading banner ads from admob -

i've been adding admob banner ads android app using standard code available in started section on website. fine except there's few second delay after activity starts before ad loaded. i've seen people having same problem , asking preloading ad there's no clear solution available anywhere. know apps on market don't have delay question how work around it? load ads array list in loading activity , store them in shared preferences have read it's discouraged. from have read , understood there not can it. take time. 1 solution have seen is adrequest adrequest = new adrequest.builder().build(); minterstitialad.setadlistener(new adlistener() { @override public void onadloaded() { log.i(tag," interstitial add :loaded"); } @override public void onadfailedtoload(int error) { log.i(tag,"could not load interstitial add"); } } minterstitialad.loadad(adrequest); this interstitial adds same goes banner

php - Iterate values of Associative array if it has one object or more -

my problem is, have set of arrays $people =[{name:'alan', haschild:true}, {name:'alice', hasdetail:true}]; and other 1 is $people =[{name:'alan', haschild:true}]; i need print elements. i have tried in below way for($i=0; $i<count($people); $i++){ echo $people[$i]['name']; } the first 1 working fine. second 1 show error this notice: undefined offset: 0 in /opt/lampp/htdocs/vp/pending_users.php on line 320 why happen? how overcome issue this basic stuff. should read few beginner's tutorials. you can loop array using foreach loop , this: $people = [ [ 'name' => 'alan', 'haschild' => true ], [ 'name' => 'alice', 'haschild' => true ] ]; foreach ($people $person) { echo $person['name'] . "\n"; }

Trajectory Plot inside of 3D transparent sphere using R -

Image
i want make trajectory plot of df inside of transparent 3d sphere. i searched stackoverflow couldn't find same question. might helpful interested trajectory of vectors. the df this df <- data.frame(mx=runif(100,-0.05,0.05), my=runif(100,-1,1), mz=runif(100,-0.5,0.5)) i agree frank's answer. if want plot trajectories on sphere supplied picture, should bit more careful, since ordinary interpolation won't give paths on sphere. there different options, easiest project paths onto sphere. require(rgl) # construct brownian motion on sphere n <- 100 sigma <- 0.5 df <- array(na, dim = c(n, 3)) df[1, ] <- rnorm(3, sd = sigma) # starting point df[1, ] <- df[1, ] / sqrt(sum(df[1, ]^2)) (i in 2:n) { df[i, ] <- rnorm(3, sd = sigma) + df[i - 1, ] df[i, ] <- df[i, ] / sqrt(sum(df[i, ]^2)) } # linear interpolation of observed trajectories, projected onto sphere times <- seq(1, n, length = 1000) xx <- ap

mysql - Sails passport js integration using sails as REST API -

i trying use passport js authentication in local mysql database. using postman extension test application. sending 2 fields i.e. username , password authentication. when 1 of field blank response shown in json format { "message": "missing credentials", "user": false } but when pass values both fields 500 internal server error. error: sending 500 ("server error") response: typeerror: cannot read property 'message' of undefined @ d:\test\api\controllers\authcontroller.js:25:23 @ strategy.strategy.error (d:\test\node_modules\passport\lib\middleware\authenticate.js:333:18) @ strategy.authenticate (d:\test\node_modules\passport-local\lib\strategy.js:94:17) @ attempt (d:\test\node_modules\passport\lib\middleware\authenticate.js:341:16) @ authenticate (d:\test\node_modules\passport\lib\middleware\authenticate.js:342:7) @ object.module.exports.login (d:\test\api\controllers\authcontroller

itunesconnect - Can't Delete App Via iTunes Connect -

i have app delete. however, using docs, there no "delete app" button though app has "right" status of "prepare submission". any ideas? as says below in docs... the app status can 1 of following, assuming there @ least 1 approved version of app [...] ...your application must have been approved @ least 1 time. guess issue. hope helps :)

vba - Connecting Access with SAS -

i have decent amount of experience sas , access, , know how call access vba, having problem table locks need with. essentially doing running proc freq in sas, passing table in access can read in subform. i have form combo boxes user can select info variable want frequency of. click button , vba passes parameters on sas, , subform populates frequency data sas. everything works except final part. i have taken parameters access, passed them sas, , run correct frequency. during sas's proc export access, error stating: "exectute: database engine not lock table "freq" because in use person or process." the issue table sas exporting used in access form opens sas. since not using form while sas processing, there way have form unlock or disconnect table sas can access it, , reconnect table form after sas finishes processing? i tried splitting database, got same problem.

android - Design of an API SDK -

i'm posting here open question because i'm wondering best way design api sdk android . here point. we have apis (json/restful) exposed, but, want build sdk developers, wouldn't want implement calls themselves. so see 3 ways consume api. synchronous way asynchronous way (2 sub parts in fact) callback way future way as don't want force dev use or way do. wondering do. multiple options here. implement the unit way . a method returns final object , not care threading. a method takes callback in parameter , trigger onresult() final object argument (it cares threading in background) a method returns future, dev can decide when wants it. implement as single object . the method returns object work on callback mode or future mode. just callbacks just futures whatever else so, we're not sure as developers , guys prefer. , if ever faced problem, final decision? thanks or feedback! just map retrofit : http://square.github.i

c# - Coverting List<double>t to DataTable is Taking alot of Time -

i building small software clients need read data 3 list each list contains around 50000 data points , supply lists me array : list<double>[] myvars = new list<double>[3]; (int x = 0; x < 3; x++) { string temprowcell = ""; temprowcell = grdmaapingview.getrowcellvalue(0, grdmaapingview.visiblecolumns[x].fieldname).tostring(); grdmaapingview.getrowcellvalue(x, grdmaapingview.visiblecolumns[x].name.tostring()); mymodifiedtable.columns.add(temprowcell, typeof(string)); myvars[x] = pressin.getvaluesbyfilter(temprowcell).values.tolist(); } (int c = 0; c < mymodifiedtable.columns.count; c++) { foreach (double v in myvars[c]) { string temp = mymodifiedtable.columns[c].columnname.tostring(); datarow temprow = mymodifiedtable.newrow(); temprow[temp] = v; mymodifiedtable.rows.add(temprow); } } grdresults.datasource = mymodifiedtable.defaultview; the problem reading of data take lo

algorithm - Number of ways to tile a W x H Grid with 2 x 1 and 1 x 2 dominos? -

Image
write program takes input width, w , height h of grid , outputs number of different ways tile w-by-h grid (2x1) dominoes i know how solve problem 3 x n grid writing recursive formula hard me! i have no idea how it! i created 2 functions f(n) - complete way of tiling till n , s(n) number of ways of incomplete tiling 3 x n ! here height variable cannot think of anything constraints : (0 ≤ w+h ≤ 22) this sort of dpish under hood. idea ivlad's: backtracking memoization. memo = {} def count_tilings_recursive(uncovered): if len(uncovered) & 1: return 0 if not uncovered: return 1 if uncovered not in memo: i, j = min(uncovered) memo[uncovered] = count_tilings_recursive(uncovered - {(i, j), (i, j + 1)}) + count_tilings_recursive(uncovered - {(i, j), (i + 1, j)}) return memo[uncovered] def count_tilings(m, n): return count_tilings_recursive(frozenset((i, j) in range(max(m, n)) j in range(min(m, n)))) prin

javascript - Adding edge labels to a CSS based tree -

Image
this code based on this . <div class="tree"> <ul> <li> <a href="#">great grand child</a> </li> <li> <a href="#">great grand child</a> </li> <li> <a href="#">great grand child</a> </li> </ul> </div> https://jsfiddle.net/danyaljj/sq6wy6bq/ i want add labels on edges. idea best way this? (the set of possible labels limited, 10 labels). this: here's solution far robust allow label on first , last item of 3-items list (there's no phydical place label on second one...) fiddle https://jsfiddle.net/sq6wy6bq/2/ html code: i'd add label in each item before labelled child so: <ul> <li> <span class="so-label">label 1</span> <a href="#">great grand child</a>

How to handle duplicates in emailaddreses when using multiple signup forms with MailChimp? -

i have various signup forms on website, adding 1 list in mailchimp. each signup form has different purpose, e.g. free ebook, video etc. using hidden source field managed provide correct download urls etc. but... how handle visitor signs on multiple forms? want share related materials him, mc marks duplicate error , requests update profile... no option obtain related material. you'll need use api make work, simple form isn't going cut it. there options. if there handful of things, have them interest groups. when signs up, free ebook, mark free ebook interest group , subscribe them if necessary. you can create automation each interest group send material.

c# - datatable turns empty when i pass it to method -

so have simple function goes through table , find rows has age columns between 2 numbers , return new table new rows. here function : private datatable agefinder(int miniage, int maxiage, datatable x) { //afwt : analyze table int count; datatable dtage = new datatable(); dtage = x.clone(); int agemin = miniage; int agemax = maxiage; if (agemin > agemax) { int temp = agemax; agemax = agemin; agemin = temp; } int agedr; count = 0; agedr = 0; datagridview1.datasource = x; foreach (datarow dr in x.rows) { agedr = convert.toint16(x.rows[count]["age "]); if (agedr >= agemin && agedr < agemax) { dtage.rows.add(dr.itemarray); } count++; } lblcountthisquery.text = dtage.rows.count.tostring(); return d

javascript - Give different tickFormat() according to time period displayed? -

is possible give different tickformat() type axis labels depending on time period being displayed? for example if th time range day, show hours tickformat(d3.time.format('%i')) if week show days tickformat(d3.time.format('%a')) if month show weeks tickformat(d3.time.format('%w')) and on , on...

html5 - Can m3u8 files have mp4 file urls? -

i in situation have flv video converted mp4 , streaming http url using nginx server. multibitrate supoport on html5 have created m3u8 file : #extm3u #ext-x-stream-inf:program-id=1,bandwidth=200111, resolution=512x288 http://streamer.abc.com:8080/videos/arvind1.mp4 #ext-x-stream-inf:program-id=1,bandwidth=3000444, resolution=400x300 http://streamer.abc.com:8080/videos/arvind1.mp4 #ext-x-stream-inf:program-id=1,bandwidth=400777, resolution=400x300 http://streamer.abc.com:8080/videos/arvind1.mp4 #ext-x-endlist but jwplayer not playing saying playlist not loaded. "no playable sources found". please help. no, hls supports segmented transport streams in m3u8 playlist. may find work in players, not part of standard, , not work in ios.

ios - NSTimer userInfo Bad Access exception -

i got problem nstimer , userinfo . in the docs apple writes system keeps strong reference timer (and therefore userinfo?) though when i'm trying access parts of userinfo object i'm getting bad access exception . (afaik means bad happened) without further ado, here's how object looks pass userinfo: @interface myobject @property (nonatomic, assign) u_int8_t cmd; @property (nonatomic, assign) nsnumber *_id; @end and here's how set timer: nstimer *mytimer = [nstimer timerwithtimeinterval:10 target:self selector:@selector(somemethod:) userinfo:message repeats:no]; [[nsrunloop mainrunloop] mytimer formode:nsdefaultrunloopmode]; the method gets triggered when timer fires -(void) somemethod:(nstimer *)timer{ myobject* mobject = [timer userinfo]; u_int8_t cmd = mobject.cmd; // works nsnumber *_id = mobject._id; // bad access } note: userinfo isn't nil. neither u_int8_t nil or whatsoever. try access nsnumber object i'm receiving follow

math - Apparent error in Matlab's perms function -

p = perms([0:2]) p = 2 1 0 2 0 1 1 2 0 1 0 2 0 1 2 0 2 1 this function supposed display permutations of vector in reverse lexicographical order. hence, expect last row of output contain elements 0 1 2 ; however, contains 0 2 1 . other rows displayed correctly. in short, order of last 2 rows interchanged. going on here? yes, seems bug. catch! bug in documentation , rather in function. if type open perms see source code, you'll see following description in first lines: %perms possible permutations. % perms(1:n), or perms(v) v vector of length n, creates % matrix n! rows , n columns containing possible % permutations of n elements. % % function practical situations n less % 10 (for n=11, output takes on 3 gigabytes). % % class support input v: % float: double, single % integer: uint8, int8, uint16, int16, uint32, int32, uint64, int64 % logical, char in no reference made rev

wireframe - Android mockup tool that exports as an .apk -

[in short] - looking mockup tool allows describe clickable buttons in predefined wireframes , allows exporting .apk . among many mockup tools available android allow wireframe creation, live preview , exporting set of images or pdf. however, allow exporting .apk highly premium feature (like marvelapp). i have created [high-fidelity] wireframes using fireworks+photoshop. need tool allows me put these wireframes in mockup, describe clickable button areas in them , open new wireframe , repeat. why ? interviewed [almost] major based tech firm design position vp of engineering. guy gave me project show skills , asked love see wireframes in action on real device shows transitions , there tons of softwares out there allows without coding. i have created apps before using android studio but, breakup each of wireframes , describe them in layout hectic now. there tools because i've spent hours finding one. should go long way ? although not looking for, recommend invision

linux - Starting sshd automatically if it is down/failed -

i trying create bash .sh script cronjob starts openssh server if down or failed. last night ssh server down , when tried access today (from work) connection refused ofc. no traces in /var/log/messages failure. so question - how determine sshd running if not "sudo service ssh start" it? thanks in advance! fellas, believe have managed task: #!/bin/bash service="ssh" if (( ! $(sudo service ssh status | cut -d" " -f 3 | cut -d"." -f 1) == "running" )) sudo /etc/init.d/ssh restart fi i have changed loglevel verbose, hope next time track more clues regarding failure of sshd.

actionscript 3 - How to make an object disappear in Action Script 3 -

i have used following code show html page in app supported action script 3.0 , adobe air. imports import flash.events.event; import flash.events.locationchangeevent; import flash.geom.rectangle; import flash.media.stagewebview; import flash.net.navigatetourl; import flash.net.urlrequest; import flash.events.mouseevent; //setup variables var _stagewebview:stagewebview; var myadverturl:string = "http://letschant.890m.com/v25.html"; // check _stagewebview doesn't exist if (!_stagewebview) { _stagewebview = new stagewebview() ; // set size of html 'window' _stagewebview.viewport = new rectangle(0, 0, 480, 688); // add listener when content of stagewebview changes _stagewebview.loadurl(myadverturl); } // show ad setting it's stage property; _stagewebview.stage = stage; so, if click button these should disappear. know should use visible:false, should put code?, aint movie clip, how should this? please help. thank :d stagewebv

How to reverse-engineer a USB device without monitoring traffic? -

how possible determine commands operate usb device, if device comes operating system , traffic monitoring software cannot installed on os. method can think of sending random commands device, until device responds, seems implausible more complex commands, , potentially dangerous. example, consider dualshock 4 controller. sony has not made official driver device, method can use create linux driver it? get hardware protocol analyzer. won't need install software on host or device under test. here 1 have used: http://www.totalphase.com/products/beagle-usb12/

html - Open/Close menu On click using only javascript no jquery -

this html file <form id="form1" runat="server"> <div class ="mvbar"> <ul> <li><a href ="m">home</a></li> <li><a href ="m">about</a></li> <li class="pjlist" onclick="load"><a href ="m">projects</a> <div class="sub1"> <ul> <div class="arrow1"></div> <li><a href ="m">projects1</a></li> <li><a href ="m">projects2</a></li> <li><a href ="m">projects3</a></li> </ul> </div> </li> <li class="svlist" onclick="load"><a href =&qu

android - Parse.com how to get data that is saved from other device -

i've implemented class called 'donar' in parse.com , used in android app. can store , retrieve data class without problem let 'device 1'. problem i'm not getting data 'device 2' , vice versa. problem? code saving data parsequery<parseobject> query = parsequery.getquery("donar"); query.whereequalto("team_id", team_id); query.countinbackground(new countcallback() { public void done(int count, parseexception e) { if (e == null) { parseobject donar = new parseobject("donar"); donar.put("name", name.gettext().tostring()); donar.put("contact", contact.gettext().tostring()); donar.put("nid", nid.gettext().tostring()); donar.saveinbackground(); code retrie

dropdownlist error in Laravel -

hi i'm dot net developer , i'm new php using laravel framework have problem in dropdownlist, did populating data database dropdownlist when i'm saving data dropdownlist id not added in database got null value. this controller public function store(request $request) { $this->validate($request, [ 'title' => 'required', 'description' => 'required' ]); $input = $request->all(); task::create($input); session::flash('flash_message', 'task added!'); return redirect()->back(); } public function create() { $category = category::lists('category', 'id'); return view('tasks.create')->with('category', $category); } and in view <div class="form-group"> {!! form::label('cagetory_id', 'category:', ['class' => 'control-label']) !!} {!! form::select('cagetory_id', $category, nu

Use Java functions with Apache Derby -

i've encountered problems using functions in apache derby, in can't derby find self-defined functions. typical error message looks this: the class 'de.uniba.kinf.projm.hylleblomst.database.sql.utils.groupconcat' not exist or inaccessible. can happen if class not public. the documentation states method must public , static. want use: package de.uniba.kinf.projm.hylleblomst.database.sql.utils; public final class groupconcat { public static string groupconcat(string separator, string... arguments) { stringbuilder result = new stringbuilder(""); (string arg : arguments) { result.append(arg + separator + " "); } result.delete(result.length() - 2, result.length()); return result.tostring(); } } basically want add groupconcat functionality database not provided in derby standard. statement use add function db this: create function sql_util.group_concat ( separator char, args var

how to use file parameter in jenkins workflow -

does file parameter work @ in workflow job? if so, please explain how so. when add file parameter under this build parameterized in workflow, won't uploaded. parameter/variable contain file name though. while in free style project upload "step" shown during build. jenkins (1.617) , workflow (1.8) i not believe file parameters can made work currently, described in jenkins-27413 .

php - Cannot echo database items -

i trying echo out database items in php nothing seems coming out. initialize php required calls out database.php stores configurations show below.what doing wrong? sql statement: <?php require_once("includes/initialize.php"); $username = $_post["name"]; $useremail = $_post["email"]; $sqlname = "select name individual"; $sqlemail = "select email individual"; if ($sqlemail == $useremail || $sqlname == $username){ $message = "hi " + $username + "this new password."; echo $message; } ?> the database configurations in php file called database.php. database.php: <?php require_once ("config.php"); class mysqldatabase { private $connection; function __construct() { $this->connection = mysqli_connect(db_server, db_user, db_pass, db_name) or die ("database connection failed: " . mysqli_connect_error() . &qu

java - WebSocket Session closes after not receiving input for some time -

so have websocket session reads information server. if cut off information it's receiving completely, after minute or stop receiving new information, , won't anything, when output server turned on. i thought websocketcontainer method setdefaultmaxsessionidletimeout(long time) would fix issue, set container.setdefaultmaxsessionidletimeout(86400000l); which thought mean continue running 1 day of inactivity. however not case, stops after minute of inactivity. below code i'm using, maybe can let me know i'm doing wrong: public void run(string... args) throws exception { log.info("starting..."); log.info("-- api url: {}", apiurl); log.info("-- api token: {}", apitoken); websocketcontainer container = containerprovider.getwebsocketcontainer(); container.setdefaultmaxsessionidletimeout(86400000l); clientendpointconfig config = clientendpointconfig .builder.create() .configurator(n

excel - string and numeric value when equal returns true -

why 5.5 = "5.5" return true in vba? is acceptable practice direclty compare numeric values string values in vba? this returns true if 5.5 = "5.5" ... this might shut-down opinion-based more anything, yes acceptable. used when comparing cell values numbers, or adding cell values, example. ie if cells contain string such abcde123, , want use 123, take 3 right characters of string , use them directly. if want rigorous use cint(string) not think necessary.

flexsider not working in Bootstrap tabs and jquery tab -

i trying put flexsider inside bootstrap tab. first tab working second tab flexsider not working. after tabs working fine flex slider. please me. flexsider compatible bootstrap tab or jquery tab. please examples. you might have missed tabs plugin code this. following code snippet same. <script type="text/javascript" src="assets/twitterbootstrap/js/bootstrap-tab.js"></script> <script type="text/javascript"> jquery(document).ready(function ($) { $('#tabs').tab(); }); </script> hope helps you.

c# - WCF AJAX Cannot infer schema. The Request/Response body is wrapped -

i'm working on connecting web form ssis through wcf web service. issue started out issue cross-referencing service, , has become issue service giving error in title. here code: //service [servicecontract] public interface iextractionservice { [operationcontract] [webinvoke(method = "post", requestformat = webmessageformat.json, responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrapped, uritemplate = "/submitextraction")] string runextraction(string start, string end, string packagename); } public string runextraction(string start, string end, string packagename) { //code run ssis package } //javascript $("#btnsubmit").click(function () { var startdatetime = ($("#from").data + " 00:00:00"); var enddatetime = ($("#to").data + " 23:59:59"); var extractiondata = { "start": startdatetime,