Archive for the ‘Uncategorized’ Category

TYPO3: Howto have a field for different CSS class for each content

Friday, November 28th, 2008


If you want to specify a CSS class for each TYPO3 content (example: TEXT with IMAGE),

you can add a new filed "Class" that will allow you to set the CSS class.

Instructions:

Add the following lines to your typoscript (setup)

#[globalVar = TSFE:field|tx_modulis_ttcontent_class > 0]
tt_content.stdWrap.dataWrap =  <a name="{field:uid}"></a><div class="{field:tx_modulis_ttcontent_class}">|</div>
#[global]

You can uncomment first and last line to make sure that the CSS class will only be outputed if non empty.

Add the following Database column to the table tt_content:

It can be done with phpmyadmin or the kickstarter.

tx_modulis_ttcontent_class (type tinytext)

Add the following to file typo3conf/ext_tables.php:

$tempColumns = Array ( "tx_modulis_ttcontent_class" => Array ( "exclude" => 1, "label" => "Class", "config" => Array ( "type" => "input", "size" => "30", "default" => "tt_content", ) ), ); t3lib_div::loadTCA("tt_content"); t3lib_extMgm::addTCAcolumns("tt_content",$tempColumns,1); t3lib_extMgm::addToAllTCAtypes("tt_content","tx_modulis_ttcontent_class;;;;1-1-1");
Clear all caches and you're done !

Google partners up with T-Mobile, releases phone with PC features

Thursday, November 27th, 2008

There has always been a competition between Apple and Google, especially in terms of looks and design. For instance, Google’s new web browser, Google Chrome, seriously emphasizes design and its sleak lines are similar to the design approached by Apple on its web site.

Today, as part of the series “Open Source Browser, Paid-for Mobile”, Google and T-Mobile — a German mobile network company — have released their first mobile telephone with PC features, called the T-Mobile G1.

T-Mobile G1: operating system, features, price

The T-Mobile G1 from Google - T-Mobile collaboration team comes with pre-installed Android software platform and operating system for mobile devices.

The only thing free in this entire equation is the fact that Google Android is based on the Linux OS and that it was developed by the Open Handset Alliance. Other than that, you’d still have to pay some $179 for a T-Mobile G1.

As for the features, the T-Mobile G1 comes bundled up with a 3 megapixel camera, has a wide color touch screen which you can slide in order to reveal the G1 keyboard, and also includes a pre-installed Internet browser.

T-Mobile representatives have said that the G1 will have an autonomy of 5h of talk time and 130h in stand-by mode.

Manufactured in Taiwan, the G1 mobile phone will be available at the begining of the next year in Europe, while the North-American market being able to sell it as early as October the 22nd, 2008.

Opinions on the T-Mobile G1 mobile phone

Google Products President and co-founder Larry Page stated at a product news conference in New York that the new T-Mobile G1 “is as good a computer as you had a few years ago” and that the Android software will be provided for free along with the mobile phone, in an attempt to persuade mobile phone companies to use the Android as their software platform.

Cole Brodman, chief technology and innovation officer of T-Mobile USA, said that “frankly this device will have mass appeal” especially because of its design and of its functionalities. He also noticed that Americans are not eager to embrace the mobile web technology and that the American market is well behind other markets: “Consumers have a desire to connect, but they haven’t found the mobile Internet very compelling,” outlining that only 16% of American mobile users go online using their phones.

Moreover, other key-people have stated that the T-Mobile G1 will be able to function on both G3 and older mobile networks, and that it will be delivered with GPS, Wi-Fi and BlueTooth connections.

Open Source Project of the Week: WinSCP

Friday, September 26th, 2008

The fourth week of September 2008 is almost over, yet we have found some time to write an article on an open source web project, as part of our new Open Source Project of the Week series.

This week’s project, and also the first open source product to be presented on our site, is WinSCP — an open source SFTP and FTP client for Windows.

Since not every reader out there is a techie or a technology fan, we will present this product using a common, natural language, so that both the home user and the might tech savvy understand what exactly is WinSCP and why one should install and use it whenever operating with a FTP server.

What is WinSCP?

WinSCP can refer to two things:

  1. a SourceForge open source project;
  2. a Windows FTP and SFTP client.

