16,020,114 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 C++ questions
View Visual Basic questions
View Javascript questions
View .NET 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 normalsoft (Top 52 by date)
normalsoft
24-Jan-17 3:59am
View
Thanks for the reply. I'll check with them regarding this.
normalsoft
18-May-15 8:19am
View
Thank u for the quick reponse.
I'm new in wcf. They have given the certificate and I have written code for trying to bypass the certificate using following code. it was working. But i think it may be problem of web.config file.
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }
normalsoft
22-Jun-14 10:26am
View
Please help.
normalsoft
22-Jun-14 7:16am
View
private String _encrypt(String message, String secretKey) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] digestOfPassword = md.digest(secretKey.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
SecretKey key = new SecretKeySpec(keyBytes, "DESede");
Cipher cipher = Cipher.getInstance("DESede");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] plainTextBytes = message.getBytes("utf-8");
byte[] buf = cipher.doFinal(plainTextBytes);
byte[] base64Bytes = Base64.encodeBase64(buf);
// byte [] base64Bytes = Base64.;
String base64EncryptedString = new String(base64Bytes);
return base64EncryptedString;
}
private String _decrypt(String encryptedText, String secretKey) throws Exception {
byte[] message = Base64.decodeBase64(encryptedText.getBytes("utf-8"));
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] digestOfPassword = md.digest(secretKey.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
SecretKey key = new SecretKeySpec(keyBytes, "DESede");
Cipher decipher = Cipher.getInstance("DESede");
decipher.init(Cipher.DECRYPT_MODE, key);
byte[] plainText = decipher.doFinal(message);
return new String(plainText, "UTF-8");
}
normalsoft
22-Jun-14 6:55am
View
Thanks bro. I do the same. jar file added to project and build. Now showing
"can not find symbol." Method encodeBase64(..)
normalsoft
22-Jun-14 6:30am
View
import org.apache.commons.codec.binary.Base64;
This libray is not getting. im using netbeans.
normalsoft
22-Jun-14 5:47am
View
Sorry im new in java. this line got error in my application.
byte [] base64Bytes = Base64.encodeBase64(buf);
encodeBase64 is underlined by red mark.
normalsoft
22-Jun-14 5:34am
View
lol. but getting only eclipse. not found any net beans code.
normalsoft
15-Jun-14 4:52am
View
Thanks for information. I tried it. Encryption is working. But i'm getting encrypted data which is unreadable data. Symbols and characters, not alpha numberic. is it right or not ?
normalsoft
21-May-14 2:20am
View
Deleted
Thank you for the comment.
Actually i needs to use HttpClient class . so that i i have to refer System.Net.Http. This is not in .net v3.5.
normalsoft
13-May-14 1:33am
View
Deleted
how to do xsd.exe ? please comment. Also give me structure of the class.
normalsoft
12-May-14 6:45am
View
sorry. actually my xml node Id is opened and closed correctly. <id> .... Here i manually entered.
normalsoft
12-May-14 6:42am
View
Deleted
<root>
<Products>
<Product>
<id>123 1234 1237</pin>
<slno>
<message>test message
</Product>
<Product>
<id>123 1234 1238</pin>
<slno>
<message>test message
</Product>
</Products>
normalsoft
12-May-14 6:41am
View
Deleted
<root>
<Products>
<Product>
<id>123 1234 1237
<slno>
<message>test message
</Product>
<Product>
<id>123 1234 1238
<slno>
<message>test message
</Product>
</Products>
This is the actual xml. I wrongly entered.
normalsoft
12-May-14 6:38am
View
Deleted
<pre lang="xml"><?xml version="1.0"?>
<root>
<Products>
<Product>
<Id>123 1234 1237</pin>
<slno></slno>
<message>test message</message>
</Product>
<Product>
<Id>123 1234 1238</pin>
<slno></slno>
<message>test message</message>
</Product>
</Products></pre>
normalsoft
12-May-14 6:37am
View
Deleted
sorry. This is the actual xml
<root>
<Products>
<Product>
<id>123 1234 1237
<slno>
<message>test message
</Product>
<Product>
<id>123 1234 1238
<slno>
<message>test message
</Product>
</Products>
normalsoft
11-May-14 0:49am
View
I checked it. But my .Net version is 3.5. HttpClient is not available in that version.
normalsoft
10-May-14 1:38am
View
Deleted
Actually I am working with .Net Framework 3.5. HttpClient is not supporting for this version. Please comment.
normalsoft
8-May-14 8:05am
View
Deleted
While referring the API (http://ipaddress:port/api/) gets an xml. It Should be refer as a web service or not ? Please advise.
normalsoft
8-May-14 7:48am
View
Me too have the same issue. How can I consume a web API using my class libray?
normalsoft
8-May-14 7:48am
View
Me too have the same issue. How can I consume a web API using my class libray?
normalsoft
8-May-14 5:49am
View
Deleted
This is for web applications. am I correct ?. but my project is in windows application and have independent class libray has to be added to it and which is responsible for API consume.
normalsoft
8-May-14 5:44am
View
We have get one third party api for an integration and have to call a method in it. I need to build a class library and want to call the API function from this. Actually my project is windows application.
normalsoft
17-Apr-14 4:34am
View
Thank you thatraja. Also i need to set permission for IIS_USR and also set default page for the application. Please comment
normalsoft
9-Apr-14 7:46am
View
I have removed the comma. Now it is working fine. Thanks for your great support.
normalsoft
9-Apr-14 7:29am
View
I think the problem coming when values comes something like comma(,) separated.
normalsoft
9-Apr-14 7:15am
View
Yes. Same #Error.
normalsoft
9-Apr-14 6:58am
View
Thanks. It is working in local machine. but not working in production. ???
normalsoft
9-Apr-14 5:48am
View
="Amount in words: " & Code.changeToWords(FormatNumber(Sum(Fields!dTurnover.Value),2))
Now it is working. One more issue Decimal part shows as Six Zero instead of Sixty
normalsoft
9-Apr-14 4:36am
View
it is something like total amount. e.g. 135.60. I think the formatting of decimal and passing as string is not properly executed.
normalsoft
9-Apr-14 4:22am
View
It is not working for me. Comes #Error as mentioned earlier. Works only when remove "FormatNumber" from the code.
normalsoft
9-Apr-14 3:45am
View
Sorry. this line was not in code. I forgot to uncomment. It works when remove FormatNumber keyword. But i needs decimal part figures into words.
normalsoft
9-Apr-14 3:29am
View
Public Function changeToWords(ByVal numb As [String]) As [String]
Dim numb as string = Convert.toString(val)
Dim val As [String] = ""
Dim wholeNo As [String] = numb
Dim points As [String] = ""
Dim andStr As [String] = ""
Dim pointStr As [String] = ""
Dim endStr As [String] = "Only"
Dim decimalPlace As Integer = numb.IndexOf(".")
If decimalPlace > 0 Then
wholeNo = numb.Substring(0, decimalPlace)
points = numb.Substring(decimalPlace + 1)
If Convert.ToInt32(points) > 0 Then
andStr = "and"
pointStr = translateCents(points)
pointStr= pointStr & " Paise "
End If
End If
val = [String].Format("{0} {1}{2} {3}", translateWholeNumber(wholeNo).Trim(), "Rupees " & andStr, pointStr , endStr)
Return val
End Function
Private Shared Function translateWholeNumber(ByVal number As [String]) As [String]
Dim word As String = ""
Dim beginsZero As Boolean = False
Dim isDone As Boolean = False
Dim dblAmt As Double = (Convert.ToDouble(number))
If dblAmt > 0 Then
beginsZero = number.StartsWith("0")
Dim numDigits As Integer = number.Length
Dim pos As Integer = 0
Dim place As [String] = ""
Select Case numDigits
Case 1
word = ones(number)
isDone = True
Exit Select
Case 2
word = tens(number)
isDone = True
Exit Select
Case 3
pos = (numDigits Mod 3) + 1
place = " Hundred "
Exit Select
Case 4, 5, 6
pos = (numDigits Mod 4) + 1
place = " Thousand "
Exit Select
Case 7, 8, 9
pos = (numDigits Mod 7) + 1
place = " Million "
Exit Select
Case 10
pos = (numDigits Mod 10) + 1
place = " Billion "
Exit Select
Case Else
isDone = True
Exit Select
End Select
If Not isDone Then
word = translateWholeNumber(number.Substring(0, pos)) + place + translateWholeNumber(number.Substring(pos))
If beginsZero Then
word = " and " & word.Trim()
End If
End If
If word.Trim().Equals(place.Trim()) Then
word = ""
End If
End If
Return word.Trim()
End Function
Private Shared Function tens(ByVal digit As [String]) As [String]
Dim digt As Integer = Convert.ToInt32(digit)
Dim name As [String] = Nothing
Select Case digt
Case 10
name = "Ten"
Exit Select
Case 11
name = "Eleven"
Exit Select
Case 12
name = "Twelve"
Exit Select
Case 13
name = "Thirteen"
Exit Select
Case 14
name = "Fourteen"
Exit Select
Case 15
name = "Fifteen"
Exit Select
Case 16
name = "Sixteen"
Exit Select
Case 17
name = "Seventeen"
Exit Select
Case 18
name = "Eighteen"
Exit Select
Case 19
name = "Nineteen"
Exit Select
Case 20
name = "Twenty"
Exit Select
Case 30
name = "Thirty"
Exit Select
Case 40
name = "Fourty"
Exit Select
Case 50
name = "Fifty"
Exit Select
Case 60
name = "Sixty"
Exit Select
Case 70
name = "Seventy"
Exit Select
Case 80
name = "Eighty"
Exit Select
Case 90
name = "Ninety"
Exit Select
Case Else
If digt > 0 Then
name = (tens(digit.Substring(0, 1) & "0") & " ") + ones(digit.Substring(1))
End If
Exit Select
End Select
Return name
End Function
Private Shared Function ones(ByVal digit As [String]) As [String]
Dim digt As Integer = Convert.ToInt32(digit)
Dim name As [String] = ""
Select Case digt
Case 1
name = "One"
Exit Select
Case 2
name = "Two"
Exit Select
Case 3
name = "Three"
Exit Select
Case 4
name = "Four"
Exit Select
Case 5
name = "Five"
Exit Select
Case 6
name = "Six"
Exit Select
Case 7
name = "Seven"
Exit Select
Case 8
name = "Eight"
Exit Select
Case 9
name = "Nine"
Exit Select
End Select
Return name
End Function
Private Shared Function translateCents(ByVal cents As [String]) As [String]
Dim cts As [String] = ""
Dim digit As [String] = ""
Dim engOne As [String] = ""
Dim i As Integer = 0
For i = 0 To Len(cents) - 1
digit = cents(i).ToString()
If digit.Equals("0") Then
engOne = "Zero"
Else
engOne = ones(digit)
End If
cts = cts & " " & engOne
Next
Return cts
End Function
normalsoft
9-Apr-14 3:19am
View
="Amount in words: " & Code.changeToWords(CStr(FormatNumber(Sum(Fields!dTurnover.Value),2)))
Actually my custom code accepts string value as parameter.
normalsoft
23-Feb-14 3:21am
View
Deleted
Thanks for the info. I have tested the dll in another dummy project and it works well. But when I tried it in my running project, it shows the given error. Actually this is the problem.
normalsoft
4-Nov-13 7:46am
View
Deleted
oh. sorry. i just searched about above dll and which is using in mvc applications.
normalsoft
4-Nov-13 7:16am
View
Deleted
but actually i'm not using MVC. its normal asp .net website
normalsoft
29-Oct-13 9:44am
View
thanks for your great support. It is working fine for me. but, in the client machine, a verifone has been connected. Actually we are trying to implement the credit card swiping and have socket mechanism for handling the verifone events. Previously, the control have been gone to the verifone device when we call the external function in the dll. Now, it is not happening. using thread may cause any issues or problem with my code ?
normalsoft
28-Oct-13 8:46am
View
thanks for the comment. but i need a timeout period criteria.
normalsoft
28-Oct-13 8:41am
View
its working. but i need to abort the process within the time limit whether response received or not.
normalsoft
27-Oct-13 7:53am
View
actually the application is in .NET 3.5. Task is not available.
normalsoft
27-Oct-13 6:25am
View
function in another dll. that referrences to the project.
normalsoft
27-Oct-13 6:24am
View
Deleted
No comment
normalsoft
5-Aug-13 3:02am
View
I had the same problem. still didn't any solution.
normalsoft
24-Jun-13 6:49am
View
Its working fine when i build the project again by adding ajax reference. Thanks for your support.
normalsoft
28-May-13 9:58am
View
I had checked the css file. but nothing added on it. still problem exists..
normalsoft
23-May-13 6:19am
View
I have already added. It was working since last 6 months. But now it shows like that..
normalsoft
5-May-13 8:00am
View
TripleDES algorithem.
Private ENCRYPTION_KEY As Byte() = New Byte() { &H61, 50, &H63, &H34, &H65, &H36, &H67, &H38 }
Private m_abytInitializationVector As Byte() = New Byte() { &H12, &H34, &H56, 120, &H90, &HAB, &HCD, &HEF }
normalsoft
5-May-13 6:08am
View
Hi sir,
Sorry for incomplete question. .dat contains an encrypted and compressed XML string or as an encrypted and compressed byte array of store transaction.
normalsoft
17-Apr-13 3:05am
View
I changed the code as follows. Now its works for me. Thanks for your great support.
Dim bytesFrom(clientSocket.ReceiveBufferSize) As Byte
'networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
Dim bytesRead As Integer = networkStream.Read(bytesFrom, 0, clientSocket.ReceiveBufferSize)
Dim dataFromClient As String = Encoding.ASCII.GetString(bytesFrom, 0, bytesRead)
normalsoft
17-Apr-13 2:49am
View
Thanks for your support.
strings are identical values. but length is different. In client side, i'm getting 12 (byte array length). But in server side, while from receiving data from network stream, it has length 8193 having rest byte values are 0. ie. 0 - 11 values are same as client side. but 12 - 8192 are zeros.
normalsoft
16-Apr-13 2:40am
View
Thanks for your reply.
I changed the code on both ends as follows (lines bolded). But i'm still getting the error while decrypting the client encrypted data in server.
"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters."
Client side:
Collapse | Copy Code
Public Shared Function SendRequest(ByVal InXML As String, ByRef OutXML As String) As Boolean
Try
Dim nwStream As NetworkStream = clientSocket.GetStream()
'' write to network stream
Dim outStream As Byte() = Encoding.ASCII.GetBytes(TripleDES.EncryptString(InXML))
' Dim outStream As Byte() = Encoding.ASCII.GetBytes(InXML)
nwStream.Write(outStream, 0, outStream.Length)
nwStream.Flush()
'' data reading from server
Dim inStream(clientSocket.ReceiveBufferSize) As Byte
nwStream.Read(inStream, 0, CInt(clientSocket.ReceiveBufferSize))
'Dim tmpStr As String = Encoding.ASCII.GetString(inStream)
Dim tmpStr As String = Encoding.Unicode.GetString(inStream)
OutXML = TripleDES.DecryptString(tmpStr)
Return True
Catch ex As Exception
OutXML = ex.Message
Return False
End Try
End Function
Server side:
Collapse | Copy Code
Module Module1
Sub Main()
' Dim ipAddress As IPAddress = ipAddress.Parse("192.168.8.8")
Dim serverSocket As New TcpListener(8888)
Dim requestCount As Integer
Dim clientSocket As TcpClient
serverSocket.Start()
msg("Server Started")
clientSocket = serverSocket.AcceptTcpClient()
msg("Accept connection from client")
requestCount = 0
While (True)
requestCount = requestCount + 1
'' Data reading from client
Dim networkStream As NetworkStream = clientSocket.GetStream()
Dim bytesFrom(clientSocket.ReceiveBufferSize) As Byte
networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
'Dim dataFromClient As String = Encoding.ASCII.GetString(bytesFrom)
Dim dataFromClient As String = Encoding.Unicode.GetString(bytesFrom)
msg("Data from client - " + TripleDES.DecryptString(dataFromClient))
'msg("Data from client - " + dataFromClient)
'' Data writting to client
Dim serverResponse As String = "Server response " + Convert.ToString(requestCount)
Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(TripleDES.EncryptString(serverResponse))
'Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(serverResponse)
networkStream.Write(sendBytes, 0, sendBytes.Length)
networkStream.Flush()
msg(serverResponse)
End While
clientSocket.Close()
serverSocket.Stop()
msg("exit")
Console.ReadLine()
End Sub
Sub msg(ByVal mesg As String)
mesg.Trim()
Console.WriteLine(" >> " + mesg)
End Sub
Show More