Solving Shrink-Ray/ Iltorb issues in Yeoman Angular-Fullstack

We had a team meeting for a project recently where the objective was to learn how to use the Yeoman Angular-Fullstack scaffolder. Unfortunately my team and I spent the entire two hours debugging the generator, particularly the shrink-ray, iltorb and node-zopfli modules. I’m not sure what the issue is with these modules, but this seems to be a pretty common problem, so I hope it’s officially fixed soon. Until then, we discovered some workarounds that might be helpful temporarily.

These fixes have not been tested rigorously to see if they break the scaffolded app. Use at your own risk.

MacOS

If you get an “ELIFECYCLE” error, this fix might work for you.

      1. Install Anaconda for Python (this step is not necessary but I find it a lot more convenient to do things this way).
      2. Run
        conda create --name snakes python=2
      3. Navigate to the folder in which you want to scaffold your app and run
        source activate snakes
      4. Now scaffold your app using
        yo angular-fullstack
      5. You should get errors showing up. Run
        rm -rf node_modules/
      6. Navigate to package.json. Remove the line that says shrink-ray.
      7. Run
        npm install
      8. Run
        npm install shrink-ray --save

And “gulp serve” should work! It did on most of the Macbooks I tested it on (around 4).

Windows

In windows we got a weird Windows SDK missing error. None of the fixes worked until we removed shrink-ray, node-zopfli and iltorb from package.json, reran npm install, and manually copied the three folders (from a working installation) into node_modules/. This is a terrible solution for many reasons (least of all that you don’t get regular updates), but it worked as a temporary fix. It’s probably fine if you just want to play around with the generator.

General

The GitHub issues page for this generator suggests using “compression” instead of “shrink-ray” for the problem I described, but I haven’t tried that method myself. Either way, I hope the issue is fixed with the generator soon!

ATMega Uploader with an LCD – Objective and Progress (Part 1)

An exciting use case for Arduino is to upload a program from an SD card to a chip using another Arduino . This would be useful for quickly updating many microcontrollers in a field, or in places where a computer is not accessible. Nick Gammon came up with a solution to this problem with his ATMega Uploader. To paraphrase from the website,

This project is intended to allow you to program your Atmega chips without having to buy a dedicated ICSP programmer. Instead, it uses a Uno (or similar) board to act as a programmer.

However, a drawback of the uploader is that it works over a serial monitor. This immediately removes the advantage of not having to carry a computer around as you update a microcontroller. I decided to try and solve this by integrating an LCD, and building a navigation interface to easily use the awesome project that Nick Gammon built over a GUI.

Now Gammon’s file uploader project includes a few different types of utilities including a board detector, a hex uploader etc. It would be convenient if there was a way to switch between these different utilities to test different things on the field. However, all the sketches don’t fit inside a single file, so there would be a need to actively switch between different sketches. I decided to try and boot different files from the SD Card for this purpose. To do this, I’m using AVR Boot.

The Objectives

  1. Create a rough interface to navigate through the ATMega File Uploader and other ATMega Utilities. Errors don’t need to be complete explanations and extensive debugging can still be done better with a computer.
  2. Use the SDFat library to move around the right files when you want to change the program being used.

Current Progress

As of writing this article, I’ve completed a rough integration of the LCD with the ATMega Hex Uploader, and begun the integration with the ATMega Board Programmer. Real-time updates can be viewed at the Github page.

 

Bringing Britain closer to the EU – A Romanian Dating Solution?

I recently came across a contest on Freelancer.com which asked for an article promoting a new Romanian Dating site in the context of the Brexit. The site was for ‘Men from the UK who wanted to meet Romanian women’. Of course, in the interest of privacy, I left the name of the website out, just calling it website.com. This was my entry for that contest, let me know what you think!

They say that love is a great unifier, blind to the petty considerations of race, religion or nationality (sometimes even blind to common sense, and sometimes just plain blind). What better way to test this adage than in today’s Britain?


No I do not speak of Prince Charles’s new romantic exploits as a knight, saving a damsel in distress in some obscure land. No, Charles is far too old for that (and still a prince, thanks to – God Bless Her – the aged Queen). What I’m talking of something less romantic, but more political – the Brexit. 


