Nothing To Lose

If you don’t have it, how can you lose it!
Subscribe

Archive for the ‘Hacks’

Moving wordpress bolg… how to keep old links working

January 03, 2009 By: Dexter Category: Hacks, PHP, Tutorial, Wordpress

If you plan to shift your Wordpress blog from old directory to another on the same host, one of the problem you would face is what about the incoming links to the post or what about the links on the search engine results.

Lets take this scenario and some simple solution:

  • Your Blog was initially installed at http://yoursite.com/blog
  • You shifted it to the top level at http://yoursite.com. (see the following link how to do this: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory )
  • Your original links to your posts will be like this http://yoursite.com/blog?p=22 (the number may vary, I am also assuming that your links are set to query string method)
  • If you have followed the procedure form wordpress for the same, you know that your index.php had to be moved to the top level of the site i.e http://yoursite.com
  • So when a person follows the old link, the person either gets to see an error or a listing of the blog directory (which is not good, both the cases).
  • So how do you redirect it to the new location.
  • Here is some code to do the same
  • Write the following code and save it as index.php under the old blog directory (i.e http://yoursite.com/blog/)

  • <?php
    $qs = $_SERVER['QUERY_STRING']; // this fetches the query string i.e the page id.
    $newurl = ‘http://yoursite.com/?’.$qs;  // new location is ready
    ?>
    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <title>Redirecting…</title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
    <!– send the user to new location –>
    <META http-equiv=”refresh” content=”2; url=<? echo $newurl; ?>”>
    </head>
    <body>
    Redirecting……
    </body>
    </html>


  • So now your old links will work magically ;)
  • BTW your are free to use the above at you own risk.

Those Irritating Broken Stubs (repair)

December 28, 2008 By: Dexter Category: Hacks, Repairs, repair

  This is a very usual thing that happens with the new modern plastic cases, though they look good, but these boxes use stubs (see IMAGE 1) to which screws are tightened to hold all the components like the circuit board, transformer etc to the box.

Unfortunately these do not have a very nice hold, i.e. the stub itself is really weak, and over a period of time due the heat and aging of the plastic it becomes weak.

The most irritating stuff that happens is when you have to open these things for minor repairs and you find that the whole of the circuit board is dangling out.
Those dammed stubs are broken.
(See IMAGE 2).

Sticking them is of no use, usually as soon as you try to replace the screw, the sticking material is not able to take the torque and they break loose again.

So big question is what to do?

Well if the stubs are small and you casing permits you to drill some holes through, i.e there is nothing apart from the stubs you can go for the following which I did to my UPS recently to get the circuit board back on place.

  • Check out how many stubs are broken.
  • Get required screw nuts pair and also spacers (IMAGE 3).
    (a spacer is a plastic cylindrical piece similar to the stub but allows to pass the screw through easily.) Also make sure your stubs are of similar height of the stub. (if you can find stubs in the market or are not easily available, take some old sketch pen or similar pen, cut in required small pieces this can also server the purpose).
  • Drill holes at center where the stub was.(IMAGE 4)

    (make sure the holes are of the size that lets the screw pass through easily but stops its head from passing, but if you have already done something like that or the stub is broken in a big hole then use some washers).
  • Put the screws from outside (IMAGE 5) of the casing and place the spacers onto it from inside. (IMAGE 6)
  • Finally Put back the circuit board (or whatever has to be placed there) pass the screws through the original holes and place the nuts onto the screws.

    (IMAGE 7)
  • Tighten carefully, not to tight ( that it breaks the board itself ) or not too loose (that they may drop out any time).
  • And your stuff is back in action and repaired.

    ( IMAGE 8 )

Well hope that was useful.. try it out some time.. as it is  “there is nothing to lose”  ;)  only tightening some loose ends. :)

 

Stub in the plastic case

IMAGE 1: Stub in the plastic case


IMAGE 2: Broken Stub

IMAGE 2: Broken Stub


Screws Nuts and Spacers

IMAGE 3:Screws Nuts and Spacers


Hole drilled at stubs location

IMAGE 4: Hole drilled at stubs location


Screws Through The Holes

IMAGE 5: Screws Through The Holes


Screws put with spacers

IMAGE 6: Screws put with spacers


circuit board placed back

IMAGE 7: circuit board placed back


Final assembly

IMAGE 8: Final assembly

Tags: ,