Archive for September, 2006

My lava lamp :)

Friday, September 29th, 2006

Well it's Friday evening so why no to post something most people won't scratch their head about :)

Here's a few pics of my first lava lamp. Well actually I had one running in Dashboard, but the real one is a real deal :) Thanks to my wife who won this one at lottery at her friend's wedding :D

dscf3622.jpg dscf3612.jpg dscf3624.jpg

Transmit SFTP without entering login and password

Wednesday, September 27th, 2006

In my previous entry regarding "SSH Login without entering password" I have wrote about how to make it easier to login into SSH servers.

It's all nice, works, and makes life easier. But if you are a Mac user who uses Transmit to log into SFTP servers, there is one very nice side-effect of the technique described in the forementioned entry. You can actually log into your SFTP servers by just typing a server's address, and with not need to enter password, or even login name!

Here's how I connect to my SFTP server:

nouserid.jpg

And after clicking the Connect button…

loggedin.jpg

Voila! No login name, and no password, but I was logged into a server which actually does require a login name, and the password is actually more than 10 characters!

How does it work? Well actually, SFTP connection is a connection using the same mechanism which is used to do an SSH connection (you use the same login and password for both). And Transmit uses the standard OS built-in functions to do this connection. Therefore, once you have set up your computer to be able to login into remote SSH server without entering password, you automatically gain ability to use Transmit to log into the same server using SFTP protocol!

There's one catch though. I have told you that you don't need to enter login name, but actually it is not true :) A name is required in order to login, but if you don't specify it, your current login name is used (which is "mike" in my case), and if login name on remote server is the same as your local one (and it happens that remote server's login name is "mike" too), you are just fine with the default values.

But what you are to do if, say, your local name is "mike", and you have setup an SSH key for, say, server "example.com" as "hosting@example.com" (ie, the user name on the remote hosting is "hosting", and not "mike)? Well, you can override the defaults, and specify which default name you want to use when connecting to which server. In order to do that, you have to edit contents of ~/.ssh/config file (you have to create it if it doesn't exist). For the case above, the contents of the ~/.ssh/config file should read

Host example.com
User hosting

This way, when you connect to the host "example.com" without specifying user name, the default user name "hosting" will be used (thanks to Dave Teare for this hint).

And of course, you can always just specify user name in the Transmit connection window :)

example.jpg

That's it :) Happy name-less and password-less SFTPing ;)

EasySWF plugin for WordPress update to version 1.0.1

Friday, September 22nd, 2006

I have updated the EasySWF plugin to version 1.0.1 today. New version contains exactly 2 fixes:

  • a fix for reading dimensions of .swf file hosted on local filesystem of the server, in case when server doesn't set the DOCUMENT_ROOT environment variable (thanks to Michael Small for pointing out the problem and helping in resolving it!)
  • updated Flash generation code so that it is automatically "activated" in IE for Windows (ie no need to click on Flash in order to be able to click on links inside it, if there are any)

You can download the update here.

More info on the plugin is available here.

What you can do with WordPress

Wednesday, September 20th, 2006

Friday last week, we have finally finished working on one site here at Media Japan where I currently work at. An ordinary site actually, but this is the first time we have used WordPress to build anything big.

The site is for construction company here in Nagoya. And the link follows, so you can look at the site and how it works (everything is in Japanese though..):

