Friday, September 25, 2015

Command execution duration in Windows

Do this:
cmd /E /C "prompt $T$$ & echo.%TIME%$ & COMMAND_TO_MEASURE & for %Z in (.) do rem."

Thursday, July 2, 2015

Time lapse: CentOS 7 on top of VMWare Workstation 11

This irritating and nerve-racking time lapse... can be overridden by using ntp which is not installed by default. Easy, just install ntpd and enable it by default.

 yum install -y ntpd  
 systemctl enable ntpd  
 tzselect  
 systemctl start ntpd  

Wednesday, June 17, 2015

Set Java version to Oracle Java

Here it is. first install JDK or JRE from oracle download page.
Then use these commands:

 /usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 2 \  
 --slave /usr/bin/javac javac /usr/java/default/bin/javac \  
 --slave /usr/bin/javadoc javadoc /usr/java/default/bin/javadoc \  
 --slave /usr/bin/jar jar /usr/java/default/bin/jar \  
 --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool \  
 --slave /usr/bin/orbd orbd /usr/java/default/bin/orbd \  
 --slave /usr/bin/pack200 pack200 /usr/java/default/bin/pack200 \  
 --slave /usr/bin/rmid rmid /usr/java/default/bin/rmid \  
 --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry \  
 --slave /usr/bin/servertool servertool /usr/java/default/bin/servertool \  
 --slave /usr/bin/tnameserv tnameserv /usr/java/default/bin/tnameserv \  
 --slave /usr/bin/unpack200 unpack200 /usr/java/default/bin/unpack200  

Then activate the configuration:
 /usr/sbin/alternatives --config java  

Thursday, May 28, 2015

Mouse is jumpy in Fedora 22 guest under VMWare 11

Yeah... So this happenned and I stumbled upon this piece of treasure:

Add this to the vmx file

 usb.generic.allowHID = "TRUE"  
 mouse.vusb.enable = "TRUE"  
 mouse.vusb.useBasicMouse = "FALSE"  

Wednesday, April 22, 2015

MotionEvent and Multitouch on Android

Excerpt from this stackoverflow post:

Android thinks about touch events in terms of gestures. A gesture in this sense includes all events from the first finger that touches the screen to the last finger that leaves the screen. A single gesture's entire event sequence is always sent to the same view that was picked during the initial ACTION_DOWN unless a parent intercepts the event stream for some reason. If a parent intercepts a child's event stream, the child will get ACTION_CANCEL.
If you're working with multitouch events, always use the value returned by getActionMasked() to determine the action. If you don't need multitouch or are working with an older platform version, you can ignore the ACTION_POINTER_* events.
  • ACTION_DOWN is for the first finger that touches the screen. This starts the gesture. The pointer data for this finger is always at index 0 in the MotionEvent.
  • ACTION_POINTER_DOWN is for extra fingers that enter the screen beyond the first. The pointer data for this finger is at the index returned by getActionIndex().
  • ACTION_POINTER_UP is sent when a finger leaves the screen but at least one finger is still touching it. The last data sample about the finger that went up is at the index returned by getActionIndex().
  • ACTION_UP is sent when the last finger leaves the screen. The last data sample about the finger that went up is at index 0. This ends the gesture.
  • ACTION_CANCEL means the entire gesture was aborted for some reason. This ends the gesture.

Saturday, February 21, 2015

Server installation notes

Install needed software
 yum install httpd  
 yum install mariadb-server  
 yum install php-ldap php-mysql php-mbstring  

Configure service startup and start them
 systemctl enable httpd  
 systemctl start httpd
 systemctl enable mariadb  
 systemctl start mariadb  

Configure mariadb(mysql)
 mysql_secure_installation  

Setup fully qualified host name
Edit /etc/hosts and add this line:
<ip> <FQHN>
example: 10.0.0.27  srv.khodemoon.com
It's not necessary for the specified name to be valid. Take it easy with naming.

Configure Apache
Edit /etc/httpd/conf/httpd.conf:
If you want apache to listen only on one network interface change Listen:80 directive (around line 130)
Change mail address for server owner: around line 235: ServerAdmin root@localhost
Change server name: directly below the server owner email: ServerName

Start Apache
 systemctl restart httpd

Open ports
firewall-cmd --add-port --permanent 80/tcp
firewall-cmd --add-port 80/tcp
firewall-cmd --add-port --permanent 443/tcp
firewall-cmd --add-port 443/tcp

Tuesday, January 13, 2015

Android's different structure to manage the UI

With Android, Google implemented its very own UI component model, introducing various new terms and concepts probably unfamiliar to most developers. Although well designed and powerful, it is unconventional, has a high learning curve and, in some respects, lacks sufficient documentation. Basic use cases may be quick to implement, but in order to develop more complex applications, a thorough understanding of Android’s UI component model is essential.
To better understand this structure, I advise this awesome blog.

Sunday, January 11, 2015

Recompile with -Xlint:unchecked

Got a warning from lint and don't know how to view it?
add these to app/build.grade folder under AndroidStudio:
 gradle.projectsEvaluated {  
   tasks.withType(JavaCompile) {  
     options.compilerArgs << "-Xlint:unchecked"  
   }  
 }  

Wednesday, January 7, 2015

Rolekit On Fedora

What is RoleKit? Why the big deal on Fedora release about it?

Take a look at this awesome article. This will start it up for you.
In my opionion, this should have been done long, long time ago...
Absence of functioning, easy to use tools like this was the most important reason for the saying "Fedora is not for servers."

The misunderstood firewalld

I love it. Its exactly what I was NOT expecting for!

Fallback

First of all, those who can't wait to shred this tech by moving back to iptables, can use these commands and get out of here:

 yum install iptables-services  
 systemctl mask firewalld.service  
 systemctl enable iptables.service  
 systemctl enable ip6tables.service  


A basic introduction

Now for us loyal fans of bleeding edge, cut throat technologies!

What is it? Why the good old iptables is dropped in favor of this new tech in Fedora?
  • The previous firewall system required a reload to mirror any change.
  • It was primarily based on chains and rules.
  • IMHO Switches to the command line program was hard :D

This new tech is exactly the opposite:
  • No change requires a complete firewall restart.
  • Its primarily based on zones and services.
  • Switches on the command line are sweeeeeeet :D

The underlying system is different and it works in another way. The idea is that connections and packets are filtered on the definition of zones. Each zone is subset of policies to control packets. Each network adapter is assigned a zone and behaves by the zone's rules. Take a look at the default zone legend below which is excerpted from fedoraproject.org.

zone:drop
Any incoming network packets are dropped, there is no reply. Only outgoing network connections are possible.

zone:public
For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

zone: work
For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

zone: home
For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

zone: internal
For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.

zone: trusted
All network connections are accepted.

 

Fun part

Got the idea? Now lets move on to another subject. Services! A service a combination of a port, protocol and possible firewall module executable to load. I'm not an administrator and I have not yet felt the need to go further on this subject. (Consider the fact that I'm lazy...)


How to open up a port?

 firewall-cmd --add-port 7777/tcp
This will not be permanent. Once the system is reset or the firewall is reloaded, this is lost.

How to open up a port permanently?

 firewall-cmd --permanent --add-port 7777/tcp

How to revert all temporary changes?

 firewall-cmd --reload  

How to revert all permanent changes?

 firewall-cmd --complete-reload  

Tuesday, January 6, 2015

Migrate from SVN to GIT

I wanted to convert an SVN repository to a git repository. Well I found this note, It may be of help to everyone. It was really good and simple ;)

http://john.albin.net/git/convert-subversion-to-git