Linux - Disk is Read Only. Windows 10 Dual Boot as a culprit

by GarciaPL on Thursday, 12 November 2020

 


JodaTime - week number of business date

by GarciaPL

If you would like to figure out week number in the month of your business date by using JodaTime in Java, please check below code snippet

Examples

  • Week number in the month for business date of 2020-10-07 is 2
  • Week number in the month for business date of 2020-10-21 is 4


LocalDate firstDayOfTheMonth = businessDate.dayOfMonth().withMinimumValue(); int weekOfMonth = Weeks.weeksBetween(firstDayOfTheMonth, businessDate.dayOfWeek().withMaximumValue().plusDays(1)).getWeeks();

IntelliJ Live Templates

by GarciaPL on Thursday, 2 July 2020

New platform with IntelliJ Live Templates has been released! You can find it here IntelliJ Live Templates


Recently I had a desire to explore a little bit of how static websites are generated using modern stack like React. I choose at the time open-source framework called Gatsby 

Gatsby has lots of advantages:
* Automatic routing based on your directory structure, so no extra code for configuring the router is needed
* Easily extensible by plugins
* Optimized for speed as only critical parts of your website are loaded
* Easy data integration with sources like CMSs, APIs, databases, file system (CSV, JSON, Markdown)

Using that technology I had created a simple project called IntelliJ Live Templates which provides listings of live templates ready to be used by developers in IntelliJ IDEA. Explanation of how live templates are used is placed on a project website under section About.

Data to fill out the website is taken from the repository placed on Github in the form of Markdown files

DataGrip of IntelliJ - Ticket around new feature for SQL

by GarciaPL on Friday, 17 April 2020

What steps will reproduce the problem?
When you create a new table with a constraint on column STATUS, it's difficult later on to amend that constraint as Oracle assigns a random name for it
CREATE TABLE MY_TABLE (
  ID                  NUMERIC(19,0)      NOT NULL,
  STATUS        NVARCHAR2(20)   NOT NULL CHECK (STATUS IN ('OPEN', 'CLOSED'));
);
What is the expected result?
Getting a warning that it's better to create column constraint using a separate statement like
ALTER TABLE MY_TABLE ADD CONSTRAINT STATUS_VALIDATION CHECK (STATUS IN ('OPEN', 'CLOSED'));

Link to a ticket - https://youtrack.jetbrains.com/issue/DBE-10549

How drop unnamed column constraint in Oracle

by GarciaPL on Thursday, 16 April 2020

If constraint on column STATUS was created without a name during creating a table, Oracle will assign a random name for it. Unfortunately, we cannot modify the constraint directly.

Steps involved of dropping unnamed constraint linked to column STATUS

  1. Duplicate STATUS field into a new field STATUS2
  2. Define CHECK constraints on STATUS2
  3. Migrate data from STATUS into STATUS2
  4. Drop STATUS column
  5. Rename STATUS2 to STATUS


ALTER TABLE MY_TABLE ADD STATUS2 NVARCHAR2(10) DEFAULT 'OPEN';
ALTER TABLE MY_TABLE ADD CONSTRAINT MY_TABLE_CHECK_STATUS CHECK (STATUS2 IN ('OPEN', 'CLOSED'));
UPDATE MY_TABLE SET STATUS2 = STATUS;
ALTER TABLE MY_TABLE DROP COLUMN STATUS;
ALTER TABLE MY_TABLE RENAME COLUMN STATUS2 TO STATUS;

The system cannot find the path specified - Anaconda

by GarciaPL on Thursday, 5 March 2020

I have installed Anaconda recently on my Windows 10 at work. I have been playing with it for a while, but then I have decided to uninstall it. Without restarting my computer, after a few days, I have decided to install Anaconda once again as I have found that I need it at the end.

I was astonished that after starting Power Shell or Cmder which emulates terminal as well, I was started getting an error listed below. It was very annoying as somehow some features like Scoop [1] and even Maven stopped working!


The system cannot find the path specified


Unfortunately, Windows 10 was not able to tell me which path he struggles with at this point. I started digging in the web to find out that the main reason for whole fuss was Anaconda which supposes to be deleted completely after the restart of PC which did not happen obviously.


Solution

Go to HKCU\Software\Microsoft\Command Processor\AutoRun 

using Register Editor and clear found value. I presume that whatever you are going to find might be related to Anaconda as it was so in my case.



[1] Scoop - https://scoop.sh