Tuesday, July 26, 2022

convert pictures from iix to png

 I did not find a solution to convert iix files to another.

ServiceNow attachments can be downloaded, for me only in iix fomrat.

But I found a solution to get the original files, which in my case usually PNG.

Click on the top on the attachments icon.


Then you will get an popup, where you can download the pictures step-by-step clicking on the blue names.



Tuesday, January 18, 2022

Reminder in slack

 I need to note done this solution.

I need to use it only a few times, but it is easy to forget.

/remind #general "It's café time!" every weekday at 3pm

Friday, December 21, 2018

load property file via JNDI to Spring context

There are many ways to load properties via JNDI with little limitations.
the JDNI conteins only the placeholder for the file.

<Environment name="config/dgc509-bio" value="PATH_TO_CONFIG_FILE/dgc509-bio.properties" type="java.lang.String" />

1 ) You can load via application context xml file:
<util:properties id="appConfig" location="file:${config/dgc509-bio}"/>
<context:property-placeholder properties-ref="appConfig"/>

But this properties you will see only in this context + @Value()

2) You can load into PropertySourcesPlaceholderConfigurer

@Beanpublic static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(ConfigurableEnvironment env) throws IOException, NamingException {
   final String path = (String) new JndiLocatorDelegate().lookup("java:comp/env/config/dgc509-bio");
   PropertySourcesPlaceholderConfigurer placeholderConfigurer = new PropertySourcesPlaceholderConfigurer();
   Properties prop = new Properties();
   prop.load(new FileInputStream(new File(path)));
   env.getPropertySources().addFirst(new PropertiesPropertySource("reloaded", prop));
   return placeholderConfigurer;
}

Monday, September 25, 2017

Mock super methods

I found a solution with PowerMock.
Unfortunately the design is not the best, the clients call one method of the abstract super class.
But we dont want to test the method of the super class one hundred times.

@RunWith(PowerMockRunner.class)
@PrepareForTest({Super.class})
public class ClientTest{

private Client client= new Client(createMock(RestClientBuilderProvider.class));

private static void mockGetResponse(final Response.Status status) {
   PowerMock.replace(PowerMock.method(Super.class, "getResponse", 
   String.class, String.class, Class.class, Map.class,
   Map.class)).with(new InvocationHandler() {
      @Override      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
         HTTPResponseWrapper response = new HTTPResponseWrapper();
         response.setStatusCode(status.getStatusCode());
         return response;
      }
   });
}

@Testpublic void testGetReferenceById() throws Exception {
   //given   mockGetResponse(NO_CONTENT);
   //when   HTTPResponseWrapper result = client.getPersonByReferenceId(ORG, REFERENCE_ID_VALUE);
   //then   assertEquals(NO_CONTENT.getStatusCode(), result.getStatusCode().intValue());
}

Thursday, August 24, 2017

monitor your oracle db session

There many popular reports or select statements to rech and understand what happen in the db. I usually use the built in function of PL/SQL developer application.

I collected what kind of privileges you have to ask to use it. because very often you dont have DBA rights. Just ask SELECT for these:

Main window: v_$session
Cursors tab: v_$open_cursor
SQL Text tab: v_$sqltext_with_newlines
Statistics tab: v_$sesstat, 
                      v_$statname
Locks tab: v_$lock

good to have also:
v$sql
v$transaction
v$mystat
v$sgainfo

Wednesday, August 23, 2017

Deadlock during an update

You thought before if you insert or update a row in a table, you do it parallel on different records.

My scenario is now to run a data transfer in PL/SQL and  keep running the Java - hibernate application. It is a paralel running, the data transfer is running on old records, and the application users create new content in the database, and modify only them.

In many cases we receive an exception on both part:
"SQLException: ORA-00060: deadlock detected while waiting for resource".

In fact the Oracle RDBMS use a lock in table level also for update and insert statements. You can read about here.

You can find these table lock modes in the session also, there are some exclusive and sharing modes.

The table indexes are coming to this topic, maybe for first it is strange.
"Indexing the foreign keys in child tables provides the following benefits:
  • Prevents a full table lock on the child table. Instead, the database acquires a row lock on the index.
"

If you have no index on foreign columns, the db will use full table lock instead of row lock.

"Oracle Database maximizes the concurrency control of parent keys in relation to dependent foreign keys. In heap-organized tables, locking behavior depends on the indexing of foreign key columns. If foreign keys are not indexed, then the child table will probably be locked more frequently, deadlocks will occur, and concurrency will be decreased. For this reason, Oracle recommends indexing foreign keys in most cases except when the matching unique or primary key is never updated or deleted."

Description of Figure 9-3 follows

Monday, July 10, 2017

being updated in IT

I faced with the relevant question on a job interview last week:

how do you keep yourself updated?



It is a really good question, I already liked this interview because of their technologies and methodologies.

I could not fulfill this question totally, but I promised myself to create a list here:

  • Social media posts:
    • Linkedin
    • Twitter
    • Facebook
  • Newsletters:
    • Java Magazin
    • Lerner.co.in
    • O'reilly newsletters
  • Online courses:
    • Coursera
    • Udemy
    • FutureLearn
    • Udacity
    • BigDataUniversity from IBM
    • DataCamp
    • Edx
  • Blogs:
    • Uncle Bob / Robert C. Martin
    • Mykong
  • IT news/ community sites:
    • Wired
    • MIT Technology review
    • Agile Connection
    • Open group
    • TechWell
  • Online tests
    • HackerRank
    • Codility
  • Books from amazon
  • Meetups

Feel free send me any suggestion!