Monday, October 30, 2006

Installing YAWS

So, I'm trying to play around with the ErlyWeb framework written by Yariv using the Erl programming language. 

For OSX Tiger there are a few things you have to install. 

I tried doing a full install from source for YAWS 1.65 but it crapped out at the last stage, so then I tried the darwinports method and it sseems to have finished without error.

This is what you have to do to setup YAWS to launch automagically via launchd during startup. 
###########################################################
# A startup item has been generated that will aid in
# starting yaws with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.yaws.plist
########################################################### 

Wednesday, October 25, 2006

Cats and Subcats

Problems:

Categories, Subcategories and each subcat has ads posted under it. The vanilla app side code supplied is too shoddy to use in a production app. Rails makes 100 SELECTs every frikking time the page gets loaded. EVERY TIME. Then, after getting all those objects, it puts it into a list and does an array.size ... OMFG!!!

anyhoo, this is what I did, put the sql in a script and have it run every 15 minutes or so. Why? because it is a general sense that the users need. Not an exact number.


-- set the total ads per "SUBCATEGORY" in the categories table

begin transaction;

update categories set ads_count=(select count(*) from ads a where a.category_id = categories.id);

commit;

-- Get totals of the ad counts for each main category ("topdogs")
select name, ads_count , (select sum(ads_count) from categories b where b.parent_id = a.id) as totcounts from categories a where a.parent_id is null;

-- Now set the total values for the main cats by summing the ad counts for all of their
-- subcategories.

begin transaction;

update categories
set ads_count=(select sum(ads_count) from categories b where b.parent_id = categories.id)
where categories.parent_id is NULL;

commit;


just put it in a rake task and have cron run it periodically, and comment out all that 100 select per page nonsense which is not necessary.

adios!

Thursday, October 19, 2006

RMagick Part Deux - R-Men in Tights

