Archive

Archive for the ‘Software Related’ Category

Link a Category to an External URL in Wordpress

June 6th, 2009 Stephen No comments

What I wanted was have a category link on my site open up an external site in a new tab. A simple task in something like Joomla. But you can’t configure this in Wordpress! It baffles me why such a basic feature is not standard. However, here’s my solution.

First, I tried a lot of redirection plugins. None did what I wanted but the best of these plugins was Redirection. It’s a professional job. First of all I created the category that I wanted to use as an external site link within my category menu. Then I created a dummy post linked to the category, so the category would appear on the site.* I then used Redirection to redirect that category link to an external site. However, while this works great, Redirection cannot redirect to a new window/tab—no redirect can.

It has to be done at the tag level by inserting a target=”_blank” into a link tag. For this, I needed to track down where the category links were being created by Wordpress.

It took a while to track down but the function that handles the output for category links is in wp-includes/classes.php. In there is the Walker_Category class and within that the start_el function, where the category output is created.

if ( $cat_name == ‘Screenshots’ )
$link = ‘<a target=”_blank” href=”‘ . get_category_link( $category->term_id ) . ‘” ‘;
else
$link = ‘<a href=”‘ . get_category_link( $category->term_id ) . ‘” ‘;

I simply added an if statement at the get_category_link section. It checks for a $cat_name match with the category I want to make an external link. (Of course for multiple categories this could be more elaborate) Then I added target=”_blank” to the $link tag for that category only.

Redirection works in perfect harmony with this solution. I suppose I could have hard coded the external link at this point. But no need, since Redirection can handle it. And if I want to change the external URL I can use Redirection instead of hacking code further.

You can see how it works by clicking on the Screenshots link in the category list.

  • NOTE. If you use this for a child category, the dummy page with actually show up under the parent category.
Categories: Computing, Software Related Tags:

Convert MP3 to KMP

March 28th, 2009 Stephen No comments

A great deal was advertised on TV in Seoul recently where you could get a new LG Cyon mobile phone—the strangely named Viewty, model KH2100, for only 26,000 won. It included a charger in the deal and since we needed an extra one of those, we bought the phone.

It’s got all the stuff you’d expect of a latest hand phone, including a cool touch screen instead of any buttons (except for off and on). It came with a cable to hook the phone up to Cyon’s Mobile Sync software. Unfortunately, this software is all in Korean and some fonts just appear as questions marks on my English XP system. But after trial and error I could figure out how to import a CVS file of my numbers into the phone and sync pictures.

Separately from this software, it’s also possible to connect to the phone’s portable 450 MB disk to upload images, text files or music. Great, I thought, I’ll just copy over some MP3 files and away I go—wrong! Like many before me, I misread the signs. When it says MP3 in all advertising, on all of the phone’s music settings, and even on the name of the phone’s default music folder, it does not mean it plays MP3! How stupid of me to think so.

The Cyon can’t play MP3s. Instead, it plays KMPs, which I’ve never heard of. There’s not much info on the net, and I could only find a Mac program that would do conversions—don’t be fooled by something called a KMPlayer, it’s just like GOM Player and doesn’t do conversions—but then I stumbled onto a Korean blog with a small conversion program that thankfully works.

You can download it from here. You don’t need to install it, everything is ready to go in the folder.

Once again, like the Cyon software, this program is made for a Korean operating system so most fonts are question marks, as shown above. Through trial and error again, I figured out how to get it to work. Here are the steps following what I’ve illustrated in the image:

1. This is where you locate and load the MP3 file you want to convert.

2. Put your mobile number (or any number) in here. It won’t work without this.

3. Select the output directory.

4. Do the conversion, which takes about 2 seconds.

Just above the convert button is a button to clear the contents.

Categories: Product Watch, Software Related Tags:

Putting DIVs Side by Side

April 26th, 2008 Stephen No comments

It can be very frustrating working with divs, when trying to modify an existing design. I had a situation where I wanted to modify a design so that the sidebar was not fixed with “relative: absolute” positioning. Things weren’t wrapping how I wanted because of it, plus the sidebar was hiding the footer.

I needed the sidebar to side by side with the content in the one container, but still able to adjust to browser width. Here’s the basic code for how I did it, the basis for which I found on a forum. It’s modified for a fixed width here, though.

First declare this in the head section.

<style type=”text/css”>

#container_div {

width:390px;
padding:6px 0;
border:1px solid #000;
margin:auto;

}

#container_div:after {

content:”;
display:block;
clear:both;

}

#left_div {

float:left;
display:inline; /*required by IE6*/
width:195px;
border:1px solid #999;
margin:0 3px 0 6px;

}

#right_div {

float:left;
display:inline; /*required by IE6*/
width:195px;
border:1px solid #999;
margin:0 6px 0 3px;

}

#left_child p,#right_child p {

font-family:sans-serif;
font-size:0.8em;
text-align:justify;
margin:4px;

}

</style>

Then in the body section, place the divs like this:

<div id=”container_div”>

<div id=”left_div”>

<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula.
Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus
nisl ac enim.
</p>

</div>

<div id=”right_div”>

<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula.
Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus
nisl ac enim. Maecenas vestibulum dolor ut velit. Maecenas condimentum pulvinar purus.
Pellentesque ac ipsum.
</p>

<p>
Quisque nec enim. Nullam elementum. Quisque rhoncus. Ut cursus, pede sit amet facilisis pretium,
</p>

</div>

</div>

