473,395 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to delete commented code lines ?

How to quickly delete commented code lines from modules, forms and reports.??

Any idea ?

thanks
Nov 13 '05 #1
17 2793
What is this for?

If you are trying to create a version of the database without any comments
so as to make it as efficient as possible for an end user, create an MDE:
Tools | Database Utilities | Make MDE
The MDE has the compiled code only, so the text cannot be edited and the
comments are absent.

For your developer version though, the comments are surely too valuable to
remove if you value your sanity in maintaining the database.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Javier Gomez" <ja*****************@gmail.com> wrote in message
news:89**************************@posting.google.c om...
How to quickly delete commented code lines from modules, forms and
reports.??

Any idea ?

thanks

Nov 13 '05 #2
Allen Browne wrote:
For your developer version though, the comments are surely too valuable to
remove if you value your sanity in maintaining the database.


Bah! Comments are for wimps. Code should be self documenting :-)

--
[Oo=w=oO]

Nov 13 '05 #3
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42***********************@news.zen.co.uk...

Bah! Comments are for wimps. Code should be self documenting :-)


Hi Tr3v0r

If UBnCodnLong Then UN0Betta = True

707

:-)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
Nov 13 '05 #4
You guys are scaring me. I have always known that VB is an
interpretive language. I tend to be quite verbose with my comments.
Are you telling me that comments can make any kind of noticeable
difference in execution speed?
Anyway, I decided to run a very primitive benchmark.

For I = 1 To 10000
For J = 1 To 1000
For K = 1 To 100
A = Sqr(69)
Next K
Next J
Next I

I ran this (Access 2000) and it took 68 seconds. I ran it again
with twenty lines of comments in the innermost loop. Same time. Is
this a legitimate test?

Hank Reed

Nov 13 '05 #5
Without running a test, my expectations match your experience, that the
comments make no difference whatsoever.

Access/VBA compiles the code into quazi-machine code. This contains no
comments. The comments are retained only in the text version, where they are
meaningful for maintenance. There is therefore NO point at all in removing
the comments, and it should give no performance benefit at all.

That was the thinking behind my first reply to this poster: what for?

I think Trevor's comments suggest he understands it the same way, even if he
does have a very English sense of humour. :-)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Hank" <ha********@aol.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
You guys are scaring me. I have always known that VB is an
interpretive language. I tend to be quite verbose with my comments.
Are you telling me that comments can make any kind of noticeable
difference in execution speed?
Anyway, I decided to run a very primitive benchmark.

For I = 1 To 10000
For J = 1 To 1000
For K = 1 To 100
A = Sqr(69)
Next K
Next J
Next I

I ran this (Access 2000) and it took 68 seconds. I ran it again
with twenty lines of comments in the innermost loop. Same time. Is
this a legitimate test?

Hank Reed

Nov 13 '05 #6
Hank wrote:
You guys are scaring me. I have always known that VB is an
interpretive language. I tend to be quite verbose with my comments.
Are you telling me that comments can make any kind of noticeable
difference in execution speed?
Anyway, I decided to run a very primitive benchmark.

For I = 1 To 10000
For J = 1 To 1000
For K = 1 To 100
A = Sqr(69)
Next K
Next J
Next I

I ran this (Access 2000) and it took 68 seconds. I ran it again
with twenty lines of comments in the innermost loop. Same time. Is
this a legitimate test?

Hank Reed


68 seconds? Gasp! Obviously I need a new computer.

Mine took 142.294 seconds without the comments
and 142.344 seconds with the comments (20 lines).

Same results before and after compilation and compacting.

Perhaps the notion of comments making any noticeable difference in speed
is a hold over from an age when whatever script Access was using was not
so efficient in converting to P-Code and "compiling".

There may be other things to be concerned about with respect to speed.
For instance you use Sqr(69) and I use 69 ^ (1/2) ... (but not for this
test). It seems that my method is about seven times slower than yours.
Perhaps, I should be a little scared.

--
--
Lyle

"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
Nov 13 '05 #7
ok I found the answer !

find & replace

Find what: '*
Replace with: (EMPTY)

use pattern matching: yes (activated)

ja*****************@gmail.com (Javier Gomez) wrote in message news:<89**************************@posting.google. com>...
How to quickly delete commented code lines from modules, forms and reports.??

Any idea ?

thanks

Nov 13 '05 #8
Lyle Fairfield wrote:
Mine took 142.294 seconds without the comments
and 142.344 seconds with the comments (20 lines).


How do you time this, Lyle?

Usually when I am analyzing performance of design choices, I'll slap
something in a test module that uses the datediff function with "s" as
the measure of time.

In the past I've seen other designers on this group talk about some
pretty fine time clocking like the above and wondered how?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #9
Sounds dangerous.

Is there any chance your app could contain a line with an embedded single
quote?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Javier Gomez" <ja*****************@gmail.com> wrote in message
news:89**************************@posting.google.c om...
ok I found the answer !

find & replace

Find what: '*
Replace with: (EMPTY)

use pattern matching: yes (activated)

ja*****************@gmail.com (Javier Gomez) wrote in message
news:<89**************************@posting.google. com>...
How to quickly delete commented code lines from modules, forms and
reports.??

Any idea ?

thanks

Nov 13 '05 #10
Tim Marshall <TI****@PurplePandaChasers.Moertherium> wrote in news:d4lfim
$k****@coranto.ucs.mun.ca:
Lyle Fairfield wrote:
> Mine took 142.294 seconds without the comments
and 142.344 seconds with the comments (20 lines).


