Main

October 20, 2009

RE: Where did my sidebar go? [Windows 7] | Posted at 12:19 PM

If you noticed that your sidebar will not start or doesn't work anymore there may be a simple solution.

If you have the Logitech camera software installed, that is the culprit. To fix the issue simply:

  1. Click the "Change Settings" button.

    image
  2. Click the Application Preferences button, then Settings under "Video Effects application support."

    image
  3. In the list, remove "sidebar.exe" (I removed everything, as seen below).

    image
  4. Restart your computer

That should fix it! I had the same problem and after doing this it finally worked.

If your sidebar isn't working and you don't have the Logitech cam software, I can't help you.

Via Windows7Forums

October 2, 2009

You Don't Need Photoshop: Get Paint.NET | Posted at 11:21 AM

Saying you don't need Photoshop is probably false if you really want powerful photo editing abilities but for those that just need a powerful image editor and don't want to pay $400, then Paint.NET is for you.

image

The best part is that is totally free and is constantly being updated. Above you can see the latest beta version and it is awesome.

There are layers, history, and filters along with common tools like magic wand, pencil, brush, shapes, freeform shapes, and more. It has everything you need for creating images and more. It also works great with tablet PCs.

I've installed it on every computer I own and always recommend it to my friends. It's easier to use than Photoshop is and is friendly to newbies.

So what are you waiting for, get Paint.NET!

August 28, 2009

How To: Fix Zune "Device Cannot Start" Error | Posted at 3:10 PM

This problem, for me, was caused by using a USB hub connected to my computer. This did not provide enough power for the Zune so Windows notified me that the device could not start.

To fix it, simply plug the USB cable from the Zune directly into the back of your computer's USB ports as those should have enough power.

That worked for me.

(I am running Windows 7 64-bit (x64))

August 19, 2009

Windows 7 RTM Available to MSDN-AA Students | Posted at 2:02 PM

Just so you know, if you are apart of the U's MSDN-AA (MSDN Academic Alliance) program, the RTM was approved by my friend just last week. It's Windows 7 Professional (32 & 64-bit editions).

I have installed Windows 7 RC on my desktop, laptop, brother's desktop, and my dad installed the RTM on his laptop. I plan on installing it on my other laptop as well. I love Windows 7.

July 3, 2009

Red Alert 3 Save Game Location in Windows 7 | Posted at 11:55 AM

It's in your "Saved Games" folder in your user folder:

image 

C:\Users\{Your User}\Saved Games\Red Alert 3

It took me awhile to find it.

May 12, 2009

Re-Post: Expose for Windows 7/Vista | Posted at 12:46 PM

image

I’ve updated my past post on using Switcher to clone the Mac OSX “Expose” feature, so check it out!

May 8, 2009

How To: Install Windows 7 RC1 on Parallels 3 | Posted at 1:03 PM

Windows 7 on Parallels 3

I am writing from Windows Live Writer on Windows 7 RC1 running on my iMac Parallels installation at work. I have Parallel Tools installed and I’ll show you how to do the same!

Continue reading "How To: Install Windows 7 RC1 on Parallels 3" »

March 3, 2009

10 Office 2007 Tips & Tricks [Self-Improvement] | Posted at 6:07 PM

As a Microsoft Student Partner, we're doing a new campaign to promote Office 2007.

I've created a deck of 10 useful tips & tricks I've learned while using Office 2007. It's impossible to list everything but I go through some key features that you may have overlooked.

I've posted it on Live SkyDrive, an excellent cloud storage (25GB!).

I will also probably share it on SlideShare.

February 23, 2009

How To: Get Hotmail on Outlook/Thunderbird | Posted at 3:21 PM

smtp-settings

