Cool PHP captcha
While looking for an easy to use captcha to add on a contact form in order to prevent spam, I found this project. It's really easy to use and integrate in your php contact form!
Cool WYSIWYG editor
While looking for a nice simple WYSIWYG editor for a CMS I was working on, I stumbled upon CKEditor. Looks good, has all the features I needed, is compatible with all the browsers and is open source! A very good choice I'd say!
It's also really easy to use. You just have to add a few javascripts and it replaces you regular textareas with the texteditor!
How to convert between ANSI and UNICODE strings?
Useful C++ code for converting between ANSI an UNICODE strings:
Ansi to Unicode:
char *ansistr = "Hello"; int a = lstrlenA(ansistr); BSTR unicodestr = SysAllocStringLen(NULL, a); ::MultiByteToWideChar(CP_ACP, 0, ansistr, a, unicodestr, a); ::SysFreeString(unicodestr);
Unicode to Ansi:
BSTR unicodestr = 0;
SomeCOMFunction(&unicodestr);
int a = SysStringLen(unicodestr)+1;
char *ansistr = new char[a];
::WideCharToMultiByte(CP_ACP,
0,
unicodestr,
-1,
ansistr,
a,
NULL,
NULL);
delete[] ansistr;
::SysFreeString(unicodestr);
Envato ‘WordPress Pack’ Bundle
Cool bundle available from envanto. Filled with cool wordpress themes and plugins!
Google Maps V3 Tips and Tricks
While studying for the google maps certification exam I made this list of tips about the 3rd version of the API. Useful as a recap of the most important features of the API.
Tips and Tricks:
- This version of the API was designed to work well on mobile devices. To check the device type and make the appropriate settings, use the navigator.userAgent property.
- You can set a default language for the map and how it behaves based on a given country or territory. For this, the language and region parameters must be set when loading the API.
- It's best to load the script asynchronously, to make sure the rest of your pages content renders properly.
- The basic objects you should know are: map, latlng, marker.
- There are two types of events: users events and MVC state changed events. User events are triggered when the user clicks on the map, goes with the mouse pointer over the marker, etc. MVC state changed events are triggered when the map's properties are changed. You can also handle DOM events.
- User events can pass arguments, MVC state changed events do not.
- There are 3 types of controls: navigation, scale and maptype.
- The default controls can be disabled by setting the Map's disableDefaultUI property (within the Map options object) to true. The map options object is also used to add or remove controls, by setting the appropriate property value to false.
- The are some options you can choose for controls, by modifying the navigationControlOptions, scaleControlOptions or mapTypeControlOptions objects. The style and position of the controls can be set this way.
- You can also create custom controls. Steps to create one: drawing the control, positioning, handling events.
- Most custom overlays you can use are: markers, polylines, polygons, info windows and custom overlays.
- If you wish to manage a set of overlays, you should create an array to hold the overlays and amnage each of the overlays in it one by one.
- Ground Overlays can be used for rendering images on the map.
- Geocoding means turning addresses into coordinates (longitude and latitude). Using one of the provided services, you can use geocoding and also reverse geocoding.
- The calls to the geocoding service are asynchronous, a callback method must be specified to be executed when the result is received.
- You can also use the google maps API to find directions between two places and properly show them on the map.
- The directions service is used for finding the directions. The call to this service is also asynchronous.
- To view the directions you need to use the DirectionsRenderer object.
- To make the directions draggable you only need to set the draggable option for the renderer to true.
- You can set waypoints for routes.
- The routes are formed of legs (between waypoints, or one leg if there are no waypoints set) and steps (more steps form a leg). You can view all of these using the DirectionsLeg and DirectionsStep objects.
- There's also the elevations service that helps you find the elevation of your locations. This too is asynchronous.
- The last service provided is the street view service. To add this one you just need to add the Street View control in the map options.
- The basic map types are: ROADMAP, SATELLITE, HYBRID (roadmap + satellite) and TERRAIN.
- You can add new types and also change the properties of the existing ones.
For more info on Google Maps V3 read Developer's guide.
Creating an Interactive Travel Map using the Google Maps API
I've played again with the google maps api and started working on an interactive travel map. The idea is that everyone can add new locations and view the locations added by others.
I've also written a tutorial about this, you can read it here.
HTML 5 Geolocation API
I've played today with this feature of HTML 5. If your browser supports it, using this, everyone can find out your exact location (it really is pretty accurate!). You will have to permit the browser to share your location.
Here's the app I've made.
Even if it sounds a bit spooky, knowing where your site's viewer are from may come in handy in various situations. And this method it more accurate than using the user's IP address. This API uses Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs to find the location.
You can read the api specification here.
How to integrate facebook in your site using the facebook javascript sdk
If you are looking for integrating facebook in your site, you should check out the facebook javascript sdk. I've written a tutorial that shown how to use the sdk. It's been published on 1stwebdesigner.com.