Ever since the so-called ‘Brexit’, there has been an increasing number of reports of hatred and hostility towards immigrants. These are sometimes ironical, given that many of the victims of said abuse have lived longer in the UK than the people the hurling insults at then. People are talking of a complete collapse of unity in Europe, and possibly and end to the European Union.


Well one website has the perfect answer to prevent this breakdown of British life. And the answer is not political or economic, it relies on – you guessed it – romance. Website.com pairs up British single men with suitable Romanian partners.


Just imagine Nigel Farage with a pretty Romanian lass. The image burns your head, I know, but imagine what that relationship would do for European unity. Mr.Farage can no longer hurl insults at fellow European politicians without receiving a sound lecture from the Missus at night.

 

And think of what it would do to Britain’s trade with the EU if Boris Johnson (or as I like to call him – the Orange Pancake) had a date in Romania. Heck, the stocks would shoot up the second he stepped foot off England. By setting up that one date you could upgrade Britain’s credit rating. 


And of course, this service isn’t restricted to those powerful (and married) politicians, website.com is meant for the grassroots. If even ten guys a day found a suitable Romanian partners, we would have Romania complaining about too much immigration from the UK in less than a month! 

And let’s be honest, the lads from England would enjoy far far better weather. 

The unKnocki – DIY Kickstarter Clones Part 1

The Knocki is a device that released on Kickstarter a while back and has (as of writing this article) received over half a million dollars in funding. The premise behind the Knocki is that it allows us to access different functions around the house using knocks on different surfaces. The Knocki is meant to be something that uses the context of the location to enable intuitive functions, for example knocking on your bedside table in the morning should turn off your alarm, or knocking on your kitchen counter should turn the microwave on. The idea is to reengage ourselves with technology in a more tactile way. Everything sounds good, right?

Not so much. While the idea is terrific, each Knocki costs $69 (at the Kickstarted super-early bird price) and will probably cost almost $100 at retail. The biggest issue with this is it limits someone who doesn’t have $300-$400 of spare cash to a single Knocki (atmost). But a single Knocki cannot deliver the full experience of connecting with technology around the house in a tactile manner. So my friend and I decided to create a DIY version of the Knocki that works just as well, but costs much less. The end product of our design (with miniaturization taken into account) cost approximately $70 for 3 “unKnocki’s” all costs taken into account. Adding each unKnocki only requires $8-$10 because we only add a transmitter module and use a common command center. For those of you interested in building your own, view the full instructable here.

We faced a number of challenges in the week or so that it took us to build the unKnocki. The first aspect we had to design was the detection of the knock. It seemed simple enough to detect one knock using a Piezo Buzzer and the Arduino, using the tutorial on the Arduino website itself! However detecting multiple knocks was slightly harder. Our first approach was to send all the serial data to python and then log the time difference between consecutive peaks. However due to serial connection issues (and other problems we simply didn’t understand) we ditched that idea. In the end, it was a simple “while loop” that ended up working, although it took us nearly 4 hours of work before this (obvious) fact dawned on us.

The second problem we ran into was the transmission of data. Our first idea was to use the 433 MHz radio to send the number of knocks from each transmitter directly to the Raspberry Pi. We tried this at first and were able to get the RFSniffer code from the 433Utils detecting the radio signals, albeit on the Linux terminal. No matter what we tried (which included VirtualWire, pi-switch-python, wrappers for RFSniffer, external libraries), we weren’t able to output this data to a python file for further processing. While this is something I would still love to do, we decided to move on to a simpler solution of having an Arduino connected to the Pi deliver data through the Serial port. This worked like a charm, and ticked another box off our list.

We also made a slight coding mishap in our initial code. We were using the Arduino millis() function to get the current time and store it as an integer to determine the time between knocks. However the program often stopped working after 2 to 3 minutes, because of an integer overflow issue i.e. the integer was no longer able to hold the value of the millis() function. We switched the variable over to an unsigned long which gives us approximately 50 days of runtime before any errors pop up.

