Java Performance Tuning

Java(TM) - see bottom of page

|home |services |training |newsletter |tuning tips |tool reports |articles |resources |about us |site map |contact us |
Tools: | GC log analysers| Multi-tenancy tools| Books| SizeOf| Thread analysers|

Our valued sponsors who help make this site possible
New Relic: Try free w/ production profiling and get a free shirt! 

Site24x7: Java Method-Level Tracing into Transactions @ $12/Month/JVM. Sign Up! 

Javva The Hutt May 2008

jKool for DevOps
Light up your Apps & get a cool t-shirt

JProfiler
Get rid of your performance problems and memory leaks!


Java Performance Training Courses
COURSES AVAILABLE NOW. We can provide training courses to handle all your Java performance needs

Java Performance Tuning, 2nd ed
The classic and most comprehensive book on tuning Java

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!
Enter email:


New Relic
New Relic: Try free w/ production profiling and get a free shirt!

Site24x7
Site24x7: Java Method-Level Tracing into Transactions @ $12/Month/JVM. Sign Up!


jKool for DevOps
Light up your Apps & get a cool t-shirt

JProfiler
Get rid of your performance problems and memory leaks!


Back to newsletter 090 contents | All Javva's articles

The Outsourcers

After a few months of continuing chats that I could hardly believe on our internal chat channels, I decided to start keeping a select few that were by no means unrepresentative. The following chats may not, however, be representative of outsourced expertise generally. I really hope not, anyway. But their continuing presence, day after day at my current office, has lead me to detail them here. The outsourcers are all from various well known global outsourcing organisations. For those unfamiliar with web development, Perl or unix, all their questions are ones that basic level operatives would be expected to know how to handle. The names and some unix paths have been changed, but I promise the chats are real.

Day 1. outsourcer1 is listed as a "unix administrator"

11:22   outsourcer1   can someone give me the command to delete the folder with its content, without deleting the content first
11:27   chatter1      do you mean rm -rf?
11:22   outsourcer1   thanx

Day 9. outsourcer2 is listed as a "developer".

13:52   outsourcer2   i had install apachi in my dev Box and hosted a page now i need to start my perl script from HTLM page is it possible
13:54   chatter2      Do you mean you want to write a CGI program?
13:55   outsourcer2   yes
13:56   chatter2      Is you problem with a) writing the CGI program or b) calling the CGI program from your web page?
14:00   outsourcer2   b) calling the CGI program from your web pag
14:00   outsourcer2   page
14:01   chatter2      Do you want the program to run taking input from a form on your web page? Or should it just run each time the page is loaded?
14:04   outsourcer2   it should start run when i do a click
14:05   outsourcer2   mouse click
14:05   outsourcer2   perl script is avilable that script should get started once i do the click in web page
14:13   chatter2      So create a form on your web page which includes just one button. The action for the form should be the URL of your CGI program.
14:21   outsourcer2   can u give me a command which do that

Day 11. outsourcer3 is listed as a "programmer"

