Tuesday, April 4, 2017

Opencart Product Options are not showing in Firefox

Issue in Opencart

Dropdown (select) with Options for products is not available. Writing in the search box does not show any options. Maybe other functionality in administrative is affected.

Sunday, March 5, 2017

Solved: MediaWiki sets all date to Thu, 01 Jan 1970 00:00:00 GMT

All dates (datetimes, timestamps) in your revisions in MediaWiki are shown as:
  • Thu, 01 Jan 1970 00:00:00 GMT
  • 00:33, 1 January 1970 
  • 31 December 1969
  • or something similar (depends on locale you use)
The issue is that a column in database is defined with shorter limit and date is truncated extremely. Updating your mediawiki will not solve the issue.

Solution: In your SQL db for your wiki look for the table called yourdbprefix_revision in that table find the column rev_timestamp and check its datatype, if it's set to anything less then VarChar(14) change it (to "VarChar(14)") and save the changes. Now when you edit a page the revision will show the correct date.

Special thanks to krikit.

Tuesday, February 21, 2017

No results in set for executeQuery() in Oracle

Issue:
executeQuery() returns no rows. Oracle SQL developer shows the rows persist into database.

Cause / error / solution:

Monday, November 7, 2016

Class.getDeclaredMethod with primitive types (basic types)

Lets have to get method object of this function:
    private void setI(int i) {
        this.i = i;
    }

Sending Integer.class in argument list cause throwing an exception: java.lang.NoSuchMethodException:

The correct way is this:
    Method iMethod = progClass.getDeclaredMethod(
        "setI", new Class[]{ Integer.TYPE } );

Same pattern could be applied for byte, short, long, float, double, boolean, char.

Thursday, July 28, 2016

Intel RAID: Create mirror RAID from existing disk

What you want

If you have Intel RAID, drive wish information and drive which have to become its mirror, this page is for you.

Drive 1: your information is here;
Drive 2: you want to use this for mirror.

Intel BIOS Options

Intel BIOS do not give you opportunity to use Drive 1 as source for the RAID. In the BIOS you could create RAID, but it will destroy all data on both drives. The options are:
1.Select Recovery Volume Option
2.Enable Only Recovery Disk – enables recovery disk if available and disables master
disk.
3. Enable Only Master Disk – enables master disk if available and disables recovery disk

The solution

You cannot do this in BIOS. You have to boot into Windows from Disk 1, install progam Intel xxx, which has the feature which you want. The syncing is 2 or 3 times slower than expected.

The result is that you will see in BIOS that both drives are in RAID.

Why generics of type are used?

Definitions

Lets have these classes:

public class SuperClass {
   // some methods
}

public class SubClass extends SuperClass{
   // some methods
}

So we are allowed to do this conversion:

SuperClass x = new SupClass();

Limitation

But, we are not allowed to make such conversion:

List <SubClass> listSubs = ...
List <SuperClass> listSupers = listSubs; // compile time error happens

Such a stupid language limitation! In this case, there is no clean solution. The bad solutions produce new List and reinserts all elements into it.

Solution

But we could use "? extends Generics" structure in this way:

List <SubClass> listSubs = ...
List <? extends SuperClass> listSupers = listSubs; // NO errors

Note: It is normal that ? extends Class structure allows only supclasses of the generics to be used. I was glad to understand that you could use the generics type itself there. So it is also possible:

List <? extends SuperClass> listSupers = new LinkedList(); // NO errors

Error: "class or interface without bounds" solved

Example:
    public List<? extends SuperClass> getObjects() {
        List<? extends SuperClass> result = new ArrayList<? extends SuperClass>(1); // error: "class or interface without bounds"
        result.add( theNeededObject ); // error: "not suitable method found for ..."
        return result;
    }

Fixed error:
    public List<? extends SuperClass> getObjects() {
        List<SuperClass> result = new ArrayList<>(1);
        result.add( theNeededObject );
        return result; // it is automatically converted from <SuperClass> to "<? extends SuperClass>"
    }