|
if you dont know the answer then shut up man..
i guess u can answer the following doubts...
1. plese help me to write code for adding two integers..
2. concatenate string "hello" and "world"..
i am expecting your valuable help asap
thankyou
|
|
|
|
|
I'm sincerely sorry mister Yesu....
You should be the one thinking about your questions, not just wasting your energy blaming other which didn't give the anwser you expected.
I gave you the anwsers on your questions, not really seriously, but nobody else could've done it better, because you didn't explain what you really wanted to do.
Again: if you would like some good anwsers, then please make sense with asking questions.
the anwser on question 2 is to hard for me, I really don't know how to do this .... but the two integers isn't really tough:
int myFirstNumberWhichIsFarToLong, secondNr;
myFirstNumberWhichIsFarToLong = 4;
secondNr = 5;
int outcome = 0;
outcome = myFirstNumberWhichIsFarToLong * secondNr;
for(int i = 0; i < myFirstNumberWhichIsFarToLong - 2; i++)
{
outcome -= (myFirstNumberWhichIsFarToLang * secondNr);
}
outcome += myFirstNumberWhichIsFarToLong;
Console.out.WriteLine("oucome should be 9: " + outcome);
This will only work when the first integer is 2 or higher and the second is 0 or higher.
Good luck
|
|
|
|
|
|
Hi guys,
Hi guys, I am implementing a download cache engine for my application. When I read that the file's LastModified is not newer than my local file, I do not download the file: When I first downloaded the file, I set the file date to the LastModified date from the response. If I request to download the same file in same session in the application again, it takes a long time in the HttpWebRequest's GetResponse() or may fail eventually in timeout.
I did close the response before proceeding on. And I set the HttpWebRequest's KeepAlive to false.
Any solutions or workaround?
Thank you in advance!
|
|
|
|
|
Sounds like your clearing up properly, but GetResponse() will hang if you don't dispose of the stream on subsequent calls.
Regards,
Rob Philpott.
|
|
|
|
|
hi guys i am using a c# class file in asp.net this class file is rsacryptography class file for encoding and decoding
here is the class file
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Collections;
namespace Cryptography
{
public class AsymmetricCryptography
{
// Fields
private string pk;
private string prk;
// Methods
public AsymmetricCryptography()
{
RSACryptoServiceProvider provider = new RSACryptoServiceProvider(0x400);
this.prk = provider.ToXmlString(true);
this.pk = provider.ToXmlString(false);
}
public static string Decript(string Decript_Text, string Private_Key)
{
string str = Decript_Text;
string str2 = "";
string xmlString = Private_Key;
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
// RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
string str4 = "";
Queue queue = new Queue();
while (str.Length != 0)
{
if (provider.KeySize == 0x400)
{
str4 = str.Substring(0, str.IndexOf("=") + 1);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
else
{
str4 = str.Substring(0, str.IndexOf("==") + 2);
queue.Enqueue(str4);
str = str.Remove(0, str4.Length);
}
}
queue.TrimToSize();
int count = queue.Count;
for (int i = 1; i <= count; i++)
{
str4 = (string)queue.Dequeue();
ERROR str2 = str2 + Encoding.ASCII.GetString(provider.Decrypt(Convert.FromBase64String(str4), true));
}
return str2;
}
public static string Encript(string Plain_Text, string Public_Key)
{
string str = Plain_Text;
string xmlString = Public_Key;
string str3 = "";
RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
//RSAParameters parameters = new RSAParameters();
provider.FromXmlString(xmlString);
int num = (str.Length / 0x20) + 1;
char[] chars = str.ToCharArray();
byte[][] bufferArray = new byte[num][];
int index = 0;
for (int i = 1; i <= num; i++)
{
if (i == num)
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, chars.Length - index);
}
else
{
bufferArray[i - 1] = Encoding.ASCII.GetBytes(chars, index, 0x20);
index += 0x20;
}
}
string str4 = str;
for (int j = 0; j < bufferArray.Length; j++)
{
str3 = str3 + Convert.ToBase64String(provider.Encrypt(bufferArray[j], true));
}
return str3;
}
// Properties
public string Private_Key
{
get
{
return this.prk;
}
set
{
if (value != null)
{
this.prk = value;
}
}
}
public string Public_Key
{
get
{
return this.pk;
}
set
{
if (value != null)
{
this.pk = value;
}
}
}
}
public class HashCalculate
{
// Methods
public HashCalculate()
{}
public static string HashMD5(byte[] file)
{
MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
byte[] buffer = file;
byte[] inArray = provider.ComputeHash(buffer);
provider.Clear();
return Convert.ToBase64String(inArray);
}
}
public class SymetricCryptography
{
public SymetricCryptography()
{
}
// Fields
private SymmetricAlgorithm mCSP = new DESCryptoServiceProvider();
// Methods
public byte[] DecryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string DecryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateDecryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = Convert.FromBase64String(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Encoding.UTF8.GetString(stream.ToArray());
}
public byte[] EncryptFile(byte[] file)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] buffer = file;
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
stream2.Close();
return stream.ToArray();
}
public string EncryptString(string Value)
{
ICryptoTransform transform = this.mCSP.CreateEncryptor(this.mCSP.Key, this.mCSP.IV);
byte[] bytes = Encoding.UTF8.GetBytes(Value);
MemoryStream stream = new MemoryStream();
CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(bytes, 0, bytes.Length);
stream2.FlushFinalBlock();
stream2.Close();
return Convert.ToBase64String(stream.ToArray());
}
public string Initialization_Vector
{
get
{
this.mCSP.GenerateIV();
return Convert.ToBase64String(this.mCSP.IV);
}
set
{
if (value != null)
{
this.mCSP.IV = Convert.FromBase64String(value);
}
}
}
public string Sessio_Key
{
get
{
this.mCSP.GenerateKey();
return Convert.ToBase64String(this.mCSP.Key);
}
set
{
if (value != null)
{
this.mCSP.Key = Convert.FromBase64String(value);
}
}
}
}
}
this is the class file error is in this line
str2 = str2 + Encoding.ASCII.GetString(provider.Decrypt(Convert.FromBase64String(str4), true));
so guys plz help me to get out of this problems
with regards
venkatesh
|
|
|
|
|
Hello Friends ,
How to retrieve image from database (sqlserver 2005) to imabe button,
I cannot get image ,
here is the Code :
{
string t;
t = Session["id"].ToString();
adp = new SqlDataAdapter(" select myname ,gender ,dateofbirth ,aboutme,activities,Favouriteblogs,books... from registrations where username='"+t+"'", con);
adp.Fill(ds);
ImageButton1.ImageUrl = ds.Tables[0].Rows[0][6].ToString();
// ImageButton1.ImageUrl = Server.MapPath("./picturs/general/" & a)
DetailsView1.DataSource = ds;
DetailsView1.DataBind();
}
<div class="ForumMod">modified on Monday, February 23, 2009 5:56 AM</div>
|
|
|
|
|
How do you store the image in db? as a string or bytes?
Calin
|
|
|
|
|
Helloo sir,
columname photo
datatype varchare(50)
|
|
|
|
|
and you keep the image name or url in photo column?
From what I can see, you are not returning the photo column in your query.
Calin
|
|
|
|
|
hi
I want to connect to a sqlserver instance on another computer in the workgroup network.
my program is win application with c# VS.NET 2008 and SQL Server 2000.
what settings are needed for my sqlserver instance and my application?
can you help me?
H.R
|
|
|
|
|
Do you want to Access the SQL Database or you just want a remote Connection ?
if you want to access the Database i dont think your Connection String will change, it will still be Normal , or are you asking how your Connection string look like ?
"User id=SA;Password=oops;Server=myremoteserver;Database=mydb"
Please be Clear
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
no need setting.
you should give win application's server name with SQl Server 2000 computer'computer name.
|
|
|
|
|
i want to know reporting.
|
|
|
|
|
you should be learn crystal report
|
|
|
|
|
or Reporting Services (ReportViewer,...)
|
|
|
|
|
This code works....
private void toolStripButton1_Click_1(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
try
{
// Set Processing Mode
reportViewer1.ProcessingMode = ProcessingMode.Local;
// Set RDL file
reportViewer1.LocalReport.ReportPath = (Application.StartupPath + "\\reports\\trdReport.rdlc");
// Supply a DataTable corresponding to each report data source
reportViewer1.LocalReport.DataSources.Add(
new ReportDataSource("getTrends", LoadData()));
// Add the reportviewer to the form
reportViewer1.Dock = DockStyle.Fill;
// Process and render the report
reportViewer1.RefreshReport();
}
catch (Exception ex)
{
StreamWriter writer = new StreamWriter(logFile, true, System.Text.Encoding.ASCII);
writer.WriteLine(System.DateTime.Now);
writer.WriteLine("[generate report]");
writer.WriteLine("[generate report]");
writer.WriteLine(ex);
writer.WriteLine("\r");
writer.Close();
MessageBox.Show(ex.ToString());
//this.Close();
//System.Environment.Exit(0);
}
this.Cursor = Cursors.Default;
}
private DataTable LoadData()
{
// Load data from XML file
DataSet ds = new DataSet();
string myFilePath = (Application.StartupPath + "\\bin\\" + "trd.xml");
ds.ReadXml(myFilePath);
return ds.Tables[0];
}
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I need to add reference to com object in run time.
I don't know witch com object i need in compile time.
Actually i need to choose between 2 com objects that i need to load.
I know those 2 object GUID - but i need to check in run time witch com object install on current machine and then load the right object.
How to do it ?
Thanks for the help.
|
|
|
|
|
You could do Late binding. This might help 1[^], 2[^]
|
|
|
|
|
Hi,
I wantt o know how can I detect if a mass storage devices was plugged in?
My aim is to block the mass storage devices like the USB flash memory, external hard disks & USB MP3 players as soon as user entered it..
|
|
|
|
|
You can iterate over drives and work out which ones are external. But, I don't see how you hope to 'block' them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
what about detecting it...
and provide an option to block or unblock..
so the application will use the group policy to block and unblock.
|
|
|
|
|
When the code below executes,the btnSendMessage_Click method(Send Message) can complete normally.
But the btnReceiveMessage_Click method blocks at 'queue.Receive();' without any exception.Why can't
receive message?Do I need to configure my OS(Windows XP) yet ?
Any help will be appreciated!
private void btnSendMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.MessageQueue queue =
new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo");
System.Messaging.Message message = new System.Messaging.Message();
message.Body = txtMessage.Text.Trim();
message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)});
queue.Send(message);
}
private void btnReceiveMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.MessageQueue queue =
new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo");
System.Messaging.Message message = queue.Receive();
message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)});
txtReceiveMessage.Text = message.Body.ToString();
}
|
|
|
|
|
To my surprise,when I use the Computer Management tool in Windows XP,the message sent doesn't exist in the queue.But the process of sending message doesn't result in an exception!Why,why?
|
|
|
|
|
Is the queue Transactional?
|
|
|
|