topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday January 27, 2026, 5:13 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: prev1 ... 181 182 183 184 185 [186] 187 188 189 190 191 ... 246next
4626
It's really just different levels of the same thing. The original code used a registry key to enumerate the physical adapters on the machine (and was right on the edge of Quick-N-Dirty). On my dev machine it found 1 Physical Adapter.

The code above is the much more detailed Network Interface list, which is where the more detailed state & status info is kept. On my dev machine it found (roughly) 20 Network Interfaces.

 The nested if's around the for(...) loop are narrowing the list down to less than a dozen items that can/will then be compared (GUID-to-GUID) to the Physical Adapters list to eliminate the disabled adapters from the Drop-Down menu.

From a (Windows) programming standpoint, these kind of shenanigans are normal... ;)

Note: Granted using the WiFi API 4wd mentioned above would have been a more elegant solution (simpler code & faster to pound out), however it also doesn't run on (isn't available in) Windows XP ... Which is (after all) or target platform.
4627
Developer's Corner / Re: Need Advice on MySQL Server Tuning
« Last post by Stoic Joker on February 03, 2011, 06:48 AM »
For indexing in MySQL, you might be surprised at just how much extra performance you can get by indexing fields that you would not normally index. I was working on a largish database and started experimenting with performance there -- additional indexing helped a fair bit.

Actually no, I manage to figure that one out a few years back ... Now I index everything, as it really does make a big difference.



Sounds like a tough nut to crack.

Is it just that the query itself takes a long time? With no resource issues... Bottleneck in there?

Have you tried a query profiler?

Given the scale of what it's being asked to do, sure... It's bound to take a while. It does not however (IMO) need to take that long... :)

Here's the thing... I run one of the problem child queries that I selected for testing purposes while watching Task Manager to see what impact it has on the server's resource usage. While the query is running the server is just chuffing along showing absolutely no sign of a strain.

I know I originally set the thing up conservatively (Instance Configuration Wizard using Developer Machine settings), because I hadn't decided if I could trust it back then. But... Now I gotta give it a bit more freedom to gobble resources because it occasionally needs them. ...Badly...

And that's where the "fun" starts, because there are a ton of different memory caches/buffers/settings which I really need adjust...but  not screw-up.
4628
Okay, nothing real exciting at this point. But I did figure out how to get the adapter status so we can weed out the inactive ones.

I started with some MSDN example code, and beat on it until it started doing what I wanted. Now I just gotta figure out how to combine it with the rest of the project.

