Excel for Jolterheads: Getting a substring from another column or how to split a string

Assuming the following situation:
In Excel column A contains the source data. Therefore, i.e. cell A1 contains the following string:
companyName - accountName

Now we want to have in column B only the companyName. We can do this by typing in the following formula in i.e. cell B1:
=LEFT(A1,FIND("-",A1,1)-2)

This returns the left part of the string in cell A1. The substring is length limited by the return value of the FIND. FIND searches for the text “” (dash) in cell A1, beginning at position 1 (remember, contrary to many programming languages, Excel starts indexes by 1). The -2 is necessary, because we search for the “” and its position is returned and because indexing starts by 1 the length includes the dash already. But, why -2? – Quite easy, because left to the dash there is a space we want neither.

If you want the right part, say accountName, you can use this formula
=RIGHT(A1,LEN(A1)-D16-1)

If you don’t want to use a formula you can also use the “Convert text to column wizard” under Data -> Text to column.

Tagged , ,

Installing Apache2 and PHP5

In this part of the series, I want to explain, how to install Apache2 and PHP5 on your Ubuntu Server (which we installed previously).

So, let’s get started by logging into the server and gaining ‘root’ :

sudo -su –

Installing Apache2

Now, as ‘root’ we can enter the following commands to update the list of available packages (1:) and to install Apache2 (2:):

1:  $> apt-get update
2:  $> apt-get install apache2-mpm-prefork

Here, we use the apache2-mpm-prefork version because we need a solution which deals each request completely isolated. For more information read the Apache2 docs.

Testing Apache

Before we start messing with it, you might as well check that Apache is working. Point a browser at http://yourdomain or http://yourIPaddress and verify that you see the installed default Apache site. If you don’t, check your DNS and firewall. Fix whatever the problem is before you go on.

Apache security

I decided to enhance the security a little bit  and got some tips by reading the Security Tips on the Apache site. There are two possible ways.

  1. You can add these to the main config file.
  2. But, I opted to keep my own config changes separate by putting them in a file in the /etc/apache2/conf.d/ directory

So, because I chose the second way, I created under /etc/apache2/conf.d/ a file named local_configs.conf and put the following in it:

# Tighten access to the file system.
# Forbid default access to file system locations
Order Deny,Allow
Deny from all

# prevent use of .htaccess files in all directories
# apart from those specifically enabled.
AllowOverride None

# Limit available info about this server.
ServerSignature Off
ServerTokens production

The file creation can be done by using vim as follows:

 $> vim /etc/apache2/conf.d/local_configs.conf

And, using the shortcut “i” to insert some text in the newly created file. To quit and save the file press the ESC-key to enter command-mode and then pressing ZZ (press SHIFT and the ‘Z’-key twice) to save and quit.
If you want to discard some changes, you can press the ESC-key to enter command-mode and then :q! to quit without writing anything to the file.

Now, we have to force Apache2 to load the new config-file by entering in the command line:

$> /etc/init.d/apache2 force-reload

Install PHP5
With our Apache2 web server running, we can install PHP5 with the following command:

$> apt-get install libapache2-mod-php5

PHP security
There is a good sample php-config-file: /usr/share/doc/php5-common/examples/php.ini-recommended, we’ll use. It contains the “warmly recommended” php.ini settings for production servers. This file is very well commented and worth the time to read.
So we first save a copy of the original php.ini file and copy the recommended file in place of the original file:

$> mv /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.original
$> cp /usr/share/doc/php5-common/examples/php.ini-recommended /etc/php5/apache2/php.ini

By editing the php.ini and changing the expose_php from “on” to “off”, we hide info about our php config by telling PHP to hide itself.

expose_php = off

So, that’s all by now….
Nice, isn’t it?

But, we haven’t reached the end… Let’s go one step further by: Installing MySQL and phpMyAdmin

Tagged ,

Installing Ubuntu Server 9.10

This is the first part of the series “Building up a development server on linux”. Now I want to focus on how to install the Ubuntu Server 9.10 as quick and easy as possible for our needs.

