Friday, 18 December 2009
Thursday, 17 December 2009
Saturday, 12 December 2009
Friday, 4 December 2009
Just remembered the time when double-decker buses used to seem so cool...
how cool it was to have stairs and a whole other floor inside a bus... :)
Wednesday, 2 December 2009
Saturday, 31 October 2009
Multi-threading in Python and GIL
Ever wonder why the hell doesn't your multi-threaded Python program work on all the cores of your CPU?
I just ran across this great presentation by David Beazley about the inner workings of the Python Global Interpreter Lock (GIL). I always knew the threads library in Python had problems, but....
it is worse that you could imagine... :(
SUMMARY
Python creates its threads as PThreads (POSIX threads) on the base operating system (eg. Linux, Windows, etc). Python does not do the heavy lifting of the threads itself. So, it does not manage its own Thread Scheduling (like Round Robin, Priority-based scheduling, etc). Yes, Python does not have any thread scheduling! All it does is, maintain some light weight state info about each thread created, and data on the current thread running...
GIL:
The GIL is basically just a lock on a C variable called "_PyTheadState_Current", which points to the TheadState structure for the currently running thread. Every Python thread has to acquire a lock on this variable to run...
The lock itself is implemented simply as either of these:
Now, the Python Interpreter (PI) "checks" (stops the currently running thread) every 100 intervals or "ticks" and releases the lock of the currently running thread temporarily (for just a microsecond). And then in the very next C statement (literally), it re-acquires it... This gives the OS just a small window to give the lock to someone else...
The "ticks" themselves are not time-slice based, but correspond to Python byte-code instructions. These ticks are not interrupt-able. The lock "release" and "acquire" are modelled as Signals to the OS. So, for every check there is a signal.
MultiCore Scenario:
In the 2 Thread/1 CPU case, this works fine as the OS can pass on the signal to the other thread (after applying its scheduling algorithm), wake it up and let it acquire the GIL. This was how it was intended when the GIL was written in to Python.
But on the 2 Thread/2 CPU case, even though the OS can try to run the second thread on the 2nd CPU, the 2nd thread is not able to acquire the lock, as by the time it receives the Signal, the first thread on the 1st CPU has reacquired the lock... :( So, the 2nd thread just keeps on waiting (and waiting)...
In this case, the two threads are actually slugging it out to get the hold of the GIL... And the I/O bound thread would usually lose (even though it should have a higher priority)...
Great explanation, watch the video...
I just ran across this great presentation by David Beazley about the inner workings of the Python Global Interpreter Lock (GIL). I always knew the threads library in Python had problems, but....
it is worse that you could imagine... :(
SUMMARY
Python creates its threads as PThreads (POSIX threads) on the base operating system (eg. Linux, Windows, etc). Python does not do the heavy lifting of the threads itself. So, it does not manage its own Thread Scheduling (like Round Robin, Priority-based scheduling, etc). Yes, Python does not have any thread scheduling! All it does is, maintain some light weight state info about each thread created, and data on the current thread running...
GIL:
The GIL is basically just a lock on a C variable called "_PyTheadState_Current", which points to the TheadState structure for the currently running thread. Every Python thread has to acquire a lock on this variable to run...
The lock itself is implemented simply as either of these:
- PThread conditional variables
- POSIX semaphores
Now, the Python Interpreter (PI) "checks" (stops the currently running thread) every 100 intervals or "ticks" and releases the lock of the currently running thread temporarily (for just a microsecond). And then in the very next C statement (literally), it re-acquires it... This gives the OS just a small window to give the lock to someone else...
The "ticks" themselves are not time-slice based, but correspond to Python byte-code instructions. These ticks are not interrupt-able. The lock "release" and "acquire" are modelled as Signals to the OS. So, for every check there is a signal.
MultiCore Scenario:
In the 2 Thread/1 CPU case, this works fine as the OS can pass on the signal to the other thread (after applying its scheduling algorithm), wake it up and let it acquire the GIL. This was how it was intended when the GIL was written in to Python.
But on the 2 Thread/2 CPU case, even though the OS can try to run the second thread on the 2nd CPU, the 2nd thread is not able to acquire the lock, as by the time it receives the Signal, the first thread on the 1st CPU has reacquired the lock... :( So, the 2nd thread just keeps on waiting (and waiting)...
In this case, the two threads are actually slugging it out to get the hold of the GIL... And the I/O bound thread would usually lose (even though it should have a higher priority)...
Great explanation, watch the video...
Labels:
gil,
interpreter,
multithreading,
python,
scheduling,
threads
Monday, 29 June 2009
Getting back to blogging
Sorry for this long break! Lots of things happened in the last six months, and so I couldn't sit down to write much. Whenever I thought of writing, I could think of so many things to write about, it got overwhelming...
But I'll get back to blogging soon...
So, if you are still reading this, please wait a little longer... :)
But I'll get back to blogging soon...
So, if you are still reading this, please wait a little longer... :)
Monday, 29 December 2008
December Tech Meetup - web analytics, casual games and online spreadsheets
The December meetup started earlier at 6:30pm like last time. The turn-around was smaller (40) this time, possibly because its December and many people are on holiday and students/professors are preparing for exams. For people working in retail-related industries, Christmas season is the busiest time of the year, while others are preparing for the holidays.
Even then this tech meetup was one of the best we have had since we started. We had two great demos, an interesting talk, and lots of pizza and beer for everyone...
We started early like last time (6:30pm) and the initial chat and pizza took us an hour. We started with the presentations by 7:45pm. We had initially planned on each demo/talk taking 15 mins including questions, but it took much longer and in the end, all talks finished only by 9:30pm.
But the quality of the discussion was really good, be it Andrew explaining policies of Google and use of analytics, or Thanasis defending Java and the design decisions behind his game, or Gordon explaining their plans to take over the world of Spreadsheets.
So let us get to the talks...
Web Analytics
Andrew Hood who founded Lynchpin Analytics gave a quick rundown on Analytics, what it is and why to use it. He explained how advanced analytics can help websites track the sources of traffic and the flow within the website. Analytics can also track how successful various marketing campaigns (like AdWords/AdSense) and referral strategies have been. In today's world of cut-throat competition for attention on the web, successful marketing campaigns are critical to a websites' fortunes. But failure or success can only be understood and replicated if hard statistics are available for the decisions being made. Online Analytics is a way to achieve this understanding.
Here's a video of Andrew's talk...
Lynchpin from Sam Collins on Vimeo.
Crazy Space
Casual Gaming is a pretty big industry ($2.25 billion in 2008) and is growing fast. The industry consisting of small and easy to play games like Solitaire (Microsoft), Tetris (Tetris Holding) and Bejeweled (PopCap Games) is aimed at "non-gamers". These games are intended to be for relaxation and quick entertainment, and are mostly aimed at women (comprising 75% of the sales). The reason we don't hear a lot about these games is that these gamers don't tend to talk a lot about their gaming habits and they usually don't identify themselves as gamers...
Thanasis Theocharidis who has been working on casual games for many years, gave a demo of his game "Crazy Space". Crazy Space is a "Othello" inspired game which has been engineered ground-up. Thanasis wrote his own libraries for online AI calculations and fast hardware acceleration in Java. The game can also run on Google's new Android mobile platform.
Even though I'm not part of the intended audience, I found the game pretty addictive after playing a while :-)... You can download/play the game online.
Hypernumbers
The charm of starting a start-up is to dream big and think different. But alas, even in the startup world, very rarely do we see ideas that are truly original and ambitious. And this is what excites me most about Hypernumbers.
The whole idea of Hypernumbers is a little hard to grasp in beginning, and it looks like another online version of Microsoft Excel. But its purpose is to build a platform using which any non-developer/non-programmer can easily build their own websites. You say: Hold on... what?
In Hypernumbers, every cell in a spreadsheet has a unique URL and hence can be used as a variable to be programmed with. This means that any element on a webpage can map to a cell in a spreadsheet. For eg, each textbox, dropdown or checkbox on a webpage would map to a cell in a spreadsheet in the backend. So, if you can program an excel sheet you could potentially create your own website!
The point is that this allows a huge number of non-technical people who know how to use and write macros in Excel, to easily create websites.
Gordon Guthrie, Dale Harvey and Hasan Veldstra have created a highly scalable architecture in Erlang from scratch. They have written their own parsers for Excel documents (along with 100k compatibility tests) and Gordon tells me their system has recently crossed 90% compatibility.
Hypernumbers were funded by SeedCamp in 2007 and are looking to launch their first beta product this year in March. So stay tuned at http://hypernumbers.com/.
See slides of Gordon's previous talk on Erlang.
Photos
I was in-charge of the photos this time and didn't do a very good job :-(. But I did take a lot of pictures and by the "law of large numbers", some of them did turn out to be good... They are here.
The Website
Colin has been working hard on the Tech Meetup website, and it should be functional and up pretty soon... Do send us any feedback as it is supposed to be used by you guys...
The next meetup is on 14th Jan. Hopefully everyone will be back from holidays and we will have a great Tech Meetup again...
Previous meetups: First (September) Tech Meetup, the October Tech Meetup, and the November Tech Meetup
Even then this tech meetup was one of the best we have had since we started. We had two great demos, an interesting talk, and lots of pizza and beer for everyone...
We started early like last time (6:30pm) and the initial chat and pizza took us an hour. We started with the presentations by 7:45pm. We had initially planned on each demo/talk taking 15 mins including questions, but it took much longer and in the end, all talks finished only by 9:30pm.
But the quality of the discussion was really good, be it Andrew explaining policies of Google and use of analytics, or Thanasis defending Java and the design decisions behind his game, or Gordon explaining their plans to take over the world of Spreadsheets.
So let us get to the talks...
Web Analytics
Andrew Hood who founded Lynchpin Analytics gave a quick rundown on Analytics, what it is and why to use it. He explained how advanced analytics can help websites track the sources of traffic and the flow within the website. Analytics can also track how successful various marketing campaigns (like AdWords/AdSense) and referral strategies have been. In today's world of cut-throat competition for attention on the web, successful marketing campaigns are critical to a websites' fortunes. But failure or success can only be understood and replicated if hard statistics are available for the decisions being made. Online Analytics is a way to achieve this understanding.
Here's a video of Andrew's talk...
Lynchpin from Sam Collins on Vimeo.
Crazy Space
Casual Gaming is a pretty big industry ($2.25 billion in 2008) and is growing fast. The industry consisting of small and easy to play games like Solitaire (Microsoft), Tetris (Tetris Holding) and Bejeweled (PopCap Games) is aimed at "non-gamers". These games are intended to be for relaxation and quick entertainment, and are mostly aimed at women (comprising 75% of the sales). The reason we don't hear a lot about these games is that these gamers don't tend to talk a lot about their gaming habits and they usually don't identify themselves as gamers...
Thanasis Theocharidis who has been working on casual games for many years, gave a demo of his game "Crazy Space". Crazy Space is a "Othello" inspired game which has been engineered ground-up. Thanasis wrote his own libraries for online AI calculations and fast hardware acceleration in Java. The game can also run on Google's new Android mobile platform.
![]() | ![]() |
Even though I'm not part of the intended audience, I found the game pretty addictive after playing a while :-)... You can download/play the game online.
Hypernumbers
The charm of starting a start-up is to dream big and think different. But alas, even in the startup world, very rarely do we see ideas that are truly original and ambitious. And this is what excites me most about Hypernumbers.
The whole idea of Hypernumbers is a little hard to grasp in beginning, and it looks like another online version of Microsoft Excel. But its purpose is to build a platform using which any non-developer/non-programmer can easily build their own websites. You say: Hold on... what?
In Hypernumbers, every cell in a spreadsheet has a unique URL and hence can be used as a variable to be programmed with. This means that any element on a webpage can map to a cell in a spreadsheet. For eg, each textbox, dropdown or checkbox on a webpage would map to a cell in a spreadsheet in the backend. So, if you can program an excel sheet you could potentially create your own website!
The point is that this allows a huge number of non-technical people who know how to use and write macros in Excel, to easily create websites.
Gordon Guthrie, Dale Harvey and Hasan Veldstra have created a highly scalable architecture in Erlang from scratch. They have written their own parsers for Excel documents (along with 100k compatibility tests) and Gordon tells me their system has recently crossed 90% compatibility.
Hypernumbers were funded by SeedCamp in 2007 and are looking to launch their first beta product this year in March. So stay tuned at http://hypernumbers.com/.
See slides of Gordon's previous talk on Erlang.
Photos
I was in-charge of the photos this time and didn't do a very good job :-(. But I did take a lot of pictures and by the "law of large numbers", some of them did turn out to be good... They are here.
The Website
Colin has been working hard on the Tech Meetup website, and it should be functional and up pretty soon... Do send us any feedback as it is supposed to be used by you guys...
The next meetup is on 14th Jan. Hopefully everyone will be back from holidays and we will have a great Tech Meetup again...
Previous meetups: First (September) Tech Meetup, the October Tech Meetup, and the November Tech Meetup
Labels:
analytics,
andrew,
casual,
crazyspace,
december,
dotredgames,
excel,
games,
gordon,
guthrie,
hood,
hypernumbers,
lynchpin,
meetup,
photos,
spreadsheets,
tech,
thanasis,
theocharidis
November Tech Meetup - Virtualization and time travel!
| ![]() |
| ![]() |
I was about to title this post as "November Tech Meetup - another success" but then thought that it was getting cliched... Nonetheless the November Meetup was pretty "successful" with about 60 people attending. We had enough pizza for everyone this time... :-)
Trial of Corners Idea
This time, on popular demand, we finally tried the corners idea. We labelled five corners in the room as "Games and virtual worlds", "Cool AI applications", "Databases and scaling", "Web design" and "Employers and job seekers". Though it seemed to be working in the beginning, and many people were asking what and where the corners were, towards the end most corners were empty. We think the reason was that even though people came to these corners, they saw no one there and went somewhere else. So it seems that it takes people dedicated to a corner to start a community around it. This may be something we can think about and try again in the future...
This time we had only one talk, but it was a good one...
Virtualization
Virtualization, or V12n (as there are 12 chars between 'V' and 'n', I didn't know that), is one of those buzzwords in the IT industry that you hear a lot, but very few people really understand what it means.
So it was great to hear Dan Shearer explain V12n, esp. since he is really passionate about it. Dan is a veteran of open source (he once told me, he first started developing software when I was 2 yrs old), and is a founder of the Samba foundation. But apart from all that, he is one of the smartest people you'll meet. So I was really looking forward to his talk...Virtualization first began as a mechanism of testing software. As a software developer it has always been a pain to develop and test over all kinds of electronic devices out there. There are different chip sets, operating systems, motherboard and device configurations, and you can never be sure if what you have written works "fine" on all of them. So virtualization began with a purpose of simulating all kinds of hardware, with software. As for the software being tested, it doesn't matter if the underlying system is "real" or "virtual".
So Virtualization is essentially "Abstraction". You can simulate electronics and hardware, physical interfaces, people (how users interact with the system) and even time (speed up or slow down the computation to test for faster devices, and even change the direction of time)...
"All software is crap" (Dan says, not me... ;-) )
The point here is that even if software is perfectly written and tested on all current hardware/software configurations, we never know how it is going to perform in the future on unknown configurations like hardware that is 100 times faster or physical interactions that have not yet been imagined and created!
But these impossible configurations can be "virtually" created and the software can still be tested on these virtual configurations. So, Virtualization gives us a powerful method of preparing and testing for all kinds of strange future situations.

Time travel (oh yeah!)
If we take snapshots of a system every say 10 secs, we could restore these snapshots every second and make time run 10 times faster! Or we can restore these snapshots in reverse and even make time run backwards (virtually of course)...
This can be of tremendous help esp. while debugging. I have always feared programming in C++, as after you have removed all the obvious bugs, the scary part starts... If there are any memory leaks or hidden bugs in the system, the program crashes while running online (and taking down 10 other systems in the process). And there is rarely any way of recreating exactly what happened (unless you have heavy logging). But such backward time-travel could allow you to go back from a crash to see exactly when, where and how the problem started.
I can't wait to actually try out one of these debuggers...
Here are the slides for Dan's talk:
Apart from many amazing new attendees we were very happy that Randy Haykin of Outlook Ventures, and who was the author of the original Yahoo strategy in the 90's, joined us.
I hope we continue to attract cool people to the Tech Meetup, and it evolves to be the hub of technologists and tech-preneurs in Edinburgh and Scotland.
</rant>
Previous meetups: First (September) Tech Meetup and the October Tech Meetup
Tuesday, 9 December 2008
December Tech Meetup - 10th Dec
The Tech Meetup for this December is scheduled for this Wednesday, i.e. 10th Dec. The venue and time are the same as last time...
Venue: 8th Floor, Appleton Tower, Edinburgh
Time: 6:30 PM
There is lots to look forward to as this time we'll have demo's from Hypernumbers and Dot-Red Games and a talk on "Web Analytics" by Andrew Hood of Lynchpin Analytics.
Can't wait...
Venue: 8th Floor, Appleton Tower, Edinburgh
Time: 6:30 PM
There is lots to look forward to as this time we'll have demo's from Hypernumbers and Dot-Red Games and a talk on "Web Analytics" by Andrew Hood of Lynchpin Analytics.
Can't wait...
update...
Sorry for not posting in a while... there were a lot of things happening...
My visa application (for UK Tier 1 visa) was rejected while the previous visa was about to expire. Apparently, the UK Border Agency doesn't recognise any income made through Paypal and Paypal statements are not considered valid. And hence, I did not have sufficient "valid" or "provable" income for the past one year to clear their minimum requirements (even though I have payed tax on it).
So it seems, my mistake was not taking a "regular" job after graduating and trying something different...
Anyway, am still in the process of sorting everything out. Fingers crossed...
Will get back to posting soon.
My visa application (for UK Tier 1 visa) was rejected while the previous visa was about to expire. Apparently, the UK Border Agency doesn't recognise any income made through Paypal and Paypal statements are not considered valid. And hence, I did not have sufficient "valid" or "provable" income for the past one year to clear their minimum requirements (even though I have payed tax on it).
So it seems, my mistake was not taking a "regular" job after graduating and trying something different...
Anyway, am still in the process of sorting everything out. Fingers crossed...
Will get back to posting soon.
Monday, 27 October 2008
Second Tech Meetup: another success...
Edit: Added an older video of Yann's demo
It seems the Tech Meetup has caught the attention of the techie folk around Edinburgh, and the second meetup on 8th October was also a big success. We had about 70 people attending, which was a lot more than we expected. Consequently we also ran out of pizza and beer...
So as the self-designated official blogger for the event, I'll try and relate the happenings of the night...
Like last time, we started around 7 o'clock with people filtering in till 7:30. This, lets call it 'group chat time', was useful as it is a good way for people to chat with acquaintances and meet with people they already know. On the other hand, it also takes up a lot of initial time. So for the coming meetup in November we are going to start earlier at 6:30 instead of 7:00, so that we can do the introductions earlier, which means people can start meeting new people earlier.
Introductions
After pizzas had arrived and everyone had had a slice or two, we started with the public introductions like last time. Going through all 70 people did take time, but we think it was pretty useful as it helped break the ice. Even though this might not scale as the number of attendees grows, we still want to carry this on for as long as possible. The main objective of the meetup is to get people meeting and chatting to people they don't already know. A public introduction helps this because even though people don't remember each and every person's name, they can still remember their faces and then come and chat to them afterward.

We are looking for ways this can scale in the future. We are trying to avoid name-badges, etc as that would make the Tech Meetup feel like yet another formal conference or a networking event. Having peoples' profiles and interests on a website beforehand might be a way, but people will still not know who the person is that they want to meet in the crowd (unless we have clear photos on the website, or use name-badges... ).
Many have also proposed a "corners idea", which we are going to try out this time. Basically the idea is to designate certain corners of the room to certain topics where people who want to talk about that can gather. I think it is a good idea. Coming up with a general and yet interesting set of topics for the corners is the hard part. We would love to hear more feedback on this...
Demos
We had two demos again like last time. We had more lined up but sadly had to cut short as we ran out of time, and it was getting late. So, this time starting earlier would help...
Wii Loop Machine
In the first demo, Yann Seznec gave a great demo of his Wii Loop Machine software. Yann's application allows users to create new electronic music using a Wii remote. A big part of producing electronic music is to do with looping music samples and mixing them in a good rhythm. Yann's software allows you to control, mix and match these loops, just like a DJ would, using a Wii remote. It also looks fun because you start dancing with the Wii remote, while producing music.

Here is a video from Yann's blog:
Wii Loop Machine 2.0 :: an intro from The Amazing Rolo on Vimeo.
Technically, Yann mentioned that he is using aka.objects library for accessing Wii remote developed by Masayuki Akamatsu. Yann also has plans of porting the Loop Machine to the windows platform soon. All in all, it was a fun demo.
Erlang

Gordon Guthrie of Hypernumbers gave a high level yet interesting talk on Erlang. He focussed on the philosophy behind Erlang which was designed from ground up to be a concurrent & distribution-oriented programming language. Even though Erlang syntax is similar to many other functional programming languages, it provides native concurrency and multiprocessing capabilities. So an application written in Erlang can scale easily to a large network of computers.
As scalability is one of the biggest concerns for any successful and growing software application, having this functionality inherent in the design since the beginning is a big plus.
Here are the slides for Gordon's talk:
Photos
Thanks to Adam Yates, we have some great photos of the meetup. Here are some of them (all throughout this post). I have also uploaded them to the Facebook group.
Future plans
All in all, it was another great meetup with lots of new people coming this time. Can't wait for the next one...
It seems the Tech Meetup has caught the attention of the techie folk around Edinburgh, and the second meetup on 8th October was also a big success. We had about 70 people attending, which was a lot more than we expected. Consequently we also ran out of pizza and beer...
So as the self-designated official blogger for the event, I'll try and relate the happenings of the night...
Introductions
After pizzas had arrived and everyone had had a slice or two, we started with the public introductions like last time. Going through all 70 people did take time, but we think it was pretty useful as it helped break the ice. Even though this might not scale as the number of attendees grows, we still want to carry this on for as long as possible. The main objective of the meetup is to get people meeting and chatting to people they don't already know. A public introduction helps this because even though people don't remember each and every person's name, they can still remember their faces and then come and chat to them afterward.
We are looking for ways this can scale in the future. We are trying to avoid name-badges, etc as that would make the Tech Meetup feel like yet another formal conference or a networking event. Having peoples' profiles and interests on a website beforehand might be a way, but people will still not know who the person is that they want to meet in the crowd (unless we have clear photos on the website, or use name-badges... ).
Many have also proposed a "corners idea", which we are going to try out this time. Basically the idea is to designate certain corners of the room to certain topics where people who want to talk about that can gather. I think it is a good idea. Coming up with a general and yet interesting set of topics for the corners is the hard part. We would love to hear more feedback on this...
Demos
We had two demos again like last time. We had more lined up but sadly had to cut short as we ran out of time, and it was getting late. So, this time starting earlier would help...
Wii Loop Machine
In the first demo, Yann Seznec gave a great demo of his Wii Loop Machine software. Yann's application allows users to create new electronic music using a Wii remote. A big part of producing electronic music is to do with looping music samples and mixing them in a good rhythm. Yann's software allows you to control, mix and match these loops, just like a DJ would, using a Wii remote. It also looks fun because you start dancing with the Wii remote, while producing music.
Here is a video from Yann's blog:
Wii Loop Machine 2.0 :: an intro from The Amazing Rolo on Vimeo.
Technically, Yann mentioned that he is using aka.objects library for accessing Wii remote developed by Masayuki Akamatsu. Yann also has plans of porting the Loop Machine to the windows platform soon. All in all, it was a fun demo.
Erlang
Gordon Guthrie of Hypernumbers gave a high level yet interesting talk on Erlang. He focussed on the philosophy behind Erlang which was designed from ground up to be a concurrent & distribution-oriented programming language. Even though Erlang syntax is similar to many other functional programming languages, it provides native concurrency and multiprocessing capabilities. So an application written in Erlang can scale easily to a large network of computers.
As scalability is one of the biggest concerns for any successful and growing software application, having this functionality inherent in the design since the beginning is a big plus.
Here are the slides for Gordon's talk:
Photos
Thanks to Adam Yates, we have some great photos of the meetup. Here are some of them (all throughout this post). I have also uploaded them to the Facebook group.
Future plans
- Dates: The next meetup is fixed for 12th of November which is a Wednesday again. We have also decided to hold meetups in the future on the 2nd Wednesday of every month, so that it doesn't conflict with most of the other events.
- Website: We have a plan for a getting a full-fledged community website up for the Tech Meetup. It will have videos of demos, photos, member profiles and facilities to contact each other, forums, Job listings and Event registration. This looks like a lot of work, but we hope to roll it out in phases soon... All suggestions are welcome...
- Venue: If we continue to grow, 8th Floor of Appleton tower will soon be too small. Bigger halls in the new Informatics Forums are an option. We have decided to stay with Appleton tower for the coming meetup, and see if we do actually outgrow it...
All in all, it was another great meetup with lots of new people coming this time. Can't wait for the next one...
Labels:
community,
edinburgh,
erlang,
hypernumbers,
loopmachine,
meetup,
tech,
yannseznec
Friday, 24 October 2008
Python
This is a presentation I gave at work on Python. It is a quick overview for anyone interested in the language. I tried to keep it not too technical (but there are still some jargon in there)...
For more on Python, I recommend these articles:
Interview with Guido von Rossum: Making of Python
Eric Raymond: Why Python?
Data structures in Python
Python: Myths about indentation
Peter Norvig: Spell Checker in Python in 21 Lines
Performance computing in Python
For more on Python, I recommend these articles:
Interview with Guido von Rossum: Making of Python
Eric Raymond: Why Python?
Data structures in Python
Python: Myths about indentation
Peter Norvig: Spell Checker in Python in 21 Lines
Performance computing in Python
Labels:
introduction,
language,
presentation,
programming,
python
Monday, 6 October 2008
Second Tech Meetup on Wednesday
So, its been a month already... the second meetup is set for this Wednesday (8th October) at 7pm. The venue is the same: Appleton Tower, 8th Floor.
Expecting lots more cool people this time...
Expecting lots more cool people this time...
Friday, 5 September 2008
First Tech Meetup: success!
Thanks to everyone who showed up yesterday! The tech meetup last night went great. We had a group of about 50 people all interested in technology, talking about technology. Even though there were many startuppers and some investors in the crowd, the business chat was to the minimum...
The two demos were great too. Tom Griffiths from Hubdub gave a quick run through of their very popular website and some insight into prediction markets. Matt Aylett from Cereproc also gave a great demo of their Speech Synthesis software and how it can mimic George Bush as well as generate West Bromwich accents.
Special thanks goes to Andrew Mitchell, Colin Adams, and the University of Edinburgh for letting us use their space, and sponsoring the Pizza and Beer... The space on the eighth floor of Appleton Tower was actually very well liked by everyone.
I know many people couldn't make it to this event because of the short notice. I will do a more detailed post about what went on soon. But if you are interested in coming and meeting all sorts of cool techies, just drop us a line...
The two demos were great too. Tom Griffiths from Hubdub gave a quick run through of their very popular website and some insight into prediction markets. Matt Aylett from Cereproc also gave a great demo of their Speech Synthesis software and how it can mimic George Bush as well as generate West Bromwich accents.
Special thanks goes to Andrew Mitchell, Colin Adams, and the University of Edinburgh for letting us use their space, and sponsoring the Pizza and Beer... The space on the eighth floor of Appleton Tower was actually very well liked by everyone.
I know many people couldn't make it to this event because of the short notice. I will do a more detailed post about what went on soon. But if you are interested in coming and meeting all sorts of cool techies, just drop us a line...
Wednesday, 3 September 2008
First Tech Meetup in Edinburgh - Sept 4th 7pm
I hear networking is important, but networking sounds like waiters with trays of finger food and paper napkins. Ian Hogarth wrote about "Hackers Need Friends Too!" (http://uk.techcrunch.com/2008/08/21/hey-hackers-need-friends-too/ )
So the first meetup on September 4th is to see what people think and what we can do to make an easily accessible and friendly community of tech minds, skills and startups around Scotland and connecting with London. We're hoping to have a meetup maybe every month and to find a way to connect with Ian's meetup in London (and other cities as they start).
So come along at 7pm to 8th Floor of Appleton Tower (Edinburgh Uni).
The response so far has been really encouraging. Thanks to Sam Collins for setting this up, Andrew Mitchell and Edi Uni for sponsoring it and Ian Hogarth for the support.
on TechCrunch UK, and we've decided to do what they do in London: get all the developers, tech heads, and tech startups together and build a functional community.
This gives everyone a community where we can learn from each other, hear what's going on around us, demo some stuff, and really try and bring together the wealth of tech talent we
have in Scotland and of course, enlighten others who may be interested.This gives everyone a community where we can learn from each other, hear what's going on around us, demo some stuff, and really try and bring together the wealth of tech talent we
So the first meetup on September 4th is to see what people think and what we can do to make an easily accessible and friendly community of tech minds, skills and startups around Scotland and connecting with London. We're hoping to have a meetup maybe every month and to find a way to connect with Ian's meetup in London (and other cities as they start).
So come along at 7pm to 8th Floor of Appleton Tower (Edinburgh Uni).
The response so far has been really encouraging. Thanks to Sam Collins for setting this up, Andrew Mitchell and Edi Uni for sponsoring it and Ian Hogarth for the support.
Friday, 15 August 2008
Great Generals: Hannibal takes on Rome III - Battle of Cannae
I finally got to writing about the third and the greatest battle of Hannibal against Rome - The Battle of Cannae. The essay is long, but the battle is truly amazing ...

After being defeated at Trebia (Dec 18, 218BC) and Trasimene (Jun 24, 217BC), the Roman Republic was already cornered. There was an enemy rampaging through Italy and yet they could not stand up to him. Fabius Maximus who was appointed the "dictator" after Trasimene, decided not to take on Hannibal (probably a wise decision) and chose to rely on cutting off his supply lines, raiding his camps and basically wearing him down. But his Fabian strategy, as it was known, soon became unpopular with the Roman public. General public was, as it still is, impatient and wanted revenge. So, in 216BC, the Senate did not renew Fabius as a dictator and elections were resumed. As a result, Gaius Varro and Lucius Paullus were elected as consuls, apart from Geminus and Regulus (who were consuls before Fabius become dictator).
Rome's preparations
Usually each consul would go to a battle by himself taking two legions that belonged to him. Each Roman legion consisted of 5,000 soldiers (or legionaries) and were generally accompanied by an allied legion of equal size. So, among the 4 consuls they commanded 16 legions (Roman + Allied), which along with about 4,000 Cavalry and other meant about 87,000 troops.
The Roman Senate decided to send all of these legions to fight Hannibal. Never before in Roman history had all four consuls gone to war at the same time. The terror of Hannibal amongst Romans was so great that they had raised an unprecedented army of almost 90,000 to take him on. They believed their strength in numbers and the strong infantry would overwhelm Hannibal's eclectic army of barbarians (as they called them).
In contrast, Hannibal only had about half as many men (40,000 heavy infantry, 6,000 light infantry and 8,000 cavalry), about 55,000 in all.
Seeing that Romans were raising a huge army, Hannibal decided to take them on sooner rather than later. He moved first by capturing the Roman supply base at Cannae, and placed himself between Romans and their supplies. This provoked the Roman army to move, confident as they were in their large army.
The stage for the epic battle between Hannibal and Roman army was set.
Know thy enemy
The two newly elected Roman consuls, Varro and Paullus were commanding the 16 legions as they moved towards Cannae. But there was a problem: who would take the overall command of the army? Neither of them would be a subordinate of the other. So, by Roman law it was decided that Paullus and Varro would take charge on consecutive days (so one day Paullus and then one day Varro, and so on). It sounds ridiculous now, but this actually happened... To make matters worse, the difference between the two generals' ways was big. Varro was a rash and arrogant general while Paullus was patient and cautious. Even though Paullus was against fighting head on with Hannibal, he wasn't able to convince the hot-headed generals who were itching for a fight. Hannibal knew this.
For two days the armies stood facing each other, but neither would attack first. When Hannibal sent a challenge to Paullus it was promptly rejected. But on the third day, when Varro was in charge, Hannibal ordered his cavalry to cross the Euphidus river and attack the small Roman camp on the other side. They attacked the Roman water supply line from the river and caused a lot of mayhem in the Roman camp. This succeeded in getting Varro angry and got him to cross the river to the other side with all his army. And Hannibal had already prepared for it...
Know thyself and prepare
Hannibal knew that his army was outnumbered 2:1, but he still had the advantage when it came to Cavalry, in numbers (8,000 as opposed to 6,000) and also in strength and experience. So, if his cavalry was able to destroy the Roman cavalry quickly, they would then be able to circle round and attack the Roman infantry from behind. When this happened, it would be essential to prevent the Roman army from spreading or escaping (and later regrouping). So, Hannibal came up with an idea of encircling the Romans from both right and left, a Pincer Attack.
Hannibal knew his soldiers and their weaknesses and capabilities very well. The Carthagian army was made up of warriors from all over the world:
Hannibal also knew that his Spanish and Gallic infantry were not as strong and battle hardened as his African unit, but they were still much larger in number (24k vs 8k). So, he decided to form a thick line with Spanish and Gallic in the center and kept the African infantry on the two sides. Their job was to perform the pincer attack from the Roman right and left when the cavalry reached the Roman rear.
He further ordered his central line to advance and meet the Roman center first, in an Echelon or more specifically a V-formation (used by fighter jet squadrons). This had three purposes:
Cavalry planning:
To ensure that his cavalry would be able to quickly destroy the Roman cavalry, he gave his commander Hasdrubal on the left, 2/3rd of his cavalry (6,500), and Hanno on the right was made in charge of the Numidian light cavalry which was 3,500 in number. While Hanno's light cavalry would hold off half the Roman cavalry, Hasdrubal would destroy the other half on the left and then circle round and attack the Roman cavalry on the right from behind. After finishing them off, the combined cavalry would attack the Roman infantry center from behind.
The framework for one of the greatest planned battles in human history had been laid. Hannibal was going to turn his enemy's greatest strength into their biggest weakness.
Stand in the eye of the storm and coordinate
When the battle began, Hannibal himself led the the center formed by the Gallic and Spanish infantry to an advance and tackled the Romans first. They bore the brunt of the Roman attack. Many soldiers were getting killed as they went head on against the strong Roman infantry charge. But being there himself, Hannibal was able to motivate his soldiers and control them to a coordinated retreat. As the central line kept falling back, the initial V-formation changed to a crescent.

In the meantime, the strong Carthagian cavalry was completely destroying the Roman flanks. As planned, they first finished off the left and then the right flanks and then attacked he Roman skirmishers from behind.
Hannibal now sprang the trap that he had laid. He ordered his battle hardened African troops (who had stayed out of the battle until now) to attack the Romans from the two sides. Maybe Romans could not see them because of all the dust caused by the battle, or the Roman generals lacked the quick judgment to respond, nobody knows for sure, but the Roman infantry was now surrounded. Without their flanks, Roman infantry drove itself deeper and deeper into the crescent shaped alley formed by the Carthagian line. Soon, they were completely encircled and running out of space to fight.
Corner and finish
The Romans in the center were packed so close to each other that they could not move their arms or lift their weapons. Only the soldiers on the outer circumference fought and were soon killed where they stood. To cause even more confusion, Hannibal ordered his soldiers to kill all the Centurions (officers) first.
As killing so many Romans was taking a lot of time, Hannibal ordered his soldiers to cut the hamstrings of the Roman soldiers to make them incapable of fighting, and then move on. After finishing the fight, they could come back and kill them at leisure.
Result
Tens of thousands of Roman bodies were all over the battlefield when darkness brought an end to fighting. Some Roman soldiers even killed themselves by burying their own heads in the ground, to escape the pain. In all about 70,000 Roman soldiers were killed and only 14,000 managed to escape and 4,000 were taken prisoner. 600 Roman soldiers were killed every minute that day.
Paullus along with two previous consuls was killed (ironically Varro survived). 29 out of 48 military tribunes and 80 out of 300 senators (in all) were killed in one day. Only 1 out of every 6 Roman soldiers who entered the battle, survived.
The Carthagians on the other hand only lost 16,000 men, most of them Spanish and Gallic who formed the center line.
The Battle of Cannae was the costliest battle in human history uptil then. It still ranks as the second most costly formation battle in human history.
Aftermath
Even though Rome was in complete disarray after Cannae, Hannibal didn't attack and lay siege to Rome. This maybe because he believed that Rome still had significant resources, and also because of his experience from his first battle when he laid siege to Saguntum (refer the introduction to the Battle of Trebia). He was criticized by many in his camp for not taking this opportunity and destroying the Romans completely. But Hannibal's objective of fighting might not have been destruction of Rome, but to dishearten it and force it into a moderate peace agreement.
Hannibal sent a delegation to Rome to propose a peace treaty on moderate terms, but the Roman Senate refused to talk. Instead they mobilized their entire male population and started raising new armies. The word 'peace' was prohibited on the streets of Rome and only women were allowed to cry in public.
At last they had learnt their lesson. Instead of fighting head-on with Hannibal, they went back to attrition strategies of Fabius. In the meantime, the Oligarchy in Carthage was growing more and more jealous of Hannibal, his achievements and his growing popularity. After a few years of maneuvering around Italy, they refused to send Hannibal reinforcements, and Hannibal was forced to pull back.

Hannibal's story
The rest of Hannibal's life story is sad. Even after such huge victories and with unrivaled strategic genius, Hannibal could not carry on winning, because of lack of support from home and loss of most of his good soldiers (either dead or tired from fighting). In 202Bc, fourteen years after Cannae, Hannibal with a much weaker army was finally defeated at the Battle of Zama by Scipio Africanus. The Second Punic War ended with the battle of Zama, and Carthage conceded defeat.
After the war ended, Hannibal tried to become a statesman and was also appointed the Chief Magistrate because of his popularity. But the oligarchy in Carthage were still jealous of him. When the Romans demanded that Hannibal surrender, Hannibal knew that the oligarchy would not support him. He decided to go into a self imposed exile. He offered his services to King Antiochus III of Syria and then the king of Phoenicia.
But the Romans were determined to hunt him down, and in the end one king (Prusias I of Bithymia) agreed to give him up. Determined not to ever fall into the hands of Romans, and to keep the promise he had made to his father on his deathbed (to fight the Romans till death), Hannibal took the poison he always carried with him (in his ring). Hannibal died in 183BC at the age of 64.
After being defeated at Trebia (Dec 18, 218BC) and Trasimene (Jun 24, 217BC), the Roman Republic was already cornered. There was an enemy rampaging through Italy and yet they could not stand up to him. Fabius Maximus who was appointed the "dictator" after Trasimene, decided not to take on Hannibal (probably a wise decision) and chose to rely on cutting off his supply lines, raiding his camps and basically wearing him down. But his Fabian strategy, as it was known, soon became unpopular with the Roman public. General public was, as it still is, impatient and wanted revenge. So, in 216BC, the Senate did not renew Fabius as a dictator and elections were resumed. As a result, Gaius Varro and Lucius Paullus were elected as consuls, apart from Geminus and Regulus (who were consuls before Fabius become dictator).
Rome's preparations
Usually each consul would go to a battle by himself taking two legions that belonged to him. Each Roman legion consisted of 5,000 soldiers (or legionaries) and were generally accompanied by an allied legion of equal size. So, among the 4 consuls they commanded 16 legions (Roman + Allied), which along with about 4,000 Cavalry and other meant about 87,000 troops.
The Roman Senate decided to send all of these legions to fight Hannibal. Never before in Roman history had all four consuls gone to war at the same time. The terror of Hannibal amongst Romans was so great that they had raised an unprecedented army of almost 90,000 to take him on. They believed their strength in numbers and the strong infantry would overwhelm Hannibal's eclectic army of barbarians (as they called them).
In contrast, Hannibal only had about half as many men (40,000 heavy infantry, 6,000 light infantry and 8,000 cavalry), about 55,000 in all.
Seeing that Romans were raising a huge army, Hannibal decided to take them on sooner rather than later. He moved first by capturing the Roman supply base at Cannae, and placed himself between Romans and their supplies. This provoked the Roman army to move, confident as they were in their large army.
The stage for the epic battle between Hannibal and Roman army was set.
Know thy enemy
The two newly elected Roman consuls, Varro and Paullus were commanding the 16 legions as they moved towards Cannae. But there was a problem: who would take the overall command of the army? Neither of them would be a subordinate of the other. So, by Roman law it was decided that Paullus and Varro would take charge on consecutive days (so one day Paullus and then one day Varro, and so on). It sounds ridiculous now, but this actually happened... To make matters worse, the difference between the two generals' ways was big. Varro was a rash and arrogant general while Paullus was patient and cautious. Even though Paullus was against fighting head on with Hannibal, he wasn't able to convince the hot-headed generals who were itching for a fight. Hannibal knew this.
For two days the armies stood facing each other, but neither would attack first. When Hannibal sent a challenge to Paullus it was promptly rejected. But on the third day, when Varro was in charge, Hannibal ordered his cavalry to cross the Euphidus river and attack the small Roman camp on the other side. They attacked the Roman water supply line from the river and caused a lot of mayhem in the Roman camp. This succeeded in getting Varro angry and got him to cross the river to the other side with all his army. And Hannibal had already prepared for it...
Know thyself and prepare
Hannibal knew that his army was outnumbered 2:1, but he still had the advantage when it came to Cavalry, in numbers (8,000 as opposed to 6,000) and also in strength and experience. So, if his cavalry was able to destroy the Roman cavalry quickly, they would then be able to circle round and attack the Roman infantry from behind. When this happened, it would be essential to prevent the Roman army from spreading or escaping (and later regrouping). So, Hannibal came up with an idea of encircling the Romans from both right and left, a Pincer Attack.
Hannibal knew his soldiers and their weaknesses and capabilities very well. The Carthagian army was made up of warriors from all over the world:
- 8,000 strong core group of Libyans and Africans who had been with Hannibal for a long time. They wore Roman armour.
- 8,000 Iberians (Spaniards) who fought with cutting and thrusting swords and javelins. They used large oval shields for protection.
- 16,000 Gauls who carried long slashing swords and small oval shields.
- 8,000 skirmishers who wore light armor and used long range weapons like javelins, bows and slings. Their main aim (like present day Artillery) was to disrupt the enemy line by long range attacks and cause casualties even before the battle began. Once the battle began, the skirmishers would usually fall back and let the heavy infantry go forward. Knowing this, Hannibal ordered his cavalry to attack and kill the skirmishers first when they arrived behind the Roman army.
Hannibal also knew that his Spanish and Gallic infantry were not as strong and battle hardened as his African unit, but they were still much larger in number (24k vs 8k). So, he decided to form a thick line with Spanish and Gallic in the center and kept the African infantry on the two sides. Their job was to perform the pincer attack from the Roman right and left when the cavalry reached the Roman rear.
He further ordered his central line to advance and meet the Roman center first, in an Echelon or more specifically a V-formation (used by fighter jet squadrons). This had three purposes:
- As the battle began, the center would slowly begin falling back and drawing the Roman center into the semi-circle thus formed.
- Because the fight would have already started in the center, Romans would also not be able to notice the two African divisions behind on the right and left.
- This would give time to the Carthagian cavalry to defeat the Roman cavalry on the right and left flanks and then attack behind the Roman center.
Cavalry planning:
To ensure that his cavalry would be able to quickly destroy the Roman cavalry, he gave his commander Hasdrubal on the left, 2/3rd of his cavalry (6,500), and Hanno on the right was made in charge of the Numidian light cavalry which was 3,500 in number. While Hanno's light cavalry would hold off half the Roman cavalry, Hasdrubal would destroy the other half on the left and then circle round and attack the Roman cavalry on the right from behind. After finishing them off, the combined cavalry would attack the Roman infantry center from behind.
The framework for one of the greatest planned battles in human history had been laid. Hannibal was going to turn his enemy's greatest strength into their biggest weakness.
Stand in the eye of the storm and coordinate
When the battle began, Hannibal himself led the the center formed by the Gallic and Spanish infantry to an advance and tackled the Romans first. They bore the brunt of the Roman attack. Many soldiers were getting killed as they went head on against the strong Roman infantry charge. But being there himself, Hannibal was able to motivate his soldiers and control them to a coordinated retreat. As the central line kept falling back, the initial V-formation changed to a crescent.
In the meantime, the strong Carthagian cavalry was completely destroying the Roman flanks. As planned, they first finished off the left and then the right flanks and then attacked he Roman skirmishers from behind.
Hannibal now sprang the trap that he had laid. He ordered his battle hardened African troops (who had stayed out of the battle until now) to attack the Romans from the two sides. Maybe Romans could not see them because of all the dust caused by the battle, or the Roman generals lacked the quick judgment to respond, nobody knows for sure, but the Roman infantry was now surrounded. Without their flanks, Roman infantry drove itself deeper and deeper into the crescent shaped alley formed by the Carthagian line. Soon, they were completely encircled and running out of space to fight.
Corner and finish
The Romans in the center were packed so close to each other that they could not move their arms or lift their weapons. Only the soldiers on the outer circumference fought and were soon killed where they stood. To cause even more confusion, Hannibal ordered his soldiers to kill all the Centurions (officers) first.
As killing so many Romans was taking a lot of time, Hannibal ordered his soldiers to cut the hamstrings of the Roman soldiers to make them incapable of fighting, and then move on. After finishing the fight, they could come back and kill them at leisure.
Result
Tens of thousands of Roman bodies were all over the battlefield when darkness brought an end to fighting. Some Roman soldiers even killed themselves by burying their own heads in the ground, to escape the pain. In all about 70,000 Roman soldiers were killed and only 14,000 managed to escape and 4,000 were taken prisoner. 600 Roman soldiers were killed every minute that day.
Paullus along with two previous consuls was killed (ironically Varro survived). 29 out of 48 military tribunes and 80 out of 300 senators (in all) were killed in one day. Only 1 out of every 6 Roman soldiers who entered the battle, survived.
The Carthagians on the other hand only lost 16,000 men, most of them Spanish and Gallic who formed the center line.
The Battle of Cannae was the costliest battle in human history uptil then. It still ranks as the second most costly formation battle in human history.
Aftermath
Even though Rome was in complete disarray after Cannae, Hannibal didn't attack and lay siege to Rome. This maybe because he believed that Rome still had significant resources, and also because of his experience from his first battle when he laid siege to Saguntum (refer the introduction to the Battle of Trebia). He was criticized by many in his camp for not taking this opportunity and destroying the Romans completely. But Hannibal's objective of fighting might not have been destruction of Rome, but to dishearten it and force it into a moderate peace agreement.
Hannibal sent a delegation to Rome to propose a peace treaty on moderate terms, but the Roman Senate refused to talk. Instead they mobilized their entire male population and started raising new armies. The word 'peace' was prohibited on the streets of Rome and only women were allowed to cry in public.
At last they had learnt their lesson. Instead of fighting head-on with Hannibal, they went back to attrition strategies of Fabius. In the meantime, the Oligarchy in Carthage was growing more and more jealous of Hannibal, his achievements and his growing popularity. After a few years of maneuvering around Italy, they refused to send Hannibal reinforcements, and Hannibal was forced to pull back.
Hannibal's story
The rest of Hannibal's life story is sad. Even after such huge victories and with unrivaled strategic genius, Hannibal could not carry on winning, because of lack of support from home and loss of most of his good soldiers (either dead or tired from fighting). In 202Bc, fourteen years after Cannae, Hannibal with a much weaker army was finally defeated at the Battle of Zama by Scipio Africanus. The Second Punic War ended with the battle of Zama, and Carthage conceded defeat.
After the war ended, Hannibal tried to become a statesman and was also appointed the Chief Magistrate because of his popularity. But the oligarchy in Carthage were still jealous of him. When the Romans demanded that Hannibal surrender, Hannibal knew that the oligarchy would not support him. He decided to go into a self imposed exile. He offered his services to King Antiochus III of Syria and then the king of Phoenicia.
But the Romans were determined to hunt him down, and in the end one king (Prusias I of Bithymia) agreed to give him up. Determined not to ever fall into the hands of Romans, and to keep the promise he had made to his father on his deathbed (to fight the Romans till death), Hannibal took the poison he always carried with him (in his ring). Hannibal died in 183BC at the age of 64.
Thursday, 24 July 2008
Great Generals: Hannibal takes on Rome - II , Battle of Lake Trasimene
Previous: Battle of Trebia
After the defeat at Trebia the Roman Senate was shocked. The reality of someone crossing the mountains and attacking them from the North was something they couldn't grasp. But still, they continued to underestimate Hannibal's strength (which wasn't just in numbers). The Senate decided to sack Sempronius (the defeated general of the previous battle) and brought in two new consuls: Gnaeus Servillius Geminius and Gaius Flaminius. Servillius was given charge of Scipio's army and Flaminius was made in charge of whatever was left of Sempronius's defeated army.
The job for Flaminius was to protect the city of Rome and prevent Hannibal from reaching the city. So he hurried his army back from Trebia towards Rome. But Hannibal followed him even faster and eventually overtook him. And before Flaminius could try to hurry back again, Hannibal cut him off using the first recorded Turning Movement in history. Hannibal's plan was to lure Flaminius into battle before he could reach Rome or receive help from Servillius. He started rampaging the countryside to provoke Flaminius. He hoped that destroying the very land that Flaminius was sent to protect will entice him into battle. And so it happened...
Flaminius like Sempronius was a rash and arrogant general. Even though all his advisers suggested that he only send his cavalry to temporarily stop Hannibal and wait for the other consul to arrive, Flaminius decided to take him on.
Meanwhile, Hannibal had come across a road that was bordered on one side by a Lake and hills on the other. In his eyes, this was the perfect place for an large-scale ambush.
Here is the Map of the area in the north of Lake Trasimene where Hannibal placed his trap. The waters of the lake have receded a little now, and so there is more space now between the hills and the lake than there was at that time.
View Larger Map
In the cover of the night, Hannibal placed his cavalry and Gallic infantry in the hills where Romans would be entering the valley from. Their job was to suddenly attack the Romans from the left and close the way back. He hid his light troops along the hills all the way to Tuoro Hill. Finally, he himself stood with his heavy infantry on top of a slight elevation where Romans could see them. He also asked his soldiers to light massive campfires on Tuoro Hill at night, so that the Romans would imagine that he's far away.

The next morning, in the fog, when Romans started approaching the road from the West, Hannibal's trap was set. To further entice Flaminius, he sent a skirmish force ahead to start fighting and then retreat to lure the Romans deeper into the valley (and into his trap).
As soon as the Roman army entered the valley, Hannibal's cavalry crashed down upon them from the hills and closed the road behind them. Now the Romans were surrounded from all sides, with their backs to the lake. The battle started even before they had time to draw up their battle lines. The Roman army was split into three parts, the west, center and the east.
Hannibal's army quickly destroyed the west flank, and heavy infantry led by Hannibal crushed the east flank. Now the Roman center was exposed to attack from all sides. They fought for about three hours but the whole Roman army was completely annihilated.
Off the 40,000 soldiers that the Roman army had in the morning, 30,000 were either killed (by the afternoon) or drowned in the lake. A few soldiers who escaped were later captured by Hannibal's brother Mahirbal the next day. Flaminius himself didn't live to regret his decisions and leadership on that day. The massacre was so intense that the soldiers didn't even notice that an earthquake occurred that morning...
Compare Roman losses to those of Hannibal's forces who lost only 1,500 soldiers out of their original strength of 50,000.
Hannibal had now planned and executed the greatest ambush in history. But this was still not his best...
After the shock of another huge defeat, Romans first gave dictatorial powers to Fabius Maximus. Fabius was smarter than the other consuls before him, and knew that going head-to-head with Hannibal was a mistake. He implemented his 'Fabian Strategy' where he avoided direct battles and tried to wear Hannibal down by harassing him.

But the Roman people and the Senate didn't have the patience to keep this up. They again removed Fabius and got two new consuls Paullus and Varro. These two would lead Romans to their biggest defeat ever - at Cannae...
Image Sources: Google Maps, Department of History, United States Military Academy.
Update: Others in the series: Battle of Trebia, Battle of Cannae
After the defeat at Trebia the Roman Senate was shocked. The reality of someone crossing the mountains and attacking them from the North was something they couldn't grasp. But still, they continued to underestimate Hannibal's strength (which wasn't just in numbers). The Senate decided to sack Sempronius (the defeated general of the previous battle) and brought in two new consuls: Gnaeus Servillius Geminius and Gaius Flaminius. Servillius was given charge of Scipio's army and Flaminius was made in charge of whatever was left of Sempronius's defeated army.
The job for Flaminius was to protect the city of Rome and prevent Hannibal from reaching the city. So he hurried his army back from Trebia towards Rome. But Hannibal followed him even faster and eventually overtook him. And before Flaminius could try to hurry back again, Hannibal cut him off using the first recorded Turning Movement in history. Hannibal's plan was to lure Flaminius into battle before he could reach Rome or receive help from Servillius. He started rampaging the countryside to provoke Flaminius. He hoped that destroying the very land that Flaminius was sent to protect will entice him into battle. And so it happened...
Flaminius like Sempronius was a rash and arrogant general. Even though all his advisers suggested that he only send his cavalry to temporarily stop Hannibal and wait for the other consul to arrive, Flaminius decided to take him on.
Meanwhile, Hannibal had come across a road that was bordered on one side by a Lake and hills on the other. In his eyes, this was the perfect place for an large-scale ambush.
Here is the Map of the area in the north of Lake Trasimene where Hannibal placed his trap. The waters of the lake have receded a little now, and so there is more space now between the hills and the lake than there was at that time.
View Larger Map
In the cover of the night, Hannibal placed his cavalry and Gallic infantry in the hills where Romans would be entering the valley from. Their job was to suddenly attack the Romans from the left and close the way back. He hid his light troops along the hills all the way to Tuoro Hill. Finally, he himself stood with his heavy infantry on top of a slight elevation where Romans could see them. He also asked his soldiers to light massive campfires on Tuoro Hill at night, so that the Romans would imagine that he's far away.
The next morning, in the fog, when Romans started approaching the road from the West, Hannibal's trap was set. To further entice Flaminius, he sent a skirmish force ahead to start fighting and then retreat to lure the Romans deeper into the valley (and into his trap).
As soon as the Roman army entered the valley, Hannibal's cavalry crashed down upon them from the hills and closed the road behind them. Now the Romans were surrounded from all sides, with their backs to the lake. The battle started even before they had time to draw up their battle lines. The Roman army was split into three parts, the west, center and the east.
Hannibal's army quickly destroyed the west flank, and heavy infantry led by Hannibal crushed the east flank. Now the Roman center was exposed to attack from all sides. They fought for about three hours but the whole Roman army was completely annihilated.
Off the 40,000 soldiers that the Roman army had in the morning, 30,000 were either killed (by the afternoon) or drowned in the lake. A few soldiers who escaped were later captured by Hannibal's brother Mahirbal the next day. Flaminius himself didn't live to regret his decisions and leadership on that day. The massacre was so intense that the soldiers didn't even notice that an earthquake occurred that morning...
Compare Roman losses to those of Hannibal's forces who lost only 1,500 soldiers out of their original strength of 50,000.
Hannibal had now planned and executed the greatest ambush in history. But this was still not his best...
After the shock of another huge defeat, Romans first gave dictatorial powers to Fabius Maximus. Fabius was smarter than the other consuls before him, and knew that going head-to-head with Hannibal was a mistake. He implemented his 'Fabian Strategy' where he avoided direct battles and tried to wear Hannibal down by harassing him.
But the Roman people and the Senate didn't have the patience to keep this up. They again removed Fabius and got two new consuls Paullus and Varro. These two would lead Romans to their biggest defeat ever - at Cannae...
Image Sources: Google Maps, Department of History, United States Military Academy.
Update: Others in the series: Battle of Trebia, Battle of Cannae
Tuesday, 8 July 2008
Pride and the Search for Happiness
What are you proud of? When your boss looks down upon you, or when a boy/girl you like treats you badly, or when a group you identify with is disrespected, or someone completely unknown shouts at you on the street, why is it that you are hurt? I feel bad in such situations, but when I honestly ask myself, 'what am I so proud of', I don't have any answers for myself.
What is so special in me that gives me a right to get upset when I am disrespected or not loved? Why does it hurt so much?
Religions tell us we are special in the eyes of God, or there is an essence, something special within us that makes us and our lives special. Are they sure? Even it is true, it is just a reason, an explanation for a feeling we had since we were kids and didn't know anything about God or Religion, a feeling we have always had.
If not, am I proud of those little achievements I have made in life. The achievements are mostly relative to other people around me. does that mean that if not for those people, I wouldn't have any pride. But I was still proud, even before I did any of those things. These so called "achievements" are just re-affirmations of the pride I have always had.
This pride or self-respect (maybe a better term), I have always carried with myself as long as I can remember. When something good happened or I succeeded in something, it became stronger and I felt confident and happy. When I lost, or thought that I was rejected, I felt hurt and sad. It was difficult for me to understand why my happiness was so dependent on what other people thought and did. Why did I have to prove myself to so many people? Why did I have to be approved of in order to be happy? I never understood...
The pain and happiness caused by this pride, was simple to deal with when I was a kid, but as I grew up, the effect of these somehow became stronger. Or maybe I started feeling it more. So, I came up with many ways to deal with it in my mind (many times without knowing). Some of them were:
1. Rationalize: When someone says something bad, I started thinking that they didn't actually say anything bad about me, but about how I did things. So if I do things differently, they would come to like/respect me again. So, I tried to change and went back again and again. This does work sometimes, but sometimes it takes you in the wrong direction. I had gotten too attached to getting approval and love rather than doing things right. As you learn in life, some people really do hate you, and no matter what you do, you can't change their minds.
Another way to Rationalize, is to think that there is something wrong not with me, but with the other person. So, fuck them. This is the next stage of frustration. If you don't care about other people, they can't hurt you right. A morphed version of this is when you only care about good opinions of yourself, start thinking that everyone else is wrong and is a loser. Now, its easy to see why this can be bad. Even people like Presidents suffer with this problem.
2. Don't push yourself: Don't get too involved, don't trust anyone completely, and stay away from any kind of commitment. So, in the end if you fail, and anyone criticizes you (or you criticize yourself), you have an excuse. You can tell yourself that you didn't give your all - if you had, you would have done much better. You remain mediocre forever, but hey atleast you know you could have done much better right. And so, your status or position in society does not reflect the real you. So, you are free to live in your own world. As you don't recognize what the world says about you, you can be free from requiring their approval.
A corollary of this approach is to run away as soon as things start to look bad. Bail out before you get hurt. Ditch the other person, the other job, before they get a chance to ditch you. The problem with this approach is that, you usually end up with nothing at all, because there are hard times in every relationship and every work.
3. Push yourself too hard: The opposite method also works. If you are really hurting, get involved in something and don't let yourself think about anything else. Shut your mind, keep doing something unless it gets back in. Its not that you have to enjoy what you are doing, but just keep doing it all the time. To hell with sleep, food, friends, life... In the end when you cross your limits, you are so exhausted that you begin to hate the very thing that you once enjoyed. You think you are working hard, or giving your best, but in reality you are just scared and running away from yourself.
4. Hedge your commitments: Another way of go around disappointment is to do 10 things at the same time. So, if you loose in some of them, you still have others. So have two girlfriends, and three jobs. This may work well for some time, but if either of those girlfriends or bosses find out that you are not committing everything, you risk loosing both of them.
You could be honest with them from the beginning, but then neither you nor they will be happy without a full commitment. You will have to start lying to atleast some of them. The issue of commitment will come up again and again until the relationships become bitter. Very few people are able to successfully pull this off.
5. Take pills, drink, eat food, or watch TV all day long: Do anything you can to forget about your hurting insides. You won't be hurt by things, events and people around you if you are not aware of them right. You have an addiction, even better... you don't have to force yourself any more. Accept that you can't fight with yourself and what you feel like doing and just do it. The only problem is, when you are not drunk, high or feeding the addiction, your pride and your heart hurts even more. Now to make yourself forget, you have to drink, eat or watch even more... and it never stops...
Why don't any of these methods work and why are they usually wrong? I don't think there is a clear answer to this question. But I'll give you some of the answers that I got...
I think that's because they are the 'easy ways out'. The best thing to do when you fear your pride being hurt is to take a moment and think what is the hardest (or atleast harder) thing for you to do at that moment. And do the hard thing. Face the fear and once it is all over, you will come out feeling better yourself. Results might not be as you expected, but atleast you were better than you expected.
In the end, the root of all pride or self-confidence, is the feeling of being alive, the feeling of existence of 'I'. The essence of being alive, is an inherent tendency in all living things to independent, to rebel against nature and to carve one's own path. At its roots, Life is the fight between will and circumstances. And pride comes from this feeling of independence. All other kinds of supposed pride are just complications on top of this, that arise from ego, arrogance, and most of it just imagination. But this basic happiness of being, is at the core of every thought, it is the proof of our existence.
So, we must keep on living, keep on fighting, and do the hard things. Pride is hurt not because someone treats us bad, but because we take the easy way of feeling bad at that instant, we take pity on ourselves.
I am still looking for answers to these questions, but I guess I am truly myself when I make the tough choices.
What is so special in me that gives me a right to get upset when I am disrespected or not loved? Why does it hurt so much?
Religions tell us we are special in the eyes of God, or there is an essence, something special within us that makes us and our lives special. Are they sure? Even it is true, it is just a reason, an explanation for a feeling we had since we were kids and didn't know anything about God or Religion, a feeling we have always had.
If not, am I proud of those little achievements I have made in life. The achievements are mostly relative to other people around me. does that mean that if not for those people, I wouldn't have any pride. But I was still proud, even before I did any of those things. These so called "achievements" are just re-affirmations of the pride I have always had.
This pride or self-respect (maybe a better term), I have always carried with myself as long as I can remember. When something good happened or I succeeded in something, it became stronger and I felt confident and happy. When I lost, or thought that I was rejected, I felt hurt and sad. It was difficult for me to understand why my happiness was so dependent on what other people thought and did. Why did I have to prove myself to so many people? Why did I have to be approved of in order to be happy? I never understood...
The pain and happiness caused by this pride, was simple to deal with when I was a kid, but as I grew up, the effect of these somehow became stronger. Or maybe I started feeling it more. So, I came up with many ways to deal with it in my mind (many times without knowing). Some of them were:
1. Rationalize: When someone says something bad, I started thinking that they didn't actually say anything bad about me, but about how I did things. So if I do things differently, they would come to like/respect me again. So, I tried to change and went back again and again. This does work sometimes, but sometimes it takes you in the wrong direction. I had gotten too attached to getting approval and love rather than doing things right. As you learn in life, some people really do hate you, and no matter what you do, you can't change their minds.
Another way to Rationalize, is to think that there is something wrong not with me, but with the other person. So, fuck them. This is the next stage of frustration. If you don't care about other people, they can't hurt you right. A morphed version of this is when you only care about good opinions of yourself, start thinking that everyone else is wrong and is a loser. Now, its easy to see why this can be bad. Even people like Presidents suffer with this problem.
2. Don't push yourself: Don't get too involved, don't trust anyone completely, and stay away from any kind of commitment. So, in the end if you fail, and anyone criticizes you (or you criticize yourself), you have an excuse. You can tell yourself that you didn't give your all - if you had, you would have done much better. You remain mediocre forever, but hey atleast you know you could have done much better right. And so, your status or position in society does not reflect the real you. So, you are free to live in your own world. As you don't recognize what the world says about you, you can be free from requiring their approval.
A corollary of this approach is to run away as soon as things start to look bad. Bail out before you get hurt. Ditch the other person, the other job, before they get a chance to ditch you. The problem with this approach is that, you usually end up with nothing at all, because there are hard times in every relationship and every work.
3. Push yourself too hard: The opposite method also works. If you are really hurting, get involved in something and don't let yourself think about anything else. Shut your mind, keep doing something unless it gets back in. Its not that you have to enjoy what you are doing, but just keep doing it all the time. To hell with sleep, food, friends, life... In the end when you cross your limits, you are so exhausted that you begin to hate the very thing that you once enjoyed. You think you are working hard, or giving your best, but in reality you are just scared and running away from yourself.
4. Hedge your commitments: Another way of go around disappointment is to do 10 things at the same time. So, if you loose in some of them, you still have others. So have two girlfriends, and three jobs. This may work well for some time, but if either of those girlfriends or bosses find out that you are not committing everything, you risk loosing both of them.
You could be honest with them from the beginning, but then neither you nor they will be happy without a full commitment. You will have to start lying to atleast some of them. The issue of commitment will come up again and again until the relationships become bitter. Very few people are able to successfully pull this off.
5. Take pills, drink, eat food, or watch TV all day long: Do anything you can to forget about your hurting insides. You won't be hurt by things, events and people around you if you are not aware of them right. You have an addiction, even better... you don't have to force yourself any more. Accept that you can't fight with yourself and what you feel like doing and just do it. The only problem is, when you are not drunk, high or feeding the addiction, your pride and your heart hurts even more. Now to make yourself forget, you have to drink, eat or watch even more... and it never stops...
Why don't any of these methods work and why are they usually wrong? I don't think there is a clear answer to this question. But I'll give you some of the answers that I got...
I think that's because they are the 'easy ways out'. The best thing to do when you fear your pride being hurt is to take a moment and think what is the hardest (or atleast harder) thing for you to do at that moment. And do the hard thing. Face the fear and once it is all over, you will come out feeling better yourself. Results might not be as you expected, but atleast you were better than you expected.
In the end, the root of all pride or self-confidence, is the feeling of being alive, the feeling of existence of 'I'. The essence of being alive, is an inherent tendency in all living things to independent, to rebel against nature and to carve one's own path. At its roots, Life is the fight between will and circumstances. And pride comes from this feeling of independence. All other kinds of supposed pride are just complications on top of this, that arise from ego, arrogance, and most of it just imagination. But this basic happiness of being, is at the core of every thought, it is the proof of our existence.
So, we must keep on living, keep on fighting, and do the hard things. Pride is hurt not because someone treats us bad, but because we take the easy way of feeling bad at that instant, we take pity on ourselves.
I am still looking for answers to these questions, but I guess I am truly myself when I make the tough choices.
Subscribe to:
Posts (Atom)