While I plan on releasing the code with the finished program, here's is the adapter bit I've been working for the last few days (Which is a bit embarrassing when I thing about it); everything needed to compile & run is below:
Code: C++ [Select]
  1. // GetIfEntry.cpp : Defines the entry point for the console application.
  2. //=============== Created by Stoic Joker: Tuesday, 02/01/2011 @ 6:23:11pm
  3. #include "stdafx.h" //--------------------------------------------+++-->
  4.  
  5.  //================================================================================================
  6. //-------------+++--> Strip \DEVICE\TCPIP_ Off of wszName to Get the Adapter's GUID For Comparison:
  7. void StripOutGUID(WCHAR *szGUID, WCHAR *wszName) { //---------------------------------------+++-->
  8.         WCHAR *p; // Walk the string to find the GUID opening '{' character. Sure There
  9.         int i=0; // Are Easier Ways to do This ... But This Way I Avoid Language Issues.
  10.  
  11.   p = wszName;
  12.   while(*p != '{') {
  13.           *p++; i++;
  14.   }
  15.  
  16.   wsprintf(szGUID, L"%s", p);
  17. }
  18.  //================================================================================================
  19. //------------------------+++--> Get Lst of Network Interfaces Available on Machine for Comparison:
  20. BOOL GetAdapters(WCHAR *szTarg) { //-----------( Much of This is From the MSDN )------------+++-->
  21.         PMIB_IFTABLE ifTable; // Declare and initialize variables.
  22.         PMIB_IFROW pMibIfRow;
  23.         DWORD dwSize = 0;
  24.         DWORD dwRetVal = 0;
  25.  
  26.   // Allocate memory for our pointers.
  27.   ifTable = (MIB_IFTABLE*) malloc(sizeof(MIB_IFTABLE));
  28.   pMibIfRow = (MIB_IFROW*) malloc(sizeof(MIB_IFROW));
  29.  
  30.    // Before calling GetIfEntry, we call GetIfTable to make sure there are entries to get.
  31.   // So... First, make an initial call to GetIfTable to get the necessary size into dwSize
  32.   if(GetIfTable(ifTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
  33.           GlobalFree(ifTable);
  34.           ifTable = (MIB_IFTABLE *) malloc (dwSize);
  35.   }
  36.   // Then make a second call to GetIfTable to get the actual data we want.
  37.   if((dwRetVal = GetIfTable(ifTable, &dwSize, 0)) == NO_ERROR) {
  38.           if(ifTable->dwNumEntries > 0) {
  39.                   for(UINT i=1; i<= ifTable->dwNumEntries; i++) {
  40.                                 pMibIfRow->dwIndex = i;
  41.                           if((dwRetVal = GetIfEntry(pMibIfRow)) == NO_ERROR) {
  42.                                   if(pMibIfRow->dwType == MIB_IF_TYPE_ETHERNET &&
  43.                                           pMibIfRow->dwAdminStatus == MIB_IF_ADMIN_STATUS_UP) {
  44.                                                   WCHAR szGUID[GEN_BUFF] = {0};
  45.                                           printf("\tDescription: %s\n", pMibIfRow->bDescr);
  46.                                           printf("\twszName: %S\n", pMibIfRow->wszName);
  47.                                           StripOutGUID(szGUID, pMibIfRow->wszName);
  48.                                           if(wcscmp(szGUID, szTarg) == MATCH) {
  49.                                                   printf("\tGUID: %S <--+++--> MATCHES REQUESTED ACTIVE TARGET ADAPTER!!!\n", szGUID);
  50.                                           }else{
  51.                                                   printf("\tGUID: %S <-+-> Is Active, But Not the One We're After.\n", szGUID);
  52.                                           }
  53.                                           printf("\tReceived %d, Sent %d\n", pMibIfRow->dwInOctets, pMibIfRow->dwOutOctets);
  54.                                           printf("\t\tNext...\n\n");
  55.                                   }
  56.                           }
  57.                   }
  58.           }
  59.           GlobalFree(ifTable);
  60.           return TRUE;
  61.   }
  62.  return FALSE;
  63. }
  64.  //================================================================================================
  65. //--------------------------------------//---------------------------+++--> Console Program Main():
  66. int _tmain(int argc, _TCHAR* argv[]) { //---------------------------------------------------+++-->
  67.   if(argc < 2) {
  68.           printf("\n\n\tERROR: No GUID Specified, Exiting!\n\n");
  69.           return 0;
  70.   }else{
  71.           printf("\n\n\tSearching for GUID: %S\n\n", argv[1]);
  72.   }
  73.   if(!GetAdapters(argv[1])) printf("\tGetIfTable failed.\n");
  74.  return 0;
  75. }
  76.  
  77.  // ============================================= STDAFX.H <-> Header File Below This Line!
  78. // stdafx.h : include file for standard system include files,
  79. // or project specific include files that are used frequently, but
  80. // are changed infrequently
  81. //
  82.  
  83. #pragma once
  84.  
  85. #ifndef _WIN32_WINNT            // Allow use of features specific to Windows XP or later.                  
  86. #define _WIN32_WINNT 0x0501     // Change this to the appropriate value to target other versions of Windows.
  87. #endif
  88.  
  89. #define GEN_BUFF   128
  90. #define MATCH            0
  91.  
  92. #include <stdio.h>
  93. #include <tchar.h>
  94.  
  95. // TODO: reference additional headers your program requires here
  96. #include <Windows.h>   //--+++--> Also Required by GetIfEntry():
  97. #include <Iphlpapi.h> //---+++--> Required by GetIfEntry():
  98. #pragma comment(lib, "Iphlpapi.lib") //-++-> ^See Above^:

...Crap, I just realized that int i doesn't actually do a damn thing... *Sigh*
4629
Living Room / Re: Google's overweening conceit (anti-Eric Schmidt rant)
« Last post by Stoic Joker on February 02, 2011, 05:45 PM »
I'm always worried when people start thinking that since they (supposedly) know better than me, they have the right to take away my freedom to choose and make decisions for me, for my own good.

Even if they're right, I should still have the freedom to make a bad choice and suffer the consequences.
Damn Straight!

Oh Yeah, and I loved the Wall*E connection...  :Thmbsup:
4630
Developer's Corner / Re: Need Advice on MySQL Server Tuning
« Last post by Stoic Joker on February 02, 2011, 03:03 PM »
You have to determine where most of the report work is being done... the client PC or the server.  Maybe put the SQL as a stored procedure on the server and have the client PC call that rather than doing the SQL reporting stuff on the client PC.

The only thing done client side is Click OK and view. Client connects with a TCP/IP session, spits in query, gets results, and displays. Queries are all structured so that the returned results set can be dropped straight into a ListView control for application use (or are stuffed into a table via either .asp or .php). The only "processing" done client side is input validation ... Which takes about 4ms, and is done prior to query being sent (No used borked queries aloud...).
4631
Living Room / Re: *URGENT* Patch IE security flaw (31 January 2011)
« Last post by Stoic Joker on February 02, 2011, 02:53 PM »
My concern would be users of sites like Twitter, where shortened links are routinely used and you don't really know where they are going. Could one of these specially crafted links be shortened and then posted on Twitter with a catchy headline promising news about current events or other attractive content?

Now, that is an interesting question... While I'd be inclined to say no - exploit should have no effect if sent to the wrong page processor - I'm not entirely sure. But I've always had an aversion stubby links.

NPR had a talk with the head engineer (or some such title) at bit.ly.  She said that there was inbuilt protection against this, using a combination of whitelists/blacklists and heuristics... if a link is questionable (it's not in either of these lists) it goes to a list to be manually checked... but they only have 20 people *total* so there is a window where a potentially malicious link is waiting to be checked and in the wild.

Oh great, we're screwed...  :D
4632
Developer's Corner / Re: Need Advice on MySQL Server Tuning
« Last post by Stoic Joker on February 02, 2011, 10:45 AM »
@Renegade - Just for the record, I designed and wrote the entire system...From the db, to the UI ... So the shooting option is out... ;)

But to be fair:
I seldom use joins.
all the critical stuff is indexed.
and I haven't a clue what denormalizing is/does. ...And I suspect it's rather unlikely that I've already done it by accident.

------------------

Anyhow, here's the thing... While I could, with agonizing care, try restructuring the report queries. I'm not entirely convinced that that will truly give me net effect I'm looking. I say this because of the following reasons:

  • as I mentioned before 99% of the time everything runs just fine
  • Sometimes a large query really is just that: 5,000+ clients, Several thousand items (seasoned with pricing/quantity info that gets tallied & totaled on multiple levels), data set is for the last many years... (Yada yada) ;)
  • It is only the large reports (that should be CPU hogging, yet are not) that are taking time to run
  • The server the queries are run against never shows more that 20% (per core) usage during the query.
  • There are no hardware based reasons (tons of memory available, no disk contention, etc.) for it to take that long.
  • I know that I used the conservative resource settings back when I originally deployed the rig.

