Friday, February 21, 2014

Using Origin on Wine is BAD NEWS... maybe not?

It seems that most of the issues with this are due to the fiber optic line that broke causing internet issues and DLC authorization errors.  Make sure that all Origin executables on Windows is in your antivirus/firewall exception list.

I'll keep this brief. Over the past days, I had issues with Origin when playing Mass Effect 3 online where connectivity is just shot. I would get errors where Origin would complain not having internet connection.  Mass Effect 3 wouldn't go online either which caused DLC authorization errors.

As it turns out, I started logging into Origin using my Wine install and I noticed doing this would create connection issues on Origin. Once it all got sorted on Windows, using it was fine. So, I deleted Origin on my Wine install. Never again.




Sunday, February 9, 2014

Better Oracle Exception Handling

While working with Oracle, I've learned more and more on better ways of handling exceptions.  There are some major specifics that need to be taken note of.  raise_application_error only works with custom error numbers.  You cannot use it to make Oracle throw just any exception.  Normally, you would use a predefined name like this: 

begin
      some select statement...
exception when no_data_found then
      --handle exception
end;

Sometimes, the Oracle error you want to handle is just not predefined.  So, you'd need a better way of handling errors and throwing some meaningful error messages back.

var b_err_code number;
begin
      some select statement...
exception when others then
      :b_err_code = SQLCODE;
      if :b_err_code = '-00904' then
          --handle exception
      else
          raise_application_error(-20000, 'Some Customized Error Message: ' || :b_err_code || ' Actual SQL Error: ' || SQLERRM);
      end if;
end;

Some points of interest here.  Using when others then allows you to handle all other cases.  Over here, we store the SQL error number to the bind variable b_err_code.  In Oracle, SQLCODE returns exactly that and in our example, we are expecting to handle ORA-00904 via the if condition.  We also have an else part where we generate our own application error.  We also use SQLERRM to return a human readable version of the SQL error message received, that would otherwise had gotten lost in the call stack.  Hope this little bit helps other Oracle and SQL developers.

May Lee Shepard

Reposted here.

Having left the wikia community.  The profile is gone.  I may re-post it here some day.

I had fun doing this in the Mass Effect wikia.  Hope you enjoy this profile.