|
You lost me
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
then check your pseudo-code.
|
|
|
|
|
|
it wasn't an OR, it was an AND operator that would have fit the bill.
However there is no need to invert the previous test condition as you are already using an ELSE.
Using less code would have avoided the mistake from the start.
|
|
|
|
|
It was obvious when I went back to check - I was just trying to get the OP to try and think it through
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thank you. I have read abit about it and with your directions, i got the understanding of how to do it better.
Thanks.
|
|
|
|
|
i want double like this in vb.net. 1.25 instead of 1.254789. how can i?
|
|
|
|
|
Look at the Math.Round() function, or at string.Format("{0:D2}",myDouble)
|
|
|
|
|
|
I have a form with 4 datagrids, 3 of which are on a tabcontrol. All the grids are coming from the same source. The problem I'm running into is the grids on Tabs2 and 3 are not displaying the data. I stepped though the code and it's there but not displaying. I also changed the tab order to see if I had a code issue but again the grid in tab1 is the only one displayed. This is what I have for code:
For Each dgv As DataGridView In {dgvMain, dgvTab1, dgvTab2, dgvTab3}
dgv.DataSource = ds.Tables("TaskList")
dgv.AutoGenerateColumns = False
Next
Dim dgvRow As Integer = 0
Do Until (i = 15)
dgvMain.Item("RetrievalKey", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("RetrievalKey")
dgvMain.Item("TaskDescription", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("TaskDescription")
dgvMain.Item("LastDoneOn", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("LastDoneOn")
dgvMain.Item("Agent", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Agent")
dgvMain.Item("AgentOrder", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("AgentOrder")
dgvMain.Item("Query", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Query")
dgvTab1.Item("Param0", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param0")
dgvTab1.Item("Param1", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param1")
dgvTab1.Item("Param2", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param2")
dgvTab1.Item("Param3", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param3")
dgvTab1.Item("Param4", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param4")
dgvTab2.Item("Param5", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param5")
dgvTab2.Item("Param6", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param6")
dgvTab2.Item("Param7", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param7")
dgvTab2.Item("Param8", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param8")
dgvTab2.Item("Param9", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("Param9")
dgvTab3.Item("ErrorMessage", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("ErrorMessage")
dgvTab3.Item("QueryPath", dgvRow).Value = ds.Tables("TaskList").Rows(i).Item("QueryPath")
dgvRow += 1
i += 1
Loop
dgvMain and dgvTab1 display, but not 2 or 3. However there are empty cells displaying. Any help will be much appreciated...
|
|
|
|
|
Ok so if I make some changes and add an event to the Tab3 selected event (for lack of a better term) and then populate the DGV it displays. I'd rather it get populated in the first run rather than each time a tab is selected if possible....
|
|
|
|
|
you have a problem with variable i not being initialized when it should.
Why aren't you using a FOR or a FOR EACH loop, like everyone else would?
|
|
|
|
|
Habit of using Do loops...
|
|
|
|
|
Hello,
I'm wondering how you can run a Windows service in ring 0, or at the kernel level, automatically upon start up, if this could be possible.
EDIT:
here's an article I've viewed on CodeProject, I'm still studying it.
Regards,
Brandon T. H.
modified 14-Feb-12 20:31pm.
|
|
|
|
|
The first question is WHY??
Services are User mode apps. Running in Kernel is very aggressively discouraged because of security and stability concerns.
Or are you actually talking about Sessions instead??
|
|
|
|
|
Dave Kreskowiak wrote: The first question is WHY??
I'm creating a firewall with "Tamper protection," so it cannot be interfered with or disrupted.
Dave Kreskowiak wrote: Running in Kernel is very aggressively discouraged
Not always, program an exit function or a shutdown of some sort on your program, and the program will close down completely, so you don't have to worry about it (building a ring 0 service or program without a exit, is plain dumb, since "technically" it is impossible to close it).
Dave Kreskowiak wrote: Or are you actually talking about Sessions instead??
What do you mean by "sessions?"
EDIT:
The people of: Symantec, COMODO or avast! (etc.), knew this would be an issue, as a business they integrated this into there firewalls. But who knows, they probably programmed "tamper protection," upon compile or as the last thing to do to "wrap up" or finish the project, so that they knew the program was finished and stable, and the last thing to do was to do that (put tamper protection on it).
modified 15-Feb-12 4:34am.
|
|
|
|
|
You don't need Ring 0 to make it "Tamper proof". The service isn't going to do the heavy lifting in this kind of application.
An app of this kind has 3 layers. There is a driver that you insert into the network stack that does the actual filtering based on a set of rules. This is what you would put in Ring 0. Oh, this can't be built in managed code (VB.NET, C#, ...) The best language to use is C/C++.
Then there is usually a service that provides two things. The first is an interface to manage the rule sets, which are then provided to the driver. The second is management of the firewall and the reporting database.
The third level is a normal user application that communicates with the service and provides the user interface for managing the firewall.
Sessions: http://windowsteamblog.com/windows/b/developers/archive/2009/10/01/session-0-isolation.aspx[^]
|
|
|
|
|
So the "operational layers" of the program I'm specifying is OR the stuff I need to do it is:
1. Software driver
2. Windows service
3. Process or program
and that they communicate and peer with each other (e.g., I want to block a certain file that I know for sure is a virus, I add it using the dialog on the program, the program says "Hey you need to watch out for this program." and the Windows service says "OK." When the process has been detected, the Windows service says to the driver "Hey can you terminate this program for me?", the driver says "sure.", then the program is gone from the computer memory, since it's process has been terminated), sorta like that?
Another question is that there are 3 rings on your computer (3: software, 2: service, 1: driver, 0: kernel): could I use a set of termination methods, like task kill first, then process terminate and then kernel terminate (if the virus resists or persists to exist?
I am using my own advanced, made firewall/antivirus, since the antiviruses out there that don't supply the options I need, there are all types of exlcusions, and advanced complexity (since I'm a programmer). An I.T. person said any leading antiviruses out there will slow down your computer, regardess of what they say (case in point, Symantec "they prove theres is faster, and it is.....kinda"), they said I'm better off creating my own, but I started the project long before he told me that, and I'm pretty good programmer (programmed for at-least 3 and 1/2 years).
If you wish to see my project/source files, I am more than glad to share them with you. (Only the Gui or program is being made, still in development)
modified 15-Feb-12 11:51am.
|
|
|
|
|
Brandon T. H. wrote: Another question is that there are 3 rings on your computer (3: software, 2:
service, 1: driver, 0: kernel):
Intel processors have 4 rings of execution, which divide authority of code to execute. Windows only supports 2 of them to keep things nice and neat. What Windows calls User Mode is Intel's Ring 3. Kernel Mode is in Ring 0. Other rings are not supported or used.
Applications are not subject to being stuck in any one Mode. Applications switch between modes all the time. You just don't notice anything. For example, in say Notepad, you see the window show up and you click File/Open and get a Open File Dialog. most of this happens in User Mode. You tell it which file to open and click OK. Then the app opens the file for readonly access and reads it. But, since opening a file is a kernel-level operation, you're now executing code in Kernel Mode. All I/O operations go through drivers or APIs that are either found in the Kernel or in Device Drivers. So, you're executing code in the kernel and you didn't have to do anything at all to switch Rings...
All user launched applications and all services you see in the Service Manager run in User Mode (Ring 3). Device Drivers, which are themselves specially written services, run in Kernel Mode (Ring 0).
You user application and service will run in User Mode. Your device driver will run in Kernel Mode.
Brandon T. H. wrote: the program says "Hey you need to watch out for this program." and the
Windows service says "OK." When the process has been detected, the
Windows service says to the driver "Hey can you terminate this
program for me?", the driver says "sure.", then the program is gone from
the computer memory,
Correct, to a point. The network driver will not kill the process. Since at that point, you've already downloaded it and executed it, it's WAY too late for your firewall to do any good. A firewall handles network communication only. It does not control process, just their access to the network. Firewalls examine network traffic and route and block it accordingly. For example, a web browser tries to open a connection to a blocked web site (blocked by IP). The firewall sees the outbound request going to that IP and blocks it by not forwarding the request down the network stack and/or rerouting the request to some other IP and port.
Killing a process is the job of a virus scanner, which will follow the same architecture, but not have anything to do with the network traffic. It deals will stuff on the machine that has already made it past the inbound firewall filter. (A firewall has no way of knowing that a certain .EXE is coming through the pipe.) The virus scanner driver becomes ad part of the file system as an extension or filter driver. When the file is finally written to disk and closed, the virus scanner can examine the contents and decide whether to kill the file or quarantine it. It would also hook part of the Loader to stop an infrected .EXE from being launched.
Brandon T. H. wrote: If you wish to see my project/source files, I am more than glad to share
them with you.
I've got enough of my own code to pour over.
|
|
|
|
|
I am redoing some vb6 programs with vb.net. My target system runs 64 bit windows 7 and I.E. 9.0.4
The vb6 program used the command:
l_lngRetVal = ShellExecute(0&, vbNullString, _ txtURL.Text, vbNullString, "C:\", SW_SHOWNORMAL)
To start I.E. and the same command would open additional tabs if I.E. was allready open.
My new program uses the code:
Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", txtURL.Text)
This allways starts a new instance of I.E.
How can I get it to just open a new tab on the existing instance??
|
|
|
|
|
If Internet Explorer is the default browser,
Process.Start(txtURL.Text)
the URL will be opened in Internet Explorer.
I am not sure if it is opened in a new instance, or in a new tab.
|
|
|
|
|
HI,
I need VB code/Macro to fetch QC report? or anyone have query in QC 10 to fetch execution status of tests.
|
|
|
|
|
First, what the $(#*&$ is "QC 10"??
Second, nobody is going write your code for you.
|
|
|
|
|
If you mean Quality Centre, you have my deepest sympathies in having to use that steaming pile. However the DB is just SQL Server, so why not go to that directly?
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Although in C# this [^] article will act as a good starting point
|
|
|
|
|