• About
  • Everyday Linux Commands

<roughCode/>

~ …so I can find it

Monthly Archives: July 2012

Running Tomcat as a service on CentOS

30 Monday Jul 2012

Posted by Scott in Apache Tomcat, Application Servers, Linux / UNIX, Networking, Operating Systems

≈ Comments Off on Running Tomcat as a service on CentOS

Tags

linux, tomcat

see http://www.tech-problems.com/install-tomcat-7-on-fedoracentos/

…hmmm…had updates this post will some config files and must not have hit Update…will fix tomorrow when I can grab the files again…

Configure Apache Tomcat to use Apache httpd web server

30 Monday Jul 2012

Posted by Scott in Apache Tomcat, Apache Web Server, Application Servers, Linux / UNIX, Networking, Operating Systems

≈ Comments Off on Configure Apache Tomcat to use Apache httpd web server

Tags

linux, tomcat

see this: http://fijiaaron.wordpress.com/2008/07/30/configuring-an-apache-virtualhost-to-use-tomcat/

and here’s a sample from my /etc/httpd/conf/vhosts/a-vhost-config.conf:

ProxyRequests Off

AddDefaultCharset Off
Order deny,allow
Allow from all

ProxyPass / ajp://localhost:8019/
ProxyPassReverse / ajp://localhost:8019/

Created /etc/httpd/conf/workers.properties:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8019

 

Advertisement

Networking fails moving VirtualBox Linux guest to another host

29 Sunday Jul 2012

Posted by Scott in Linux / UNIX, Networking, Operating Systems

≈ Comments Off on Networking fails moving VirtualBox Linux guest to another host

Tags

linux

(because the mac changed)
https://forums.virtualbox.org/viewtopic.php?f=2&t=27220

…and the mac address in the eth0 config file at /etc/sysconfig/network-scripts/ifconfig-eth0 needs to match the mac address in the rules file at /etc/udev/rules.d/70-persistent-net.rules…

The gist is…

You can edit the /etc/udev/rules.d/70-persistent-net.rules or you can delete the rules and Linux will configure it on the next boot.

Or bypass the whole issue and use the same mac address as the original vm…which shouldn’t be a problem behind different NAT firewalls(?)

Linux commands I always forget

27 Friday Jul 2012

Posted by Scott in Linux / UNIX, Operating Systems

≈ Comments Off on Linux commands I always forget

Tags

linux

Un-TAR a file: tar -zxvf yourfile.tar.gz

 

(actually decided to re-do this as a page…see the link up top)

Drupal restoration project link dump

27 Friday Jul 2012

Posted by Scott in CMS, Drupal

≈ Comments Off on Drupal restoration project link dump

Tags

Drupal

I found a backup of a defunct Drupal project, and now it’s time to see if I can take these file system zip files (of the entire Drupal directory structure in (I don’t remember what directory they were in)) and database backup files made with the backup module or something and see if I can recreate enough stuff to look at one of the sites from that server…

To that end, here are some links that I’m reviewing…more to come as I work through this…

a quick drupal install refresher for me… http://idolinux.blogspot.com/2009/01/quick-install-of-drupal-6.html

http://www.webologist.co.uk/blog/how-to-backup-and-restore-drupal

since the backup and migrate module was used…http://drupal.org/node/547560#comment-1935846

Create the MySQL user…and create the database…and try to import the GIANT SQL file

GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
CREATE DATABASE db_name;
mysql -u USERNAME -p DATABASENAME < FILE.SQL

and now I can get to the default site…just need to get the vhosts set up and working and Bob should then be your uncle…

…sites are up and running, but need to work on the URL rewriting…http://drupal.org/node/228462

 

CentOS activate eth0 and get dhcp working

27 Friday Jul 2012

Posted by Scott in Linux / UNIX

≈ Comments Off on CentOS activate eth0 and get dhcp working

Tags

linux

During an install from the minimal CentOS iso, I forgot to set eth0 to connect automatically. Since the default setting on CentOS is for eth0 to be disabled, this resulted in having to remember how to use vi to edit /etc/sysconfig/network-scripts/ifcfg-eth0 to update the configuration.

Update the following:

BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no

…and restart the network.  NM_CONTROLLED turned out to be a big deal, because until I updated that from yes to no, I wasn’t getting an IPv4 address.  And IPv6 wasn’t getting any name resolution.  Don’t know if that was due to my host (this was a VirtualBox instance that I’m setting up as a demo for a friend, and I don’t know what the IPv6-ability of my old sitting around on the couch laptop is) or an issue with my 1st gen Time Capsule with integrated olde-school Air Port…

..hacking core (WP)

26 Thursday Jul 2012

Posted by Scott in CMS, Code Samples, WordPress

≈ Comments Off on ..hacking core (WP)

Tags

WordPress

Due to a quirk of my Windows shared hosting provider that is impacting one WordPress blog and not another…I hacked functions.php.  Now, as with hacking Drupal core, I’m not proud of this, but despite the fact that both sites claim to be reading the same php.ini file, one has the open_basedir restriction in effect, and the other does not.  So here’s my hack to get around image uploads blowing up because IIS is putting them in temp and php can’t get there…

// /wp-includes/functions.php
// ~ line 1716

