Tuesday, May 1, 2018

How to start cygwin X in windowless/multiwindow mode

Double click on "Cygwin64 Terminal".

Then enter the command: startxwin

Then open another cygwin window, and enter this: env DISPLAY=:0.0 xterm

Thursday, February 22, 2018

Monday, January 8, 2018

Closing laptop lid without suspending/hibernating on Fedora 27


1. As root, edit /etc/system/logind.conf

2. Change

    #HandleLidSwitch=suspend

    to

    HandleLidSwitch=ignore

3. Reboot

Wednesday, December 27, 2017

Change broken sun visor clip snap retainer holder for 1998, 1999, 2000, 2001, or 2002 Toyota Corolla

This is a pretty easy DIY fix.  All you need is a standard phillips head screwdriver.  If your visor clip still holds the visor, but is kind of broken where it easily comes un-snapped, pick up something like this from eBay for well under $10:

https://www.ebay.com/itm/OEM-Gray-Sun-Visor-Clip-Snap-Retainer-Holder-Toyota-Lexus-Left-Right/192338123335

Unscrew the old one.  Pull the old one out.  You might have tug at it a little hard.  I even used a flathead screwdriver to pry a little of it off.  It will pop off eventually, and then you can easily install the new one.

Tuesday, December 19, 2017

Installing PhpPgAdmin on Fedora

Installation


Install postgresql and apache httpd

Install PhpPgAdmin:

sudo yum install phpPgAdmin

pg_hba.conf


Modify the pg_hba.conf file and change the following line:

local   all             all                                     peer

to this

local   all             all                                     md5

This will allow a password to be entered when the PhpPgAdmin app tries to login to the postgresql server.

phpPgAdmin.conf


If you've installed phpPgAdmin on Fedora (or likely other Linuxes such as CentOS or RHEL), you'll need to modify the /etc/httpd/conf.d/phpPgAdmin.conf to open up access.  In the Apache 2.4 section, put only this line in:

Require all granted

Then restart the httpd web server.

Then try to login here: http://localhost/phpPgAdmin - you will use the same login and password that you use to login into postgresql with the psql command line utility.


Thursday, December 7, 2017

How to get Nvidia Driver working on Fedora Linux 27

I had a few problems with this, so I thought I'd blog about it.  There's a new way to install the Nvidia driver on Fedora.  First, check if your laptop has the Optimus technology (hybrid graphics).  If so, disable it in the BIOS.  Then follow these instructions:

https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide

When you finally get ready to test out if your Nvidia driver was successfully installed, you can run glxgears and check the frame rate.  You may have to turn off "Sync to VBlank" in the nvidia-settings (in "OpenGL Settings") first.

These instructions are needed to download (or create) a patched version of the NVIDIA installer, for newer kernels such as 5.x (e.g. 5.5 and 5.6).

Friday, November 17, 2017

How to play a DVD movie on Fedora 24

This probably works on newer Fedora versions too.  You might have problems with DVDs not playing, due to them being encrypted and Fedora not coming with the decryption software.  Here's how to get your DVD movie playing.

sudo su

dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

dnf install gstreamer1-{ffmpeg,libav,plugins-{good,ugly,bad{,-free,-nonfree}}} --setopt=strict=0
nf -y install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

dnf -y install gstreamer-ffmpeg gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-good-extras gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-devel gstreamer-plugins-base-devel gstreamer1-libav gstreamer1-plugins-bad-freeworld gstreamer1-plugins-ugly

dnf -y install libdvdread libdvdnav lsdvd

sudo dnf -y install git autoconf automake libtool kaffeine

# Download and install libdvdcss
mkdir /path/to/anywhere
cd /path/to/anywhere
git clone https://code.videolan.org/videolan/libdvdcss.git
cd libdvdcss
autoreconf -i
./configure
make
sudo make install

Then start Kaffeine by pressing the Windows button on your keyboard, and searching for "Kaffeine". The DVD should start.

Friday, August 18, 2017

How to clear P0128 Check Engine Light (CEL) (coolant temperature below thermostat regulating temperature) on a 1999, 2000, 2001, or 2002 Toyota Corolla

Parts needed:

Do this:
  1. Park car in a place where you don't mind a little coolant leaking out, or put a basin under your car
  2. Pop hood
  3. Disconnect battery  (Disconnect black/negative first)
  4. Remove battery from car
  5. Remove engine air filter and air filter console.  You don't have to completely remove the top of the air filter console.  You can just move it off to the side. See https://www.youtube.com/watch?v=sXUNb9fTeG8 - you might need to remove two black plastic cable straps/ties which you can do by sticking in a mini flathead screwdriver in the opposite side (from the bottom).  Be careful not to drop any 10mm bolts down the hole in the air filter console.  You can wrap it in aluminum foil if you don't trust yourself.
  6. Use your hands to unclip the wiring from the old temperature sensor.  It might be a tight fit, but you should be able to get your fingers in there if your fingers aren't too fat.  Be careful not to break the sensor wirings.
  7. Remove the temperature sensor using the 19mm deep socket.  I used a breaker bar.
  8. Some coolant might leak out, so quickly hand-screw in the new temperature sensor into the engine and tighten with the 19mm deep socket.
  9. Reassemble.
The check engine will be cleared because the battery was removed, but the real test will take 50-200 miles of driving to make sure the car's computer keeps the P0128 code off.

Some people reported the temperature dial instantly going up to "H" right away, but I didn't experience that.

Sunday, August 21, 2016

PHP warnings on Windows

In recent PHP distributions on windows, they give you a .zip file, and you just unzip it.  If you're not getting error or warning messages on the command line, here's what you can do to fix that:

copy \path\to\phpInstallDir\php.ini-development c:\Windows\php.ini

Thursday, June 23, 2016

Allow access to phpMyAdmin to all IP address on Fedora 23 and Apache httpd 2.4

If you've installed phpMyAdmin using yum on Fedora 23, you may be getting "Forbidden: You don't have permission to access /phpmyadmin/index.php on this server." messages in the browser when you try to open up the phpMyAdmin in the web browser.  Fix the problem like this: Edit /etc/httpd/conf.d/phpMyAdmin.conf and make the following changes:

...
   <IfModule mod_authz_core.c>
     # Apache 2.4                                                            
     <RequireAny>
       Require all granted
#       Require ip xxx.xxx.xxx.xxx                                              
#       Require ip 127.0.0.1                                                    
#       Require ip ::1                                                        
     </RequireAny>
...

Sunday, May 10, 2015

Speedrunning The Legend of Zelda

