Freitag, 9. Dezember 2011

Kostenloses Kontaktformular / Anfrageformular für joomla 1.7

Für die Webseite www.eheringe-trauringe-online.ch habe ich joomla 1.7 verwendet. Nun ging die Suche nach einem guten, einfachen und kostenfreien Kontaktformular für joomla 1.7 wieder los. Ich habe diesmal FlexiContact genommen. FlexiContact ist für joomla 1.5, 1.6 und 1.7 einsetzbar. Die Konfiguration ist einfach und das Form schnell in die Webseite integriert. Standardmäßig sind die Felder Name, E-Mail, Adresse, Betreff und die Eingabe eines Textes integriert. Man kann aber noch bis zu 5 eigene Textfelder und eine Liste hinzufügen. Außerdem ist es möglich, dass Nutzer sich eine Kopie der eigenen Nachricht zu senden lassen können. Es kann auch auf eine Bestätigungsseite verlinkt werden (diese muss als Beitrag zusätzlich angelegt werden). Für Webseiten, die keine aufwändigen Formulare benötigen, reicht FlexiContact absolut aus.

Donnerstag, 10. November 2011

Joomla 1.7 Template with Slider-Menu-Effect

On the following page http://www.1sr.de/free-joomla-templates.html you will find a Joomla template for the joomla 1.7 (http://www.1sr.de/downloads/templates/1sr_170_1.zip) . The special thing about this template: It already includes the possibility of a top menu with slider effect in top menu. You can also choose their own colors and incorporation of course its own logo.There is also the possibility of a Facebook or Twitter links to display.

Joomla 1.7 Template mit Slider Menü

Auf der folgenden Seite http://www.1sr.de/free-joomla-templates.html findet man ein Joomla Template für die 1.7er Version (http://www.1sr.de/downloads/templates/1sr_170_1.zip). Das Besondere an diesem Template: Es enthält bereits die Möglichkeit ein Top Menü mit Slider-Effekt zu erzeugen. Man kann außerdem seine eigene Farbvarianten wählen und natürlich sein eigenes Logo einpflegen. Außerdem besteht die Möglichkeit einen Facebook oder Twitter Link anzuzeigen.


Mittwoch, 26. Oktober 2011

Moving Average (with gaps) - Sql (Mysql) - Query

The following post shows an example how to create a query for moving averages for mysql database data.


Structure



