Showing posts with label Tech. Show all posts
Showing posts with label Tech. Show all posts

Monday, February 4, 2013

Add Twitter Bootstrap to MVC4

Unzip bootstrap files into the /Content directory.

Add the following lines to App_Start/BundleConfig.cs


bundles.Add(new StyleBundle("~/Content/bootstrap/css/bundle")
.Include("~/Content/bootstrap/css/bootstrap.css"));
bundles.Add(new ScriptBundle("~/Content/bootstrap/js/bundle")
.Include("~/Content/bootstrap/js/bootstrap.js"));


Add the following lines to View/Shared/_Layout.cshtml

@Styles.Render("~/Content/bootstrap/css/bundle")
@Scripts.Render("~/Content/bootstrap/js/bundle")

Note that jQuery must be included before the Bootstrap js-bundle.

Wednesday, April 27, 2011

Installing rmagick on ubuntu 10.04

I just installed ruby and rmagick on an ubuntu 10.4 server. Got some errors during the installation and thought i should summarize the procedure here:

Install ruby

sudo apt-get install ruby1.9.1 rubygems1.9.1


Install imagemagick


sudo apt-get install imagemagick


Tried to install rmagick

sudo gem install rmagick


Got this error:

ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1:in `
'


Found this page, which pointed med to install ruby1.9.1-dev package.


sudo apt-get install ruby1.9.1-dev


Ok, trying again to install rmagick

sudo gem install rmagick


Got this error:

ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.


Found this question on superuser.com which pointed me to install the libmagickwand-dev-package.

sudo apt-get install libmagickwand-dev


Finally, another attempt to install rmagick

sudo gem install rmagick




Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Updating class cache with 0 classes...
Installing RDoc documentation for rmagick-2.13.1...


Success!

Thursday, April 7, 2011

DavMail and microsoft online exchange

DavMail

URL: https://red002.mail.emea.microsoftonline.com/EWS/Exchange.asmx
Enable EWS - check

IMAP
Server name: localhost
Port: 1143
User name: username@domain.com

SMTP
Server name: localhost
Port: 1035
Connection security: none
Authentication method: Password, transmitted insecurely
User Name: username@domain.com

LDAP
Hostname: localhost
Base DN: ou=people
Port number: 1389
Bind DN: username@domain.com

Wednesday, February 23, 2011

Wireless streaming from Spotify to PS3


After many hours trying to get wireless streaming from Spotify to Playstation 3, I finally found a working solution on Linux (ubuntu).

My setup:


I used the solution described in this blog.

But I failed miserable with only streaming the echoes of silence...

Then I found another Spotify streaming blog post, only this time for squeezebox.

This inspired me to try the same trick creating a PulseAudio null-sink.

pactl load-module module-null-sink sink_name=spotify


Setting the sound output to the new sink:



install the lame encoding library to be able to stream mp3:


sudo aptitude install gstreamer10.0-plugins-ugly-multiverse


make sure icecast is running

/etc/init.d/icecast2 start


and then fire up a mp3 stream:

gst-launch-0.10 pulsesrc device=spotify.monitor ! audioconvert ! lame bitrate=320 mode=stereo ! shout2send ip=localhost port=8000 password=PASSWORD mount=spotify.mp3


I then added the following line to my WEB.conf in the ps3mediaserver root folder:

audiostream.Web=Spotify,http://localhost:8000/spotify.mp3


Now start up your PS3 and PS3 Media Server. On your PS3 go to the 'Audio' section, select 'PS3 Media Server', Web-folder and Spotify. Be patient it takes a couple of seconds before it starts.

Thursday, March 25, 2010

Basic authentication - CXF Tips and Tricks Part 1

I'm starting a new blog post series with Apache CXF tips and tricks. In this first post I'll show you how to do communicate with a Web Service together with HTTP Basic authentication.

Below is an example of HTTP Basic authentication with username 'johnsmith' and password 'sesame99'.


URL wsdl = getClass().getResource("myservice.wsdl.xml");
MyService service = new MyService(wsdl).getMyServicePort();
BindingProvider bp = (BindingProvider)service;
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "johnsmith");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "sesame99");

Saturday, May 23, 2009

The Silver Bullet for PS3 Streaming and transcoding

A while ago I bought a Sony Playstation 3 (PS3) to use it as a gaming and media box. But finding a decent video streaming solution on the linux platform turned to be quite a hassle. After a lot of time searching for the ultimate solution supporting all kinds of codecs and transcoding to the ps3, I landed on Fuppes. It wasn't the perfect solution but it solved most of my media issues.

But then I found the ps3mediaserver-project. The feature list is huge, it supports all kinds of codecs through a ton of libraries. Runs on Java, and therefore platform-independent, Yeay!

Current features (from http://code.google.com/p/ps3mediaserver/)

* Ready to launch and play. No codec packs to install. No folder configuration and pre-parsing or this kind of annoying thing. All your folders are directly browsed by the PS3, there's an automatic refresh also.
* Real-time video transcoding of MKV/FLV/OGM/AVI, etc.
* Direct streaming of DTS / DTS-HD core to the receiver
* Remux H264/MPEG2 video and all audio tracks to AC3/DTS/LPCM in real time with tsMuxer when H264 is PS3/Level4.1 compliant
* Full seeking support when transcoding
* DVD ISOs images / VIDEO_TS Folder transcoder
* OGG/FLAC/MPC/APE audio transcoding
* Thumbnail generation for Videos
* You can choose with a virtual folder system your audio/subtitle language on the PS3!
* Simple streaming of formats PS3 natively supports: MP3/JPG/PNG/GIF/TIFF, all kind of videos (AVI, MP4, TS, M2TS, MPEG)
* Display camera RAWs thumbnails (Canon / Nikon, etc.)
* ZIP/RAR files as browsable folders
* Support for pictures based feeds, such as Flickr and Picasaweb
* Internet TV / Web Radio support with VLC, MEncoder or MPlayer
* Podcasts audio/ Video feeds support
* Basic Xbox360 support
* FLAC 96kHz/24bits/5.1 support
* Windows Only: DVR-MS remuxer and AviSynth alternative transcoder support

Go get it now!

Tuesday, March 3, 2009

Optimize git-svn workflow with bash auto complete and Hack&Ship scripts

I've just started using Git at work. We have a large and old subversion repository at work, so git-svn comes to the rescue. Git-svn provides a connection between a central subversion repository and your local git repository. This enables you to get most of the benefits git provides, while still adhering to company standards and commit code to a subversion repository.

I recommend reading Git SVN Workflow to get started with git-svn.

I had some trouble installing Git properly on my computer running Ubuntu 8.10. When executing git svn rebase I got the following message:

Can't locate SVN/Core.pm

After a lot of debugging I figured i was missing a perl library. Installing libsvn-perl did the trick:

sudo aptitude install libsvn-perl


To get the most out of git-svn I'm using git bash completion and two small Hack && Ship scripts to automate the workflow.

Bash autocompletion

Download and install git-completion.sh

Modify your PS1 variable in ~/.bashrc to show the current branch when inside a directory in a git repository:

PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '


Your prompt will look something like this:

neo@zion:~/dev/emp (trunk)$


Automating the workflow

The recommended git workflow is to create a branch for every new feature you work on. For your branches to be up to date you have to switch to your master branch, rebase with the svn repository, switch back to your branch and then rebase your branch with the master. This is 4 commands that can be automated.

hack.sh

#!/bin/bash
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
status=`git checkout master | awk '{print $1}'`
if [[ ! "${status}" =~ error ]]; then
git svn rebase
git checkout ${CURRENT}
git rebase master
fi


After making sure your branch is up to date you'll want to merge your branch with the master and then push your changes to the central repository (the subversion repository):

ship.sh

#!/bin/bash
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git rebase -i master
status=`git checkout master | awk '{print $1}'`
if [[ ! "${status}" =~ error ]]; then
git merge ${CURRENT}
git svn dcommit
fi

Thursday, February 26, 2009

CXF - How to set a custom endpoint address

For some reason it is rarely straight forward how to configure a Java Web Service framework to use a custom endpoint address (one that is not in the WSDL). Anyway, here is how you do it in CXF:


URL wsdl = getClass().getResource("myservice.wsdl.xml");
MyService service = new MyService(wsdl).getMyServicePort();
BindingProvider bp = (BindingProvider)service;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL);

Thursday, February 19, 2009

Linux one liner: When did I come to work today?

I'm usually quite tired when I get up in the morning. Beeing a consultant with flexible hours, it is often easy to forget exactly when I got to the office in the morning. So I figured i had to write a script to check when I started my computer. What it does is checking the syslog for the first occurence of todays date. I'm running Ubuntu linux and the syslog file is rotated a while after my computer has started. This is why I'm checking syslog.0.

The magic one liner:

date "+%b %d" | xargs -i grep -m1 -i {} /var/log/syslog.0
|awk '{ print "Today I got to work at " $3 }'

(Syntax plugin didn't handle long lines properly. Remove the and put the entire thing on one line.)

Tuesday, September 23, 2008

PS3 - Streaming and transcoding xvid on the fly with fuppes on linux

I recently bought myself an PS3 and I'm very happy with it. Except for one thing, the built in support for streaming video is not the best. Currently it only seem to support some types of mpeg or wma files. This is not satisfactory since I've ripped most of my dvds into xvid.

Finding a upnp streaming server for linux wasn't easy. After trying many different upnp streaming servers with DLNA support (ushare and mediatomb among others), I finally found fuppes. It supports streaming and transcoding of media files on the fly. And it works great with PS3 :)

This thread will get you started. But it is filled with xbox 360 questions and other issues:

My setup:
PS3 - firmware 2.43
Ubuntu 7.10 Server (gutsy)
fuppes - svn revision 578

To make it short I did the following to get it to work:
Note that the apt-get install line has been escaped with slashes '\'. Remove them and put everything on one line if you encounter any problems.
sudo apt-get install ffmpeg build-essential libavutil-dev libavformat-dev libavcodec-dev
\ subversion libtool automake autoconf libsqlite3-dev libpcre3-dev libxml2-dev
\ liblame-dev pkg-config

wget http://heanet.dl.sourceforge.net/sourceforge/fuppes/fuppes-SVN-578.tar.gz
tar xvzf fuppes-SVN-578.tar.gz 
cd fuppes-SVN-578
autoreconf -vfi
./configure --enable-video-transcoding
make
sudo make install
sudo ldconfig


Download my fuppes.cfg and put it in ~/.fuppes/fuppes.cfg

If you wish to use init.d to control your startup take a look at this howto.

UPDATE - 23. May 2009: Check out my silver bullet post about the ps3mediaserver-project

Thursday, March 22, 2007

Remove .svn directories from a project

SubversionSometimes when you work on a project or checkout the source from an existing project you get stuck with a lot of .svn directories. This is quite a hassle to remove if you want to hook the source up to another subversion repository. Removing the files manually is quite tedious since every single directory that is under version control has its own .svn directory. This quick one-liner can help you:

find . -type d -name .svn | xargs rm -rf


(this is no magic really, just writing it for myself to remember.)