Recently the Windows Live team enabled POP email access for all Hotmail (Live Mail)-based accounts. I found a great resource for how to add your accounts to Outlook (and with Thunderbird it's pretty much the same).

What are Windows Live Hotmail's POP3 and SMTP Settings?

In Thunderbird, for incoming you choose POP. For outgoing (SMTP), you need to add it in the Outgoing Server account and instead of SSL, choose TLS with a port 25. Type in your username as well.

Yes, it works with Hotmail-based accounts too, like my Student Partners email address.

[via Ask Leo]

February 10, 2009

How To: Generate a Clean/Friendly URL | Posted at 5:27 PM

The term "slug" was first coined, I believe, by Wordpress to mean a URL-friendly version of a post title. You see them on blogs all the time. How do you go about converting an unfriendly title into a friendly one?

Learn how on my Intrepid Studios blog where I give you code in C# and PHP.

January 16, 2009

Better DataPager in .NET 3.5 [Efficient] | Posted at 7:39 PM

I am working on a custom blog implementation for Intrepid Studios and I am using a ListView to display posts on the front page. It's just a very nice control…

Anyway, paging for a ListView is done by adding a DataPager control to the page and customizing its behavior.

I was interested in seeing how efficient it was, expecting it to properly utilize my LinqDataSource's ability to grab only the actual number of rows needed from my SQL database.

The articles I read on 4GuysFromRolla and other sites mentioned that it does not, but they were referencing an SqlDataSource.

It turns out, the DataPager does use efficient paging with a LinqDataSource and you do not need to put it within a <form runat="server"> tag to use (just use the QueryStringField property!).

How come? From what I understand, the LinqDataSource uses automatic paging to only get a certain number of rows. That's why it is the only DataSource control with an "AutoPage" property.

I am exceedingly happy with this.

January 13, 2009

Lightweight Rich-Text Editor [jQuery] | Posted at 11:49 PM

jQuery Lightweight Rich Text Editor for ASP.NET

Thank you to Batiste Bieler for the original script, jQuery Rich Text Editor Lightweight.

I heavily modified it to support ASP.NET forms (and their funny client IDs) and to work a bit more efficiently. It’s tested with PHP and .NET both. It should work with any kind of form.

Visit the jQuery Rich Text Editor project page for details.


                              
                              
                           

January 10, 2009

How To: Programmatically Add Nodes to the SiteMap For Your .NET Site [Tips & Tricks] | Posted at 6:23 PM

Problem

The Web.sitemap file stores only static URLs, so if you have a page like this:

http://yoursite.com/news.aspx?view=4

Your sitemap breadcrumb will not reflect the fact that you are viewing a an actual news item. If you're like me, you also reflect the breadcrumb in the title of your page. So instead of seeing:

Breadcrumb: Home > News > A headline!
Title: A headline! : News : My Site

You see:

Home > News
News : My Site

Read on for how to solve it.

Continue reading "How To: Programmatically Add Nodes to the SiteMap For Your .NET Site [Tips & Tricks]" »

January 8, 2009

Creating a Wrapper for Firebug's Console [Tips & Tricks] | Posted at 12:20 PM

Thanks to Dimitar over at Frag on how to create a wrapper for Firebug's console, I was able to implement better debugging in my jQuery plugin. The one quip I had was that I needed to directly pass everything to the log function. The way Dimitar did it, it wrote a log line for each argument. I was passing formatted strings.

Here are the offending lines:

for (var i = 0, l = arguments.length; i < l; i++)
	console.log(arguments[i]);

And here's what you replace it with:

console.log.apply(this, arguments);

BAM! Works like a charm.

Thanks Dimitar!

January 5, 2009

Use CSS to Create a Dynamic Sidebar, with a Fixed Element [Tips & Tricks] | Posted at 11:24 AM

CSS Sidebar Normal

I am working on my new Intrepid Studios website and I came up against a CSS wall. I needed a sidebar that had a "main image" for a design and then list extra images or extra information. However, I wanted it to look cool, so I wanted the image to overlap the header and always appear in the same place.

I needed the design to follow these guidelines:

  • The photo must always appear in the same place no matter the height of the header. Sometimes there is no photo.
  • Sidebar content must always appear below the header.
  • The header has a variable height, so it should push the sidebar content down if it's larger than the photo.
  • I want the sidebar content to come after the body content in the HTML, because it's extra information.

Read on fair reader, to see how I solved my problem

Continue reading "Use CSS to Create a Dynamic Sidebar, with a Fixed Element [Tips & Tricks]" »

Expose for Windows Vista/7 [Clone] | Posted at 9:16 AM

image

I use an iMac at work and whatever you say about Mac, one thing is for sure, Expose is genius. I am almost angry that this functionality isn't in Windows 7. Nobody uses Flip3D. Well, some do but I don't.

Enter Switcher. A free app switcher ala Expose, that works with multiple monitors. I will go through some cool features that will make Switcher look and act like OS X Expose.

Continue reading "Expose for Windows Vista/7 [Clone]" »

January 1, 2009

WEB 1001 and WEB 1002, Introduction to Web Design [Webinars] | Posted at 11:48 AM

I've made available my old seminar reference sites here:

http://intrepidstudios.com/tutorials/WEB%201001/

http://intrepidstudios.com/tutorials/WEB%201002/

I made them awhile back when I gave two seminars to my high school program that I was in, the Lighthouse Program. It was for gifted and talented students, so the material was geared toward a younger audience which is apparent in the slides. You won't find much high-level web design thoughts, but it is a good primer on getting into web design if you're interested.

December 26, 2008

Using the Power of LINQ to Easily Manage Collections of Objects [Awesome] | Posted at 4:15 PM

I am currently working a WPF BlackJack implementation to further develop my object-oriented and .NET skills. I have a great book called VB 2008 Recipes. It’s all sorts of useful and I recently came across a super great way to manage my annoying collections of cards, players, etc. in the game.

Instead of implementing interfaces like IList or IEnumerator for, say, a Hand of cards, you can create a variable/property called Cards with a type List(Of Card). This creates a generic list of objects of type Card (your card class, or any other type of class you want a collection of).

Then, as in my case, you can perform some powerful functions that would otherwise take more lines of code to do. For example, in BlackJack an Ace can be valued as either 1 or 11, depending on whether or not it will make the Hand total over 21 (a bust).

The way I calculate the total value for a hand, I calculate the total of all non-ace cards and then calculate the total of the Aces based on that other total.

Here was the original code I used before implementing LINQ:

Dim Cards() As Card
Dim hasAces as Boolean = False
' Calculate total for non-Ace cards
For Each myCard As Card In Cards
    Select Case myCard.Rank
        Case Card.RankType.Ace
            ' Aces
            hasAces = True
        Case Else
            intTotal += myCard.Value
    End Select
Next

If hasAces Then
    ' Do the same thing as above, only select case Ace
    ' and figure out the total
End If

That is a simplified version. Now, witness the power of LINQ combining that Select statement into a single line!

Imports System.LINQ.Enumerable

[...]

Dim Cards As List(Of Card)

' Calculate total for non-Ace cards
' PS. I <3 LINQ
intTotal = Cards.Where(Function(c) c.Rank <> Card.RankType.Ace).Sum(Function(c) c.Value)

' Any Aces?
If Cards.Any(Function(c) c.Rank = Card.RankType.Ace) Then

End If

As you can see, WAY more manageable! The reason LINQ can do this is because the System.Linq.Enumerable namespace has Extension methods like Sum, Where, Average, Max, Min, etc. that work with any kind of collection.

Previously, I was aware of LINQ to SQL and how great that was, but I didn't realize LINQ also worked with Objects (hence, LINQ to Objects).

Like I said earlier, instead of making my Hand class implement an IList, etc. I can just make Cards a property so that when I need to add a card, retrieve a card, etc from an external class, all I need to do is:

MyHand.Cards.Add(new Card)

or

MyHand.Cards(0)

If you want more information about LINQ to Objects, check it out on MSDN!

December 9, 2008

How To: Create a Grid of Album Covers [Zune] | Posted at 1:16 PM

album-grid-zune-software

If you are looking for a way to easily create a grid of your favorite album covers or artists, there is a decent implementation of the technique in the Zune Software. You don't need a Zune to use it.

All you do is let it scan in your library, then start playing a song. Click the bar graph in the bottom right corner to go into Now Playing view. You will see the program fill in your albums like it shows above.

You can take a screen shot and cut out whatever you want.

This gave me an idea, though. There's no easy way to customize how that grid looks because it constantly gets updated. So I was thinking of making some simple software that would do the same thing, only with better customization.

It'd be a fun project and someone would find it useful, I think. Winter break work!

December 6, 2008

Sample: Using A Strongly Typed Data Source in .NET [Exercise] | Posted at 1:40 PM

From my IDSC 3102: Intermediate Programming class, here is the second program we had to complete. It was a simple Database connection project, but I used and played with a strongly typed dataset.

Screenshot

What It Is

A grading program that allows you to input grades for a select number of students, save changes to the DB, and view a semester report. The report should show a list of students and their cumulative semester average calculated using a specific formula. It should also display a "printable list" for your students to view their grades, showing only the last 4 digits of their SSN.

What You Will Learn

  • How to set up and utilize a typed DataSource (DataSet.xsd)
  • Dynamically save any changes from a DataGridView to its underlying Datasource
  • Validate and prevent data entry errors
  • Set up a Mask (i.e. ***-**-1234 for a social security number) for a  column on a DataGridView control

Download Source

Download zip (165KB)

September 10, 2008

Fix: BioShock Crashing On Startup [Tips & Tricks] | Posted at 3:57 PM

Recently a friend of mine tried to install BioShock and play it on his newly minted computer.

However, when he started the game, it would crash right on startup.

How to fix it?

Install the latest DirectX Runtime update.

Almost monthly Microsoft releases new DirectX updates, so make sure it's all up-to-date! After he did that, it worked fine.

August 26, 2008

Watch Hulu On Your TV [Awesome] | Posted at 10:12 AM

I use a little program called TVersity to stream my music, videos, and pictures to my Xbox 360. Once I discovered Hulu, I wished TVersity supported it. Alas it was not to be.

Enter PlayOn. PlayOn is still in beta but it works! It will stream YouTube, CBS, Hulu, and ESPN to your console (PS3 and Xbox). Unfortunately, just glancing around I didn’t find any full episodes from CBS.

I tested it out and I watched The Daily Show and a handful of YouTube videos (TVersity supports YT as well).

Once they add a few more networks so I can watch Lost in HD, we’ll be golden. NetFlix support will be redundant for 360 considering the Fall update but for PS3 users that might be some good news.

There is a 30-day trial and after it expires you can pay $30 to activate it. If you ask me that’s well worth the price if you’re like me and don’t have cable and don’t want to watch TV on your monitor.

Thanks Penny Arcade!

August 23, 2008

How To: Fix Beyond Good & Evil (BG&E) Graphics Glitches in Vista/XP | Posted at 1:15 AM

Today I let my friend borrow Beyond Good & Evil to play it, since it’s such an awesome game. He has Vista and when we ran the game there was some graphical corruption. He has an 8800GTS and it ran the game fast, but there were some artifacts in the menus.

After some Google searching I found this post. Here are the settings that you should set in the Settings program:

Beyond Good & Evil Settings

We actually set the Shadows to High. But it seemed like Antialiasing may be the culprit, we didn’t have a chance to test it with it turned on.

Thanks jackdewey.

[Beyond Good & Evil - Graphical artifacts in Vista via VistaReadyGames Forum]

August 20, 2008

Fix: Suckerfish IE7 Disappear/Sticky Bug [Yay!] | Posted at 11:50 PM

After searching Google and reading comments, I could not find a solution to a problem I had while using the Sons of Suckerfish drop-down menu.

My problem was not only that the drop down stuck when you clicked somewhere first, but also the drop down would disappear when I got past a certain point (probably the height of the containing <li>).

Here’s how I fixed it:

ul#nav li:hover div, ul#nav li.over div

{

    left:0;

    zoom:1; /* fix ie7 disappear */

}

ul#nav li:hover, ul#nav li.over

{

    height:auto; /* fix ie7 sticky */

}


Note that I have a containing <div> within the <li> element. That is because my drop-downs are a bit more customized with headings, background, etc. Just change "div"? to "ul"? if you just have a <ul> inside the <li>. Note I also use "left:0"? because the containing list element aligns text to the center, so an auto left margin centers the drop down which isn’t what I want.

Thanks to css-class.com for their list of fixes. This works in all browsers I own.

Tested in: Firefox 2+, IE6+, Safari 3, and Opera 9

How To: Read RSS/Atom Feed Using .NET and the XmlDataSource With Or Without Namespaces [Coding] | Posted at 12:43 PM

Today I was working on my site and I wanted to show some recent blog entries on the side. Used to PHP I was looking for an RSS reader I could use. I found one but it didn’t quite work with what I needed.

Stupidly, I realized that all the things I needed were right there!

Hit the jump for all the details!

Continue reading "How To: Read RSS/Atom Feed Using .NET and the XmlDataSource With Or Without Namespaces [Coding]" »

August 18, 2008

Customize Google Calendar RSS Feeds: Sort Events, Limit Results, etc. [Tips & Tricks] | Posted at 2:21 PM

If you use an RSS reader to subscribe to people’s Google Calendar events, or you use an RSS parser to read your calendar’s feed onto a webpage, you may have realized that there’s not really any good documentation about customizing that feed. Well, actually, there IS but it’s not apparent from doing a simple Google search that you can use the Google Calendar API reference to see how to customize a feed display.

Today I wanted to do a couple things, I wanted to sort the RSS by start date and from the event happening soonest to the event happening later. I also wanted to limit the results to 5 to reduce time for parsing.

Here’s how to do it, it’s quite simple:

https://www.google.com/calendar/feeds/[account]/public/basic?orderby=starttime&sortorder=ascending&max-results=5

If you notice, all I did was add some query string values.

orderby: starttime – Order results by when they start
sortorder: ascending – Order from least to greatest (soonest to latest)
max-results: 5 – Limit results to 5 events

You can use the following query string keys to customize your RSS data: Google Calendar API Reference

Tip: If you’re using PHP and SimplePie to parse the RSS, you need to add the following line of code to prevent SimplePie from automatically sorting the items by date:

$feed->enable_order_by_date(false);

August 14, 2008

Import an Audiobook From CDs Painlessly Using iTunes [Tips & Tricks] | Posted at 5:35 PM

I just discovered this feature. If you want to import a CD that is an Audiobook, like I bought Stephen Colbert’s “I Am America and So Can You,? you can easily do so using iTunes.

If you ever have tried importing an audiobook, you know there’s many tracks. iTunes has a neat feature that can join them all together and import them as one track per CD. Useful!

  1. Insert CD.
  2. Open iTunes.
  3. Right-click CD and select “Get Info?
  4. Fill in the proper information. I suggest naming the CD “Disc 1? and so on so that you won’t overwrite any existing discs. Later you can make them all one album.
  5. Select all the tracks on the CD, by hitting Ctrl-A (Apple-A).
  6. Go to Advanced and select Join CD Tracks.
  7. All done! Hit Import CD on the bottom right to import the joined track. Change ID3 tags as you see fit. I suggest importing at 96kbps or lower because it’s spoken and doesn’t need higher quality, unless you don’t care about size.

Note: It’s a good idea once you’re done to edit all the tracks and check the option to remember position. That way when you stop one it will resume where you left off!

August 12, 2008

10 Tips for Speeding Up Your Web Designing [Tips & Tricks] | Posted at 9:55 PM

homeless-coder Recently on Digg an article was posted on some tips for saving time with your web design. Although it’s just a personal list, I thought that some tips could have been better and so I offer my own little list. I won’t bother rehashing the good tips the author posted, just adding to it.

This list isn’t comprehensive nor is it a detailed breakdown of each idea. It’s meant to be an overview and a jumping off point, not a How To article. These are the methods I employ and they serve me well!

1. Drop Down Menus: I use a simple tutorial from A List Apart on creating a CSS-only dropdown menu, called Suckerfish. Using a simple <ul> with no style tags and one or two classes, you can build a functional drop down in minutes, and not have to worry about styling someone else’s possibly inept code. This is also standards-compliant whilst also being the best choice for navigation in general due to degradability.

2. Make Reusable Stylesheets: Anything relating to style, positioning, and layout can be done using CSS and should only be done using CSS with a few minor exceptions. A great thing I’ve learned is to create small, cross-site CSS that can just be copy/pasted to a new website you’re working on. For example, I have a “base.css? that I use in every site I create that can be copied to another and then be done by changing a few values like fonts.

3. Image Capturing: If you’re on a Mac, use the all-powerful Apple + Shift + 4. This lets you drag an area rectangle and capture anything on-screen. It is saved natively as a PNG and just drag it onto Photoshop to manipulate it. Easy as pie!

If you need to edit a lot of pictures, I use Picasa to adjust filenames or color in photos. See my previous experience batch editing and scanning lots of photos.

4. Use FTP Software to Edit Files: This mostly applies to Mac, but there must be a good power combo on PC that I’ve yet to use. This tip could be substituted for “Use the software that fits the purpose.? On my Mac at work my power combo is the following programs:

  • TextMate
  • Transmit
  • Photoshop

With only those 3 programs open, I can pretty much create and work on a website quickly and efficiently. Recently I had to create a <select> box with all the majors offered at my University. The list was long. However, I did it in literally 30 seconds using some simple keyboard shortcuts. On this page, hold Apple (Mac)/Ctrl (PC) down within Firefox 3 and drag your cursor over each table cell containing the major.

Copy/paste into TextMate and it will paste in plaintext. Then highlight all the lines, hit Apple + Ctrl + Shift + W and type “option? to wrap each line in a specific tag. All done!

Additionally, TextMate allows you to instantly save a file directly onto the webserver without any annoying extra clicking. Transmit has many useful functions including duplicating files, tabs, and very quick batch uploading. Double-click a file and it will open in TextMate, if you specified an external editor.

5. Better Multi-Browser Testing: Setup some Virtual Machines to test different browsers, or just install Multiple IE and be done with it considering most problems occur in IE if you code for Mozilla-based browsers (which you should be!). Personally, I installed Safari, Opera, Firefox, and Multiple IE. Really, though, only IE6 and IE7 should be enough.

6. Code Minimally: This goes hand in hand with using CSS effectively. Your webpage without CSS should be a typical flow document. There shouldn’t be any large images across the screen, background images, mis-aligned text, non-standard font sizes, etc. Basically, a good webpage should be fully functional/navigable without CSS or JavaScript. The added bonus is less coding!

7. Design for Accessibility: There are many reasons why designing for accessibility yields good results. Besides the fact that it should be an obligation for a disabled user to be able to access your site, designing with accessibility in mind also lets search engines index you faster and more accurately, getting all of your content. This applies to image search and content searching. This also allows your design to degrade in old browsers, text-based browsers, and mobile browsers.

8. Install Useful Extensions: By far the most useful extensions I own for Firefox are Firebug and the Web Developer Toolbar. Without them, I couldn’t design as fast as I can. I can’t count how many times I’ve used Firebug’s “Inspect Element? feature to debug CSS or to copy values between sites.

9. Mockup Designs First: By far one of the most timesaving elements of designing a website for me is doing an initial mockup. It only takes a few hours and you can present a complete picture of the site for the client before you actually do any coding. I personally use Photoshop because later I can slice it up to get background images for use with CSS. The client can critique it and it also lets you visualize the site yourself.

10. Use Photoshop Wisely: Some people don’t know how useful the Slice tool is. Instead of making everything but the portion of the screen you want invisible, trimming it, selecting all, copying it, then pasting into a new document, then Saving for Web, all you need to do is use the Slice tool to create “slice up? your design. You can name the slices, adjust their dimensions to your liking, and when you’re done, you can just save them all at the same time! In addition, each slice can have its own specific format like GIF or JPG or PNG. It saves me a lot of time.

Don’t use slices to make an HTML layout. You should only be using slices to get the images you need to use in your layout.

And there you have it! 10 tips to improve not only the speed and efficiency at which you work, but also your overall design skills!

Happy coding!

August 8, 2008

How To: Integrate Google Picasa Onto Your Own Website Using PHP | Posted at 12:19 AM

I mentioned when I posted about finishing a website that I had made some custom scripts, and this was one of them.

This assumes you have all the Google PHP scripts ready on your site, comments have been made at appropriate areas. The HTML included is meant to be styled and is just the structure I used to make it. You can see the implementation right over yonder.

Features:

It’s tested and working, make sure you configure it properly. As always, feel free to add on as you please.

This was a quick script so I’d add some more error checking if I were you. It doesn’t use classes or anything, it’s just down and dirty.

Download Source Code (.zip)

gallery.php

<?php

/************************************************************

****    Picasa and PHP Integration Script

****    Created by: Kamran Ayub (c)2008 Intrepid Studios, Inc.

****    http://www.intrepidstudios.com/

****    This is just a very barebones implementation! No fancy

****    classes and whatnot. Feel free to improve it.

****

**************************************************************/    

//set_include_path("/local/home/"); // set if Zend folder isn't in the same directory as gallery.php, e.g. it's below it

 

// Vars

$user = "YOUR_GOOGLE_USERNAME";

$pass = "YOUR_PASSWORD";

$albumId = $_REQUEST['albumId'];

$albumName = $_REQUEST['albumName']; // This is just lazy, because when you are using the newAlbumQuery method, the name of the album can be gotten anyway.

$page = $_REQUEST['page'];

$maxResults = 15; // Max Results per page

$maxImageSize = 800; // don't go over 800 otherwise you won't be able to embed the larger photos

$zend_dir = "Zend/Loader.php"; // should point to your Zend directory

 

// Functions

function Paginate($numPages,$currentPage,$albumName,$albumId) {

    // Create page links

    

    $s = "<ul class='page-nav'>\n";

    for($i=1;$i<=$numPages;$i++) {

        $class = "";

        

        // Current page?

        if($i == $currentPage) {

            $class = " class='selected'";

        }

        $s .= "<li".$class.">";

        $s .= "<a href='?albumId=".$albumId."&amp;albumName=".$albumName."&amp;page=".$i."'>".$i."</a></li>\n";

    }

    $s .= "</ul>\n";

    

    return $s;

}

 

// Picasa Web Albums

require_once($zend_dir);

Zend_Loader::loadClass('Zend_Gdata_Photos');

Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

Zend_Loader::loadClass('Zend_Gdata_AuthSub');

 

// Authenticate

$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;

 

$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);

 

