Wednesday, December 18, 2013

Subscript and SuperScript in HTML

To write Subscript in HTML use <sub> tag and
to write SuperScript in HTML use <sup> tag as shown in the example below.

<!DOCTYPE html>
<html>
<body>
     Chemical formula of Oxgen (O2) is written as O<sub>2</sub>
     X squared (X2) is written as X<sup>2</sup>
</body>
</html>

Friday, December 6, 2013

የኮምፒውተር ጥያቄና መልሶች: ኮምፒውተሬ አማርኛ አይጽፍም፡፡ ምን ላድርግ?

ጥያቄ
ኮምፒውተሬ አማርኛ አይጽፍም፡፡ ምን ላድርግ?

መልስ
ኮምፒውተር ላይ አማርኛ ለመጻፍ የተለያዩ ሶፍትዌሮች አሉ፡፡ 
    ለምሳሌ፡ ፓወር ግዕዝ፣ ቪዥዋል ግዕዝ፣ አብነት(ኤቢኔት) ግዕዝ ከታዋቂዎቹ መካከል ይገኙበታል፡፡
ከእነዚህ ሶፍትዌሮች  መካከል አንዱን ጭነህ/ቀድተህ መጠቀም ትችላለህ፡፡

ወይንም ደግሞ ኢንተርኔት ላይ የተለያዩ አማርኛ በቀላሉ እንድትጽፍ የሚያስችሉህ መካነ-ድሮች አሉ፡፡
የምትጽፈውንም ጽሁፍ ቀጥታ ወደ ፌስቡክና ሌሎች ማኅበራዊ መካነ-ድሮች መላክ ትችላለህ፡፡

ለምሳሌ
http://www.amharickeyboard.com/
http://www.typeamharic.com/

ጥያቄዎን ይጠይቁ!
ላይክ ያድርጉ!
ሼር ያድርጉ!
ብዙ ጥያቄ ከመለሱ የዚህ ፌስቤክ ገጽ አስተዳዳሪ ይሆናሉ!

www.facebook.com/compqa

የኮምፒውተር ጥያቄና መልሶች: ኮምፒውተሬን ስዘጋው በጣም ስለሚቆይ የማስነሻውን ቁልፍ ይዤ ነው የማጠፋው፡፡ እባካህ መፍትሔ ካለ፡፡


ለብዙ ኢትዩጵያውያን የሚጠቅም እንዲሆን መልሱን በአማርኛ እመልሳለሁ፡፡

ጥያቄ
When I turn of my laptop using start>shutdown, it gets stacked and stays like that and I have been using a long press to shutdown my laptop. Do you have a solution please?

በአማርኛ
ኮምፒውተሬን ስዘጋው በጣም ስለሚቆይ የማስነሻውን ቁልፍ ይዤ ነው የማጠፋው፡፡ እባካህ መፍትሔ ካለ፡፡

መልስ

ጥያቄህ ሰፋ ያለ ቢሆንም የሚከተሉት መፍትሔዎች የገጠመህን ችግር ይፈታልሀል፡፡
1. በቅርቡ የጫንከው ሶፍትዌር ወይም ሃርድዌር ካለ ችግሩን የፈጠረው ያ ሊሆን ስለሚችል ሶፍትዌሩን ወይም ሃርድዌሩን አስወግደህ ኮምፒውተሩን ለመዝጋት ሞክል፡፡ ከተሳካ ያ ሶፍትዌር ወይም ሃርድዌር ተመጣጣኝ (compatible) አይደለም ወይም አጫጫኑ ልክ ስላልሆነ ድጋሚ ሞክር ወይም ባለሙያ አማክር፡፡

Thursday, December 5, 2013

Restoring SQL Server Database and Getting out of Standby/Read-only mode

You database might be Standby/Read-only mode after restoring your database in SQL Server.

The solution is:

  1. Click on New Query
  2. Select 'master' as your database
  3. Run the following script

