Java Digital Magazine

With the help of Texterity, Oracle has begun publishing a glossy, bimonthly magazine focused on Java. From the mouths of Oracle, “Java Magazine is an essential source of knowledge about Java technology, the Java programming language, and Java-based applications for people who rely on them in their professional careers, or who aspire to.”

It is available as a free digital download for the iPhone, Android, and as a web based reader.

Site Maps and Their Place in the Land of SEO Snakeoil

I’m not a fan of SEO tricks. I come across a lot companies not willing to embrace the concept of good content; instead gullibly grasping on to SEO tricks as a proverbial magic bullet. Whether it is ignorance or faith, it becomes a tiger chasing its tail. But there are some sensible, reasonable things that one can do that don’t resort to unethical trickery.

Site maps are a great tool that are often overlooked. It took me a while before I started appreciating them . I’ve come to recognize their benefit.

They provide a great and efficient way of having your website indexed by Google, Yahoo!, and Bing.

It is well worth the effort.

Here is a good link with all of the tools needed: http://www.smart-it-consulting.com/article.htm?node=154&page=83

and here is a good series of “how-tos”: http://www.smart-it-consulting.com/article.htm?node=133

And then, finally, you’ll need to log in to Google’s Webmaster Tools and submit your site map. You’ll want to toggle Yahoo! and Bing, also.

I do this for all of my sites that I build. It gives me great feedback.

99 Bottles of Beer

I thought that you might get a kick out of this (if you didn’t already know of its existence).

Next time someone asks you about the programming differences of one language vs another, send them here: 99-bottles-of-beer.net/

No more “Hello, World”. 🙂

It is a collection of the song, “99 Bottles of Beer” written in 1,486 different programming languages.

Pretty funny, but also fun and informative. While obviously this can be done in a simple rudimentary loop, a lot of submitters take it way beyond that and get really excessive, but… I found myself spending a couple of hours and wading through many examples to see how people got creative, and learned a few new things along the way.

Is ASCII Art Making a Comeback?

I have noticed ASCII art showing up in commented out sections in the headers of a few websites. Today, I even saw one in barackobama.com’s code. It must be a new trend. Remember all of the ASCII art back in the 1980s and dot matrix nekked ladies?

I will keep a running tally. Anytime that I come across a new piece of ASCII art in someone’s header, I will add it to this post. I went ahead and made one for myself. Nothing special, though. I just figured that I would join in the fun.

 

 

 

 

 

 

 

