Archive for Uncategorized

ConBee 2 firmware upgrade on Ubuntu

Requirements:

Installed Deconz software. Downloadable, here: http://deconz.dresden-elektronik.de/ubuntu/stable/

Download the lates firmware from here:

http://deconz.dresden-elektronik.de/deconz-firmware/?C=M;O=D
(deCONZ_ConBeeII_0x)

Stop all services:

$ sudo systemctl stop deconz && sudo systemctl stop deconz-gui

Stop ModemManager if it is installed:

$ sudo systemctl stop ModemManager

Update the firmware:

sudo GCFFlasher_internal -t 60 -d /dev/ttyACM0 -f <LOCATION_OF_THE FIRMWARE_IMG>/deCONZ_ConBeeII_0x1234567.bin.GCF

src: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually

Unuable Remmina with squares as characters

I use Ubuntu 20.04 and sometime remmina makes me a joke….

If you start remmina, and you see like this:

remmina uses squares like on that pics

Try this:

rm -rf ~/.cache/fontconfig && sudo fc-cache -r -v

Acutally, it resolves me the problem.

Hassio with supervisor on Gentoo by docker

Supervisor, first start

Docker pull:

docker pull homeassistant/qemux86-64-homeassistant:landingpage

Than, start it:

docker run -d --name hassio_supervisor \
--privileged \
--security-opt apparmor:unconfined \
--security-opt seccomp=unconfined \
-v /run/docker.sock:/run/docker.sock \
-v /run/dbus:/run/dbus \
-v "/opt/hassio/data":/data \
-e SUPERVISOR_SHARE="/opt/hassio/data" \
-e SUPERVISOR_NAME=hassio_supervisor \
-e HOMEASSISTANT_REPOSITORY="homeassistant/qemux86-64-homeassistant" \
homeassistant/amd64-hassio-supervisor:224

Linux Desktop experiences

DRAFT

A long-long years ago (til 2007) I used linux as desktop (Gentoo exactly).

After, the windows 7 and the 10 also will be a very-very good PC OSs.

BUT I tried the Ubuntu 20.04, and it seems work wine from 1 month at my 2in1 PC with WWAN card (DELL 7390).

I would like to collect some useful programs which I found very userful, fast and maintined (actually).

Program typeLinux programWindows alternative
(what I liked to use)
Screenshot maker and editorFlameshotGreenshot
Clipboard managerCopyQDitto
LauncherULauncherLaunchy
File managerDouble CommanderTotal Commander
SSH session managerRemminaKitty
VNC session managerRemminaUltraVNC
RDP session managerRemminaRDCman (discontinued)

mdadm raid 5 all disk became spare

After an irregular restart, the raid 5 array became unreachable. D’oh!

# cat /proc/mdstat

$ cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md3 : inactive sdd3[3](S) sde3[4](S) sdf3[6](S) sdg3[5](S)
      6546850144 blocks super 1.2

As you can see all sd[cdefg]2 partitions are (S)pare.

First, we had to stop the array:

# mdadm --stop /dev/md3

and after we have to reassamle the array:

# mdadm --assemble /dev/md3 /dev/sdc3 /dev/sdd3 /dev/sde3 /dev/sdf3 /dev/sdg3 --verbose

After, we have to see like this:

$ mdadm --assemble /dev/md3 /dev/sdc3 /dev/sdd3 /dev/sde3 /dev/sdf3 /dev/sdg3 --verbose
mdadm: looking for devices for /dev/md3
mdadm: Fail create md3 when using /sys/module/md_mod/parameters/new_array
mdadm: /dev/sdc3 is identified as a member of /dev/md3, slot 0.
mdadm: /dev/sdd3 is identified as a member of /dev/md3, slot 2.
mdadm: /dev/sde3 is identified as a member of /dev/md3, slot 3.
mdadm: /dev/sdf3 is identified as a member of /dev/md3, slot -1.
mdadm: /dev/sdg3 is identified as a member of /dev/md3, slot 1.
mdadm: added /dev/sdg3 to /dev/md3 as 1
mdadm: added /dev/sdd3 to /dev/md3 as 2
mdadm: added /dev/sde3 to /dev/md3 as 3
mdadm: added /dev/sdf3 to /dev/md3 as -1
mdadm: added /dev/sdc3 to /dev/md3 as 0
mdadm: /dev/md3 has been started with 4 drives and 1 spare.

