Job with LEGO + IT, what else I can asked for
?
Monday, December 2, 2019
Thursday, November 28, 2019
Connecting Oracle with Python via cx_Oracle extension
Installation Prerequisites
- Python 2.7, 3.5 or above
- Oracle Client / Oracle Instant Client "Basic" or "Basic Light"
- libaio / libaio1 package
Installation Reference
Sample Python Code
import cx_Oracle
# Make DSN address. Real values for host address, port and service name were replaced by '<>'.
dsn = cx_Oracle.makedsn('<host_address>', '<port>', service_name='<service_name>')
# Connect to DSN
orcl = cx_Oracle.connect(user='<username>', password='<password>', dsn=dsn)
# Get cursor
cursor = orcl.cursor()
# Execute SQL statement
cursor.execute('<SQL SELECT STATEMENT>')
# Fetch result
data = cursor.fetchone()
Friday, November 22, 2019
Sending F10 in Ubuntu Terminal
By default, you just can't send F10 to Ubuntu Terminal's curses program. This is because F10 is being captured by Terminal.app already.
A quick workaround is to use "ESC 0" to simulate sending F10 inside Terminal.app.
Reference
A quick workaround is to use "ESC 0" to simulate sending F10 inside Terminal.app.
Reference
Tuesday, November 19, 2019
Customized Dash (Launcher / Taskbar) Icon in Ubuntu
To customize application icon in Ubuntu:
- Create a .desktop file in ~/.local/share/applications/
e.g. /home/user/share/applications/<application name>.desktop - Add the following content to the desktop file
[Desktop Entry]Done!
Encoding=UTF-8
Version=1.0
Type=Application
Name=ApplicationName
GenericName=ApplicationName
Icon=/home/user/application-icon.png
Exec=/home/user/application/application-executable
Categories=Category;Subcategory
Thursday, October 31, 2019
Removing unused packages in Linux
To remove unused packages in Linux, we will use the following software:
- deborphan
- gtkorphan (GUI based)
- rpmorphan
References
Wednesday, October 30, 2019
Deleting files specified in a text based file list
To delete a list of files specified in a text based file list, do the following:
Reference:
https://superuser.com/questions/355584/how-to-delete-files-from-a-folder-using-a-list-of-file-names-in-windows
> for /f %i in (files_to_delete.txt) do del %i
Reference:
https://superuser.com/questions/355584/how-to-delete-files-from-a-folder-using-a-list-of-file-names-in-windows
Export text based file list for the difference between 2 directories (Windows version)
The following is a tutorial for exporting a text-based file list showing the difference between 2 directories (e.g. D:\DirA, D:\DirB):
Step 1: Create a text-based file list for both directories
Step 2: Use WinMerge to get the difference between the 2 file lists:
Step 1: Create a text-based file list for both directories
> cd D:\DirA
> dir /s /b /a:-d > file-list-dir-a.txt
> cd D:\DirB
> dir /s /b /a:-d > file-list-dir-b.txt
Step 2: Use WinMerge to get the difference between the 2 file lists:
Note: To display difference only, you need to set "View > Diff Context > 0 Lines".
Step 3: Copy the difference from WinMerge and create a text file to store it.
Ubuntu dock shows applications in current workspace only
In Ubuntu dock, to show applications in current workspace only, run the following command:
$ gsettings set org.gnome.shell.extensions.dash-to-dock isolate-workspaces true
References
$ gsettings set org.gnome.shell.extensions.dash-to-dock isolate-workspaces true
References
Thursday, October 24, 2019
Running Springboot web app in IntelliJ Idea Community Edition
When you run your springboot application in IntelliJ idea Community Edition having the following error, you can try the solution below to solve the problem.
Error "Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer"
If your "pom.xml" has dependency with "provided" scope, you may have trouble when running your application in IntelliJ Idea Community Edition.
Some suggests that you can change the scope from "provided" to "compile". Here is another solution for this issue:
In your "Run/Debug Configurations", check "Include dependencies with 'Provided' scope". Then you can run the application from IntelliJ Idea Community Edition.
Error "Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer"
If your "pom.xml" has dependency with "provided" scope, you may have trouble when running your application in IntelliJ Idea Community Edition.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
Some suggests that you can change the scope from "provided" to "compile". Here is another solution for this issue:
In your "Run/Debug Configurations", check "Include dependencies with 'Provided' scope". Then you can run the application from IntelliJ Idea Community Edition.
Wednesday, October 2, 2019
Image bytes to np array in Python
For reference:
# data - image bytes
im = Image.open(BytesIO(data))
I = numpy.asarray(im)
print("I type:", type(I), "I shape:", I.shape)
>> I type: <class 'numpy.ndarray'> I shape: (512, 512, 3)
# data - image bytes
im = Image.open(BytesIO(data))
I = numpy.asarray(im)
print("I type:", type(I), "I shape:", I.shape)
>> I type: <class 'numpy.ndarray'> I shape: (512, 512, 3)
Subscribe to:
Posts (Atom)
Upgrade nodejs in conda (from v18 to v26)
If your conda env is nodejs v18, doing a conda install nodejs=26 is likely to create a lot of conflict. Consider remove those conflicting p...
-
When Office2003 couldn't find file SKU011.CAB: regedit -> [HKEY_LOCAL_MACHINE] -> [SOFTWARE] -> [Microsoft] -> [Office] -...
-
The resolution can be changed by editing the BlueStack's registry: HKLM\SOFTWARE\BlueStacks\Guests\Android\FrameBuffer\0\Height and ...
-
Suppose you got a file in Big5 containing some HKSCS characters (e.g. 深水埗, 赤鱲角, etc). When your environment (Ref: Charset.defaultCharset( ) ...