Both of these definitions rely on the idea and sustained effort of Martin Prikryl, a 29 years old Software developer from Prague, the Capital of the Czech Republic.

WinSCP - the SourceForge Open Source Project

It was he who created a new SourceForge project because once he graduated from the University of Economics in Prague, he had lost the hosting access to the University’s server.

Once hosted on SourceForge, which is a large open source portal and community with free registration for open source projects, Martin began working on a SFTP and FTP client for Windows. As we all know, Windows is an operating system developed by the Microsoft Corporation; other than that, some of you might also find it useful to learn that FTP refers to the file transfer protocol (a protocol for transferring files to / from a web server), while SFTP refers to secure file transfer protocol, SSH file transfer protocol, which serves the same purpose but in a secured way.

The WinSCP SourceForge project was started in 2003 and is now hosted at http://sourceforge.net/projects/winscp. According to project founder Martin Prikryl, there are some 400,000 software unique update checks every weeks, meaning that some 400,000 users have already installed the software on their PCs.

WinSCP - the Windows FTP and SFTP client

WinSCP, the result of Martin’s SourceForge project, is a software application for Windows operating system. It allows the user to connect either in the traditional or secured way to a web server via the file transfer protocol, in order to upload or download files to/from the server.

The original description of the WinSCP Windows client is the following:

WinSCP is a SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol.

The software can be installed for free on either one of the following operating systems:

  • 32-bit MS Windows (95/98)
  • 32-bit MS Windows (NT/2000/XP)
  • All 32-bit MS Windows (95/98/NT/2000/XP)
  • Win2K
  • WinXP

and is available in a multitude of languages, including: Catalan, Czech, Dutch, English, Finnish, French, German, Hungarian, Indonesian, Italian, Japanese, Malay, Polish, Portuguese, Russian, Spanish, Swedish.

As you can see for yourselves, WinSCP cannot be installed on a Microsoft Vista operating system; however, this issue will undoubtedly be solved in the near future.

As of today, September the 26th 2008, the current version of WinSCP is 4.1.6, with the last software update being performed on July the 30th, 2008.

Here are some quicklinks: WinSCP Sourceforge project page, WinSCP official site, WinSCP download area (on SourceForge).

To find out subdomains of a domain, first do:

Tuesday, March 4th, 2008

To find out subdomains of a domain, first do:

dig domain_name.com

to find the name servers in the authority section (we’ll call them ns1.foo.bar and ns2.foo.bar)

then do a:

dig @ns1.foo.bar domain_name.com axfr

or

dig @ns2.foo.bar domain_name.com axfr


How to burn a file over 4Go size on Linux k3b

Friday, September 14th, 2007

k3b is just a front-end to growisofs, mkisofs, cdrecord, and other assorted programs, so it shouldn’t have any limitations of its own, but just reflect those of the programs it calls.

It appears that growisofs in turn calls mkisofs, which is what is complaining about the file being too large. Googling appears to confirm that this is a internal limit of mkisofs.

So the trick is to split the file in two, which first doesn’t sound very interesting, unless you have the good tool !

The solution: Splitpipe !

To create backups:
tar c /home | splitpipe -s dvd -o ‘growisofs -Z /dev/dvd=/dev/stdin’

To restore backups:
joinpipe /dev/dvd | tar xz

It features checksums, making sure that the dvds are read in correct order, and other usefull features.

But it can also be used to backup the entire /home on multiple DVDs.

See the website of Splitpipe ->

Applying Composite View Pattern with TYPO3

Thursday, August 16th, 2007

The following assumes that the reader is already experienced with Typo3’s modern templating.

This goal of this article will be to explain how we can adapt Core J2EE’s Composite View pattern within Typo3’s modern templating. The main difference is that instead of using Java and JSP, we will use Typo3’s backend with typoscript.

The following assumes that the reader is already experienced with Typo3’s modern templating.

This goal of this article will be to explain how we can adapt Core J2EE’s Composite View pattern within Typo3’s modern templating. The main difference is that instead of using Java and JSP, we will use Typo3’s backend with typoscript.

Let us start by describing the Composite View pattern, a design strategy for the presentation layer that allows developers to have multiple atomic subviews forming the single display page (or composite view).

