javascript meetup

Posted in Bash on June 24th, 2010 by gmunteanu

i would like to announe a javascript meetup in bucharest, at bucharest hubb , monday 28 june 2010, at 5:00 pm – 8:00 pm.

we will talk about javascript on google application engine, rhino, and javascript on the server side in general.

if you want to come, here is a page where you can confirm:

http://www.facebook.com/event.php?eid=130216580334301&ref=mf

hope you will find it interesting, and if enough people will like it, we will continue meeting on a regular basis.

altctrl not experimental any more

Posted in Bash on February 14th, 2010 by gmunteanu

now it is public, so any update through the mozilla addon website will be pushed into your firefox. according to their statistics there are many of you that are still using older versions [even 0.3]. Becoming public addon, altctrl is now updated to all users who installed it thourgh the mozilla addon website. the people that downloaded the extension from my website http://altctrl.e-forum.ro is not affected by this at all. i will keep both locations in synch from now on, so people that feel better to take it from the mozilla addon website can do that. go grab your personal price comparison tool for IT components now: https://addons.mozilla.org/en-US/firefox/addon/11290

2 apache httpd instances running on the same host

Posted in Bash on January 21st, 2010 by gmunteanu

a client of mine wanted to revert to php4, as php5 was not good for his website. i tried to convince him to migrate to a better and newer CMS, no success. the only way to make him happy was to put php4 in place.

My only solution was to place his domain on another apache instance, with libphp4.so loaded, and in lighttpd.conf to direct his domain to that apache instance.

in order to run 2 apache instances you need only to create another httpd.conf file from the existing one and change a few lines. and then with “-f” parameter you launch 2 apaches each having its own configuration file.

As you now from my older posts i have a lighty web server that acts as a proxy to the apache and jetty servers.

in lighttpd.conf i do this:

$HTTP["host"] =~ "(^|\.)DOMAINNAME\.com$" {
$HTTP["url"] =~ "\.php|\/$" {
proxy.server = ( ".php" =>
( "localhost" =>
(
"host" => "127.0.0.1",
"port" => 8094
)
),
"/" =>
( "localhost" =>
(
"host" => "127.0.0.1",
"port" => 8094
)
)

)
}
}

i copied httpd.conf to httpd_php4.conf and added/modified 4 lines:

added PidFile “/usr/local/apachephp/php4pidfile”
added LockFile “/usr/local/apachephp/php4lockfile”
modified: Listen 127.0.0.1:8094
modified: LoadModule php4_module        modules/libphp4.so

and started another apache instance that will listen on another port [8094] like this: apachectl -f /path/to/httpd_php4.conf start. if you want to stop this certain instance, or want to restart it, you add -f parameter too, say “apachectl -f /path/to/httpd_php4.conf stop”.

http://sety.ro/

lagabi.ro – apparel aggregator

Posted in Bash on January 9th, 2010 by gmunteanu

just launched http://lagabi.ro , my aggregator. it is derived from my old idea of doing a product comparison tool, but others did it while i was doing other stuff. when finally decided to launch it, i had to try another approach, and find a niche. all other product comparison sites are general, and they have the disadvantages of being generalist:

- apply same interface to all products/category of products. this is not good.

-  you can find the same intel processor in many online stores, and you can get a list with the prices they want for it. but you can’t really do that for shoes. this is why they are almost always listed with having only 1 shop as provider.

-  listing shoes in 10-15 rows per page, each row having a small image on the left , and description plus price in rest, is not good either.

- filters , same thing, cannot be adapted very much for each category of products.

so, i thought i can find a type of products that will allow me to beat them. These are shoes, clothes, bags, hats, jewelry. all  of them have image/picture as their main attribute, much more important over the others. In a processor you are interested in the specification, in a phone , if it has certain capability [though lately the look is important too], etc … .

so i gave the idea a try, and the result is http://lagabi.ro.

it is not finished. more stores and products must be added. i started with shoes and bags for women only to get some feedback, thinking this will be the most popular categories in this website.

the main features of the website are:

  • horizontal scrolling and pagination
  • big accent on the image of the product
  • filters, being able to get what you want fast

Horizontal scrolling and pagination is my biggest bet, i hope users will validate my presumption, that this is the way you want to browse apparel.

it is done in mootools, the great js library, and on the server side it uses java. Lazy initialization is used a lot, to make the interface responsive, and reduce page load times. pagination is done by first loading 16 products [8 columns], and when the user drags and goes right,another 16 are brought and showed. the colors are extracted with imagemagick’s great tool: convert.