RESTORE DATABASE <db_name> WITH RECOVERY

Wednesday, December 4, 2013

Keystore vs. Truststore and Testing a Java SSL connection

I got the following note from here.

Keystore vs. Truststore

The SSL/TLS related Java classes have the concept of Keystores and Truststores. Initially I had no idea what a Truststore was and thought that a Keystore fulfilled both it's own role as well as that of a Truststore, but oh how wrong I was. 

  • A Keystore is used to contain and provide private key data. So whenever clients are connecting TO a java based server application (like Tomcat), the Keystore is used to present it's server certificate (public cert) to the clients and contains the private key associated with that server certificate. 
  • The Truststore on the other hand contains the list of trusted certificates that would be used when a java based application (also could be Tomcat) functions as a client and makes an outbound SSL connection to some other device. The contents of the Truststore would be used to validate the identity of the server certificate being presented to the client by the other device.

Monday, December 2, 2013

Death and Abaw

Really Funny

One day death came to Abaw and said "Abaw today is your day..!!!"
Abaw replied : "But I'm not ready to die..."
Then death said.... "well there's nothing I can do because your name is the next one on the list."
Abaw said : "Okay why don't you take a seat and I'll get you something to eat before we go ?"
Then death said : "all right" 
Abaw gave death some food with sleeping pills in it. 
Death finished eating and fell into deep sleep. 
Abaw took the list and remove his name from the top of the list and put into the bottom of the list.
When death woke up, he said to Abaw "hmmmm well, because you have been so very good to me, I will start at the bottom of the list."


Abaw is Sc-rood!

Solving Android Studio will not be able to start Issue in Windows

I encountered the following error while using Google's Android Studio which is an IDE based on IntelliJ in both Windows 7 and 8.

Simplest Solution
If you are running in Windows 7/ 8/ Vista/ etc. then try running Android Studio as administrator (Right Click on Android Studio and select Run As Administrator). 

Another Solution
1- Go to folder where android-studio is installed. (C:\Program Files (x86)\Android\android-studio)

2- Now go back to previous folder. (C:\Program Files (x86)\Android)

Wednesday, November 27, 2013

Some points to note when preparing Curriculum Vitae (CV)

Some points to note:

  1. Make it look attractive
  2. Write your experiences, projects and skills at the first few pages
  3. Explain what your role was in every project/position
  4. Write it to be as convincing as possible for the recruitment team to hire you.

Tuesday, November 26, 2013

መልካም ሥራ

ሀበሻ እንዲህ ይላል፡፡ 
"ጽድቅና ኩነኔ ቢኖርም ባይኖርም ከክፋት ደግነት ሳይሻል አይቀርም፡፡"
Specially if you are a believer of God or Allah, you should not expect a thing from anyone because God will counts all the good deeds you have done and he'll pay you. You should TRUST/BELIEVE God.
የማቴዎስ ወንጌል 7*12 "እንግዲህ ሰዎች ሊያደርጉላችሁ የምትወዱትን ሁሉ እናንተ ደግሞ እንዲሁ አድርጉላቸው፤ ሕግም ነቢያትም ይህ ነውና።"

Thursday, November 21, 2013

Restore Default Windows 7 File Extension Type Associations


A lot of people asked me how to fix file extension problems. This means all the files and/or folders in your computer are opening using the same software/program which it should not do.

For instance, it opens all PDFs, folders, excel files, music and video files using Microsoft Word or Firefox or Chrome or any while all file types have their own specific program that opens them.

I found this great article by Brick here

Here's How You Can Solve the above Problem:
1. Click on the link for the file extension in the list below the blue NOTE box below that you would like to restore the default associations of. This will download it's .reg file.

2. Save the .reg file to your desktop.

Wednesday, November 20, 2013

How to Integrate Internet Download Manager (IDM) with Google Chrome

The following video shows you how you can integrate Internet Download Manager (IDM) with Google Chrome.


