Friday, 11 October 2019

Printing Clob Attachments from Oracle Database Along with Report Data

One challenge I was set by a manager at work was to enable users to be able to print from one of our in-house Apex applications and have a single button to print a record that included both rows of data from an Oracle database as well as various attachments that are linked to that record. These attachments could be PDF files, Word documents or Excel spreadsheets.

Looking online there doesn't seem to be much in the way of options for being able to use a single tool to produce a report that includes rows of data from an Oracle table along with CLOB or BLOB data in a single place.

However one idea came to mind when I was talking through options with colleagues. We already have the facility within the Apex system for a user to email themselves a copy of a specific record with any linked data. If it was possible to add the Clob attachments to this email then it would give a way to be able to print them.

Within Microsoft Outlook there is the ability to print an email and one slightly hidden option is to also print all attachments. The main print screen is below.

Printing Clob Attachments from Oracle Database
Printing Clob Attachments from Oracle Database

Click on Print Options and you see the screen below with the option to Print attached files. If you tick this option then the email body will be sent to print and each attachment will also be sent to the printer as a separate print job. 

How to print clobs in report with Oracle data
How to print clobs in report with Oracle data

You will see a message asking if you want to open the program that processes each attachment type - answer Ok and the print is generated. You don't even see the program opening, the print is just generated. The print jobs will be sent directly to the printer and be held for printing by the user or print immediately depending on your print server setup.

To generate the email from the Oracle database we're using the Apex_Mail PROCEDURE which is part of the standard Oracle UTL_SMTP toolkit that has lots of documentation online.

https://docs.oracle.com/database/121/AEAPI/apex_mail.htm#AEAPI341

You can use the APEX_MAIL package to send an email from an Oracle Application Express application. This package is built on top of the Oracle supplied UTL_SMTP package. Because of this dependence, the UTL_SMTP package must be installed and functioning to use APEX_MAIL.APEX_MAIL contains three procedures. Use APEX_MAIL.SEND to send an outbound email message from your application. Use APEX_MAIL.PUSH_QUEUE to deliver mail messages stored in APEX_MAIL_QUEUE. Use APEX_MAIL.ADD_ATTACHMENT to send an outbound email message from your application as an attachment.

So the process to print a report from Oracle that includes table data as well as PDF, XLS, DOC or other attachments stored as Clobs is below:
  • Generate email from Oracle Apex
  • Add attachments to email
  • Send email
  • Use Outlook to print email and all attachments

An improvement/variation on this would be to include the Oracle table data in a PDF as an attachment to the email rather than being in the email body. This would allow you to control the layout and format of the table data more closely and avoid the email headers being shown.

If you have any questions, comment or feedback please post below

Wednesday, 17 October 2018

OpenHabian Raspberry Pi 3 Installation Failure Error

I've been trying to install OpenHabian 1.4 on my Raspberry Pi 3 and repeatedly getting a failure error with the installation when it tries to update packages. My Raspberry Pi has been variously plugged into a wall socket charger, TV and router to power the micro USB supply which have all worked fine when the standard Raspian Operating system was used.

However it appears that OpenHabian is very susceptible to voltage fluctuations during the installation process and if there is any slight drop it can cause the process to fail giving an error in the package installer but not making any mention of the voltage being the cause. The only sign that there may be an issue was when I connected the Pi to my TV monitor to view the install and noticed the yellow power symbol flash on screen a few times.

After seeing this error I downloaded the image onto a fresh SD card and started the installation again but this time using my mobile battery charger with 2A output. The installation completed flawlessly and I now have a fully working OpenHabian install ready to use!

Monday, 19 March 2018

Question From eBay Member - Email Virus Malware

One of the latest virus/malware attacks is an email that purports to be a question from an eBay member. Crucially the email is not shown as being from eBay but is spoofed as being a different sender - the ones I've seen are from wincanton.co.uk and meterreading@britishgas. The message says:

Hello Your ad is posted twice . Which is the right price ?Is this your product? 