function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {

	$proper_filename = false;

	// Do basic extension validation and MIME mapping
	$wp_filetype = wp_check_filetype( $filename, $mimes );
	extract( $wp_filetype );

// hack
return compact( 'ext', 'type', 'proper_filename' );

	// We can't do any further validation without a file to work with
	if ( ! file_exists( $file ) )
		return compact( 'ext', 'type', 'proper_filename' );

In case there’s any question, dropping a custom php.ini into the web root didn’t work. Neither did one in each folder, or in the cgi folder or anywhere else I could think to stuff a php.ini…

Linux link dump for current project (to be sorted later)

25 Wednesday Jul 2012

Posted by Scott in Apache Tomcat, Apache Web Server, Linux / UNIX, Operating Systems

≈ Comments Off on Linux link dump for current project (to be sorted later)

Tags

apache, linux

Working on a new project and the server guys made me a new RHEL server for the dev team to use.  And IT said “here you go, good luck”.  Now, in a previous career choice I was a Windows server admin, and I’ve dabbled in your various Linux and UNIX and Solaris environments.  I have not, however, been a big Apache Tomcat user. The Apache httpd server, sure, but not Tomcat.  So here are some links I’ve been reading to get my local CentOS VM configured before I start trying to blow up configure the dev server that my team will be using to support multiple virtual sites and Tomcat instances…
  • http://articles.slicehost.com/2010/5/19/apache-virtual-hosts-on-centos-part-1
  • http://articles.slicehost.com/2010/5/20/installing-apache-on-rhel
  • http://articles.slicehost.com/2010/7/17/linux-file-permission-concepts
  • http://www.networkclue.com/os/Linux/commands/chcon.aspx
  • http://www.linuxquestions.org/questions/linux-general-1/chcon-cant-apply-partial-context-to-unlabeled-file-371977/
  • http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-6-on-fedora-centos-red-hat-rhel/
  • (setting up tomcat) http://bobcares.com/blog/?p=451

SELinux again on AJP connection: http://sysadminsjourney.com/content/2010/02/01/apache-modproxy-error-13permission-denied-error-rhel/

 

C# using app.config to define font settings

19 Thursday Jul 2012

Posted by Scott in C#, Code Samples

≈ 1 Comment

Tags

C#, settings

I thought it would be nice to provide some configuration options, such as font family and size, in a desktop application I’ve been working on recently.  I also wanted to provide a default option, and have that configured in the app.config file instead of having to recompile the application if I decide to (or get told to) change the font size, bold/un-bold, font family, etc.  I couldn’t, however, just set a value in the app settings and add keys with the name and size.   I needed to actually define a font setting.  But I’d never bothered to do that before.  So here’s what I did.

Right-click the project and select Properties, then navigate to the Settings tab and add a new System.Drawing.Font value:

I chose a nice big, bold Arial so it could be seen on a monitor stuck to the wall from across the room.

The value will look something like this in your app.config:

<applicationSettings>
    <MyApplication.Properties.Settings>
        <setting name="DisplayFont" serializeAs="String">
            <value>Arial, 15.75pt, style=Bold</value>
        </setting>
    </MyApplication.Properties.Settings>
</applicationSettings>

Finally, I added a little something like this to the form’s load method to grab the default font…at first:

private void Form1_Load(object sender, EventArgs e)
    {
        // set the font
        dg1.DefaultCellStyle.Font = Properties.Settings.Default.DisplayFont;

And that uses the default font of my choice, as set in the app.config, every time the application launches.  That way I could change the font setting in app.config any time I wanted and not have to recompile the application.  That was step one.

In the end, what I ended up doing was using the application level default value in Settings, and adding a user scope font setting also.  If the user scoped font value is null or it equals the default application scope font, I use the default font.  If the user scope font is different — read by saying something like

System.Drawing.Font a = Settings.Properties.User.MyFontValue;

anyway, if font a is different from font b (from Settings.Properties.Default.DisplayFont), dg1.DefaultCellStyle.Font = a;

And then I provided a font dialog that’s opened up from an option dropdown button and when you pick a font, Settings.Properties.User.MyFontValue is updated…

FontDialog Fdiag = new FontDialog();
if(Fdiag.ShowDialog() != DialogResult.Cancel )
    {
       Settings.Properties.User.MyFontValue=FDiag.Font
    }

Or something like that.  Pretty basic stuff, really, but I haven’t done a whole lot of desktop applications where I actually needed to provide…or save…options for the user…

Error updating WP site

18 Wednesday Jul 2012

Posted by Scott in CMS, WordPress

≈ Comments Off on Error updating WP site

Tags

WordPress

Got this error trying to update a WordPress site, and I didn’t want to lose all the content.  What error?

Unable to locate WordPress root directory

Given that I use a Windows host (don’t start on me, I’ve used them since, like, 2001), it’s obviously permissions.  The site in question (not this one, so don’t go playin’) had WP installed in a sub-folder, so I brute forced the permissions there and the upgrade worked.  Now I just need to tighten up security back to what it SHOULD be 😦

← Older posts

Recent Posts

  • Bulk commands to install PHP and MySQL on CentOS 7
  • Four year gap? No, had just been self-hosting for a while
  • winhttpcertcfg.exe Example
  • Configure Tomcat 7 to use HTTPS
  • SCP on Mac (and a tool for Windows)

Archives

  • November 2018
  • October 2018
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012

Categories

  • Apache Tomcat
  • Apache Web Server
  • Application Servers
  • C#
  • CMS
  • Code Samples
  • Databases
  • Development Tools
  • Drupal
  • IIS
  • Java
  • Linux / UNIX
  • MS SQL Server
  • Networking
  • Operating Systems
  • Oracle
  • Uncategorized
  • Video Games
  • Windows
  • WordPress

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Create a free website or blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • <roughCode/>
    • Already have a WordPress.com account? Log in now.
    • <roughCode/>
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...