Who is talking?


React, a JavaScript Library for Building User Interfaces

over 3 years ago | Eduard Moldovan: eduardmoldovan.com - tech

This is one of the news that was waiting in my reeder inbox this morning. Let's check it out a bit.

Angular.js Hacks

almost 4 years ago | Rocky Jaiswal: Still Learning

A couple of good things happened this week, I got a MacBook Pro (Retina Display) from my generous employer (which I setup promptly after the recent pain Linux distros have been giving me) and I got an underground car parking at work. At 45 degrees, walking back to my car from my office was no easy ...

Cloning, inserting and deleting PowerPoint slides using OpenXML SDK

almost 4 years ago | Jimmy Skowronski: jimmy skowronski

Recently I’ve been fighting a lot with the OpenXML SDK working on some cool data driven presentation engine. One of issues I had was how to clone slides. I did some search and found multiple blogs on how to do it but none of them really worked. Most of them shows you how to clone a simple slide and few how to deal with charts. In my case I had images, drawings, embedded Excell workbooks and charts all together on a single slide. After some time I managed to create an extension method that creates full slide clone. The key was to copy all embedded elements, including user defined tags. /// <summary>/// Clones the specified slide./// </summary>/// <param name="sourceSlide">The slide to clone.</param>/// <returns>Cloned slide.</returns>public static SlidePart Clone(this SlidePart sourceSlide){ // find the presentationPart: makes the API more fluent var presentationPart = sourceSlide.GetParentParts() .OfType<PresentationPart>() .Single(); // clone slide contents Slide currentSlide = (Slide)sourceSlide.Slide.CloneNode(true); var slidePartClone = presentationPart.AddNewPart<SlidePart>(); currentSlide.Save(slidePartClone); // copy layout part slidePartClone.AddPart(sourceSlide.SlideLayoutPart); //copy all embedded elements foreach (ChartPart part in sourceSlide.ChartParts) { ChartPart newpart = slidePartClone.AddNewPart<ChartPart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); newpart.AddNewPart<EmbeddedPackagePart>(part.EmbeddedPackagePart.ContentType, part.GetIdOfPart(part.EmbeddedPackagePart)); newpart.EmbeddedPackagePart.FeedData(part.EmbeddedPackagePart.GetStream()); } foreach (EmbeddedObjectPart part in sourceSlide.EmbeddedObjectParts) { EmbeddedObjectPart newpart = slidePartClone.AddNewPart<EmbeddedObjectPart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); } foreach (EmbeddedPackagePart part in sourceSlide.EmbeddedPackageParts) { EmbeddedPackagePart newpart = slidePartClone.AddNewPart<EmbeddedPackagePart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); } foreach (ImagePart part in sourceSlide.ImageParts) { ImagePart newpart = slidePartClone.AddNewPart<ImagePart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); } foreach (VmlDrawingPart part in sourceSlide.VmlDrawingParts) { VmlDrawingPart newpart = slidePartClone.AddNewPart<VmlDrawingPart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); } foreach (UserDefinedTagsPart part in sourceSlide.UserDefinedTagsParts) { UserDefinedTagsPart newpart = slidePartClone.AddNewPart<UserDefinedTagsPart>(part.ContentType, sourceSlide.GetIdOfPart(part)); newpart.FeedData(part.GetStream()); } return slidePartClone;} .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } In case you need, here is another extension method I use to insert the clone into the presentation. In my case I didn’t want to add it to the end of presentation but wanted to insert before slide that was used as the clone source. /// <summary>/// Inserts the before the specified slide./// </summary>/// <param name="presentationPart">The presentation.</param>/// <param name="newSlidePart">The slide to be inserted.</param>/// <param name="referenceSlidePart">The slide before which the new slide will be inserted.</param>public static void InsertBefore(this PresentationPart presentationPart, SlidePart newSlidePart, SlidePart referenceSlidePart){ SlideIdList slideIdList = presentationPart.Presentation.SlideIdList; //find the reference slide string refSlideRefId = presentationPart.GetIdOfPart(referenceSlidePart); SlideId refSlideId = slideIdList.ChildElements .Cast<SlideId>() .FirstOrDefault(x => x.RelationshipId.Value.Equals(refSlideRefId, StringComparison.OrdinalIgnoreCase)); // find the highest id uint maxSlideId = slideIdList.ChildElements .Cast<SlideId>() .Max(x => x.Id.Value); // Insert the new slide into the slide list after the previous slide. var id = maxSlideId + 1; SlideId newSlideId = new SlideId(); slideIdList.InsertBefore<SlideId>(newSlideId, refSlideId); //slideIdList.Append(newSlideId); newSlideId.Id = id; newSlideId.RelationshipId = presentationPart.GetIdOfPart(newSlidePart);} And finally another extension method to delete a slide, just in case you may need it. /// <summary>/// Deletes the slide from the presentation./// </summary>/// <param name="presentationPart">The presentation.</param>/// <param name="slideToDelete">The slide to delete.</param>public static void DeleteSlide(this PresentationPart presentationPart, SlidePart slideToDelete){ // Get the presentation from the presentation part. Presentation presentation = presentationPart.Presentation; // Get the list of slide IDs in the presentation. SlideIdList slideIdList = presentation.SlideIdList; // Get the slide ID of the specified slide string refSlideRefId = presentationPart.GetIdOfPart(slideToDelete); SlideId slideId = slideIdList.ChildElements .Cast<SlideId>() .FirstOrDefault(x => x.RelationshipId.Value.Equals(refSlideRefId, StringComparison.OrdinalIgnoreCase)); // Get the relationship ID of the slide. string slideRelId = slideId.RelationshipId; // Remove the slide from the slide list. slideIdList.RemoveChild(slideId); // Remove references to the slide from all custom shows. if (presentation.CustomShowList != null) { // Iterate through the list of custom shows. foreach (var customShow in presentation.CustomShowList.Elements<CustomShow>()) { if (customShow.SlideList != null) { // Declare a link list of slide list entries. LinkedList<SlideListEntry> slideListEntries = new LinkedList<SlideListEntry>(); foreach (SlideListEntry slideListEntry in customShow.SlideList.Elements()) { // Find the slide reference to remove from the custom show. if (slideListEntry.Id != null && slideListEntry.Id == slideRelId) { slideListEntries.AddLast(slideListEntry); } } // Remove all references to the slide from the custom show. foreach (SlideListEntry slideListEntry in slideListEntries) { customShow.SlideList.RemoveChild(slideListEntry); } } } } // Get the slide part for the specified slide. SlidePart slidePart = presentationPart.GetPartById(slideRelId) as SlidePart; // Remove the slide part. presentationPart.DeletePart(slidePart);} HTH

