tag:blogger.com,1999:blog-54595386518421101532017-12-13T06:15:22.599-08:00Vern's ConsciousnessVern's Consciousness is a blog by Vern Martin. Its first purpose is to share computer related "how tos." I rely a lot on the posts of others who share such things. It's time to give back.Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.comBlogger50125tag:blogger.com,1999:blog-5459538651842110153.post-72529642179636999152017-09-30T08:04:00.000-07:002017-09-30T08:04:54.329-07:00Nginx + Passenger + Ruby: Getting it to Work the First Time<div dir="ltr" style="text-align: left;" trbidi="on"><h2 style="text-align: left;">Getting Ruby App Working for the First Time</h2><div style="text-align: left;">Getting Nginx to run your Ruby app for the first time may be easy, but it likely will run into some difficulties. A very common problem from what I can see on the web is that some gem won't install. After quite a bit of digging and a little guessing I finally got it work. And in particular, I solved the common "bundle install" error. Since I could not find any reference to my particular solution on the web, I'm sharing it here.</div><h3 style="text-align: left;">Install</h3><div style="text-align: left;">Nginx is install as is Fusion using the "setup and deploy" reference below. Worked well. </div><h3 style="text-align: left;">Run in Development Mode</h3><div style="text-align: left;">Passenger was failing, but it was not telling me much because it was running in production mode. I wanted more detail right in the browser. I could have found a lot of detail either in /tmp (there were passenger logs there) and /var/log/nginx. But instead I set "rails_env" to "development" in /etc/nginx/sites-enabled/default and then I saw lots of details in the browser.</div><h3 style="text-align: left;">Error #1</h3><div style="text-align: left;">I configured Nginx to run my app, and the first issue I ran into was found in /etc/nginx/passenger.conf: the "passenger_ruby" setting was set to some ruby that didn't exist. So, I set that value to the output of the "which ruby" command which happens for me to be /usr/local/bin/ruby.</div><div style="text-align: left;"><br /></div><h3 style="text-align: left;">Error #2</h3><div style="text-align: left;">In one of the passenger log files in /tmp, I saw reference to a failure to run "make" This, it turns out, was not a fatal error, but I fixed it anyway by:</div><div style="text-align: left;"><br /></div><div style="text-align: left;">mkdir -p /home/&lt;my user&gt;/.passenger/native_support/5.1.8/ruby-1.9.3-x86_64-linux<br />cd /home/&lt;my user&gt;/.passenger/native_support/5.1.8/ruby-1.9.3-x86_64-linux<br />/usr/local/bin/ruby /usr/share/passenger/ruby_extension_source/extconf.rb</div><div style="text-align: left;"><br /></div><div style="text-align: left;">And then running "make" which produced the following files:</div><div style="text-align: left;"><br /></div><div style="text-align: left;">passenger_native_support.o<br />passenger_native_support.so<br /></div><div style="text-align: left;"></div><h3 style="text-align: left;">Error #3 and Final Solution</h3><div style="text-align: left;">Now I was getting a bit further and hitting the seemingly typical "It looks like Bundler could not find a gem." error. I reviewed: <a href="https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-application-reports-during-startup-that-it-cannot-find-a-gem">https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-application-reports-during-startup-that-it-cannot-find-a-gem</a></div><div style="text-align: left;">but so far no joy. I looked closer at the error:</div><div style="text-align: left;"><br /></div><div style="text-align: left;">"git://github.com/rails/activerecord-session_store.git (at master@b5e7da2) is not yet checked out. Run `bundle install` first. (Bundler::GitError)"</div><div style="text-align: left;"><br /></div><div style="text-align: left;">I had run "bundle install" and "bundle update" many names for my application, and I looked in the "Gemfile" ans saw the following line:</div><div style="text-align: left;"><br /></div><div style="text-align: left;">gem 'activerecord-session_store', github: 'rails/activerecord-session_store'</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Well, "bundle install" and even "bundle update" ran for me at a command line with no issue, but my application was still reporting the same bundle error.&nbsp;</div><div style="text-align: left;"><br /></div><div style="text-align: left;">I happened to see something in "bundle help" and guessed it might help, so I ran:</div><div style="text-align: left;"><br /></div><div style="text-align: left;">bundle package --all</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><i>And that was the solution! App would finally come up.</i></div><h4 style="text-align: left;"><i>What "bundle package --all" does</i></h4><div style="text-align: left;"><i>"</i>bundle package" bundless all the .gem files needed to run the application in th the "vendor/cache" directory. Since my error involved "git" I included "--all" which also packages git and path directories. That didn't seem to be necessary, but I did it just in case.</div><div style="text-align: left;"><i></i><br /></div><div style="text-align: left;">For more information, run the "bundle help" or "bundle package --help" command.</div><div style="text-align: left;"><br /></div><h3 style="text-align: left;">Most helpful References </h3><br /><br /><a href="http://geekhmer.github.io/blog/2016/07/13/setup-and-deploy-ruby-on-rails-on-ubuntu-16-dot-04-or-latest/">http://geekhmer.github.io/blog/2016/07/13/setup-and-deploy-ruby-on-rails-on-ubuntu-16-dot-04-or-latest/</a><br /><br />Most helpful trouble shooting reference:<br /><br /><a href="https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/">https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/</a><br /><br />Most specifically to my issue:<br /><br /><a href="https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-application-reports-during-startup-that-it-cannot-find-a-gem">https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-application-reports-during-startup-that-it-cannot-find-a-gem</a><br /><br /><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-27041802714506071372017-04-16T15:56:00.000-07:002017-04-16T16:10:35.650-07:00Elementary OS: Free Installation<div dir="ltr" style="text-align: left;" trbidi="on"><h2 style="text-align: left;">Don't be Intimidated</h2><div>Elementary OS (<a href="https://elementary.io/">https://elementary.io/</a>) has received a reasonable amount of press. It's a Linux distro with a pretty face and has been getting positive reviews. BUT: it wants to know how much $$ you're going to pay before you proceed to download it. What? <u>A Linux distro that costs $$? Well, that's the way it appears.</u> And, if you download it and love it, you should consider contributing with a donation. But what if you just want to check it out first? Click on download and up pops a dialog to collect some money. Is there a free alternative? Yep:</div><div><br /></div><div>BEFORE you click on download, click into the "Custom Amount" field and type 0.00 and then click on the Download button. The next dialog will let you click another Download button to get the download started. Once downloaded, if you run the .ISO file line any other distribution, you can "try" it (live CD) or "install" it. One way to both install and try it out of course it to create a new Virtual Machine using something like&nbsp;<a href="https://www.virtualbox.org/wiki/VirtualBox">Oracle Virtual Box</a>. You can install Elementary OS as well as Oracle Virtual Box without spending a dime.<br /><br />For a nice introduction to this distro, see:&nbsp;<a href="https://en.wikipedia.org/wiki/Elementary_OS">https://en.wikipedia.org/wiki/Elementary_OS</a>. Note that it's built on <a href="https://en.wikipedia.org/wiki/Ubuntu_(operating_system)">Ubuntu LTS</a>.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-c-xa_Z3no2E/WPPzxZivopI/AAAAAAAAAN0/Z_wNQcgym1Upj3YW-8cSlx0yZ_l-jdRMwCK4B/s1600/Selection_012.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="https://2.bp.blogspot.com/-c-xa_Z3no2E/WPPzxZivopI/AAAAAAAAAN0/Z_wNQcgym1Upj3YW-8cSlx0yZ_l-jdRMwCK4B/s400/Selection_012.bmp" width="400" /></a></div><div><br /></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-mfESqxLePSk/WPPz78MqRfI/AAAAAAAAAN8/7FUXyWS9plQRqhbrTXsHtFN0bCevt3yYACK4B/s1600/Selection_011.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://3.bp.blogspot.com/-mfESqxLePSk/WPPz78MqRfI/AAAAAAAAAN8/7FUXyWS9plQRqhbrTXsHtFN0bCevt3yYACK4B/s400/Selection_011.bmp" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-HfarU1lGVc8/WPP4YwGOqzI/AAAAAAAAAOI/klHbpiU_Rw8OPcm40ZQtkHZrvoAeo0EUACK4B/s1600/Selection_013.bmp" imageanchor="1"><img border="0" height="311" src="https://3.bp.blogspot.com/-HfarU1lGVc8/WPP4YwGOqzI/AAAAAAAAAOI/klHbpiU_Rw8OPcm40ZQtkHZrvoAeo0EUACK4B/s400/Selection_013.bmp" width="400" /></a></div><div><br /></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-54906626198314302572016-04-27T17:41:00.003-07:002016-04-27T17:41:41.678-07:00Getting Started with Virtual Machines and Linux<div dir="ltr" style="text-align: left;" trbidi="on">If you're looking for some simple instructions for getting a Linux Virtual Machine up and running, here are some I created for a friend of mine:<br /><br /><a href="https://www.blogger.com/"></a><span id="goog_1181683266"></span><span id="goog_1181683267"></span><a href="https://www.dropbox.com/s/1g779mky9qb0zol/GettingStartedWithVirtualMachines.docx?dl=0">Getting Started with Virtual Machines</a></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-12844476072787308502016-04-04T18:58:00.003-07:002016-04-04T18:59:47.109-07:00Defecting to Linux Mint<div dir="ltr" style="text-align: left;" trbidi="on">Back in 1998 I was at a Perl conference in San Jose, California. The SUSE folks were there and handed me a copy of OpenSUSE. I installed it, loved it, and have used it ever since -- until now. Over the past couple of years, I've kept my eye on Linux Mint. I liked what I saw. Recently I was in the mood to upgrade my trusty Linux VM running in Oracle VirtualBox. I finally settled on Linux Mint and had everything up and running fairly quickly: CrashPlan, MySQL, Ruby on Rails, Guake Terminal.<br /><br />I ran this for a couple of weeks and decided to give the latest OpenSUSE a try: Leap 42.1. Well, as usual, it was much more laborious. For instance, I had to refresh my memory on how to get CrashPlan to start automatically. I worked long and hard to get all the various Ruby on Rails libraries compiled. And MySQL? Well, MariaDB is pretty good, but MySQL Workbench, while it works, just doesn't work as well and constantly nags about certain features not being available.<br /><br />But, after working all day, I had most everything I needed. <i><b><u>Except one thing</u></b></i>: Linux Mint just looked better. The fonts were more appealing, and in general, everything was crisper and better looking. So, I thought: must be the Cinnamon desktop. I did really like it. So, I installed Cinnamon in OpenSUSE and gave it a try instead of KDE Plasma. Nope. Still did not look as nice.<br /><br />So, I went back to my Linux Mint instance, despite it still complaining about running in "rendering mode" (OpenSUSE when running in Cinnamon has the same issue on my laptop under VirtualBox). Guess I'm here to stay for a while. Nice distro. Still favor OpenSUSE in some ways. It's a bit more industrial quality, but Linux Mint is far more appealing -- and it was far easier and faster to get all my favorite stuff up and running.</div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-53117276736695976732015-10-30T03:50:00.001-07:002015-10-30T07:41:05.975-07:00From Android to iPhone: a Few Notes<div dir="ltr" style="text-align: left;" trbidi="on">After six years of Android phones (HTC was by far the best!), I'm now using an iPhone. But I'm still Google-centric. Here are a few notes:<br /><div><br /></div><div><ul style="text-align: left;"><li>The Google Calendar app for the iPhone is awesome. Love the scheduler view.</li><li>Google Maps works fine.</li><li>"Google" itself is ok. Seems to have trouble finding things at times. Fortunately, Siri is getting better.</li><li>Google Contacts: finally tamed this as follows:</li><ul><li>Log into iCould on a PC</li><li>Click on one contact</li><li>Use ctrl-A to select all</li><li>Hit the delete key</li><li>Wait! (Takes a while)</li><li>When prompted to delete, delete all the contacts</li><li>Use&nbsp;<a href="https://itunes.apple.com/us/app/contacts-sync-for-google-gmail/id454390333?mt=8">ContactSync</a>&nbsp;to manually sync from Gmail to iCloud</li><li>From that point on you can use a two-way sync if you like</li></ul></ul><div>My transition to the iPhone was made easy by several years of using an iPad. Android is getting so very good, that it's a toss up which OS you prefer. The key with Android is to get a phone you're happy with.&nbsp;</div></div><div><br /></div><div>For me the iPhone is the Cadillac of phones. Android is the Chevrolet. Both are nice, iPhone is a bit more luxurious -- and most of the time that's good, sometimes not so.</div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-10268990622679540432015-03-22T03:41:00.002-07:002015-03-22T03:41:47.165-07:00Software Licensing<div dir="ltr" style="text-align: left;" trbidi="on">"<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;">I'm not inclined to make grand pronouncements about the future of software, but if anything kills off commercial software, let me tell you, it won't be open source software. They needn't bother. <u>Commercial software will gleefully strangle itself to death on its own licensing terms.</u>" Jeff Atwood&nbsp;<a href="http://blog.codinghorror.com/why-ruby/">http://blog.codinghorror.com/why-ruby/</a></span><br /><br />Recently we went through an exercise at work in which we tracked down every use of the Oracle database for licensing audit purposes. In particular when I found out that a web app must now be tied directly to an end user I was incredulous. Why? On the back end we had a licensed "service account" accessing Oracle. We were in a sense simply providing a report view to whomever came along to use the application. Seemed reasonable to me, but I was very naive.<br /><br />So I second guessed IT management as I so very often do and looked into the issue myself. Unfortunately I found out that management has a right to be concerned. Even our company with its in-house lawyers was right to bring in high paid consultants to navigate Oracle's licensing. Suddenly all the Microsoft SQL Server fans were gloating. Gloating that is until they found out that Microsoft was moving in the same direction as Oracle and our existing licensing would expire at the end of the year.<br /><br />So, I agree with&nbsp;<a href="http://blog.codinghorror.com/about-me/">Mr. Atwood</a>: licensing could kill commercial software. It made me glad that my prejudice for personal projects has always been in the direction of free and open software development tools.</div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-14092054737034001572015-03-20T13:01:00.000-07:002015-03-20T13:03:19.198-07:00iPad: A Bit Less Impressed these Days<div dir="ltr" style="text-align: left;" trbidi="on">When I got my iPad4 a few years ago I was amazed at the battery life and rapid boot -- though most of the time it was just waking up from sleep. I hardly ever shut it off.<br /><br />These days I've seen what an Ultrabook with lots of RAM, a decent CPU, and a solid state drive can do running Windows 7. Now I understand my iPad better. It's always had a solid state drive and a reasonable about of RAM.<br /><br />For too many years I compared Apples and Oranges. Now that Ultrabooks have similar hardware to iPads in the form of solid state drives they are very comparable, much more useful, and if you put them to sleep as frequently as my iPad sleeps, their battery life is just as amazing as that of the iPad's.<br /><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-76316697186454787542015-03-20T10:43:00.002-07:002015-03-20T10:51:57.606-07:00NuGet for Visual Studio<div dir="ltr" style="text-align: left;" trbidi="on">Lately I've been doing a lot of Visual Studio development at work and at home. I don't like rewriting or copying common code from project to project. I strongly believe in the "DRY" principle of programming: "Don't repeat yourself." On the other hand, package management can be a pain.<br /><br />Installing third party software using&nbsp;<a href="https://www.nuget.org/">NuGet</a>&nbsp;is now so very easy. But I was not the only developer that thought it would be complicated to create and manage our own Nuget packages. How wrong I was!<br /><br />Creating and managing NuGet packages could not be easier, and NuGet takes so much of the pain out of managing shared code. It comes installed by default in the latest versions of Visual Studio, and if &nbsp;you don't have it, you can install it as an ad-on.<br /><br />Here are the simple steps to creating a NuGet package and making it available to your Visual Studio projects (or other software that accesses NuGet like <a href="http://www.monodevelop.com/">MonoDevelop</a>). These steps assume a C# project only because that's what I've been working with.<br /><ol style="text-align: left;"><li>Create, write, and build a library project (this is where you compile to a ".dll" file). Your shared code will be in the .dll</li><li>Download nuget.exe from&nbsp;<a href="https://nuget.codeplex.com/releases/view/58939">https://nuget.codeplex.com/releases/view/58939</a>&nbsp;and put it in your "PATH."</li><li>From an MS command shell, CD down into your <u style="font-style: italic; font-weight: bold;">project</u>&nbsp;directory (typically one level lower than your solution). This is the directory where your ".csproj" file exists. (Assuming your doing C# development.)&nbsp;</li><li>Edit your project assembly information (either through project properties or by editing AssemblyInfo.cs directly to fill in program description, company name, etc.</li><li>Run "<b>nuget spec</b>" to create a new ".nuspec" file.</li><li>Edit the nuspec file as you desire. Once you run the next step, you'll know better how you want to edit it based on the warnings you get form NuGet.</li><li>Run "<b>nuget pack</b>" to generate the ".nupkg" file, like: "CommonCode.1.0.0.0.nupkg"</li><li>Copy this and all other such package files to a directory of your choice. If you're sharing this with others, make sure they can access that directory. (This is the easiest way to create a NuGet repository, and the focus of this example.)</li><li>One time only: go into Visual Studio Tools-&gt;NuGet package manager-&gt;Package Manager Settings and under "NuGet Package Manager-&gt;Package Sources" add your package directory as a package source, naming your new "repository." Be descriptive and concise.</li></ol><div>Now when you have a solution open in Visual Studio, go to Tools-&gt;NuGet package manager-&gt;Manage NuGet Packages for Solution, look under "Online" and you will see the repository you added and whatever packages happen to be there.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-D00d330LqJI/VQxaBd0IWzI/AAAAAAAAAMo/_pPDMRJRoWw/s1600/you_package.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-D00d330LqJI/VQxaBd0IWzI/AAAAAAAAAMo/_pPDMRJRoWw/s1600/you_package.PNG" height="266" width="400" /></a></div><div><br /></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-7857386088954880412014-01-26T17:46:00.001-08:002014-01-26T17:46:27.022-08:00Getting CrashPlan out of the Way<div dir="ltr" style="text-align: left;" trbidi="on">I love CrashPlan (<a href="http://www.code42.com/crashplan/">http://www.code42.com/crashplan/</a>), but: by default it backs up EVERYTHING in a user's home directory. This creates real performance issues on Windows even if CrashPlan attempts to go easy on you while you're working. Even in Linux it can be a problem as applications like Firefox and Netbeans create so many hidden directories and files under your home directory. And then there's DropBox that never really deletes your files unless you work very hard to make sure they are gone.<br /><br />So, I have found the best strategy is to go in and completely de-select my home directory when configuring my CrashPlan backups, and then add ONLY the few things I really care to back up.<br /><br /><b><i><u>BIG GOTCHA IS THIS</u></i></b>: be sure to check the box that says "Show Hidden Files" or you will still get too much activity as Windows creates all sorts of junk files in your home directory.<br /><br />Ah, at last, I can get some work done without putting CrashPlan to sleep.<br /><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-85573952042266180732014-01-25T11:13:00.001-08:002014-01-25T11:13:55.904-08:00Ruby Development/Debugging with Netbeans 7.4 in openSUSE 13.1<div dir="ltr" style="text-align: left;" trbidi="on">Ruby development is possible with the latest version of Netbeans with a plugin, and Netbeans is by far my favorite Ruby development IDE -- and it's free unlike some of the others I've tried in Linux and couldn't get working anyway. Here are some tips:<br /><div><ol style="text-align: left;"><li>Download the latest Netbeans from&nbsp;<a href="https://netbeans.org/downloads/">https://netbeans.org/downloads/</a>&nbsp;(I download the full blown version. It downloaded fast and as will be seen below, you can choose later not to install things you don't want)</li><li>Downloaded was<span style="font-family: Courier New, Courier, monospace;"> netbeans-7.4-linux.sh</span> and run it as root. I chose to customize the install and install ONLY the Base IDE, Java SE, and "Features on Demand"</li><li>Netbeans installs nicely, and the IDE is found in the SUSE start menu without any extra effort (and I add it to my favorites for convenience).</li><li>Run Netbeans and make sure all is well.&nbsp;</li><li>Go to&nbsp;<a href="http://wiki.netbeans.org/RubySupport">http://wiki.netbeans.org/RubySupport</a>&nbsp;and find the link to the plugin which is currently&nbsp;<a href="http://plugins.netbeans.org/plugin/38549">http://plugins.netbeans.org/plugin/38549</a>. Download it (a zip file).</li><li>Unzip it where you like, in this example, it's unzipped in the following directory under the directory structure Netbeans creates in my home directory: <span style="font-family: Courier New, Courier, monospace;">/home/admvrm/.netbeans/7.4/my_plugins/ruby</span> -- a directory I created.</li><li>In Netbeans, Navigate to Tools-&gt;Plugins-&gt;Settings and click the "Add" button.</li><li>Change the url from <span style="font-family: Courier New, Courier, monospace;">http://</span> to<span style="font-family: Courier New, Courier, monospace;"> file://</span> and add your full path to the <span style="font-family: Courier New, Courier, monospace;">updates.xml</span> file. In my case, the url becomes: <span style="font-family: Courier New, Courier, monospace;">file:///home/admvrm/.netbeans/7.4/my_plugins/ruby/archive/build/updates/updates.xml</span></li><li>When done, click the "Available Plugins" tab, select "Ruby and Rails" and choose install. I chose to ignore all "unsigned" warnings about the files.</li><li>I chose to start restart the IDE as soon as the install is finished.</li></ol><div>Great. Now Netbeans understands Ruby and Rails and I can open my existing Ruby and Rails projects,. Next thing was to get the Ruby debugger working because it was failing. My first big clue came as I read&nbsp;<a href="http://stackoverflow.com/questions/4188963/rails-on-netbeans-uncaught-exception-no-such-file-to-load-script-server-or">http://stackoverflow.com/questions/4188963/rails-on-netbeans-uncaught-exception-no-such-file-to-load-script-server-or</a>. This helped me understand that I needed to fix<span style="font-family: Courier New, Courier, monospace;">&nbsp;/usr/lib64/ruby/gems/2.0.0/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide</span>. After some experimentation I found that I had to shift past an extraneous argument, and that was all I had to do. So, I made the following change to<span style="font-family: Courier New, Courier, monospace;"> rdebug-ide</span> and now I can debug console Ruby applications with Netbeans 7.4. Yay! It comes in handy from time to time.</div></div><div><br /></div><div>Changed:</div><div><br /></div><div><span style="font-family: Courier New, Courier, monospace;">Debugger::PROG_SCRIPT = ARGV.shift</span></div><div><br /></div><div>to:</div><div><br /></div><div><div><span style="font-family: Courier New, Courier, monospace;">script = ARGV.shift</span></div><div><span style="font-family: Courier New, Courier, monospace;">if script =~ /^_0/</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; script = ARGV.shift</span></div><div><span style="font-family: Courier New, Courier, monospace;">end</span></div><div><span style="font-family: Courier New, Courier, monospace;">Debugger::PROG_SCRIPT = script</span></div><div><br /></div></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com1tag:blogger.com,1999:blog-5459538651842110153.post-39871800149386120412014-01-20T15:48:00.001-08:002014-02-22T02:38:58.369-08:00Getting CrashPlan Working in openSUSE 13.1<div dir="ltr" style="text-align: left;" trbidi="on">I have come to rely on <a href="http://www.code42.com/crashplan/">CrashPlan </a>for my external cloud based backups. But installation proved problematic on openSUSE 13.1 64 bit. Here's how I solved the issue:<br /><ol style="text-align: left;"><li>Got into Yast software management and installed "eclipse-swt." The CrashPlan UI will crash complaining of "Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM" which is a bit of a red herring. I install eclipse-swt and it went away.</li><li>That solved, another error will occur. But I had to refer to&nbsp;<a href="http://support.code42.com/CrashPlan/Latest/Troubleshooting/CrashPlan_Client_Closes_In_Some_Linux_Installations">http://support.code42.com/CrashPlan/Latest/Troubleshooting/CrashPlan_Client_Closes_In_Some_Linux_Installations</a>&nbsp;and following its recommendation add "-Dorg.eclipse.swt.browser.DefaultType=mozilla" to the end of the&nbsp;GUI_JAVA_OPTS definition in the CrashPlan "run.conf" file.</li></ol><div>At this point, the CrashPlan service had not started, so I started it manually by running (as root):</div><div><br /></div><div>/etc/init.d/crashplan start</div><div><br /></div><div>Not sure if I had to do this, but I also ran:</div><div><br /></div><div>insserv /etc/init.d/crashplan</div><div><br /></div><div>However it was only after reboot that the CrashPlan service finally appeared in the list of services when I looked at the "Services Manager" And then everything was as it should be. It started automatically and was up and running.</div><div><br /></div><div><b>ONE OTHER CAVEAT: </b>if you happen to run the CrashPlanDesktop as root first, when you run it as some other user you may find you cannot start up because you cannot write to log files. If that is the case, make sure that you remove or chmod the ui_* logs in&nbsp;/usr/local/crashplan/log or wherever you installed CrashPlan.<br /><br /><u><b>And one final tip</b></u>: you might have to right click on the SUSE start menu and select "Edit Applications" and create your own link to the CrashPlanDesktop. And if you want icons, see /usr/local/crashplan/skin.</div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com3tag:blogger.com,1999:blog-5459538651842110153.post-73447200294254792312014-01-18T17:25:00.000-08:002014-01-18T17:25:57.518-08:00OpenSUSE: Making Oracle Java THE System Java<div dir="ltr" style="text-align: left;" trbidi="on">OpenSUSE comes with a subpar version of Java and some applications refuse to run on it. Replacing OpenJDK with the standard Java from Oracle is not difficult IF you have these resources at your fingertips:<br /><br />The following link is actually all you need, and it starts out by explaining why OpenSUSE does not come with the standard Java:<br /><br /><a href="http://en.opensuse.org/SDB:Installing_Java">http://en.opensuse.org/SDB:Installing_Java</a><br /><br />From the article, however, you should see the following key links:<br /><br /><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;">JDK download:&nbsp;<a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html" id="" shape="rect" style="border: 0px; color: #047ac6; line-height: 1.428571em; margin: 0px; padding: 0px;" target="_blank">http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html</a>&nbsp;</div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;"><br clear="none" /></div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;">Instructi0ns from Oracle:&nbsp;<a href="http://www.java.com/en/download/help/linux_x64_install.xml" id="" shape="rect" style="border: 0px; color: #047ac6; line-height: 1.428571em; margin: 0px; padding: 0px;" target="_blank">http://www.java.com/en/download/help/linux_x64_install.xml</a></div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;"><br clear="none" /></div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;">JRE download:&nbsp;<a href="http://java.com/en/download/linux_manual.jsp?locale=en" id="" shape="rect" style="border: 0px; color: #047ac6; line-height: 1.428571em; margin: 0px; padding: 0px;" target="_blank">http://java.com/en/download/linux_manual.jsp?locale=en</a>&nbsp;</div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;"><br /></div><div style="border: 0px; font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em; margin: 0px; padding: 0px;"><br /></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-69152279323012964482014-01-12T10:33:00.002-08:002014-01-12T10:43:38.220-08:00Using Paperclip to Upload and Display Images in a Rails 4 Application<div dir="ltr" style="text-align: left;" trbidi="on">I recently decided to add support for uploading images of "users" to my application. Table name was "users." It turned out to be pretty easy, but there were <u><b>a couple of gotchas</b></u>. And it seems that many of the notes online do not cover Rails 4 specifics. &nbsp;Here are some notes. First of all, some key resources:<br /><br /><a href="https://github.com/thoughtbot/paperclip/wiki/Installation">https://github.com/thoughtbot/paperclip/wiki/Installation</a><br /><br /><a href="https://github.com/thoughtbot/paperclip/wiki/Quick-Start">The Paperclip Quick Start Notes</a><br /><br /><a href="http://cumiki.com/ryooopan/notes/1384614048?repo=ryooopan/mitakalab-twitter">Someone Else's Rails 4 Paperclip Notes</a><br /><br />Here is my step-by-step for my Rails 4 Application:<br /><ol style="text-align: left;"><li>Added to my <span style="font-family: Courier New, Courier, monospace;">Gemfile</span> the following and then run "bundle install":&nbsp;<span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 1.428571em;">gem</span><span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 19.984375px;"> </span><span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 1.428571em;">"paperclip"</span><span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 1.428571em;">,</span><span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 19.984375px;"> </span><span style="font-family: Monaco, Courier, monospace; font-size: 14px; line-height: 1.428571em;">"~&gt; 3.1"</span></li><li><span style="font-size: 14px; line-height: 1.428571em;"><span style="font-family: inherit;">Added just one line to my model (</span><span style="font-family: Courier New, Courier, monospace;">user.rb</span><span style="font-family: inherit;">), (I'm placing my preferred "missing" image in </span><span style="font-family: Courier New, Courier, monospace;">public/system/users/avatar</span><span style="font-family: inherit;">, and note that I am using "</span><span style="font-family: Courier New, Courier, monospace;">avatar</span><span style="font-family: inherit;">" as my base field name for the image). Also note that Rails 4 does not like the use of "attr_accessible" as shown in the official Quick Start (<a href="https://github.com/thoughtbot/paperclip/wiki/Quick-Start" style="font-size: medium; line-height: normal;">The Paperclip Quick Start Notes</a>). Leave it out or you may get a message like "</span></span><span style="font-size: 14.40000057220459px; line-height: 19.98750114440918px;">`attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one.". Therefore, I only added the following one line to my model -- note that I wanted three versions of my file in addition to the "original"</span><span style="font-family: Monaco, Courier, monospace;"><span style="font-size: 14px; line-height: 1.428571em;">:&nbsp;</span></span></li><ul><li><span style="font-family: Courier New, Courier, monospace;"><span style="font-size: 14.40000057220459px; line-height: 19.98750114440918px;">has_attached_file :avatar, :styles =&gt; { :larger =&gt; '400x400', :medium =&gt; "200x200&gt;", :thumb =&gt; "100x100&gt;" },</span><span style="font-size: 14.40000057220459px; line-height: 19.98750114440918px;">:default_url =&gt; '/system/users/avatars/missing.jpg</span></span><span style="font-family: Monaco, Courier, monospace; font-size: 14.40000057220459px; line-height: 19.98750114440918px;">'</span></li></ul><li><span style="font-size: 14.40000057220459px; line-height: 19.98750114440918px;"><span style="font-family: inherit;">Generate my database migration with the following command:&nbsp;</span></span><span style="line-height: 1.428571em;"><span style="font-family: Courier New, Courier, monospace;">rails generate paperclip user avatar</span></span></li><li><span style="font-family: 'times new roman', times, serif; line-height: 1.428571em;">Migrate the changes to my database:</span><span style="line-height: 1.428571em;"><span style="font-family: Courier New, Courier, monospace;"> rake db:migrate</span></span></li><li><span style="font-family: 'times new roman', times, serif; line-height: 1.428571em;">And here is a very important step. Without it the database was not getting updated, but there was not indication of error. Added ":avatar" (or whatever you are calling your field) to the permitted parameters in my controller class (</span><span style="line-height: 1.428571em;"><span style="font-family: Courier New, Courier, monospace;">users_controller.rb</span></span><span style="font-family: 'times new roman', times, serif; line-height: 1.428571em;"> in my base). So:&nbsp;</span><span style="line-height: 22.856250762939453px;"><span style="font-family: Courier New, Courier, monospace;">params.require(:user).permit(:avatar, ...)</span></span></li><li><span style="line-height: 22.856250762939453px;"><span style="font-family: times new roman, times, serif;">I use&nbsp;</span><span style="font-family: Courier New, Courier, monospace;">&lt;%= image_tag @user.avatar(:larger) %&gt;</span><span style="font-family: times new roman, times, serif;"> in my&nbsp;</span><span style="font-family: Courier New, Courier, monospace;">form_for(@user,:multipart =&gt; true) do |f| </span><span style="font-family: times new roman, times, serif;">block to display the image. Note also the addition of "</span><span style="font-family: Courier New, Courier, monospace;">:multipart =&gt; true</span><span style="font-family: times new roman, times, serif;">" which is also key. Note that I am displaying the "larger" version of the file by specifying "</span><span style="font-family: Courier New, Courier, monospace;">(:larger)</span><span style="font-family: times new roman, times, serif;">". Leave off any specification if you just want the original size to display.</span></span></li><li><span style="line-height: 22.856250762939453px;"><span style="font-family: times new roman, times, serif;">In that same block I use the following to upload the image:&nbsp;</span></span><span style="line-height: 22.856250762939453px;"><span style="font-family: Courier New, Courier, monospace;">&lt;%= f.file_field :avatar %&gt;</span></span></li><li><span style="font-family: inherit;"><span style="line-height: 22.856250762939453px;">And finally I had to comment the following which appeared only in my config/environments/production.rb file as it was preventing the application from both finding the uploaded images and thus displaying them:&nbsp;</span></span><span style="line-height: 22.856250762939453px;"><span style="font-family: Courier New, Courier, monospace;">config.serve_static_assets &nbsp;= true</span></span></li></ol><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com4tag:blogger.com,1999:blog-5459538651842110153.post-53296623190004824182013-12-27T06:07:00.001-08:002014-01-26T18:06:52.211-08:00Upgrading Application from Rails 3 to Rails 4<div dir="ltr" style="text-align: left;" trbidi="on"><div style="text-align: left;">A few notes about upgrading a Rails 3 app to Rails 4. Looking back at all this effort now, it does not seem like I had to change much. Just a few little things -- but in a lot of places. The pain was in tracking down all the various changes. Took a lot of time along with trial and error. The right solution was not always obvious at first. And when I say "right" I mean the one that works for me. That's the only thing I claim: these appear to be working for me.</div><div><br /></div><div><ul style="text-align: left;"><li>First a word about "webrick:" In the course of all the changes I was making, I finally stopped using webrick and went to 'thin.' This eliminated some annoyances like 'Request URL too long'. To switch over to 'thin' was easy. Once the following steps were complete, "rails server" ran the 'thin' web server instead of 'webrick'</li><ul><li>run: "gem install thin"</li><li>edit Gemfile to add the line: gem 'thin'</li><li>run "bundle install"</li></ul></ul></div><div style="text-align: left;"><ul style="text-align: left;"><li>Routes needed a lot of attention as usual with any major upgrade. Routes seem now much more secure than they were. I found one trick that helped me understand the issues better. I added the following to one of my controllers temporarily:</li><ul><li>url = url_for :controller =&gt; :messages, :action =&gt; :message_to_group, :users =&gt; @users</li><li>raise url</li></ul><li>I don't claim to be an expert at routes by any means, but most of my definitions now look like the following and work:</li></ul><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; controller :preferences do</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; get 'preferences/edit' =&gt; 'preferences#edit'</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; post 'preferences/edit' =&gt; 'preferences#edit'</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; end</span></div><ul style="text-align: left;"><li>Speaking of security: now I have to "require" and "allow" parameters when updating records. Example:</li><ul><li><span style="font-family: Courier New, Courier, monospace;">@hour.update_attributes(params[:hour])</span> is <u>now</u>:</li><li><span style="font-family: Courier New, Courier, monospace;">@hour.update_attributes(hours_params_for_update) </span>where&nbsp;<span style="font-family: Courier New, Courier, monospace;">hours_params_for_update</span> is a function containing code like<span style="font-family: Courier New, Courier, monospace;">&nbsp;params.required(:hour).permit(:field1,:field2, etc.)</span></li></ul><li>ActionMailer has changed. Statement like:</li></ul><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; bcc to<br />&nbsp; &nbsp; from &nbsp; &nbsp; &nbsp; from<br />&nbsp; &nbsp; reply_to &nbsp; from<br />&nbsp; &nbsp; sent_on &nbsp; &nbsp;sent_at</span><br /><ol style="text-align: left;"><ul><li>Becomes:</li></ul></ol><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; mail(</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :bcc =&gt; to,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :subject =&gt; my_subject,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :reply_to =&gt; from,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :from =&gt; from</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; )</span></div><ul style="text-align: left;"><li>Visibility of methods that were "protected" changed, and I removed "protected" spec from them.</li><li>As I started into this, I saw it was a mistake to ignore the deprecation warnings I saw during the upgrade to Rails 3. So, this time I eliminated ALL of them:</li><ul><li><u><b>DEPRECATION WARNING: #apply_finder_options is deprecated.</b></u></li><li><u><b>DEPRECATION WARNING: This dynamic method is deprecated.</b></u></li><li>Many dynamic "finder options" methods are deprecated:</li></ul></ul><span style="font-family: Courier New, Courier, monospace;">EmailGroupsUser.find_all_by_email_group_id(params[:email_group_id])</span> <u>becomes</u>:<br /><span style="font-family: Courier New, Courier, monospace;">EmailGroupsUser.where(["email_group_id = ?",params[:email_group_id]])</span><br />See&nbsp;<a href="http://edgeguides.rubyonrails.org/4_0_release_notes.html#active-record-deprecations">http://edgeguides.rubyonrails.org/4_0_release_notes.html#active-record-deprecations</a></div><div style="text-align: left;"><ul style="text-align: left;"><ul><li><b><u>DEPRECATION WARNING: The following options in your EmailGroup.has_many :users declaration are deprecated: :order. Please use a scope block instead.</u></b></li></ul></ul></div><div style="text-align: left;"><div><span style="font-family: Courier New, Courier, monospace;">EmailGroup.paginate(:page =&gt; page,:per_page =&gt; EMAIL_GROUPS_PER_PAGE,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :conditions =&gt; ['UPPER(description) like ?',"%#{search_for}%"],</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; :order =&gt; "description desc"</span>) becomes:</div><div><span style="font-family: Courier New, Courier, monospace;">EmailGroup.order("description desc").where(['UPPER(description) like ?',"%#{search_for}%"]).paginate(:page =&gt; page,:per_page =&gt; EMAIL_GROUPS_PER_PAGE</span>)</div><div><ul style="text-align: left;"><ul><li><u style="font-weight: bold;">DEPRECATION WARNING</u><b><u>:&nbsp;Relation#all is deprecated</u></b></li></ul></ul></div><div><span style="font-family: Courier New, Courier, monospace;">VolunteerType.order("sort_level").all.map { |type| [type.description,type.level] }</span> <u>becomes</u>:</div><div><span style="font-family: Courier New, Courier, monospace;">VolunteerType.order("sort_level").map { |type| [type.description,type.level] }</span></div></div><div style="text-align: left;"><ul style="text-align: left;"><ul><li><b><u>DEPRECATION WARNING: The following options in your User.has_many :email_groups declaration are deprecated: :order. Please use a scope block instead.</u></b></li></ul></ul><span style="font-family: Courier New, Courier, monospace;">has_many :users, :through =&gt; :email_groups_users, :order =&gt; 'last_name,first_name,middle_name'</span> <u>becomes</u>:</div><div style="text-align: left;"><span style="font-family: Courier New, Courier, monospace;">has_many :users, -&gt; { order('last_name,first_name,middle_name') }, :through =&gt; :email_groups_users</span></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><ul style="text-align: left;"><ul><li><b><u>DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.1.</u></b>&nbsp;</li></ul></ul><div><span style="font-family: Courier New, Courier, monospace;">link_to("Refresh Test Data from Live (Production) PFERD","/preferences/refresh" ,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; {:confirm =&gt; 'This may take a few moments. Please wait until the screen is updated with a new status' }, :title =&gt; 'Refresh Data')</span> <u>becomes</u>:</div><div><div><span style="font-family: Courier New, Courier, monospace;">link_to("Refresh Test Data from Live (Production) PFERD","/preferences/refresh" ,</span></div><div><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; :data =&gt; {:confirm =&gt; 'This may take a few moments. Please wait until the screen is updated with a new status', :title =&gt; 'Refresh Data</span>' })</div></div><div><ul style="text-align: left;"><li>Images, JavaScript files, and style sheets moved down under the "app/assets" folder in <span style="font-family: Courier New, Courier, monospace;">images</span>, <span style="font-family: Courier New, Courier, monospace;">javascripts</span>, and <span style="font-family: Courier New, Courier, monospace;">stylesheets </span>folders respectively.&nbsp;</li><li>In application.html.erb:</li><ul><li>link to favicon changed:</li></ul></ul><span style="font-family: Courier New, Courier, monospace;">&lt;link rel="shortcut icon" href="/favicon.ico" /&gt;</span> <u>becomes</u>:</div><div><span style="font-family: Courier New, Courier, monospace;">&lt;%= favicon_link_tag 'favicon.ico' %&gt;</span></div><div><ul style="text-align: left;"><ul><li>stylsheet link changed:</li></ul></ul><span style="font-family: Courier New, Courier, monospace;">&lt;%= stylesheet_link_tag :all %&gt;</span> <u>becomes</u>:</div><div><span style="font-family: Courier New, Courier, monospace;">&lt;%= stylesheet_link_tag "scaffold", media: "all" %&gt;</span></div><div><br /></div><div><ul style="text-align: left;"><ul><li>javascript include changed. "defaults" no longer works, and without this changed "confirm" popups were no longer working.</li></ul></ul><span style="font-family: Courier New, Courier, monospace;">&lt;%= javascript_include_tag :defaults %&gt;</span> becomes:</div><div><span style="font-family: Courier New, Courier, monospace;">&lt;%= javascript_include_tag "application" %&gt;</span><br /><span style="font-family: Courier New, Courier, monospace;"><br /></span><br /><ul style="text-align: left;"><li><span style="font-family: Courier New, Courier, monospace;">config = Rails::Configuration.new</span><span style="font-family: inherit;"> becomes </span><span style="font-family: Courier New, Courier, monospace;">config = Rails.application.config</span><span style="font-family: inherit;"> so you can read the Rails configuration with lines like:</span></li></ul><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; host &nbsp; &nbsp; = config.database_configuration[Rails.env]["host"]</span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; database = config.database_configuration[Rails.env]["database"]</span><br /><span style="font-family: Courier New, Courier, monospace;"></span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; port &nbsp; &nbsp; = config.database_configuration[Rails.env]["port"]</span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; password = config.database_configuration[Rails.env]["password"]</span><br /><span style="font-family: Courier New, Courier, monospace;"></span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; user &nbsp; &nbsp; = config.database_configuration[Rails.env]["username"]</span><br /><div style="text-align: left;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></div></div><div><br /></div><div><br /></div></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-73035095722364281792013-04-21T11:18:00.000-07:002013-12-29T17:27:04.728-08:00Configuring Static IP in Suse Linux Using Yast<div dir="ltr" style="text-align: left;" trbidi="on"><div style="text-align: justify;">Here is a simple formula that worked to produce a static IP address which is under certain circumstances desirable. I make no claim that this is the best say, I only claim this worked. The method shown here uses standard network management.</div><br /><div style="text-align: justify;">Start with a DHCP configuration and capture the output of commands "ifconfig" and "route." Then capture the current values in in /etc/resolve.conf. Use those values to configure the following network configuration dialogs. Use "ifconfig" to show a current working IP address and mask. Use the addresses in resolv.conf for the DNS name refers. Use the output of the "route" command to see the default IP gateway.</div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-0Kc0PCl0UYs/UXQsh21BqaI/AAAAAAAAAK4/PqskoN7Yj-A/s1600/Photo+Apr+21,+1+51+33+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="321" src="http://4.bp.blogspot.com/-0Kc0PCl0UYs/UXQsh21BqaI/AAAAAAAAAK4/PqskoN7Yj-A/s400/Photo+Apr+21,+1+51+33+PM.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/--sS6V09e7PI/UXQsjQXYkrI/AAAAAAAAALA/mixmgNqTCi4/s1600/Photo+Apr+21,+1+51+34+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="319" src="http://4.bp.blogspot.com/--sS6V09e7PI/UXQsjQXYkrI/AAAAAAAAALA/mixmgNqTCi4/s400/Photo+Apr+21,+1+51+34+PM.png" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-_Y9EUqTFCbE/UXQskQT2PuI/AAAAAAAAALI/lcms_PMc5vg/s1600/Photo+Apr+21,+1+51+35+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="319" src="http://3.bp.blogspot.com/-_Y9EUqTFCbE/UXQskQT2PuI/AAAAAAAAALI/lcms_PMc5vg/s400/Photo+Apr+21,+1+51+35+PM.png" width="400" /></a></div><br /><img src="webkit-fake-url://6D4D6844-9847-42A3-A26E-645C30FBD96B/imagepng" /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-80577674279391681832012-11-03T04:42:00.001-07:002013-12-29T17:26:06.227-08:00Mobile Hotspot and Home Networking<div dir="ltr" style="text-align: left;" trbidi="on"><div style="text-align: left;"><b><u>Problem</u></b>: I wanted to configure my home network getting internet from my mobile hotspot (i.e. my phone) the same way as if I were getting internet from a cable or dsl modem. My Netgear wireless router (WNR834B) did not want to act as a repeater for the mobile hotspot even though it is theoretically possible to turn it into a wireless repeater. If there's a way, I could not figure it out.</div><div><br /></div><div><b><u>Solution</u></b>: I bought a Netgear "Range Extender" (WN2000RPT). It was able to connect to the mobile hotspot and configuration was pretty easy. It also provides the usual wireless security I had with my wireless router, i.e. I can prevent unknown Mac addresses from connecting wirelessly. My PC's on the other hand can be hard wired into the ports on the back of the range extender.</div><div><br /></div><div><u><b>One Caveat</b></u>: One minor problem I had to solve was that I did not want my IP addresses to change if the range extender was not connected to the mobile hotspot. Out of the box, it's designed to configure itself dynamically and it was reverting to default network configurations when not connected to the hotspot. The simple solution was to go into the "IP Address Setup" (after it's connected to the mobile hotspot) and choose to "Use Static IP Address." That locks in the IP configuration.</div><div><br /></div><div><b><u>Conclusion</u></b>: so far it's working great with the following benefits:</div><div><ol style="text-align: left;"><li>Communication between my two pc's is no longer routed through the mobile hotspot. This is (a) more secure and (b) a whole lot faster! And I do mean a very lot faster.</li><li>The pc's can both connect wirelessly to either to the extender or the mobile hotpot -- and they still get the same ip address and are on the same network. But they can also be wired into the back of the repeater -- or both at the same time for Windows 7.</li><li>Pc's can communicate with each other, even if the mobile hotspot is not up and running. So, when I leave the building for a while, my pc's can stay connected.</li></ol></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-31363084058249883782012-10-13T04:49:00.003-07:002013-12-29T17:26:23.674-08:00Salesforce Sub Queries created by the Force IDE Schema Browser<div dir="ltr" style="text-align: left;" trbidi="on"><br /><div style="text-align: left;">Today my goal was to finally begin to understand Salesforce Sub queries which offer a very powerful way to fold multiple queries into one single query which helps reduce the number of SOQL queries in any given transaction so as to avoid bumping into the SOQL query limit. I finally figured out how to use the Force IDE schema browser to write queries. Once I had working queries, I started understanding what I was looking at.</div><div style="margin-bottom: 0in;"><br /></div><div style="margin-bottom: 0in;">So: how do we create a query that has a sub query with the Force IDE schema browser?</div><div style="margin-bottom: 0in;"><br /></div><div style="margin-bottom: 0in;"></div><ol style="text-align: left;"><li>Fire up the Force IDE. In my case, I start the Eclipse IDE with the Force IDE plugin installed, drill down to "salesforce.schema" in a Salesforce project and double click on it.</li><li>The Opportunity object tends to be the master of many other objects and is a good object to start looking at. On the right hand side of the dialog under "Schema" find "Opportunity" and click on the triangle icon to expand. Next drill down into "Child Relationships."</li><li>Find a child like "Note" and expand that drilling down to "Fields" and select one like "Note Id."</li><li>Under "Query Results" to the left of the "Schema" window you've been working on, you'll see a query like:</li><ol><li><span style="font-family: Courier New, Courier, monospace;">Select id,name, (Select Id From Notes) From Opportunity o</span></li></ol><li>Here is a query that accesses the Opportunity and three other detail objects for which Opportunity is the master:</li><ol><li><span style="font-family: Courier New, Courier, monospace;">Select id, name, (Select Role From Partners), (Select CreatedDate From OpenActivities), (Select Id From Notes) From Opportunity o</span></li></ol></ol><br />If you're writing some apex code to access such queries, the sub queries become lists, so you might write something like this for the above example with notes and opportunity objects:<br /><br /><span style="font-family: Courier New, Courier, monospace;">for ( Opportunity o: [Select id,name, (Select title From Notes) From Opportunity] ) {</span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; for ( Note n: o.Notes ) {</span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; System.debug(n.title);</span><br /><span style="font-family: Courier New, Courier, monospace;">&nbsp; &nbsp; }</span><br /><span style="font-family: Courier New, Courier, monospace;">}</span><br /><div style="margin-bottom: 0in;"><br /></div><div style="margin-bottom: 0in;">The schema browser offers a powerful way to start writing SOQL queries and create useful examples to work from.</div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-80914515670012095382012-10-10T13:02:00.003-07:002013-12-29T17:23:32.723-08:00Salesforce Sub Queries created by the Force IDE Schema Browser<div dir="ltr" style="text-align: left;" trbidi="on"><h2><div class="MsoNormal"><b><span style="font-family: 'Times New Roman', serif; font-size: 18pt;">Salesforce Sub Queries created by the Force IDE Schema Browser<o:p></o:p></span></b></div><div class="MsoNormal"><b><span style="font-family: 'Times New Roman', serif; font-size: 18pt;"><br /></span></b></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">Today my goal was to finally begin to understand Salesforce Sub queries which offer a very powerful way to fold multiple queries into one single query which helps reduce the number of SOQL queries in any given transaction so as to avoid bumping into the SOQL query limit. I finally figured out how to use the Force IDE schema browser to write queries. Once I had working queries, I started understanding what I was looking at.<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><br /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">So: how do we create a query that has a sub query with the Force IDE schema browser?<o:p></o:p></span></div><div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Fire up the Force IDE. In my case, I start the Eclipse IDE with the Force IDE plugin installed, drill down to "salesforce.schema" in a Salesforce project and double click on it.<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">The Opportunity object tends to be the master of many other objects and is a good object to start looking at. On the right hand side of the dialog under "Schema" find "Opportunity" and click on the triangle icon to expand. Next drill down into "Child Relationships."<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">3.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Find a child like "Note" and expand that drilling down to "Fields" and select one like "Note Id."<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">4.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp; &nbsp; &nbsp;U</span></span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">nder "Query Results" to the left of the "Schema" window you've been working on, you'll see a query like:<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Select id,name, (Select Id From Notes) From Opportunity o<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">5.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Here is a query that accesses the Opportunity and three other detail objects for which Opportunity is the master:<o:p></o:p></span></span></div><div class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"><!--[if !supportLists]--><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]--><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Select id, name, (Select Role From Partners), (Select CreatedDate From OpenActivities), (Select Id From Notes) From Opportunity o</span></span><br /><span style="font-weight: normal;"><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: Times New Roman, serif; font-size: medium;"><span style="font-weight: normal;">The schema browser offers a powerful way to start writing SOQL queries and create good examples to work from.</span></span></div><div class="MsoNormal"><br /></div></h2></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-81721434251640943512011-10-03T04:11:00.000-07:002011-10-03T04:11:28.987-07:00DataStage Director Client: Run-time error '13': Type mismatch<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-FFMBcLAlMuI/TomWyBhrmAI/AAAAAAAAAKQ/A-zDz6_I5aw/s1600/screen_shot.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-FFMBcLAlMuI/TomWyBhrmAI/AAAAAAAAAKQ/A-zDz6_I5aw/s1600/screen_shot.jpg" /></a></div><div class="separator" style="clear: both; text-align: left;">We went round and round with IBM on this for several months until they finally suggested the following which works beautifully and simply to get rid of this useful-to-no-one error message:</div><div class="separator" style="clear: both; text-align: left;"></div><ol style="text-align: left;"><li><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">Examine the file C:\IBM\InformationServer\Version.xml to determine the clientTagId (or this could be on your D: drive or wherever you have DataStage installed). Example:&nbsp;</span><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">&lt;InstallType client="true" clientTagId="0a045bd2-09cd-4b80-a158-ac1cb63c8268"</span></li><li><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">Run "regedit"</span></li><li><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">Navigate to "<span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">HKEY_CURRENT_USER\Software\IBM\InformationServer\DataStage Client," find the key that matches the name from step 1.</span></span></li><li><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;"><span style="font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;">Rename it to &lt;key name&gt;.bak</span></span></li></ol><div><span class="Apple-style-span" style="font-family: 'Times New Roman', serif;">Run the Director client again. You should see that none of the previously defaulting information is filled in (host name, user name, etc). This indicates that a new key is being created. Once you authenticate, you should see that the run-time error is now gone.</span></div><br /><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-52277780513157932132011-08-24T20:47:00.000-07:002011-08-24T20:47:03.467-07:00rsnapshot on SUSE Linux 11.4<div dir="ltr" style="text-align: left;" trbidi="on">A couple of friends of mine are big "<a href="http://rsnapshot.org/">rsnapshot</a>" users. I'm glad I took time to install and configure it. I finally have the Apple Time Machine-like backups I have always wanted on Linux. Of course, I'm not using any fancy GUI. That I don't get, but I get lots of cool backups and since rsnapshot takes advantage of "hard links" there is no unnecessary file duplication in my backups.<br /><br />The install was easy: I just used Yast to find "rsnapshot" and installed it. Next I had to learn enough about it to be dangerous. I edited&nbsp;/etc/rsnapshot.conf, learned to run "rsnapshot configtest" to test my configuration file, set my own "intervals," added some "backup" definitions, set my "snapshot_root" directory, and above all (for me) un-commented "no_create_root" I'm backing up to a USB drive, and I don't want rsnapshot assuming it's mounted when it's not. If the rsnapshot root directory I defined does not exist, I don't want it to be created. I want rsnapshot to stop dead in its tracks.<br /><br />At first I ran "rsnapshot hourly" manually just to see what it was really doing. After some experimentation (who needs online help or user manuals?), I finally realized the significance of the "intervals" and what rsnapshot is doing with them. Basically it's this: once you've created the number of "hourly" backup directories defined in your interval configuration, the next time you run "rsnapshot hourly" it will replace the oldest directory with a new one. If the next interval "up" is "daily" then I must have run the defined number of hourly backups first. So, let's say my intervals are define thus:<br /><br /><br />interval &nbsp; &nbsp; &nbsp; &nbsp;hourly &nbsp;6<br />interval &nbsp; &nbsp; &nbsp; &nbsp;daily &nbsp; 14<br /><div><br /></div><div>If I have only 5 hourly backups then "rsnapshot daily" has nothing to do. If I have six, then the most recent one becomes my first "daily" backup directory and I then have one less hourly directory. Like this:</div><div><br /></div><div><div>drwxr-xr-x 3 root root 4096 Aug 23 04:19 daily.0</div><div>drwxr-xr-x 3 root root 4096 Aug 21 18:26 daily.1</div><div>drwxr-xr-x 3 root root 4096 Aug 21 16:27 daily.2</div><div>drwxr-xr-x 3 root root 4096 Aug 21 16:22 daily.3</div><div>drwxr-xr-x 3 root root 4096 Aug 21 16:02 daily.4</div><div>drwxr-xr-x 3 root root 4096 Aug 24 23:18 hourly.0</div><div>drwxr-xr-x 3 root root 4096 Aug 24 20:18 hourly.1</div><div>drwxr-xr-x 3 root root 4096 Aug 24 05:02 hourly.2</div><div>drwxr-xr-x 3 root root 4096 Aug 24 04:19 hourly.3</div><div>drwxr-xr-x 3 root root 4096 Aug 23 19:22 hourly.4</div></div><div><br /></div><div>If I run "rsnapshot daily" again, there is nothing to do, and if I look at /var/logs/rsnapshot, that's what it tells me: "hourly.5 not present (yet), nothing to copy."</div><div><br /></div><div>The next run of "rsnapshot hourly" will create the "hourly.5" (which is number 6).</div><div><br /></div><div>You can define whatever intervals you want. I could have weekly, monthly, and yearly, etc.</div><div><br /></div><div>So know I know enough about rsnapshot to use it and enjoy it.</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-32380724027061742682011-08-24T20:23:00.000-07:002011-08-24T20:23:45.618-07:00Upgrading to SUSE 11.4<div dir="ltr" style="text-align: left;" trbidi="on">Just a quick note about my recent upgrade from SUSE 11.3 to 11.4: it was darn easy, really. I used the "Network" CD which installed the update from online repositories. I normally don't "upgrade" any OS. I usually start from scratch and do a new clean install. I felt lazy and bold this time, so I just upgraded my OS (after taking images of my disk partitions just in case). I had not heard the "horror" stories of the SUSE 11.4 upgrade. I heard them afterward, and I'm glad I was blissfully ignorant, because for me the upgrade worked just fine and saved a lot of time over a fresh install. I'm now happily running 11.4.&nbsp;</div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-62034123450965483222011-08-24T20:15:00.000-07:002011-09-03T05:40:44.571-07:00Dropbox on SUSE Linux 11.4<div dir="ltr" style="text-align: left;" trbidi="on">I created a <a href="https://www.dropbox.com/">Dropbox</a> account today and had to piece together bits and pieces of how to get it up and running on&nbsp;SUSE&nbsp;Linux 11.4. Sad to say it was not obvious. The following notes will hopefully make it obvious to the reader (who will probably be me some day in the future when I'm trying to do this again).<br /><div><div style="text-align: center;"><b><br />Steps to Initial Success</b></div><div><ol style="text-align: left;"><li>Download the bz2 file from the "Compile from Source (bz2)" link at&nbsp;<a href="https://www.dropbox.com/downloading?os=lnx">https://www.dropbox.com/downloading?os=lnx</a></li>
<li>Unzip and in the resulting&nbsp;nautilus-dropbox-0.6.9 directory, run "./configure" which told me to install "lib-nautilus" (lib-nautilus1 in YAST) and "docutil." From Yast, I installed lib-nautilus1 and nautilus-devel as well as docutil.</li>
<li>Run "make"</li>
<li>And then as root, "make install"</li>
<li>The following steps are done as my standard user ...</li>
<li>Run "dropbox" to see the dropbox command help/program usage.</li>
<li>Run "dropbox -i start" to start it up the first time which brings up a graphical dialog confirming that I will now download the "proprietary daemon" which I did.</li>
<li>Once downloaded, a tutorial dialog comes up and eventually (after providing dropbox login name and password) the nautilus file manager and my "Dropbox" file folder which appears under my home directory but it's a synced folder with my online dropbox file folders.</li>
</ol><div>From the command line I can check the status of the dropbox daemon or stop it:</div></div><div style="text-align: left;"><ol style="text-align: left;"><li>dropbox status</li>
<li>dropbox stop</li>
</ol>Now that the "proprietary&nbsp;daemon" is installed, I can just give the command "dropbox start" to get it going again. And when it's running, I see a cute little open box icon in my task manager tray. If I click on it, the nautilus file browser opens again. So long as the daemon is running, the file manager shows "bold green checks" on the items that are synced and living online in Dropbox:</div><div style="text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-y6F3duy6cZY/TlW6Xz2hadI/AAAAAAAAAKA/7DEMu8a8GSM/s1600/nautilus-1.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="220" src="http://4.bp.blogspot.com/-y6F3duy6cZY/TlW6Xz2hadI/AAAAAAAAAKA/7DEMu8a8GSM/s400/nautilus-1.jpeg" width="400" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div style="text-align: left;">When the daemon is stopped, the check marks disappear to let me know that folders aren't currently live with Dropbox.</div><div style="text-align: left;"><br /></div><div style="text-align: center;"><b>Creating rcdropboxd</b></div><div style="text-align: left;">I found a system init script for SUSE at:&nbsp;<a href="http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall/openSuseStartup">http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall/openSuseStartup</a></div><div style="text-align: left;"><br /></div><div style="text-align: left;">I grabbed the text found there and placed it in&nbsp;/etc/init.d/dropboxd. I created a symbolic link to /usr/sbin/rcdropboxd for convenience. Per the text for the script, I created /etc/dropbox/dropbox.conf and added a single line:</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><div style="text-align: center;">DROPBOX_USERS="&lt;my user name&gt;"</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Now I can start the daemon by running "rcdropboxd" and I could go into Yast-&gt;Configure runlevels and start dropbox as a system service. Of course the "dropbox" command itself as an "autostart" argument that would be used to start dropbox on login. In the end, I prefer to start it when I want it running and stop it when I don't. <b>Note that dropbox is installed with "autostart on" by default.</b>&nbsp;So, from the command line I ran: "dropbox autostart n" to turn it off.</div><div style="text-align: left;"><br /></div><div><br /></div></div><div style="text-align: left;"><br /></div></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com0tag:blogger.com,1999:blog-5459538651842110153.post-81022423434554206752011-06-03T14:39:00.000-07:002011-06-03T14:39:31.236-07:00odbcad32.exe: setting up ODBC access on Windows 7 64 bit<div dir="ltr" style="text-align: left;" trbidi="on">A long-time customer of mine bought some Windows 7 64 bit machines. I needed to set up an ODBC connection to an MS Access database for a &nbsp;custom legacy Java program. When I went into ODBC the only driver available was one for SQLServer. I googled, I searched, I looked through Windows 7 books at Borders.So far no answer. No Luck.<br /><br />I used my MSDN subscription to create a new Windows 7 VM and unfortunately there was no trouble there! All the usual drivers appeared. And unfortunately, I created a 32 bit machine, and the problem does not exist 32 bit Windows 7. But I did not know that at the time, and it only deepened the mystery. Why did I have no trouble creating the ODBC connection to MS Access right from the time the machine fired up for the first time?<br /><br />Finally I posted the question to&nbsp;<span class="Apple-style-span" style="-webkit-text-size-adjust: none; color: #333333; font-family: Arial, Helvetica, 'Nimbus Sans L', sans-serif; font-size: 18px; line-height: 11px;"><a class="public" href="http://www.linkedin.com/groups?home=&amp;gid=2215094&amp;trk=anet_ug_hm&amp;goback=%2Egmp_2215094" style="-webkit-text-size-adjust: none; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: rgb(51, 51, 51) !important; font-family: inherit; font-size: 18px; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline; vertical-align: baseline;" title="This is an open group">Windows 7 &amp; Server 2008 R2 troubleshooters</a>&nbsp;</span>group on <a href="http://www.linkedin.com/">LinkedIn</a>. Someone there was kind enough to clue me in and tell me to run %windir%\syswow64\odbcad32.exe. That brought up the usual ODBC dialog, but now when I created a "File DSN," I had access to the MS Access driver which I configured to use the appropriate database file (.mdb file).<br /><br />Had I fired up a 64 bit Windows 7 VM I could have duplicated the problem. As it is, I did see the same issue on a number of windows 7 machines at Best Buy from several different OEMs.<span class="Apple-style-span" style="-webkit-text-size-adjust: none; color: #333333; font-family: Arial, Helvetica, 'Nimbus Sans L', sans-serif; font-size: 18px; line-height: 11px;">&nbsp;</span><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com1tag:blogger.com,1999:blog-5459538651842110153.post-50765768963769010082011-05-15T11:30:00.000-07:002011-05-15T11:31:27.238-07:00Converting Text to PDF<div dir="ltr" style="text-align: left;" trbidi="on">Converting text to PDF is handy and can be a shortcut around the complexities of generating pdf output when your needs are simple. One way to do it is using "enscript" and "ps2pdf" as in the following command:<br /><br />enscript --no-header --landscape -q -p - my_text_file.txt|ps2pdf - my_pdf_file.pdf<br /><br />If you need enscript, you can get it from:&nbsp;<a href="http://www.iki.fi/~mtr/genscript/">http://www.iki.fi/~mtr/genscript/</a><br /><br />Building it yourself is straightforward. Once you untar/unzip the download, you can use "./config --help" to get help in special configurations if you need it.<br /><br /></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com2tag:blogger.com,1999:blog-5459538651842110153.post-201341552402546592011-04-23T12:09:00.000-07:002011-06-12T08:56:56.875-07:00Rails 3: Converting has_and_belongs_to_many to has_many :through<div dir="ltr" style="text-align: left;" trbidi="on">Reference:&nbsp;<a href="http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association">http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association</a><br /><br />Converting my old Rails 2 app to Rails 3 has been a great education. In this lesson, I had to convert has_and_belongs_to_many to "has_many :through," because as of Rails 3.1, has_and_belongs_to_many with attributes to join the table/model will be deprecated (see comments to this post).So, while the old helper worked fine with Rails 3.0, I decided to be proactive and modernize my app even further.<br /><br />Once I found the <a href="http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association">above referenced guide</a> and saw the example about physicians and patients, it seemed straightforward enough. So, why was mine not working? How does one go about debugging it when Rails is throwing exceptions all over the place. And what can possibly go wrong? As I found out, a lot of little things. It's easy to misspell a table reference and never know anything is wrong until the code tries to exercise the association in some way. In one case I found that ":through =&gt; 'table_name' " did not work, but ":through =&gt; :table_name" did. So, while I got away with using a string in my old code, only a symbol seemed to work in the new code. So, how do I make it easy to debug this stuff?<br /><br /><b>The first key for me was to use the rails "console,"</b> so in my app home directory, I give the command "rails console," and now I have an interactive Ruby session with all my application structures available. In particular I can call upon models to do their thing. I can, for example give the command: User.find(508) to find the user record with id 508. And don't forget about "reload!" which is invaluable for reloading your code in the console session as you're changing it in an editor.<br /><br /><b>The second key for me was to go through each association one at a time</b>, very methodically, and make sure every necessary component is working. The most fundamental part is the table that provides the two-way association. In my app I have volunteers that attend training sessions. I want to know which training sessions users have attended, and which users have attended which training sessions. So, I have a "training_sessions_users" table. In my schema.rb, I see:<br /><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp;create_table "training_sessions_users", :id =&gt; false, :force =&gt; true do |t|</span></b><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp; &nbsp;t.integer &nbsp;"training_session_id"</span></b><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp; &nbsp;t.datetime "created_at"</span></b><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp; &nbsp;t.datetime "updated_at"</span></b><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp; &nbsp;t.integer &nbsp;"user_id"</span></b><br /><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp;end</span></b><br /><br />In training_sessions_user.rb then, I need the following two lines of code:<br /><ul style="text-align: left;"><li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-weight: bold;">belongs_to :user</span></li><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> belongs_to :training_session</span></b></li></ul>This creates two simple associations that are easy to test. The following must work, and I made sure I had data to test with:<br /><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">TrainingSessionsUser.first.user</span></b></li><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> TrainingSessionsUser.first.training_session</span></b></li></ul>This is the simplest yet most fundamental part of the whole equation. It's a logical place to start, and I made sure that much worked.<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"><br /></div><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;">Now for my training sessions. In training_session.rb, I have first and foremost the following:</div><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">has_many :training_sessions_users, :dependent =&gt; :destroy</span></b></li></ul>This means that the following has got to work, and that's the next thing I verified and debugged as necessary:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">TrainingSession.first.training_sessions_users</span></b></li></ul>Similarly on the user side:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">has_many :training_sessions_users, :dependent =&gt; :destroy</span></b></li></ul>Implies that the following must work, assuming I have a user with id 508:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">User.find(508).training_sessions_users</span></b></li></ul>So far so good. All of this must be working, but it does not imply that everything I had working using "has_and_belongs_to_many" is still working. So, the next step is to verify that the following found in training_session.rb:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">has_many :users, :through =&gt; :training_sessions_user, :order =&gt; 'last_name,first_name,middle_name'</span></b></li></ul>This implies that the following must work:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">TrainingSession.first.users</span></b></li></ul>Likewise in user.rb:<br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">has_many :training_sessions, :through =&gt; :training_sessions_users, :order =&gt; "date_of_training desc"</span></b></li></ul><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;">Which implies that the following must work:</div><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"></div><ul style="text-align: left;"><li><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">User.find(508).training_sessions</span></b></li></ul><u><b>Conclusion</b></u><br /><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;">Once I had this verification pattern laid out after my struggles with the first conversion of has_and_belongs_to_many, the next one went relatively smoothly. There were still things to debug. It's so easy to misspell things ever so slightly -- to leave something singular when it needs to be plural, for instance. Or to spell "has_many" as "has_manu," and since you don't see that when you first fire up your application, since it only pops up at runtime, it is imperative to have some methodology to work this out ahead of time. And of course, when you have a patten like the one above, it's easy to encapsulate this in test procedures.</div><div style="-qt-block-indent: 0; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-indent: 0px;"><br /></div></div>Vhttp://www.blogger.com/profile/09807644576964703392noreply@blogger.com3