|
You do realise that we know you work for Merrill Lynch don't you, and that we have your email address. How do you think your boss would feel if he read this message and realised you didn't know how to do your job?
|
|
|
|
|
I already emailed his boss
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I really wonder how come these guys go through the interview with such an amount of lethargic attitude.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Yes, I wonder the same as well.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I write as one who is little more than a novice. As of this writing, I have litte more that the concepts of namespace, class, methods, operators, operands. Although there is much more learning in my path I have a need to comprehend and ultimately create an API for a project. My thinking is that if I can actually do items necessary to such an interface my practical experience would be more memorable to me. As of this writing, I have read the entire Wikipedia primer... understanding about half of it.
Primarily, I would want to see reading appropriate to my level but also some exercises so as to demonstrate what does what. Hoping for someone's guidance for a series of correspondence that would be finite. Presently working with visual studio 2008 Team Suite.
|
|
|
|
|
mauricemcse wrote: Although there is much more learning in my path I have a need to comprehend and ultimately create an API for a project
Considering you said you are a little more than a novice, I wouldn't recommend goind into API design this early. Other members may confirm or refute my opinion though.
API design is hard, and takes a lot of time to master (if it can be mastered). First of all, you have to design a whole set of class interactions: how they are related, how they communicate to each other, design patterns which may or may not be applied to some or all of them.
Then it's the user's point of view, and that is the hardest of all. You have to put yourself in your user's shoes and think like one: How could you make your API easy to use? How could you make the vital things obvious, while not buzzing him with details? What defaults should you provide? What sensible defaults should you set? How is your API configured, and how easily configurable can you make it? Then comes the API documentation, so on and so forth.
In my opinion, you cannot create an API before you master the use of at least several major ones (.NET comes to mind, and then another example of a well-designed API - the Android Java API). Also, you cannot create an API without a deep understanding of OOP and its concepts - classes, interfaces, inheritance, overloading, the whole primer. That's maybe the thing of most paramount importance.
After doing your homework learning OOP and playing around with some big APIs, then you can start doing one yourself. Start small - a small math library for instance, with a broad design instead of a deep one (in this way you don't have to think a lot about class links). After that, you can go on and expand your possibilities and your views (incremental doctrine comes to mind).
I'm actually looking forward to see more experience members' opinion on this, may spark a nice discussion.
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
I agree with Andrei, do not start with an API, think up a project that interests you, a hobby or something you have asome knowledge of. I had one novice build a dive log as his sport was scuba diving therefore he kn what he wanted. Start from there.
Design the data structures your want to work with then build your database (I am LOB centric so I always think database first) then decide on your interface and start designing that. All the while reading up on the aspects of developing you are working with.
I think there are a number of articles on the first steps to becoming a developer around - good luck
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I also saw you got downvoted. While this shouldn't have been posted in C# (I think it would have been better posted in Design and Architecture), I am willing to cut you some slack because I believe your question was valid, and well-formulated (something we don't see much around here).
Downvote countered
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
As the others said an API might be to soon.
If you want to learn and understand better, I would try to master the English language better first.
Don't get me wrong, you clearly did an effort to make yourself understandable, but the text does more resemble a google translate than really understanding the language. Understanding English better will make you understand the articles/tutorials better and will give you a broather range of resources to search for.
V.
|
|
|
|
|
First of all, welcome to the world of programming. I hope that the negative votes won't put you off.
Unfortunately, you have a lot of work ahead of you getting to understand the basics of programming in .NET. This is far too big an area for you to skip, and no one is likely to offer to enter into correspondence with you to teach you how to do this. The brutal truth is that we are all busy people, and offering this level of tuition is a full time affair - saying that, there's no reason for you not to ask about specific things and people will try to help you here if they can.
I would suggest that you start off by reading something like Jon Skeet's C# in Depth[^] to get a good understanding of C#.
Finally - the API itself. Writing an API is hard. It's not simply a matter of slinging some methods together. A good API requires a deep understanding of how people are going to access your code, and how they are going to use it. This really is advanced stuff and I would steer clear of it if possible. If you must produce an API, make sure that you check every input to ensure that it is valid - the golden rule of API design is "trust nothing".
|
|
|
|
|
mauricemcse wrote: create an API for a project. My first question would be: why do you believe you need to create an API? Have you actually analysed the problem you are trying to solve and determined that this is the optimum answer, or do you just think it 'sounds right'?
As to learning, you don't mention what language(s) you plan to use, but since you posted this in the C# forum I would suggest .NET Book Zero[^] as an excellent primer.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
In a C# 2008 desktiop application, I have a line of code that fails a try catch block.
The line of code is:
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
The wholse section of code looks like:
public Attachment AttIputDoc(String custId, String fileName)
{
Attachment att = new Attachment();
byte[] buffer = null;
try
System.IO.FileStream fileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
catch (Exception e)
{
}
The line of code is trying to access a file that does not exist in a specific location.
Can you tell me how the code listed above knows where the directory path is for the file that needs to get uploaded at? The place it thinks the file needs to be loaded from is where the source code of where the application is acutally running from.
How would I override the default location so I can obtain the value from the app.config file?
|
|
|
|
|
This supposes that you have stored the value in your appSettings in a key called Path.
string path = ConfigurationManager.AppSettings["path"];
string fullPath = System.IO.Path.Combine(path, fileName); Then, use fullPath in place of fileName when you create the FileStream.
|
|
|
|
|
I obtained the code from a contract shop. You code has been setup in the app.config file yet.
|
|
|
|
|
If this method is sealed to you, then you must pass in the fully qualified file name. The code I gave you will still do.
This is the problem with contract shops; they don't always give you good code. They'll give you exactly, and only, what you ask for.
|
|
|
|
|
But even when it works the reference will immediately go out of scope.
|
|
|
|
|
Hi,
I am getting the above error on the last line:
MSSQLconnection.Close();
could you please help..
here is the code:
try
{
MSSQLconnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSQL"].ConnectionString);
MSSQLconnection.Open();
MSSQLcommand = new SqlCommand("select * from persons where is_migrated = 0 order by file_no", MSSQLconnection);
MSSQLreader = MSSQLcommand.ExecuteReader();
while (MSSQLreader.Read())
{
lblFileNo.Text = "File# " + MSSQLreader["file_no"].ToString();
MySQL_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["mySQL"].ConnectionString);
MySQL_connection.Open();
MySQL_command = new MySqlCommand("insert into patients (current_file_no, id_type, id_number, date_of_birth, full_name, nationality, gender, old_file_no, marital_status, blood_group, patient_is_vip, is_outside_country, address_outside_address, address_country, address_flat, address_building, address_road, address_avenue, address_block, address_po_box, contact_mobile, contact_home_tel, personal_email, created_date) values (param_current_file_no, param_id_type, param_id_number, param_date_of_birth, param_full_name, param_nationality, param_gender, param_old_file_no, param_marital_status, param_blood_group, param_patient_is_vip, param_is_outside_country, param_address_outside_address, param_address_country, param_address_flat, param_address_building, param_address_road, param_address_avenue, param_address_block, param_address_po_box, param_contact_mobile, param_contact_home_tel, param_personal_email, param_created_date)", MySQL_connection);
MySQL_command.Parameters.Add("param_current_file_no", MySqlDbType.Int32).Value = Convert.ToInt32(MSSQLreader["file_no"]);
MySQL_command.Parameters.Add("param_id_type", MySqlDbType.VarChar, 255).Value = MSSQLreader["id_type"].ToString();
MySQL_command.Parameters.Add("param_id_number", MySqlDbType.VarChar, 255).Value = MSSQLreader["id_number"].ToString();
MySQL_command.Parameters.Add("param_date_of_birth", MySqlDbType.VarChar, 255).Value = MSSQLreader["date_of_birth"];
MySQL_command.Parameters.Add("param_full_name", MySqlDbType.VarChar, 255).Value = MSSQLreader["person_name"].ToString();
MySQL_command.Parameters.Add("param_nationality", MySqlDbType.VarChar, 255).Value = MSSQLreader["nationality"].ToString();
MySQL_command.Parameters.Add("param_gender", MySqlDbType.VarChar, 255).Value = MSSQLreader["gender"].ToString();
MySQL_command.Parameters.Add("param_old_file_no", MySqlDbType.VarChar, 255).Value = MSSQLreader["old_file_no"].ToString();
MySQL_command.Parameters.Add("param_marital_status", MySqlDbType.VarChar, 255).Value = MSSQLreader["marital_status"].ToString();
MySQL_command.Parameters.Add("param_blood_group", MySqlDbType.VarChar, 255).Value = MSSQLreader["blood_group"].ToString();
MySQL_command.Parameters.Add("param_patient_is_vip", MySqlDbType.VarChar, 255).Value = MSSQLreader["person_is_vip"].ToString();
MySQL_command.Parameters.Add("param_is_outside_country", MySqlDbType.VarChar, 255).Value = MSSQLreader["is_outside_country"].ToString();
MySQL_command.Parameters.Add("param_address_outside_address", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_outside_address"];
MySQL_command.Parameters.Add("param_address_country", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_country"].ToString();
MySQL_command.Parameters.Add("param_address_flat", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_flat"];
MySQL_command.Parameters.Add("param_address_building", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_building"];
MySQL_command.Parameters.Add("param_address_road", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_road"];
MySQL_command.Parameters.Add("param_address_avenue", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_avenue"];
MySQL_command.Parameters.Add("param_address_block", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_block"];
MySQL_command.Parameters.Add("param_address_po_box", MySqlDbType.VarChar, 255).Value = MSSQLreader["address_po_box"];
MySQL_command.Parameters.Add("param_contact_mobile", MySqlDbType.VarChar, 255).Value = MSSQLreader["contact_moblle"];
MySQL_command.Parameters.Add("param_contact_home_tel", MySqlDbType.VarChar, 255).Value = MSSQLreader["contact_home_tel"];
MySQL_command.Parameters.Add("param_personal_email", MySqlDbType.VarChar, 255).Value = MSSQLreader["email_address"];
MySQL_command.Parameters.Add("param_created_date", MySqlDbType.Timestamp).Value = Convert.ToDateTime(MSSQLreader["created_date"]);
int MySQL_reader = MySQL_command.ExecuteNonQuery();
MySQL_command.Dispose();
MySQL_connection.Close();
mark_migrated(Convert.ToInt32(MSSQLreader["file_no"]));
}
}
catch (Exception exp)
{
return;
}
finally
{
MSSQLcommand.Dispose();
MSSQLreader.Close();
MSSQLconnection.Close();
}
|
|
|
|
|
You have closed your connection in the body of the try block, and then you attempt to close it again in the finally block. You only need to do this once - the simple fix is to remove the Dispose /Close pair from inside the try part.
|
|
|
|
|
The way I see it, he actually has 2 different connections in there an MS-SQL and a MySQL one, and in the try he closes the MySQL one, not the MS-SQL one. I had posted the same answer immediately after you, but deleted it. Then I took another look, and spotted it
EDIT: I did upvote your solution before that though, and I'll leave it as is
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
What Andrei says is true, I had thought what Pete said (closing the connection twice) but then I saw they're different connections.
I think I've seen this problem when the command's connection is not closed right away after use; since you already have the data in the reader, maybe you could close the SQLConnection before the while loop and see if it helps?.
And just my point of view: the catch block should either give an informative message of the problem (or at least just log the message somewhere) or it should be done away with.
|
|
|
|
|
Hi guys,
no he's right
sorry..
i missed it..
the connection was already closed here:
mark_migrated(Convert.ToInt32(MSSQLreader["file_no"]));
this is the code which closes the connection:
private void mark_migrated(int file_no)
{
MSSQLconnection_Migrated = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSQL"].ConnectionString);
MSSQLconnection_Migrated.Open();
MSSQLcommand_Migrated = new SqlCommand("update persons set is_migrated = 1 where file_no = " + file_no, MSSQLconnection_Migrated);
int MSSQLreader_Migrated = MSSQLcommand_Migrated.ExecuteNonQuery();
MSSQLcommand_Migrated.Dispose();
MSSQLconnection_Migrated.Close();
}
I will try checking connection state before closing and revert back if not zsolved.
thanks guys
|
|
|
|
|
jrahma wrote: MSSQLconnection_Migrated = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSQL"].ConnectionString);
Isn't that a whole different connection though?
|
|
|
|
|
oh sorry!
you are right..
then where is the problem?!!
|
|
|
|
|
Scoping issues. Try moving your MSSQL connection before the try - catch block. Also, I've only now noticed it. Just out of curiosity: does your code even compile?
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
I don't think that's it either.
|
|
|
|
|