Node.js On Localhost, With A Custom Domain

almost 4 years ago | Eduard Moldovan: eduardmoldovan.com - tech

I had to direct my browser to a node.js application, running on a custom port on my Mac. Easy? Yes. Here's how.

JSON API Spec - Finally

almost 4 years ago | Eduard Moldovan: eduardmoldovan.com - tech

JSON API is extracted from the JSON transport implicitly defined by Ember Data's REST adapter. In general, Ember Data's goal is to eliminate the need for ad-hoc code per application to communicate with servers that communicate in a well-defined way.

Using Term Document Matrix

almost 4 years ago | Lalatendu Das: Interpretations of technorealism

Problem Statement:Let's say you have a number of documents. Each document has a number of words (we refer them as terms). The problem is to identify two documents which are most similar.Given below is one of the solution approachesUse of Term Document Matrix:Each row of a Term document matrix (let's name it as D) is a document vector, with one column for every term in the entire corpus of documents. The matrix is sparse as not all document might contain a term. The value in each cell of the matrix is the term frequency.example:docid      term1      term2     term3     term4                                term nd1            2             1            0              0                                    3d2            0             2            3              4                                    1d3            1             0            4              2                                    0..The transpose of the same Term Document Matrix (DT) will look as followsdocid      d1     d2        d3  .............. dnterm1       2      0          1 term2       1      2          0term3       0      3          4..We can create a Similarity Matrix (S) by multiplying D with DT { e.g. S = D * DT}The structure of Similarity matrix will be as followsdocid   d1       d2        d3 ............. dnd1       x11     x12      x13             x1nd2       x21     x22      x23             x2nd3       x31     x32      x33             x3n..dn        xn1    xn2      xn3               xnnwhere Xmn = SUM Product of all term frequencies of docids dm and dnIntuitively higher the value of Xmn, the more similar are the documents with doc ids dm and dn.Coming back to our original problem, find which to documents are most similar. Simply look into the Similarity matrix and find our the row, col of the highest value in the matrix. 