14:26   outsourcer3   Hi,  I have a string. Depending on certain condifion I want to change the contents of string
14:26   outsourcer3   from position 7 to 14, Is this possible in Perl ?
14:26   outsourcer3   EXAMPLE :
14:26   outsourcer3   str="{1:F01XXXXXXXXBYYY2281089558"
14:26   outsourcer3   if ( condition is true )
14:26   outsourcer3   replace XXXXXXXX with AAAAAAAA
14:27   chatter2      Yes. It's possible.
14:27   outsourcer3   how ?
14:28   chatter2      s/some pattern/some replacement/ if (some condition);
14:30   outsourcer3   thats nice ,  but here XXXXXXXX  can be anything , so i want do chnage the contenets from position 7 to 14
14:30   outsourcer3   so s/some pattern/some replacement/ if (some condition);  will not work , bcoz we can NOT mention positions
14:30   chatter3      can
14:31   chatter2      Perhaps if you gave us a more concrete example then we'd be able to show you how to do it.
14:32   chatter3      s/^abc.../abcfgh/
14:32   chatter3      e.g.
14:33   outsourcer3   ok..in my string "{1:F01XXXXXXXXBYYY2281089558" , if certain condition is true then i want to replace the characters from position 7 to 14 with some other chnarachers
14:34   chatter4      perldoc -f substr
14:34   outsourcer3   we cant be sure that the first 6 charcters will be always {1:F01
14:34   chatter2      I don't think we suggested that you could :-)
14:35   chatter2      But as Paul says, substr might be more to your tastes :)
14:36   outsourcer3   any expert here ?
14:37   chatter4      do you just want a solution, or do you want to learn how to solve the problem?
14:38   chatter6      are you the correct person to solve the problem?
14:38   outsourcer3   $str="{1:F01XXXXXXXXBYYY2281089558";  if certain condition is true then i want to replace the characters from position 7 to 14  ( 8 characters ) with some other 8 characters
14:39   outsourcer3   i tried it , but since i am beginner in Perl, i thought somebody can help
14:39   chatter5      15:30   outsourcer3   thats nice ,  but here XXXXXXXX  can be anything , so i want do chnage the contenets from position 7 to 14
14:39   chatter5      If you're sure about the positions then do:    substr($mystring, 7, 14) = 'XXXXXXXXX'   # note this hasn't been tested for the right numbers, etc., but that's the idea
14:39   chatter6      can you not do it in a language you're fluent in?

Day 24. outsourcer4 is actually listed as a "senior programmer"

...
12:47   chatter7      i would also suggest that following some kind of coding standard might help - indenting, global variables, case, etc all all over the place here
12:47   outsourcer4   i am very new to perl....i am sorry for the inconveinience
12:48   outsourcer4   do i have to include Test::Simple in the script and run?
12:48   chatter2      $curr_count is also reset on line 87. It's possible that you're getting undef back in a later loop.
12:49   chatter2      Have you been given any Perl training?
12:49   chatter2      Or do you have Perl books available?
12:49   outsourcer4   ii had a training for 2 days
12:49   outsourcer4   i refer to perldoc
12:50   chatter2      http://www.perl.org/books/beginning-perl/  - Good book.
12:50   outsourcer4   grt!! thanx
12:51   chatter7      no offence to you at all - but i'm surprised that you would be let alone to write production software here after just seeing a language for 2 days...
12:51   outsourcer4   :)
12:51   outsourcer4   i am trying

Day 33. outsourcer5 did not appear to have a listed job title. Which perhaps decribes his expertise somewhat better than the previously listed job titles for the other outsourcers.

09:06   outsourcer5   hi, how to execute sybase bcp utility in unix shell scripts.
09:06   outsourcer5   some body help me on this
09:10   chatter8      the same way you execute other commands in shell scripts.  without more detail noone can help you.  did you try it? do you get an error? what's the error?
09:12   outsourcer5   i'm getting bcp not found error
09:13   chatter8      do you mean "bcp: command not found" ?  try giving the full path, or editing your PATH
09:13   outsourcer5   i went thr this path /xxx/yyy/zzz/sybase/OpenClientServer/prod/bin/
09:13   outsourcer5   and executed there
09:14   chatter8      not sure what you mean
09:15   chatter8      do you mean you did "cd /xxx/yyy/zzz/sybase/OpenClientServer/prod/bin/ ; bcp " ?  because that won't work
09:15   chatter8      this isn't DOS
09:15   outsourcer5   ok
09:16   chatter8      again: try giving the full path, or editing your PATH
09:16   outsourcer5   ok
09:17   chatter8      if that doesn't mean anything to you, ask for some unix training

Day 35. By now I think I gave up recording what the outsourcer's job title was listed as, since it bore no resemblance to any skillset that I could understand. It's possible that this one was CEO.

