All posts by ephestione

Windows 10 bluetooth not working on Asus UX51VZ and Centrino Advanced-N 6235

Long story short, my bluetooth mouse, a Logitech Mx Master 2S, disconnected out of the blue, first times I just had to turn off and on bluetooth on windows, once the bluetooth device was automatically disabled because “it caused problems” and I had to restart, finally it stopped working altogether, always telling me “try connecting your device again”. I tested it with every other bluetooth device I had handy, to no avail.

Wasted maybe half an hour, on my almost nonexisting free time schedule (AAARGH)

So finally I had the nice thought of checking, from device manager, if there were updated drivers for the chipset responsible for wireless (WiFI and Bluetooth), a Centrino Advanced-N 6235. I updated it since it automatically downloaded new drivers, restarted as I was asked, and even if wifi kept being shitty, the bluetooth mouse finally connected, as did my android phone.

Change user of transmission-daemon under Debian and Raspbian

I have a raspi3 running transmission daemon downloading to an external USB drive shared via Samba. I don’t want to keep using debian-transmission user with the daemon since just switching to my user account having the access rights to the external USB is much simpler.

I had it already nice and running before, but updating the daemon with apt-get messed everything (and lost all the running torrents as well) so I had to rediscover the procedure once again, and for posterity (and myself for future occasions) I’m writing it down here.

By the way all the missing torrents appeared again after I solved the issue.

So, here are the things you need to do:

  1. run sudo service transmission-daemon stop just in case
  2. edit /etc/init.d/transmission-daemon to have USER=username
  3. edit /lib/systemd/system/transmission-daemon.service to the same effect
  4. run sudo chown -R user:user /etc/transmission-daemon/
  5. run sudo chown -R user:user /var/lib/transmission-daemon/

Done.

fix Android gallery timestamp from video image filename

If you copied the files from another phone, you will notice the new gallery will have all files to the same date of the copy operation.

Install BusyBox, and from terminal or better yet JuiceSSH onto local device, go to /sdcard/DCIM/Camera and do

for i in VID*.mp4; do busybox touch -t ${i:4:8}${i:13:4}.${i:17:2} $i; done;

for i in IMG*.jpg; do busybox touch -t ${i:4:8}${i:13:4}.${i:17:2} $i; done;

Supposing the filename is in the format

IMG_YYYYMMDD_HHMMSS.jpg VID_YYYYMMDD_HHMMSS.mp4

 

Raspberry Pi 3 vs Cubieboard 2 Samba NAS performance

I’ve been using a Cubieboard overclocked to 1.3GHz as my home little NAS server since a few years ago, and just recently I bought a Raspberry Pi 3 thinking it would have been surely faster.

I was especially looking to get better Samba performance.

I have additional ntfs-3g and encryption layers other than Samba, but both boards had their version of Debian installed, with the same packages and same configurations, so the starting configuration was basically the same.

Both were -alternatively- attached to the same Toshiba Canvio 3TB USB3 disk (working in USB2 mode on both boards), and on two adiacent ports on my TP-Link ADSL router.

I overclocked my Raspi3 to 1.5GHz, with sdram_freq set to 500.

For my test, both were alternatively running off the same AC powered USB adapter, under the same wattmeter, each with his own USB power cord.

Well, it was an overall disappointing experience.

Raspberry Pi 3 @ 1.5GHz

  • Download speed via Samba: almost 7MB/s
  • CPU temperature: about 42°C
  • System load: ~2
  • Power draw: 2.6W, with short spikes to 2.7W

Cubieboard 2 @ 1.3GHz

  • Download speed via Samba: almost 7MB/s in average, oscillating between 6.3 and 7.5MB/s
  • CPU temperature: about 42°C
  • System load: ~2
  • Power draw: average 3.4W, ranging from 3.3 to 3.5W

So, the only area where raspi3 is superior to cubie2 is the power draw, otherwise I would have expected way better performance.

