tag:blogger.com,1999:blog-98280002024-03-14T02:24:22.583-07:00Assay the EssayI have a tendency to write and speak in essay. I invite you to assay my essay with your thoughts and comments.David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.comBlogger172125tag:blogger.com,1999:blog-9828000.post-60144065336357221092019-08-23T08:34:00.000-07:002019-08-23T08:34:22.058-07:00A Dell Deal<div dir="ltr" style="text-align: left;" trbidi="on">
Living in Singapore can be expensive, but thankfully, there are Dell deals here to keep prices at bay. Here's one for the new XPS 13 2-in-1, fully decked out.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4H1iUiZvcx0WUcBqafTABTIZV5LZbEWEmFvzSrn3s4yHIx_BiEOEl213aJcbI23Xo4pt_Jw6qtpfWKmm5qhoXzaKXeLJ7HQsj-HwvKg7FX71LbOx4SN7DXYdWwkZtbCCz252z/s1600/Screen+Shot+2019-08-23+at+10.57.32+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1153" data-original-width="1350" height="546" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4H1iUiZvcx0WUcBqafTABTIZV5LZbEWEmFvzSrn3s4yHIx_BiEOEl213aJcbI23Xo4pt_Jw6qtpfWKmm5qhoXzaKXeLJ7HQsj-HwvKg7FX71LbOx4SN7DXYdWwkZtbCCz252z/s640/Screen+Shot+2019-08-23+at+10.57.32+PM.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
At least tax is included! The culprit is in fact not the laptop itself, but as one might guess, one of those convenient but perilous add on components, in this case Office. MS Office, that is, not a new office space overlooking the CBD, even though that price might be more warranted.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji4S1aRgAOwck_IkKrQVhAogcSSm4mRFei-zAHAQ8M13lNnsgLHPoWWVztLTv_ysfEWA2UnnRFNy0kzGzpYkEGqSwmwBLxNbimQ4k9w5R2w7-3SUE6JSrHkOwvkAhhHcfxYpbm/s1600/Screen+Shot+2019-08-23+at+10.41.42+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="439" data-original-width="879" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji4S1aRgAOwck_IkKrQVhAogcSSm4mRFei-zAHAQ8M13lNnsgLHPoWWVztLTv_ysfEWA2UnnRFNy0kzGzpYkEGqSwmwBLxNbimQ4k9w5R2w7-3SUE6JSrHkOwvkAhhHcfxYpbm/s640/Screen+Shot+2019-08-23+at+10.41.42+PM.png" width="640" /></a></div>
<br />
Granted, I'm sure this is all just a bug in the backend. Hopefully I won't accidentally click on Buy Now, or I'll have definitely bought the farm.</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-59517033130176234772019-01-20T02:11:00.000-08:002019-01-20T02:11:04.301-08:00Chrome Remote Desktop on Ubuntu 18.04<div dir="ltr" style="text-align: left;" trbidi="on">
Google Chrome Remote Desktop (CRD) has served as a great help for managing several computers from afar. Recently I inherited an older Dell workstation running Windows 7 that could not be upgraded to Windows 10, which I needed for Windows Subsystem for Linux, so I opted to rewipe and install Ubuntu 18.04 instead.<br />
<br />
Setting up CRD on Ubuntu was not quite as straightforward as that on Windows or Mac, though my experience thus far is that the connection and reliability has been quite solid. Many blog posts and StackExchange answers have addressed installing CRD on Ubuntu, but I encountered a few peculiarities in my setup that I wanted to consolidate here.<br />
<br />
Here is my setup pathway:<br />
<br />
<ul style="text-align: left;">
<li>I needed to install Chrome rather than Chromium as mentioned in <a href="https://medium.com/@vsimon/how-to-install-chrome-remote-desktop-on-ubuntu-18-04-52d99980d83e">this Medium post</a></li>
<li>During my first installation, I installed the current (non-beta) CRD package and extension, but after a CRD update I could lost remote access and reinstalled with the latest, beta CRD package/extension</li>
<li>To access the latest CRD extension, I went to the <a href="https://remotedesktop.google.com/access/">CRD website</a> rather than directly to the Chrome App Store</li>
<li>The bottom tile under "This Device" gave the option to download and install the CRD <span style="font-family: Courier New, Courier, monospace;">.deb</span> package</li>
<ul>
<li>Make sure that no other application such as Synaptic Package Manager is accessing the package manager, or else a simple double-click install will silently fail</li>
<li>During a separate installation on a Mac with CRD previously installed, the CRD website would not show my device until I ran the CRD uninstaller (from the Applications folder) and reloaded the CRD website to reinstall the extension</li>
<li>The <a href="https://chrome.google.com/webstore/detail/chrome-remote-desktop/inomeogfingihgjfjlpeplalcfajhgai">installed Chrome extension</a> appears to be different from the <a href="https://chrome.google.com/webstore/detail/chrome-remote-desktop/gbchcmhmhahfdphkhkmpfmihenigjmpp?hl=en">CRD extension normally seen</a> in the App Store</li>
</ul>
<li>At the point I could see my server on other computers and initiate a connection, but I could never get past the login screen, as <a href="https://askubuntu.com/questions/1028985/cant-advance-beyond-login-screen-with-chrome-remote-desktop-in-ubuntu-18-04">mentioned by others</a></li>
<li>A workaround that also has the benefit of allowing login to the current rather than a new session is to manually edit the CRD configuration as explained in <a href="https://superuser.com/questions/778028/configuring-chrome-remote-desktop-with-ubuntu-gnome-14-04/850359#850359">this SuperUser answer,</a> with a few changes:</li>
<ul>
<li>My user account was already part of the chrome-remote-desktop group</li>
<li>The <span style="font-family: Courier New, Courier, monospace;">DEFAULT_SIZES</span> setting did not seem to affect my resolutions, although I did not try out many configurations</li>
<li>Note the importance of setting <span style="font-family: Courier New, Courier, monospace;">FIRST_X_DISPLAY_NUMBER = 1</span> on Ubuntu 18.04</li>
</ul>
<li>After restarting CRD, I could access the current session from other computers</li>
<li>I also needed to keep my monitor plugged in and turned on, even if taking input from other port, or else windows and the Activities screen would not respond for some reason</li>
</ul>
<div>
So far CRD has been working smoothly, though I of course anticipate the next update and reboot to see how long it will continue to work with the current configuration.</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-70767050431439922202018-12-24T18:50:00.000-08:002018-12-24T18:50:07.464-08:00Android battery recalibration<div dir="ltr" style="text-align: left;" trbidi="on">
My Samsung Galaxy S6 Active inexplicably nose-dived in battery level from 31% to 0% over the span of about 15min of usage. Thinking I must have used the mobile browser awfully heavily, I simply recharged the phone but saw it continue charging for about another 20-30min after reaching an apparent 100%. I figured that this process would itself recalibrate the battery, restoring life and sanity to the meter.<br />
<br />
On this next battery cycle, however, the phone battery again took a precipitous drop in indicated battery level. Does SoundCloud really use that much battery, I wondered? Perhaps the battery didn't recalibrate because I had turned on the phone during the the prior charging. I plugged the phone back in, but the battery percentage suddenly popped up from 5% to 25% before quickly draining again. Unless I had bought these batteries from Six Flags, this roller coaster battery life could not be a correct one.<br />
<br />
One thing was clear -- I needed to recalibrate my recalibration efforts. I looked up <a href="https://www.androidpit.com/how-to-calibrate-the-battery-on-your-android-device">this guide</a> on Android battery recalibration, attempting to follow the instructions for non-rooted phones. I let the phone completely die, plugged in the charger, and saw the battery indicator immediately show about 25%. The phone charged completely, indicated 100% when I turned it on, and appeared to drain very slowly throughout the next couple days until undergoing another steep drop starting around 30%, to the point that the phone shut off as soon as I turned on the screen. Perhaps my brief plug-in had wrecked the calibration signal?<br />
<br />
I had no choice but simply to plug in the phone again, and thankfully it indicated 0% charge. I let the phone charge completely -- and completely unperturbed this time -- while completely off, and the phone indicated 100% when I turned it on again. The battery indicator showed faster drainage, closer to what I had seen it its prior days. Never have I been so happy to see faster battery drainage since I assumed that the indicator was actually accurate this time. Indeed, the battery didn't show any precipitous decline, but instead slowly drained to a quiet and steady death. I recharged it once again, and again to my delight, the battery kept draining at a normal pace.<br />
<br />
So for Christmas this year, I have a "brand new" Android phone. Merry Christmas!</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-22671707027310735712017-08-14T22:50:00.000-07:002018-05-12T14:12:14.834-07:00Migrating multi-project Subversion repo to Git<div dir="ltr" style="text-align: left;" trbidi="on">
<i>I've been recording my Subversion to Git journeys to remind myself for the next Subversion conversion. Here are my prior entries in case they're helpful:</i><br />
<a href="http://davematthew.blogspot.com/2013/05/migrating-sourceforge-repository-from.html">Simple Sourceforget repo from Subversion to Git</a><br />
<a href="http://davematthew.blogspot.com/2013/05/migrating-from-subversion-to-simple.html">Self-hosted Git server</a><br />
<br />
I had saved one remaining Subversion project for the last to migrate to Git because of its relative complexity in structure. It's actually one of my first projects, the <a href="http://textflex.com/texttrix/">Text Trix</a> text editor, and I had migrated it from CVS to Subversion way back in the day using <a href="https://github.com/nirvdrum/svn2git">svn2git</a>.<br />
<br />
Here is the basic structure:<br />
<span style="font-family: "courier new" , "courier" , monospace;">root</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">|--texttrix</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> |--trunk/branches/tags</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">|--jsyntaxpanettx</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> |--trunk/branches/tags</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">|--osterttx</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> |--trunk/branches/tags</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">|--plugins</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> |--plugin0</span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> |--trunk/branches/tags</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> |--plugin1</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> |--...</span><span style="font-family: "courier new" , "courier" , monospace;">|--txtrx</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> |--trunk/branches/tags</span><br />
<br />
When I gave svn2git the root level URL, svn2git only tracked changes when the repo had a single project, in the trunk/branches/tags format. After I had expanded the repo to include multiple projects, each with its own trunk/branches/tags organization, svn2git stopped tracking the folders further. To include the full history, I pointed svn2git to the main project only, and svn2git was able to track the project back from when it had moved there. I also excluded any .class, .jar, and .lex files since these can be re-generated.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">svn2git https://svn.code.sf.net/p/texttrix/svn/texttrix --authors ~/authors-ttx.txt --verbose --exclude ".*.class$" --exclude ".*.jar$" --exclude ".*.lex$"</span><br />
<br />
For some reason many files to exclude leaked through, so I eventually went to the <a href="https://github.com/rtyley/bfg-repo-cleaner">BFG</a> cleaner to remove these files, with some helpful hints from <a href="https://github.com/IBM/BluePic/wiki/Using-BFG-Repo-Cleaner-tool-to-remove-sensitive-files-from-your-git-repo">this guide</a>. I first needed to initialize a bare git repo to "remotely" host my subversion-imported repo:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">mkdir ttxhost</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ttxhost</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git init --bare</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ../texttrix</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git remote add origin ../ttxhost</span><br />
<br />
This "remote" host is actually local but serves as a clean repository from which BFG can pull and push. But before I actually ran BFG, I needed to make sure that my commit at HEAD did not have any files that I intended to remove since BFG leaves the HEAD commit alone.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">git rm lib/*.jar</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git commit -m "Remove remaining jars"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: inherit;">Push the whole repo into ttxhost:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git push origin master</span><br />
<br />
Next I cloned this host repo and allowed BFG to work its magic. I had some difficulty finding the syntax for removing multiple files from the main docs but eventually found this <a href="https://stackoverflow.com/questions/38705858/can-multiple-files-be-specified-when-using-bfg">Stackoverflow comment</a>.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ..</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">mkdir ttxclean</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ttxclean</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git clone --mirror ../ttxhost</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">java -jar ../bfg-1.12.15.jar --delete-files "{*.class,*.jar,*.lex}" ttxhost.git</span><br />
<br />
BFG reported that it had successfully cleaned files, and after summing the sizes of these files, I realized that BFB had removed about 80% of the original size of my repo. Inspected the output carefully turned out to be important as I had learned here about the need to remove files from the HEAD commit.<br />
<br />
To get all these changes onto the host repo, I needed to clean the repo and push its changes:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ttxhost.git</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git reflog expire --expire=now --all && git gc --prune=now --aggressive</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git push</span><br />
<br />
When I went back to the host repo, however, it remained the same size. And running "git gc" made it even bigger! According to <a href="https://stackoverflow.com/a/1908476">this post</a>, this behavior is known for git gc, reflecting a safety mechanism to keep unreferenced objects for 2 weeks in an unpacked form. Using the "prune" flag greatly reduced the size:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ../../ttxhost</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git gc --prune=now</span><br />
<br />
And voila, the host repo went from 9.1 to 3MB! I next checked out a fresh copy of this repo to check it:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ..</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">mv texttrix texttrix.old</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git clone ttxhost texttrix # can skip if you don't need to check</span><br />
<br />
The new repo was clean and ready for upload to GitHub! Following <a href="https://help.github.com/articles/importing-a-git-repository-using-the-command-line/">this guide</a>, I cloned a bare copy of the host repo and mirrored it to GitHub to upload all references.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">mkdir ttxforgithub</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ttxforgithub</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git clone --bare ../ttxhost</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd ttxhost.git</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">git push --mirror https://github.com/the4thchild/texttrix.git</span><br />
<br />
I removed my prior local repo and cloned in the one from GitHub:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">cd ../..</span><br />
<span style="font-family: Courier New, Courier, monospace;">rm -rf texttrix</span><br />
<span style="font-family: Courier New, Courier, monospace;">git clone https://github.com/the4thchild/texttrix.git</span><br />
<br />
And here it is on <a href="https://github.com/the4thchild/texttrix">GitHub</a>. And now I have to repeat all over with each of the remaining projects and plugins.</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-10409913308022506742016-12-18T23:33:00.001-08:002016-12-18T23:33:49.742-08:00Trying to make sense of Starkiller base's demise<p dir="ltr">Rogue One felt like an old friend I never knew I missed. As several reviews have mentioned, many have considered it the best Star Wars film since the original trilogy, a true hearkening back to the films we grew to know so well and lovr. But Force Awakens came out last year, and wasn't it already quite a resounding success, a return to original trilogy form? </p>
<p dir="ltr">I certainly thought so, and that was why I bought the digital film as soon as it became available. I had little difficulty explaining away most of the plot holes, at least to myself, but one hole kept nagging at me. How did the Resistance take down the Starkiller base with such apparent ease? Or conversely, why did the First Order make their prized weapon so vulnerable, and especially in such a way as to replicate the vulnerability of the two previous Imperial death planets?</p>
<p dir="ltr">Perhaps one key to reconciling this apparently fatal flaws lies in another potential plot hole. Another criticism raised against the Starkiller design is that its attachment to a planet greatly limits its mobility. Unless it could somehow up and move its entire existing planet, the weapon could really only target nearby planets within its fiery canon's range.</p>
<p dir="ltr">Either this design was an incredible overlooked weakness, or it underlies the fact that Starkiller was not an end unto itself. If it could only target planets within a local radius or its orbital trajectory, perhaps the weapon was but a prototype, or at least a first of its class, one of many such weapons to come. We might conjecture that Starkiller was merely a new type of weapon that would be installed on many additional planets, each targeting local New Republic planets within reach.</p>
<p dir="ltr">As one of many, Starkiller would not be the end all, the prized possession which the First Order would defend at any cost. The base would be important, no doubt, but also important would be the ability to construct multiple such bases efficiently and within cost. Even as formidable as a Star Destroyer might be, for example, each ship would have to "cut corners" in the name of reasonable construction costs and time to make the construction of any similar designs feasible.</p>
<p dir="ltr">Similarly, Starkiller would have to work within its design constraints, which meant relying on less than impregnable defenses. And as the first of many similar designs, a 1.0 effort shall we say, of a weapon that harnesses an inherently unstable energy source, the system remained only vulnerable to demise with a critical perturbation of its inner workings.</p>
<p dir="ltr">The Resistance took advantage of this vulnerability and killed the Starkiller base, but their celebration perhaps underlies their own naive vulnerability. The base had destroyed its intended targets -- multiple surrounding New Republic planets -- and many more Starkiller bases are perhaps to come, each situated near additional ripe Republic targets. And if the First Order can in fact learn from mistakes, then these new Starkiller 2.0 bases will be do away with the trench-run-critical-vulnerability once and for all. Or so we hope, at least for the sake of believability.</p>
<p dir="ltr">What made Rogue One feel so fresh was not having to go through such mental exercises to justify the plotline. But hey, there are so many much more skilled people doing the creative heavy lifting to put these movies together in the first place, so props to them for painting the universe we so thoroughly debate and <u>enjoy</u>.</p>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-21309290017575368822016-09-05T15:51:00.000-07:002016-09-05T15:51:18.488-07:00Another try at Matplotlib<div dir="ltr" style="text-align: left;" trbidi="on">
Awhile back, I finally managed to <a href="http://davematthew.blogspot.com/2013/10/installing-matplotlib-and-mayavi-on-mac.html">install Matplotlib (and Mayavi)</a> through general package management tools on the Mac. Through a combination of Homebrew and Pip and a lot of finagling, my take-3-or-so try at getting the Python graphing libraries to work actually came to fruition.<br />
<br />
Some recent feedback on the tXtFL AI prompted me to revisit the modeling software, but alas, Matplotlib was no longer working on my system. When I tried to run my scripts, I got a "<span style="font-family: Courier New, Courier, monospace;">Fatal Python error: PyThreadState_Get: no current thread. Abort trap: 6</span>" error. As far as I can tell, the error tracks back to a <a href="https://github.com/Homebrew/homebrew-science/issues/3401">bug in the latest version of vtk</a> included with Homebrew.<br />
<br />
What was odd to me was that the Virtualenv technique I had used was supposed to isolate the dependency chain so that the packages would continue to work even if some of them got updated and broke compatibility with other packages. I realized, however, that the Homebrew package installations take place outside of the virtual environment, so at least the way that I've been using Virtualenv probably does not fully isolate the environment.<br />
<br />
Not being able to run a modeler just because of a broken dependency is of course a real bummer, so I set out to find alternative solutions. I've been reluctant to try commercial offerings in hopes of sticking with generalized package management solutions such as Homebrew, but I came across an at least partially open source solution called Anaconda. The trouble with installed Matplotlib from scratch is the sheer number of dependencies (no less than "pycairo, PyQt4, PyQt5, PySide, wxPython, PyGTK, Tornado, or GhostScript" listed on the <a href="http://matplotlib.org/users/installing.html">official installation page</a>), which makes having a dedicated package manager via Anaconda for these and other Python scientific computing dependencies make perfect sense.<br />
<br />
Anaconda offers the option of a complete install ("Anaconda") vs a minimalist install ("Miniconda"), and I went for the Miniconda install to see if I could get by with it. After installing the 64-bit Windows version, I created a separate virtual environment inside it with the Matplotlib and Mayavi libraries as follows:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">conda create --name pystat matplotlib mayavi</span><br />
<br />
Apparently including all required packages at environment creation time is preferable. Anaconda pulled in all the other required dependencies and set up the virtual environment. All of these packages apparently are available for new virtual environments as well, which streamlines future downloading.<br />
<br />
I'm used to using Cygwin for all my Bash-within-Windows computing, but Anaconda and Cygwin <a href="https://github.com/conda/conda/issues/747">do not appear to always play nicely</a> with each other. I tried at activate the virtual environment within Cygwin, but the detected python appeared to be from Cygwin rather than from Anaconda.<br />
<br />
Instead, I dropped into an old-fashioned Windows command prompt and fired up Anaconda from there. A simple "activate pystat" command brought me into the correct environment. I had to learn though that "cd d:\src" does not automatically bring one into that folder, but apparently typing "d:" as a separate command first is required. Clearly I'm a Windows command prompt newbie.<br />
<br />
From there, both matplotlib and mayavi worked out of the box. I didn't even need to use the custom launch script that I had <a href="http://davematthew.blogspot.com/2013/10/installing-matplotlib-and-mayavi-on-mac.html">used previously</a>. The beauty of Anaconda it is cross-platform, so I next plan to see if it will work as seamlessly back on my Mac as it has on Windows. Or maybe by then, vtk with brewed python will be friend again.</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-65711463612082692172016-06-26T22:50:00.001-07:002016-06-26T22:50:04.279-07:00Crowdsourced Prayer<p dir="ltr">I've always wondered why we should ask others to pray for us if God hears the prayers even of one--and especially if he knows our needs even before we ask of him. Having others pray for us might seem to be redundant, or if we were to take it to the extreme, even faithless.</p>
<p dir="ltr">One Scripture that comes to mind regarding the prayers of many is from Revelation, where the multitude if prayer is likened to incense being poured out to God. There is no indication that these prayers somehow grab his attention better or that they might get lost otherwise, but rather that just as incense is a way of worship, so also the prayers of many combine to form collective praise to our God.</p>
<p dir="ltr">Asking people to pray for us may then be less about maximizing the chances that God might answer our prayer and instead more about creating an opportunity where more people might worship God. And how does that happen through prayer? By asking others to enjoin in our requests, we give opportunity for more people to see how God answers our requests. By crowdsourcing our prayer, we collectively reap the rewards. Our concerns become others' concerns, and likewise our answered prayers become others' answered prayers.</p>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-87641646620934417342016-05-13T22:23:00.000-07:002016-05-13T22:23:50.566-07:00Married!<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-TYCxWMbWff4/VyQZFxhJMaI/AAAAAAAAte0/nseZmBPZIiITgfiE-D_-F7RgiTImKEVBQCKgB/s1600/20160323%2BD%2B%252B%2BE-60.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="265" src="https://3.bp.blogspot.com/-TYCxWMbWff4/VyQZFxhJMaI/AAAAAAAAte0/nseZmBPZIiITgfiE-D_-F7RgiTImKEVBQCKgB/s400/20160323%2BD%2B%252B%2BE-60.jpg" width="400" /></a></div>
<br /></div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-81398483897124963182015-08-19T08:51:00.000-07:002015-08-19T08:51:17.443-07:00Troubleshooting SELinux<div dir="ltr" style="text-align: left;" trbidi="on">
As much as I hoped to make the greatest use of SELinux to secure my servers, I've typically dropped it into "permissive" mode after encountering cryptic security restrictions. I recently set up a basic Fedora server on Digital Ocean including SELinux and decided to try sticking it out with SELinux in full protection mode.<br />
<div>
<br /></div>
<div>
And as usual, I encountered a cryptic "failed to start" error while reconfiguring an Apache server. Thanks to a <a href="https://ask.fedoraproject.org/en/question/38435/run-apache-virtualhost-on-different-port/?answer=38436#post-id-38436">comment on one of the Fedora forums</a>, I found a convenient tool, <code>audit2why</code>, to help decipher the error message. Piping the error output into <code>audit2why</code> (eg <code>systemctl status httpd.service|audit2why</code>), the tool actually gave me the specific command to adjust the setting in SELinux.<br />
<br />
Now we can have peace of mind and peace of configuration too!</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-85799711351093918552014-12-11T11:48:00.001-08:002018-08-15T00:35:42.709-07:00Migrating Git repo from Eclipse to Android Studio<div dir="ltr" style="text-align: left;" trbidi="on">
I've been tracking the <a href="https://developer.android.com/sdk/index.html">Android Studio</a> releases from afar for awhile and have been looking for an excuse to truly give it a shot. Besides the fact that Java 7 for IntelliJ <a href="https://intellij-support.jetbrains.com/entries/27854363-IDE-doesn-t-start-after-updating-to-Mac-OS-Yosemite-or-Mavericks">wasn't really supported</a> on the Mac for some time, the transition from the Eclipse build system to Gradle seemed a bit invasive.<br />
<br />
One of the biggest barriers in my mind was migrating my Git repository to the new Gradle structure without losing file history. Android Studio will migrate an Eclipse project to an Android Studio, Gradle-based one, which involved moving a number of folders as well as replacing Eclipse- with Gradle-specific configuration files. I wanted to use the Android Studio migration tool but was unsure whether Git would identify these changes as file moves or treat them as entirely new files, which would make tracking file history more cumbersome.<br />
<br />
<a href="http://stackoverflow.com/a/24741965/1911852">Some have found</a> that Git will identify these files as simply moved/renamed, but unfortunately I did not experience that. Instead, I found that I could run the migration tool in a separate location and manually recreate the moves on the original repository. Here's how I did that, in case anyone else is trying the make the move as well.<br />
<ol>
<li>Create a new branch in the Eclipse project location. This will make it easier to delete any changes if migration gets messy.</li>
<li>Start the Android Studio migration tool. To get it running, I closed any open Android Studio project, and the wizard popped up. I then chose to import a non-Android Studio project and pointed to the Eclipse project location. For the new project, I chose a distinct outside folder location.</li>
<li>Migrate the project! There were some errors upon actually building the project, but at least for me the migration itself went smoothly.</li>
<li>Mirror the major folder moves. Back in the original Eclipse project location, I started moving folders via git to mirror the new structure. The key is that there are really only a few folders to move, so it's not as painful as it looks. Here are the main commands I ran, with help from <a href="http://android-ed.blogspot.com/2014/09/migrate-project-in-github-to-android.html">this post</a>:<code class="prettyprint linenums"><br />mkdir -p app/src/main/java<br />git mv src/com app/src/main/java<br />git mv res app/src/main<br />git mv assets app/src/main<br />git mv AndroidManifest.xml app/src/main</code><br />"src/org" can be changed to whatever your source sub-root folder is, and "assets" or other folders may need to be in/excluded according to your project files.</li>
<li>Commit these changes in the new branch. Now they are ready to be picked up in your new Gradle-based project!</li>
<li>Copy the Eclipse project's .git folder into the new Gradle-based project location. This will make the Git repo with all the major moves available in your Gradle location, including the new branch where all the dirty work is being done.</li>
<li>Turn on VCS for the new project. Android Studio has a dedicated VCS menu with the option to turn on various versioning systems. Once it's activated, you can show changes and confirm that Git sees all those moved files as being in the right place.</li>
<li>Add all the new Gradle-based files. The nice thing about using the Android Studio VCS is that it knows not to show a bunch of Gradle build files that shouldn't be version controlled. It also deletes a bunch of Eclipse-specific project files from Git simply because they weren't migrated. The challenge however is that it doesn't by default offer to add all the files you do in fact need. Here are the files that appear to be key, which I learned from viewing the <a href="https://github.com/playgameservices/android-basic-samples/tree/master/BasicSamples">Android Samples project</a> structure:<code class="prettyprint linenums"><br />app/build.gradle<br />gradle<br />build.gradle<br />gradlew<br />gradlew.bat<br />settings.gradle</code></li>
<li>Commit all changes to Git. If you've pushed them, you should be able to pull them on another machine right from within Android Studio to access your project there.</li>
</ol>
<div>
From my brief taste of Android Studio so far, it's been quite a treat!</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-62018792082167677992014-04-30T20:38:00.001-07:002014-04-30T20:38:36.713-07:00FlightGear Mod Repo<div dir="ltr" style="text-align: left;" trbidi="on">
I've been enjoying FlightGear too much recently and felt it's high time to finally start giving back what little I can. I've set up a small repository to collect modifications I've made to existing components, which for now merely consists of one aircraft and the joystick I use.<br />
<br />
<a href="https://github.com/the4thchild/flightgear-mod">https://github.com/the4thchild/flightgear-mod</a><br />
<br />
Feel free to incorporate any elements into your own midnight flights and to post any changes of your own!</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-40098427660812553972014-03-26T21:02:00.000-07:002014-04-05T13:33:39.376-07:00EXTRA_PLAYERS in Google Play Services<div dir="ltr" style="text-align: left;" trbidi="on">
I noticed while updating an Android app to the new <a href="http://android-developers.blogspot.com/2014/03/google-play-services-43.html">Google Play Services API 4.3</a> that the EXTRA_PLAYERS constant appeared to have disappeared. The <a href="https://developers.google.com/games/services/android/realtimeMultiplayer">Google Play Games documentation</a> (as of 3/26/2014) suggests that it had moved to Multiplayer.EXTRA_PLAYERS as did several other constants, but no such variable or any other location for the variable could be found.<br />
<br />
Using Google's own cached pages feature, I found that an <a href="http://webcache.googleusercontent.com/search?q=cache:qH73JcO-cnkJ:https://developer.android.com/reference/com/google/android/gms/games/multiplayer/Multiplayer.html+&cd=4&hl=en&ct=clnk&gl=us">older version</a> of the documentation refers to another method, RealTimeMultiplayer.getSelectOpponentsIntent. That method's documentation in turn refers to a <a href="https://developer.android.com/reference/com/google/android/gms/games/Games.html#EXTRA_PLAYER_IDS">Games.EXTRA_PLAYERS_IDS</a>. It looks as if this variable is the new equivalent of the old EXTRA_PLAYERS constant, although I have no other way of verifying this except that my app appears to be working in multiplayer mode.<br />
<br />
Hope this helps anyone looking for an extra variable to take the place of EXTRA_PLAYERS.</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-61905123189045651732014-01-12T21:48:00.000-08:002019-01-20T02:11:31.049-08:00Chrome Remote Desktop on the Mac<div dir="ltr" style="text-align: left;" trbidi="on">
One reason I took my time in picking up a Mac desktop was that Windows Remote Desktop Protocol (RDP) works so well. Rather than configuring my various laptops and desktops where I work to all have similar configurations and to each run all the software I need, I found that I can lot in remotely to a central Windows workstation via Windows RPP from any computer. It essentially turns my 5 and 9 year old laptops into a modern machine by allowing me to use them as if I were on my more powerful desktop.<br />
<br />
Mac does come with a type of screen sharing based on VNC. I used this screen sharing extensively during grad school to log into my Linux desktop, and while it worked fine on the uber-fast university network, it hasn't fared so well from my home connection. Apparently it sends actual images of the screen, which can be rather slow even when tapping into more advanced compression algorithms. Apple does offer another remote desktop software, but unfortunately it requires a separate fee, unlike the Windows RDP included with Windows Professional editions.<br />
<br />
But just when I thought that all hope was lost, Google came out with the <a href="https://chrome.google.com/webstore/detail/chrome-remote-desktop/gbchcmhmhahfdphkhkmpfmihenigjmpp?hl=en">Chrome Remote Desktop</a> extension. At first I wondered what the use of it was when Windows has its own RDP, but I found that Chrome Remote Desktop can share a Mac screen with other clients. Best of all, it shares at RDP-like speeds, making remote work practical even for moderately intensive graphical tasks.<br />
<br />
While logging into my Mac via Chrome Remote Desktop, I did run into occasional glitches with a few workarounds. Recently, my Mac would show up as "offline" when I knew that the computer was on and would even accept ssh connections. The <a href="https://productforums.google.com/d/msg/chrome/_SV_6pZiW1A/xAs1EhUFkhgJ">workaround</a> was to make use of the ssh connection to log in and restart the Remote Desktop service by running:<br />
<br />
<code>sudo killall -HUP remoting_me2me_host</code><br />
<br />
Then when I refreshed the Remote Desktop clients page, my machine would show up as online. As you can see, keeping ssh open (via System Preferences > Sharing > Remote Login) as another emote login tool proved valuable for troubleshooting.<br />
<br />
Occasionally the windows would no longer be clickable, and the screen would no longer update. The workaround was to restart finder with the command (again via ssh):<br />
<br />
<code>killall Finder</code><br />
<br />
I also find that modifier keys such as Cmd (the Apple or Windows button), Ctrl, Alt, and Shift often get "stuck" so that Remote Desktop keeps acting AS IF THEY WERE STILL DOWN. The simple solution I've found has been simply to hit the modifier key again to "unstick" it.<br />
<br />
A small annoyance that I've found is that the "Resize desktop to fit" option is sometimes limited by the display sizes given by the Mac system. I then either need to scale down a much larger display size onto my tiny laptop screen, or scroll around this various parts of this large display one corner at a time. Windows key shortcuts also often take precedence over the Mac ones. For example, Cmd-Tab, the shortcut for switching windows on a Mac, gets intercepted by the Windows client machine. But whoever expected it to be so easy as using a shortcut to switch from Windows to Mac?<br />
<br />
<br /></div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-25977976793869241702013-11-16T20:12:00.001-08:002013-11-16T20:18:51.164-08:00First Nighttime bbq!<p dir="ltr">Adding a little extra warmth to the already unusually warm San Franciscan Veterans' Day weekend evening with Sonrise folk and other friends.</p>
<div class="separator" style="clear: both; text-align: center;"> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAAGgHmz6D44QEdIP7Tz1zkrhBfV0OebS9hKMWHqalx8y4U3cvAbwgd-rzL-vqluGcQtakBeZxXJh5YAbCsJoWnMb56zh-PzdqGH4nfF12JnfDd-j6KqltiPwf55eZ2Mw2qGK/s1600/IMAG0441%25257E2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRAAGgHmz6D44QEdIP7Tz1zkrhBfV0OebS9hKMWHqalx8y4U3cvAbwgd-rzL-vqluGcQtakBeZxXJh5YAbCsJoWnMb56zh-PzdqGH4nfF12JnfDd-j6KqltiPwf55eZ2Mw2qGK/s640/IMAG0441%25257E2.jpg"> </a> </div>David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-82783488850526731692013-10-27T21:53:00.000-07:002013-10-27T21:54:11.627-07:00FlightGear Rembrandt: HAF -> SFO<div dir="ltr" style="text-align: left;" trbidi="on">
The windy walk back from work during dusk reminded me that I do in fact live in San Francisco. And although my work schedule doesn't allow me to get out of town all that much, fortunately my flight simulator tries to fill in the gap. A couple days ago I decided to flip on the new "Rembrandt" setting in the flight sim, FlightGear, and I found myself sinking into an entirely new cockpit, as if it were the real thing. As I took a short hop tonight from Half Moon Bay Airport to San Francisco International, the airport lights flickered just beyond the cabin glow of my cockpit. And just to make things feel truly real, immaculately surreal, the sim's real-time weather brought me from the fog of HAF airport to a crosswind landing at SFO.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr4qoAZR_1saOSANIPyJD0NrZcKtlKMMIHiVIbDtl-jlGXUNqDLFzkjvfhlxjmNZFiPrtHUaK3YzLkkDcJC8okwpcEegLze7vHguVwKkKW7QfprzheQALifteXF0EWEuzHtW6W/s1600/fgfs-screen-035.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr4qoAZR_1saOSANIPyJD0NrZcKtlKMMIHiVIbDtl-jlGXUNqDLFzkjvfhlxjmNZFiPrtHUaK3YzLkkDcJC8okwpcEegLze7vHguVwKkKW7QfprzheQALifteXF0EWEuzHtW6W/s400/fgfs-screen-035.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhyphenhyphenhMlmykfanyD4dFDYtaFo1cdmbb1idAWdsrxX3KiwMoaN1JvpAtH_iN27W5xAm_BN5B-hDo93qJfSV-a62jA2UhLenNbSKkQlKARaB54CWrAU3dbw2fCXNBR2PpyN59FGTp1/s1600/fgfs-screen-040.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhyphenhyphenhMlmykfanyD4dFDYtaFo1cdmbb1idAWdsrxX3KiwMoaN1JvpAtH_iN27W5xAm_BN5B-hDo93qJfSV-a62jA2UhLenNbSKkQlKARaB54CWrAU3dbw2fCXNBR2PpyN59FGTp1/s400/fgfs-screen-040.png" width="400" /></a></div>
<br />
A couple weeks ago, I did actually get to venture inside a cockpit at SFO, this one a 737-900. My brother's friend from church gave us tickets to a United Airlines show, where I got to take a snapshot of my niece in her future profession (or so we hope!).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj4CkdfKiIOvEH9oHrMlkIe1HySWoLJ7oadty998BY2IdfyVs8QlD56Q5DeUxpj7BqEOAgi9qgpRfvci_ypIQ6-hs6Qe2J39w16p9i4FYM0mtj3rOv1JxhF4vEeUJN6OHCzZHY/s1600/IMAG0380.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj4CkdfKiIOvEH9oHrMlkIe1HySWoLJ7oadty998BY2IdfyVs8QlD56Q5DeUxpj7BqEOAgi9qgpRfvci_ypIQ6-hs6Qe2J39w16p9i4FYM0mtj3rOv1JxhF4vEeUJN6OHCzZHY/s400/IMAG0380.jpg" width="400" /></a></div>
<br />
To my amazement, as soon as I took these snapshots from my Android phone, Google identified them as coming from a 737. It even guessed a 737-800--pretty close! Now if FlightGear could get its planes identified by Google as "the real thing," that would be rather impressive. And judging by the rendering in Rembrandt, I think that day may not be so far off.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiH88YIKzBHVPiLU62HS4n-MuytchOvy1agQC3DN2rWDaz-DMvQu8wrWZh68UPkxcbGsxzpssiGHDtn8tXd6sizpSPoRkJ9a01wGbcR-YAcWzJBu5Iad5TqTrWEUWHaYpUb_lc/s1600/fgfs-screen-041.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiH88YIKzBHVPiLU62HS4n-MuytchOvy1agQC3DN2rWDaz-DMvQu8wrWZh68UPkxcbGsxzpssiGHDtn8tXd6sizpSPoRkJ9a01wGbcR-YAcWzJBu5Iad5TqTrWEUWHaYpUb_lc/s400/fgfs-screen-041.png" width="400" /></a></div>
<br />
In any case, as much as I enjoy the relaxing realism of a virtual flight after a long day, I'm thankful for the real pilots keep our real bodies safe in the air, day after day after day.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYcwpZBXV0xGfFC8Gj_XrD5aWkXD_DdZo6vOfC_1KMNtpzlTfTVSDt2qgqfO6UURk5u73_nXJBEKKQWnQ_OwxTPGA0ZAKxZ15LNnwGFMY-PHxiOqGm7-M7aYMdLJgAWX1N5ydP/s1600/IMAG0401.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYcwpZBXV0xGfFC8Gj_XrD5aWkXD_DdZo6vOfC_1KMNtpzlTfTVSDt2qgqfO6UURk5u73_nXJBEKKQWnQ_OwxTPGA0ZAKxZ15LNnwGFMY-PHxiOqGm7-M7aYMdLJgAWX1N5ydP/s640/IMAG0401.jpg" width="361" /></a></div>
<br /></div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0San Francisco International Airport (SFO), San Francisco, CA 94128, USA37.615223 -122.3899789999999837.564916000000004 -122.47065999999998 37.66553 -122.30929799999998tag:blogger.com,1999:blog-9828000.post-8328370348517851152013-10-14T23:41:00.000-07:002016-09-05T12:42:31.680-07:00Installing Matplotlib and Mayavi on Mac<div dir="ltr" style="text-align: left;" trbidi="on">
I had lots of fun with Matlab in grad school, but I always had in the back of my mind that at some point my educational subscription would run out. Thus started my slow search for alternatives, preferably open source alternatives with combined graphing capabilities.<br />
<br />
I also had lots of fun with Python, so my hunt brought me to the Matplotlib, a Pythonic scientific graphing tool. While Matlab has a single application (plus many toolkits) to install, the Pythonic solution has no less than Python + Numby + Scipy + Matplotlib to get things rolling. Installing Matlab is as simple as starting and installer and letting it do the work, whereas installing Matplotlib was another story. Allow me to document that story here in the likely chance that I'll otherwise forget it.<br />
<br />
Matplotlib can be installed through a single solution provided by a company named Enthought, but my hope was to install everything using standard open-source installers. Here's my setup and the specific requirements I was aiming for:<br />
<ul style="text-align: left;">
<li>Mac OS 10.8</li>
<li>Homebrew for package management</li>
<li>Python installed from Homebrew rather than from Apple XCode</li>
<li>Virtualenv to isolate a "scientific Python" environment</li>
<li>Matplotlib as a primary graphing tool</li>
<li>Mayavi as an alternative 3D graphing tool</li>
</ul>
<div>
<b>Installing Homebrew</b><br />
<br />
Back in college I became an avid Linux user, and part of both the joy (and occasional angst) of Linux was the package management system. rpm, yum, and apt-get all provided ways to keep software up to date without having to check individual sites for updates.<br />
<br />
When I had to use Windows more often, I found the Cygwin system a boon both for accessing all my Linux/bash scripts on Windows as well as keeping everything up to date. At some point, I did install Matplotlib via Cygwin but, alas, did not document instructions and have since forgotten the details of the process.<br />
<br />
Now that I'm using a Mac, I found Homebrew to meet all my package management needs. Installing it was a matter of running a <a href="http://brew.sh/">simple command</a> (scroll to the bottom of that page). <a href="https://github.com/mxcl/homebrew/wiki/FAQ">Keeping it up to date</a> involved <code>brew update; brew upgrade</code>, and that was that.<br />
<br />
<b>Installing Homebrew-based Python</b><br />
<br />
One of the tricky aspects of Homebrew is that Python can come from multiple locations. Apple XCode already includes Python, so by default Python will run, albeit an older version. Installing the Homebrew-based version <a href="http://hackercodex.com/guide/python-virtualenv-on-mac-osx-mountain-lion-10.8/">can be a help</a> as it brings a newer version and also allows customization so that it will work with a wider variety of packages. The Homebrew-based package also apparently brings pip with it for additional installations.<br />
<br />
To install Python 2.x, I used the command:<br />
<br />
<code class="prettyprint linenums">brew install python --with-brewed-openssl</code>
<br />
Python 3.x could also apparently be installed side-by-side with Python 2.x by replacing "python" with "python3", although I haven't yet tried out 3.x.<br />
<br />
I did come across some errors, most likely based on a prior installation of pip outside of Homebrew. This <a href="http://stackoverflow.com/questions/13354207/how-to-symlink-python-in-homebrew">SO answer</a> and <a href="http://bryan.parno.net/thoughts/?p=99">blog post</a> helped me revive the installation.<br />
<br />
<b>Installing pip and virtualenv to install more packages</b><br />
<br />
Now that we've used one package manager, we get to use another package manager, this time pip, a Python package manager. And the first package to install is a tool to manage multiple sets of packages. Talk about recursive package management, huh?<br />
<br />
Following <a href="http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/">this guide</a>, my first step was to install virtualenv, which allowed me to isolate the subsequent packages in case I later wanted to install a different, potentially conflicting set of packages. A side benefit is that if I made a mistake during installation, it was a matter of deleting a virtual environment rather than trying to clean up my entire system.<br />
<br />
I used this command to install virtualenv, using pip provided by the Homebrew-based Python.<br />
<br />
<code class="prettyprint linenums">pip install virtualenv</code>
<br />
To keep my virtual environments together, I made a separate directory and then created a new environment, which is started through the activate script.<br />
<br />
<code class="prettyprint linenums">
mkdir ~/virtualenvs<br />
cd ~/virtualenvs<br />
virtualenv pystat<br />
source pystat/bin/activate<br />
</code>
<br />
<b>Installing Numpy + Scipy + Matplotlib</b><br />
<br />
And now, time to install what we set out for! First, <a href="https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md">be sure to deactivate</a> the virtualenv session to install from within a normal shell session prior to running further brew commands.<br />
<div style="background-color: #e0e0e0; margin: 1em;">
<b>UPDATE (9/5/2016)</b>: Looking back through this post, I think that the pip commands still need to be within the virtualenv to make isolated environment relevant. Also, I'm not sure how isolated this entire configuration is since the Homebrew installations occur outside of the environment, and updates appear to break the installation. For example, a recent <a href="https://github.com/Homebrew/homebrew-science/issues/3401">incompatibility with vtk</a> appears to have rendered my installation unusable at least for now.
</div>
<code class="prettyprint linenums">
deactivate<br />
pip install numpy<br />
brew install gfortran<br />
pip install scipy<br />
brew install freetype<br />
pip install matplotlib<br />
</code>
<br />
Here's a screenshot of visualizing football models with Matplotlib.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid098PToT7rKstdv0pO3dAMSsUCzr2XuynIaBs-Bz9PbuTadJWZPH3hi0iSVFNv7bO8Du9F6rF9WJ6fmjd0G7hkXQXnz8980o4c96QIfTZrZR1XKOshFJ9TUbOGg0Zc-okEqsM/s1600/Matplotlib-txtfl_4thdown.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="345" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid098PToT7rKstdv0pO3dAMSsUCzr2XuynIaBs-Bz9PbuTadJWZPH3hi0iSVFNv7bO8Du9F6rF9WJ6fmjd0G7hkXQXnz8980o4c96QIfTZrZR1XKOshFJ9TUbOGg0Zc-okEqsM/s400/Matplotlib-txtfl_4thdown.png" width="400" /></a></div>
<br />
<b>Installing Mayavi</b><br />
<br />
While testing out Matplotlib for 3D histograms, I came across a few rendering issues and this <a href="http://matplotlib.org/mpl_toolkits/mplot3d/faq.html">faq from the Matplotlib site</a> itself that suggested using Mayavi as a more powerful 3D engine. Installing Mayavi was no laughing matter, but it did work in the end, particularly with the help of <a href="http://matforge.org/fipy/wiki/InstallFiPy/MacOSX/HomeBrew">this guide</a>.<br />
<br />
Installation involving tapping another Homebrew repository, homebrew/science,<br />
<br />
<code class="prettyprint linenums">
brew install cmake<br />
brew install qt<br />
brew install pyqt<br />
brew install --python --qt vtk<br />
brew install wxmac<br />
pip install configobj<br />
pip install envisage<br />
pip install mayavi<br />
</code>
<br />
During the final step, I was initially unable to install mayavi because of an error in finding the vtk package, despite having successfully installed it. Apparently vtk gets installed in the Python system site package and is not accessible from within the virtualenv. My workaround was simply to turn off the switch that was preventing access to these packages while in a virtualenv:<br />
<br />
<code class="prettyprint linenums">
rm ~/virtualenvs/pystat/lib/python2.7/global-site-packages.txt<br />
pip install mayavi<br />
</code>
<br />
Mayavi is installed!<br />
<br />
<div style="background-color: #e0e0e0; margin: 1em;">
<b>UPDATE (2/24/2014)</b>: While trying to update Homebrew today, I ran into a few errors. The first error stated:<br />
<code class="prettyprint linenums">
vtk: Unsatisfied dependency: matplotlib<br />
Homebrew does not provide Python dependencies; install with:<br />
pip install matplotlib<br />
</code>
<br />
<div class="p1">
Matplotlib was installed within the virtualenv and does not appear to be visible to Homebrew. I ended up having to activate the virtualenv where matplotlib was installed and running the Homebrew update from there. vtk did show up in the Homebrew global Python site-packages directory (<code>/usr/local/lib/python-2.7/site-packages</code>), even when installed from the virtualenv.</div>
<div class="p1">
<br /></div>
<div class="p1">
I also encountered a error on updating wxmac:</div>
<code class="prettyprint linenums">
/usr/local/Cellar/wxmac/3.0.0.0/include/wx-3.0/wx/strvararg.h:25:14: fatal error: 'type_traits' file not found<br />
#include <type_traits><br />
^<br />
1 error generated.<br />
error: command 'clang' failed with exit status 1<br />
</code>
<br />
<div class="p1">
Apparently this error has been <a href="https://github.com/Homebrew/homebrew/issues/23666">reported</a> and commented upon extensively several months back with a workaround. The solution was to run:<br />
<code class="prettyprint linenums">
brew edit wxmac<br />
</code>
and add the line:</div>
<div class="p1">
<code class="prettyprint linenums">
ENV.append_to_cflags "-stdlib=libc++"
</code></div>
<div class="p1">
to the '<code>cd "wxPython" do</code>' block (currently line 39, where the line can be added after the existing append_to_cflags call).</div>
<br /></div>
But alas, it would not run. I received the error message:<br />
<br />
<code>
This program needs access to the screen.<br />
Please run with a Framework build of python, and only when you are<br />
logged in on the main display of your Mac.<br />
</code>
<br />
which fortunately had this handy <a href="http://stackoverflow.com/a/13684638/1911852">SO solution with a script</a> to run Python from within the requisite environment (or see this <a href="http://wiki.wxpython.org/wxPythonVirtualenvOnMac">alternative script</a>). Here's a screenshot of visualizing that same football model but with Mayavi.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU48ifcR7zec7zSxgfhLVg_hsrMhXLIu5mFjWSie31cae0tkoGMQGNNz9s9v3goEzc4nhphZ3l7WfShnD-AQdAwRRgUrnlW2xsMtv64muZd4CbPpXuVn-Nm-l8kbIMJNSPqFKT/s1600/Mayavi-txtfl_4thdown.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU48ifcR7zec7zSxgfhLVg_hsrMhXLIu5mFjWSie31cae0tkoGMQGNNz9s9v3goEzc4nhphZ3l7WfShnD-AQdAwRRgUrnlW2xsMtv64muZd4CbPpXuVn-Nm-l8kbIMJNSPqFKT/s400/Mayavi-txtfl_4thdown.png" width="372" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Now I'm enjoying both Matplotlib and Mayavi home-brewed in a cozy virtual environment. With a real coffee in hand, of course.</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-24945860744736160302013-09-27T18:44:00.001-07:002013-09-27T18:47:24.006-07:00Android-x86 4.3 on VirtualBox with Google Play Services<div dir="ltr" style="text-align: left;" trbidi="on">
I've run Android on VirtualBox over the past couple years (<a href="http://davematthew.blogspot.com/2011/09/app-development-with-android-x86-on.html">2.3</a>, <a href="http://davematthew.blogspot.com/2011/12/android-40-ice-cream-sandwich-on.html">4.0 part 1</a>, <a href="http://davematthew.blogspot.com/2012/04/android-x86-ics-on-virtualbox.html">4.0 part 2</a>) as it provided a considerable performance improvement over the standard emulator. After I picked up an Ivy-Bridge-based Mac Mini, the sheer performance improvement over my prior machines made up for much of the slack in the emulator and allowed them to be a pretty decent and simpler alternative to the VirtualBox solution. Recently however I did find another excuse to re-explore Android on VirtualBox and found a couple pleasant surprises.<br />
<br />
<b>Out-of-the-box 4.3 from Android-x86</b><br />
<br />
I learned that Android-x86 posted a <a href="http://www.android-x86.org/releases/build-20130725">build of 4.3</a> shortly after its arrival, and I decided to give it a shot. Unlike prior builds of earlier Android versions, this build worked right out of the box. There's really not a whole lot of configuration details to add from my prior experiences. Here's a screenshot of a basically un-customized install ticking its way onward to 2 weeks of uptime.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLbRYl_oSEPjQqqO8Q3G2kfuMu3fSf1KsrgF_EPl3LkYzZgz4TGDHL1OymcOjgNkQdt454tfFIEfa0OsTtzcW3lPMDKOQSN8BrWUI2Q9FNZ6JYYzgMMbP1rroTL-BiAtVMXBTX/s1600/Android-x86-4_3-uptime.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLbRYl_oSEPjQqqO8Q3G2kfuMu3fSf1KsrgF_EPl3LkYzZgz4TGDHL1OymcOjgNkQdt454tfFIEfa0OsTtzcW3lPMDKOQSN8BrWUI2Q9FNZ6JYYzgMMbP1rroTL-BiAtVMXBTX/s640/Android-x86-4_3-uptime.jpg" width="390" /></a></div>
<br />
<br />
I used the same settings that I had used for <a href="http://davematthew.blogspot.com/2011/12/android-40-ice-cream-sandwich-on.html">Android 4.0</a>, except that I happily managed to get away with using only 256 MB of RAM. There was no need for special partitioning for an SD card, and customizing screen resolution was similar to my <a href="http://davematthew.blogspot.com/2011/09/app-development-with-android-x86-on.html">prior experience</a> except that I didn't have to adjust the DPI setting.<br />
<br />
<b>Google Play Services</b><br />
<br />
An additional motivation to retry Android on VirtualBox was to see whether Google Play Services might work better on it. I recently integrated Google Play Game Services into tXtFL Mobile, and one issue that cropped up during testing is that the standard emulator's version of the Play Services is baked into the emulator image so that it can't be updated separately from the entire emulator image.<br />
<br />
Where this became a problem was when a version of the Google Play Services SDK was released that was incompatible with the emulator's version. Android on the emulator gave an error message to the effect, "Google Play services out of date. Requires 3159100 but found 3136130," and unfortunately that meant waiting for another emulator release, which took almost a month to fix after it was first <a href="https://code.google.com/p/android/issues/detail?id=57880">reported</a> and reared its head again briefly awhile later although has now been fixed.<br />
<br />
The Android-x86 version thankfully includes the Google Play Store, and what that means is that unlike the standard emulator, Android-x86 on VirtualBox can install updated versions of Google Play Services. After initially installing Android-x86 4.3 on VirtualBox, my app promptly crashed while attempting to sign into Google Play. After waiting awhile and rebooting, however, I found that Play Services had updated itself, and subsequent sign-ins worked without a hitch.<br />
<br />
Play Services has continually kept itself updated since then, and here's the latest version, with a number higher than that on my phone or the emulator (834000-30). The version number itself is the same though (3.2.65).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdnbyD7s-ctVvmoRw9lC3hrFVDHuXsd_T4quFf5rr33YTcMge9j8f9nGKYBkEm3boIhWavfRwuDVTTGbZjPHnrzWPKhTe15EKWSQDxAJwRhX9cXywiq_D8nCaSZz_3tcyVYxOt/s1600/Android-x86-4_3-googleplay.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdnbyD7s-ctVvmoRw9lC3hrFVDHuXsd_T4quFf5rr33YTcMge9j8f9nGKYBkEm3boIhWavfRwuDVTTGbZjPHnrzWPKhTe15EKWSQDxAJwRhX9cXywiq_D8nCaSZz_3tcyVYxOt/s400/Android-x86-4_3-googleplay.jpg" width="400" /></a></div>
<br />
Now I just have to wait for Android-x86 to release a 4.4-based build.</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-55239016125069746902013-09-15T14:58:00.002-07:002013-09-15T14:59:30.677-07:00A's vs Giants in 2013<div dir="ltr" style="text-align: left;" trbidi="on">
Last season, the A's and Giants were in the race right up to the end. This season, they've taken very different routes, and this snapshot from today's out-of-town scoreboard symmetry pretty much sums up the season:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEt9MtmCJi-MI-O0Sv5jPq8Qa8-yyQ6zWRYs8VaScLo8prkg4qb_6pWitVdW1JTrz6d2mW8IbfVgR73u1RIYfozxWQ8T6HFEgpamVYMj9gZXwZjQeaf8K5e3SVXRCesTFVS9s5/s1600/Screen+Shot+2013-09-15+at+2.53.23+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEt9MtmCJi-MI-O0Sv5jPq8Qa8-yyQ6zWRYs8VaScLo8prkg4qb_6pWitVdW1JTrz6d2mW8IbfVgR73u1RIYfozxWQ8T6HFEgpamVYMj9gZXwZjQeaf8K5e3SVXRCesTFVS9s5/s1600/Screen+Shot+2013-09-15+at+2.53.23+PM.png" /></a></div>
<br />
SF was actually up 1-0 until a bases-loaded, bases-clearing double put them back in the hole. The A's are trying to preserve their lead in the game and widen their lead in the divisional race with the Rangers.</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-2588539142980932102013-07-03T21:28:00.002-07:002013-07-03T21:30:11.438-07:00"Keep your eyes on the ball"<div dir="ltr" style="text-align: left;" trbidi="on">
This past Friday I attended an A's-Cardinals game at the Coliseum, thanks to a 2-for-1 ticket my buddy picked up. I was testing out the panorama function on my new HTC One and just so happened to catch the first single of the game. The panorama setting appears to use the exposure settings from the first frame, so I swept from right to left--in this case, from batter to outfield--which turned out to double as a way to keep my camera's eye on the ball from the batter to the outfielder. Here you can see Coco Crisp's swinging, the 3rd baseman's lunging, and the left fielder's fielding the ball all in one frame, as if all took place simultaneously. If you look closely, you might even see multiple versions of the ball coursing their way to the outfield.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLb_CWbwbF8FWXsR8l1RI2aRkhqXCDazcxVLDtwRT4Dlnz02vMnI2VlHQWfup74d5fqW2fcZrwb2VnXkIuE7xXQTuL0hlz9jTu-1vpOe16zS5AIbMmnVzXnZP8gdJedlkHhrs/s1600/STLvOAK-2013-06-28-0095.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLb_CWbwbF8FWXsR8l1RI2aRkhqXCDazcxVLDtwRT4Dlnz02vMnI2VlHQWfup74d5fqW2fcZrwb2VnXkIuE7xXQTuL0hlz9jTu-1vpOe16zS5AIbMmnVzXnZP8gdJedlkHhrs/s640/STLvOAK-2013-06-28-0095.jpg" width="640" /></a></div>
<br /></div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0Coliseum, Oakland, CA 94621, USA37.7567466 -122.1930517000000137.7441926 -122.2132217 37.7693006 -122.17288170000002tag:blogger.com,1999:blog-9828000.post-37199542597395608152013-05-19T17:41:00.000-07:002013-05-19T23:54:57.782-07:00"Save both yourself and your hearers"<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
Today's sermon touches on 1 Tim 4:11-6, where Paul exhorts Timothy to preach so that he might save both himself and his hearers. The question proposed in the sermon is how he can save anyone when we know that only God, only Christ Himself, can save us? The answer proffered is that we save by preaching the very Gospel that saves, that in a sense we do not save, but we provide the message that saves.</div>
<div>
<br /></div>
<div>
The challenge with this interpretation however is that the verse specifically says that we do in fact save, not merely that we are a conduit for salvation. God is certainly the one who works in us to save, but somehow Timothy is the direct agent to "save both yourself and your hearers." So how then do we as mere humans actually perform salvation? I think that the key is to ask ourselves, from what are we saved? In many cases the Scripture points to salvation from hell and sin, a very spiritual salvation that only God can enact in us. If I shared the Gospel to someone who then chose to follow Christ, I would never say that I saved him, but that Christ saved him.<br />
<br />
We know however that there are many other things from which we can be saved. In this passage, Paul appears to refer less to eternal salvation and more to the practicalities of daily life and ministry. He speaks of the challenges of service and of preaching to guide people through the daily struggles of life. He may therefore be referring to the very power and responsibility we have to save people not only from walking into gross sin, but also from all the senseless trials, conflict, and even simple stupidity that we have all committed. Through the experiences that Timothy has suffered and the maturity that he has gained despite his youthfulness, he can share with them the strategies that he has gained and the Scriptures that he has learned to help save them from falling into the mistakes that he has committed himself or as a leader has seen others make.</div>
<div>
<br /></div>
<div>
By helping to "save both yourself and your hearers," we can also exemplify on a daily basis God's eternal salvation of us. By saving people from all sorts of practical, visible troubles that we might otherwise find ourselves in, we can more readily see and more deeply appreciate the internal and eternal salvation that only God has provided us in Christ.</div>
</div>
David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-12342176219760738362013-05-18T15:51:00.000-07:002018-08-15T00:35:42.600-07:00Migrating from Subversion to a simple self-hosted Git serverI recently <a href="http://davematthew.blogspot.com/2013/05/migrating-sourceforge-repository-from.html">migrated</a> a Sourceforge-hosted Subversion repository to a Git repository for one of my open-source projects. I also have a number of private projects holed up on an old Linux server at home and decided that it's nigh time to git them over to Git as well. Now that I have a Mac Mini, I figured that I could take advantage of its Unix backbone to set up a simple SSH-based, self-hosted Git server.<br />
<br />
My code will get an upgrade in hardware and version control protocol in one fell swoop. And given the number of minor tricks I had to find along the way, especially with the help of <a href="http://blog.smitec.net/posts/setting-up-a-git-server-on-osx/">this tutorial</a>, I figured that I'd document them here for posterity's sake.<br />
<br />
<b>Exporting the Subversion repository</b><br />
I <a href="http://davematthew.blogspot.com/2013/05/migrating-sourceforge-repository-from.html">again used svn2git</a> to export the Subversion repository to a local Git repository. In my case, I had a multi-project Subversion repo and wanted to export only one sub-project, so I used the "--no-minimize-url" flag. It also happened to be in slightly non-standard layout ("TxtflMobile" instead of "trunk"), which required me to explicitly set the trunk name. The authors flag was as outlined <a href="http://davematthew.blogspot.com/2013/05/migrating-sourceforge-repository-from.html">previously</a>.<br />
<br />
[on local machine:]<br />
<span style="font-family: Courier New, Courier, monospace;">$ mkdir prjdir</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ cd prjdir</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ svn2git http://path/to/repo/subproject --trunk TxtflMobile --tags tags --branches branches --no-minimize-url --username name --authors ~/authors-txtfl.txt --verbose</span><br />
<br />
As the repo was private, I had to specify the username to access the repo. Strangely, the execution hung, and I realized that I was supposed to provide my password even though it didn't prompt me--that is, until after I provided my password and hit Enter.<br />
<br />
To check the export, I ran the "git branch" and "git tag" commands to see the listing of all branches and tags.<br />
<br />
<b>Setting up the simple Git server</b><br />
Looking through Git server options, I initially thought that I would need to download a variety of third-party server packages to set it up. A great many server packages do exist, including <a href="http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/">8 outlined here</a> and seemingly several popular packages that have since arisen. Fortunately, one of the easiest of these options is also one <a href="http://git-scm.com/book/en/Git-on-the-Server-Getting-Git-on-a-Server">recommended in the Git book itself</a>, the SSH-based server that allows access through basic SSH login.<br />
<br />
To set up the remote repository on the server, I logged into the server (which happened to be the same computer to which I had exported the Subversion repo). In the System Preferences, I made sure that "Remote login" was enabled, which turns on sshd to allow SSH connections. I also wanted to <a href="http://serverfault.com/a/67616">change the sshd port</a>, which involved editing the /System/Library/LaunchDaemons/ssh.plist file and making sure that my router forwarded this port to my server.<br />
<br />
Now that the server was accessible (was, in fact, a "server"), I created a "bare" repository in the location from which I would host the Git repo and into which I would push my local Git repo.<br />
<br />
[on server:]<br />
<span style="font-family: Courier New, Courier, monospace;">$ mkdir /path/to/hosted/repo</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ cd /path/to/hosted/repo</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git init --bare</span><br />
<br />
<b>Pushing the local repo to the server</b><br />
Back on the local machine, I prepared the repo for pushing onto the server. I added the remote location to the repo to indicate where to push up the local repo.<br />
<br />
[on local machine:]<br />
<span style="font-family: Courier New, Courier, monospace;">$ git remote add origin ssh://name@127.0.0.1:123/path/to/hosted/repo</span><br />
<br />
In my case, I used my username and customized port (eg "123") for login. Note that the <a href="http://www.bramschoenmakers.nl/en/node/720">"ssh://" protocol is necessary</a> to specify the alternate port. In the process of learning this trick, I had to edit the URL for "origin" by using the "set-url" parameter in place of "add". In this case, I used "127.0.0.1" as the IP because I would be pushing the local repo from same machine as the server.<br />
<br />
Once I had set the remote URL, it was just a matter of pushing up the master branch, each additional branch, and all the tags to the server.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ git push origin master</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git push origin branch1</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git push origin branch2</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git push --tags</span><br />
<br />
<b>Accessing the repo from abroad</b><br />
Of course, one of the main benefits of hosting the hosting the repo remotely is that one can access it from abroad. Using the "git clone" command to the server's URL allowed me to download it onto another machine.<br />
<br />
[on another local machine:]<br />
<span style="font-family: Courier New, Courier, monospace;">$ git clone ssh://name@hostname.com:123/path/to/hosted/repo</span><br />
<br />
Another benefit of hosting the repo remotely is for backups. The cloned copies <a href="http://stackoverflow.com/questions/4658451/can-a-local-git-clone-be-considered-a-complete-backup-of-the-repo-it-was-cloned">each serve as backups</a>, and the remote repo itself can be backed up from the server. As one still getting used to Git, I immediately made an erroneous commit that I had already pushed to the remote server. While reverting this change can be difficult once on the remote server, in this case I merely had to enter the Time Machine backup software and restore the folder on the remote machine from a preceding backup. This simple solution is of course much more feasible given the simplicity of the project on such a simple server.David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-66199372144150304702013-05-06T21:42:00.000-07:002018-08-15T00:35:42.673-07:00Migrating a Sourceforge repository from Subversion to GitI still remember when a friend at church came up to me and said, "I'm gonna tell 'bout something you're gonna love. It's called Subversion." At the time, CVS had been the main version control system for keeping track of files, and it had revolutionized my way of thinking about backups and record-keeping. But CVS had its limitations, including lack of basic functionality such as renaming files cleanly. Subversion was like "a breath of fresh air," where seemingly all of the limitations of CVS went "poof."<br />
<br />
But alas, the world has moved on, and Git has grit its teeth deeply into the stronghold of Subversion. Having built so many projects with Subversion behind the scenes, I was rather reluctant to git over to Git. I knew it was only a matter of time, however, and finally decided that I must give it a shot, starting with one of the several Sourceforge projects I administer.<br />
<br />
Sourceforge supports a number of version control systems, including both Subversion and Git. Surprisingly, the documentation for migrating a Subversion repository to Git on Sourceforge was rather sparse, and as far as I can see, there's no auto-migration mechanism to simplify the task. Fortunately, there are many other tools to simplify the process, which I'd like to document for posterity here.<br />
<br />
The beauty of the migration is that it doesn't require downloading the whole Subversion repository. The tool <a href="https://github.com/nirvdrum/svn2git">svn2git</a> can apparently work on the remote repository to do all the conversion, and then the resulting local Git repository can be pushed onto the Sourceforge-hosted remote Git repo.<br />
<br />
On my Mac, I first made sure that git, git-svn, ruby, and rubygems were installed. All the packages must have come with XCode Developer Tools as they were all already installed and ready to go. I next installed svn2git using the simple command:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ sudo gem install svn2git</span><br />
<br />
I then created a new directory to hold the new repository and entered it:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ mkdir jaj</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ cd jaj</span><br />
<br />
The simplest command for import, which assumes the standard trunk/tags/branches layout, would have been (for my "jarajar" project with mountpoint "code"):<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ svn2git https://svn.code.sf.net/p/jarajar/code</span><br />
<br />
To map the author names to Sourceforge email addresses, I made a simple authors.txt file of the format:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sourceforgeusername = name@users.sourceforge.net</span><br />
<span style="font-family: Courier New, Courier, monospace;">sourceforgeusername1 = name2@users.sourceforge.net</span><br />
<br />
<a href="https://help.github.com/articles/importing-from-subversion">GitHub recommends</a> import of each project within a Subversion repository to a separate Git repo. In my case, my Subversion repo was laid out for multiple projects, even though it really only contained one. To import only this project, I pointed svn2git to this project folder alone and passed the "--rootistrunk" argument:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ svn2git https://svn.code.sf.net/p/jarajar/code/trunk/jarajar --rootistrunk --authors ~/authors.txt</span><br />
<br />
Note that in the process of experimenting, I had failed imports that kept on failing, even though the subsequent commands were correct as far as I could tell. It turns out that the import process created a .git folder that had become corrupted and was preventing subsequent exports, even with the correct command. Deleting the .git file fixed these errors to start afresh, and running the commands with the "--verbose" command greatly simplifying troubleshooting.<br />
<br />
Once I had imported the repository into my new local Git repo, I simply needed to push it to the Sourceforge-hosted Git repo. After creating an empty Git repo using the Sourceforge project Admin tool, I followed the <a href="https://sourceforge.net/p/forge/documentation/Git/">Sourceforge import instructions</a> for pushing a local repository (conducted from within the same directory):<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$ git remote add origin ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git config branch.master.remote origin</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git config branch.master.merge refs/heads/master</span><br />
<span style="font-family: Courier New, Courier, monospace;">$ git push origin master</span><br />
<br />
And voila, my Subversion repository popped up in my Git repo, including all historical dates from revisions of old. Had I imported the entire project, maybe I would even see that venerable commit message, "New repository initialized by csv2svn." And back then, that had to be done by a Sourceforge engineer.David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-19902396758816484432012-12-31T17:22:00.000-08:002012-12-31T17:22:57.012-08:00The year's sunsetAs we trail off toward the sunset of the year, it's hard to imagine that but one year has passed on by. The year has been one of my most exhausting ones yet also one of the most fulfilling, and I'm deeply thankful for God's sustenance throughout it. Just this time last year I thought I would soon be leaving the San Francisco and the Sunset District, yet here He has placed me, and now more than ever the Sunset has felt like home. And what better way to celebrate than with a sunset such as this on a routine walk back home?<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivtn_c0v7ibq0ek0Ro36_YAgI7xNzKGi_2umTGYeKYtrNgdzBHgXJ6kBW8Zh40PzWDK9MstF5C-4LQP5y_PsUdFufbG3zxyE78Wt5z3_Ponf3JUkR9pVdbZABRhjoz3llqc3Xc/s1600/SunsetInTheSunset2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivtn_c0v7ibq0ek0Ro36_YAgI7xNzKGi_2umTGYeKYtrNgdzBHgXJ6kBW8Zh40PzWDK9MstF5C-4LQP5y_PsUdFufbG3zxyE78Wt5z3_Ponf3JUkR9pVdbZABRhjoz3llqc3Xc/s640/SunsetInTheSunset2.jpg" width="480" /></a></div>
<br />David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com1tag:blogger.com,1999:blog-9828000.post-824575678320179072012-10-03T21:45:00.000-07:002013-07-03T21:30:31.530-07:00Let's go Oakland...Apparently ESPN's "Baseball Think Factory" <a href="http://espn.go.com/blog/sweetspot/post/_/id/29591/miracle-as-cap-miracle-run-to-division-title">thought that the A's</a> had a 0.4% chance of winning the division. Maybe from here on out our baseball thinking caps should bear the large letter "A" on it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4IX7N34uFbA/UA4F0G01vYI/AAAAAAAACnI/gQLoO_3ODHE/s1600/IMG_6126.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="http://2.bp.blogspot.com/-4IX7N34uFbA/UA4F0G01vYI/AAAAAAAACnI/gQLoO_3ODHE/s400/IMG_6126.JPG" width="300" /></a></div>
<br />
Or maybe a samurai hairstyle.David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com0tag:blogger.com,1999:blog-9828000.post-20975512928712691042012-07-18T14:52:00.000-07:002012-07-18T14:53:43.543-07:00Browsing Apache Derby databasesIt can be fun to run complex queries on databases by command-line tools, but sometimes the beckon of a graphical aid is just too strong. Since migrating the <a href="http://blog.textflex.com/2010/06/managing-your-txtfl-database.html">tXtFL</a> leagues/teams/players/etc from a convoluted structure of individual files to a simple database, I've enjoyed using the OpenOffice.org/LibreOffice Base application for browsing data. I use LibreOffice anyway for much of my office needs, and setup for database grazing was <a href="http://blog.textflex.com/2010/06/managing-your-txtfl-database.html">a mere 11 steps</a>.<br />
<br />
There were a few shortcomings, however, that propelled me to explore a few database browsing alternatives. LibreOffice isn't the lightest of programs, both in terms of disk and RAM consumption as well as startup time, so taking a quick peek at the data can take longer than expected. Moreover, LibreOffice locks the database until the entire office suite is closed, preventing me from accessing the db from the tXtFL app until I've closed LibreOffice--including any other LibreOffice apps still open.<br />
<br />
So what are the alternatives? Browsing the <a href="http://en.wikipedia.org/wiki/Comparison_of_database_tools">Wikipedia database tool comparison table</a>, I found a number of open-source alternatives that support JDBC connections, which are required for connecting to the Apache Derby database that my app uses. My goal was to test out the ease of setup and connection to the database both via embedded and network modes. In embedded mode, only one program can access the database at a time, whereas in network (client/server) mode, my app hosts the db for a concurrent connection from the db browser.<br />
<br />
As setup wasn't always completely straightforward for each of the apps, I've outlined the steps below using the scenario of connecting to the tXtFL database.<br />
<br />
<h3>
Getting the database driver (Apache Derby)</h3>
<div>
<br /></div>
For all of these programs, I ended up needing to manually add the database drivers. You can pick them up from the <a href="http://db.apache.org/derby/derby_downloads.html">Apache Derby download page</a>. I used the latest current release (10.9.1.0), and the <span style="font-family: 'Courier New', Courier, monospace;">lib</span> or <span style="font-family: 'Courier New', Courier, monospace;">bin</span> packages should be fine. All you'll need is the <span style="font-family: 'Courier New', Courier, monospace;">derby.jar</span> file, plus the <span style="font-family: 'Courier New', Courier, monospace;">derbyclient.jar</span> file if you're connecting to a Derby db in network mode.<br />
<br />
<h3>
LibreOffice</h3>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2r23mNJ90XChznAB5AGLdjhXHg0XZd_vBj8mezqhzef1BCH5H7BoKi7GgVJyZmwQ3hi-3cv6xqzkDolamVGycY0bmjXad7cOmFZd_cFfhQ70ynKiNiY36RjJrXHx8S86VL5LM/s1600/tXtFL-db-libreoffice_emb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2r23mNJ90XChznAB5AGLdjhXHg0XZd_vBj8mezqhzef1BCH5H7BoKi7GgVJyZmwQ3hi-3cv6xqzkDolamVGycY0bmjXad7cOmFZd_cFfhQ70ynKiNiY36RjJrXHx8S86VL5LM/s320/tXtFL-db-libreoffice_emb.png" width="320" /></a></div>
<br />
If you already use <a href="http://www.libreoffice.org/">LibreOffice</a> for its excellent word processor and spreadsheet capabilities, why not give it a shot for database management? I've <a href="http://blog.textflex.com/2010/06/managing-your-txtfl-database.html">previously described</a> the process but wanted to update it hear in a more streamlined fashion.<br />
<ol>
<li>In Tools > Options > Java, click on Class Path > Add Archive. Browse to and select the <span style="font-family: 'Courier New', Courier, monospace;">derby.jar</span> file you downloaded from the Derby website, then click OK.</li>
<li>In File > New > Database, choose "Connect to existing database," select JDBC, and press Next.</li>
<li>For the Datasource URL, choose your path, such as <span style="font-family: 'Courier New', Courier, monospace;">derby:C:\Users\[username]\.txtfl3\FootballDB</span> for the tXtFL db.</li>
<li>For the JDBC driver class, enter <span style="font-family: 'Courier New', Courier, monospace;">org.apache.derby.jdbc.EmbeddedDriver</span>.</li>
<li>Enter your username/password (or skip it for tXtFL) and save the file.</li>
<li>Click on Tables to start browsing your data!</li>
</ol>
<div>
For connecting to Derby in networking mode, you can repeat the same steps, with the following adjustments:<br />
<br />
<ul>
<li>Add the <span style="font-family: 'Courier New', Courier, monospace;">derbyclient.jar</span> file to the Class Path list.</li>
<li>Point the Datasource URL to <span style="font-family: 'Courier New', Courier, monospace;">derby://localhost:1527/C:/Users/[username]/.txtfl3/FootballDB</span> (or whatever your server address is).</li>
<li>If you're running tXtFL, make sure that in the tXtFL Options pane, "Open database as server to allow multiple connections" is checked and that the program is running!</li>
</ul>
<div>
<div>
Unfortunately I cannot post a current screenshot of the database browser in action as it failed to load. I have Java 64-bit installed, and apparently 32-bit Java is required for LibreOffice on Windows. Another quirk is that when scrolling data, the table only advances line-by-line, which can be slow. Pressing the arrow to advance to the end of the table and then backing up to the line of interest can speed the process. Nonetheless, LibreOffice has served my db browsing very well for several years, and I will certainly be watching for continued updates to the suite.<br />
<br /></div>
</div>
</div>
<div>
<h3>
SquirrelSQL</h3>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU7kDbx5sbnTEdUYsS9rWRf1Bs5L1b5GNbJVNnLd9p4MrcDecbxOAjt1bTUn1CuPAuN_3xcGEfAroZ4FZ_-0DUMED6ZlX5PlSu76FpAjkAq-4761X5GnuO_hrpf2wNXgitkLIs/s1600/tXtFL-db-squirrelsql_client.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="303" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU7kDbx5sbnTEdUYsS9rWRf1Bs5L1b5GNbJVNnLd9p4MrcDecbxOAjt1bTUn1CuPAuN_3xcGEfAroZ4FZ_-0DUMED6ZlX5PlSu76FpAjkAq-4761X5GnuO_hrpf2wNXgitkLIs/s320/tXtFL-db-squirrelsql_client.png" width="320" /></a></div>
<div>
<br /></div>
<div>
I learned about <a href="http://squirrel-sql.sourceforge.net/">SquirrelSQL</a> from Apache Derby's own website. At about 35 MB, the app weighs in at a much more economical size than LibreOffice does while still providing all of the functionality as a db browser. And although startup time wasn't any snappier, a <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1541325&group_id=28383&atid=393414">patch from way back in 2007</a> ensured that disconnecting from the database released the lock, without having to shut down the entire program. That means that you can flip back and forth with ease between viewing your db and running your program that depends upon it. Of all the db browsers I tried, only this program appeared to <a href="http://old.nabble.com/Disconnecting-Derby-and-TDD-td34157618.html">employ the Derby command</a> to fully shutdown the database without shutting down the program.</div>
<div>
<ol>
<li>When installing the program, I used the <span style="font-family: 'Courier New', Courier, monospace;">squirrel-sql-x.y.z-install.jar</span> installer. Make sure to <b>choose the Derby plugin during installation</b>, as apparently this plugin brings the crucial patch to disconnect the db completely.</li>
<li>In the Aliases pane, press "+" to add a new alias.</li>
<li>Press New to add the Derby driver. In the Extra Class Path tab, press Add to pull <span style="font-family: 'Courier New', Courier, monospace;">derby.jar</span> into the list, and then press List Drivers to automatically load in the drivers. I tried using the supplied derby.jar from the program's plugins folder but could not get it to load successfully.</li>
<li>For the URL, use the same paths as above or wherever you've stored your own db.</li>
<li>Press OK to open the db.</li>
<li>In the tree, open TXTFL > TABLE to find all the tXtFL tables.</li>
<li>Wait, what happened to all the entries after 100? In File > New Session Properties, open the Object Tree tab and uncheck the "Contents - Limit rows" box to see your complete tables.</li>
</ol>
<div>
Again, you can repeat the steps but with <span style="font-family: 'Courier New', Courier, monospace;">derbyclient.jar</span> and the network URL address to connect to the db in network mode. Note that for some reason, a <b>username/password must be supplied</b> even if your db does not have or use one. Fortunately, I simply supplied a single letter for both fields (eg "a" for username and password) and connected without a hitch.<br />
<br /></div>
</div>
<div>
<h3>
DBEdit2</h3>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEuVVgB1MMDmX4XmTG0zSx4-bspgH-1A2qnSmCpqeDeuyaHGaY3U3_HiQFbNyE7o1AuyRWCusvsAI0R8MdzGSRLpirL5w8d1NJ7Lk2qHXaTZCOqxWJHvTG7c6CizPI6Fv0-ICX/s1600/tXtFL-db-dbedit2_client.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="289" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEuVVgB1MMDmX4XmTG0zSx4-bspgH-1A2qnSmCpqeDeuyaHGaY3U3_HiQFbNyE7o1AuyRWCusvsAI0R8MdzGSRLpirL5w8d1NJ7Lk2qHXaTZCOqxWJHvTG7c6CizPI6Fv0-ICX/s320/tXtFL-db-dbedit2_client.png" width="320" /></a></div>
<div>
<br /></div>
<div>
I loved using <a href="http://dbedit2.sourceforge.net/">DBEdit2</a> only because it's so pleasantly minimalistic. It's but a fraction of the size of LibreOffice, starts up happily snappily, and does away with all but the bare necessities in its interface.</div>
<div>
<ol>
<li>Before opening the program, drop <span style="font-family: 'Courier New', Courier, monospace;">derby.jar</span> into the DBEdit2 program folder (eg <span style="font-family: 'Courier New', Courier, monospace;">C:\Program Files (x86)\DBEdit 2</span>), replacing the older version (10.7) that's there.</li>
<li>In Connections, choose Add, then Derby.</li>
<li>As far as I can tell, the Input dialog box doesn't actually create a file in that location and may actually just be for naming your new connection.</li>
<li>In the Connection dialog, add the URL as above. For network connections, the username/password can be filled as for SquirrelSQL (eg "a" for each field).</li>
<li>Once you've made your connection, you're presented with a totally blank screen. Fear not! To browse your data, you can directly input sql commands. As an extra aid, the Help menu helpfully includes an "Insert 'select * from'" shortcut to do just that for you in the sql text area, and then you can click on the icon on the far upper right to browse your db schema and double click on tables to drop their name into the sql command. When you're ready to roll, press the blue "Play" icon to run the command. Voila!</li>
</ol>
<div>
Clearly this option may not be for all, but I do plan to experiment further with it. Reminds me a bit of the beloved SQLiteBrowser, or an even simpler version of it.<br />
<br /></div>
</div>
<div>
<h3>
Orbada</h3>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIEs3i9o7rQkhi-CNvT-fNbee2hs4FyfRHdhtN1_N3SC1l9TekBAhrT2Ab6WF1YWCgcJNFfociVZXGPFzqa5NsTMf4VvhO5fQJVHE8iDqz7cHErLnJBrOy6Bu0SZwiZNDbm4cJ/s1600/tXtFL-db-orbada_emb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIEs3i9o7rQkhi-CNvT-fNbee2hs4FyfRHdhtN1_N3SC1l9TekBAhrT2Ab6WF1YWCgcJNFfociVZXGPFzqa5NsTMf4VvhO5fQJVHE8iDqz7cHErLnJBrOy6Bu0SZwiZNDbm4cJ/s320/tXtFL-db-orbada_emb.png" width="320" /></a></div>
<div>
<br /></div>
<div>
Perhaps the king of the pack in terms of full-on complexity is <a href="https://sourceforge.net/projects/orbada/">Orbada</a>. It's on par with SquirrelSQL in size and startup time as well as walloping with features and a complex interface, but with an extra splash of color to liven things up a bit and a flurry of additional wizards to make you feel as if setup is easier.</div>
<div>
<ol>
<li>In the Program > New connections... dialog, press Drivers, then New.</li>
<li>Name the driver as you like, and then browse to your <span style="font-family: 'Courier New', Courier, monospace;">derby.jar</span> file using the button next to the Source of driver drop-down. Press the refresh button next to the Class drop-down to pick up the autoloaded driver. Press OK, then Close.</li>
<li>Back in the connections dialog, press New to define your connection.</li>
<li>Name it as you like (regardless of the prompting), then choose your derby driver.</li>
<li>The series of text fields are supposedly supposed to walk you through the URL syntax, but I found it easier just to copy and paste in the URL from above into the Connection string field. Note that username/password is not required, even for networked connections, in this app.</li>
<li>Once you've connected, you can write sql commands as in DBEdit2, or you can be lazy and go to View > Browse tables (JDBC) to view them in all their colorful glory.</li>
</ol>
<div>
As with LibreOffice and DBEdit2, the entire program must be shut down when connected to an embedded db to free it for access from another program. In network mode, the database can be disconnected without shutting down the program, but make sure to commit (Connection > Commit changes) prior to disconnecting.</div>
<div>
<br /></div>
<div>
So there you have it, four free alternatives to view your Apache Derby database (or many others). I had been hoping to find a one-download, one-click option, but instead I found 4 options that required at least 5-6 steps. Well I suppose that if the steps here reduce the number of steps to manually query and debug the database, the investment may be worthwhile. Certainly the price of the software was.</div>
</div>David Younghttp://www.blogger.com/profile/16757270705896494512noreply@blogger.com1