<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>A Dev Blog</title><generator>Tumblr (3.0; @rfc2822)</generator><link>http://blog.dev001.net/</link><item><title>[Typo3 tt_news] How to fix "No news in this list"</title><description>&lt;a href="http://bugs.typo3.org/view.php?id=12931"&gt;[Typo3 tt_news] How to fix "No news in this list"&lt;/a&gt;: &lt;p&gt;Do you always get “no news in this list” (in German: “Keine News in dieser Ansicht”) although tt_news is correctly set up? Then maybe it’s because you have a LATEST plugin somewhere and the items shown there are not displayed in a LIST anymore. To avoid this, add&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;plugin.tt_news.excludeAlreadyDisplayedNews = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to your template (TypoScript setup).&lt;/p&gt;

&lt;p&gt;There is a documentation bug that states it’s off by default, but it’s on…&lt;/p&gt;</description><link>http://blog.dev001.net/post/17458518411</link><guid>http://blog.dev001.net/post/17458518411</guid><pubDate>Sun, 12 Feb 2012 02:04:49 +0100</pubDate></item><item><title>[Typo3] Install a cronjob yourself without hoster assistance</title><description>&lt;p&gt;If you host a Typo3 installation at a provider where you don’t have shell access, need a custom cron job for the Typo3 scheduler and the host’s configuration interface (Plesk, for instance) is somehow cumbersome (for instance, it may limit your cron job to a chrooted shell and PHP isn’t installed the chroot environment, so you can’t start PHP scripts from there), you can try to install a &lt;a href="http://typo3.org/extensions/repository/view/shell/current/"&gt;Typo3 Web shell extension&lt;/a&gt;. Then check for existing cron jobs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you see some environment variable definitions, remember them. There may be a SHELL= restricting you to a chroot shell – in this case you may choose to remove this environment variable in your custom crontab. Now write your &lt;a href="http://www.manpagez.com/man/5/crontab/"&gt;custom crontab&lt;/a&gt;, put it into fileadmin and call&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;crontab fileadmin/your-cron
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Check with&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It should work because in professional hosting environments, there shold be only one user for Web, FTP and cron job and by default, every user can set up his own cron jobs in UNIX.&lt;/p&gt;</description><link>http://blog.dev001.net/post/17452227809</link><guid>http://blog.dev001.net/post/17452227809</guid><pubDate>Sun, 12 Feb 2012 00:08:40 +0100</pubDate><category>Typo3</category></item><item><title>[Typo3] Using direct_mail with external SMTP server</title><description>&lt;p&gt;There are several traps when using Typo3 4.5 and the direct_mail newsletter extension with an external SMTP server. Here’s how to set it up:&lt;/p&gt;

&lt;p&gt;First of all, prepare the SMTP server (for instance, by allowing the IP of the Web server as relay host or setting up user authentication).&lt;/p&gt;

&lt;p&gt;In the Typo3 Install tool, set the [MAIL] settings correctly (transport=smtp, transport_smtp_server, defaultMailFromAddress and defaultMailFromName). To see if it works, send a mail from within the Install tool and check its headers (the SMTP server should be mentioned in a Received line).&lt;/p&gt;

&lt;p&gt;As a dependency for direct_mail SMTP usage, you need PEAR::Mail with Net::SMTP support. Mail.php must be in the include path. Install it on your server, or if you only have a Webspace, put the necessary files into a /pear directory and add this directory to the include_path. Check whether it works using a modified &lt;a href="http://www.phpmaniac.net/wiki/index.php/Pear_Mail#Sending_using_authenticated_SMTP"&gt;example script&lt;/a&gt;. Don’t change the path in the include line because direct_mail will include Mail.php directly, too.&lt;/p&gt;

&lt;p&gt;Then set the SMTP server in the Typo3 extension manager’s direct_mail settings.&lt;/p&gt;

&lt;p&gt;Always try out newsletters with separate test recipients because the single test mail in the last step of sending isn’t exactly the same how the other emails are sent. If you get an error at the last step (step 5), set [MAIL][substituteOldMailAPI]=0.&lt;/p&gt;

