This cable follows the below diagram precisely; note the color-coded heat shrink, and note that the TRRS plug’s internal wiring is such that the Tip is wired to the furthest-left solder point, followed by R1 and R2, and finally the Sleeve solder point is actually also the strain relief and threaded housing. So you’ve gotta think a bit backwards (and/or use an ohmmeter to check your wiring.)
Warning, this alternative *may* be more reliable than mine: https://github.com/johnboiles/BaofengUV5R-TRRS
And this article has a lot of helpful hints: http://www.wcares.org/?page_id=2677
And of course, using a Bluetooth TNC, etc, is going to be much more reliable than this hack. I don’t use this on a regular basis.
Finally, this cable seems to work well on my Samsung Galaxy Nexus, but is not detected as an output by my Nexus 5x when plugged into the radio so it might need different resistor values or connections depending on your devices.
I harvested a cheap Baofeng handheld speaker/microphone for its cable (although you can buy them here — the Kenwood type) and bought a 3.5mm TRRS plug from Digi-key. It’s a bit tight to solder the resistors inside the plug housing, but it is possible (just remember to put the plug housing on the cable BEFORE soldering, otherwise you’ll be unable to put it on later… a mistake I made about three times.)
Here are the diagrams: Continue reading
I got this error after adding an onKernelRequest listener to my Symfony project and trying to pass Twig_Environment to it as an argument. It worked via the web browser, but not in any PHPUnit tests hitting multiple pages.
After much head scratching and reading of the Symfony source code, I ended up making an onKernelException listener instead. Magically, rendering a twig template from it (passing a TwigEngine argument) worked.
So, here’s how I handle custom exceptions in a custom way. Notice I’m testing for Twig_Error_Runtime because my specific error is coming via Twig; you may be able to just test for regular Symfony exceptions instead:
Using this as a guide ( http://wiki.rsyslog.com/index.php/Working_Apache_and_Rsyslog_configuration ) I was able to get Apache’s access log, filtered, forwarding to my Papertrail instance (via syslog / rsyslog). It may be useful to someone: Continue reading
A lot of tutorials are showing you how to create embedded forms with associations/relations — what about unrelated entities?
I figured out you can pass the second entity as a parameter to the parent form, pass it normally to the embedded form via the ‘data’ parameter, which will let the embedded form update the object. Then just persist() the object back in the controller like normal. No crazy data/request wrangling necessary! Continue reading
Sometimes you really need to know what computers on your network were doing yesterday at noon, because you get a nastygram from the MPAA about bittorrent demanding that you do something — but bittorrent is notoriously hard to block.
You can try installing BandwidthD on your Pfsense router, to see who’s using a bunch of bandwidth at that time, and you can look back through DHCP or WiFi logs to see who was connected at the time, but the complaint letter tells you the exact time and port number used. Wouldn’t it be cool if you could log that?
Here’s what I came up with. Download the Cron package for Pfsense, and add a new Cron job:
Command: pfctl -ss | egrep '(>.*>|<.*<)' | logger
The firewall states (who is connected to what) will now dump to your system log every hour — kinda noisy, but also kinda effective for tracking long downloads on random ports.
Coming from Rails, I know that DRY (don’t repeat yourself) is a virtue. In my Symfony PHP project, I was faced with copy-pasting a hundred lines in order to test a bunch of methods in PHPUnit. So, I wrote a quick wrapper to take in the arguments as minimally as possible instead of cluttering up the code with tons of duplicate syntax: https://gist.github.com/zyphlar/c959b2d66bce1c10c637