Enjoy downloading videos from youtube and any other website.




More info can be found here.

Monday, November 18, 2013

Display or List Environment Variables in Windows

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.
They are part of the operating environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

To view the contents of the environment variables:

1. open command prompt (write "cmd" in search bar of the start menu or in Run)
2. To list -> write "set" (without quotes) and hit enter
    To save it into file -> "set > output.txt" and hit enter
I.e. The file will be saved in C:\
To save the file in other directory "set > D:\output.txt" and hit enter


Tuesday, November 12, 2013

Java Decompiler project: To extract .java file from .class

Please check out the following project which also contains plugins for Eclipse and IntelliJ at http://jd.benow.ca/
The “Java Decompiler project” aims to develop tools in order to decompile and analyze Java 5 “byte code” and the later versions.
It can extract .java files from .class files which are called "byte codes" in Java. 
Thanks for the developers!


Thursday, November 7, 2013

Simple way to solve MySql Error #1044 - Access denied for user 'username'@'localhost' to database 'my_database'

Error Description:

Access denied for user 'username'@'localhost' to database 'my_database' means: 
the user 'username' doesnot have enough or no privilege to access (insert, update, create, drop/delete) the database 'my_database'.

Simple Solution:

1. Create the database in cPanel
2. DONOT assign a user [Main thing]



3. Use phpMyAdmin -> Select the database you want to import the tables -> Go to Import tab and browse for the file -> Click "Go"

4. You will see "Import has been successfully finished ..." message.

Wednesday, October 16, 2013

Formatting Numbers by padding with leading zeros in SQL Server

DECLARE @empNumber INT = 7123
SELECT STUFF('000000', 6-LEN(@empNumber)+1, LEN(@empNumber), @empNumber)
Or, as per your query

SELECT STUFF('000000', 6-LEN(EmployeeID)+1, LEN(EmployeeID), EmployeeID)
         AS EmployeeCode
FROM dbo.RequestItems
WHERE ID=0

You can change your procedure in this way

SELECT Right('000000' + CONVERT(NVARCHAR, EmployeeID), 6) AS EmpIDText,
       EmployeeID
FROM dbo.RequestItems
WHERE ID=0
However this will change your EmployeeID to a string, so I suggest to add again the original numeric value

Friday, September 13, 2013

How to Display Date and Time in your Grails Application

I am going to show you how you can accept Data and Time from the user as input using 'Jquery Date Time Picker Plugin'.

You can read more about the plugin here.

Step 1:

In BuildConfig.groovy, add the following code in plugins tag as:

plugins { 
    compile ":jquery-ui:1.8.24" 
    compile ':jquery-date-time-picker:0.1.0'
}

Step 2:

In Config.groovy, add the following code:

Monday, September 9, 2013

DiffMerge : A Merging tool for Git

When using the distributed Version Control i.e. Git, your files might conflict since multiple users might have been working on same file.

Hence, you can use any text editor which is boring, tiresome and hard to identify where the issue is. The best option is to use a merging tool such as Diff Merge. (Click on the link to go to the downloads page)

I faced one configuration issue when I was trying to use it for the first time.
The error was "Unexpected Parameter". The configuration from the software manual didnot work for me.

The solution is to edit the .gitconfig file manually to look like the following.

The following commands in a Command Prompt window will update your .gitconfig to configure GIT use DiffMerge:

C:\> git config --global diff.tool diffmerge
C:\> git config --global difftool.diffmerge.cmd "C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\""

C:\> git config --global merge.tool diffmerge
C:\> git config --global mergetool.diffmerge.trustExitCode true
C:\> git config --global mergetool.diffmerge.cmd "C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe  --merge --result=$MERGED $LOCAL $BASE $REMOTE" trustExitCode = true keepBackup = false


The code snippet that is Bold is the major change made.

Grails : Displaying Error Message on View which is thrown from the Service Layer

In your controller class, enclose the code that calls the service in a try-catch block.