My hobby for the last few months has been watching Twitch streamers stream speed runs of Zelda (the original Zelda), and also taking a stab (no pun intended) at speed running myself.  It took me a long time to finally get my VCR-taped speed runs of Zelda in a digital format, but here it is:


(https://www.youtube.com/watch?v=WqcHvzwj9Uk)

That is a video of my 38:36 which was a former PB (personal best).  I PB'd last night, at 38:30, but I don't have that video on youtube yet.  I've been doing commentary of my PB runs too, so I'll try to get that uploaded too.

The leaderboard is here: https://www.zeldaspeedruns.com/leaderboards/loz/1st-quest

Saturday, April 25, 2015

How to download iPhone Voice Memos to your computer

I was trying to copy an iPhone voice memo to my Windows 7 computer today.  I literally tried for hours using iTunes, which I've successfully done before (with some effort).  I couldn't get it working today.  Instead, I tried a freeware utility called iFunbox, and it worked great.  Download it here:

http://www.i-funbox.com/en_download.html

There's also a MacOS version.

Once iFunbox is downloaded and installed, choose the "File Browser" tab at the top, and expand the "Voice Memos" option.  If there are no voice memos, then try going into iTunes, plug in your iPhone to your computer, choose the phone icon (after the music note, movie, TV show, and ellipsis icon at the top), and choose "Settings" | "Music", and make sure that "Include voice memos" is checked.  Then run iFunbox.

Wednesday, April 8, 2015

How to Install LiveSplit on 64-bit Fedora 20 Linux

1) Download the latest LiveSplit from here: http://livesplit.org/downloads/

2) install wine:

yum install wine

3) Download winetricks

wget http://winetricks.org/winetricks
chmod a+x winetricks

4) Setup a 32-bit wine prefix:

sudo su
export WINEARCH="win32"
export WINEPREFIX=~/.wine-PROGRAM-NAME/
wineboot -u

5) sudo su
winetricks dotnet40

6) unzip LiveSplit_1.5.5.zip

6) Run LiveSplit

sudo su
wine ./LiveSplit.exe

Thursday, March 26, 2015

How to compile qemu for RHEL 6

1) Download, compile, and install SDL-1.2.15

2) Download qemu-2.2.1.  Configure like this:
./configure --enable-cdl

3) /path/to/bin/qemu-system-x86_64 -m 4096 /path/to/HardDriveImage.qcow2

4096 is the amount of memory you want to use, in MB.

If your hard drive image is from VirtualBox, http://cheznick.net/main/content/converting-a-virtual-machine-from-virtualbox-to-kvm explains how to convert the hard drive image to either a raw .img file or a qcow2 file:

1) VboxManage clonehd /path/to/hardDriveImage.vdi hardDriveImage.img --format raw
2) qemu-img convert -f raw hardDriveImage.img -O qcow2 hardDriveImage.qcow2

Sunday, March 22, 2015

How to permanently show the Bookmarks Toolbar in Firefox

Right click on the tab area (right under the window title bar), and check the "Bookmarks Toolbar" option.

Enabling that feature was kind of hard to find for some reason...

Friday, March 20, 2015

How to force a Solr 5.0.0 field/column to be a certain type

Solr 5 uses a managed schema by default, while Solr 4 used the schema.xml file.  Solr 5 automatically creates the schema for you by guessing the type of the field.  Once the type is assigned to the field, you can't change it.  You have to set the type of the field before you add data to Solr 5.

To change the schema in Solr 5, you will want to use the Schema API, which is a REST interface. Go to https://cwiki.apache.org/confluence/display/solr/Schema+API

https://cwiki.apache.org/confluence/display/solr/Schemaless+Mode describes a little bit about the Schemaless Mode (i.e. managed schema).  That page states the following:

"You Can Still Be Explicit - Even if you want to use schemaless mode for most fields, you can still use the Schema API to pre-emptively create some fields, with explicit types, before you index documents that use them. ... Once a field has been added to the schema, its field type is fixed."

If you are using the quick start guide for Solr 5, here's what you have to do if you want to explicitly specify the field types:

After you enter the following command:

bin/solr start -e cloud -noprompt

Then enter a command like this:

curl -X POST -H 'Content-type:application/json' --data-binary '{    "add-field" : {        "name":"MYFIELDNAMEHERE",        "type":"tlong",        "stored":true}}' http://localhost:8983/solr/gettingstarted/schema

The previous command will force the MYFIELDNAMEHERE field to be a tlong.  Replace MYFIELDNAMEHERE with the field name that you want to be explicitly set, and change tlong to the Solr type that you want to use.

After doing that, then load your data as usual.

Tuesday, March 17, 2015

How to install Windows 98 without using a floppy disk drive

If you're reading this... no you didn't go back in time 15+ years.

I had to install Windows 98 to one of my computers, because my video capture card only has drivers for Windows 95 and Windows 98.  It had been so long since I've installed Windows 98, I forgot that the Windows 98 installation CD is not bootable.  I didn't think I had a floppy disk (even though that computer had a floppy disk drive), so here's how I installed Windows 98 instead:

1) Download Knoppix (http://www.knopper.net/knoppix/index-en.html) and create a Knoppix CD

2) Create a Windows 98 boot CD from here: https://staff.washington.edu/curreri/windows-98-boot-cd-download-this-iso/

3) Boot my computer to the Windows 98 boot CD, repartition and format your hard drive to FAT32.  Use the format /s switch to copy the system files to the c drive.

4) If you only have 1 CD drive, boot to Knoppix, and copy the Windows 98 installation CD to the "C drive", which was mounted at /mnt/sda1 or /dev/sda1 for me.  You can use scp to copy the Windows 98 installation CD to your "C drive".  If you have 2 CD drives, you can skip the Knoppix step, and just change to the R or S drive (which should be the other CD drive) on steps 7 and 7.

5) Boot to the Windows 98 boot CD if you currently have Knoppix up.

6) Change to C drive by typing in "c:" at the DOS prompt (or change to the R or S drive)

7) Run the setup.exe Windows 98 install program

Tuesday, March 10, 2015

How to get multiple distributed shards working on Solr 5.0.0


