The empty member optimization
- March 7th, 2010
- Write comment
To understand the optimization, we need to understand what the empty member bloat is. Consider a class defined as:
class Foo
{
};
To understand the optimization, we need to understand what the empty member bloat is. Consider a class defined as:
class Foo
{
};
At least, as a computer science engineer, I tend to think that ‘everything should just work‘ and ‘Hmm, it is so simple that why hasn’t someone thought of it before’. Most of the time it’s about google-ing skills and knowing where and what to look for. Anyway, this post it not about that. Here’s what I wanted to do and found the perfect tools for it. I wanted to upload my pictures in flickr and access it from my own web-site. The reason? Multifold. On flickr, the storage is cheap and almost unlimited. Its also about using the community support there. On the flip side, the GUI is not snazzy. It works alright, but it’s not super presentable. All I want is presentation layer for the pictures that I have already uploaded. One way to do it is upload the pictures in your own website, but then you lose the advantages of flickr. More so, on a philosophical note, why should I upload the same pictures? Twice. (Web-development was never the best skill set that I ever possessed so, I used to copy paste flickr URL into a file on my website and render all these URL-images.) Never found time to better this until I found pixel post.
Ok, if you want results like these read on.
So, what do you do now? What you set out to do in the first place. Upload pictures on flickr and pull selective images from there on to your web-site. Simple? Yeah. Spent four hours doing it but, trust me - the sense of accomplishment was immense. Enough chatter, now lets get on with business.
As a matter of fact, thanks to pixelpost, importr, yui, jquery, flickr and every technology that makes it work. (Though, it did come with some effort, hopefully, it gets better from here). Thank you, again. And, for the rest who want to set it up like I did, good luck.
Random facts
Exceptions offer an elegant to roll up error state to the caller. Thank heavens we can do away with setjmp and longjmps. Mind you, exceptions are expensive (unwinding the stack is!) Use return code to handle error state, if need be. Yes, it’s not the easiest way to to trickle up an error.
Think about transactionality of the call. Does your function offer basic or strong safety or is it exception neutral? The standard containers require this by contract|function signature in all case. Here’s a pessimistic discussion about why we cannot rely on exceptions to make our software more robust. Years later, here’s a follow up, by Petru on how we can write ‘hard-working’ code to ensure atomicity and exception-safety by the RAI-idiom.
Not that there were enough data-types in C already? Some arguments why a simple C++ class wouldn’t replace a bool. Here’s a discussion about alternative implementation for a type safe boolean, ranging from #defines, const int, enums to to what not?! After all these, we stop wondering?!
vim - is definetly more powerful than I actually assumed. After you have basic stuff out of the way, here are a few things that you want to setup before working with large projects.
Tabs , cscope, marks, mouse, key mapping
Of course, all of this and more comes for free with eclipse, visual studio, etc. Oh, I forget they are IDEs and take five years to load.
Of course, I’ll post more when I configure my vi.
Hail, vi!
Use the same procedure here. Instead of the chilly powder use - one spoon of pepper powder and three green chillies.
Oh, yeah - you’ll love ‘em. Andra Style
1) garam masala two spoons
2) chicken masala two spoon
3) dhaniya powder two spoons
4) chilly powder two spoons
5) grated coconut - one spoon
6) Ginger garlic paste one spoon
7) salt (to taste)
onions - two
9 )tomatoes - half? [I use 3-4 spoons from the diced tomatoes can]
chicken - 1.5-2lbs
Preparation:
i. Cut the onions
ii. Put (1) through (9) in a mixer to make a paste
iii. Defrost the chicken
iv. Cut the chicken
v. Boil the chicken with just a little water in a cooker - until it seems cooked. [The chicken will begin to sweat - it will “yield” water]
Now you have “almost” cooked chicken and beautiful paste that you made in step ii.
vi. Put the paste in the cooker with the chicken. Add water to the paste to make it a gravy to desired “density”.
vii. Pressure cook it - for a single whistle. You don’t want more than one whistle because it chicken is already cooked. Ideally, you should get the gravy depending on how much water you’ve added in the first place, right?
You might want to add salt to taste, but it should do if you used the proportion that I mentioned.
I’ll post a picture in the coming posts.
It was a hot day, close to 100F. I want to say cloudless but, that wasn’t true. Anyway, it was desert for as far as I could see. Lone standing rocks as if they were kept there on pupose or, as if someone had forgotten to get it out of the way. At the distance, looking at the colour of the rocks, you would tend to think the rocks are burning, trust me, they were.
I spent the whole afternoon driving around - rested at the Double arch for a while. Under the arch is the only shelter you would find in the piercing heat. The Delicate Arch was the big one everyone talked about. It is almost a symbol of Utah. (Wonder why everything is called an Arch?) I bet you have seen it somewhere! The walk to Delicate arch, if I remember right was close to 1.5miles from the road. I thought it was off-season at Arches, yet I couldn’t get parking to walk the trail. Disappointing. There was an Delicate Arch View trail a few miles down the road. It was a far-side view of the arch, across the valley. The valley was breath taking. Are you the types who is afraid of heights? Good luck looking down.
This was my base station. Small town in Grand County, Ut with a population of five thousand (may be?) - two hours from Grand Junction. I had booked a room at a hostel in the city. I was apprehensive about staying here, but it turned out to be one of my luckier decisions. Great people , very helpful. They helped me plan the rest of the trip. It was an ideal place to stay because, it was ten minutes from Arches National Park and thirty minutes Canyonlands. There are a plenitude of activities that you engage yourself with: sky diving, whitewater rafting, mountain biking. Oh, by the way, did I forget to mention? - it is an outdoorsy place!