// update the second argument to be CompanyName-ProductName-Version

$gp = new Zend_Gdata_Photos($client, "Google-DevelopersGuide-1.0");

 

 

// Default page

if(!isset($page)) {

    $page=1;

}

 

if(isset($albumName)) {

    $albumName = urldecode($albumName);

}

?>

<html>

<head>

    <title>Integrate Picasa and PHP Demo</title>

    <link rel="stylesheet" type="text/css" href="base.css" media="all" />

    <link rel="stylesheet" type="text/css" href="gallery.css" media="all" />

    <link rel="stylesheet" type="text/css" href="awesomebox.css" media="all" />

    

    <!-- YUI, older -->

    <script type="text/javascript" src="http://yui.yahooapis.com/2.2.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>

    <script type="text/javascript" src="http://yui.yahooapis.com/2.2.0/build/animation/animation-min.js"></script>

    

    <script src="awesomebox.js" type="text/javascript"></script>

</head>

<body>

    <h1>Photo Gallery</h1>

    

    <div class="albums">

    <h3>Albums</h3>

                

        <?php

        try {

            $userFeed = $gp->getUserFeed("default");

            echo "<ul>\n";

            foreach ($userFeed as $userEntry) {

                echo "<li><a href='gallery.php?albumId=". $userEntry->gphotoId->text . "&amp;albumName=". urlencode($userEntry->title->text) ."'>". $userEntry->title->text . "</a></li>\n";

            }

            echo "</ul>\n";

            //print_r($userFeed); // Debug

        } catch (Zend_Gdata_App_HttpException $e) {

            echo "Error: " . $e->getMessage() . "<br />\n";

            if ($e->getResponse() != null) {

                echo "Body: <br />\n" . $e->getResponse()->getBody() . 

                     "<br />\n"; 

            }

            // In new versions of Zend Framework, you also have the option

            // to print out the request that was made.  As the request

            // includes Auth credentials, it's not advised to print out

            // this data unless doing debugging

            // echo "Request: <br />\n" . $e->getRequest() . "<br />\n";

        } catch (Zend_Gdata_App_Exception $e) {

            echo "Error: " . $e->getMessage() . "<br />\n"; 

        }

        ?>

     </div>       

    <?php

    // List photos from album

    

    if(!isset($albumId)) {

    ?>

        <div class="grid">

        <p>Choose a photo album to view.</p>        

        </div>            

    <?php

    } else {

        $query = $gp->newAlbumQuery();

    

        $query->setUser("default");

        $query->setAlbumId($albumId);

        $query->setImgMax($maxImageSize); 

        $query->setMaxResults($maxResults);

        

        if(isset($page)) {

            $query->setStartIndex((($page-1) * $maxResults)+1);

        }

    ?>

        <h3>Photos from <?= $albumName ?></h3>

        <div class="grid">

        <?php    

        try {    

            $albumFeed = $gp->getAlbumFeed($query);

            

            // Number of results

            $numResults = $albumFeed->gphotoNumPhotos->text;

            

            // You should probably check if $numResults is a number...

            

            // If there are more than $maxResults, we need to paginate this...

            $numPages = ceil($numResults / $maxResults);

            

            if($numPages > 1) {                            

                echo Paginate($numPages,$page,$albumName,$albumId);

            }

            foreach ($albumFeed as $photoEntry) {

                $contentUrl = "";

                $thumbnailUrl = "";

                

                if ($photoEntry->getMediaGroup()->getContent() != null) {

                  $mediaContentArray = $photoEntry->getMediaGroup()->getContent();

                  $contentUrl = $mediaContentArray[0]->getUrl();

                }

        

                if ($photoEntry->getMediaGroup()->getThumbnail() != null) {

                  $mediaThumbnailArray = $photoEntry->getMediaGroup()->getThumbnail();

                  $thumbnailUrl = $mediaThumbnailArray[1]->getUrl();

                }

        

                echo "<div class='photo'><a rel='gallery' href='".$contentUrl."'><img src='" . $thumbnailUrl . "' alt='" . $photoEntry->title->text ."' title='" . $albumName ."' /></a></div>\n"; 

            }

            //print_r($albumFeed);

            echo "<div style='clear:both;margin-bottom:6px;'>&nbsp;</div>";

            if($numPages > 1) {                            

                echo Paginate($numPages,$page,$albumName,$albumId);

            }

        } catch (Zend_Gdata_App_HttpException $e) {

            echo "Error: " . $e->getMessage() . "<br />\n";

            if ($e->getResponse() != null) {

                echo "Body: <br />\n" . $e->getResponse()->getBody() . 

                     "<br />\n"; 

            }

            // In new versions of Zend Framework, you also have the option

            // to print out the request that was made.  As the request

            // includes Auth credentials, it's not advised to print out

            // this data unless doing debugging

            // echo "Request: <br />\n" . $e->getRequest() . "<br />\n";

        } catch (Zend_Gdata_App_Exception $e) {

            echo "Error: " . $e->getMessage() . "<br />\n"; 

        }

        ?>

        </div>

    <?php

    }

    ?>