&lt;p&gt;If you have debug messages in the mail body, turn off [FE][DEBUG] in the Install tool or localconf.php.&lt;/p&gt;

&lt;p&gt;If you use the “Direct Mail Plain text” static template as well as “Direct Mail Content Boundaries” and your emails are screwed up, make sure that “Direct Mail Content Boundaries” are included &lt;em&gt;before&lt;/em&gt; anything else.&lt;/p&gt;

&lt;p&gt;To disable CSS and JavaScript output in the HTML version of mails, add this to your TypoScript setup:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;config {
  removeDefaultJS = 1
  inlineStyle2TempFile = 0
}
plugin.tx_cssstyledcontent._CSS_DEFAULT_STYLE &gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Avoid special characters like ’ and _ in the direct_mail “sender name” because there is a bug that such mails won’t be sent over PEAR::Mail. This bug should have been fixed since 2009, but it’s still present for me.&lt;/p&gt;

&lt;p&gt;If you try to send an HTML / HTML+plain text version but you only receive plain text, make sure the recipient  (tt_address) records have “Enable HTML mail” set.&lt;/p&gt;</description><link>http://blog.dev001.net/post/17232177447</link><guid>http://blog.dev001.net/post/17232177447</guid><pubDate>Wed, 08 Feb 2012 00:22:00 +0100</pubDate><category>Typo3</category></item><item><title>Cisco WebVPN: "applet not initialized"</title><description>&lt;p&gt;If you connect to Cisco WebVPN with port-forwarding and get the message “applet not initialized” although Java applets work in your browser, you may have to &lt;strong&gt;enable third-party cookies in your browser&lt;/strong&gt;.&lt;/p&gt;</description><link>http://blog.dev001.net/post/16885286239</link><guid>http://blog.dev001.net/post/16885286239</guid><pubDate>Wed, 01 Feb 2012 23:55:04 +0100</pubDate></item><item><title>Converting DBF to CSV files</title><description>&lt;p&gt;How to convert DBF to CSV files:&lt;/p&gt;

&lt;p&gt;1) Install PERL, DBI, and DBD::XBase (comes as a package for many Linux distributions).
2) Use a script like this one:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/perl
use DBI;

my $dbh = DBI-&gt;connect("DBI:XBase:/directory/of/dbf/file") or die;
my $sth = $dbh-&gt;prepare("select * from YourDbfNameWithoutFileExtension") or die;
$sth-&gt;execute() or die $sth-&gt;errstr();

# adapt column names
print "Col1Name,Col2Name,Col3Name\n";

my @data;
while (my @data = $sth-&gt;fetchrow_array()) {
    print join(",",@data)."\n";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;3) Call this script and redirect stdout to the CSV file.&lt;/p&gt;</description><link>http://blog.dev001.net/post/14563495366</link><guid>http://blog.dev001.net/post/14563495366</guid><pubDate>Wed, 21 Dec 2011 15:47:00 +0100</pubDate></item><item><title>Android: generate incoming SMS from within your app</title><description>&lt;p&gt;(Tested with Android 2.3.3 SDK)&lt;/p&gt;

&lt;p&gt;Sometimes, you need to simulate an incoming short message for your app. For instance, an encryption app could need to intercept incoming SMS using a BroadcastReceiver, then check if the SMS was encrypted and if so, decrypt it. Then the decrypted SMS and not the original one should be processed further (show up in SMS app etc.).&lt;/p&gt;

&lt;p&gt;The usual way is to create a BroadcastReceiver, intercept the SMS_RECEIVED broadcast on the incoming message and abort the broadcast if necessary (if the message was encrypted or somehow else only for your app). Then you could generate a notifcation and put the SMS into the inbox:&lt;/p&gt;

&lt;h3&gt;Putting an SMS directy into the native inbox database&lt;/h3&gt;

&lt;p&gt;You will need the WRITE_SMS privilege.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public static final String SMS_EXTRA_NAME = "pdus";
public static final String SMS_URI = "content://sms";

