Feed on
Posts
Comments

This is a problem I ran into at YSTV recently. We run a Samba 3 domain and have recently upgraded our Edit PCs to use Windows 7. Unfortunately Windows 7 out of the box will not join a Samba domain, saying that the “Domain does not exist or could not be contacted” after asking you for login credentials (so it must have contacted the domain controller already, right?!).

Fortunately though, the fix is quite simple. There are two things you need to do:

  1. Install at least samba 3.2.14. This was the oldest version I got to work under Gentoo, but at the time of writing it’s still masked in portage.
  2. Modify a few registry keys on your Windows 7 machines:
      HKLM\System\CCS\Services\LanmanWorkstation\Parameters
      DWORD  DomainCompatibilityMode = 1
      DWORD  DNSNameResolutionRequired = 0

      HKLM\System\CCS\Services\Netlogon\Parameters
      DWORD  RequireSignOnSeal = 1
      DWORD  RequireStrongKey = 1

      Some places will tell you to set the second two values to 0, however I’ve found this not to be necessary – you can just leave them to their defaults of ‘1’. If you run into problems, you can try switching to 0. Otherwise, it might be time to check server logs and make sure that NetBios is working correctly to resolve the Domain name to a Domain Controller.

It’s also worth pointing out, that after the “Welcome to the DOMAIN domain”  message, you may get a DNS error popup. You can safely ignore this, and all seems to work fine (and it doesn’t bother you again).

It has been an interesting year, and those of you who know me should certainly agree. This last year has been my Industrial placement year as part of my Degree – All fun and games you might think. Mostly, you’d be right – aside from the daily struggle of commuting to Leeds every day.

It’s been a busy year in YSTV too. This time a year ago I had just rolled out a bunch of new servers, setup a new flash streaming solution and generally made life more difficult for myself (but better for everyone else, i hope!). A year later, and I’m at it again. This time I’ve rolled out some new high spec Edit PCs, complete with Windows 7. On top of that, myself and several others completely rewired and re-organised the Control Room.

 

However, what this post is all about is how my outlook on a certain few big corporations has changed – Microsoft and Apple.

Continue Reading »

I recently got the following error message whilst trying to write to an excel file using the openXML library in ASP.Net and C#:

System.ApplicationException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.IO.IsolatedStorage.IsolatedStorageFile.nGetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope)
at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor()
at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile()
at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName)
at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream()
at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()
at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at System.Xml.XmlTextEncoder.Write(String text)
at System.Xml.XmlTextWriter.WriteString(String text)
at System.Xml.XmlAttribute.WriteContentTo(XmlWriter w)
at System.Xml.XmlAttribute.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlDocument.WriteContentTo(XmlWriter xw)
at System.Xml.XmlDocument.Save(Stream outStream)
at OfficeOpenXml.ExcelWorksheet.Save()
at OfficeOpenXml.ExcelWorkbook.Save()
at xxx.addDataSetToExcel(DataSet DataSetSource, String fileName, String title, String subject, String category, String comments, String fileType)

Turns out that this is in no way a common problem (google was not my friend on this occasion). After nearly an entire day trying to figure this one out I finally came accross the solution and intend to share it here:

The openXML library uses a MemoryStream object when creating the spreadsheet – When the amount of data your putting into your spreadsheet gets too large to be held in memory, it starts to offload the data to disk. This is where the problem arises.

For whatever reason, ASP.NET decides it’s going to try to put the data into an obscure directory that doesn’t always exist – C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage. I’m not entirely sure why it comes up with Access is Denied, presumabley because the user in the application pool doesn’t have permission to create a directory?

In any case, if you get this problem, just create the above directory and make sure that the user in your application pool (or Everyone) has read and write access to it.

Spamtastic!

This weekend saw a sudden surge of spam comments coming my way. Strangely though, the comments seem legit. No links to various websites, not random text – nothing. Just a few sentances that are so generic they seem relevant.

I let the first couple through – It wasn’t until I noticed i had comments from several different ‘people’ all from the same IP that I started to question it. Further investigation reveals a peculiar email address and that every ‘person’ has google as their website address.

Apparently this was a massive spam attack

