MSBuild XmlMassUpdate and Empty Elements With New Lines

While working on substitution files at work that hook into MSBuild and XmlMassUpdate, I noticed XML elements that are empty (<foo></foo>) compile into <foo>\r\n</foo>. No worries, XmlMassUpdate should be able to find this and inject the value I want.

- Wrong -

Most likely a bug in XMU or we’re running an out dated version was causing this. Still this was a problem since we had default elements that needed to be empty. This was a huge thorn in our side during test-deployments since XMU was refusing to inject values into elements that contained an empty new line.

So how did we get around it? Well it just so happens the ‘remove’ XMU action is able to find the element and remove it. Oddly not able to inject our substition though.. Our substitution file was then modified to look like this, which was successful:

This was my solution and I hope it somehow helps you.

ffmpeg command line options

Figure someone would get some use out of this:

Main options:
-L                  show license
-h                  show help
-version            show version
-formats            show available formats, codecs, protocols, …
-f fmt              force format
-img img_fmt        force image format
-i filename         input file name
-y                  overwrite output files
-t duration         set the recording time
-fs limit_size      set the limit file size
-ss time_off        set the start time offset
-itsoffset time_off  set the input ts offset
-title string       set the title
-timestamp time     set the timestamp
-author string      set the author
-copyright string   set the copyright
-comment string     set the comment
-v verbose          control amount of logging
-target type        specify target file type (“vcd”, “svcd”, “dvd”, “dv”, “pal-vcd”, “ntsc-svcd”, …)
-dframes number     set the number of data frames to record
-hq                 activate high quality settings
-scodec codec       force subtitle codec (‘copy’ to copy stream)
-newsubtitle        add a new subtitle stream to the current output stream
-slang code         set the ISO 639 language code (3 letters) of the current subtitle stream
Continue reading

Cross-platform Get Free Drive Space in Python

While searching for a way to get free drive space via Python in a cross-platform friendly way. I stumbled upon this Stackoverflow posting which seems to do the trick!

Stackoverflow Link

 

Static CherryPy Pages By Code

Here is a simple template I use for spinning up a CherryPy instance with no config file. The following example assumes you have a subdirectory named ‘static’ in the root directory of your Python script.

 

List directories with Java JCIFS over SMB

Utilizing the JCIFS SMB implementation you can easily list directories and manage files over a SMB UNC Share.

My example happens to be in groovy but you get the idea. :)

In the code below it’s important to note SmbFile obj can be used for a directory or file. When specifying a directory like in my example, you MUST end the path with a trailing / or you’ll get SmbException when you try to get a listing.