</body>

</html>


August 4, 2008

How To: Use PHP to Grab Event Date from Google Calendar RSS [Tips & Tricks] | Posted at 7:52 PM

Recently I finished a site that required me to use Google Calendar to manage events. I thought that it would be nice to show what events are up and coming, so I used SimplePie to grab and show their calendar feed.

However, the RSS date was the date the event was added, not the date that the event happens. This makes sense but makes it a bit harder to be useful in the website.

I used some simple RegEx to get the event date… it’s rough but it works and I’ve tested it with events spanning multiple dates, all day, and specific times.

<dl>

    <?php

    // Feed: http://www.google.com/calendar/feeds/[google account]/public/basic?max-results=5

    foreach ($feed->get_items() as $item):

        

        // Grab When: date.

        $content = $item->get_content();

        $content = strip_tags($content);

        

        if(preg_match("/When: (.*!?)/", $content, $matches)) {

            $content = $matches[1];

        } else {

            $content = "No Date Found";

        }

    ?>

        <dt>Event:</dt>

        <dd><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></dd>

        <dt>Event Date:</dt>

        <dd><?php echo $content; ?></dd>

    <?php endforeach; ?>

</dl>


This assumes you have a SimplePie feed… you can just use the RegEx in any other implementation instead…

July 29, 2008