Building a web app with node js

almost 4 years ago | Aishwarya Singhal: Aishwarya Singhal

NodeJS is an event driven javascript framework that makes writing asynchronous code a piece of cake! For small apps and a limited user base, this is almost magical – the code can be churned out fast, it is clean and … Continue reading →

Building a web app with node js

almost 4 years ago | Aishwarya Singhal: Aishwarya Singhal

NodeJS is an event driven javascript framework that makes writing asynchronous code a piece of cake! For small apps and a limited user base, this is almost magical - the code can be churned out fast, it is clean and it is perfectly unit testable. The purpose of this blog is not to sell node js though, we'll instead look at how an application could be built easily. The applications I work on are primarily client-server, like web apps, or mobile apps with a backend. So here's what my toolkit with node js looks like: Express JS: Sinatra like web framework that gives basic structure to the web app Sequelize JS: ORM framework Require JS: for modularization Node DB Migrate module: just like rails db migrations Mocha JS: For unit tests Chai JS: For test assertions Crypto: For encryptions Angular JS: For the front end MySQL: database Lets keep the front end out of scope for this article and only focus on getting an app that can serve JSON over REST. Setting up the environment Install nodejs Next, we need expressjs Run the following npm install -g express # create the app now. we'll call it 'myapp' express myapp cd myapp node app.js You should now see something like this "Express server listening on port 3000" Yay! You now have a basic Express JS app running! Configuring the app The ExpressJS guide is a pretty good resource for getting started, so I would recommend that you read through it. Next, add the following in package.json under dependencies: "mysql": "*", "supervisor": "*", "db-migrate": "*", "sequelize": "*", "requireindex": "*", "mocha": "*", "crypto": "*", "chai": "*" Save package.json and run "npm install" Supervisor module is a great module for development environments and it auto reloads the app on change, so you dont have to restart your node server every time. To run the app using supervisor, just use "supervisor app.js" Requireindex is a nice module that helps get all objects from  a directory into a single object, without adding a "require" for each file Add the error handler in app.js (as described in expressjs guide) app.use(function(err, req, res, next){ console.error(err.stack); res.send(500, 'Something broke!'); }); Run the app again and access using http://localhost:3000. Adding database support Install mysql We already have the node module included in package.json (mysql), so the app is now ready to start talking to the database We'll use node db migrate module to set up the database. Create a file database.json under myapp. The contents should look as follows: { "dev": { "driver": "mysql", "user": "root", "database": "myapp" }, "test": { "driver": "mysql", "user": "root", "database": "myapp_test" }, "production": { "driver": "mysql", "user": "root", "database": "myapp" } } Create a db.js in the myapp directory with the following contents: var express = require('express'), Sequelize = require("sequelize"); var app = express(); var env = app.get('env') == 'development' ? 'dev' : app.get('env'); // db config var fs = require('fs'); var dbConfigFile = __dirname + '/database.json'; var data = fs.readFileSync(dbConfigFile, 'utf8'); var dbConfig = JSON.parse(data)[env]; var password = dbConfig.password ? dbConfig.password : null; var sequelize = new Sequelize(dbConfig.database, dbConfig.user, password, { logging: true }); exports.sequelize = sequelize The above uses the same file (database.json) as used by db-migrate module so all your configuration stays at one place. It also initializes our ORM framework viz. sequelizejs. To use this, just add require('db.js') as required and get sequelize. Configure unit tests Modify your package.json and add the following under "scripts": "pretest": "db-migrate up -m ./migrations --config ./database.json -e test", "test": "NODE_ENV=test mocha test test/*/**" The above will ensure that your db migrations are run automatically when you run the tests, and also that you don't have to remember longish commands for recursively running tests in sub directories. Add a basic test case under "test" directory. var expect = require('chai').expect, should = require('chai').should(); var db = require("../db.js").sequelize; var DataTypes = require("sequelize"); var assert = require("assert") describe('DB', function(){ it('should check db connection', function(done){ db .query("select count(1) from users") .success(function(o){ expect(o.length).to.not.equal(0); done(); }).error(function(error) { done(); }); }) }) Prepare for test data - create a file _setup.js under tests and put the following: var db = require('../db.js').sequelize; var testData = [ "INSERT INTO users (name) VALUES ('test user');", "INSERT INTO users (name) VALUES ('test user 2');" ]; // now run the test data testData.forEach(function(sql){ db.query(sql).success(function(){ }).error(function(e){ console.log(e); }); }); console.log(">>>> starting tests..."); The SQLs above are obviously just indicative and you'll have to add your SQLs as needed. Run npm test to execute the tests! Build a model Start creating your db migrations (like db-migrate create users) ! They will be stored under myapp/migrations directory. Run the following: db-migrate create users Now open the migration that has been created under migrations directory and add table definition, e.g. var dbm = require('db-migrate'); var type = dbm.dataType; exports.up = function(db, callback) { db.createTable('users', { id: { type: 'int', primaryKey: true, autoIncrement: true }, name: 'string' }, callback); }; exports.down = function(db, callback) { db.dropTable('users', callback); }; Run the migrations to create users table. Now create a directory called "models" under myapp. This is where we'll put our models. Under models, create users.js with the following contents (or similar) var db = require("../db.js").sequelize; var crypto = require('crypto'); var DataTypes = require("sequelize"); var User = function(name, username, password) { this.name = name, this.user_name = username, this.password = password }; var users_table = db.define('users', { name: DataTypes.STRING, user_name: DataTypes.STRING, password: DataTypes.STRING }, { timestamps: false, underscored: true }); User.prototype.save=function(onSuccess, onError) { var shasum = crypto.createHash('sha1'); shasum.update(this.password); this.password = shasum.digest('hex'); users_table.build(this).save().success(onSuccess).error(onError); }; User.find=function(username, password, onSuccess, onError) { users_table.find({ where: {user_name: username, password: password}, attributes: ['id', 'name', 'user_name'] }).success(onSuccess).error(onError); }; User.lookup=function(name, onSuccess, onError) { users_table.findAll( { where : [ "name like ?", '%' + name + '%' ] } ).success(onSuccess).error(onError); }; exports.get=User; exports.table=users_table; As a reminder, we use sequelizejs for ORM and crypto for encryptions above. To use this model, all we now need is to create an object of User and call user.save(), or directly call User.find or User.lookup as needed. Notice that these take callbacks for success and error, thats because node js is a totally event driven framework and everything is synchronous. These methods don't return anything :smile: Lets add a route, create user.js under routes directory. var User = require('../models/users').get; exports.authenticate = function(req, res) { User.find(req.body.username, req.body.password, function(o) { if (o) { res.json(o.selectedValues); } else { res.send(401, "Auth failed"); } }, function(error) { console.log(error); res.send("Auth failed"); }); }; And in app.js, add the route app.post('/authenticate', user.authenticate); All done! You now have an app that can connect to the database and authenticate users! In the next blog, we'll see how we can quickly assemble a front end

