Category Archives: resources

XML String Format

Useful new tool created:

XML String Format.

Check it out.

Provides:

– XML Validation

– Format of the un-formatted XML string


Top 10 site down issues

Security hasn’t changed much from the last 3 years till now, but bringing up the top 10 issues that can bring your site down is always a good thing.

Here is the top 10 countdown application security risks:

  • Injection
  • Cross-Site Scripting (XSS)
  • Broken Authentication and Session Management
  • Insecure Direct Object References
  • Cross-Site Request Forgery (CSRF)
  • Security Misconfiguration
  • Insecure Cryptographic Storage
  • Failure to Restrict URL Access
  • Insufficient Transport Layer Protection
  • Unvalidated Redirects and Forwards

Want more information about them and how to prevent them? Check it out:


Making a mobile version of your website with PHP

droid-doesCreating a mobile version of your website is not a very hard task, but it requires a bit of work. Unlike a desktop browser (PC browser) a mobile browser still have limited resources and usually it has it’s unique way to interpret and renders the page.

When creating a mobile version of your website there is one thing you need to know before starting to develop:

  • it will work for all phone types or only smartphones and newer types of devices?

Even with support of detection and translators to develop mobile sites, this decision actually might help you on how far you will want to go with the features of the website.

Now it is time to get your tools set.

First things first. Download WURFL witch is a mobile device detection system and register on their Community group. This is the must important tool that you will need for your mobile site. WURFL is a XML device system that will read a user agent string and based on that it will give a full feature and capabilities from the device.

The next step is to install a translator. This will help you on writing the code without worrying about if it is WML, CHTML, HTML 4, etc. Make’s things a ton easier. Currently WURFL works great with WALL (old WALL API) and WNG (the next generation of WALL – go with this one if you can).

With both of these you have all your libraries set and you should be ready to code.

The best and most advisable way to use this is to use WURFL to detect the device coming and if is a detected phone, then redirect to the mobile site, otherwise, normal site. Consider the rules fully and test all. In case of doubt, redirect to the normal site (there is a greater chance for the user agent being a browser from a desktop than a phone).

A couple of good useful notes:

  • Create a domain.mobi or m.domain.com to support your mobile application
  • Javascript is still very limited even smartphones
  • size matters: rule of thumb 10 seconds for full page rendering
  • devices such as iPad are considered mobile devices
  • WURFL also is supported by Java

Good luck and have fun.


Converting your PDF to a valid ePub file

On devices like iPhone, iPad, Kindle and some other readers, the ePub format is the desired format for books. For some devices it is the only format accepted for a book.

I went on a task to converting one of my PDF books into a ePub so I could use with my readers and I found out that it is a harder task that it really seems, therefore, with some patience and a little validation and bug correction, you can easily fix all issues.

The first step is to download Calibre. There are other conversion tools online to be downloaded but Calibre does a heck of a good job on converting your file.

The next step is to convert the file and check if it is a valid file for iPad. Let’s use Apple’s iPhone and iPad as a base since Apple’s standards are the worst to be met. For checking if your file will work, go to the ePub Validation from ThePress.org. Upload the epub file and wait for the result. If everything works fine you should get a nice passed score, otherwise it will throw a bunch of errors on the page.

Now comes the hard part. If you see errors on the page, then you need to edit your epub based on the errors that you receive. Basic knowledge of HTML and XML is more than enough for fixing the files. Calibre will not let you edit the epub files individually, so we will need a secondary software for this. Using Winrar uncompress the epub file, just like you would do with a .rar file, and edit the files using Edit+ or Notepad. Once all changes are done, just place them back on the .epub file.

Validate the file again, just as a double check and you should be good to go.

Note: Most of the errors on the report will be easy change, but there is one that is quite hard to understand. If you come across an error saying: unfinished element – you need to make sure that all childs under that element are there. This one usually happens on the .opf file that contains the metadata and epub information.

For more info about epub’s: http://en.wikipedia.org/wiki/EPUB


Developers

“Developers are tools that convert caffeine into code”

Author: Unknown


Can’t connect to the Internet – use open DNS

Sometimes the ISP’s can be somehow annoying. You have some functions of your Internet connection working, look at the router and everything seems right, refreshed DHCP and nothing, no juice, you just can’t get the pages to load.

Today I came around this same exact problem and with a little help of a co-worker and friend I learned a sweet hack that will just fix this kind of issue.