One of the advantages of applying this pattern is that it allows designers and programmers the ability to treat subviews modularly. Treating subviews as such is quite practical since we can better focus our efforts without having to worry about their dependencies. For instance, by separating the visual portions of the view contents, different people can focus on developing each visual subpart without needing to take into account the other subparts. Furthermore, having modular visual components greatly enhances reusability, which comes in handy especially to avoid redundant inclusions in a website template. To best demonstrate this, I will be using http://www.valtech.ca/ as an example.

By using modern templating, the website has been divided into different subviews as indicated in the illustrations. Each subview in this website is (or is composed of) Typo3 content elements, typoscript components such as GMENUS, and template files.

For this pattern, we have to class the views into two types – static and dynamic. The following links will be used as examples on how both types of views are used :

Welcoming page: http://www.valtech.ca/

Product page: http://www.valtech.ca/general/internet/

Package page: http://www.valtech.ca/forfaits/emeraude/

As you might have noticed in all three pages, they share some common visual components. These are the static subviews.

Indicated in the blue sections, the static subviews include:

  • the company logo

  • the top-right links

  • the three-column bottom section with the products

  • the footer.

Static views are usually subviews that are typically identical in all pages and are also not updated very often.

As for the dynamic views, they are not as reused in all pages and they also usually contain different website content for each page using it. These views are basically the ones that make the welcoming, product, and package page differ from one another.

Indicated in the red sections, the dynamic views include:

  • the top menu for the welcoming page

  • the top menu for the product/package page

  • the search bar for the welcoming page

  • the search bar for the product/package page

  • the main content of the welcoming page (between the top menu and the product prices)

  • the main content of the product page, which has no menu

  • the main content of the package page, which has a menu

Using the composite view pattern, I can easily mix and match static/dynamic views to create different-looking pages as shown in the three links mentioned.

In order to accomplish this, the first step should be to start identifying the static subviews. Once the static views are all identified, we then insert them into a main template setup so that all the pages using it can include them. I usually store all the template setups inside a backend sysfolder. Let us call the main template setup Main Template (M.T).

Now we can begin by assigning the static views to it using the company logo as a bare bone example. For Valtech.ca, the logo is actually an image content element stored in a backend page. The following typoscript code shows us how to retrieve the logo (subview in the form of a content element) from any particular page:

# Setting the global contents:

# Obtain the logo from page containing global content elements

# @param pidInList : the id of the page containing the content

styles.content.getLogoContent = CONTENT

styles.content.getLogoContent {

table = tt_content

select.pidInList = 1

select.orderBy = sorting

select.where = colPos=0

select.languageField = sys_language_uid

renderObj.stdWrap.wrap =

|

}

#~

The above code tells Typo3 to get the logo from a page with id = 1, which stores all the global elements of the website. Now we also need to assign the content element to the main template, which is done by the following typoscript snippet within the same template setup:

# Assign contents to main template:

# Set the main subparts in the template

page.10 = TEMPLATE

page.10 {

template = FILE

template.file = fileadmin/templates/main_template.html

workOnSubpart = GLOBAL_CONTAINER

subparts.LOGO < styles.content.getLogoContent

marks.FIRST_PRODUCT< styles.content.getFirstProductContent

marks.SECOND_PRODUCT< styles.content.getSecondProductContent

subparts.NEWS_SECTION < styles.content.getNewsContent

subparts.FOOTER < styles.content.getFooterContent

}

#~

The bolded line assigns the Logo content element to the main template. To better see the big picture, I have also included some of the other static content elements below.

For reference, here is the mock html code snippet of the main template to work with the above:

<html>

<body>

Some content that will be overwritten by a subpart…

This subpart is for later on when we want to inject a dynamic view

</body>

</html>

Having assigned the elements, the main template now contains all the common static subviews, and consequently, we can apply Main Template (M.T.) to all the pages by using the “Include basis template” option using the Typo3’s Template module.

The second step would be to create sub-template setups with which we can use to insert our dynamic subviews into the main template also by assigning them using the “Include basis template” option. For Valtech.ca, I used a sub-template setup for each of the three pages to manage their dynamic views. For clarity, let us name them M.T. > welcome, M.T. > product, and M.T. > package. We will just be taking a look at M.T. > welcome for our example.