Example:
try {

def searchResult = User.getUserByName(params.name)

if(searchResult != null)
render(view: "/admin/user/list", model: [userInstanceList: searchResult?.results, userInstanceTotal: searchResult?.total])

else{

flash.message = message(code: 'user.nonfound.message', default: "No items found.")
render(view: "/admin/user/list", model: [userInstanceList: [], userInstanceTotal: 0])
}
} catch (e) {

flash.message = message(code: 'user.nonfound.message', default: "No items found.")

render(view: "/admin/user/list", model: [userInstanceList: [],userInstanceTotal: 0])
}

Wednesday, September 4, 2013

Sending Email from your Grails Application : A Tutorial

Here is how you can simply send an email from your Grails Application.


Step 1: In BuildConfig.groovy add the ff code in plugins{} tag,

// Grails mail plugin
compile ":mail:1.0.1"

Step 2: In Config.groovy, add the ff code
grails {
mail {
host = "smtp.gmail.com"
port = 465
username = "sample@gmail.com"
password = "fakeP@SSw0Rd"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}

Solving: "No result defined for action ... and result input"

When programming in Java and using the Struts 2 Framework, the program threw the exception "No result defined for action ... and result input".

The solution was to add an input redirection like.

<result type="dispatcher" name="input">/WEB-INF/jsp/pc/agent/myJSP-page.jsp</result>

Tuesday, August 27, 2013

Getting all the records from a table and displaying them in a DataGridView (Visual Basic.Net Version)

Written by: Biniam Asnake


Assuming you have already took the pleasure of creating a Visual Basic Windows Application and you have a database in SQL Server. For this case let’s call the database “Industry”


1st. Create app.config file (By right clicking on your project’s name in Solution Explorer)
2nd. Paste the following code


<connectionStrings>
   <add name="connectionString"
       connectionString="SERVER=(local);; DATABASE = Industry; Integrated Security=True;
Trusted_Connection= Yes;"
       providerName="System.Data.SqlClient" />
</connectionStrings>

Tuesday, August 20, 2013

Script To Migrate Data from Excel to SQL Server

Simply, here is a script to insert data from your xls or xlsx data to SQL Server.

-- This script Migrates data from Ms. Excel to Ms. SQL Server
-- GLOBAL CONFIGURATIONS For ALL Senarios
sp_configure 'show advanced option', 1
reconfigure
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

USE [master]
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
GO

Solving mySql exception: ERROR 1396 (HY000): Operation CREATE USER failed for 'somebody'@'%'

To solve the problem of creating using which raises an error "ERROR 1396 (HY000): Operation CREATE USER failed for 'somebody'@'%'", run the following script with the proper changes(user name and password).


grant all privileges on *.* to somebody@localhost identified by 'password' with grant option; 

Wednesday, August 7, 2013

Solving com.microsoft.sqlserver.jdbc.sqlserverexception the result set was generated for update

To solve the following issue,
"com.microsoft.sqlserver.jdbc.sqlserverexception the result set was generated for update"

add the following code to your Stored Procedure/SQL script.

SET COUNT OFF

Monday, August 5, 2013

Solving Exception: SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server.

If such error is thrown in SQL Server 2012 Management Studio, 
"Msg 15281, Level 16, State 1, Line 2
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online."


  1. Right Click on your Server 
  2. Select Facets
  3. Select "Surface Area Configuration" from the combo box 
  4. Change the "Ad Hoc Distributed Queries" to True.


Tuesday, July 30, 2013

Solving jdbc.SQLServerException: The statement did not return a result set.

My stored procedure (SP) returns the last updated record from a table if totalAmount is not null or zero. The SP runs fine in SQL Server Management Studio.
When I run the same SP from my grails/java app, it throws the error "Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set."

This was because if totalAmount is null or zero, there is nothing to return. Therefore, I added an empty /null return. The code is shown below.

-- Save total_amount of every BU for that day
SELECT @totalAmount = SUM(total_amount) FROM settlement

IF (@totalAmount IS NOT NULL)
 BEGIN
  -- Insert fields in to settlement_batch table 
  INSERT INTO settlement_batch (completed_time_stamp,       
         settlement_batch_number, status_time_stamp, 
         total_amount, updated_by_user_id, created_by_user_id, 
         date_created, last_updated, version)
  SELECT GETDATE(), MAX(ISNULL(settlement_batch_number,0)) + 1, 
         GETDATE(), @totalAmount, @currentUser, @currentUser, 
         GETDATE(), GETDATE(), 0
  FROM settlement_batch
  -- Get the settlement_batch_id of the last inserted record
  SET @new_settlement_id = IDENT_CURRENT('settlement_batch');

  -- Return the last inserted id in settlement_batch
  SELECT ISNULL(@new_settlement_id, 0) AS NewSettlementId
 END
ELSE
 BEGIN
    SELECT NULL AS NewSettlementId
 END

Wednesday, July 17, 2013

Change gitbash home directory

The simplest way is to change the property of the git bash.
Right click on Git Bash -> Properties
Change the "Start in" attribute to "%HOMEDRIVE%%HOMEPATH%\git" (without quotes) as shown in the figure below.

Publishing to Tomcat v6.0 Server at localhost has encountered a problem.

I run in to the following Tomcat server error while trying to build my application developed in Java (using Eclipse IDE).



Tuesday, July 16, 2013

Target runtime Apache Tomcat v6.0 is not defined

Posted on 

I was upgrading the tomcat in my eclipse from version 6 to 7. Servers were added, old servers were removed. Tomcat 6 installed. But the server is not starting because of the following error.
Target runtime Apache Tomcat v6.0 is not defined.    <project name>        Unknown    Faceted Project Problem
It keeps my old server entry for the project.
We need to right click on the project, properties and Targeted Runtimes. Uncheck the old entry and enable the new entry. This should solve this error.
Targeted Runtimes
Targeted Runtimes
Still server is facing some other issue. Need to check up.

Windows 8 - Cannot Save on 'Hosts'

Article by http://www.petenetlive.com/KB/Article/0000674.htm

Problem

Windows did this with Windows 7 (and Vista). If you attempt to edit the hosts file you will see the following.
Hosts - You don't have permission
You don't have permission to save in this location. Contact the administrator to obtain permission. Would you like to save in the My Documents folder instead?

Solution

1. You could run an admin command window, and use the EDIT command, but Notepad is easier. Open the Apps page (Windows Key+Q) > Locate Notepad and right click it > Run as Administrator.
Note: YES Even if you are logged in as an administrator.

Windows 8 Run Notepad as Administrator

2. Now you can open the hosts file (make sure you change the file type to all files or notepad wont see it!). And you can then edit the file and save the changes.

Windows 8 Save the hosts file

Making VMware Server 2 work on Windows 8

Follow the following steps:

  1. Install VMware server
  2. Open regedit and look for this address
    1. HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VMwareHostd\DependOnServiceand Remove "ProtectedStorage" from the list.
  3. Open CMD and write the followingsc create "VMware Host Agent" start=auto binPath="C:\Program Files (x86)\VMware\VMware Server\vmware-hostd.exe"
  4. Restart your computer
  5. Start the VMware by double clicking on the icon on the desktop "VMware Server Home Page"
  6. Log in. If you are not able to log in, use your "administrator" user's name and password. For more info, read this (http://helpdeskgeek.com/virtualization/vmware-server-web-access-default-username-and-password/)
  7. If you already have a VM installed and moved from another computer,
    1. Click on "Add Virtual Machine to Inventory"
    2. Browse and Select the .vmx file
    3. When it prompts you "msg.uuid.altered:This virtual machine may have been moved or copied. In order to configure certain management and networking features VMware Server needs to know which. Did you move this virtual machine, or did you copy it? If you don't know, answer "I copied it"." 
select "I Moved It" and click "OK"

8. If such error comes 
"Power On Virtual Machine" failed to complete.
If these problems persist, please contact your system administrator.
Details: Cannot open the disk 'C:\Virtual Machines\Windows 2003-002\Windows 2003-002.vmdk' or one of the snapshot disks it depends on.

Solution

Reason: Failed to lock the file.", delete the .lck file from the VM's folder. These files are the lock files that should only exist while your VM is powered on. Delete the .lck files and power the VM up.

Friday, July 5, 2013

Decoding/Converting .apk Files to Source Code

Procedure for decoding .apk files: a step-by-step method

* This article is written by a guy code named "prankul garg" in stackoverflow.com.

Step 1:

Make a new folder and put .apk file in it (which you want to decode). Now rename the extension of this.apk file to .zip (eg.: rename from filename.apk to filename.apk.zip) and save it. Now you get classes.dex files, etc. At this stage you are able to see drawable but not xml and java files, so continue.

Step 2:

Now extract this zip apk file in the same folder (or NEW FOLDER). Now download dex2jar from this linkhttp://code.google.com/p/dex2jar/ and extract it to the same folder (or NEW FOLDER). Now open command prompt and change directory to that folder (or NEW FOLDER). Then write dex2jar classes.dex and press enter. Now you get classes.dex.dex2jar file in the same folder. Then download java decompiler from http://java.decompiler.free.fr/?q=jdgui and now double click on jd-gui and click on open file. Then open classes.dex.dex2jar file from that folder. Now you get class files and save all these class files (click on file then click "save all sources" in jd-gui) by src name. At this stage you get java source but the xml files are still unreadable, so continue.

Step 3:

Now open another new folder and put these files
  1. put .apk file which you want to decode
  2. download apktool v1.x AND apktool install window using google and put in the same folder
  3. download framework-res.apk file using google and put in the same folder (Not all apk file need framework-res.apk file)
  4. Open a command window
  5. Navigate to the root directory of APKtool and type the following command: apktool if framework-res.apk
  6. apktool d "fname".apk ("fname" denotes filename which you want to decode)
now you get a file folder in that folder and now you can easily read xml files also.

Step 4:

It's not any step just copy contents of both folder(in this case both new folder)to the single one
and now enjoy with source code...


Friday, June 14, 2013

SpudSoft Excel Emitter - Single Sheet with No Repeating Header and Page Break Interval Zero/ 0 (Java)

I came across using BIRT (Business Intelligence and Reporting Tools), which is an open source Eclipse-based reporting system that integrates with your Java/Java EE application to produce compelling reports.

It has emitters that are used to export the reports to differnet formats such as HTML, PDF, and Office and OpenOffice formats including Excel (xls : 2003 and xlsx: 2007).

When using BIRT's Excel Emitter, it is good to export to a single sheet but it cannot export charts and diagrams. So, I had to use a different emitter.

There are various extended emitters of BIRT. Among which SpudSoft is the one which is recommend by senior programmers.

Tuesday, June 4, 2013

Android Code Zone: Setting a button to disabled and changing the color

Setting a button to disabled and changing the color

In drawable folder, create an xml file called button_disabled.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">   
 <solid android:color="@color/silver"/>
<corners
   android:bottomRightRadius="20dp"
   android:bottomLeftRadius="20dp"
   android:topLeftRadius="20dp"
   android:topRightRadius="20dp"/>
</shape>

Andorid Code Zone: findViewById returns null

If  findViewById returns null,

you are probably callingfindViewById before calling setContentView.
If that's the case, try callingfindViewById AFTER calling setContentView like:

setContentView(R.layout.home);

try {

runOnUiThread(new Runnable() {

@Override
public void run() {

((Button) findViewById(R.id.my_button)).setVisibility(View.GONE);
}
});
} catch (Exception e) {

Toast.makeText(Home.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}