The result should look something like this:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula.
Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus nisl ac enim. Maecenas vestibulum dolor ut velit. Maecenas condimentum pulvinar purus.
Pellentesque ac ipsum. Curabitur sodales, elit vel molestie hendrerit, elit odio rhoncus tellus,
nec gravida enim urna id velit. Donec nec tellus. Vestibulum nulla.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula.
Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus
nisl ac enim.

Quisque nec enim. Nullam elementum. Quisque rhoncus. Ut cursus, pede sit amet facilisis pretium,

Categories: Software Related Tags:

Jailbreak iPod Touch 1.1.4 and Add an English-Korean Dictionary

April 15th, 2008 Stephen No comments

I’ve noted before my disdain for Apple and the company’s culture of arrogance. And I’ve mentioned my annoyance at certain decisions made regarding the iPod Touch. What further annoys me about this product is that Apple expects you to pay extra to have some more very basic applications added to it. The way around that is to jailbreak your iPod Touch and get 100s of apps for free.

Here is the easiest way to do it. Simply go to the ZiPhone blog site and download the latest ZiPhone. This program is backward compatible, so it’ll work with any iPod Touch version. Unzip it somewhere on Windows or Mac. Have your iPod Touch plugged in but iTunes off. Now fire up the ZiPhoneGUI.exe.

You will be presented with a screen similar to the one below. The latest version just has one Jailbreak button for both iPhone and iPod Touch. Just click the appropriate button to jailbreak your iPod Touch. You’ll see streams of white font text output on your Touch and it’ll eventually reboot. When that happens, you ready to add sources and start installing free stuff.

I’ve noted on forums that people sometimes get errors and have various problems. If you have problems, you can always fire up iTunes and simply restore your iPod Touch to it’s original condition, in which case I think all previous settings are wiped. I didn’t have any problems at all, at least not with jailbreaking the thing.

For more info on jailbreaking, see iPod Touch Fans, Lifehacker and Lonman06. There are also other methods to jailbreak an iPod Touch. Just search Google.

Wiggle Issue with 1.1.4

The first thing I wanted to do was take of ZiPhone’s web clip link. However, I found that you cannot customize your home screen after the jailbreak. This is easily fixed by adding a repo source to obtain what is called the January App Pack. It contains useful apps that come standard with the iPhone—Weather, Stocks, Google Maps, and Notes. Somewhere in there is also the “wiggle” functionality, or the ability to customize your home screen.

Here is the repo source to add, and a few others:

http://www.spaziocellulare.com/ispazio.xml

http://ipodtouchmaster.com/files/repo.xml

http://applerepos.com/

Refresh your sources. Then search your packages for 1.1.4 iPhone applications and Tweaks. Add the goodness.

Now go to your home screen and touch an icon and hold it for a second or two. You will then see all icons wiggling. Web clips will show a black and white X on their corners. To delete a web clip, such as the one ZiPhone installs, simply click the X and delete.

Manually Add an English-Korean Dictionary

Korea is perhaps the 10th largest economy in the world, and yet iPod Touch does not include a Korean keyboard. I told you Apple sucked. Worse than that, you can’t install an English-Korean or Korean-English dictionary through the installer—at least, not yet. You have to do it manually.

First of all, install weDict via your iPod Touch Installer.

Next, what you’ll be doing is accessing your iPod Touch via the SSH protocol and copying files over. I did this using my Linux machine, however, you can do the same in Windows or Mac.

In Windows, you could download Putty or WinSCP to do it. If you can install the Terminal v100 app on your iPod Touch, you could use that. Initially, I could not install the Term-v100 on 1.1.4. Later, after added the repos above, I was able to. So, here I’m just describing what I did without that app.

To begin, download the English-Korean files from Stardict. They’ll be in a tarball, so if you haven’t got Linux, you’ll need a good zip program that can unzip the formats involved. On Linux, there is dictzip program you can get especially for this; otherwise, other archiving programs will do the job. I believer you can rename the *.dict.dz file to *.dict.gz to unzip. More instructions are here and here.

Once unzipped, you only need the .dict and .idx files. For iPod Touch 1.1.3/4, these need to be copied to the /private/var/mobile/Library/weDict/ folder. For 1.1.1/2, copy them to the /private/var/root/Library/weDict/ folder. For people who don’t want to deal with the command line, I’d recommend using one of the windows programs above.

In Linux, I did this in a terminal window with the following instructions:

scp english-korean.dict root@192.168.0.9:english-korean.dict

and

scp english-korean.idx root@192.168.0.9:english-korean.xdx

Your Touch IP address may differ. You’ll have to got to your Wi-Fi settings to check what it is.

You’ll notice I didn’t nominate a directory to put them in. At the time, I wasn’t sure exactly where they were supposed to go, so I just got them onto the iPod first. Then I logged into the iPod and had a look around with this:

ssh root@192.168.0.9

If you have to logged on the username is of course “root” and the password is “alpine.” Don’t use “dottie” as specified on some sites. That is probably the password for earlier versions. For 1.1.4, use “alpine.”

I found where the weDict folder was and moved (mv) the english-korean.* files there. That’s all there is to it.

Now fire up weDict on your iPod and try a word to see if it gives you its Korean equivalent. If not, you’ll probably need to go into weDict’s settings and make sure there is a tick against “english-korean.”

Korean Keyboard

If you want to go the other way and search Korean-English direction, you’ll need a Korean keyboard. Unfortunately, this does not seem available to 1.1.4 users. You can install a Korean keyboard on iPod Touch 1.1.1 or 1.1.2, and instructions for that are on this site. If you can get a keyboard, then you can install the korean-english dictionary available on the Stardict site, in the same way as I’ve shown above.

