|
Friend,
No one has so much free time to write your code. If you want there are people here [^]who would write a loads of code for you.
I would suggest you to buy a book and start reading. That would help you in a longer run.
There are tons of tutorials, articles on internet available for it too.
You can also take a look here [^]to get started.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
You should buy a basic book and read it. You should forget this project ( I assume it's not paid work, you're not that dishonest, right ? ), and just work through a book to learn these sort of basics.
Then when you know enough to write your own code, if you get stuck, you can ask in the ASP.NET forum
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
I wrote a C# application that uses several DLLs. The application will be used by about 20 people over a network. I would like to install the application on the server - and have everyone run it with a mapped shortcut. It seems after googling it - it isn't possible - which seems very odd to me.
I have installed the program on the server, added the assemblies to the sever GAC. When I am logged into the server as a admin user I can run it just fine.
However when I try to run it from my local client machine, I get a security issue. It seems that the program cannot access the "network structure" (which it needs to be able to do in order to connect to a DB).
I checked user permissions and they are correct (full read/write). I also lowered my intranet trust level. What am I missing?
Thanks
Marc
|
|
|
|
|
Consider using ClickOnce deployment.
only two letters away from being an asset
|
|
|
|
|
It is possible but it means altering the code access security policy on every client machine.
As has already been suggested, it's easier and safer to use click once so each client has a copy on their machine that can automatically update from the server.
|
|
|
|
|
How do I manage the updates?
Any good references for on how to develop updates to an application? I usually just recompile and overwrite - but I am sure there is a better way.
Thanks
|
|
|
|
|
There's loads of references and tutorials around. MSDN[^] is a good place to start.
|
|
|
|
|
|
Hey Marc
I've had similar problems compiling my application for .Net 3.5, I found out that it was a bug in the framework and .Net 3.5 SP1 fixed it for me.
Hope this helps
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 am developing a C# application.
I have to generate a network diagram in c#,how should i do it???
is there any plugin for it??
Please paste some source code
|
|
|
|
|
Does this[^] helps?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
liveinweb2.0 wrote: Please paste some source code
That's a bit insane. You should read the guide on how to ask questions. C# help is what every subject line would be in here, if it was a good header.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
What diagram do you want to generate?Here is an example, hope will help you.
using System;
using System.IO;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace Insight_cs.WebCharts
{
public class PieChart
{
public PieChart()
{
}
public void Render(string title, string subTitle, int width, int height, DataSet chartData, Stream target)
{
const int SIDE_LENGTH = 400;
const int PIE_DIAMETER = 200;
DataTable dt = chartData.Tables[0];
float sumData = 0;
foreach(DataRow dr in dt.Rows)
{
sumData += Convert.ToSingle(dr[1]);
}
Bitmap bm = new Bitmap(width,height);
Graphics g = Graphics.FromImage(bm);
g.ScaleTransform((Convert.ToSingle(width))/SIDE_LENGTH,(Convert.ToSingle(height))/SIDE_LENGTH);
g.SmoothingMode = SmoothingMode.Default;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.Clear(Color.White);
g.DrawRectangle(Pens.Black,0,0,SIDE_LENGTH-1,SIDE_LENGTH-1);
g.DrawString(title,new Font("Tahoma",24),Brushes.Black,new PointF(5,5));
g.DrawString(subTitle,new Font("Tahoma",14),Brushes.Black,new PointF(7,35));
float curAngle = 0;
float totalAngle = 0;
for(int i=0;i<dt.Rows.Count;i++)
{
curAngle = Convert.ToSingle(dt.Rows[i][1]) / sumData * 360;
g.FillPie(new SolidBrush(ChartUtil.GetChartItemColor(i)),100,65,PIE_DIAMETER,PIE_DIAMETER,totalAngle,curAngle);
g.DrawPie(Pens.Black,100,65,PIE_DIAMETER,PIE_DIAMETER,totalAngle,curAngle);
totalAngle += curAngle;
}
g.DrawRectangle(Pens.Black,200,300,199,99);
g.DrawString("Legend",new Font("Tahoma",12,FontStyle.Bold),Brushes.Black,new PointF(200,300));
PointF boxOrigin = new PointF(210,330);
PointF textOrigin = new PointF(235,326);
float percent = 0;
for(int i=0;i<dt.Rows.Count;i++)
{
g.FillRectangle(new SolidBrush(ChartUtil.GetChartItemColor(i)),boxOrigin.X,boxOrigin.Y,20,10);
g.DrawRectangle(Pens.Black,boxOrigin.X,boxOrigin.Y,20,10);
percent = Convert.ToSingle(dt.Rows[i][1]) / sumData * 100;
g.DrawString(dt.Rows[i][0].ToString() + " - " + dt.Rows[i][1].ToString() + " (" + percent.ToString("0") + "%)",new Font("Tahoma",10),Brushes.Black,textOrigin);
boxOrigin.Y += 15;
textOrigin.Y += 15;
}
bm.Save(target, ImageFormat.Gif);
bm.Dispose();
g.Dispose();
}
}
public class BarChart
{
public BarChart()
{
}
public void Render(string title, string subTitle, int width, int height, DataSet chartData, Stream target)
{
const int SIDE_LENGTH = 400;
const int CHART_TOP = 75;
const int CHART_HEIGHT = 200;
const int CHART_LEFT = 50;
const int CHART_WIDTH = 300;
DataTable dt = chartData.Tables[0];
float highPoint = 0;
foreach(DataRow dr in dt.Rows)
{
if(highPoint<Convert.ToSingle(dr[1]))
{
highPoint = Convert.ToSingle(dr[1]);
}
}
Bitmap bm = new Bitmap(width,height);
Graphics g = Graphics.FromImage(bm);
g.ScaleTransform((Convert.ToSingle(width))/SIDE_LENGTH,(Convert.ToSingle(height))/SIDE_LENGTH);
g.SmoothingMode = SmoothingMode.Default;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.Clear(Color.White);
g.DrawRectangle(Pens.Black,0,0,SIDE_LENGTH-1,SIDE_LENGTH-1);
g.DrawString(title,new Font("Tahoma",24),Brushes.Black,new PointF(5,5));
g.DrawString(subTitle,new Font("Tahoma",14),Brushes.Black,new PointF(7,35));
float barWidth = CHART_WIDTH / (dt.Rows.Count * 2);
PointF barOrigin = new PointF(CHART_LEFT + (barWidth / 2),0);
float barHeight = dt.Rows.Count;
for(int i=0;i<dt.Rows.Count;i++)
{
barHeight = Convert.ToSingle(dt.Rows[i][1]) * 200 / highPoint;
barOrigin.Y = CHART_TOP + CHART_HEIGHT - barHeight;
g.FillRectangle(new SolidBrush(ChartUtil.GetChartItemColor(i)),barOrigin.X,barOrigin.Y,barWidth,barHeight);
barOrigin.X = barOrigin.X + (barWidth * 2);
}
g.DrawLine(new Pen(Color.Black,2),new Point(CHART_LEFT,CHART_TOP),new Point(CHART_LEFT,CHART_TOP + CHART_HEIGHT));
g.DrawLine(new Pen(Color.Black,2),new Point(CHART_LEFT,CHART_TOP + CHART_HEIGHT),new Point(CHART_LEFT + CHART_WIDTH,CHART_TOP + CHART_HEIGHT));
g.DrawRectangle(new Pen(Color.Black,1),200,300,199,99);
g.DrawString("Legend",new Font("Tahoma",12,FontStyle.Bold),Brushes.Black,new PointF(200,300));
PointF boxOrigin = new PointF(210,330);
PointF textOrigin = new PointF(235,326);
for(int i=0;i<dt.Rows.Count;i++)
{
g.FillRectangle(new SolidBrush(ChartUtil.GetChartItemColor(i)),boxOrigin.X,boxOrigin.Y,20,10);
g.DrawRectangle(Pens.Black,boxOrigin.X,boxOrigin.Y,20,10);
g.DrawString(dt.Rows[i][0].ToString() + " - " + dt.Rows[i][1].ToString(),new Font("Tahoma",10),Brushes.Black,textOrigin);
boxOrigin.Y += 15;
textOrigin.Y += 15;
}
bm.Save(target, ImageFormat.Gif);
bm.Dispose();
g.Dispose();
}
}
public class ChartUtil
{
public ChartUtil()
{
}
public static Color GetChartItemColor(int itemIndex)
{
Color selectedColor;
switch(itemIndex)
{
case 0:
selectedColor = Color.Blue;
break;
case 1:
selectedColor = Color.Red;
break;
case 2:
selectedColor = Color.Yellow;
break;
case 3:
selectedColor = Color.Purple;
break;
default:
selectedColor = Color.Green;
break;
}
return selectedColor;
}
}
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 21:58pm.
|
|
|
|
|
hello every body
i m very glad that the team of code project help me solving my problem i wish in future it will be continue.....
|
|
|
|
|
can anyone plz suggest me a code to record and play a file of mp4 or avi format......
|
|
|
|
|
If you Google for c# play avi or c# play mp4 you will get loads and loads of hits. Some have code, some only descriptions of how to do it.
Have a go yourself.
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.”
|
|
|
|
|
Hi, I'm currently using Visual c# 2008 express edition. I'm trying to save an image over a file with the same file name. When it attempts to do this is bombs out because it says either it's a generic GDI+ error or the process is already in use. This makes perfect sense why it would throw those errors, but how can I overwrite the file so that it doesn't give me this problem. I've tried Opening a file stream around it then closeing it. useing the bmpPicture.Dispose(), and GC.Collect(), none of those work.Is there something else I could try? or perhaps something I'm doing wrong?
here is a snippet of my code:
<br />
private void SaveFile()<br />
{<br />
bmpPicture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);<br />
gfxScreenShot = Graphics.FromImage(bmpPicture);<br />
gfxScreenShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y + 25, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);<br />
bmpPicture.Save(FilePath, ImageFormat.Bmp);
}<br />
|
|
|
|
|
Hi,
a likely cause for bmpPicture.Save(FilePath, ImageFormat.Bmp); to throw an exception is the file is locked "by another process", which typically means your own process (or maybe some other) has the file open. Typically you would have loaded it either with Image.FromFile() or PictureBox.Load()
Images loaded that way keep their file open for as long as they exist. There are three remedies:
1. quick and dirty
get the picture, make sure you don't need it anymore, call dispose:
Image img=PictureBox.Image;
PictureBox.Image=null;
img.Dispose();
img=null;
2. quick and dirty
when you initially get the image, make a copy and throw away the original:
Bitmap bm2=null;
{
Bitmap bm1=Image.FromFile("image.jpeg");
bm2=new Bitmap(bm1);
bm1.Dispose();
}
3. clean and easy
don't use Image.FromFile nor PictureBox.Load; instead use Image.FromStream
Bitmap bm=Image.FromStream(File.OpenRead("image.jpeg"));
[EDIT] Bug fixed in my other reply ]/EDIT]
modified on Tuesday, September 8, 2009 1:53 PM
|
|
|
|
|
vandel212 wrote: GC.Collect()
Is that really necessary? It usually isn't..
|
|
|
|
|
Sorry, the third option ("clean and easy") wasn't entirely correct, as the stream does not get closed/disposed of. Here is a better way:
Bitmap bm=null;
using (FileStream stream=File.OpenRead("image.jpeg")) {
bm=Image.FromStream(stream);
}
So in the end, there isn't a single-line solution.
|
|
|
|
|
My goal is to preform various image processing tasks on an image taken by a webcam...
After googling, and trying different examples... I failed to find a simple solution. Example code is either overly complicated or it only supports WIA webcams only.
I like how "Motion Detection Algorithms[^]" works (for stills) however the code is overly complicated for the task I want to preform with a mind blowing 48 .cs files...
I tried trimming down but ended up with 26 files of code I have no clue on...
All I want to do is take a still or two every five minutes... Any suggestions on this simple sounding yet strangely complicated task?
|
|
|
|
|
My problem is simply that I am trying to make a simple command line RSA encryption program and was trying out the number 123^17 and don't seem to be able to store the value anywhere because of its size. How can I work with numbers that are bigger than 10^20?
|
|
|
|
|
integers or reals?
search CodeProject (or google) for either BigInt or BigNumber, and you will find several classes that take care of it, not all at the same quality level though.
This[^] one you may like, no guarantees.
C# 4.0 has a BigInt class built-in, I haven't had a look yet.
|
|
|
|
|
Try the System.Decimal type which can hold values from ±1.0 × 10^−28 to ±7.9 × 10^28 with precision of up to 28-29 significant digits.
|
|
|
|
|
I've found that fixed-length number structs are usually better for relatively short numbers. Looks like 128bit should do in your case - and that's easy to make (just put 2 ulongs together in a struct, all operations except division and modulo are easy to extend)
|
|
|
|
|