All Things Techie With Huge, Unstructured, Intuitive Leaps

A Whole Bunch of MySQL Stuff

Had a major event today on our server.  MySQL took the server down.  It was the daemon mysqld.  It started to spike the memory, which started the system to page furiously and then we had a kernel dump.  Went to /var/log/messages and grepped for “memory” and saw that UID27 reported out of memory as part of the crash output.  The message was

 [ERROR] /usr/share/mysqld: Out of memory (Needed xxx bytes)

So what to do?  Obviously we didn't have enough RAM allocation.  I use entirely an innodb engine with mysql.  So I had to find where mysql was getting its configs from.

From the server console, I typed in:

mysql --help

and among all of the stuff that was returned, it told me where to look for the config file.  It said:


Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf

So I went to /etc/my.cnf and used the vi editor.  I added

innodb_buffer_pool_size = 1000M

I added it under [mysqld].  We have 4 Gigs of RAM and the allowable value is up to 80% of the RAM.  Previous to this it was 16M.

Then I stopped the database by issuing the following command:

/etc/init.d/mysqld stop

No issues.

To start it, I issued

/etc/init.d/mysqld start

and it failed.  This is what it said:


[root@ap1 etc]# /etc/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

Well, went back to /etc/my.cnf and I noticed that I had forgotten the "i" in the innodb_buffer_pool_size.  I added that, and it started.

I gotta tell you, the application now screams!!  I should have done a RAM allocation earlier.




Making Effective Online Ads



Everybody sells at one time or another. We sell ourselves to our dates. We sell ourselves to our prospective employers. We sell stuff on the internet. There is a lot of clutter out there, and when we have something to sell, we must get ourselves to stand out above the clutter.

If you have to create an ad, or a webpage or any online presence, then this eBook is for you. It is the Top Secrets of the Admasters. It teaches you how to make the most effective online ads and web pages. It tells how to make ads that people cannot resist clicking on.

The psychology and layout of an online presence is important. This book show you how to use color, subject matter, trusted colors, the 9 elements that your ad must have and other helpful tips to rise above the noise and get noticed on the web.

Buy it here on Amazon Kindle:  http://www.amazon.com/dp/B009XHPIYE

Major UIX Tip -- It's Black and White

If you ware a regular reader of this blog, you know that I have several blogs, and I am constantly experimenting with them as to optimal design to generate the most hits, the greatest user experience and the best UIX or user interface experience.

I decided to experiment with stickability -- how long visitors to the site would stick around for content other than that what brought them there in the first place.  I took two relatively popular blogs, and had one with a black background and one with a white background.

The white background blog continuously outperformed the black one.  After a month, I switched it.  The one that was previously black and now white, suddenly became popular again with more hits.

No one needs more black and white evidence than this.  I had previously opined that a black background on a mobile device acts like a mirror, and that a white background was better.  That was a subjective feeling before.  It appears that it is also an empirical observation now.

New Revenue Stream for Photoshop Gurus

Self publishing on Amazon with eBooks is now a big thing.

I was reading an online forum for that topic and the author of the above book idly wondered online as to whether Brits hated her because she wasn't getting sales in the UK.  Her book had a cover of the heroine in a bar scene that was drawn for the cover.

I opined that perhaps the UK reader had cultural anomalies that made them hard to identify with the American bar scene.  The author replied that she was considering changing the cover.

It occurred to me that a photoshop person could make some serious cash by doing covers for authors.  Then I discovered that they were.  There was some guy selling stock photos for $20 with the title and author added with the photoshop text tools.  Others were selling covers for up to $299 per cover.  Photoshop gurus, here is another revenue stream for you.

A real graphics designer with a creative flair could probably make more money doing covers than the authors were making writing the books.

Just as an exercise tonight, I idly wondered how I would re-design the cover of Ms. Alroc's book called "Strangely Sober".  Knowing that sex sells, I photoshopped the above cover just as an exercise.  Ms. Alroc didn't ask for this and is unaware that I am doing this.  I just did it to see how my design effort would turn out.  I will certainly notify her that I have done this, and I will remove it if she requests it.

And if you are a Kindle reader, please buy her book:  http://www.amazon.com/Strangely-Sober-Essa-Alroc/dp/1478341467/ref=la_B008QN3FX2_1_1?ie=UTF8&qid=1350875121&sr=1-1

Thanks.

How to split a .war file or a .zip file