For this case, I created a more complex subview in the form of an html template file named welcome.html, which contains subparts and marks to be replaced by other content elements.

Let us include only the description on the left as shown in the screenshot. The typoscript to grab this content element for this description is as follows:

# Setting the dynamic contents:

# Obtain the description on the left

styles.content.getDescription = CONTENT

styles.content.getDescription {

table = tt_content

select.orderBy = sorting

select.where = colPos=3

select.languageField = sys_language_uid

renderObj.stdWrap.wrap =

|

}

#~

It is practically the same as the code for retrieving the company logo except that it takes the content associated to the current page the web user goes on instead. This is as we would expect since dynamic views usually do not share the same content.

The following typoscript then takes welcome.html and assigns the content element to it:

# Assign contents to a sub-template (or subview):

# Set the subparts in the center composite view

subTemplate.12 = TEMPLATE

subTemplate.12 {

template = FILE

template.file = fileadmin/templates/subviews/welcome.html

workOnSubpart = SUBVIEW_CONTAINER

subparts.INFO_SECTION < styles.content.getDescription

subparts.INFO_SECTION_HEADER < styles.content.getDescriptionTitle

marks.TEXT_UNDER_SEARCH < styles.content.getDescriptionUnderSearch

subparts.BANNER_TEXT < styles.content.getMiddleBannerTextLine

marks.SEARCH_BOX < plugin.tx_macinasearchbox_pi1

}

#~

Notice that I have also put in other elements inside welcome.html, which more completely forms the dynamic subview we have in the welcoming page.

Now in order to connect this dynamic subview (in the form of a sub-template file) to the main template, we simply do:

# Connect to the main basis template:

page.10 = TEMPLATE

page.10 {

template = FILE

template.file = fileadmin/templates/main_template.html

workOnSubpart = GLOBAL_CONTAINER

subparts.DYNAMIC_SUBVIEW < subTemplate.12

}

Recall in main_template.html that we have a subpart called DYNAMIC_SUBVIEW. This would be where our constructed dynamic subview would be inserted.

Finally, we have managed to construct a main template consisting of static subviews common to all pages. Within that main template, we also have the ability to insert different dynamic subviews in order to obtain three different pages. Taking advantage of the Typo3 hierachy and template inclusion options, we can assign the static subviews to many pages by including the main template at the parent node. The children pages can thus be customized by different dynamic subviews by assigning to them the sub-template setups. As a note, there are other preferable methods in applying these patterns such as making use of the Template Page Selector extension. That would be a topic for another article though.

This week rpm: glipper

Friday, June 1st, 2007

A simple a rpm to get an history of your clipboard…


Modulis New Typo3 Extension

Thursday, May 24th, 2007

Modulis has release a new extension for the RSS and RDF news feed import. Now you can import the news from anywhere you want to your own website!


Setting up a DHCP and FTP server to configure Soundpoint IP polycoms

Thursday, May 24th, 2007

In order to save time and effort put into configuring the Polycom phones as well as further customizing their functionalities, Polycom phones come with the option of downloading and using the configuration files hosted on an (T)FTP server. To make this happen, it is necessary to use a DHCP server that can tell the phone to boot using our FTP server. The following details how we set this up using Asterisk 1.2.x on Centos 4, and one other computer running both the DHCP server and the FTP server. Of course, you can also host the servers on separate machines.

On the main computer that is going to run both the DHCP and FTP server, I installed another ethernet card to configure the phones on a different subnet since I did not want to interfere with any of our main networks. The following shows my network topology:

The advantage with this is mostly convenience. I can still work on my computer using our main networks in addition to being able to configure phones on a separate network.

Installing and Configuring the DHCP server

Let us begin with setting up the DHCP server. I have just added another ethernet card into my computer and have designated it as eth1. Now if I run ifconfig -a, I should see the word MULTICAST for the ethernet cards installed. If not, the kernel must be recompiled with it.

If you can use yum, simply do yum install dhcp to install the dhcp server.

This should also create some default configuration files in /etc that we will have to edit.

Configuring the server mostly takes place in /etc/dhcpd.conf. This is what we used in ours:

option boot-server code 66 = string; # this tells DHCP to set option 66 as a string variable (which will be defined later)

