E-com DevBlog Spider-ball-vacuum

28Sep/100

WIndows 7 Upgrade Family Pack from Deals.woot

I noticed this a while back and have been trying to remember it for later. apparently windows is offering a 3 license family pack upgrade for $150. So for those of you who are not yet on the latest windows and wanna be, or for those like me who know that it's eminent that we'll have to be there someday (or go *gulp* MAC, or Linux) and figure you might as well do it as inexpesively as possible, check out the link and mark your calendar for Oct. 3

Windows 7 Upgrade

Print This Post Print This Post
10Sep/100

LinkPost August 2010

Welcome to the latest LinkPost, I'm finally caught up with this post so I am understandably excited.  This month we are featuring some excellent HTML5, CSS3, and of course jQuery plug-ins.  And since it's been a while, I have two new font links (let the peoples of the interwebs rejoice!)

Web Development (HTML JS CSS)

http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/ - more html5 code to get excited about

http://ajaxian.com/archives/when-does-javascript-trigger-reflows-and-rendering - Thomas is a genius, keep it simple and keep it streamlined. excellent short article with great illustrations.

http://www.webdesignerwall.com/tutorials/css3-media-queries/ - I can't remember if I've linked to media queries before, but this is something that is up-and-coming, and is good to start looking at now. (update, yes I have totally linked to this over at CSS-Tricks, great article, check it out in the last LinkPost - or the LinkPost before the last one ;) )

http://speckyboy.com/2010/08/22/50-awesome-new-jquery-plugins/ - Some of these aren't too new, but there should be a few that you will probably use right now

Android

http://speckyboy.com/2010/08/04/a-useful-selection-of-android-developer-tools-and-resources/ - Excellent round up of tutorials, ebooks, etc. for the Android developer in you.

Image / Design

http://www.noupe.com/freebie/80-useful-psd-templates-for-designers.html - Last year there was a fantastic psd pack, and this year looks pretty good too

http://www.noupe.com/tutorial/35-fresh-and-wanted-photoshop-tutorials.html - new photoshop resources for the win!

http://speckyboy.com/2010/08/09/30-fresh-and-free-icon-sets-for-designers-and-developers/ - More icons than you can shake a stick at.  Ok fine, maybe not that many, but plenty none-the-less

http://www.noupe.com/wallpaper/50-tremendous-grunge-wallpapers-for-your-desktop.html - a very nice collection of grungy wallpapers... use for inspiration, or for your desktop :)

http://www.noupe.com/tutorial/photoshop-web-design-layout-tutorials-from-2010.html - Photoshop tutorials for everyone! this time featuring web layouts

Fonts

http://www.fontpark.net/ - Been a while since I've linked fonts, but look! a new resource!

http://www.smashingmagazine.com/2010/08/12/30-new-free-high-quality-fonts-typography/ - 30 more fonts from Smashing Mag

Print This Post Print This Post
10Sep/100

LinkPost July 2010

So close to caught up! I'm really going to start changing the way I do these, well at least I think I'm going to change ;) .

Image / Design

http://speckyboy.com/2010/07/02/25-free-color-tools-apps-and-palette-generators/ - like the link says, a large list of color apps for your designer side.

http://vandelaydesign.com/blog/design/paper-textures/ - Nice round up of paper textures, some have been passed around for a while, but who doesn't need a good paper texture now and then.

http://www.webdesignerdepot.com/2010/07/exploring-photoshop%E2%80%99s-angle-gradient-tool/ - Great little show on the power of the angle gradient tool (which I'll admit, I never used, because I thought it was useless).

http://www.noupe.com/tutorial/brilliant-adobe-photoshop-cs5-tutorials-from-2010.html - Good tutorials for the photoshopers

Web Development (HTML JS CSS)

http://designreviver.com/tutorials/fresh-html5-resources-articles-and-tutorials/ - great listing of html5 tutorials.

http://css-tricks.com/return-false-and-prevent-default/ - Seems this last week that e.preventDefault vs. return false is getting a lot of attention.  Here's a great article on it.

http://www.learningjquery.com/2010/07/great-ways-to-learn-jquery - A great list of where to start to dive into the wonderful world of jQuery (my js lib of choice).

http://speckyboy.com/2010/07/11/40-jquery-and-css3-tutorials-and-techniques/ - Large list of jQuery and css3 tutorials (although not sure why you need css3 if you're using jQuery, but eh, it's a good way to learn css3... I hope).

http://www.ilovecolors.com.ar/using-cookies-jquery/ - jQuery and cookies? sounds like it could be delicious

