Programing
IGMH mobile/web app open for testing/usage
by Nashath Rafeeq on Aug.30, 2012, under News, Programing
It was one of those rare quiet morning in office (touch wood) when Naail @kudanai (http://www.kudanai.com/) pinged me about a interesting problem he had. He asked me for suggestion on scraping IGMH doctors duty roster from this ancient looking aspx page. At the time he had google app engine app and He was attempting at the time to use YQL to rangle the data out of the page as the page was being served out of a non standard port on the server wich appengine did not like.
I suggested to him to port the app over to django proper and move the whole application over to my server. To this end we ported app over to django added some fancy (ie: stupid) caching so that we dont kill the poor server we were scraping the data from front end is built on jquerytouch and compass. API stubs are also available to any one who want to get some some sane looking data for their own apps. For access ping Naail or me (@NashRafeeg).
To to try it out for yourselves, visit: http://igmh.dot.my
For those of you more technically inclined
The Backend is
* Nginx
* Django with FastCGI
* Mechanize
* Beautiful Soup
Front End is powered by Jquerytouch and Compass
For how we got started on this endeavor hit up http://www.kudanai.com/2012/08/igmh-mobileweb-app-open-for-testingusage.html
How to list cron jobs of all the users
by Nashath Rafeeq on Nov.18, 2011, under cool, Programing
while I was doing some server maintenance for a customer last night it required that i find out what cron jobs were in the cron tabs of all the users on the machine. I found this handy script that will list out all the cron jobs for all the users
[sourcecode language='sh']
#!/bin/bash
for user in $(cut -f1 -d: /etc/passwd)
do echo $user && crontab -u $user -l
echo ” ”
done
[/sourcecode]
Gource: An VCS visualization system
by Nashath Rafeeq on Nov.01, 2011, under cool, Music, Programing
Leave a Comment :CG, Ideas, Programing, SVN, Web more...Reddit URL Harvester
by Nashath Rafeeq on Mar.31, 2011, under cool, Programing
I was browsing Reddit and I stumbled upon a small sub-reddit at /r/Earthporn this small conner of Reddit had higres pictures of earth scenery. From there i was directed to /r/CityPorn, /r/SpacePorn , /r/MachinePorn, /r/AnimalPorn and /r/BotanicalPorn all HD pic. This got me thinking since i am lazy as fuck i did not want to spend every day going through six sub-reddit download and save them the best way to do is to automate the process.
In order to download the images the first thing that needed to be down was to harvest the urls from the sub-reddits home page. I could have gone and screen scraped with beautiful soup but reddit provides this nifty feature where by if you append .json to end of a url eg http://www.reddit.com/r/earthporn/.json it will return the json file for the corresponding page with posts and urls and other data (also if you append .xml it will return and XML file with the pages data ). This allows me to skip all the dirty crud of passing html of a constenly changing page. Below is the version 0.0.1 of URL harvester code.
(continue reading…)
Printing 1 to 1000 without loop or conditionals
by Nashath Rafeeq on Jan.03, 2011, under Programing
Print numbers from 1 to 1000 without using any loop or conditional statements.
#include <iostream>
template<int N>
struct NumberGeneration{
static void out(std::ostream& os)
{
NumberGeneration<N-1>::out(os);
os << N << std::endl;
}
};
template<>
struct NumberGeneration<1>{
static void out(std::ostream& os)
{
os << 1 << std::endl;
}
};
int main(){
NumberGeneration<1000>::out(std::cout);
}
PHP variable variables; “variable variable takes the value of a variable and treats that as the name of a variable”. Also, variable.
by Nashath Rafeeq on Oct.19, 2010, under Programing
this is only the entrance of the rabbit hole.
If you understand what this expression really does, you realize that you’re gazing upon the entrance to R’lyeh.Do you think you don’t need your soul anymore? If you do, follow me into the lair of the Elder Gods. But be warned, you will die a lot inside.The first thing to understand is what $ is. $ is actually a shorthand for ${} and means “return the value of the variable whose name is contained in this”.That variable name is a string.
A bare word is a PHP string. Let that sink for a second, because we’ll come back to it later: $foo really is the concatenation of $ the variable-indirection character (think *foo) and foo which is a string. foo === "foo" in PHP, even though in raw source code you’ll probably get a warning. If those are enabled.
JavaZone Trailer
by Nashath Rafeeq on Jun.26, 2010, under Art, cool, Programing
The Future: Argumented Reality
by Nashath Rafeeq on Feb.14, 2010, under cool, Programing
This is the new set up that is being rolled out all lego stores around the world. Imagine this technology coming to wireless contact lenses that that can project images in wearers field of vision. Imagine a world where
- Bookstores will have the top 5 reviews hover above any book you take off the shelf
- Showing relationship status above our heads so we can date new people.
- system will analyze body language of another so the socially awkward will receive cues on how to better communicate with the opposite sex.
- Show what song you are currently listening too
- See how many calories something has before you eat it
- Be aware of the average crime rate of the area you are in by the color of the road.
- And australian spiders will finally have health bars,
- being able to watch tv from any where with images filling up whole feild of vision
we truly live in the future
Reddit clone in ASM
by Nashath Rafeeq on Feb.10, 2010, under cool, Programing
2,382 Comments :asm, cool, Programing, reddit more...Facebook has rewritten the PHP runtime from scratch
by Nashath Rafeeq on Jan.31, 2010, under Programing
It seems the rumors that php being rewritten by facebook seems true. A new open source project that is going to be released by them come this tuesday. The unofficial word is that it is some sort of compiler for php and some poor soul has been hacking away trying to implement it for past one year and it is rumored to have reduced the cpu usage by 80%.
This is pretty significant numbers if its true. For most of the webapps the performance issues are going to be on the network latency and DB rather than the script engine but with a 80% reduction is cpu time means the page can be chuged out 400% faster dramatically reducing the hardware costs. with user numbers in 100′s of millions for facebook even 1% gain in performance will save them a chunk of change.
Every one of you know how much a evagilist i am when it comes to python while no where fast as .net or Java it can pretty much wipe the floor with every day venilla php in performance numbers, especially with Mod_wsgi or fast_cgi implemented. Facebook with thousands of man hours invested in their code base they cannot just up and switch to another language with out major cost or headaches. So they have done the next best thing changed the internals of the tired old donkey they being riding around so that its rocket powered so that it can run with the Lamborghini’s.