Here's how to get distributed querying working with shards with Solr 5.0.0
  1. Go through http://lucene.apache.org/solr/quickstart.html (see my blog here for hints http://muddyazian.blogspot.com/2015/03/how-to-get-solr-500-quick-start.html)
     
  2. If you follow the quickstart, 2 shards are created on (i) port 8983 and (ii) port 7574.  Two replicas are also created, but the important thing to note is that port 8983 has one shard, and 7574 has the other shard.

    The data are automatically routed to either the 8983 shard or the 7574 shard when importing.
     
  3. A query like

    http://localhost:8983/solr/gettingstarted/select?q=*:*

    will query on both shards, and merge the results together
     
  4. If you only want results from one shard, then form the query like this:

    http://localhost:8983/solr/gettingstarted/select?q=*:*&shards=localhost:7574/solr/gettingstarted

    (Note: that you need the /gettingstarted at the end of the URL, which is something missing from the instructions at https://cwiki.apache.org/confluence/display/solr/Distributed+Requests)

Information pieced together from:

How to expand all trees Emacs and org mode

Usually, you expand a subtree by pressing TAB.  To expand the whole document, press:

Ctrl-u Ctrl-u Ctrl-u TAB

Friday, March 6, 2015

How to get solr 5.0.0 quick start tutorial working on Fedora linux

As of today, the current version of Solr is 5.0.0, and the quick start guide is here:

http://lucene.apache.org/solr/quickstart.html

When running:

$ bin/solr start -e cloud -noprompt

If you are getting the following error message:

WARN  - 2015-03-06 16:02:05.519; org.apache.solr.util.SolrCLI; Request to http://134.252.99.99:7574/solr/admin/collections?action=list failed due to: Connection timed out, sleeping for 5 seconds before re-trying the request ...

It's likely because your router or firewall is blocking connections to your own machine to port 7574 when using the IP address.

Here's a workaround:

Edit the /etc/hosts file and put in the following line:

134.252.99.99 localhost

(replace 134.252.99.99 with your IP address)

Your OS will know that 134.252.99.99 is localhost, and will bypass the router.

Now, when you go to http://localhost:8983/solr/#/~cloud you should see this diagram:


Note: 134.252.99.99 is not my IP address.  It's supposed to be a "dummy" IP address.  Apologies if that is your IP address.

How to get VNC server (vncserver) working with Fedora via yum

$ sudo yum install tigervnc-server
$ vncserver

On the client machine, download a vnc client (such as Tight VNC), and put in the following server IP address:

server.ip.address:5901

Tuesday, March 3, 2015

How to install VirtualBox .rpm on Fedora 16

No guarantees here, because there's a "rpm -i --force" involved...

wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/17/Everything/x86_64/os/Packages/l/libpng-1.5.10-1.fc17.x86_64.rpm

sudo rpm -i --force libpng-1.5.10-1.fc17.x86_64.rpm

wget http://download.virtualbox.org/virtualbox/4.3.24/VirtualBox-4.3-4.3.24_98716_fedora17-1.x86_64.rpm

rpm -i VirtualBox-4.3-4.3.24_98716_fedora17-1.x86_64.rpm

After that, add yourself to the vboxusers group  (in /etc/group)

Tuesday, February 17, 2015

Getting Networking to Work with VirtualBox and CentOS

Why isn't my network working when I've installed CentOS 6 on VirtualBox?  Try to do this:

1) Edit the /etc/sysconfig/network-scripts/ifcg-eth0 file

2) Change

ONBOOT=no

to

ONBOOT=yes

3) Reboot the VM

Networking should work after that.

Saturday, November 1, 2014

Convert flv video to mp4

Download ffmpeg and do this:

ffmpeg -i yourInputVideo.flv -ar 22050 output.mp4

Tuesday, October 7, 2014

Compile subversion for Fedora 19

If you've already tried to compile subversion for Fedora 19, and you got the error message when doing a svn update of svn checkout:

Unrecognized URL scheme for ...

then you have to compile subversion with https support.  This is done by default, but you have to have the serf libraries installed.  Here's how to get things working:

sudo yum install libserf libserf-devel apr-util apr-util-devel apr apr-devel

Then, you can compile subversion normally, like this:

tar -zxvf subversion-1.8.10.tar.gz
cd subversion-1.8.10
./configure
make -j16
sudo make install

Install Adobe Acrobat Reader on Fedora 20

Adapted from http://www.if-not-true-then-false.com/2010/install-adobe-acrobat-pdf-reader-on-fedora-centos-red-hat-rhel/

sudo su

wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i486linux_enu.rpm

yum install nspluginwrapper.i686 libcanberra-gtk2.i686 adwaita-gtk2-theme.i686 PackageKit-gtk3-module.i686

yum localinstall AdbeRdr9.5.5-1_i486linux_enu.rpm

Monday, October 6, 2014

Java Applet plugin on RHEL 6 Linux and Firefox

Here's how to run a Java applet in Fedora on RHEL 6 Linux:

1) Download the Java RPM from http://www.java.com

2) Install the RPM

3) Create a symbolic link to the Java shared library:

ln -s /usr/java/jre1.7.0_67/lib/i386/libnpjp2.so ~/.mozilla/plugins/

4) Restart Firefox

5) Confirm that you see the Java information when you type "about:plugins" in Firefox, on the locaiton bar.

Thursday, September 4, 2014

Speed up Windows 7 and reduce hard drive activity

Disable Superfetch.  Start > Run > services.msc - then right click on Superfetch and stop the service.  Double click on Superfetch, and chnage the "Startup type" to "Disabled".

Change what is indexed for search.  Go to "Control Panel", and search for "Indexing options".  Don't search in Outlook or any other directory, except for the "Start Menu".

In Task Scheduler, disable defrag and "RACTask".

Friday, August 29, 2014

How to avoid yum from automatically running via PackageKit on Fedora


Run this:

sudo /usr/bin/gpk-prefs

Then choose the "Never" option.

Thursday, August 28, 2014

How to change the screensaver lock timeout in Fedora 20 and Gnome

Run this on the command line (in Terminal):

gsettings set org.gnome.desktop.session idle-delay 3600

Change 3600 to anything else you want.  The units are in seconds.

Tuesday, August 19, 2014

How to fix HDMI problem on Dell XPS 14 (2012 or 2013 version)

My HDMI port stopped working on both Fedora 19 and Windows 7 on my Dell XPS 14 laptop, which I purchased in 2013.  You may also have this problem with the Dell XPS 12 laptop.  Unfortunately, the solution to fix it was replace the motherboard, which Dell was able to do for no charge since my system had 1 week of warranty left.  If you don't have a warranty, you might be in an unfortunate situation.

I had been using the HDMI port for almost a year with no problems on both Linux and Windows.  When I started using the Display Port with the HDMI port to drive two external monitors, that worked for about a week, and then the HDMI port stopped working.  The Dell tech support person on the phone said that they do not recommend that I use both the HDMI and Display Port at the same time on the Dell XPS 14 model, because there is not enough power to drive both (for this particular laptop model).

Here is another guy who had a different Dell model with the same issue, and he also replaced the motherboards: http://www.experts-exchange.com/Hardware/Displays_Monitors/Q_28337978.html

Sunday, August 17, 2014

