Blog
Page: 0 1 2 3 4 5 6 7 8 9 ... 10 ... 15 ... 20 ... 25 ... 30 ... 35 ... 40 ... 45 ... 50 ... 55 ... 60 ... 65 ... 70 ... 75 ... 80 ... 85 ... 90 ... 95 ... 100 ... 105
Cmake stupidity...
Date: 1/12/2017
Tags: cmake
So given this snippit:
add_dependencies(my_target jansson)
I get this error:
The dependency target "jansson" of target "my_target" does not exist.
Ok so I did 'add_directory' that, so what if I did this:
add_library(jansson)
add_dependencies(my_target jansson)
Now I get:
add_library cannot create imported target "jansson" because another target with the same name already exists.
Really? It just errored out because it didn't exist? You can't have it both ways Cmake!!!

Cmake: you get what you paid for!
(1) Comment | Add Comment

UDP and Ubuntu 14/Windows incompatibility
Date: 14/9/2017
Tags: linux ubuntu networking
For the last few weeks I've been mucking around in the background with an application I've called "ClipShare" that basically sits on the network and allows you to copy and paste between different machines. It supports text, images and files at the moment. I'm sure such a thing already exists but I like how it auto-detects all the machines running it on the network via UDP broadcast and supports Windows, Mac and Linux. It's far from production ready, it still crashes a bit and hangs up during file transfers sometimes. But over time I'm sure I'll iron that out.

Things like Samba, VNC and VM's (Vmware/Virtualbox) tend to have support for things like clipboard and file sharing. But in my experience they break very easily and it's 50/50 if they'll work or not. Hence having an alternative for getting the data across.

In testing I had a Ubuntu 14 VM running on a Windows host and for the life of me couldn't get the UDP packets to go from Ubuntu to Windows. I could see the packets arriving in Windows land via Wireshark but the recvfrom wouldn't get the packet. The packet wasn't large, just 40 bytes or so. In researching the issue I found that IP packets have a checksum, so I figured out how to get Wireshark to test the checksum. It confirmed the checksum was good. I could see using 'netstat -s' that there was an increasing count of 'Received Packets Discarded'. So Windows for reasons unknown was discarding the UDP traffic from Ubuntu. I tried turning off the Windows Firewall. No difference.

So then I decided to spin up my Ubuntu 16 VM and test the exact same code there. And sure enough it's working fine. So in conclusion I believe that at the OS level, Ubuntu 14 has some busted networking code. I can't tell what's wrong. Maybe it's a Windows thing. But it's basically meant I'm moving to Ubuntu 16 for all my Linux dev stuff. The main reason I had a Ubuntu 14 environment was that I had a working Raspberry Pi cross compiler install and I hate messing with a working env just for the sake of upgrading. However that broke recently anyway so it seems that the last reason for keeping 14 just disappeared.

Fun times.
(1) Comment | Add Comment

Apple and the curse of VNC
Date: 8/9/2017
Tags: mac vnc
For many years now it's annoyed me greatly that trying to connect a Windows VNC client to a MacOSX VNC server has resulted in terrible horrible slow and glitchy performance. Mac to Mac is fine, Windows to Windows is fine, but cross platform? Nope. In fact the Mac to Mac performance is better than any of the Windows or Linux implementations. The reason being that Apple has added a range of proprietary extensions to make that use case better than normal VNC. This is also why the Windows -> Mac case is sub-optimal. It seems that the fast VNC modes that everyone else talks aren't spoken by the Apple VNC server implementation. So what to do? Well the solution that I'm employing at the moment is to... not use the Apple VNC server implementation! Turn off screen sharing in the options and install VNC connect. The cross platform performance is quite decent, running the server and client from the same vendor. Maybe 90% as fast as the all Apple case?

Embrace, extend, extinguish am I right?

You either die a hero or you live long enough to see yourself become the villain.

