MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for February, 2012

Fedora URL Changes

without comments

Somebody posted on a Gnome patching blog post for Fedora to let me know that the download URL was invalid. I poked around and it appears that the old Fedora URL at Red Hat’s site doesn’t work:

http://download.fedora.redhat.com/pub/fedora/linux

You now have to go the Fedora Project web site for the code archive, and it’s here:

http://archive.fedoraproject.org/pub/fedora/linux/

If somebody knows why they made the change without any fanfare, please post a note.

Written by maclochlainn

February 20th, 2012 at 12:18 pm

Posted in Fedora,Linux

My iPhone is back …

with one comment

Life’s interesting, and thankfully AT&T is no longer the sole provider of the iPhone. On December 21st, 2010, I replaced my iPhone 3G with a LG Optimus S using Sprint. It was adequate, and far cheaper than what AT&T was charging me. It also had 3G service because AT&T didn’t provide coverage in Rexburg, Idaho.

The iPhone is now on Sprint, and I switched to the iPhone 4S. When I went and got it, I thought it strange that there wasn’t an order option for AppleCare+. No one mentioned that AppleCare+ was now the ticket, and that it’s the responsibility of the vendors to advise you at the time of purchase. They didn’t advise me! Is it possible that they don’t want to advise you because AppleCare+ provides for two repairs for accidental damage at $49 per service opportunity and covers any part that might fail earlier through normal use. Who wouldn’t opt to protect the iPhone from both a faulty part or grip for $99 over 2 years?

A rumor or rumbling that may have its origin in Apple Support is that AT&T, Sprint, and Verizon aren’t telling customers at the time of sale. Customers must then take their iPhone to an Apple Store, not an authorized reseller, have their phone inspected before they can get AppleCare+ after sale. That is if you do it within 30 days of the purchase with proof of purchase and a Genius Bar appointment.

Alert to potential buyers, demand AppleCare+ before you get your iPhone! Let your friends know because this may be more than a baseless rumor. That is, unless you like inordinate risks. Those in that category should watch this unfortunate Assuie bungee jumper go swimming with the crocodiles. At least the crocodiles didn’t get her below Victoria Falls in Zimbabwe, which is a miracle in itself.

The downside was that I’d have to go to Salt Lake City for the coverage, the upside is I have an iPhone again. The upside outweighs the downside, but like Shylock in the Merchant of Venice I’d like to get my metaphoric pound of corporate flesh. When I posed the question to the Sprint kiosk, “Is it possible that the vendors have some financial interest in folks not purchasing AppleCare+?” ;-) That question asked; and, miraculously, Sprint said it was their error and they’d fix it – add AppleCare+. Apple support emailed me to confirm that AppleCare+ is now enforce on my new iPhone. That proves the squeaky wheel does get oiled.

I strongly recommend you don’t waste your money on anything less than an Otterbox Defender Series Hybrid Case & Holster for iPhone 4 & 4S.The video below explains why.

The only problem I’ve found is the hip case because it’s hard plastic and breaks. Fortunately, you can buy just the OtterBox iPhone 4S Defender Case Replacement Belt Clip Holster through Amazon.com for less than $8 at the time of updating this blog post.

Written by maclochlainn

February 16th, 2012 at 10:29 pm

How to use object types?

with 3 comments

A tale of Oracle SQL object types, their constructors, and how you use them. This demonstrates what you can and can’t do and gives brief explanations about why.

The following creates a base SAMPLE_OBJECT data type and a sample_table
collection of the base SAMPLE_OBJECT data type.

CREATE OR REPLACE TYPE sample_object IS OBJECT
(id       NUMBER
,name     VARCHAR2(30));
/
 
CREATE OR REPLACE TYPE sample_table IS TABLE OF sample_object;
/

If the base SAMPLE_OBJECT data type were a Java object, the default constructor of an empty call parameter list would allow you to construct an instance variable. This doesn’t work for an Oracle object type because the default constructor is a formal parameter list of the object attributes in the positional order of their appearance in the declaration statement.

The test case on this concept is:

1
2
3
4
5
6
DECLARE
  lv_object_struct SAMPLE_OBJECT := sample_object();
BEGIN
  NULL;
END;
/