Categories: Software Related Tags:

Fixing the Slow Opening of Office 2003 Documents and Worksheets

March 21st, 2008 Stephen No comments

The time it was taking Office 2003 documents and spreadsheets to open on my wife’s PC was a joke. It was a real pain without explanation. And I still don’t know why it happened. However, I did find out how to fix it, not before wasting more of my life because of Windows. I will have to bill Microsoft for the time spent.

Here’s how to fix the problem:

  1. Open My Computer.
  2. Go to Tools -> Folder Options, and click on File Types.
  3. Find the extension of the file in question (XLS, DOC, etc.)
  4. Highlight the extension and click “Advanced.”
  5. Highlight the “Open” Action and click “Edit.”
  6. Click in the “Application used” field
  7. Hit the “End” key to put the cursor at the end of the command.
  8. Put a space and type in “%1″ (With the quotes.)
  9. Uncheck “Use DDE.”
  10. Click “OK.”

If a /dde exists in the “Application used” line, delete it.

That’s it . . . Oh and, by the way, Windows sucks.

Categories: Software Related Tags:

Overcoming How Apple Sucks

December 15th, 2007 Stephen No comments

After my wife purchased an iPod Touch, she was disappointed to find how restrictive it’s video formats were. It annoyed me, too. But Apple’s arrogant and moronic policy on this has annoyed a lot of people. It really is pathetic.

I’ve never had a smooth relationship with Apple, for one reason or another, going way back. I’m certainly not a fan of Apple employees, at least not those I used to encounter in Australia, with their arrogance and impatience at having to converse with peasantry like customers (it’s good to see things are different in Korea). Some Apple users’ attitudes have rubbed me up the wrong way, too. On top of it all, things like video format and iTunes restrictions really take the edge off what are otherwise good products.

In my searches for video conversion programs to overcome Apple’s limitations and absurdities, I came across some decent free ones. We don’t want to be paying for a program by some company riding on the back of Apple’s own money grabbing intransigence, do we? No, so, I thought it’d be a good idea to give some exposure to those who provide a free solution to a problem that should not even exist.

Most people recommend Videora for doing conversions in Windoze. This program seems to work OK, but for all the time it takes to convert files, you could actually watch them and still have time to spare to go for a jog with your old music iPod.

Another free program that works well is Any Video Converter. It’s pretty good, but it’s video resolution setting doesn’t go up to the 480×320 setting I wanted, so I tend not to use it.

Also for free is the Cheetach iPod Video Converter, although I haven’t tested this one yet.

Another program I tried was Winff, for Windows or Linux. It is basically a GUI frontend for ffmpeg, a famous video encoder. It seems to work quite well, and also seems to be quicker than using Videora. However, I think you need to convert again once your video file has been copied into iTunes. As sometimes happens with converted files that will not load into iPod Touch, you have to right-click on the file—once it is in iTunes—and select the conversion you want iTunes to do for you. This can take a while and adds to the total conversion time.

The free program I like to use at the moment is Free Video to iPod Converter, which is a no-nonsense converter and gets the job done pretty quickly. The quality seems fine for our purposes.

Some programs I have yet to check out are MeGUI, XviD4PSP and StaxRip. As far as I know, they all require .NET framework to be installed, and you have to download and install other things to get them to work. It may or may not be worth the effort.

Have a look here for more.

As a side note for Linux users, most of the above programs are not available to you. I’ve tried some of them in Wine, with only Winff working without a hitch. However, for converting video for iPod Touch, I just use a terminal command line to run ffmpeg and the excellent DVD ripper called HandBrake. You can get HandBrake for Windoze, but it won’t rip copyrighted material as the version for Linux will. My adventures in using these resources are on my Linux How-to site and can be found here. (Much of this post comes from that source.)

All that remains now is to find an iPod Touch manager so that we can ditch iTunes.

But the problem is that iPod Touch is not recognized as an external hard disk—-an icon for it does not shows up in Windows–so, you cannot use any of the existing alternative iPod management programs to copy files back and forth between and iPod and your computer.

This means you are at the mercy of iTunes. Already I’ve had unknown error messages pop up, which I had to fix by playing around with sound and head phone settings–I mean, WTF? At other times, iTunes simply does not see the iPod. And that truly fits the definition of being up shit creek without a paddle. Restarting does not solve it. You have to completely shut down and restart. For all of this, Apple, you suck more–deeper and harder.

I’ve searched a lot, but was disappointed to find that Yamipod does not support iPod Touch, nor do any other management programs except Touchcopy, which I have yet to test properly. The problem is that you have to pay for it. But I’m reaching the point where I just might. I’ll try it and see.

I’m sure many programs already out there will eventually have the functionality to work with iPod Touch. It is desperately needed, given the amount of annoyed and disappointed people on forums.

Categories: Software Related Tags:

Insert HTML Code Into HTML, PHP or SHTML Files

December 2nd, 2007 Stephen No comments

The scenario is that I wanted to insert HTML code into HTML, PHP or SHTML files to create the “tab” menu bar seen at the top of the page. For this, the code had to go after the <body> tag in each content management system file that handled the page structure.

To include the HTML code in a PHP source file is a simple matter of using a standard include function:

<?php include_once (’/path/to/menufile.html’ );?>

Or, there are other ways. Some systems will accept this:

require_once ‘/path/to/menufile.html’;

It depends on the system, and it’s just a matter of following what is done elsewhere in each system.

