|
Hi fellas,
I wanna know what is the best pattern to my web application to use LINQ to SQL in project.
|
|
|
|
|
|
Is that a design pattern now? And I've been using it for ages!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
You are going at things completely backwards. First you figure out what problem you are trying to solve. Then you decide what patterns provide the best solution for that problem. Then you decide what tools to use to implement those patterns.
The way you are doing things is like asking "What is the best vehicle to buy if I want it to be blue?" It may work out fine, but you may end up trying to drive a blue boat through desert sand or a blue motorcycle across the ocean floor.
|
|
|
|
|
The Avoid-Like-The-Plague pattern.
|
|
|
|
|
Dear Coders.
My app requires the display of simple animations using a picture box or custom control.
Now, could I create an animated GIF and load this into the control, or should I create each individual bitmat and load them one after the other, re-creating the animation?
I do not want to create a 'video' and load that, I need full control over the animation(s).
Thank you
Steve
|
|
|
|
|
An easy way is to override on paint and then use double buffering to paint your animations. The best way is to get a background image and then draw sprites on top of the image rather than trying to let GDI+ render an entire frame. It is painfully slow.
|
|
|
|
|
you could do it either way. Animated GIF has the advantage of being simple, once you have the one file.
CodeProject holds an article (with NGIF in the title) that shows one way to turn a series of images into an animated GIF.
|
|
|
|
|
Thank you, I will have a look!
Steve
|
|
|
|
|
You're welcome.
|
|
|
|
|
I have some static method that i call from the main code.
The method return some object that i allocate in the start of the method - and in the method body i doing some operation on this object and at the end i return it.
Its look like this:
static object locker = new object();
public static SomeObject f(SomeObject org)
{
SomeObject o
lock( locker )
{
o = org.Clone();
Do something on o;
}
return o;
}
I dont know why - but i get the "exception Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
If i lock the scop - how other thread got in ?
Someone can help here ?
|
|
|
|
|
I see nothing that is inherently wrong.
Check all the details of the exception, watch the line number, investigate the line of code.
If all else fails, show us those details and the actual code.
|
|
|
|
|
try:
public static SomeObject Foo(SomeObject someObject){
SomeObject result = null;
if(someObject != null){
lock(someObject){
try{
result = (SomeObject)someObject.Clone();
}
catch(Exception e1){
}
}
}
return result;
}
|
|
|
|
|
Hi there.
I have made a user control which does something with a selected listbox.
The user selects a listbox to handle from the properties menu of the usercontrol
[IMG]http://img690.imageshack.us/img690/6100/listbox.jpg[/IMG]
I used this code to get the listbox at the property window.
<pre>
private ListBox box;
public ListBox _ListBox
{
get
{
return box;
}
set
{
box = value;
}
}
</pre>
well.. the problem is that the user can change the selected listbox's (from property menu) properties, which i realy don't like.. so how can i in any ways avoid that? (Remove the properties or disable the "+")
Thank you
|
|
|
|
|
I have hardly done any such thing, however I think you should read this[^]; the BrowsableAttribute looks promising.
|
|
|
|
|
Snap!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Attributes are your friend here.
Look up the Browsable and DesignTimeVisibility attributes.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
sry but i can't seem to find anything about attributes. Can you help me a little more?
|
|
|
|
|
Here is a link to the Browsable[^] attribute.
You can look up the DesignTimeVisibleAttribute for yourself.
You will never be a programmer if you cannot use a search engine.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
well said.
and snap to you too.
|
|
|
|
|
Yeah i know
Got the deal with the Browsable(false) thing. but it is not what i need. The programmer should be able to see the "box" from properties. All i want to is remove the little + sign right to the "box" or whatever i named it
Do I misunderstand anything or are we at another point now?
|
|
|
|
|
and what would be the use of seeing the property without being able to expand it and change its properties?
|
|
|
|
|
this is quite hard xD
http://img811.imageshack.us/img811/3831/navn.jpg
i made a little guide on how i wan't it to be. Hope that it is easier to understand now
|
|
|
|
|
wow. great way of illustrating your question!
I don't know the answer. I suspect your "box" property is of type ListBox, which should not be, as you don't want to manipulate a ListBox, all you want to do is select one of several names (of ListBoxes), so it should behave as a ComboBox (but not offer access to the properties of a ComboBox!).
That is similar as say choosing a color where you can choose from a limited set of colors. Must be provided somehow.
|
|
|
|
|
tyty..
It's because i let's say want to add an item to a listbox in a program. In that case i would make a void like this.
public static void Add(listBox l, string s)
{
l.Items.Add(s);
}
And before the program knows what listbox it is to add the string i must be setted from designer code as it is a component. Thats what i want -.-
i could of course just do it like this.
myComponent.Box = listBox1
but i wan't to make it easy for beginners.
|
|
|
|