The link below the question appears to be eBay but if you hover over (don't click!) then you'll see that the URL isn't the same as the link text. The link is to a compromised site so that when you click your PC will be infected with malware that can steal bank details or be controlled remotely.

This was quite an effective attack as I do currently have eBay listings running at the moment but fortunately the email came in on an account that isn't linked to eBay and all eBay emails come from them not the third party who has the question.

Tuesday, 20 December 2016

Company Investigations Inquiry Notice Email Scam

Latest scam/virus email from Investigations Enforcement services mail@localmail.com which is probably a spoofed email address. If you're asking if an titled Company Investigations Inquiry Notice is real or fake then we can confirm it is a fake, scam email. As usual the advice is to just delete the email, it is a scam to get you to click on the link which will download infected software to your PC.



Company Investigations Inquiry Notice Email Scam
Company Investigations Inquiry Notice Email Scam




Email details below:






Company Investigations Inquiry Notice


We have received a complaint about your company which suggests corporate misconduct.


This may involve:


  • Causing significant harm to customers, suppliers, etc.
  • Breaking the law, e.g. double-dealing
  • Serious misbehavior, e.g. company assets have not been used properly
  • Having a notable impropriety in its affairs.


As part of this procedure we have made our own background fieldwork and if it happens to be in the public interest, we can apply to the court to wind up the company and stop it trading.


Your Inquiry Number: 33IFMP344

Also if the conduct of the director(s) who run the company is questionable enough, we can commence proceedings to disqualify them from managing a limited company for a period up to 15 years.
The investigation may give us details that we can pass to another regulatory body that has more appropriate powers to deal with any concerns the investigation uncovers.

Tuesday, 13 December 2016

Notice of Intended Prosecution (NIP) Speeding Ticket by Email Fake or Real?

If you have received a Notice of Intended Prosecution (NIP) Speeding Ticket by Email and are wondering if it is fake or real then think about these points.
 
In the UK Police do not send speeding tickets (Notice of Intended Prosecution (NIP)) by email. The notice has to be sent by post within 14 days to the registered keeper, there is no option to email.
 
  • Does the email claiming to be a Notice of Intended Prosecution (NIP) show the vehicle registration?
  • Does the email claiming to be a Notice of Intended Prosecution (NIP) show the Registered Keeper Name?
The answer to both these questions is likely to be no as the emails are sent at random and the spammers have no idea who they have been sent to.


A Notice of Intended Prosecution has to be linked to a vehicle and a Registered Keeper so these emails can be deleted as spam.


If you have clicked the link on the email then I'd recommend using a virus scanner on your PC as you are likely to have infected your machine with a virus or Trojan.
 
 
Notice of Intended Prosecution (NIP) real or fake
Fake Notice of Intended Prosecution (NIP) Email
 

Thursday, 8 December 2016

Manchester Police Speeding NIP Email Scam Virus - Notice of Intended Prosecution



The latest email virus scam/spam purports to be from Greater Manchester Police and to be a speeding ticket titled Notice of Intended Prosecution - M24181


There is a link in the email to view the photo which will be a virus that infects your machine if you click the link. Opening the email itself should not harm your machine but you should delete the email.


Remember: UK Police DO NOT send speeding tickets known as Notice of Intended Prosecution (NIP) by email. The email also has no vehicle details included despite claiming to have detailed information about the location of the alleged offence.


===============================================================




Notice of Intended Prosecution (NIP) Information
Greater Manchester Police
In accordance with Section 1 of the Road Traffic Offenders Act 1988. we hereby inform you that it is mandatory to take proceedings against the driver of motor vehicle.
Details of the Violation
·         Time & Date: at 18:56 on 30/11/2016
·         Fixed Speed Camera UIN: 1WJT2
·         Location: A560 Hyde Road, near Wyecroft Close, Stockport
·         Violation: EXCEED 25 MPH SPEED LIMIT
·         Vehicle Speed: 85
We have photographic data that the driver of motor vehicle failed to comply with a speed limit at the date, time and location.
You have been announced as driver of the vehicle at the time of the supposed offence and have a legal obligation to comply with the provisions of the notice.
Check The Photographic Proof
Whether you agree with the NIP or not you have to fill out the section 172 notice declaring who was driving the car at the time of the offence within 28 days. The NIP with the section 172 notice were sent to your mailing address





  • Time & Date: at 19:17 on 30/11/2016
  • Speeding Device ID: 6QDI5
  • Location: A664 Rochdale Road, near Queens Park (inbound), Manchester
  • Offence: EXCEED 25 MPH SPEED LIMIT
  • Vehicle Speed: 80
.

Friday, 25 November 2016

Oracle Apex Admin Password Locked - How to Unlock/Reset Apex User Account

If you get the message that your Oracle Apex account is locked because the password has been entered incorrectly then you have a number of ways to unlock and reset the account password.



Oracle Apex admin account locked
Oracle Apex admin account locked
If you know the email address that was registered to the Apex workspace then you can click the link below the Sign In button.

How to Unlock/Reset Apex User Account
How to Unlock/Reset Apex User Account
Unfortunately this option doesn't always work and might not be relevant if you know the password for the account and just need to remove the "locked" flag against the account.

If you have access to the underlying tables as SYS or other suitable Oracle user then find the appropriate Apex schema (APEX_050000 for Apex 5) and look for table WWV_FLOW_FND_USER.

Oracle apex WWV_FLOW_FND_USER reset account
Oracle apex WWV_FLOW_FND_USER reset account

If you use a tool such as TOAD or SQL Developer then you can navigate to the columns ACCOUNT_LOCKED, FAILED_ACCESS_ATTEMPTS and update the values so that the account is no longer locked and can be used for normal login.

Set the value in these columns:

ACCOUNT_LOCKED  to N
FAILED_ACCESS_ATTEMPTS to 0 (zero).


Oracle apex ACCOUNT_LOCKED, FAILED_ACCESS_ATTEMPTS
ACCOUNT_LOCKED, FAILED_ACCESS_ATTEMPTS
As long as you know the correct password for the workspace you will then be able to login as normal to the Apex admin screens.