cool part of it:

mdadm: /dev/md3 has been started with 4 drives and 1 spare.

let’s check the result:

$ cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] 
md3 : active raid5 sdc3[0] sdf3[6](S) sde3[4] sdd3[3] sdg3[5]
      4910137344 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
      bitmap: 0/13 pages [0KB], 65536KB chunk

And it done, huh ūüôā

Move ‚ÄúShow Applications‚ÄĚ right to left of the Dock in Ubuntu

When I installed new Ubuntu 18.04, first thing I have my mind is to move the Dock at botton. I was very happy to see that Ubuntu 18.04 is already provided that option, to enable this you need to go to setting > Dock and then ‚ÄúPosition of screen‚ÄĚ to bottom.

Yessss, it works.

Image for post

After this one more thing I noticed is ‚ÄúShow applications‚ÄĚ is showing at the right side of the Dock but I like it on the left (Event in old versions and mac/ windows its in left). I tried to search in google but nothing found so I thought of writing a notes about it. And finally, I got it working so I thought it will be good to share it with everyone.

Here is the command you need to run for this

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true

Yayyy, its working.

1*AbDjQvjx30Du4QBoNrHegg.png (700√ó31)

And of course, to back set it false:

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top false

src: https://medium.com/@suneel.omrey/move-show-applications-right-to-left-of-the-dock-in-ubuntu-18-04-9592dfd18c9a

Win 10 set default editor

1. Start the registry editor (regedit.exe) and select HKEY_CLASSES_ROOT.

2. Press Ctrl + F to open the Find dialog.

Image

3. Type systemfileassociations, enable “Keys” and deselect “Values” and “Data” check boxes.

4. Press ENTER.

You’ll now be taken to the HKEY_CLASSES_ROOT\SystemFileAssociations branch.

Expand the “SystemFileAssociations” branch by double-clicking on it
Scroll down until you see a subkey named “image”
Double-click “image”

Double-click “shell”

Double-click “edit”

Double-click “command”

src: https://answers.microsoft.com/en-us/windows/forum/windows_10-files-winpc/change-default-image-editor/4b01b777-338f-49c1-8300-9bcd7f60c160

IDEA linux – import module hanging

I tried IDEA on linux. OF course, It started with gooling ūüėÄ

I tried to import the modules, but hanged… (on a freshly created project, with import maven modules)

 

The resolution was:

File -> invalidate caches and restart

src: https://stackoverflow.com/questions/47626478/intellij-idea-stucked-on-loading-project-screen

Disabling UPS beep under Linux

But it will take about 3-5 minutes to make all the setup under Linux properly. We need to run a upscmd at last, but there are a few steps before that.

  • First of all, install¬†nut¬†package:
$ sudo apt install nut
  • Append following lines to¬†/etc/nut/ups.conf¬†according to your ups device (descparameter not important, you don‚Äôt need to give correct brand name either but the given section name will be used later to identify configured ups device, we‚Äôre using¬†eaton¬†as config section name here):
[eaton]
driver = usbhid-ups
port = auto
desc = "Eaton 5E"
  • Now start the upsdriver with¬†upsdrvctl:
$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
  • Run upsc command the get beeper status:
$ upsc eaton ups.beeper.status
enabled
  • We‚Äôre so close, now append following lines to¬†/etc/nut/upsd.users, change the username admin or password as you want:
[admin]
password = "test1234"
actions = SET
instcmds = ALL
  • Reload¬†upsd¬†with the new users config:
$ sudo upsd -c reload
  • You can query the list of the commands which will be supported by your ups device with the¬†upscmd:
$ upscmd -l eaton
Instant commands supported on UPS [eaton]:

beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
shutdown.stop - Stop a shutdown in progress
  • As you can see, there is a command named¬†beeper.disable¬†and we‚Äôll be execute this command (give the username and password which we configured just before):
$ upscmd eaton beeper.disable
Username (root): admin
Password: 
OK
  • Now check the beeper status again:
$ upsc eaton ups.beeper.status
disabled

