Friday, July 13, 2007
Namespaces for PHP
Thursday, July 05, 2007
Project Euler
Here is the solution to one of the problems
How Many Lychrel Numbers are below 10,000 ? http://projecteuler.net/index.php?section=problems&id=55
my solution in python, which takes abt 39 seconds:-
def lychrel(x):
i = 0
while i < 50:
x += int(str(x)[::-1])
if str(x) == str(x)[::-1]:
return False
i += 1
return True
print len ([x for x in range(1,10000) if lychrel(x)])
Saturday, May 26, 2007
Microsoft Popfly
The site is in alpha, and there are definitely some issues that I have come across. But the UI is amazing, it works with firefox ( big plus ! ).
I will be messing around with this and see what mashups I can come up with. Please feel free to add me as a friend ( http://www.popfly.ms/users/Kashif ) and I will post invites for users as soon as I get them :)
Sunday, May 06, 2007
Vice Funds
Now for anyone who still reads this would you invest in it ? Abhi , I think I already know your answer :)
Saturday, February 24, 2007
Roman Numeral Converter
In this challenge, you will be given a number in roman numeral form and must print out its integer value.
( from codegolf)
My latest solution at 129 bytes:-
r,l,s={'M':1000,'D':500,'C':100,'L':50,'X':10,'V':5,'I':1},1000,0
for j in raw_input():s+=r[j]-(0,l*2)[r[j]>l];l=r[j]
print s
Any other ideas ?
Update:
After manzo's comment, I searched a little and came up with this. Right now its at 119 bytes
r,l,s=dict(M=1000,D=500,C=100,L=50,X=10,V=5,I=1),1000,0
for j in raw_input():s+=r[j]-(0,l*2)[r[j]>l];l=r[j]
print s
Saturday, January 06, 2007
Colors for Visual Studio
This is what my current setting looks like:-
Any ideas for the colors of the html tag names other than white ?
Friday, December 08, 2006
Codegolf
The challenge in question:-
The game of REVERSE requires you to arrange a list of numbers in numerical order from left to right. To move, you tell the computer how many numbers (counting from the left) to reverse. For example, if the current list is
2 3 4 5 1 6 7 8 9 and you reverse 4, the result will be 5 4 3 2 1 6 7 8 9. Now if you reverse 5, you win.What we're asking you to do is, given a list of numbers in a random order, produce the moves required to arrange them so they end up in numerical order.
(from codegolf.com)
Now Ive been working on this for a couple of hours and the best I can come up with is this ( My language of choice, python):-
[UPDATE #1]: File Size - 181kb
1) Changed the while loop condition
2)A different way of printing, by adding a comma after the last object one can suppress the new line that is automatically added by print in python
3)Removing unnecessary indentation helped on the file size
4)Didnt need the strip function
import re,sys
n = map(int,re.split(" ",sys.stdin.readline()))
l = len(n)
while l:
m = n.index(max(n[0:l])) + 1
n[:m] = n[m-1::-1]
n[:l] = n[l-1::-1]
print m,l,
l -= 1
[ORIGINAL]
import re,sys
n = map(int,re.split(" ",str(sys.stdin.readline()).strip()))
l = len(n)
while n != sorted(n):
m = n.index(max(n[0:l])) + 1
n[:m] = n[m-1::-1]
n[:l] = n[l-1::-1]
print m,"\n",l
l -= 1
the algorithm works in the following way:-
given a list, get its length
find the index of the maximum value within it, do a reverse from 0 to the index, so now the max is in front (and the move being the index + 1)
then do a reverse again on the length of the list , bringing the max to the end of the list (now the move after that being the length of the list)
decrease the length, so you iterate over a smaller list and repeat the same steps on the smaller section of the list
Anyone have anymore ideas to make this shorter ( either the program itself or the algorithm ) ?
Saturday, December 02, 2006
Thursday, October 05, 2006
Cant argue with this
Saturday, September 23, 2006
Learning Python
I am sure everyone who took COSC 2320 with Dr. Anderson remembers the word count program. Well after going through some of the tutorials of python here is the same program in python
Not only is it smaller, but its also easier to understand. Hopefully more to follow
import re
import string
#dictionary to store words and their counts
word_count = {}
#read in text document line by line
for line in open("trial.txt").readlines():
#remove leading and trailing whitespace
line = string.strip(line)
#split the string into words
#based on whitespace, punctuation, digits
for word in re.split("["+string.whitespace+string.punctuation+string.digits+"]",line):
#make the word lower case
word = string.lower(word)
#check if it is actually a word
if re.match("^["+string.lowercase+"]+$",word):
#increment count if true
if word_count.has_key(word):
word_count[word]+=1
#else add entry
else:
word_count[word] = 1
for w in word_count:
print w, ":" ,word_count[w]
Edit: Some more playing around
import re
import string
word_count = {}
text = open("trial.txt").read();
#list of words delimited by whitespace, punctuation and digits
#iterate by words in returned list from split
#lower case all the words in the text
words = re.split("["+string.whitespace+string.punctuation+string.digits+"]",string.lower(text))
#go through the list
for i in range(0,len(words)-1):
#as long as the word in the list is a word and is not already a key
if re.match("^["+string.lowercase+"]+$",words[i]) and not word_count.has_key(words[i]):
#add to the dictionary and get the count from the list
word_count[words[i]] = words.count(words[i])
for w in word_count:
print w,":",word_count[w]
Thursday, August 31, 2006
Friday, August 25, 2006
Friday, June 16, 2006
Struts so far has been awesome
Tuesday, May 30, 2006
Lets see here
Michael awakens and finding himself in the most awkward position ever ( you have to hear the story from him for the full effect )
Awesome Career Fair
We all passed OS ( this one was too close )
PGH 547 is being remodelled ( and not the way we thought it would be, this one not so much of a highlist )
Completing the SE project 30 minutes before the demo
At the moment this is all that I remember , and good luck to everyone who will be starting their internship tomorrow.
Tuesday, May 23, 2006
Tuesday, April 25, 2006
Thursday, April 13, 2006
Tuesday, April 04, 2006
Oldest Account
Whats your oldest account and do you still use it ?
OS
I beat you to it abhi lol
Saturday, April 01, 2006
Tuesday, March 14, 2006
Finally
Sunday, March 12, 2006
Eclipse + PHP
Windows -> Preferences -> PHPeclipse -> PHP, then select the Typing tab and uncheck the two options to enable closing of quotes
Wednesday, March 08, 2006
CodeIgniter
Replacing the library with this code is another issue, but it was done real quick
Have a go at it here ==> CodeIgniter
Monday, February 27, 2006
How people find this site
will kashif and i get into a big fight today? (Google) ==> this one had me laughing, is it you shey ?? lol j/k
"Kashif Deniro" (Google)
DirectShow Syllabus (AltaVista) ==> people still use AV ???
Thursday, February 23, 2006
Googlefasting
Conclusion: You can stay away from their services like mail, maps, but when it comes to search it is very difficult to replace Google. Maybe if Yahoo improves on its mindset feature switching could be a little more easier.
Wednesday, February 22, 2006
CougarCS Career Fair
Shey where are the pics ??
Monday, February 06, 2006
Monday, January 23, 2006
Interesting Article
Twenty percent of U.S. college students graduating from 4-year colleges don't have the skills to handle tasks like estimating whether their car has enough gas, or calculating the total cost of ordering office supplies, a new study has found.
Thursday, January 19, 2006
No School Friday
Friday, January 06, 2006
More MSN 8.0 Invites
Saturday, December 31, 2005
Tuesday, December 20, 2005
MSN Messenger 8.0 Invites
Update: All gone, as soon as I get more Ill post em here.
Thursday, December 15, 2005
So fresh, so clean clean
I have also switched from AVG to Avast because after some research I found that Avast has better detection rates and its real time scanning is quite powerful
btw long what did shon do ?
Monday, December 12, 2005
Its Over !!!
Hurricane Rita screwing up thing like nobody imagined.
15 ppl in one elevator going for the arch exam
the rent a coder cheating scandal
more than 12 hours worth of coding for the multimedia mid term !!
The architecture debacle ..... ( everyone who was in the class knows what Im talking about )
Anyone have other stories worth mentioning ?
Sunday, December 04, 2005
Wednesday, November 30, 2005
Bloglines Alternative
Monday, November 28, 2005
Can you ..
Friday, November 25, 2005
Monday, November 21, 2005
New AT&T logo
Looks more like a creme savers to me now
Sunday, November 20, 2005
Sun Java Studio Creator
Friday, November 18, 2005
Friday, November 04, 2005
Monday, October 31, 2005
Wednesday, October 26, 2005
I also have 2 more wordpress.com invites to giveaway, so you know what to do.
Saturday, October 15, 2005
Tuesday, October 11, 2005
Friday, October 07, 2005
What a waste !!!!
Monday, September 26, 2005
Most of us know about FREE blog hosting provided by wordpress.com . I was lucky enough to get an invite today . So far the interface is amazing and is really simple to use.
Now I also happen to have 1 invite to give away. The person to get is the one who leaves the best comment at to what they would do with their wordpress.com blog :)
UPDATE: I will be emailing the lucky winner the invite tomorrow.
Saturday, September 24, 2005
Finally some sunshine
Friday, September 16, 2005
Thursday, September 15, 2005
UPDATE: A good tutorial http://cui.unige.ch/DI/cours/1804/GNU%20Prolog%20manual.html
Monday, September 12, 2005
In other news I have moved all my pictures from textamerica to flickr.
Thursday, August 18, 2005
Lets see what other features are going to be packed in.
Monday, August 15, 2005
Remove register_globals completely
Remove magic_quotes_*
Remove safe_mode
Remove some stuff that has been marked deprecated since PHP 3/4
Remove various function aliases
One thing is for sure, this means people will have to change their code radically in order for it to work on php 6.0 .....
Should be interesting to see how things shape up
http://shiflett.org/archive/135
Friday, August 05, 2005
Monday, July 25, 2005
First thing that comes across is the load speed, it definitely kicks google out of the water, even though im pretty sure their servers must be loaded since they just launched. Another aspect that stands out is the smooth scrolling, another +1 for virtual earth.
They have also included some features such as "locate me":- ( cant say much since both google and microsoft cant find my house and simply give me the map of houston ), "scratch pad":- which remembers all the places you searched for and also keeps track of where you last left off using cookies.
MSN maps is brilliant, though I dont see myself completely switching to either service I will surely be using them both side by side while comparing the results.
Sunday, July 24, 2005
Saturday, July 23, 2005
I think its safe to say the general rule of thumb when it comes to deciding when to use what is use single quotes when outputting plain strings and html with no variables since the PHP parser wont have to look for variable, and use double quotes when there are variables, special characters, symbols .
Here is a nice PHP benchmarking site http://www.blueshoes.org/phpBench.php
Monday, July 18, 2005
Thursday, July 14, 2005
Friday, July 08, 2005
These are the intersections that it is currently showing ( If you would like to see more, leave me a comment :) ):-
I-10 at Heights.
I-10 at TC Jester.
I-610 West Loop at Bellaire Blvd.
I-610 West Loop at Beechnut
I-45 at Cross Timbers.
I-45 at Tidwell .
I-45 at Little York.
59 at Hillcroft.
59 at Weslayan.
59 at Shepherd
59 at Beechnut.
Please let me know if there are any improvement that I can make to it. If there are other intersections that you would like to see you can visit the Houston Transtar and drop me a line at kashif-khan at excite dot com.
Saturday, July 02, 2005
http://www.tipmonkies.com/2005/05/12/use-gmail-as-a-personal-organizer/
Thursday, June 30, 2005
Anywho, this will surely lead to some amazing applications using the power of AJAX
Friday, June 24, 2005
Friday, June 03, 2005
http://phpsec.org/projects/guide/
Friday, May 27, 2005
http://www.phpfreaks.com/tutorials/52/0.php
PHP Freaks
Monday, May 23, 2005
* Satellite images with 45-degree-angle views of buildings and neighborhoods
* Satellite images with street map overlays
* Ability to add local data layers, such as showing local businesses or restaurants
From the screenshots the image quality is definitely awesome. Hopefully they have updated their maps, since google maps still cannot locate my house. Impressive stuff !!
Tuesday, May 17, 2005
As for other news, the semester is over and I have been busy adding features to my blog at f2o.org . I just recently added a rss feed for the sucker and am distributing it using feedburner, so lets see how that turns out.
Oh yes, the Sony Playstation looks awesome
http://www.engadget.com/entry/1234000620043567/
Monday, May 02, 2005
Sunday, April 24, 2005
Monday, April 18, 2005
Sunday, April 17, 2005
Class descripton:
Have you ever wished you know more about programming your smart phone, your web camera, your VCR, or your Tablet PC. Have you ever noticed that computing has slipped away from the desktop and even from the laptop and has gone ubiquitous? Do you know that 'gadget computing' is the fastest growing area in our tech sector and where most of the new computing jobs are created? If your answer is yes to all the above, you like 'cool programming,' and you have an affection for 'bluetooth,' then you are perfect candidate for the "Multimedia Programming" class offered in fall 2005.
Syllabus
Component Object Modeling (COM)
Microsoft DirectShow SDK
Video and audio programming and applications
Programming and applications of serial devices
Embedded Visual C++ and Pocket PC
PDA programming and applications
Smart phone SDK
Cell phone programming and applications
Tablet PC SDK
Programming and applications of Tablet PC
Sure does sound exciting !!
Wednesday, April 13, 2005
Tuesday, April 05, 2005
You can demo it here http://kashif.dotgeek.org/YahooImage.php
Saturday, April 02, 2005
Thursday, March 31, 2005
Wednesday, March 30, 2005
Click the picture for a better view.
what I also dont like about it is the type of input data it needs to return an answer
mixed date_sunrise ( int timestamp [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]] )other than that little "rant" I think PHP 5 is definitely a major step from 4.0
.
Wednesday, March 23, 2005
I decided to implement something with the new yahoo api, and I decided to go with a simple spell checker. Now I coming across a little problem with this, yahoo only provides spelling suggestions if it can actually find something with that query, so that you can query with the correction. If it cant , no spelling suggestions are offered. I am hosting it here http://kashif.dotgeek.org/YahooSpellCheck.php and the source can be seen here http://kashif.dotgeek.org/YahooSpellCheck.php.txt
Can anyone offer some tips or further suggestions ?
Monday, March 21, 2005
oh and something totally random, someone came to this page after querying for this on google: " *Kashif Beattie* " .. How weird is that ??
Friday, March 11, 2005
Tuesday, March 08, 2005
Here is a screenshot(click for a better view):
Got any others ?
Monday, March 07, 2005
Sunday, March 06, 2005
Wednesday, February 23, 2005
With so much space available now, how hard would it be for Apple to incorporate video playing capabilities to the next generation of ipods . I definitely think that will be one of the key features , especially with all the video on demand services going around these days.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
Monday, February 21, 2005
Sunday, February 20, 2005
UPDATE: since f2o.org is down at the moment I have also uploaded the script at this location http://www2.cs.uh.edu/~kkhan/houston_traffic.txt
Friday, February 18, 2005
in my opinion - Unbelievably Ridiculous
Thursday, February 17, 2005
Monday, February 14, 2005
Now I think one of the major fixes would be the whole rebuilding of the site whenever you edit anything. Its okay if you have a small blog, but couple of hundred posts and you could be sitting for quite a while before all the changes take place. And thats if you are lucky and dont suffer a time out in between, in which case you are stuck with partially working site. Something should be done about that so that it is more dynamic.
End of rebuilding rant
Friday, February 11, 2005
For people looking for rss feeds for xanga users , this is the link to their feeds http://www.xanga.com/rss.aspx?user= username . Just replace username with their xanga id and it should point to their site feed. For some reason it doesnt show up on the xanga site itself.
Wednesday, February 09, 2005
Monday, February 07, 2005
Wednesday, February 02, 2005
To download Sunbird visit here
[UPDATE]: The official .2 version has come out today.