public static final String ADDRESS = "address";
public static final String PERSON = "person";
public static final String DATE = "date";
public static final String READ = "read";
public static final String STATUS = "status";
public static final String TYPE = "type";
public static final String BODY = "body";
public static final String SEEN = "seen";

public static final int MESSAGE_TYPE_INBOX = 1;
public static final int MESSAGE_TYPE_SENT = 2;

public static final int MESSAGE_IS_NOT_READ = 0;
public static final int MESSAGE_IS_READ = 1;

public static final int MESSAGE_IS_NOT_SEEN = 0;
public static final int MESSAGE_IS_SEEN = 1;

private void putSmsToDatabase( ContentResolver contentResolver, SmsMessage sms )
{
    ContentValues values = new ContentValues();
    values.put( ADDRESS, sms.getOriginatingAddress() );
    values.put( DATE, sms.getTimestampMillis() );
    values.put( READ, MESSAGE_IS_NOT_READ );
    values.put( STATUS, sms.getStatus() );
    values.put( TYPE, MESSAGE_TYPE_INBOX );
    values.put( SEEN, MESSAGE_IS_NOT_SEEN );
    values.put( BODY, sms.getMessageBody().toString() );

    // Push row into the SMS table
    contentResolver.insert( Uri.parse( SMS_URI ), values );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Source: &lt;a href="http://stackoverflow.com/q/5946262"&gt;http://stackoverflow.com/q/5946262&lt;/a&gt; (modified)&lt;/p&gt;

&lt;p&gt;However, this method is not future-safe because the content://sms URI is not specified in the SDK and may be subject to change. Also, if the user uses another SMS app than the default one, the message might not appear in the inbox of this SMS app.&lt;/p&gt;

&lt;h3&gt;Doing it by generating a SMS_RECEIVED broadcast&lt;/h3&gt;

&lt;p&gt;So I thought about the possibility to generate a SMS_RECEIVED broadcast by the app. So the message would be processed as a “real” one, including all other filters and then go into the correct SMS app, including all notifications just as from a real one.&lt;/p&gt;

&lt;p&gt;A Google research told me that it was not possible: &lt;a href="http://stackoverflow.com/q/3819856."&gt;http://stackoverflow.com/q/3819856.&lt;/a&gt; I tried myself and after setting the BROADCAST_SMS permission, I didn’t get a permission error but didn’t manage to get it working. Then I found this useful posting: &lt;a href="http://d.hatena.ne.jp/thorikawa/20100930/p1"&gt;http://d.hatena.ne.jp/thorikawa/20100930/p1&lt;/a&gt; (use a translation service if you don’t speak Japanese – I don’t) and got it working (just call sendSms from your app):&lt;/p&gt;

&lt;p&gt;You will need the BROADCAST_SMS privilege.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;     private static void sendSms(Context context, String sender, String body) {
             byte [] pdu = null ;
             byte [] scBytes = PhoneNumberUtils
                             .networkPortionToCalledPartyBCD( "0000000000" );
             byte [] senderBytes = PhoneNumberUtils
                             .networkPortionToCalledPartyBCD(sender);
             int lsmcs = scBytes.length;
             byte [] dateBytes = new byte [ 7 ];
             Calendar calendar = new GregorianCalendar();
             dateBytes[ 0 ] = reverseByte(( byte ) (calendar.get(Calendar.YEAR)));
             dateBytes[ 1 ] = reverseByte(( byte ) (calendar.get(Calendar.MONTH) + 1 ));
             dateBytes[ 2 ] = reverseByte(( byte ) (calendar.get(Calendar.DAY_OF_MONTH)));
             dateBytes[ 3 ] = reverseByte(( byte ) (calendar.get(Calendar.HOUR_OF_DAY)));
             dateBytes[ 4 ] = reverseByte(( byte ) (calendar.get(Calendar.MINUTE)));
             dateBytes[ 5 ] = reverseByte(( byte ) (calendar.get(Calendar.SECOND)));
             dateBytes[ 6 ] = reverseByte(( byte ) ((calendar.get(Calendar.ZONE_OFFSET) + calendar
                             .get(Calendar.DST_OFFSET)) / ( 60 * 1000 * 15 )));
             try {
                     ByteArrayOutputStream bo = new ByteArrayOutputStream();
                     bo.write(lsmcs);
                     bo.write(scBytes);
                     bo.write( 0x04 );
                     bo.write(( byte ) sender.length());
                     bo.write(senderBytes);
                     bo.write( 0x00 );
                     bo.write( 0x00 );  // encoding: 0 for default 7bit
                     bo.write(dateBytes);
                     try {
                             byte[] bodybytes  = GsmAlphabet.stringToGsm7BitPacked(body);
                             bo.write(bodybytes);
                     } catch(Exception e) {}

                     pdu = bo.toByteArray();
             } catch (IOException e) {
             }

             Intent intent = new Intent();
             intent.setClassName( "com.android.mms" ,
                             "com.android.mms.transaction.SmsReceiverService" );
             intent.setAction( "android.provider.Telephony.SMS_RECEIVED" );
             intent.putExtra( "pdus" , new Object[] { pdu });
             context.startService(intent);
     }

     private static byte reverseByte( byte b) {
             return ( byte ) ((b &amp; 0xF0 ) &gt;&gt; 4 | (b &amp; 0x0F ) &lt;&lt; 4 );
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Source: &lt;a href="http://d.hatena.ne.jp/thorikawa/20100930/p1"&gt;http://d.hatena.ne.jp/thorikawa/20100930/p1&lt;/a&gt; (modified)&lt;/p&gt;

&lt;p&gt;I have used GsmAlphabet from the &lt;a href="https://gist.github.com/CyanogenMod/android_frameworks_base/blob/gingerbread/telephony/java/com/android/internal/telephony/GsmAlphabet.java"&gt;Android source code&lt;/a&gt; (I changed all EncodingExceptions to generic Exceptions for testing purposes).&lt;/p&gt;

&lt;p&gt;For a good reference of how to create a PDU and what the single fields mean, please have a look at &lt;a href="http://www.dreamfabric.com/sms/."&gt;http://www.dreamfabric.com/sms/.&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.dev001.net/post/14085892020</link><guid>http://blog.dev001.net/post/14085892020</guid><pubDate>Sun, 11 Dec 2011 23:27:45 +0100</pubDate><category>Android</category><category>mobile</category></item><item><title>How to restart god after deploying a Rails app with Capistrano</title><description>&lt;p&gt;If you use the &lt;a href="http://god.rubyforge.org/"&gt;God gem&lt;/a&gt; to manage your Ruby on Rails application server (&lt;a href="http://unicorn.bogomips.org/"&gt;Unicorn&lt;/a&gt;, for example), you will have to restart the application server using God after deploying a new version.&lt;/p&gt;

&lt;p&gt;I found a solution that polls the application’s tmp directory for restart.txt (like &lt;a href="http://www.modrails.com/"&gt;Phusion Passenger&lt;/a&gt; does) from within the god configuration and restarts the app if the file is touched. However, it didn’t work well for me because the ps syntax varies on different systems and the method is not very reliable (it triggered when I didn’t want it to, and vice versa).&lt;/p&gt;

&lt;p&gt;So I thought about it and now I think that the best solution to restart an app via god is to do (surprise):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;god restart YOUR-APP
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And it should be done exactly if capistrano deploys, and not by polling.&lt;/p&gt;

&lt;p&gt;To allow this command to be run by your deploying user, install sudo and make an entry into sudoers. It may look like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;thedeployinguser ALL=(root) NOPASSWD: /usr/local/bin/god restart YourRailsServer
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, all you need to do in config/deploy.rb is to make it look like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles =&gt; :app, :except =&gt; { :no_release =&gt; true } do
     run "ln -nfs #{shared_path}/sockets #{release_path}/tmp/sockets"
     sudo "god restart YourRailsServer"
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(I need the socket symlink for the Unicorn UNIX sockets.)&lt;/p&gt;</description><link>http://blog.dev001.net/post/12532098051</link><guid>http://blog.dev001.net/post/12532098051</guid><pubDate>Wed, 09 Nov 2011 00:43:53 +0100</pubDate><category>rails</category></item><item><title>[FreeBSD] unicorn.god</title><description>&lt;p&gt;I had a very strange problem concerning my Ruby on Rails installation, using FreeBSD, nginx, Unicorn and God.&lt;/p&gt;

&lt;p&gt;When starting god from the command line as root, everything worked. However, as soon as I placed the god command into /etc/rc.local or a even service file in /usr/local/etc/rc.d, god didn’t start the Unicorn server but showed exit code 127 for “bundle exec unicorn -E production -c config/unicorn.rb”.&lt;/p&gt;

&lt;p&gt;So I added a log directive to the god configuration and looked at the log file. It said:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;env: ruby1.9: No such file or directory
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then I changed the god configuration to include /usr/local/bin in the PATH and now everything works. Here my configuration file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;RAILS_ROOT = '/srv/www/my-project-prod/current'

God.watch do |w|
    w.name = 'my-project'
    w.interval = 30.seconds

    w.uid = 'my-project'
    w.gid = 'my-project'

    w.pid_file = File.join(RAILS_ROOT, "tmp/pids/unicorn.pid")
    w.behavior(:clean_pid_file)

    w.dir = RAILS_ROOT
    w.env = { 'PATH' =&gt; '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin' }

    w.start = "bundle exec unicorn -E production -c config/unicorn.rb -D"
    w.stop_signal = 'QUIT'
    w.restart = "kill -USR2 `cat #{w.pid_file}`"
    w.start_grace = w.restart_grace = 30

    w.start_if do |start|
        start.condition(:process_running) do |c|
            c.running = false
        end
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If somebody is interested, here is my god service file (/usr/local/etc/rc.d/god):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh
#

# PROVIDE: god
# REQUIRE: DAEMON

. /etc/rc.subr

name="god"
rcvar=`set_rcvar`
command="/usr/local/bin/god"

start_cmd='${command} -c /usr/local/etc/god.conf'
status_cmd='${command} status'
stop_cmd='${command} terminate'

load_rc_config $name
run_rc_command "$1"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where god_enable=”YES” is set in /etc/rc.conf, and /usr/local/etc/god.conf includes all my project god files.&lt;/p&gt;</description><link>http://blog.dev001.net/post/11822574669</link><guid>http://blog.dev001.net/post/11822574669</guid><pubDate>Sun, 23 Oct 2011 18:41:00 +0200</pubDate><category>freebsd</category><category>rails</category></item><item><title>hey, when u installed ts3 on freebsd, did u get the serveradmin password??</title><description>&lt;p&gt;yes, it is in the ts3 log file&lt;/p&gt;</description><link>http://blog.dev001.net/post/10782614702</link><guid>http://blog.dev001.net/post/10782614702</guid><pubDate>Thu, 29 Sep 2011 00:59:46 +0200</pubDate></item><item><title>Ruby 1.9 invalid multibyte char (US-ASCII) when running bundler via Capistrano on FreeBSD</title><description>&lt;p&gt;If your Rails app works fine after upgrading to Ruby 1.9 (including &lt;code&gt;bundler install&lt;/code&gt; in development environment), but throws an error like this when you deploy it via Capistrano:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;... capistrano runs bundler as deployment user ...
... invalid multibyte char (US-ASCII) ...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;make sure that the environment variables are set correctly for this user, especially that the LANG variable sets UTF-8 as charset (for instance, LANG=en_US.UTF-8). Of course, you can just set it in the shell profile of the app user, or you can &lt;a href="http://www.freebsd.org/doc/handbook/using-localization.html"&gt;do it the FreeBSD way in login.conf&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.dev001.net/post/10078641712</link><guid>http://blog.dev001.net/post/10078641712</guid><pubDate>Sun, 11 Sep 2011 14:26:53 +0200</pubDate><category>rails</category><category>freebsd</category></item><item><title>On-the-fly RSA encryption for secure transmission of forms/resources over non-secure connections</title><description>&lt;a href="https://github.com/rfc2822/acts_as_securely_transferable"&gt;On-the-fly RSA encryption for secure transmission of forms/resources over non-secure connections&lt;/a&gt;: &lt;p&gt;I created a new plug-in / gem called acts_as_securely_transferable. It provides on-the-fly RSA encryption for secure transmission of forms/resources over non-secure connections.&lt;/p&gt;

&lt;p&gt;See README for more details.&lt;/p&gt;</description><link>http://blog.dev001.net/post/8791485926</link><guid>http://blog.dev001.net/post/8791485926</guid><pubDate>Thu, 11 Aug 2011 23:02:37 +0200</pubDate></item><item><title>Why pay for an SSL certificate when JavaScript does it, too?</title><description>&lt;a href="http://iamjosh.wordpress.com/2008/03/18/encrypting-login-password-without-ssl-in-ruby-on-rails/"&gt;Why pay for an SSL certificate when JavaScript does it, too?&lt;/a&gt;: &lt;p&gt;This is a very nice solution to encrypt password fields, credit card numbers etc. in a secure way without needing an expensive SSL certificate. Of course, the authenticity function is lost (i.e. the end user can’t verify who you are, but anybody can buy an SSL certificate too so it doesn’t make much difference). The important thing is the secure transmission of the secret details.&lt;/p&gt;

&lt;p&gt;It makes use of this &lt;a href="http://www-cs-students.stanford.edu/~tjw/jsbn/"&gt;RSA implementation in JavaScript&lt;/a&gt;. Don’t store secret information in a CookieStore session (which is used in Rails by default now) - use, for instance, &lt;a href="https://github.com/scottwb/encrypted_cookie_store"&gt;EncryptedCookieStore&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.dev001.net/post/8649326816</link><guid>http://blog.dev001.net/post/8649326816</guid><pubDate>Mon, 08 Aug 2011 19:05:19 +0200</pubDate></item><item><title>Why it doesn't make any sense to move invalid HTML code into JavaScript</title><description>&lt;p&gt;When I &lt;a href="http://www.google.com/webmasters/+1/button/"&gt;added the Google +1 button&lt;/a&gt; to one of my Web sites, I noticed that the button code given by Google is not valid HTML 5. There is a HTML 5 version, but when used with i18n (for instance, in German) the JavaScript code is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&lt;script type="text/javascript" src="https://apis.google.com/js/plusone.js"&gt;
  {lang: 'de'}
&lt;/script&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now this isn’t valid HTML 5 because &lt;a href="http://www.w3.org/TR/html-markup/script.html#script-constraints"&gt;the script tag can have &lt;em&gt;either&lt;/em&gt; a source reference (src) &lt;em&gt;or&lt;/em&gt; some inline script content&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So I began to search the Web and found solutions like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$(function(){
  $('#gplus').append('&lt;g:plusone&gt;&lt;/g:plusone&gt;');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h1&gt;Why doesn’t make this any sense?&lt;/h1&gt;

&lt;p&gt;Short answer: If you read a newspaper and don’t understand the text - would it be helpful to find instructions how you can write the doubtful text by yourself?&lt;/p&gt;

&lt;p&gt;Long answer: Let’s first ask why you want your code to be valid HTML. Probably to get the greatest possible compatibility with current and future browsers and to support the development of the Web. Who do you write the HTML code for?&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;&lt;p&gt;User agents: Current and future user agents should be able to understand and render your code. In the actual case of the +1 button, user agents may either understand the code and render it or they simply ignore it. There is no need to “hide” the HTML code for them and then insert it by JavaScript because they have to interpret the code inserted by JavaScript nevertheless.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Robots: Normally, they don’t use JavaScript so they would be the target group for “hiding HTML by JS”. However, robots are designed to get most information of the Web and can parse most code that is somehow understandable. In case of correctly opened and closed tags, there is no reason why a robot shouldn’t understand a page that contains an unknown tag. Also, the most important robot is Google and I doubt that Google will reject your page because you embedded the Google +1 button. Furthermore, the actual problem is related to the &lt;script&gt; tags which are ignored by robots anyway.&lt;/script&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For yourself: Do you really feel better when a HTML validator tells you that your code is valid, but you know that it inserts invalid code by JavaScript?&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Of course, I have a strong preference for &lt;em&gt;really valid&lt;/em&gt; Web code - but moving invalid code from HTML to JavaScript doesn’t make any sense for me.&lt;/p&gt;</description><link>http://blog.dev001.net/post/8530076462</link><guid>http://blog.dev001.net/post/8530076462</guid><pubDate>Sat, 06 Aug 2011 00:15:56 +0200</pubDate></item><item><title>Google: Please give me the -1 button</title><description>&lt;p&gt;Where I can vote down (only for me! and maybe Google friends) all these crappy sites that are spamming the search results.&lt;/p&gt;</description><link>http://blog.dev001.net/post/8398900872</link><guid>http://blog.dev001.net/post/8398900872</guid><pubDate>Tue, 02 Aug 2011 23:35:00 +0200</pubDate><category>Google</category></item><item><title>FreeBSD: finding out free/total memory</title><description>&lt;a href="http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt"&gt;FreeBSD: finding out free/total memory&lt;/a&gt;: &lt;p&gt;As there is no “free” like in Linux by default, I found this script which gives a good overview about the current RAM usage on FreeBSD systems.&lt;/p&gt;

&lt;p&gt;The “freecolor” port doesn’t work for me because it’s only available for i386 systems.&lt;/p&gt;</description><link>http://blog.dev001.net/post/8128489076</link><guid>http://blog.dev001.net/post/8128489076</guid><pubDate>Wed, 27 Jul 2011 16:00:24 +0200</pubDate><category>FreeBSD</category></item><item><title>Rails security: mass assignments allow assocations to be changed by user</title><description>&lt;p&gt;Inspired by &lt;a href="http://railspikes.com/2008/9/22/is-your-rails-application-safe-from-mass-assignment"&gt;http://railspikes.com/2008/9/22/is-your-rails-application-safe-from-mass-assignment&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re using associations, they can be set by mass-assignment by default. For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class Property
  has_many :rooms
end

class Room
  belongs_to :property
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Assuming this code for room creation:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@property = Property.find params[:id]
@room = @property.rooms.create params[:room]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will work fine because even if params[:room] contains { :property_id =&gt; some_other_id }, the property of @room will be set to @property.&lt;/p&gt;

&lt;p&gt;However, if you have an update with mass-assignment like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@property = Property.find params[:id]
@room = @property.rooms.find params[:room_id]
@room.update_attributes params[:room]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;it is possible to change the belongs_to association by passing params[:room] =&gt; { :property_id =&gt; some_other_id }.&lt;/p&gt;

&lt;p&gt;Of course, sometimes this is desired behaviour (think of a property user who can select which room they belong to). However, often this is a huge security hole.&lt;/p&gt;

&lt;p&gt;The only solution I know is to use attr_accessible for all models. It’s also possible to force attr_accessible for all models by creating this initializer:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ActiveRecord::Base.send(:attr_accessible, nil)
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.dev001.net/post/7930098063</link><guid>http://blog.dev001.net/post/7930098063</guid><pubDate>Fri, 22 Jul 2011 17:52:00 +0200</pubDate><category>Rails</category></item><item><title>simple_format, auto_link and :rel =&gt; 'nofollow'</title><description>&lt;p&gt;Rails 3.0.6+&lt;/p&gt;

&lt;p&gt;If you use auto_link to mark up links in your text, you can add the rel=”nofollow” attribute like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;auto_link(@text, :html =&gt; { :rel =&gt; 'nofollow' })
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However, if you also want to use simple_format:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simple_format(@text)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you can’t combine this by default:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simple_format(auto_link(@text, :html =&gt; { :rel =&gt; 'nofollow' }))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;because then the rel=”nofollow” will be filtered by the sanitation initiated by simple_format. So, you can either tell it to don’t do sanitation or just add this into a config/initializer:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MyApp::Application.config.after_initialize do |config|
  ActionView::Base.sanitized_allowed_attributes = 'rel'
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This should work too (but doesn’t for me all times):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MyApp::Application.config.action_view.sanitized_allowed_attributes = 'rel'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then this should work:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;simple_format(auto_link(@text, :html =&gt; { :rel =&gt; 'nofollow' }))
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.dev001.net/post/6754962976</link><guid>http://blog.dev001.net/post/6754962976</guid><pubDate>Tue, 21 Jun 2011 15:38:00 +0200</pubDate><category>Rails</category></item><item><title>Installing TeamSpeak 3 server on FreeBSD</title><description>&lt;p&gt;I have made a FreeBSD port for the TeamSpeak 3 server (&lt;a href="http://www.freebsd.org/cgi/cvsweb.cgi/ports/audio/teamspeak3-server/"&gt;audio/teamspeak3-server&lt;/a&gt;), for amd64 and i386 architectures.&lt;/p&gt;

&lt;p&gt;To install the port:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd /usr/ports/audio/teamspeak3-server
make
make install
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or, if you have installed portupgrade:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;portinstall teamspeak3-server
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It adds a teamspeak system user automatically, installs TeamSpeak into the correct directories and adds an rc.d entry. To enable the service, add&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;teamspeak_enable="YES"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to your /etc/rc.d and it will be started when the system boots. Use&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;service teamspeak status
service teamspeak start
service teamspeak stop
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to manage it at runtime.&lt;/p&gt;

&lt;p&gt;If you have a license file (licensekey.dat), put it into /usr/local/etc/teamspeak. Logs (they comprise the admin token after the first start) are stored in /var/log/teamspeak, the files at /var/db/teamspeak.&lt;/p&gt;

&lt;p&gt;On the &lt;a href="http://www.teamspeak.com/?page=downloads"&gt;TeamSpeak download page&lt;/a&gt;, they say that one is not allowed to link to these files directly without their written permission so a port would not be allowed. However, I mailed them regarding the port and they told me that I can announce it in the forums so I think this is a permission.&lt;/p&gt;</description><link>http://blog.dev001.net/post/5492274720</link><guid>http://blog.dev001.net/post/5492274720</guid><pubDate>Sat, 14 May 2011 23:39:00 +0200</pubDate><category>FreeBSD</category></item><item><title>Xerox Phaser 6110N network password reset</title><description>&lt;p&gt;After studying the manual, the service manual, various Internet sites, 3 calls to the Xerox hotline and a lot of help-requesting mails to Xerox partners (not a single one answered even when I offered money for a simple answer), I can now say that:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;p&gt;The Xerox Phaser 6110N network password (for the Web interface) cannot be reset. If you forget it, you can’t use the networking functionality anymore and you have downgraded it to a Phaser 6110.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The IP address can only be changed with a Windows tool - useless if you use Linux or Mac.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;So: &lt;strong&gt;Don’t buy it&lt;/strong&gt;.&lt;/p&gt;</description><link>http://blog.dev001.net/post/4312944222</link><guid>http://blog.dev001.net/post/4312944222</guid><pubDate>Sun, 03 Apr 2011 18:00:00 +0200</pubDate><category>hardware</category><category>xerox</category></item><item><title>Gigabyte "Easy Energy Saver" not so easy without Windows</title><description>Me: Regarding the "Easy Energy Saver" function: Is it a hardware feature that is always available or do I need the Windows EES application/Windows drivers to run? I only use Ubuntu Linux on my system and I'm interested in maximum energy saving.&lt;br /&gt;&#13;
&lt;br /&gt;&#13;
Gigabyte: [...] It's hardware oriented designed but needed to be driven by software.&lt;br /&gt;&#13;
There is no software for Linux.&lt;br /&gt;&#13;
Officially we don't support any Linux distribution.&lt;br /&gt;&#13;
&lt;br /&gt;&#13;
Me (thinking): "There is no software for Linux", so energy saving is only available if you buy and use Microsoft(R) Windows(R) all the time. With any other operating system, you have to waste electrical power and harm the environment, we're sorry.</description><link>http://blog.dev001.net/post/3365609763</link><guid>http://blog.dev001.net/post/3365609763</guid><pubDate>Fri, 18 Feb 2011 19:34:00 +0100</pubDate><category>hardware</category><category>gigabyte</category></item></channel></rss>

