Welcome to Berlin! Willkommen in Berlin!

The top places you can visit can be found on one long street called Unter Den Linden. Here are the places you can visit there.

Photo by Claudio Schwarz | @purzlbaum on Unsplash

It is just a collection of beautifully shaped stones and it is even fun…

Run the following commands separately to change/reset your ‘root’ user password in MySql database.

There is a database called mysqlwhich is the default database. It is where Users such as root are stored. More info can be found
In this script, it is assumed that your new password is MyNewPassword. Hence, replace that with whatever you want your password to be.

UPDATE mysql.user
SET Password=PASSWORD(‘MyNewPassword’)
WHERE User=’root’;

Originally published at http://binyit.blogspot.com.

First, Set up your connectionString and use the following code snippet in a method.

using (SqlConnection con = new SqlConnection(connectionString)){


SqlCommand cmd = new SqlCommand("SELECT userid, username, email, city FROM USERS where username=@username and password=@password", con);
cmd.Paramters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@password", password);
cmd.CommandType = CommandType.Text;

UserInfo info = new UserInfo();

using (SqlDataReader rdr = cmd.ExecuteReader())
if (rdr.HasRows)
rdr.Read(); // get the first row

info.UserID = rdr.GetInt32(0);
info.UserName = rdr.GetString(1);
info.Email = rdr.GetString(2);
info.City = rdr.GetString(3);

Acknowledgement to: Tim of StackOverFlow.com

Apache Struts is a project developing an open-source web application framework for Java EE web application development that promotes a model–view–controller (MVC) architectural approach through extensions the Java Servlet web API. [Definition from Wikipedia]

To know more about Apache Struts 2, click here.

Redirect To JSP Page

It is very simple to redirect to…

No talking! Let’s just do the code.

// String that is comma separated 
String listOfUserIds = “10,11,12,13”;
// The magic that converts it to list
List<String> userIds = new ArrayList<String>(Arrays.asList(listOfUserIds.split(“,”)));

To convert the List back to String:

userIdsLists = userIds.join(', ')

Originally published at http://binyit.blogspot.com.

When upgrading grails to version 2.3.0, I got the following error.

Failed to resolve dependencies ... 
org.grails.plugins:tomcat:2.3.0 ...
hibernate:2.3.0 ...

This is because as of Grails 2.3.0, the tomcat and hibernate plugins (as well as the scaffolding and webflow plugins) have been split out as completely independent plugins and are no longer versioned with Grails. You need to use explicit versions now instead of using $grailsVersion.

Hence, I replaced the following things in my BuildConfig.groovy file

OLD: runtime “:hibernate:$grailsVersion”// For versions prior to Grails 2.3.0
NEW:runtime ‘:hibernate:’
OLD: build “:tomcat:$grailsVersion” // For versions prior to Grails 2.3.0
NEW: build ‘:tomcat:7.0.42’

And I added the following line to be able to run the create- and generate- scripts in Grails 2.3.0

//To run the create- and generate- scripts in Grails 2.3.0
compile ‘:scaffolding:2.0.0’

Originally published at http://binyit.blogspot.com.

If multiple line blank spaces appear in your Microsoft Word document, (when you copy and paste from a PDF document or from some website),

Code Example

<script type="text/javascript">
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
document.write("<b>" + day + "/" + month + "/" + year + "</b>")

The result will be 15/1/2014

Here is a complete class that shows how another activity is called when a button in the first activity is pressed.

public class FirstActivity extends Activity implements View.OnClickListener {

Button goToSecondActivityButton;

protected void onCreate(Bundle savedInstanceState) {


((TextView) findViewById(R.id.textRecommendationMessage)).setText("This is the first activity");

goToSecondActivityButton= (Button) findViewById(R.id.button_go_to_second_activity);

public void onClick(View view) {


private void goToSecondActivity() {

Intent intent = new Intent(FirstActivity.this, SecondActivity.class);

If you have a string variable containing a date value such as 2014–06–03T11:03:44.779+03, then:

Code Example

import java.text.SimpleDateFormat 
import java.text.DateFormat
String mydate = “2014–06–03T11:03:44.779+03”
DateFormat formatter = new SimpleDateFormat(“yyyy-MM-dd”)
Date parsedDate = formatter.parse(mydate)
Date formattedDate = formatter.format(parsedDate)
/* Simplified code in one line
Date parsedAndFormattedDate = formatter.format(formatter.parse(mydate))

Originally published at http://binyit.blogspot.com.

Biniam Asnake

Lead Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store