Setting up MythTV as a dedicated HTPC machine requires MythTV to start on boot and restart if anything crashes, have no desktop environment and a light weight display manager. I found the best display manager for running MythTV as a dedicated HTPC is LightDM. It is easy to configure, has no default desktop environment, and has auto login feature. Once configured correctly only mythfrontend will boot on startup and respawn is anything crashes.

Setting Up LightDM

To switch to LightDM, first make sure it is installed.


sudo apt-get install lightdm

You will get prompted during the installation process which display manager you want to use. If you have multiple installed make sure you select lightDM. If you already have lightDM installed then just update /etc/X11/default-display-manager


/usr/sbin/lightdm

Auto Login

To configure LightDM to auto login and continue to auto login if X or MythTV crashes edit /etc/lightdm/lightdm.conf


[Seat:*]
autologin-guest=false
autologin-user=mythtv
autologin-user-timeout=0
user-session=mythtv

Greeters provide the login panel, so remove any reference to greeters. The autologin-user is the user you want mythtvTV to run as. user-session is the xsession to run after logging in.

XSession

The value of user-session needs to reference a file in /usr/share/xsessions/. So in this example my user-session is mythtv so I need a file named mythtv.desktop.


[Desktop Entry]
Name=mythtv
Exec=/usr/bin/mythfrontend.real
Type=Application

Testing

Assuming lightDM is already running, restart it


sudo systemctl restart lightmd

If everything works when lightDM restart it should automatically login mythtv user and running mythfrontend. If something so wrong check out /var/log/lightdm/lightdm.log.

My biggest gripe with the Android head units is the user experience. There are a handful of Android launchers available on the Play Store that provide a more automotive experience. I tried a few and could not find the right balance between Android and an automotive experience. So I spent the last few evening creating one.

 

Enough rambling, we all want to see screenshots:

Screen Shot 2018-05-05 at 12.06.11 PM

 

Main Objectives:

  • Install and go! I don’t think new users should have to invest time setting up and configuring the launcher.  The defaults settings should provide a complete experience. Settings should be available to tweak the experience once you’re familiar with it.   
  • An Android experience within an automotive environment. A balance of automotive UI experience with Android paradigms.  A lot of the available automotive launchers provide a unique experience, completely dropping any Android paradigms.
  • Larger touch points so interacting with the UI is easy.  Having precise touch points requires to much focus. Something I learned years ago swapping an OEM head unit with an Alpine.  The memory buttons where so small on the Alpine, that hitting the right one required focus.

 

Current Features:

  • The seven apps on the bottom are all configurable with a long press.  
  • The app drawer icon launches the app drawer
  • The screen widgets, wifi, location, weather, time/date can be enabled or disabled to suit your preferences
  • Manufacturer logo is configurable.
  • Settings are accessed through a long press of the manufacturer logo

 

Upcoming Features:

  • Phone message integration, similar to Android Auto.  When a message is received a notification displaying the message is displayed on the screen.
  • Wallpaper support to provide even more of a personal experience.
  • Can Bus integration

 

The launcher is stable but far from feature complete.  I’m interested to hear what others think would add usefully functionality to the launcher,  while still adhering to the goals of the launcher.

 

To Install:

If you would like to install it directly on your head unit, goto Chrome and type in the following url to download it directly on your head unit.   If this is your first app not from the Google Play Store then it will prompt you to change a security setting to allow apps from  “Unknown Sources”.  After changing the setting click on the downloaded apk and it will install.

To install directly on head unit enter this url:

https://tinyurl.com/y7s5kwgn

To download the apk

CarLauncher Download

I missed  having a vegetable garden.  I tried multiple times but with all other demands and interests in life regular maintenance was irregular at best.  So I started looking into hydroponic and starting thinking about ways to automatic most of the regular maintenance.  During my research I discovered aquaponics and was fascinated with the bio system that it forms.

 

These two video where intriguing, since part of my motivation is to automate most of the regular maintenance requirements.

 

 

 

Part of the fun of this project is the design and building of the system.  So I started off researching existing designs to create my own variation.   There are a variety of systems; Flood and Drain, Drip Irrigation, , NTF, etc.  After hours researching I narrowed it down to a flood and drain system.   Flood and Drain is a process of pumping water into the grow pot and then draining it out.  Now that I have the basic system decided time to get down to designing the system.

 

Aquaponic Drain And Fill

 

For the system to work popularly oxygen concentrations in the water need to be maintained. Plant roots consume oxygen so during the drain cycling the roots are exposed to oxygen.  Fish also consume oxygen from the water so proper concentrations of oxygen needs to be maintained within the water.  This can be achieved mechanically using a aquarium air pumps or naturally by aggregating the water.  Keeping with the cost down concept I need the system to naturally aggregate the water, so the overflow also acts as an aerator by spilling the water back into the fish tank.  The water inlet also act as a drain, leveraging the siphon effect, water is drained to the level of the inlet pipe.

So now that the design is complete it’s time for some automation.  Part II will focus on automation of the system using a SparkIO Core to control turning on and off the pump along with monitoring temperature and humidity to determine how often to drain and fill.

Got the Samsung Galaxy X from T-Mobile today and spent most the day tinkering with it.  One thing I could not find instruction on was how to tethering the phone with Snow Leopard.  So I just started tinkering to see if I could figure it out.  Low and be hold it worked with very little effort.

  1. First change your USB Settings to “Ask on connection” on your phone. Settings->Applications->USB Settings
  2. Return to your home screen and connect your phone to your Mac via a USB cable
  3. The phone will now prompt  you for the connection mode, select “Samsug Kies”
  4. After the phone connects, your mac should alert that a new network interface was found
  5. Open the Network Preferences on your Mac
  6. Select the new Samsung_Andriod network interface
  7. Select “Advanced” and use the following settings
  8. Vender: Samsung
  9. Model: GPRS
  10. APN: epc.tmobile.com
  11. CID: 1
  12. Click OK

