11 Temmuz 2017 Salı

How to display Schemas Panel on Mysql Workbench

Sometimes, you have trouble with Schemas Panel that cannot be displayed when you run MySQLWorkbench. You can see "no object selected" message instead of Schemas Panel on Navigator Panel.

To fix this issue and get Schemas Panel back, I recommend instructions below:

1) Open Terminal.

2) Reset workbench setting and configurations like below:
cd ~/Library/Application\ Support/MySQL/Workbench/
rm wb_state.xml
rm wb_options.xml
3) Open MysqlWorkbench. On initial open after the fix above, you will wait a little bit, but then you see Schemas Panel on the left side!

21 Haziran 2017 Çarşamba

How to install an additional java on MacOS?

Java 8 is already built on my Mac, but I also need Java 7 to run some projects properly. Addition to this, switching between these versions should be easy, because I may need to switch it based on a project I work on.

Actually, the fastest and right way is to install Java 7 and manage versions of Java via "homebrew". However, I don't know why, Oracle put Java 7 installer under the authentication. It needs username and password. Because of this, related installer cannot be found on homebrew repos.

Not the fastest way, but there is only one way left, MANUEL SETUP.
1) Uninstall jdk8:
sudo rm -rf /Library/Java/*
sudo rm -rf /Library/PreferencePanes/Java*
sudo rm -rf /Library/Internet\ Plug-Ins/Java*
2) Install jdk7:
You must have oracle account. Enter your username & password on Oracle Java 7 download page and download/install it.

3) Reinstall jdk8:
You don't need oracle account for this.

4) Prepare environment variables:
Add something below into .profile(.bash_profile) file on your home directory.
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_7_HOME=$(/usr/libexec/java_home -v1.7)

alias java7='export JAVA_HOME=$JAVA_7_HOME'
alias java8='export JAVA_HOME=$JAVA_8_HOME'

#default java8
export JAVA_HOME=$JAVA_8_HOME
5) Check the version of your java installed on your Mac.

References:
  1. https://stackoverflow.com/a/26252993
  2. https://github.com/caskroom/homebrew-cask/issues/9447
  3. https://stackoverflow.com/a/30412014

27 Şubat 2017 Pazartesi

Links of my journal paper and conference proceedings

My last paper "A Review of Security Concerns in Internet of Things" was accepted by Scientific Research Publishing to be published in one of its journals whose name is "Journal of Computer and Communications" in the past months. I hereby share the link of the paper and other conference proceedings that I wrote in the past:

.: E. Leloglu, "A Review of Security Concerns in Internet of Things", Journal of Computer and Communications, 5, 121-136. doi: 10.4236/jcc.2017.51010.


.: E. Leloglu, T. Ayav and B. Ergenc, "Coefficient-Based Exact Approach for Frequent Itemset Hiding", The Sixth International Conference on Information, Process, and Knowledge Management (eKNOW 2014), Barcelona, Spain, 2014. The link.


.: E. Leloglu, T. Ayav and B. G. Aslan, "A review of cloud deployment models for e-learning systems", 43rd Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), Budapest, Hungry, 2013, pp. 1-2. doi: 10.1109/DSN.2013.6575331

30 Ocak 2017 Pazartesi

Why does not MySQL event run?

The event scheduler may be on OFF position.

.: SQL command below can be used to see if the event scheduler is ON or OFF;

SHOW PROCESSLIST;
If there is no line that has a process "Daemon" by user "event_scheduler", it means that the event scheduler is OFF and should be activated in order that events can run.

.: The event scheduler can be activated with the SQL command;

SET GLOBAL event_scheduler = ON;

20 Kasım 2016 Pazar

java.sql.SQLException: Your password has expired. To log in you must change it using a client that supports expired passwords.

*** To clarify the issue, I can give the reason that causes this exception of MySQL (https://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.html);

"From MySQL 5.7.4 to 5.7.10, the default default_password_lifetime value is 360 (passwords must be changed approximately once per year). For those versions, be aware that, if you make no changes to the default_password_lifetime variable or to individual user accounts, all user passwords will expire after 360 days, and all user accounts will start running in restricted mode when this happens. Clients (which are effectively users) connecting to the server will then get an error indicating that the password must be changed: ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement."
*** How can we handle it;
Open the terminal, reach the directory that has mysql.exe (usually at C:\Program Files\MySQL\MySQL Server 5.7\bin) and typed:
mysql -u root -p
After this, you will realise that you cannot use "ALTER" command to change password. Because your password is expired and actions allowed are limited on this process. Here is the solution to reset the password on this screen;
SET PASSWORD = PASSWORD('xxxxxxxx');
*** Further upgrade after reseting the password (https://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.html); 
"To avoid having such clients suddenly stop working due to a password expiring, make sure to change the password expiration settings for those clients, like this:
ALTER USER 'script'@'localhost' PASSWORD EXPIRE NEVER
Alternatively, set the default_password_lifetime variable to 0, thus disabling automatic password expiration for all users."

18 Temmuz 2016 Pazartesi

How can it be possible that HTTP is stateless, although HTTP uses TCP protocol?

- TCP is connection-oriented, stateful and reliable.
- UDP is connectionless, stateless and unreliable.
- HTTP uses most commonly TCP protocol.

By taking information above into consideration, how can it be possible that HTTP is stateless?

* HTTP does not inherit from TCP or any other lower-level protocols used to transport itself. Using one of these protocols in transport layer doesn’t mean that HTTP becomes stateful automatically or is required to be stateful [1].

HTTP will work the same without considering a transport technology such TCP, SCTP or another protocol over HTTP;

- HTTP provides a stateful connection by using TCP, but then it makes this connection disconnect. Later on, it can connect again, if it is needed. Many different connections are created while a user browses a web-site. These connections are surely stateful, but the whole, I mean the conversation, is not, because each connection in the conversation is started and ended in a way of being independent of any other connection [2].

There is good example here about what I tell above;

" Consider the phone service to be TCP and consider your relationship with distant family members to be HTTP. You will contact them with the phone service. Each call to them would be a stateful TCP connection. However, you don't constantly stay on the phone with them, as you will disconnect and call them back again at a later time. You would certainly expect them to remember what you talked about on the last call. HTTP in itself does not do that, but it is rather a function of the web server that maintains the state of the overall conversation." [3]

If you have a popular server that has a million hits per day, management of these hits is very important in this sense. Each hit consists of a quick connect and disconnect. However, if each user open a connection in your web-site, then it could potentially overwhelm your server.

As a result, HTTP itself is stateless without considering its transport technology. It means that applications have to implement another layer on top of HTTP to establish state. Session cookies are typically used for this reason [1].

References:
  1. http://superuser.com/a/825372
  2. http://whatis.techtarget.com/definition/stateless
  3. http://fixunix.com/tcp-ip/66544-tcp-stateful-protocol-then-why-not-http.html#post214883

18 Mayıs 2016 Çarşamba

Caused by: java.io.NotSerializableException: bean.Example

NotSerializableException is common exception type on run-time of Java web applications when Tomcat server restarts. This is due to Tomcat's default behavior of serializing all the sessions and after restart trying to deserialize them. This is the persistance feature of Tomcat server.

Caused by: java.io.NotSerializableException: bean.Example

1) In the exception above, "bean.example" is fully qualified name of class that does not implement the Serializableinterface while it is been expected by the code behind. To fix it:

package bean;

import java.io.Serializable;

public class Example implements Serializable {
   private static final long serialVersionUID = 1L;
  private DeviceManager deviceManager = new DeviceManager();
// ... }
There is another important thing that Tomcat persists sessions and all objects in each session. Hence, if there is a variable that is used to keep instance of another classses, they also should be implemented with the Serializableinterface.

2) Sometimes, finding the class that throws the exception and making it implement theSerializableinterface may not be feasible when the class belongs to a third-party library. Objects that are created from this kind of class should not be serialized, but these objects can be declared as transient. Once a field of a class is declared as transient, then, it is ignored by the serializable runtime.


package bean;

import java.io.Serializable;
import com.google.gson.*;
public class Example implements Serializable { private static final long serialVersionUID = 1L;
  private transient Object deviceInformation = null;
// ... }
3) Another solution to get rid of NotSerializableException may be disabling session persistence in Tomcat server. To disable it, find tomcat_dir/conf/context.xml and find a place where it says:

<!-- Uncomment this to disable session persistence across Tomcat restarts -->

* This solution is valid for both Tomcat 6 and Tomcat 7.
References:
  1. http://stackoverflow.com/a/11692208/1194553
  2. https://mihail.stoynov.com/2011/04/11/disable-session-persistence-in-tomcat/
  3. https://examples.javacodegeeks.com/java-basics/exceptions/java-io-notserializableexception-how-to-solve-not-serializable-exception/
  4. http://stackoverflow.com/a/1904705/1194553