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.