Convert WTV files to play them in Playstation 3Windows Media Center allows you to record TV shows to your hard drive. As a proud user of a playstation 3 I checked that ps3 cant read WTV movies. You need to convert them to dvr-ms. In Vista and Windows 7 this can be done by a right click on the file. But I want this to be done automatically after a recording has been finished.
Follow these steps to get lucky:
Create a second folder like TV-Converted.
Go to your "Recorded TV" folder and create a file named "convert.cmd".
c:
cd \
cd windows
cd ehome
WTVConverter "E:\Recorded TV\*.wtv" "E:\TV-Converted"
del "E:\Recorded TV\*.wtv"
This will convert all wtf files and save them into the new folder. Just replace the path with your path names.
Now set up a cron job or task that automatically runs that script after a recording has finished its work.
- Open your Taskplaner
- Add a new Task ( call it like WTV Converter)
- Choose "protocol a specific event"
- From the dropdown box choose "Media Player" protocol
- Choose "Recording" as source
- Set tje Event-ID to 1 (means recording has finished)
- As Action choose "Start Program"
- Select your Script like ""E:\Recorded TV\convert.cmd"
- Done!
Save it and test it. You can edit your task and add other triggers. For example EventID 3 that shows that you manually stopped a recording.
You can now add the new folder to your shared media and stream the converted files to your ps3 or where ever you want.


 |
Created January 13, 2010, 12:07 pm Short introduction to WPFThe windows presentation foundation is the biggest change in windows UI programming since Windows 3.1 was replaced by Windows 95. Since ages all UI outputs where made by GDI+ and WIN32 operations. The future is DirectX. So it was a smart step to embedd DirectX in a better way. So the WPF uses the DirectX framework and all its power to render high qualitiy graphics using hardware acceleration. To support older systems and to keep WPF extendable it implements rendering tiers. The lowest tier wont use any hardware acceleration. The highest one can use the power of current DirectX Versions.
So what is WPF? Its an abstraction level of DirectX. Not for game developers but for software developers.
Advantages
- Resolution independence
- Rich Text support
- Animations
- Hardware Acceleration
- Command Pattern (History Functionality)
- Declarative
- Resolution independence due DPI translation (autoscaling)
The only real disadvantage it that WPF only works in windows based environments. DirectX is a core windows technology. A subset of WPF is Silverlight that isnt depending on client technology by using plugins.
XAML
The Extensible Application Markup language "zammel" is a declarative language to insantiate .NET objects. You can compare it with the asp.NET controls that are declared in a ASPX files. XAML makes it more easier to sperate code from design. WPF can also be used 100% without using any XAML by writing all code manually.
- Supports Nesting Elements
- Each element has a ContentProperty Attribute that returns its content
- Markup Extension {x:static ... } allows to set properties dynamically.
- Attatched Properties allow to access properties of parent instances
- XAML is compiled to BAML (binary application markup lang) by xamlc.exe
This example code shows a window with a colored fullsize button.
<window class="Dixus.WPF.Training.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
x="http://schemas.microsoft.com/winfx/2006/xaml"
height="300" width="300">
<grid>
<button name="button1">Button
<button.background>
<lineargradientbrush>
<gradientstop offset="0" color="gray">
<gradientstop offset="1" color="yellow">
</lineargradientbrush>
</button.background>
</button>
</grid>
A basic WPF application
To understand how WPF works its a good idea to build an app from the scratch. Create an empty project and add a c# class like this. You will fiqure out which references you need. If you have no WPF window template use the UserControl and change the derived classes to window.
using System;
using System.Windows;
namespace Dixus.WPF.Training
{
class CoreWPFApp
{
[STAThread()] static void Main()
{
Application app = new Application();
MainWindow wnd = new MainWindow();
app.MainWindow = wnd;
wnd.Show();
app.Run();
}
}
}
This is just an example - not the way you would work. Visual Studio will create a app.xaml. As it works with all xaml files it will generate a partial class that derives from application. The main window wont be shown by the Show-Method then. A startup URI is set in the InitializeComponent Method (that is called in every XAML constructor).
Structure and layout
WPF provides a complete new model for positioning content. At first there is exactely one instance of a window. Every object in that model has a content property. This property can hold exactely one control. This content can be a StackPanel or a single element. The StackPanel itself can hold more than one content and so on... This is great because you have powerfull possiblities but its easy to handle.


 |
Created November 5, 2009, 10:16 am PEX for VSUnit Testing is something most developers hate. Its just boring. Nice to see that microsoft research is working on an VS IDE integrated solution for full covered unit tests.


 |
