събота, 23 ноември 2013 г.

tomtom mydrive not installing

Well, not really a Linux related post, but anyway.
I had to install tomtom's mydrive on a Windows XP machine. It couln't install for no obvious reasons. The machine had the .net 4.0 and SP3, but it was very unclear what the problem was. I tried installing it on my Sabayon with Wine and it turned out it installed just fine. It couldn't run and I thought the reason is that I don't have the .net 4.0 installed, so I did:
$­wget http://winetricks.googlecode.com/svn/trunk/src/winetricks
$ bash winetricks dotnet40 corefonts
It didn't help, really, but then I checked in wine for the tomtom app. And thanks to it, I found out that 1) it won't run under wine because of " KERNEL32.dll.SetVolumeMountPointW" which has not been implemented so far.
2) You need Microsoft Visual C++ 2005 SP1 runtime to run it!
Voila! That was the problem the whole time. Since the Windows machine has been used only for browsing, nobody bothered to install Visual C on it. The tomtom app of course didn't feel obligated to report this problem, it just crashed silently leaving me scratching my head. After installing it, the app installed fine, connected the device and started updating. It still has not finished, but at least it is working.
My biggest surprise was that my Sabayon recognised the tomtom protocol (network type) and connected fine. It was unbelievable. So, that's the story for today.

понеделник, 7 октомври 2013 г.

How to embed cyrillic subtitles in a video, 2013

Finally I got this to work. I needed to embed Cyrillic subtitles in a video, to be able to watch it on a lame device which likes to screw the subtitles (which it would otherwise read ok).
Anyway, we tried this for quite long but the final try was the working one. I follow this guide.
1. First, locate a working Cyrillic font. I ran a kfind to find Tahoma.TTF
2. Edit ~./mplayer/config
and add:
# Set font.
#set your ttf fonts here, example:
font=/path/to/Tahoma.TTF
# Set font encoding.
subfont-encoding=unicode
# Set subtitle file encoding.
unicode=yes
utf8=yes
3. Close this file.
4. Open your subtitles file with kwrite and then click Save As and pick UTF8 as encoding.
5. Well, that's it, then just use:
$ mencoder -UTF8 -sub movie_subtitle.srt -ovc xvid -xvidencopts bitrate=70000 -oac copy -o new.movie.name.avi movie.avi
and mencoder will do the rest. Well, it takes some time, but it works.
Note, if you do -ovc copy, it won't embed the subtitles, just copy the whole movie.
I'm not sure how high you should go with bitrate.
Also, I've found this: -subfont-text-scale 3
if you want to increase the font size. I haven't tried it yet.
For people wanting to try with cp1251, you can try this link, but it didn't work with me.
You can also read this guide, with which you can do a lot of cool things. But all I need is to embed the subtitles, so I'm fine with this command.
Enjoy!

петък, 13 септември 2013 г.

How to send email trough console (smtp)

This one took me a whole lot of nerves to figure it out, and in the end, it turned out I was sleeping the whole time.
The idea was to backup the database of my forum and to send it to an email. There are lots of sites suggesting ways to do it, but here's my final choice (source):

NOW="$(date +"%m%d%Y")"
/usr/bin/mysqldump -hlocalhost -uDBUSER -pDBPass DBName | gzip > /BCKlocation/BCK_NAME$NOW.sql.gz
nail -r "sender@email.com" -s "test" -a /BCKlocation/BCK_NAME$NOW.sql.gz RECIPIENT@email.com
This will attach your backup to the email and send it to the recipient email. I spent the whole night trying this, until I figured that the last option is the recipient email and nothing else. It turned out I was sending myself emails on the email I thought I'm sending them from. Quite stupid, but anyway. Note, it's better not to write your password in a file, so if you have the option to do this trough ssh, it's better to use only -p .

Now comes the funny part - how to set up the smtp. Well, I did it with a .mailrc file in which I put:

set smtp=smtp://name.of.the smtp.server:port
set ssl-verify=ignore
set from=user@domain.com
set smtp-auth=login
set smtp-auth-user=user@domain.com
set smtp-auth-password=password

This options depend on your hosting, so you need to check them there. You can also set them without the .mailrc file, just by typing
mailx -v -s "$EMAIL_SUBJECT -S smtp-use-starttls -S ... $TO_EMAIL_ADDRESS
where ... are all of the options you have in the .mailrc.

But that's all. Doing this, you can happily send yourself emails, reminders, and other goodies, just for the fun of it.
The nice part is that you don't need to use your hosting email to do that, you can use any email server supporting smtp.

If you want to use gmail, here's the smtp setting:

set smtp-use-starttls
set ssl-verify=ignore
set smtp=smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=name@gmail.com
set smtp-auth-password=pass
set from=name@gmail.com

and the command:

$ mailx -v -s "$EMAIL_SUBJECT" $TO_EMAIL_ADDRESS
Nice, huh!
For the man of nail and all its cool options you can see here.