How to hide keyboard when losing Text Field focus in iOS/iPhone/iPad programming in Objective C when using a UIScrollView

If you are making an iOS/iPhone/iPad app, and you are trying to hide the keyboard when clicking outside the UITextField, you can do this:

1) Make sure that your UITextField has an IBOutlet in the ViewController.h file.  If you need to set this up, open the "Assistant editor", click on the storyboard, make sure that the ViewController.h file is in the other window, and Ctrl-drag the UITextField down to the ViewController.h file.

2) Make sure that the Scroll View has a delegate connected to the View Controller.  If you need to set this up, click on the Scroll View, open the "Connections inspector", and drag the circle next to the delegate to the View Controller in the "View Controller Scene" menu

3) In your ViewController.m file, add in a function that looks like this:


-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [_myTextField endEditing:YES];
}

4) Instead of _myTextField, use whatever name you used in step 1 above.

Tuesday, August 12, 2014

Download a password protected webpage with Objective C for iOS/iPhone/iPad

1) Go to http://allseeing-i.com/ASIHTTPRequest and download the latest version (the .tar tarball file)

2) In Xcode, in your project, click on the file folder icon, which is the top left button, so that you can see all the .h and .m files in your project.
3) Open the .tar file in Finder, and drag-and-drop the Classes/ASI* files to Xcode, on the left hand side, in the same directory that the rest of your .h and .m files are.  NOTE: Don't copy the files manually through the command line (Terminal) nor outside of Xcode.
4) If you are creating an iPhone app, drag-and-drop the External/Reachability/Reachability* files to Xcode, on the left hand side, in that same directory.
5) Go to http://allseeing-i.com/ASIHTTPRequest/Setup-instructions and follow the step 2 directions, which is setting up the Build Phases.
6) If you are using ARC, then you need to disable ARC for the ASI* and Reachability* files.  Click on your main project on the left hand side, then choose "Build Phases", and expand the "Compile Sources" section.  For all of the ASI* and Reachability.m files, add in the following flag for "Compiler Flags": -fno-objc-arc (Also see http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project)
7) At the top of your .m file where you want to download the webpage, paste the following line:
#import "ASIHTTPRequest.h"

8) In that same .m file, download the file by doing this:


    NSString* url = @"http://www.google.com";
    NSURL *nsurl = [NSURL URLWithString:url];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:nsurl];
    [request setUsername:@"enterUsernameHere"];
    [request setPassword:@"enterPasswordHere"];
    
    [request startSynchronous];
    NSError *error = [request error];
    if (!error) {
        NSString *response = [request responseString];
        NSLog(response);
    }

That's it!

Monday, August 11, 2014

Solving "Error initializing QueryElevationComponent." with Solr

You may be getting the following error message when trying to start up Solr:

ERROR - 2014-08-11 16:49:49.554; org.apache.solr.core.CoreContainer; Unable to create core: collection1
org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:868)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:643)
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:556)
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:261)
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:253)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
        at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:251)
        at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:651)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:851)
        ... 10 more

If you're getting this error, you may have changed your primary index from a string to an int.

To fix this, edit your example/solr/collection1/conf/elevate.xml file, and change it to the following:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- ... -->
<elevate>
 <query text="foo bar">
<!--
  <doc id="1" />
  <doc id="2" />
  <doc id="3" />
-->
 </query>
 <query text="ipod">
<!--   <doc id="MA147LL/A" />  
   <doc id="IW-02" exclude="true" />
-->
 </query>
</elevate>

Specifically, comment out the <doc ... /> tags.

Sunday, August 10, 2014

How to retrieve a Text Field value in iOS/iPad/iPhone programming in Xcode

1) Drag the Text Field onto your storyboard

2) On the top right side of the screen, you'll see a button that looks like a tux with a bow tie.  It is labeled "Show the Assistant Editor".  Click on that button

3) You should see the storyboard side-by-side to a text window showing code.  Make sure that the .h is showing, such as ViewController.h - you can switch the file by clicking on "Automatic".

4) Scroll the text edit window down to the end, right before "@end".

5) Hold down control, and drag the Text Field to the ViewController.h text edit windows, and drop it right before the "@end".  Type in any name for the Text Field, such as textEntryField.

6) In the callback function (not necessarily a callback function for the Text Field) in the ViewController.m file, you can retrieve the value of the Text Field through "_textEntryField.text".  For example:


NSString* entryText = _textEntryField.text;
NSLog(@"The text in the Text Field is: %@", entryText);

Create callback to respond to button click in iOS with Xcode

1) Click on the storyboard that has the Button that you want to respond to.

2) Near the top right corner, you'll see a button that looks like a tux with a bow tie, entitled "Show the Assistant Editor".  Click on that.

3) Make sure that the .m file is showing (e.g. ViewController.m)

4) Hold down control and drag the button from the storyboard down to the text editor which will create a new function.  Type in a name for the function, such as "buttonTapped".

5) Click "Connect".

6) Now, fill in the callback function.

How to access a webpage/URL in Android using Apache .htaccess/.htpasswd password authentication

You can't download a webpage in the main thread.  You have to create an asynchronous task.  Here's how to do that:

Create a class called RetrieveFeedTask (change the hilighted text):


class RetrieveFeedTask extends AsyncTask<String, Void, Long> {

    private Exception exception;

    @SuppressLint("NewApi") protected Long doInBackground(String urlParam) {

     try 
   {
       DefaultHttpClient client = new DefaultHttpClient();
       client.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("username", "password")); 
       HttpGet request = new HttpGet(urlParam);
       
       HttpResponse response = client.execute(request);
        
       HttpEntity entity = response.getEntity();
       InputStream inputStream = entity.getContent();
       
       StringWriter writer = new StringWriter();
       String encoding = StandardCharsets.UTF_8.name();
       IOUtils.copy(inputStream, writer, encoding);
       
       StringBuffer sb = writer.getBuffer(); 
       String finalstring = sb.toString();
        
   } 
   catch (IOException e) 
   {
       // TODO Auto-generated catch block
       e.printStackTrace();
   }
    catch (Exception e)
    {
e.printStackTrace();
    }
   
    return new Long(0L);
   
    }

     @Override
     protected Long doInBackground(String... arg0) {
return this.doInBackground(arg0[0]);
     }
}


In your activity file, open the url like this:

String url = "http://www.myPasswordProtectedWebServer.com";
new RetrieveFeedTask().execute(url);



In your AndroidManfiest.xml file, be sure to add the following:

<uses-permission android:name="android.permission.INTERNET"/>


Solution derived from http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception

Monday, August 4, 2014

Installing iOS 5.1 simulator on XCode 5.1