Created October 11, 2009, 7:07 pm Discovering powershellWow. I havent really something done with powershell. To take advantage of the new power i started to read about it and to try some stuff. Its really amazing!
As .net engineer i am happy that you can access all the power you can take in your IDE. So for example you can create .NET objects in a bash.
$myobject = new System.Anydotnetclasses....
Easy also the use of static classes like System.Math. Just set it to a variable and use the methods with scope operator...
$math = [System.Math]
$math::Sqrt(16)
4
So you can imagine what you are able to do to automate some tasks without the need of any compiler. You build a small script. You can connect to databases, create xml files, whatever .net allows you to do. Sure you can use WebClient class to read RSS feeds or you use the mailer to send mails.
Powershell is object based. So ill try to internalize the new unfamiliar syntax. For example to use new-item with -type directory instead of mkdir. But there is a powerfull help system. You must know that most things start with get-....
get-help new-* -detailed
This gives you a list with help entries matching commands that start with "new-". If you want more details use this:get-help new-item
Be aware that you not only can use .net classes. You have access to WMI objects and even to COM objects. So you can easiliy connect to applications by using their COM objects. For example this shows how to create an internet explorer instance, navigating and showing the browser window... PS C:\Users\hokr\Documents\E-Books\Powershell> $ie = new-object -comobject InternetExplorer.application
PS C:\Users\hokr\Documents\E-Books\Powershell> $ie.Navigate("http://www.dixus.de")
PS C:\Users\hokr\Documents\E-Books\Powershell> $ie.Visible = $True
I ll stop here because it doesnt make sense to write another tuturial. There are a lot good tutorials out there. Just google or bling for it :)


 |
Created July 17, 2009, 3:15 pm LINQ to SQL Debug VisualizerCreated June 8, 2009, 4:45 pm Internet Explorer and DeliciousCreated May 29, 2009, 2:40 pm VB.NET and C# ComparisonCreated May 9, 2009, 12:23 pm ASP.Net PathsCreated May 9, 2009, 12:22 pm Add IIS custom headers programmaticallyI was looking for a solution to add custom headers for IIS virtual folders or subfolders. There is a way using cscript.exe and adsutil.vbs in the AdminScript directory of InetPub. But here is a much more elegant way to do it. Add a reference to System.DirectoryServices to your project and you can modify headers in your deployment project or whereever like this.
Protected Sub AddCustomHeaders(ByVal virtualDirName As String)
Dim strPath As String = "IIS://localhost/W3SVC/1/Root/" & virtualDirName
Dim de As DirectoryEntry = New DirectoryEntry(strPath)
Dim myEntries As DirectoryEntries = de.Children
' Find Images Folder
For Each entry As DirectoryEntry In myEntries
If entry.Name = "Images" Then
'Add a custom header (here Ie6 Cache Bugfix)
entry.Properties("HttpCustomHeaders").Add("Cache-Control:post-check=900,pre-check=3600")
entry.CommitChanges()
Exit For
End If
Next
End Sub
This header solves the issue that IE6 doent cache images. Its a bad idea to put the Cache-Control entry to the Virtual Directory folder. Because everything will be cached. If you do it in code, only aspx pages are affected - but not the images.
So just add the Cache Control to your images subfolder and the flicker problems are gone.
If you want to do it in a bash you can choose this way.
Change directory to C:\inetpub\AdminScripts
cscript.exe adsutil.vbs set w3svc/1/ROOT/YOURVIRTUALDIR/Images/HttpCustomHeaders "X-Powred-By: ASP.NET" "Cache-Control: post-check=900,pre-check=3600"
'End Try


 |
Created April 27, 2009, 6:00 pm Dan Miser - Ignoring specified elements during XMLSerializationCreated March 3, 2009, 1:42 pm XENOCODE Virtual ApplicationsTesting web sites in every browser can be a pain. You cant run different versions of IE. But here is the solution. You can download browsers like IE6,7,8, Mozilla Firefox, Chrome, Safari that runs in a virtualized box. Thats incredible. You dont need to start a Virtual Machine to test your websites for IE6 compatiblity - the vm is included in that file. You just download the exe file from http://www.xenocode.com and you can use it! For free.


 |
Created February 25, 2009, 9:55 am How to get gmail contacts into your mobile phone1. Export google contacts as VCF 2. Convert VCF to Western Europe Codepage 28591 ( e.g. VS2008 -> Advanced Save Options )
3. Import VCF in Vista Contacts
4. Import Vista Contacts into Outlook and Sync Outlook with gmail.
Or use a third party tool like Mobile Master.
Thats simply blah.


 |
Created February 11, 2009, 3:12 pm Rebuild Vista Performance IndexFor some reasons you cant refresh the performance index in control panel. There is am empty site. But if you set PerfCplEnabled to 1 (DWORD) then you see much more.
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Control Panel\Performance Control Panel


 |