(I will try and find a free solution in the medium term, and will update this post if/when I do)
(0) Comments | Add Comment

sem_post funkiness on Linux
Date: 9/8/2017
Tags: linux
I moved the Linux implementation of the GThreadEvent class (.h, .cpp) over to the sem_open, sem_post, sem_wait calls a little while back.

Initially I used named semaphores and that seemed to work ok. But after a few weeks I noticed that sometimes the call to sem_post would just quietly NOT increment the semaphore count, while still returning 0 (Success). Which causes the listening thread blocking in sem_wait to never wake up. Crucially this would break the destructor / exit loop of GEventTargetThread.

Googling this didn't turn up anything useful. I believe I was using the API correctly and the documentation is very sparse. Anyway I implemented the semaphores using the sem_init/sem_destroy (anonymous) and it seems to be robust. Still, I'd like to know what the deal is with the named ones. The general pattern of behaviour I would see is:
  • Thread 1: Create using sem_open
  • Thread 2: Block on sem_wait
  • Thread 1: Start shutdown - calls sem_post (returns 0, but no increment) to tell thread 2 that it needs to exit.
  • Thread 2: Still stuck blocking on sem_wait...
Fun times. I checked it under valgrind and no weird memory accesses. Sometimes it would work ok and exit gracefully. But most of the time it would hang.
(0) Comments | Add Comment

Ho ho ho
Date: 21/12/2016
Tags: scribe html-editor
The merry little elves at Memecode have been working away at all hours of the night to bring you a working Rich Text (HTML) editor in Scribe to put in your Christmas stockings.

With the release of Scribe v2.1.33 there is enough functionality to write email with styles. The reply/forwarding side of things isn't as good as the composition of new email. For a variety of reasons. And the control is still definitely in "Alpha" (i.e. incomplete functionality, still contains bugs, possibly show stopping ones).

It would be a excellent idea to reset the reply/forward formats to their default values, because I've updated the default template for HTML reply/forward. If you have a custom template for plain text, save that before you reset the templates in File -> Options -> General -> Reply / Fwd templates -> Reset.

Also go into your signature settings and configure a HTML sig for each account with an identity.

I'll set some expectations first... with the pros:
  • You can edit and delete styles to the text: font, font size, bold/italic/underline, foreground and background colours.
  • The tool bar tracks the current style.
  • You can add and remove links.
  • Most common text editor operations work: deleting / adding text. Selecting regions. Copy / paste.
  • Text reflows to the space available.
And some cons:
  • No undo / redo.
  • Cut / Copy / Paste is plain text only.
  • Replies/forwards are by default converted to plain text, losing any source styling. This is on purpose until I rewrite the reply/forward template merge code to cope.
  • The cursor can get "stuck" sometimes. Reposition with the mouse or use a different key combination.
  • Screen updates might be flaky in some situations.
  • No support for multiple levels of quoting.
  • No support for images (yet, it's on the todo list).
  • No indent/outdent support yet.
  • No lists, bulleted or numbered.
  • Swapping between the text and HTML tabs after you create the email or reply doesn't work. You are locked into whatever control you start with. This will change in later releases.

To switch between plain text and HTML quickly use Edit -> Use HTML Editor.

Do not use the HTML control for production emails. If it matters, use the plain text compose control. Otherwise I'd like to hear how it goes.
(0) Comments | Add Comment

Rich Text / HTML support in Scribe
Date: 5/12/2016
Tags: scribe
There has been a lot of people asking about the Rich Text / HTML editing support in Scribe and so while not fixing crash bugs I'm actively developing a new control to support styled text editing.

So that those that are interested can track the progress I'm publishing my internal spreadsheet of bugs and features:



Broadly speaking my hope is to have a very basic control working by the end of the year. Good enough that you can write and reply to email with, even if there isn't a lot of support for styling. Maybe some basic stuff like bold, colours and font size.
(2) Comments | Add Comment