Posts tagged ‘tip’
In my recent project there are quite many tasks that run in the background – generate thumbnails, detect colours on the pictures, run DB updates etc. Sure, all that is handled using cron and Yii commands. However there is a little problem. Consider we have DB update routine that should import new stock data from the datafeed. Datafeed is uploaded hourly, but upload can’t be scheduled to minutes – connection speed, different errors may interrupt the upload. On the other hand, sometimes processing takes 5 mins and sometimes – a few hours because in the first variant we just replace records and in the latter – download images for the new products.
Continue reading ‘Concurrent process management in Yii’ »
Posted by Konstantin Mirin on March 25, 2010 at 09:31 under PHP, Programming, Yii.
Tags: experiece, extension, tip, trick, Yii
4 Comments.
Firefox is great for web development mainly because of the large number of plug-ins available. Here’s my list:
- Web developer toolbar – great thing for the web development. Personally I use resizing features, password revealing and elements highlighting.
- Firebug – absolute winner. This is actually the main tool for development I use. I’m going to write a more detailed post about it later. For now, you can enjoy this video
- Cache status shows cached size in the status bar. But the main use is it’s ability to clear cache in a few clicks. This saves lots of time clicking here and there when developing complex JS application.
- Live HTTP Headers allows to view all HTTP headers that go here and there while you’re requesting the page. It’s a great thing when you need to grab some content from the password-protected area or inspect what’s going on when you request page.
- YSlow is a firebug plug-in from the Yahoo team which analyzes your content and shows you the ways of the client-size optimization of your page. It’s recommendations are really valuable. Try it and you’ll never uninstall it
- SitePoint HTML reference is a firebug plug-in too, that adds HTML help to the every HTML tag and CSS property. It also provides examples and best practices. I don’t think this is great value for gurus, but definitely useful for all others
- Fasterfox is a plug-in that boost Firefox performance. It is in the “experimental” state, but quite stable. I haven’t ever experience any problems with it.
- Selenium IDE is designed as a helper tool for creating selenium tests. It is really great and handy tool if you use automated testing. I’m going to cover this in my blog later.
And what are your favourite plug-ins? How do you use them?
Posted by Konstantin Mirin on March 16, 2010 at 08:00 under Programming.
Tags: browsers, efficiency, tip, trick
2 Comments.
Websites, that aggregate something become more and more popular because we need all information available in one place and accessed fast and easily. From time to time, you come across with tasks, that require retrieving some data from the password-protected area. For example, I use Guru.com for my job search. They post lots of the projects there, but they don’t offer convenient listing and filtering. So I developed my own tool, that grabs everything from there and ranks it all in the way I need. So, we’ll take a look at different types of password-protected areas and see how to deal with any of them
Continue reading ‘Grabbing password-protected content with cURL’ »
Posted by Konstantin Mirin on May 24, 2009 at 09:00 under PHP, Programming.
Tags: experiece, PHP, tip, trick, tutorial
15 Comments.
OOP is a great concept, it simplifies the programmer’s life, especially in the field of interface development. Nearly all modern web-interfaces use JS in some way – for field highlighting, validation, help etc. It’s OK when there are such simple things.
And now imagine, that we have a set of dialogue windows (HTML+CSS) for adding a comment, rating, sending to the friend. Each of these boxes has a number of functions – check if user is logged in(if not – show login form), send AJAX request, process response, show error/success messages, position the box on the page etc.
Continue reading ‘OOP in jQuery’ »
Posted by Konstantin Mirin on April 30, 2009 at 22:19 under JavaScript, UI, jQuery.
Tags: framework, jQuery, OOP, tip, trick, workaround, yui
23 Comments.
I bet you didn’t know, that switch can be used to answer the question: “Which of the N following statements is true?” Continue reading ‘Trick with php switch()’ »
Posted by Konstantin Mirin on March 6, 2009 at 12:41 under PHP.
Tags: PHP, tip, trick
3 Comments.
As you know, PHP can return only one value from the function. However, there is a simple workaround – we return an indexed array from function and immediately split it into variables using list():
-
-
function ret()
-
{
-
//something useful here
-
return array($varA,
$varB);
-
}
-
list($a,
$b) = ret
();
//we’ll have $varA in $a and $varB in $b after this
-
Posted by Konstantin Mirin on March 6, 2009 at 09:38 under PHP, Programming.
Tags: PHP, tip, trick
Comment on this post.
Yesterday I’ve read a post on The Developer’s Day blog. Then tested this thing in Yii. There is a jQuery in my application, so I created test controller and test action, that only outputted “Hello, world” and called it from the firebug console Continue reading ‘Speeding up Yii or why should you use DB sessions’ »
Posted by Konstantin Mirin on March 5, 2009 at 06:02 under Databases, PHP, Yii.
Tags: DB, production, session, tip, trick, Yii
18 Comments.
Nearly every large application has some configuration parameters – site admin email, cache time for different blocks, number of latest news, number of items per search or catalogue page etc.
Continue reading ‘Handling Application Parameters in Yii – Using the Database’ »
Posted by Konstantin Mirin on March 4, 2009 at 11:48 under Databases, Yii.
Tags: DB, extension, framework, tip, trick, Yii
27 Comments.
In Yii you can have all your JS and CSS files together with your PHP. For example, you have some view in /views/user/create.php and you can have your css & js in /views/user/assets/css/ and /views/user/assets/js/. That’s quite convenient when you reuse your views/controllers/components from application to application. But these directories are not accessible from the web, so there is publishing mechanism there. Continue reading ‘Registering group of JS files in Yii’ »
Posted by Konstantin Mirin on March 3, 2009 at 15:27 under Yii.
Tags: framework, tip, trick, Yii
3 Comments.
One of the ways to make your blog more search engines friendly is to take cate of your <title> tag. That’s what’s showin in the browser’s window title. By default, wordpress shows Blog name on the homepage and [BolgName] > Blog archive > [PostTitle] on the posts page (the most important to us). Best variant is to show only post title or ctegory title in the <title> tag, without any blog name. Best variant to do this is to install All in one SEO Pack and configure everything there. However, if you can’t/don’t want do this, you can do one simple change.
- Go to Design->Theme Editor if you have version less, than 2.7 or Appearance -> Editor if you have 2.7.
- Choose file header.php
- Find line <title>…..
- Replace this line with these two:
-
-
<?php if (($t = wp_title(" ", false)) == ”){$t = get_bloginfo(‘name’);} ?>
-
<title><?php echo $t; ?></title>
-
- You’re done!
Further reading – wordpress reference
Posted by Konstantin Mirin on February 26, 2009 at 18:02 under Wordpress.
Tags: seo, tip, title, trick, Wordpress
7 Comments.