MySQL Joins explained in one simple image

I was looking for picture like this for quite a long time. Thank you Olek for sending me one yesterday.
1UKp7

16 years since my Dady passed away

Time is going so fast. Today it’s been 16 years since my Dad passed away. If I look back on these years I am without him, I can’t believe it’s been so long. I hope that he’s o.k. there where he is right now. I am 32 right now so it means half of my life I spent without him. I miss him.

My Dady: “You passed away, but you will always be in my heart. I hope you would be happy where I am right now, with my wife I have and with your another 4 grandchildren. I hope that one day I will be able to take them to see at least your grave. Missing you.”

Problem with Ajax and Windows-1250 encoding

I have a client and his application is written in encoding Windows-1250. I know I should rewrite it in UTF-8, but since it’s a quite a big system, it’s not easy. Also one motto is saying – Never touch the running system. So I have to deal with problems which come out of Windows-1250 encoding.

The problem I was facing this time was how to send a text via AJAX and encoded in Windows-1250.

I used jQuery function ajax() with hope, everything would be good, but I was mistaken. All special characters were destroyed and save wrongly into the database. So I started my investigation.

1. contentType for jQuery.ajax()

After a short investigation, I found out there is a parameter contentType, which I can set up for ajax function. I hoped this would help me out of the problem, so I set up

jQuery.ajax({
	...
	contentType: 'application/x-www-form-urlencoded; charset=Windows-1250'
});

and I went to test it. How surprised I was went it was not working again. So I started to read an instruction for this parameter and I did not like what I read there.

The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.  

From that time on I knew, that I will have to find a workaround.

2. mb_convert_encoding

I found out I can use mb_convert_encoding() function to convert between encodings. I implemented this:

$description = array_key_exists('value', $_POST) ? $_POST['value'] : null;
$description = mb_convert_encoding($description, "Windows-1252", "UTF-8");

This does its job but only up to the point. Because the website is in czech language, we do have some special characters, which will not work properly by using function mentioned above. I am talking about e.g. ěščřžýá. The function above would replace these special characters by question mark ?. So I knew I’m half of the way to find the solution / workaround, but I also knew, I’d have to come with something special.

3. Replace before sending and before saving

What came to my mind was that if I can’t send the data properly, I can replace special characters by some special string, send it and before I save it into a database, I will replace it back. I came with this idea:

function convert_strings(string) {
	var convert = {
		'_ce_' : 'ě', '_cs_' : 'š', '_cc_' : 'č', '_cr_' : 'ř',
                '_cz_' : 'ž', '_cy_' : 'ý', '_ca_' : 'á', '_ci_' : 'í', 
                '_cn_' : 'ň', '_ct_' : 'ť', '_cd_' : 'ď', '_cu_' : 'ů', 
                '_cuu_' : 'ú', '_cE_' : 'Ě', '_cS_' : 'Š', '_cC_' : 'Č', 
                '_cR_' : 'Ř', '_cZ_' : 'Ž', '_cY_' : 'Ý', '_cA_' : 'Á', 
                '_cI_' : 'Í', '_cN_' : 'Ň', '_cT_' : 'Ť', '_cD_' : 'Ď', 
                '_cU_' : 'Ů', '_cUU_' : 'Ú'}
       
        for(var i in convert) {
            var reg_exp = new RegExp(convert[i], 'g');
            string = string.replace(reg_exp, i);
        }

        return string;
}

value = convert_strings(value);			
var post_data = {value: value}
ajax_loading(element, 'show', 'row');
jQuery.ajax({
	...
	url: ...,
	data: post_data
}).done(function(data) {
	...
}).fail(function(data) {
	...
});

It will call a php file, where we have to replace the strings back.


$description = array_key_exists('value', $_POST) ? $_POST['value'] : null;
$description = mb_convert_encoding($description, "Windows-1252", "UTF-8");
$replace = array(
	'_ce_' => 'ě', '_cs_' => 'š', '_cc_' => 'č', '_cr_' => 'ř', 
	'_cz_' => 'ž', '_cy_' => 'ý', '_ca_' => 'á', '_ci_' => 'í', 
	'_cn_' => 'ň', '_ct_' => 'ť', '_cd_' => 'ď', '_cu_' => 'ů', 
	'_cuu_' => 'ú', '_cE_' => 'Ě', '_cS_' => 'Š', '_cC_' => 'Č', 
	'_cR_' => 'Ř', '_cZ_' => 'Ž', '_cY_' => 'Ý', '_cA_' => 'Á', 
	'_cI_' => 'Í', '_cN_' => 'Ň', '_cT_' => 'Ť', '_cD_' => 'Ď', 
	'_cU_' => 'Ů', '_cUU_' => 'Ú');
$description = strtr($description, $replace);

And we are finished. I know this is not the most correct solution, but it works and that is the most important thing for me. I would be happy if you can share any other idea, how to solve this problem. If you have any – please use comments to share it with me.

