Monthly Archives: March 2015

SQL

Select value from DB table which presents more than one time

duplicates
If you want to see duplicated column values in DB table use next:

 select 
     doc_id,
     count(1)
 from doc_pictures
 group by doc_id
 having count(1) > 1

Thanx to http://stackoverflow.com/a/19635626

JRebel and JBoss integration with WAR file

jreb
You may know about JRebel project. It’s very helpful for development in java world.
The following steps describe how to use JRebel for Web application:

1. Install JRebel plugin for your IDE.

2. Create file descriptor rebel.xml with JRebel plugin in your IDE in WEB-INF\classes folder like:

<?xml version="1.0" encoding="UTF-8"?>
<application 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://www.zeroturnaround.com" 
  xsi:schemaLocation="http://www.zeroturnaround.com 
    http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">

 <classpath>
   <dir name="D:/project/idea/out/production/projectUI">
   </dir>
 </classpath>

 <web>
   <link target="/">
   <dir name="D:/project/src/projectUI/src/main/webapp">
   </dir>
   </link>
 </web>

</application>

3. Add the argument to JBoss AS start script:

-javaagent:C:/Users/UserName/.IntelliJIdea14/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar

Here is the path to jrebel.jar file placed after installation.

4. Deploy your application on JBoss.

5. Change some code and make (recompile) the project.

6. See the changes! Profit!

Thanx, zeroturnaround!

VirtualBox ‘/etc/init.d/vboxdrv setup’ issue after kernel update

vboxkernel
It’s too disturbed to run ‘/etc/init.d/vboxdrv setup’ command after kernel update each time. But how can it be fixed?
Fortunately, way is:

sudo apt-get install linux-headers-`uname -r`
sudo dpkg-reconfigure virtualbox-dkms  
sudo modprobe vboxdrv

So, DKMS package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
Thanx to http://askubuntu.com/a/220778 a lot!

Restart, shutsdown, logoff Windows from command line

cmdprompt
It’s often need to restart, shutsdown, logoff Windows from command line. For example, if you connect to OS via remote desktop protocol you can’t restart/shutdown it from UI.
In such case you can use next:

shutdown -r
restarts os

shutdown -s
shutdown os

shutdown -l
logoff os

shutdown -t xx
where xx is number of seconds to wait till shutdown/restart/logoff

shutdown -i
gives you a dialog box to fill in what function you want to use

shutdown -a
aborts the previous shutdown command....very handy!

Additional options:

-f
force the selected action

Thanx to http://stackoverflow.com/a/162305