The next issue was relatively minor – finding the right IFTTT channel to use for triggering events. We started off with Twitter, which had a 30 second delay between the knock and the event on the phone. We then used the Pi to send a Telegram message which was delivered almost as soon as the table was knocked. However Telegram was not compatible with IFTTT. We finally saw the solution in the form of the Maker Channel for IFTTT, which lets you make PHP requests to trigger actions. This was exactly what we needed!

And that’s it. A weeks work, summarized in four paragraphs and one instructable.

We are not saying a DIY solution is necessarily better than the Knocki. For the average person who may not be interested in electronics, the Knocki is a convenient easy way to get started. We simply offer a much cheaper solution with immense applicability due to our integration with IFTTT. All hail the unKnocki!

Mathematical Single Divs

Creating shapes from single divs using purely css is a fun way to see how much you can really do with css, and has even inspired amazing projects like this and this. My tryst with CSS has been brief and I don’t have nearly as much experience to create those kinds of divs. However, I recently read this article about using the CSS3 shape attributes to create polygons from a single div. I decided to use the magic of jQuery and CSS togethor to create mathematically accurate single divs. You can view the full project implementation here, and play around with a few functions yourself. I’ve put some photos of divs below for you to look at!

pic1

pic2

pic3

pic4

pic5

Using External Webhosting To Deploy Your Heroku App

When I had to add a custom domain to my Heroku app, it seemed like such an easy task. Atleast that’s what the tutorials promised me. They told me that it was as simple as adding the custom domain to Heroku through the command line (or through the Heroku Dashboard) and adding a CNAME record to my DNS provider. So I got to work and bought my domain at NameCheap, and sure enough once I followed all the steps herethings worked perfectly.

But I wanted to transfer the domain to my EcoWebHosting account because I got a free three year subscription there through my Udemy courses. Plus, that account gave me free email, which NameCheap wanted me to pay extra for. How hard could switching over be, right?

Wrong. I couldn’t understand for the life of me what I was doing wrong when I edited my DNS records on my EcoWebHosting domain manager. Now, I must warn you, this might purely be my incompetence speaking because the solution is breathtakingly simple. But just in case its a more common problem that I think it is, I thought I should put this guide out there.


Step 1

Go to the site from which you purchased the domain and find the setting that allows you to change your DNS provider. Under that choose custom DNS and set your nameservers to those provided by your hosting site. For EcoWebHosting the name servers are

ns1.ecowebhosting.co.uk
ns2.ecowebhosting.co.uk

Step 2

Login to your hosting service and create a new hosting package, and enter in your domain name. Once that is created, a navigate to Manage Domains and select DNS management.

Step 3

Under DNS management, look for the CNAME or AAAA record associated with www. Delete that record. Next add your own CNAME record with sub-domain www and CNAME yourappname.herokuapp.com.

Step 4

Next login to your Heroku Dashboard and under the settings tab for your app, add the custom domains

yourapp.com
www.yourapp.com

After a while, this may take a day or two (though for me it was quite fast), you should be able to access your site through the www.yourapp.com domain. Just typing yourapp.com may not take your to your site, but might show you an index placeholder page generated by your hosting company.

Step 5

If you can access your site through the www.yourapp.com domain but not simply by typing yourapp.com, follow these next set of steps. Ideally, you should add another set of CNAME Records for the subdomains “” (first value left blank) and “*“. However, for hosting sites like EcoWebHosting, this can’t be done as the mail servers are already using these ID’s. The following is a simple workaround.  

Go into your file structure (accessible from cPanel through the Manage Your Hostings link on the site). Navigate into the folder containing a file called index.html. Inside this folder create a new file called .htaccess and type the following inside it

Redirect / http://www.yourapp.com

What’s happening here is that every time your site is opened through the yourapp.com domain, it is redirected to the www.yourapp.com domain.

Conclusion

And that’s it. It is a simple process, but one that I found no documentation for. Hopefully this lets you get your app running on a custom domain easily enough!

The SAT Guessing Guide 2015

Some questions on the SAT are easy enough that you know the answer as soon as you read the question. Some questions are hard enough that you can’t choose from any of the five options. However, the most exasperating type of question is one in which you can comfortably eliminate three answer choices, but never be able to decide between the other two. Every time I faced a question like this on the SAT I wondered, what is the best possible guess I can make between those two answer choices?

