|
Christian Graus wrote: answered this yesterday. So did several other people.
Here we go again, huh?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Use a more meaningful subject line, instead of just c#.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I need to be able to do JPEG lossless rotations/transformations in C#. Unfortunately, the methods available in C# are not reliable enough.
Does anyone have a wrapper for jpegtran for use in C#?
|
|
|
|
|
If it's a C++ dll, you can use p/invoke
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Unfortunately, it's an exe.
|
|
|
|
|
Is there any way to expand (or collapse) individual categories in the PropertyGrid?
|
|
|
|
|
hi, i recently started rewriting a lot of my c++ code over to c# and have come across a very tough issue which i would really like some help solving. what i am trying to make is a program that allows a user to load a dll file at run time which the dll file would be a .net managed dll file like the application BUT i do not want the application to know anything about the dll files, i have seen a lot of stuff on doing this but so far not much of it has worked as i think i am not writing the dll file correctly, the dll file i would like to be able to use forms with and i think i have not done that correctly which is making it impossible to load the dll file correctly. so if someone could please show me something on how to write the dll file correctly so it can load forms properly and allow my application to load the dll file correctly, i would very much appreciate it.
thank you in advance.
|
|
|
|
|
DataTable passwordTable = user_TableTableAdapter.GetDataBy(textBox1.Text);//getDataBy returns a Datatable
DataRow [] passwordRow = passwordTable.Select();
Object passwordObject = passwordRow.GetValue(0);
string Userpassword = Convert.ToString(passwordObject);//trying to retrieve password...
if (Userpassword == textBox2.Text)
{
Form n = new Form4();
n.Show();
this.Hide();
}
else
MessageBox.Show("Wrong Password");
Im trying to compare the password entered on textbox to password in SQL Server..
returns a error..Any better way of doing this, let me know..;)
Is this chair taken
|
|
|
|
|
Bonsta wrote: Im trying to compare the password entered on textbox to password in SQL Server..
returns a error
Can you be more specific about the error that you are getting?
|
|
|
|
|
Looks like you have password in plain-text since it looks as if you have the user enter a password in the textBox2. This is not good practice. I'd look at cryptography algorithms before continuing on.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I have a SQL 2005 Database that has a Table called User that stores users of the application and their passwords and access levels...
I want to:
1)retrieve the pasword for the Username entered on the textbox1.(if username not found show Error)
2)check retrieved password against the password entered on textbox2
3)if they match, open next form(Form4())
I have been looking for articles on the site, but have not been successful...If there is a simpler way plz help.
Thanks in advance.....;)
Is this chair taken
|
|
|
|
|
Bonsta wrote: check retrieved password against the password entered on textbox2
Like I said before, not a good idea having password in plain text. Have it encrypted on the database side, and characters masked out in the textbox. When doing the check, encrypt the textbox text to a temporary string and then compare against the database.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Is there a way to display an additional dialog in the Setup project generated by Visual Studio 2003?
I want to display a dialog which will require the user to enter installation password. The dialog would first have to generate a random string, and then check if the password is the right one for that string. I have allready made that dialog, so my problem is the following:
I have tried two things:
1) I created an Installer class, and overriden the OnBeforeInstall method, to display my dialog. Then I added the compiled FormDialog.EXE as a Custom Action in the Setup project. However, the dialog appears during the Installation Progress, when the progress meter shows that the installation is almost complete. And I wanted it to display before the progress bar is shown, so that the installation would not start before entering the password.
2) I added a "Textboxes (A)" dialog in the user interface of the Setup project. But, I do not know how to make the setup generate the random string, and check if the password is correct, since I am not able to make any Installer class run before the progress bar of the installation is shown.
Is there a way to run a Custom Action before the Progress screen is show?
And can I make it change value of a TextBox in "Textboxes (A)" dialog?
Thanks
|
|
|
|
|
Custom actions will always run after the installation is completed when the progress bar reaches 100%.
As for adding a custom screen it is possible and you will have to edit the MSI database using a tool called Orca.
Be warned using Orca is a real pain in the butt. I'm surprised MS hasn't done much in this area with Visual Studio.
I will give you a refernce to a codeproject article that discusses addition of a custom installation screen before the installation actually takes place. The article should give you an idea "what" is involved with MSI editing and adding a custom screen.
http://www.codeproject.com/useritems/ChangeVDirWebSetupProject.asp?msg=1631151&Page=2&userid=1785827&mode=all#xx1631151xx[^]
Finally, you can investigate WIX- Windows Installer XML. This stuff is really freaking cool.
|
|
|
|
|
Hi all,
I want to have only vertical scrollbar in my listview .
Can anyone please tell me how can i do it?
Please provide code.
Praveen Sharma
|
|
|
|
|
Hello
I am messing around making things that tell the time zone and other things to learn c #
I was wandering when you see a console app with numbers eg
1. get time zone
2. get date and time
3 etc
how do you do such a menu
Thanks for the help
Mark
Noobster
|
|
|
|
|
static void Main(string[] args)
{
Console.WriteLine("Input number and press ENTER to choose option:");
bool loop = true;
while (loop) {
Console.WriteLine("0 - Exit");
Console.WriteLine("1 - Get Time Zone");
Console.WriteLine("2 - Get Date and Time");
switch (Console.ReadLine()) {
case "0":
loop = false;
break;
case "1":
Console.WriteLine(System.TimeZone.CurrentTimeZone.StandardName);
break;
case "2":
Console.WriteLine(DateTime.Now.ToLongDateString() + ", " + DateTime.Now.ToLongTimeString());
break;
default:
break;
}
}
}
Hope this'll help
Greetings - Gajatko
|
|
|
|
|
wow i was thinking of making variables for each option then having a if statement haha
i guess switch is better for more options..
trying to grasp the bool loop = true;
it keeps asking me once i pick a answer i guess instead of writing a bunch of Console.WriteLine(); cool
Good stuff my brain is frying today lol
|
|
|
|
|
I use "loop " variable instead of just "true " to avoid goto statement. In the case "0" a statement "double break" whould do the trick, but there isn't such thing. So set the variable to false and the next loop will not evaluate.
Greetings - Gajatko
|
|
|
|
|
Hi!
how can initialize attributes?
and how can i read the data from a specific one, not in a search!!
Thanks
|
|
|
|
|
Hi all!
Via Environment.TickCount I can get time elapsed since system started. How could I get time elapsed since user logged in? An array containing all users who log in since the system starts last time and how long they stayed would be the best.
Greetings - Gajatko
|
|
|
|
|
it can be done using WMI (System.Management namespace),I don't know but maybe .NET has some classes which give you these info.
with WMI
you can retrieve these data through Win32_LogonSession and Win32_LoggedOnUser and extract start time from them.
with subtracting from DateTime.Now you'll have the duration
it would be somewhat like this
class UserLogonData
{
const string ALLUSERS = "All";
readonly string userName;
readonly DateTime loggedOnTime;
string logonId;
public string UserName
{
get { return this.userName; }
}
public DateTime LoggedOnTime
{
get { return this.loggedOnTime; }
}
public string LogonID
{
get { return this.logonId; }
}
public TimeSpan LoggedDuration
{
get { return DateTime.Now.Subtract(this.loggedOnTime); }
}
private UserLogonData(string userName, string logonId, DateTime loggedOnTime)
{
this.userName = userName;
this.logonId = logonId;
this.loggedOnTime = loggedOnTime;
}
public override string ToString()
{
return this.userName;
}
public static UserLogonData[] GetUsersLogonTime(string userName)
{
List<UserLogonData> dataList = new List<UserLogonData>();
ManagementObjectSearcher mosUser = new ManagementObjectSearcher(new SelectQuery("Win32_LoggedOnUser"));
ManagementObjectSearcher mosSession = new ManagementObjectSearcher(new SelectQuery("Win32_LogonSession"));
ManagementObjectCollection mocUser = mosUser.Get();
ManagementObjectCollection mocSession = mosSession.Get();
foreach (ManagementObject moUser in mocUser)
{
string userLogonAntecedentData = moUser.Properties["Antecedent"].Value.ToString();
string userLogonUserName = Regex.Replace(userLogonAntecedentData, @".*Name=""(?'name'.+)"".*", "${name}");
if (userName!=ALLUSERS && userLogonUserName != userName) continue;
string userLogonDependentData = moUser.Properties["Dependent"].Value.ToString();
string userLogonSessionId = Regex.Replace(userLogonDependentData, @".*LogonId=""(?'id'\d+)"".*", "${id}");
foreach (ManagementObject moSession in mocSession)
{
string sessionLogonId = moSession.Properties["LogonId"].Value.ToString();
if (sessionLogonId == userLogonSessionId)
{
string dateTime = moSession.Properties["StartTime"].Value.ToString();
string formattedDateTime = Regex.Replace(dateTime,
@"(?'year'\d{4})(?'month'\d{2})(?'day'\d{2})(?'hour'\d{2})(?'min'\d{2})(?'sec'\d{2})\.(?'mil'\d{0,3}).*",
@"${year}/${month}/${day} ${hour}:${min}:${sec}.${mil}");
dataList.Add(new UserLogonData(userLogonUserName,userLogonSessionId
,DateTime.Parse(formattedDateTime)));
}
}
}
return dataList.ToArray();
}
public static UserLogonData[] GetUsersLogonTime()
{
return GetUsersLogonTime(ALLUSERS);
}
}
hope the post would be useful
good luck
|
|
|
|
|
Thank you, thank you and thank you!
1 ) What about this situation:
(current user time line)
SYSTEM START>------|------------|--------|----------|------->NOW
user A|user B |user C |user B |user A
where "|" is a logout/switch operation.
And I want to calculate how long the user A used computer. Your Duration property calculates duration assuming that all these users are STILL logged in.
I suppose a property "LogOutTime " would do that.
2 ) How do you know that?? Please post some knowledge source - I couldn't find it anywhere.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
unfortunately it seems there is no LogOutTime property (at least I didn't found out anyOne)
but AFAIK In windows only on user can work at the same time
so there is a class in .NET name Microsoft.Win32.SystemEvents.SessionEnding it happens when a user trying to logoff or shutdown
so you can find active user through WMI again or through System.Environment.UserName
and find you are in which session.
I think with adding the event to the class you can find total duration.(but it needs your program always run or atleaset when user is going to logout or shutdown)
if you get the duration inside the method associated with that event it would be total user log time.
ofcourse there is another approaches like looking inside eventlogs but i think this is the easiest one
hope the post would be useful
|
|
|
|
|
Thanks!
However it seems to be difficult to get a real duration because of Windows hibernate service.
UserLogonData.GetUsersLogonTime(Environment.UserName) returns an array which contains two items. NOW it looks like I'm sitting on this chair for
LoggedDuration {1.04:01:07} - from yesterday evening, when Windows was hibernated (28 hours?? Oh God...).
or
LoggedDuration {01:49:33.6101250} - today (almost two hours, not so bad)
?
"AFAIK In windows only on user can work at the same time":
Yes, but more than one may be logged in at the same time AND one user can work more than one time in the single system session (if e.g. some other guy kicked him out for a while because he "just wanted to check mailbox", but after that that guy could return back -- and I want to know how (totally) this first guy was sitting on the chair).
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|