Posts

Showing posts from 2016

On airports and electric vehicles.

Before we even start, let me digress a little. I think there are two kinds of passengers at the airport - either you stand in line at the boarding counter of the gate or you don't, either you stand up as soon as the flight stops or you happily wait for the rest to deplane. Using electric vehicles in the airport, for official purposes Now, coming back to the point, I was flying to Delhi from Pune yesterday and noticed that there are a lot of vehicles running around, helping with the day-to-day operations of the airport. For example, small airports have tracktors which I presume are being used to move luggage between the airplane and the terminal. Bigger airports have buses to shuttle people from the airplane to the terminal. There are oil tankers carrying air fuel. There also seem to be a few private 4 seater vehicles, which I presume are used to shuttle the cabin crew to and from the airplane. Now, coming to the point, what is the carbon footprint of a terminal/airport? I wi

On software engineering ethics

Image
This post/video is, IMO, a sister post of the previous one - https://rahulporuri.blogspot.in/2016/12/on-bias-at-work.html . The video, embedded below, talks about ethics in software design and the IT sector in general. All of us have seen these so called Dark Patterns on the internet/websites. Watch the video and you'll probably recognize a number of them. Better yet, visit the website : http://darkpatterns.org/ and you'll find more examples which couldn't be covered in the talk. Just watch the talk, I'm not going to give you a summary. What I want to talk about is the topic of Ethics in the Software Engineering world. Engineering Ethics is a course every student sits through in college. For most it is a formality. And given that now-a-days most college graduates end up working with and actively developing software, it is important to understand and lookout for ethical boundaries that we might be crossing while developing software. There is another beautiful/

On bias at work.

Image
Watching this talk reminded me of the Engineering Ethics course that I had taken back in college (at IIT Madras). And I'm surprised that we weren't taught about bias at the work place. And all of us are biased. Whether we do it unintentionally doesn't absolve us of wrongdoing. Everyone should make effort to learn about how they might be biased and act on their biases and double check the decisions that are taken, especially when a diverse group of people are involved. I remember another talk on how Software Engineering ethics. In this day and age when software is integral to everyone's day-to-day life and is integral at our workplace, great scrutiny should be placed on the it, to make sure that it doesn't discriminate or target certain peoples. I'll link that talk at a later time. Until then ...

Radio astronomy on the high seas

What is the best location to place a telescope? The first answer that comes to people's minds is a mountain top. Ask them why and they might not know but they just might know that most telescopes are on mountain tops, so there must be a good reason there. Well, in fact there is a reason. Telescopes work better when placed on mountain tops because there's less atmosphere for the telescope to look through, less atmosphere that can smear the images being taken leading to better science. Actually. There's a small correction. Optical and sub-mm telescopes are best placed on mountain tops. Radio telescopes on the other hand can work just as well when placed at sea level. Now. Following up to the first question, What is the best location to place a radio telescope? Because altitude doesn't matter, the main problem is radio interference. Man-made radio interference is the biggest source of noise to radio telescopes. This is the reason why the JVLA in NA is a designa

On VR gaming

For those of you who don't know, VR stands for Virtual Reality. VR Gaming is slowly picking up traction, among game developers and aficionados. But. I still think it has a long way to go before it becomes widely adopted as the norm. Also, Gaming/Entertainment isn't where I wished VR was heading but that's where the market seems to be driving it. Moving on, one of the reasons why I don't see VR gaming pick up anytime soon is because of the complex nature of the setup - there needs to be a large enough space for the person immersed in VR to not come across physical obstacles that would distract the virtual gameplay. The VR headsets themselves are fairly costly. What I propose is this - a combination of Google Cardboard, a decent phone and bluetooth/wired joysticks. If you don't know what Google Cardboard is, go here - https://vr.google.com/cardboard/ . It's a contraption to convert your phone into a VR device. Xiaomi is coming out with a similar product,

On programmers.