Of course, you also need to link your cascading style sheet file as well, if you are going to use one, which might be done like this.

<link rel=”stylesheet” href=”<?php echo ‘http://yoursite.com/includes/menufile.css’; ?>” type=”text/css” media=”screen” />

Some content management systems incorporate HTML files, each serving a particular purpose. So, I needed to include HTML code in some HTML files to get the “tab” menu to work. The only thing that I could see working for me was an iframe, also just inserted straight after the <body> tag.

<iframe

src=”http://yoursite.com/path/to/menufile.html”
width=”100%”
height=”36″
scrolling=”no”
align=”top”
frameborder=”0″
marginwidth=”0″>

</iframe>

One problem I had with this was that when a menu item was clicked, the webpage it was referencing would load in the frame itself, which you definitely don’t want. To overcome this, I created a separate menufile.html for the sites that needed an iframe. In each page reference, or href I made sure that the target was “parent”, for example, like this:

<a class=”menu” href=”http://somesitename.com/index.html” target=”_parent”>Site Name</a>

The marginwidth at 0 was also important to get the frame to stretch across the browser at 100%.

But I had another reason for creating an iframe specific HTML file as well. I discovered that some things did not work with an iframe, if I linked a stylesheet in the conventional place, that is, between the <head> and </head> tags. So, within the special iframe HTML menu file itself, I added the link to the stylesheet, like this:

<link rel=’stylesheet’ href=’http://yoursite.com/includes/menufile.css’ type=’text/css’>

For some reason, this made everything work, although it’s not proper because it is referenced after the “head” tags. Oh, well, to hell with that, it works.

Inserting HTML into the next file type, the SHTML files, or server side include files, is a breeze–as easy as the PHP insertion method. It’s done like this:

<!–#include virtual=”/path/to/menufile.html” –>

Of course, don’t forget the stylesheet link, if you’re using css. In addition, you may have to add special css tweaks relative to each site, or else you could code the tweaks directly into the sites. That’s because a style for one site might look a bit different on another, or some things might not work at all.

In my case, the “hover” was not working on my MediaWiki site. Nothing I did seemed to fix it. I would move the curser of the links and it would just stay as an arrow. Yet immediately below, the “log in” link worked. It was a world of frustration. However, I found that the solution was to include these parameters in the style sheet:

z-index: 1;
position: absolute;

Problem solved. What this does is cause the tab key, if you happen to use it, to start at the menu and move through each link as you hit tab, then onto the other links below it. Other sites didn’t need it, but this one did. I won’t be forgetting that fix in a hurry.

Update:

Another way I could have done this is to use Frameset, although I haven’t tried it before. With a Frameset, the tabbed menu would remain at the top of the browser regardless of any scrolling by a user.

Categories: Software Related Tags:

Dominating!

October 20th, 2007 Stephen No comments

(Select for a larger size)

I was dominating! A rare moment for me, in the world of Counter Strike, so I just had to post it. On the left you can see my tally: 1 wounded, almost killed, and 3 killed! Sadly, just as I’d taken out my last victim, someone got me with a head shot. You can see my blood splattering everywhere. So, the image captures it all. My death just as I’d reached a moment of glory, just as my “dominating” status was flashed for all to see. Oh, well . . .

The map or environment seen here is an old one and one of my favorites, called awp_india, where everyone is on equal ground, enclosed in a small area with very little cover and with the choice of only two weapons, a sniper rifle (AWP) or a knife. Now, if only real life could be as much fun.

Categories: Software Related Tags:

Web Safe Colour Standards

September 16th, 2007 Stephen No comments

By Dyann K. Schmidel, and repeated here just for fun and because it’s pretty . . .