So... I'm looking for more of a "Let Loose the Reins!" type of solution so the MySQL server service can have have a better crack at the CPU's "time". I just don't want to over do it because there are a few other things the box does/needs to be handling also.
4633
Living Room / Re: Google's overweening conceit (anti-Eric Schmidt rant)
« Last post by Stoic Joker on February 02, 2011, 10:12 AM »
I am so much more than any of the technologies I choose to employ.

Why can't  "I'm a Mac" and "I'm a PC" understand that?  :-\

I feel like a number,
I'm not a number,
I feel like a number,
Damnit I'm a man...

(you know the song)
4634
I wonder how long Apple can keep this up.  They make good stuff, but it's only a matter of time before they have to let go of their closed system little by little.  Their userbase is growing a lot, and they are going to be asking for this and that, which means more options and capabilities are going to be demanded.  And Apple will have to satisfy them somehow.  If they want to keep this success they have going on, they have to let it go a little.

Quite to the contrary... I think Apple should clamp down as tightly as they can on their little nut. That way there wont be any chance of them falling of while they ride it straight to hell.

...Afterwhich we can all be free of their foolish money-grubbing nonsense. :)
4635
Developer's Corner / Need Advice on MySQL Server Tuning
« Last post by Stoic Joker on February 02, 2011, 08:04 AM »
Greetings
  A few years back I setup a MySQL server back-end for our company with an Intranet website so everybody could have free access to the same correct up-to-date information. This resolved issues we had been having with people squirreling away copies of stuff and then arguing over who's info was the most(est) current/correct. *Sigh*...

  So... This was good, for awhile. But then another db was added for something else, and another, and another... Now 99% of the time all is still just fine, but there are the odd occasions where large (All of the X, who got X, in the past X years...) reports need to be compiled ... And some of these are taking up-wards of 3-5 minutes to complete.

  Initially, I setup the server config to use resources sparingly; used just the basic many things happening on box (MySQL Instance Configuration Wizard) configuration. But now I'm faced with having to re-think that configuration to speed-up report generation...And the settings available on the advanced (MySQL Administrator) options are considerably more complex...

  Mind you I have considered the possibility that I may just be creating a larger problem instead of solving one ... So thought it best to ask if there were any (succinct) best practice tutorials available for tweaking this puppy up a notch so that the larger report queries don't take quite so close to forever to run...