I’m installing the whole server system in a VMware Player 3.0 environment, but feel free to do the steps on a real system. There are no points to change or at least only a little…

  1. Download Ubuntu Server 9.10
    You can download the latest Ubuntu Server 9.10 here. I’ve chosen the 64-bit version for this tutorial. burn or mount the image as you prefer and start the real server or the virtual machine to start the server installation.
  2. Choose your preferred language – I chose “English”.
  3. By pressing “F5” enter the menu of “Other options” and select/activate “Expert mode” – if activated a “X” appears.
  4. Select “Install Ubuntu Server” to start the installation process.
  5. Select again your preferred language (English in my case). Select the country (in my case “other” -> “Europe” -> “Germany”) and “Locale” -> “en_US.UTF-8”. I also activated in the menu “Choose other locales to be supported” -> “de_DE@euro”.
  6. Choose the right keyboard model; maybe also the origin of the keyboard and the layout, etc.
  7. Select by “Encoding to use on the console” -> “UTF-8” and the correct character set as well as “Font for console” -> “VGA”. Leave the next settings with the default values.
  8. Select in the next step “Detect and mount CD-ROM” and activate “usb-storage” and “Pc card” if necessary.
  9. Click on “Load debconf preconfiguration file” and after that on “Load installer components from CD” and leave all values as default.
  10. Next “Detect network hardware” and with “Configure the network” select your appropriate settings.
  11. By “Configure the clock” leave the default values.
  12. Go on with “Detect disks” and “Partition disks” and use in the latter case “Guided – use entire disk” and for our case leave the setting at “All files in one partition…” and let the installer write all changes to disk if you are sure.
  13. By clicking “Installing the base system”, the installer downloads and copies the real base file for the new OS.
  14. Next in the menu subpoint “Drivers to include in the initrd” select “targeted: only include…”.
  15. Next “Setup users and passwords” and “enable shadow passwords” as well as do NOT allow “root to login”. Enter your full name and the installer proposes you a Linux user name. Enter a secure password (by using numbers and upper and lower case characters as well as special characters.)
  16. In our case it is not necessary to encrypt your home directory, but still you could if you want… I, for myself doesn’t.
  17. Go on with “Configure the package manager” and with “Yes” by “Use a network mirror” and leave all default values. Also select “Yes” when the installer asks you about to “Use restricted software?” and if you want to “Use software from ‘universe’/’multiverse’ component”. Go on with “Yes” as well by the question “Use backported software” and “partner repositories”.
  18. Next “Select and install software” and click on “No automatic updates” and leave all preconfigured collections deselected.
  19. Select “Install the GRUB boot loader on a hard disk” and let the installer allow to install GRUB 2.
  20. Next “Finish the installation” and choose “UTC time” if no other non-linux is installed parallel to the new installed one.
  21. Reboot the system.

Congratulation!

The new Ubuntu server 9.10 is installed. Now you can login with your user name and password. To gain ‘root’ access use “sudo” followed by the command you want to run as ‘root’ and your user password if asked.

To gain ‘root’ for more than one command use “sudo su -” to get a ‘root console’.

Next follows a description  about how to “Install Apache2 and PHP5” on your new server.

Tagged

Develoment server build on linux – Introduction

In this article series, I want to explain how to set up an development server based on Ubuntu Server 9.10 Linux as the OS. Installing Apache2 and PHP5. After that installing MySQL and phpMyAdmin. Further installing Java 6 JDK and GlassFish v3.0 as a JavaServelt and JSP/JSF environment.
No that the base system and services are installed, we can install and configure the bug tracker Mantis and Subversion as the Version Control System and Hudson as the Continuous Integration system.

The series is split up into these parts:

  1. Introduction (this part)
  2. Installing Ubuntu Server 9.10
  3. Installing Apache2 and PHP5
  4. Installing MySQL and phpMyAdmin
  5. Installing Java 6 JDK and GlassFish v3.0
  6. Installing Mantis
  7. Installing Subversion
  8. Installing Hudson

So, lets get started with “Installing Ubuntu Server 9.10“.

Tagged , , , , , , , , ,

Maven and Eclipse: Compiler version inheritance

I’ve recently started to use Maven 2 in my Eclipse projects. So everything has worked fine for a single-module project, but I had some difficulties with a multi-module project.

The problem was, that I haven’t got Eclipse to use the J2SE version 1.6. Instead, Eclipse always used the default version 1.4. This Doesn’t worked for me, because of the use of Generics (which are introduced in 1.5).

The wrong parent pom
In a multi-module project, you should define a parent- / main-pom which holds all settings and properties that are common to all modules. So, I configured the build-properties as shown here:

<properties>
	<java-version>[1.6,)</java-version>
	....
</properties>

<build>
  	<plugins>
  	  	<plugin>
  	  	  	<groupId>org.apache.maven.plugins</groupId>
  	  	  	<artifactId>maven-compiler-plugin</artifactId>
  	  	  	<inherited>true</inherited>
  	  	  	<configuration>
  	  	  	  	<source>${java-version}</source>
  	  	  	  	<target>${java-version}</target>
  	  	  	</configuration>
  	  	</plugin>
  	</plugins>
