Skip to content

mpgtx: MPEG splitting made easy

Considering ffmpeg for mpeg cutting/splitting… too complex i think for such a simple task.

mpgtx.sourceforge.net is the way to go if are looking for simple operations like cutting/joining mpeg files.

Tool Summary :

This simple command(from a ruby script I wrote) will cut the full length videos into count_chunks pieces and store them under directory_writable, where count_chunks and directory_writable are both variables
[code]

Open3.popen3("/bin/mpgtx -#{count_chunks} #{_file_to_process} -f -b #{directory_variable}/#{game.file_path.gsub('.mpg','')} 2>> #{directory_variable}/split.log")

[/code]

  • Share/Bookmark

RAILS_ROOT

RAILS_ROOT gives you relative path within the applications it works fine as far as you need the path within rails application.

How about getting absolute path to rails folder?

I found one way, and thats from the ENV hash.

You can use ENV['PWD'] to find absolute path to the rails folder.
Any other ways ??

*Update 4th Oct 2007*

Dir.pwd is a better way

  • Share/Bookmark

Ruby: Can’t modify frozen string

Workaround:

_use_me = frozen_string.dup

  • Share/Bookmark

Rails RJS redirect

page.redirect_to :action => ‘thanks’, :p1 => @g_resp.params["_code"], :p2 => @r_id

  • Share/Bookmark

Form tag & Extra Vertical Space Problem

Fix:
form style=”margin-top: 0px;margin-bottom: 0px;”

  • Share/Bookmark

Tips & Tricks

Mysql Getting Random Row: “order by rand()”

  • Share/Bookmark

textbox image alignment problem

Problem:
[code]
text_field(:member, :dob,:size=>"20", :maxlength => "50",:tabindex=>"22") img_tag
[/code]
Fix:
[code]
text_field(:member, :dob,:size=>"20", :maxlength => "50",:tabindex=>"22") img_tag {:style="position:absolute"}
[/code]

  • Share/Bookmark

Windows Media Player Events

Value     State     Description
0     Undefined         Windows Media Player is in an undefined state.
1     Stopped            Playback of the current media item is stopped.
2     Paused             Playback of the current media item is paused. When a media item is                                                       paused, resuming playback begins from the same location.
3     Playing                 The current media item is playing.
4     ScanForward         The current media item is fast forwarding.
5     ScanReverse         The current media item is fast rewinding.
6     Buffering                 The current media item is getting additional data from the server.
7     Waiting                 Connection is established, but the server is not sending data. Waiting for session to begin.
8     MediaEnded     Media item has completed playback.
9     Transitioning     Preparing new media item.
10     Ready             Ready to begin playing.
11     Reconnecting     Reconnecting to stream.

Remarks

Windows Media Player states are not guaranteed to occur in any particular order. Furthermore, not every state necessarily occurs during a sequence of events. You should not write code that relies upon state order.

Example Code

The following JScript code shows the use of the player.playState property. An HTML text element, named “myText”, displays the current status. The Player object was created with ID = “Player”.

// Test whether Windows Media Player is in the playing state.
if (3 == Player.playState)
myText.value = “Windows Media Player is playing!”;
else
myText.value = “Windows Media Player is NOT playing!”;

  • Share/Bookmark

Multiple Gtalk instances

This is how you can run multiple instances of Google talk
c:\> googletalk.exe /nomutex

pretty straight huh !

  • Share/Bookmark

PHP / Windows Task scheduling from command prompt

schtasks /create /tn “My Scheduled Jobs” /tr “php-win.exe D:\Program Files\xampp\htdocs\somefile.php” /sc minute

make sure that php-win.exe is in path while giving this command

  • Share/Bookmark