|
Thats nice.
|
|
|
|
|
Hello,
The question is simple but I found it tricky to accomplish.
I want to extract all the text from within the default.code node:
< default.code >
<script type="text/javascript"><!--
google_ad_client = "<?php echo($adsense_pubid);?>";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "245917";
google_color_text = "555555";
google_color_url = "555555";
google_ui_features = "rc:6";
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
< /default.code >
The problem is that when I read it, the is also considered a XML node. I simply want to extract the javascript code block.
How can I do this ?
Thanks
|
|
|
|
|
The script tag IS an XML node. However you can select the default.code and select the InnerXml ( from memory ) to get the script blocks with the XML tags which also happen to be script tages.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I have a habit of storing my connection string in a member of a base clase for my data access objects. That way, each object can access the database independently of each other. However, I was wondering how others handle this.
With the current way, each object is independent, but each object must maintain its own connection string value, even if its the same throughout all objects of the application.
One answer would be a static member, that way it's shared throughout all objects, but then the capability for different objects to access different databases would be lost unless the static member was constantly updated.
Thanks for any suggestions.
|
|
|
|
|
That's done in the Data Access Layer. Are you saying you do it in your business objects?
|
|
|
|
|
Nope, this is in a base class for the Data Access Layer code objects. Sorry if my post was not clear.
|
|
|
|
|
Good.
In my data access base classes[^] I hold a System.Data.IDbCommand , if I want the connection string I use this.cmd.Connection.ConnectionString ; there's no need to store it a second time.
I don't keep instantiating and throwing away connection and command instances -- that's wasteful (not that I've benchmarked it).
But now I don't know what you mean by "each object can access the database independently". What objects? I have one data access class that is basically a wrapper around one Connection/Command (with specialized versions for the various databases I use). I can instantiate one for each database and I can clone it when I need an additional connection to a particular database.
|
|
|
|
|
class base
{
string m_connString;
public string ConnString
{
get{ return m_ConnString;}
private set{ m_ConnString = value;
}
public Base()
{
ConnString = default_value
}
pubic Base(string connString)
{
ConnString = connString;
}
}
class Derived : Base
{
pubic Derived(string connString) : base(connString)
{
}
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I've got a tree view with multiple nodes added during run time and they have different images from image list.
But once you start clicking them, they change the image to recent added one.
There is somthing to do with SelectedImageKey property. How to disable such changes?
Чесноков
|
|
|
|
|
If I'm understanding you right, you want both images to be the same. A TreeNode object has two images. Once image is for the not selected and the other is for the selected/expanded view. Just set both properties to the same value.
TreeNode tn = new TreeNode();
tn.SelectedImageIndex = 0;
tn.ImageIndex = 0;
Hogan
|
|
|
|
|
Hi friends.
there is a clinic software who was written by a bankrupted company,
and now it doesn’t work by the some reason, and there is no support on this software,
All things that I have to do are recover the patient’s data that was written by doctor handwriting in his notebook tablet-pc.
let me describe a little...
software has a feature that allow to the doctor to write the patients information by hand writing with an electrical pen, it so like paint brush software and it save this information in the database like bellow...
AIfIAR0E2A/uBgIZAkgRBUgRRP8BBEgQRTUKSBFXDQAAAFD/AQQDATgAGCIgMgkA9P8CAekiOkUzCQD4nwIBWiA6RTgIAP4DAAAAgH8ADw4S+SONP88jjT8RAACAPx4+4gKD/glK/glJAAAAAAAAAAAYyAAAAAAAAAAAAAAAAAiQIkAAAAAAVMgAAAAESAEJAAAAAAxkAAAAAAIfEAAKLw+E+44+492VloilKFtOjSCG4PDhA6KAjpKCkI
i found that, it's definitely a String Base 64, 'cause I was able to build a byte array from it with this code:
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
and then i use this :
public Image ByteToImageConvert(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
but i face with this problem on " Image returnImage = Image.FromStream(ms);":
Parameter is not valid.
So What should i do?
i attached the database file here/:
http://rapidshare.com/files/302706380/test.accdb.html
there is a tables in the database, and all thing that i need is the "VISIT Table" 's information on the column by the name "NOTES", i think it must be image.
HELP ME,THis IS UrGENT Problem!
thank you very much!
With best Regards!
modified on Thursday, November 5, 2009 7:36 PM
|
|
|
|
|
Forgive me if I seem a bit dense..... I am unable to find a question anywhere in your post nor could I find any relevance to C#.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Dear Wes Aday,
If you do more attention, you will find that, my question is relative to C# problem.
i need to know what functions or method or classes should i use to solve my problem in C#!
Well i found that, it's definitely a String Base 64, 'cause I was able to build a byte array from it with this code:
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
and now the thing that i'm looking for is:
How could i make an image from byte?
thank you!
|
|
|
|
|
maysam gamini wrote: If you do more attention
If you would go back and read your original post, no where in the post is any reference to any C# code that you have tried to address your database problem. I paid very careful attention.
In any case you might try this C# Image to Byte Array and Byte Array to Image Converter Class[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
THank you Wes Aday,
i use this :
public Image ByteToImageConvert(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
private void button2_Click(object sender, EventArgs e)
{
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
pictureBox1.Image = ByteToImageConvert(data);
}
but i face with this problem on " Image returnImage = Image.FromStream(ms);":
Parameter is not valid.
What should i do?
PLease HELP!
thank you!
|
|
|
|
|
I wouldn't be too sure that the string is encoded in base 64 unless you know for sure that it is. Would be unusual to my way of thinking. I am thinking that the MemoryStream is the invalid parameter because the byte array is invalid.
maysam gamini wrote: string strData = dataGridView1[2, 0].Value.ToString();
try something like:
byte [] data = new ASCIIEncoding().GetBytes(strData);
MemoryStream ms = new MemoryStream(data);
Image im = new Image.FromStream(ms);
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Thank you,
but unfortunately i sill have he same problem as before.
Parameters is not valid!
private void button2_Click(object sender, EventArgs e)
{
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = new ASCIIEncoding().GetBytes(strData);
MemoryStream ms = new MemoryStream(data);
Image im;
im = Image.FromStream(ms);
pictureBox1.Image = im;
}
|
|
|
|
|
Sorry
Like Richard said. There are 2 things that I can think of:
1. It's not really a valid image stream. That is, the data is not an image but something else.
2. The data string is encrypted.
BTW I think that you will have a hard finding someone that will take your database and just open it up. Especially from an unknown source. *I* won't do it.
Good luck.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Dear Friends,
Well i found that, it's definitely a String Base 64, 'cause I was able to build a byte array from it with this code:
string strData = dataGridView1[2, 0].Value.ToString();
byte[] data = Convert.FromBase64String(strData);
and i use this :
public Image ByteToImageConvert(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
but i face with this problem on " Image returnImage = Image.FromStream(ms);":
Parameter is not valid.
What should i do?
PLease HELP!
thank you!
modified on Thursday, November 5, 2009 6:55 PM
|
|
|
|
|
maysam gamini wrote: Parameter is not valid.
I think this message is telling you that the stream is not a valid image stream. It does not matter how you create the stream, unless it is a valid image it will not convert. You need to check the format of correct image streams and then compare to your data to see what the differences are.
|
|
|
|
|
thank YOu!
Guys, I attached the Database File and all information that i have, please just try, and find a soloution for me.
tnx!
i probably know what the problem is, but i don't know how could i handle it!
|
|
|
|
|
maysam gamini wrote: Guys, I attached the Database File and all information that i have, please just try, and find a soloution for me.
I don't have the time or the expertise to do this; I am sorry but the problem is yours to resolve. People here will help where they can but if you need a full solution you will probably have to pay someone for it.
|
|
|
|
|
|
Good afternoon. I have the following code:
private void cboFolder_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboFolder.SelectedValue != null)
{
Cursor.Current = Cursors.WaitCursor;
SetProgressBarMarquee();
lblLoading.Visible = true;
progressBar1.Visible = true;
this.viewToolStripMenuItem.Enabled = true;
cboSP_Site.SelectedIndex = -1;
cboWS.SelectedIndex = -1;
txtAddress.Text = cboFolder.SelectedValue.ToString();
WebBrowser1.Focus();
WebBrowser1.Url = new Uri(cboFolder.SelectedValue.ToString());
SendKeys.Send("+{F10}(VD)");
}
}
private void SetProgressBarMarquee()
{
this.progressBar1.Style = ProgressBarStyle.Marquee;
this.progressBar1.MarqueeAnimationSpeed = 50;
}
When I select one of the items in the combo box the folders display in detail format, but others do not. On the second selection for example temp folder it displays as details.
Any suggestions? WHEELS
|
|
|
|
|
I have this little code who is adding that number to a listbox1, already make in the UI.
What I want is to RENAME the listbox1 to lb, BUT inside this void ONLY.(I think of it as a some sort of variable when I want to rename it.)
HOW TO DO IT?
public void ListBoxItemAdd()
{
listBox1.Items.Add("12345");
}
Thanks
~Teodor~
|
|
|
|