I want to be free
I want to be free [http://i1t2b3.com/] Any fool can make things bigger and more complex Home About My projects Jun 14 10 reasons not to use Assembla assembla , development , ideas No Comments » Although Assembla is one of the best ticket systems, I hate it at times. Main reason is that their team plays with fonts and colors and thus changes the site appearence, and at the same time ignores the major issues. Here is the list that irritates me the most: When you create a ticket, the editor doesn’t work properly. For example, if you hightlight a URL with intention to mark it as a link, they still ask you for the URL in a prompt (a month ago they would even just replaced it with a default markup text like “ [[http://server.com | URL TEXT]] “) The same is WIKI based on tinyMCE — it fails so often, that 50% of times I have to open the content HTML source and fix things manually Affiliate system — it pays you back only if you refered 3+ new users. I have just 2 leads, and I loose $80 every month… Some time ago they had an offer to blog about them and get $5 reward — I wrote a post, and their marketing guy Ryan told me that they gonna pay me only after a referal would pay a bill — which was not mentioned in the offer. If you want to export tickets data (for example, to count some stats regarding development performance), you will have to deal with their internal semi-JSON format with no documentation (only not-so-self-explanatory feilds names) Previously they had a project name in project space URL, now they use a unreadable hash — if you work with more then 1 project, you’d feel how unhandy it is There are 3 (three!) different SVN repositories types (SVN+Trac, External SVN, Source/SVN) in Tools which is confusing. Every one has its own set of possibilities — you have to choose what is more vital for you, you cannot have it all. Current filter choise is lost if you leave Assembla page for 5-10 minutes, and you have to switch to it over again. The choise is saved in a HTTP-secure cookie (it means you cannot change it by JavaScript). Damn, why? They don’t show hours total for tickets no matter how you group them. It’s one of the most important things for developers, guys. If you want just to get content of the project, you cannot. I mean not SVN Checkout, but kind of SVN Export — download all folders/files without SVN client. They had a button that allowed to download the project as ZIP archieve, but now it’s not there. I have a few PHP projects which many people download and use, and they complain often about this missing feature. All in all, Assembla still has a big way to go to maturity. Jun 06 MySQL Proxy db , development , mysql No Comments » At times it’s necessary to know which queries the server runs right now. Of course, you can try this statement: SHOW PROCESSLIST but if you need a more poweful tool, try MySQL Proxy . Although it’s still an alpha version, it’s a handy tool to monitor, filter and manipulate your queries since there is Lua scripting language interpreter supported which is quite obvious in usage. The MySQL Proxy (as can be understood from its title) can help you to see communication between a few MySQL servers and a few clients. My usage pattern is that the Proxy listens to 4040 port on my local machine, and if I change the port setting in connection string of any application (my job project or even PhpMyAdmin), I can see the queries logged in a console window. You can track lots of characteristics of queries — just take a look at example Lua scripts in the package that you’ve downloaded. May 30 Bulk SQL loading db , development , ideas , mysql No Comments » If you want to load a list of SQL files into your database on Windows, you can create a .cmd file with such content and run it. Place it in the same folder where your .sql files are. @echo off SET DATABASE=my_database SET USER=root SET PASS=1 SET FORMAT=*.sql FOR /F "usebackq" %%i IN (`dir /on /b %FORMAT%`) DO echo %%i && mysql --user=%USER% --password=%PASS% --default-character-set=utf8 %DATABASE% < %%i Make sure, mysql command can be run. If no, either set the full path to mysql command tool, or add the path to PATH environment variable. Apr 13 Sphinx pre-query not inheriting db , sphinx No Comments » Sphinx is a nice search engine and is used at our project hugely. Although, I found a case when using a pre-fetch query is not obvious. The pre-fetch query is a query that is run before the data is got from database, so thus you can set character encoding, tune database caching, set variables, etc. So, if we have 2 sources, one is parent for all other sources since it has database connection params, and second one inherits from the parent. source www { type = mysql sql_user = root sql_pass = sql_query_pre = SET NAMES utf8 } source www_country : www { sql_query = SELECT * FROM country } All works fine – when www_country souce is used, the same sql_query_pre will be used because www_country is a child of parent source. Although, if one day you decide to add a custom pre-query to the child source, it seems you loose the parent’s ones: ... source www_country : www { sql_query_pre = SET @usefulVariable = 1 sql_query = SELECT * FROM country } In this case it seems you have to duplicate the parental pre-query in every child =( So the right child is gonna be: ... source www_country : www { sql_query_pre = SET NAMES utf8 sql_query_pre = SET @usefulVariable = 1 sql_query = SELECT * FROM country } Nov 17 Reverse geocoding in your app db , development No Comments » Reverse geocoding is a process of getting toponym name (city name) by its coordinates. To make this, you can use a remote service like I have already described , or implement it yourself. To do so you need two things: A database of cities with coordinates (having a population value at least for major cities is a big plus) A method to find a closest city #1 is left for you, let’s talk about #2. In the previous post I introduced the DISTANCE function (SQL) to count a distance between 2 points by coordinates. Let’s use it to find the biggest city closest to a given point: DELIMITER // DROP FUNCTION IF EXISTS REVERSE_GEOCODE;// CREATE FUNCTION REVERSE_GEOCODE( latitude DOUBLE, longitude DOUBLE, radius DOUBLE ) RETURNS DOUBLE READS SQL DATA DETERMINISTIC COMMENT 'Finds a city by coordinates given. Returns City ID.' BEGIN DECLARE cityID INT(10) DEFAULT 0; DECLARE d DOUBLE DEFAULT 0; /* useless var */ SELECT id, DISTANCE(`lat`, `lng`, latitude, longitude) AS dist INTO cityID, d FROM `geo_cities` WHERE lat BETWEEN FLOOR(latitude - 0.5) AND CEIL(latitude + 0.5) AND lng BETWEEN FLOOR(longitude- 0.5) AND CEIL(longitude + 0.5) HAVING dist < radius ORDER BY IF(population > 0, population, 1) * (1/IF(dist > 0, dist, 1)) DESC LIMIT 1; RETURN cityID; END; // DELIMITER ; Well, this function orders cities by (population and distance) function — so that the biggest closest city is returned. WHERE clause is supposed to shorten the number of cities which are looked through; otherwise we would have to search through whole world’s cities. In my solution the search is limited by a reasonably small rectangle. In the next post I’ll tell you how to find a biggest city depending on current Google Maps zoom, so that it won’t give you a small city near Paris if you click on France at a world-level map view. Nov 04 SQL function to count distance between two points db , development 2 Comments » Useful function. DELIMITER // DROP FUNCTION IF EXISTS DISTANCE; // CREATE FUNCTION DISTANCE( lat1 DOUBLE, lon1 DOUBLE, lat2 DOUBLE, lon2 DOUBLE ) RETURNS DOUBLE NO SQL DETERMINISTIC COMMENT 'counts distance (km) between 2 points on Earth surface' BEGIN DECLARE dtor DOUBLE DEFAULT 57.295800; RETURN (6371 * acos(sin( lat1/dtor) * sin(lat2/dtor) + cos(lat1/dtor) * cos(lat2/dtor) * cos(lon2/dtor - lon1/dtor))); END; // DELIMITER ; In next post I will explain how I used this function to implement a reverse geocoding — it’s useful when you need to find a closest city by given coordinates. Nov 03 Sphinx on Windows and error 1067 development , php , server No Comments » I attempted to setup Sphinx on Windows, but was not trivial — problem was that I couldn’t run the SearchD as a Windows service since I got 1067 error (“ Process Terminated unexpectedly “). It’s not obvious but helpful to know how you can get the error message the service crashes with. To do so, go to Control panel → Administration → Event Viewer. Here you can get all notices and error messages that the service produces: If you get your service running and search tool gives you the correct results, but your PHP application gets FALSE as query result, try to see what SphinxClient’s getLastError() method returns: $s = new SphinxClient; $s->setServer("localhost", 3312); ... $result = $s->query('test'); echo $s->getLastError(); In my case there was a following message: s earchd error : client version is higher than daemon version (client is v.1.22, daemon is v.1.19) Nov 02 Preferrable sorting in MySQL db , development No Comments » At times, some records in a recordset are more important than others — e.g. a featured product in a products list. In such a case you can make 2 requests to get the featured item first, then to load other N-1 items, and then display them. If you want to make it by one move, you can use a feature of preferrable sorting — you can define what value and in which field goes first if such value is present. For instance, you want to show an item with item_id=15 first: SELECT * FROM items ORDER BY item_id IN (15) DESC Which returns something like (featured item goes first): +----------+------------+ | item_id | name | +----------+------------+ | 15 | Product 15 | | 32 | Product 32 | | 31 | Product 31 | | 30 | Product 30 | | 29 | Product 29 | | ... | ... | +----------+------------+ Sep 01 Interview with Matt Mullenweg, the WordPress creator wordpress 1 Comment » How did the idea to create WordPress come to you and why did you decide to make it a free product? WordPress evolved out of my own desire for a blogging product to make my site better, and a frustration with the existing solutions that I felt were too complicated and hard to use. WordPress was built on the code of an existing GPL product called b2, so it was completely natural for it to continue the GPL license and preserve the freedoms of our users. How do you make money on it now and what do you plan in the future to earn more? About 5 years ago I founded a company called Automattic to create commercial services around WordPress that would help grow the market. The first of these was an anti-spam service, Akismet, and we later followed up with WordPress.com, Gravatar, Polldaddy, IntenseDebate, VideoPress, VaultPress, and more to come. How does your development process work: how many developers do you have, are they full/part time workers, are they located in an office (where?) or are they remote? What IDE and environment do they use to work on WordPress? There are about 200 active contributors to core WordPress development, all of them volunteers although some are paid by their employers (including Automattic) to contribute to WordPress. There is no set development environment, everyone uses what is most comfortable to them. I have noticed a a definite bias toward using Macs, though. What influence have WordPress got on the market and how does this affect the competitor produсts (both commercial and free)? WordPress is definitely one of the largest publishing platforms now, but there are excellent competitors including Blogger. Innovation in the market is good because it keeps us all on our toes. Starting from 2.3.3 version the biggest part of changes were connected with admin area and look-and-feel, and not with the code optimization. Can we hope that one day the engine will become more robust? We are constantly rewriting, refactoring, and optimizing the code in WordPress, ofter as much as 10-20% in a single release. Since 2.3.3, probably 95% of the code has been rewritten. This deliberate process of improving the code is better than a massive rewrite because us to test each change more and preserve backward compatibility. Do you plan to stop to support PHP4 and avoid deprecated.php usage? Yes, in 2011. Are there any plans to make plugins approval system more tough? Some public plugins still are of poor quality. Eventually I’d like to bring more of the review process that we have for themes to the plugin directory, but since we encourage people to host their development on the directory I think we should be open to hosting everything. Do you reward the plugins and themes developers? I’m sure many plugin and theme developers are highly rewarded by their work, but we don’t give out money or anything from WordPress.org. Will you add some more plugins out-the-box apart from Akismet and Hello Dolly? Probably not. What do you think on WordPress turning from a blog engine into a full featured website CMS? This is a pretty natural transition that started with the introduction of the Pages feature and has grown from there. More than half of new WordPress installations aren’t being used as blogs at all. If you start to write WordPress now from the scratch – what would it look like? Starting today I would probably leave off some features that aren’t used as much anymore, like a blogroll manager, and focus more on SEO and social integration. What do you think about such frameworks like ZendFramework, Сodeigniter, Symfony, etc.? Didn’t you think to use it for Wordpress development? WordPress itself is a framework you can use to build highly advanced and scalable applications. Which CMS/CMF do you like? What projects did you keep in mind while creating WordPress? Our about page mentions and links to Textpattern, Movable Type, and Drupal as inspirations Thank you, Matt! Apr 14 Convert latin1 to utf8 db , development No Comments » If you import unicode text into latin1 database column, the symbols would be screwed up — russian symbols become a shit like “залоговый депозит”. To convert such quickly (as a test) you can use Lebedev’s convertor . To convert the whole table do the following (thanks to dull.ru ): The most important step: dump such data in a file with mysqldump mysqldump -u user -p --default-character-set=latin1 --skip-set-charset --no-create-info --extended-insert --complete-insert dbname table > dbname.sql If not the whole table data is bad, create another table ( CREATE TABLE t2 LIKE t1 ) and copy wrong rows to the new table. Replace latin1 by utf8 in the file This can be done manually in your editor or by this command: sed -r 's/latin1/utf8/g' dbname.sql > dbname_utf.sql Convert your latin1-table to utf8 (and maybe truncate it): ALTER TABLE `table` CONVERT TO CHARACTER SET 'utf8'; Import the utf8 data back to the table: mysql -u user -p --default-character-set=utf8 dbname < dbname_utf.sql That’s it. Previous Entries Recent Posts 10 reasons not to use Assembla MySQL Proxy Bulk SQL loading Sphinx pre-query not inheriting Reverse geocoding in your app SQL function to count distance between two points Sphinx on Windows and error 1067 Preferrable sorting in MySQL Interview with Matt Mullenweg, the WordPress creator Convert latin1 to utf8 Zend View Helpers inheritance Cannot upload a big file? How to rate Points Of Interest automatically Federated engine – MySQL table as symlink Currency exchange in your application Blogroll I wanna be developer project (Russian) The endless art (Russian) Бизнес-планы на заказ Archives June 2011 (2) May 2011 (1) April 2011 (1) November 2010 (4) September 2010 (1) April 2010 (2) March 2010 (2) January 2010 (1) September 2009 (5) August 2009 (1) July 2009 (4) May 2009 (5) February 2009 (2) January 2009 (6) December 2008 (2) November 2008 (4) May 2008 (1) April 2008 (1) March 2008 (2) February 2008 (1) January 2008 (3) December 2007 (3) Recent Posts 10 reasons not to use Assembla 06-14-2011 MySQL Proxy 06-06-2011 Bulk SQL loading 05-30-2011 Sphinx pre-query not inheriting 04-13-2011 Reverse geocoding in your app 11-17-2010 Recent Comments MOD : Re, So i don't have the problem i replace all of i... MOD : Hi, thanks for your script that's what i needed, but it do... David : Please Please Update to Firefox 4.01... lord : Update to v.4... Victor : I’m having problem with setting up. I can see all the checkb... About This template is built with validated CSS and XHTML, by N.Design Studio . Icons used here are from Web 2 Mini pack. To download more WordPress Themes , please visit www.ndesign-studio.com. Open "about_text.txt" file in the theme folder to edit this text. WP Theme & Icons by N.Design Studio Entries RSS Comments RSS Log in fast loan . Интернет-маркетинг продвижение сайта легко и быстро. . Are you wondering how to phone number search that is bugging you?