|
|
1. You will need to create the Indexed ColorMap (i dunno how).
2. Then apply a filter reading each pixels color and converting to either 0 or 1. (btw the image quality will very crap, not sure if it would usefull, unless u are doing fingerprints)
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hi.
I'm working on a small Guestbook component. I want to make this component as good as possible and realy re-usable. I have a public class called GuestbookLogic exposing all the methods needed to get messages, add new messages and so on. The GuestbookLogic class have a prive property called Dalc. The Dalc property is of type IDalc.
IDalc is a public interface defining all the methods needed by the Data Access Layer Component to be compatible with the bussines logic. In the component i have two implementations of IDalc, SqlDalc and OleDbDalc. The reason i did this was to enable the users of the component to implement any DALC. For instance, if you want to use XML as your data layer, you could create a XmlDalc by implementing IDalc.
My problem is how you tell the bussines logic which implementation of IDalc to use. At the moment i have some logic in the get {} method of the private IDalc property. What it does is to check if the private dalc == null, if it is, then create a new instance of IDalc based on values in app/web.config. It creates the instance like this:
<br />
dalc = (IDalc)System.Activator.CreateInstance(Type.GetType(System.Configuration.ConfigurationSettings.AppSettings["GreIT.Guestbook.Dalc"])); <br />
The GreIT.Guestbook.Dalc propery have this value: "GreIT.Guestbook.SqlDalc, GreIT".
My question is: say you use this component on a ASP.NET app. Would using System.Activator be a performance issue? Do you have any other ideas on how to plug in the IDalc implementation? I could have a set of pre-defines properties, and then have some logic like this.
<br />
string dalcSetting = System.Configuration.ConfigurationSettings.AppSettings["dalc"];<br />
<br />
if(dalcSettings.Equals("Sql")) dalc = new SqlDalc(); <br />
else dalc = new OleDbDalc();<br />
The problem with this implementation is that the developers using the component wouldn't be able to plug in IDalc implementations of their own.
|
|
|
|
|
The AppSettings - like all configuration sections after initial reads - are cached so accessing this won't cause the app to parse XML each time. Using Activator.CreateInstance is also fairly common, and even though it require a few more cycles to instantiate the Type, this would be negligable for code that isn't burdened with lots of requests. If this is the case, you could instead cache the Type in an Application state variable. That would at least save you a little time. Since any changes to the .config result in the AppDomain for the web application to reload, you wouldn't even have to worry about cleaning up the application state variable. Just put some check for this variable in your code like so:
if (Application["DalcType"] == null)
{
Application["DalcType"] = Type.GetType(...);
} The Application reference you can get depending on where you request it, whether that's in a Page or from the HttpContext.Current reference. This would cut down the amount of code required to execute to get the Type, thus boosting performance some.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi Heath.
Thanks for quick feedback on my question. Good thing to know that web.config get's cached when it's loaded. The tip about using Application[] to cache objects is another good tip.
Whould making the IDalc property static have the same effect? Keeping the type in memory untill the web app get's reset?
<br />
private static IDalc dalc;<br />
<br />
private static IDalc Dalc<br />
{<br />
get<br />
{<br />
if(dalc == null)<br />
dalc = System.Activator(....);<br />
return dalc; <br />
}<br />
}<br />
|
|
|
|
|
Does anybody knows how can i create a report programmatically with any fields i want in it and from any source i want?
I have searched a lot for any package with such features but i have not finded any. thanks a lot
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
Take a look at DevArticles[^]
This might help...
Free your mind...
|
|
|
|
|
Hi.
I'm developing a part of a larger System where I'm using the crystal reports
viewer that comes with Visual Studio .NET.
I want to be able to control wether or not the printer selection screen
should be displayed.
In our System we already have configured wich printer to use, so the windows
printer selection screen that appears after pressing the print button,
should not be shown.
Is this at all possible to control when I'm usig the crystal reports viewer?
Regards Troels
|
|
|
|
|
If you use the ildasm.exe IL disassembler that ships with the .NET Framework SDK and view the IL for CrystalReportViewer.PrintReport - following it till ReportDocumentBase.Print - you'll see that it displays the PrintDialog without checking any state variables. So, unfortunately, you can't change this behavior.
You might try emailing support at http://www.crystaldecisions.com[^] to request such a feature.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
It looks like you are right.
Thanks anyway.
|
|
|
|
|
I'm a C/C++ programmer trying to keep up with the game.
How do I construct this C fragment in C#? I'm happy to use strings rather than char *.
struct UserData
{
char *pName;
char *pData;
int n;
} UserData[] =
{
{"Dave", "123", 44},
{"Harry", "345", 67}
};
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct UserData
{
public UserData(string name, string data, int n)
{
this.Name = name;
this.Data = data;
this.N = n;
}
public string Name;
public string Data;
public int N;
} See the documentation for the StructLayoutAttribute in the .NET Framework SDK for more details and examples.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath, I was actually wondering about how to initialise the data, and you put me on the right track. I've ended up with your class
public struct UserData<br />
{<br />
public UserData( string name, string data, int n)<br />
{<br />
this.Name = name;<br />
this.Data = data;<br />
this.N = n;<br />
}<br />
public string Name;<br />
public string Data;<br />
public int N;<br />
}
and then for the data:
<br />
public UserData[] uData =<br />
{<br />
new UserData( "Dave", "123", 44),<br />
new UserData( "Harry", "345", 67),<br />
};
and thus use the 'uData' array in a loop as I wanted.
Thanks
|
|
|
|
|
I'm just trying to make sure I understand. Obviously there is nothing wrong with this but it was my understanding that StructLayoutAttribute was used if the struct were to be passed to unmanaged code, otherwise it wouldn't be necessary. Is there some benefits to using the attribute for managed code as well?
|
|
|
|
|
No, it wouldn't be necessary in managed code unless marshaled to native code, but since he mentioned C/C++ I just assumed that he might require it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks, just wanted to make sure I wasn't missing something.
|
|
|
|
|
I am trying to access data from the serial port using c# I don't want to use a GUI I just want to be able to recieve a stream of bytes, does anybody know how to do this or have any suggestions thanks Tim
|
|
|
|
|
there are no .NET library to use for this.
You have another couple of options.
Use a component from VS 6.0:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320
OR use the win32 API:
http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/default.aspx
|
|
|
|
|
Hi,
I am trying to play mp3 files from C# app. I have Windows Media Player 6.4 and I am able to play the file but with mp3 files, it disables the fast forward and rewind buttons and I also want the trackbar with it.
So, I installed Windows Media Player 9 with SDK. That has a problem that it doesn't look like the gray color simple WMP and that is the look I want. I know I can change the skin, but that seems to be a lot of work and I don't know how to choose a skin while playing a file !
I did read in help that if I put audio.URL = "c:\filename.mp3?WMPSkin=Compact" it should work, but I didn't see the skin change when I ran the applicaiton.
Any suggestions ?
Thanks,
Paul
|
|
|
|
|
pahluwalia wrote:
Any suggestions ?
Stop double posting
|
|
|
|
|
Why don't you just set the visibility to false and handle the events and methods (like Play and Stop ) yourself? It appears there is no way to change the skin using the WMP object model.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I developed a system to print our companies invoices. Now, I am trying to find ways to optimize the system. One of the biggest things is how long it takes to print. When a bill is printed, it also prints all the paperwork stored as tiff images that go with that bill. These images really seem to take a long time to print. I tried converting them to a smaller format to hopefully speed up spooling time. Funny enough, it took longer to print a 159KB gif file than a 1344KB tiff file. My question is, does anybody know of a way to decrease the amount of time it takes to print these images? Thanks.
|
|
|
|
|
I think it really depends on the capabilities of your printer. In which case short of writing your own device driver there isn't anything you can do.
|
|
|
|
|
But can anybody explain why it takes longer to print a 159KB gif image than it does to print a 1344KB tiff image?
|
|
|
|
|
.NET sends _all_ data to a printer using Raster images. This means if you only send plain taxt to a printer, it still converts it into a raster image. If you communicate with the printer via the Serial port it takes quite a while.
If you only want to send text you can develop a component in VB (VS 6.0) that sends plain text to a printer and use this in .NET.
can't help with the image though...
|
|
|
|