|
supercat9 wrote: Is there any easy way to convert accented characters to ASCII, such that "déjà" would become "deja"?
Nope, not that I've seen.
supercat9 wrote: I could probably build a mapping table using culture-sensitive comparisons (if character+"b" sorts between that "ea" and "ec", that character must be some sort of "e") but that seems rather hokey.
Hokey, but about the only thing you've got that will do this.
Trying to convert using codepages will replace the accented characters with question marks.
|
|
|
|
|
Dave Kreskowiak wrote: Hokey, but about the only thing you've got that will do this.
Well, I tried writing some code to do the conversion. Not terribly elegant, but if I allocate 64K for an array of pre-translated characters the slowdown should be minimal.
I append an "8" to the character to be translated an check to see whether that puts it between "A" and "Z9". If so, I check that against "B", "C", etc. until I either find a character that's greater or have passed "Z".
In this particular application I didn't need upper and lower case, but that could probably be handled by comparing a character with its forced-to-uppercase version. If they match, the character is uppercase; otherwise it's lowercase.
One interesting quirk I discovered: "-B" (a hyphen followed by the letter B) sorts between "A" and "C". That's why I append a digit to the string. Depending upon localized sort rules, "-8" may be before "A" or after "Z9", but it shouldn't be between them.
|
|
|
|
|
C# code next...
string accentedStr;
byte[] tempBytes;
tempBytes = System.Text.Encoding.GetEncoding("ISO-8859-8").GetBytes(accentedStr);
string asciiStr = System.Text.Encoding.UTF8.GetString(tempBytes);
...quick & short!
|
|
|
|
|
Interesting that translates accented letters as letters rather than question marks. Useful to know. Is there any handy list of variations one could use (e.g. is there a version which would translate "þ"; as "th" or "ß" as "ss" (those characters still translate as question marks).
Also, out of curiosity, is there any function which would translate a Unicode string into a pure-ASCII string that would retain Unicode's linguistic sort order, though not necessarily appearance (e.g. so that "ßb" would sort between "ssa" and "ssc", and "β" would sort between "α" and "γ"?)
|
|
|
|
|
Alrighty well the story is im working on a database and using VBA with a WebBrowser control. So what i wanna do is be able to go to. www.amazon.ca and search there database with a segment of code for a specific item.. like lets say that im searching for the game "need for speed" i want to be able to click on it so that it switches to the page with the webbrowser control and searches on amazon.ca for it.. i dont want to link all the games since there are many games and would take a long time.. But also the fact that there are going to be many new stuff added to the database and it would be much easier for it not to have to have each item hyperlinked to the pages.. and im also using 3 different sites to search. one is amazon.ca the other is Futureshop.ca and bestbuy.ca i hope that you guys are able to help me out fairly soon.
|
|
|
|
|
Only thing I can think of is if they offer an SDK that allows you to do this. I don't know if they do.
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
I have a problem!!I can't get or edit data in MySQL using VB.NET. I have to used many ways to do it,for example: CoreLib.NET(MyDirect and UniDirect) and ODBC connection, but there are no results!!
What should I do to load(to ListView) or edit data in MySQL???
|
|
|
|
|
What is the code you are using to get the data?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Connect to MySQL I use this code:
'-------
Imports CoreLab.MySql
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
Dim datAdap As MySqlDataAdapter
Dim commands As MySqlCommand
Private Sub frmChooseTasks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
oMySqlConn.ConnectionString = "User ID=root;" & "Password=passw;" & "Host=localhost;" & "Port=3306;" & "Database=tasks;" & "Direct=true;" & "Protocol=TCP;" & "Compress=false;" & "Pooling=true;" & "Min Pool Size=0;" & "Max Pool Size=100;" & "Connection Lifetime=0"
oMySqlConn.Open()
commands.Connection = oMySqlConn
datAdap.SelectCommand = command
datAdap.Fill(dataSet, "Table")
lstvAvTasks.Items.Add(dataSet.Tables.Item(0).Rows(0).ToString) 'Adding to ListView data from MySQL,But it doesn't work
If (oMySqlConn.State = ConnectionState.Closed) Then
oMySqlConn.Open()
End If
End Sub
|
|
|
|
|
What is your command for the select command? I don't see it. Did you construct it through a wizard?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Not through a wizard, I use SELECT COMMAND by component that given to me by CoreLib.NET. This component have a input property "select command" and I inset there name of the table. Can you give some advise or samples working with MySQL by other way maybe??
|
|
|
|
|
What is your select query that is tied into the select command?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
This is command: "SELECT * FROM tasks"
Have you got some examples that show how to wrok with MySQL??
|
|
|
|
|
I think you might be missing a ; at the end inside the quotes. This may be silly to ask, but is there data in the table
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
does VB 2008 have the ability to upload and download files to\from a web site ftp folders???
|
|
|
|
|
|
I have just started with VB.Net, and so far I am having a blast - however I have hit a wall with regards to the QuickTime component offered by Apple. I am posting this message here to see if anyone here has or is using it.
In the below URL (listing 3) you can see an almost perfect example of how to convert a file in VB 6 using QuickTime. I am only stuck on two issues: where / what is control.movie coming from (it's supposed to be the file you want to convert but I dont see where it is created or being passed from) and I need to get QuickTime to report back with it's export options, or the codecs which can be used to export.
http://developer.apple.com/technotes/tn2006/tn2120.html
This is technically my third program I have written so far, the second one being a total rewrite of the first. I am pretty sure the answer is right there staring me in the face, I just dont have the experiance yet to see it!
Any help at all would be greatly appreciated.
Thanks,
Mark
|
|
|
|
|
I need to start a console application on a remote machine and have its console windows visible in on a user's desktop. So far I know of a couple different ways to start the console app, but not so that its visible to a user.
Any ideas?
|
|
|
|
|
This is a HUGE security violation. You cannot launch interactive processes using any methods exposed by the .NET Framework or WMI. You MUST use a third party utilty to launch the app, like PSEXEC. Google for it.
|
|
|
|
|
Thanks for the reply. I must admit it came much quicker than I expected.
I am aware of psexec but was hopeing that I could avoid using it. If no one else has any thoughts, I'll have to look elsewhere.
Thanks.
|
|
|
|
|
To launch an interactive process, you simply have no alternative. None of the methods provided in the Win32 SDK, WMI, or managed code will launch a process interactively. The user logged onto the target machine will never see it. The reasons for this are self-evident.
|
|
|
|
|
Hello every one
I am phasing some issues while i am tring to save a image..
My application works as follows
It is a application in which i am using a tablet to to let the user write free hand
I am able to do the first part by creating a bitmap and graphic object. I am capturing points and drawing lines between them
My next objective is to load a existing image and let the user draw over it and save it...
I am able to do it but when i save it back it gives a GDI error as “A generic error occurred in GDI+.”
I also have a option to let the user clear the old image and create a new one. When i do it i am able to save
The codes are as follows
form load
'Lode a existing image
picDraw.Image = System.Drawing.Image.FromFile(im_path)
'Associating the graphics object to Picture box
bm = New Bitmap(picDraw.Width, picDraw.Height)
g = Graphics.FromImage(bm)
'Draw on the Graphics object.
g.FillRectangle(New SolidBrush(Color.White), _
0, 0, picDraw.Width, picDraw.Height)
'Load the prescription to be edited
g.DrawImage(picDraw.Image, 0, 0)
Clear the image
' Draw on the Graphics object.
g.FillRectangle(New SolidBrush(Color.White), _
0, 0, picDraw.Width, picDraw.Height)
picDraw.Image = Nothing
Save the image
'Update the picture box with the latest bitmap
bm = picDraw.Image
'Save the bitmap as Image on the stated path
bm.Save(path_string, System.Drawing.Imaging.ImageFormat.Gif)
There is a timer which executes after every 50 milliseconds, hear i load the bitmap's contents in the picture box
picDraw.Image = bm
Can any one plz hep me out
-- modified at 9:47 Monday 26th November, 2007
|
|
|
|
|
Hi,
some comments that may or may not help you:
1.
"A generic error occurred in GDI+.” is the general message you get when something goes
wrong inside GDI+, the graphics subsystem. If it occurs while trying to save, it
may mean disk full, bad file name, ... or fill locked.
2.
Image.FromFile() keeps the file locked as long as the Image object lives.
Image.FromStream() does not do that.
3.
Taken together, if you try to save to the same filename you used to load an image from,
and that image is still alive, then you should go for FromStream().
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks a lot...
after posting this query did some more research i am able to find that when i want to over right the old file i am not able to do it...
is it another way to handle it...
I think there is a crude way but i am not satisfied with it...
The crude way i think should work is that copy the file to be loaded on as a temporary file at a different location and over right the original file
now with ur input i think the things should work
|
|
|
|
|
One more issue..
how do i read file from dis by FromStream()
|
|
|
|