# There are two DHCP update schemes. We wil pick the more reliable one of them
#ddns-update-style ad-hoc; 
ddns-update-style interim;

# define the subnet (customize this for your network)

subnet 192.168.2.0 netmask 255.255.255.0 {
# default gateway
option routers 192.168.2.1;
option subnet-mask 255.255.255.0;
option domain-name "asterisk.local";
option domain-name-servers 192.168.2.1; # Since we do not use a DNS server, we'll just point it to the gateway
option time-offset -18000; # Eastern Standard Time

option ntp-servers clock.redhat.com; # NTP server

# We define the range of ips to use here
range dynamic-bootp 192.168.2.3 192.168.2.50;
default-lease-time 600;
max-lease-time 7200;
#Polycom phones configuration starts here
group {
        # Boot server, including protocol (FTP) and username/password
        # My FTP server (Asterisk box) is 192.168.200.16 – modify for your FTP server (FTP configuration below)
        option boot-server "ftp://polycom:123456@192.168.2.2";
        # Now, list the phones by network address, to give them
        # defined IP per phone.  Note that phones listed here is
        # what makes them part of the group that gets the above
        # configuration
        host x217 { # host name is optional, but makes for easy reference
                hardware ethernet 00:04:f2:10:05:b9; # MAC address of phone
                fixed-address 192.168.2.5; # IP you want assigned to the phone
        }
        # Repeat the lines above starting with host for as many phones as you would like to
        # have configured.

        } # end of Polycom group
} # end of subnet block

Now because my computer uses more than one ethernet card, I have to specify that I want to install the recently installed one in /etc/sysconfig/dhcpd:

# Command line options here
DHCPDARGS=eth1

That is it for installing and configuring the DHCP server. You just need to service dhcpd restart and it should be good to go. You can also change the runlevel of the server by doing chkconfig dhcpd on. If you need to debug, turn on the debugging mode by entering dhcp -d -f. You can also do tail -f /var/log/messages.

Installing and configuring the FTP server

Setting up the FTP requires a unix user account to which we place the configuration files the phone is supposed to download.

Add the account:

useradd polycom
passwd polycom

To make it so that the polycom user cannot log into the system, we modify /etc/passwd. At the end, the line referring to the polycom should change from polycom:x:5001:5001::/home/polycom:/bin/bash to polycom:x:5001:5001::/home/polycom:/sbin/nologin.

To install the FTP server, do yum install vsftpd.i386.

Now we need to configure /etc/vsftpd/vsftpd.conf. Change/add the follow parameters:

chroot_list_enable=YES # this allows you to specify local users to chroot() to their home directory

userlist_enable=YES # this makes it so that only the users in the userlist_file will be allowed to log in with FTP
userlist_deny=NO

Now we need to add the polycom user to a few files. By default, they should be /etc/vsftpd/chroot_list and /etc/vsftpd/user_list. Simply append polycom to them.

Now start the server by doing service vsftpd restart. You can also turn it on by default by doing chkconfig vsftpd on.

Setup the phone using Polycom’s configuration files

Make the home directory read only by doing chmod u-w /home/polycom.

Now create the following directories in /home/polycom: contacts, log, overrides. Change their ownership by doing chown polycom.polycom contacts log overrides.

At this point, we’ll need the SoundPoint IP Software 1.6.7 configuration files, which are obtainable here. Unzip by doing unzip <filename>. Although there are newer versions available, they are reported to have bugs.

At this point, you’ll notice a file named 000000000000.cfg. Rename this file to have the same MAC address as the phone by doing mv 000000000000.cfg 0004f21005b9.cfg. for example. You should use the MAC address of your own phone though, which can be found in the sticker in the back.

Modify this new file to include x217.cfg (you can choose to call it something else preferably representing the phone) and server.cfg in the CONFIG_FILES attribute as follows:

<?xml version=”1.0″ standalone=”yes”?>

<APPLICATION APP_FILE_PATH=”sip.ld” CONFIG_FILES=”x217.cfg, server.cfg, phone1.cfg, sip.cfg” MISC_FILES=”" LOG_FILE_DIRECTORY=”" OVERRIDES_DIRECTORY=”" CONTACTS_DIRECTORY=”"/>

Create x217.cfg:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>

<reginfo>

reg.1.displayName=”John”