WordPress is thought of as just a personal blogging system, mostly, and many people don't think about it as of a system you can use for building a full-fledged corporate site. Well, although there may be other system more oriented to building corporate sites, WordPress was doing just fine for us.What we have created with WordPress:
  • Pages based static pages structure to present static content. Pages are organized into hierarchy, and Fold Page List plugin is used to auto-unfold list of subpages of the selected category.
  • There are 3 different page templates used in total (top level, and 2 templates for showing 2nd and 3rd level pages); as well there are special templates for displaying contact forms (totalling 4 on the site).
  • Forms are not easily processed by WordPress (you do have an ability to get an ordinary contact form processed, but there are no plugins to process free-form content forms), so I had to write a special form processor, which I will hopefully make available to public after some code cleanup and translation to English :) These forms are all processed without a single page refreshes using the AJAX technology. You can see an example if you click this link.
  • We have also used Google Maps to show location of company offices, as you can observe at this page. Unfortunately, I couldn't find any easy to use Google Maps plugins so I wrote one myself, and you can get more info and download at this link.
  • Also, as it turned out, there was no easy to use Flash embedding plugin, so again I wrote one myself. You can see the real-life example here, and download the plugin here.
  • We have added the auto-updating sitemap page to the site using Dagon Design Sitemap Generator (by slightly modifying the source, though..)
  • There are Google Sitemap support added by means of fantastic Google Sitemaps plugin.
  • In order to show closeups of pictures in posts, we have used the cool Lightbox 2.0 plugin.
  • In order to show thumbnails of pictures of a post on front page, we have used (although it needed to be heavily modified) the Post Image plugin.
  • There are also other plugins we have used to show various content in user-accessible area, like Author Image(s), Fuzzy Recent Posts, Fuzzy Recent Comments, and Fancy Excerpt.
  • There are several simple support functions I had to write in order to add various functionality to the site, but the total line count is about 150 lines of PHP code, so it is not really a big deal (and you can get away just fine without these functions in most cases).
  • Regarding administrative area, I have used the following plugins in order to track statistics on the site: Counterize, WP-SlimStat.
  • Since there is also a "Staff blog" set up on the site (and blogs, even on corporate sites, even if nobody actually reads them, are good because they keep search engines attention on the site, and if updated regularily, can be a very good tool to rank up the site on search engines listings). So.. since there is also Staff blog updated to several different people, we needed to limit access of these people to any categories except for blog, and news (news is just a blog category). Moreover, only one person is allowed to make posts to news, and all others are just allows to post to blog. I have used the Limit Categories plugin in order to implement this functionality.
  • There was just one more problem with WordPress admin panel - all users could see each others posts, which is not a very good thing (they couldn't edit each others posts though, but could see them in listings). I had to hack the WordPress code a little bit in order to "fix" this problem You can read about it following this link.

That's basically all we have done in order to build the forementioned WordPress-driven site. It all might look pretty complicated, and actually it was at the beginning (I never used WordPress to build anything big before), so I had to learn and search, search and learn, write plugins and workarounds. So it took about 2 months to complete this project. But I'm sure our next WordPress-based site will be a breathe to build - all required plugins are found, all missing plugins are written, etc.. Out client is happy and site working very smoothely. What else do I need? :)

So.. it might be a long entry, but the point is - you can build pretty complex sites in WordPress, and it is actually not very hard, and doesn't take lots of time to do that, once you understand the basics of how WordPress works.

Anyway, hope this info will be of use. :)

Inline Google Maps plugin updated to version 1.1

Friday, September 15th, 2006

I have updated my Inline Google Maps plugin to version 1.1 today. The hightlight of the new version is much improved handling of HTML inside the marker description field. You can now basically use any HTML you want for description, unless it contains single quotes :)

Have fun with your maps! :)

Easy Inline SWF 1.0 Plugin for WordPress

Wednesday, September 13th, 2006

There are several plugins to display Flash content for WordPress, but they don't make it easy for a user to insert Flash. They ask you to put some weird tags into your post, set Flash dimensions.. Well… NO MORE OF THIS PAIN! :) (cool CM huh ;) (more…)

Just a rainbow :)

Monday, September 11th, 2006

Just a beautiful rainbow I took with my mobile phone the other day. There actually was a double rainbow at that exact place just 10 seconds before I shot this one, but the first shot with double rainbow was hopelessly out of focus :(

 

Rainbow

WordPress: how to hide other users' posts in admin panel

Monday, September 11th, 2006

I am working on another WordPress-based system currently, and have faced a problem when I have many users who can log into WordPress admin panel to post their blog entries. But doing so, they all can see each others posts, even though not being able to edit any post but their own's.

From users  point of view, it is not the best thing in the world to look for your own posts in the list, especially if there are lots of users in the system.

So, here's a simple solution for the problem - after logging into the system, non-admin users will be able to only see their own posts in the Admin -> Manage panel. The only thing is that I seems no plugin solultion is possible so you have to add 3 lines to one file.

The file you have to add these lines is located in /wp-admin/edit.php file in your WordPress installation. You have to go to line 150 (or near it, where it says:

if ($posts) {
$bgcolor = '';
foreach ($posts as $post)…..

..etc

Now, just add the following code ABOVE the one mentioned above:

if ($userdata->user_level<10) {
    $posts = query_posts("author=".$userdata->ID);
}

So, in the end you will get something like that:

<?php

if ($userdata->user_level<10) {
    $posts = query_posts("author=".$userdata->ID);
}

if ($posts) {
$bgcolor = '';
foreach ($posts as $post) { start_wp();
$class = ('alternate' == $class) ? '' : 'alternate';

You're done! Now all non-admin users will see only their own posts :) Simple and easy. Have fun. 

Inline Google Maps for WordPress

Friday, September 8th, 2006

There are several WordPress plugins for showing Google maps on blog pages exist, but unfortunately, they are all kind of do "too much" :) Like displaying your posts on a Google map, or something like that. What I needed is just a simple plugin which would allow me to embed a Google map into my WordPress blog pages, anywhere I want, preferrably with a single line of simple code. There was nothing like that so I have wrote my own plugin. It's easy to use and install, and works fine so.. here we go :)

(more…)