Go to your router configurations, or your PC / Mac configurations and set these 2 DNS entries:

DNS1: 8.8.8.8
DNS2: 8.8.4.4

This will use a open DNS – Google – to get your pages through.

Nice trick and good hack. Kept as resource.

Have fun.


MacBook Pro Charging Meltdown

Today while using my Macbook Pro I noticed that it was hot as a volcano core and for the first time I heard it turning on the fan.

No need to mention that I’m a hard core user when it comes to computers in general. With PC’s (notebooks or not), I usually have huge cooler fans so it can stay cool, but on a Mac, it was a surprise to see the temperature going up to 150F.

After a little search and talking to some peers I have found out that on Macbook’s that have the internal battery heating up bad when charging is something very common. Sad it is true (they don’t do Mac’s as they did  before).

Anyway, after a small search I have found out a good post with a great tool that will help you control the fan settings and monitor the temperature.

Check it out: http://blog.ziggytek.com/2010/01/06/why-your-macbook-macbook-pro-is-overheating/

You can also download the application directly at: http://www.macupdate.com/info.php/id/23049


Using the Facebook Javascript SDK

I have been messing with the FB API’s for a while to get that counter customized for us. The more I messed with the API’s the more I got the feeling that FB is not quite sure what is doing.

The Javascript API that we seen is the new Javascript API and it seems it is on Alpha release. The good thing is that with it we wont need anymore that .htm verification file for running cross-domain javascripts, but the bad part is that currently Goal uses for the fan badges the old javascript API.

New: http://developers.facebook.com/docs/reference/javascript/
Old: http://developers.facebook.com/docs/reference/oldjavascript/

I found a comment saying that if we are currently wanting to use the new API (Javascript SDK) we should fully remove the old references from the site and since it is on Alfa release the data functionality are still not ready. Besides this I was getting error after error when using the new API even after removing all old references from the application.

http://wiki.developers.facebook.com/index.php/JavaScript_Client_Library

The best way to keep track of the Javascript SDK from Facebook is by following the issues list at: http://github.com/facebook/connect-js and by checking on the FAQ. There is a lot of good information there.

Just a note, the Wiki is being deprecated. All the information that we should look are under the developers.facebook.com/docs.

Playing with the API’s, I have created a custom AJAX call using JQuery and JSONP. the JSONP allows a cross-domain request from Jquery AJAX and with that I was able to correctly execute a query using FQL.

The query is a parameter given to a url (http://api.facebook.com/method/fql.query?query=QUERY.) and it will return in either XML or JSON format.

Anyway using the query is pretty simple and if you want to give a test run of the results format before doing anything the best place is:

http://developers.facebook.com/docs/reference/rest/fql.query

There is one annoying bug that I could go through with the new SDK, the SDK wont bootstrap giving an error at line 3. I think is related to cookies and the old API. I will still give a search on that and when I find the solution, I will place it here as an update.

Have fun.


Zend Framework – Zend Currency

Today I got myself up with searching on Google and trying to understand the Zend Currency (a great way to easily format numbers in currencies format – PHP does have a function but it does not work under Windows) examples in the Zend Framework documentation. Whatever I did it was not working until I have bumped into a help manual from Zend that showed a better example.

Basically, the Zend Currency will totally bypass the parameters in the array and throw an error if the like the examples on the API documentation are set:

$currency = new Zend_Currency(
‘value’   => 100,
‘display’ => Zend_Currency::USE_SHORTNAME,
)
);
print $currency; // Could return ‘USD 100’
In order for this to work you need to first create the Zend_Currency object passing the locale and currency format (or if you don’t pass any parameter, it will just grab the format and locale from the system).
$currency = new Zend_Currency();
echo $currency->toCurrency(100); // could return USD 100
If you need to pass the locale or currency format this is how you can do:
$currency = new Zend_Currency(‘en_US’, ‘EUR’); // set locale to USA and the currency format to Euro
echo $currency->toCurrency(100);
If we do this same example following the API documentation we would:
$currency = new Zend_Currency(array(‘locale’ => ‘en_US’, ‘value’ => 100, ‘currency’ => ‘EUR’);
echo $currency; // doesn’t work unless you set the locale using the Zend_Registry and Zend_Locale
Anyway is worth to log this kind of troubleshoot.
Have fun.

%d bloggers like this: