Techie Tuesday

With “Techie Tuesday,” I am planning on providing interesting tidbits on code, HTML, tech websites or anything that seems to relate.

Need snowflakes? Use dingbats:


Symbol   HTML             Unicode
    ✻        &#10043 or &#x273B

    ✽        &#10045 or &#x273D
    ❄        &#10052 or &#x2744
    ❅        &#10053 or &#x2745
    ❆        &#10054 or &#x2746
    ❇        &#10055 or &#x2747
    ❈        &#10056 or &#x2748

siggy

Source: unicode.org

A month of blogging

During September, my blogging frequency declined a bit and October wasn’t much better. In an effort to jump start the posting again or burn myself completely out, I am challenging myself to post every day in November. I will be busily knitting and able to blog about some of the knitting, but not all as Christmas is quickly approaching.

siggy

In which I finally fix a theme

The more time I spend digging around themes, the more I learn about WordPress, PHP, and CSS. I am consistently downloading themes that don’t work correctly with my Gallery2 plug-in. Don’t confuse this with the new, built-in WordPress gallery. This is the independent application with a plug-in that powers my photos page. With few exceptions, the themes I download consistently break the footer on my photo page or the sidebar on my library page generated by Now Reading. I really like the current theme, Fall Season 1.1, but the footer on the photo page was not playing well with the plug-in. For a while, I wanted to blame the two previously mentioned plug-ins, but they both play well with WordPress Default theme. That fact lead me to the logical conclusion that the themes are broken. I have also started to “fix” the themes that don’t come with dynamic (changeable) sidebars. I downloaded Fresh Editorial today looked to be dynamic when I grabbed it, the proper code was in place for the functions file, but was absent in the sidebar file. I think I understand why, it was a bit complicated to make the sidebar look the same after updating it, but with a little tweaking, it would be possible. I have chosen not to spend more time on it at this point, as their site doesn’t support FireFox 3 so i am unable to leave comments unless I visit their site with Internet Explorer. See comments for why I was unable to leave a comment. I also found a wonderful Christmas theme, Winter Red. Winter Red will need tweaking as both the library page and the photo page are seriously out of whack.

All this to say I think I am the only one getting anything out of metablogging, but in the hopes that someone else using WordPress and these themes happens to search for how to fix things, I’d like to have an answer for them.

Why Orange?

This site was orange from August 5, 2008 through August 28, 2008 in protest of IOC allowing China to host the Olympics. There are numerous human rights violations which continue to be denied by government officials in China. I must confess, for the two weeks in which NBC was unwatchable I should have gone two weeks without watching any TV. However, it didn’t occur to me until just now that it would have been easier to do it when there wasn’t much to watch. Instead, maybe it will be a real sacrifice when I actually do it.

siggy

The wonders of GIMP

GIMP is a GNU image manipulation program, does that explain enough? Probably not, it is a graphic editing/creating program that is available free for Windows, Linux and Mac. Last night while surfing for holiday WordPress themes, I went to wiki to find out a list of all the holidays in the US and happened upon a site for free and paid PhotoShop tutorials. So I followed one of the tutorials using GIMP and created the above graphic. Since I didn’t find as many themes as I had hoped, one for Valentine’s Day, Christmas, Winter, and St. Patrick’s Day, I decided that I would create a few graphics to substitute in current themes. Unfortunately, when I created the above image, I did so in a rather small resolution in case I didn’t like the result, so I can’t enlarge it. So now I need to redo it all, grr, in a larger size.

siggy

Knitting Podcasts Revisited

In April, I sat down and listed all of the knitting related podcasts in recent subscription. Many of those are still in my list, a few have gone by the way, several are on summer hiatus. Due to a nearly empty iPod, I have subscribed to a few more with the hopes of education and entertainment. To make the cut the podcast had to be currently recording and related to knitting. I present another list and will add critique as applicable with a standard disclaimer and a twist. You may find objectionable content at the following links, I cannot attest as I have not previewed. Just sharing the wealth of knowledge currently at my fingertips.

siggy

A lesson in WordPress

You may not have noticed there is an event countdown widget1 in my sidebar. Since no one has complained, I gather that no one is particularly upset that I countdown to a few select events and birthdays. Really, it’s a reminder to me that it’s coming soon because I do tend to forget things.

Yesterday, I discovered a small bug in the display of the events. I’m not sure if it has always been there and I’m blind or what, needless to say, I live in GMT-5 time zone give or take a little daylight savings time, it’s lovely here. The weather is ever changing, there are interesting birds and animals. However, the code as written doesn’t address possible time zone issues. The code assumes that the host computer is in the same time zone as the event, which is not always accurate. In an ideal world the plug-in/widget would ask me to input my desired time zone and adjust accordingly, someday I may sit down and “fix” it so that it does inquire. In my case, the server hosting this application lives in California, GMT-8 give or take a DST. What does it mean? My events calendar is about 3 hours off when it displays an event. For example, it’s midnight in GMT-5 and an event occurs at 8:00AM. As the code is written, the event is is not 8 hours away, it’s 12 hours away. In another example, an event that happened 2 hours ago is listed as one hour in the future with the code as written.