How To: Get Free Audiobooks Legally | Posted at 8:47 PM

I’ve gushed before about how I love Audible. I also calculated how much I saved.

But then it occurred to me… have I really saved much? Consider that your public library, University, or city library may well have that audiobook available to you completely free!

I wanted to know how many of my Audible books I could have gotten for free, even if I had used credits to buy them.

In Minneapolis, by checking the Minneapolis Public Library website and NetLibrary.com which you have access to if you have a library card, I found that only the following books weren’t available in either place:

  • Fahrenheit 451 by Ray Bradbury
  • Diamond Age (unless you like phonotapes) by Neal Stephenson
  • Snow Crash by Neal Stephenson
  • Wyrms by Orson Scott Card
  • Lamb by Christopher Moore

That’s 5 books out of 13 books. Definitely not bad! And then consider all the ones I could potentially get.

The Minneapolis Library has teamed with NetLibrary.com which lets you check out up to 10 audiobooks at a time, with the ability to play on a portable. They last for 21 days before you have to check them in or you can renew them once for another 21 days. That’s more than enough time to get through a book if you listen regularly.

Consider my girlfriend who works 8 hours a day at a computer with no interaction… she borrowed my audiobooks and we even rented some from the library (if you don’t want to rip the CDs, use that old CD player that’s been collecting dust sitting in the basement). She can get through Pillars of the Earth in a week and a couple days since it’s 44 hours. Imagine the amount of books you could “read? with access to all this free public material!

