Algemeen en interessant nieuws over en door NosTech

NIEUWS

Server upgrade 17/12/2015
10-12-2015 13:34

Beste klant,

Op donderdag 17 december 2015 zullen alle servers geüpgrade worden. Deze upgrade zal plaats hebben vanaf 5u00 en zal ten laatste om 8u00 afgerond zijn. Het kan zijn dat gedurende deze periode uw website en/of email voor +/-15 minuten ontoegankelijk is. Ondanks deze eventuele downtime kunnen wij wel garanderen dat er geen gegevens (email, …) verloren zullen gaan.

NosTech

Lancering ROTZ website
25-09-2015 20:00

Officiële lancering van de responsieve website ROTZ.be in opdracht van Huis Van Het Kind Zele

Link: http://www.rotz.be

PHP extension Imagick no longer working after upgrading - libMagickWand.so.2 error [Fixed]
17-08-2015 14:13

After upgrading the ImageMagick package on the server with for example the yum command, There is a small possibility that the PHP extension might no longer be working, you can test this with the command php -m | grep imagick, if it returns imagick, then all is working fine. If you get an error like:

PHP Warning:  PHP Startup: Unable to load dynamic library ’/app/vendor/php/lib/php/extensions/no-debug-non-zts-20121212/imagick.so’ - libMagickWand.so.2: cannot open shared object file: No such file or directory in Unknown on line 0

Then things are definitely not so fine. The reason is that you might have it installed imagick using pecl. Since the ImageMagick has been updated, things might have changed. In orde to solve this issue, the easiest way to do this, is to remove the existing installation and reinstall everything. This can be done using the following commands (I’m using yum command, but it should also be working for other package-installers, like apt, …):

yum remove ImageMagick
pecl uninstall imagick

Remove the extension=imagick.so-line from php.ini or rm /etc/php.d/imagick.ini

Restart webserver
service httpd restart

Now we reinstall everything
yum install ImageMagick ImageMagick-devel
pecl install imagick
echo extension=imagick.so >> /etc/php.ini

Restart webserver
service httpd restart

Now to check if things are running fine again
php -m | grep imagick


This should return imagick

Ereg function has been deprecated since PHP 5.3
02-04-2015 10:00

Since PHP v5.3 the frequently used ereg-function has become depracted, here you can find back an overview of how most cases of using ereg can be fixed:

Old ereg() code:
ereg(’.([^.]*$)’, $this->file_src_name, $extension);
New replacement code:
preg_match(’/.([^.]*$)/’, $this->file_src_name, $extension);

Old ereg_replace()  code:
$this->file_dst_name_body = ereg_replace(’[^A-Za-z0-9_]’, “, $this->file_dst_name_body);
New replacement code:
$this->file_dst_name_body = preg_replace(’/[^A-Za-z0-9_]/’, ”, $this->file_dst_name_body);

Old eregi()  code:
eregi(’.([^.]*$)’, $this->file_src_name, $extension);
New replacement code:
preg_match(’/.([^.]*$)/i’, $this->file_src_name, $extension);


NosTech website v4!
28-03-2015 20:30

Link: http://www.nostech.be/

jQuery: Prepend event handlers
27-03-2015 23:24

Although it’s not integrated by default in jQuery, it’s pretty easy to prepend a new handler to the existing handlers for a certain event in jQuery. In the following example we will prepend a new click-event to the existing ones:

Add new handler to click event:
$(’element’).click(function(){console.log(’test’);});