That’s it. It takes some time but your ears will be happy.

 

src: https://linux-tips.com/t/disabling-ups-beep-under-linux/592

Apache CXF Without spring

I found a very good blog post about that topic, here: http://chathurangat.blogspot.com/2014/02/apache-cxf-first-jax-ws-soap-web.html

I copied there, to be here also for the future:


Apache CXF First JAX-WS (SOAP Web Service) Example (CXFNonSpringServlet)

The most of the people think that the Apache CXF supports only to develop Spring based Web Services. this is NOT true. is supports to build both Spring based and Non spring based web services.
1.¬†CXFServlet¬†–¬† this will support for the Spring based web services.
2.¬†CXFNonSpringServlet¬†–¬† this will support for the non spring web services.the purpose of this article is to demonstrate how to develop non spring based web service with Apache CXF. i have already developed and¬† tetsed the service with SoapUI. i am just sharing the source code for your reference.the project structure looks as below.,

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.chathurangaonline.apache.csf.jax.ws.samples</groupId>
    <artifactId>apache-cxf-jaxws-sample</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>apache-cxf-jaxws-sample Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <cxf.version>3.0.4</cxf.version>
    </properties>
 
    <dependencies>
 
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
 
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
 
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>compile</scope>
        </dependency>
 
    </dependencies>
    <build>
        <finalName>apache-cxf-calculator-service</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!--compiles with java 7-->
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <!--WAR plugin-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.5</version>
            </plugin>
        </plugins>
    </build>
</project>

 

CalculatorService.java

the following is the Service Endpoint Interface(SEI).

package com.chathuranga.apache.cxf.jax.ws.samples;
 
import javax.jws.WebMethod;
import javax.jws.WebService;
 
/**
 * <p>
 *     SEI
 * </p>
 * @author Chathuranga Tennakoon / www.chathurangaonline.com
 */
@WebService
public interface CalculatorService {
 
    @WebMethod
    double addNumbers(double num1,double num2);
}

 

CalculatorServiceImpl.java

the following is the Service Implementation Bean (SIB)

package com.chathuranga.apache.cxf.jax.ws.samples.impl;
 
import com.chathuranga.apache.cxf.jax.ws.samples.CalculatorService;
import javax.jws.WebMethod;
import javax.jws.WebService;
 
/**
 * <p>
 *     SIB for {@link com.chathuranga.apache.cxf.jax.ws.samples.CalculatorService}
 * </p>
 * @author Chathuranga Tennakoon / www.chathurangaonline.com
 */
@WebService
public class CalculatorServiceImpl implements CalculatorService {
 
    @WebMethod
    public double addNumbers(double num1, double num2) {
        return num1 + num2;
    }
}

 

AppCXFNonSpringServletImpl.java

the custom implementation for the CXFNonSpringServlet.

package com.chathuranga.apache.cxf.jax.ws.samples.impl;
 
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
import javax.servlet.ServletConfig;
 
/**
 * <p>
 *    Application Specific Custom Implementation for the {@link org.apache.cxf.transport.servlet.CXFNonSpringServlet}
 * </p>
 * @author Chathuranga Tennakoon / www.chathurangaonline.com
 */
public class AppCXFNonSpringServletImpl extends CXFNonSpringServlet{
 
    @Override
    public void loadBus(ServletConfig servletConfig){
        super.loadBus(servletConfig);
        ServerFactoryBean factory = new ServerFactoryBean();
        factory.setBus(bus);
        factory.setServiceClass(CalculatorServiceImpl.class);
        factory.setAddress("/calcService");
        factory.create();
    }
}

 

web.xml

<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 
    <display-name>Archetype Created Web Application</display-name>
    <servlet>
        <servlet-name>AppCXFNonSpringServlet</servlet-name>
        <servlet-class>com.chathuranga.apache.cxf.jax.ws.samples.impl.AppCXFNonSpringServletImpl</servlet-class>
    </servlet>
 
    <servlet-mapping>
        <servlet-name>AppCXFNonSpringServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

Source code can be downloaded at :- https://github.com/chathurangat/apache-cxf-jax-ws-first-service

Chathuranga Tennakoon
www.chathurangaonline.com
chathuranga.t@gmail.com