Does this mean Audible is useless? I don’t think so. I think that next time I will check if my library has the book before buying on Audible and I’ll only use credits from now on to buy books. $15/month is 1 book a month and you save: the book price - $15. It’s still not a bad deal… just be sure to check around before you decide to buy that audiobook.

July 26, 2008

How To: Scan and Store Many Pictures | Posted at 2:13 PM

Just today I was tasked with the job to scan in about 50 pictures so that we could store them online for our family members to see and for others to print out and add to my great grandma’s birthday photo album.

I thought it would take forever but in just one hour I was able to scan all of them in, edit them all for better picture, and upload them to a web album that my family could see.

What You Will Need

  • Photoshop CS or above
  • Scanner or printer with scanner
  • Google Picasa2 or equivalent photo editor/organizer
  • Google Picasa account
  • A lot of RAM

1. Scan in Photos

Here is where you can be creative. The idea is to scan in a batch of photos, as much as your scanner can fit, and keep doing it until you don’t have any left.

With Photoshop, this is real easy.

Click File –> Import –> Name of your scanner/printer

This should launch ScanGear CS. Here’s why ScanGear CS is amazing. It has a super quick preview feature to see what’s being scanned, it lets you crop the image to your liking, and it can scan with many additional features like DPI and photo enhancement.