I had a problem.  I remotely manage some coders 800 miles away.  I am getting them up to speed with j2ee, jsps, java, pojos and such.  I needed to get a .war file to them to deploy on a test server.

I used Eclipse to make my war, and when I went to send it to them, the size of the file was 34 megabytes.  I am only allowed 25 megabytes with my email program as an attachment.

What makes a war file big, are the jars in the lib directory.  I could have pulled them out and sent them separately, but my programmers are junior programmers and I wanted a no-muss, no fuss solution.  I needed a free file splitter.

So I went to http://www.filesplitter.org/ and downloaded FreeFileSplitter.  I broke my war file into 18 mb chunks, and sent my guys two emails each with a chunk attached.

They downloaded FreeFileSplitter on their end.  It doesn't even have an installer.  It is just a very small binary that sits on the desktop.  They joined the two chunks together and deployed the war.

Thanks very much to FreeFileSplitter.  It works like a charm.  It will split and reassemble any kind of file including zip and media files.

How To Prevent Hack Attacks and Cyber Attacks From Iran

I just read that American Banks and other companies are under cyber attack sponsored by the government of Iran.

If I were the CIO, CTO or the IT management type responsible for American banks, financial institutions, energy companies, or major (and not-so-major) corporations, I would call in my network administrators and system administrators and have them write firewall rules blocking everything from Iran. If there is an economic embargo, there should be an internet embargo as well.

As a public service, here is a list of IP addresses to write the firewall wall rules preventing any access at all from Iran.

 Major IP Address Blocks For Iran