Interesting to note, the transfer speed via samba was the same on the raspi3 at the default frequency of 1.2GHz (no benefit from overclocking whatsoever, if not maybe increased oscillations in speed with the same average value), while cubie2 seriously improved after I overclocked back then.

This might indicate a saturation of the USB bus, where the ethernet adapter resides in the raspberry pi 3, which might be the case since the system load of 2 means the 4 cores of the raspberry pi 3 are loaded half as much as the 2 cores on the cubieboard 2, so they could be waiting for the bus to free itself.

Investigating further, I ran

vmstat 3

on both the boards during the transfer… and averages were as follows:

  • Cubieboard 2: user 7%, system 52%, idle 39%, waiting 2%
  • Raspberry Pi 3: user 2%, system 28%, idle 55%, waiting 15%

I think it’s quite clear at this point that while the cubieboard 2 is crunching during that time (the idle should be due to one of the two cores not being optimized), the raspberry pi 3 is waiting on the bus to free itself before sending in other data (the higher idle also must be due to the 4 cores not being all used for the task, mostly 2 of which just don’t do anything at all).

I spent about half to buy the raspberry pi 3 than what I paid for the cubieboard 2 back then, but after so much time it’s not surprising; what is surprising is that the everyday performance appears to be the same 🙁

At this point I will probably keep the cubieboard 2, because it’s already configured as I want it (it’s got more amenities to it than just the NAS server based on Samba) and the different power draw would save me only about 2€ per year on the raspberry pi 3, so no point in upgrading.

UPDATE:

It’s been a couple months since i wrote this article, and for the last month, maybe more, I’ve been actually using the raspi3 as server (and have sold the cubie2 which wasn’t useful anymore).

I noticed that, on the long run, the NAS transfer speed didn’t keep up on the cubieboard after the uptime went, well, up 🙂 It got down to about 2MB/s, with spikes of 5MB/s, maybe less, but never quite reached the 7MB/s average which I got for the tests. No idea what caused this performance drop, but it was a fact: as days went by, the transfer speed was not on par, but far less.

The raspi3 on the other side looks more reliable, its uptime is 40 days as I write, and it still is right below the 7MB/s mark.

Firefox not firing onReadyStateChange with two AJAX requests and a confirm dialogue

There are many discussions like this on the internet, but I am confident I am now examining a very specific problem of Firefox, with a very specific AJAX routine.

Symptoms: there are other AJAX requests in the background, and there is a request initiated by the user, which requires confirmation (your average “are you sure you want to delete?” dialogue). The AJAX request to delete the entry never fired. Every AJAX request was in the default, asynchronous mode.

No matter what, I couldn’t for the life of me make that request work, everything else did. Only the “delete” functions didn’t (in Firefox, as Chome and Internet Explorer worked no problem).

I used console.log messages as crumbs along the way, to follow the flow, and it stopped right at onReadyStateChange, as anything after it wouldn’t show zip in the console. Which meant the onReadyStateChange wasn’t being triggered.

I even thought it was something off with the function name (maybe the delete inside it borked something, silly me thought).

I also tried switching to synchronous mode the incriminated requests… and welp, they worked! For a short while I thought about leaving them be synchronous, but I didn’t want those pesky warnings in the console about synchronous requests ruining the user esperience.

Only by chance an epifany happened, and the obvious came forth (I KNEW there had to be a reasonable explanation which I had yet to grasp).

Well, my configuration went like this (it’s an internal web application we are talking about): an AJAX request triggered each second to a PHP to check the user credentials and inactivity time, and an AJAX request by user intervention was launched to delete an entry… after a confirm dialogue requested, well, user confirmation for the delete (duh).

Everything worked flawlessly before, the problem started appearing after I added the background AJAX request each second (which I didn’t want to get rid of anyway).

As you may or may not know, the window.confirm dialogue is a synchronous structure, which means the page execution is frozen until the user presses either OK or CANCEL in the dialogue (same thing happens with the window.alert function).

