Archive for the ‘ Programming ’ Category

How Time and Dates are Shown in WordPress

For a while now, something had been bothering me about my blog. The dates were being displayed in day/month/year format (29/1/10), and the times were all in military (13:25). This isn’t a big deal, but it bothered me. Well when I set the blog up, I had set it the way I wanted to using the settings section of my WordPress Admin screen. According to it, I should have been seeing January 29, 2010 1:25 pm, but with this particular theme, it stubbornly would remain the same.

I did a little digging through the Appearance Editor, and found where the dates and times were displayed in the templates. It looked as if a function the_time() was being called, and passed in the two following formats: the_time(‘d/m/y’) and the_time(‘G:i’). It was time for Google to come to the rescue. A nice little search for php + the_time brought me to the WordPress documentation for what was apparently a template tag function. From here I found how to manually set the time and date the way I wanted, or return the default control back to the WordPress settings page that I had been frustrated at before. If you might be having the same issue, check the documentation out here. Good luck, and happy blogging!

Advertisements

Getting Here from There

So, I have recently been busy renovating wetspork.com. I have a horrible habit of creating blogs in other places. Well, I have finally managed to move all of the content from my other blogs to here. My most recent round of writing has been on a blogspot blog. Blogspots great, but after a while, the lure of hosting your own site wins out. Thats why I went, and revamped this site.

The next question was how to get everyone here. I finally got everyone looking at a blog, and then I go and move it. Not very nice, and some of my friends may shake their heads. In an effort to make it easier on them, as well as on any readers I may have, I implemented a redirect on my blogspot blog.

This is actually pretty easy. I simply went to my Blogspot dashboard, clicked on the Layout link, and then went to the “Edit HTML” link at the top. In my header before anything else is called, I dropped in the line:

<meta HTTP-EQUIV="REFRESH" content="0; url=http://yourdomainhere.com/" />

and was on my way. Pretty easy, and now you’re here…Maybe whether you like it or not.

ssh and scp: Working with Different Ports

Today, I wanted to work on the theme for my blog. I usually use FireFTP; a great ftp client add-on for Firefox, but due to some bugginess with my work computer, it wasn’t functioning properly. I decided to ssh into my site, and scp my new theme folders up to the site. Looking throught the information through AwardSpace, I found that connections must be made over port 2222 instead of the standard port 22. This was interesting because I had to sit back for a second and think how to change the ports that these commands work with. To ssh using a different port, simply use:
ssh user@wetspork.com -p2222
To scp from your computer to a site, use:
scp -r -P2222 FolderName user@wetspork.com:path/
It wasn’t difficult to figure out how to do this with the ssh and scp man pages, but it was interesting to see that one uses a lowercase p while the other uses a capital P. No, these are not interchangeable. As it is, hopefully these couple lines might help the next person to run into this question.

Web Programming Final: PHP Zen With Zend

The last part of this web programming class is to present on a topic that we had no former knowledge of. The topic I researched for this presentation was the Zend framework for PHP programming. The power point for this presentation is posted on slide share, and embedded below.

Google Chart API

Just a quick post on a very useful tool. If yoiu have any charts or data to display in a website whatsoever, you need to uses the Google chart API. This useful way of displaying data is versatile, dynamic, and most of all, easy to use. I would talk about it more, but they have the best information on the site itself. This is just an example they provide: http://chart.apis.google.com/chart?chs=250x100&chd=t:60,40&cht=p3&chl=Hello|World. Paste it into your browser and check it out. All aspects of your graph are controlled in a single line. In this line, it has the render size,percents to be shown, chart type, and labels listed.

Phone Conference

Just posting on a new experience here for myself. I recently was able to be part of a phone conference for a project I have been helping out with. It was interesting to see how a phone conference went, but also surprising that I was asked for my thoughts about the project, and actualy treated like amember of the team. It was a good experience, and has helped me to feel even more at home here in my internship.

A phone number database

Recently I have been working on phone number assignment for the Asterisk system being put in place at PSU. The project wasn’t entirely that difficult, but I did learn som fun new tricks with it. One neat thing that I learned was how to combine the array_merge() function in php with the range function. Since I was assigning a lot of numbers, I needed a more efficient way to generate them than just a stadard for-loop.  An example of a query like this might be: $numbers = array_merge(range(1000, 1999), range(4000, 9999)). I was also able to practice using the useful php function implode. If you don’t know what this is, it is a useful tool for breaking arrays into strings for things like inserting them into databases. Very useful in my case when loading thousands of numbers. Some of the other things I learned on this project entailed working independently on a real project as well as working with a deadline. The two people I was primarily reporting to were on vacation while I worked on this project, and it was due while they were still gone. It actually felt nice to be doing something “real” here at my job where I am the one being counted on.