For options I have everything set to “OFF? and “None? because I’d rather edit it directly. I use a 300dpi setting for friendly and sharp printing.

Set up the photos in the scanner and press Preview in ScanGear. You should see your photos show up. Crop it so that you get all the photos and click Scan.

Keep using Preview and Scan until you’ve scanned in all your photos into Photoshop. Depending on how much RAM you have, you may only get through 3-4 batches before your computer slows down. I have 2GB of RAM so I scanned in everything just fine.

2. Slice and Dice

Here’s where some magic happens. We will use the Slices tool to split each image into their separate photos.

Select the Slice tool, then drag a box around each photo. You may have slightly tilted photos… if that’s the case, you can use the Select tool and then transform it to be straighter. I didn’t care so I just sliced so that it cropped out any slanted edges.

Once you’ve done that, go to File –> Save for Web

It might warn you about slow response, ignore it. In the Save for Web dialog, use the Slice Select tool to double-click each slice and give it a descriptive name. These will be your filenames.

Now hold the Shift key and select each picture slice. Make sure you’re exporting using JPEG and 100% quality.

Click Save and in the Save dialog make sure “All selected slices? is chosen, not “All Slices.?

Pick a folder to save them in and voila, you’re done.

Now do the same thing to each of the other Photoshop documents.

