Logo

Who is talking?

Archive

The quest for better code

about 4 years ago | Rocky Jaiswal: Still Learning

I am largely dissatisfied with code that I usually write. Usually I write a working version, then a cleaner working version and then finally a cleaner Object Oriented working version. Obviously this takes some time but more on that later. Lately, I found Sandi Metz's rules to be quite practical an ...

How to make your Rails::Engine gem compatible with both rails 3.2.x and rails 4.0

about 4 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

As I am improvising audit_rails (Rails::Engine gem), this weekend I planned to make it compatible with both rails 3.2.x and rails 4.0. It was not very difficult though.Here was the challenge I faced in this process:First thing I did was get rid of attr_accsessible from model of my gem and I was able to get my gem working with Rails 4 application, but  I started getting warning when used it for Rails-3 app: Can't mass-assign protected attributes errorTo fix this, I tried using protected_attributes gem, but it didn't work. Fortunately, I looked-up for devise and a trick help me find a solution for mass-assignment issue.I checked which version of Rails is in use and if it is Rails-3 then using attar_accessible in model:Loading ....I hope this trick help saving some human hours :)

How to make your Rails::Engine gem compatible with both rails 3.2.x and rails 4.0

about 4 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

As I am improvising audit_rails (Rails::Engine gem), this weekend I planned to make it compatible with both rails 3.2.x and rails 4.0. It was not very difficult though.Here was the challenge I faced in this process:First thing I did was get rid of attr_accsessible from model of my gem and I was able to get my gem working with Rails 4 application, but  I started getting warning when used it for Rails-3 app: Can't mass-assign protected attributes errorTo fix this, I tried using protected_attributes gem, but it didn't work. Fortunately, I looked-up for devise and a trick help me find a solution for mass-assignment issue.I checked which version of Rails is in use and if it is Rails-3 then using attar_accessible in model:Loading ....I hope this trick help saving some human hours :)

Nuget Error: "No more data is available"

about 4 years ago | Sumit Bajaj: Sumit Bajaj's Blogs

Unable to install Nuget Package Manager on Visual Studio 2010 SP1, Windows 7, 64 bit machine. When creating new MVC4 Project, getting Nuget Error "No more data is available".Here are the steps which will resolve the issue.1. Open Visual Studio -> Tools -> Extension Manager...2. From Online Gallery, Download Nuget Package ManagerIf you get error like "No more data is available", Download it from Nuget Website.3. Once downloaded, change the extension "vsix" to "zip"    For example:  Nuget.Tools.vsix  -> Nuget.Tools.zip4. Goto path  C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\ide\Extensions\Microsoft Corporation\NuGet Package Manager\1.6.21205.9031if it is not existing, create the folders so path could look like above path.5. Unzip the Package (see step 3) in the folder (see step 4)6. Now ...\NuGet Package Manager\1.6.21205.9031 should have all dlls and respective files7. Restart Visual Studio and now it should workEnjoy!!

The Yun Way

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

