Salı, Aralık 25, 2012

Dumping Rtmp streams

I have seen some posts on net about dumping rtmp streams. Usually  you need to record the traffic between you and the web page offering rtmp stream to find out the location of mp4 file and other things.
Here is a command line foo

rtmpdump -r "rtmp://server.hostname.app" -a "application" -y mp4:031cef05aa114ejr48krui846960d79a.mp4 -W http://pathtoplayer/xxxplayer.commercial.swf -f "WIN 11,5,502,135" -p http://web.site.referring -o output.mp4

Cumartesi, Aralık 08, 2012

FFMpeg Tips

MP4 to Mpeg2 For DVD conversion
video mpeg2  audio ac3

ffmpeg -i file.mp4 -vcodec mpeg2video -acodec ac3  -aspect 16:9 -target pal-dvd out.mpg

WMV to MP4 conversion
video x264 audio mp3
ffmpeg -i file.wmv  -vcodec libx264 -acodec libmp3lame out.mp4
video x264 audio vorbis
ffmpeg -i file.wmv  -vcodec libx264 -acodec libvorbis out.mp4

ffmpeg -codecs 
shows the codecs supported form en/decoding.





Çarşamba, Kasım 21, 2012

PXEing with iPXE,SmartOS,OpenBSD

Today I needed to install SmartOS and OpenBSD onto an old server whose dvdrom is not working. Because dvdrom is not working, I didnt have much options to install an iso then pxe booting. According to instructions on this site, I set up an ubuntu tftp and pxe server and managed to start live version of SmartOS on that server. But I realised after that I cant install SmartOS that way. It was just for booting as far as I understood. So I changed my way  and installed OpenBSD by pxeing. OpenBSD is installed with using file sets on remote ftp sites. Actually I made a local http server to broadcast those sets but because of ethernet problems on that old server, I couldnt manage to connect to local http server. They were some strange ethernet problems. But at last I managed to connect to a remote ftp server and loaded these sets smoothly.
I learned that iPXE is a powerfull opensource pxe program by this journey.

Salı, Ekim 16, 2012

Strange network share problem resolved

For some time I had a problem with a Windows 7 Home Premium computer when accessing to lan network shares. I was getting "0x80070035 network path was not found" or "0x80004005 unspecified error" messages while trying to access network shares on the same workgroup. I have made some research on web suggesting various solutions. It may be a firewall issue, or an issue about credential(s) manager. But lastly one other suggestion solved my issue. My problem was not those and it was about the missing feature "Client for Microsoft Networks" of my network card . Installing that feature resolved the issue.

Swf object z-index problem

When you have a swf object in your web page, some css menus, or other items might become hidden under the swf object. To solve this you might use the "transparent" attribute of the swf object's wmode property like this


         
         

refer to  this  .

Renumbering id field of a database table

For a database I needed to renumber the existing id fields. Without using any auxiliary scripting language, here is a way to do it in mysql: say you want to number the id field begining from index 1000,
set @count=999;
update table set id=@count:=@count+1;
as described in this page.

Perşembe, Eylül 27, 2012

Merge Ps,Pdf Files and A4 into A5

I was trying to print man pages of OpenBSD. They were in .ps format and the paper size was a4. I wanted to convert the man pages so that two a5 pages lie onto an a4 page for the sake of being printer/environment friendly. I also want to combine them as a single document.
Here are the commands

1) Making OpenBSD man file a .ps file
mandoc -Tps /usr/share/man/man4/route.4 > route.ps

2)Converting 2 a4 pages into 2 a5 pages on a single a4 page
psnup -2 -Pa4 -pa4 input.ps output.ps
 This command converts 2 a4 pages into a5 ones and put them o a single a4 page. Magic isnt it?

3) Convert .ps files to
pdf ps2pdf input.ps output.pdf

4) Combine .pdf files
pdftk file1.pdf file2.pdf cat output outfile.pdf

There is also a psmerge command. But it gave me some errors. So I chose converting them into pdf and then combining way.

Ps: Here is a command for making 2 pages of a pdf file into one page:
The package is called pdjam in Ubuntu
pdfnup --nup 2x1 --outfile output.pdf  input.pdf

This makes a lot of economy

Cumartesi, Mayıs 26, 2012

Php 5.1.6 json_encode

I was using Spiros Kabasakalis great ajax crud gii template for Yii on a server where PHP is of version 5.1.6. It was giving an error when one creates a new record. Some digging showed that it is because the 5.1.6 version does not include json library which is used in the template code. I installed the json library usein pecl, included ir in php.ini and voila.
Meanwhile I have heard o another library upgradephp which gives PHP 5.3/5.4 special properties to earlier versions of PHP. Now its time to enjoy Kabasakalis' library.

Salı, Mayıs 22, 2012

Python mechanize, beautiful soup and html scraping

I used to have bash,sed,awk,curl,beautifiul  soup  when I was doing html parsing,scraping and automating tasks. I was aware of mechanize but was not using it. Today I decided to give it a try for an automation task and I didnt regret. It was a real fun(!) learning(!) it. Actually I learned a bit of it. It helped me a lot on automating browser requests. Although I didnt yet use it for form handling, I know it has some magical power there too. I also realised that one must use Beautiful Soup with Mechanize. These make an awesome combo worth trying and using. Thanks to all the folks behind them.
here is a snippet
br = mechanize.Browser()

br.open("http://www.site.com")
all_links=[l for l in br.links(url_regex="pattern")]
for i in all_links[5:]:


br.follow_link(i)
temp=br.response().read()
soup=BeautifulSoup(temp)                                                                                                  
link=soup.find('a', href=re.compile("mp3"))   #title\/tt[0-9]*\/"))
if hasattr(link, "href"):
    lin=link['href']
    file=lin.split("/")[-1]
    print file+"----"+lin
    br.retrieve(lin,file)

Here are some helper links
http://stockrt.github.com/p/emulating-a-browser-in-python-with-mechanize/
http://stockrt.github.com/p/handling-html-forms-with-python-mechanize-and-BeautifulSoup/

Çarşamba, Mart 14, 2012

A Windows Vista tip

I was looking for a solution to a windows vista machine which dont login to a profile. Namely the profile was corrupt and the administrator account was not showing up when then system is started in safe mode. I tried some  suggestions by people on the internet. One of them stated that the administrator account in Vista is hidden to reveal it one needs to write this into a elevated command prompt
net user administrator /active:yes
Lets see if this helps to start this machine.

Salı, Mart 13, 2012

Jquery regex selectors

I needed to find some dom elements which have a regex class names in jquery.
Jquery is really awesome and people made some precious contributions to it.
One of them is James Padolsey's regex selector which is found here. It fit my needs
and I used it like this

$('a:regex(class,sometext[0-9]*)').each(function(){
grup="'"+$(this).attr('class').split(' ')[0]+"'" ;
$(this).colorbox({rel:grup});
});
in binding colorbox to newly inserted items to the page by infinite scroll.
All these bold words are names of great jqeury extensions which I have made use of on a page
together with another awesome extension masonry. Extensions, extensions,extensions thats the way
we build web pages nowadays.