steelblue steelblue steelblue 4682B4
royalblue royalblue royalblue 041690
cornflowerblue cornflowerblue cornflowerblue 6495ED
lightsteelblue lightsteelblue lightsteelblue B0C4DE
mediumslateblue mediumslateblue mediumslateblue 7B68EE
slateblue slateblue slateblue 6A5ACD
darkslateblue darkslateblue darkslateblue 483D8B
midnightblue midnightblue midnightblue 191970
navy navy navy 000080
darkblue darkblue darkblue 00008B
mediumblue mediumblue mediumblue 0000CD
blue blue blue 0000FF
dodgerblue dodgerblue dodgerblue 1E90FF
deepskyblue deepskyblue deepskyblue 00BFFF
lightskyblue lightskyblue lightskyblue 87CEFA
skyblue skyblue skyblue 87CEEB
lightblue lightblue lightblue ADD8E6
powderblue powderblue powderblue B0E0E6
azure azure azure F0FFFF
lightcyan lightcyan lightcyan E0FFFF
paleturquoise paleturquoise paleturquoise AFEEEE
mediumturquoise mediumturquoise mediumturquoise 48D1CC
lightseagreen lightseagreen lightseagreen 20B2AA
darkcyan darkcyan darkcyan 008B8B
teal teal teal 008080
cadetblue cadetblue cadetblue 5F9EA0
darkturquoise darkturquoise darkturquoise 00CED1
aqua aqua aqua 00FFFF
cyan cyan cyan 00FFFF
turquoise turquoise turquoise 40E0D0
aquamarine aquamarine aquamarine 7FFFD4
mediumaquamarine mediumaquamarine mediumaquamarine 66CDAA
darkseagreen darkseagreen darkseagreen 8FBC8F
mediumseagreen mediumseagreen mediumseagreen 3CB371
seagreen seagreen seagreen 2E8B57
darkgreen darkgreen darkgreen 006400
green green green 008000
forestgreen forestgreen forestgreen 228B22
limegreen limegreen limegreen 32CD32
lime lime lime 00FF00
chartreuse chartreuse chartreuse 7FFF00
lawngreen lawngreen lawngreen 7CFC00
greenyellow greenyellow greenyellow ADFF2F
yellowgreen yellowgreen yellowgreen 9ACD32
palegreen palegreen palegreen 98FB98
lightgreen lightgreen lightgreen 90EE90
springgreen springgreen springgreen 00FF7F
mediumspringgreen mediumspringgreen mediumspringgreen 00FA9A
darkolivegreen darkolivegreen darkolivegreen 556B2F
olivedrab olivedrab olivedrab 6B8E23
olive olive olive 808000
darkkhaki darkkhaki darkkhaki BDB76B
darkgoldenrod darkgoldenrod darkgoldenrod B8860B
goldenrod goldenrod goldenrod DAA520
gold gold gold FFD700
yellow yellow yellow FFFF00
khaki khaki khaki F0E68C
palegoldenrod palegoldenrod palegoldenrod EEE8AA
blanchedalmond blanchedalmond blanchedalmond FFEBCD
moccasin moccasin moccasin FFE4B5
wheat wheat wheat F5DEB3
navajowhite navajowhite navajowhite FFDEAD
burlywood burlywood burlywood DEB887
tan tan tan D2B48C
rosybrown rosybrown rosybrown BC8F8F
sienna sienna sienna A0522D
saddlebrown saddlebrown saddlebrown 8B4513
chocolate chocolate chocolate D2691E
peru peru peru CD853F
sandybrown sandybrown sandybrown F4A460
darkred darkred darkred 8B0000
maroon maroon maroon 800000
brown brown brown A52A2A
firebrick firebrick firebrick B22222
indianred indianred indianred CD5C5C
lightcoral lightcoral lightcoral F08080
salmon salmon salmon FA8072
darksalmon darksalmon darksalmon E9967A
lightsalmon lightsalmon lightsalmon FFA07A
coral coral coral FF7F50
tomato tomato tomato FF6347
darkorange darkorange darkorange FF8C00
orange orange orange FFA500
orangered orangered orangered FF4500
crimson crimson crimson DC143C
red red red FF0000
deeppink deeppink deeppink FF1493
fuchsia fuchsia fuchsia FF00FF
magenta magenta magenta FF00FF
hotpink hotpink hotpink FF69B4
lightpink lightpink lightpink FFB6C1
pink pink pink FFC0CB
palevioletred palevioletred palevioletred DB7093
mediumvioletred mediumvioletred mediumvioletred C71585
purple purple purple 800080
darkmagenta darkmagenta darkmagenta 8B008B
mediumpurple mediumpurple mediumpurple 9370DB
blueviolet blueviolet blueviolet 8A2BE2
indigo indigo indigo 4B0082
darkviolet darkviolet darkviolet 9400D3
darkorchid darkorchid darkorchid 9932CC
mediumorchid mediumorchid mediumorchid BA55D3
orchid orchid orchid DA70D6
violet violet violet EE82EE
plum plum plum DDA0DD
thistle thistle thistle D8BFD8
lavender lavender lavender E6E6FA
ghostwhite ghostwhite ghostwhite F8F8FF
aliceblue aliceblue aliceblue F0F8FF
mintcream mintcream mintcream F5FFFA
honeydew honeydew honeydew F0FFF0
lightgoldenrodyellow lightgoldenrodyellow lightgoldenrodyellow FAFAD2
lemonchiffon lemonchiffon lemonchiffon FFFACD
cornsilk cornsilk cornsilk FFF8DC
lightyellow lightyellow lightyellow FFFFE0
ivory ivory ivory FFFFF0
floralwhite floralwhite floralwhite FFFAF0
linen linen linen FAF0E6
oldlace oldlace oldlace FDF5E6
antiquewhite antiquewhite antiquewhite FAEBD7
bisque bisque bisque FFE4C4
peachpuff peachpuff peachpuff FFDAB9
papayawhip papayawhip papayawhip FFEFD5
beige beige beige F5F5DC
seashell seashell seashell FFF5EE
lavenderblush lavenderblush lavenderblush FFF0F5
mistyrose mistyrose mistyrose FFE4E1
snow snow snow FFFAFA
white white white FFFFFF
whitesmoke whitesmoke whitesmoke F5F5F5
gainsboro gainsboro gainsboro DCDCDC
lightgrey lightgrey lightgrey D3D3D3
silver silver silver C0C0C0
darkgray darkgray darkgray A9A9A9
gray gray gray 808080
lightslategray lightslategray lightslategray 778899
slategray slategray slategray 708090
dimgray dimgray dimgray 696969
darkslategray darkslategray darkslategray 2F4F4F
black black black 000000
Categories: Software Related Tags:

PHP Fusion Mod: Only Show Utilized News Categories

July 28th, 2007 Stephen No comments

It annoyed me that when the News List is selected in PHP Fusion, you get the whole list of news categories with their images, regardless of whether they have any news associated with them. This means that people have to scroll through all categories to see what news is available. Other PHP Fusion sites did the same thing. I was amazed no one had done anything about it.

I wanted to fix things so that only news categories with news would be displayed with their news items listed. The file I had to modify for this was news_cat.php in PHP Fusion’s root directory.

Basically, what I did was add an SQL query on the “news” database table that is based on the current news-category ID being processed. Then I have an “if” statement that checks that the current news category ID is present. I don’t care what the number is; I just want to check whether the “news” table has an entry with that category. If it’s present, normal processing continues; if not, than everything is skipped.