So, for those with blogs beware. Comments along these lines should marked as spam:

KattyBlackyard
google.com
katty@ds4ns1ns2.cn
89.28.14.35
Submitted on 2009/06/15 at 11:09am

I really like your post. Does it copyright protected?

I’ve just started using PostgreSQL as my database of choice for a few projects, and needed some way of scheduling backups. As a result I’ve created the following small bash script that will backup a given database and put it in a gzipped tar archive.

You can find the script in my svn repository here.

Usage is pretty simple:

backup_pgsql dbname

where dbname is the name of the database you want to backup.

By default, the script tries to put your backup in /tmp/ – you can change this behaviour by modifying the BACKUP_DIR variable in the script – make sure to include the trailing / though.

Now, of course this is only the backup part. To schedule this, you can edit your crontab file (usually found in /etc/crontab) and include a line like this:

1  3  * * *     root    backup_pgsql dbname

This will backup the database, dbname, at 03.01am every day. Assuming your backup_pgsql is in your PATH. I put mine in /usr/local/bin/ and chmod +x it. If you don’t want to do that, simply provide the full path to the script.

A while ago I rebuilt the video streaming solution at YSTV so that it used flash video. Not wanting to pay for Adobe Media Server, I opted to try and create my own, as it were. I knew that VLC could stream video so I set off to get it to stream flv.

Fortunately for me, the latest builds at the time of vlc could do just that. However, there was one minor flaw – If VLC was transcoding video and streaming it, every client that connected would cause VLC to start up another transcoding process. Not good.

Eventually I found a solution by sending video though ffmpeg first and piping the output into VLC.

The result of my efforts can be found on my wiki here.

The system described there has been happily serving YSTVs live webstream for almost a year now with no major problems – It even survived 150 simulteneous viewers (which considering our previous streaming solution died at 15, isn’t bad going).

I’m not going to say the streaming solution is perfect, because it’s anything but that. However, if your looking for a relatively small scale, cheap flash video streaming system, this should suffice.

Hopefully it’ll help someone, Comments are of course welcome.

I recently had a need to display the current svn revision of a php based website on the home page. This is particularly useful when working on a website as part of group and you have a central dev server than runs a copy of the latest code. It allows you to quickly and easily see which revision is being run on that server.

Anyway, on to the doing part.

There are a number of different ways to achieve this, some more complicated and tedious then others.

The simplest method I found was to parse the .svn/entries file. This, of course, relies on the fact that the code you run is based on a checkout of the repo, rather than an export. This probably isn’t a good idea in a production environment, unless you setup your sever to prevent access to the .svn folder.

The code looks like this:

$svn = File('.svn/entries');
$svnrev = $svn[3];

You can now print the contents of $svnrev wherever you want and you should get the revision number dispalyed.

Note that the 3 indicates the 4th line in the file. If you get unexpected results, check the .svn/entries file and adjust the index on $svn[] as required.

The other methods of doing this are discussed here

Most of the time this is a relatively trivial exercise. In the majority of cases, simply setting ‘Workbook Calculation’ to ‘Automatic’ in the Excel options will give the desired effect.

However, I recently stumbled across a situation where this doesn’t work. If you find yourself entering data into an Excel workbook through some other means – in my case, using the OpenXML libraries in C# – then you may need to force excel to update any formulas you had.

The solution is simple, using a small VB macro. To get it to happen when the workbook is opened, use the following code:

Private Sub Workbook_Open()
 
 Application.CalculateFullRebuild
 
End Sub

If you put that in the code for the main workbook (as opposed to one of the sheets) then it should happen when the spraedsheet is opened.

I recently had some fun and games upgrading PostgresSQL on my Gentoo box – I was running 8.2.7 and needed 8.3.x for it’s support of ENUM types.

After some googling I found this blog which explained how to do it. There were a few extra steps for me, however, so I though I’d repost my findings here.

Continue Reading »

I’ve recently been doing some research in the area of producing High Quality MP4 files with the h264 codec. Of course, my program of choice for encoding to this format was ffmpeg with the libx264 codec. I just wanted to share some of my findings, in particular a few example commands for creating these videos.

Continue Reading »

Older Posts »