Clean up MySql database

There are things you can think about when deleting data from a large table. In my case the table contains 40 million records.

Symptoms 1: it took long time to execute a delete statement.
Solution: delete smaller chunks of data

Use the following command to find out what are being executed in database

mysql> show processlist;

To see which tables are locked (in used)

mysql> show open tables where in_use > 0;

To kill a process ex. a query that takes long time to execute

mysql> show processlist; 
mysql> kill <pid>;

 

Advertisements

Users have a problem to view their invoices in web browsers / Android phones

Symptoms

The PDF invoice is saved as invoice.ashx. Then, Android mobile users have a problem to open it in the mobile phone.

Other info

An Android developer at a bank informed that it is normal that users cannot view a PDF file in web browsers in a mobile phone. Usually they download the file and use a PDF reader/viewer app to open it.

Solutions

Use a Content-Deposition HTTP response header to suggest the browser to download the file with a suggested filename.

Content-Disposition: attachment; filename=”invoice.pdf”

Tests

What to test

  1. PDF invoices can be viewed
  2. The invoice can be saved and reopened

On station computers

  1. Chrome
  2. Edge
  3. Internet Explorer
  4. Safari
  5. Firefox

On Android phones

  1. Chrome
  2. Opera
  3. Firefox
  4. Firefox Focus
  5. Dolphin
  6. Edge

On iOS phones

  1. Chrome
  2. Safari
  3. Opera
  4. Dolphin
  5. Firefox Focus

Notes

Check my solution with this one. To extend Spring’s AbstractView http://www.codejava.net/frameworks/spring/spring-web-mvc-with-pdf-view-example-using-itext-5x

As a Lead Architect

My journey with the current company as a lead architect is going to start on Wednesday.

I plan to write about this journey to share my experience and challenges I face on the way from the start to the finish line.

When I accepted the job, I didn’t have all answers how to achieve the goals of this role. I only know that this is what I want to work with.

I know it is going to be tough, the road to the finish line is going to be rough. But, I know the moment when I pass the line, it’s going to feel great, absolutely fantastic.

I long for that moment and feelings.

This journey is also a therapy to my sickness. I don’t think I like it this way but I always choose a difficult way that I have to work on it and put an effort.

It’s a way for me to find a way back to love myself.

This return I have a slogan, “make it happen” to keep me focus on the goals and be motivated.

I expect that I feel tired, I work a lot, it’s difficult, people don’t agree with me, they talk about my work, my work is not perfect and many more.

Despite resistance, I’m going to learn to accept and handle it. I will continue practicing and improving until I’m comfortable with difficulty.

Now, it’s time for me to grow, to take the next step, to a higher position. Leadership, technical lead and communicator.

Selecting a new, compact digital camera

It has been several days that I spend time on reading reviews, comparing different camera models and still cannot make a decision which one to buy.

Making a decision has always been difficult for me. This is one area that I want to improve. I often start a project without completing it. And, when it happens many times, I feel down. It’s like sitting, thinking but no action has been taken. I need an action that yield a tangible, useable result.

So this time, I write down criteria to make them visualized from the most to least important. The camera that meets most criteria is the one I’m going to buy.

  • I’m not changing a camera system = I’m not investing in buying an expensive body and objectives
  • Must be compact (don’t feel intrusive when using it), light weight = I can carry it around easily (less than 500g with lens and battery packs)
  • A tilt screen for wefie
  • Effective pixels at least 16 MP
  • High photo quality: autofocus, continuous autofocus (servo)
  • Good photo quality in a low light condition (without flash): high ISO, wide-aperture
  • Support HD video 1080 x 30 fps
  • OK photo quality at night scene (with flash)
  • Good bokeh effect
  • Good macro photos
  • Support Wifi
  • Nice to have: Silent shooting mode

This is a list of the candidates

  • Fujifilm X-A10 (5489 sek) – test this model in the shop
  • Fujifilm X100F (13898 sek) – over budget
  • Fujifilm X100T (10878 sek) – over budget
  • Sony RX100 (3490 sek) – too old model
  • Sony RX100 IV (8141 sek) – too expensive
  • Sony RX100 V (9990 sek) – too expensive 
  • Panasonic Lumix DMC LX-100 (5680 sek): too low resolution
  • Panasonic Lumix DMC LX-15 (6455 sek) – test this model in the shop
  • Panasonic Lumix DC GF9K (not available in Sweden)

Batman Returns

The title has nothing to do with this post. I just need to give it a title and a clue that I’m returning to write this blog again.