Thoughts about Philippians 4:19 – My God will supply all you need

Our sister Katerina mentioned yesterday during the time of offering the following verse – Philippians 4:19. As I was mentioning it in my todays’ prayer, God showed me something which I didn’t see before about this verse.

And my God will give you everything you need because of His great riches in Christ Jesus. / NLT

And my God will meet all your needs according to the riches of his glory in Christ Jesus / NIV

But my God shall supply all your need according to his riches in glory by Christ Jesus / KJV

It is really great to listen to His commandments and meditate above the scripture day and night. He will open your eyes and show you something which you may not have seen before.

This verse is very know among Christians and believers. It is the verse that everyone is quoting in time of need or in time that the enemy is trying to convince us, that poverty belongs to us. When we quote this verse, the enemy’s lair has no power on us anymore.

The verse consists of 2 parts (at least this is what i can see).

1. Promise: By my God shall supply all you need … (KJV)

By this promise the God wants us to build a faith in Him. He wants to acknowledge that He’s the provider – as His name is Jehovan Jireh (God who provides) and He will supply all what we need. He knows our needs even before  we tell them to Him. He knows we have to eat and we have to drink, we need a cloth to wear and we need a place to sleep. He simply knows it, before He always walk before us and He cares for us. We can see this promise in many parts of the Bible – maybe with not exact same words, but with the same meaning – e.g. Matthew 6:25-34, Matthew 7:9-11 etc.

One this I’d like to also mention here is that the verse is not saying: But my God shall supply all you want nigher By my God shall supply you desire. God will supply exactly what you need. So if you are waiting for something and God hasn’t supplied it yet, maybe it because you do not really need it. For example if you have a working car, but we want God to provide you a Porsche or Lamborghini, maybe God is telling you, that you do not really need it.

2. Condition: … according to his riches and glory by Christ Jesus. (KJV)

Yes even it this simple verse, there is a condition for the first part. God is saying that I will do it according to his riches and glory by Christ Jesus. What does he mean by this?  Why God didn’t stop just telling us – I will supply all your need. Because there’s something important. If I could extend the sentence / verse to give it more meaning, I’d at – in your life. So the whole verse would be

But my God will supply all you need according to his riches and glory by Christ Jesus in your life.

Rich people measure their richness by how much money they have. They compare their bank accounts and they know exactly, who is more riches and who is less rich. What the God is trying to tell us here is – that He will supply all we need but only to the point how richly Jesus Christ is in our lives. How much we trust Him and how much we allow Him to do.

Our sister Katerina always encourages us by telling us – Do not limit God. Do not put Him inside a box by saying – this is too much even for God. Build a faith for God and He will reward you. Learn how to trust Him completely and He will supply all you need. But we have to allow Him to do so.

Remember the riches and glory that Paul was talking about in this verse, is the riches and glory of Jesus Christ in your life. No-one else can do this for you, it’s your personal journey. Let Jesus take complete control in you life and I believe, you will experience more power of this simple and short verse.

Baby relax chair for sale – possible to use as swing chair as well.

 

We are selling baby relax chair which can be converted to swing chair. Condition like new. Only battery needs to be changed.

  • Price: 20 EUR
  • Location: Limassol
  • Interested? Call: Tomas 99866855

IMG_5536

IMG_5538

IMG_5539IMG_5541IMG_5542IMG_5547

IMG_5540

3 add-ons for Mozilla Thunderbird I use every day

As you probably know, I use Mozilla Thunderbird to manage my email. I found it as a great tool for my everyday job. We use RT as our ticketing system, which allows you to add comment directly from the interface, but I found the usage of email client much more convenient. E.g. it is much more easier to find my comments from yesterday or from a specific date from email client than from RT.

But to make my life even easier, I have found 3 add-ons which I use every day.

 1. Copy as Plain Text

This add-on allows you to copy any kind of text, from any source and paste it as plain text. This is a great add-on which I’d recommend to everyone. Before I found this, I used to copy / past a text to Notepad and copy / paste the same text to Thunderbird. And because I hate doing something extra, this was very difficult for me and I was many times very upset. So if you have same problem as me, try this add-on out and you will see.

Download: https://addons.mozilla.org/en-US/thunderbird/addon/copy-as-plain-text/

2. QuickText

QuickText add-on allows you to add a predefined text very easily. You can even use short-cut to make your job even faster.  I have one template for email to our clients, another one if I want to send something to my colleagues and couple different templates for another reasons. I can just open new email, press e.g. Alt+1 and the structure of the email will always be the same. Another feature that this ad-don comes with is support for parameters. To be honest I’ve never needed them, but you can check it out and maybe they will help you as well.

Download: https://addons.mozilla.org/en-US/thunderbird/addon/quicktext/

3. Subject Manager

