Stream Airvision (aircam) on webpage

Well, the correct term is not streaming it´s featching a new image every 0,5 second.

So, this is how I did it:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">// <![CDATA[
setInterval(function(){
var currentDate = new Date().getTime();
$('#videoframe').attr("src","http://YOUR-URL-TO-THE-SERVER/snapshot.cgi?_="+currentDate);
},500)
// ]]></script>
<img id="videoframe" alt="Video preview" src="http://YOUR-URL-TO-THE-SERVER/snapshot.cgi?_=136421898asd7583" width="640" height="360" border="1" />

The thing here is to use javascript to reload the image, and then use current timestamp to make sure the browsern doesn´t cache the image.

MAMP add virtualhosts

If you want to run your own VirtualHosts when you are using MAMP on Mac, just do the following step:

1.) Open your terminal

2.) Run: pico /Applications/MAMP/conf/apache/httpd.conf

3.) Add the following to the bottom of the file (change for your values):


NameVirtualHost *

DocumentRoot ”/Applications/MAMP/htdocs/”
ServerName localhost

DocumentRoot ”/Applications/MAMP/htdocs/YOUR-PATH”
ServerName http://www.YOUR-DOMAIN.com
ServerAlias YOUR-DOMAIN.com *.YOUR-DOMAIN.com
4.) Save

5.) Open your hosts file, ”sudo pico /etc/hosts”

6.) Add your domain and point it to your localhost (add at the bottom of the file):

127.0.0.1 http://www.YOUR-DOMAIN.com

7.) Save and your done

If you want to check your configuration, just run: apachectl configtest

Make WordPress plugin grid column responsive

Grid columns (http://wordpress.org/extend/plugins/grid-columns) is a great wordpress plugin for using columns. The problem is that it is not responsive. But that is easy to solve. Just add this to you responsive CSS:

@media (max-width: 700px) {
.column-grid .column, .column-grid .column-first, .column-grid .column-last { float: none; }
body .column-grid .column { width: 100%; }

}

”body” can be changed to example ”#container” if you´r using a container div with that id.

”max-width: 700px” can of course be changed to you own width.

TYPO3 typoscript get last page updated

Use typoscript to fetch the latest updated page. This script fetch the last updated content and returns the date:

lib.field_lastupdated=CONTENT
lib.field_lastupdated {
table = tt_content
wrap =<p>Last update   |</p>
select{
orderBy = tstamp DESC
languageField=sys_language_uid
max = 1
pidInList = 1
recursive = 10
selectFields = tstamp
}
renderObj = COA
renderObj {
10 = TEXT
10 {
field = tstamp
strftime = %Y-%m-%d
wrap = |
}
}
}

Typoscript hmenu/tmenu has child

If you want to use a different wrap for your menu depending on if a page has childs or not. Just use ”IFSUB” in your typoscript.

Ex.) If you want to accomplish this:

<ul>
<li><a href=”#”>Start</a></li>
<li class=”haschilds”>Has submenu
<ul>
<li><a href=”#”>Subpage 1</a></li>
<li><a href=”#”>Subpage 2</a></li>
</ul>
</li>
<li><a href=”#”>No subpages</a></li>

Your typoscript should look like this:

lib.field_mainmenu = HMENU
lib.field_mainmenu {
1.entryLevel = 0
1.expAll = 1
1 = TMENU
1.wrap = <ul>|</ul>
1.noBlur = 0
1.ACT = 0
1.NO.wrapItemAndSub = <li>|</li>
1.IFSUB = 1
1.IFSUB.wrapItemAndSub = <li class=”haschilds”>|</li>
1.IFSUB.doNotLinkIt = 1

//– Wrap for Active link
1.ACT = 1
1.ACT.wrapItemAndSub = <li class=”selected”>|</li>
1.ACT.ATagParams = class=”selected”
1.ACTIFSUB = 1
1.ACTIFSUB.wrapItemAndSub = <li class=”haschilds”>|</li>
1.ACTIFSUB.doNotLinkIt = 1

//– Wrap for current link
1.CUR = 1
1.CUR.wrapItemAndSub = <li class=”selected”>|</li>
1.CUR.ATagParams = class=”selected”
1.CURIFSUB = 1
1.CURIFSUB.wrapItemAndSub = <li class=”haschilds”>|</li>
1.CURIFSUB.doNotLinkIt = 1

2 < .1
2.entryLevel = 1
2.wrap = <ul class=”submenu”>|</ul>

//– Deactivate wrap for Active link on sublevel
2.ACT = 0
2.CUR = 0

}

TYPO3 mk_anydropdownmenu handler_getFromTableList parseFromTables error

I just ran into this error:

DBAL fatal error: No handler found in handler_getFromTableList() for: ”” (SQL engine parse ERROR: No table name found as expected in parseFromTables()!: near ” ”)

This is easy to solve, just follow these steps:

  1. Edit file /typo3conf/ext/mk_anydropdownmenu/pi1/class.tx_mkanydropdownmenu_pi1.php
  2. Go to line 362
  3. Change it to: $sqlString = $GLOBALS['TYPO3_DB']->quoteStr($this->savedGetVar,$this->table);
  4. Save the file, upload it, and CLEAR THE CACHE

The problem here is that the table is not added as a second parameter from start, so it needs to be added.

WordPress slow admin?

Is your wordpress admin slow? Do you run a multisite? On a server that uses NAT?

The problem is that the admin-panel tries to connect to it self, and if you use NAT the server can´t reach it self, so it has to time out each time you load a new page.

To solve this, just add you domain to the hosts file (/etc/hosts for linux and c:\windows\system32\drivers\etc\hosts for windows).

Example:
127.0.0.1 localhost http://www.yourdomain.com
127.0.0.1 localhost yourdomain.com

If you do not have access to your hosts file, just remove the admin panel. For mor information, visist http://codex.wordpress.org/User:Westi/Hosting_WordPress_Behind_NAT