Image
I just watched this brilliant keynote today. It's a commentary on Programmers and the software development industry/ecosystem as a whole. I am not going to give you a tl;dr version of the talk because it is a talk that I believe everyone should watch, that everyone should learn from. Instead, I am going to give my own parallel- ish views on programmers and programming. As pointed out in the talk, there are mythical creatures in the software development industry who are revered as gods. Guido Van Rossum, the creator of Python, was given the title Benevolent Dictator For Life (BDFL). People flock around the creators of popular languages or libraries. They are god-like to most programmers and are treated like gods. By which, I mean to say, we assume they don't have flaws. That they are infallible. That they are perfect. And alongside this belief in the infallibility of these Gods, we believe that they were born programmers. That programming is something that peopl

Another talk at the local PythonPune meetup

I rehashed the workshop I conducted at SciPy last weekend into a 20-ish minute talk today at the local Python meetup group. I've been following their activities for well over 4 months now and every time it so happens that I'm traveling when they organize the meetup. Every month for the last 4 months. And finally. Finally. Today, there were no conflicts. It couldn't have happened at a better time either. I already had all of the material because I used the same slides as those I used during the workshop. Ohh, if you don't know, the workshop I conducted was on `Automated Testing using Python`. I talked about the unittest module and the mock module and I briefly mentioned the pytest and nose test runners in passing. Overall, the talk was well received. A few people came up to ask me about follow up questions, about how mock can actually help with testing a large code base and I tried my best to give them examples. I also talked to a few of the regulars and the organiz

Scipy India 2016

SciPy India happened during 10-11 Dec 2016 and it was my first SciPy It was especially fun because after 2 years, I got back in front of people to talk for long- ish periods of time. I guided two workshops, the first on "Automated Testing in Python" and the second on "An introduction to Git and GitHub". I also gave an impromptu lightning talk, on the Trains side-project that I have been working on for sometime now. The two workshops needed a couple of days of work from my side, as I played around with the overall outline of the workshops and made the specific slides I needed. In the end, both of the workshops were well received, from what the audience said to me in person. A few expected both of the talks to be more advanced but I guess I can't make everyone happy. Personally, it does make sense for me to modify the content and make multiple versions, which would speak to students with varied levels of expertise. Add few slides here. Remove a few slides th

It's been a while

It's been a while since I last posted something. Life got a little busier over the last couple of months. Rather, I've gotten worse at managing my time. Weekends were spent traveling or with friends. Weekdays were spent hunched over and typing, mostly words that made sense to a computer but a few that make sense to most people. While I have been working on a few things on the side, I haven't written about the progress I'm making. A weird kind of truth has been dawning on me. I had set a high bar for myself and prevented myself from posting a draft I didn't consider to be finished. Or if it didn't convey anything new or exciting. Mostly because I was asking my self the question "Why would anyone want to read what I write?". And I've come to an interesting answer. Most people don't want to read my blog. The few who have read something I wrote wouldn't want to read the rest of the things I have written. And the fraction of those few who

A network of physicists at IIT Madras

I started to find networks interesting, especially because of the insights they can provide into the system. Earlier, I worked on making a network of Universities based on co-authorship on publications. Studying such network and their evolution can be helpful. For example, if an ongoing multi-university collaboration is successful without the knowledge and support of the host universities, such analysis can be a way to lobby for official support. On similar terms, I created a new network of physicists at the Department of Physics at the Indian Institute of Technology at Madras (which is my almamater). They revamped the department's website, specifically the Recent Publications page, which is updated with publications of the faculty in the department. As you can see from the table, each row/paper contains a list of authors. By collecting such lists, we can make a network which shows who collaborates with who and without prior knowledge, take a guess at which labs collaborates wi

Mapping out the train routes in India

Image
I had nothing better to do on a Sunday morning so I made a map. If you have been following my blog, you will know that I am trying to make sense of the Indian Railways, why the trains runs late  and if there's anyway we can learn about the cause of the delays, based on patters in delay. Towards that goal, I posted two blog posts that described how and where I was collecting my data from and a first look at the data I was gathering . Even from the preliminary look , it can be seen that there are specific routes/stations that are causing a delay along a train's route. And the delays were induced on multiple runs at the same station, meaning that it wasn't simply a one time thing. Moving on, another way to look at the problem is to understand how crowded the railway lines are. By mapping all train movement in India, we will be able to understand how crowded specific routes are and if they're crowded at a specific time of the day. By adding delay information

