Archive for 2006

December 29th, 2006

Introducing JSwitchy

Filed under: Cool Coding, JQuery, JavaScript — jasonlevine @ 11:40 am

Ten days ago, A List Apart posted an article titled Switchy McLayout: An Adaptive Layout Technique. In this article, they explained how to use JavaScript to change stylesheets on the fly depending on the size of the browser window. Their code was quite compact at only 1KB, but it required the user to define everything in the JavaScript code. I thought I could do better and considered this to be a prime subject for a JQuery plugin. So off I went a-codin’ and came up with JSwitchy. Now the JavaScript is very generic and the size definitions take place within the HTML code itself (in a manner that could easily be defined once in a site’s template).

For more information, check out JSwitchy.

No Comments

No comments yet.

December 28th, 2006

Happy Holidays/New Year

Filed under: Misc Thoughts — jasonlevine @ 8:46 am

Hey all,

Ok, I’m a bit late on the holidays part. Still, I hope everyone had a happy holiday season and here’s hoping that everyone has a wonderful 2007!

Noah Holiday Card 2007 (Small).jpg

1 Comment

  1. Comment by knight-gkla — February 27, 2007 @ 5:18 am

    Hi Jason, Glad to see you’re still on the net. Hope you can help with this one, couldn’t see anywhere else to put it. I’ve used cookiejar for years and I think it’s great. Just upgraded to Vista (probably a mistake) and it worked fine run as administrator. However the Vista upgrade from Xp was a disaster and lots of the system began to crumble. A clean install is great but I can’t get cookiejar back, I get an error “Runtime 76, path not found”. I know you don’t recon to maintain this, but the program works fine if I can instal it.

October 10th, 2006

Big News About Something Little

Filed under: Misc Thoughts — jasonlevine @ 9:16 pm

We were waiting to announce this news, but I just can’t wait anymore:

Test Result

Yes, we’re expecting Number 2!

For now, we’ve dubbed this one “Little Cashew.” Everyone uses “peanut” so we wanted to be a little different. Noah added “little” since it will be his little brother or sister. Due date is early May.

Here are the first photos of Little Cashew:

Cashew Photo Number 1

Cashew Photo Number 2

Unfortunately, Little Cashew wouldn’t stay still for a better photo. Maybe next time.

Beth’s doing as well as can be expected as she fights exhaustion, nausea, and heartburn, and sleeplessness.

No Comments

No comments yet.

JHeartbeat and JTicker

Filed under: Cool Coding, JQuery, JavaScript — jasonlevine @ 9:00 pm

Recently, I’ve been doing more and more development with JQuery. For those who haven’t heard of it, JQuery is a JavaScript library that makes some previously time consuming and difficult tasks very easy. The way that it is built, you can even develop plugins to extend JQuery’s functionality. And that’s just what I did:

JHeartbeat will allow a web page to periodically poll a server. This polling can be used to keep the user’s session alive or to download updated information.

JTicker will turn an RSS feed into a scrolling news ticker.

Try them out and let me know what you think.

