Useful Linux Script: Eject disk from desktop icon

This script should be executable and on Desktop.

#!/bin/bash
#eject cd or dvd disk from the disk drive

eject /dev/sr0

 

Advertisements

Change screenshot file format png to jpg on Ubuntu

Open “dconf-editor”

 

navigate to org > gnome > gnome-screenshot and change the default-file-type png to jpg.

 

“dconf editor” is available for installation in the ubuntu software center

from StackOverFlow

https://askubuntu.com/questions/128855/how-to-save-screenshots-as-jpg-automatically

Starting Android Programming: Android Studio Run Configuration Error

androidprog.jpg

Gotta this error message from Android Studio when started android programming for the first time.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) at org.gradle.api.internal.

From the solvent start, set proper path of JDK was effective.
I also downloaded other SDK version for each Android version.

 

Other error message.

Edit Configuration: Error Please select Android SDK

I Logged in to Google Account

Installed many SDK versions and Tools from SDK Manager icon on Android Studio.

Right upper icon on Android Studio – Project settings (icon) > change JDK to /usr/lib/jvm/1.8

I guess my case was cause of JVM path.
Perhaps SDK was only latest one, I downloaded even the oldest one.
It expanded to 11.9GB…

Screenshot from 2018-12-05 12-58-07.jpg

Solved this !!!

 

Next execute on my tablet.
http://cg.hatenadiary.jp/entry/2015/01/02/185636

My Ubuntu didn’t recognize my tablet.

installed adb

make sure the tablet’s

developer options > usb debugging on

Use sudo usermod -aG plugdev $LOGNAME to add yourself to the plugdev group about adb command.

cd to ..

masa@em-p:~/Android/Sdk/platform-tools$ ./adb devices
List of devices attached
adb server version (32) doesn’t match this client (40); killing…
* daemon started successfully

Changed cable.
restart tablet and ubuntu resolved this.
Often usb debugging mode is don’t know why..

androidProg2

Windows Administrating: Install OpenJDK 1.8

To begin from the result had to uninstall old Oracle jdk (1.6) to use Openjdk 1.8 because of priority problem I guess. But it made can’t open jar file by double click the file…

So if you will, take responsibillity…

Today I installed Eclipse Oxygen to clean installed Windows 7 on NEC LaVie laptop which I call “dee-jay” because this is for Traktor DJ.

And when lauching Eclipse it said like “Need newer JDK than 1.6”.
So I downloaded the source from here.
https://jdk.java.net/java-se-ri/8

Here I heard “Windows i586” for the first time.
But it was not problem so. Just CPU architecture (guess old).

After downloaded the zip extracted to “Program Files” directory.
And added the path to “Environmental Variables”.
But it kept using 1.6 JDK.
Configuring “JAVA_HOME” environment variable was not effective too.

Finally I uninstalled old “Oracle JDK 1.6” from the “Control Panel” > “Uninstall Softwares”.
This was great. 1.6 jdk was at “System32” directory whereis high priorities.

I used

start — this start programs in the search path.
path — this displays path variable values.
(setx path “%path%; this is useful to set path variable)

commands on Command prompt.

And now fighting to Clone git repository on eclipse LoL.

Installing Qtractor: Made a lots errors

qtractor installing a lots errros.

My case it needed

sai means “sudo apt-get install”

 

ERROR MESSAGE1
*checking for Qt library version >= 5.1… no; Qt 5.1 or greater is required

-> sudo apt-get install qt5-default

 

ERROR MESSAGE2
*configure: error: *** SNDFILE library not found.

-> sai -libsndfile-dev

 

ERROR MESSAGE3
checking for qmake-qt5… no
configure: error: qmake-qt5 not found in current PATH. Maybe QT development environment isn’t available. (qt5-devel)

->sudo apt-get install qt5-qmake

Next I tried below commands but don’t know was necessary.

{-> sai qtchooser

->export QT_SELECT=5}

Next

-> sudo apt-get install qt5-default

 

next

ERROR MESSAGE4
checking for sndfile… no
configure: error: *** SNDFILE library not found.

-> sai -libsndfile-dev

 

next

ERROR MESSAGE5
Project ERROR: Unknown module(s) in QT: x11extras

 

->apt-cache search libqt5x11extras

->sai libqt5x11extras5-dev

solved
And then, did
“sudo make” and “sudo make install”
ERROR MESSAGE5
lupdate: could not exec ‘/usr/lib/x86_64-linux-gnu/qt5/bin/lupdate’: No such file or directory

->sudo apt-get install qttools5-dev-tools

FINISHED😃

 

qtractor

 

Ubuntu: Package broken error

My ubuntu couldn’t update because of linux-header missing.

To tell the result, “sudo apt-get clean, update, upgrade” solved this problem.

upgrade called grub install prompt, so perhaps avoiding this is better.

Below is just memo.

Package Broken

Check if you are using third party repositories. If so disable them, since they are a common source of problems.