Most of this file consists of an “if-else” statement beginning with “if (isset($cat_id))”. The code I needed to modify was what immediately followed the latter “else” part of this statement, within a “while” loop. As you can see I’ve coloured my added code blue.

} else {
$res = 0;
$result = dbquery(”SELECT * FROM “.$db_prefix.”news_cats ORDER BY news_cat_id”);

if (dbrows($result)) {
echo “<table cellpadding=’0′ cellspacing=’1′ width=’100%’ class=’tbl-border’>\n”;
while ($data = dbarray($result)) {

$myresult = dbquery(”SELECT * FROM “.$db_prefix.”news WHERE news_cat=’”.$data['news_cat_id'].”‘ ORDER BY news_datestamp DESC LIMIT 20″);
$mycheck = dbarray($myresult);

if ($mycheck['news_cat']) {

$rows = dbcount(”(news_id)”, “news”, “news_cat=’”.$data['news_cat_id'].”‘ AND “.groupaccess(’news_visibility’).” AND (news_start=’0′||news_start<=”.time().”) AND (news_end=’0′||news_end>=”.time().”)”);
echo “<tr>\n<td width=’150′ class=’tbl1′ style=’vertical-align:top’><img src=’”.IMAGES_NC.$data['news_cat_image'].”‘ alt=’”.$data['news_cat_name'].”‘><br><br>\n”;
echo “<b>”.$locale['401'].”</b> “.$data['news_cat_name'].”<br>\n<b>”.$locale['402'].”</b> $rows</td>\n”;
echo “<td class=’tbl1′ style=’vertical-align:top’>\n”;
if ($rows) {
$result2 = dbquery(”SELECT * FROM “.$db_prefix.”news WHERE news_cat=’”.$data['news_cat_id'].”‘ AND “.groupaccess(’news_visibility’).” AND (news_start=’0′||news_start<=”.time().”) AND (news_end=’0′||news_end>=”.time().”) ORDER BY news_datestamp DESC LIMIT 10″);

while ($data2 = dbarray($result2)) {
echo “<img src=’”.THEME.”images/bullet.gif’ alt=”> <a href=’news.php?readmore=”.$data2['news_id'].”‘>”.$data2['news_subject'].”</a><br>\n”;
}
if ($rows > 10) echo “<div style=’text-align:right’><img src=’”.THEME.”images/bullet.gif’ alt=”> <a href=’”.FUSION_SELF.”?cat_id=”.$data['news_cat_id'].”‘>”.$locale['405'].”</a></div>\n”;
} else {
echo “<img src=’”.THEME.”images/bullet.gif’ alt=”> “.$locale['404'].”\n”;

}

}
}
$res = 1;
}

Note that the end bracket of my “if” statement is the forth one above, just before the closing brackets of the existing code’s “if” statement and “while” loop.

Categories: Software Related Tags:

How I got CS Working with Wine on Linux

June 19th, 2007 Stephen No comments

I finally installed wine, following much the same procedure as documented here. Then I installed CS. There were no problems installing either of them. I could run Steam, but I couldn’t get any graphics showing, i.e. latest news images, and so on. That didn’t matter too much. However, I couldn’t run CS.

The short version of how I fixed it is just below. If these steps don’t work for you, the longer version further below may contain something useful.

In Wine’s Registry I imported the following by saving it to a “file.reg” then importing it with “wine regedit file.reg”. This seemed to stop Steam from hanging on me when games were installing.

“UseGLSL”=”enabled”

In winecfg:

1. Under Graphics, I turned off “pixel shading” and I checked “Allow DirectX apps to stop the mouse leaving the window” & “Allow the window manager to control the windows”

2. Under Audio, “Hardware Acceleration” is set to Emulation and the OSS Driver box is ticked. I’ve also checked “Driver Emulation,” although I don’t think this matters much.

3. Under Applications, I set “Windows Version” to either Vista or XP.

In Steam:

1. I entered the following into CS Source’s Launch Options: -dxlevel 90

There might be more to my success, such as getting rid of the “libjack” error (as specified below), but I don’t think so. As it stands, everything is working, except that the graphics are not as good as in Windows. I’ll keep working on that.



The long version
of what I did to get CS working is as follows.

First of all, when I ran CS, I only got a black screen.

I tried all the recommended fixes for this at http://appdb.winehq.org/appview.php?iVersionId=3731

Turning off pixel shading got me past the black screen issue.

====================

But I still couldn’t run the game. It’d load and then crash. I tried the recommended commands.

This gets into the game but it crashes after a few seconds

cd ~/.wine/drive_c/Program\ Files/Steam && WINEDEBUG=-all wine steam -applaunch 240

Then i tried the menu link, which is pretty much the same. It crashed at the point the game screen should come up.

env WINEPREFIX=”/home/stephen/.wine” wine “C:\Program Files\Steam\steam.exe” -applaunch 240

====================

I read that it might be a sound problem and I should list conficting sound devices with this:

lsof /dev/snd/pcm* /dev/dsp

Nothing found.

====================

I read that the game launch setting of -dx_level 70 would work. I tried that and other dx levels. They had no effect. Later I would find another reference to these levels that says to set them using this: -dxlevel 70. That was some time later, though. I’ll get to that.

====================

Then I found this post:

On some systems non-root users can’t set negative nice values by default. This privileges problem could probably have some light shed on it by saying what platform/shell you’re running.

In the meantime, if you aren’t going to remove that restriction before your next gaming sesh, you can run the program and then change the priority from elsewhere by running the process as the desired user, then using:

renice -10

as root. With judicious scripting you could achieve the same effect as the sudo given above – ie for tonight’s gaming you could probably get away with using this in your steam script and running it as an ordinary user:

WINEDEBUG=”-all” wine Steam.exe $* & su -c “renice -20 -p `pidof wine`”

which, assuming your system likes that (you might want sudo), would require you entering your root pass immediately upon running it, but use no root privs for the program itself.

So I followed it using this. It gets into the game but it crashes after a few seconds and I can’t enter the su password.

WINEDEBUG=”-all” wine Steam.exe $* -applaunch 240 & su -c “renice -20 -p `pidof wine`”

I try running the su “renice” command separately after running wine so I could enter the password. Others use a nice command, but I get a nice parameters error or else permission denied. Running “renice” didn’t do anything.

====================

I took off driver emulation in winecfg’s Audio and that gave me the longest game play ever, around 10 seconds. Everything was very fast, impressive, until then.

====================

I noticed a libjack error and so I made a link to the already installed version:

root@server1: /usr/lib ~: ls -al | grep libjack
lrwxrwxrwx 1 root root 4 2007-02-05 18:36 libjack0.100.0 -> jack
lrwxrwxrwx 1 root root 25 2007-02-05 18:36 libjack-0.100.0.so.0 -> libjack-0.100.0.so.0.0.23
-rw-r–r– 1 root root 78192 2007-01-13 00:58 libjack-0.100.0.so.0.0.23

root@server1: /usr/lib ~: ln -sf /usr/lib/libjack-0.100.0.so.0 /usr/lib/libjack.so

It didn’t do anything except get rid of the error.

====================

I came across this site with a how-to and followed its advice on starting the game.

WINEDEBUG=”fixme-all” wine Steam

Steam worked but the game didn’t launch at all.

====================

Then I suddenly remembered that I might need Cheating-Death to be running in case that was why my game play was being cut short. I downloaded that and installed it.

This time the game crashed just after the player model selection.

====================

It could be Steam causing it . . . some guy said. Yeah, right, thanks.

====================

The guys on this site had similar problems to me: http://bugs.winehq.org/show_bug.cgi?id=7698
Apparently what was happing was a “[Bug 7698] Counter-Strike:Source crashes after a while”

I tried some of their suggestions:

Running under winver 98 mode (set in winecfg) I got the longest playtime ever. However, key commands don’t work, so I can’t move. When I get shot the game crashes with a runtime error message popping up.

Anyway, support for winver 98 will finished at the end of June, 07.

I tried another suggestion, running with -nosound.

WINEDEBUG=-all wine steam -applaunch 240 -nosound

This gave me no sound, but again I couldn’t move during the game and it crashed as well.

====================

Other suggestions I tried were to run with different screen resolutions. I set these in the winecfg graphics section.

Well, everything crashed and left my Linux screen at a tiny resolution

====================

Earlier, I had put -applaunch 240 in the game launch options as well as -dxlevel 80, but forgot about them because they didn’t seem to have any effect.

Then when I played around with winver and tried windows vista, things seemed to start working. The CS resolution was still set to -dxlevel 80 or something but I could easily change that via the games video options. I adjusted the screen to 1280×1024 LCD and Normal (4:3) and it worked. CS just keep running–no crashes at any stage. The graphics were a little basic but the thing is, it kept running. The only problem was that I had no keyboard control.

To got that when I enabled “Allow the window manager to control the windows”

Everything appears to be working fine. Everything in fact is faster then in Windows. I just need to get better graphics and it’s goodbye booting into Windows.

====================

Some things I haven’ t tried yet that might improve the graphics are these:

Run regedit and go to: HKCU -> Software -> Wine -> Direct3D

Set the OffscreenRenderingMode key to the value “fbo”, “backbuffer” and “pbo” in
turn, trying the game in each mode.

Categories: Gaming, Software Related Tags:

PHP Fusion Mod: Anonymous Guest Comments

May 24th, 2007 Stephen No comments

I wanted to allow people to leave comments on my PHP Fusion site without the hassle of registration or logging in. That process has always annoyed me about sites, when all I have wanted to do was say thanks or something, and not be forced to jump through hoops to do so.

When attempting to implement a quick and easy system, I was confronted with two main issues:

  1. Php Fusion doesn’t allow a method via the back end administration to allow commenting by guest users.
  2. Open commenting is asking for trouble from spammers who bombard your site with porn links, etc.

(UPDATE TO WHAT FOLLOWS: note that I still have received spam. If a person whats to post it, there’s nothing you can do, except disable comments altogether. If a bot it still getting through, then the Botslap infusion might be a solution.)

The first issue is solved by some simple edits to the /includes/comments_include.php file. I found out how to do this on a forum site. You simply need to find 3 references to

$settings['guestposts'] == “1″ and change the 1 to a 0.

What this does is allow commenting by anyone.

So near the beginning find

if ((iMEMBER || $settings['guestposts'] == “1″) && isset($_POST['post_comment'])) {

Change the “1″ to a “0″

Then find

} elseif ($settings['guestposts'] == “1″) {

Change the “1″ to a “0″

Lastly, find

if (iMEMBER || $settings['guestposts'] == “1″) {

Change the “1″ to a “0″

Next I downloaded the Comments Spam Protection mod from here

It’s simply a comments_include.php replacement. I noticed that this was for an earlier version than my PHP Fusion, and that its code was quite different from my existing comments_include.php. It seemed to work, but I decided not to risk using it and instead transferred the necessary code across to my existing comments_include.php.

I prefered my spam protection math question to be at the top rather than the bottom, so it wasn’t quite and direct transfer. Also, because of code differences, I had to add a little bit of code of my own.

First find

}
redirect($clink);
}

and change it to this (here is where you can put your own error message)

} else {
$invalid = true;
$comment_message2 = trim(stripinput(censorwords($_POST['comment_message'])));
echo “<div style=’text-align:center’><br />You must answer the maths question correctly for your comment to be added. This is to prevent bots from spamming the comments. We apologise for the inconvenience.<br /><br /></div>”;
}

