|
Message Closed
modified 23-Nov-14 7:16am.
|
|
|
|
|
Hi stancrm, thanks for your help.
I have tried all of this but did not what I want.
what I want is that xaxis should show entire day as hour. let say
if from 12am to 11 pm and each minortic or majortic should show individual hour.
this what I am doing. I also know that xaxis depends on x value.If you can give me a hint
how do I frame time for the entire day as hour.
code>// Set the XAxis to date type
myPane.XAxis.Type = AxisType.Date;
// X axis step size is 1 day
myPane.XAxis.Scale.MajorStep = 1;
myPane.XAxis.Scale.MajorUnit = DateUnit.Hour;
myPane.XAxis.Scale.Format = "h tt";
myPane.XAxis.Scale.Min = hList[0].X - 1;
thanks again.
|
|
|
|
|
codeproject helped me many times
and i m thankful for that.
There is another question
when we create setup for windows application. can we set any property to hide the application database from the user. I want to hide the mdf file from the user.
thanks for all the reply in advance
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
No more than you can hide any other file - you could set the hidden attribute, but thats about all. Why not use encryption within your database?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
can we define the hidden property at the time of creating setup project and how can i use the encryption in database
if u please define some more it will be very helpfull for me
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
The hidden attribute is a file atribute. It hides files from view for simple users. However more advance users uses 3rd party file manager or uses explorer setting "Show All Files". That settings shows files with Attribute: Hidden and System atribute.
One whay to fool users is to use .mdf database with custom extension (something.Dat).
If you realy want to prevent users from using your database, use on the fly encryption/decryption. I do not recommend to use hide attribute.
You could use windows folder and put somewhere or Use custom partition and use it to store database there. The second option is not recommended, because it is too hard and too long to successfully use it.
|
|
|
|
|
thanks saksida
now ill try to do encryption on database
can u provide me some links for startup
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
|
In reality there is no real way to hide the file, anyone with a bit of knowledge will ab able to find the file whatever you do. The only way to be secure is to use sql server encrytion, so just google that.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
thanks ashfield
now ill try to do encryption on database
can u provide me some links for startup
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Try Google. We have given you the advice, now its up to you to do it.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Ok thanks for your rplies
Regards
Narendra Singh
(Jindal Tech Ventures)
|
|
|
|
|
Hi all,
Dose any one know about documentation oF MSPastry Library under MSDN that could be utilized in C# code?
thnaks to you all in advances
|
|
|
|
|
There is no documentation since it's a Microsoft Research project.
|
|
|
|
|
Hey guys
As in the post below I'm busy writing a TCP server. The servers TCP communications are executed asynchronously.
Someone suggested that I take the received bytes out of the asynchronous callback and process it in a separate thread. Lets say I have 100 clients sending data to the server, I can't have 100 threads(one for each client) processing data cause that would defy the object of writing this server asynchronously.
So what I need to do is have a pool of lets say 5 threads for arguments sake that will process the incoming data of ALL the connected clients... I've never done anything like this and have no idea where to start, is this what thread pools are used for?
If anyone could clarify this or point me in a direction i would be really grateful
Thanks
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Yes. Check out SmartThreadPool 2.0. We're using it at work, and it's absolutely tits. I think the latest version is on CodePlex.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: and it's absolutely tits
I agree, I use it on a different project but not quite like this. I was actually busy brushing up on that article
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I'll second SmartThreadPool. We use it to hive off our Tcp processing, and it just works.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hey Pete, long time since we've spoken
Pete O'Hanlon wrote: We use it to hive off our Tcp processing, and it just works
So you've done this before?
Here's my PacketReceivedCallback:
private void PacketReceivedCallback(IAsyncResult result)
{
IOClient client = (IOClient)result.AsyncState;
int bytesRead = client.Socket.EndReceive(result);
if (bytesRead != 0)
{
lock (clientLock)
{
StringBuilder sb = new StringBuilder();
if (client.IncompleatePacket.Length > 0)
{
sb = client.IncompleatePacket;
}
foreach (byte CurrentByte in client.ReadBuffer)
{
if (CurrentByte == EmptyByte)
{
continue;
}
if (CurrentByte == PacketTerminator)
{
PacketReceived(client, sb.ToString());
bytesReceived += sb.ToString().Length;
BroadcastPacket(sb.ToString(), client);
sb = new StringBuilder();
client.IncompleatePacket = new StringBuilder();
}
if (CurrentByte != EmptyByte && CurrentByte != PacketTerminator)
{
sb.Append((char)CurrentByte);
}
}
if (sb.Length > 0)
{
client.IncompleatePacket.Append(sb.ToString());
}
}
client.Socket.BeginReceive(client.ReadBuffer, 0, client.ReadBuffer.Length, SocketFlags.None,
new AsyncCallback(PacketReceivedCallback), client);
}
else
{
CloseConnection(client);
}
}
The way I see it is I'll have a collection, possibly a List<string> , in my IOClient class. Instead of trying to split the packets up in the callback I'll call MyStringList.Add(Encoding.ASCII.GetString(client.ReadBuffer,0,bytesRead));
Then my SmartThreadPool will sit and take a piece of data from that list and strip out the individual packets more or less like I'm doing in the above snippet... Is that more or less how its done?
And then would you mind telling me how I make the smart thread pool do this in the most effiecient manner? Like i told JSOP, I've used SmartThreadPool before, but not quite like this...
Thanks bud
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hi Harvey,
I haven't done massive TCP/IP on Windows yet, however I looked at your code and have two remarks:
1.
your PacketReceivedCallback() method is asynchronous to everything else in your app, so it is bound to run on a separate thread; earlier experiments like these[^] have convinced me they always run on a Thread from the one and only ThreadPool in .NET
Of course you could modify the scheme in such a way that PacketReceived() rather than processing the packet, just puts it in some queue, then signals its waiter, which could be another Thread, a regular one, a ThreadPool one, or one from any other fancy threadpool you choose. That could be advantageous when your machine has several processors, and I mean more than 2 here. On a 1- or 2-core machine it probably isn't worth the trouble.
2.
Your code is silently converting incoming bytes into chars into strings. That may be fine, however in general TCP/IP transports binary data. It is up to the application layers to decide what that data represents. You probably are aware of all this, but I wanted to say it explicitly just in case.
|
|
|
|
|
Hey Luc
Thanks for your comments...
Luc Pattyn wrote: 2.
Your code is silently converting incoming bytes into chars into strings. That may be fine, however in general TCP/IP transports binary data. It is up to the application layers to decide what that data represents. You probably are aware of all this, but I wanted to say it explicitly just in case.
Yup, I'm just playing around with some proof of concept code before I build the real deal
Me and my stepbrother just discussed this and I think I may have an idea.
The receiving of data happens in the .net ThreadPool as you mentioned and then sends the result back via a callback.
At this point I'll shove the entire piece of data into a collection of some type that resides in my client object. I'll also signal the main processing thread of this event.
This thread will be responsible for checking if a work item for the specific client has been started(in which case it will be ignored cause the thread in progress will process it) or not. If not it will queue the work item in the thread pool.
These work items will then strip the packets from the clients raw data and trigger events in my code that i can handle appropriately.
What you think? do-able?
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
sounds doable.
caveat:
Harvey Saayman wrote: I'll shove the entire piece of data into a collection of some type
that collection will be operated upon by at least two threads (the ThreadPool thread as the only producer, and your nre new thread as the only consumer), so it will need thread-safety precautions, e.g. a Lock. So in the end any of the client threads could potentially block the PacketReceivedCallback thread.
BTW: There also is a delicate way of doing this without a lock, but it is rather hard to get it absolutely safe. You shouldn't even try it before you really need to get rid of all locks.
ADDED:
The official ThreadPool has a particular behavior in that it manages how many threads it is going to use for a particular set of "jobs" (i.e. QueueUserWorkItem() calls). It will dynamically alter the number of threads, but only at a limited pace, something like "no more than 1 extra thread per half second". Which really means work items may get a long delay before they start. That might upset your clever threading scheme and make it look like pretty slow (and even worse than a simple non-threaded approach) at first. One way around it is not to use the ThreadPool, i.e. using real explicit Threads.
BTW: I haven't seen it documented, however I have a test app to prove it; no article yet (that is planned for next year).
modified on Friday, December 18, 2009 2:03 PM
|
|
|
|
|
Thanks bud
Yea, I realize that I'd have to use lock on the said raw data collection... I think I really need to keep the locking to a minimum though. Like when a worker thread from the data processing pool gets a new piece of data, only lock while making a copy to work with and then remove it from the raw data collection so that I dont hold it up so long and the data receiving thread sits and waits anyway...
I was actually reading up on lock and Monitor today, i was so frustrated with this problem i found one mother of an article on threading that explained a whole lot I wasn't even aware of.
I cant wait to try this out, I really hope it works. When I do get it to work I'll be writing an article myself cause I haven't seen any high load .Net TCP server code on the web.
Thanks once again
My girlfriend says in the background: Oh my gosh you guys should learn when to switch off
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:16am.
|
|
|
|