Browsing the blog archives for July, 2008.

Infra Recorder

tech

Infra Recorder is a free, open-source (GPL) CD/DVD burning app (sadly, only on Windows).
http://infrarecorder.sourceforge.net

I haven’t tried burning DVDs but CDs work just fine.

(BTW, I came across this while I was downloading the Ubuntu live disk)

Add the first comment

Ruby private class method

programming

The following is just so I can remember it… You need not read all this.

In Java, if you need a class whose constructor is private – so you can’t instantiate it from anywhere else, you’d do:

public class AClass {
  private int a;
  private AClass(int a){
    super();
    this.a = a;
  }

In Ruby, it’s a bit different. The why will come later (dynamic language), but just hiding the initialize method is not enough. You can still create an object coz you are actually calling the new method:

irb(main):001:0> class AClass
irb(main):002:1>   attr_reader :a
irb(main):003:1>   private
irb(main):004:1>   def initialize(a)
irb(main):005:2>     @a = a
irb(main):006:2>     end
irb(main):007:1>   def some_other_method
irb(main):008:2>     "ha"
irb(main):009:2>     end
irb(main):010:1>   end
=> nil
irb(main):011:0> obj = AClass.new(100)
=> #<aclass :0xb75768c4 @a=100>
irb(main):012:0> obj.a
=> 100
irb(main):013:0> obj.some_other_method
NoMethodError: private method `some_other_method' called for #</aclass><aclass :0xb75768c4 @a=100>
        from (irb):13
        from :0
irb(main):014:0>

You’d have to hide the new method:

class AClass
  attr_reader :a
  def initialize(a)
    @a = a
  end
  def self.test
    "test"
  end
  private_class_method :test
end

puts AClass.test

That shows:

test.rb:12: private method `test' called for AClass:Class (NoMethodError)

3 Comments

zembly super!!!

on life, programming

Ok Ok Ok… I’ve not been posting regularly. Mostly a fault of companies like BMW, Nintendo and Amazon…

Yeah, so since my last blog, I got a BMW 3-series, an Amazon Kindle (as a gift, that too!) and a Wii. So life’s been busy… driving, reading new stuff and playing fun games! Oh and the introduction of a new person… who keeps me, let’s say, engaged? :-)

So all that and stuff like what-I’m-going-to-write-about now is basically what is keeping me from writing more blogs… Believe me, I hardly get to stop a think a moment nowadays… Time’s just flying… what with nice increase in office work too. Thank God I like it – I would have stopped coming to office otherwise. No, really!

So I have turned to micro-blogging… Don’t get me worng, I love to write here… but where’s the time? So I turned to twitter recently. If you haven’t seen that yet – try it out – it’s the latest fad. Like sms-ing and blogging… It’s called Twitting! I mean it – go to twitter right now and see the demo video. It’s cool… and as most people believe, it’s the future… of smsing/blogging/mailing all-in-one.

So if you still wanna see my updates – whatever handful you are anyway – get on to twitter and find me (arnab_deka) and follow me. I’ll still continue to write blogs, but they will be rare – like this.

So today I came across this new shiny thing called zembly.

I think I blogged about : http://heroku.com/ The first online IDE I saw… but that won’t interest most of you as it was only for RubyOnRails.

Look at the new zembly: http://zembly.com/

Visual-coding in Javascript in a nice IDE (read Visual Studio, but much nicer, AJAXy and with lots less errors. AND FREE!).

and the IDE is online! Get APIs for free (like, from, Yahoo, Google, Amazon, Flickr etc.) and publish your WebService/idget/app for free! Quick and easy…

Here’s a Hello-world type WebService I created (I should say it created for me – it was so damn easy):
http://zembly.com/things/a7085d0638fb4ec799379ab499eefe71;exec?

and put your name in and see:
http://zembly.com/things/a7085d0638fb4ec799379ab499eefe71;exec?name=[your%20name%20here]

Never thought it would be so easy to craete a web-service! :-)

BTW, they are open for beta users now – check it out, it’s nice…

2 Comments
Newer Posts »