473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing text from strings

I'm writing a program to emulate nuerons (can't spell for my life
sorry) and am using an array of "mailboxes" to propagate messages
through the network, but I need to be able to remove the request from
everybody's mailbox after the response is returned. The source can be
found at www.birchile.com/webbomb/brain.htm , the source is in the only
script tag there. To be specific I want to delete text from the mb
array using the look() method of the n object.

--Thanks for listening,
mouseit

Jan 14 '06 #1
18 1594
mo********@gmai l.com wrote:
I'm writing a program to emulate nuerons (can't spell for my life
sorry)
Do you mean "neurons", as in "cortex"? (BTW, spell checkers exist.)
[...] To be specific I want to delete text from the mb
array using the look() method of the n object.


Sorry, your code lacks any sign of code style, particularly indentation, and
there is no inline documentation whatsoever. Fix that and come back again
if you want advice _for free_.
PointedEars
Jan 14 '06 #2
Yeah I dont really bother with comments or the like, dont need it, and
I'm waaay to lazy to find a spell checker (Microsoft Word takes
forever).

Jan 15 '06 #3
Thanks anyways I think.

Jan 15 '06 #4
"mo********@gma il.com" <mo********@gma il.com> wrote in
news:11******** **************@ o13g2000cwo.goo glegroups.com:
Yeah I dont really bother with comments or the like, dont need it, and
I'm waaay to lazy to find a spell checker (Microsoft Word takes
forever).


It is difficult to read unindented code and especially make sense of it
when you don't use semicolons to end statements, a really bad practice.
You probably never learned C or any of its object-oriented descendants, but
ending statements in a semicolon is NOT an option in those languages, and
why Javascript made it an option is anyone's guess, except maybe to please
those who lack any sort of discipline such as barely commenting their code.

It would also help if you use more descriptive identifier names for
variables and functions/methods/properties. Functions that are declared as
'sd' could actually be named 'sendDirectMail ' if that's what they in fact
do. It makes code more easily debuggable by others----something you are
requesting here. Moreover, the Javacript language designers encourage the
use of descriptive identifiers.

The only way of debugging your problem is to load it up into a debugger to
track execution, and you don't even suggest inputs to your form to attempt
to help us reproduce the problem you are having.

Give that original post of yours and your source code some more thought.
Jan 15 '06 #5
Actually C and C++ were the first two languges I learned, Processing
does it and I do a lot in that so im used to it. As for indented code
I just don't see the point... I can read it fine sans indents. Also
sorry about the comments I guess I dont really have an exuse for that.

Jan 15 '06 #6
Patient Guy said the following on 1/15/2006 4:26 AM:
"mo********@gma il.com" <mo********@gma il.com> wrote in
news:11******** **************@ o13g2000cwo.goo glegroups.com:

Yeah I dont really bother with comments or the like, dont need it, and
I'm waaay to lazy to find a spell checker (Microsoft Word takes
forever).

It is difficult to read unindented code and especially make sense of it
when you don't use semicolons to end statements, a really bad practice.


Using semicolons to end statements is optional so I am not sure how you
can say that something that isn't required is "bad practice" per se in
Javascript itself. Is it a bad practice when moving to other languages?
Absolutely.

I have yet to see code (and am interested in a *real world example*)
where leaving the semicolon off breaks the code but inserting it fixes
the code.

When I say "real world example" I am not asking for a theoretical
situation where the code would never be used for any purpose other than
showing the lack of ; causes an error but adding it removes the error.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 15 '06 #7
Zif
mo********@gmai l.com wrote:
Actually C and C++ were the first two languges I learned, Processing
does it and I do a lot in that so im used to it. As for indented code
I just don't see the point... I can read it fine sans indents. Also
sorry about the comments I guess I dont really have an exuse for that.


Stuff 'em - if it was hard to write, it /should/ be hard to read. If
they can't read it, they don't know enough to help, right?
--
Zif
Jan 16 '06 #8
Zif said the following on 1/15/2006 7:58 PM:
mo********@gmai l.com wrote:
Actually C and C++ were the first two languges I learned, Processing
does it and I do a lot in that so im used to it. As for indented code
I just don't see the point... I can read it fine sans indents. Also
sorry about the comments I guess I dont really have an exuse for that.

Stuff 'em - if it was hard to write, it /should/ be hard to read.


That's not true. The easier code is to read the easier it is to maintain.
If they can't read it, they don't know enough to help, right?


If you want to believe that, then go ahead. It is very far from the
truth though. Many people, myself included, simply don't care to sit and
make code readable to be able to help a person who is asking for *free*
help. If you want free help, then you should endeavor to please the
people you are asking for help from.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 16 '06 #9
Randy Webb <Hi************ @aol.com> wrote in news:c6Gdnb83xa BKPVfeRVn-
uQ@comcast.com:
Patient Guy said the following on 1/15/2006 4:26 AM:
"mo********@gma il.com" <mo********@gma il.com> wrote in
news:11******** **************@ o13g2000cwo.goo glegroups.com:

Yeah I dont really bother with comments or the like, dont need it, and
I'm waaay to lazy to find a spell checker (Microsoft Word takes
forever).

It is difficult to read unindented code and especially make sense of it
when you don't use semicolons to end statements, a really bad practice.


Using semicolons to end statements is optional so I am not sure how you
can say that something that isn't required is "bad practice" per se in
Javascript itself. Is it a bad practice when moving to other languages?
Absolutely.

I have yet to see code (and am interested in a *real world example*)
where leaving the semicolon off breaks the code but inserting it fixes
the code.

When I say "real world example" I am not asking for a theoretical
situation where the code would never be used for any purpose other than
showing the lack of ; causes an error but adding it removes the error.


http://groups.google.com/groups?q=se...vascript&hl=en

The 1st, 2nd, and 4th links in that results page show good threads
containing posts from individuals who urge the use of semicolons in
Javascript, and those who shrug their shoulders about whether they should
be required.

I write Javascript pretty much the same way I used to style C, from which
Javascript ultimately derives. The inclusion of semicolons makes code
readable and maintainable by others, even if the interpreter can whiz
through it and insert the end-of-statement tokens itself.

Jan 16 '06 #10

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

Similar topics

5
2521
by: Paradox | last post by:
In general I love Python for text manipulation but at our company we have the need to manipulate large text values stored in either a SQL Server database or text files. This data is stored in a "text" field type and is definitely not unicode though it is often very strange text since it is either OCR or some kinda electronic file extraction. Unfortunately when it is retrieved into a string type in python it is invariably a unicode type...
0
5675
by: Eric | last post by:
Hi, I was sure I would be able to find some info about this in the LWP archives but I have had no luck. I also can't seem to tell if the libwwww Perl mailing list is alive or not. my $ua = LWP::UserAgent->new(); push @{ $ua->requests_redirectable }, 'POST';
1
346
by: ChrisC | last post by:
Im having trouble removing line breaks from my c# string. Actually, im having trouble getting .Trim() to work properly, as it seems to count a string that has nowt but a break of some sort as not being empty. To get trim to work properly im trying to axe out the line breaks seperately. Ive got .replace("/r") and "/n" but still having problems with some strings. Are there paragraph markers or something I should be removing too? how do i...
8
14275
by: Peter O'Reilly | last post by:
I have an HTML form with a textarea input box. When the user conducts a post request (e.g. clicks the submit button), an HTML preview page is presented to them with the information they have filled out in the prior page's form elements. Naturally some users like to copy and paste text into the textarea box and presumably do so from say a word processor program. Some Macintosh based users I know of experience problems with foreign...
16
2063
by: graham.reeds | last post by:
I am updating a website that uses a countdown script embedded on the page. When the page is served the var's are set to how long the countdown has left in minutes and seconds, but the rest of the script is left untouched. However I want to take the script out of the page and have it as a seperate file that can be cached, reducing serving costs - the page gets hit a couple of thousand times per day, sometimes as high a 5K, so any...
0
2474
by: sameer mowade via .NET 247 | last post by:
Hello All, I have problem while dynamically removing row from the Datagrid which i have added dynamically as shown in the following code snippet. The problem is that while removing dynamically added row it also removes the row at the end along with the added row. Plz tell me if, I am missing any thing. Code </asp:datagrid>
23
1767
by: Peter Row | last post by:
Hi, I am currently working on a VB.NET project that has been going for quite a while. In the past it has been developed with a lot of compatibility VB6 functions and constants, e.g Left(), LCase() and vbCr Whilst not currently able to port to C# I am trying to remove usage of these functions and constants.
6
8668
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii chars. i'm assuming python has something like valid_str = strip(invalid_str)
11
6200
by: cmay | last post by:
I am having this problem... Lets say that your source XML is formatted like this: <somenode> Here is some text Here is some more text </somenode> When to a <xsl:value-of select="somenode" /I want the output to be free of the tabs that are included in the source XML. These tabs are not really part of the content, but rather just there
8
2511
by: starsky51 | last post by:
I'm sure it's something i'm doing wrong, I just can't see it. I've set up a simple page with the following code: <html> <head> <title>tester</title> <script language="javascript" type="text/javascript"> alert('First String Second String'); </script> </head>
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10319
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10070
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.