<!DOCTYPE html>
<html>
<head>
<!-- d3 uses extended ascii characters, so we HAVE to specify utf-8 -->
<meta charset="utf-8">
<script type="text/javascript" language="javascript" src="d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
// 1. Select a DOM element with a CSS selector
// 2. Create (and append) a new p DOM element, append it to body
// 3. Set the text of the DOM element p, to "Hello World!"
d3.select("body").append("p").text("Hello World!");
</script>
</body>
</html>
Friday, July 25, 2014
Sublime Text on MAC -
Go to end of line/begin of line, and select to end of line, begin of line defaults were driving me crazy. I wan home to move to begin of line, and end to go to end of line - not begin/end of document. Same deal for shift+home and shift+end - I want to select to begin/end of line.
Here's how to "fix" it - just add this to the keymaps.
Here's how to "fix" it - just add this to the keymaps.
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }, { "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }, { "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} }, { "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
Tuesday, April 01, 2014
macports - rsync blocked
Rsync is blocked at my work because stuff.
http://www.dreamchain.com/how-to-sync-mac-ports-without-rsync/ says:
http://www.dreamchain.com/how-to-sync-mac-ports-without-rsync/ says:
If port 873 is blocked on your network and you need to sync MacPorts do this:
In
/opt/local/etc/macports/sources.conf
replacersync://rsync.macports.org/release/ports/ [default]
with
http://www.macports.org/files/ports.tar.gz [default]
and run
sudo port sync
instead of
sudo port selfupdate
MacPorts is now synching using http over port 80 instead of rsync over port 873.
Wednesday, March 19, 2014
Why I love Python
Reason #1
monkeys.sort(key=lambda monkey: monkey.height)Reason #1.2
monkeys.sort(key=lambda monkey: (monkey.height, monkey.age))
Reason #1.3
monkeys.sort(key=lambda monkey: (monkey.height, monkey.age), reverse=True)
Wednesday, June 02, 2010
WPF - ListViewItem - MouseOver
I keep forgetting the style, to set the mouseover color of a listview item
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
Friday, March 19, 2010
Evolution - GMail - IMAP
Lies and more lies.
Here's how I got evolution to work with Gmail using IMAP
Receive:
IMAP
imap.gmail.com:993
SSL
Send:
SMTP
smtp.gmail.com:465
server requires authentication
ssl encryption
authentication type PLAIN
Sunday, January 24, 2010
ffmpeg and mp3
I went to the trouble of compiling ffmpeg on windows - but there was an issue with compiling lame. It felt so unnatural on windows anyway. I'm so used to just having all the tools right there. With Ubuntu it's just so EASY. Most programs are just a quick apt-get away. If I need to compile something, it's just make install and you're away!
I'm supposed to be studying - but looks like this post : http://symbiotix.net/articles/compiling-ffmpeg-mp3-ubuntu-revised-ubuntu-gutsy-server is what I need. I'll give it a try when I have time - or maybe medibuntu has a ffmpeg with it build in?
Stolen from his site:
"However, we’re using Ubuntu based servers and Ubuntu has a strict policy not to include non-free software. This means that the ffmpeg version in the repositories is not built with essential functionality, like mp3 support for audio conversion.
Solution: compile from source. Don’t run away screaming. It’s real easy.
1. enable universe and multiverse repositories
UbuntuGuide » general notes » how to add extra repositories
2. get your tools
sudo apt-get install checkinstall build-essential subversion
3. get the latest ffmpeg sources
cd /usr/local/src sudo svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
4. get the necessary dependencies
sudo apt-get install liblame-dev libfaad-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev
5. configure
cd ffmpeg sudo ./configure --enable-gpl --enable-liba52 --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-pthreads --disable-vhook
6. compile
sudo make
7. go have a snack
8. create the .deb package
sudo checkinstall
note: just press [return] each time when asked for a configuration option
9. install the .deb package
sudo dpkg -i [ffmpeg_your_version.deb]
10. rejoice "
Sunday, December 27, 2009
ffmpeg - MTS to MOV with DNxHD
So I'm trying to get some insane high quality .MTS video, down to the same quality as my DSC's .MP4 stuff in DNxHD.
I can't for the life of me convince ffmpeg to get the FPS right. So for now my solution is NOT to take it to DNxHD, but to MJPEG
The video is easier than the sound - due to Vegas having that stupid sound bug. I spent more than an hour today trying to find an audio stream that Vegas likes. So far I have this:
ffmpeg -i source.MTS -vcodec mjpeg -s 1280x720 -qscale 1 -r 30 -acodec ac3 -ac 2 -ab 192k -ar 44100 target.AVI
Video works sweet - sound still messed up!
Thursday, December 24, 2009
Sony Vegas - it's worth the trouble to get it to work
After battling for hours - I have the solution.
Problem: Sony Vegas won't play audio for .MP4 - they blame QuickTime (LAME!!). All other non-pro video editors suck. Apart from the ones I blogged about - I tried a whole bunch of open source ones. They all suck.
Solution:
1. Pay for Sony Vegas (incentive to get it to work + I'm a Sony whore even though their laptops suck)
2. Download DNxHD codec from Avid woohoo for open standards!
3. Set up a nice Ubuntu install in VirtualBox (I'll have to dual boot until Civilization and Vegas run native under Linux.) Skip this step if you are hard core enough to compile ffmpeg to work under Windows.
4. Praise the mighty ffmpeg
5. Boom. You're ready!!!
Tuesday, December 22, 2009
Video Editing - With Adobe Premier Elements 8
Awesome i7 chip, 7200rpm drive is decent enough - lets give this a spin
1) Massive download, install Adobe Premier Elements 8
2) Woohoo! It can edit .MP4 files!!!
3) Ok. It stopped working. W.T.F???
3.1) Damnit! Fine - I'm learning how to use ffmpeg
3.2) Install ubuntu in virtualbox - I'm not rebooting all the time
3.3) ffmpeg -i M4H00471.MP4 -vcodec mjpeg -sameq output.avi
4) Ok - sweet - I can open my files
4.1) I wonder if it works in Vegas now?
4.1.1) Nope
5) Ok - lets do some easy fade in / fade out effects
5.1) Damn this shit is slow.
5.2) DAMN!!! THIS IS SLOW!!!
5.3) W.T.F? It's not even touching my processor! My machine is just sitting back and relaxing!
5.3.1) Lots of free memory also... hmmm...
5.4) Ok ok - maybe I need to defrag?
5.5) Still slow as all hell.
Come on!!! How hard can this be! I just want to edit some some video mp4 video from my little digital camera. 720p 30 - that's not even a crazy high resolution. It should be a dream!
Sunday, December 06, 2009
Video Editing - With Kdenlive
New laptop with Ubuntu Karmic Koala. Time to edit those holiday videos.
1) Hello Kdenlive. Ok.. lets load in all the clips... BOOM CRASH.
2) Ok. Let's try only one. Hmm... sound playback kinda broken. Let's drag it on anyway. BOOM CRASH.
SOD THIS!
Video Editing - With Sony Vegas Platinum 9.0
New laptop with Windows 7. Time to edit those holiday videos.
1) After messing around and trying to figure out what I was doing wrong.... No sound? Oh excuse me - mp4 from my Sony DVC doesn't provide a understandable audio track?
1.1) Ok - I'll convert it to something else
1.1.1) To VLC!
1.1.1.1) .OGG maybe? .OGG with VLC - bad quality, and sound is skippy. And Vegas can't play it.
1.1.1.2) .ASF then. Blegh. I think VLC is a bit ill.
1.1.2) Sod VLF - there must be something else! Ooow how about handbrake?
1.1.2.1) Nope - only for transcoding to nice little happy viewable formats.
1.1.3) MediaCoder?
1.1.3.1) Need 7zip to extract
1.1.3.2) Error code 8? That doesn't help me!
Forget this!!! I'm booting back into ubuntu!
Monday, November 23, 2009
Monday, October 19, 2009
WPF and the modal dialog (boring)
Warning boring tech related blog entry follows:
The trick (hack) is the following
1) You need a System.IntPtr containing a pointer to the windows handle (this.Handle if you are lucky enough to be in a System.Windows.Window.Form)
2) You need to feed this pointer into your dialog thusly:
WindowInteropHelper wih = new WindowInteropHelper(myUserControl);
wuh.Owner = myIntPtr;
// then, with magical flair:
myUserControl.ShowDialog();
Tuesday, October 13, 2009
log4net
I keep forgetting how to switch on log4net (using app.config)
I always end up wasting time on the apache docs, and searching the net to find this
Step 1: Edit AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
Step 2: Edit App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>
I always end up wasting time on the apache docs, and searching the net to find this
Step 0:
Ensure that the first declaration of
"private static readonly log4net.ILog Log =log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);"
Occurs in your main assembly - if the first declaration is in linked assemblies, it won't load the setting correctly.
Step 1: Edit AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
Step 2: Edit App.config
Important! The configSections bit has to be at the top of your config file. So if you've got an existing one, don't just add it on to the end!
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>
Step 3:
Need more example files - go to http://logging.apache.org/log4net/release/config-examples.html
Labels:
.net,
coding,
log4net,
programming
Wednesday, August 26, 2009
Thursday, February 26, 2009
XML, DOM, JAVA
One of those things that I never bother remembering the exact details of, but end up having to look up on the internet all the time.
Note to self: XML, DOM, JAVA
Taken from this guys site: http://www.genedavis.com/library/xml/java_dom_xml_creation.jsp
Also a bit from here: http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
// get dom doc
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// Document doc = docBuilder.parse(new File(inputFilename));
// -- insert building dom here
// get dom transformer
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// make dom into something useful
FileWriter fw = new FileWriter(new File(outputFilename));
StreamResult result = new StreamResult(fw);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
Note to self: XML, DOM, JAVA
Taken from this guys site: http://www.genedavis.com/library/xml/java_dom_xml_creation.jsp
Also a bit from here: http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
// get dom doc
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// Document doc = docBuilder.parse(new File(inputFilename));
// -- insert building dom here
// get dom transformer
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// make dom into something useful
FileWriter fw = new FileWriter(new File(outputFilename));
StreamResult result = new StreamResult(fw);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
Friday, September 05, 2008
WindowsXP on HP dv2716ca
XP can be installed and run on "Vista only" HP machines - at least on the dv2716ca - I have done so.
I don't like Vista. I gave it a fair chance, it was so bad - that I moved away from Microsoft completely, to Ubuntu. Ubuntu is a dream compared to Vista. I like XP - but lets face it, it's dying (or being killed). The future is Linux, Tiger and Vista. I'm not going to hold onto XP, the reality is, that if Microsoft doesn't move forward, and doesn't kill XP - they will lose to Mac and GNU.
I don't like Vista. I gave it a fair chance, it was so bad - that I moved away from Microsoft completely, to Ubuntu. Ubuntu is a dream compared to Vista. I like XP - but lets face it, it's dying (or being killed). The future is Linux, Tiger and Vista. I'm not going to hold onto XP, the reality is, that if Microsoft doesn't move forward, and doesn't kill XP - they will lose to Mac and GNU.
What follows, is a brief description of what is needed to get an HP Pavilion dv2716ca to boot Vista, XP and Ubuntu. The same should go for most dv2700.
I should put in here - HP does NOT recommend you do this. You probably will lose all support, and for all I know your warranty to. For that matter - don't hold me responsible if your computer is completely useless after doing all of this. Put on you adventure hat!
Install Ubuntu.
Your old XP code won't work, because it doesn't have the right drivers. If you slipstream it on Vista, your CD key might stop working. So you need to slipstream a XP install CD on an XP machine.
I don't have another XP machine, so I installed VirtualBox OSE on Ubuntu, and installed a copy of XP there.
You can do it manually, or the easy way, use nLite
I found my SATA drivers on the HP site, but they are on the Intel site also. (Intel Matrix Storage Manager - sp38088.exe)
Install XP and get back Ubuntu and Vista
XP will now work, but Vista and Ubuntu have disappeared.
There are a few million different ways to do this. Ubuntu is easy, but you need to fix Vista first, that's just how it goes. There are lots of places on the net that say how - I'm not going to repeat - Google it!
Getting Ubuntu back is easy also, I'm not going to pretend I know what bootloader you are using - so you have to figure that out. I used grub. Basically boot up Ubuntu with your live cd and Google it.
Install drivers
This the tricky bit. I spent a few hours using lspci on linux to identify drivers, and try them on XP. ALL the drivers are there. Mostly on the Intel site, and on the HP site. The only trick was the card reader - that took lots of searching.
The only thing I haven't been able to get to work thus far - is the sound. Well - it works, but plugging in the headphones doesn't mute the built in speakers.
I should put in here - HP does NOT recommend you do this. You probably will lose all support, and for all I know your warranty to. For that matter - don't hold me responsible if your computer is completely useless after doing all of this. Put on you adventure hat!
Install Ubuntu.
- Resize your Vista partition. I booted into knoppix and used gparted. Sizes are up to you. Make a NTFS partition for your XP install, and leave the rest of the space unallocated, for your Ubuntu install. I created a 5 gig XP partition, it's enough for XP and nothing else, because I'll be installing my software on my Vista drive, and on a removable hard drive.
- Install Ubuntu.
Your old XP code won't work, because it doesn't have the right drivers. If you slipstream it on Vista, your CD key might stop working. So you need to slipstream a XP install CD on an XP machine.
I don't have another XP machine, so I installed VirtualBox OSE on Ubuntu, and installed a copy of XP there.
You can do it manually, or the easy way, use nLite
I found my SATA drivers on the HP site, but they are on the Intel site also. (Intel Matrix Storage Manager - sp38088.exe)
Install XP and get back Ubuntu and Vista
XP will now work, but Vista and Ubuntu have disappeared.
There are a few million different ways to do this. Ubuntu is easy, but you need to fix Vista first, that's just how it goes. There are lots of places on the net that say how - I'm not going to repeat - Google it!
Getting Ubuntu back is easy also, I'm not going to pretend I know what bootloader you are using - so you have to figure that out. I used grub. Basically boot up Ubuntu with your live cd and Google it.
Install drivers
This the tricky bit. I spent a few hours using lspci on linux to identify drivers, and try them on XP. ALL the drivers are there. Mostly on the Intel site, and on the HP site. The only trick was the card reader - that took lots of searching.
The only thing I haven't been able to get to work thus far - is the sound. Well - it works, but plugging in the headphones doesn't mute the built in speakers.
Wednesday, August 20, 2008
Sony Walkman (NWZ-B105F) on Ubuntu
Every now and then Ubuntu isn't quite as user friendly as I'd like it to be - and I have to learn something new about linux.
This time, my dandy new Sony Walkman (NWZ-B105F) doesn't get auto-deteced when I plug it in. (It's being discontinued, so it's going for cheap at the sony store in Calgary)
Thanks to http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=866297 - it's not a problem - just use pmount to mount a device accessible by any user.
where is my walkman?
sudo fdisk -l
mount it!
pmount /dev/sdb1 /media/Walkman
Done! Ubuntu pops up with a link on my desktop to unmount it - but it doesn't work - so I have to do:
sudo umount /media/Walkman
ALTERNATIVELY!!!
Go to the Sony site, and download the new firmware. Then it just works. :)