http://www.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/ - Great article on detecting mobile devices and changing your display to fit them (just remember the toggle so they can view the whole site if they want).

http://www.admixweb.com/2010/07/14/oop-javascript-creating-an-window-box/ - Excellent tutorial (with demo) of how to build a window object with javascript.

http://www.noupe.com/javascript/50-useful-javascript-and-jquery-techniques-and-plugins.html - More jQuery plug-ins (yes, some have been around for a while...)

http://mediaelementjs.com/ - Another html5 ready video/audio contender.  This one looks pretty sweet, even includes silverlight if flash isn't installed on the system, I'll have to give it a try and then report back on it.

http://www.divisionbyzero.co.uk/2010/07/29/how-to-beat-form-spam-with-just-css/ - Good little article on how to avoid spam using css.

http://www.noupe.com/how-tos/50-useful-articles-and-resources-you-may-have-missed.html - Round up of articles I may have skipped, and others that should be mentioned again.

Print This Post Print This Post
10Sep/100

LinkPost June 2010

Continuing in the very late LinkPost updates, here is the one for June.

Images / Design

http://www.webdesignerwall.com/general/60-free-handwritten-script-fonts/ - Handwriting is in, well as long as it's not your handwriting.
http://www.webdesignerdepot.com/2010/06/opacity-photoshop-blend-modes-pattern-magic/ - Photoshop (and I'm sure you could gimp this to some degree) unite! and create patterns for everyone!
http://www.noupe.com/tutorial/30-useful-abstract-photoshop-design-tutorials.html - I like abstractiness, so enjoy these photoshop tutorials
http://speckyboy.com/2010/06/20/30-of-the-best-web-development-and-design-mini-icon-sets/ - Nice list of some great little icons

Web Development (HTML, JS, CSS)

http://www.html5rocks.com/ - Great page from some google devs on learning and incorporating HTML5 now into your site.
http://aext.net/2010/06/css3-animation-and-3d-effects/ - Nice round up article of css3 features (css3 sure is fun)

http://speckyboy.com/2010/06/22/50-jquery-plugins-for-form-functionality-validation-security-and-customisation/ - a nice list of some old and some new jQuery plugins to make life awesome.

Print This Post Print This Post
10Sep/100

LinkPost May 2010

I'm way behind on posting these, but better late than never right?  May was a light month for links, which probably means I was busy, so here are four links that may be of some use.

Web Development Links

http://line25.com/tutorials/spice-up-your-web-typography-with-font-face - time to play with the @fontface import
http://gtmetrix.com/ - For those developers that aren't big into bloating Firefox, you can now use this online service to run PageSpeed and YSlow to figure out why your webpages are painfully slow.

Image / Design links

http://www.noupe.com/freebie/40-fresh-free-texture-packs-from-2010.html - 40 free texture packs :) Yay for free!
http://speckyboy.com/2010/05/10/android-app-developers-gui-kits-icons-fonts-and-tools/ - All the goodies for android apps

Print This Post Print This Post
8Sep/101

Android Maps Panning Listener

I've been developing an Android Maps app that needs to add some overlays to the map as the user pans the map around. Since it seemed like such an obvious thing to do with maps, I thought there would be a built in listener that would handle that for me. Boy was I wrong. It seems that the Maps API doesn't really have any support for that and so we're left to try to figure out the best approach.

After researching and coding I've written up two ways to listen to see if the user pans the map.

  • Set an onTouchListener on the MapView
  • Run a listener thread that pings the mapView every so often to see if it's moved

Both approaches use a DistanceCalculator (I forgot where I saw it posted otherwise I would link to it) to see if we've panned enough distance to update the overlays. The code will be at the end of this post.

I prefer the first approach since it seems cleaner, but it does have the drawback that the built in zoom controls won't work with it. But here is the code:

mapView = (MapView) findViewById(R.id.mapview);
        //Built in Zoom Controls don't work with the onTouchListener
        //mapView.setBuiltInZoomControls(true);
        mapView.setSatellite(true);
        mapView.setOnTouchListener(new OnTouchListener() {
 
			@Override
			public boolean onTouch(View v, MotionEvent event) {
 
				int actionId = event.getAction();
 
				if (actionId == MotionEvent.ACTION_UP && userIsPanning) {
 
					userIsPanning = false;
					if(mapCenter == null || DistanceCalculator.calculateDistance(mapCenter, mapView.getMapCenter()) > DISTANCE_CHANGE) {
			    		mapCenter = mapView.getMapCenter();
 
			    		//TODO Update your overlays because the map has moved
			    		Toast.makeText(context, "Panned", Toast.LENGTH_SHORT).show();
			    	}
 
					return true;
 
				 } else if (actionId == MotionEvent.ACTION_MOVE) {
					 userIsPanning = true;
				 }
 
				return false;
			}
		});

