15,663,550 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by rajesh@1989 (Top 50 by date)
rajesh@1989
8-Oct-13 8:57am
View
Hi Nelek,
I already post this question to message board due to there is no reply from him. So, I posted this question here.
and thank you for your provided link but I do not need to get windows service's path whereas I require to find the exe's path of any application by name or any other manner.
rajesh@1989
10-Jul-13 7:07am
View
Thank you!!
Can you explore it in details?
rajesh@1989
10-Jul-13 5:33am
View
suppose I have install a client exe on system A and system B. how can clients communicate with each other? please help me I could not understand that. will I need to get windows hosting and opening a port something like that or any other procedure?
rajesh@1989
10-Jul-13 3:44am
View
The above example you provided are good but how I centralized the server and install only client exe on client machine? Client machine may be exceeded 200.
rajesh@1989
10-Jul-13 3:43am
View
The above example you provided are good but how I centralized the server and install only client exe on client machine? Client machine may be exceeded 200.
rajesh@1989
17-Jun-13 1:39am
View
Thank you Laurence!! and many many thank to Jonas
I got the solution...by using Jonas answer http://stackoverflow.com/questions/87795/how-to-prevent-flickering-in-listview-when-updating-a-single-listviewitems-text
I will soon update the exact answer for it.
rajesh@1989
1-Jun-13 2:53am
View
I got the solution...
rajesh@1989
31-May-13 20:33pm
View
I want url based service without using wcf client just like asmx service.
rajesh@1989
28-May-13 15:13pm
View
[ServiceContract]
public interface IFileUpload
{
[OperationContract]
[WebInvoke(
Method = "POST",
BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat=WebMessageFormat.Json,
UriTemplate = "/UploadedFiles/")]
void Upload(Stream data);
}
public class FileUpload : IFileUpload
{
public void Upload(Stream data)
{
StringBuilder sb = new StringBuilder();
try
{
string contentType = WebOperationContext.Current.IncomingRequest.ContentType;
if (!contentType.StartsWith("multipart/form-data; boundary="))
{
throw new ArgumentException("Error, invalid Content-Type: " + contentType);
}
MemoryStream ms = new MemoryStream();
byte[] buffer = new byte[1000];
int bytesRead = 0;
do
{
bytesRead = data.Read(buffer, 0, buffer.Length);
ms.Write(buffer, 0, bytesRead);
} while (bytesRead > 0);
sb.AppendLine("Request size: " + ms.Position);
string boundary = contentType.Substring("multipart/form-data; boundary=".Length);
byte[] boundaryBytes = Encoding.ASCII.GetBytes(boundary);
byte[] requestBytes = ms.ToArray();
int index = 0;
Debug.Assert(requestBytes[0] == (byte)'-', "First char is '-'");
Debug.Assert(requestBytes[1] == (byte)'-', "Second char is '-'");
index = 2;
string boundaryLine = ReadLine(requestBytes, ref index);
Debug.Assert(boundaryLine == boundary, "First line is boundary");
string contentDispositionLine = ReadLine(requestBytes, ref index);
Debug.Assert(contentDispositionLine.StartsWith("Content-Disposition"), "First line of part is Content-Disposition");
sb.AppendLine(contentDispositionLine);
string contentTypeLine = ReadLine(requestBytes, ref index);
Debug.Assert(contentTypeLine.StartsWith("Content-Type"), "Second line of part is Content-Type");
sb.AppendLine(contentTypeLine);
string emptyLine = ReadLine(requestBytes, ref index);
Debug.Assert(emptyLine == "", "Third line is empty");
byte[] file = new byte[requestBytes.Length - index - "\r\n--".Length - boundaryBytes.Length - "--\r\n".Length];
Array.Copy(requestBytes, index, file, 0, file.Length);
File.WriteAllBytes(@"\UploadedFiles\a.txt", file);
sb.AppendLine("File saved to a.txt, len = " + file.Length);
}
catch (Exception e)
{
sb.AppendFormat("{0}: {1}", e.GetType().FullName, e.Message);
sb.AppendLine();
}
WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain";
// return new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString()));
}
string ReadLine(byte[] buffer, ref int index)
{
StringBuilder sb = new StringBuilder();
while (index < buffer.Length - 1 && buffer[index] != 0x0D && buffer[index] != 0x0A)
{
sb.Append((char)buffer[index]);
index++;
}
index += 2;
return sb.ToString();
}
}
What is wrong in above code? is above works to accept multipart/form-data? Due to stream is used I cann't test it. It is not consuming through multipart/form-data by iphone. I am newbie in WCF Multipart/Form-data. Please help me
rajesh@1989
28-May-13 1:55am
View
is it not possible through web service asmx(1)?
I am creating a web service application in which I have created many web service now you are telling that I need to use wcf. is it possible to two kind of service on single application(2)?
thank you!!
rajesh@1989
27-May-13 15:46pm
View
Hi Tadit,
How can I debug my web service?
Here my question that is this web service will accept multipart form-data?
I have created a new thread for this http://www.codeproject.com/Questions/597629/WebserviceplusforplusfileplusuploadplususingplusMu
when I phone developer consume this service they get 'invalid request' by posting data as multipart form-data with boundary.
rajesh@1989
26-May-13 9:13am
View
hi Tadit,
Can you please reply for above ?
rajesh@1989
24-May-13 6:46am
View
Please give me some solution for it. It is very urgent as I am on stuck.
Thank you!!
rajesh@1989
24-May-13 6:11am
View
I wrote following code on demo application use consume web service and web service is giving response like: Unable to cast object of type 'System.String' to type 'System.Web.HttpPostedFile'.
<form id="form1" runat="server" action="http://MySiteAddress/FileTransfer.asmx/TransferFile" enctype="multipart/form-data">
<asp:FileUpload runat="server" id="fileArray"/>
<asp:Button ID="btnSubmit" runat="server" Text="Upload" onclick="btnSubmit_Click" />
<asp:Button ID="Button1" runat="server" önclick="Button1_Click" Text="Button" />
</form></pre>
rajesh@1989
24-May-13 5:54am
View
I do not understand what you want to say. I already added on web.config file.
rajesh@1989
24-May-13 3:03am
View
Hi Tadit,
Thank you again.
I know as I am accept your solution there is no right to ask a question to you in this thread. But I am facing critical problem that How to make webservice that uses TransferFile() method by multipart form data?.
I have write following code for it:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void TransferFile()
{
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Request = postedContext.Request.Files;
foreach (HttpPostedFile item in Request)
{
string filename = item.FileName;
byte[] fileBytes = new byte[item.ContentLength];
item.InputStream.Read(fileBytes, 0, item.ContentLength);
objFileTransfer.TransferFile(filename, fileBytes);
//objFileTransfer.TransferFile(filename, fileBytes);
retJSON = js.Serialize(new { Result = objFileTransfer.TransferFile(filename, fileBytes) });
Context.Response.Write(retJSON);
// fileBytes now contains the content of the file
// filename contains the name of the file
}
}
Is this webservice get multipart form data?
When an iPhone developer consume this api they got response like:
Problem uploading file: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
rajesh@1989
23-May-13 14:57pm
View
Thank you Tadit!!
This is my mistake and I apologize for it.
I just one query to you that "is my code works for large file?". I have tested that files 1 or 2 kb are uploaded successfully but when I upload 1mb files then it throw "The underlying connection was closed: An unexpected error occurred on a receive." error. What I will do for this. thank you!!
rajesh@1989
23-May-13 10:27am
View
Yes I checked and found complete url of ftp with directory name.
rajesh@1989
23-May-13 9:27am
View
Why? I realy wants to know file uploading method to ftp. I am newbie.
Please explain where I do wrong?
rajesh@1989
23-May-13 9:15am
View
This error has vanished after I restart me system but found new error:
System.Net.WebException was caught
Message=The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
Source=System
StackTrace:
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at System.Net.ConnectionPool.Destroy(PooledStream pooledStream)
at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.GetRequestStream()
at BizConnectPro_BAL_DAL.FileUpload.TransferFile(String filename, Byte[] fileContent) in E:\BizConnect-Pro_BAL_DAL Project\BizConnectPro_BAL_DAL\BizConnectPro_BAL_DAL\FileUpload.aspx.cs:line 50
InnerException:
Why this error occured while I already pass filecontent to it.
rajesh@1989
21-May-13 4:46am
View
If query is not possible from given table structure then I will change its structure as per your suggestion.
rajesh@1989
21-May-13 1:58am
View
Thanks for deterministic help!!
It works but when I pass receiverId 3,4 and MessengerId 2 it display chatId. I think In this situation it should not return chatId.
As you said I wrote following procedure..
ALTER proc [dbo].[usp_StartChat]
(
@MessengerId int,
@ReceiversId varchar(200),
@MsgText varchar(max)
)
as
begin
declare @ChatIdTable table
(
ChatId int
)
declare @Temp table
(
Id int
)
declare @Temp2 table
(
Id int
)
declare @Original Table
(
Id int
)
declare @ChatId int
insert into @Temp select @MessengerId
insert into @Temp2 select * from dbo.Split(@ReceiversId)
insert into @Original select * from @Temp union all select * from @Temp2
insert into @ChatIdTable select cd.ChatId from TblChatMaster cm
join TblChatDesc cd on cm.ChatId=cd.ChatId
join TblMessageMaster mm on cm.ChatId=mm.ChatId where MessengerId in (select * from @Original)
select @ChatId=chatid from @ChatIdTable group by ChatId having COUNT(*)=(select COUNT(*) from dbo.Split(@ReceiversId))
if @ChatId is not null or @ChatId!=''
begin
....do something.. like...
insert into TblMessageMaster(ChatId, MsgText, MsgDate, MessengerId) values(@ChatId, @MsgText, sysdatetime(), @MessengerId)
select cm.ChatId, cd.ReceiverId, mm.MessengerId 'SenderId', mm.MsgText, convert(varchar(40), mm.MsgDate, 120) 'MsgDate' from TblChatMaster cm join TblChatDesc cd on cm.ChatId=cd.ChatId join TblMessageMaster mm on cm.ChatId=mm.ChatId where cm.ChatId=@ChatId
end
else
begin
....do..something.like.
insert into TblChatMaster(CreatedDate) values(sysdatetime())
select @ChatId=chatid from TblChatMaster where chatid=IDENT_CURRENT('TblChatMaster')
insert into TblChatDesc select @ChatId, * from dbo.Split(@ReceiversId)
insert into TblMessageMaster(ChatId, MsgText, MsgDate, MessengerId) values(@ChatId, @MsgText, sysdatetime(), @MessengerId)
select cm.ChatId, cd.ReceiverId, mm.MessengerId 'SenderId', mm.MsgText, convert(varchar(40), mm.MsgDate, 120) 'MsgDate' from TblChatMaster cm join TblChatDesc cd on cm.ChatId=cd.ChatId join TblMessageMaster mm on cm.ChatId=mm.ChatId where cm.ChatId=@ChatId
end
end
rajesh@1989
20-May-13 8:04am
View
Yes, Exactly!!
rajesh@1989
20-May-13 7:32am
View
but how could I separate ReceiverId ? and ReceiverId may be 2,3,4 then By above conclusion I need to add an extra condition. How could I do that!!
rajesh@1989
20-May-13 6:48am
View
It display two different chatId 4 and 5
rajesh@1989
20-May-13 6:39am
View
Sorry I didn't explain it. dbo.Split is a method that is split the value into rows where comma is founded.
rajesh@1989
20-May-13 6:37am
View
It shown two different chatId 4 and 5
rajesh@1989
16-Mar-13 2:49am
View
Thank you Sergey for your response!!
Then How do I do without SetPixel/GetPixel?
rajesh@1989
5-Mar-13 2:52am
View
First of all thank you for your valuable response. But there is same error occured "object is currently in use elsewhere" and it is too slow when I am processing 640X480 image.
void FinalVideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
System.Console.WriteLine("1: Flag status: "+ flag.ToString());
if (!flag)
{
flag = true;
System.Console.WriteLine("2: Flag status: "+ flag.ToString());
using (ImageAttributes attributes = new ImageAttributes())
{
LiveImage = (Bitmap)eventArgs.Frame.Clone();
//NewBitmap.Size = new Size(LiveImage.Width, LiveImage.Height);
//create a blank bitmap the same size as original
//get a graphics object from the new image
Graphics g = Graphics.FromImage(NewBitmap);
//create the grayscale ColorMatrix
ColorMatrix colorMatrix = new ColorMatrix(
new float[][]
{
new float[] {.3f, .3f, .3f, 0, 0},
new float[] {.59f, .59f, .59f, 0, 0},
new float[] {.11f, .11f, .11f, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0, 0, 0, 0, 1}
});
attributes.SetColorMatrix(colorMatrix);
//draw the original image on the new image
//using the grayscale color matrix
g.DrawImage(LiveImage, new Rectangle(0, 0, 640, 480),
0, 0, 640, 480, GraphicsUnit.Pixel, attributes);
//ProcessedBitmap = new Bitmap(NewBitmap);
}
#region [Image processing using loop commented]
////foreach (int a in IEnum_a)
////{
//// foreach (int c in IEnum_c)
//// {
//for (int a = 0; a < 480; a++)
//{
// for (int c = 0; c < 640; c++)
// {
// now_color = Duplicate_GrayscaleImg.GetPixel(c, a);
// if (now_color.ToArgb() == Color.WhiteSmoke.ToArgb())
// ProcessedBitmap.SetPixel(c, a, Color.Orange);
// else if (now_color.ToArgb() == Color.White.ToArgb())
// ProcessedBitmap.SetPixel(c, a, Color.Red);
// else if (now_color.ToArgb() == Color.DarkGray.ToArgb())
// ProcessedBitmap.SetPixel(c, a, Color.Red);
// else
// ProcessedBitmap.SetPixel(c, a, Color.Blue);
// }
//}
#endregion
//System.Diagnostics.Stopwatch sWatch = new System.Diagnostics.Stopwatch();
//sWatch.Start();
#region [Image processing using bitlock]
const byte BYTE_255 = 255;
Bitmap24 bm24 = new Bitmap24(NewBitmap);
// Lock the bitmap.
bm24.LockBitmap();
// Invert the pixels.
for (int i = 0; i < NewBitmap.Height * bm24.RowSizeBytes; i++)
{
// bm24.ImageBytes[i] = Convert.ToByte(BYTE_255 - bm24.ImageBytes[i]);
bm24.ImageBytes[i] = (byte)(BYTE_255 - bm24.ImageBytes[i]);
//System.Console.WriteLine(bm24.ImageBytes[i].GetHashCode())
rajesh@1989
27-Feb-13 6:31am
View
thanks sir!
But it is difficult to find out through breakpoint. Actually exception occurred after few minutes.
rajesh@1989
26-Feb-13 2:09am
View
Now, I am facing one another problem that I want to convert GrayScale image into Red, Yellow and Green according to dark spot found on GrayScale image.
Is this possible through that?
Highly appreciate!!
rajesh@1989
26-Feb-13 2:05am
View
Thank you!!
I have resolved this issue by initialize bitmap on form_load like this:
private void MainScreen_Load(object sender, EventArgs e)
{
NewBitmap = new Bitmap(100, 100);
}
Memory once allocated to NewBitmap and can used it every time.
rajesh@1989
25-Feb-13 7:28am
View
Thank you!!
width:640, height:480
I am missing one point in my posted question that this error is occurred after successfully converted and display in picturebox for few minutes.
rajesh@1989
6-Aug-12 2:09am
View
when User close the Browser then data is not deleted.
rajesh@1989
12-Jul-12 10:00am
View
thank you,
now i am using following method but e.commandArgument return <%item.ProductID%>,
<asp:LinkButton ID="LnBtn" runat="server"
CommandArgument='<% :item.ProductID %>' CommandName="click"
oncommand="LnBtn_Command">Add To Cart
rajesh@1989
12-Jul-12 9:42am
View
Error 12 Invalid expression term '<'
Error 17 Invalid expression term ')'
rajesh@1989
12-Jul-12 7:35am
View
how to use GUID? please suggest me any example for it.
rajesh@1989
12-Jul-12 5:54am
View
thank you,
have a look to www.4templates.com site. here user has not to registered himself before buying. He can add items to cart without login and if he want to checkout/payment for that then he need to login.
I want to do same operation like www.4templates.com
rajesh@1989
12-Jul-12 5:38am
View
just tell me that how to create session id for specific user who are visited my site. my reference site is www.4templates.com
rajesh@1989
12-Jul-12 5:34am
View
i do not have any code for that i just ask how to manage it
rajesh@1989
12-Jul-12 5:33am
View
Deleted
i do not have any code for that i just ask how to manage it
rajesh@1989
17-May-12 8:30am
View
thanks for ur rply!!
Can you give me some example. I am using database in my application.
rajesh@1989
16-May-12 6:53am
View
picturebox1 always show visible false property
rajesh@1989
16-May-12 6:04am
View
thanks for ur rply...
sorry i want to set pictureBox1.visible=true
i wrote your solution like this:
this.MyMdfForm.pictureBox1.visible=true;
but it does work.
rajesh@1989
27-Mar-12 1:42am
View
i want to insert podate=null
instead of 1900-01-01 00:00:00.000;
rajesh@1989
21-Mar-12 3:41am
View
In Load argument I am passing crystal report path.
when i create an exe of that Software then error has occured like this:
unhalded exception has occured in you application.Load report failed. System can not find specified path.
I am also used rpt.Load(@"..\..\..\Billing_Inventory\ReportJobwork.rpt");
rajesh@1989
11-Mar-12 10:16am
View
thank you for your solution!!
I improved my question please check it and give me solution !!
as soon as possible!!
rajesh@1989
11-Mar-12 3:44am
View
thank you for your comment....
print preview on crystal report display each item in different page of similar company.
i want to group all item in single page and Grand total it of similar company.
if user select same company and sale different items and want to print sale invoice then should be grouped all item in single page.
rajesh@1989
16-Feb-12 6:39am
View
pls sir,
read again this problem. i am improved this question.......
sir this is a web based project so namespace could not been found.....
thanking you
rajesh@1989
16-Feb-12 6:01am
View
thanx sir,
but hint me in detail how can this methods is called when we enter in textbox....
Show More