Another useful blog
This is another useful blog.
It covers asp.net and sql server
Storing jpegs in databases
I know that storing images in a database is oftern a bad idea.
However there can come requirements that force things on you.
For the database end I have used an IMAGE datatype in SQL Server.
The delphi approach is as follows:
You need to use GraphicEx to allow display in the normal controls.
All this requires is adding the GraphicEx unit to the end of your uses clause.
procedure LoadJPEGImageFromStream(const aImage: TImage;
const stream: TStream);
var
aJPEG : TJpegImage;
begin
aJPEG := TJPEGImage.Create;
try
aJPEG.LoadFromStream(stream);
aImage.Picture.Assign(aJPEG);
finally
aJPEG.Free;
end;
end;
procedure LoadFromDB(Image : TImage; aField : TBlobField)
var
aBLOBStream : TStream;
begin
ado.Open;
ado.First;
aBLOBStream := adoFAX.CreateBlobStream(aField,bmRead);
try
LoadJPEGImageFromStream(Image, aBLOBStream );
finally
aBLOBStream.free;
end;
end;
procedure SaveToDB(const filename : string)
var
FS : TFileStream;
begin
FS := TFileStream.Create(filename, fmOpenRead);
try
ado.open;
ado.Insert;
adoIMAGE.LoadFromStream(FS);
ado.Post;
finally
FS.Free;
end;
end;
Just to check that this is not a Delphi-only format I wrote the following test from C#:
sqlDataAdapter1.Fill(dataSet11, “DB”);
// How to get an image from a database in .NET
pictureBox1.Image = new Bitmap( new MemoryStream( dataSet11.DB[0].IMAGE ) );
pictureBox1.Height = pictureBox1.Image.Height;
pictureBox1.Width = pictureBox1.Image.Width;
This loads the image previously stored by a Delphi app.
This ensures that the image format used is language neutral.
Why Features Are Added To Software
There are a number of reasons why a feature is added to a software product:
– Customer requested feature
– Company considers this will benefit the customer
– To obtain a sale that would not otherwise be made
– Match a competitor
– To qualify for an award
Least Priv part 3
This is link to a microsoft knowledge basis article covers auidting under active directory.
This may help identify least priv problems.
Delphi 2006 Rocks!
The latest incarnation of Delphi (the tenth version) 2006 seems to be way beyond the microsoft contribution to the field. Out of the box it provides a massive component suite and extensive refactoring tools.
I have just upgraded a large Delphi 5 application suite to D2006 with very little pain.
A few objects had moved units, I had to add the variants unit in a lot of places. Some of the MIDAS parameters now expect TCustomClientDataSet rather than TClientDataset.
It is impressive in that I was able to interchange COM clients and servers build with the differing versions without much trouble. In fact the code areas which we had used the built in events the least required fewer or no changes.
A minor annoyance is that the TChart was missing from the QuickReports 4 suite.
TeeChart is an amazing chart control suite.
Locale id's from Microsoft
This is the list of locale id’s.
These are used by various MS products to control how output works.
Delphi After Borland
As a long time Delphi developer this could be a good thing. Borland had not been paying these tools enough attention of late. Plus given Borland’s recent habit of changing names (Borland -> Inprise -> Borland.com -> Borland) they may even end up reacquiring the product line!
Borland have stated that they will only sell them to a company that would actively develop the products so they will not be mothballed.
Least Priv part 2
This is proving hard to do.
I found the following in an old mcsd study guide (WMA I and WMA II – Prendergast) :
The problem is that there is no one place to find the documentation to be able to secure a WIndows 2000 or above machine – especially when you include Active Directory.
This is especially fun when windows helpfully performs actions on your behalf silently.
This can cause deployment nughmares.
For example when you use DCOMCNFG to specify the identity for a COM object and specify the password it quietly grants you the “log on as a batch job right”. When active directory is involved in the mix it notices that acording to it’s information (gpo) that you should not have that right and takes it away. This can cause an application to fail upto a day after it was deployed and tested. This gets really fun when the deployment engineer has now left the country.
I have also been looking for the means to determine what Privilege are requested.
Finally I have found it!
Under Local Security Settings| Local Policies | Audit Policy there is an option to “Audit privilege use”
Between the settings of audit on success and audit on failure we now have enough tools to identify the use of privileges. This information is written to the event viewer | security section (a point that is not clearly documented anywhere that I could find on the msdn site).
Least Priv
I have a customer that wants to know the minimum priv that an existing application uses.
I am trying to collect the tools needed to investigae this.
This is the sysinternals utility that will detect security related items.
This is a link to a wmi query that lists the required permissions when an operation has failed.