08:25   outsourcer6   Hi
08:25   outsourcer6   I have created a folder in unix box and i am not able to delete it
08:26   outsourcer6   its creating some hidden nfs files inside the directory
08:26   chatter10     rm -rf ${directory}/.*
08:26   outsourcer6   its saying Directory not empty
08:26   chatter10     rm -rf ${directory}
08:28   outsourcer6   >  rm -rf $temp/.*
08:28   outsourcer6   rm: Unable to remove directory /.pi/RCS/.pi: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.pi/RCS/etc: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.pi/RCS: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.pi: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.pwdmgmt/.ssh: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.pwdmgmt: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.ssh/commands: Permission denied
08:28   outsourcer6   rm: Unable to remove directory /.ssh: Permission denied
08:30   chatter10     ok... try: find $directory -exec rm -rf {} \;
08:30   outsourcer6   ok
08:30   chatter10     where $directory is the directory you want removed
08:33   outsourcer6   >  find $temp -exec rm -rf {} \;
08:33   outsourcer6   find: path-list predicate-list
08:34   outsourcer6   but still not getting deleted....
08:38   chatter10     echo "-- $temp --"
08:39   chatter10     please
08:39   chatter10     I bet $100 your variable is empty
08:39   chatter10     and you have probvably hosed your home directory too
08:42   outsourcer6   u r right...its empty...
08:42   outsourcer6   but why is it saying tht file exists in the directory?
08:43   outsourcer6   if i try ls -al
08:43   outsourcer6   am getting the below result
08:43   outsourcer6   drwxrwsrwx   2 rrwdev   rrwdev      4096 Jan 10 08:22 .
08:43   outsourcer6   drwxr-sr-x   3 rrwdev   rrwdev      8192 Jan 10 08:22 ..
08:43   outsourcer6   -rw-------   1 rrwdev   rrwdev     12288 Jan 10 06:25 .nfsB59DA3
08:43   outsourcer6   -rw-------   1 rrwdev   rrwdev      4096 Jan 10 06:25 .nfsC59DA3
08:43   outsourcer6   -rw-------   1 rrwdev   rrwdev     12288 Jan 10 06:33 .nfsD59DA3
08:43   outsourcer6   -rwxrwxrwx   1 rrwdev   rrwdev      4096 Jan 10 05:58 .nfsE59DA3
08:48   outsourcer6   and when i try deleting this .nfs* files its getting created again and again
08:56   chatter10     why do you want to delete the nfs files?
08:59   outsourcer6   since it was saying file exists in the directory i tred deleting it
08:59   outsourcer6   *tried
09:09   chatter10     I'm just hoping you know the implications of running "rm -rf $temp/.*" when $temp is empty....
09:09   chatter10     and I hope you realize how lucky you are there was a dot in there
09:10   chatter10     if I were you i'd raise a request to get all my unix accounts deleted
12:20   chatter8      rm -rf $temp/.*     <-- oh boy!
12:20   chatter8      for anyone else who doesn't know what they're doing:
12:20   chatter8      never, ever, ever, ever give an argument like .* to rm.  that will match both . and .. so will recurse UPWARDS until it reaches /
12:20   chatter8      congratulations, you've nuked your entire filesystem
12:20   chatter8      (in this case it made no difference, since it was run as rm -rf /.* so it started at the root anyway!)

Day 37.

