Keep hard drives spinning!

There’s usually great deals on external drives, especially Western Digital brands where you get 1TB drives for about $50. However, they don’t respect Apple’s system settings to prevent hard disks from going to sleep (spinning down). Whenever you browse files and folders in Finder, those hard drives will instantly awake, even though you might don’t want to view contents in those hard drives.

It helps save sanity. No longer will you have to wait for the disks to wake up.

http://www.macupdate.com/app/mac/31158/keep-drive-spinning

 

Posted in Programs | Tagged , , , , , , , | Leave a comment

How to fix the new Firefox tabbing style (3.6+)

Apparently, Mozilla adopted the way Opera handles tabs when you open links in a new tab. Quite frankly, I do not like it since I’ve been so used to the old style of opening new tabs towards the right, and it can get confusing sometimes.

Thankfully with a quick search, I found out through a Google Groups thread that you’re still able to use the old method without having to downgrade or use an extension. Thanks Larry and Dave!

Here’s how to do it:

Type “about:config” in the url bar and agree to the terms that you won’t break anything.
search for “browser.tabs.insertRelatedAfterCurrent”
double click to set it from “true” to “false”

and you’re all set to go!

Posted in Code | Tagged , , , , | Leave a comment

Quick RSS Feed example

Here’s a quick way to get your site running with it’s own RSS feed. You rarely see a site without one!

<?php
header('Content-type: text/xml'); //change file type to XML
include("the database!");  //get config
?>
<rss version="2.0">
<channel>
 <title>Feed Name</title>
 <description>Feed Descriptiondescription>
 <link>http://yoursite.com</link>
<?php
$result = mysql_query("SELECT * FROM entries ORDER BY id DESC"); //get the information
while($row = mysql_fetch_assoc($result)){ //repeat the info
?>
<item>
 <title><?php echo $row['title']; //echo the title
?></title>
 <description><?php echo $row[short]; //echo the content
?></description>
 <author>SiteName submissions@yoursite.com</author>
 <link>http://yoursite.com/index.php?id=<?php echo $row['id']; //another link to the article
?></link>
 <guid>http://yoursite.com/#<?php echo $row[id];// Quick Link
?></guid>
</item>
<?
} //end the while
?>
</channel>
</rss>

Special thanks for runnerjp who supplied the above code!

Posted in Code | Tagged , , | Leave a comment

MAMP Pro error fix for Navicat

I decided to upgrade with MAMP Pro since it made virtual hosts much easier, however it cut my production when Navicat told me that it failed to connect. I made sure it wasn’t a port or login error, and it worked with phpMyAdmin.

Thanks to this thread about the same issue with MAMP conflict with Navicat, it needed a socket to connect.

When you connect with Navicat, you go under the Advanced properties and enter the following in.

/Applications/MAMP/tmp/mysql/mysql.sock

Posted in Code | Tagged , , , , , | Leave a comment

Functional usage of jQuery to replace PHP

For the longest time, I’ve been using PHP to alternate rows when displaying data in a grid. I stumbled across this neat little site that adds a bit more to tables (or divs for you savvy css designers)

How to use the zebra striping layout via a tutorial and demo

I’ll never go back to the old methods as this will take some processing off the server.

Posted in Code, Cool Sites | Tagged , , , | Leave a comment

Good read on jQuery vs MooTools

Much like any debate: Kirk vs. Picard, Mario vs. Sonic, Joel Hodgson vs Mike Nelson, there’s one on Javascript framework. I personally use jQuery since it was the easiest to learn and had many plugins that did all the heavy lifting, but you should read a semi-unbiased article about Mootools and jQuery frameworks.

You can read the debate on jQuery vs Moo Tools here.

Posted in Code, Cool Sites | Tagged , , , , | Leave a comment

Best mac apps for programmers

I’ve been using Coda for web development. It’s a nice program, but I wonder if there are any other programs that can raise the bar a bit higher. Fortunately, such programs exist to make webdesigners lives easier at a small price.

Web Development

MacRabbit has these two promising looking applications, one that just got released to the public called Espresso. It seems to fall short of Coda without quick preview. However it does have the benefit of including a FTP program inside so I don’t have to use Transmit when updating files.

CSS Design

CSS Design is usually a big headache, especially with cross browsing since they all never play nice *cough*internet explorer*cough*.

While the feature with Coda is nice, but it doesn’t really work for me. With CSS3 and HTML5 coming around the corner, there will be a new set of rules to learn. Not to mention that finding how CSS is working with Safari is not possible since there are no plugins like WebDeveloper for Firefox. CSSEdit is there to help. The X-ray feature alone is worth getting the program. There are also many other features worth taking a look.

Project Management

For getting projects on time, I would normally use iCal to set up dates when things were due. While it’s nice, it can get messy. Just the other day, I found Things. Finally I can get my projects organized. It’s like an extension of iCal.

Posted in Cool Sites, Programs | Tagged , , , , , , , | Leave a comment

jQuery simple comment form

jQuery is such a powerful tool, and mastering it will take only a few months at best. Here’s a very simple form that you can use to test out jQuery’s ajax ability. For best practices, you want to make sure that the form still works when javascript isn’t enabled. Why sacrifice functionality?

Before we begin, you need to download jQuery (current release 1.3), otherwise you’ll get a bunch of errors. Also make sure that you’re making a connection to the javascript file. So often the script won’t work because the browser cannot find the jQuery javascript file on the server.

Now once you upload that javascript file and make sure that it’s there, you’re ready for the form.

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script language="javascript">
function ajax_submit(){
var nameField = $("#name").val();
var emailField = $("#location").val();
var commentField = $('comments').val();

 $.ajax({
 type: "POST",
 url: "submit.php",
 data: "name=" + nameField + "&email=" + emailField + "&comments=" + commentField,
 success: function(msg){
 $('#message').html(msg);
 }
 });

}

$(document).ready(function () { //begin document ready
$('#name').focus();
$('#submitbutton').click(function() { ajax_submit(); return false; });
});
</script>
<form method="POST" action="submit.php">
<div id="message"></div><br />
Name: <input type="text" name="name" id="name"><br>
Email: <input type="text" name="email" id="email"><br>
Comments: <br /><textarea id="comments" name="comments"></textarea><br />
<input type="submit" value="Send email" id="submitbutton">
</form>

Now for the submit.php page, which is simplified for the purpose of getting an answer.

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

if($name) { //if someone typed in a name
echo "Thanks for using the comment form!";
} else {
echo "I don't know who you are...";
}
?>

You can test out the script demo to see what it will look like. You can add more creative stuff to it, but this will get you started.

Posted in Code | Tagged , , | Leave a comment

PHP date essentials

In my projects, I’m always using dates, but to make life easier, I’ve composed a list of the dates I use to help reference by name rather than by the code.

<?php
$today = strtotime('today');
$yesterday = strtotime( '-1 days' );
$beforeyesterday = strtotime('-2 days');
$lastweek = strtotime('-7 days');
$lastmonth = strtotime('-30 days');
$lastyear = strtotime('-365 days');
$showtoday = date('M d');
$showyesterday = date('M d', $yesterday);
$showweek = date('M d', $lastweek);
$showmonth = date('M', $lastmonth);
$showyear = date('Y', $lastyear);
$now = time();
?>

I hope this is helpful for other PHP coders out there.

Posted in Code | Tagged , | Leave a comment

Inside Google Voice

I was surprised to see this little gem in my inbox.

google-voice-invite

Continue reading

Posted in Cool Sites | Tagged , , , | Leave a comment