</build>

But every time the default J2SE version was chosen by the m2eclipse plugin when I imported the existing maven project into the workspace of Eclipse. So what was wrong?

The correct parent pom
After a lot of searching around in the web, I found the solution. The problem is, that the build element cannot be inherited. The maven-compiler-plugin has to be configured in a pluginManagement element in the build element. As shown:

<build>
    <pluginManagement>
        <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 ...
             </plugin>
         </plugins>
     </pluginManagement>
 </build>

The child pom
But nevertheless, the build element must be specified in the child pom’s as well – but now without to configure it:

<build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
         </plugin>
     </plugins>
</build>

Range notation in properties and inheritance of build configurations
That works fine, but again there was a mistake in my first configuration. The Java version was written in range manner [1.6,) – which means the Java version needs to be equal or greater then 1.6.
But strangely this range notation can not be used in combination with “range notation in properties and inheritance” (?) or only in combination with “range notation in properties and inheritance of build configurations”(?) !!! – I think the latter is the case.

However, the use of only the version number 1.6 – without the range notations – works!

Maybe this is a bug…or due to a configuration mistake of mine….I’ve no idea…
So feel free, to leave comments or hints.

Tagged , ,

Numlock nach Booten

Wenn jemand schon mal seinen Nummernblock unter Debian sofort aktiviert haben wollte, sollte hiermit zurecht kommen:

  • Generell für die Konsole gilt:
    • In der letzten Zeile von /etc/console-tools/config:

      LEDS=+num

    • alternativ: ein Skript erstellen:
      # /etc/init.d/setleds: set the state of keyboard LEDs (numlock ON)
      PATH="/sbin:/bin:/usr/sbin:/usr/bin"
      [ -e /usr/bin/setleds ] || exit 0

      echo -n “Setting Numlock=ON as default… ”
      for TTY in /dev/tty[1-10]; do
      setleds -D +num < $TTY > /dev/null
      done
      echo “done.”

      exit 0

    • und einbinden: update-rc.d setleds start 20 2 .
  • Zitat von: http://linuxwiki.de/TastaturKonfiguration

  • X Window System

    Beim X Window System ist es nicht ganz so einfach. Zum Glück gibt es einen fertigen Code den Ihr mit dem Paket numlockx installieren könnt. Ist das Paket auf der Platte genügt es, den Befehl

    numlockx on

    in die Datei ~/.xinit.rc zu schreiben. Die Datei könnt Ihr notfalls auch gleich selbst anlegen.

    Zitat von: http://blog.chip.de/chip-linux-blog/kurztipp-numlock-auch-fuer-x-beim-booten-20080218

Tagged , ,

Iceweasel – Printer Preview….

Da ich gerade erst von KDE auf Gnome umgestiegen bin, bin ich sagen wir… auch zum ersten mal auf das sehr seltsame Verhalten von Iceweasel unter Debian (Lenny) gestoßen.
Folgendes ist mir auch aufgefallen und beinhaltet auch gleich die Lösung:

I assume it’s the same in other distributions, but under Debian in Iceweasel, print preview by default is lacking the option to scale content and view it in either landscape or portrait.

From digging around in the configuration I found the print.whileInPrintPreview value to be set to ‘false’. Changing this to ‘true’ enabled scaling and landscape/portrait mode.

I have no idea why this isn’t enabled by default, but I assume it will be at some point in a future version. The funny thing is, all of this is enabled by default in the Windows build and I’m not sure about OSX.

Und da gibt es auch eine weiteres Problem, welches ich auch bestätigen kann:

I also found that using a custom scale produces a bug that splits the window into two panes, each with cut-off text. Whenever I close print preview and re-open it, everything looks fine.

Eine sicherlich bessere und schneller Lösung für dieses “Split-Panel”-Problem ist es, mal eben die Landsape/Portrait bzw. Hochformat/Querformat zu betätigen.

Alle Zitate von: Mean Jollies Blog – Firefox’s print preview

Realtek ALC1200 Soundprobleme unter Linux (Debian)

Ich habe das Asus M3N78 Pro-Board in meinem Rechner und nutze die Onboard-Soundkarte ALC1200 von Realtek. Leider erkennt das aktuelle Debian Stable (Lenny) diese Soundkarte beim Bootvorgang nicht automatisch. Aber dank Linux und den init-Scripten ist das auch kein Problem.