12:00   outsourcer7   Hi
12:01   outsourcer7   i am using the 5.8.0 version of perl
12:02   outsourcer7   when i am running the SFTP script i get errors saying that can't locate Net/S FTP.pm  in @INC....
12:02   chatter2      You asked this question at 8:50 this morning.
12:02   outsourcer7   i tried adding the lib path use lib "/xxx/yyy/zzz/cpan/5.8.8-2006.03/lib";
12:02   chatter2      And I gave you the answer
12:02   outsourcer7   i went thru the link
12:03   chatter2      If you're using Perl 5.8.0, why are you using a CPAN build for 5.8.8?
12:04   outsourcer7   i am not sure which lib to use
12:04   outsourcer7   pls advice
12:04   chatter2      I advise you to give this task to a Perl programmer.
12:05   chatter2      I don't think we have Net::SFTP in the Global cpan build.
12:06   chatter2      Oh. Wait. Looks like it was added in 5.8.8-2006.09
12:07   chatter2      use lib '/xxx/yyy/zzz/cpan/32-bit/5.8.8-2006.09/lib';
12:07   chatter2      But you should also upgrade to using Perl 5.8.8 at the same time.
12:08   chatter2      And please read http://xxx/yyy/zzz/Perl-FAQ#Perl-FAQ-ArethereanygoodonlineresourcesforPerl
12:08   chatter2      (and some of the resources it points to)
12:09   outsourcer7   how to upgarde the perl version? do i need to raise aany request for that?
12:09   chatter2      All of the Perl versions are available on Global
12:10   chatter2      Did you get shown how Global works when you started working on a project?
12:10   outsourcer7   no
12:11   chatter2      Do you have any experience in writing Perl?
12:11   outsourcer7   no
12:11   chatter2      Sounds like you're a perfect choice for this task then :-)
12:11   outsourcer7   i recently started perl programming
12:12   outsourcer7   :)
12:12   chatter2      12:11        outsourcer7   i recently started perl programming <==== Then the link I posted above will be of great help to you
12:12   outsourcer7   i am going thru that
12:13   chatter2      Do you have any experienced Perl programmers that you can go to for assistance?
12:13   chatter2      (other than us)
12:14   chatter2      Strange. Net::SFTP is also in cpan/5.8.8-2006.03. Wonder why your code didn't find it.
12:17   chatter3      outsourcer7 are you running on unix or windows?
12:17   outsourcer7   on unix
12:18   chatter2      I just mention this in passing as I'm sure that no-one would make this mistake: but I assume you added the "use lib ..." line before the "use Net::SFTP" line.
12:21   outsourcer7   yes i did
12:24   chatter2      Ok. Well in that case I don't know why it didn't work. I recommend you spend a couple of weeks reading up on Perl and then revisit this problem.
12:25   outsourcer7   i too would prefer that...but it seems we have a release this weekend

Day 38. outsourcer7 returns to finalise the work for that weekend deadline. Oh, and in case you are wondering, yes, this is a quoted company. And yes, the share price is well off its highs.

13:30   outsourcer7   Hi
13:30   outsourcer7   i am using unlink to remove a file
13:31   outsourcer7   how to delete more than one file
13:31   outsourcer7   will unlink do that
13:31   chatter2      What happened when you tried it?
13:31   chatter2      What does the documentation say?
13:31   chatter3      have you checked the documentation for unlink?
13:31   chatter3      ah, too slow
13:31   outsourcer7   yes
13:31   outsourcer7   i used unlink for del one file
13:32   outsourcer7   now i have remove say 2 files
13:33   chatter2      And what does the very first sentence in the documentation say?
13:33   chatter3      out of interest, what documentation did you check?
13:34   outsourcer7   thanks
13:49   chatter4      make sure you check the return value appropriately
13:50   chatter2      Yeah. But it mentions that in the documentation :)

Day 45. outsourcer8 is another "developer"

08:29   outsourcer8   Hi how do i search only in specific columns for a chatcter in a file
08:32   chatter11     do you have some column delimiter? tab, comma, whatever
08:32   chatter11     or are they fixed width?
08:34   outsourcer8   the delimiter is |
08:36   chatter11     cut -d\| -f3,5,6 | grep whatever_you_are_looking_for
09:54   outsourcer8   Hi the data in the file is like L|GGLM|XXX|22834MXN2889000143
09:54   outsourcer8   i want the output to be L|GGLMXXX22834MXN2889000143
09:55   outsourcer8   bsiaclly merge the 2,3 and 4 th coulumns
09:59   chatter11     awk -F\| '{print $1"|"$2$3$4}'
10:01   outsourcer8   where do i ggive the filneame?

Like this last example, chatters often gave up when it was clear they had answered the question, only to have the outsourcer then request information that a first year student still at University would be able find the answer to with 5 minutes effort. I have to question whether these outsource organisations really understand just how badly their reputation is being affected by displaying this level of competence. But I guess that as long as the money keeps rolling in, they probably don't care.

BCNU - Javva The Hutt.


Back to newsletter 090 contents


Last Updated: 2017-03-29
Copyright © 2000-2017 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/javvathehutt090.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us