So, imagine the background AJAX request being queued behind the confirm dialogue, and obviously taking precedence over anything else that had to come after, and the new AJAX request being formed right after the press on the OK button of the confirm dialogue, to delete the entry that the confirmation was for.

Well, these two requests were launched at the very same time, in a manner that Firefox (not the other browsers though) probably overlapped the onReadyStateChange and never triggered the one for the secondary AJAX request.

In fact getting rid of the confirmation dialogue solved the problem.

Either that, or I will have to come up with an asynchronous method of requesting user confirmation.

Import QR vCard with multiple words name and surname in Android

First of all: YOU CAN’T.

Now for real, there’s a workaround, just buid your vCard text to be rendered as QR Code by removing the spaces between the first name words, and the last name words (surname that you may like).

Example:

N:Johns Phillips;John Philip;;; (Last Name;First Name;;;)

becomes:

N:JohnsPhillips;JohnPhilip;;;

and then, in the address book editing form that appears in Android you just tap in the middle of the joined words and press space.

It will be MUCH faster than moving around in the fields the misplaced name components.

 

There is NO WAY to actually have a vcard data correctly formatted to be correctly rendered by a QR Code scanner and correctly passed to the address book.
If you used a correctly formatted vCard file to directly import it in Android address book, it will work (for example, first export a vCard file for a contact, and then reverse engineer it… but to actually copy the VCF to the phone for each contact and manually importing it would be time consuming and bothersome); but if you use a generated QR code from the vCard code, each and every QR scanner out there will pass the full name data to the address book as a single unformatted string, IGNORING the name components of the N field, leaving the address book parser to decypher which is which.

So, depending on how you go about hacking your way into the vCard format, you might get

John (first name) Philip Johns (middle name) Phillips (last name)

or any other weird combination, BUT the one you were looking for.

Believe me, I tried, and chances are, if you ended up here, you did, too.

In my case I spend on it much more time than I care to admit. More than I needed to actually code from scratch the PHP to generate the relevant QR code into my management software.

So just embrace this workaround, but if you find a solution, please Please PLEASE share in the comments.

Create STL from DICOM with 3D Slicer

Pretty much a self reference post, based on Slicer v. 4.6.

  1. Open the relevant DICOM set.
  2. Open the Crop Volume module
  3. In “Input ROI” dropdown select Create new AnnotationROI
  4. In the slices view adjust the selection so only the interesting area is covered (if you cannot see the delimiters of the crop rectangle, then zoom out the slice view -dragging with right mouse button- until it’s visibile, then move/resize it panning the slice view -dragging with middle mouse button- and then finally rezoom until you are satisfied adjusting the selection)
  5. Click on the Crop! button and see how the slices are cropped to the set area
  6. Open the Editor module (you can select the GenericAnatomyColors palette)
  7. Click on the coloured rectangle on the Label: row, and choose your relevant structure (if you’re here you probably want bone)
  8. Click on ThresholdEffect button (third from last from the effect buttons)
  9. In the Threshold Range input area that just appeared set a starting value of 300 HU (Hounsfield Units) which usually is a good starting density value for bone
  10. You will see the relevant areas blinking in the slices images, and you can adjust the density range by using the small arrow buttons on the side of the lower value of the range
  11. When satisfied, click Apply
  12. Click on the MakeModelEffect button, first from last, and right after click Apply
  13. After a while (depengin on how large is the ROI and how complex is your structure) the rendered model will appear in the 3D view
  14. Click on the SAVE button in the top tools bar, and deselect every entity except the last one (usually named bone if you followed this tutorial), and then choose the STL format in the dropdown on the side (VTK format is selected by default), plus change to your needs the saving folder, and press the Save button
  15. Profit!

Share mysql and apache folders from windows XAMPP to linux XAMPP

This is a replica of the article by jultech from 2007 for posterity and data-replication purposes.