Well, after much frikkin consternation, I was able to install RMagick by following this. I believe one of the problems was that I set gcc version to 4.0 !!! :(

So, I set it back to 3.3 and found a little bit more information (It is really SICK how frighteningly complicated and assinine the install if ImageMagick is! .. then again, I'm complaining on just installing.. think about the good people who develop it.. so.. enough bitching)

here is what you have to do on OSX Tiger I think:




  • Follow Hive Logic tutorial, put it in a shell script whatever. EXCEPT!!!... (see below)
  • After downloading the versions of Imagemagick source, do the following to configure:

    • ./configure --prefix=/usr/local CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib'
    • make
    • sudo make install (you will see some warnings, I think it is okay to ignore them)
    • gem install rmagick



NOTE: make sure you are downloading the latest versions of all the libs, HiveLogic's versions are lagging behind a bit, but it seems to have done the thing for me to the point where I was able to install the gem.

Biggest Joke EVER!

RMagick on OSX is the biggest DAMN JOKE on the face of the earth!!!!!

I just wanted to say that. Thanks.

Tuesday, October 17, 2006

Tingoo is an awesome Desi site

Shameless plug: Tingoo.Com is an awesome classifieds and Desi Forums site catering to all desis (or is it desi's, or maybe desis' ??) NRI's, people of the subcontinent, South Asia or whatever.

Anyways, enough fawning over such a great site. I really liked it (maybe because I helped develop it). because it caters to all desis and not just indians or pakistanis or bangla people etc. Its aim is to help desi people all over the world find things that they are looking for. simple things like the best dosa restaurant in the neighbourhood etc. (okay maybe the Desi Business dir (biz dir) part is not done yet, but it will be soon).

So there, I'll post more updates when we have added more thingies to it. Until then, enjoy the free classifieds and the forums (all ruby on rails baby!)

Wednesday, October 11, 2006

Installing RMagick on OSX Tiger

I ended up downloading the railsday2006 bundle from one of the sites (it is in the comments in the Railsday2006 blog article).

Now, Rails is great and all, and it makes the developers do some really nice test driven development, but one thing that escapes me is: Why don't Rails developers document their fucking applications? I am going through each of the submissions and there are about 150+ of them. Out of 20 so far, there have been maybe TWO (yes two) which bothered to put a README_FOR_APP in the doc directory. But almost 17 of those twenty had unit/integration tests written.

How is it that a developer writes up 8 files and hundreds of lines of test code, but can't do the eventual user of his/her code the courtesy of including a simple readme file?

Something is really whacked here, and I'm talking general attitudes and philosophy here.

Anyhoo, back to the topic. So I was playing around with the WeRateStuff app by the http://WeBreakStuff crowd, and one of the things is to install various gems. One of them is RMagick. Long story short, HiveLogic has an excellent writeup on their blog.

Anyhoo, Make sure you install Imagemagic 6.0 or later installed. The version in the HiveLogic article is a from the time it was written up (a bit old). My Tiger install had a 5.5.7 version already installed.

NOTE: You may have to use the following command to set the gcc to version 4.0


sudo gcc_select 4.0


UPDATE #2: Hmm.. it may not be the gcc version, and I may have to revert it back. The "make" is failing on fontconfig.h not being found. So I googled the error message and found something that indicated I may have to do a 'locate fontconfig.h' and then use the full path. There were 2 versions, one in my X11 dir and the other on /opt/local (I think Darwin ports uses that). so I used the /opt/local one because it was newer.Still not go, this time the link failed. So I did a sudo make clean and then make and lets hope this works.

This brings me to RANT NO. 2. Why can't we just have these libs built for different versions? I think it would be good, but that maybe more trouble than its worth. So prolly doing it this way is safer. Anyhoo, GCC continues.

I may have to rever to version 3.3. Lets see. It would be nice if the ./configure part figured this shit out for you. or at least aborted if the right version hadn't ben 'gcc selected'

UPDATE 3: Okay, I GIVE THE F&(K up!!! It uses RMagick, and it just won't install and the loader craps out. I guess i got to update lots of stuff.. so, this way, I guess I'll jsut stop it and not check up weratestuff

This brings me to my gripe: Why can't we turn things off in Rails apps? why can't I just say, I don't care about the images for now, just show me the site. FFS! this is so annoying.

No docs,
No configuration,
But its got tests! and fonts, if you can get the thing to work
Oh and if you want to run more than two apps? well, do two rails installs.

I don't really know why this doesn't get old with people? There is truckloads of Repitition, but no one seems to care.

What gives? Am I the crazy one? Why isn't Rails a bit more like Camping or Django?


Caveat Emptor. And thanks to Hive logic for an excellent writeup FWIW.. :)

ciao!

Sunday, October 01, 2006

James Britt Learns his lesson

B&N strikes agin! James Britt pre-ordered a book from B&N, only to see it first on the shelves, and only to be disappointed by an email from BN telling him he won't be getting it for some time. I don't blame him for sounding a bit ticked.

Way to go. I'm guessing they've shipped all their copies to their stores, so they have none left for anyone foolish enough to actually use their Web site.


This is why I NEVER EVER order chicken Teriyaki in an Italian restaurant, and Beef Yakisoba in an Indian restaurant. (Although there is one exception to it: The Butler's Pantry)

B&N in the states and its evil equivalent here in Canuckland (chindigo store monopoly) have given me enough trouble on their "online" side that I totally stopped using it. Now I use the "professionals" erm.. amazon.ca or that store in quebec. I find that amazon.ca is ALWAY.. and I mean ALWAYS on time, and gives me a better break %age wise when it comes to discounts. Also, Amazon doesn't push books in your face which seem to satisfy the political agenda's of its owners (unlike some other "bookstores" I know)

I have been ordering from amazon.ca store and I even get free shipping for orders greater than 40 bucks. For someone who spends more on books than on clothes and shoes and things of that nature, this comes in real handy. (plus you don't have to wear the book to figure out if it fits.. hehe)

Thanks Britt for reminding us yet again ... and hopefully you'll get the book soon enough. TEH WOZ has been pushing it like mad lately. which is good because I like to listen to the guy. He seems to have the energy of an excited high school nerd :)

(I mean it in a good way)