From IPTo IPTotal IPsAssign DateOwner
62.60.128.062.60.255.2553276813/06/2001Iranian Research Organization for Science & Technology
62.193.0.062.193.31.255819217/07/2000DP IRAN
62.220.96.062.220.127.255819225/10/2001Soroush Audio Visual Company
77.36.128.077.36.255.2553276812/03/2007IRIB (Islamic Republic of Iran Broadcasting)
77.77.64.077.77.127.2551638421/02/2007Rayaneh Danesh Golestan
77.104.64.077.104.127.2551638407/10/2008Respina Networks & Beyond
77.237.64.077.237.95.255819201/02/2007Respina Networks & Beyond
77.237.160.077.237.191.255819206/02/2007Parsun Network Solutions
77.245.224.077.245.239.255409607/05/2007Research Institute Of Petroleum Industry
78.38.0.078.39.255.25513107219/03/2007Information Technology Company (ITC)
78.109.192.078.109.207.255409617/07/2007Afranet
78.110.112.078.110.127.255409609/08/2007TSTonline co.
78.111.0.078.111.15.255409627/08/2007Neda Rayaneh
78.154.32.078.154.63.255819217/07/2007Arya Sepehr Ettelarasan Tehran
78.157.32.078.157.63.255819228/08/2007Fanava Group
78.158.160.078.158.191.255819206/09/2007Arya Sepehr Ettelarasan Tehran
79.127.0.079.127.127.2553276817/09/2007AsiaTech Inc.
79.132.192.079.132.223.255819202/10/2007Morva System Company
79.175.128.079.175.191.2551638412/11/2007Afranet
80.66.176.080.66.191.255409609/06/2004University of Tehran Informatic Center
80.69.240.080.69.255.255409603/04/2009ir.pasargad
80.71.112.080.71.127.255409618/01/2005Neda Rayaneh
80.75.0.080.75.15.255409619/06/2001Afranet
80.191.0.080.191.255.2556553623/07/2002Information Technology Company (ITC)
80.242.0.080.242.15.255409627/04/2009AFROOZ Etela Resan Company Ltd
80.253.128.080.253.143.255409613/12/2001Azadnet Resaneh
80.253.144.080.253.159.255409628/05/2002Azadnet Resaneh
81.12.0.081.12.127.2553276827/05/2002Soroush Audio Visual Company
81.28.32.081.28.47.255409617/04/2002IsIran
81.28.48.081.28.63.255409622/12/2004IsIran
81.29.240.081.29.255.255409617/06/2009Pardis Ettela Resaan Sepehr
81.31.160.081.31.175.255409603/06/2002Sharif University Of Technology
81.31.176.081.31.191.255409608/12/2003Sharif University Of Technology
81.90.144.081.90.159.255409604/01/2006Afranet
81.91.128.081.91.143.255409618/07/2002DATAK Internet Engineering, Inc
81.91.144.081.91.159.255409626/09/2002DATAK Internet Engineering, Inc
82.99.192.082.99.255.2551638412/12/2003Pars Online
82.115.0.082.115.31.255819206/01/2004Parsun Network Solutions
83.147.192.083.147.255.2551638414/06/2007Oracle Investment Group.
84.47.192.084.47.255.2551638418/10/2004Parscyberian Consultants
84.241.0.084.241.63.2551638410/06/2004Aria Rasana Tadbir
85.9.64.085.9.127.2551638411/02/2005Pishgaman Kavir Yazd Cooperative
85.15.0.085.15.63.2551638419/04/2005Aria Rasana Tadbir
85.133.128.085.133.255.2553276806/12/2005Sepanta Communication Development Co. Ltd
85.185.0.085.185.255.2556553625/11/2004Information Technology Company (ITC)
85.198.0.085.198.63.2551638431/01/2005TSTonline co.
86.109.32.086.109.63.255819205/07/2005Azadnet Resaneh
87.107.0.087.107.255.2556553622/08/2005Soroush Audio Visual Company
87.247.160.087.247.191.255819223/11/2005Neda Rayaneh
87.248.128.087.248.159.255819226/08/2008CallWithMe
89.144.128.089.144.191.2551638427/01/2006ANDISHE SABZ KHAZAR CO. P.J.S.
89.165.0.089.165.127.2553276801/03/2006Neda Gostar Saba Data Transfer Company Private Joint Stock
89.221.80.089.221.95.255409629/09/2006Fanava Group
89.235.64.089.235.127.2551638430/05/2006Azadnet Resaneh
91.98.0.091.99.255.25513107211/09/2006Pars Online
91.184.64.091.184.95.255819211/10/2006DATAK Internet Engineering, Inc
91.186.192.091.186.223.255819210/11/2006Oracle Investment Group.
92.50.0.092.50.63.2551638417/12/2007Shahrad Net Company Ltd.
92.61.176.092.61.191.255409602/01/2008Arian Rasaneh Pars
92.62.176.092.62.191.255409625/01/2008ir.pasargad
92.242.192.092.242.223.255819208/01/2008Respina Networks & Beyond
93.110.0.093.110.255.2556553624/04/2008Laser Company Ltd
94.74.128.094.74.191.2551638414/07/2008Farahoosh Dena
94.101.128.094.101.143.255409615/08/2008AFROOZ Etela Resan Company Ltd
94.101.176.094.101.191.255409621/08/2008Jahan Negar Parsian
94.101.240.094.101.255.255409626/08/2008AFROOZ Etela Resan Company Ltd
94.139.160.094.139.191.255819226/11/2008DATAK Internet Engineering, Inc
94.182.0.094.183.255.25513107217/09/2008Aria Rasana Tadbir
94.184.0.094.184.127.2553276811/08/2008I.P.M
94.184.128.094.184.255.2553276815/07/2009I.P.M
94.241.128.094.241.191.2551638430/09/2008Oracle Investment Group.
95.38.0.095.38.255.2556553611/12/2008Fanava Group
95.80.128.095.80.191.2551638425/11/2008Bozorg Net-e Aria
95.81.64.095.81.127.2551638404/06/2009Hamara System Tabriz Engineering Company
95.82.0.095.82.63.2551638408/12/2008Shahrad Net Company Ltd.
95.82.64.095.82.127.2551638411/12/2008kara amin ertebat
95.142.224.095.142.239.255409611/08/2009Armaghan Rahe Talaie
188.34.0.0188.34.255.2556553619/03/2009Asre Enteghal Dadeha
188.75.64.0188.75.127.2551638424/08/2009homatelecom
188.118.64.0188.118.127.2551638422/06/2009University of Tehran Informatic Center
188.121.96.0188.121.127.255819211/05/2009Jahan Negar Parsian
188.121.128.0188.121.159.255819211/05/2009TSTonline co.
188.126.128.0188.126.159.255819223/07/2009Arian Rasaneh Pars
188.136.128.0188.136.255.2553276815/05/2009Ariana Gostar Spadana
188.158.0.0188.159.255.25513107209/06/2009Neda Gostar Saba Data Transfer Company Private Joint Stock
194.225.0.0194.225.255.2556553629/12/1995I.P.M
195.146.32.0195.146.63.255819222/07/1997Information Technology Company (ITC)
212.16.64.0212.16.95.255819229/05/2008Farhang Azma Company Ltd
212.33.192.0212.33.223.255819215/07/2008Fanavaran Ettelaaat Dibagaran Karaj Co. Ltd.
212.50.224.0212.50.255.255819223/05/2008Rasaneh Esfahan Net
212.80.0.0212.80.31.255819227/05/2009Farhang Azma Company Ltd
212.95.128.0212.95.159.255819227/04/2009Parsun Network Solutions
212.120.192.0212.120.223.255819227/05/2008Hamara System Tabriz Engineering Company
213.176.0.0213.176.31.255819208/12/1999Iranian Research Organization for Science & Technology
213.176.32.0213.176.63.255819225/07/2000Iranian Research Organization for Science & Technology
213.176.64.0213.176.127.2551638401/02/2000Iranian Research Organization for Science & Technology
213.195.0.0213.195.63.2551638421/04/2009Arya Sepehr Ettelarasan Tehran
213.207.192.0213.207.255.2551638407/11/2002DATAK Internet Engineering, Inc
213.217.32.0213.217.63.255819219/02/2001Pars Online
213.233.160.0213.233.191.255819204/04/2003Sharif University Of Technology
217.11.16.0217.11.31.255409621/11/2002Afranet
217.24.144.0217.24.159.255409620/03/2003Parscyberian Consultants
217.25.48.0217.25.63.255409624/03/2003IRNA
217.64.144.0217.64.159.255409601/04/2009Aka Networks
217.66.192.0217.66.207.255409607/11/2000Neda Rayaneh
217.66.208.0217.66.223.255409602/02/2001Neda Rayaneh
217.146.208.0217.146.223.255409626/04/2004Neda Rayaneh
217.172.96.0217.172.127.255819211/02/2004Parscyberian Consultants
217.174.16.0217.174.31.255409626/03/2004National Iranian Oil Company
217.218.0.0217.219.255.25513107203/04/2001Information Technology Company (ITC)
Source:  http://www.nirsoft.net/countryip/ir.html