After upgrading to XCode 5.1, the iOS 5.1 simulator has been removed. You can restore it by using this procedure:

http://stackoverflow.com/questions/22479215/install-ios-5-simulator-to-xcode-5-1

Sunday, August 3, 2014

How to get the scroll view working in an iOS iPad/iPhone app

It's not straight forward, but it's not too bad to set up.  Here's a good tutorial about how to do it, which will only take 9 minutes (plus or minus) of your life:

https://www.youtube.com/watch?v=-lt1o_k9jUw

How to get a Picker working in Xcode for an iOS iPad/iPhone app

If you drag and drop a Picker onto the Storyboard, the picker won't show.  You have to connect it up to a data source.  Here's how to do that:

http://www.techotopia.com/index.php/An_iOS_7_UIPickerView_Example#The_PickerViewController.h_File

Friday, July 11, 2014

How to download and install an old version of Google Chrome on Windows 7

1) Uninstall Chrome

2) Go to: http://www.oldversion.com/windows/download/google-chrome-22-0-1229-0

3) Install Chrome 22

4) Once chrome is installed, enter about:plugins in the location bar

5) Search for "Google Update" and click on disable

Wednesday, July 9, 2014

Fixing Google Chrome on Windows with EMET

Sometime during the spring and summer of 2014, Google Chrome was conflicting with Windows EMET.  Sometimes, Chrome wouldn't display Flash pages, sometimes you'd get the "He's Dead Jim" message, sometimes you'd get the "Woah Google Chrome has crashed" message, and other times, Chrome would start but you'd just get blank white pages, even with the settings page.  The Chromium developers fixed it, but as of July 9, 2014, the stable and beta versions of Chrome are still broken.  Here's a simple fix: install Google Chrome Canary, which is a more cutting edge version, which is working fine for me.

Thursday, May 29, 2014

How to get public_html in users directories working with Fedora 20 and Apache httpd

This is how to get the public_html directory working in users directories.

Edit the file /etc/httpd/conf.d/userdir.conf

Uncomment the UserDir line, and change it to:

UserDir enabled

Save the file and restart apache

sudo /sbin/service httpd restart

mkdir ~/public_html
chmod 755 ~
chmod 755 ~/public_html

Create a file called ~/public_html/index.html and put something in it.

Wednesday, April 30, 2014

How do I turn off the firewall in Fedora?

sudo /sbin/service firewalld stop
sudo /sbin/chkconfig --level 345 firewalld off

What to do if restarting apache httpd fails when trying build an OSM tile server

If you are using Fedora to create an Open Street Map tile server, when you restart apache, you might be getting this error:

Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.

When running systemctl status httpd.service, if the error looks like this:

Apr 29 23:23:22 hostname.com systemd[1]: Starting The Apache HTTP Server...
Apr 29 23:23:22 hostname.com httpd[6326]: AH00526: Syntax error on line 88 of /etc/httpd/conf/httpd.conf:
Apr 29 23:23:22 hostname.com httpd[6326]: Invalid command 'LoadTileConfigFile', perhaps misspelled or defined by a module not included i...guration

Make the following changes:
  1. Rename the /etc/httpd/conf.d/mod_tile file to /etc/httpd/conf.d/mod_tile.conf
  2. Change the contents of that file to the following:
    LoadModule tile_module /usr/lib/httpd/modules/mod_tile.so

Thursday, January 30, 2014

Solve Windows 7 hanging upon boot when loading classpnp.sys

If your Windows 7 installation hangs upon boot with the Starting Windows icon, even with safe mode, here's what might fix it.  If the booting process stalls a bit on classpnp.sys in safe mode, try rebooting, going into the BIOS, and either resetting the BIOS to the factory default settings, or changing the HDD type to something different.  Then reboot either in Safe mode or normal mode, and hopefully you'll get the login screen.

Tuesday, December 24, 2013

How to view the source after a webpage has been loaded with AJAX


  1. Use Chrome.
  2. Bring up the developer tools by right clicking anywhere on the page, and selecting "Inspect Element.
  3. Click on the "Elements" tab
  4. Right click on the <html...> tag, and select "Copy as HTML"
  5. Paste the clipboard into your favorite text editor.

Tuesday, December 17, 2013

How to save an encrypted iPhone voice mail as an mp3 on Windows

My daughter left me her voice mail today.  She had her mom's phone on the way home, called me, and cried for 72.78 seconds.  I had to save this voice mail, so this is how I did it:

  1. Backup your iphone using iTunes
  2. Download Backuptrans itunes Backup Extractor: http://www.backuptrans.com/itunes-backup-extractor.html
  3. This will allow you to retrieve up to 3 voice mails
  4. To convert the .amr file to .mp3, use http://audio.online-convert.com/convert-to-mp3

Thursday, November 21, 2013

How to get gzip working for Jetty 8 and Solr

If you're getting the following error message in the solr.log file:

java.lang.ClassNotFoundException: org.eclipse.jetty.servlets.GzipFilter

Try doing the following:

Edit /opt/solr/solr-webapp/webapp/WEB-INF/web.xml and put the following in it:


<web-app ... >


<filter>
      <filter-name>GzipFilter</filter-name>
      <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
      <init-param>
        <param-name>mimeTypes</param-name>  
        <param-value>text/html,text/plain,text/xml,application/xhtml+xml,application/xml,text/css,application/javascript,image/svg+xml,application/json,application/xml; charset=UTF-8</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>GzipFilter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

If you don't have a jetty-servlets*.jar file, then download it from http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets and put it in /opt/solr/lib

Restart jetty:

sudo /sbin/service jetty restart

If solr doesn't start up, check the /opt/solr/logs/solr.log file.

Tuesday, November 19, 2013

How do I show PHP errors on a webpage?

In your /etc/php.ini file, add the following:

error_reporting(E_ALL);
ini_set('display_errors', 'on');

Friday, November 8, 2013

How to require password authentication for Apache Solr 4 and Jetty

Some of the documentation in the Solr wiki is outdated, so here's what worked for me.  In the following files, you can change the highlighted fields.

Edit /opt/solr/etc/jetty.xml and add the following:

<Configure>

    <Call name="addBean">
      <Arg>
        <New class="org.eclipse.jetty.security.HashLoginService">
          <Set name="name">Test Realm</Set>
          <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
          <Set name="refreshInterval">0</Set>
        </New>
      </Arg>
    </Call>

...

</Configure>

Edit  /opt/solr/solr-webapp/webapp/WEB-INF/web.xml and add the following:

<web-app>
...
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Solr authenticated application</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>core1-role</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Test Realm</realm-name>

  </login-config>

...
</web-app>

