![]() |
Today ! |
Thread Tools | Search this Thread |
|
|
|
|
Just Cuddly Old Me™
Posts: 1,502
Karma:
|
absolutely boiling out there, been to the country park and it was absolutely packed
__________________
blog | flickr | fazyluckers | graphic design forum | graphic design links | The Photo Forum MCP | MCDST | MCTS |
|
|
|
|
|
|
|
Tech-Babe
![]() Posts: 2,700
Name: Cindy
Karma:
![]() ![]()
|
Today i jot acquainted with a very nice guy called Jordie
![]() |
|
|
|
|
|
|
|
Just Cuddly Old Me™
Posts: 1,502
Karma:
|
you jot?
![]() today was hot and boring at work
__________________
blog | flickr | fazyluckers | graphic design forum | graphic design links | The Photo Forum MCP | MCDST | MCTS |
|
|
|
|
|
|
|
Elite Member
Posts: 669
Name: nick
Karma:
![]()
|
really busy at work - made some important project managers doubleplus happy (always good for the image) & got a few remote clients out of trouble. A feelgood day
![]() (homegrown) Leek & (homegrown) Potato soup for dinner tonight (leftovers from last night...) ![]()
__________________
My Opera Blog |
|
|
|
|
|
|
|
Elite Member
Posts: 368
Name: The Duke of URL
Karma:
|
Ha!
"Taking it e-z", today - hardest work I plan to do today, is to water my "octopus' garden" (in the shade, ala the Beatles tune) so my tomato plants don't die (that's right - I am "into it" now, the gardening bit) & to combine the functions of two of my programs (one old, since 2004 iirc, & a new one) into 1 single new one! Why? Well, I used the programs below to FINALLY finalize my custom HOSTS file... took a while, & I found out "catch-22's" when using ACCESS SQL import/export (via select distinct queries for normalization/removal of duplicate entries) is why! (Which I mentioned in this thread a couple pages back as a method I decided to try to use, since others' hosts file entries formats are NOT the same as my own - Heck, I'll be "bold about it" & state in fact, that they ARE LESS EFFICIENT, & "throw my 2nd app below for a loop" if NOT in the format I use as well when it goes to "normalize" the HOSTS file's internal entries). ----------------------------------------------------------- So, to make other custom HOSTS file makers' entries in my HOSTS file the same as the format I use? Well - I did that via writing an app that "scrubs" out the format's others use when doing HOSTS file lines entries (rather than Access SQL exports after select distinct queries for normalization): (Sourcecode is below... in my "P.S.", for anyone that's interested in that kind of thing!) ... &, I have to do that, because My custom HOSTS file, for line entries, uses this format: IPAddress (singlespace) URL (cr+lf/enter keypress) (& not all others do!) I.E.-> Some folks who do HOSTS files have a TAB instead of the singlespace noted above... OR They leave a trailing space before the cr+lf (just after the URL), & this makes the file larger, especially over MANY entries! This happens after Ms-Access exports & adds unecessary size (slows load of HOSTS). (I suspect strongly this format used by others is due to Ms-Access being used on import/select distinct queries/export back to HOSTS file imo (& experience from using it to do so earlier here in fact))... That format I use, however? It is the MOST logically efficient I can think of in fact, especially for blocking bad sites &/or adbanners (127.0.0.1 vs, the 0.0.0.0 I use). (e.g.-> Some folks use 127.0.0.1, which is fine, unless you have a TON of entries, & I do @ 533,000++ lines now - those extra 2 bytes of 127 vs. 0 on the first octet addup, & eat more RAM this way in DNS Cache memory occupancy + a longer loadtime from disk results). ----------------------------------------------------------- Then, once the file entries' format is setup correctly? I "normalize it" (removal of duplicate entries for size & memory efficiency + faster loadtime up from disk into your local DNSCache) ! That's done here by using this older app of mine, which then removes duplicated entries, which DO happen like mad, especially if you consolidate others' HOSTS file entries (which I do) first (once the file's line entries are in the form above I note): ![]() & that 2nd app then helps you make or delete new entries as well (via checking if you already have an entry in the file that you intend to insert)): ![]() ----------------------------------------------------------- My current CUSTOM HOSTS FILE (for both blocking out javascript/iframe poisoned websites &/or adbanners) is now 14mb in size, yes LARGE, but "super-comprehensive"! It's composed of ALL of the other known & respected HOSTS files, listed here: WIKIPEDIA HOSTS FILES: http://en.wikipedia.org/wiki/Hosts_file Plus:
![]() Works like a dream, this new HUGE custom HOSTS file of mine now... even @ that size (& even on a Celeron Pentium II with only 64mb (my main tester & friend Jack's machine))... Plus, the new app I wrote (pictured first above, sourcecode below) to "scrub" & format others' HOSTS file entries for insertion into mine for speed + efficiency AND so my other app will "normalize it", w/ out erring out/abending, FLIES! Which makes sense: I wrote it in a combination of Win32 API calls, & more importantly, in Borland Delphi 7.x! (Delphi was proven, of ALL places, in "Visual Basic Programmer's Journal" Sept./Oct. 1997 issue "INSIDE THE VB COMPILER" to blow away both VB & even MSVC++ in tests, especially those of math & strings work (which EVERY PROGRAM DOES, but especially one of THIS nature no less) by over 2-3x the speed other languages manage on this type of processing... it was a "wise-choice" imo @ least, to use it for this type of app, based on the work it does (heavy string comparison & manipulation work in files)). * Strange as that may sound? I am a "happy guy" about that! APK Hosts File Rewriter 1.0++ - which tears thru 53,000++ entries in the HOSTS file in less than 2 minutes on my current system, @ roughly 36,000 lines a minute/ 600 lines a second (F A S T, try this with notepad.exe, written in C/C++, by way of comparison? It manages around 166 lines per second... thus, You'll be waiting 3-4 days)... (Which is NOT bad, considering my CPU & system is NOT 'state-of-the-art' by any means (2++ yrs. old now))... ----------------------------------------------------------- So - Other than downloading MS patches today & watering my garden (iirc, it is "patch tuesday" from MS, 2nd tuesday of every month)? I am probably going to COMBINE the functions of both programs above into 1 single one (new rewrite most likely, as I have gotten better @ programmatic optimization since I wrote the 2nd app (APK Hosts File Optimization Engine 3.0++) & intend to make it run as fast as the first app shown above)... APK P.S.=> Code for my "APK Hosts File Rewriter 1.0++" is here (small, but F A S T): {COPYRIGHT APK - Alexander Peter Kowalski 06/01/2008 onwards} unit Unit1; //HAND & COMPILER LEVEL OPTIMIZATIONS SWITCHES/#PRAGMA DIRECTIVES {$define nodebug} {$STACKCHECKS OFF} {$D-}//will prevent placing Debug info to your code. {$L-}//will prevent placing local symbols to your code. {$O+}//will optimize your code, remove unnecessary variables etc. {$Q-}//removes code for Integer overflow-checking. {$R-}//removes code for range checking of strings, arrays etc. {$S-}//removes code for stack-checking. USE ONLY AFTER TESTING ! {$Y-}//will prevent placing symbol information to your code {$H-}//Forces ShortString usage (no heap usage)... apk interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ComCtrls, StrUtils; type TForm1 = class(TForm) OpenDialog1: TOpenDialog; BitBtn1: TBitBtn; StatusBar1: TStatusBar; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; procedure BitBtn1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var //GLOBAL Form1: TForm1; implementation {$R *.dfm} {$H-} {$h-} //FORCE SHORTSTRING USAGE (below 254 char) so it does not use stack, & keeps memory usage on local heap (faster)... apk procedure TForm1.BitBtn1Click(Sender: TObject); register; //use register loading, equivalent of FastCall C/C++ stuff, & faster... apk var Save_Cursor:TCursor; F1: TextFile; F2: TextFile; Ch: ShortString; {I can & did do this here, vs. String datatype cast (no url I use is over 110 characters + it matches the $h- compiler directive for optimization)... apk} Flags: TReplaceFlags; Counter: Integer; {Possible optimization: Use smaller numerical datatype, since I doubt I'll use the full capabilities of INTEGER in THIS program that works on a HOSTS file... apk} begin inherited; Save_Cursor := Screen.Cursor; Screen.Cursor := crHourGlass; Ch:= Trim(''); Counter:=0; Label3.Caption:= Trim(DateTimeToStr(now)); Label3.Update; Label2.Refresh; Label4.Caption:= Trim('Waiting to complete...'); Label4.Update; Label4.Refresh; //Time slice - internally multitask here... apk Application.ProcessMessages; {ACTUAL "ACTIVE INGREDIENT" (code engine that does the actual work) HERE} //============================================== try if OpenDialog1.Execute then begin If OpenDialog1.Filename <> '' then begin BitBtn1.Enabled:=False; AssignFile(F1, OpenDialog1.Filename); Reset(F1); AssignFile(F2, 'B:\HOSTS\NewNormalizedFinalMinusTrailingBlanks.tx t'); Rewrite(F2); //Blanks out, no need for FileUtils unit If FileExists... apk while not Eof(F1) do begin Counter:=Counter+1; Readln(F1, Ch); //Replace ANY 127.0.0.1(tab) with 0.0.0.0(space) 1st... apk Ch:= StringReplace(Ch, '127.0.0.1', '0.0.0.0', Flags); //Reverse the string first, & StringReplace will nail the trailing blank Ch:= ReverseString(Ch); Ch:= StringReplace(Ch, ' ', '', Flags); //Reverse it again & write it (trailing blank is removed now)... apk Ch:= ReverseString(Ch); Ch:= StringReplace(Ch, '0.0.0.0', '0.0.0.0 ', Flags); Ch:= StringReplace(Ch, '0.0.0.0 ', '0.0.0.0 ', Flags); //Burn quotes from AccessExport (after normalize filedata) to text... apk Ch:= StringReplace(Ch, '"', '', Flags); Ch:= StringReplace(Ch, '"', '', Flags); Ch:= StringReplace(Ch, '"', '', Flags); Ch:= StringReplace(Ch, '"', '', Flags); Writeln(F2, Ch); Label4.Caption:= Trim(DateTimeToStr(now)); Label4.Update; Label4.Refresh; StatusBar1.SimpleText:= Trim(IntToStr(Counter) + ' ' + Ch ); StatusBar1.Update; StatusBar1.Refresh; end; CloseFile(F2); end; CloseFile(F1); end; //============================================== except //ERR TRAPPING VIA EXCEPTION/RAISE EXCEPTION/CUSTOM ERRHANDLER I BUILT HERE... apk begin Application.ProcessMessages; //Time slice-multitask internally here, after loop is done, even after Exception catch on err/abend... apk BitBtn1.Enabled:=True; Screen.Cursor := Save_Cursor; Screen.Cursor:=crHourGlass; close; end end; Application.ProcessMessages; //Time slice-multitask internally here, after loop is done... apk BitBtn1.Enabled:=True; Screen.Cursor := Save_Cursor; Screen.Cursor:=crDefault; Application.ProcessMessages; //Time slice-multitask internally here, after loop is done... apk Application.MessageBox(PChar('Done: Total lines processed = ' + IntToStr(Counter)),nil); end; procedure TForm1.FormCreate(Sender: TObject); register; //use register loading, equivalent of FastCall C/C++ stuff, & faster... apk var ProcessID: DWORD; ProcessHandle: THandle; ThreadHandle: THandle; begin inherited; {RUNNING @ REALTIME CPU PRIORITY FOR UTMOST IN SPEED via Win32 API call usage for that below... apk} ProcessID:= GetCurrentProcessID; //Application.Handle SHOULD do this as well here... apk ProcessHandle:= OpenProcess(PROCESS_SET_INFORMATION, false, ProcessID); SetPriorityClass(ProcessHandle, REALTIME_PRIORITY_CLASS); ThreadHandle:= GetCurrentThread; SetThreadPriority(ThreadHandle, THREAD_PRIORITY_TIME_CRITICAL); end; end.
__________________
"I'm Reese: Sgt. TechComVN38416, assigned to protect you - You've been TARGETTED FOR TERMINATION!" Last edited by APK; Jun 28, 2008 at 10:51pm. |
|
|
|
|
|
|
|
Witty Title
![]() Posts: 1,548
Name: Dave
Karma:
![]() ![]() ![]()
|
Today, I got tired from reading the previous posts and all the stuff y'all have done. My order of things to do starts with me feeling better...and may go back to lay down to do that. Next thing, first make sure first thing is done.
I need to get my hayfield that I call my front yard mowed. The dog almost disappears when he goes outside. If I get that done, need to stir the compost, then put the grass clippings on top. And after that, I'll add that stuff on tomorrow's to-do list because I probably won't get it done today.Dave ![]()
__________________
|
|
|
|
| Thread Tools | Search this Thread |