iRui.ac - Home of vSlider » Tips 4 Geeks http://irui.ac I've seen things you people wouldn't believe Thu, 18 Sep 2008 01:39:44 +0000 http://wordpress.org/?v=2.6.3 en 404 Revisited http://irui.ac/archives/2008/06/15/404-revisited http://irui.ac/archives/2008/06/15/404-revisited#comments Sun, 15 Jun 2008 15:11:38 +0000 Rui http://irui.ac/?p=92 A few users of vSlider have noticed recently (mainly due to Google Analytics) that the 404 page of the theme was creating problems for them. This is because it doesn’t actually return the 404 code, but a normal 200 (the code of OK) instead.
The reason for this goes back to Internet Explorer 6 - I’ve blogged about this issue back in 2005 (see a complete description here.
In a nutshell, IE6 didn’t show the custom 404 page without a bit of hacking from my side, and at the time IE6 was the most popular browser, so this seemed like a good idea. But with more and more people moving to Firefox (yupee!), and with IE7, this is not such a big problem anymore. So, I will remove this dirty trick from the next release (whenever that happens :) ). In the meantime, if you are having problems because of this, edit the 404.html page and remove the first 4 lines.

]]>
http://irui.ac/archives/2008/06/15/404-revisited/feed
vS3 hotfixes http://irui.ac/archives/2007/07/09/vs3-hotfixes http://irui.ac/archives/2007/07/09/vs3-hotfixes#comments Mon, 09 Jul 2007 22:14:56 +0000 Rui http://irui.ac/archives/2007/07/09/vs3-hotfixes/ Ok, some bugs/issues/problems have been found in vSlider 3, none of them too critical. I don’t want to just jump to version 3.1 already just to fix this (I rather do it later, with a few improvements). Instead I list them, with hotfix instructions. If you find some more, add comments here and I’ll keep the text updated.

  • Post titles in WordPress are still visible when using LightBox:
    go to the file \vSlider3\js\vsShadow\vsShadow.css, and on line 12 replace “z-index: 5000;” with “z-index: 50;”
  • Image or album title area in Gallery2 looks funny if the title text is empty:
    go to the file \gallery2\themes\vSlider3\templates\header.tpl and on line 87 add this code before the {/if}:
    Quick Code

    {else}<h2 class="single-title">&nbsp;</h2>
  • vSlider 3 just doesn’t work in some PHP configurations: Some PHP installations have very strict settings and won’t load files with paths that are not fully specified. In this case, replace the indicated lines with these:

    File header.html
    Lines 25 through 31:
    Quick Code

    <?php require (TEMPLATEPATH . "/styles/style_main.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_header.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_page.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_content.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_post.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_comment.css.html"); ?>
    <?php require (TEMPLATEPATH . "/styles/style_sidebar.css.html"); ?>

    Line 58:
    Quick Code

    <?php require (TEMPLATEPATH . "/styles/ieHacks/style_ie_behavior.html"); ?>

    File footer.html
    Line 64 :
    Quick Code

    <?php require (TEMPLATEPATH . "/styles/ieHacks/style_ie_behavior.html"); ?>
  • LightBox always picks up the original (large) image in Gallery2:
    the following changes will make LightBox pick up the smallest resize of the picture (or the original if no resize is available).

    In file vSlider3/theme.inc, add this to line 75:
    Quick Code

    
    $theme =& $template->getVariableByReference('theme');
    foreach ($childIds as $childId){
    	list ($ret, $resizeTable) = GalleryCoreApi::fetchResizesByItemIds(array($childId));
    	if (isset($resizeTable[$childId][0])) {
    		$theme['resizeId'][$childId] = $resizeTable[$childId][0]->getId();
    	}
    }
    foreach ($theme['children'] as $id=>$item){
    	if ($item['descendentCount'] >0 ){
    		list ($ret, $Descendent) = GalleryCoreApi::fetchItemizedDescendentCounts(array($item['id']));
    		$theme['children'][$id]['Descendent'] = $Descendent[$item['id']];
    	}
    }
    

    In file vSlider3/templates/album.tpl, find this:
    Quick Code

    
    {if (!$theme.lightbox_plugin_active)}
    	{capture assign=linkUrl}
    		href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}"
    	{/capture}
    {else}
    	{capture assign=linkUrl}
    		href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.id`"}" rel="lightbox[Photo]" title="{$child.title|markup}&lt;br&gt;&lt;a href=&quot;{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}&quot;&gt;View Photo Page&lt;/a&gt;"
    	{/capture}
    {/if}
    

    And replace it with this:

    Quick Code

    
    {if (!$theme.lightbox_plugin_active)}
    	{capture assign=linkUrl}
    		href="{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}"
    	{/capture}
    {elseif ($theme.resizeId[$child.id] eq '')}
    	{capture assign=linkUrl}
        href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.id`"}" rel="lightbox[Photo]" title="{$child.title|markup}&lt;br&gt;&lt;a href=&quot;{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}&quot;&gt;View Photo Page&lt;/a&gt;"
    	{/capture}
    {else}
    	{capture assign=linkUrl}
        href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.resizeId[$child.id]`"}" rel="lightbox[Photo]" title="{$child.title|markup}&lt;br&gt;&lt;a href=&quot;{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}&quot;&gt;View Photo Page&lt;/a&gt;"
    	{/capture}
    {/if}
    
  • Add the Views Count to albums and pictures in Gallery 2:
    go to the file vSlider3/templates/album.tpl and near the end find “showSize=true”. Add “showViewCount=true” after it.
  • Fix a PHP Warning: Division by zero in Gallery 2
    go to the file vSlider3/templates/theme.inc and in the end of the file delete the line $theme['columnWidthPct'] = floor(100 / $params['columns']);.
  • Fix a small localization bug in administration
    go to the file admin/color.html, and in line 5 replace __(’Posts:’,'Svlider’) by __(’Posts:’,'vSlider’). Thanks goes to SILENCE for spotting this.
]]>
http://irui.ac/archives/2007/07/09/vs3-hotfixes/feed
Third time’s the charm - vSlider 3 is out! http://irui.ac/archives/2007/06/23/third-times-the-charm-vslider-3-is-out http://irui.ac/archives/2007/06/23/third-times-the-charm-vslider-3-is-out#comments Sat, 23 Jun 2007 21:12:19 +0000 Rui http://irui.ac/archives/2007/06/23/third-times-the-charm-vslider-3-is-out/ Finally, after a few months in the making, here is the new 3 series! Yes, it look a very long time, more than I thought at the beginning, but a lot of stuff happened in the meantime, and one can only go so far without proper sleep :)
What’s available now? New and improved cool stuff for latest & greatest versions out there:

  • vSlider 3 for WordPress 2.2
  • vSlider 3 for Gallery2 2.2.1 (using WPG2 2.x and 3.0 beta)
  • KBurnalizer 3 javascript library
  • KBurnalizerG2 module for Gallery2 2.2.1

See? Can’t be more up-to-date than this!
You see it running on this website, so I guess its working…

So, what’s new? Tons of things. For a complete list, check the specific download pages on Cool Stuff, but here are the highlights:

  • New and expanded Theme Administration page
  • Full pixel-precise control of the width of theme
  • Option for fluid layout! Fills your entire browser, whatever the dimensions. Everything resizes automatically (this one was tough… :) )
  • Complete control over colors without coding. You can use one of the provided color schemes, or create your own. You can create as many as you like, and select individual colors for every visual element.
  • Place the sidebar on left or the right of the page.
  • Administration page for all the nice little icons - sliders, RSS feeds, quote symbols, etc…
  • Several options for the header, including auto-rounded border. Yes, that’s for all the people that kept asking for the Header template :) Now you can just use normal rectangular images and the theme will create a nice round border for you
  • The Gallery2 theme has been redesigned with a more consistent look and LightBox support.
  • Everything done using CSS and Javascript - no images used for either layout or graphical backgrounds. Not even for the rounded borders. This gives you the most flexibility for customizations without coding.
  • Aahh… just check the download page for the full list….

I tested as much as I could, but there were so many changes and new features, a few bugs are bound to appear. If they do, please let me know and I’ll try to fix them ASAP.
Also there were a couple of other features suggested by some of you that I thought would be cool, but didn’t make into this version (you have to draw the line somewhere). They might make it into version 3.1 later on…

I also take this opportunity to present another side project I started with my wife - OneWorldToSee.com. No, it’s another WP theme or another nifty tool. It’s kind of a “life project” - a plan to travel around the world and see *everything* worth seeing. The OneWorldToSee.com website is a blog about this plan and the passion for exploring in general. I invite you all to become members and even post your own texts about travel experiences.
It is also a way to finance it, since we decided to “sell” the world in order to see it - you’ll understand once you see it :)

All the stuff I’ve been making here in iRui.ac is free and will continue to be. I used to have a donation page and even an Amazon wish list, but that’s all gone now. Instead, if you feel compelled to show your appreciation and help us in process, hop over to OneWorldToSee.com and see how you can contribute.

Have fun with vSlider 3!

]]>
http://irui.ac/archives/2007/06/23/third-times-the-charm-vslider-3-is-out/feed
Windows XP Registry Tips http://irui.ac/archives/2005/12/05/windows-xp-registry-tips http://irui.ac/archives/2005/12/05/windows-xp-registry-tips#comments Mon, 05 Dec 2005 06:57:02 +0000 Rui http://irui.ac/?p=30 Messing around with the Windows registry is usually not the brightest idea. But sometimes, there isn’t any other way – the Windows interface alone doesn’t allow you to do everything the operating system as to offer.
In this post I mention two ticks that I’ve used frequently. Nothing really dangerous… just fun cool stuff that sometimes comes in handy :)

Order of the Start Menu items

One of the most irritating features of Windows XP is that you can’t easily sort the program entries on the Start Menu - they just follow the order they are installed. In previous versions there was a “sorting” option, but for some strange reason, Microsoft decided to remove it. Luckily, you can still do it by editing the registry. Open the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Explorer\MenuOrder\Start Menu2\Programs

(it’s possible that you can have “Start Menu” instead of “Start Menu2”)

There is a binary value called “Order” inside this key – delete it. Next, reboot your computer. Now all the items are sorted by alphabetical order.
Unfortunately, every time you install a new program, it will still go the end of the list, so you might to want to do this trick from time to time. Oh well, better than nothing…

Change the Drive Name and Icon

Most people can have quite a few drives in their Explorer – hard drives, CD-ROMs, DVD burners, external drives and even virtual drives, from applications like DAEMON Tools or similar. Some drives might have their own personalized name and icon, but most often then not they get the Windows default icon and name, like “CD-Rom drive”. It would be much nicer if they had a customized name, like “Sony DVD Burner” or “Maxtor External”. Even better, they could have their own custom icon, like the company logo. Well, you can also achieve this by a few changes to your registry. Open the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\Explorer\DriveIcons

If by any chance this key doesn’t yet exist, create it. Then create a key for each drive that you want to customize, giving the drive letter as a name – for instance “…\DriveIcons\G”.
If you want to define a custom icon, inside the drive letter key create another key called “DefaultIcon” and set the “(Default)” value to the location of an icon file (those tiny files with an .ico extension). You should have a bunch of them already, but you can get more on the Internet or even make your own.
If you want to specify the name, create another key within the drive letter key called “DefaultLabel” and set it’s “(Default)” value whatever text you want, like “My tiny USB stick”.
Refreshing Explorer might be enough to see the results, but you might have to reboot the computer.

]]>
http://irui.ac/archives/2005/12/05/windows-xp-registry-tips/feed
Solving Java and DirectDraw problems http://irui.ac/archives/2005/12/04/solving-java-and-directdraw-problems http://irui.ac/archives/2005/12/04/solving-java-and-directdraw-problems#comments Sun, 04 Dec 2005 22:11:21 +0000 Rui http://irui.ac/?p=29 I’ve been dealing with Java for many years now – both as a programmer and as an end-user. Several times I’ve found compatibility issues with Win32 systems at graphics level – screen corruption, redraw problems, slow response, you name it. From my technical experience, I’ve known for a long time that this is mostly caused by the usage of DirectDraw inside the Java Virtual Machine. Typically, I would solve any problem with a specific application by providing this parameter directly to the JVM:

-Dsun.java2d.noddraw=true

This disables the use of DirectDraw for that application, and problem solved!

But ever since I got my new computer, I’ve had problems with practically ALL Java applications, including applets and such. At the first I didn’t care much, but lately it started to bother me a lot the way that applications were completely “freezing”. So, what I needed was a way to disable DirectDraw automatically for all applications automatically – a kind of “system wide” parameter. I found some people suggesting to disable video hardware acceleration completely on Windows. But, c’mon, I’m not going to lower the performance of my machine just because of a few measly applets!
Finally I found what I think it’s the perfect solution. I added a System Environment Variable named _JAVA_OPTIONS and provided the value -Dsun.java2d.noddraw=true. Every time the JVM starts, it will look for this environment variable and pass the provided parameters automatically. I can tell you that it works great!

]]>
http://irui.ac/archives/2005/12/04/solving-java-and-directdraw-problems/feed
Using quotes in vSlider http://irui.ac/archives/2005/11/28/using-quotes-in-vslider http://irui.ac/archives/2005/11/28/using-quotes-in-vslider#comments Mon, 28 Nov 2005 22:28:54 +0000 Rui http://irui.ac/?p=26 One very interesting debate among web design purists is how to best use CSS to represent quotes. In HTML, it is very simple to markup a block of text as a quote. Simply use the blockquote tag, like this:
<blockquote>The first step to getting the things you
want out of life is this: Decide what
you want.</blockquote>

Using CSS, we can assign a distinct look and feel to make the quote stand out from the text, like making it italic and maybe even indent it a little. A very common technique is to use an image as the quote symbol, and by setting it as the background of the block, we can have a rather nice effect, without any messy “img” tags.
I’ve created a custom quote image for the vSlider theme, and the CSS to use it, so the previous example would be rendered like this:

The first step to getting the things you want out of life is this: Decide what you want.

Now, the problem is that although this looks quite ok, it would be a lot nicer if we could also have the closing quote as well. And this is where the problems begin, since in CSS there is no way we can use two different images as backgrounds for the same block. If we could, it would be rather simple: the opening quote would be defined in the top left, and the closing quote on the bottom right. Since this is not possible, again we have one of those (unfortunately common) situations where we have to mix semantics and presentation. By adding a “div” tag, we can create a nested block with its own style and that can be used as a placeholder for the closing quote.
In the case of vSlider, I have defined this as a class named blockquote-inner. So, we can slightly change our previous example to:

<blockquote>
<div class="blockquote-inner">The first step to getting
the things you want out
of life is this: Decide what you want.</div>
</blockquote>

And the result would be:

The first step to getting the things you want out of life is this: Decide what you want.

Which looks a lot better, if I may say so. Uglier code, true… but nicer result :)
If you are using the vSlider theme, you can give it a try.

]]>
http://irui.ac/archives/2005/11/28/using-quotes-in-vslider/feed
vSlider slides across the world http://irui.ac/archives/2005/11/26/vslider-slides-across-the-world http://irui.ac/archives/2005/11/26/vslider-slides-across-the-world#comments Sat, 26 Nov 2005 19:07:16 +0000 Rui http://irui.ac/?p=25 It makes me extremely happy that a lot of people have downloaded my vSlider theme and are using it on their blogs. I’ve seen it being used from South America to Japan :)
It’s a good feeling to give something back to the community from which I got so much.

Some people have asked me how to change the header image, or how to get the effect they see on iRui.ac of getting a different image on each page refresh. It’s really, really simple. If you look to the folder structure of the theme, you will notice that the default image is located in \vSlider\images\headers\vSlider.jpg, but there is no direct link to this image on the HTML code. That is because I’ve added a little bit of PHP code that selects randomly any image located on that same folder. That is, just dump all your header images there, and they will be immediately picked up – you don’t have to change any code. They should all be the same size as the default one, of course.

I would also like to ask for some feedback on how well the theme works in other browsers and operating systems. As I mentioned in the download page of the theme, I only know how it looks and behaves in IE, FireFox and Opera. If you can leave some comments about this, I would appreciate it.
Also, if you have suggestions for improvements, feel free to shout them out!

]]>
http://irui.ac/archives/2005/11/26/vslider-slides-across-the-world/feed
When subdomains are trouble http://irui.ac/archives/2005/11/21/when-subdomains-are-trouble http://irui.ac/archives/2005/11/21/when-subdomains-are-trouble#comments Mon, 21 Nov 2005 21:45:36 +0000 Rui http://irui.ac/?p=23 This is a good techie tip if you are hosting your site in a “multi-domain” account (you know, when you have a single hosting account, but you can have many domains on the same IP address).
A common problem with these accounts is that they have wildcard DNS enabled, which means that any request for a sub domain that doesn’t exist gets redirected to your main page. The problem is that this will always be the main page of the main account!

Here’s an example to make it clear. Let’s say that you have the domains abc.com and xyz.com on the same account. abc.com is your main domain (the one you used to register…). If you type in your browser 123.abc.com, you will get the homepage of abc.com, which is exactly what you want (I’m assuming that the 123 sub domain doesn’t exist). But if you type 123.xyz.com, you will not get the homepage of xyz.com (as you might have expected), but again the homepage of abc.com - no fun.

Now, there are a couple of options to deal with this. You can disable the wildcard DNS, or mess around with the httpd.conf files, but there are always some loss of functionality if you do this.
For my specific case, I came up with an alternative solution, that doesn’t involve messing around with any configuration whatsoever. You can use a small piece of PHP to interpret the request and then redirect if needed. The basic idea is that if the page sees that the “intended” domain is different, then it redirects the page by sending a new location.
Here’s an example (you have to adapt it to your specific situation):

<?PHP

// Handy function to test end of strings
function endsWith( $str, $sub ) {
   return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub );
}

$requested_host = $_SERVER['HTTP_HOST'];

// If the request was meant for xyz.com
if(endsWith($requested_host, "xyz.com")) {
   header("Location: http://xyz.com");
}

// Anything else goes here
else {
  header("Location: http://abc.com");
}

?>

This may be slightly different for you case, and can even be improved to handle “any” domain, but I think you get the point.

]]>
http://irui.ac/archives/2005/11/21/when-subdomains-are-trouble/feed
404 and IE http://irui.ac/archives/2005/10/26/tipstricks http://irui.ac/archives/2005/10/26/tipstricks#comments Tue, 25 Oct 2005 22:58:31 +0000 Rui http://irui.ac/?p=13 This is a nice tip for people having problems with custom 404 pages in Internet Explorer. If you don’t know what a 404 error is, then let me explain in the shortest form possible:

It’s what your browser gets when it can’t find the page you requested.

There, a very low-tech explanation that goes straight to the point. If you want a “real” explanation, I suggest www.plinko.net.
Take a look around - they have everything you need to know about 404, and then some.

When I was making my very own custom 404 page for this blog, which should be a reasonably easy task, I stumbled upon a really weird problem. No matter how much I tried, I could not see the page in Internet Explorer. It was working fine in Firefox, but IE kept showing me its own standard “Page not found”. I went googling on the problem and it became clear that this is a known issue. IE is a little bit too smart for its own good – if you dig through the options, you’ll find a little gem named “Show friendly HTTP error messages”. If this is enabled, then IE can choose to ignore the content of error pages and show its own version of them. And, this option is enabled by default (of course…).

A good workaround is to prevent your browser from knowing that your page is actually a 404 page, and you can do that by forcing the return of a code 200.
How exactly you do that? Well depends on which technology you are using for generating the pages. Basically, you must be able to control the HTTP headers being returned. In the case of PHP (which I use in this case), I could solve my problem by adding this block of code:

<?php
  header("HTTP/1.1 200 OK");
  header("Status: 200 OK");
?>

The two different styles of declarations are just to ensure that will work, regardless of what version of PHP is being used. Note that this must absolutely be the first thing on the page!
You can check my 404 page. If I did my job right, you should see it, even in IE.

]]>
http://irui.ac/archives/2005/10/26/tipstricks/feed