the design is dark, i had 50/50 opinions of how it shoud be. right now it stays this way.

Hope you enjoy it, or your girlfriends as of now. as for you my male-readers, please wait a little more time.

amazon price firefox addon

Posted in Bash on September 27th, 2009 by gmunteanu

if you happen to be on a webpage where a book is mentioned and want to know its amazon price or even buy it, then this extension is for you.  it adds to the link my amazon affiliate id too, so if you feel offended then you must remove it before you paste it in your location bar. it is much lighter than altctrl, and uses amazon API to do the job.

if more books are present on the page, it takes the first one and uses it. i haven’t yet decided how to best incorporate in the user interface the other books, maybe it will be done in the next version.

you can find it here: https://addons.mozilla.org/en-US/firefox/addon/14540 .

info on altctrl :  it will be rewritten ~50% due to help from mihai mafteianu . it will reduce bandwidth consumption, matching products will be better , plus i can now extend to books and beyond.

free software campaign

Posted in Bash on September 22nd, 2009 by gmunteanu

i fully endorse this campaign:

Campania Alege Software Liber

altctrl 0.8.2

Posted in Bash on July 4th, 2009 by gmunteanu

added sigmanet.ro

added necessary code so that you won’t be forced to update to a newer version when a new store is added.

made the changes necessary for going public in the main addons repository on mozilla website: only 1 object into the global namespace, eliminated the jar .file – smaller size of the extension.

i admit i let my attention drawn to other things, but i will get back to altctrl in september.

using vim instead of sed

Posted in Bash on February 2nd, 2007 by gmunteanu

in order to process a text file in any sense, and being used with vim, and not with sed
i use the following for deleting googlebot lines from a web log.

vim -e -c ":d/googlebot/g" -c :wq website.YYYYMMDD.log
-e doesn’t put vim in interactive mode, so you can script it and put it in crontab.

or if you need to pipe it:

cat website.YYYYMMDD.log | vim – -e –c ":d/googlebot/g" -c :wq

maybe i will add more vim issues as comments to this post.

group_concat and NULL in mysql

Posted in Bash on January 9th, 2007 by gmunteanu

Well, today I spent 2 hours on a query that involved group_concat.
we had a table that looked like this:
Columns:
……….
client_name
phone
mobile
email
……….
and in a complex query we needed to have group_concat(client_name),  group_concat(phone), group_concat(mobile), group_concat(email) …
[note: actually we did : cast(group_concat(client_name) as char),  cast(group_concat(phone) as char), cast(group_concat(mobile) as char), cast(group_concat(email)  as char)... ]
the thing is that phone and mobile were missing for most of the clients, and the value was NULL.
now if you have for phone values:
NULL
123456789
NULL
NULL
then group_concat(phone) is 123456789
and i woud get:
 clients                                             phone
john,george,alex,vio                123456789

and i wouldn’t know which client had that phone.
what i needed was somethin like:
 clients                                             phone
john,george,alex,vio                _,123456789,_,_
and i would know that george had phone number 123456789.

the sql for that is:
select …. cast(group_concat(ifnull(client_name,’_')) as char),  cast(group_concat(ifnull(phone,’_')) as char), cast(group_concat(ifnull(mobile,’_')) as char) … from clients_table …

mysql analyze and optimize from bash

Posted in Bash on November 14th, 2006 by gmunteanu

You want to optimize your mysql databases on a regular bases [say every night].
this is the script that does it. just put it in the crontab and you will be fine:
You could say you could do it in php, but there are machines dedicated for mysql, so why put php on them when you have bash?
I assure you, in php there are more lines than in this small script.

#!/bin/sh
for table in $(mysql -u MysqlUser -pMysqlPassword -D DBName -e 'show tables' | awk '!/Tables/ {print $1}'); do
mysql -s -s -u MysqlUser -pMysqlPassword -D DBName -e "analyze table $table"
mysql -s -s -u MysqlUser -pMysqlPassword -D DBName -e "optimize table $table"
echo " $table -> optimized"
done

explanations:
awk '!/Tables/ {print $1}' i want the header produced by mysql to not show, so i take Tables_in_DBName out of the output
mysql -s -s -> suppressing some formatting from mysql output

Now, your mysql will run faster and using the indexes you put in place.