Skip to main content

How to Create an Icon (.ico)

· One min read
ひかり
Main bloger
  1. Create an icon.

    How to create an icon

  2. Prepare seven PNG images of sizes 16, 24, 32, 48, 64, 128, and 256. How to create an icon

  3. Create an icon using the convert command. How to create an icon

convert *.png favicon.ico

Creating an Electron App

· One min read
ひかり
Main bloger

Creating the working directory

mkdir test-electron-app
cd test-electron-app

Creating package.json

npm init -y

Installing electron

npm i --save-dev electron

Creating index.js

const { app, BrowserWindow } = require("electron")
const path = require("path")

function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, "preload.js")
}
})

win.loadFile("index.html")
}

app.whenReady().then(() => {
createWindow()

app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})

app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit()
}
})

Creating index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body style="background: white;">
<h1>Hello World!</h1>
<p>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</p>
</body>
</html>

Modifying package.json

Replace the scripts section.

"scripts": {
"start": "electron ."
}

Running the app

npm start

How to make Ruby

· One min read
ひかり
Main bloger

This is a program that returns 3 as an example.

First, write the source code in C.

// three.c
#include <ruby.h>

static VALUE int_three(void){
return INT2NUM(3);
}

void Init_three(void){
rb_define_singleton_method(rb_cInteger, "three", int_three, 0);
}

Create a script to create a Makefile.

# extcof.rb
require 'mkmf'
create_makfile "three"

Make

$ make

Write a Ruby script to call the created program.

# main.rb
require "./three"
p Integer.three

Run

$ ruby main.rb
3

Creating a DLL and compiling with C

· One min read
ひかり
Main bloger

Notes on creating a DLL and compiling C

Library

Source file

// gcd.c
int gcd(int a, int b){
return !b ? a : gcd(b, a % b);
}

Header file

// gcd.h
#ifndef TEST_H
#define TEST_H

int gcd(int a, int b);

#endif

Program

#include <stdio.h>
#include "gcd.h"

int main(void){
printf("%d\n", gcd(24, 36));
}

Compilation

Creating the DLL

gcc gcd.c -shared -o gcd.dll

Compile

gcc main.c -lgcd -L.

unity-terrain-shimabara

· One min read

-- title: Generating Realistic Terrain in Unity authors: hikari

I tried creating realistic terrain in Unity.

Created based on satellite imagery and elevation data from the Geospatial Information Authority of Japan.

Unity Shimabara Peninsula

Next, I'd like to create Kyushu.

Making Printed Circuit Boards with Acetone Transfer

· 2 min read
ひかり
Main bloger

I made a printed circuit board for developing a homemade measuring instrument.

Acetone Transfer

Print on plain paper with a laser printer, then place the printout on a copper board, wet it with water, and press the paper firmly. Next, apply a small amount of acetone and, from above a clear file, rub the toner onto the copper board with your fingernail to transfer it with acetone. The first time, I used too much acetone and failed. It's just right when it's soaked throughout. I used 100% acetone nail polish remover.

Printed Circuit Board Acetone Transfer

Wash and rub with water to remove the paper.

Etching

Pour the etching solution into a suitable container and warm the solution to body temperature using a freezer bag filled with hot water for etching. Around 40 to 45℃ seems to be good, but I didn't use a thermometer as it would rust, so I just estimated. Visually confirm that the copper in the unmasked areas has dissolved, then stop etching.

Printed Circuit Board Etching

Dissolving the Coated Parts

Dissolve the parts masked with toner or permanent marker using acetone. This leaves only the copper in the masked areas, creating the circuit.

Printed Circuit Board Etching

Making a Small Circuit

I drilled holes and soldered to make a small circuit. It was easier to solder by applying it as if laying it on top of the copper.

Printed Circuit Board Etching