Coherent Blah's

Recently in Others Category

For some time now, the smarties at citicards.com have written some oh-so-cool javascript on their front page that stops it from loading well in Firefox or Konquerer , at least not without disabling Javascript. I can understand a mistake or two here and there, but the frontpage? That also for months? What are those folks thinking!!
Here is how it looks on Konquerer after loading.
Citicard_b.jpg

There are two workarounds.
1. Disable Javascript while visiting citicards.com. Lame!!
2. Instead of citicards.com, use https://www.accountonline.com/. It's the real site that's used behind citicards.com. If you login to citicards.com, you will get forwarded to https://www.accountonline.com/. By going to that site directly, you bypass the front page, and the great browser-independent Javascript.

Also, call Citicards, and tell them you'll close your account if they don't fix it ASAP



Apparently Tata Nano doesn't hold the World's Cheapest Car status anymore. There is a new kid in the block, and it's electric. Thus, the issue of pollution on crowded Indian roads is moot, though the question of the transport infrastructure being able to support it remains.
 
Tara Tiny is here.
From the report:
The Tata Nano is no longer the world's cheapest car! Jostling along with Tata Nano, this July, will be Tara Tiny and Tara Titu. These are zero emission, electric cars and cost only Rs 99,000! And they come from the Tara International stable.

Although I haven't done the calculation myself, this seems very interesting:

"Now, people are driving fuel cars at an average of Rs 6 per km. One can drive our cars at 40 paise per km."