Create a file in /opt/solr/etc/realm.properties and put the following in it:

admin: yourPasswordHere,core1-role

You can change "admin" to whatever username you want.

For the password, you can either use the literal password, or use an OBF/MD5/CRYPT hash.  To create a hash, you can do the following:

cd /opt/solr
java -cp /lib/jetty-util-8.1.10.v20130312.jar org.eclipse.jetty.util.security.Password admin yourPasswordHere

The above utility will print out the hash to the screen, and you can chose either the OBF, MD5, or CRYPT line.  Make sure that you copy the entire line, including the "OBF:..." part.  Copy this line to the /opt/solr/etc/realm.properties file; the result will look something like this:

admin: OBF:1x1v1xmk1w9b1pyh1oq31uum1xtv1zej1zer1xtn1uvk1or71pw51w8f1xmq1x0r
,core1-role

The above is all in one line.  No line break.  Make sure you put the comma before the "core1-role".

After you've changed everything, restart the solr server.  If you're using Fedora, do this:

sudo /sbin/service jetty.sh restart

Then open up your web browser to http://localhost:8983/solr/#/collection1/query and the web browser should ask you for a password.  Enter admin for the user name and yourPasswordHere for the password.

Hint: if you get an error on the Solr admin webpage, you can check the log for warning messages.  The log file is here: /opt/solr/logs/solr.log

More info:



Monday, November 4, 2013

Ruby, yaml, and gem in Fedora Linux

If you're trying to use gem to install something, and you're getting the following error message:

It seems your ruby installation is missing psych (for YAML output)....

You could try to install libyaml like this:

yum install libyaml

If that still doesn't work, it might be because the libyaml library is not new enough.  If that's the case, install libyaml from source from here:

http://pyyaml.org/download/libyaml/

Then, uninstall ruby, and then re-install ruby.  Hopefully you'll have success after that.

Friday, October 18, 2013

S&P 500 during certain presidencies

I don't pretend to claim a causal relationship, but since we're at an all time high, I felt like looking up the facts:

Clinton: +210.69% http://finance.yahoo.com/echarts?s=%5EGSPC+Interactive#symbol=%5Egspc;range=19930118,20010119;compare=;indicator=volume;charttype=area;crosshair=on;ohlcvalues=0;logscale=off;source=undefined;

Bush 43: -38.60% http://finance.yahoo.com/echarts?s=%5EGSPC+Interactive#symbol=%5Egspc;range=20010119,20090120;compare=;indicator=volume;charttype=area;crosshair=on;ohlcvalues=0;logscale=off;source=undefined;

Obama: +108.32% http://finance.yahoo.com/echarts?s=%5EGSPC+Interactive#symbol=%5Egspc;range=20090120,20131018;compare=;indicator=volume;charttype=area;crosshair=on;ohlcvalues=0;logscale=off;source=undefined;

To be fair, Reagan and Bush 41: +234.88% http://finance.yahoo.com/echarts?s=%5EGSPC+Interactive#symbol=%5Egspc;range=19810119,19930120;compare=;indicator=volume;charttype=area;crosshair=on;ohlcvalues=0;logscale=off;source=undefined;

Thursday, October 17, 2013

Resolve "Can't right click on message in Outlook 2003" issue

For a long time, I haven't been able to right click on an email in Outlook 2003 (e.g. to flag it).  This is how to resolve it:

1) Exit Outlook and other Office apps

2) Go to C:\users\username\AppData\Local\Microsoft\FORMS

3) Delete the FRMCACHE.DAT file

4) Restart Outlook

Wednesday, September 25, 2013

How to Convert MS Access Database to MySQL

MySQL Workbench (versions 5 and 6) contain a Migration Toolkit to convert external databases to MySQL, but Microsoft Access isn't an option.  However, it used to be an option in the predecessor tool: MySQL GUI Tools.  Fortunately, you can download an archived installer for MySQL GUI Tools here:

http://dev.mysql.com/downloads/gui-tools/5.0.html

With that, if you install MySQL GUI Tools (and install a 32-bit version of the Java JRE 6), if you start the MySQL Migration Toolkit, there is an option to convert from an Microsoft Access database.  I chose all of the default settings (except I asked for .sql scripts to be saved), and it converted fine.

Thursday, September 12, 2013

How to change the default OS in grub on Fedora 16, Fedora 17, Fedora 18, and Fedora 19

See https://ask.fedoraproject.org/question/8885/how-can-i-change-default-operating-system-in-start-up-boot-menu/

Essentially, you will want to change the /etc/default/grub file and then perform the following:

grub2-mkconfig -o /boot/grub2/grub.cfg

Tuesday, September 10, 2013

Why can't I click on the confirm box when encrypting a partition in the Fedora 18 or Fedora 19 installer (anaconda)?

If you are having trouble clicking or switching to the "confirm" box when typing in your passcode/password in the Fedora 18 or Fedora 19 installer, here's what you can do:


  1. Ensure that your passcode is strong enough. Make sure that the red stop sign disappears.
  2. Press "Tab" on the keyboard to switch to the "confirm" box.
That's it.

Saturday, August 24, 2013

How to log every query in MySQL on Fedora

In /etc/my.cnf, in the [mysqld] section, add the following 2 lines:

general_log=1
general_log_file=/var/log/mysql.log

Then:

sudo su
touch /var/log/mysql.log
chown mysql:mysql /var/log/mysql.log

Restart mysqld:

sudo /sbin/service mysqld restart

Note that the "log" variable in my.cnf is now deprecated, and doesn't log files in Fedora 14.


Friday, August 23, 2013

How to Install MongoDB on Fedora

If you are using the instructions at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/ they say to create a file called /etc/yum.repos.d/10gen.repo - but if you try that, you may be getting the following error when trying to start the mongod service.

It turns out that mongodb is built into fedora (via yum), so you don't need to add the 10gen.repo file.  Here's how to install mongodb on Fedora:

1) Uninstall mongodb:

yum erase mongodb
yum erase mongo-10gen

2) Remove the 10gen.repo file

rm /etc/yum.repos.d/10gen.repo

3) Install mongodb via default yum

yum install mongodb mongodb-server

4) Start monogodb service

/sbin/service mongod start


Tuesday, August 20, 2013

Friday, August 16, 2013

Why won't MySQL Workbench let me add a Foreign Key relationship?

You might be unable to check the desired foreign column box in MySQL Workbench.

If you are trying to add the foreign key on the command line, then you may also be getting "a can't create table 150 alter table" and Error Code 1005 error.

Make sure that you have the table and column names correct.