Running the program raises the following exception, which points to the object instance constructor from line 2 above:

  lv_object_struct SAMPLE_OBJECT := sample_object();
                                    *
ERROR at line 2:
ORA-06550: line 2, column 37:
PLS-00306: wrong number or types of arguments in call to 'SAMPLE_OBJECT'
ORA-06550: line 2, column 20:
PL/SQL: Item ignored

Changing the instantiation call to the Oracle design default, two null values let you create
an instance of the SAMPLE_OBJECT type. The following shows that concept, which works when the base object type allows null values.

1
2
3
4
5
6
DECLARE
  lv_object_struct SAMPLE_OBJECT := sample_object(NULL, NULL);
BEGIN
  NULL;
END;
/

If you want to have a null parameter constructor for an object type, you must implement a type and type body with an overloaded no argument constructor, like this:

1
2
3
4
5
CREATE OR REPLACE TYPE sample_object IS OBJECT
( id       NUMBER
, name     VARCHAR2(30)
, CONSTRUCTOR FUNCTION sample_object RETURN SELF AS RESULT);
/
1
2
3
4
5
6
7
8
9
CREATE OR REPLACE TYPE BODY sample_object IS
  CONSTRUCTOR FUNCTION sample_object RETURN SELF AS RESULT IS
    sample_obj SAMPLE_OBJECT := sample_object(NULL,NULL);
  BEGIN
    SELF := sample_obj;
    RETURN;
  END sample_object;
END;
/

Unlike Java, the addition of an overloaded constructor doesn’t drop the default constructor. You can also create a single parameter constructor that leverages the sequence like this:

1
2
3
4
5
6
CREATE OR REPLACE TYPE sample_object IS OBJECT
( id       NUMBER
, name     VARCHAR2(30)
, CONSTRUCTOR FUNCTION sample_object RETURN SELF AS RESULT
, CONSTRUCTOR FUNCTION sample_object (pv_name VARCHAR2) RETURN SELF AS RESULT);
/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE OR REPLACE TYPE BODY sample_object IS
  CONSTRUCTOR FUNCTION sample_object RETURN SELF AS RESULT IS
    sample_obj SAMPLE_OBJECT := sample_object(sample_object_id.NEXTVAL,NULL);
  BEGIN
    SELF := sample_obj;
  END sample_object;
  CONSTRUCTOR FUNCTION sample_object (pv_name VARCHAR2) RETURN SELF AS RESULT IS
    sample_obj SAMPLE_OBJECT := sample_object(sample_object_id.NEXTVAL,pv_name);
  BEGIN
    SELF := sample_obj;
    RETURN;
  END sample_object;
END;
/

You can test the final object type and body with this anonymous block of code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
SET SERVEROUTPUT ON SIZE UNLIMITED
 
DECLARE
  lv_object_struct1 SAMPLE_OBJECT := sample_object();
  lv_object_struct2 SAMPLE_OBJECT := sample_object('User Name');
  lv_object_struct3 SAMPLE_OBJECT := sample_object(1001,'User Name');
BEGIN
  dbms_output.put_line('lv_object_struct1.id   ['||lv_object_struct1.id||']');
  dbms_output.put_line('lv_object_struct1.name ['||lv_object_struct1.name||']');
  dbms_output.put_line('lv_object_struct2.id   ['||lv_object_struct2.id||']');
  dbms_output.put_line('lv_object_struct2.name ['||lv_object_struct2.name||']');
  lv_object_struct2.name := 'Changed Name';
  dbms_output.put_line('lv_object_struct2.id   ['||lv_object_struct2.id||']');
  dbms_output.put_line('lv_object_struct2.name ['||lv_object_struct2.name||']');
  dbms_output.put_line('lv_object_struct3.id   ['||lv_object_struct3.id||']');
  dbms_output.put_line('lv_object_struct3.name ['||lv_object_struct3.name||']');
END;
/

It prints to console:

lv_object_struct1.id   [1]
lv_object_struct1.name []
lv_object_struct2.id   [2]
lv_object_struct2.name [User Name]
lv_object_struct2.id   [2]
lv_object_struct2.name [Changed Name]
lv_object_struct3.id   [1001]
lv_object_struct3.name [User Name]

Hope this helps those looking for a quick syntax example and explanation.

Written by maclochlainn

February 14th, 2012 at 8:14 pm