Created February 7, 2009, 9:20 pm Most important gmail hotkeysI cant live without google mail any longer. Google Labs added some really cool features like calendar, google docs and task integrations. There are some cool hotkeys that make you work faster with gmail - if you know and learn them. z = undo k / j = pre / next in message list p /n = pre / next in message view u = go to inbox / = go to search box c = compose in message view x = select message s = star (cyclic) e = archive r = reply # = abort / delete l = label v = move shilt i/u = mark read / unread * + a = select all * + n = deselect all


 |
Created February 7, 2009, 12:49 pm Usage extended properties in SQL Server Management StudioIf you open the database properties you see extended properties for the database. Here you are able to set some user defined parameteres and values. Following code allows you to read out those values by T-SQL very easy.
declare @username SQL_VARIANT
SELECT @username = [value] from sys.extended_properties
WHERE class_desc = "DATABASE"
AND [Name] = "UserName"
select @username


 |
Created January 27, 2009, 1:55 pm DocProject and the Send Feedback blah.I use the great DocProject to create code help files. You set it up in 5 minutes.
The only one thing that is annoying are the "Send Feedback" and the three default languages. But there are configfiles in /Presentation/Style/Configuration and Content that you can edit to get rid of this.
To get rid of the different declaration syntax just uncomment the ones you dont need.
CPlusPlusDeclarationSyntaxGenerator
ScriptSharpDeclarationSyntaxGenerator
To remove the "send feedback" stuff from your footer edit your sandcastle.help1x.config and look for feedback and uncomment that part.
file="..\..\Help\Presentation\Style\content\feedback_content.xml
Then open shared_content and uncomment that whole part that includes feedback related stuff. For me it was the easiest to uncomment the complete footer. Just look there and you will see what you can do.


 |
Created December 16, 2008, 2:05 pm Repair corrupt infragistics image pathsI was going crazy because my in my designer and ASP.NET Development Server no infragistics controls that use images could find them. Looks like a corrupt installation... But how to solve it. With nice help from infragistics forum i could solve it this way...
I am currently using 2008 Vol2 CLR 35... If you are using another version you probably have to change some directory names..
He tries to load the images from this path:
/aspnet_client/system_web/2_0_50727/ig_common
No where is it located? You find it here:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles
Just make sure the ig_common directory is in this path including the images folder from your infragistics installation.


 |
Created December 9, 2008, 4:28 pm Prerelease Visual Studio 2010
Download 7 GByte and you can check out the new VS 2010 CTP in a Virtual PC.
You find the download links here.
Its a Windows 2008 Server on a 25 GByte Virtual Disk. The new Visual Studio version will be including more possibilities for SOA driven development. The feature i am looking forward to is the support of UML as part of OSLO.
More information around new stuff in channel 9.


 |
Created December 3, 2008, 12:48 pm Marking code makes you more efficientIt is a really helpfull tool. Many developers dont use it but its really nice to have. Makes life easier. The Tasks and Bookmarks in Visual Studio allows to create grouped and named bookmarks ( STRG + (K + K) ). You can edit those Bookmarks in the Bookmark window and navigate though them by STRG + ( K + N) or P for next and previous marks.
Same works fine for your task list. Just press STRG + ( K + H) and you have created a new task that is linked to your current code possision.


 |
Created December 3, 2008, 10:24 am Temporary Projects in Visual StudioIf you often create new solutions or projects just to test a piece of code or something else, you will have a lot of trash in your folders. There is a simple way to stop this.
Just disable the checkbox "Save new projecs when created" in Options - Projects and Solutions in Visual Studio IDE.


 |
Created December 3, 2008, 10:07 am Special stack chartThere are many chart types but sometimes it happens that you cant find the one you need. So you need to specialize one chart to get the one you need. This special chart shows one column as summary. All other columns are parts of the summary column shown as a stack chart. Also there are shown annotations that shows the sum of each column at the top of the stack charts.
There is no way to move the columns the way you need and also no solution to add summary annotation for stack charts. So the easy solution is to add a dummy rows to your data.
Public Overrides Function CreateResultTable() As DataTable
Dim dt As New DataTable()
dt.Columns.Add("Month", GetType(String))
dt.Columns.Add("Dummy", GetType(Int32))
dt.Columns.Add("Value1", GetType(Int32))
dt.Columns.Add("Value2", GetType(Int32))
dt.Columns.Add("Value3", GetType(Int32))
dt.Columns.Add("Anotation", GetType(Int32))
Return dt
End Function
Now we can use those dummy rows for our purposes. The Dummy Column will be our placeholder for the Y-Margin of the StackColumns and the annotation box. But how can we hide this columns in our chart? This is pretty easy. Just overwrite ChartDrawItem and hide the column by its number.Protected Sub myChart_ChartDrawItem(ByVal sender As Object, ByVal e As ChartDrawItemEventArgs) Handles myChart.ChartDrawItem
If e.Primitive.Column = 0 Then 'dummy row
e.Primitive.Visible = False
ElseIf e.Primitive.Column = 4 Then 'annotations row
e.Primitive.Visible = False
End If
End SubNow we disable those dummies. The effect is that we can place the annotations above each stack where we need it. This example shows how you add an annotation to each column and how you can disable the border and set the font. For i As Integer = 0 To ReportsDt.Rows.Count - 1
Dim CallOut As CalloutAnnotation = New CalloutAnnotation()
CallOut.Text = CalcSum(i)
CallOut.Location.Column = 4
CallOut.Location.Row = i
CallOut.OffsetMode = UltraChart.Shared.Styles.LocationOffsetMode.Automatic
CallOut.FillColor = Nothing
CallOut.Border.Thickness = 0
CallOut.Border.Color = Drawing.Color.Transparent
CallOut.TextStyle.Font = New Font("Arial", 9,FontStyle.Bold, GraphicsUnit.Pixel, 0)
myChart.Annotations.Add(CallOut)
Next


 |
