Windows Applications (How Do I in C#)

by Damiaan Peeters 6. December 2007 17:04

Today I found the  How Do I in C# series on MSDN.  The How Do I in series are a great way to get started with task-based topics for any C# programmer and application developer.

At this moment the Windows Applications (How Do I in C#)  page. This page links to help on widely used Windows applications tasks.

Windows Applications (How Do I in C#)

Blocking a IP address in Windows Server 2003

by Damiaan Peeters 5. December 2007 17:31

If you want to block a ip address in windows Server 2003, you can do this fairly easy by setting an inbound filter for that particular IP address.

Go to the

Administering Routing and Remote Access Service

choose there the  - IP filtering - General - the network connection - properties - inbound filter.

DDL Triggers

by Damiaan Peeters 4. December 2007 14:11

DDL stands for Data definition language.  Nothing new until now, you might know DDL as the alter, create and drop statements from SQL.

However, in Microsoft SQL Server 2005 it is possible to add triggers for these statements. 

These kind of triggers allow you to audit these potentially dangerous statements:

CREATE TRIGGER safety
ON DATABASE
FOR CREATE_TABLE, DROP_TABLE, ALTER_TABLE
AS
   PRINT 'You must disable Trigger "safety" to drop, create or alter tables!'
   ROLLBACK ;


DDL triggers fire only in response to DDL events specified by Transact-SQL DDL syntax. System stored procedures that perform DDL-like operations are not supported.

To see a list of the triggers created (in the system catalog), you can use this statement

SELECT name,te.type_desc,te.type
FROM sys.triggers t
JOIN sys.trigger_events te on t.object_id = te.object_id
WHERE t.parent_class=0
AND name IN('ddlTestEvents1','ddlTestEvents2')
ORDER BY name,te.type_desc

Where ddlTestEvents1 and ddlTestEvents2 are of course the names of the events.

If you need to create for the 3 statements the same trigger, you can use

FOR DDL_TABLE_EVENTS

instead of all the individual events.  You will observe the same effect in the triggers catalog.

Tags: , ,

SQL

Strange Microsoft Access Error on ADP project (Sql Server 2005 Extended Properties)

by Damiaan Peeters 2. December 2007 23:51

Today I got a very strange error on my Microsoft Access ADP Project.

image

Microsoft Office Access can't find the object 'SELECT *, sql_variant_property(value, 'basetype') AS type FROM ::fn_litextendedproperty(N'MS_DisplayViewsOnSharePointSite', N'user', N'dbo', N'table', N'TableName', NULL, NULL)'.

To be honest, I had no idea what this meant.  Neither the explanation followed by this error.
After thinking a little while, I found the solution.

Earlier today I tried to add a database schema.  And deleted it afterwards. 

If you look at the tables changed by the database schema, and the tables which where not involved, the only difference are the Extended Properties on the tables.  The tables with extended properties will also give this error in Microsoft Access 2007.  For the record, I am using SQL Server 2005 for this project.

The solution

What you need to do: open the table properties in Microsoft SQL Server Management Studio.
Then go the extended properties. 

image

 

When I deleted the MS_Filter, MS_OrderBy my problem was gone.

My Font BindingList

by Damiaan Peeters 2. December 2007 14:13

When you search a lot on MSDN, you might encounter from time to time a nice example.  Yesterday I found such a nice example on the BindingSource Class page.

They created a new new Generic BindingList of the Font Class

public class MyFontList : BindingList<Font>
{
    protected override bool SupportsSearchingCore
    {
        get { return true; }
    }
    protected override int FindCore(PropertyDescriptor prop, object key)
    {
        // Ignore the prop value and search by family name.         for (int i = 0; i < Count; ++i)
        {
            if (Items[i].FontFamily.Name.ToLower() == ((string)key).ToLower())
                return i;
        }
        return -1;
    }
}        

To use this class, just fill the MyFontList and attach it to a bindingSource.

MyFontList fonts = new MyFontList();
for (int i = 0; i < FontFamily.Families.Length; i++)
{
    if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Regular))
        fonts.Add(new Font(FontFamily.Families[i], 11.0F, FontStyle.Regular));
}
binding1.DataSource = fonts;
listBox1.DataSource = binding1;
listBox1.DisplayMember = "Name";

BlogEngine.Net works with Windows Live Writer

by Damiaan Peeters 1. December 2007 12:40

Like a charm!  Just entered the blog address, my username and password.  Windows live writer discovered all the rest! 

image

The new look and features in Windows Live Writer (version 2008) are cool.  Let's see if BlogEngine.Net and Live writer can work with embedded images.

 

 

New place to blog

by Damiaan Peeters 30. November 2007 13:09

Yes...  And finally...

I am using nucleus for years, but because my webhosting company (speedpacket) is already 3 months not capable to put my website back online, i went for a whole new solution.  This new solution is BlogEngine.Net available on CodePlex

I'll try to import my old post, but nucleus doesn't support BlogML.  For now, my old posts (and domainname) will be unavailable...

Malware blijft toenemen

by Damiaan Peeters 1. November 2006 15:47

De hoeveelheid kwaadaardige software of malware is de afgelopen twintig jaar enorm toegenoemen, waarschuwt antivirusproducent F-secure. De zes eerste maanden van 2006 werden gekenmerkt door de twintigste verjaardag van het eerste computervirus "Brain" en het feit dat het aantal mobiele malware de kaap van 200 heeft overschreden. Volgens F-Secure is geen enkele onbeveiligde computer, pc of mobiel toestel vandaag de dag nog veilig voor een virusaanval.

Tags:

Computers gaan steeds langer mee

by Damiaan Peeters 12. October 2006 15:46

Computers worden steeds betrouwbaarder.
In 2003 ging 7% van alle computers stuk in hun eerste levensjaar, vorig jaar was dat 5%. Dat blijkt uit een studie van het onderzoeksbureau Gartner. Logischerwijze gaan computers sneller stuk naarmate ze ouder worden. Na vier jaar is de kans op sneuvelen toegeomen tot 12%, wat een verbetering is ten opzichte van 2003 toen die kans 15% was. Laptops zijn nog iets labierler dan pc's. Vorig jaar moest 15% van alle laptops terug naar de fabrikant in het eerste jaar. Vooral het moederbord is bij laptops erg kwetsbaar, maar ook harde schijven strooien vaak roet in het eten. Samen zijn ze verantwoordelijk voor maar liefst de helft van de kapotte laptops. Gartner zegt dat de dalingen te danken zijn aan de verbeterde computerdesign, maar ook aan de kwaliteitszorg tijdens de fabricage.

Tags:

General

Spam wordt agressiever

by Damiaan Peeters 2. September 2006 15:45

Het aantal spamberichten is sinds april met 40% gestegen en spammers blijken steeds inventiever te worden. Zo vermommen ze hun boodschappen als maar meer in een mailtje dat van een bekende lijkt te komen. Via de zogenaamde zombie-pc's die spammers onder controle hebben, kunnen ze e-mailadressen achterhalen, maar ook patronen van de gebruikers zoals taalfouten en handtekeningen. Door die patronen te gebruiken bij het versturen van spam, is de kans groter dat die door filters geraakt en dat kwaadaardige links in mails worden aangeklikt. Zowat de helft van de spam wordt verstuurd door middel van afbeeldignen, dit om de spamfilters te omzeilen. Die berichten bevatten enkel een afbeelding om de boodschap over te brengen waardoor filters die zoeken naar bepaalde woorden of url's het bericht dus niet kunnen analyseren en bijgevolg ook niet kunnen blokkeren. In juni vorig jaar was 'plaatjesspam' goed voor 1% van alle spamberichten, halverwege dit jaar was dat al 12%.

Who.I.am

Certified Umbraco Master, Part of Umbraco Certified partner comm-it, .Net and Azure developer, seo lover. Magician in my spare time.

Month List