12 Comments

  1. Comment by gavinmroy — October 26, 2006 @ 5:57 pm

    Hey, I’ve been developing an app with jHeartbeat (thanks for the cool plugin btw). I was wondering if you planned on releasing it under a license (MIT for example like jQuery). I’m concerned about distributing it in my app without knowing what the license could/would be. Thanks again for a cool plugin.

  2. Comment by jasonlevine — November 6, 2006 @ 11:41 am

    jHeartbeat is free to use for any commercial or non-commercial project. I just ask that I be credited somewhere. Doesn’t need to be in huge, bold letters or anything. Just make some small mention of jHeartbeat and my site where ever you feel it is appropriate.

    You are right that I should come up with a more formal license, though. I’m looking at the MIT license right now and that looks pretty good. In fact, consider jHeartbeat and my other JQuery plugins/scripts to be “unofficially” covered by the MIT license. (By “unofficially”, I mean that they are under that license now but I probably won’t get to update the documentation for a bit.)

  3. Comment by ray — December 1, 2006 @ 3:19 pm

    Hi Jason,

    Good work with jHeartbeat!

    My question:
    ———–
    You mention that:
    “…can use the callback function to manipulate this (returned) data, if needed..”.

    Being new to jQuery, could you show a simple “hello world” example for the callback function?

    Suggestion:
    suppose we’d like to multiply times 2,
    the number returned in the DIV by “heartbeat.asp”?
    What would the actual samnple code be?

    Thanks, Jason!
    ray

  4. Comment by jasonlevine — December 28, 2006 @ 8:42 am

    ray,

    The JHeartbeat page has the generic code. However, a simple “Hello World” application might look like this:

    	$(document).ready(function() {
    		$.jheartbeat.set({
    			url: "heartbeat.asp",
    			delay: 3000
    		}, function () {
    			alert("Hello World!");
    		});
    	});
    

    A function that might take the number returned and multiply it by 2 would look something like this:

    	$(document).ready(function() {
    		$.jheartbeat.set({
    			url: "heartbeat.asp",
    			delay: 3000
    		}, function () {
    			alert(parseInt($("#HeartBeatDIV").html())*2);
    		});
    	});
    

    I hope this helps.

  5. Comment by bleen18 — January 29, 2007 @ 3:28 pm

    jHeartbeat is great, but how do you make it stop beating? I’m using ti to check the status of a slooow script. Once the script is complete though, I want the page to stop checking.

    Thanks!

  6. Comment by bleen18 — January 29, 2007 @ 5:33 pm

    Regarding my last comment .. I figured it out and thought I’d share:
    clearTimeout($.jheartbeat.timeoutobj.id);

    With that though, another question: in the “set” function, shouldn’t the first few lines be:
    if (this.timeoutobj.id > -1) {
    clearTimeout(this.timeoutobj.id);
    // note the ‘.id’
    }

  7. Comment by howie — February 9, 2007 @ 6:20 am

    Is it possible there’s a memory leak in JHeartbeat? I’ve been playing with it for the last couple of days, on something that fetches JSON updates every few seconds from our monitoring system, and uses that to update a UL with entries.

    It works nicely now, but I left it running overnight, and came back to a 1GB firefox! Since then, I’ve ripped out ALL of my code, leaving just an empty every-2-seconds heartbeat, and left it going in IE, and I can still watch the memory usage grow every tick…

    This is my first go at this kind of stuff, so I’m prepared to believe it’s me. Is there any more scientific instrumentation for looking at this stuff?

  8. Comment by erica — April 12, 2007 @ 11:06 am

    I downloaded http://www.jasons-toolbox.com/JTicker/JTicker_With_JQuery.zip, but JTicker doesn’t seem to be working when I view index.html on my machine- neither with your xml file or with my own. All I see fading in and out is “JTicker 0.5 Beta.” Any ideas? This is exactly what I want to implement on my site and I want it to work soooo bad! Also, if you can answer that question, is there any way to display more than one item at a time? So, for instance, four headlines - fade out - the next four headlines - etc.

  9. Comment by peter — April 22, 2007 @ 1:51 am

    I would like to suggest a change to jHeartbeat
    IE caches, and I saw how you send various HTTP/HTML headers to stop the caching. I would like to suggest adding a counter instead,
    which would force IE to request the result from the server and not make anything time dependent:

    In the changes, show below, I have added a counter.
    If the user has already supplied a url with a parameters, then the extra parameter starts with a & instead of a ?.

    options: {

    url: “heartbeat_default.asp”,

    counter: 0,
    delay: 10000

    },

    beat: function() {

    var c = this.options.url.search(/\?/) == -1 ? ‘?’ : ‘&’ ;
    var newUrl = this.options.url + c + “counter=” + this.options.counter++ ;
    $(”#HeartBeatDIV”).load(newUrl);

    this.timeoutobj.id = setTimeout(”$.jheartbeat.beat();”, this.options.delay);

    this.beatfunction();

  10. Comment by peter — May 20, 2007 @ 6:25 am

    The memory leak as pointed out in comment 7 is really problematic. Is there any way of fixing it?

    Thanks

    Peter

  11. Comment by jasonlevine — July 24, 2007 @ 6:45 am

    howie, It’s possible that there’s a memory leak in there somewhere. When I get some time, I need to update this plugin for the latest version of JQuery.

  12. Comment by eshu — November 12, 2007 @ 5:51 am

    thx for a nice plugins…

    i have one question regarding JTicker

    is it possible to extend somehow support for other character encodings..
    for example im using Windows-1250 and can not get some special character..
    i know that that is an issue…
    its pitty that half of the world can not use that nice technology ;-(

    thx

    mario

August 31st, 2006

Slightly Thickerbox 1.7

Filed under: Cool Coding, JavaScript, Slightly Thickerbox — jasonlevine @ 1:32 pm

I’ve upgraded Slightly Thickerbox to use JQuery 1.0.1 and the updated version of Interface Elements for JQuery.

2 Comments

  1. Comment by joshuazz — September 21, 2006 @ 3:13 pm

    Thank you for implementing the ability to play video files. This sets STB apart from the others in a nice way.

    However I seem to be having issues with it. The video content is always pushed up against the left border of the window, and the aspect ratio is off, as in appears square instead of 320 x 240. Any idea how to fix it?

    Thanks

  2. Comment by asterocean — November 6, 2006 @ 1:50 am

    jmp3 & thickbox are both great plugins that using jquery,

    then, how could jmp3 work in a thickbox window?
    jmp3 works fine alone, it seems that

    $(document).ready(function(){
    $(”.mp3″).jmp3();
    });

    not work when loaded by thickbox

    then which event should it been binded? any sugestion would be grateful.

    another question , how could thickbox work when loaded in a thickbox window? that’s thickbox over thickbox, :-)

    i’ve patch some flaws in thickbox, maybe someone will need it.
    such as:
    animated gif problem:thickbox loading again and again when display animated gif
    tiny picture problem:thickbox size is too small when display small size picture
    selects disapeared when thickbox closed:selects disapeared when thickbox popup,but won’t show again when thickbox quit.

    maybe someone will like it, see diff

    19d18
    “);

    > $(”body”).append(”");
    110d108
    close” + ““+caption+”");

    > TB_HEIGHT = imageHeight + 80;
    > $(”#TB_window”).append(”"+caption+”close” + TB_PrevHTML + TB_NextHTML + ““);
    164d153
    “+caption+”close” + TB_PrevHTML + TB_NextHTML + ““);

    > $(”#TB_window”).append(”"+caption+”
    close” + TB_PrevHTML + TB_NextHTML + ““);
    201c190
    “+caption+”
    close” + TB_PrevHTML + TB_NextHTML + “”);

    > $(”#TB_window”).append(”close” + TB_PrevHTML + TB_NextHTML + “”);
    228c217,218
    TB_VisibleSelects = $(”select:visible”);
    > TB_VisibleSelects.toggle();
    307c297
    TB_VisibleSelects.toggle();
    315c305
    TB_VisibleSelects.toggle();
    322d311
    }

    thanks a lot

August 14th, 2006

Slightly Thickerbox 1.6

Filed under: Cool Coding, JavaScript, Slightly Thickerbox — jasonlevine @ 8:36 pm

I’ve just posted a new version of Slightly Thickerbox. This version fixes the issue that the last release had with IE and the Interface Elements for JQuery. It also will hide any visible select boxes on the page when a Slightly Thickerbox window is opened. This works around a long standing bug in IE that places select boxes above all page elements. (It’s a “feature” that has caused many a web master to rip hair from their heads.)

Right now, there are two outstanding bugs that I know of:

1. Java Applets still appear in front of Slightly Thickerbox items.
2. Sound from movies still plays in background when Previous/Next/Close links are clicked.

If anyone knows of a way to fix these issues, I’d love to hear them. (Though I have an idea on #1. #2 looks to be more complicated.)

As always, you can get Slightly Thickerbox by going to http://www.jasons-toolbox.com/SlightlyThickerBox/

2 Comments

  1. Comment by RichH53 — August 17, 2006 @ 1:48 pm

    Jason, the runtime error I get when trying to uninstall Cookie jar is:
    Run Time error “5″
    Invalid procedure call or argument

    (Thanks… you can just email me at codybearz@rap.midco.net
    if you would want to.)
    Rich.

  2. Comment by lotrgamemast — September 7, 2006 @ 6:10 pm

    The animation to make the box apear doesnt work at all in Opera 9, so the box won’t show. However when you click the translusent black div the box apears and then animates away as normal. You may want to make it work in Opera as lots of people do use it:

    http://www.opera.com

August 3rd, 2006

My birthday but the present is for you.

Filed under: Cool Coding, JavaScript, Slightly Thickerbox — jasonlevine @ 9:03 am

It’s my birthday today, but the present is for you. I’ve upgraded Slightly Thickerbox to version 1.5.

You can now add movies (MPEG or AVI) to a Slightly Thickerbox group. You can also group AJAX pages together. This could be used as a quick and easy way to put together an online presentation.

I’ve also done a lot of backend code restructuring, but that won’t concern most of you. If you were calling the TB_Show function directly, you’ll need to change your reference to TB_ShowObj and pass it a reference to the object you want to display. For example:

TB_ShowObj(document.getElementByID(”FirstElement”))

Finally, I’ve added support for the Interface Elements for JQuery. This is a JQuery plugin that, among other things, adds some more advanced animation capabilities. If you include the Interface Elements scripts (included with the download, see below for the code), then Slightly Thickerbox will use the advanced animation capabilities automatically. Otherwise, Slightly Thickerbox will use the built-in animation capabilities that JQuery possesses.

As always, you can get the latest version of Slightly Thickerbox by going to http://www.jasons-toolbox.com/SlightlyThickerBox/.

EDIT: I just uncovered a bug with Slightly Thickerbox and IE when using the Interface Elements. For now, just disable the Interface elements (comment out or delete the references). I’ll post a fix when I figure out what is going wrong. (FireFox seems to be unaffected by the bug.)

6 Comments

  1. Comment by RichH53 — August 4, 2006 @ 7:34 am

    Comment by RichH53 — July 30, 2006 @ 4:01 pm

    Jason: I’m trying to unistall cookie jar and I keep getting a runtine error. What do I do? I can’t seem to download the updated version you’ve got of this program. Please help!!! Thanks. RichH53 codybearz@rap.midco.net

  2. Comment by ovdncoke — August 4, 2006 @ 8:51 am

    Hi Jason, upgraded last night to use thickerbox 1.5 and it solved my ‘not grouping images in whole table just rows’ problem. However I am using this on another page that has a Java Applet in the middle and the applet always appears in front of thickerbox. Example here,

    http://www.duncane.plus.com/albums/course/15th.html

    I’ve tried the trick but no luck. I also tried to recreate the fix used for lightbox here,

    http://www.huddletogether.com/forum/comments.php?DiscussionID=124

    but again no luck. I’m pretty new to all of this so I’m a bit lost now.

    Any help is appreciated,
    Thanks

    Ewan

  3. Comment by jasonlevine — August 8, 2006 @ 8:45 am

    RichH53, What’s the runtime error?

  4. Comment by ovdncoke — August 8, 2006 @ 10:51 am

    What I meant to say in Comment 3 is “I’ve tried the ‘wmode param’ trick but no luck”….

    Cheers
    Ewan

  5. Comment by jasonlevine — August 14, 2006 @ 8:28 pm

    ovdcoke,

    It looks like Java applets always appear on the top of the page no matter what the HTML code. Just like select boxes in IE. It’s an issue that has caused many a web master to tear out their hair. I’ve worked around the select issue for the next release of Slightly Thickerbox (which will be posted shortly), but am still trying to get a Java Applet workaround in place.

  6. Comment by ovdncoke — August 17, 2006 @ 5:36 pm

    Thanks Jason,

    I’m using Cody’s thickbox again just so I could get a workign version to show some people. It works fine with the Java Applet, have a look

    http://www.duncane.plus.com/albums/course/2nd.html

    I’m still curious to see if the animations would make it look any slicker though.

    Thanks Again
    Ewan

July 24th, 2006

The Bronx Zoo

Filed under: General Photography, Misc Thoughts, Photo Gallery — jasonlevine @ 9:28 pm

On Friday, July 21st, I went to the Bronx Zoo with my parents, wife, and son. On the way over, we drove through pouring rain, thunder, lightening, and wind. There were plenty of times when I thought that we were crazy for continuing on. My son was so looking forward to seeing the animals, though, so I drove on in the slim hopes of the bad weather passing when we got to the zoo. And wouldn’t you know it? As we entered the Bronx, the rain lightened. The thunder and lightening faded away. And the winds died down. Sure the clouds were still there and it was very humid, but the weather was now passable for a zoo visit. The ground wasn’t even as wet as I thought they might be.

So we entered the zoo and went through the exhibits. The Butterfly House was fun, especially for me since I’ve wanted to take some butterfly shots for awhile. The little guys are quick though and usually flit away before the camera is focused on them. In the Butterfly House, though, the butterflies are used to people gawking at them. So they didn’t mind me getting up close to take their photos. Two even took a break from flying on me! It’s hard to take a closeup shot of a butterfly on your upper arm, though.

We also saw the gorillas. I think this might have been Noah’s favorite part. He loves gorillas and kept pointing them out to us and running over to see another one. This one gorilla approached the glass dividing the gorilla habitat from the human section. She laid down and rested a foot and arm on the glass. One of the other zoo visitors touched the glass and the gorilla moved her hand over to cover the woman’s hand. The woman tapped the glass and the gorilla tapped back. It was quite interesting. (I joked that the gorilla must be thinking “Boy, what a great human exhibit we have here.”)

We also went on the Wild Asian Safari monorail, walked through the bears exhibit, saw the giraffes (my son’s second favorite, I think), and even walked through the Children’s Zoo. As we were nearing the end of the Children’s Zoo, my father got a call from a coworker in Manhattan. He reported that Manhattan was pitch black out and thundering like crazy. As if on cue, we heard thunder in the background. We hurried out of the Children’s Zoo and left the Bronx Zoo. (We were almost done with the Children’s Zoo and that was going to be our last stop anyway, so it’s not like we cut our trip that short.) As we got out of the parking lot, rain drops started falling on the car’s windshield. Then the driving rain, thunder, lightening, and winds returned.

Still it stayed nice long enough for us to have a very nice visit. I’d recommend visiting the Bronx Zoo to anyone, but especially if you have little kids. It’s one thing to see all of the animals. It’s quite another to have a toddler next to you in sheer awe over the fact that a gorilla is right in front of him.

As for photos, I was able to take quite a few photos. Most of my Asian Safari photos didn’t turn out well, but that’s mainly because the monorail didn’t really stop moving long enough for my camera to take decent photographs. Still, I’ve opened a new gallery for the Bronx Zoo photos. Just click here to view them.

No Comments

No comments yet.

July 18th, 2006

Which is the lesser of the two evils?

Filed under: Misc Thoughts — jasonlevine @ 7:43 am

More and more I’m not sure that a government Network Neutrality bill is a good solution. Don’t get me wrong, I’m a strong proponent of Network Neutrality and completely agree that the telecos are looking to erect toll booths along their networks to pad their bottom line. However, government regulations almost never are perfect. This is especially true when dealing with technological issues.

ISPs should be allowed to manage the traffic on their network so long as that management doesn’t give preferential treatment to their own traffic or someone else’s traffic based on payments. For example, if they are shaping their network to speed up their VoIP solution, they had better also speed up the VoIP solutions of their competitors. The telecos are in the unique position of being pipe provider and content/service provider. They shouldn’t be allowed to use one as unfair competition in the other market. As a second example, telecos shouldn’t speed up or slow down Google based on whether Google has paid them this month. Unless, of course, Google uses them as their direct upstream provider.

However, federal legislation would likely be poorly worded. At one extreme, it could be the CAN-SPAM of Network Neutrality. All talk and no action. (They might bust some small ISP as “proof” that it’s working, but mostly they would allow the telecos trample all over Network Neutrality.) At the other extreme, it might be so restrictive that an ISP implementing a spam filter would run afoul of the law.

So we’re left with two possibly bad scenarios. Let the telecos free reign and wind up with content providers who need to pay each individual teleco along the way lest their traffic be shunted to the slow lane. (This would make running a website prohibatively expensive and would wind up shutting down many small sites.) Or let government reign in the ISP but run the risk of them not pulling back just the right amount. Which is the lesser of the two evils?

No Comments

No comments yet.

July 14th, 2006

Cloning my son

Filed under: General Photography, Reviews — jasonlevine @ 3:05 pm

This is a combination post. In some ways, it will be the first of many freeware reviews. In other ways, it will be a tutorial on how to create images like this:

Bet you didn’t know that I had triplets, did you? Well, I don’t. (And given how much of a handful one Noah is, thank goodness!) So how come there are three distinct Noah’s in that photo? Microsoft Group Shot is why.

Microsoft Group Shot is a freeware application that Microsoft has released that enables you to take multiple photos and combine elements of them to make one overall composite photo. The most common use for this would be group photos (hence the “Group Shot” name). Whenever you do this, someone invariably blinks or looks away just as the camera takes the shot. With Group Shot, you would take a series of photos of the group and select which faces you wanted to use in the composite photo. Nothing that can’t be done with a copy of Photoshop or Paint Shop Pro, mind you, but it is much simpler (and cheaper) with Group Shot. In fact, my only gripe with Group Shot is that you can’t resize the window.

To make a composite photo, you obviously need to start with the source photos. For this, I would recommend getting a good tripod so the overall scene doesn’t change from photo to photo. Once you are set up, take your photos as you normally would. After uploading your photos to your computer, load up Group Shot. Drag the series of photos into Group Shot and it will load them up, one photo per tab. Now, for each photo, you simply drag a rectangle around the area that you want to use in the composite photo and click “Add to Composite.” Group Shot will display an in-progress composite image for you. When you are finished, simply export the final image. Viola! No more blinked eyes!

Now onto Part II. Creating triplets where only one kid really exists. Start off with your tripod/camera setup. Place your subject in the first position and take the photo. Now change positions and take another photo. Repeat this as many times as necessary.

Now load up Group Shot and drag the images onto it. Carefully select the subject in each photo and click the add to composite button. Export the final result and you have a quick and easy photo with multiples of the same person or object.

No Comments

No comments yet.

Page generated in: 0.636 seconds.
Powered by: WordPress 2.5