Search this blog ...

Thursday, July 22, 2010

How to query and obtain MD5 checksum for a file hosted on rapidshare.com

How many times have you downloaded file(s) from rapidshare.com only to extract them / join them / etc and discover that the file appears to be corrupted? You then wonder was it a download issue, or was the actual file itself hosted on rapidshare the problem.

My ADSL2+ internet connection here in Australia is slow by today’s internet speed standards (realworld tests, I get 500 KB/s download and 100 KB/s upload); To add insult to injury, internet quota in Australia is capped!  Thus, I don’t want to have to download a large file again, unless absolutely required.

The solution to this problem, is to make a basic HTTP request to rapidshare and request MD5 checksum information for the specific file(s) concerned, and then compare this with the MD5 checksums of the downloaded files on your local machine.

To perform MD5 checksum on your local files, first get yourself a suitable md5 hash tool for your specific OS platform concerned:

http://www.openoffice.org/dev_docs/using_md5sums.html

You can then use my html script below to query rapidshare for checksum info.  Put in the textarea the rapidshare links to query, for example

 http://rapidshare.com/files/408093110/test.iso

The MD5 checksum is returned as 32-character, hexadecimal-formatted hash. Using the test.iso link above for example, the MD5 checksum component returned by rapidshare appears in bold below:

408093110,test.iso,20348928,153,1,l3,78F8244AF76C6CF9641190780A50A9D8

<html>
  <body>
    <!-- Code by M.Shannon -->

    <script type="text/javascript">

      var debugMode=false; // set to true to enable window alerts

      function findURLs(refFiles, refFileNames)
      {
        var exp=/http:\/\/(www\.)?rapidshare\.com\/files\/\d+\/[\w_\-\.]+/igm;
        var matches = document.getElementById("urls").value.match(exp);

        if (matches != null)
        {
          for (var i = 0; i < matches.length; i++)
          {
            var url = matches[i];
            if (debugMode) { alert(url); }
            var index1 = url.lastIndexOf("/files/");
            var index2 = url.lastIndexOf("/");

            refFiles.push(url.substring(index1 + 7, index2));
            refFileNames.push(url.substring(index2 + 1));
          }
        }
      }

      function validate(form)
      {
        var files = new Array();
        var fileNames = new Array();

        findURLs(files, fileNames);

        if (files.length > 0)
        {
          if (debugMode) { alert(files); alert(fileNames); }
          form.files.value = files.toString();
          form.filenames.value = fileNames.toString();
          return true;
        }
       
        return false;
      }

  </script>

  <form><textarea id="urls" cols="80" rows="4">paste your rapidshare hyperlinks in to this textarea</textarea></form>

  <form method="post" action="http://api.rapidshare.com/cgi-bin/rsapi.cgi" onsubmit="return validate(this);">
    <input name="sub" type="hidden" value="checkfiles_v1">
    <input name="incmd5" type="hidden" value="1">
    <input name="files" type="hidden" value="">
    <input name="filenames" type="hidden" value="">
    <input type="submit">
  </form>

  <script type="text/javascript">
    document.getElementById("urls").focus();
  </script>

  </body>
</html>

Wednesday, July 21, 2010

How to prevent auto-repeat of videos in XBMC

For the best part of the last year, one annoying issue I have found with my particular XBMC setup was that videos would auto-repeat. I could not understand why this was, or where the auto-repeat setting was stored. If you pressed the TV power button mid playback of a movie, the movie would continue to play and repeat over and over.

It was particularly nasty should the video be played from an external USB disk, as the disk would never go to sleep.

Anyway, today I finally worked out where this setting is stored; instructions below assume an AppleTV XBMC setup :-

Navigate to a movie/tv episode etc

Hold down menu button until popup menu appears

from popup menu, choose "Queue item"

hold down menu button once more until popup menu re-appears

from popup menu, choose "Now playing ..."

"NOW PLAYING - VIDEOS" screen should appear

press Previous/Rewind button, and a side-menu on left-hand side should appear

Check the value for the REPEAT option. If it is set to REPEAT:ALL, movie will play over and over.

Set it to REPEAT:OFF

Friday, July 9, 2010

How to determine ATV Software Version Running

-bash-2.05b$ sw_vers
ProductName:    Apple TV OS
ProductVersion: 10.4.7
BuildVersion:   8N5880

AKA – Software Version 2.40

According to XBMC God – S.Davilla:

r1.00 -> 8N5107
r1.10 -> 8N5239
r2.00 -> 8N5400
r2.01 -> 8N5455
r2.02 -> 8N5461
r2.10 -> 8N5519
r2.20 -> 8N5622
r2.30 -> 8N5722

View ORACLE SQL query results with columns rendered vertically

Below is a script I hacked together from various sources to render ORACLE SQL query results in a vertical fashion (column are presented vertically rather than horizontally).

Tested with Oracle Database 11g Enterprise 11.2.0.1.0

:-