Thank you,
Stoic Joker
4636
Half of all respondents in 2010 reported a failure due to DDOS, which could have been avoided with either more selective router configuration or by adding a layer of security at the edge of the network that can shed bogus DDOS or other unauthorized traffic before it gets to the firewalls.
-bottom page 1 2nd article

So... Now "we" need a firewall for the firewall? This almost sounds like they're trying to conjure up the electronic version of the safest way to get shot in the face.
4637
Living Room / Re: A Funnier IE6 Story
« Last post by Stoic Joker on February 02, 2011, 07:15 AM »
...You mean that silly InterWeb fad/thing ain't blown over yet??? Damn kids these days...

 :D
4638
  • This weekend the company announced new "Starter" editions of C++ Builder and Delphi, priced at about $200.
...or you could get the (IMHO superior) Express editions of Visual C++ and C# instead, for free. Hard decision, hard decision.

I made that switch years ago (I really just wanted smaller code), and have never regretted it.
4639
Living Room / Re: Why does the Mayan calendar end on....?
« Last post by Stoic Joker on February 02, 2011, 07:07 AM »
Oh Great, now I have 3 possible cake timing dilemmas...

Hay, how about a countdown clock with a configurable Apocalypse? ...I could add an EoW (End of World) label to T-Clock... *Shrug* ...To dark maybe..? :-\
4640
Living Room / Re: *URGENT* Patch IE security flaw (31 January 2011)
« Last post by Stoic Joker on February 02, 2011, 06:50 AM »
My concern would be users of sites like Twitter, where shortened links are routinely used and you don't really know where they are going. Could one of these specially crafted links be shortened and then posted on Twitter with a catchy headline promising news about current events or other attractive content?

Now, that is an interesting question... While I'd be inclined to say no - exploit should have no effect if sent to the wrong page processor - I'm not entirely sure. But I've always had an aversion stubby links.
4641
Living Room / Re: *URGENT* Patch IE security flaw (31 January 2011)
« Last post by Stoic Joker on February 01, 2011, 11:01 PM »
From the MS Security Advisory (Mitigating Factors and Suggested Actions):

In a Web-based attack scenario, a Web site could contain a specially crafted link (MHTML:) that is used to exploit this vulnerability. An attacker would have to convince users to visit the Web site and open a specially crafted URL, typically by getting them to click a link in an e-mail message or Instant Messenger message that takes users to the attacker's Web site, and then convincing them to click the specially crafted link.

So once again it's only those who blindly click away at anything that are (actually vulnerable) affected.

Microsoft Security Advisory (2501696)
4642
You would still have to manually dredge up the Adapter's ID string for devcon to (target) use.
4643
I once disabled the NIC on a Production Server I was working on via Terminal Services - ::) - That went rather badly...
4644
Hm... That looks like a Windows (error) message. Can you disable the NIC in question from the Network Connections folder?