if(!$invalid) redirect($clink);
}

Next find (note it’s c102, not c100)

tablebreak();
opentable($locale['c102']);

and insert the numbers generation code like this

tablebreak();

// Calculate random equation and answer
$var1 = rand(1,5);
$var2 = rand(1,5);
$equation = $var1 . ” + ” . $var2 . ” = “;
$validation_answer = $var1 + $var2;

opentable($locale['c102']);

Lastly, find this

echo “<tr>
<td align=’center’><textarea name=’comment_message’ rows=’6′ class=’textbox’ style=’width:400px’></textarea><br>

and insert the code for the input field like this

echo”<tr style=’ text-align: left; height: 25px;’>
<td>”.$equation.” <input type=’text’ name=’validation’ value=” class=’textbox’ style=’width:250px’>
<input type=’hidden’ name=’validation_answer’ value=’$validation_answer’ class=’textbox’ style=’width:250px’>
</td>
</tr>
<tr>
<td align=’center’><textarea name=’comment_message’ rows=’6′ class=’textbox’ style=’width:400px’>”;
if($invalid) echo $comment_message2; echo”</textarea><br>

That’s it. You’re good to go.

Categories: Software Related Tags:

How to Stop Browser Jumps Because of the Scroll Bar

March 28th, 2007 Stephen No comments