Come to think of it, I should do this with China too.  It is ironic that the minute that I deploy a new server, I start getting clever scripted hack attacks from institutions in China, like the meteorological institute.  I think that firewall blocking from unfriendlies, should be the first step in protecting your digital assets.


 

Buddha of the Binaries ~ Zen of Software Development~ Noble Truth #3


Oh Buddhist of the Binaries, I desire more lessons, what is the third noble truth?

Well my little code monkey with the red ass,  the third noble truth is that bugs in software  can be overcome and apps become killer and happiness can be attained; that true happiness and contentment are possible. lf we give up useless kiddie scripting and learn to code Java classes and jsps each day at a time (not dwelling in the past or the imagined future) then we can become happy and free. We then have more time and energy to help take our company viral. This is Nirvana.

One must learn to write elegant, simple profound code that supplies a desired need among the software addicts of the world.  Your code must become the crack cocaine of the mobile device.

For the other lessons, click HERE (and send money!)


How To Resize and Rename Photos

I had a problem.  I had to send a kajillion pictures to a person.  They were taken with a high resolution setting on the camera.  All of the photos were too large to be sent by email.

Usually when I have just a few, I open them in GIMP and resize the image.  This was a whole folder full of photos.

I searched the web for a free resizer and PhotoResize400.exe came up.  I gave it the college try.  I downloaded it from here:  http://www.rw-designer.com/picture-resize  and to my surprise, it wasn't zipped or anything.  The binary executable loaded directly onto the desktop.

I then separated out the pics that I wanted into a new folder on the desktop.  Then I closed the folder, grabbed it by selecting it, and drag and dropped it on the PhotoResize400.exe icon.  As quick as you could say "Gee I wonder if this works|, it was done.  I took a peek inside the folder, and sure enough it was done.

It preserved the original pics, and next to it, made a newer smaller version labeled -400.jpg.  (If the original pic was name 100234.jpg, it renamed it to 100234-400.jpg).  So now, it was a pain in the rear to separate them.  I decided to use DOS to do it.

I opened a RUN command shell and changed directory (cd command) to my desktop.  Then I did a directory listing (dir).  All of the photos were name September12-00x.jpg and the smaller ones were named September12-00x-400.jpg.

To separate them out so that the listing would group the smaller ones together, I had to do a DOS rename. It was easy as pie.  I typed in rename September12*-400.jpg  resized*.jpg in the cmd window.