My objectives were twofold:

  • to find the best possible single answer choice for each section (Reading, Writing and Math)
  • to find the most probable pair of answer choices for each section, i.e. to which two answer choices occurred the most in pairs

I used 11 actual SAT papers to do my analysis, and analysed over 1700 answer choices. At the end of the analysis, I arrived at some interesting conclusions. (You can find the entire excel sheet here).

A couple of quick notes before I share my results.

  • None of this data is to be used as a substitute for common sense. If you know an answer is wrong (or right), choose that over anything statistics might tell you. 
  • Wherever I have said that probabilities are reasonably higher, it only means that they are higher than their expected values. This does not mean that they are significantly large.

Reading 

As expected the number of A, B, C, D and E answer choices were all around 20%. The deviation from 20% was very low, with a standard deviation of only 1.8%. The most likely single correct answer was D, with 22.7% of the share. Nothing interesting so far.

Now for the paired answers, and this is where it really gets interesting. The most common pair is CD, with 5.7% of the share. But what is more interesting is the second most common option, AD (5.1% of the total). Viewed in isolation, AD is quite boring. However, when you observe that A & D independently constitute the two most probable options (for the single correct answers), it makes a considerable difference. This is because both the individual and paired probabilities of A & D are high. This means that the likelihood of getting AD (in that order) is reasonably higher than the likelihood of any other pair of options on the Reading section.

Math

To save your eyes some trouble, I’m going to tell you that the Math section is exactly like the Reading section in terms of the single correct options, except that the standard deviation is lower, at 1.3%. D is again the most common option with 21.5% of the share.

The paired answers are more revealing in Math than they are in any other section. Just like in the Reading section, AD is the most common option. However, two things further boost the probability of D & A. Firstly, the DA pair is the third most common option. Secondly, A & D are the two most common individual occurrences. Since AD, DA and A & D(individually)are all more likely, the probability of these pairs being the right answer is reasonably higher than the probability of any other pair being correct.

Writing

Option C takes has the highest probability here with  a 23.9% chance of occurrence. There is a standard deviation of 2.9% in this section, with the percentages for each option hovering near 20%. However, option A has an unusually low occurrence of only 15.8%.

The conclusions in this section are similar to those of the previous sections. BC is the 2nd most common pair (5.6%) and CB is the 3rd most common pair (5.2%). B & C are individually the two most likely options. Using arguments similar to those used for the previous two sections, it is evident that the pair BC (in any order) has a reasonably higher likelihood of being right than any other pair does.

Overall

The overall analysis is quite lackluster. All the options have a very similar individual likelihood, and the most common pairs don’t contain the most common letters (unlike the individual sections).


So there it is, my analysis of the SAT test options. Hopefully, you won’t be as confused anymore when you have to pick between two answers on the SAT!

The Antics of An Ant

youtube=http://youtu.be/xtNkNRZy2Lw

While I was trying to install a whiteboard on my desk, I used 3M’s double sided tape. Quick tip, never use 3M tape unless you know that you never want to remove it! I couldn’t get most of the tape off my table, and that’s the white thing you see on the table in the video. Luckily, that tape created an interesting experiment right on my table.

While I was working at my desk, I saw a fly that was stuck in the tape, and an ant that was trying to lift it off. If you saw the video, you know that the ant was successful. There were a few more experiments I conducted that produced some interesting results.

Can ants lift 10 times their own weight?

Most ants can lift atlas three times their own weight and there is well-documented research with precise capabilities of different ants noted. By scaling approximations, the ant in the above video weighs anywhere from 0.3 to 0.6 mg, while the fly weighs 2.5 to 3 mg. So the ant definitely lifts a weight much greater than its own body weight.

How much does it take to stop an ant from moving with this weight?

This was a very interesting question to answer. On the sticky tape, the ant seemed to find it very hard to move. It took the ant well over 10 minutes to escape the sticky tape prison. Once it got past that, there was a hair in front of it, which it wasn’t able to get over at all. Only when the hair was removed did it make any progress. As is evident from the video, the ant moved incredibly fast with the load on the table. Even when I blew on the ant from a 20cm distance, it walked with the load, albeit slower.