I don’t write PHP from scratch, I just read it, usually understand it and then alter it to suit my needs. But this time, I really just wanted a quick fix. This particular code was written in PHP and WordPress, so rather than trace the code from top to bottom across two files, I chose the one file I knew I needed to change and went to work. I changed random and not so random numbers and hoped that I would find it while refreshing the events list. Chaos ensued. After spending too much time, I gave in and read the code across the two files as well as comparing it to the two web pages that are produced from those files. One file is the admin interface page where all events are entered into the php database and stored as variables in the table. The other file waits to be called by a widget or page, and then pulls data out of the database, applies code to it, and displays it. All I have to say for my efforts is, “DUH!”

I had already determined that the problem existed because the of host server being in a different time zone and hoped to alter the script to tell the host server to pretend it was in my time zone. That didn’t work so much, so I read about what the different time statements were. I spent some time at PHP-Date.com and PHP.net reading about various date/time functions like current_time(), date_default_timezone_set(), date_default_timezone_get(), gmmktime(), strtotime() and a few more. The solution turned out to be very simple once I read the code and looked up what each command did. In my defense, there are nine variables but between the two files, the order is constantly rearranged so I had mixed up four of the variables, thinking they held values they didn’t hold. I discovered that current_time() was a WordPress function and MYSQL function. The actual line I tried to alter was current_time(timestamp, $gmt = 1), the however, I don’t know how variable for $gmt is used by WordPress nor what the possible values are beyond 0 and 1. I tried to alter it up through 10 and didn’t find the correct value, I added single quote/apostrophe around timestamp, I tried using mysql instead but that seemed to break it the most. Dates were displayed as seconds, rather than years, months, weeks, hours, minutes, and seconds. Why on earth would that happen? Well, Unix/Linux uses a time system based on the Gregorian calendar and midnight on January 1, 1970, also referred to as Unix Epoch. All dates/times are expressed as seconds before (negative values) or after (positive values) that date. Fun factoid: The 24 hours (a.k.a. 86400 seconds) representing August 5, 2008 are through . The previous timestamps are generated using the php command strtotime() because I desperately need to something to show for the last 24 hours. Should you like to experiment with this, I recommend using using your favorite search engine and looking up the terms “unix time” or “POSIX time” along with the word converter. Please be aware that based on the command used to call the timestamp, results will vary so you may not get the same result across several different converters. I didn’t count them all, but there didn’t seem to be a shortage of unique commands to call time for various purposes, such is the nature of UNIX/Linux. One of the reasons for the difference is a problem calculating leap seconds. I’ll spare you the details.

As I just mentioned, strtotime() was a php function. While searching, I found that the php-date.com page had an interactive strtotime() box, strtotime() was used several places in the timestamp section. I could display the current GMT time, then practice using different commands to alter the displayed time. After reading that, I wondered why both strtotime() and current_time() were used. So I changed current_time() to strtotime(‘+ 3 hours’) because I knew it would display the correct time based on experiments at php-date.com, at least until DST ends. Solving it this way seems crazy because somewhere in California the current time is converted from GMT to GMT-8 and I basicall changed it to GMT-8+3. Some day I’ll learn how to use the time zone things and just use GMT-5, but all it did today was break the plug-in, so I’ll leave it for now.


1 A widget is a piece of code inserted into a spot on the sidebar to perform a function. There are many widgets that have been in my side bar including a search bar, the answer to why this site is orange for August 2008, a random image from my photo gallery, and Now Reading (a list of books).

siggy

Chasing my tail

How many blogs does it take to answer my question about pingbacks? The correct answer is at least four, but three of them were mine and I ultimately answered my own question.

When I installed WordPress 2.5, my pingbacks broke. You may wonder what a pingback is or you may not be interested in the slightest. If you are not interested, this may be the post to skip, unless you enjoy watching a kitty chase her tail for hours and hours and hours before remembering she has one important blog, this one, and two test blogs. Normally I don’t have two test blogs, usually it is just one, however, a few weeks ago I was attempting to help a fellow knitting forum member with her pre-2.5 blog, so I installed the version she was running and before I broke my blog at the 2.5 install, I upgraded the test blog to be sure nothing would break. I failed to take into account my web host breaking the one-click install, lesson learned let me assure you. To attempt to head-off any further problems I set up an identical blog to this main one with the same posts and settings behind the scenes, as well as the same plugins also behind the scenes.

After spending a few hours combing the wordpress.org codex, then the “interwebs” at large, I decided my answer did not lay out there, it lay between my head and my three installs. I say it took at least four blogs to answer the question because wordpress.org is a blog and I found a few individuals attempting to be helpful on their blogs, but didn’t answer my question. I also checked WordPress.com to reassure myself that WordPress 2.5 did indeed know how to handle pingbacks. You may wonder what a pingback is, a pingback appears on my blog in the comment of a post when someone out in the wide “interwebs” writes something and links back to a specific blog post of mine.