(HEY!!! It’s mine! Clever use of Rs and Ps, no? 🙂

 

 

 

What is Stack? What is Heap?

I came across this nice explanation at max-pedia.com of the differences between stack and heap. If you’re a bit fuzzy about it (like me), it takes a couple of readings for it to fully sink in.

What is heap and stack?

http://www.maxi-pedia.com/what+is+heap+and+stack/

The stack is a place in the computer memory where all the variables that are declared and initialized before runtime are stored. The heap is the section of computer memory where all the variables created or initialized at runtime are stored.

What are the memory segments?

The distinction between stack and heap relates to programming. When you look at your computer memory, it is organized into three segments:

  • text (code) segment
  • stack segment
  • heap segment

The text segment (often called code segment) is where the compiled code of the program itself resides. When you open some EXE file in Notepad, you can see that it includes a lot of “Gibberish” language, something that is not readable to human. It is the machine code, the computer representation of the program instructions. This includes all user defined as well as system functions.

Heap and stack - what is it?

Now let’s get to some details.

What is stack?

The two sections other from the code segment in the memory are used for data. The stack is the section of memory that is allocated for automatic variables within functions.

Data is stored in stack using the Last In First Out (LIFO) method. This means that storage in the memory is allocated and deallocated at only one end of the memory called the top of the stack. Stack is a section of memory and its associated registers that is used for temporary storage of information in which the most recently stored item is the first to be retrieved.

What is heap?

On the other hand, heap is an area of memory used for dynamic memory allocation. Blocks of memory are allocated and freed in this case in an arbitrary order. The pattern of allocation and size of blocks is not known until run time. Heap is usually being used by a program for many different purposes.

The stack is much faster than the heap but also smaller and more expensive.

Heap and stack from programming perspective

Most object-oriented languages have some defined structure, and some come with so-called main() function. When a program begins running, the system calls the function main() which marks the entry point of the program. For example every C, C++, or C# program must have one function named main(). No other function in the program can be called main(). Before we start explaining, let’s take a look at the following example:

int x;                      /* static stack storage */
void main() {
   int y;                   /* dynamic stack storage */
   char str;                /* dynamic stack storage */
   str = malloc(50);        /* allocates 50 bytes of dynamic heap storage */
   size = calcSize(10);     /* dynamic heap storage */

When a program begins executing in the main() function, all variables declared within main() will be stored on the stack.

If the main() function calls another function in the program, for example calcSize(), additional storage will be allocated for the variables in calcSize(). This storage will be allocated in the heap memory segment.

Notice that the parameters passed by main() to calcSize() are also stored on the stack. If the calcSize() function calls to any additional functions, more space would be allocated at the heap again.

When the calcSize() function returns the value, the space for its local variables at heap is then deallocated and heap clears to be available for other functions.

The memory allocated in the heap area is used and reused during program execution.

It should be noted that memory allocated in heap will contain garbage values left over from previous usage.

Memory space for objects is always allocated in heap. Objects are placed on the heap.

Built-in datatypes like int, double, float and parameters to methods are allocated on the stack.

Even though objects are held on heap, references to them are also variables and they are placed on stack.

The stack segment provides more stable storage of data for a program. The memory allocated in the stack remains in existence for the duration of a program. This is good for global and static variables. Therefore, global variables and static variables are allocated on the stack.

Why is stack and heap important?

When a program is loaded into memory, it takes some memory management to organize the process. If memory management was not present in your computer memory, programs would clash with each other leaving the computer non-functional.

Heap and stack in Java

When you create an object using the new operator, for example myobj = new Object();, it allocates memory for the myobj object on the heap. The stack memory space is used when you declare automatic variables.

Note, when you do a string initialization, for example String myString;, it is a reference to an object so it will be created using new and hence it will be placed on the heap.

The Continued Demise of Email as a Marketing Tool

From time to time, I have to attempt an explanation to a marketeer as to why email blasts are an exercise in futility. But, knowing that they are happy with a 1% to 3% success rate with direct mail marketing, I realize that I am not speaking to the choir.

Many, many companies worth their salt have set their filters to deny image files. Generally, it is a bandwidth issue but here is a good example of it being a security issue, thanks to the intrusiveness of  ContactMonkey…

From Ars Technica, by Sean Gallagher

The funny thing is that C|NET also reviewed the software but went the other way and gave it a glowing review. My guess is that Jason Cipriani wasn’t fully aware of the software’s implications.

===================
The spy in your inbox
One PR company—and its tracking program—creep out an Ars writer.

by Sean Gallagher – Nov 6 2012, 4:10pm EST
Everything on the Internet is monitored in some way. Companies track what you do at work through deep packet inspection to make sure you don’t wander into territory forbidden by company policy, or dump corporate data to a remote server just before you give notice. The Web pages you visit and the HTML-based mass e-mails you open are logged and tracked by advertisers and marketers. And your boss can tell if you’ve ever opened that urgent message or not.

But people usually don’t throw it in your face and shatter whatever remaining illusions of privacy you might have, as someone did to my colleague Andrew Cunningham today.”Oh, man, a PR person was just totally creepy at me,” he interjected over IRC this morning.

The “creepy” was an e-mail that a media representative for a company called ContactMonkey sent on the heels of another one Cunningham had just opened. The second message included information about his location, the e-mail client he had used to open it, and the exact time it had been opened.

The Outlook plug-in toolbar for ContactMonkey’s Bridge.
The message and the data were a demonstration of Bridge, a $5-a-month service that installs a plugin for Microsoft’s Outlook 2010 mail client and for Google’s Chrome browser for use with GMail. Bridge gives anyone the power to know those details for any message they send—or at least any message that lands in the inbox of someone who trustingly opens e-mails without blocking HTML-embedded images.

Invisible sprites

That’s because Bridge uses an embedded graphic with a unique Web address to track each message. That Web address includes calls to ContactMonkey’s tracker API, which include a message identifier and the e-mail address of the sender. When the recipient opens a tracked e-mail, it sends a secure Web request back to ContactMonkey’s server identifying the message, and the server records the IP address that the message was opened from and the date and time. Then it pushes back data to the sender, including how many times the message was viewed, the geographic location it was viewed at (based on the IP address), and the type of client it was viewed from (based on what the mail client reports as its type when it makes the HTML request).

The HTML code that embeds the tracking graphic in Bridge-bugged email messages (address of sender obscured).
Using graphics to collect metrics is an old hack, going back to the “sprites” used on many early personal Web pages to track page views. Web request based tracking is also heavily used by both legitimate large-scale e-mailers and spam factories to collect information such as when and where e-mails are opened, and to test the “hit rate” for various subject lines and offer teases.

But ContactMonkey gets even more personal about it, because it identifies each recipient explicitly, and reports back directly on them. It’s a technique akin to those used by some “spear-phishing” attacks to inject code into e-mails—no, it doesn’t execute code on the client. But it does create a way to collect information that might be useful for stalking someone.

Sweeping for bugs

There’s an easy way to block this sort of tracking with most mail clients. Microsoft Outlook, for example, will allow users to block embedded graphics in e-mails from all sources, or only display them in e-mails from sources in the user’s contact list. Most companies will set their mail systems to block HTML-embedded objects in messages for security purposes.

Users of Apple’s Mail app have a little less fine-grain control—unchecking “Display remote images in HTML messages” in Mail’s “Viewing” preferences blocks all HTML-embedded images from loading when you open a message. But that’s not the case with some mobile and Web-based mail clients—the iOS Mail app and Android 4’s built-in mail client, for example, both open HTML enclosures by default. That means if you open a bugged e-mail from a mobile device, the sender will be able to get information on where you are based on whatever IP address gets associated with your phone or tablet, whether it’s via Wi-Fi or your cellular provider.

If you do get tracked and discover it, however, there are some interesting ways to disrupt the tracking. For example, you could clip the tracking tag from the email and post it as a graphic or link on a website.

But that something like Bridge can be so easily blocked, and that it takes advantage of technologies that most business users may consider to be a security threat, should be enough to discourage most legitimate users from trying to use the service. After all, it’s really just a sneaky way of doing the same thing that a Return-Receipt-To e-mail header does, without giving the recipient a choice. And very few legitimate mass-mailers generate their e-mails from Outlook or GMail.

So that makes Bridge the provenance of a very narrow strip of users, one that includes stalkers, private investigators, ex-spouses and high-pressure salespeople—and the occasional public relations consultant.

Taliban Oopsie

We have all accidentally hit the “Reply All”, but this one is a big oopsie… Or, was it??? From arstechnica.com, one of my favorite tech sites as they have lengthy, dense articles (though, lately, their articles have been skewing to the brief side). 

Taliban fails to BCC an e-mail, reveals its entire PR mailing list

Fundamentalist militant groups sometimes fail at e-mail, too.

by  – Nov 16 2012, 12:51pm EST

  • An apparent slip of the hand by a Taliban spokesperson has revealed the members of the group’s mailing list, according to a report Friday from ABC News. The 400 e-mail addresses include many journalists, but also a few members of government as well as “academics and activists.”
The Taliban regularly sends e-mail blasts with press releases highlighting its latest activities, usually from the e-mail account of spokesperson Qari Yousuf Ahmedi. But this time, the press release Ahmedi intended to send was forwarded from the account of another spokesperson, Zabihullah Mujahid. Ahmedi forwarded the e-mail on to the mailing list, but CC’d all 400 members, rather than BCC’ing them, so the full list of e-mail addresses was laid bare to all who received it.According to ABC News, the list included “a provincial governor, an Afghan legislator” and an “Afghan consultative committee.” We can only imagine the chain of reply-alls that followed, but we’re certain it’s the stuff of nightmares.

What is a Hacker?

“A hacker is someone who thinks outside the box. It’s someone who discards conventional wisdom, and does something else instead. It’s someone who looks at the edge and wonders what’s beyond. It’s someone who sees a set of rules and wonders what happens if you don’t follow them. A hacker is someone who experiments with the limitations of systems for intellectual curiosity.”

I came across this quote by Bruce Schneier on his Schneier on Security blog – “A blog covering security and security technology”. Good readings.

Book Review: HTML Dog

I read a LOT of reference books. I recently bought a Kindle so that I could keep all of them with me. As you know, physically, these books are HEAVY.

Anyway, I figure that, as I read these books, I will share my impressions.

One of the best books that I have read and recommend is Patrick Griffiths’ “HTML Dog” – subtitled “The Best Practice Guide to XHTML and CSS”. In fact, I was planning on using it in a new Pratt course that I was developing.

Unfortunately, it has not been updated since 2009. I am not sure why. The book is impressive and Patrick should continue to stay ahead of the game and re-release the book incorporating new topics.

Anyway, check it out. It is well-written and explains concepts well to the beginner coder.