REM NAME: vselect.sql - Replacement by M Shannon.
prompt
accept tname prompt "Enter the table or view you wish to display vertically: "
prompt
prompt Enter the "WHERE" clause(s)...
prompt - if there is no "WHERE" clause, press [Enter].
prompt - do not include the word, "WHERE"; just specify syntax beyond "WHERE".
prompt - do not use single quotes for literals; use double quotes (") to enclose literals.
prompt
accept where prompt '=> '
prompt
prompt Enter the "ORDER BY" clause...
prompt - if there is no "ORDER BY" clause, press [Enter].
prompt - do not include the words, "ORDER BY"; just specify syntax beyond "ORDER BY"
prompt - do not use single quotes for literals; use double quotes (") to enclose literals.
prompt
accept orderby prompt '=> '
prompt

set termout on
set serveroutput on

declare
  l_where_clause    varchar2(500);
  l_orderby_clause  varchar2(500);
  l_cur             number;
  l_dtbl            dbms_sql.desc_tab;
  l_cnt             number;
  l_status          number;
  l_val             varchar2(200);
  double_quote      char(1) := '"';
  two_single_quotes char(1) := chr(39);
begin
  if length('&where') > 0 then
    l_where_clause := 'WHERE ' || replace(ltrim(rtrim('&where')),double_quote,two_single_quotes);
  else
    l_where_clause := null;
  end if;

  if length('&orderby') > 0 then
    l_orderby_clause := 'ORDER BY '|| replace(ltrim(rtrim('&orderby')),double_quote,two_single_quotes);
  else
    l_orderby_clause    := null;
  end if;

  l_cur := dbms_sql.open_cursor;
  dbms_sql.parse(l_cur,'select * from &tname '|| l_where_clause ||' '|| l_orderby_clause,dbms_sql.native);
  dbms_sql.describe_columns(l_cur,l_cnt,l_dtbl);
  for i in 1..l_cnt loop
    dbms_sql.define_column(l_cur,i,l_val,30);
  end loop;

  l_status := dbms_sql.execute(l_cur);

  while ( dbms_sql.fetch_rows(l_cur) > 0 ) loop
    dbms_output.put_line(lpad('=',80,'='));
    for i in 1..l_cnt loop
      dbms_sql.column_value(l_cur,i,l_val);
      dbms_output.put_line(rpad(l_dtbl(i).col_name,30) ||' --> '||l_val);
    end loop;
  end loop;
  dbms_sql.close_cursor(l_cur);
end;
/

Sample output:

SQL> @ /home/mshannon/other/scripts/database/vselect

Enter the table or view you wish to display vertically: dba_users

Enter the "WHERE" clause(s)...
- if there is no "WHERE" clause, press [Enter].
- do not include the word, "WHERE"; just specify syntax beyond "WHERE".
- do not use single quotes for literals; use double quotes (") to enclose literals.

=> username like "SY%"

Enter the "ORDER BY" clause...
- if there is no "ORDER BY" clause, press [Enter].
- do not include the words, "ORDER BY"; just specify syntax beyond "ORDER BY"
- do not use single quotes for literals; use double quotes (") to enclose literals.

=> username asc

...

================================================================================
USERNAME                       --> SYS
USER_ID                        --> 0
PASSWORD                       -->
ACCOUNT_STATUS                 --> OPEN
LOCK_DATE                      -->
EXPIRY_DATE                    --> 24-AUG-10
DEFAULT_TABLESPACE             --> SYSTEM
TEMPORARY_TABLESPACE           --> TEMP
CREATED                        --> 13-AUG-09
PROFILE                        --> DEFAULT
INITIAL_RSRC_CONSUMER_GROUP    --> SYS_GROUP
EXTERNAL_NAME                  -->
PASSWORD_VERSIONS              --> 10G 11G
EDITIONS_ENABLED               --> N
AUTHENTICATION_TYPE            --> PASSWORD
================================================================================
USERNAME                       --> SYSMAN
USER_ID                        --> 72
PASSWORD                       -->
ACCOUNT_STATUS                 --> OPEN
LOCK_DATE                      -->
EXPIRY_DATE                    --> 24-AUG-10
DEFAULT_TABLESPACE             --> SYSAUX
TEMPORARY_TABLESPACE           --> TEMP
CREATED                        --> 13-AUG-09
PROFILE                        --> DEFAULT
INITIAL_RSRC_CONSUMER_GROUP    --> DEFAULT_CONSUMER_GROUP
EXTERNAL_NAME                  -->
PASSWORD_VERSIONS              --> 10G 11G
EDITIONS_ENABLED               --> N
AUTHENTICATION_TYPE            --> PASSWORD
================================================================================
USERNAME                       --> SYSTEM
USER_ID                        --> 5
PASSWORD                       -->
ACCOUNT_STATUS                 --> OPEN
LOCK_DATE                      -->
EXPIRY_DATE                    --> 24-AUG-10
DEFAULT_TABLESPACE             --> SYSTEM
TEMPORARY_TABLESPACE           --> TEMP
CREATED                        --> 13-AUG-09
PROFILE                        --> DEFAULT
INITIAL_RSRC_CONSUMER_GROUP    --> SYS_GROUP
EXTERNAL_NAME                  -->
PASSWORD_VERSIONS              --> 10G 11G
EDITIONS_ENABLED               --> N
AUTHENTICATION_TYPE            --> PASSWORD

PL/SQL procedure successfully completed.

Wednesday, July 7, 2010

Mount ISO from Apple TV Command-Line-Interface CLI

hdiutil mount Australia.iso

/dev/disk3                                              /Volumes/AUSTRALIA

ls /Volumes/AUSTRALIA

AUDIO_TS        VIDEO_TS

hdiutil unmount /Volumes/AUSTRALIA

"disk3" unmounted successfully.