As you can see it simply sets a flag when it detects we're moving and then waits for the ACTION UP to show that the user has removed their finger.

The listener thread has a little more to it and I've noticed it doesn't always work as expected. In the onCreate method in your main class you'll add this:

//updateMapOverlaysThread is declared as a member variable
 
updateMapOverlaysThread = new UpdateMapOverlaysThread(this, mapView, messageHandler);
		new Thread(updateMapOverlaysThread).start();

And here is the thread class:

import android.content.Context;
import android.os.Handler;
import android.util.Log;
 
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
 
class UpdateMapOverlaysThread implements Runnable {
 
	private static final String TAG = "UpdateMapOverlaysThread";
	private static final int INTERVAL = 1500;
	private static final int PAUSE_INTERVAL = 7500;
	private final Double DISTANCE_CHANGE = .01; //in km
 
	private boolean enabled = true;
	private boolean interrupted = false;
 
	private int zoomLevel = 0;
	private Handler mainThreadMessageHandler = null;
	private Context context = null;
	private MapView mapView = null;
	private GeoPoint mapCenter = null;
 
	/**
	 * @param context
	 * @param mapView
	 */
	public UpdateMapOverlaysThread(Context context, MapView mapView, Handler messageHandler) {
		this.context = context;
		this.mapView = mapView;
		this.mainThreadMessageHandler = messageHandler;
	}
 