Subject Manager is an add-on which does exactly what its name stands for. It helps you with subjects of your email. As I mentioned earlier, we do use RT as our ticketing system and the subjects for the emails have always same structure.

[mmVirtual #{number}] {ticket_name}

So what I do is that I insert all the tickets I’m currently working on and when I need to inform a client or just post a comment to a particular ticket, I just simply select from drop-down menu the one, I’d like to send an email to. It’s really helpful ad-don and I believe you will find it helpful even if you do not use RT.

Download: https://addons.mozilla.org/en-US/thunderbird/addon/subject-manager/

Do you know about another great add-on for Mozilla Thunderbird?

If you know about another great add-on for Mozilla Thunderbird, add your comment underneath. I always love to make my life easier so I’d appreciate your recommendation.

How to easily create HTML table from Excel by using Sublime Text Editor

There is no question, that Sublime Text editor is the best editor I have ever had a privilege to work with. And on top, it’s been proving this fact day by day.

Recently I had to create an HTML Table from Excel file, so I tried to do it with Sublime Text Editor and I found it really easy.

1. Open Excel file

When I opened excel file, I saw something like this

excel_view

2. Select all and copy to the Sublime Text Editor

I selected all data and copied it to sublime text editor. I got this view

view_sublime

3. Let’s use Find + Replace tool to build a table body

I always use hotkey Ctrl + H, but you can use link from top menu – hotkey is always must more faster – so I’d recommend to remember this.

3a. Start <td>

Press Ctrl + H and fill following

sublime_start

  • Find what: ^
  • Replace with: <td>
  • Press Replace All or Ctrl + Alt + Enter

When you do this, you will get this image

sublime_start_finished

 3b. Let’s create last </td>

Press Ctrl + H and fill following

sublime_end

  • Find what: \n
  • Replace with: </td>\n
  • Press Replace All or Ctrl + Alt + Enter

When you do the 3 steps above, you will get this image

sublime_end_finished

3c. Complete </td><td> in between lines

This is quite tricky part, but we can do it again very easily. Press Ctrl + H and fill following

sublime_between

  • Find what:  + (there’s a space in front of + sign)
  • Replace with: </td><td>
  • Press Replace All or Ctrl + Alt + Enter

sublime_between_finished

4. Let’s use Ermet to complete table

Select all the text and press Ctrl + Alt + Enter

sublime_table

And finally press Enter and we are done.

sublime_table_finished

 

So as you can see, Sublime Text Editor is very easy to be used but it can do extra ordinary things as well. I’d recommend it to everyone and as I said before, Sublime Text Editor is the best editor I have ever worked with.

Great job guys.

Trust in Jesus always

10670244_986671924691743_9102366448750991862_n

Is Jesus really who he was claiming he is?

Is Jesus really who he was claiming he is? He said in John 14:6 – I am the way, the truth and the life. No one can come to the Father except through me. I was going through the study and they were saying – that this statement can be equal to someone saying – I am a fried egg or I am a Christopher Columbus.   So why people would believe him?

In order to be believable, you must “back up” your words with your action. You cannot just say it and hope they are going to believe me. But you have to support your statement with actions. Even Jesus himself was saying – Do not believe to me because what I say, but believe to me because what I do in my Father’s Name.

As you have a closer look on Jesus life, you can clearly see, that he fulfilled this part.His life was foretold many years before He was born and the way how he lived gave him an authority to declare this statement. The way how he took care about outcast and people separated from the society, how he never doubt his purpose on the earth, how you endure all beating and bad behavior and on top, we accepted a painful death on the cross for our sins – He really had an authority to declare that He is the way, the truth and the life.

Many people do not want to accept that there is only One way. Even some religion struggle with this idea and trying to change the fact. But I pray that the eyes of the people will be opened and they will clearly see, that Jesus Christ is the Lord, He is the only One way and we have to accept it as the fact.

1 Timothy 2:5 tells us: For there is one God and one mediator between God and mankind, the man Christ Jesus.  There is no-one else through whom we can go to heaven, only by Jesus – No one can come to the Father except through me (John 14:6). 

I believe that if people understood that Jesus was not a liar or lunatic, but he really is the only One way, there wouldn’t be so many conflicts nowadays.

I pray that the Lord will open your eyes and you will clearly see who Jesus is. He is the Lord and the Savior of the world. He is our great advocate, the High Priest, the very best friend. Father have a mercy upon your children and give them understanding hearts and eyes so they can come closer to you – into your very presence. Bring light upon their lives and let them clearly see. I break any chain of darkness from their eyes and I open them in Jesus Mighty Name. Thank you for listening to my prayer. You are Great and Mighty King. In Jesus’ Mighty Name I prayed.

God did not promise ….

God didn’t promise
days without pain
laughter without sorrow
sun without rain,
but He did promise
strength for the day
comfort for the pain
and Light for the way.

© 2014 Tomas Pavlatka

Theme by Anders NorenUp ↑