originally published on the official arduino blog This summer I had a speaker engagement at the Codemotion conference in Berlin which I really enjoyed for many reasons. For starters Jule & me participated in an inspiring wearable computing workshop where we met Zoe Romano for the first time. The next day I talked about a possible and easy way how to build the internet of things. Presenting thoughts on & actions how to build the IOT. After the talk it seemed to appear like a a good idea to Zoe that I should get a sneak peek at some new Arduino hardware. There weren’t any more details since it was still secret back then. Of course it didn’t took me much time for consideration since I really love Arduino for making our hardware prototyping so much easier. I happily agreed on checking out this new mysterious device. <!-- more --> The talk was about how to connect anything to the internet using an open source framework I initiated called the Rat Pack, so I assumed it had to do something with online connectivity or that something had to be connected to the internet. Turns out it was about both ;-). Making things talk with each other online (source: slideshare). When Zoe told me about the Arduino Yun I was immediately stoked: an Arduino Board equipped with wifi, plus being able to access a small real time linux system. How awesome is that? Exactly. I couldn’t wait to get hold of the Yun, and when it finally arrived it became quite obvious to me that I had a well thought and rounded product in my hands. Before I really knew what hit me this thing took shape on our balcony: Back then secret device, back then secret Yun. I’ll skip the amazing deeper tech details if you don’t mind (Uploading via wireless LAN, remote debugging, SSH access, Ruby on your Yun…). If you do mind please tell me, I’m glad to blog about them too ;-). I’ll just give you a rough outline of the journey I went through with the Yun so far. The first idea was to integrate it into the Rat Pack ecosystem. Adapting the Arduino client code of the rat pack was fairly easy, it simply uses Linux shell commands on the Yun instead of putting the HTTP command together in the Arduino C code. It’s just a small detail but dramatically reduces the complexity of your project. You don’t have to implement the HTTP calls yourself, you can rely on the work horse that Linux is. Being inspired by this first success with the Yun I thought maybe I could reduce complexity of the prototype of a device that we use to welcome guests at our place. I’m talking about the Bursting Bubbles Foursqaure Switch. Foursquare & Arduino powered soap bubble machine. When you check in to our balcony with foursquare, a soap bubble machine starts filling the air with bursting bubbles. The first prototype uses Arduino connected to an XBee Wifly to control the soap bubble machine and a Rat Pack server that handles the Foursqaure API. Initial approach with lots of moving parts™. Quite complex and actually and as you might have guessed the Yun helped reducing both the software and the hardware complexity drastically. Adding it to the project made it possible to cut off a lot of fat. Actually it now only consists of the Yun connected to the soap bubble machine. The Yun way. What’s true for the hardware is also true for the software. Have a look at the code base. Reduced comlpexity is achieved by processing the response of the Foursqaure API on Linino as opposed to letting the Ruby server take care of it. And although there’s much debate when it comes to JSON processing with regular expressions in general, I just used grep and a matching regexp to extract the information from Foursquare’s JSON response. The parts marked green are the only ones necessary after adding the Yun to the setup. Losing some pounds. Or rather kilobytes… For us at making things happen the Yun will also be the platform of choice for our Internet Of Things workshops. Until now we use Arduinos and XBee WiFlys since they turned out to be the most robust solution for introducing a group of people to the principles of connecting things to the internet. Current ‘IOT Basics’ workshop setup. Although this works most of the time there is still time needed to wire things up and debug the hardware the participants build. With the Yun we can reduce the time necessary for setting things up and debugging the custom setup and use it to concentrate on spreading our knowledge on the subject. Actually you only need two wires for the basic Rat Pack example when using the Yun: Future workshop setup: drastically reduced wiring effort. So on the bottom line I see the Arduino Yun as a major milestone in making the internet of things available to a broader audience and empowering fellow makers and tinkerers to spent less time debugging and more time inventing. Less complexity = more time for creativity (source: twitter). It will also make our workshops far less complex and let the participants concentrate less setting things up and focus on their creativity. I did not use all of it’s features yet, I’m more than curious to explore more of it. The feature I’ll focus on next is the possibilities of actually using the pins of your Arduino via RESTful web service. I guess I’ll keep you posted about that. Thanks Arduino for this awesome device and thanks for letting me have a look at it a little earlier. It seems like the beginning of a wonderful friendship…

International Design for Experience (DfE) awards

about 4 years ago | James Torio: Designing the experience

I am excited to be a judge for the international Design for Experience (DfE) awards. This program recognizes people and companies that have achieved success in the design of user- and customer-centered products and services. If there’s a team, product, company, agency, or service that you feel deserves recognition, please nominate them: http://awards.designforexperience.com/

Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern

about 4 years ago | Christian Lilley: UI Guy

This definitely deserves a full article. The Promise pattern can fundamentally alter our async code, making it elegant, declarative, and highly functional. But for now, here are just the slides from my recent Meetup presentation in Bangalore: Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern from Christian Lilley

Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern

about 4 years ago | Christian Lilley: UI Guy

This definitely deserves a full article. The Promise pattern can fundamentally alter our async code, making it elegant, declarative, and highly functional. But for now, here are just the slides from my recent Meetup presentation in Bangalore: Promises, Promises: Mastering Async I/O in Javascript with the Promise Pattern from Christian Lilley

Steps to migrate from other CMS to Sitecore

about 4 years ago | Sumit Bajaj: Sumit Bajaj's Blogs