Also make sure that the two columns are EXACTLY the same type.  Check for int(10) vs int(11) and int(10) vs int (10) unsigned.  They have to be EXACTLY the same type.  MySQL Workbench may not show or let you change int(10) to int(10) unsigned, but you can check the exact column type using "show create table", and you can change it on the command line like this:

ALTER TABLE TableName CHANGE columnName columnName  int(10) unsigned DEFAULT NULL

After this, you should be able to check the desired box in MySQL Workbench.

Also, make sure that both tables are using InnoDB

Also see: http://stackoverflow.com/questions/9018584/error-code-1005-cant-create-table-errno-150

Monday, August 12, 2013

How to recover found.000 folder that is locked

On Windows 7, if chkdsk recovers a found.000 folder, and you can't access it, and if changing ownership to you doesn't work, try this simple trick:

Copy the folder to another area.

Then try to access the copy of that folder.

For some reason, it works for me.

Friday, July 26, 2013

How to disable Java Updater Tray Icon in Windows

If you ask Java to disable the tray icon, sometimes it won't respect your wishes.  The issue is that the Administrator needs to disable it.  This what you do:

1) Start the command prompt as the Administrator
2) cd \Program Files\Java\jre6\bin
3) javacpl
4) Go to the Advanced Tab
5) Expand Miscellaneous
6) Uncheck the Place Java icon in system tracy
7) Right click the Java icon, and click on Cancel
8) Under Advanced | JRE Auto-Download, switch it to Never Auto-Download

Thursday, July 4, 2013

Why does Windows 7 reboot itself every 2 minutes?

I ran into this issue: I had installed the 320.49-desktop-win8-win7-winvista-64bit-english-whql.exe NVidia GeForce driver.  This forced me to install some type of .NET 4 (extra?) runtime environment.  The next time I booted my computer, Windows 7 would automatically reboot itself after about 2-3 minutes.  If I were in safe mode, it didn't reboot.  This is how I solved it:

  1. Booted Windows 7 in safe mode (press F8 when booting)
  2. Installed an old NVidia driver, such as 314.07-desktop-win8-win7-winvista-64bit-english-whql.exe
  3. Reboot Windows in normal mode
  4. Now you have to be real quick before your machine reboots: uninstall the .NET 4 runtime environment that had just been installed.  The uninstaller will ask you to reboot your machine.  Reboot it into normal mode.
  5. If all goes well, your system will be back to normal!

You can also try reading the logs in the Event Viewer for some hints.

Similar symptom, different solution: http://social.technet.microsoft.com/Forums/windows/en-US/d7379f4d-9337-4800-9c8b-582fd0c439a7/windows-7-pro-keep-restarting-on-itself-will-not-last-longer-than-2-minutes-but-safemode-works

Ditto: http://www.tomshardware.com/answers/id-1672386/computer-rebooting-pretty-stumped.html

Wednesday, July 3, 2013

How to get viewvc working with Apache httpd and Fedora and subversion (svn)


  1. Get subversion working with httpd first. (See http://muddyazian.blogspot.com/2013/05/how-to-start-subversion-repository-over.html)
  2. yum install viewvc viewvc-httpd
  3. Edit /etc/viewvc/viewvc.conf and modify the svn_roots and root_parents options.
  4. Edit /etc/httpd/conf/httpd.conf and add in the following:

    <Directory /usr/lib/python2.7/site-packages/viewvc/bin/mod_python>
      Order allow,deny
      Allow from all
      AuthType Basic
      AuthName "Subversion repositories"
      AuthUserFile /etc/svn-auth-users
      Require valid-user
    </Directory>

    <Directory /usr/share/viewvc/templates/docroot>
      Order allow,deny
      Allow from all
    </Directory>

    ...

    Alias /viewvc-static "/usr/share/viewvc/templates/docroot/images"

    ...

    ScriptAlias /viewvc /usr/lib/python2.7/site-packages/viewvc/bin/cgi/viewvc.cgi
    ScriptAlias /query /usr/lib/python2.7/site-packages/viewvc/bin/cgi/query.cgi

  5. Restart the web server: /sbin/service httpd restart
  6. Go to http://localhost/viewvc
  7. If you haven't already done so, create the /etc/svn-auth-users file:

    htpasswd -cm /etc/svn-auth-users firstUsername
    New password:
    Re-type new password:
    Adding password for user firstUsername
You can test things out (sanity check) like this:

/usr/lib/python2.7/site-packages/viewvc/bin/standalone.py -r /path/to/svn/repository/location

Then in firefox, go to http://localhost:49152/viewvc

Wednesday, May 29, 2013

Change Font Size of Tabs in Eclipse Juno on Fedora

Edit ECLIPSE_HOME/plugins/org.eclipse.platform_4.2.2.v201302041200/css/e4_default_gtk.css

Change  the following


.MPartStack {
font-size: 6;

How to set up a email mailer post commit script with subversion on Fedora.

From http://stackoverflow.com/questions/501692/easiest-best-way-to-set-up-svn-commit-emails, the easiest way is to use the existing .py mailer script.

_____________

On Fedora 15, do the following:

yum install subversion-python

_____________

In your subversion repository:

cd hooks

cp post-commit post-commit.tmpl

Change

mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf

to

/usr/share/doc/subversion-1.6.18/tools/hook-scripts/mailer/mailer.py commit "$REPOS" "$REV" /etc/mailer.conf

_____________

After that, do the following to setup the mailer.conf file:

cp /usr/share/doc/subversion-1.6.18/tools/hook-scripts/mailer/tests/mailer.conf /etc/mailer.conf

Edit the mailer.conf and:

uncomment  mail_command = /usr/sbin/sendmail

add in commit_subject_prefix

add in propchange_subject_prefix

add in lock_subject_prefix

add in unlock_subject_prefix

Add in from_addr

Add in to_addr

_____________

Test it out by committing a test revision.

Tuesday, May 21, 2013

Using Unity over proxy with Windows 7

1) Go to Control Panel\All Control Panel Items\System and Go to "Advanced system settings".

2) Under the Advanced Tab, go to Environment Variables, and add two variables: HTTP_proxy and HTTPS_proxy.  Set it to your proxy, such as http://myproxy.domain.com:80 and restart Unity.

3) If you get certificate errors, you can manually activate, using the steps found here: http://answers.unity3d.com/questions/358967/peer-certificate-cannot-be-authenticated-with-know.html

Also from http://blog.gfx47.com/2011/03/08/unity3d-httphttps-proxy-problem-solved-o/

Tuesday, April 9, 2013

Create a tracking branch off of a remote branch in git

git branch --track branchName origin/branchName
git checkout branchName

Wednesday, March 27, 2013

Resolve "Agent admitted failure to sign using the key."