What does it take to detach the ant from its load?

From my experiments, a LOT. I wasn’t able to separate the two. I blew a gust of wind that was enough to throw the ant 20 cm away, but it still had its load with it. I then lifted the load up and shook it vigorously, but the ant still held on to the load. This led me to the conclusion that the bite of an ant is incredibly strong, and on looking it up, my guess was confirmed here.

How do ants find their way around?

Based on what I saw, and what you can see in the video, it seems to be completely random initially. The reason I say this is because the ant actually went far away from the sticky tape and then came back to that exact same spot after circling around the table. I think it needs time to find its way back.

Are ants social animals?

Ants are famous for their cooperation and group effort. However, I’m not sure that this works every time. The reason I say this is that when two other ants went near this ant, they simply walked around without sharing the  load. Even when I forced these two ants to walk right in front of the other ant by blocking all other paths, they still walked around the other ant. It seemed as though they knew that the ant was there but didn’t see the need to help. I have two theories about this. Maybe the ants actually didn’t know that the other ant was there, and maybe ant communication is not that simple. Otherwise, despite being aware of the presence of the other ant, they chose not to help because the fly wasn’t too “hard” to lift. The problem with this second hypothesis is that the first ant seemed to move slower and slower every five minutes, which might indicate that it could not bear the load without strain. Of course, I don’t know the actual reason behind this, but these reasons seem plausible to me. Let me know what you think!

A Case Study of The Pallikaranai Marsh

While clearing up my (not-so-clean) cupboard, I came across two spiral bound documents that contained two studies of the Pallikaranai Marsh in Chennai. These were studies my friends and I did when I was in the 8th grade about various aspects of the marsh. When I was going through the document, I realized that when we were doing this study, one of the biggest roadblocks we faced was a lack of easily available information about the marsh. I knew that I had to publish this document online, because it contains data that someone else might need at some point in time. So here it is. Let me know what you think!

Phase 1

Phase 2

The Abstract
‘The World has enough for everybody’s need, not everybody’s greed’ – these famous words of Mahatma Gandhi symbolize the project that we have undertaken. This project on the Pallikaranai Marsh is the first step in protecting a huge ecosystem. The ecologically-sensitive  Pallikaranai Marsh, one of the last remaining natural wetlands in south India has been deteriorating steadily due to ill – planned urbanization, destructive reclamation and dumping of solid waste.  This project deals  mainly with solid waste management and water problems. In this project there has been and is going to be research into the water and soil quality from the marsh and around to make inferences about the dangers of human intervention in this ecosystem. Our experimental Research also features GIS(Geographical Information System) and Grid  Mapping. Our major findings reveal that the marsh water is polluted, mercury level is seven times more than the permissible limit. The pot culture studies have proved that some plants may grow well when the water samples are rich In organic matter. The results of this study are truly significant  and can  help in the betterment of the locality and also motivate the civic body to start working towards protecting this marsh.

The Sunrise Alarm Clock

Ever woken up in the morning, looked at your alarm clock, and wished you’d woken up about 5 hours earlier? I know I have. As one of the dreamiest sleepers in the world, I have not found a single alarm clock (or a combination of them) that has ever been loud enough to wake me up permanently. Thus, this project. This project started with an article I read about how “dawn-simulating” clocks are far more effective at waking people up than just regular alarm clocks. So I thought, why not build one? And then I got started.

Its finally done. Undoubtedly one of my most gruesome and excruciating builds, this clock put all my skills to the test and forced me to learn a lot about electronics. But at the end of it all, I think I have a decent alarm clock, that is for me, the first time I have been able to wake up on time. Check out the complete instructable here!

Update: While the alarm clock did work well, I had received some criticism that said that the project did not look very nice. A few people rightly said that the way I had painted my wood had made all the imperfections stand out in it. While experimenting with different finishes, I came across a sheet of card stock. I used this to finish my project by printing a large sheet of card stock black, and then using it as a laminate to cover all sides of my project. Unexpectedly, the LEDs turned out looking quite nice inside the card stock, and I think the entire project has an improved look. Let me know what you think!

sun2

For the extra code that I promised on my instructable, here it is!

Continue reading “The Sunrise Alarm Clock”