How To: build the Internet Of Things

almost 4 years ago | Sven Kräuter: makingthingshappen blog.

The first serious Internet of Things project I worked on was the digital foosball table I prototyped for Sinner Schrader’s Radical Innovation Lab. An interesting detail that you might not have guessed: I only built the software. A slim little Ruby API & attached to a realtime web app and to the Arduino hardware. The hardware was built by one of my all time favorite colleagues Thomas Jacob. I admired the hardware skills he had and didn’t dare to dream of developing something similar on my own. I was only a software guy, right? First working prototype in action, check wired for details. <!-- more -->Right, but: Arduino is perfect to get into the subject of hardware hacking. Although I’ll never reach Thomas level of craftsmanship in general I was able to build hardware that connects itself to the internet pretty fast. The first prototype was just a breadboard with a switch that could light an led on the other side of the world. Or in my case: on the other side of the breadboard. The following projects I did all had two things in common: a lean development approach and a variation of the API and wireless hardware shields in various forms. These experiences lead to the Rat Pack Remote Control Workshops that we offer. Aimed at software people who want to see their Arduino projects talk to eacht other via a wireless internet connection. Rat Pack Repo Some wires attached to a few lines of code: the Rat Pack. When I was asked to talk about the Rat Pack device at Codemotion I was glad to offer a talk on the subject. I used it as an opportunity to distill all the previous versions to a handy package that acts as a basic building block for the IoT: the Rat Pack Repo that describes what’s necessary to built a little IoT project using Arduino Uno & Sparkfun’s Wifly Shield. The idea is: use this little example that enables you to make an LED light up globally by pressing a button locally to connect almost anything to the internet. Almost Anything? For example the wearable computing projects that where done at the great workshop Kobakant did in cooperation with Zoe Romano to open Codemotion. Jule weaving in some electronic life into fabrics. Jule and me participated, but my initial intention to develop my conductive thread sewing skills further was a little distracted: inspiration struck me. I realized I could adjust the Rat Pack using the Xbee Breakout Lilypad to attach the Xbee Wifly that slumbered in my toolbox. I managed to do so and the adjusted code is part of the Rat Pack Repo on github now. The fritzing sketch has still to be done - I hope to see some Open Source / Open Hardware contribution love happening there soon ;-). When inspiration strikes… (source: Arduino) The workshop was quite exciting already. When I did my talk I was even more excited by all the interest in the subject and even more by the very communicative and open crowd. Breaking the first rule of live demo over and over again. So many people getting in touch with me after the talk, during the day & during the following days isn’t really symptomatic for a german tech event. I really enjoyed the multi cultural, international and open vibe and took quite some inspiration with me. I hope I was of any help to the crowd too. If you missed the talk you can get a glimpse how it was by checking the slides: Rat Pack Remote Control - an Internet Of Things ™ primer I was glad to do some client work in Berlin the next couple of days - which I’m also quite exctied about currently but that would be a little off topic here. I used the drive & the new encounters of the weekend to connect myself a little in this pulsating city. From the amazing Knowable crew who are about to built a github for makers - which will make my life much easier - over the very inspiring lunch breaks to the visit at the Berlin Fab Lab - where I also ran into Kobakant’s Hanna - this week in Berlin was really packed with inspiration and new encounters. I’m on my way back to Hamburg right now which I miss pretty much. I will miss Berlin too I guess, looking forward to see you again soon! I’d also love to see some reports of actual IoT projects built on the Rat Pack example. I’d love to see some open source contributions aka pull requests to improve it even more. Curious where this project will lead to!

