Showing posts with label twiiter. Show all posts
Showing posts with label twiiter. Show all posts

Tuesday, January 13, 2009

ReeTweet : My First PHP/AIR/Twitter ...thing

Well, I am in 3-2 now (thats, IIIyr IIsem ) and its high time that I decided I go "deep", following one of the many paths open to me in the computer field. I can say I am marginally good in many things. Although its "many" its still marginally, I can make a simple webpage for myself, make a poster or two, edit some photos, write some codes, edit videos, mix audio, animate stuff in flash, do some DB management etc.. but nothing did I go too deep where I could actually say I am VERY good at.

My interesting in web-developing started back when I was a 12yr old making websites with flash navigation bars, but it stopped there, afterwards 10th class etc started and it was only curricular learning, extra-curricular things only involved "fun" :P

And seeing that I am very much interested in internet related developments, I thought that it would be better if I did something to expand my knowledge in this field.. So one fine day I asked @aalaap for some suggestions and after hearing what exactly I wanted to do, he suggested I learn PHP, and directed me to a nice learning place for beginners.

And I don't know why, just 5 Days ago it hit me that I should try out Adobe Air too (knew nothing about it till today) and just downloaded the SDK and stuff.

Lets fast forward to today, which after THIS happened, and also when I really started feeling that I should just have one small dabba with me using which I can just keep posting to twitter, not using a browser, so that I dont waste time stalking the timeline :P

So, I set my goal this morning (first "my" day of the holidays) to finally sit and see this Air thing and learn some PHP.

HelloWorld

So, I started off the day by reading how I could make my first "HelloWorld" app in Air. As I read on, I realized that the Air is really awesome! I dont know if there are already things like this, but its basically like having a browser window of your own! You just write HTML things like you would usually do for it to appear in a browser, and then you point that HTML file as the source for your app, and then Air creates a window showing that HTML page, making it look like its a standalone App.(FYI uses Webkit engine)

Pretty good it is! This technique of doing things compliments my forte very much!

So, I kept doing things from that HelloWord tutorial and within no time I had it successfully working.. no hitches or anything :D After doing that, I immediately shifted my attention to PHP

Monkeys are your best friend.

You have your code monkeys, greasemonkeys, lab monkeys, and lots more, @aalaap directed me to this "webmonkey.com" which has good resources and tuts for beginners and experts alike.

So I made my way to that place and then started reading the PHP for beginners tutorial. Everything is basically like just any other programming language you've learnt in the past, so learning that part was not that hard. The main thing was knowing exactly how things work, the way communication between HTML and PHP things happen and all that.

And once again, the way PHP and HTML work together seems like MAGIC, i.e compliments my interests :D

After reading the whole article, ( which I say should be THE way anyone should write tuts! ) I did a bit of experiments with Air and PHP.

Now comes Twitter!

So, after making myself comfortable with how all things work. I started looking at how the twitter API works.. its basically just updating a RSS feed. So I started looking up on how I access and update feeds using PHP, and webmonkey lead me to THIS place.

It has links to things that people have already done to use Twitter API, using different platforms. The main aim here is "Dont re-invent the wheel"

I.E. Rather than sitting and writing those codes of lines again just take them from others who are sharing it.. but this, if you're a beginner, stunts your knowledge..so what I did was just sit lookup all the methods and variables that the person used in his small code by going to PHP.net and tried to figure out what how it was working.

After spending a good amount of time I was comfortable with what all of it meant and what was exactly happening. I also realized that there is a looooooot more to learn.. its the just the beginning.

Here comes ReeTweet!

After observing everything, I finally started making the application. I just used the code provided there in the TwitterAPI Wiki, and then added forms in my HelloWorld HTML.

The first build I made had only Username and Password dabbas, along with the tweet area. Basically not much work was needed to be put into it. Just make your text areas, give them ids, POST the values to the PHP script and then update the twitter.com/statuses/update.xml using cURL commands.

So here is the Box you've all been waiting for!

So simple, is it not?

So, after a few hours of reading and trying out various things, I was finally able to get the thing done in the same day!