Furthermore run the following command in a Terminal: apt-get install -f

Transaction failed: The package system is broken

The following packages have unmet dependencies:
linux-headers-4.4.0-139-generic: Depends: linux-headers-4.4.0-139 but it is not installed

linux-headers-4.4.0-139-lowlatency: Depends: linux-headers-4.4.0-139 but it is not installed

-f option of apt-get install  is  ( -f, –fix-broken)

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running
APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system’s dependency structure can be so corrupt as to require manual intervention (which usually means using dpkg –remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations. Configuration Item:
APT::Get::Fix-Broken.

Is linux-header api of c?

error message of desktop icon:
Error
Broken count > 0.

Error message of “sudo apt-get install linux-headers-4.4.0-139”

masa@em-p:~$ sai linux-headers-4.4.0-139
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
linux-headers-4.15.0-34 linux-headers-4.15.0-34-generic linux-headers-4.4.0-137 linux-headers-4.4.0-137-lowlatency
linux-headers-4.4.0-138-generic linux-image-4.15.0-34-generic linux-image-4.4.0-137-lowlatency
linux-modules-4.15.0-34-generic linux-modules-extra-4.15.0-34-generic
Use ‘sudo apt autoremove’ to remove them.
The following NEW packages will be installed:
linux-headers-4.4.0-139
0 upgraded, 1 newly installed, 0 to remove and 22 not upgraded.
42 not fully installed or removed.
Need to get 0 B/10.1 MB of archives.
After this operation, 71.0 MB of additional disk space will be used.
(Reading database … 486606 files and directories currently installed.)
Preparing to unpack …/linux-headers-4.4.0-139_4.4.0-139.165_all.deb …
Unpacking linux-headers-4.4.0-139 (4.4.0-139.165) …
dpkg-deb (subprocess): cannot copy archive member from ‘/var/cache/apt/archives/linux-headers-4.4.0-139_4.4.0-139.165_all.deb’ to decompressor pipe: failed to read (Input/output error)
dpkg-deb (subprocess): decompressing archive member: lzma error: unexpected end of input
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-139_4.4.0-139.165_all.deb (–unpack):
cannot copy extracted data for ‘./usr/src/linux-headers-4.4.0-139/arch/mips/include/asm/octeon/cvmx-npi-defs.h’ to ‘/usr/src/linux-headers-4.4.0-139/arch/mips/include/asm/octeon/cvmx-npi-defs.h.dpkg-new’: unexpected end of file or stream
Errors were encountered while processing:
/var/cache/apt/archives/linux-headers-4.4.0-139_4.4.0-139.165_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

“sudo apt-get clean” (clear cache)

“sudo apt-get update” and “sudo apt-get upgrade”

resolved this.

Writing “sleep or suspend script” for JACK and qjackctl

JACK is weak for suspend because it needs to be stopped and restarted when come back from suspend. So I’m trying to write suspend script which stop JACK before go to suspend mode and start after come back from sleep.

First stop and start qjackctl command is below.

dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop

 

dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start

 

Now I have very simple script that very useful when come back from suspend mode because it stop and restart qjackctl automatically. That is

#!/bin/bash
dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop && dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start

Actually this is enough useful. Lol. But I will try to make better one.

It use

sudo pm-suspend

command. The problem is needs sudoers configuration to use pm-suspend command.
Without this “sudo pm-suspend” in bash shell script won’t do anything.

sudo -S pm-suspend

will work, it receives password from a terminal and will suspend.
And this is almost perfect except for security problem

password='Hacker\'s password'
echo $password | sudo -S pm-suspend

It won’t require to input password interactively.

#!/bin/bash
#Suspend script for JACK(qjackctl)
#First stop JACK and go to suspend
dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop
password='********'
echo $password | sudo -S pm-suspend

Then, this should be assigned with hot key on GUI manager on Ubuntu.

And I guess restart script is harder because I should research mechanism and the script path which automatically done when return from suspend mode.

My plan was logging about sudoers configuration but now I think i can go with this.

I will write again soon. Bye.😀

 

 

 

jarコマンドによる実行可能Jarの作成

 

 

jar

オプション

c JARファイルの作成
f ファイル名の決定
v 内容のリストをverboseモードで
m   マニフェストファイルから値と名前を特定する
-C はfileオペランドで指定されたファイルを処理する際にディレクトリが一時的に変更される

 

参考
https://docs.oracle.com/javase/jp/8/docs/technotes/tools/unix/jar.html
https://docs.oracle.com/javase/jp/8/docs/technotes/guides/jar/jar.html

 

この時のディレクトリ・ファイル構成

~/Desktop/git/masa-examplesがソースのルートディレクトリ
     applications - JaydlePrototype01.java がメインメソッドを含むクラス
     practice - IOMethods.java  がメインクラスで使った依存するクラス

 

まず~/Desktop/git/にJaydleBuildディレクトリを作成
~/Desktop/git/masa-examplesから以下のコマンドを実行

 

javac -d ../JaydleBuild/ applications/JaydlePrototype01.java 
javac -d ../JaydleBuild/ practice/IOMethods.java

 

これでJaydleBuildディレクトリにクラスファイルができた。

 

masa@em-p:~/Desktop/git/JaydleBuildTest$ tree
.
├── applications
│   └── JaydlePrototype01.class
└── practice
    └── IOMethods.class

2 directories, 2 files

のように、

パッケージのディレクトリが作成されている。

 

次に簡単なマニフェストファイルを同ディレクトリに作成

Manifest-Version: 1.0
Main-Class: applications.JaydlePrototype01

 

そして、さっき作ったクラスファイルとマニフェストファイルをjarコマンドでまとめる。

masa@em-p:~/Desktop/git/JaydleBuildTest$ jar cmf Manifest.txt JaydleJarTest.jar ../masa-examples/

失敗。間違ったJARができた。

 

masa@em-p:~/Desktop/git/JaydleBuildTest$ jar cmf Manifest.txt JaydleJarTest.jar .

これでちゃんと作れた。

Screenshot from 2018-10-21 22-56-14

参考
jar コマンドで実行可能な JAR ファイルを作成する | まくまく Java ノート
http://maku77.github.io/java/jar/executable-jar.html

 

YoutubeのMVの音声を抽出してMP3として保存できます。たぶんLinux環境だと動きます。
https://github.com/iamaturtle113/Jaydle

WindowsとMacでは試してないです。Macなら動くかも?Windowsはターミナルのコマンドがちょっと厳しいか。

注 Youtube-dlコマンドがターミナルから起動できることが条件です。

 

Changing Display Brightness on iMac Ubuntu

Screenshot from 2018-10-20 11-32-35.png

My iMac Ubuntu is hard to change display brightness.

It needs terminal command. By the way have to burn chips again😍 Repair man!

change

/sys/class/backlight/radeon_bl1/brightness

file by text editor or

echo 100 | sudo tee brightness

I was making shell script to do this like

#!/bin/bash
#To change iMac display brightness

echo $1 | sudo tee /sys/class/backlight/radeon_bl1/brightness

But use sudo command in a shell script is pretty hard.

And

sudo "User Command"

results

masa@em-p:/sys/class/backlight/radeon_bl1$ sudo iMacDisplay02.sh 
sudo: iMacDisplay02.sh: command not found

Because of /etc/sudoers .

Recommended edit by visudo.

Tough!!😊

日記:平成30年10月15日月曜日(神無月、先負w)

今日は、吾輩のiMacにMacOSを新規インストールしようと思う。
GPUの故障により、10ヶ月くらい?お蔵入りしていた我が七台目のコンピュータ iMac named “Em-P”(Model A1312 EMC2429)。

リフローと言われる修理方法で復活を遂げて、四ヶ月あまり。
修理自分で分解して行ったけど、それなりに大変だった。メモリ4GBが一枚使えなくなっているし。
こっちもリフローして見る予定。修理に目覚めてから、修理待ち製品が並んでいる。やつらのヤジが聞こえてきそうな気がするくらいだ。w Elektron MachineDrumも、メンテ中に配線切れて、片方からしか音でなくなっていて、基盤に配線工事が必要だし、iPadは電池交換で復活した。大変喜ばしいが、サポート切れていて、iBookが使えねぇし、PDFみる術確立できてねぇ。あとWiiのドライブが壊れて、イジェクトできないやつと、CDコンポのドライブの回転不良も心のどこかでスタックオーバーフロー現象でてる。

って愚痴のような駄文つらねて、すいまソン。

今日は、iMac内蔵ドライブにパーティション作ってあった、”Mac HD Renewal”にMacOSをインスツールするぞ。これで仕切り直し、ただLogicのインスコ、めっちゃ時間かかった記憶がある。。

iMacのドライブもGPUエラーから復活するとき、ごねにごねたんだよね。電源ケーブルさしたまま、メモリ抜いたら一回起動不可になった。しかも結構深くハマって、非常時モードのターミナルから、修復コマンドで1〜2時間格闘した。具体的に言うと、データの修復要請がでて、一度は復活したけど別の本命データは今も修復できない状態で。そっちは、ただ起動しただけでそうなった。あれは忘れもしないサッカーの国際自愛の日。Suchmosがなんか歌ってたな。有料ソフト5千円くらいの使えば治りそうなんだけど。ワンダーシェアとか。フリーのやつはなんか写真用とかが多くて、ファイル名とかフォルダの階層構造とかが復元できない模様。バックアップのファイルとか乱れ並んでいて有限なディスクスペースにどっかり座っちゃっている。ヌリカベや石臼の類。w

ゴシップガールを見ていてフリーズして、そこから再起不能になってしかも私のRSIを電磁波によって蝕み、公園の大地で素足になって消磁とかしてた。