|
Hello to All
I want to change the name of my process or hide it from task manager.
also do you think that the anti viruses warn about it?
Best regards
|
|
|
|
|
mobasher wrote: I want to change the name of my process
Change the name of your executable.
mobasher wrote: or hide it from task manager
Why? The user usually owns the machine that he/she is using, and would have every right to see what is running in his/her system.
mobasher wrote: also do you think that the anti viruses warn about it?
Yes, but merely as being "malware", not a virus.
I are Troll
|
|
|
|
|
There is only one method to do this, but I'm not saying what it is.
mobasher wrote: also do you think that the anti viruses warn about it?
No, but, coming from a LAN Admin background, there is no legitimate reason to do this. If I caught your app doing it, it would be, at my highest priority, uninstalled and the systems rebuilt from scratch. Only malware would ever want to do this.
|
|
|
|
|
I have many parameters in my system_parameters table in SQL and I am populating into a hashtable but it seems it's not reading all (and no error raised!).. it's reading 19 out of 68.. this is my code to read from the sql:
while (sql_reader.Read())
{
if (_system_parameters_hash.ContainsKey(sql_reader["system_param_name"])) return;
if (sql_reader["system_param_value"] == DBNull.Value)
{
_system_parameters_hash.Add(sql_reader["system_param_name"].ToString(), null);
}
else
{
if ((string)sql_reader["system_param_type"] == "bit") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToBoolean(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "string") _system_parameters_hash.Add((string)sql_reader["system_param_name"], (string)sql_reader["system_param_value"]);
else if ((string)sql_reader["system_param_type"] == "int") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt32(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "int64") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt64(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "short") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt16(sql_reader["system_param_value"]));
}
}
and this is a sample rows (parameter name, parameter value then parameter type)
APPOINTMENT_DEFAULT_CLINIC 2 int
APPOINTMENT_DEFAULT_DOCTOR 3 int
BACKUP_DESTINATION_FOLDER C:\Temp\cure.bak string
BACKUP_SCHEDULE_DURATION DAILY string
BACKUP_SCHEDULE_ENABLED True bit
what can I do?
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:24am.
|
|
|
|
|
i did but still the same with no error
and my select statement is SELECT * FROM system_parameters
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:23am.
|
|
|
|
|
what's the use of breakpoint if no error and no problem running the application? were do you want me to set the break point?
|
|
|
|
|
The breakpoint that was mentioned by someone you should place at the begin of the while loop
As to the error without exception. In this line:
if (_system_parameters_hash.ContainsKey(sql_reader["system_param_name"])) return;
you return from method. Are you sure names aren't duplicated at least once... in 20th row returned from your command?
This is something you could discover by debugging your code ![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
start debugging: do NOT set a breakpoint, observe closely what happens, add code to improve visibility; add a try-catch and show Exception.ToString, add an else clause that counts how many entries contain unrecognized types, look at the actual data of the very first row that does not make it to the ArrayList, consider what happens when a DBNull occurs, start thinking and acting.
|
|
|
|
|
i did all that but it's still not working... it's actually existing the while loop when it reaches count 19 with no errors as if my total count in the database table is 19 only!!
any duplicates in the table? that was your question? no, duplicates, I already checked and I have also copied the entire table as excel format in this link:
system_parameters table[^]
this is my full code which I am using:
public void get_system_properties()
{
try
{
_system_parameters_hash = new Hashtable();
_system_parameters_hash.Add("SQL_SERVER_CONNECTION", null);
_system_parameters_hash.Add("SQL_SERVER_DATABASE", "Cure");
_system_parameters_hash.Add("EVENT_LOG_DESCRIPTION", null);
_system_parameters_hash["SQL_SERVER_CONNECTION"] = "Data Source=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLServer").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";initial catalog=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLDatabase").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";User Id=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLUser").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";Password=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLPassword").ToString();
_system_parameters_hash["SQL_SERVER_CONNECTION"] += ";Connection Timeout=";
_system_parameters_hash["SQL_SERVER_CONNECTION"] += cure_registry_current_user.GetValue("SQLTimeout").ToString();
sql_connection = new SqlConnection((string)_system_parameters_hash["SQL_SERVER_CONNECTION"]);
sql_connection.Open();
sql_command = new SqlCommand("sp_get_system_parameters", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_reader = sql_command.ExecuteReader();
while (sql_reader.Read())
{
if (_system_parameters_hash.ContainsKey(sql_reader["system_param_name"])) return;
if (sql_reader["system_param_value"] == DBNull.Value)
{
_system_parameters_hash.Add(sql_reader["system_param_name"].ToString(), null);
}
else
{
if ((string)sql_reader["system_param_type"] == "bit") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToBoolean(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "string") _system_parameters_hash.Add((string)sql_reader["system_param_name"], (string)sql_reader["system_param_value"]);
else if ((string)sql_reader["system_param_type"] == "int") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt32(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "int64") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt64(sql_reader["system_param_value"]));
else if ((string)sql_reader["system_param_type"] == "short") _system_parameters_hash.Add((string)sql_reader["system_param_name"], Convert.ToInt16(sql_reader["system_param_value"]));
}
}
Trace.Write(_system_parameters_hash.Count);
}
catch (Exception exp)
{
create_event("System", "Error populating system properties!!", exp, EventLogEntryType.Error, 1000, false);
MessageBox.Show("Error populating system properties!!" + Environment.NewLine + "Please contact your system administrator.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
finally
{
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null)
{
if (sql_connection.State == ConnectionState.Open)
sql_connection.Close();
}
}
}
|
|
|
|
|
one of the recommendations I made was "add code to improve visibility", I see none of that.
before the reading loop, add code to show the number of rows returned, so you can check that number right away; identify the last row added, or better yet, the first one missing. Would it perhaps be the first one with type "short"? does that ring a bell?
|
|
|
|
|
i copied the real code but i already did the count before when troubleshooting and I got the correct count as per my stored procedure.
what's wrong with the short? it's a data type and I am already including it in both the table row and the code?
|
|
|
|
|
just log intermediate results and locate the problem. it can't be hard. either the data comes in and doesn't get stored, or it does not come in. use logging, don't trust anything as one of your assumptions or observations is bound to be wrong since you don't agree with the results.
|
|
|
|
|
hi friends $ Seniors,
i am trying to save an image in PNG format, the original image is 24dpi and is 16.2 mb, afterwards i add alpha channel to image and make some portion of the image transperant, after this when i save the image img.save(imagepath, imageformat.png) the size is increased to 33 mb. i wanted to know the image size increased is correct? does the image dpi changed from 24 to 32 increases the image so much?
friends, also debugging my code i found a strange thing, which i would like to share with u
Bitmap bmp = new Bitmap(imagepath);
bmp.save("c:\11.jpg"); // this saved image with 16 mb
Bitmap bmp1 = new Bitmap(bmp);
bmp1.save(c:\\22.jpg); // this saved image with 33 mb
Thanking in Advance
Regards
Samir
|
|
|
|
|
1.
Maybe transparency uses the alpha channel, so now every pixel needs 4 bytes rather than 3?
2.
you should never use Bitmap.Save(string), always use Bitmap.Save(string,ImageFormat).
3.
VCsamir wrote: Bitmap bmp1 = new Bitmap(bmp);
An image may hold metadata, e.g. a camera creating a JPEG file adds a lot of metadata to the pixel data. Copying a bitmap like you do does not copy the metadata.
|
|
|
|
|
hello
I have a DataView and bind it to dataset. for find value in dataview, I use dataview.rowfilter
for Example :
dataview.RowFilter="FirstName like 'D*'";
This will display only those records where the FirstName column begins with D.
If I want to *select* those records where the FirstName column begins with D but still display all the records,
What can I do?
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Hi, you cannot select a row by a DataView. i assume that you have bindet the DataView to a DataGridView Control. In this case, the only method to "select" the rows instead of filter, i know, is my following example.
public partial class Form1 : Form
{
private DataView _dataView;
public Form1()
{
InitializeComponent();
for (int i = 0; i < 10000; i++)
{
dataSet1.Tables[0].Rows.Add("A" + i, "A", "A", "A");
dataSet1.Tables[0].Rows.Add("Ae" + i, "Ae", "Ae", "Ae");
dataSet1.Tables[0].Rows.Add("B" + i, "B", "B", "B");
dataSet1.Tables[0].Rows.Add("Be" + i, "Be", "Be", "Be");
dataSet1.Tables[0].Rows.Add("C" + i, "C", "C", "C");
dataSet1.Tables[0].Rows.Add("D" + i, "D", "D", "D");
dataSet1.Tables[0].Rows.Add("E" + i, "E", "E", "E");
dataSet1.Tables[0].Rows.Add("F" + i, "F", "F", "F");
}
_dataView = new DataView(dataSet1.Tables[0]);
dataGridView1.DataSource = _dataView;
}
public void SelectRowsInView(string filter)
{
Dictionary<string, DataGridViewRow> dataGridViewRows = new Dictionary<string,DataGridViewRow>();
DataRow[] dataRows = _dataView.Table.Select(filter);
foreach (DataGridViewRow dataGridViewRow in dataGridView1.Rows)
{
if (dataGridViewRow.Cells[0].Value != null){
dataGridViewRows.Add(dataGridViewRow.Cells[0].Value.ToString(), dataGridViewRow);
}
}
dataGridView1.ClearSelection();
foreach (DataRow row in dataRows)
{
if ( dataGridViewRows.ContainsKey( row[0].ToString() ) )
{
dataGridViewRows[row[0].ToString()].Selected = true;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
SelectRowsInView("Column1 like 'B*'");
}
}
You have to use the primary key of the DataTable as Dictionary Key, there will be a exception, if you use a not non-ambiguous column as key, in this case, the primary key is index 0.
There a some performance optimizing by using a dictionary, i have desist from comment the source code, you can use the method SelectRowsInView as base idea. I hope i could help ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
i have got an eventhandler say evntHnadler , and i want to add another event that should be fired when the "evntHnadler" is fired , but before that i want to check if my second event is already registered with "evntHnadler " or not , any idea how to do it ...
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:24am.
|
|
|
|
|
thanx this is ok for custom created events, but the problem is i'm trying to get the invocationlist from the button1.click, any idea ?
|
|
|
|
|
Hi to all,
How naming controls in C# ?
for example if you have a button for Register , a good name for this button is btnRegister
Button=btn
Label = lbl
TextBox = txt
PictureBox =? and other controls
|
|
|
|
|
|
that would be OK. It is your choice. Or your company's.
|
|
|
|
|
yes,it's true
but i want to find good way for naming controls
|
|
|
|
|