Created October 24, 2008, 11:15 am Pimp your Visual StudioCreated June 2, 2008, 4:08 pm A Sharepoint Development Environment I never had to do with Sharepoint Windows Services so I wanted to play a bit with it. I know it is that portal solution of microsoft to handle large intranets. You have a complete .NET object model where you can do all that you need. Futher its free! All you need is a Windows Server licence. The best way is the installation in a VirtualPC. So setup a VM with Windows Server 2003. Give it a least 1 GB Memory. After installing the windows server run all updates and service packs and configure the server xp like. That means disable the server stuff like error logs, shutdown logs and internet explorer security. A good german article you can find here.
- Install IIS with ASP.NET support
- optionally install and setup Active Directory
- Install Frameworks 2.0, 3.5
- if you forgot to install the IIS use reg_iis in the framework directory
- Install your Visual Studio 2005 or 2008
- If you want to develop WepParts use 2005 (Sharepoint Tools still not out for 2008)
- Download WSS 3.0 and install it (default way works fine)
- Install the Sharepoint Software Development Kit
- connect with your Administrator Password to http://localhost for the default website
- connect to http://localhost:17642 for sharepoint admin backend
- Open you Visual Studio and add the sharepoint.dll reference.
- Start exploring the sharepoint object modell
Remember that the sharepoint is installed as a website. So you will find a web.config. By default its set to windows auth mode. So here I created two ToDo entries that I want to read out with Visual Studio.
MyBlog Example and A Second List Entry. Sharepoint organizes data in lists that are stored in sql server tables. You can create your own lists with your own data types and fields.
So lets take a look how you can access those elements by Visual Studio and WSS oject model.
using System;
using Microsoft.SharePoint;
namespace SharepointShell
{
class Program
{
static void Main(string[] args)
{
String url = "http://localhost/";
SPSite mySite = new SPSite(url);
SPWeb myWeb = mySite.OpenWeb("/");
SPList myList = myWeb.GetList("/Lists/Aufgaben");
foreach (SPListItem myListItem in myList.Items)
Console.WriteLine(myListItem.Title);
}
}
}
Like you expect the output are the two items I created. You can now iterate over the List.Items collection to access the fields of the list.


 |
Created May 19, 2008, 10:46 am ScottGu's LINQ TutorialI updated a project to Visual Studio 2008 and framework 3.5 some weeks ago. Now the time had come to reengineer a small submodule from classic dataset DAL to a LINQ DAL. The main important advantage of LINQ is the compilable SQL. One of the biggest problems in large project was taking care of changes in the DDL on sql server side. The compiler cant help you because all SQL statements are written as strings. But with linq thats not a problem any longer.
Second thing i like is that you dont need that huge and slow datasets any longer. The LINQ designer creates smaller objects that you can use as business objects much more better than a DataSetRow used to be. Also there is no need for IsDateIsNull methods. You can work with nothing or null like you do with other objects too.
However... The greatest introduction in LINQ wrote scott.


 |
Created April 21, 2008, 11:52 am Folder view and unzip in VistaThere are many thinks why I sometimes feel like "format c:" using windows vista. One reason was that every windows explorer folder was looking different. Every settings where made correctly. But my source code folders where shown with columns like "Rating" and "Lenght". WTF. You can fix this in registry:
Open the key HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell and delete the complete Bags and BagMRU key folder. Create a new key
HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell with new string "FolderType" with value "NotSpecified". Then open your explorer and reset the folder settings.
Next think i used to love on vista was the missing context menu entry to extract zip files by explorer. You can fix this by executing this command in console.
cmd /c assoc .zip=CompressedFolder


 |
Created April 12, 2008, 10:49 am |