A tale of two trains : The Indian Railways

Image
Last week, I started collecting the running status of a few (<10) trains everyday. I wrote a blogpost last week about how I was collecting the data if you want to know more. Now, let's look at what I've collected so far. (Open in the following images in a new page to take a better look at which stations are the most problematic and understand the general trend better) Train 18029 - runs from Lokmanyatilak (Mumbai) to Shalimar. This train is mostly representative of what happens with the rest of the trains discussed below. There are stations enroute where the train makes up for lost time and then it loses any gains made. But, for the most part, I guess the delays are acceptable, given that they're within an hour of expected arrival time. Train 12809 - runs from Mumbai CST to Howrah JN. This train was a little surprising because it's different compared to the rest of the lot. The train almost always makes up for delays in at the start of the route. There are

Dude, Where's my Train? - The Indian Railways.

I have a friend who was traveling from New Delhi to Guwahati and due to certain constraints, she had to take train number 12502. She had made further plans of traveling from Guwahati based on the assumption that she would reach Guwahati at the expected arrival time. You all know where this is going. The train was late and she had to make changes to her travel plans. We all have either known someone who went through this or personally went through this ourselves. Usually, trains run by the Indian Railways are not more than an hour late. There are ones who run perfectly on time too. And then there are also trains that are multiple hours late, sometimes even > 6! Which I don't think is acceptable. And because I had nothing better to do on a Sunday, I set about to do something about it. If you guys have read a few of my earlier blog posts, you know where this is going. I'm going to write some code that will help me automate something. Or get some data. Or make a plot or a map

Playing around with errors in Python - NameErrors

Let's start with NameErrors, which is one of the more common errors that a newcomer to Python will come across. It is reported when Python can't find a local or global variable in the code. One reason this might pop up is because a variable is being referred to outside of it's namespace . To give you an example a = 10 def test_f (): a = 20 print a test_f() print a Let's walk through the code. After defining the variable a and the function test_f, you would naively expect the test_f() function call to change the value of a to 20 and print 20. You expect the print statement after the function call to also print 20. Because you expect the function call to have changed the value of a. But, if you try running the code for yourself, you'll notice that the final print statement will print 10. This is where namespaces come into the picture. Now, let's try this instead def test_f (): b = 20 print b test_f() print b The

Pocket reading list - Week 4.1 of July.

The Ukrainian Hacker Who Became the FBI’s Best Weapon—And Worst Nightmare - What I find most amazing about this article is what the hacker says about his fellow mates, that all they want is a job and if they found one that paid well and was stable, they wouldn't have much need to hack and make money the illegal way. This is, in my opinion, in general true for a sizable human population that defaults to stealing and cheating to make their livelihood, because they didn't have the option to work towards a legal/stable livelihood and now they're having to make ends meet one way or another. Canada’s $6.9 Billion Wildfire Is the Size of Delaware—and Still Out of Control - Just another reminder that Nature is a force out of our control. After settling down in every remote corner or the Earth, moving to the top of any and every food chain, we humans might feel invincible. But events like this remind us that nature around us is very fragile and can be disturbed beyond the poin

Playing around with exceptions in Python - Up is Down and True is False

True , False = False , True The above is a valid statement in Python2 (but not in Python3) and after executing the above statement, Python will return False if you evaluate 1==1 and True if you evaluate 1==2 . That's funny. It's hilarious. It pretty much made my day. And in the same vein as the previous post , you can use it to screw around with people. Take a look at the following piece of code. from utils import * if True : print 1 You expect it to print 1 because the if statement always evaluates to True . But. But. If you placed the earlier True/False switch statement in a file called utils.py , importing from that file will mean that the if statement always evaluates to False and nothing will be printed. Hide the True/False switch in an import statement and watch the world burn! Let me now give you a little insight into what is happening behind the scenes. My name is Rahul. Calling me something else doesn't change who I am or what