Ich habe mir nun folgendes gebaut:

  1. Als erstest sollte man mal überhaupt prüfen ob man einen Sound aus der Linux-Kiste bekommt. Hierzu als Root mittels ein paar Konsolenkommandos die Soundkarte manuell erkennen lassen:
    • rmmod snd_hda_intel
      Entfernt erst mal das zuständige Kernelmodule. Dieses sollte ja eigentlich nicht geladen sein. Aber besser wir überprüfen es mal.
    • modprobe snd_hda_intel
      Dieser Befehl lädt das Soundmodul, welches eigentlich unserer Linuxkiste beibringen sollte wie man unsere gelibeten mp3, etc abspielt.
    • War die Soundausgabe (z.B. durch Abspielen einer mp3 im mplayer) erfolgreich, können wir zum nächsten Schritt weitergehen.
  2. Hierzu schreiben wir uns ein kleines init-Script für den Bootvorgang, welches wir unter
    /etc/init.d/intelaudio_start
    ablegen. Das Script sieht dann folgendermaßen aus:

    #!/bin/sh
    modprob snd_hda_intel
    exit 0

  3. Ein weiteres Script (/etc/init.d/intelaudio_stop) soll beim Herunterfahren der Neustart wieder das Kernelmodul sauber entfernen:

    #!/bin/sh
    rmmod snd_hda_intel
    exit 0

  4. Als nächstes müssen wir nun diese beiden Script nur noch in den jeweiligen “Run Leveln” starten. Zu den Run-Leveln finden wir im Debian-Anwenderhandbuch folgenden Hinweis:

    Runlevel:

    0

    halt, hält das System an, ohne es neu zu starten.

    2 bis 5

    Multiuser Modus, in diesen Runleveln wird üblicherweise gearbeitet. Ein unverändertes Debian System läuft im Normalbetrieb im Runlevel 2.

    6
    Dieser Runlevel dient zum Neustarten (Reboot) des Systems.

    Zitat von: 3.8 Systemstart und -stop bei Debian

  5. Durch das Programm "update-rc.d", das die Scripte aus /etc/init.d/ in die jeweiligen Runlevel-Verzeichnisse (/etc/rc0.d/ bis /etc/rcS.d/) verlinkt und ihnen einen Platz in der Ausführungsreihenfolge zuweist, erhalten wir unseren automatisiterten Start der Scripte zu den jeweiligen Run-Level-Zeitpunkten.
  6. Mit

    update-rc.d /etc/init.d/intelaudio_start start 49 2 .

    Wird das Boot-Script in den Run-Level 2 eingetragen, wobei es an 49 Platz der Bootsequenz gestartet wird. Die Leerzeichen und der Punkt am Ende sind wichtig!

  7. Gleiches gilt für unser Stop-Script

    :update-rc.d /etc/init.d/intelaudio_stop start 51 0 6 .

    Hier wird das Script “intelaudio_stop” auf Platz 51 (in der Regel sollte man immer 100 minus Startstelle, also 100-49=Stoppplatz wählen) in den Runlevels 0 und 6 (Shutdown und Reboot) gestartet. Die Leerzeichen und der Punkt am Ende sind auch hier wichtig!

Das war’s auch schon….

Hoffe es hilft dem ein oder anderen…

Tagged , ,

Featured Articles: “Werbung die Emotionen weckt”

Ich hätte es nicht besser sagen können:

Damit Werbung bei potentiellen Kunden registriert wird, muss zu allererst die Aufmerksamkeit des Betrachters gewonnen werden. […] Ein wichtiges Mittel um daher im Gedächtnis des Betrachters “hängen zu bleiben”, ist das Erreichen der emotionalen Ebene. Ein Schritt der unserer Meinung nach den folgenden Werbe-Kampagnen durchaus eindrucksvoll gelingt.

Zieht euch einfach den Blogeintrag “Werbung die Emotionen weckt” auf dem Webstandard-Blog rein von dem auch der Kommentar kommt.

Tagged

Meetup…. Komischer Dienst aber cooles Video

Ich bin in meiner Recherche über soziale Dienste und Websites mit Bezug zu Communities und sozialen “Ereignissen” auf den Dienst Meetup gestoßen.

Eigentlich finde ich den Dienst etwas komisch… aber die Anzahl der “gehosteten” Meetings belegen eigentlich eine rege Benutzung des Services.

Aber wegen was ich dachte, ich sollte mal darüber bloggen, waren auch eher die Videos die Meetup “erklären” sollen.

Sie sind direkt auf der Meetup-Seite  und dann die Videos “New to Meetup?” zufinden… *looool*

Reblog this post [with Zemanta]
Follow

Get every new post delivered to your Inbox.