When a web page on your site does not reach the height of your browser, there won’t be any scroll bar. However, if you then select a page that has lengthy content, a scroll bar will appear, and this will cause the browser to “jump” to accommodate the extra width. It can be annoying and untidy.

To fix it is simple, just have a scroll bar all of the time. Here is what to put in your CSS file:

html { height: 101%; }

Categories: Software Related Tags:

Java Guitar Scales Codex

March 25th, 2007 Stephen No comments

I spent much of my teenage youth playing guitar. The interest waned but returned in later years, after the Internet had really taken off and after I had studied computer programming. Compared to my teenage years, so much information now is out there freely available online. If only . . .

When my interest was reawakened, I was searching the net for free guitar programs and came across a brilliant Guitar Scales Codex. I’d saw some programs and sites that provided the same kind of thing but nothing like this Java software. I took it apart with a decompiler and had a look at the code. Then I added some extra scales of my own to the code and recompiled it.

Here it is, the Guitar Scales Codex.

The program so impressed me that I contacted the creator of it, a German guy named Robert Ley, and told him what a good job he had done. Naturally, he was pleased to get some feedback. Once again, great job Robert!

He’s updated things since then and added some new stuff, so check out his site here.

Categories: Music, Software Related Tags:

Having a Good TiddlyWiki

March 24th, 2007 Stephen No comments

The following refers to the TiddlyWiki you can get by right clicking here and saving the “link” or “target” to download.

You enter data into a TiddlyWiki through a tiddler. When you want to make one just click ‘new tiddler’ on the menu on the right. Hover the mouse over the top right of the tiddler that appears and click ‘edit’ to write in it and give it a title. Then click done, which saves it (if you have Auto Save enabled; otherwise, select “Save Changes”). You will see whatever you have created listed under the ‘All’ tiddlers tab.

Now, if you want to have things in the menu, or create new menu items, click ‘Edit Main’ up the top. You can see into the tiddler, once you click ‘edit,’ and note how headings and drop down headings are created. You’ll notice at the bottom, the name of ’systemTiddlers.’ This is a tag. You can give anything one or more tag names like that. You don’t have to do anything else except put some tag name, if you want to group things, at the bottom of any tiddler. Then you can see it under the tags tab. The beauty of this is that you don’t have to keep track of any hierarchy.

For example, to put something in the top menu, do this: create a new tiddler; open it up with edit and give it a name and at the bottom give it a ‘Notes’ tag. Then click ‘done.’ Now when you click the drop down of ‘Notes’ in the main menu you will see a link to your new tiddler. Or else, just open this tiddler and add ‘Notes’ at the bottom of it, then click ‘done.’

Here’s another empty TiddlyWiki from the official TiddlyWiki site at http://www.tiddlywiki.com. Right click on this link to empty.html and selecting ‘Save link as…’ or ‘Save target as…’. You can choose where to save the file, and what to call it (but make sure that it’s saved in HTML format and with an HTML extension).

For even more versions of TiddlyWiki, have a look at the Ubantu Demo Site

Here’s a tip. If you want everything you can see at the TiddlyWiki sight, or any other Tiddly site, just right click on the web page and choose “View Source.” A window will open up showing the web page’s source code. Do a Ctrl-A to select all of the source code and then a Ctrl-C to copy it. Now open up Notepad or Wordpad and do a Ctrl-V to paste all of the code. Save the file as whatever name you like, but give it a htm or html extension. Then double click on it to open up your new fully featured standalone TiddlyWiki.

By the way, you can also get a tiddlywiki that resides on a server is run using MySQL.

Categories: Software Related Tags: