IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New okies yankout spaces
cat foo to awk print only nonwhite space>newfilename why invoke c++?
thanx.
bill
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Re: okies yankout spaces
I was thinking along the same lines. Isn't there a regular expression that could do that in 1 line? Something in perl? Or a call to grep with piped output?

New In Visual BASIC 6.0 and above
there was a replace command for strings.

strName = Replace(strName," ", "")

Does C++ have a replace command like that?




"I wonder how much of this BS Corporations will continue to shallow before they start looking into alternatives to Microsoft software?" -[link|http://z.iwethey.org/forums/render/content/show?contentid=106839|Orion]

New Nope
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New s/ //g
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New (string findTokens: ' ') inject: '' into: [:a :b | a,b]



"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
New beautiful :)
-drl
New Doh! Better: string select: [:ea | ea ~= $ ]
What was I thinking? Must have been later than I thought



"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
New Or maybe (string copyWithout: $ )
This is sort of a fun little exercise actually - I don't think in Smalltalk enough.



Smalltalk is dangerous. It is a drug. My advice to you would be don't try it; it could ruin your life. Once you take the time to learn it (to REALLY learn it) you will see that there is nothing out there (yet) to touch it. Of course, like all drugs, how dangerous it is depends on your character. It may be that once you've got to this stage you'll find it difficult (if not impossible) to "go back" to other languages and, if you are forced to, you might become an embittered character constantly muttering ascerbic comments under your breath. Who knows, you may even have to quit the software industry altogether because nothing else lives up to your new expectations.
--AndyBower
New Right before he left, he tried to rally in Perl
\nsub removeSpaces {\n  my $s= "aa bb";\n  print $s\n  $s =~ s/ //gi;\n  print $s\n}\n\n$s = "aa bb";\nremoveSpaces;\n
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New He might have been better at C++
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New Perl
my $nospaces = join('',split(/ /,$withspaces));

C++? What an ODD way to make a living...


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
New Perl redux
perl -p -i -e 's/ //g'
-----
Steve
New sed 's/ //g' filename.txt > filename2.txt
I mean if we're really going for minimal, right? :)
===

Implicitly condoning stupidity since 2001.
New key difference, though.
The perl command will edit the file in place versus having sed read the original file from stdin and write a new file to stdout :)
-----
Steve
New Java
StringBuffer a = new StringBuffer( " ab ab ab ab " );

for( int i=0; i < a.length(); )
{
if ( a.charAt(i) == ' ' )
a.deleteCharAt(i);
else
i++; // only increment if you don't delete char
}
Expand Edited by gdaustin July 11, 2003, 11:40:45 AM EDT
New Wow, that's a lot of typing :-P



"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
New n^^2 for the worst case
can you do better? May be not in Java - I have to look at StringBuffer
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
Expand Edited by Arkadiy July 11, 2003, 01:14:15 PM EDT
New Yes you can
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New You're looking for "best algorithm"
I was looking for compact code, quick implementation.

Sadly, a lot of the work I have to do is done in a hurry, so the customer doesn't care if it's a bubble sort or quick/merge/insert sort unless the data set is really large.

Also, I work with databases a lot, so when someone wants it sorted, I ORDER BY on the SQL and it's done.

DB2 SQL is my best language. Java is probably next.

I haven't looked for the "best algorithm" since I worked at SABRE, where we had lots of time (usually at least 2 quarters) to implement something.

Glen Austin
New Re: Java - off the top of my head...
\nStringBuffer a = new StringBuffer( " ab ab ab ab " );\n\nint j = 0;\nint i = 0;\nwhile (i < a.length())\n    {\n    while (i < a.length() &&  a.charAt(i) == ' ' )  // Change this to a while\n        // a.deleteCharAt(i);  Don't delete\n        i++;\n    if (i < a.length())\n         {\n         a.charAt(j) == a.charAt(i);  // Pull the characters forward.\n         i++; // walk both forward\n         j++;\n         }\n    }\n


Yeah...you need to clean the code up at the end too....but hey...it's off the top of me head.
(And I'm sure it can be improved.)
     Another "removeSpaces" from a job candidate - (Arkadiy) - (59)
         Bleurrrgh. -NT - (admin)
         You have a *great* need for a coder! :) -NT - (a6l6e6x) - (1)
             LPRD sez: Able to chew and walk gum at the same time. :) -NT - (Arkadiy)
         Help me - (broomberg) - (30)
             You pass. - (Arkadiy) - (29)
                 Depends. - (admin) - (15)
                     Agreed. - (Yendor) - (9)
                         Not buying it... - (gdaustin) - (8)
                             And I'm not buying yours... - (Yendor) - (7)
                                 I'm saying that a Computer Science or MIS Grad Student - (gdaustin) - (6)
                                     This is not a friggin' function! - (Arkadiy) - (5)
                                         Yep, the guy doesn't understand null terminated strings. - (a6l6e6x) - (4)
                                             Is that like - (Ashton) - (3)
                                                 Nope, that's null-terminated chain. -NT - (Arkadiy)
                                                 Nope - (ben_tilly)
                                                 Oh, is THAT how you reverse-engineer Microsoft code? - (FuManChu)
                     Next time I see someone like that, - (Arkadiy) - (1)
                         Next time you see someone like that - (tuberculosis)
                     Also depends on the College - (Simon_Jester) - (2)
                         He did not use STL because of the way I posed the question - (Arkadiy) - (1)
                             ah - now I understand - (Simon_Jester)
                 Phew - (broomberg) - (12)
                     This may be too harsh - (Arkadiy) - (5)
                         Exactly - (deSitter) - (3)
                             This is not "pressure programming" - (Arkadiy) - (2)
                                 Yes, precisely - (deSitter) - (1)
                                     That particular algorithm has been really successful - (Arkadiy)
                         They did not do this to juniors - (broomberg)
                     Re: Phew - (deSitter)
                     Insertion Sort - (gdaustin) - (1)
                         Merge Sort is better - (tuberculosis)
                     What a waste of time - (tuberculosis) - (2)
                         I think qsort is a bad example. - (static) - (1)
                             I'm trying hard to recall - (FuManChu)
         Re: Another "removeSpaces" from a job candidate - (orion)
         okies yankout spaces - (boxley) - (20)
             Re: okies yankout spaces - (gdaustin) - (19)
                 In Visual BASIC 6.0 and above - (orion) - (1)
                     Nope -NT - (Arkadiy)
                 s/ //g -NT - (ben_tilly) - (6)
                     (string findTokens: ' ') inject: '' into: [:a :b | a,b] -NT - (tuberculosis) - (3)
                         beautiful :) -NT - (deSitter)
                         Doh! Better: string select: [:ea | ea ~= $ ] - (tuberculosis) - (1)
                             Or maybe (string copyWithout: $ ) - (tuberculosis)
                     Right before he left, he tried to rally in Perl - (Arkadiy) - (1)
                         He might have been better at C++ -NT - (ben_tilly)
                 Perl - (pwhysall) - (3)
                     Perl redux - (Steve Lowe) - (2)
                         sed 's/ //g' filename.txt > filename2.txt - (drewk) - (1)
                             key difference, though. - (Steve Lowe)
                 Java - (gdaustin) - (5)
                     Wow, that's a lot of typing :-P -NT - (tuberculosis)
                     n^^2 for the worst case - (Arkadiy) - (2)
                         Yes you can -NT - (Arkadiy) - (1)
                             You're looking for "best algorithm" - (gdaustin)
                     Re: Java - off the top of my head... - (Simon_Jester)
         Fun with code... - (gdaustin) - (2)
             I can tell you what will happen - (Arkadiy) - (1)
                 Will have to wait for Monday... - (gdaustin)

Make your blood boil?
93 ms