	@Override
	public void run() {
 
		Log.d(TAG, "Start");
 
		boolean fireOverlayUpdater = false;
 
		while(!interrupted) {
 
			if(enabled) {
				Log.v(TAG, "zoomLevel: " + zoomLevel + " map zoomLevel: " + mapView.getZoomLevel());
				if(zoomLevel !=  mapView.getZoomLevel() ){
		    		zoomLevel = mapView.getZoomLevel();
		    		fireOverlayUpdater = true;
		    	} 
 
				Log.v(TAG, "mapCenter: " + mapCenter + " map mapCenter: " + mapView.getMapCenter());
				if(mapCenter == null || DistanceCalculator.calculateDistance(mapCenter, mapView.getMapCenter()) > DISTANCE_CHANGE) {
		    		mapCenter = mapView.getMapCenter();
		    		fireOverlayUpdater = true;
		    	}
 
		    	if(fireOverlayUpdater) {
 
		    		Log.d(TAG, "Need to update overlays");
 
		    		//TODO Update the overlays
 
		    		// Send the overlays to the UI Thread
//		    		Message message = mainThreadMessageHandler.obtainMessage();
//		    		OverlayItem overlayItem = new OverlayItem(mapView.getMapCenter(), "POINT", "BOOYA");
//		    		message.obj = overlayItem;
//		    		mainThreadMessageHandler.sendMessage(message);
 
			    	// Reset
		    		fireOverlayUpdater = false;
		    	}
 
		    	// Wait until time to fire again
				try {
					Thread.sleep(INTERVAL);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
 
			} else {
				// Wait until your turn to work again
				try {
					Thread.sleep(PAUSE_INTERVAL);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
 
			}
		}
 
	}
 
	/**
	 * @param enabled
	 */
	public void setEnabled (boolean enabled) {
		Log.d(TAG, "setEnabled: " + enabled);
		this.enabled = enabled;
	}
 
	/**
	 *
	 */
	public void killThread() {
		Log.d(TAG, "killThread");
		interrupted = true;
	}
 
}

You'll notice that we use a MessageHandler to post the overlays on the map. Here is the Handler defined in the onCreate method in our main class:

//Setup Message Handler
        messageHandler = new Handler() {
 
        	public void handleMessage(Message msg) {
 
        		OverlayItem overlayItem = (OverlayItem)msg.obj;
 
        		//TODO Add the overlay to the map
 
            }
 
        };

But these are the approaches that I've tried. Has anyone tried a different approach if so how has it worked out?

import com.google.android.maps.GeoPoint;
 
public class DistanceCalculator {
 
	//earth’s radius (mean radius = 6,371km)
   private static final double radius = 6371;
 
   public static double calculateDistance(GeoPoint startP, GeoPoint endP) {
 
	  double distance = 0;
 
	  if(startP != null && endP != null) {
		  double lat1 = startP.getLatitudeE6()/1E6;
		  double lat2 = endP.getLatitudeE6()/1E6;
		  double lon1 = startP.getLongitudeE6()/1E6;
		  double lon2 = endP.getLongitudeE6()/1E6;
		  double dLat = Math.toRadians(lat2-lat1);
		  double dLon = Math.toRadians(lon2-lon1);
		  double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
		  Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * 
		  Math.sin(dLon/2) * Math.sin(dLon/2); 
		  double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
		  distance = radius * c;
	  }
 
	  return distance;
   }
}
Print This Post Print This Post
1Sep/108

Zend Framework vs. CodeIgniter

I hope nobody minds but this is going to be more of a rant than an actual performance comparison of the two frameworks. First of all I started using CodeIgniter almost two years ago, and while it was a bit of a thorn at first it was never super difficult to figure out how to do stuff. The documentation was easy to understand and full of examples of what to do, plus things worked when I did them. As a result I've used CodeIgniter on several projects since.

Recently at my current job the powers that be (hereafter referred to as "they") decided to go from a progressive coding approach to a more MVC type approach using a framework (either custom made or already built). I'd like to point out that I'm all for using a framework especially on the applications we've got right now. I did suggest CodeIgniter as the framework of choice but my suggestion was received with disgust, so I kept my mouth shut...big mistake.

After attempting to build their own MVC Framework "they" decided to go with Zend Server Community Edition. Now I didn't (and still don't, which is sad) know a lot about the Zend Framework so I was somewhat excited to see it in action, especially since my experience with CI has been so great. And I guess maybe that's one of the reasons I'm posting today.

For anyone out there wondering if Zend is a good match for you, STOP!
For anyone out there who recently implemented the Zend Framework, WHY? It's not to late to turn back.

I've been working with the Zend Framework for about two weeks now, and I don't expect to know everything there is to know about Zend but I do expect to know SOMETHING. Let's just take a trip down memory/nightmare lane.

Please excuse me if I can't remember all the details, I've tried so hard to block some of this from ever resurfacing.

My first task was to figure out how to ajax with zend, seems simple enough right? Shoot zend even created a helper that loads the (almost) latest jQuery libraries for you so you never have to worry about being up to date. Not only that but zend has a way to build your Ajax request so you don't have to know how to do that yourself either. What they don't tell you is that in order for the jquery libraries to be loaded on your page, you DO have to use at least one of their custom php jquery building tools (in other words, you can't make all your jquery by yourself), otherwise the libs just wont load. Instead they let you beat your head against your desk for hours and hours until you finally un-comment a test jquery builder you had previously used only to find out that was the missing piece.

Next our whole team has been tasked with creating a new application using zend, it's been over a week now, I still feel like I don't know anything. Now you might be saying to yourself, "did you try google dipstick?" Yup sure did, and as google does it pulled up all kinds of links. Almost always the top 5 go strait to the official zend documentation which is by far the worst documentation I've ever seen about anything. It's like when someone has a secret and they know you want to know, but they know that if they tell you then they'll lose the leverage they have on you, so they just hold on to it with that smirk on their face and never tell you anything. There's all kinds of words but they don't say much and the examples are horrific at best. One example I was looking at had a variable in it, and they'd conveniently cut out the part where they actually initialize that variable so you have no idea what values it is supposed to hold. Turns out it was an array, but I still don't know if it was a named array or if it can simply be numbered. I actually got a little excited when I stumbled onto the Programmers reference guide, I thought "yes if anything will help this is it", I was wrong to think that and I apologize.

Now here's the kicker, I do need to backtrack a bit. When you install zend there is a GUI that is installed to help you manage how the server works, I've recently lost this GUI, by lost I mean I know where it's supposed to be and the files are all there but the GUI doesn't show up when i put the correct URL in my browser. So I started researching this, only to find that a certain part of the server called lighttpd is not running, the GUI is the only thing that requires lighttpd. So i started googling lighttpd is not running and got a fair amount of hits on that one. None of which helped. Finally I decided to create an account with the zend forums and humbly ask the zend folks themselves what to do about my problem.

To my dismay, when I logged in I found a little counter at the bottom of the page that said "Users browsing this forum: disgruntled and 0 guests" (if you haven't guessed, I'm 'disgruntled'). You have got to be kidding me, I'm the only one on this forum? Now to be fair it was after 5:00 on the east coast so I imagine the 3 people using zend in that part of the world have gone home.

how many people on this forum?

how many people on this forum?

Needless to say, I'm a little disappointed, awe who am I kidding? I'm downright furious.

On the flip side, if anyone reading this has any idea on where I can get my hands on some useful examples of zend at work. Please leave them in the comments.

Print This Post Print This Post