Home > Articles

The Long and Winding Method

The Kaptain's previous article opened a window to the MyInformIT Recommends page with custom items specified for the individual user. Now he invites us to step through the window to see the inner workings of this technology.
Like this article? We recommend

What a fantastical world we live in. Despite my bemoaned lack of a Jetson's-style flying car, I do have a lot of other neat stuff. None of it flies, unless I throw it, but these pieces of technology do have a certain charm. As I write these words, I'm seated comfortably in my recliner. A lap desk spans the arms of the chair, positioning my laptop computer at just the correct ergonomic typing height. As the spooky music from an X-Files rerun plays on the TV, an 11 Mbps wireless card contacts my home LAN and checks my email. If I had preferred, I could have chosen to listen to MP3s, the music piped into the living room from my office via 900 MHz wireless speakers. Everything I need to do can be accomplished in ridiculous repose with my behind cradled in burgundy leather.

The multifunction remote for the TV, DVD, digital cable, and stereo lies close at hand to my right. A spread-spectrum digital phone and my cell phone share space with the remote on the end table. Both phones have Caller ID displays so that I can ignore telemarketers. On my left, another table holds the all-important tall, cold one. Perched on the headrest of the recliner, my cat, Kali, stretches languorously, satisfied with a life of idle luxury.

By comparison, the work environment is a sweatshop. From every corner, the curses of frustrated developers rain down into my cube. At least that invective drowns out the soul-stealing hum of the fluorescent lighting and the incessant clicking of keyboards. My chair isn't too bad. I pilfered it from the office of one of InformIT's departed, but it isn't exactly a Barcalounger. And it's a far stretch from making up for the fact that I have to stare at a wall for eight hours a day. The windows are on the other side of the building. I won't even bring up the monolithic air duct that runs through the middle of my cube—Shafthenge, as I call it.

All right, none of this is exactly the fare you would find in Dante's Inferno, but as Einstein pointed out, everything is relative. I'm thinking of faking an injury, perhaps to a vertebra or metatarsal. I'd concoct a head injury, but they all think I have one already. I'd claim anything that could keep me at home to type away in peace from the comfort of my high-tech sanctum sanctorum.

A Little Java Is Recommended

Alas, that's enough wistful longing. There is some heavy digging to be done, and it's best that we get started. I promised some high-octane Java, and that's what I plan to deliver. We were going to find out the mysteries of the InformIT Recommends section of the MyInformIT page, as seen in the now-familiar Figure 1.

Figure 1 MyInformIT one more time.

We start our journey, as mentioned in the last installment, at the Java function informit.RecommendedBooks.getBucketResults(). Here again is what getBucketResults() looks like:

1  public void getBucketResults()
2  {
3   Recordset RS  = null;
4   Recordset Count = null;
5
6   this.verifyClauses();
7
8   if ( user_interests_exist ||
9      user_certifications_exist ||
10     user_job_titles_exist )
11    {
12      //
13      // we know the user and they have a profile
14      //
15
16      if ( user_interests_exist &&
17        user_certifications_exist &&
18        user_job_titles_exist )
19      {
20       setBucketResults( 1 );
21      }
22      else
23      {
24       if ( user_interests_exist ^
25          user_certifications_exist ^
26          user_job_titles_exist )
27       {
28         setBucketResults( 1 );
29       }
30       else
31       {
32         setBucketResults( 0 );
33       }
34      }
35    }
36
37   }

Did you ponder it, as I asked? No matter, you get to go on the ride anyway. Line 6 calls this.verifyClauses(), and we begin there. The class informit.RecommendedBooks is actually a subclass of informit.InformITRecommends. That class is a subclass of ProductBucket, which is a subclass of GenericBucket. GenericBucket is a subclass of java.lang.Object. As Beavis and Butt-head might say, "There is none higher." So we have a chain of inherited classes that can all share methods. The method this.verifyClauses() actually resides all the way up the chain in GenericBucket. Let's open the drapes and see what verifyClauses is up to.

1  protected void verifyClauses()
2  {
3   if ( getRelatedProductFromClause() != null )
4   {
5     if ( getRelatedProductFromClause().equals("") )
6     {
7      setRelatedProductFromClause(null);
8     }
9   }
10   else
11   {
12    setRelatedProductFromClause(null);
13   }

The first thing we want to do is check for a field from the database. You might remember from the last article that I discussed product_from_clause, a field in the users table. When you update your profile customization page, the product_from_clause field is appended to store the names of the auxiliary tables that were touched. If you added a job description and a certification description in your profile, the product_from_clause would store "user_job_titles,user_certifications" in the row keyed to your unique user_id. Lines 3–13 above check for the existence of data in that field. If the field is null or set to an empty string, a public variable called related_product_from_clause is set to null by calling the method setRelatedProductFromClause(null).

14   if ( getUserID() != null )
15   {
16    if ( getUserID().equals("") )
17    {
18      this.setUserID( null );
19      user_profile_tables = null;
20    }
21   }
22   else
23   {
24    user_profile_tables = null;
25   }
26   //

Next, we check to see if your user_id was set in the ASP that called this method. Remember that we retrieve your user_id from the session_id found on the query string. Every session_id corresponds to a unique user_id in the database, and from that we can determine for whom to fetch MyInformIT data. If the user_id is null or empty, we set it to null, along with another variable, user_profile_tables.

27   if (getRelatedProductFromClause() != null)
28   {
29    state_info_exists = true;
30   }
31   else
32   {
33    state_info_exists = false;
34   }

We set a flag, state_info_exists, to true if data was found in your product_from_clause. It's set to false if that database field was empty.

35   if ( user_profile_tables == null )
36   {
37    user_interests_exist = false;
38    user_certifications_exist = false;
39    user_job_titles_exist = false;
40   }

We perform the same check in lines 35–40 above. If the variable user_profile_tables is not null, however, we can pull from it the tables for which you have associated data. user_profile_tables is set to hold the same comma-separated list as the product_from_clause variable, if that data exists.

41   else
42   {
43    user_profile_tables = user_profile_tables.trim();
44
45    StringTokenizer st =
46      new StringTokenizer( user_profile_tables,
47                ",",
48                false );
49    String current_token;
50
51    while (st.hasMoreTokens())
52    {
53      current_token = st.nextToken();
54
55      if ( current_token != null )
56      {
57       if ( current_token.equalsIgnoreCase
58          ( "user_interests" ) )
59       {
60         user_interests_exist = true;
61       }
62
63       if ( current_token.equalsIgnoreCase
64          ( "user_certifications" ) )
65       {
66         user_certifications_exist = true;
67       }
68
69       if ( current_token.equalsIgnoreCase
70          ( "user_job_titles" ) )
71       {
72         user_job_titles_exist = true;
73       }
74
75
76      }
77
78      current_token = null;

We use the Java StringTokenizer function on lines 45 and 46 to split the user_profile_tables string into its component parts, breaking on the commas. We then loop through the tokens to match our possible tables: user_interests, user_certifications, and user_job_titles. A flag is set to true for each possibility if a correlation is discovered. This particular programmer sets his temporary placeholder variable, current_token, to null when the loop is complete. Isn't he a tidy sort?

79    }
80
81    st = null;
82
83
84   }

He cleans up the StringTokenizer variable, too. Boy, he is fastidious! With our flags set for each auxiliary table where data exists, we exit verifyClauses() and return to getBucketResults().

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020