(Bing seems to think this is a common Windows issue)
4645
That error message is (should only be) displayed when you hit the cancel button.

yes, that's what i did. was just testing on a PC with non-wifi component to see what happens.
Okay, my intention was to give the user feedback regarding the programs intentions. So they weren't waiting for it to do something else, and/or were not sure it had completely closed. If it is actually causing more confusion I can pull it out of the next build.
4646
That error message is (should only be) displayed when you hit the cancel button.
4647
Well I'll be damned! (me too)

I've been doing most of the testing on my XP laptop(which just exits on LAN), so hadn't noticed this rather interesting behavior.

Strangely my 32-bit Win7 machine at the office didn't do this (or I didn't notice it)...But x64 here does.

The C# Native WiFi API thing didn't pan out as it's Vista/7 only (I'm not ready to give-up on XP just yet), so I'm polking around looking for options.
4648
Post New Requests Here / Re: IDEA: Wireless sensor
« Last post by Stoic Joker on January 31, 2011, 07:13 PM »
While not entirely the answer, I just ran across a very interesting structure (while researching something else (semi related)) in the VS2k5 Platform SDK:

Code: C++ [Select]
  1. DWORD GetIfEntry(
  2.   PMIB_IFROW pIfRow
  3. );

One of the members of the MIB_IFROW structure is dwOperStatus, which has these possible values:
ValueMeaning
MIB_IF_OPER_STATUS_NON_OPERATIONAL LAN adapter has been disabled, for example because of an address conflict.
MIB_IF_OPER_STATUS_UNREACHABLE WAN adapter that is not connected.
MIB_IF_OPER_STATUS_DISCONNECTED For LAN adapters: network cable disconnected. For WAN adapters: no carrier.
MIB_IF_OPER_STATUS_CONNECTING WAN adapter that is in the process of connecting.
MIB_IF_OPER_STATUS_CONNECTED WAN adapter that is connected to a remote peer.
MIB_IF_OPER_STATUS_OPERATIONAL Default status for LAN adapters
 
 
I know there were other issues, but this looked handy enough to make a note of for future reference.
4649
I tried it at home on a Windows 7 pc with no wifi adapters, and it gave some kind of GUID error dialog.

Really? Weird, I just ran it here (Win7 desktop/no WiFi) and it just quietly exited. Might that have been an earlier build? I gotta remember to put build numbers in these things (bad habbit...).

Quietly exited here on my x64 W7 PC when I selected an unplugged WiFi adapter.  Selecting the LAN connection does the same as clicking on the tray icon.

Yeah, that's gonna need some polish.

Selecting the WiFi adpater when it's plugged in resulted in the same as clicking on the tray icon, (the popup window that shows what you're currently connected to - same result as LAN connection).

Am I miss-reading that? ...Or are you saying you got a connections window for a LAN adapter?
4650
DC Member Programs and Projects / Re: GetSerious0.1 - (don't expect much)
« Last post by Stoic Joker on January 31, 2011, 06:35 PM »
It is the as designed behavior of repetedly going from zero to X that keeps the UI in a constant state of motion. Which is what tends to draw the eye.

hi Stoik, I did some work.
I think this behaviour is due to a vista theme where the progress bars animate from zero to their current spot.
and since I use xp, I didn't understand at first what you meant.

here's a customized version - see if it solves the problem for you.
and heh, I had to choose a color, green looks classic.

also try clicking the +/- it limits the number of items shown. (left click increments, right click decrements)

I believe that's all for this little program. see ya

Quieter UI is excellent. And I believe you assessment of the progress bar behavior is correct also.


When clicking a bit on the +1/-1 semi-button, it changes to some count (up and down with left/right mouseclicks), that has no relation to the number of app-titles shown, don't know what that's supposed to mean? The +1/-1 didn't return, but I could it to go to "15 items shown" (and more if I wanted to), though there are only 4 items actually showing
The +1/-1 is a max item count, and is therefore only relevant if you've reached it. Not incredibly intuitive at first blush, but should be handy once learned.
Pages: prev1 ... 181 182 183 184 185 [186] 187 188 189 190 191 ... 246next