|
Huh? A rainbow...
So it starts off really hard, then eases out. And as time goes by you slowly forget everything you already learned?
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
The Undefeated wrote: A rainbow...
Yep. It invites you for a long journey, but you will never reach the end (remember,
that's where the pot of waffles and pie is). I can't remember the part about forgetting
everything though.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I have an older imaging toolkit that I use in a number of apps and I am trying to migrate one of them to C#. The toolkit has a number of ActiveX OCX controls. I have tried to add them to my C# app, but to no avail. I use SharpDevelop as my IDE.
So far, I have been able to add references to my app, but I cannot find a way to add the controls as components so that I can drop them onto my forms. Can this be done, and if so, how do I go about doing so?
Thanks in advance,
William
|
|
|
|
|
Hello all,
If i am showing a message with a MessageBox how can i close it myself with a timer...?
Thanks for the help...
Luis E Tineo S
|
|
|
|
|
You can't. Create your own form that looks like a message box so that you can put a timer on it.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Oh well... I think that it is much better since i can have it look the way i wanted, plus i can have more control over it.
Thanks for the info!!!
Luis E Tineo S
|
|
|
|
|
|
OK, I love to learn new and better ways to do things, but this just doesn't seem one of them.
I'm originally from the Java camp so I've used straight DB code such as hard coded calls to the database and ORM tools like Hibernate. I've been working in VB for the past 5 years on various projects and have used similar techniques here as well.
I am working on a fairly large project and decided to use strongly typed db access such as what is taught in these fairly popular tutorials:
http://www.asp.net/learn/data-access/[^]
Boy am I getting a headache. It seems to me that the only benefits I get are IntelliSense and compile time checking. IntelliSense wasn't available before strongly typed database code so this is more of a convenience than any real need. Compile time checking is nice but I've already had several errors that are not caught until runtime. These errors largely deal with enforcing constraints when filling a DataTable using a standard DataAdapter. Most of these errors are extremely trivial, do not interfere with my actual code and would never have been brought to my attention without strongly typed db code.
So here is what I see as the major negative. I feel like I am getting much more code dependence rather than the current shift towards independence. This project largely works with data from a vendor database. If they ever update their schema (which can be as often as once a week) my app will break, even if they simply change a field from varchar(10) to varchar(12).
I'm starting to lean towards either rolling my own db code or using NHibernate again. Also, LINQ seems to be a departure from this strategy as well.
Does anyone else have any comments? Have any of you used strongly typed db code on a large project and found it to be indispensable? What am I missing?
Thanks!
Matt Penner
|
|
|
|
|
We use XPO[^] here at work. We had done it "by hand" previously, and XPO saves us tons of time.
That said, it's not a walk in the park. There are still issues, such as the db scheme change breakings (although XPO handles most schema changes automatically OK).
Most O/R mappers give you database independence; your code will work with MS SQL Server, MySQL, Oracle, Access, whatever.
Overall, I'm certainly glad we have an O/R mapper. It could be better, but it's far, far better than doing it by hand.
|
|
|
|
|
Judah Himango wrote: It could be better
Yes it could. As a work around, don't do development that uses databases... actually don't do development that uses data at all.... oh what heck just don't do software development. Hey maybe the circus that's in town could use another clown?
|
|
|
|
|
led mike wrote: Hey maybe the circus that's in town could use another clown?
Sorry, I went there last night and took the LAST CLOWN JOB IN TOWN. Ha. Take that, you clown-wannabe.
|
|
|
|
|
Judah Himango wrote: you clown-wannabe.
Not really... I was just clowning around.
|
|
|
|
|
Yay XPO. I like XPO - even with its quirks.
|
|
|
|
|
MattPenner wrote: What am I missing?
This requirement of yours seems to stand out... to me anyway.
MattPenner wrote: If they ever update their schema (which can be as often as once a week)
That seems to be a significant requirement to me. Based on that requirement I would not expect standard database techniques to sufficiently meet that requirement. It might warrant specific custom design to accomplish flexibility and extensibility.
|
|
|
|
|
On program startup, you could query the schema for all your tables. Build class to hold information like field names, value types and lengths.
Here's some of my code, I'm sure most people here can come up with something more effecient . The tabbing is getting killed but you get the idea.
Mine looks something like this
<br />
namespace DBWrapper<br />
{<br />
public class FieldInfo<br />
{<br />
private string strField = string.Empty;<br />
private string strType = string.Empty;<br />
private int nLen = 0;<br />
<br />
public string FieldName<br />
{<br />
get { return strField; }<br />
set { strField = value; }<br />
}<br />
<br />
public string FieldType<br />
{<br />
get { return strType; }<br />
set { strType = value; }<br />
}<br />
<br />
public int FieldLen<br />
{<br />
get { return nLen; }<br />
set { nLen = value; }<br />
}<br />
}<br />
<br />
public class TableData : List<FieldInfo><br />
{<br />
public FieldInfo Get(string strFieldName)<br />
{<br />
FieldInfo retFieldInfo = new FieldInfo();<br />
<br />
foreach (FieldInfo fiInfo in this)<br />
{<br />
if (string.Compare(fiInfo.FieldName, strFieldName, true) == 0)<br />
return fiInfo;<br />
}<br />
<br />
return new FieldInfo();<br />
}<br />
<br />
}<br />
}
<br />
To get the schema info I use this (I think this is half my code and half somebody elses but it's been so long since I touched it I don't remember)<br />
<br />
protected bool GetTableSchema(out DataTable dtSchema)<br />
{<br />
dtSchema = new DataTable();<br />
SqlCommand dbCommand = new SqlCommand();<br />
SqlDataReader dbReader;<br />
bool bRetValue;<br />
<br />
if (!OpenDatabase())<br />
return false;<br />
<br />
try<br />
{<br />
dbCommand.CommandText = "SELECT * FROM " + m_strTableName;<br />
dbCommand.Connection = m_DBConnection;<br />
dbReader = dbCommand.ExecuteReader(CommandBehavior.KeyInfo);<br />
dtSchema = dbReader.GetSchemaTable();<br />
bRetValue = true;<br />
}<br />
catch (Exception ex)<br />
{<br />
string strErrorMessage = "Error Getting Table Schema " + dbCommand.CommandText + "\r\nMsg: " +<br />
ex.Message;<br />
#if DEBUG<br />
Console.WriteLine(strErrorMessage);<br />
#else<br />
m_LogHandler.WriteLogLine(strErrorMessage);<br />
#endif<br />
bRetValue = false;<br />
}<br />
finally<br />
{<br />
CloseDatabase();<br />
dbCommand.Dispose();<br />
}<br />
<br />
return bRetValue;<br />
}
|
|
|
|
|
these objects can just be templated and code generated ... there are code generators out there that can use db schemas as a datasource but I've always just rolled my own code generator.
|
|
|
|
|
Hey Everybody!!!
I'm having the weirdest problem ever! I really can't figure it out!
I wrote a crawler, and I am downloading using DownloadData() of the WebClient class.
I'm starting to crawl when all the time I am getting a WebException with the message "The operation has timed out".
I can easily surf to this page using my browser, moreover, when I try to download ONLY this page using the DownloadData(), the page is being downloaded without any problems!!!
I keep on getting this exception specifically on this page.
I'm really stuck with it !!!
Help anyone????
Thanks in advance !!!
|
|
|
|
|
Here's a wag.... your crawler may be being detect as a bot by bot prevention systems running on that server.
|
|
|
|
|
Thanks for the QUICK reply , but I thought about it...
I tried to prevent it using Thread.sleep(1000) AND changing the user-agent to IE's user-agent.
but it doesn't work
maybe it checks using a different method, but I can't really think of one....
|
|
|
|
|
Green Fuze wrote: I thought about it...
I tried to prevent it using Thread.sleep(1000)
I don't know what kind of response you are eliciting with that statement but I am going to choose to say "no comment".
|
|
|
|
|
you wrote that maybe my bot is being detected by some kind of a bot detection. So, from what people told me, too many HTTP requests in an interval might point out that it is a bot, Therefore by using Thread.sleep, I thought maybe I would cause my bot to perform less HTTP Requests, thus making it look like it is a human, and not a bot. anyway, it doesn't work... so....
|
|
|
|
|
Green Fuze wrote: thus making it look like it is a human
how did you make it look human by requesting a page every second? You think real people do that?
|
|
|
|
|
I can't remember off the top of my head but there is a way to send data about how you are accessing the data, such as what type of user, browser capability ect. Look into how to set that and it may fix your problem.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
|
Or you might have wrong proxy address in the config file.
|
|
|
|