|
Okay I'll give that a try.
I've found out that the XHTML isn't completely valid. Some of the tags aren't closed properly. Here's in excerpt:
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<meta name="robots" content="noarchive"/>
<meta name="description" content="/a/ is 4chan's imageboard dedicated to the discussion of Japanese anime and manga."/>
<meta name="keywords" content="imageboard,japan,anime,manga"/><link rel="alternate stylesheet" type="text/css" href="http://zip.4chan.org/yotsuba.9.css" title="Yotsuba"><link rel="stylesheet" type="text/css" href="http://zip.4chan.org/yotsublue.9.css" title="Yotsuba B"><link rel="alternate stylesheet" type="text/css" href="http://zip.4chan.org/futaba.9.css" title="Futaba"><link rel="alternate stylesheet" type="text/css" href="http://zip.4chan.org/burichan.9.css" title="Burichan"><link rel="alternate" title="RSS feed" href="/a/index.rss" type="application/rss+xml" /><title>/a/ - Animu & Mango</title>
While some of the tags are somewhat formed properly, some aren't. The first one is easy:
result.Replace ("\"/>", "\" />");
I think I could use regex for the tags missing a closing "/" but I don't know how to do that.
[Edit]
Okay the result.Replace bit isn't working.
modified on Thursday, June 25, 2009 1:18 PM
|
|
|
|
|
I'm afraid you may have to use a custom parser, for HTML.. That will work, but it's a lot of work to make.
|
|
|
|
|
Well all of the HTML seems to be properly nested as per the XHTML specs, but some of the tags simply aren't closed properly. All I may need to do is C#'s version of PHP's preg_replace function.
|
|
|
|
|
If you can get that to work then it's probably less work, but it may not be as robust. Up to you though
|
|
|
|
|
I found more malformed HTML on other boards. It seems that my program will be significantly more complicated than I though.
Putting a XHTML transitional doctype creates 431 errors just on one thread alone.
|
|
|
|
|
I have a MDI project. The child forms have a menustrip, the menustrip used to have items like File, Edit etc. But today when I opened the project the items where gone from designer view. I can still find the items in the dropbox that contain all objects on the form, but when I select them they do not appear. It is not the allow merge property the most people think it is, this is in design mode not run time. The menu doesn't even appear at run time. I have tried google and other sources no sucesss?
Anyone know what causes this ???
tom
|
|
|
|
|
Its look like the problem is in Visual studio IDE
you might want to try this (Work around)
remove the strip from form try adding it again on the from
this might solve your problem
|
|
|
|
|
Yeah I have done that before, but that only solves the problem for a while, what do I do when it happens again? I need to know what causes this?
|
|
|
|
|
This is what I have found out so far: it seems that what you are working with the forms resource folder, and you delete a resource file, I get a message saying that the designer might become unstable. as soon as I delete a resource and I get the warning message and I say Ok, then the menu items disappear and some other random items disappear. The solution to avoid this problem is instead of deleting, one should exclude instead.
Tom
|
|
|
|
|
I am trying to send an SMTP email. It runs fine on my computer and on anothe one at home, both on vista, but when I sent it to a friend who is running windows xp pro it is giving him this error. anyboby knows why and how to solve please?
System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at FireTalkNew.TellFriend.InviteFriend()
at FireTalkNew.TellFriend.btnInvite_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
FireTalkNew
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Ninu/Local%20Settings/Apps/2.0/17HTMRTE.XCA/NAECG3MY.J21/fire..tion_0000000000000000_0001.0000_323f949fc90232cc/FireTalkNew.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Data.Linq
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Data.Linq/3.5.0.0__b77a5c561934e089/System.Data.Linq.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
Assembly Version: 0.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/mscorlib/2.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
FD
|
|
|
|
|
milenalukic wrote: anyboby knows why and how to solve please?
What's the code used to send the email?
|
|
|
|
|
private void SendMail()
{
name = txtName.Text;
string body = txtMessage.Text;
MailMessage email = new MailMessage(FromEmail, ToEmail, subject, body);
SmtpClient SmtpMail = new SmtpClient(host, 25);
SmtpMail.Credentials = new NetworkCredential(email, password);
SmtpMail.EnableSsl = false;
SmtpMail.Send(email);
MessageBox.Show("Your message has been sent.", "Message Sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
FD
|
|
|
|
|
Ive been developing a app that uses a sql compact database (3.5).
when the app installs the database connection path is designed to be dynamic (ie i dont know if there local drive will be c?)
so ive written the follwing (feel free to advise if there is a better way to do this)
namespace SomeNameSpace.DataAccess.Help.SQLCommands
{
internal class ConnectionCommand
{
internal class GetConnectionCommand()
{
internal const string LiveDatabase()
{
private readonly static string xDataSourceAccess = "Data Source=" + System.Windows.Forms.Application.StartupPath + "\\Data\\database.sdf;Password=password1;Persist Security Info=True";
return xDataSourceAccess;
}
}
}
}
but im concerned about have the password in free text, any example of how i can improve this?
thanks
|
|
|
|
|
You mean you're concerned that it's plaintext?
Well don't worry, it's impossible to actually encrypt it. You can obfuscate it (possibly with encryption, but the key you use for that will have to be stored, unless you encrypt the key in which case you have a new key, and in the end you will always have an unencrypted key) but keep in mind that obfuscating it will tell any hacker who just accidentally comes across it that it is something that you wanted to hide and thus must be something important.
So, my advice would be to use the "hide in plain sight" trick - just put it in the AppSettings somewhere, not encrypted, but in separate parts (not the whole string, but only parts, like "password1" or maybe "pass" and "word1" somewhere else to make it look less like a password)
Doing any encryption on it will only make it stand out, and it will never make it impossible to get the password unless even your app itself can not get the password either (which is pretty lame)
|
|
|
|
|
harold aptroot wrote: So, my advice would be to use the "hide in plain sight" trick
..That's just bad advice.
|
|
|
|
|
Not really, there's nothing better you can do..
If you "encrypt" it, the "encrypted" data will stand out like a fire in the night and coupled with the fact that it's impossible to actually encrypt it the situation would just be worse than if it weren't encrypted (and people would just ignore the data unless they were actively trying to hack it)
|
|
|
|
|
Of course the password would have to be something that doesn't look like a password, but that's a small price to pay..
|
|
|
|
|
Encrypt the password in the settings file - as Harold said you can't stop a REALLY determined hacker, but then you aren't interested in a really determined hacker, your customers are only mildly curious about the data in THEIR database and an encrypted password will do 2 things. Supply a reasonable level of security against the power user and assure your customer that you take security seriously.
Remember the customer is, well your customer and it is his perceptions you need to cater for.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi i am new to OOP and c# , Im building a program that reads settings form a .cfg file .
I have managed to import the entrire cfg file into an array using string .split
onst string fName = @"Settings.cfg";
string[] lines = File.ReadAllLines(fName);
List<string> fields = new List<string>();
foreach (string s in lines)
{
if (s == "" || s.StartsWith(" ") || s.StartsWith("/"))
{
continue;
}
fields.AddRange(s.Split(new char[] { '=' }));
}
Settings = fields.ToArray();
However this also adds the setting name to the array which is not needed , is there any way to modify the code so only values to the right of the = get added to the array ?
Thanks
|
|
|
|
|
|
you can use Substring method instead of Split method.
find the index of '=' character using IndexOf method and then pass this index + 1 as the parameter of Substring method.
|
|
|
|
|
Two things occur to me.
The first, to allow you to carry on using the same design that you have:
if (s == "" || s.StartsWith(" ") || s.StartsWith("/"))
{
continue;
}
fields.Add(s.Split(new char[] { '=' }[1])); <===== you might have to add a ToString(), or cast to a string
The second would be to use a Dictionary , rather than a List for fields . This would allow you to keep both parts; the setting name as the key and the setting value as the er.... value.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
If the value contains an equal sign, then also use the overload of Split that limits the number of strings returned.
|
|
|
|
|
If your cfg file is set out like:
Name=SK
FavWord=Delicious
So you only have one item per line, you should just be able to add the second element of the array:
foreach (string s in lines)
{
if (s == "" || s.StartsWith(" ") || s.StartsWith("/"))
{
continue;
}
string[] parts = s.Split(new char[] { '=' });
fields.Add(parts[1]);
}
Also, it might be worth your while to check out the Dictionary class, which may work out better for you. With a dictionary you can add an item like this:
myDict.Add("Name", "SK");
string m_name = myDict["Name"];
Handy stuff.
EDIT: Wow I need to post quicker. When I first hit 'Reply' this question had no answers!
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
SK Genius wrote: EDIT: Wow I need to post quicker. When I first hit 'Reply' this question had no answers!
Ditto.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|