Out of pure frustration of nothing to show for an afternoon’s worth of work, I set about digging through my theme’s code, hoping maybe the theme was broken, no such luck. I then decided to open the test blogs. I admit, I forgot about the second blog running a really old version of WordPress until I went looking for the password for the first test blog. That second install turned out to be a huge help to the investigative process. I worked to make both 2.5 versions mirror each other in code and active plugins. My main blog would catch one or two out of six actual pingbacks. The other two blogs found all the pingbacks I sent. Again, a bit stumped, I started to wonder if it was a versioning problem with a plugin, the test blog doesn’t have the newest versions of all the plugins I have installed. I only update them when I am using it to test something. It then occurred to me that I redirect this blog. The install folder is not at the root of my site, nor will it be again. That is part of what broke it the first time and made it more difficult to fix. One-click install from my dearest host likes to install to a completely empty folder, no other files or folders present. So when it broke and I reinstalled it, I was going to have to create a subfolder or delete all my photos, files, etc and start over from scratch. I was already deeply saddened by the loss of my blog and did not wish to lose anymore. WordPress 2.x has a setting that allows users to indicate where the blog source files are located while redirecting traffic to another location. In my case, my install is at http://proefrocks.net/blog/, while until today, you viewed it at http://proefrocks.net. My test blogs were not redirecting traffic like the main blog is/was. Once I change the setting to redirect it, the pingbacks broke there as well. Which was a huge relief. I blame my own troubleshooting skills becoming rusty. Ten months ago, this problem would have been solved in under an hour. I also discovered along the way I could force pingbacks if I consistently put a trackback url into each post. That’s not going to happen. I’m trying to retrain my brain to remember to put tags on my posts, about 50-50 there and I’ve always used categories but again, 75-25 there.

To summarize, you will notice a change in my domain layout. When you visit http://proefrocks.net you will now be greeted with a static (unchanging) page with links to several different areas of the domain, one of which will be this blog. I will probably link to Josh’s blog, my photo gallery and the photo gallery for BWCA (Boundary Waters Canoe Area). The page will be updated as changes dictate.

Still to do, create a custom redirect script. June 13, 2008: I created the .htaccess file at the root directory per apache.org. Luckily for me, my permalink structure is simple, all posts from 2008 appear to be in a folder called 2008 and those from 2007 appear to be in folder called 2007. The simple addition of two lines directing requests for 2008 to now go to blog/2008 and 2007 to go to blog/2007 has rendered all links out there in the “interwebs” valid.

P.S. If you remember to move .htaccess and index.php from root back to the WordPress folder, be sure to edit everything and well, I had to empty .htaccess in the WordPress folder which then broke my entire site. I fiddled for another hour and then remembered that plugins cause 2.5 to become rather unruly. I deactivated my gallery plugin, WPG2, emptied the .htaccess again and reactivated the plugin. Then I allowed WPG2 to reconfigure itself, rewriting good things to the .htaccess file.

What’s more fun than sleep?

Give up?

Finding and tweaking progress bars. Why? Because I couldn’t find just what I wanted and couldn’t let it go. A knitting site has a built in widget for tracking what is in my notebook of projects, but it links to my page on that private site, which is great if you have an account, not so great when the waiting list was huge or if you just don’t want to have a membership to a knitting website. It also stays current. For example, if I wanted to show my current knitting progress on my projects listed in my notebook in this post, it would only be accurate for today, June 11 as long as I never updated my projects again. If say I have 3 projects going right now and currently A is at 20%, B is at 60% and C is waiting to be frogged (ripped out), but next month, A is at 50%, B is finished and C no longer exists. When I update my project page next month, the progress bars at this page will no reflect the progress I had made. That is because the progress bars there are designed to be a current reflection of what I am working on and I can display it in the sidebar. Not what I how like to use them

I present my answer: progress bars.

Please leave comments at this blog post until the progress bars live on a page with comments. If you would like my rendition of progress bars, leave a comment and I’ll send you a zip folder. Be sure that you enter your email address correctly in the comment form. No one but me will see it, I promise, well maybe Zorro will see it but he doesn’t speak human, so it’s not a real concern for ya’, oh and I can’t forget about about Little Guy, but he only rubs on the screen, he doesn’t look at it and the other two, well, no worries there, they don’t seem to like computers.

Knitting Websites

Knitting Sites with patterns:

  • Knitting Daily – an Interweave site with patterns for free and purchase, as well as weekly informative emails, and resources to purchase.
  • Knitting Pattern Central – bookmark site of patterns, free
  • Knitty – online knitting zine with patterns, articles, etc., come outs quarterly


Knitting Helps

  • Knitting Help – full of instructional information and videos to aid your knitting endeavors
  • The Knitters Bag – this page is a list of instructional videos for may stitches


Other Random Knitting Sites: