Forked PHP TMDB Library

Since the original developer wasn’t responding and I really need this fast I decided to fork the original TMDB PHP library located here: https://github.com/pixelead0/tmdb_v3-PHP-API-

The fork is called tmdbphp and is located here: https://github.com/steffmeister/tmdbphp

I updated it with a few fixes and additional methods. Feedback is welcome.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/forked-php-tmdb-library/

Blackberry App World

Hey, just wanted to note that my apps Virtual Viewer and Steffs Todo App are also now available on Blackberry App World. But currently only for the Blackberry Playbook (OS v2.0).

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/blackberry-app-world/

SQL, UNION and correct ORDER

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

Just had to combine two tables month column and sort the whole thing. I had two tables like

Name Month
Something 201201
Else 201112

and

Name Month
Anything 201201
Other 201111

and I wanted (put the two tables‘ month in one column and remove duplicates):

Month
201201
201112
201111

The solution was not too complicated, but I thought I share it.

SELECT MONTH FROM table1
UNION
SELECT MONTH FROM table2 ORDER BY MONTH DESC

No need to add a GROUP BY because of the UNION, and the seconds query ORDER BY sorts the complete result.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/sql-union-and-correct-order/

Virtual Viewer 1.31

1.31 is a very important update to Virtual Viewer. It fixes the following problems:

  • fixes the problem where sending command was not possible with ESXi 4.1 (symptomes were 403 errors)
  • AND this fixes also sending commands to ESXi 5 hosts! This means v5 of ESXi and vSphere is finally supported

Thanks for the people who wrote me! This helped detecting and fixing these problems!

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/virtual-viewer-1-31/

Steffs To-Do App 1.3.7

Since „Todo“ is a registered trademark I had to rename my to-do app to „Steffs To-Do App“, which is version 1.3.7.

Learn more about the app here.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/steffs-to-do-app-1-3-7/

Virtual Viewer 1.27 to 1.29 released

Just uploaded v1.29 of Virtual Viewer, heres a changelog what happend from 1.27 (yesterday) to 1.29:

  • the snapshot addon is now builtin, no need to download it anymore! (also reduced the price of the power addon a bit)
  • initial support for ESXi 5 (I had no chance to test vCenter 5 yet – may work too), currently read-only!
  • fixed two reported crashes (hopefully)
  • you can now see if a VM is disconnected (when the host is disconnected)
  • small bug fixes (labels, logging behaviour, power addon bug)

Enjoy.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/virtual-viewer-1-27-to-1-29-released/

5 „good-to-know-basics“ of Joomla component development

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380 Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380 Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380 Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380 Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380 Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

I just developed a Joomla 1.6 component for a private project and came across some things which I believe are good to know. So I decided to note 5 things here:

Include JavaScript / CSS files

Adding a JavaScript or CSS file to the header section of the HTML is quite simple and elegant (well in my opinion):

// get document object
$document =& JFactory::getDocument();
// add JavaScript file
$document->addScript('components/com_mycomponent/views/script.js');
// add Stylesheet file
$document->addStyleSheet('components/com_mycomponent/views/styles.css');

Database handling

Using the database in Joomla is also quite simple:

// get database object
$db =& JFactory::getDBO();
// set a query, #_ will be replaced with the database prefix set in Joomla!
$db->setQuery('SELECT * FROM #__table');
// setting a query will not execute it, you execute it with, returns false in error case:
$db->query();
// getNumRows returns the number of rows of the result
// loadAssoc loads the first row as an array
if ($db->getNumRows() > 0) $row = $db->loadAssoc();

You can use setQuery also for INSERTs and UPDATEs too of course. You should also check the documentation.

User handling

// return the user object
$user =& JFactory::getUser();
// print the user id
echo $user->id;
// print the user name
echo $user->username;

You may also want to check this page with some more details.

Multilanguage

Need a component in several languages? No problem. First you need to create a language file (called com_mycomponent.ini) in the correct subdirectory. For example if you want to have a en-GB translation you save the file to JOOMLA_ROOT/language/en-GB. If you want to have a german translation you save it to JOOMLA_ROOT/language/de-DE. The file you need should look like this:

; You can have comments with coma-semicolon
; then you have the labels
COM_MYCOMPONENT_HELLO="Hello."
COM_MYCOMPONENT_GOODBYE="Goodbye."
; and so on...

If you need to enter some special chars like umlauts you need to use the html entity in that file!

Then in your code you can use the labels like this:

echo "You say: ".JText::_(COM_MYCOMPONENT_HELLO)."<br />";
echo "I say: ".JText::_(COM_MYCOMPONENT_GOODBYE);

This will print the two labels. The language which is set in Joomla will be the default language of your component. You have not to think about this though. Joomla will automaticall pick the correct ini file.

GET and POST

Find detailed information in the API documentation and on this example page.

Basically you can acces POST/GET variables like this:

$string = JRequest::getString('myvar');

So thats all for today. I hope I can help some newcomer with this information.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/5-good-to-know-basics-of-joomla-component-development/

Android SDK and AVD Manager and Proxies

Finally I figured out how to use the Android SDK and AVD manager with a proxy… I configured it correctly in Eclipse and it worked without problems but the manager does NOT honour these settings!

The solution is to start the SDK and AVD manager stand-alone, just change to your Android SDK directory, subdirectory tools and start „android“ (or android.exe on Windows I guess). The manager opens with a new „Settings“ section on the left side.

It takes a host name and a port, and you are able to force it to use http instead of https. It seems there is no option to use authentification so you would have to whitelist https://dl-ssl.google.com on your proxy if you have the ability.

I found the solution on stackoverflow.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/android-sdk-and-avd-manager-and-proxies/

Copy SQL records

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/.sites/69/site4132644/web/services/techblog/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

Just found myself needing a way to copy and modify SQL records in one process.

I came up with the following PHP code which is rather ugly but works:

// open mysql connection and stuff
...
// select rows you want to copy, adapt as needed
$result = mysql_query("SELECT * FROM downloads WHERE pid=2");
// check if there are actually rows
if (mysql_num_rows($result) > 0) {
  // fetch columns
  $amount_fields = mysql_num_fields($result);
  $fields = array(); // create field array
  $counter = 0; // set counter var
  // build columns array
  while($counter < $amount_fields) {
    $fields[] = mysql_field_name($result, $counter); // fetch column name
    $counter++; // next column
  }
  // go through selected rows
  while($row = mysql_fetch_assoc($result)) {
    // start of insert query
    $insert = 'INSERT INTO downloads ';
    $columns = '('; // query columns part
    $values = '('; // query values part
    $counter = 0; // reset our counter
    // go through the columns
    foreach($fields as $value) {
      // the first time we do not add commas
      if ($counter > 0) {
        $columns .= ',';
        $values .= ',';
      }
      $columns .= $value; // add column
      $values .= "'".$row[$value]."'"; // add value
      // HERE would be the place to modify the values
      $counter++;
    }
    // close brackets
    $columns .= ')';
    $values .= ')';
    // finally build query
    $insert .= $columns.' VALUES '.$values;
    // run query, should check the return value
    mysql_query($insert);
  }
}

I wonder if there is a easier way. If you only need to copy (without modifying) a record you may be interested in SELECT INTO.

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/copy-sql-records/

Typo3 auto fill tt_news news article author

I finally found a typo3 extension to pre-fill the author field when creating a news article.

The name of the extension is „cron_setdefaultauthor“. Get it here.

Yay!

Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/typo3-auto-fill-tt_news-news-article-author/