|
If your willing to pay then MSI Factory[^] is a good tool
Otherwise you could look into WIX[^] (lots of effort) or what is available in Visual Studio[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Make a Setup and Deployment to make installer package.. In that way you can have in control panel too.
|
|
|
|
|
Thanks dude... its worked ... One more thing how to create a desktop shortcut for inatalled location using this deployment...
|
|
|
|
|
Don't get too used to the Setup and Deployment project. It won't be there in the next Visual Studio.
I highly recommend you start using InstallShield Express or some other packaging tool, InnoSetup, Wise for Windows Installer, WIX, ..., in its place.
|
|
|
|
|
Hello i am using visual studio 2010. I am currently working on a project and i am stuck at the part where i must effectively remove the background of an image. I am working on images like flowers.
i am now currently using filters to filter out the background. however different image has different color values and i have no idea how to remove background for different images.
i use the follow codings:
<br />
ColorFiltering filter = new ColorFiltering();<br />
<br />
filter.Red = new IntRange(30, 100);<br />
filter.Green = new IntRange(0, 255);<br />
filter.Blue = new IntRange(0, 255);<br />
<br />
filter.ApplyInPlace(cropImage);
and every time i want to filter the image i have to change the filter values myself manually is there any way i can do it without doing it manually?
|
|
|
|
|
WOAH!!! Yesterday you couldn't do the basic task of getting MIN and MAX values for an int array and now your on to image processing!!! You must have read alot of books last night
I don't know about this ColorFiltering thing you got going on but I guess you need to calculate BG colour and use that.
Is the BG colour always going to be a solid one colour? If so you could make the assumption that the very first pixel is part of the BG, Get its colour and use that as the colour to filter.
I guess you are also assuming that the BG colour will not also be used in the parts of the image you want to keep?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
oh i manage to find out how to do the min and max of course i move on. and by the way i am very new to c# programming and my project requires me to do that so i have no choice pls understand if i post qns that might seems easy to you but it might be hard for me. I felt helpless so i turn to forum.
the background consist of many different color not one solid color.
All i know was keeping the color i want using filter(code) as shown above however i have to manually set the color. is there anyway i can do it so that it can automatic detect the colors i want to keep?
|
|
|
|
|
Its not easy for me either, I certainly don't know how to do what you need. But you just seem to be very deep in with so little knowledge.
There is a saying on my planet... "Don't jump in the deep end if you cant swim (or if your wearing iron boots without a blue tunic on)"
One tip - Code cannot guess what you what (not with 100% guarantee at least) basically you need to tell it one way or another what color(s) you want to keep.
How do you determine which colour(s) you want to keep?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
"Removing the background" is secondary to what you need to know for this. You need to do some research on edge detection algorithms in order to do this properly.
I can't really help you with that, but I think that will help you along the way.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi,
We're trying to figure out validation in the mvvm doing validation in the business logic or model.
I've implemented the validate by exception type in our business logic - a simplified diagram can be found here:
http://util.gubbl.com/imageupload/validate_by_exception.gif[^]
If we've got lot's of inputs that are independent of each other, there is no problem, the exception is thrown, the textbox catches it an marks it's borders red for each wrong input. However, when we've got dependent values we're in trouble.
e.g.
- Value1 and Value2 in the model must not be the same, so we've got a validate function in each of those looking for the equals value and throw an exception if that happens
- now, if we set Value1 to 0 and Value2 to 1 everything is fine
- Value1 gets set in the GUI to 1 --> this one gets marked red, because the validation of the other values is not triggered, so Value2 in the GUI is not marked faulty
- Value2 gets set to 2 in the GUI, now we've reached a valid state, but only Value2 gets validated, so Value1 still is marked as faulty
Is there a common pattern to solve that issue? we don't want to introduce a dependency in the GUI between the two textboxes, because this logic should only be present in the business logic layer.
Instead of implementing the validate by exception one could also implement the IDataErrorInfo interface, but the problem still exists, there is no way to force depending values to validate their values again, at least none that i can see
Any help is appreciated
cheers,
manni
modified on Thursday, November 11, 2010 3:08 AM
|
|
|
|
|
I have some bitmap.
I know that the bitmap format is PixelFormat.FormatXXXXXXbppRgb ==> but i want dynamically to calculate the size of each pixel.
For example ==> if the bitmap pixel format is Format24bppRgb i want to calculate that the R/G/B range is between 0 to 255.
So, i don't know how to get the information that in case of Format24bppRgb the R/G/B bit size is 3.
or that in the format is Format32bppRgb that the R/G/B bit size is 4.
P.S: i don't want to use the code
BitmapData bmDateFrame = bitmap.LockBits(....)
Int32 picPixelBit = bmDateFrame.Stride / bitmap.Width;
|
|
|
|
|
There doesn't appear to be an easy way to do this from what I can tell. but looking at the PixelFormat Enumeration[^] it is only going to be 8 or 16 bits per pixel so a small switch statement should do the job.
The bigger question is why do you need to know this? There is most likely a better way as I have never needed to know this information.
|
|
|
|
|
The size of each pixel depends only on the pixel format. You can see here[^] the lenght for each pixel format and how many bits are used for each A/R/G/B component.
|
|
|
|
|
please provide me some code to generate toolstrip like glossy sky blue color for my form's back color. lots of third party control having that color. so i just need to know how to generate that type of gradient color.help me with sample code. thanks.
tbhattacharjee
|
|
|
|
|
I am trying to write a method which will get triggered whenever there is a display settings change like resolution change, dual monitor connected and enabled etc. For this I am relying on SystemEvents.DisplaySettingsChanged event.
In the event handler, I am doing the following to detect the active display devices (got this in google search).
[StructLayout(LayoutKind.Sequential)]
public struct DISPLAY_DEVICE
{
public int cb;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string DeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceString;
public int StateFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceKey;
public DISPLAY_DEVICE(int flags)
{
cb = 0;
StateFlags = flags;
DeviceName = new string((char)32, 32);
DeviceString = new string((char)32, 128);
DeviceID = new string((char)32, 128);
DeviceKey = new string((char)32, 128);
cb = Marshal.SizeOf(this);
}
}
[DllImport("user32.dll")]
public static extern bool EnumDisplayDevices(
string lpDevice, int iDevNum,
ref DISPLAY_DEVICE lpDisplayDevice, int dwFlags);
const int DISPLAY_DEVICE_ACTIVE = 0x01;
const int DISPLAY_DEVICE_PRIMARY_DEVICE = 0x04;
foreach (Screen screen in Screen.AllScreens)
{
LogMsg("Display Device:" + screen.DeviceName + " " + "BPP:" + screen.BitsPerPixel.ToString() + " " + "Width:" + screen.Bounds.Width.ToString() + " " + "Height:" + screen.Bounds.Height.ToString());
DISPLAY_DEVICE monitor = new DISPLAY_DEVICE(0);
monitor.cb = System.Runtime.InteropServices.Marshal.SizeOf(monitor);
LogMsg("Cb:" + monitor.cb.ToString());
EnumDisplayDevices(screen.DeviceName, 0, ref monitor, 0);
LogMsg("State flags:" + monitor.StateFlags.ToString());
if ((monitor.StateFlags & DISPLAY_DEVICE_ACTIVE) == 0x01)
{
LogMsg("Display Device is active");
}
if ((monitor.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) == 0x04)
{
LogMsg("Display Device is primary one");
}
}
What I observed is, the StateFlags is always zero. Then how to check for the active display device?
Is there any other way to detect all the active physical display devices? Any idea whats wrong in the above method?
Also, in the event handler, how to know what caused this event? What I mean is, whether the resolution caused this event or changing to dual monitor caused this event?
Any help or pointer is appreciated.
|
|
|
|
|
This[^] will signal some of the changes you're interested in. When a second monitor is enabled/disabled showing the same image as the primary monitor, I don't expect it to fire though.
|
|
|
|
|
In this line:
EnumDisplayDevices(screen.DeviceName, 0, ref monitor, 0);
You are always passing 0 to iDevNum parameter, so you are always getting the same data. See remarks here[^]. Anyhow, I don't know why you need to use the EnumDisplayDevices function. If you want your primary screen you have it in System.Windows.Forms.Screen.PrimaryScreen, and if you want all the active screens you have them in System.Windows.Forms.Screen.AllScreens. To know what is the reason of the event you can get the configuration at the beginning and compare with it when the event is raised.
|
|
|
|
|
I'm working on one of my first client/server applications. Now my idea is the clients will checkin to the server every 30-60 seconds. When the agent first contacts the server, the server will query the database for "pending actions" (that are placed in there by a control center application), and return those to the client.
So:
Client connects to server (every 60 seconds or so)
Server queries database for actions
Server returns action
Client performs action
Client returns data to server
Server stores updated data in database
Now what I'm doing is passing a serialized object:
[Serializable]
public class Operations
{
[Flags]
public enum Tasks
{
NULL = 0,
CHECKIN = 1,
UPDATE_SERVICES = 2,
UPDATE_PROCESSES = 3,
UPDATE_SOFTWARE = 4,
UPDATE_PRINTERS = 5,
UPDATE_DEVICES = 6,
UPDATE_DRIVES = 7,
UPDATE_SYSTEMBOARD = 8,
UPDATE_COMPUTERINFO = 9,
GET_SERVICES = 10,
GET_PROCESSES = 11,
GET_SOFTWARE = 12,
GET_PRINTERS = 13,
GET_DEVICES = 14,
GET_DRIVES = 15,
GET_SYSTEMBOARD = 16,
GET_COMPUTERINFO = 17,
GET_ALL_DATA = 18,
REGISTER_AGENT = 19
}
public int AgentId { get; set; }
public int AgentLocation { get; set; }
public string Netbios { get; set; }
public Tasks Task { get; set; }
public ComputerInfo ComputerInfo { get; set; }
public SystemBoard SystemBoard { get; set; }
public Processes[] Processes { get; set; }
public IPAddress[] IpAddresses { get; set; }
public Services[] Services { get; set; }
public DiskDrive[] DiskDrives { get; set; }
}
So the client has access to this info as well. So what it does it populate that information. (If the client sets the TASK to UPDATE_SERVICES the client only populates the Services[] array.. not all of the information is populated each time fyi)
Now before I sent or receive I Serialize and Deserialize each side:
IFormatter formatter = new BinaryFormatter();
Operations[] ops (Operations[])formatter.Deserialize(state.ms);
BTW this works fine.. just wondering if its the CORRECT or a GOOD way of doing it.
|
|
|
|
|
If you use Flags attribute for the enum, then the values are absolutely wrong. See this[^]. I think you should remove the Flags attribute on your enum.
Regarding to your question, well, you have not given us much information but, at a firt glance, I don't like the architecture you describe. It is not versatile. Any possible future change will cause a lot of compatibility problems.
|
|
|
|
|
Ill read the Flags attribute.
I have to be able to send the client agents commands to perform which will return data to the server. From there I plan to have a control panel application that will view that information and also be able to send commands to the agents.
Now the agents could be on different networks. Which means that the server cannot create a direct connection to the agents due to them possibly being behind a firewall. So the agent of course has to be the one that first connects to the server.
I guess what I'm asking is if you were creating something like this how would you lay it out? I created the Operations class because it can hold the information, but it doesn't mean that ALL the information will be populated.
Sorry if I'm not explaining it very well.. lets me try it this way:
Client Agent connects to server
Server Accepts connection and queries database for pending actions:
Socket old = iar.AsyncState as Socket;
Socket client = old.EndAccept(iar);
Operations[] ops = AgentActions.GetPendingOperations(1);
MemoryStream ms = new MemoryStream();
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(ms, ops);
client.BeginSend(ms.ToArray(), 0, (int)ms.Length, 0, new AsyncCallBack(SendCallback), client);
The pending actions table is just the AgentId and the TaskId (which matches the ENUM).
So at this point the client is receiving information from the server about what actions it should perform:
int bytesRead = client.EndReceive(iar);
if (bytesRead > 0)
{
state.ms.Write(state.buffer, 0, bytesRead);
if (bytesRead == StateObject.BufferSize)
client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReceiveCallback), state);
else
{
state.ms.Seek(0, SeekOrigin.Begin);
IFormatter formatter = new BinaryFormatter();
Operations[] ops = (Operations[])formatter.Deserialize(state.ms);
}
}
Here is my state object:
public class StateObject
{
public Socket workSocket = null;
public const int BufferSize = 1024;
public byte[] buffer = new byte[BufferSize];
public MemoryStream ms = new MemoryStream();
}
I hope that helps in explaining what I'm trying to do. Like I said it works. I can send the Operations array back and forth and insert it in the DB and what not but I'm just wondering if there is another way I should be doing this.
|
|
|
|
|
Hmmm, I don't know... I don't like it. I still think this architecture is too rigid. Your current implementation is too concrete and the communication layer depends too much on the concrete types you are using. If you had to add some extra features to the Operations in the future you would be in trouble. Your communication layer should be much more abstract. See SOLID principles[^] for object oriented design.
However, if you anticipate that the functional requirements for this application will not change nor grow in the future, then what you have done might be enough.
|
|
|
|
|
I'll read what you sent and see if I can figure out a good way to change it differently. I mean I have to pass a custom object between the agent and server. That Operations object is a custom object. So if I ever did updates inthe future I would just add it, and then the server would be updated and agents as well.
|
|
|
|
|
Yep, I know what you mean. My very first client-server solution architecture was really very similar to yours. It was simple and worked very well, but as requirements grew up the maintenance became a pain in the neck. Every change required a new server version and a new client version, and every new piece of software had to be deployed everywhere within the less period of time, becouse there were usually compatibility issues between the new versions and the old ones, and many other headaches.
My last client-server architecture is absolutely different. The communication layer is stable, I mean, no matter what information comes and goes, this layer can handle it without any change. Both, client and server layers can be easily extended: there is no need to recompile them. Still more, there is no need to stop them. Each one of these two sides is a simple application which only has to load or unload plugins. I don't even have to change the database structure. When there is a problem with a plugin I only have to change, recompile and replace its library. Sure, the associated module will not be available during the change, but the rest of the application will keep working.
|
|
|
|
|
I think I see what your saying but I just can't wrap my head around what I should do. I mean I have to pass a certain data structure because this information will be getting stored in a database. So the columns have to match up some way or another.
Unless I'm making the clients pass the SQL commands and parameters along with the values to the server, it only seems like if an update was to happen it would have to update the server and clients.
|
|
|
|
|
You didn't happen to write an article on this did you? I would like to see similiar code so I can better understand what I need to do. As I sit right now I am unable to come up with a better solution than passing my custom object (differnet compiled dll) back and forth. The client sends the custom object, the server reads it, and depending on which task was set it calls a different method to insert the data (or update) into a SQL database.
|
|
|
|
|