Now move it to the first position:
var lastEvent = $._data($(’element’).get(0), ‘events’).click.pop();
$._data($(’element’).get(0), 'events’).click.unshift(newEvent);


PS: If you have a selector which can have multiple elements selected, make sure to put this code in a loop and replace ‘.get(0)’ by ‘.get(counter)’.

Server Update PHP 5.4
20-02-2015 11:59

Zoals aangekondigd werd aan onze klanten via mail in de loop van vorige week, zijn ondertussen alle sites overgezet naar PHP v5.4. Dit omdat de oudere versies ondertussen té verouderd waren en als onveilig worden beschouwd. Er werd gekozen voor PHP 5.4 omdat deze versie het meest compatibel is met de oudere versies van PHP die sommige sites nog gebruikten, zodat er een minimale impact op de websites van toepassing is.

Indien u nog vragen of opmerkingen heeft hieromtrent, kan u ons uiteraard steeds contacteren via de gekende wegen.

Kleine geplande server down-time op maandag
01-11-2013 15:00

Beste klanten,

Op maandag 4 november voeren wij tussen 19:00 uur en 21:30 uur preventieve onderhoudswerkzaamheden uit aan de stroomvoorzieningen van onze servers. We verwachten dat uw website mogelijks tijdens het onderhoudsvenster ongeveer 15 minuten niet bereikbaar zal zijn. Voor alle duidelijkheid zullen er geen gegevens (website alsook email) verloren gaan. We bieden dan alvast onze excuses voor enig eventueel ongemak aan.

Nieuwe website online!
19-03-2013 23:35

De vernieuwde website van NosTech staat vanaf nu online.

Link: http://www.nostech.be

Spaw editor no longer working on IE9 It seems that...
06-10-2011 01:17

Spaw editor no longer working on IE9
It seems that the spaw editor is no longer working on Internet Explorer 9, the editor field remains grayed out.
The problem is related to a small JS issue. If you use the compatibility button in IE9 it fixes the issue, but of course you have to click it.
If you’re looking for a code solution, I didn’t find it anywhere on the net, so I’ve written a fix myself. In the file js/ie/editor.js you should replace the following code:

// returns reference to editors page iframe
SpawEditor.prototype.getPageIframe = function(page_name) {
  return this.document.frames(page_name + ’_rEdit’);
}
by this one:

// returns reference to editors page iframe
SpawEditor.prototype.getPageIframe = function(page_name) {
 if (document.frames) {return this.document.frames[page_name + ’_rEdit’];}
 else {return this.document.getElementById(page_name +’_rEdit’).contentWindow;}
}

How to set the time in Linux
19-04-2011 13:48

While logged in as root do the following:

  1. Type “date”.
  2. You should see some variation of
    “Wed Nov 24, 9:29:17 EST 1999”
  3. To change the time type(as an example):
    date -s 10:10
  4. The system response will be:
    “Wed Nov 24, 10:10:02 EST 1999”
  5. Then if you want to set the hardware(BIOS) clock so the system will keep the time when it reboots type:
    clock -w
    or
    setclock

Quick Tip: You Need to Check out LESS.js
26-01-2011 18:18

You might be familiar with such services as LESS and Sass. They allow for far more flexibility when creating your stylesheets, including the use of variables, etc all based on the fast JavaScripting.

Link: http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-you-need-to-check-out-less-js/

Java equivalent/alternative to php explode methode String.split() will do in...
24-01-2011 12:59

Java equivalent/alternative to php explode methode
String.split() will do in most cases.

Example:

String str = “Madrid,Paris,London”;
String[] tokens = str.split(“,”);

tokens[0] = “Madrid”;
tokens[1] = “Paris”;
tokens[2] = “London”;

 

The problem with String.split() is that it uses a greedy regex match, so if some of your tokens are empty strings, it will drop them. If you want to preserve empty strings, use this method:

StringUtils.splitPreserveAllTokens(String str, char separatorChar)


Facebook photo badge displays only photos from certain albums
20-01-2011 16:58

When you decide to make a photobadge on Facebook it will allow you to automatically share your latest photos with the world from one image generated by Facebook. As you might have noticed it doesn’t take all the photos from all of your albums. The reason for this is probably because you have to enable the album for ‘Everyone’, and so the album cannot be set for 'Friends only’ or something similiar. You can change your album-settings by clicking on an album and then at the bottom you will find a link 'Change album settings’.

Google Maps API v3 vs v2 marker, tooltip, popup
29-06-2010 10:41

A nice overview of the different approaches in Google Maps API v2 and v3, for displaying tooltips, popups on markers.

Link: http://laurentbois.com/2009/06/07/google-maps-api-v3-vs-v2/

NosTech Webloc Opener
17-07-2009 11:25

Using WeblocOpener, you can will be able to open .webloc files in windows using your default browser (so no need to install Safari). Just double click your webloc files and they will open. You need to associate the .webloc filetype to the program, but it’s all explained when you just double click WeblocOpener. You can now download WeblocOpener for free.
Update (27/10/2009): Version 1.1 is now fully compatible with Windows 7 too.

Downloads: 3509

Appending to event functions in javascript.
11-06-2009 16:02

Asked question: I have this code. later in javascript I want to add javascript like document.body.onload= “funcSetByJS()” How can use the document.body.onload=“ code without killing the code I set in the html? I want the onload to look like this when i am done. onload="funcSetByHTML(); nFunctionsIDontKnowWhatTheyWillBe(); funcSetByJS()”. I need a way to append to the onload event, rather then rest it? Can this be done?

See the link for the answer.

Link: http://answers.google.com/answers/threadview?id=510976

Fatal error: Call to undefined function: socket_create()
28-04-2009 10:17

If this function is not working for your setup, make sure to check the following options:

* (PHP 4 >= 4.1.0, PHP 5)
* PHP should be compiled with this option
* Check your php.ini file and make sure the line extension=php_sockets.dll exists and is not commented out with the ; in front of it.

Output extended ascii characters in Java
15-12-2008 17:11

Each character of text is specified by a value specified according to some encoding scheme. The particular type of encoding, the number of bits and bytes required for the encoding, transformations between encodings, and other issues thus become important, especially for a language like Java that is aimed towards worldwide use. Encoding becomes particularly relevant to I/O when text gets moved between different systems with perhaps different encoding schemes.

So give a brief overview of character encodings here.

The 7-BIT ASCII code set is the most famous, but there are many extended eight bit sets in which the first 128 codes are ASCII and the extra 128 codes provide symbols and characters needed for other languages besides English.

For example, the ISO-LATIN-1 set (ISO Standard 8859-1) provides characters for most West European languages and for a few other languages such as Indonesian.

Java itself is based on the 2-byte UNICODE representation of characters. The sixteen bits provide for a character set of 65,535 entries and so allows for broad international use.

The first 256 entries in 2-byte UNICODE are identical to the ISO-Latin-1 set. That makes the 2-byte Unicode inefficient for programs in English since the second byte is seldom needed. Therefore, a scheme called UTF-8 is used to encode text characters (e.g. string literals) for the Java class files.

The UTF code varies from 1 byte to 3 bytes. If a byte begins with a 0 bit, then the lower 7 bits represent one of the 128 ASCII characters. If the byte begins with the bits 110, then it is the first of a two byte pair that represent the Unicode values for 128 to 2047. If any byte begins with 1110, then it is the first of a three byte set that can hold any of the other Unicode values.

Thus, UTF trades the ability to only one byte most of the time for occasionally needing to use up to three bytes. For text in English and
many other languages, this is a good tradeoff that can drastically reduce file size over those in strict Unicode.

Java typically runs on platforms that use one byte extended ASCII encoded characters. Therefore, text I/O with the local platform, or with other platforms over the network, must convert between the encodings. As we mentioned in the previous section, the original one byte streams were not convenient for this so the Reader/Writer classes for two byte I/O were introduced.

The default encoding is typically ISO-Latin-1, but your program can find the local encoding with the following static method in the System: String local_encoding = System.getProperty(“file.encoding”);

The encoding can be explicitly specified in some cases via the constructor such as in the following file output: FileOutputStream out_file = new FileOutputStream (“Turkish.txt”);
OutputStreamWriter file_writer = new OutputStreamWriter (out_file, “8859_3”);

A similar overloaded constructor is available for InputStreamReader. See the book by Harold for more information about character encoding in Java.

MORE ABOUT UNICODE

If a character is not available on your keyboard, it can be specified in a Java program by its Unicode value. This value is represented with four hexadecimal numbers preceded by the “u” escape sequence. For example, the “ö” character is given by u00F6 and “è” by u00E8.

The program UnicodesApplet shows examples of characters specified by their Unicode values and drawn on the applet panel.


UnicodesApplet.java

import javax.swing.*;
import java.awt.*;

/** Unicode demo program. **/
public class UNICODESAPPLET extends JApplet
{

public void init () {
Container content_pane = getContentPane ();

// Create an instance of DrawingPanel
DrawingPanel drawing_panel = new DrawingPanel ();

// Add the DrawingPanel to the content pane.
content_pane.add (drawing_panel);

} // init

} // class UnicodesApplet

/** Display unicode characters. **/
class DrawingPanel extends JPanel
{
public void paintComponent (Graphics g) {
// First paint background unless you will
// paint whole area yourself.
super.paintComponent (g);

g.drawString (“\u00e5 = \u00e5”, 10, 12 );
g.drawString (“\u00c5 = \u00c5”, 10, 24 );
g.drawString (“\u00e4 = \u00e4”, 10, 36 );
g.drawString (“\u00c4 = \u00c4”, 10, 48 );
g.drawString (“\u00d6 = \u00d6”, 10, 60 );
g.drawString (“\u00f6 = \u00f6”, 10, 72 );

} // paintComponent

} // class DrawingPanel
Link: http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter09/characterEncodng.html

Associate fields to table in MySQL using PHP Just a...
08-12-2008 19:06

Associate fields to table in MySQL using PHP

Just a fairly useful (to me at least!) “implementation” of mysql_fetch_assoc to stop the clobbering of identical column names and allow you to work out which table produced which result column when using a JOIN (or simple multiple-table) SQL query: (assuming a live connection …)

$sql = “SELECT a.*, b.* from table1 a, table2 b WHERE a.id=b.id”; // example sql
$r = mysql_query($sql,$conn);
if (!$r) die(mysql_error());
$numfields = mysql_num_fields($r);
$tfields = Array();
for ($i=0;$i<$numfields;$i++)
{
    $field =  mysql_fetch_field($r,$i);
    $tfields[$i] = $field->table.’.’.$field->name;
}
while ($row = mysql_fetch_row($r))
{
    $rowAssoc = Array();
    for ($i=0;$i<$numfields;$i++)
    {
        $rowAssoc[$tfields[$i]] = $row[$i];
    }
//    do stuff with $rowAssoc as if it was $rowAssoc = mysql_fetch_assoc($r) you had used, but with table. prefixes
}

Browser Plug-in Detection for flash, director, quicktime, ...
25-11-2008 16:40

On the following site you can download a javascript (and also a little bit of VB) which allows you to detect which plugins are available on the client’s machine. Detects Flash, Director, Quicktime, Windows Media and Real.

Link: http://developer.apple.com/internet/webcontent/detectplugins.html

Change the Default Sent, Junk, and Trash Folders
05-11-2008 13:32

Set the Default Sent, Junk, and Trash Folders

How to configure the default sent, junk, and trash folders used by
the WiscMail web client and other common desktop e-mail clients.

CHANGE THE DEFAULT FOLDERS USED BY:

  • Mozilla Thunderbird (Windows/Mac)
  • Outlook Express
  • Outlook 2003
  • Outlook 2007
  • Windows Mail (Vista)
  • Mail (Mail.app for Mac)
  • Entourage (Mac)
Mozilla Thunderbird 2.x (Windows/Mac)

  • Open Thunderbird
  • Click Tools
  • Click Account Settings
  • For Sent messages, click “Copies & Folders” and choose “‘Sent’ folder on:” or specify a custom folder by selecting “Other.”
  • For Junk mail, click “Junk Settings.” If Thunderbird’s adaptive junk mail controls are active, check “Move new junk messages to:” and select “'Junk’ folder on:” or specify a custom folder by selecting “Other.”
  • For Trash, Thunderbird uses the “Trash” folder. Changing this requires a workaround detailed here. This process has not been confirmed.
  • Click OK

Outlook Express

Outlook Express does not filter Junk mail, so it is not possible to
specify a default Junk mail folder. For Trash, Outlook 2007 uses the
“Deleted Items” folder. This cannot be modified. To modify the default
Sent folder:

  • Open Outlook Express
  • Click Tools
  • Click Accounts…
  • Click your account name
  • Click Properties
  • Click IMAP
  • Customize the default Sent folder by checking “Store special folders on IMAP server” and entering your preferred sent folder name.
  • Click OK

Outlook 2003

In Outlook 2003, it is not possible to customize the default Sent
folder (“Sent Items”), Trash folder (“Deleted Items”), or Junk folder
(“Junk E-Mail”). The junk filter can be disabled through
Tools/Options/Preferences/Junk E-Mail, but the folder name cannot be
customized when junk filtering is enabled.

Outlook 2007

  • Open Outlook 2007
  • Click Tools
  • Click Account Settings…
  • Click your account name
  • Click Change…
  • Click More Settings…
  • Click Folders
  • For Sent mail, click “Save sent mail in the Outlook Sent Items folder” to use Sent Items, or click the second option to specify a custom Sent folder.
  • For Junk mail, Outlook 2007 uses the “Junk E-Mail” folder. The Outlook junk filter can be disabled through Tools/Options/Preferences/Junk E-Mail, but if enabled, the folder name cannot be edited.
  • For Trash, Outlook 2007 uses the “Deleted Items” folder. This cannot be modified.
  • Click OK

Windows Vista Mail

  • Open Windows Mail for Vista
  • Click Tools 
  • Click Accounts… 
  • Click your account name
  • Click Properties 
  • Click IMAP
  • Customize the default Sent/Drafts/Trash/Junk folders by checking “Store special folders on IMAP server” and entering your preferred folder names.
  • Click OK
  •  
Mac Mail 2.x (Mail.app)

  • Open Mac Mail
  • Click the folder that you would like to use for your Sent, Trash, or Junk folder.
  • Click the “Mailbox” menu
  • Click “Use this mailbox for” and select Drafts, Sent, Trash, or Junk.

Entourage (Mac)

  • Open Entourage
  • Click Tools
  • Click Accounts
  • Click your account name
  • Click Edit
  • Click Advanced
  • Customize the default Sent/Junk folders by selecting the preferred
  • folder names from the drop-down menus in the “Special folders”
  • section.
  • Customize the default Trash folder by selecting the preferred folder
  • name from the drop-down menu in the “Delete options” section.
  • Click OK
Link: http://kb.wisc.edu/page.php?id=8235

Boot camp windows drivers don't show when Leopard X dvd is inserted
22-10-2008 10:46

Problem: After having installed Leopard, to update Windows drivers, you put the Leopard DVD in while in Boot Camp Windows. The new driver install did not occur. You also could not find Windows drivers on Leopard DVD. And, while in Leopard and starting up Boot Camp Assistant, there was no longer any way to make a Windows driver CD (or folder).

Solution: I had to right-click the DVD drive in Vista, and choose Show Windows Files rather than Show Mac Files. Presto, the setup for Windows drivers appeared.

If you have Mediafour’s MacDrive installed in Windows, Mediafour says that when you right-click the DVD, you should choose “MacDrive -> Show Windows Files.” This is because the Leopard installation DVD is a multisession disc.

Synchronize files in Windows XP
16-09-2008 00:29

Synchronize files in Windows XP. Learn how to keep your laptop or desktop pc in sync. Very good and simple tutorial.

Link: http://www.windows-help-central.com/synchronize-files-in-windows-xp.html

Remote Desktop Does Nothing and no error messages appear
15-09-2008 13:03

It appears that the video drivers affect the Remote Desktop Server (RDC) and causes this to mall-function. You can find back the discussion thread here on the site of Microsoft. Installing older video drivers again might solve your problem.

How to turn on automatic logon in Windows XP
15-09-2008 10:32

Describes how to use Registry Editor to automate the logon process in Windows XP.

Link: http://support.microsoft.com/kb/315231

PHP: How to Get the Current Page URL
12-08-2008 11:08

Sometimes, you might want to get the current page URL that is shown in the browser URL window. For example if you want to let your visitors submit a blog post to Digg you need to get that same exact URL. There are plenty of other reasons as well. In this tutorial we will show how you can do that.

Link: http://www.webcheatsheet.com/PHP/get_current_page_url.php

NosTech File Comparer
07-08-2008 12:11

NosTech File Comparer allows you to find all duplicate or identical files on your computer. Just select the directory or drive you want to scan for duplicate files and hit Start. You will get a list of potential duplicate files found and the interface allows you to view, open the containing folder or delete the file in just one click. This program is very useful to clear some additional diskspace in no time. You can now download FileComparer for free.

Downloads: 3142

Setting a minimum height for a div
18-07-2008 15:16

Actually the solution is very easy for IE since IE treats height almost as if it were min-height. So the following will do what you want (assuming 200px was the min-height you wanted)
..foo {
  min-height: 200px
} // feed IE the same value for height, but not it IE Mac 5
* html .foo { /*\*/ height: 200px; }

Of course, Safari still doesn’t support min-height either, so you
might be interested in Dave Shea (of Mezzoblue and the CSS Zen
Garden)’s cunning fix

Cursor: hand not working with mozilla, firefox, netscape, ...
16-07-2008 15:04

Mostly our CSS code looks like: cursor: hand; This is not working in firefox etc. except IE. The reason is IE supports the keyword hand and mozilla, netscape, firefox do not. If You want to use cursor: hand; to work on all the browsers, simple use cursor: pointer;

Ook Belgische isp Yabu introduceert limietloos abonnement
16-06-2008 16:45

De Belgische internetprovider Yabu heeft een internetabonnement zonder datalimiet aangekondigd dat volgende maand in heel België beschikbaar zal zijn. Klanten dienen zich te schikken naar een fair use policy.

PHP: url_exists() extends the file_exists() function                                                 If you want...
16-06-2008 15:58

PHP: url_exists() extends the file_exists() function                                                

If you want to check on remote files wether they exist or not, it’s not possible with file_exists(). So below you can find a function which allows you to check on these files. The code can also be found on php.net

function url_exists($url)
{
    $handle = curl_init($url);
    if (false === $handle)
    {
        return false;
    }
    curl_setopt($handle, CURLOPT_HEADER, false);
    curl_setopt($handle, CURLOPT_FAILONERROR, true);
    curl_setopt($handle, CURLOPT_NOBODY, true);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, false);
    $connectable = curl_exec($handle);
    curl_close($handle);
    return $connectable;
}

This video explains on how to deploy and update AIR...
06-06-2008 10:22

This video explains on how to deploy and update AIR Applications. It’s presented by Serge Jespers on the On Air Tour in Madrid.



The Top 50 Google Android Apps
06-06-2008 01:32

Google has presented the 50 applications that have passed the first round of the $10M Android application contest.

Paypal's Sandbox Error 10501
06-06-2008 01:21

It appears after a long search that this error doesn’t mean exactly what paypal defines: “This transaction cannot be processed due to an invalid merchant configuration.” It appears that this error is also thrown when you are using DirectPayout from another country else then the US or UK. PayPal officially confirmed this.

iPhone plugin: Download Files With Safari.
04-06-2008 19:00

iPhone hacker hachu developed a download plug-in for MobileSafari. Once installed and customized, it allows you to download data off the Internet and store it on your iPhone or iPod touch local disk in the /var/root/Downloads folder.