reg.1.address=”217″

reg.1.label=”217″

reg.1.auth.userId=”217″

reg.1.auth.password=”12345″

reg.1.lineKeys=”2″

/>

</reginfo>

Create server.cfg:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>

 <!-- Our local phone system common configuration in this file -->
<localcfg>
 <server voIpProt.server.1.address="asterisk-server.com"/>
 <SIP>
   <outboundProxy voIpProt.SIP.outboundProxy.address="asterisk-server.com"/>
 </SIP>
 <voice>
   <volume voice.volume.persist.handset="1"
     voice.volume.persist.headset="1"/>
 </voice>
 <TCP_IP>
   <SNTP tcpIpApp.sntp.daylightSavings.enable="1"/>
 </TCP_IP>
<localcfg>

This tells the phone which Asterisk server to use, and also configures it to use daylight savings time.

Common configuration updates

Most of this article is based on www.sureteq.com/asterisk/polycom.htm. They also mention some useful updates for DST rules in North America and for configuring the messages button. The following is directly from their article:

Effective March 11th, 2007, there are new DST rules for much of North America and Canada.  Here is how to update your Polycom central server to use these new settings permanently.

Go to your FTP home directory (/home/polycom) and ‘nano -w sip.cfg’.

Find the daylight savings time settings (to search in nano, do CTRL+W, type in what you want to find such as ‘daylight’ and press ENTER).  They should be in the <TCP_IP> section and should look like this:

tcpIpApp.sntp.daylightSavings.enable=”1″
tcpIpApp.sntp.daylightSavings.fixedDayEnable=”0″
tcpIpApp.sntp.daylightSavings.start.month=”4″
tcpIpApp.sntp.daylightSavings.start.date=”1″
tcpIpApp.sntp.daylightSavings.start.time=”2″
tcpIpApp.sntp.daylightSavings.start.dayOfWeek=”1″
tcpIpApp.sntp.daylightSavings.start.dayOfWeek.lastInMonth=”0″
tcpIpApp.sntp.daylightSavings.stop.month=”10″
tcpIpApp.sntp.daylightSavings.stop.date=”1″
tcpIpApp.sntp.daylightSavings.stop.time=”2″
tcpIpApp.sntp.daylightSavings.stop.dayOfWeek=”1″
tcpIpApp.sntp.daylightSavings.stop.dayOfWeek.lastInMonth=”1″

These may appear on a single line…if so, just ensure there is a space between each setting.

Change these settings to this (changes are in red):

tcpIpApp.sntp.daylightSavings.enable=”1″
tcpIpApp.sntp.daylightSavings.fixedDayEnable=”0″
tcpIpApp.sntp.daylightSavings.start.month=”3
tcpIpApp.sntp.daylightSavings.start.date=”8
tcpIpApp.sntp.daylightSavings.start.time=”2″
tcpIpApp.sntp.daylightSavings.start.dayOfWeek=”1″
tcpIpApp.sntp.daylightSavings.start.dayOfWeek.lastInMonth=”0″
tcpIpApp.sntp.daylightSavings.stop.month=”11
tcpIpApp.sntp.daylightSavings.stop.date=”1″
tcpIpApp.sntp.daylightSavings.stop.time=”2″
tcpIpApp.sntp.daylightSavings.stop.dayOfWeek=”1″
tcpIpApp.sntp.daylightSavings.stop.dayOfWeek.lastInMonth=”0

CTRL+X to exit, and answer ‘Y’ when asked to save.  Reboot your phones and they will have the new setting.

6.2 - Messages button configuration

Another common update to the default config files is telling the ‘Messages’ button what to do.  In order to work with Trixbox, this needs to be changed.

Go to your FTP home directory (/home/polycom) and ‘nano -w phone1.cfg’.

Find the ‘<msg’ section and change the following variables:</font>

msg.bypassInstantMessage=”1″

msg.mwi.1.callBackMode=”contact”

msg.mwi.1.callBack=”*97″

CTRL+X to exit, and answer ‘Y’ when asked to save.  Reboot your phones, and they will have the new setting.


How to change linux default gateway / route

Thursday, May 24th, 2007

If you have to internet connexion and want to switch from one router to the other just issue:

<code>ip route add default via 192.168.X.X</code>