Articles

There is No Right Way to Develop Software

I like it:

Being a good developer means compromise. It means sometimes doing things one way for one project, and another way for another. It means balancing the needs of your stakeholders with your ideals. Sometimes they’re not always going to match up, but that doesn’t mean you should stomp the ground with your feet and have a tantrum when things don’t go your way.

The real key? Strong opinions, weakly held.

With that alone, you’ll go far.

Source: dlo.me

Internet traffic control and monitoring tool

Sometimes our network connection is too fast for measure eg. “how my website is loaded”. In that case would be good to slow down our download / upload connection and test our loading website using slower connection. I use NetLimiter – Ultimate Bandwidth Shaper which provide me option for download and upload streaming.

Note: above software is designed only for Windows OS.

Moving jQuery and other script code to the bottom of html code in Worpdress

Why script (eg. JavaScript) needs to be put at the bottom of html code is nicely described in article High Performance Web Sites: Rule 6 – Move Scripts to the Bottom. So now I will not explain here why.

Let’s focus on how to move any scripts in WordPress to the bottom of html code. Let’s say we want to move mycode.js file (which is located in /js/ directory in our theme directory) with our code that depend on jQuery in our WordPress theme. Open header.php and insert the code just before any html code:


and also in footer.php just befor[……]

Read more about post Moving jQuery and other script code to the bottom of html code in Worpdress

Apache and error AH00132

Let’s say you have a localhost (based for example on Wamp) on your computer where is Windows OS. You may be surprised that sometimes some files you can not run. In “error console” of Apache you may see error AH00132 which can look like this:

[Fri Mar 15 17:44:24.195510 2013] [core:error] [pid 6236:tid 1040] (OS 5) Access denied. : [client 127.0.0.1:51288] AH00132: file permissions deny server access: C:/wamp/www/test/index.html

Well, the problem is in the option “Encrypt contents to secure data” which was set for directory “test“. The[……]

Read more about post Apache and error AH00132

font-face and aborted request(s)

By default at least IE up to 9 8 (not tested on IE10 IE 9 and 10 doesn’t block loading content and they use local fonts, if available) blocks loading page until fonts are not downloaded. Moving fonts for font-face to separate subdomain (eg. fonts.example.com) means that page loading will not be blocked by loading fonts from font-face. However, you may discover that fonts are not loaded after moving them to separate subdomain. What is wrong?

You must add header Access-Control-Allow-Origin "*" (or specify here your subdomain) when serve fonts[……]

Read more about post font-face and aborted request(s)

Detect browser cookie third party support using feature detection

So, you want to detect browser cookie third party support.

What is third-party cookies

Basically, third-party cookies are cookies that are set by a website other than the one you are currently on. For example, ctomczyk.pl might have a Twitter like button. That button will set a cookie that can be read by Twitter. That would be considered a third-party cookie.

Some browsers (from specific versions), like Firefox and Safari, have this option disabled by default. However, see page “How to enable third-party cookies in your web browser” t[……]

Read more about post Detect browser cookie third party support using feature detection

Loading optimization tips

Your web page / application loading very slowly? There is several reasons why your data is loading slowly. However, some tricks can be done to make load site faster.

Max connections per hostname

Try to measure amount of connections using Firebug in Firefox console, also in Google Chrome, Opera or Internet Explorer. There is also nice tool named “HTTP Analyzer” (30 days of trial) which can help you track the network connections. Even, if they are not coming from browsers only.

Every browser can open some several connections per hostname[……]

Read more about post Loading optimization tips

Wamp, error PHP Startup: Unable to load dynamic library ‘c:/wamp/bin/php/php5.3.13/ext/php_intl.dll’

Tried to run internationalization in WAMP using php_intl module, but got error Unable to load dynamic library ‘c:/wamp/bin/php/php5.3.13/ext/php_intl.dll’. This makes me headache. It happens because Apache can’t find the icu*.dll files. There is at least 3 solutions:

  • One solution is to add “C:\wamp\bin\php\php5.3.9” (or similar directory) to your system PATH.
  • The other solution is to copy the icu*.dll files to your apache’s bin directory.
  • A third option is to copy the icu*.dll files to your Windows system directory (system32 or SysWOW64)[……]

Read more about post Wamp, error PHP Startup: Unable to load dynamic library ‘c:/wamp/bin/php/php5.3.13/ext/php_intl.dll’

JavaScript, split and non-breaking space

I created and added pre element with contentEditable attribute. I inserted some text with non-breaking space and tried to get text and split using simple txt.split(/\s/), where txt represent string from pre element. Unfortunately, this split doesn’t work well in IE7 and return wrong splitted data in array when string contains non-breaking spaces.

I solved this problem by using little trick:

var temp = doc.createElement('div'),
    str;

temp.innerHTML = txt;
str = temp.innerText || temp.textContent || temp.text;
temp = null;

a[……]

Read more about post JavaScript, split and non-breaking space

Pagination