This should return you to the standard Network preferences, use the following settings:

Telephone Number: epc.tmobile.com

Account Name: <your phone number>

Password: <your My T-Mobile passowrd>

Click “Connect” and if everything works, you should be tethered.

This patch is indented for people who run QMail for personal mail hosting and want to route all outgoing mail through there ISP smtp server. The reason to route outgoing mail through you ISP is that some smtp servers won’t accept mail from dynamic ip addresses. To do this in QMail you configure smtproutes control file to direct all outgoing mail to your ISP’s smtp server (see man qmail-remote(8)). However, some ISPs require SMTP authentication for outing mail which qmail doesn’t support. This patch provides support for SMTP authetication.

Build

  • Apply the patch to the code.
  • Follow the normal build process for making QMail.
  • If the same qmail verision is already installed via a package you can copy over just the qmail-route binary, you won’t need to install the complete built version

Configure

smtpauth – create this file in your control directory and put you ISP’s username in it. The username must be base64 encoded. To do this you can use this website to get the base64 encode string. Enter you username and click encode. Copy the result to this file

smtppasswd – create this file in your control directory and put you ISP’s password in it. The password must be base64 encoded. To do this you can use this website to get the base64 encode string. Enter you password and click encode. Copy the result to this file

Issues

  • There a know issues that the smtpauth file must exist. If it doesn’t qmail-route will crash.is file

MythFlix is a MythTV plug-in for managing your Netflix queue from MythTV. It currently supports the ability to view your queue and add movies to your queue. The browse feature is based on the Netflix RSS feeds. This plug in is not very mature, which means things might not work right and/or it might break other things.

Screenshots

Downloads

MythFlix has been incorporate into the MythTV project. This site no longer contains the most recent code. To get the most recent version you must check out the last source from the MythTV project

Dependencies

  • Crypt:SSLeay Perl Library

Instructions

To browse movies MythFlix uses the RSS feeds from NetFlix, no screen scrapping. To select which RSS feeds you want, go to the configuration page. A list of available RSS feeds are presented. Select the ones you want. Then select “Browse” from the main MythFlix menu to see the avaliable movies. When you see a movie you want press ‘Enter’. This will add the movie to your queue. To view your queue select “Queue” from the main MythFlix menu.

Credit

This work was derived from MythNews.

Integrating Spring and Hibernate would seem like a no brainier. Spring comes with a plethora of support for hibernate and the combination is very popular.  However, I’ve struggled every time to figure out how to best integrate the two technologies.  I’ve searched Google and found as many different solutions as new questions.

The problem seems to stem from the different patterns available to intergrate spring and hibernate. The complexity of your application will help determine which pattern works best.  For most web based application session-per-request pattern is sufficient.  A session-per-request is a single hibernate session for each http request.  Spring provides a servlet filter for this, OpenSessionInViewFilter.  This filter binds a hibernate session to thread local when the filter processes the request.

To set up the OpenSessionInViewFilter add the following to the web.xml file.

<filter>
<filter-name>OpenViewInSession</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenViewInSession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Next configure the session factory in the spring context.

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<!-- this will show us all sql statements -->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.show_type">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
<prop key="hibernate.hibernate.cache.use_query_cache">true</prop>
<!-- Set schema here so we can vary it -->
<prop key="hibernate.default_schema">cms</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.supplyframe.partmanagement.domain.Company</value>
<value>com.supplyframe.partmanagement.domain.Taxonomy</value>
</list>
</property>
</bean>

Now inject the session factory configured previously into you data access classes. It’s important to call currentSession() on the session factory when a session is needed and not store the session. The session returned by currentSession() will be the session bound to thread local when the filter processed the request.

<bean id="companyService" 
    class="com.supplyframe.partmanagement.service.CompanyService">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

Good luck!

Living in Southern California without A/C I’m always a little worried about the temperature inside my computer cases.  I just rebuilt a system and forgot to plug in the 120mm fan in front of the drives.  When I opened the case up to reconnect the fan the hard drives where scorching hot.  After rebooting I checked the drive temperatures using hddtemp, 59C-66C.  Ouch!  Now with the fan connect, the drives are 42C-48C.

Nothing kills a drive faster then heat, so I decided to start monitoring them.   Here is a script that uses hddtemp to monitor the drive temperature and send out an alert and if the drive reaches critical condition will shut the machine down. To install hddtemp on Ubuntu run: sudo apt-get install hddtemp

#! /bin/bash

#List of devices to monitor
DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf"

#Email address to send alerts to
SYSADMIN=email@address.net

#Mail program
MAIL="/usr/bin/mail"

#Alert temperature before sending alerts
ALERT_TEMP="60"

#Max temperature before shutting down down
KILL_TEMP="65"

SHUTDOWN_CMD="/sbin/shutdown -h now"

for HD in $DEVICES
do
    TEMP=`/usr/sbin/hddtemp -n $HD`
    logger "Checking temperature on $HD... ($TEMP C)";
    if [ "$TEMP" -gt "$ALERT_TEMP" ]; then

        DATA=`/usr/sbin/hddtemp $HD`
        HOSTNAME=`hostname`
        MSG="$HOSTNAME Drive temperature critical"
        #
        (
        echo " "
        echo "$DATA"
        echo " "
        ) | $MAIL -s "$MSG" $SYSADMIN
    fi;

    if [ "$TEMP" -gt "$KILL_TEMP" ]; then
    $SHUTDOWN_CMD
    fi;

done

The following added to cron.d runs the script every 5mins.

*/5 * * * * root /usr/local/bin/hddtemp.sh