You might be getting the following error message, perhaps when either using ssh or git:


Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Solve this by this simple fix:

ssh-add

What may have happened, is that you changed your ssh key, and something got confused.

Thursday, February 14, 2013

How to format JSON on the command line

Also known as pretty print.

echo myFile.json | python -mjson.tool

Tuesday, February 12, 2013

Why do I get SplFileInfo::getMTime()... errors in symfony2?

The error, in the browser, might look like this:

SplFileInfo::getMTime() [<a href='splfileinfo.getmtime'>splfileinfo.getmtime</a>]: stat failed for /var/www/html/Symfony/src/Srb/AnthonyBundle/Controller/.#DefaultController.php

If you are using emacs, make sure you save off all files.  If you don't, you might have a # file around, and symfony gets confused.

Install symfony2 and doctrine using composer

1A) Download composer, which will download the composer.phar file which can be kept anywhere:

cd /path/to/composer/install/dir
curl -s https://getcomposer.org/installer | php

1B) Install symfony:

cd /path/to/composer/install/dir
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev

2) Check the configuration

Go to http://localhost/Symfony/web/config.php

3) Configure the database

Edit the /path/to/webroot/Symfony/app/config/parameters.yml file

4A) If you already have the database table created, make sure that the primary key is named id.

4B) If you already have the database table created, you can skip to creating an entity class:

php app/console doctrine:generate:entity --entity "MySpecificBundle:Things" --fields="id:int(11) price:float"

5) Edit the src/.../Controller/DefaultController.php file to do something interesting with the database table.

For example:

$row = $this->getDoctrine()
  ->getRepository('MySpecificBundle:Things')
  ->find($name);

if (!$row)
  {
  throw $this->createNotFoundException('No row found for id: '.$name);
  }

$otherVariable = $row->getOtherVariable();

return array('name' => $otherVaraible);

6) Open your browser to http://localhost/Symfony/web/app_dev.php/hello/1 to view the row

7) To create a CRUD scaffold, perform the following command:

php app/console doctrine:generate:crud --entity="MySpecificBundle:Things"

Then open your browser to http://localhost/Symfony/web/app_dev.php/things


Friday, February 8, 2013

Install Symfony2 and propel using composer

1A) Download composer, which will download the composer.phar file which can be kept anywhere:

cd /path/to/composer/install/dir
curl -s https://getcomposer.org/installer | php

1B) Install symfony:

cd /path/to/composer/install/dir
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev

_____________________

2) To optionally install propel:

2A) Configure composer.json file

  cd /path/to/webroot/Symfony

  Open /path/to/webroot/Symfony/composer.json in a text editor
  Add in the following line:


 "require": {
        ... ,
        "propel/propel-bundle": "1.1.*"
    },

2B) Download and install propel:

cd /path/to/webroot/Symfony
php /path/to/composer/install/dir/composer.phar update

After this step, you'll need to manually register the bundle in the AppKernel.php file.  See the following page for how to do that: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration (Search for "The second step is to register this bundle in the AppKernel class:") (Note that I had to add the first configuration on that page, even though I was using Composer")

After that, you'll need to "configure the bundle": http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration Note: I had to comment out or delete the doctrine: block, otherwise symfony would get confused and thought I was using doctrine.

Wednesday, February 6, 2013

How to get HP Color LaserJet 2605dn to print color

I've had a problem getting my HP Color LaserJet 2605dn printer to print color on my Windows 7 64-bit machine, but it's working now.  I had to use the Universal Print Driver (UPD), and in the Control Panel (Control Panel\All Control Panel Items\Devices and Printers), right click on the printer, go to Printer Properties > Device Settings > Device Type (way at the bottom), and change "Auto Detect" to "Color".  You should now be able to print color.

Friday, November 16, 2012

How to Workaround Mac OS X Lion VNC Password Issue

You may be having trouble typing your username or password when VNC'ing to your Mac OS X Lion machine from a Windows machine.  Try the following:

1) Type the password really slowly, around 1 character per second

2) If that doesn't work, you may have a process taking a lot of CPU cycles.  If that's the case, ssh into your Mac OS X Lion machine, run "top", and see what process is taking a lot of CPU cycles.  Kill the process.  Then try to VNC in.

Monitor Network Traffic on iOS Simulator

1) Install WireShark: http://www.wireshark.org/download.html

2) Add Wireshark bin directory to your path.  If you are using tcsh, edit your ~/.cshrc file and add in the following:

set path=(/Applications/Wireshark.app/Contents/Resources/bin $path)

3) In Terminal, run the following:

tshark 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

4) Run the iOS Simulator, and browse to something.  You'll see the HTTP connections made in Terminal.

Sunday, October 21, 2012

Global Viz of Google+ Users

I don't use Google+, but this is an interesting way to vizualize global data:

http://www.virante.org/blog/2012/08/29/google-plus-user-map-visualization/

Tuesday, September 25, 2012

Getting Windows 7 NFS Client to Connect to a Fedora Linux NFS Server

1) On linux:

sudo /sbin/chkconfig --level 345 nfs-server on
sudo /sbin/service nfs-server start
system-config-nfs

When the GUI pops up, add in your directory that you'd like to share, and the IP addresses (e.g. your Windows 7 IP address) you'd like to share your directory with.

2) Still on linux, edit the /etc/exports file, and change the following line:

(rw,sync)

to

(rw,sync,all_squash,anonuid=12345,anongid=23456)

where 12345 is your linux uid and 23456 is your linux gid.

That will make files written to your nfs server from anonymous client be owned by the specified uid and gid.

3) On linux, perform a

/sbin/service nfs-server restart

You can also perform the following, to confirm the directories shared:

sudo /usr/sbin/exportfs

4) On Windows 7, go to Control Panel > Programs and Features > Turn Windows features on or off

Check all three checkboxes under Services for NFS.  Optionally turn on Telnet Client if you'd like to test out your NFS connection over port 111 (telnet linuxServerHostname 111)

5) Windows-R (run) > \\linuxServerHostname\path\to\nfs\mountname

If all goes well, that will just magically work.

6) (Optional) To mount the nfs server to a Windows drive, you can perform the following on the command line:

mount \\linuxServerHostname\path\to\nfs\mountname z:

And to unmount, either:

umount -a

or

umount z:

Easy.  Well... at least, not too bad.

Friday, September 14, 2012

cannot find ... NXConstantString

Why do I get the following error (on Linux using GNUstep), when trying to compile an Objective C program?

... error: cannot find interface declaration for ‘NXConstantString’ ..

Answer:

Use the following flag when compiling everything (.o's, main, etc):

-fconstant-string-class=NSConstantString