I have a flashback memory that I set up a goal for writing and keeping myself going with this blog. When I reached the goal, it was like I had arrived my destination. I guess that was (part of) a reason I discontinued with this blog.

When I scrolled through old posts, I missed what I did in the past. This includes photography. Before my daughter was born, I thought I was going to shoot lots of baby photos. Fact was I did it occasionally far from documenting her 1st year with my professional camera.

Now, I have a second chance, the second child dues on 17 June. I’m looking for a new digital camera that is more practical to carry around. I also try to build new motivation to get back on photography as a hobby, finding something else to do outside office hours.

So writing this blog is one, doing photography is another one and combine them as I used to do.

I also plan to write about what is going on in my day, books I read, topics I am interesting in. Just to summarize my thought and hopefully improve my thinking process and communication skill by writing.

Okay, it’s enough about my return. Now, start writing real stuff.

Welcome back!

 

A Golden Year

I’m going to be a mother. With excellent welfare programs in Sweden, I am staying home the whole year. Until the baby is born I am home to collect energy for giving birth, prepare myself mentally on laboring (a birth plan has been written), read what I think it’s necessary when the baby comes home, fix the apartment as much as I can. I, also, have time left to think about my future plan and hope I will find time to execute it. I try to teach myself to draw and hope I can draw my baby. Photography is what I planned long time ago (it will be lots of baby photography) but drawing (sketching) is something really special that I wish I could.

I’m excited to meet the baby, myself and how our life will change. How will I develop as a mother? Will I be able to give unconditional love? Will I be able to raise my child as he/she want to be and not as how I want him/her to be? How will I balance time for the baby and career? Will I be able to find all answers to my questions in time?

It’s all so exciting!

Fjällbacka, a fishing village

Fjällbacka has a very long history, started from Stone Age. It was a place where Ingrid Bergman lived when she visited Sweden and was featured in the film “Ronja the Robber’s Daughter” of Astrid Lindgren.

But I was not aware of its existence until I watched a detective TV series, Fjällbackamorden (Fjällbacka Murders), of Camilla Läckberg. It was the series and filming techniques that attracted me to this small and charming village on the west coast of Sweden.

This and other villages around here have given me a new picture of Sweden. This is not similar to anything I have seen in big cities such as Stockholm, Gothenburg and Malmö, in towns in the mountains or small islands i Stockholm’s archipelago.

Here you will find characteristic houses and harbors along the coast lines and more summer houses up on the hills. There is a hill that situates in the middle of the village where you can easily climb up to get a breathtaking view over the village and archipelago.

About photography. In the beginning it was supposed to be photos of orange and Falun red/maroon houses contrasting with blue skies. However, everyone of us knows that we cannot control the weather so I used an inspiration from the series to shoot my photos instead.

Now, let me present you Fjällbacka through my lens! The photos are on order how I discovered them.

Stora Hotellet, Fjällbacka

Stora Hotellet

Fjällbacka coastlines

Fjällbacka houses and harbors

The harbor

Boats and the harbor

Kungsklyftan

A view from Kungsklyftan

A view of archipelago

A view of archipelago

A view of archipelago from Kungsklyftan

A view of archipelago from Kungsklyftan

Harbors and coastlines

Harbors and coastlines

Kungsklyftan, a cleft that has huge stone blocks wedged in like a roof

Kungsklyftan, a cleft that has huge stone blocks wedged in like a roof

Stora (Big) and Lilla (Little) Vetteberget

Stora (Big) and Lilla (Little) Vetteberget

A fantastic view from the top of Vetteberget. There is something in this picture that makes me fall in love with it. Perhaps powerful coastal wind.

A fantastic view from the top of Vetteberget. There is something in this picture that makes me fall in love with. Perhaps powerful coastal wind.

On the top of Vetteberget

Miniature of lakes and forests on the top of Vetteberget

A coastline next to the sailing school

A coastline next to the sailing school

At the sailing school

At the sailing school

This to remind me the location where I stood and enjoyed breathtaking views. Did you see the stairs?

This to remind me the location where I stood and enjoyed breathtaking views. Can you find the stairs?

I thought I was lost to discover the place :)

It costed me to get lost to discover the place 🙂

Leading line

A leading line

Can't have enough of the scenes :D

Can’t have enough of the scenes 😀

I have to thank those guys for standing on the pier :D

I have to thank the guys for standing on the pier 😀

It's midsummer, so we can't miss a majstång (maypole) at Ingrid Bergman Square

It’s midsummer, so we can’t miss a majstång (maypole) at Ingrid Bergman Square