Premshree Pillai ([info]premshree) wrote,
@ 2004-08-04 17:48:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Celebrating the self
I want to read a book that would make me happy about myself. No, don't get the wrong idea ... I am not depressed with life or anything of that sort. I don't know why, but I don't understand why I have to be surrounded by ineptitude all the time. I deserve better, don't I?

I try not to bother about things around me. Sometimes it works, but most of the times it doesn't. I want to take my mind off these things. I don't necessarily want to read something that makes me happy about myself... but I don't see another way. At least by way of shrouding myself with being happy about myself I can stop bothering about all the maladroitness that seem to perpetually surround me.

Reading a book that celebrates humanity might help.... But on second thoughts, that would kill my ego for some time ... and that's probably not a good thing.

I think I want to read something that would have the exact opposite effect of what I assume Atlas Shrugged would have. Suggestions?

In other stuff, I have been playing around with a few programming languages—to find one that would serve most of my purposes well. Today I played with Ruby. Of course, I cannot make any judgement... so soon. Anyway, to begin with, I coded yet another SMS to LiveJournal Gateway.
#################################################
#
# $sms2lj.rb$ $version 1.0.0$ <5:22 PM 8/4/2004>
# Ruby based SMS to LiveJournal gateway
#
# Copyright (C) 2004 Premshree Pillai.
# <http://premshree.livejournal.com/>
#
#################################################

require 'cgi'
require 'net/http'
require 'net/pop'

class SMS2LJ
	def initialize(lj_user, lj_password, journal, pop3_host, pop3_user, pop3_password)
		@lj_user 		= lj_user
		@lj_password	= lj_password
		@journal		= journal
		@pop3_host	= pop3_host
		@pop3_user	= pop3_user
		@pop3_password	= pop3_password
	end
	
	def httpPost(subject, content)
		h = Net::HTTP.new("www.livejournal.com", 80)
		resp, body = h.post("/interface/flat",
			"mode=" 			+ CGI.escape("postevent") 		+
			"&user=" 			+ CGI.escape(@lj_user) 			+
			"&password=" 		+ CGI.escape(@lj_password) 		+
			"&event=" 			+ CGI.escape(content) 			+
			"&lineendings="	+ CGI.escape("pc") 				+
			"&subject=" 		+ CGI.escape(subject) 			+
			"&year=" 			+ CGI.escape("#{Time.now.year}") 	+
			"&mon=" 			+ CGI.escape("#{Time.now.mon}") 	+
			"&day=" 			+ CGI.escape("#{Time.now.day}") 	+
			"&hour=" 			+ CGI.escape("#{Time.now.hour}") 	+
			"&min=" 			+ CGI.escape("#{Time.now.min}") 	+
			"&usejournal=" 		+ CGI.escape(@journal)
		)
	end
		
	def getMails
		pop = Net::POP3.new(@pop3_host)
		pop.start(@pop3_user, @pop3_password)
		if !pop.mails.empty?
			pop.each_mail do |m|
				mail 		= m.pop
				mail_lines	= mail.split(/\r\n/)
				httpPost("", mail_lines[mail_lines.length - 1])
				puts mail_lines[mail_lines.length - 1]
				m.delete
			end
		end
		pop.finish
	end
end

# LiveJournal config
LJ_USER		= "*****"
LJ_PASSWORD	= "*****"
JOURNAL		= "*****"

# POP3 config
POP3_HOST	= "*****"
POP3_USER	= "*****"
POP3_PASSWORD	= "*****"

# Sleep config
SLEEP_PERIOD 	= 10 # in seconds

obj = SMS2LJ.new(LJ_USER, LJ_PASSWORD, JOURNAL, POP3_HOST, POP3_USER, POP3_PASSWORD)
while 1
	obj.getMails
	sleep SLEEP_PERIOD
end


(Post a new comment)


[info]pickmybrains
2004-08-04 05:25 am UTC (link)
rise my son and read this one!

To Kill a Mockingbird... a great piece of work,

get transferred to small town life and the best qualities that the human spirit embodies.

(Reply to this)(Thread)


[info]premshree
2004-09-26 03:06 am UTC (link)
Through reading it. I wanta [sic] move to Alabama! :)

Wanta recommend anything else?

(Reply to this)(Parent)(Thread)


[info]pickmybrains
2004-09-27 04:14 am UTC (link)
Im glad you liked it

Give Rushdie a try!, esp The Moor's Last Sigh.

(Reply to this)(Parent)(Thread)


[info]premshree
2004-09-27 04:28 am UTC (link)
Hmm. That'll *probably* be my next read (in the queue anyways) ... after I'm done with this.

(Reply to this)(Parent)


[info]prema
2004-08-04 06:58 am UTC (link)
Jonathan Livingston Seagull (by Richard Bach) if you haven't read it yet - it's awesome. Not very dull, and definitely celebrates the self, but it's also more than that - it's about breaking barriers.

There's an e-text version here : http://www.42.dropbear.id.au/jls.html

p/s: i'd like to see a sms-to-lj gateway written as a web service ;) do you ever play with .net?

(Reply to this)(Thread)


[info]premshree
2004-08-04 07:15 am UTC (link)
... i'd like to see a sms-to-lj gateway written as a web service ;) do you ever play with .net? ...

Yes, I could ... but it won't serve much purpose (you'll have to run some piece of code from your shell anyway) ... and instead of utilizing your resources, my server would be hit at all the time.

No, I don't play with .net.

(Reply to this)(Parent)


[info]jace
2004-08-04 07:30 am UTC (link)
Read Starving in the Company of Beautiful Women by Micheal Dean. Worked to great effect for me.

(Reply to this)(Thread)


[info]premshree
2004-08-05 02:36 am UTC (link)
I love myself....

That's what I want to hear myself say!

(At first I thought that I entered a faux site. He needs to do something about it.)

(Reply to this)(Parent)(Thread)

Its ironic that I am doing this....
[info]tomlinsonian
2004-09-21 04:44 pm UTC (link)
but try Anthem.
its Rand, talks about the same sort of thing as Atlas Shrugged does.
But you'll agree that not all sad stories are saddening....
(anyway, Atticus finch has done more for mankind than Howard Roark or John Galt, so read on!)

(Reply to this)(Parent)(Thread)

Re: Its ironic that I am doing this....
[info]premshree
2004-09-22 01:22 am UTC (link)
I'm fine now, so I could even read Atlas Shrugged.

Anthem will come some day. For now I have something that promises to be good queued up.

(Reply to this)(Parent)

ruby style
[info]evan
2004-08-04 07:34 pm UTC (link)
rather than stuff all those cgi.escapes together, try making a hash of keys to values and then escape 'em all in one go.

(Reply to this)


[info]teemus
2004-08-04 10:46 pm UTC (link)
So what does Ruby take your language count to? Something like 20? :)

(Reply to this)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…