Playing around with errors in Python - KeyboardInterrupt

It's really hard to write code that doesn't throw errors, no matter what language one programs in. I've gotten used to writing modular code that helps maintain a constant train of thought and reduce the chance of errors occurring but still, from time to time, only after running the code do i go "Ohh, No!". I've been reading up on advanced concepts in python for about a week now and one thing I came across was the Python Standard Library reference of the Built-in Exceptions . I've come across most of these errors, a few more commonly than the rest. I thought that it'd be an interesting exercise to write code that intentionally raises the errors listed in that reference. To start with, let's look at something that's not exactly an Error but is an interesting thing to play around with, KeyboardInterrupt . If a code is producing error messages or if it's not responsive or if you just wish to halt it, most of us press CTRL+C , which correspon

Diamonds and why they're not as precious as they're made out to be

Before I say anything, Priceonomics people are awesome and some of the things that they write about are just mind-blowing! Coming to the point, Diamonds. While I was familiar with the fact that diamonds aren't actually all that precious or all that rare, I didn't know the whole story. After reading the following two articles, one more recent than the other - Have You Ever Tried to Sell a Diamond? and Diamonds Are Bullshit , I truly believe in the power of advertising. That's all there is to it. Advertising. In fact, after reading these two articles, I am convinced that Inception is in fact possible. It's a long con. A very very long con, spanning half-a-decade advertising campaigns, which made people believe that 1. A diamond ring is a must when a man asks a woman's hand for marriage. An addendum to this is the fact that a month's salary must be spent on said diamond ring. - The size of diamonds used in an engagement ring and the amount of money spent b

Pocket reading list : Week 1.2 of July

Sexy beasts  : I don't know why I hadn't asked the questions that were being answered in this article earlier. There are male birds out there with bright and extremely beautiful feathers, feathers that are primarily used to attract their female counterparts. And I should've asked the question "How does the bright and beautiful feathers help the female understand which male is stronger/fitter/better to reproduce with?", which this article answers. And there are things involved that came as a surprise to me. How Seattle Gave Up on Busing and Allowed Its Public Schools to Become Alarmingly Resegregated  : Apparently Seattle schools in the 70s and 80s enforced racial uniformity in schools in the area, by providing bus service to students if they needed to travel to a school a little further away, in the hopes of achieving racial uniformity. But now, the current administration and ignorant/biased/elite/pretentious/dumb parents are apparently resegregating the school

Pocket reading list : Week 1.1 of July

On spaghetti sauce - Malcolm Gladwell  : There's a lot to learn from how products are priced and the is a lot of science behind why the product lineup is what it is. Apparently, when companies approached a consultant to help them revive their product, conduct customer surveys and help defeating their rivals. What the consultant suggested was revolutionary, for the time. This is a story of what the consultant understood from his understanding of the human condition. The Arctic Suicides: It's Not The Dark That Kills You  : Urbanisation, in many parts of the world, is on full swing, and it's moving at an especially fast and frighteningly pace in some parts of the world! This account tells us what can go wrong if this urbanisation, and it's effect on the native population, isn't handled with care. It's surprising, shocking and sad that the deaths of so many natives isn't receiving a broader public attention. Why the S.E.C. Didn’t Hit Goldman Sachs Harder  :

Using my internet usage to understand my daily activity cycle

Image
Well, I had a little bit of work to do on Friday night, mainly because I didn't get much work done during the day. And I tried a couple of other ideas I had in mind but they didn't exactly pan out so I finally settled on this. Coming to the point, I use Google and Stack Overflow on a daily basis at work. In fact, it can be crudely said that if i'm using the internet, then I'm working and if I'm not using the internet, I'm either sleeping or watching something. I know what you're going to say, what if i'm wasting time on the internet, reading articles or worse, watching videos on Youtube and to that i'm going to say, from internet usage, I should be able to distinguish between using the internet for work i.e google/SO and wasting my time watching videos on Youtube. Now, let's look at how this can be done. I'm going to talk in the context of OSX and Linux-based systems. I didn't play around with Windows system. Maybe another time. 1