3. Organize and Upload

As far as we’re concerned, we’re done. However, chances are you want to organize these photos and upload them to the web. I use Picasa because I like its easy-to-use interface and it’s fairly evolved feature-set. I also chose Picasa Web Albums because they have 1GB of space and allow me to upload the original sizes. For reference, my 66 pictures only take up 31MB of space on the Picasa web album.

Start up Picasa and organize your photos. Add captions, rotate them, fix their color (the “I’m Feeling Lucky? option usually is all you need), fix Red Eye, etc. Then just select all the photos you want to upload and choose “Web Album? at the bottom.

4. Alternatives

If you don’t own Photoshop but still want to streamline your editing, try The GIMP editor. It’s free and duplicates many of the functions Photoshop offers. What you may not get is a nice scanning software like ScanGear CS. It’s fast which is more than you can say about software like HP or scanner manufacturer software.

All I’m doing is batch scanning photos and slicing them to make them easier to scan and upload.

July 9, 2008

4 Tips on Saving Lots of Money on Textbooks | Posted at 1:08 PM

Since I ordered my books already today, I don’t see why I can’t share some of my tips with you fellow college students.

Tip 1: Don’t Buy From Your Bookstore. Ever.

There’s no reason you need to ever buy from your college bookstore, as long as its more expensive than anything you find online.

99% of the time your college bookstore exorbitantly raises its price. Once in awhile a book will cost less there just because it’s old. I maybe have bought 2 books at the bookstore during my 2 years of college.

Tip 2: Search Online Using ISBN, NOT Title

I’ve seen it happen. You find this great deal on your textbook and you order it. When you get it, it says “Study Guide.? I made that mistake. Always search via ISBN number because it usually guarantees you’ll find the exact book. That brings me to my next point…

Tip 3: LOOK OUT for International Editions

When searching by ISBN you will come across International Editions. Here’s a pro tip: even though they are cheaper, don’t buy them. Because when you want to sell it, they’ll be worth about $5. Plus, even though the contents of the books are usually the same, the problems are almost always different. Case in point: I bought my Accounting book as an International edition. Guess what? ALL the problems in the back of the book used different monetary values than the US edition. I had to go and write in all the proper numbers from the problems on my syllabus. Now I can’t really even sell the damn book.

My girlfriend bought a textbook as an international edition and she can’t sell it on Amazon for more than $3 or so. Plus no one will see it on Amazon because it has to the the same ISBN… and guess what, people search for the US edition ISBN, not the international! You may have better luck listing your book on AbeBooks, people seem to sell it under the US ISBN anyway.

Tip 4: Use Trusted Websites

This is so you won’t get jipped. Use a site like the ones I mention below so that if something goes wrong you can easily return it. Always look at people’s return policy, condition, and description of the book.

How I Bought My Books

So today, I went onto my U account and looked at the books I needed for my classes. Since I’ve had experience with this, it didn’t take me long to find my books online and order them within about 15 minutes.

If you don’t like scouring the interwebz for the best deal (like me), you can use a site like CampusBooks.com to find what you’re looking for.

Personally, I use two websites because I’ve never had problems with them. AbeBooks and Amazon Marketplace.

About half the time, AbeBooks has much better deals than Amazon does. Once in awhile, you’ll see a better deal on Amazon. I bought two books today, let’s see how much I saved.

Book Bookstore I paid
Finance $129.50 $68 (Amazon)
Entrepreneurship $100.75 $15 (Abe)
Totals: $230.25 $83

So, let’s see, I saved $147.25. Not bad, eh? And all US editions, too.

July 8, 2008

Fix: ATI CCC 8.6 Infinite Loop Bug | Posted at 9:50 PM

I wasn’t the only one to have this problem. Apparently, when I installed the new ATI drivers for my temporary video card, the Catalyst Control Center (CCC) will keep disappearing and reappearing if you try to open it. Others have the same problem. As pointed out in the aforelinked thread, you can just get around it by installing only the 8.6 driver and then the 8.5 CCC:

  1. If you haven’t already installed it, grab the new ATI 8.6 Display Driver Only package. Install it.
  2. If you have it installed already, uninstall the new ATI CCC from Add/Remove Programs. Note: Only the CCC, not the driver or software uninstall.
  3. Now, download and install the 8.5 CCC and then restart.

Now once you’ve restarted, you can use the Catalyst Control Center without it acting up.