When dualbooting between windows (first OS installed) and linux, do this:

~ # mv /opt/lampp/var/mysql /opt/lampp/var/mysql.BACKUP
 ~ # ln -s /mnt/windisk/path/to/XAMPP/mysql/data/ /opt/lampp/var/mysql
 ~ # mv /opt/lampp/htdocs /opt/lampp/htdocs.BACKUP
 ~ # ln -s /mnt/windisk/path/to/XAMPP/htdocs /opt/lampp/htdocs

This creates a backup of the original XAMPP folders in linux, and them symlinks them to the windows disk mounts.

Restart XAMPP to have th configuration running.

Thank you jultech.

Fix mount: unknown filesystem type ‘isw_raid_member’

You may also get ‘linux_raid_member‘ instead of ‘isw_raid_member‘, usually it’s the same.

So you probably have run through other tutorials telling you not to mount directly but to mount the raid instead…. but you have no raid!

Maybe though, you HAD a raid back in time, and you removed it leaving the disks as separate storage, and in that case there would be “rogue” raid metadata on the disk that makes linux (mint in my case) think it is a raid, and get confused.

Thanks to Chris_F I finally solved it, you need to use dmraid (install it if it’s not on the system, via apt-get) to remove those orphan tags:

sudo dmraid -rE /dev/sdb

In my case, this instantly showed the disk in file manager.

Xiaomi Mi Band 2 vs Teclast H30, first impressions

I had been using the Mi Band 2 foralmost a month, but ordered the Teclast H30 because I liked the SMS text function, and also the general look of it.

What I like of the Mi Band 2 is the fact that I have a watch on my wrist once again (I have been wristwatch-less for about 10 years!), it warns me of incoming calls (when I am working among loud noises or walking to work among traffic, I might not hear my phone or feel it vibrating inside my pocket) and the sleep tracking function.

Heartrate measurement is a disappointment, but not because of Mi Band 2 in itself, more that as a technology you need to stay really in one place and not moving, otherwise it WILL miss hearbeats and give you a really low frequency. Also you do not get continous heartrate measures with the Mi Band 2.

Distance and calories are so useless since they are calculated based on steps count, and amount to a really insignificant number.

When I got the Teclast H30 I put them together on the same wrist. Pairing the band with my phone was a blast (with the Mi Band 2 it took WAY too much fiddling with my phone’s bluetooth).

Surprise, Teclast H30 supports continuous heart rate measurement via a setting on the Android app, but the value was inaccurate if compared to Mi Band 2 (I was fast walking back home, Mi Band 2 gave me a realistic 139bpm, while the H30 was stuck at max 93, but it might as well have been a defect in positioning it on my wrist).

Also Teclast H30 over Mi Band 2 has the find my phone function, where you would jump to said function and your phone would ring.

Also Teclast H30 often was faster than Mi Band 2 in showing the time after raising my wrist.

TSports app doesn’t require online registration as MiFit does.

The advantages though end right about at this point.

I could greenify MiFit app, but TSports is hard to be put in hibernation as it installs as a resident app by default and eats away at the phone battery even if it is in the watchlist of Greenify.

You cannot choose which elements to display on Teclast H30 like you can with the Mi Band 2, you always have to scroll through the Time/Date/Sleep hours/Steps/Distance/Calories/Battery/Find Phone, and it gets annoying really fast! Also on the Mi Band 2 you can display, with the latest firmware, time and date together, while on Teclast H30 they are on different screens.

Finally, the alarms: on MiFit you can set alarms depending on the weekday or just once, while on TSports you can only set an alarm to ring every day for the rest of existence.

I cannot report about sleep tracking nor battery duration as after a half-a-day experience I gave this band to my S.O.

I can testify anyway on the SMS text display to be working, as I got one during that time. It doesn’t display the author name even if it is in your phonebook though, just the originating phone number.

That’s all folks!