What have I been up to?? Nothing much... Last thing of note was going to Saskatchamawoozle.
This time, my dandy new Sony Walkman (NWZ-B105F) doesn't get auto-deteced when I plug it in. (It's being discontinued, so it's going for cheap at the sony store in Calgary)
Thanks to http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=866297 - it's not a problem - just use pmount to mount a device accessible by any user.
where is my walkman?
sudo fdisk -l
mount it!
pmount /dev/sdb1 /media/Walkman
Done! Ubuntu pops up with a link on my desktop to unmount it - but it doesn't work - so I have to do:
sudo umount /media/Walkman
ALTERNATIVELY!!!
Go to the Sony site, and download the new firmware. Then it just works. :)

What have I been up to?? Nothing much... Last thing of note was going to Saskatchamawoozle.
Wednesday, May 14, 2008
Open Office - Outline Numbering (Springtime in Canada!)
I've been a MS Word user for way too long. So much so, that I struggle to use Open Office some days.
So. Lesson for today - when you want to have outline headings (e.g. something that looks like:)
1 Heading 1
1.1 Heading 2
1.1.1 Heading 3
1.2 Heading 2
1.2.1 Heading 3
You have to go Tools -> Outline Numbering -> then modify every damn heading to show the appropriate amount of sub levels etc.
It's springtime in Canada!!!! (Translated for people from real countries: This means, it snows less, and when it does snow, it gets mushy real fast)
Spring in Alberta(Calgary): "Fear not! That snow will be gone in a few days!"

Spring in Ontario(Toronto): "Fear no longer homeless bum! No longer need you hide in the caverns the welfare state has provided for your life of drug abuse and mental instability! The streets belong to you now!"

Spring in Quebec(Gatineau): "Flower while you still can buddy! The camera don't show it, but I'm standing in snow!"
So. Lesson for today - when you want to have outline headings (e.g. something that looks like:)
1 Heading 1
1.1 Heading 2
1.1.1 Heading 3
1.2 Heading 2
1.2.1 Heading 3
You have to go Tools -> Outline Numbering -> then modify every damn heading to show the appropriate amount of sub levels etc.
It's springtime in Canada!!!! (Translated for people from real countries: This means, it snows less, and when it does snow, it gets mushy real fast)
Spring in Alberta(Calgary): "Fear not! That snow will be gone in a few days!"
Spring in Ontario(Toronto): "Fear no longer homeless bum! No longer need you hide in the caverns the welfare state has provided for your life of drug abuse and mental instability! The streets belong to you now!"
Spring in Quebec(Gatineau): "Flower while you still can buddy! The camera don't show it, but I'm standing in snow!"
Subscribe to:
Posts (Atom)