Hoodie - Very Fast Web App Development

almost 4 years ago | Eduard Moldovan: eduardmoldovan.com - tech

Build complete web apps in days, without having to worry about backends, databases or servers, all with an open-source library.

Web Colour Data

almost 4 years ago | Eduard Moldovan: eduardmoldovan.com - tech

"What is the most common colour/s or hue/s on the web? Do certain industries prefer certain colours over others? What colours are generally found together?"

The future of phones

almost 4 years ago | Akshaya Kumar Sharma: Akshaya's World

Filed under: Technology Tagged: Nokia Lumia, Windows Phone

5 reasons to use AngularJS in the corporate app world

almost 4 years ago | Sanjeev Mishra: Sanjeev Mishra's Blog

5 reasons to use AngularJS in the corporate app world.

Building HTML5 Apps with Yeoman and Backbone

almost 4 years ago | Rocky Jaiswal: Still Learning

In my last few blogs I talked a bit about Yeoman. For me, working with Yeoman has been a real pleasure, so in this blog I will talk about building a small single page HTML5 application with Yeoman and Backbone.js. The software we need for thi ...

5 reasons to use AngularJS in the corporate app world

almost 4 years ago | Oscar Villirreal: Digital Caveman

The current situation in the world of corporate apps can be described with one word, chaotic. Between legacy code that has been around for N years jumping from developer to developer with no documentation. To over complicated interfaces that are over complicating the code. To a mixture of N technologies in one single app. Lets […]

