Posts

node.js - Streaming an uploaded file to an HTTP request -

my goal accept uploaded file , stream wistia using the wistia upload api . need able add fields http request, , don't want file touch disk. i'm using node , express , request , , busboy . the code below has 2 console.log statements. first returns [error: not implemented] , second returns [error: form-data: not implemented] . i'm new streaming in node, i'm doing fundamentally wrong. appreciated. app.use("/upload", function(req, res, next) { var writestream = new stream.writable(); writestream.on("error", function(error) { console.log(error); }); var busboy = new busboy({headers: req.headers}); busboy.on("file", function(fieldname, file, filename, encoding, mimetype) { file.on("data", function(data) { writestream.write(data); }); file.on("end", function() { request.post({ url: "https://upload.wistia.com", ...

objective c - Changing collectionview button's image in Cocoa -

tools : xcode, objective-c, mac, cocoa purpose : creating collection view many buttons. each button opens file in folder , each of them has background picture of file (for example: jpeg file) looks see in folder. question : how make each button have different image? also, difficult beginner? p.s. : if did without collectionview option, drag button on xib , change background images, need window collapsable , scrollable, hence using collection view. i appreciate comments/help/answers. thanks! this should not difficult. collectionview holds collection of collectionviewitems. inside item can create views need. 1 of them nsimageview set @ runtime image like. suggest play around collectionview , f samples apple provides on it.

javascript - How to parse C# code then serialize it back to text file -

i found there c# antlr4 grammar. build antlr4 parser c# grammar. works. can walk parse tree , see there nodes have children. now generate c# source code parse tree. can somehow generate (out of grammar) inverse of antlr parser instead of parsing, when given parse tree generate source code result in parse tree? edit: my current attempt in coffeescript walk source tree decorating pieces of source code using original source , start , stop positions antlr puts in nodes, , walk again print source code. problem multiple nodes start @ same space in source code. deal have nasty logic put source pieces in deepest node: antlr = require 'antlr4' {csharp4parser} = require './csharp4parser' {csharp4lexer} = require './csharp4lexer' input = "namespace { class b {}; class c {} }" cstream = new antlr.inputstream(input) lexer = new csharp4lexer(cstream) tstream = new antlr.commontokenstream(lexer) parser = new csharp4parser(tstream) parser.buildparsetre...

Meteor + CodeShip + Modulus -

can recommend setup script deploy modulus after passing tests? right i'm using: nvm install 0.10.28 nvm use 0.10.28 curl -o meteor_install_script.sh https://install.meteor.com/ chmod +x meteor_install_script.sh sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g" meteor_install_script.sh ./meteor_install_script.sh export path=$path:~/.meteor/ meteor --version which i've managed copy + paste around interwebz , have no idea i'm doing. finally test pipeline is: meteor --test the output codeship logs: i20150515-13:34:16.005(0)? [velocity] mocha starting mirror @ http://localhost:44995/. i20150515-13:34:16.006(0)? [velocity] takes few minutes first time. i20150515-13:34:16.006(0)? [velocity] can see mirror logs at: tail -f /home/rof/src/bitbucket.org/atlasshrugs/garden/.meteor/local/log/mocha.log passed mocha : server initialization => should have meteor version defined as gets client-side tests, hangs ever , fails build. any suggestions...

.net - C# async await using LINQ ForEach() -

i have following code correctly uses async/await paradigm. internal static async task addreferencsedata(configurationdbcontext context) { foreach (var sinkname in requiredsinktypelist) { var sinktype = new sinktype() { name = sinkname }; context.sinktypecollection.add(sinktype); await context.savechangesasync().configureawait(false); } } what equivalent way write if, instead of using foreach(), want use linq foreach()? one, example, gives compile error. internal static async task addreferencedata(configurationdbcontext context) { requiredsinktypelist.foreach( sinkname => { var sinktype = new sinktype() { name = sinkname }; context.sinktypecollection.add(sinktype); await context.savechangesasync().configureawait(false); }); } the code got work without compile error this. internal static void addreferencedata(configurationdbcontext context) { requiredsinktypelist.forea...

sql server - Add a column to table a, if the values exist in table a and table b -

i know how check if values exist in both table, how can add column indicate find something select name, id table_a ta exists (select 1 table_b tb ta.id = tb.id) result name id 1 123 2 234 3 345 what want name id exists 1 123 y 2 234 n 3 345 n you can use exists criteria in case statement: select name, id, case when exists (select 1 table_b tb ta.id = tb.id) 'y' else 'n' end [exists] table_a ta

list - Java Comparator removing values form String object -

i trying sort list using java comparator reference https://www.soapui.org/apidocs/net/java/dev/wadl/x2009/x02/resourcedocument.resource.html import java.util.comparator; import net.java.dev.wadl.x2009.x02.resourcedocument.resource; public class resourcecomparator implements comparator<resource>{ @override public int compare(resource o1, resource o2) { return o1.getpath().compareto(o2.getpath()); } } but getting wrong values , path has below values before sorting: /customer,/customer/{id},/order/{id},/order after sorting: /customer,/customer/{id},/order,/order i not sure why "{id}" missing after sort.