How do you time this, Lyle?


Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub wscfy()
Dim a As Double
Dim i As Long
Dim j As Long
Dim k As Long
Dim t As Long
t = GetTickCount
For i = 1 To 10000
For j = 1 To 1000
For k = 1 To 100
a = Sqr(68)
Next k
Next j
Next i
Debug.Print GetTickCount - t, a
End Sub

--
Lyle

"The aim of those who try to control thought is always the same. They find
one single explanation of the world, one system of thought and action that
will (they believe) cover everything; and then they try to impose that on
all thinking people."
- Gilbert Highet
Nov 13 '05 #11
Lyle Fairfield wrote:

Mine took 142.294 seconds without the comments
and 142.344 seconds with the comments (20 lines).


Only difference I could make to that code was to dim all the variables
as long except for a, which was single.

First pass, all variants took 90 seconds, second pass all declared types
took 73 seconds, closer to Hank's speed, wonder what he's got under the
bonnet (hood)? (XP2800+ here).

--
[Oo=w=oO]

Nov 13 '05 #12
Trevor Best wrote:
Lyle Fairfield wrote:

Mine took 142.294 seconds without the comments
and 142.344 seconds with the comments (20 lines).


Only difference I could make to that code was to dim all the variables
as long except for a, which was single.

First pass, all variants took 90 seconds, second pass all declared types
took 73 seconds, closer to Hank's speed, wonder what he's got under the
bonnet (hood)? (XP2800+ here).


I paid 2995 USD for my Commodore B Series 8088 with 256 K ram. How can
something so expensive be so slow? And those were 1982 dollars!

--
--
Lyle

"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
Nov 13 '05 #13
Lyle Fairfield wrote:
I paid 2995 USD for my Commodore B Series 8088 with 256 K ram. How can
something so expensive be so slow? And those were 1982 dollars!


I remember a 448MB RAM kit for an RS6000 being £17,000, mine only had
16MB and no OS, dunno how much the machine was as it was given to me,
nice but totally useless present though :-\

--
[Oo=w=oO]

Nov 13 '05 #14
Why dangerous ?

I think it is more effective than dangerous.... :-)))
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<42**********************@per-qv1-newsreader-01.iinet.net.au>...
Sounds dangerous.

Is there any chance your app could contain a line with an embedded single
quote?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Javier Gomez" <ja*****************@gmail.com> wrote in message
news:89**************************@posting.google.c om...
ok I found the answer !

find & replace

Find what: '*
Replace with: (EMPTY)

use pattern matching: yes (activated)

ja*****************@gmail.com (Javier Gomez) wrote in message
news:<89**************************@posting.google. com>...
How to quickly delete commented code lines from modules, forms and
reports.??

Any idea ?

thanks

Nov 13 '05 #15
The line:
rs.FindFirst "[Field2] = 'Dog' Or [Field2] = 'Cat'"
becomes
rs.Findfirst "[Field2] =

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Javier Gomez" <ja*****************@gmail.com> wrote in message
news:89**************************@posting.google.c om...
Why dangerous ?

I think it is more effective than dangerous.... :-)))
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:<42**********************@per-qv1-newsreader-01.iinet.net.au>...
Sounds dangerous.

Is there any chance your app could contain a line with an embedded single
quote?
"Javier Gomez" <ja*****************@gmail.com> wrote in message
news:89**************************@posting.google.c om...
> ok I found the answer !
>
> find & replace
>
> Find what: '*
> Replace with: (EMPTY)
>
> use pattern matching: yes (activated)

Nov 13 '05 #16
In any case you should use REPLACE (one by one) intead of REPLACE ALL
or you may comment your code in a deferent way for example:

'/ abcde....... etc......

and then use for find and replace became as follows

FIND: '/*
REPLACE: (EMPTY)
USE PATTERN MATCHING: activated

Now you can make use of REPLACE ALL !!!

You can use any simbol except the special ones :-))

regards
Nov 13 '05 #17
Lyle Fairfield wrote:
How do you time this, Lyle?

Private Declare Function GetTickCount Lib "kernel32" () As Long


A belated thank you very much for this!

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Radde | last post by:
Hi all, #include<iostream> using namespace std; class A{ private: int* iArray; int size; public:
35
by: Jon Slaughter | last post by:
I'm having a problem allocating some elements of a vector then deleting them. Basicaly I have something like this: class base { private: std::vector<object> V;
3
by: Stewart Graefner | last post by:
What do I need to use to be able to make information in a table be deleteable by a User? The table I have tracks Vacation time. It has two fields Vacation Dates and Days taken(Default value 0). The...
3
by: Rolf | last post by:
I have a form with about 15 to 20 lines. Their names are LineXXX. What code can I put in the click event of a button to delete all the lines? Thanks! Rolf
1
by: nasirmajor | last post by:
dear all, Please any urgent help regarding following code. i have the following code ================================================================= public void Delete(Object sender,...
3
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot...
15
by: batman | last post by:
i have a text file that is like: date = OCT0606 asdf sdaf asdfasdgsdgh asdfsdfasdg START-OF-DATA asdfasdfg asdfgdfgsfg
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
1
by: jmarcrum | last post by:
Hello all! i have a “monitor-type” program, where my program recognizes my defined "commands”, and executes the given command, or produces an error message that says “unrecognized command”. After...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.