First I thought only email id can be sent for the authentication so tweeted that.. then I tried using my Userid instead. It works both ways! :D



It echo()s these lines of text after submitting, I guess I can use the information and then render a nice page after submit :D

Afterwards, I realized that there was no point in using the userid and password, as this was something I created for myself.. so made the simple dabba I was talking about :D



So, yeah thats how I am leaving it for today.. will see more next time.

My app Link is where?

One of the main things that I wanted was that I will get "from ReeTweet" whenever I make the post.. I used to think that it was a parameter in the XML file that I should be updating in order to give the name and link.. but after looking around a bit.. it turns out that .. inorder to get "from app" and make it link to someplace, you must "File a request" and it has many constraints set.

It was very discouraging :( I dont see why they should do that, I mean, make it possible via some xml parameters and people who make things can show it.. I dont see how it can be "abused" linking to something there is similar to linking something in your tweet. Well, I guess its them being on the safe side, or maybe doing that to have an "exhaustive" list of all the apps that people are making.

I just hope that after I finish working on the thing I can get permission to mention my app :P

So what's next?

Well there's LOT of stuff to be done! I didnt take any security measures, and neither did I make more "personalized" here is a small list of things I want to do.

  • Look around about what security measure should be taken
  • Go back to main page after successfully posting!! (right now have to restart the app :P )
  • Add script to show remaining characters.
  • AJAXify IT!!
  • Make my own icon
  • Make a nice BG
  • Show @replies in another tab
  • Count number of tweets in current session and show
Well thats only a start, I just hope I learn a lot of things doing that :D

Final Thoughts

There is no guarantee that I will be doing web development in my future, as in, job.. but for the moment, I am loving and will keep doing it till..well.. circumstances force me to do something else... I wouldn't be sad if it had something to game programming :P (comfortable with designing algorithms there too :D )

And as for AIR, I have to say! Its far far FAR better than me having to make those swings/jFrames applets in java, this feels so natural to me, and very comfortable with it! Swings and all feel so scary when you look at them, and doing this in Air is... just so ME.

So.. yeah, thats it about what I did today, Now I will look into where I should go next to learn more about PHP, the exhaustive lists and everything at PHP.net are a bit scary :S

Monday, January 12, 2009

Reetesh's Scheduling Algorithm

Note: Well, no matter how silly/incoherent/unnecesary this felt when I typed, I finally gatehred the strength to post it..

Everyone has stacks of work queued up with them.. and you do them in some order or the other. But it is very important to note that the environment you do your work in, should be such that it compliments your work and method.

Not too long ago, I was happy sitting doing my things and flowing along with the time. I always had notes and a small notice board filled with things that I had to do (on the computer), With not much problem I used to achieve those tasks. But recently, those notes have been piling up and that board hasn't been erased since ages.

The problem here is that, there have been only two processes running when I come home and sit on the computer..

  • Process A : AKA System Idle process, wander aimlessly in social sites and Reading RSS feeds
  • Process B :Help someone with some problem.
Process A

These things have various threads which keep happening in a round robin fashion.. I look at the RSS feeds and read for sometime, then go to twitter and stalk a little, then go to forums and help some one, check my scraps and reply to the doubts, the cycle repeats.

The Blog news sites keep putting news for hits, I get suckered into reading everything because of my thirst for.. well, anything that happens in my areas of interest (One big goal of having a huge encyclopaedia in me head). So that keeps giving new things to read once the cycle is over, then people on twitter keep tweeting and there are so many people with common interests that keeps me watching, to see if they found something interesting that I could probably make use of.. that is another never ending process.

Then there is the forum thing where you periodically go and keep checking if the person asking the question to which you replied has answered back or not..

In this way, time gets wasted, so obviously this way of round robin-ing all these process is a very bad thing to do. Socializing and having connections with people is good, but one should never go overboard.

Process B

Basically, there is nothing wrong in helping others, I actually love seeing that what I know is helping in making others' life easier. But the thing here is that, since the past few months it has gone to such lengths that I get daily 1hr+ phone calls, chatting for an hour (altleast) and then roaming in the forums for another few hours .

The main culprit here is me ofcourse, I can choose to say "I am short on time" or "have to do something else", but I just can't say that, and then again there is thing that, I have my chat clients ALWAYS on, so anyone looking for help instead of googling will ask me first, because.. well, there is a good chance I would know how to help.

The main reason I go online (not invisible) on these things is because, I've been getting calls from people/relatives saying they haven't seen me since so long, etc etc..(all that mushy stuff) giving me a feeling of "loosing your friends". So that the social tie is tied tightly once I go and stay online.

But thats basically "asking for it" Once you go online you are sure to be bombarded with even more people and waste a few cycles there.

What Happened?

Simply put, I got the proverbial "kick in the nuts" all that information junkie-ness finally proved fatal and it went to such an extent that I lost the sense of responsibility, never thinking about things I should actually be getting done. It was, always, the same cycle, repeating. Even sometimes when I decided firmly that

"I will play this game today"
"I will complete this task today"

I would get pings from friends or maybe a call from someone to do/help with something and then keep doing that and then after doing it, go into the system idle process and waste the remaining time.

How bad was it? Simply put, I completed only 13 games last year, compared to 23 from 2007, and most of the 2008 games were rather, short.

This was at its peak in the past three months, with even movie/anime/game activity being close to 0 so you can forget about "learning/studies" etc. And day before yesterday I got my "kick in the nuts" by failing to pass an exam by 2 Qs (which I openly accept, could have prepared more for, even though I did the minimum required preparation)

As they say.. "Its all fun and games until someone looses an eye"

Well, I guess you require something BIG to happen so that you get back intoright track and start doing things the right way...

So... What now?

Well, I guess its time for a CHANGE, and what kind of change?

Everytime I remember this saying from a good friend of mine "Life is all about getting your priorities straight" I always loved that sentence, wanted to follow it, never felt it was that necessary, but I guess it IS now.

So , shifting from my Round Robin ways with no priorities at all.. now on I will be having a very highly prioritized method of scheduling my tasks.

I have plans to learn and do a lot by the time this semester ends, so I guess its time to get my other kind of knowledge's fill and do it in a right manner. Everyday will have its own fresh board/page and will do those first, and only then go to my feeds/twitter etc..

  • WONT start my day with "Lets see whats the latest news at kotaku"
  • Will not keep stalking my timeline on twitter.
  • Apply appropriate Stealth settings on Chat clients
  • Remove all Social Apps from Startup
  • Do atleast one thing that you WANT to do.. not what you HAVE to.
  • Learn to say "NO"
They might sound cheesy and all, but yeah, thats what I am aiming for.. ofcourse at first I will try to completely be away from everything so that I can later manage having limited exposure to them.

Will it work?

You have no idea how many edits, cuts, and modifications this post has gone.. I was going to NOT post this thing at all.. just like 100s of other things that go through my head, but I finally decided that I will make this post and let all my friends know, so that, atleast they will keep me kicking back on the right track.. i.e not just @sadaarjun and @PhaniPS :P

Just writing this is like overcoming a huge hurdle...

----
Comment on twitter

Basically, most of the people in there are people either working or.. well, not in college like me.. I mean the people with as much activity as mine. All those @SathyaBhat s and @b50 s spamming timelines are happily tweeting along from their office computers when they have nothing else to do...its bad, to try and replicate that part of them :P Its better me, as a student, utilise that time for something better :P

I guess I finally understand the on again, off again, moods of @preshit and also why @xubz has disappeared.@QuizMaster seems to be doing fine.. but has been less active recently because of the exams.. well, just hope @Rockstar_sid and @pcsbox dont get too carried away. @karthiksn seems to be in a similar System Idle process situation though..

Tracking..

In the end, will be tracking my own progress via twitter and blog activity.. let us just see if something happens after I post this thing... I dont want it turn out like all those other times when you get serious and think of doing something but endup being overwhelmed by the wretched System Idle Process.