Development

Icons einbinden via @font-face

Posted in Development, Icons, Resourcen, Typographie, Webdevelopment on September 19th, 2010 by admin – Be the first to comment

Icons PreviewUPDATE: Aus irgendeinem unerklärlichen Grund fehlen 4 Icons, die in dem Originalset dabei waren. Ich habe keine Lust, alles neu zu machen, also bleiben sie wohl noch eine Weile verschollen…

Ich habe mich vorgestern mal hingesetzt und das Iconset Raphaël (eigentlich als Beigabe für die JavaScript-Library RaphaëlJS gedacht) in einen @font-face-kompatiblen Webfont konvertiert. Das bedeutet, dass 120 Zeichen der Schriftart keine Buchstaben darstellen, sondern Symbole. Eingebunden werden diese dann via CSS (JavaScript ist nicht nötig) und ein wenig HTML:

<span class="icon">M</span> Send me an email!

Das ist zwar zugegebenerweise nicht semantisch korrekt oder besonders Barrierefrei (dazu hier eine Notiz von dem Pictos-Macher), macht das Einbinden aber ziemlich einfach, ist beliebig skalierbar und funktioniert in fast alle Browsern (Safari in iOS spielt komischerweise nicht mit). Einfärben geht intuitiv mit “color” und man kann beliebige CSS3-Effekt auf die Zeichen anwenden. Außerdem ist der gesamte Font relativ klein, 47kb reichen den meisten Browsern.

Die Idee dahinter ist nicht neu, als Vorbild kann Pictos gelten – die aber leider nicht kostenlos sind und sich somit für kleinere Projekte und zum Experimentieren disqualifizieren.

In natura zu bewundern ist das ganze hier. Dort könnt Ihr auch die Dateien (die wie die original Icons unter MIT stehen) runterladen und sie für eure Projekte verwenden.

Paranoia für Linux-Admins

Posted in Development, Linux, Sicherheit, Webdevelopment on September 13th, 2010 by admin – Be the first to comment

Heute: Welche Programme lauschen an welchen Ports?

netstat -anp|grep LISTEN

netstat -anp|grep LISTEN

MySQL++ with Eclipse CDT on Linux/Ubuntu

Posted in Development on August 18th, 2010 by admin – Be the first to comment

After a whole day of figuring out how to get a stupid “select item from stock” running with MySQL++ and Eclipse CDT I decided to write it down for everyone else having the same problem.

  1. Get the MySQL++ development-files. You might load them from here but it might be easier to just get them via
    apt-get libmysql++-dev

    or synaptic (I’m working with Ubuntu). Make also sure to have mysql-client-x.x (just in case…)

  2. Start Eclipse. Create a new C++ project (executable|empty project)  and add a “source folder” named “src”.
  3. Create a new *.c and *.h file with following contents:
    #include 
     
    #include "mysql++.h"
     
    using namespace std;
     
    int main() {
     
    	mysqlpp::Connection conn(false);
    	if (conn.connect("sample", "localhost", "root", "rootpw")) {
    		// Retrieve a subset of the sample stock table set up by resetdb
    		// and display it.
    		mysqlpp::Query query = conn.query("select item from stock ");
    		if (mysqlpp::StoreQueryResult res = query.store()) {
    			cout &lt;&lt; "We have:" &lt;&lt; endl;
    			for (size_t i = 0; i &lt; res.num_rows(); ++i) {
    				cout &lt;&lt; '\t' &lt;&lt; res[i][0] &lt;&lt; endl;
    			}
    		} else {
    			cerr &lt;&lt; "Failed to get item list: " &lt;&lt; query.error() &lt;&lt; endl;
    			return 1;
    		}
     
    		return 0;
    	} else {
    		cerr &lt;&lt; "DB connection failed: " &lt;&lt; conn.error() &lt;&lt; endl;
    		return 1;
    	}
     
    	return 0;
    }
  4. Now for the tricky bit (I spent a whole day searching for something called “linker” or “includes” but Eclipse decided to just name it “directories”…): Right click your project and choose “properties”. Under “C/C++ Build|Settings|Tool Settings|GCC C++ Compiler|Directories” you will find an empty field. Click “add” and include “/usr/include/mysql++” and “/usr/include/mysql”. Apply.
  5. Hit the “hammer” icon (“build ‘debug’ for …”), choose “run configurations” under the run icon and type into the textfield names “C/C++ Application” “Debug/MyProjectName”. Apply.
  6. Click “Run” – You will now hopefully have a running “Hello World” for C++ with MySQL.