What this did was rename the September12-00x-400.jpg to resized-00x-400.jpg.  The 00x was an incremental number (01, 02,03) so the numbering was preserved, it just took out the September12 prefix, because even the big ones (unresized) started with that prefix and they were a pain to separate.  Now all of the unresized ones started with September12 and all of the small ones started with resized.  When you did a directory listing or explored the folder, they were all neatly grouped into large and small by name.

As a product review, I fully recommend PhotoResize400.exe.  The photos are a little small for my liking, but it let me send a whole pile through the email.

Anonymous Email? What is the Best?

I was idly wondering about sending an anonymous email, so I plugged the term into good old Google.  The first site that came up was:

www.sendanonymousemail.net


I have a couple of throwaway email accounts (everyone should have a couple of them that cannot be tied to you) and send two from that page.  That was 5 hours ago.  No email has arrived at any of my email boxes from them.  Things that make you go hmmmmm.

Then I ended up at:

send-email.org

Well, within 20 minutes the test email arrived.  So I would say that send-email.org is the best out of the two.

When the email arrived, it said that it was from Free Email Service and the return address was: info@send-email.org

That works for me.

Then I got to thinking ...........  ..............

suppose that I was an intelligence agency, FBI, law enforcement, private investigator, criminal, blackmailer or a news organization.  I would set up one of these things to collect information and see what comes in.

That thought was enough to scare the crap out of me.  Its now back to sending emails from a Linux command line for me.

Update:  It is now 16 hours and the emails from sendanonymousemail.net still have not yet arrived.  This service is definitely not to be relied on.

Update II - I think that sendanonymousemail.net is a scam.  My test emails still haven't arrived a full day and a half later, and they probably never will.

java.sql.SQLException: After end of result set





I had to google this exception thrown because I had never encountered it before:

java.sql.SQLException: After end of result set


It turns out that I had called ResultSet rs.next() twice.  The second time it was after the end of it.  It was a careless dumb coding error.

Simple yet dumb error.   Hope this helps.

Thread: java.net.SocketException: Too many open files

Running my tomcat app on a Centos machine.  I looked at the logs and saw this error:

Thread: java.net.SocketException: Too many open files

Bummer.  I opened up a putty ssh to the server and did an su to superuser.  I wanted to see what the hard limit was for open file handles

I typed in at the bash#    ulimit -Hn and the return value was 1024,  Not good.

I issued the command to up the hard limit to 10000.  The command was ulimit -Hn 10000.

The soft limit was 1024 as well.  I upped the soft limit to 5000 with the command:  ulimit -Sn 5000

From what I could gather, this problem started happening when I initiated a log4j logger and we started getting decent traffic.

Hope this helps.

Java - How to make an arraylist of arraylists

I had to make an arraylist of arraylists.  The reason that I was doing this, was that I had to eliminate duplicates from a resultset.  The easiest way to do this was to put the resultset into an arraylist so that I could operate on it, because you can't iterate or use a resultset twice in Java.

Here are a few examples of the constructors to make an arraylist of arraylists:

   ArrayList<ArrayList<Object>> allData = new ArrayList<ArrayList<Object>>();

 ArrayList<ArrayList<String>> allString = new ArrayList<ArrayList<String>>();

 ArrayList<ArrayList<int>> allInts = new ArrayList<ArrayList<int>>();


Easy once you know how.

CNN Website Error

(click for larger image)

This has all happened to us at one time or another.  We have deployed a website and have forgotten to validate the tags.  When we visit the website live, we find the above junk printed.  It is actually the tag code that wasn't interpreted but rather rendered as text due to a missing element.

One of the easiest ways to avoid website validation errors is to go to the following URL:

http://validator.w3.org/

and enter the URL.  It will identify any tag errors.

I am just amazed that a large organization like CNN who lives and dies by their online presence would make such newbie mistakes.

Java String MySQL Error

I just spent an hour banging my head against a wall.  I constructed a mysql query string from variables.  So my string construct would look like this:
String quality = "Very Good";

String queryString = "Select  * from products where consumer_rating=" + quality;

The thing kept bombing.  It said that I had an sql error near where consumer_rating=Very Good.

It all looked kosher.  I had forgotten that a string value needs single quotes.

In other words, I should have declared quality =" 'Very Good' ";

Notice the single quotes after the double quotes.  Necessary for an sql statement for string injection.

Hope this helps someone save some time.