Here are few easy steps to migrate the data from other CMS to Sitecore1. Get the detail of CMS from where to migrate in Sitecore2. Export the articles or items in xml format. Generally all CMS gives this option to export it in xml file format3. Read the xml tags one by one to get all related details (code given is just for reference)//Get all files under specific directorystring[] files = Directory.GetFiles(path);List<ArticleData> articleList = new List<ArticleData>();//Read each file one by oneforeach (string filePath in files){    XmlDocument xmlDoc = new XmlDocument();    xmlDoc.Load(filePath);                  ArticleData article = new ArticleData();    article.FileName = filePath.Substring(path.Length + 1, (filePath.Length - (path.Length + 1)));    XmlNodeList list = xmlDoc.SelectNodes("record/item[@name='it_article_title']");                    article.Title = list[0].InnerText;    XmlNodeList list1 = xmlDoc.SelectNodes("record/item[@name='it_publication_date']");                    article.Date = list1[0].InnerText;    XmlNodeList list2 = xmlDoc.SelectNodes("record/item[@name='it_author']");                    article.Author = list2[0].InnerText;         XmlNodeList list4 = xmlDoc.SelectNodes("record/item[@name='it_summary']");                    article.Summary = list4[0].InnerText;       XmlNodeList list6 = xmlDoc.SelectNodes("record/item[@name='it_image_file_name']");                    article.Thumbnail = list6[0].InnerText;    articleList.Add(article);}           4. Create template in Sitecore including all required fields5. Take reference of below mentioned code to create item in Sitecore and fill the values in itDatabase masterDb = Sitecore.Configuration.Factory.GetDatabase("master");//Get the Item under which you want to import all items . //Here ID of that item is passed under which all items will be imported.Item activeItem = masterDb.GetItem(new ID("1CD389F0-E0C7-4D22-A39D-0C5BD2A1251D"));                //For Editing an Item in Sitecore, Security should be disabled else you have to create user //with required permission and write logic to authenticate it                using (new Sitecore.SecurityModel.SecurityDisabler())                {                       Item newItem = activeItem.Add(article.FileName, template);                    newItem.Editing.BeginEdit();                    newItem.Fields["Title"].Value = article.Title;                    newItem.Fields["Body"].Value = article.Text;                                        DateTime dt = new DateTime();                    DateTime.TryParse(article.Date, out dt);                    newItem.Fields["Article Date"].Value = Sitecore.DateUtil.ToIsoDate(dt);                    newItem.Fields["Image"].Value = article.Image;                    newItem.Editing.EndEdit();                }6. Run the code and check, Item should be created in Sitecore~~~~~~~~~~~~~~~Happy Coding !!~~~~~~~~~~~~~~

SharpShell 2.0

about 4 years ago | Dave Kerr: dwmkerr.com

I have just released SharpShell 2.0  - you can get the release from sharpshell.codeplex.com or the new GitHub page at github.com/dwmkerr/sharpshell. This release has been primarily a bugfixing release, but there is one very useful new feature, the Server Registration Manager tool (srm.exe). This is a standalone application that can be used to install and uninstall SharpShell servers. srm install server.dll -codebase srm uninstall server.dll This tool makes it much easier to deploy SharpShell servers. You can call the tool as a Custom Action in a MSI project, either by using Visual Studio 2010's installer project type, or a WiX project. I'll be writing up an article on the CodeProject on how to use the tool soon, until then you can download the tool and try it out now!

Goodbye Backbone

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

I had to recently do a Backbone.js test and that was the end of my cooperation with Backbone.

Are great developers both left and right brain expressive?

over 4 years ago | Steve Jansen: /* steve jansen */

My wondeful wife pointed to me this outstanding visualization of left vs. right brain expression. It made me thing that a great developer is probably expressive on both sides: you clearly need the academic properties of the left brain: logic, analysis, objectivity. But the right side creativity is also going to be needed to create something worth using, something that impacts our daily lives, something with an outstanding user experience. Creative Commons visualization by VaXzine CC visualization by VaXzine What do you think? Are great devs truly ambidextrous of the mind?

Are deadlines evil? - 2

over 4 years ago | Rocky Jaiswal: Still Learning

My last post generated a lot of reactions and it seemed like I was only asking questions and not giving any solutions. So here it goes, how would I release (or propose) to release software projects / products without a deadline. My ...

Make sure unattended.xml is not encrypted!

over 4 years ago | Kristof Mattei: Kristof's blog

