Posts

Showing posts from May, 2010

How to find axis of revolution of cylindrical objects generated from STL files in matlab? -

i have 3d models in stl file format. reading files using "stlread" function provided here . gives me 2 outputs, faces , vertices. after plotting vertices (values of x,y,z stored in matrix format) using scatter3 plot, getting cluster of points. there way find out axis of revolution of cluster of point? currently, used kmeans clustering algorithm find out 1 centroid points. drawing normal each plane(xy,yz,zx) on centroid. after getting 3 normals, calculated distance between each normal , each point. stored values in 3 vectors 1 each normal. normal has least unique distances axis of revolution. working symmetric rotational objects. unsymmetrical objects has elongation rotational surface, centroid shifted not able generate proper axis of rotation.

java - JavaFX Tables - Adding columns works but no text -

i have searched everywhere (including youtube videos) , couldn't find answer. i have simple code partially works: @fxml private tableview<model.location> locationstable; @fxml observablelist<model.location> locationslist = fxcollections.observablearraylist(); public void initialize(url location, resourcebundle resources) { locationslist.add(new model.location("123", "123", "123")); locationslist.add(new model.location("321", "123", "123")); locationslist.add(new model.location("abc", "123", "123")); system.out.println(locationslist); // locationid column tablecolumn<model.location, string> columnlocationid = new tablecolumn<model.location, string>(); columnlocationid.settext("id"); columnlocationid.setminwidth(104); columnlocationid.setcellvaluefactory(new propertyvaluefactory<model.location, string>("

batch file - How to get folder name from provided input path with CMD -

i have input path c:\student\temp in temp folder, there many other folders. want latest folder name order descending. @echo off /f "tokens=* delims=" %%# in ('dir /b /a:d /o:d /t:c "c:\student\temp"') set "latest=%%~nx#"

java - Scope prepended to name when rendering JavaScriptResourceReference in Wicket 7.0.0-M6 -

in panel supposed loading js resource, add behavior following method panel: @override public void renderhead(component component, iheaderresponse response){ response.render(javascriptheaderitem.forreference(new javascriptresourcereference(relativeclass, webapplication.get().getservletcontext().getcontextpath() + jsref))); } i can see stepping through in debug name parameter context path prepended url of resource, want! when website run, panel looks @ localhost:8080/context/scopeurl/context/resourceurl instead of localhost:8080/context/resourceurl . scope can't set null, have use name parameter access resource properly? classes kept in separate directory structure within root directory scripts trying load, otherwise wouldn't such problem. answers work wicket 6.x should work version, think. javascriptresourcereference uses class "relativeclass" scope , encodes in url. you need use contextrelativeresourcereference(jsref)

unity3d - Changing color of of gameObject in Unity -

okay have code. void start () { gameobject.getcomponent<renderer> ().material.color = color.green; } i expected gameobject change color green. imported black , in inspector has turned green in actual application not appear green. cant use gameobject.renderer.material.color = color.green since unity tell me outdated , have use new version. going simple missing? in advance. update: when run code tab pops in inspector 'sprites-default (instance)' , if change selection box unlit > color works. there anyway of making stick? the color changes cant see result because shader in material needs light , don't have lights see black can add light source or change materials shader unlight.

git - In which order to rebase several differently old branches onto master? -

i searched through git docu , tower tutorial rebasing, didn't find suitable advice. age of branches maybe not matter, if there no conflicts? if does, is there general recommendation or rule of thumb, branch rebase first or last? scenario: writing thesis, , having worked on different chapters/files in parallel, each different branch. on master branch, configurations pandoc or latex package settings changed, changes need integrated branch eventually. if in doubt, i'll merge, i'm curious rebase advice. thanks! there no rule of thumb. because know changes have in each branch. if touched same lines in different branches, have conflicts. no matter order decide, will. choose order has logic/common sense purpose. recommendation, when rebase, not lose old commits. happens new commits same changes created. if before rebasing create temporal branch. have kind of "backup" in case of goes wrong. git checkout branchtorebase git branch tmp git rebase mas

javascript - Angular Delayed Compilation Skipping ng-bind -