The launch hour - The story

almost 4 years ago | Priya Ranjan Singh: thisText

The last time I blogged was when I was too excited to be on a 128 kbps Internet line back in college days. Years have passed, things have changed and the blogging experience too. I have things to share. This is going to be about technology, how inclined to something still needs to be figured out.

The Internet Makes This Possible

almost 4 years ago | Eduard Moldovan: eduardmoldovan.com - tech

I many times read that the internet might be harmful. Yes, it might. But the thing is that it only might. Here's why.

The Serving Leader

almost 4 years ago | Lalatendu Das: Interpretations of technorealism

"The Serving Leader" by Ken Jennings and John Stahl-Wert was my weekend reading. The book talks about five actions that can transform teams, business and community. My key takeaways from the book areServing leaders run to great purpose by holding out in front of their team a "reason why" that is so big that it requires and motivates everybody's best effortsThey qualify to be first by putting other people firstThey raise the bar of expectation by being highly selective in choice of team leaders and by establishing high standards of performance They teach serving leader principles and practices and remove obstacle to performance. These actions multiply the serving leader's impact by educating and activating tier after tier of leadershipThey build on strength by arranging each person in the team to contribute what he or she is best at. This improves everyone's performance and solidifies teams by aligning the strengths of many peopleSome of the thoughts were counter intuitive such as "focus over strength over addressing weaknesses". Yet the argument that "it is foolish to pour all our energy into turning weaknesses to serviceable mediocrity" - makes profound sense. Overall a good read and fodder for introspection. 

D3 Waterfall chart

almost 4 years ago | Oscar Villirreal: Digital Caveman

When it comes to waterfall charts and d3 you have very few options. 1) Your are on your own, which means you are free to draw it how ever you want (which is pretty much the coolness of d3) 2) You use this repo https://github.com/sattybhens/waterfall which will give you a horizontal chart. Has a mix […]

What motivates programmers

almost 4 years ago | Rocky Jaiswal: Still Learning

The title of this blog post may sound authoritative but it is far from it. It's is just a set of observations which I have picked up from my own experiences and introspection when I felt motivated or demotivated on a project. I have been in the software development industry for more than a decade now and hav ...

Ajaxify a Form with Backbone

almost 4 years ago | Rocky Jaiswal: Still Learning

I have been working a lot with Yeoman lately and find it to be absolutely fabulous. It's make web development a real joy. With a few simple commands I can have a Backbone, Require.js and Twitter Bootstrap application ready. Also, instead to manually searching and downloading a JavaScrip ...