|
Well, I don't know what the problem is. Just some shots in the dark, what is SSdb class? What does the code look like for DatabaseExists() method on the SSdb class?
|
|
|
|
|
Hi,
SSdb is a DataContext class I made using SQLMetal, completely untweaked. I'll have to look at the code in DatabaseExists() method when I get home this evening, I don't have it in front of me right now.
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Just to tie up this thread. I've just received a reply to this query from Microsoft. Its a known bug with SQL Compact 3.5 whilst using the |DataDirectory| macro in the connection string ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi there.
I saw this string in Firefox's bookmark file :
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB
AAAAAQCAYAAAAf8/9hAAACJ0lEQVQ4jaXPoWvjUBzA8SdP7t
8oTFzgTKBmgYkFJhqYaOHEKBNHqBhh4njEjDBRysQRToxHRS
ETgzdRSEUhM4VEFFIxyMQgExMRExUTld8T6cptHWdOfODxe/
Dl9xPhLCec5egsIc00aaZJshidJaj1378IleUk85gii8gzRZ
5FFPOIYhGRznUdynLCLEd9QuhJhL4J3ruWxDcB6awO5n+FVF
a8I9yeQ+fYIuh3CX97qJFEXXQIexbRSBJdS+LxgDxTpJlGTR
OiebEh3NMOZrOB07Zwew7S7zDodwkvXdTVOrgOJZMB6Z0iGm
v0okAvCkQ4Ulj7BtaegX1g4LQtuic23lmnjl269WZDDzXy0D
cB6V1IPI2IFwUiuS+Q/QBr38A+MNcM7JaJ07bonNi4pw7yvL
s+00UNPeLJAD3ViPShJH0oiSYx9qGF+a2B0zKx9w3MZqMOH5
o4Rxad7xbdH/V2Qb9LcOEh8seSN3qiSaeKZBwSDQPCXxLpu3
SPHZwja7Oh07bxzlz0NEYUTyUfpfc58SzZmn9GlM8lH3k/Pe
wDe2v+GVFVFf9DLF8qzKaJEAIhBNKX7zR2GwghUFch5WOB2T
QxmybSlyxfKsRqWbFaVgS+xGqam/cbr+cSDRVW0yTwJcZuA6
/nIoRgtVwHqqeCnZ0vpHfxViDwJfGtxtqrA07LJr6NCHxZB3
itcFr25oTgXG5JxnVg+VzitGyMrw28UxdeK/4AmzjRL9vLQH
kAAAAASUVORK5CYII
I want to convert this string to image.
So I used this function , but an Exception occurred.
private Image Base64StringToImage(string base64ImageString)
{
byte[] b;
b = Convert.FromBase64String(base64ImageString);
MemoryStream ms = new System.IO.MemoryStream(b);
Image img = System.Drawing.Image.FromStream(ms);
return img;
}
Can you help me ?
Freshman
|
|
|
|
|
If you search the forums, you will find a thread about decoding base64 into an image from just a few days ago.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You're missing some data. Ignoring the image / data stuff at the beginning, the rest of the string isn't long enough for base 64. I copied 20 characters from within the string, tagged it on the end and it displays ok.
|
|
|
|
|
Thanks friend.
hammerstein05 wrote: I copied 20 characters from within the string, tagged it on the end and it displays ok
Can you explain more ?
Freshman
|
|
|
|
|
data:image/png;base64,
if you get rid of that section at the beginning, you'll get an error along the lines of base64 string is of incorrect length. Well, the string is 312 characters, my understanding of this is that the string needs to be divisible by 64, so the next one up (removing characters would remove image data) would be 832 characters in length. So, I copied 20 characters from within the string and tagged them on the end. Admittedly, there would be incorrect image data, but it should still work. And it did. It displays an icon. It's probably the favicon.ico (Zine is the word on the icon)
That's how I got it working. Your code is pretty much correct.
|
|
|
|
|
Thanks , you're nice my friend.
Freshman
|
|
|
|
|
hammerstein05 wrote: my understanding of this is that the string needs to be divisible by 64
That is not correct, but if the number of characters is divisable by 4 it happens to form a base64 string that needs no extra characters at the end to be decodable.
As the length is incorrect for a base64 string, it's probably "modified base64" that is used. Here you can read about how the string is padded at the end with "=" characters, and how "modified base64" doesn't use those:
wikipedia: Base64[^]
To make the .NET method decode the string, you can determine how many "=" characters should be added at the end, from the number of characters in the string (after all white space has been removed).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank-you, I appreciate being educated on this.
|
|
|
|
|
i think after you remove the header...base64, you forget to remove all whitespace from that string, i try not add 20 character that suggested and it works(look like zeppelin and zine)
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
hammerstein05 wrote: I copied 20 characters from within the string, tagged it on the end and it displays ok.
Which charecters did you copy ?
Freshman
|
|
|
|
|
Doesn't matter, just copy 20 characters.
I actually tried to just adding random letters on the end, it still worked.
|
|
|
|
|
Thanks a lot hammerstein05.
Freshman
|
|
|
|
|
MDI WinForms 2 application.
I need that Ctrl+F1 cycles through windows like Ctrl+Tab.
I overrided MDI child form OnKeypress method but Ctrl+F1 press is ignored.
How to force Ctrl+F1 to cycle between windows ?
Andrus.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Control | Keys.Tab:
return true;
case Keys.Control | Keys.F1:
keyData = Keys.Control | Keys.Tab ;
break;
}
return base.ProcessCmdKey(ref msg, keyData);
}
Andrus
|
|
|
|
|
If focused control is ReadOnly, Ctrl+E menu shortcut key is ignored.
To reproduce, run code below, press Ctrl+E.
Message box does not appear.
How to use Ctrl+E key from readonly or disabled control ?
Andrus.
using System;
using System.Windows.Forms;
static class Program
{
static void Main()
{
Application.Run(new Form1());
}
}
class Form1 : Form
{
public Form1()
{
menuStrip1 = new MenuStrip();
fileToolStripMenuItem = new ToolStripMenuItem();
openToolStripMenuItem = new ToolStripMenuItem();
textBox1 = new TextBox();
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { openToolStripMenuItem });
fileToolStripMenuItem.Text = "File";
openToolStripMenuItem.ShortcutKeys = ((Keys)((Keys.Control | Keys.E)));
openToolStripMenuItem.Text = "Open";
openToolStripMenuItem.Click += new System.EventHandler(openToolStripMenuItem_Click);
textBox1.Location = new System.Drawing.Point(55, 150);
textBox1.ReadOnly = true;
Controls.Add(textBox1);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
}
void openToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Clicked");
}
MenuStrip menuStrip1;
ToolStripMenuItem fileToolStripMenuItem;
ToolStripMenuItem openToolStripMenuItem;
TextBox textBox1;
}
Andrus
|
|
|
|
|
I am using Sql Server 2005 Compact Edition as a database and I can't seem to get this thing to add a simple record... I run the a simple Insert statement and the Table is still empty. I get no error code or anything... Has anyone else been able to add records to a Compact Edition table in Visual Studio 2005 using C#??? Here is my code...
INSERT INTO TimeZone
(state, abbrev, tzone)
VALUES (@p1, @p2, @p3)
Now the one thing that isn't showing is my primary key field which is "tzid". But it is autonumbered. I fill in the values in code for @p1, @p2, @p3. When I open up the TimeZone table, it is empty... Any help would be appreciated. Thanks
|
|
|
|
|
I've no experience with CE but are you able to execture your query with your parameters from a Management Studio?
|
|
|
|
|
please put your code over here
|
|
|
|
|
Is it possible to get the left-most coordinate (the left edge of the Region) for a specific y-coordinate? I thought about getting the bounds for the Region, then start at the x-coordinate and work my way in with IsVisible(), but it's very slow. Does anybody have any other ideas?
Thanks!
|
|
|
|
|
If you can't divide the bounds of the region into lines (so that you can use simple linear math to calculate the coordinate), you can use a binary search to call IsVisible as few times as possible.
Pick two points, one that you know is to the left of the region, and one that you know is inside the region. Calculate the point that is exactly in the middle of those two points. Use IsVisible to find out if that point is inside the region or not. If it is, use that as the new rightmost point, otherwise use it as the new leftmost point. Repeat the process until the distance between the points is small enough.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa,
I haven't done this, but I would expect the region class to have methods to solve this.
How about intersecting with a rectangle (height 1), then call GetBounds?
|
|
|
|
|
Thanks! I'll go with the latter one. I hadn't thought of that :> brilliant! thanks.
|
|
|
|
|
Hi
The pattern is sth like this:
<br />
^-?((?<X>[0-9]{0,8})/(?<Y>[0-9]{0,15})|(?<X>[0-9]{0,8}))\*?$<br />
and I want to have the variables in their named groups as following
X=...
Y=...
I don't know how to use MatchCollection, CaptureCollection ,etc. Can anyone help me?
|
|
|
|