background you can invoke $compile after angular application has been bootstrapped using angular.injector method. angular.injector(['ng', 'late']).invoke(function($rootscope, $compile) { $compile(myelement)($rootscope) } this works fine directives have created on late module, not invoke of ng-bind . example i have angular app initialized on element separate ones need compile. <div ng-app="test"> </div> <div id="uncompiled"> {{ $id }} <div ng-controller="latecontroller cont"> {{ $id }} {{ "5" }} {{ cont.clicked }} <div late-directive="5"></div> </div> </div> then, once angular finished bootstrapping, create module , directives elements should compiled late. angular.element(document).ready(function() { angular.module('late', []) angular.module('late').controller('latecontroller', function($scope) { conso

android - how to create multiselection in listview? -

i using listview in android app. use checkbox in listview , want know: how can create multiselection , how can show selected items in activity button click event. following code snippet: public class home extends listactivity { private progressdialog pdialog; // url contacts json private static string url = "http://api-11hr.anovatesoft.com/v1/list"; // json node names private static final string tag_contacts = "contacts"; private static final string tag_username = "username"; private static final string tag_name = "name"; private static final string tag_email = "email"; private static final string tag_address = "address"; private static final string tag_contact_number = "contactnumber"; private static final string tag_postal_code = "postalcode"; private static final string tag_image = "image"; sessionmanager session; private double l

clojure - Clojurescript/OM persist app-state through refresh -

i followed basic tutorial on om's github basic tutorial simple form enables array of contacts stored within app state modified however, these modifications 'reset' upon page refresh. if remove 3 people current app-state , refresh, these 3 people present in app-state again. the code same tutorial, ill post anyway: (ns ^:figwheel-always om-tut.core (:require-macros [cljs.core.async.macros :refer [go]]) (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true] [cljs.core.async :refer [put! chan <!]] [clojure.data :as data] [clojure.string :as string])) (enable-console-print!) (println "edits text should show in developer console.") ;; define app data doesn't over-written on reload (defonce app-state (atom {:contacts [{:first "ben" :last "bitdiddle" :email "benb@mit.edu"} {:first "alyssa" :middle-initial &quo

Puppet console to show rpm packages it installed, including package dependencies -

i have puppet module installs package a, in turn depends on package b. when run puppet agent apply through ci tool, output puppet console log , package a(version, config file, wrote in puppet module), puppet asked yum install package b(due dependency) , installed in background, without trace. so want see yum log installing package b in puppet console log, there way that? or flag turn on more detailed logging (other verbose)? thanks!

ssl - Error configuring multiple java keystores using dks KeyStore type -

i have java/tomcat base application uses standard jdk ssl api. simplify keystore management have 2 trust keystore files merged. 1 oracle jdk ($java_home/lib/security/cacerts) , 1 specific company. in java 8 possible use multiple keystores using dks keystore type. i've configured ssl-keystore-test.dks following content: domain app1 { keystore app1-truststore keystoretype="jks" keystoreuri="file:///opt/myapp/testkeystore.jks"; keystore system-truststore keystoreuri="${java.home}/lib/security/cacerts"; }; when try list certificates keystore receive following error: # /opt/jdk1.8/jre/bin/keytool -list -keystore ssl-keystore-test.dks -storetype dks -storepass changeit keytool error: java.lang.unsupportedoperationexception: keystore must loaded using domainloadstoreparameter what proper way merge @ runtime 2 keystores if not have access change application? looks dks keystore type can use program

c++ - Open Cmake Project in Visual Studio like Qt Creator -

i used program @ qt creator in linux working on windows , visual studio (i forced it). when programming in qt creator these features great , useful me: opening several cmake project @ same time , easy switching between them. there no need run cmake command in terminal before opening project , qt creator handling matter itself. therefore, if there error in cmakelists.txt correct inside of qt creator now, in windows should run cmake command in cmd before open project in visual studio. are there extensions or add-on's visual studio have mentioned features of qt creator opening cmake project? do have other suggestion working on cmake project in visual studio? for first question, visual studio provide complete solution , can add , switch between projects inside solution. (see differences between projects , solutions in this post) but second question, don't know official extension that. once created solution cmake, can change cmakelist in vs.

java - JavaFX or controlsfx custom title bar -

curretly, i'm using javafx.scene.control.alert , org.controlsfx.control.notifications displaying messages user. have dialogs custom title bar want have same title bar on dialogs, didn't find resources style these two. have make own dialogs?

c++ - How sizeof(std::cout) is 140 whereas sizeof(std::string) is only 4? -

consider following program: #include <iostream> int main() { std::cout<<sizeof(std::string)<<'\n'; std::cout<<sizeof(std::ostream)<<'\n'; std::cout<<sizeof(std::istream)<<'\n'; std::cout<<sizeof(std::cout); } the output on compiler(g++ 4.8.1) 4 140 144 140 the output confuses me. why sizeof string class 4 bytes & ostream & istream gives 140 & 144 bytes respectively? sizeof(std::cout) is 140 bytes same sizeof(std::ostream) . so, think because cout object of type ostream that's why getting output same here. right? these sizes compiler dependent? basically comes down fact iostream has quite bit of state store, string has little. nonetheless, idea of string having size of 4 little surprising (at least me). i'd expect 12 32-bit implementation, or 24 64-bit version. in particular, string typically contain 3 things: pointer actual buffer hold data (typical

fileshare - Network File Share Access Speed -

working on update ms access project hasn't yet been migrated (else...better...that doesn't suck). has front-end/back-end design. 1 of updates move new san in our virtual server environment. know if file access/db connection speed better if back-end housed @ \\root\sub1\ @ \\root\sub1\sub2 ? make difference either way ? have heard should put high in structure can cant find supporting documentation up. it have no impact. but why not try? wouldn't take more time writing question here.

c - Not getting correct values in I2C interfacing in Atmega -

i'm new concept of i2c , i've been having problems interfacing i2c between 2 atmega32(s). i have 1 atmega32 master lcd screen connected , i2c slave lm35 has been connected , both of these atmega have been connected sda , scl lines. so, although getting data on lcd screen attached master, i'm not getting right values. temperature 28 centigrade here lcd connected master keeps repeating 65280 reason. can tell me i'm going wrong? code both master , slave devices have been posted below. the master code: int main(void) { unsigned int xx=0x00; unsigned char yy; ddra=0xff; i2c_init(); //i2c initialization lcd_init(); //lcd initialization while(1) { (int i=0;i<3;i++) //getting unsigned int data slave, { //broke data 4 parts , receiving if (i==0) //one byte @ time. { i2c_start(0x01); //i2c start along address of slave yy=i2c_read_ack();

ios - Preload next (currently invisible) cell UICollectionView -

i'm working uicollectionview , have full screen cells , when swipe next cell image takes bit load cell (since they're high res). i'm using phcachingimagemanager cache image before hand , it's cached before load cell, loading image imageview takes noticeable spark of time. wondering if there's way preload invisible next cell before gets cellforitematindexpath? any thoughts? it apparently takes time load image has been cached phcachingimagemanager cause of delay. created test function saved next image (and add previous 1 too) in property while setting current cell , flicker no more. i'll post working example when i've cleaned up... update: created _images nsmutabledictionary store loaded images , populate using function - (void)startcachingsurroundingimages:(nsinteger)index { cgsize targetsize = phimagemanagermaximumsize; phimagerequestoptions *options = [[phimagerequestoptions alloc] init]; [options setnetworkaccessallowed:yes]; [options s

c++11 - A valid solution to write objects containing strings into files? -

please can explain meaning of 2nd line of following code? book *b; b=(book *)new char[sizeof(book)]; f1.read((char*)b,sizeof(book)); this 1 of suggestions found writing object of class book (which contains std::strings ) file. ps: works !! the code included not "write objects." reads array of bytes f1 . that code not correct c++ either. can never byte copies of c++ object contains other objects, because might contain pointers or virtual function tables. copying them file worse because pointers point memory doesn't exist anymore. , fyi, std::string has pointer.

foreign keys - Remove one to many relationship with Laravel 5 -

i have 1 many relationship in task controller public function todo() { return $this->belongsto('app\todo'); } in todo controller public function tasks() { return $this->hasmany('app\task'); } adding relationship following code $todo = new todo $todo->save(); $task = new task $todo->tasks()->save($task); $task->save(); but want delete later not object relationship any ideas assuming normal schema, you'll have todo_id column on tasks table. unset record want detach. $task->todo_id = null; $task->save();

c# 4.0 - how to create secret key automatically after 5 minute in C# windows application -

i create 1 function in class file: public string createprivacykey(string s3) { prky = convert.tostring(s3); return prky; } and function call in windows form on button click event: private void button1_click(object sender, eventargs e) { string cleartext = textbox2.text.trim(); string ciphertext=class1.encrypt(cleartext,true); // txtdecryptedtext.visible = false; //label3.visible = false; textbox2.text = ciphertext; label3.visible = true; label5.visible = true; label4.visible = true; random val = new random(); int randomnumber1 = val.next(1001, 50000); ra = convert.tostring(randomnumber1); str = cs.createprivacykey(ra); label5.text = str.tostring(); } but want key regenerate automatically after 5 minute how generate key add timer form using designer: toolbox - components - timer drag time form it appear on bottom of designer right click on , select properties timer interval: number of millisecon

r - starting tmux from within vim chooses wrong terminal-emulator -

i using vim-r-plugin editing r-files in vim , gvim. starting gvim, opening r-file, , invoking \rf fire terminal emulator, tmux-session in terminal emulator, , new r-session in tmux-session. possible choices terminal emulator on system are: % sudo update-alternatives --config x-terminal-emulator es gibt 5 auswahlmöglichkeiten für die alternative x-terminal-emulator (welche /usr/bin/x-terminal-emulator bereitstellen). auswahl pfad priorität status ------------------------------------------------------------ 0 /usr/bin/lxterminal 40 automatischer modus 1 /usr/bin/koi8rxterm 20 manueller modus 2 /usr/bin/lxterm 30 manueller modus 3 /usr/bin/lxterminal 40 manueller modus * 4 /usr/bin/uxterm 20 manueller modus 5 /usr/bin/xterm 20 manueller modus drücken sie die eingabetaste, um die aktuelle wahl[*] beizubehalten, oder

java - Unmarshalling xml where the only difference is the schema -

i have unmarshall xml java classes. xml schemas have been versioned (currently on version 3). receiving 2 different events share common elements, common elements of different version. kicker is, versions not matter me. have events: <event1 xmlns:com="http://www.foo.com/common"> <com:name> <com:first>phil<com:/first> </com:name> </event1> <event2 xmlns:com2="http://www.foo.com/commonv2"> <com2:name> <com:first>phil<com:/first>roger </com2:name> </event2> since, in case wrote code event 2 first, code looks like: @xmlrootelement(name = "name", namespace = "http://www.foo.com/commonv2") public class name { private string firstname; @xmlelement(name = "first", namespace = "http://www.foo.com/commonv2") public void setfirstname(string firstname) { this.firstname = firstname; } } is t

c# - Lazy<T> .Subsequent threads to initialize if one thread fails -

i using lazy<t> lazythreadsafetymode executionandpublication , using initialization method. what achieve if initialization fails on 1 thread ,only next thread should try , initialize again. dont want threads race initialization (as in publication mode) or exception cached , thrown again threads (as in executionandpublication mode). is there way achieve this? as explained here as noted in previous section, lazy objects created specifying lazythreadsafetymode.publicationonly treat exceptions differently. publicationonly, multiple threads can compete initialize lazy instance. in case, exceptions not cached, , attempts access value property can continue until initialization successful.

How to group headers of PrimeFaces dataTable with dynamic columns -

i using modified dynamic columns primefaces showcase: dynamic columns . task add column header grouping here primefaces showcase: group . trying start incrementaly, small code doesn't work (no header shown): <p:datatable id="resulttable" var="result" value="#{mybean.searchresults}"> <p:columngroup type="header"> <p:row> <ui:repeat value="#{mybean.columns}" var="column" > <p:column headertext="#{column.header}" /> </ui:repeat> </p:row> </p:columngroup> <p:columns value="#{mybean.columns}" var="column" columnindexvar="colindex"> <h:outputtext value="#{result[column.property]}"/> </p:columns> </p:datatable> primefaces version 3.4.1 grouping dynamic columns @ least supported in newer pf version. columns under

c# - Checking if a string begins with a given string -

i new programming. need determine if given string begins something. example check if string begins "hi" return true, return false if it's "high". starthi("hi there") -> true; starthi("hi") -> true; starthi("high five") -> false. i've tried .substring , .startswith, can't figure out how make them return false "high five". i've tried this: public static bool starthi(string str) { bool firsthi; if(string.isnullorempty(str)) { console.writeline("the string empty!"); } else if(str.substring(0,2) == "hi") { firsthi = true; console.writeline("the string starts \"hi\""); } else { firsthi = false; console.writeline("the string doesn't start \"hi\""); } console.readline(); return firsthi; } .startswith, changed "else if": else if(str.star

java - Variable might have not been initialized? -

here java code (a terrible brute force algorithm know , that's requirement). think have initialized j variable in loop before references, when run compiler alerts. import java.util.arrays; public class brute { public static void main(string[] args) { string filename = "./collinear/input" + args[0] + ".txt"; in f = new in(filename); int n = f.readint(); point[] points = new point[n]; int x, y; stddraw.setscale(-10000, 50000); for(int = 0; < n; i++) { x = f.readint(); y = f.readint(); points[i] = new point(x, y); points[i].draw(); } arrays.sort(points); int i, j, k, l; for(i = 0; < n; i++) for(j = 0; j < n; j++) if(points[j] == points[i]) continue; for(k = 0; k < n; k++) if((points[k] == points[i]) || (points[k] == points[j])) continue;

javascript - Need to pass $scope with variables to another page in angular? -

i have routes: $routeprovider .when('/', { templateurl: 'views/main.html', controller: 'mainctrl', controlleras: 'main' }) .when('/next', { templateurl: 'views/next.html', controller: 'mainctrl', controlleras: 'main' }) .otherwise({ redirectto: '/' }); when i'm in main page. clicking next button , see 'views/next.html'. i'm not have $scope. how can scope? new route renders new template , bind new scope template. can't use same scope both routes. however, there @ least 2 workarounds. 1). $rootscope . $rootscope available in views can store data in , able access in template. 2). service . use shared service in both controllers. optimal solution cases.

android - Unable to push GCM notification using node-gcm -

i need push gcm node, using node-gcm, getting enotfound error var gcm = require('node-gcm'); var gcmmessage = new gcm.message({ collapsekey: 'notify', delaywhileidle: false, timetolive: 3600, data: { title: "hai", message: "message", } }); var gcmids = ['<myid>']; var sender = new gcm.sender('<mysender id>',{'proxy':'<proxyip>:8080'}); sender.send(gcmmessage, gcmids, 4, function(err, ret){ console.log('>>> sendgcm: ', err, ret); }); i getting error sendgcm: { [error: tunneling socket not established, cause=getaddr info enotfound] code: 'econnreset' } null

electronics - Relationship between rated voltage and rated power on lamp holder -

i bought string of lights america (110v, 25w per socket, 50 sockets (1250w total) use in south africa (power supply 220/230v 50hz). i thought use converter , 25w incandescent bulbs. but wonder if need converter? resistor actual bulb, buy here , therefore rated 25w @ 220v. surely fine? wondering if lamp holders will, don't know, melt maybe? you cannot plug directly wall socket - sure, if connect 2 bulbs in series can it. don't know how light string looks - meaby post photo or link, bought them? we'll find out. back power relationship - if rated 25w @ 110v - current around 200ma per "socket". when connect them 220v source, current twice big - might melt/burn lights.

vba - Replace application.vlookup with vlookup(R1C1..) -

i'm using application.worksheetfunction vlookup follows: for = 4 lastrow cells(i, 35) = application.worksheetfunction.iferror(application.vlookup(cells(i, 12), sheets("risk explorer greeks").range("a1:c50000"), 3, 0), cells(i, 15)) next as takes long time i've tried replace using following code: range("ai:ai" & lastrow).formular1c1 = "=iferror(vlookup(rc[-21],'risk explorer greeks'!r2c1:r50000c3, 3, false),"range("o4:o" & lastrow)" however it's giving me error, believe because of last piece of code comes in play when error occurs. in first bit of code, if vlookup failed in cell 50, iferror lookup value in row 15 column 50 , give back. i'm trying achieve second bit of code i'm using, doesnt seem work. can me out pls? i've been playing around while can't seem resolve! you're missing start row range object, , want value in column 15 of current row in formula so

sql server - SQL join Query in SQL management studio -

select dbo.items.maxstocklevel ,dbo.items.minstocklevel ,dbo.itemsdefination.name dbo.items inner join dbo.itemsdefination on dbo.items.businessunitid = dbo.itemsdefination.businessunitid , dbo.items.itemid = dbo.itemsdefination.itemid i have single column in 1 of database tables - dbo.itemdefination, column name dbo.itemdefination.name. column contains 3 values need extract separately each other - product name, category, , subcategory. 001-00-0000 id represents category, 001-01-0000 id represents subcategory , 001-01-0001 id represents product name possible ? it might you, if delimited comma. declare @temp table(name varchar(100)) insert @temp select 'abc,ert,err' union select 'abc1,ert1,err1' union select 'abc2,ert2,err2' union select 'abc3,ert3,err3' union select 'abc4,ert4,err4' select parsename(replace(name,',','.'),1) produst, parsename(replace(name,',','.'),2) c

c++ - How to add milliseconds to the time duration since epoch? -

using std::chrono library, have variable type unsigned long , representing number of milliseconds 1 jan 1970 now, , want add 100 milliseconds it. unsigned long = std::chrono::system_clock::now().time_since_epoch().count(); unsigned long t100ms = std::chrono::milliseconds(100).count(); unsigned long time = + t100ms; when printing t100ms , " 1000 ". if print value of std::chrono::system_clock::now every second , see incrementing number not increased 1000 @ each iteration (as 1 second equal 1000 milliseconds, should case). question does std::chrono::system_clock::now().time_since_epoch() not return amount of time has passed since 1 jan 1970 represented in milliseconds? std::chrono::system_clock::now().time_since_epoch() elapsed time since epoch, expressed in whatever units system clock chooses use; these attoseconds, or years, or in between . clearly, adding number of milliseconds number of nanoseconds (for example) nonsensical. if want perform ar

SQL Server :Remove duplicate records but be able to choose which record to keep by specific column -

i have problem , can't find right solution. hope can me. i have table looks this: id date description location 1 2012-12-01 low 1 2012-12-01 low 1 2012-12-01 low b 2 2012-12-01 high 3 2012-12-01 low c the result should this id date description location 1 2012-12-01 low b 2 2012-12-01 high 3 2012-12-01 low c i hope me. a general method prioritize rows use row_number() case statement. in case, seem be: select t.* (select t.*, row_number() on (partition id, description order location desc ) seqnum table t ) t seqnum = 1;

Getting contacts with google APIs C# -

i wonder current best way, contacts google accounts. trying many examples, either not working or libraries using not documented. the success had sample: https://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/oauth2_sample/oauth2demo.cs but have copy urls every time want test manually. how can change sample automatically open web browser , access token or there better way it?

security - Pentest pure JavaScript (qooxdoo) Website -

i'm wondering how pentest website made in javascript, example using qooxdoo framework. websites not contain requests server respond html content. 1 javascript file gets transmitted when loading page (which empty html page link javascript file) , page beeing set loaded js file, without line of html written developer. typically, there spidering/crawling in web app scanners (like nexpose), check website links , forms , crawl link find directs same domain , test parameter found on these links. assume scanners not have effect on pure js page. then there's other possibility: proxy server (like burp suite) captures traffic beeing sent server , able check found parameters on requests. work test api-server located behind website (for example find sql injections). but: there way test client, example xss (self or stored)? or more in general: types of attacks typically need check in such pure js web application? tools that?

javascript - Mocha JS: How to reference members from asynch before function in describe/it test functions -

i'm trying dynamically load settings asynchronously config files before running test suite. test suite needs take config object test, , create server connection beforeeach test - close server connection aftereach test. have following code outline, test suite (nested describe ) called before setup ( before ) function has finished; means testconfigs array empty. i'm trying achievable, or have fundamentally change test? describe('test server configs', function () { var testconfigs = []; before('get server configurations', function (done) { var conf = path.resolve('conf'); fs.readdir(conf, function (err, files) { files.foreach(function (file) { var config = require(path.join(conf, file)); testconfigs.push(config); }); } console.dir(testconfigs); //prints non-empty array done(err); }); }); describe

node.js - Cannot pipe after data has been emitted from the response nodejs -

i've been experiencing problem require library of node js. when try pipe file , stream on response, error: you cannot pipe after data has been emitted response . because calculations before piping data. example: var request = require('request') var fs = require('fs') var through2 = require('through2') options = { url: 'url-to-fetch-a-file' }; var req = request(options) req.on('response',function(res){ //some computations remove files potentially //these computations take quite somme time. //function creates path recursively createpath(path,function(){ var file = fs.createwritestream(path+fname) var stream = through2.obj(function (chunk, enc, callback) { this.push(chunk) callback() }) req.pipe(file) req.pipe(stream) }) }) if pipe stream without calculations, it's fine. how can pipe both file , stream using request module in nodejs? i fo

ios - _BSMachError while running Stanford's CS193p Smashtag app -

i downloaded smasthag demo app course's site . project builds fine (after small changes in twitter, twitterrequest etc. classes, because use latest xcode 7b4) , works fine on simulator (i had add nsapptransportsecurity key info.plist ), not on device - doesn't fetch tweets . tested on both iphone 6 ios 9 public beta , ipad 2 ios 8.4. moreover, when app running in simulator , change hashtag search, whole tableview reloads new tweets, in console this: 2015-07-23 03:24:15.560 smashtag[25991:4344251] _bsmacherror: (os/kern) invalid capability (20) 2015-07-23 03:24:15.560 smashtag[25991:4344251] _bsmacherror: (os/kern) invalid name (15) app still runs fine, error bugs me. couldn't fine _bsmacherror in google (just 1 lonely indonesian tweet). can't why app doesn't fetch tweets on device. to fix issue should set locale en_us. change private extension astwitterdate in tweet.swift following fix issue on non en_us devices. ... private extension string {

algorithm - Print a two dimensional array in an outward spiral -

i asked question in interview: given (n x m)array, say: 1 2 3 4 5 6 7 8 9 print elements if traversed spirally centre. in above case, answer 5 4 7 8 9 6 3 2 1 being familiar printing array in inward spiral, suggested stacking elements , popping them later, told otherwise. note : n not equal m given nxn matrix (being n odd number), , starting @ center position [n/2, n/2], general path generate spiral is: move left 1 position move down 1 position move right 1 2 positions move 1 2 positions move left 1 3 positions move down 1 3 positions move right 1 4 positions move 1 4 positions ... there pattern can follow. edit after edition of op's question if matrix nxm n != m or n or m even, first have clarify in question behavior expect when reach 1 of edges of matrix: stop? go on ignoring positions outside matrix?

windows mobile - MFC application / AfxOleInit / RAPI failure with RPC server is unavailable -

to implement copy , paste functionnality in mfc application, invoke afxoleinit() method. we use rapi communicate windows mobile devices. when afxoleinit not used, have no problems. but afxoleinit executed, reproduce following sequence: the mobile device in cradle , correctly connected via windows mobile device center (wmdc) pc, cerapiinitex , cerapiuninit complete successfully we remove mobile cradle deconnects wmdc we reput mobile in cradle and, second time, cerapiinitex , cerapiuninit complete successfully we remove mobile cradle deconnects wmdc at moment, message appears in "output" tab of visual studio: "the rpc server unavailable" we reput mobile in cradle , time cerapiinitex fails return value "the rpc server unavailable" we have tried put code contains calls rapi dll functions: directly in mfc application, in dll, in activex we reproduce error in cases. note that, if code put in process launched via createprocess mfc a

javascript - Openlayers 3 get segment and polygon points -

i working on drawing points/segments/polygons on map , uses openlayers 3. first part have done , draws points/images , makes segments/polygons etc. trying retrieve added elements points(coordinates) , in order build them other sessions. current progress getting coordinate point/image , can't coordinates segment/polygon . ideas / ?? <!doctype html> <html> <head> <title>draw , modify features example</title> <script src="jquery-1.11.2.min.js"></script> <link rel="stylesheet" href="bootstrap.min.css"> <script src="bootstrap.min.js"></script> <link rel="stylesheet" href="ol.css" type="text/css"> <script src="ol.js"></script> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12">

installshield - Windows Installer runs custom action code not in the right sequence and fails -

i have weird situation custom action code not run synchronically. in log can see "winroot dir" log line should appear after "commonfiles dir" line. appears @ end. this code: [customaction] public static actionresult ccca_logproductname(session session) { productname = session[installshieldconstants.productname]; customactiondata customactiondata = new customactiondata(); // log properties cculog.logmessagetofile(session, "ccca_logproductname", "installdir : " + session[installshieldconstants.installdir]); cculog.logmessagetofile(session, "ccca_logproductname", "product version : " + session[installshieldconstants.productversion]); cculog.logmessagetofile(session, "ccca_logproductname", "source dir : " + session[installshieldconstants.sourcedir]);

java - Change Launcer Icon of the Application -

can tell me how change default launcher icon specific activity , again change others activity before. thanks activities don't have icons app does.you can change icon of app manifest file. first have add icon drawable folder under res , manifest give name of icon: android:icon="@drawable/new_icon" , said on comments can't change after compilation.

knockout.js - Error when using KnockoutObservableArray in TypeScript -

i have following code: class indexviewmodel { projects: knockoutobservablearray<project>; constructor() { this.projects = ko.observablearray<project>([]); } filteredlist: knockoutcomputed<project[]> = ko.computed(() => { var elements = ko.utils.arrayfilter(this.projects(), (item: project) => { //do }); //return }) } but when load page, javascript error, says, typeerror: _this.projects not function index-viewmodel_test.js the rendered javascript part is, this.filteredlist = ko.computed(function () { var elements = ko.utils.arrayfilter(_this.projects(), function (item) { //return }); //return }) what missing here? the problem projects member not yet defined when filteredlist computed. moving computation in constructor of class solved issue. code: constructor() { this.projects = ko.observablearray&l

App engine subdomain redirects on static files (HTTP 301) -

i have domain (let's say) example.com , want serve content (mainly static files - client side app) naked domain . want accept subdomains , not end in error because of dns or 404. common users put www in front of domain (for whatever reason). i did set custom domains in appengine console, naked , * (wildcard). shows dns records need have, set them too... same, a/aaaa records pointing appengine ips , * cname appengine alias (googlehosted). i have read how behaves default on https://cloud.google.com/appengine/docs/domain?csw=1 , change bit. page accessible domains example.com, www.example.com, blog.example.com etc. what redirect request going else naked domain naked domain without adding script handler. with apache , modrewrite solution easy, has rewritecond %{http_host} , rewriterule ^(.*)$ http://example.com/$1 [r=301,l] ... possible app.yaml ? couldn't find @ https://cloud.google.com/appengine/docs/python/config/appconfig . i don't want redirect in javascrip

android - Navigation view with fragment. Toolbar -

Image
so, have activity navigation view. click on item change fragment in activity. fragment have same toolbar. 1 have toolbar , tablayout it. know better declare toolbar once on activity <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/toolbar" /> <framelayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/toolbar" /> </relativelayout> or declare in each fragment. the disadvantage of first method default toolbar shadow. when add tabs in fragment, shadow looks when tried 2 solution. toolbar icon instead drawer animated logo. thanks. i had exact same problem. how solved it: move toolbars fragments suggested (so won't have shadow separating two). allows way more flexible way

ios - Do xc:provisioning profile for iTunes connect to upload build? -

i have knowledge app store build submission , app available on itunes. want update build. have prepared iphone build , try submit itunes connect via application loader. got error. should prepare build using xc: provisioning profile? please suggest me. in advance.

android - org.openqa.selenium.WebDriverException: Not yet implemented -

dr.switchto().frame(dr.findelement(by.xpath("//android.widget.textview[@text='baby corn pepper fry']"))); dr.findelement(by.id("com.msf.smartd.merchant:id/menu_item_switch")).click(); i tried switch focus menu item "baby corn pepper fry". , used above code. getting error webdriverexception. this might due appium version, need upgrade appium.

ios - Sliding a view controller from bottom with a Gesture -

Image
i have question (objective-c related). i want create sliding bottom viewcontroller on top of root map view controller click on annotation. 1) after click on annotation should slide bottom , show 10% of height; 2) after upward swipe gesture - should show 100% if user drags upwards fully; 3) on downward gesture user should able decrease visible height 10% again; 4) on mapview click bottom viewcontroller should hide. i'm including visual scheme of process implementation. any ideas very appreciated! check demo nhslidingcontroller panningviewcontroller

git - Branch exists locally, but not in the origin -

when enter folder on server, , type git branch command, see following result: *develop something_else master but when enter repository on bitbucket, see branch develop not there. there's dev branch instead. same thing in sourcetree. what's wrong? you need push remote: git push -u origin <your branch name> should it. more info here

php - Guzzle 6 request to TMDB -

i try make request movie database api. here url access guzzle http://api.themoviedb.org/3/movie/21208?api_key=my-key http://docs.themoviedb.apiary.io/#reference/movies/movieid/get if if try url normal in browser, works. in guzzle became 204 status code "no content". here guzzle code: $client = new \guzzlehttp\client(['base_uri' => 'http://api.themoviedb.org/']); $response = $client->get('/3/movie/' + $id, ['query' => ['api_key' => 'my-key']]); dd($response); something helpful use apiary debugging proxy. make request in browser private apiary address ( http://private-xxx-themoviedb.apiary-proxy.com/ ) , 1 guzzle. trace both requests you, , can compare difference see guzzle doing.

How can I disable Zip link in HTML publisher plugin in jenkins -

i using html publisher plugin jenkins. saw there link on top right corner of page downloads zip file entire report folder. there way can modify download , not there? i have same problem everey , (i guess when update installed automatically jenkins). after reading this (in particular section html publisher plugin ) found following. executed groovy script below using script console: system.setproperty("hudson.model.directorybrowsersupport.csp", "sandbox; img-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'unsafe-inline'; ") system.getproperty("hudson.model.directorybrowsersupport.csp")