CREATE TABLE IF NOT EXISTS `quotationtest` (
  `id` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `close` decimal(5,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Data

INSERT INTO `quotationtest` (`id`, `date`, `close`) VALUES
(1, '2011-05-15', 12.706),
(2, '2011-05-16', 4.303),
(3, '2011-05-17', 3.182),
(4, '2011-05-18', 2.776),
(5, '2011-05-19', 2.571),
(6, '2011-05-20', 2.447),
(7, '2011-05-21', 2.365),
(8, '2011-05-22', 2.306),
(9, '2011-05-23', 2.262),
(10, '2011-05-24', 2.228),
(11, '2011-05-25', 2.201),
(12, '2011-05-26', 2.179),
(13, '2011-05-27', 2.160),
(14, '2011-05-28', 2.145),
(15, '2011-05-29', 2.131),
(16, '2011-05-30', 2.120),
(17, '2011-05-31', 2.110),
(18, '2011-06-01', 2.101),
(19, '2011-06-02', 2.093),
(20, '2011-06-03', 2.086),
(21, '2011-06-04', 2.080),
(22, '2011-06-05', 2.074),
(23, '2011-06-06', 2.069),
(24, '2011-06-07', 2.064),
(25, '2011-06-08', 2.060),
(26, '2011-06-09', 2.056),
(27, '2011-06-10', 2.052),
(28, '2011-06-11', 2.048),
(29, '2011-06-12', 2.045),
(30, '2011-06-13', 2.042),
(31, '2011-06-14', 1.960);

For the data above we can use following Sql Code (Mysql) to calculate a moving average (3 day ma in taht case). We use a subquery and a date_sub function for the time window. HAVING COUNT(*) = 3 is used to set moving average to NULL for the first (time window – 1 days).

Query

SELECT t1. id, t1.date, (
SELECT AVG(close)
FROM quotationtest t2
WHERE t2.date > date_sub(t1.date, interval 3 day) AND t2.date <= t1.date HAVING COUNT(*) = 3
) AS ma FROM quotationtest t1


Notice that this code only works for continual data. If there are gaps (e.g. weekends with no stockjobbing) you could not use date_sub function because oft he gaps. In that case you can use the code below. In this query we use some kind of  sorted iterators for doing that job. Notice that the code below is specific Mysql code, but you’ll find possibilities for sequence generation in other databases (e.g. postgres), too.

SET @rowt1 = 0;
SET @rowt2 = 0;

SELECT t1.id, t1.date, (SELECT AVG(close)  FROM (SELECT @rowt2 := @rowt2 +1 AS rownum , id, date, close FROM quotationtest ORDER BY date) t2 WHERE t2.rownum <= t1.rownum AND t2.rownum > (t1.rownum - 3) HAVING COUNT(*) = 3) AS ma FROM (SELECT @rowt1 := @rowt1 +1 AS rownum , id, date, close FROM quotationtest ORDER BY date) t1 ORDER BY t1.date

Have fun




Mittwoch, 5. Oktober 2011

Kostenlose Joomla Amazon Komponente

1sr hat eine kostenfreie Joomla Komponente freigegeben mit deren Hilfe Amazon Produkte über den Amazon Web Service einfach in das CMS Joomla eingebunden / integriert werden können. Über eine einfache Konfiguration können sowohl Produkt-Übersichtsseiten als auch einzelne Produktseiten erzeugt werden.

Folgende Features besitzt die fsramazon Komponente:

  • AWS Konfiguratiton
  • Partnernet (Amazon Advertising) Konfiguration
  • Farb-Konfiguration
  • Produktdetail Konfiguration
  • Erstellung von Seo optimierten Seiten

Nachfolgend noch die offizielle Beschreibung der Joomla Komponente

Bei Fsr Amazon handelt es sich um eine Komponente für das Content Management System (CMS) Joomla, mit deren Hilfe Produkte der Amazon Plattform(en) über einen von Amazon zur Verfügung gestellten Web Service (» AWS) mit Hilfe der Amazon » Product Advertising API in Joomla integriert werden können. Neben der Darstellung der Produkte als Produkt-Übersichts- und –Detailseiten, ist auch Amazons Produktempfehlung integriert, welche die eingebunden Produkte Provisionen auf generierte Umsätze ermöglicht.

sowie ein Link zu mehr Infos

Montag, 12. September 2011

Creates minimal (simple, portable) Http Server (Apache, Xampp)

Following post describes how to build a minimal (portable) Http Server with the help of apache (xampp project)




Download an extract a Xampp Project (e.g. http://freefr.dl.sourceforge.net/project/xampp/XAMPP%20Windows/1.7.3/xampp-win32-1.7.3.zip)

Create following folder structure

PortableHttpServer
|-   apache|    |- bin
|    |- conf
|    |- logs
|    |- modules
|
|-   htdocs


Copy following files:


xampp/apache/bin/httpd.exe   => apache/bin
xampp/apache/bin/libapr-1.dll   => apache/bin
xampp/apache/bin/libapriconv-1.dll   => apache/bin
xampp/apache/bin/libaprutil-1.dll   => apache/bin
xampp/apache/bin/libhttpd.dll   => apache/bin


xampp/apache/conf/mime.types => apache/conf


xampp/apache/modules/mod_dir.so => apache/modules
xampp/apache/modules/mod_mime.so => apache/modules


Create httpd.conf file in apache/conf with following content


#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 4444


#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule dir_module modules/mod_dir.so
LoadModule mime_module modules/mod_mime.so


#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:4444


#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "../htdocs"


#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.htm
</IfModule>
  
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain


#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain


<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig "conf/mime.types"


    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz


</IfModule>

Create start.bat file in PortableHttpServer with following content:


cd "%~dp0apache/bin/"
httpd.exe -f conf/httpd.conf


pause


Create index.html in htdocs with following content:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Title of Webpage</title>
  </head>
  <body>
    <p>Content of webpage</p>
  </body>
</html>

Start start.bat
Open webbrowser with following url: http://localhost:4444

Freitag, 15. Juli 2011

Update multiple columns with select statement in Postgres

Wenn man mehrere Spalten in per SELECT updaten will, muss man in Postgres eine spezielle Syntax verwenden. Die Standard Update Syntax funktioniert (noch) nicht mehr hier unter 'Compatibility'.

Das nachfolgende Beispiel zeigt die Möglichkeiten für das gewünschte Update auf mehrere Spalten:

CREATE TEMP TABLE test (id int, a varchar, b varchar);

INSERT INTO test VALUES (1, 'a', 'b');

UPDATE test SET (a, b) = ('c', 'd') WHERE id = 1; -- << OK

UPDATE test SET a = (SELECT 'c'), b = (SELECT 'd') WHERE id = 1; -- << OK

UPDATE test SET (a, b) = (SELECT 'c', 'd') WHERE id = 1; -- << FAIL

UPDATE test SET a = sub.a, b = sub.b FROM (SELECT 'c' AS a, 'd' AS b) sub WHERE id = 1; -- << OK


Montag, 6. Juni 2011

Neues Kommandofenster in Windows 7 öffnen (Command window/prompt here)

Etwas versteckt, aber doch gut nutzbar hat Microsoft das Öffnen eines neuen Kommandofensters in das Explorer Kontext-Menü eingebaut.

Hierzu muss man mit gedrückter SHIFT-Taste einen Rechtsklick auf den gewünschten Ordner ausführen.





Freitag, 3. Juni 2011

Seiten in joomla nicht mehr erreichbar nach Verzeichnisschutz bei 1und1

Ich wollte für die folgende Seite (ein joomla Projekt) mal einen Verzeichnisschutz bei 1und1 ausprobieren: http://www.korrekt-gera.de/
Danach funktionierte jedoch nix mehr. Die Startseite ist zwar noch erreichbar jedoch keine andere Seite mehr über einen Link in der Navigation. Außerdem gibt es Probleme im Adminbereich bei der Darstellung der Artikel.
Offensichtlich hängt dies mit dem Verzeichnisschutz bei 1und1 zusammen. Nach stundenlangen Gesprächen mit 1und1 gab es auch keine Lösung. Nach weiteren Stunden der Fehlersuche bemerkte ich, dass die .htaccess überschrieben wurde. Da aber auch joomla einiges aus der .htaccess holt, passt dann natürlich nix mehr. Wenn man den Verzeichnisschutz wieder entfernt, wird die .htaccess sogar ganz gelöscht. Das Hochladen der .htaccess Datei funktioniert so auch nicht. Man muss eine htaccess.txt hoch laden und dann wieder in .htaccess umbenennen. Danach lief auch wieder alles glatt im joomla Projekt.

Donnerstag, 2. Juni 2011

Joomla Modul für Google +1 Button

Seit kurzem hat Google eine neue Möglichkeit geschaffen, mit nur einem Klick Google und anderen Nutzern mitzuteilen, dass man eine Seite gut findet. Das wollten wir für die Seite http://www.eheringe-trauringe-online.at einmal ausprobieren. Dafür habe ich ein joomla Modul gesucht. Gefunden habe ich es auf folgender Seite: http://rndm-snippets.blogspot.com/2011/06/how-to-add-google-1-button-to-joomla-16.html
Das Modul gibt es sowohl für die 1.5er Version (Google +1 Button für joomla 1.5) als auch schon für die 1.6er Version (Google +1 Button für joomla 1.6) zum Download.

Donnerstag, 26. Mai 2011

ALTER TABLE ADD COLUMN IF EXISTS (Postgres)

Manchmal möchte man eine Spalte in Abhängigkeit von deren Existenz hinzufügen. Da man ALTER TABLE ADD COLUMN IF EXISTS nicht direkt auf eine Postgres Table ausführen kann, ist nachfolgend ein kleiner workaround definiert, der sogar die mögliche Existenz von Tabellen in  mehreren DB Schema berücksichtigt.


SELECT 'ALTER TABLE '||tablename||' ADD COLUMN my_new_column integer' AS update_stmt
FROM pg_tables
WHERE tablename = 'my_table_name' 
AND tablename NOT IN (
 SELECT table_name 
 FROM information_schema.columns
 WHERE table_catalog = 'my_catalog'
 AND table_schema = 'my_schema'
 AND table_name = 'my_table_name' 
 AND column_name = 'my_new_column'

Montag, 23. Mai 2011

Selenium RC: Firefox 3 could not be found in the path!

Nach der Umstellung auf Window 7 (64 bit) lieferten alle Selenium (RC) Tests folgende Fehlermeldung:
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox.exe'' to your PATH environment
variable
Der Fehler konnte durch das Hinzufügen von "C:\Program Files (x86)\Mozilla Firefox" zu den Umgebungsvariablen (PATH) behoben werden

Mittwoch, 4. Mai 2011

Selenium IDE (1.0.11) für Firefox 4

Da die aktuelle Version (1.0.10) der Selenium IDE nicht im Firefox 4 läuft und ein einfaches Hochsetzen der maxVersion in der install.rdf auch Probleme macht, gibt es hier eine Vorabversion (Testversion) der IDE in Version 1.0.11.

Montag, 2. Mai 2011

Joomla Fehler - JFolder::create: Infinite loop detected / Datei kann nicht verschoben werden

Wollte für ein Projekt (www.treppen-kompass.de) ein Modul installieren. Dabei bekam ich die Fehlermeldung JFolder::create: Infinite loop detected / Datei kann nicht verschoben werden. Nun dachte ich, wie schon sooft, ein Problem bei den Rechten der betreffenden Ordner. Aber die Rechte waren alle in Ordnung. Nach etwas Suchen habe ich dann eine Lösung gefunden.
Der Fehler lag an dem Pfad zum tmp-Verzeichnis. Dies könnt ihr in der Konfiguration (Adminbereich) unter Server ändern. Ladet dazu vorher eine php-Datei mit dem Namen path.php und folgendem Inhalt in Euer joomla Verzeichnis (ftp-Server):

Ruft dann die Datei auf (www.eureSeite.de/path.php). Dort findet ihr dann den Pfad, der um /tmp ergänzt, in der Konfiguration eingetragen werden muss.
Danach sollte die Installation des Moduls funktionieren.

Dienstag, 5. April 2011

Kostenloses ScanProgramm / ScanSoftware

Ich hatte einige Probs mit der Software meines Brother DCP 135c. Die Scansoftware von Brother wollte einfach nicht mehr unter Windows7 (64 bit) funktionieren. Nun habe ich nach einem kostenlosen Scanprogramm gesucht, mit dem ich auch gleich pdf´s erzeugen kann. Es gibt da viele Scanprogramme. Habe einige ausprobiert - wirklich gut hat mir keines gefallen. Außerdem waren die meisten dann doch nur Testprogramm (Shareware) mit irgendwelchen Einschränkungen. Dann habe ich gelesen, dass man mit dem kostenlosen Bildbetrachtungsprogramm irfanView auch scannen und daraus pdfs erstellen kann. Gesagt getan. Leider gab es beim speichern des pdfs einen Fehler ("pdf save error"). Lädt man sich aber IM(age)PDF noch runter funktioniert des Scan und das speichern als pdf in irfanview. IM(age)PDF ist eine dll Datei. Die muss in den Plugins-Ordner von irfanview. Speichert man nun den Scan als pdf, funktioniert alles tadellos.

ThumbNail Fotogalerie / Bildergalerie in Joomla

Ich habe länger nach einem einfach zu bedienenden Modul / Plugin für eine Fotogalerie (Thumb Nail) für Joomla 1.5.x gesucht. Dabei habe ich verschiedene Tools (Multithumb Galerie, Fotogalerie Rockslideshow, Joomgallery) ausprobiert. Diese haben mich allerdings alle nicht zufrieden gestellt. Dann habe ich noch den ImageSizer von reDim ausprobiert. Super einfach. Installation, wie immer in Joomla. Die Bilder werden von allein im LightBox-Effekt dargestellt, sobald man diese beim einfügen in Joomla verkleinert (skaliert). Man lädt das Bild in Originalgröße hoch und verkleinert es dann. Es wird dann in der kleineren Größe auf der Webseite dargestellt und klickt man drauf wird es in der größeren Größe in der Light-Box dargestellt.
Hat man mehrere Bilder auf der Seite so werden diese dann in einer Bildergalerie angezeigt.

Donnerstag, 17. März 2011

JavaScript in / mit JavaScript einbinden / einbetten

Wenn man mit JavaScript neue Html Elemente anlegen will, in die wiederum JavaScript Code eingebunden / eingebettet sein soll, funktioniert es nicht den JavaScript Code über innerHTML dem Element zuzuweisen.

Folgende Lösung schafft allerdings Abhilfe:

//neues Skript Element mit JavaScript Code anlegen und in Html Element einbinden /einbetten


var script = document.createElement("script");
script.setAttribute('type','text/javascript'); 
script.text='alert(\'This is added js code\');';
document.getElementById("parentDiv").appendChild(script);


Zu beachten ist allerdings, dass setAttribute in älteren Internet Explorer Versionen (IE6) Probleme bereiten könnte.


Montag, 14. Februar 2011

Fehlermeldungen beim Starten von Eclipse unter Windows 7

Beim starten von Eclipse unter Windows 7 bekam ich folgende Fehlermeldung:

A Java Runtime Enviroment (JRE) or Java Development Kit (JDK) must be
available in order to run Eclipse. No Java virtual machine was found after searching
the following locations:
C:\Program Files (x86)\Eclipse\eclipse\jre\bin\javaw.exe
javaw.exe in your current PATH

Als erstes kontrollierte ich die eclipse.ini. Hab dann den Pfad auf meine Java Version korrekt gesetzt. Dabei soll man aufpassen, dass das Argument -vm vor den -vmargs ... steht. Außerdem sollen alle Argumente in einer neuen Zeile stehen.

Meine .ini sah dann so aus:

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1.R36x_v20100810
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.default
Action
openFile
-vm
C:/Program Files (x86)/Java/jre6/bin
-vmargs
-Xms40m
-Xmx384m

Aber auch das half nix und der Fehler blieb.

Dann bemerkte ich, dass ich die falsche Java Version hatte. Der automatische Download hat die 32 Bit Version genommen. Ich brauche aber die 64 Bit Version.

Also noch einmal zu java und den richtigen Download diesmal per Hand ausgesucht und gesaugt.

Siehe da - java liegt nun auch nicht mehr unter C:/Program Files (x86)/Java sondern unter C:/Program Files/Java

Dann noch einmal die eclipse.ini geändert (mit korrektem Pfad zu java) und fertig.

Danach ließ sich Eclipse problemlos starten.

Dateiendungen unter Windows 7 ändern

Gleich zu Beginn bei der Arbeit mit Windows 7 stellte sich mir die Frage: Wie kann ich Dateiendungen im Explorer ändern?

Ganz einfach:

1. Windows Explorer öffnen
2. Im Menü oben links "Organisieren" öffnen
3. "Ordner und Suchoptionen klicken"
4. Zum Reiter "Ansicht" wechseln
5. Checkbox "Erweiterungen bei bekannten Dateitypen ausblenden" deaktivieren
6. "Übernehmen" und "OK" klicken

Fertig! Nun kann man wie gewohnt die Dateiendungen bei umbenennen mit ändern,

Montag, 7. Februar 2011

Ausgewählte Tabellen aus Postgres exportieren

Anhand der Dokumentation von Postgres kann man sich mit pg_dump ein Kommando für den Export von ausgewählten Tabellen erstellten:

pg_dump.exe -h <hier die IP> -p <hier der Port> -U <username> -O -c -i -d -t "(pattern_one_*|pattern_two_*)" -f "C:\patterndump.sql" <dbname>