Specifications are here:
Specifications of Tara Tiny are as follows:

  • No of seats: 4
  • Net weight: 850 kg
  • Wheel base: 2150 mm
  • Maximum speed: 50 km/hour
  • Maximum grade ability: 15%
  • Motor power: 3 kw
  • Battery voltage: 6V*10
  • Recharge duration: 8 hours
  • Driving charge: 120 km
  • Ground clearance: 150/mm
  • Running cost: 40 p/km
  • Battery capacity: 200/Ah

  • One of my friends was asking me about developmental milestones of children. I normally refer to AAP for this. A search showed they are strewn all over the page, but sometimes we need them consolidated. So, here is the list:

    Developmental Milestones of Children as per AAP:
    1. One Month
    2. Three Months
    3. Four to Seven Months
    4. Eight to Twelve Months
    5. Two years
    6. Three to Four Years
    7. Four to Five years

    I was at WalMart a week back to change my Car battery. While they were having at it, I had nothing else to do except checking out the aisles...
    ...and of course, getting hit by the folks of Quixtar and its variants. "Sir, are you from Chennai?", "I have met you somewhere", "Do you know where I can find flash memory", "Is this thing any good?", "You work for Cisco, right?". I can probably list fifteen more such taglines.
    The only thing that I can think of is, do these guys have a life? Think about it... on a nice weekend, instead of spending time with family, or watching a good movie, or changing your car battery (;-)), you are hitting on strangers in Walmart/Sears trying to scam them up!! I can understand if you are homeless or broke, but most of these guys are with a decent job, earning a decent salary. Think guys think!! Will you ever stop making a fool of yourselves?

    A nice article on what is Multi Level Marketing wand why it's doomed is HERE. Please read this, and get a life!!

    I was planning on re-shuffling my Cable TV channel subscriptions to save a few bucks, and just happened to open my Cable TV bill from Comcast. Towards the very end, I see a 17.99$ charge for "Service Call Charge". Hmmph!!! What is that? A 17.99$ service should be a reasonably good "service". At the very least, I expect it not to be an invisible service!!
    I connected to their Online Chat service, and in about 15/20 minutes, after being told I'm behind 68 other people (C'mon guys, it's day after Christmas, you should be fighting hangover and enjoying gifts, not chatting with Comcast? Get a LIFE!!!), I get to connect to a very helpful Mark. Here is how the conversation went (abridged):

    user JohnDoe has entered room
    analyst Mark has entered room

    Mark> Hello JohnDoe, Thank you for contacting Comcast Live Chat Support. My name is Mark. Please give me one moment to review your information.
    Mark> Good Day, Thank you for giving us the opportunity to assist you today, I will be more than glad to clear any doubts or troubles you may have, feel free to ask anything you need, How are you today?
    JohnDoe> I'm good, how about u?
    JohnDoe> In my latest bill, I see a 17.99 charge for "Service Call Charge". What is this?

    Mark> I am really sorry, I understand this situation may cause you a lot of inconvenience, I promise I'll do all I can to solve this situation for you the best I can.for security reasons may I please have your account number, the name on the account and the last four digits of the Social Security Number?
    JohnDoe> Yes, XXX-XX-XXX-XXXXXXX
    JohnDoe> that's the acct number.

    Mark> Perfect! thanks for the information, one moment please.
    Mark> Thanks for the information I have located this charge type was generated due to a service order, it should have been a trouble call, this is an error, I will gladly remove this  charge from your bill.
    JohnDoe> Thanks.
    JohnDoe> How come it was added to my account? What kind of calls cause this charge?

    Mark> Thanks to you JohnDoe for letting us know, I have applied a credit to your account in the amount of $17.99 You should see this credit on your billing statement within two billing cycles.
    Mark> Well its nothing related to phone calls you do, its for when a technician drops you a visit.
    Mark> the reason for the tech going to your address is why the charge is generated
    Mark> for example, a tech wont charge for service orders, but will charge for a trouble call.
    JohnDoe> But there was no technician scheduled, or no-one was here. How come the charge showed up?
    Mark> Yes precisely there was no order processed, therefore we removed it.
    JohnDoe> Do you think such errors are possible in future? Do you expect me to check every bill I get for such mistakes?
    Mark> I will record the account about this matter to avoid problems in a later future.
    JohnDoe> Thank you.
    Mark> I really hope I was helpful to you, is there something else I can help you with?
    JohnDoe> No that'll be all. Merry Christmas and a Happy New Year.

    Duh!!!
    I pointed out this SlashDot article to a friend, and his question was, isn't 1$/watt too expensive?

    My response:

    $1/watt is not like your electricity meter. It's the cost of the panel that can produce one watt.

    For example:
    Amazon Solar Panel for 80$

    So, a 15 watt panel costs 80 bucks. that'd be 5.33 bucks per watt.

    For example, my monthly usage is 1000 kwh. Assuming I use electricity uniformly, that would mean, for 30 days (720 hours), I use 1000kw. So, my load will be 1000,000/720 = 1388watt on average per hour. Round it off to 1.5kw

    So, If I want to use a solar panel, I'd need a 4.5 kw panel (assuming I get full sunlight only for 8 hours a day). That'd cost me 24k for just the panel.

    I paid 200$ for electricity in the 1000kwh month. So, to recover my cost, it'd take me 10 years (just for the solar panel, I'm not talking about battery and other equipments here). My solar panel will be near end-of-life in that many years. Plus, solar panels never give full wattage. That's just the best case scenario.

    Now, if I have a 1$/watt panel, I get it back in (4500/200)=22.5 months. Now that'd make a lot of sense. Even if I get it back in, say, 5 years, and the solar panels are made to last, say, 15 years, you'd save about 24k.  Nice!!

    I had some posts in my older blog that I think is worth retaining. Here are the cut-pasted ones:

    Post 1

    Memory leaks and GDB

    I cooked up this nice nice nice trick to detect memory corruption using gdb. It needs two things. libc compiled with -g option, and statically linked to your program... so that you can step into the malloc/free functions of libc and still do source level debugging.
    The idea is, gdb allows you to run a set of gdb commands or a gdb script when a breakpoint is hit. :help commands on gdb prompt gives the following output:
    (gdb) help commands
    Set commands to be executed when a breakpoint is hit.Give breakpoint number as argument after "commands".With no argument, the targeted breakpoint is the last one set.The commands themselves follow starting on the next line.Type a line containing "end" to indicate the end of them.Give "silent" as the first line to make the breakpoint silent; then no output is printed when it is hit, except what the commands print.
    So, you can potentially set breakpoints at two locations, end of malloc routine, and beginning of free routine. For malloc breakpoint, set the commands as the following (replace r, size as the malloc return pointer and size passed to malloc respectively):
    silent
    printf "Malloc-ed %x %d\n",r,size
    continue
    end
    For free breakpoint, set the commands as the following (replace ptr with the pointer passed to free)
    silent
    printf "Free-ed %x\n",ptr
    continue
    end
    After this, just continue/run the program, and you will get an output like this:
    Free-ed 8102000
    Malloc-ed 80fbc38 132
    Malloc-ed 80fbd38 132
    Malloc-ed 80fbe00 132
    Malloc-ed bfbff790 2
    Malloc-ed 80baa8a 15
    Free-ed 80d4160
    Free-ed 80d4150
    Malloc-ed 80d4105 4096
    Malloc-ed 80d4105 4096
    Free-ed 8103000
    Malloc-ed 80d4105 4096
    Malloc-ed 80d4105 4096
    Free-ed 8103000
    Free-ed 8105000
    Free-ed 8104000
    Malloc-ed 80d3080 4096
    Free-ed 8103000

    This is a crude example of the trick, but you can extend it by writing perl scripts to parse the output, adding backtrace to the output so that you can catch the non-freed memory. Comes in handy in a system which does not have tools like dmalloc/mmalloc ported, but has libc source that can be compiled and statically linked.

    Post 2:

    Designated Initializers

    Was having a discussion at work about designated initializers in C. A designated initializer is where you use the name of a structure element to initialize it. Something like:
    struct s {
             int a;
             char b;
             char c; };

    struct s s1 = {
        .a = 1,
        .c = 'a',
        .b = 'z'
        };
    The advantages are:
    1. You can initialize them in any order, and the compiler takes care of the rest.
    2. There is no chance of you introducing a bug by swapping locations of two elements. On the same note, if someone introduces a new element to the structure, it doesn't have to be initialized by everybody who uses the structure, and won't mess up the ordering.
    3. Elements that are not initialized will get initialized to 0 or NULL based on its type. So, you won't have to explicitly initialize them.
    4. Code is much more readeable and greppable.
       We realized that this was not a standard according to C89, but gcc started supporting it as an extension. Finally in C99, this was standardized.
     
    Post 3

    Makefile duh!!
    Today I faced a strange Makefile issue with gmake. Assume the makefile as:

    %.x %.z:
        echo "$(@) $(suffix $(@))"
    all:a.x a.z

    According to gmake manual:
    Similar commands work for all the targets. The commands do not need to be absolutely identical, since the automatic variable `$@' can be used to substitute the particular target to be remade into the commands (see section Automatic Variables). For example:
    bigoutput littleoutput : text.g
          generate text.g -$(subst output,,$@) > $@

    is equivalent to
    bigoutput : text.g
          generate text.g -big > bigoutput
    littleoutput : text.g
          generate text.g -little > littleoutput


    So, I expected my makefile to generate:
    echo "a.x .x"
    a.x .x
    echo "a.z .z"
    a.z .z
    But instead it generates
    echo "a.x .x"
    a.x .x
    and ignores the a.z rule.

    The problem happens to be that gmake does not really extend an implicit rule to multiple rules, so, after executing it once, it decides to not execute it again.

    The solution to this is to use static pattern based rules. Using that, the makefile will look like the following that will solve the problem:

    a.x a.z:a.%:
        echo $(@)

    all:a.x a.z

    About this Archive

    This page is a archive of recent entries in the Others category.

    Linux is the previous category.

    Technology is the next category.

    Find recent content on the main index or look in the archives to find all content.