Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Set up the configure and name /home/pi/.homebridge/config.json
1 2 3 4 5 6 7 8
{ "bridge": { "name": "Homebridge", "username": "FF:FF:FF:FF:FF:FF", // MAC address of Ethernet on Raspberry "port": 51826, "pin": "111-11-111" // Set up what you want to }, }
Set up boot up
To save the following words and to name homebridge into /etc/default
1 2 3 4 5 6 7
# Defaults / Configuration options for homebridge # The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others) HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more # You can display this via systemd's journalctl: journalctl -f -u homebridge # DEBUG=*
To save the following words and to name homebridge.service into /etc/systemd/system/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[Unit] Description=Node.js HomeKit Server After=syslog.target network-online.target
[Service] Type=simple User=homebridge EnvironmentFile=/etc/default/homebridge # Adapt this to your specific setup (could be /usr/bin/homebridge) # See comments below for more information ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS Restart=on-failure RestartSec=10 KillMode=process
it’s a simple way to install vnc server. Don’t use default vnc server (Realvnc) that is not compactable on mac since it need to activate license, however, I haven’t a monitor to display.
1
$ sudo apt-get install tightvncserver
Now you can use build-in vnc client on mac.
open Finder and press ⌘+k
In the Server Address enter vnc:// followed by your computer name or IP address.
First, I got a problem that the taskbar disappeared when I remoted to vnc server. I have had a tricky solution. to remove lxpanel and the taskbar is back.
When I used cmocka to write the unit test, the compiler alerts a error cast from pointer to integer of different size [-Werror=pointer-to-int-cast]. I have tried to write a unit code for running arm 32-bit and x64 machine however it was not working since I wrote the following code that was only working properly on x64.
1
assert_false(list_find(list, 11));
Let’s figure out the problem since the void pointer.
First try, I rewrite the code on arm 32-bit that convert the void pointer to integer. So that it was working on my raspberry. However it was not working on x64 machine. WTF.
1
assert_false((int)list_find(list, 11));
Since the size of void pointer on x64 is 64-bit and the size of integer is 32-bit. Now the compiler alerts me another error message. How to figure out the problem. Let’s use a type intptr_t. The magic that converts to suitable size on the platform. If you compile the code on x64, it will convert to unsigned long that is 64-bit. Otherwise it converts to int.
To compile bluez on the raspberry that got the following message when to install libreadline-dev.
1 2 3 4 5
Setting up install-info (4.13a.dfsg.1-5ubuntu1) ... dpkg: error processing install-info (--configure): subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: install-info
It’s a locale problem. You can modify the /etc/environment to correct locale. My solution modify /etc/environment to en_US.UTF-8 and use raspi-config to install en_US.UTF-8. One more thing, don’t forget to run locale-gen to generate locale profile. Reboot your system. All problem solved.
You got the ERROR: polls..AppleDouble (unittest.loader._FailedTest) when you run the unit test on Django. It means OSX create the .AppleDouble folders in your Django project.
No shit, just following the code. OSX based on POSIX that it can’t use sem_init to initial the semaphore and it can’t use sem_destroy to destroy the semaphore, too.
I was refactoring the project because sometimes the project crashed. Analyzing the code I found it is the problem of memory managemnt. Sometime it use the wrong address when it free the memory. In the project, it didn’t use malloc of GNU C library to allocate the memory and it implemented the feature.
The following code is a basiclly malloc implementation from stackoverflow. It use sbrk to implement malloc. I was confusing why it use a low-level function to implement malloc allocating the memory. What is different with malloc and sbrk?
sbrk is a low-level function in GNU C library. From wikipedia said that brk and sbrk are basic memory management system calls used in Unix and Unix-like operating systems to control the amount of memory allocated to the data segment of the process.sbrk supports to allocate the memory but it isn’t flexible to use memory that means it can’t use released memory. You can follow the code and I used static memory to refactor malloc. The code allocated a huge array and it retured the pointer address to new block if it wasn’t released memory.