I was playing around with Sysprep when I hit a weird issue with VirtualBox and Encrypted folders on the host. Setup: unattended.xml on the host, encrypted (with Windows EFS). Virtual Machine, hosted in VirtualBox I mounted the folder with unattended.xml (and other files) inside the VirtualBox and started sysprep (sysprep+shutdown.cmd just executes the sysprep with […]

Stepping Off the Happiness Treadmill

over 4 years ago | Daniel Higginbotham: Flying Machine Studios

"Happiness is not something that you pursue; it is something you allow." — Chade-Meng Tan I did not expect to have a life-altering insight while tidying my kitchen some night during the winter of 2011. Yet there I was, sponge in hand and mind on idle, when out of nowhere: "No matter how much money you make, you will never feel like you have enough. Some part of you will always want more." Whatever I was doing at that moment - scrubbing a pot, wiping up crumbs, I don't remember exactly - I stopped. My stomach sank, and I felt a kind of melancholy blossom. What a sobering realization! Ultimately, I'm glad that some wayward neurons shoved those thoughts into my consciousness. The changes I've made since then have made me much more satisfied and without a doubt saved me from years of needless stress and frustration. At the time, I had been investing tremendous energy into building a web app in hopes that I'd start earning a little passive income. True, I also did it for the joy of conquering a technical challenge and to meet a need of my own. But I was largely motivated by anxiety, a ceaseless feeling that I had to find some way, any way, to make more money. You see, I grew up poor. Meal ticket poor, welfare housing poor, single Vietnamese refugee mother raising two children on a McDonald's wage poor. Wear the same outfit twice before washing it to save on soap and water poor. "Toys for tots" - I was one of those tots. In that kind of climate it's almost inevitable that you internalize a constant fear that you will not have enough money. Eventually my mother, through her own extraordinary effort and later with the help of my stepfather, was able to pull our family out of poverty and into a comfortable, lower-middle-class lifestyle. But the money worries never went away. My mother took a night job because it paid well, but even then she would often study when she wasn't working or sleeping so that she could advance herself further. The result was that she didn't get to spend much time with my brother and me, something she still regrets. One of my most heart-breaking experiences was hearing my mom reveal how lonely she was, that she never got to see me or my brother. She would come home at 3 in the morning and her only company was the hamster busily running nowhere on her hamster wheel. Thus it was that at 26 years old, firmly situated in a great job which more than met my financial needs, I too continued to busy myself with schemes to earn more money. And thus it was that some pre-conscious part of my brain, clearly wiser than the guy at the controls, shouted at me while I cleaned: "This is going to get you nowhere." After the initial shock, I understood how unwise my path was. That whatever part of me feels anxiety about money will never, never be quieted by more money. One idea that's stuck with me in my reading is that you get better at whatever you're doing. By allowing my actions to be driven by my compulsion for more money, I was not making things better. I was only reinforcing a broken behavior. I had to find another way. If I couldn't learn to be satisfied with what I had - which was enough to meet my basic needs and much more - then I was screwed. That night I resolved to put my effort into only those things I truly want to get better at: being a good friend, being a good brother, being a good partner, and being more creative. But I knew that the desire for more money would always be there, trying to siphon my time away and pour it into pointless schemes. And then I read about the difference that gratitude makes. First, in "The Pursuit of Perfect" by Tal Ben-Shahar. Then, in "The Happiness Advantage" by Shawn Achor. And yet again in "The Tools" by Phil Stutz and Barry Michels. I began my own daily gratitude practice, beginning each day by thinking of three things that I'm grateful for. I even created a little online community for sharing gratitude. This practice has been instrumental in helping me overcome my compulsion for more money. The craving has diminished as, daily, I take stock of my life and recognize the good things in it. I let myself fully experience the truth that my life is full of reasons for wonder and joy. In a way, I think of my craving as my mom internalized. Always looking out for me, always vigilant about my well being. Day by day I tell her, "It's OK. You don't have to work so hard. Things are OK. You can relax." And day by day, she does. In the mean time, I have flourished. I've done the creative work and learning that I find meaningful, taking up the violin, throwing myself into improv comedy, and learning more about programming. I've moved much closer to my family and have gotten to see them more in the past eight months than in the past eight years. And in a few weeks I will be marrying the love of my life. Life is good, and I am grateful for it.

GitHub sings the praises of a distributed workforce

over 4 years ago | Steve Jansen: /* steve jansen */

Tom Preston-Werner, co-founder of GitHub.com, highlights the competitive advantages behind a number of company virtues I admire. A few of these virtues are organic growth, outstanding user experience, and a distributed workforce. Below is an video excerpt from a fireside chat interview with Mr. Preston-Werner from July 2013, speaking to the benefits of a remote workers, particularly developers: One of the most memorable quotations from the interview is: “Companies that aren’t distributed can’t possibly say that they hire the best people.” I have the privilege of working at a great employer that also “gets it”. Most of my colleagues are remote workers across nearly every time zone. Constraining your team to a single city is a self-imposed barrier, particularly for creative work like coding that fits brilliantly with remote collaboration.

Re-looking at unit testing of JS Code: Jasmine

over 4 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

Few years back I looked at unit testing of JavaScript code and used BlueRidge Project, which died later. It was painful and I quickly lost interest in testing JavaScript code. Later I used jasmine around the same time and did some unit testing, but again lost the will to write tests for JS code.Here were the pain areas:testing DOM manipulation codeuse of numerous anonymous functionslack of will to write good and testable JS code @sumankpaul really kind of re-introduced me to Jasmine from scratch and I started learning again with the right attitude.Here are some tips from today's learning:Write testable codeMinimum or No DOM manipulation in JS code, DOM manipulation is evilTalking with the DOM, DOM manipulations and actual JS code logic are different concerns and need to have right tools like AngularJS if possible for the same.Onclick should not be attached with many functionAnonymous functions should be changed to named-functionsonClick is not bad to be added on DOM as AngularJS also does the sameSome tools:Flight library for DOM manipulationTesting ajax methods/third party calls:mock = (stub = spyon + return) + expectationsUsing Jasmine:file name has to have 'Spec' otherwise use --matchall flag--autotest to run JS tests like guardMore to learn... 

Re-looking at unit testing of JS Code: Jasmine

over 4 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

Few years back I looked at unit testing of JavaScript code and used BlueRidge Project, which died later. It was painful and I quickly lost interest in testing JavaScript code. Later I used jasmine around the same time and did some unit testing, but again lost the will to write tests for JS code.Here were the pain areas:testing DOM manipulation codeuse of numerous anonymous functionslack of will to write good and testable JS code @sumankpaul really kind of re-introduced me to Jasmine from scratch and I started learning again with the right attitude.Here are some tips from today's learning:Write testable codeMinimum or No DOM manipulation in JS code, DOM manipulation is evilTalking with the DOM, DOM manipulations and actual JS code logic are different concerns and need to have right tools like AngularJS if possible for the same.Onclick should not be attached with many functionAnonymous functions should be changed to named-functionsonClick is not bad to be added on DOM as AngularJS also does the sameSome tools:Flight library for DOM manipulationTesting ajax methods/third party calls:mock = (stub = spyon + return) + expectationsUsing Jasmine:file name has to have 'Spec' otherwise use --matchall flag--autotest to run JS tests like guardMore to learn... 

Are deadlines evil?

over 4 years ago | Rocky Jaiswal: Still Learning

This may appear to be a rant, maybe it is, or maybe it is just a state of mind. Maybe I have hit a wall as I complete close to eleven years as a programmer but one thing I fail to understand now in the software world is the culture of deadlines. Maybe I will find it hard to get a job in India afte ...

JavaScript Apps vs Progressive Enhancement

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

There has been another fight on the web lately. This is all about JavaScript applications making progressive enhancement impossible to do. That does not seam the case to me. Here is my take on the subject.

ConsoleControl and Happy Coders

over 4 years ago | Dave Kerr: dwmkerr.com

Sometimes I write up an article and some code on the CodeProject and get a good response, other times it seems an article sinks beneath the waves without any notice. Looking over some emails the other day, I noticed that my ConsoleControl article had actually received a slow and steady response of extremely positive feedback - people are using it and suggesting improvements. screenshot This is great, it's one of the things I love about the community of developers that I'm part of. So I decided to try and put a bit more back with ConsoleControl. I've moved the source code to GitHub, so that anyone can fork it and work on it easily: https://github.com/dwmkerr/consolecontrol I've bulked out the readme.md file with some more information and am working in the documentation. I've also added ConsoleControl to Nuget - you can install it for WinForms or WPF with the commands below: PM> Install-Package ConsoleControl PM> Install-Package ConsoleControl.WPF Finally, I'm blogging about it here. It's great to see people using a project like this, it's rare for me to share comments like the ones below, but I must say I was touched by: This is just about borderline genius. - Gerben Rampaart Brilliant. So easy to use and works flawlessly. - Sukar I saw similar controls - but yours is outstanding - I love it! BTW: Very nice coding (style, comments) - 5ed! - johannesnestler To finish off this post, I'd like to say thanks to everyone who's commented, suggested improvements and shared their experiences with the code, it's a great feeling when you share something and it seems that people benefit from it. If you've used the code and want to share ideas for improvements or feedback, email, comment or hit the GitHub page or CodeProject article.