What would be better in Opera !

Subscribe to RSS feed

Sticky post

What would really be better in Opera

Here is a list of things that I don't find appropriate for Opera :

Right-click on a not found image
Cannot right-click to get properties or to try to reload the image.

Trouble with the address bar
I have troubles as I'm trying to reach localhost:8080 while I'm developing. Sometimes, I'm redirected to google, sometimes, I get the Opera error : "This address type is unknown or unsupported" (this is a translation). That's really annoying and that kind of strange behavior (with the address bar) decided me, a few years ago, to change from Firefox to Opera. I think I'll do the reverse process in a short while ...

Trouble with the address bar 2
I configured my local server in a way it serves a page if the address is 'http://localhost:8080/page' and lists the content of a folder if the address is the same plus a trailing slash (http://localhost:8080/page/'). Opera always takes me to the folder ; I can't reach the page ; that's really too much !

Unsuccessful reload of local pages
Recently, I also encountered a weird trouble : couldn't force the reloading of a local file (localhost:8080/test.css).
Opera kept an old version of the file whereas it worked fine under FF.

Printing under Linux
As mentioned in another post, when I print something using a Xerox networ printer (if this could help) , it's printed twice.

Ctrl+back
Please give me back the old-fashioned ctrl+back shortcut in the address bar (deleting both text and preceding-slash and not stopping before dashes or dots).

Javascript history
Please authorize the history.back() method at least, as a <a> link.

Menu tree for XML browsing
Please add a menu tree to display/hide nodes of XML documents like Opera or Chrome.

Opera blog : update dates
I wish creation AND last update date could be displayed in posts and I also wish I could choose to put or not the last modified post on top of my blog (for major updates) or keep it at its original place. For example, when I add an item in the present post, I think the latter should be placed on top of my blog.

Search within a page
I don't like the dark background (it reminds me the javascript alert) and I don't want a bigger highlight zone than the selected text either because it sometimes masks the surrounding text.

Scrolling inside a textarea
While reaching the edge, the scrolling stops instead of scrolling the parent element.

Opera blog : cannot line break !
If I write "<a>" (with real chevrons, not with html entities) in a post ; I cannot break the line in the rest of the post ...

Opera bug with first letter and javascript

, , ,

Try the following code ; when the first-letter css pseudo-class is used, updating the text node does not update the first letter.
<html>
  <head>
  <style>
  p:first-letter{
    color:red;
    font-size:50px;
  }
  </style>
  </head>
  <body>
  <p id="p">L'image bleue.</p>
  <button onclick="document.getElementById('p').firstChild.nodeValue='The blue image.';return false;">Write "The blue image." using nodes</button>
  <button onclick="document.getElementById('p').innerHTML='The blue image.';return false;">Write "The blue image." using innerHtml</button>
  </body>
</html>

Printing with Opera under Linux

, , ,

I use a Xerox network printing but when I print something, it is always printed twice even though only one copy is asked !

PHP script to sync srt subtitles

, , , ...

#!/usr/bin/php
<?php
  // OPENSOURCED BY METRALLIK
  if($argc>1 && !is_file($argv[1])) exit("$argv[1] is not a file\n");
  if($argc==3){
    echo "INPUT FILE  : $argv[1]\n";
    $d=$argv[2];
    echo "DELAY       : $d\n";
    $f=$argv[1].'.delayed_'.$argv[2].'.yb';
    file_put_contents($f,preg_replace_callback('#(\d+:\d+:\d+,\d+) --> (\d+:\d+:\d+,\d+)#sim','delay',file_get_contents($argv[1])));
    echo "OUTPUT FILE : $f\n";
  }
  elseif($argc==6){
    echo "INPUT FILE  : $argv[1]\n";
    $o1=strToMs($argv[3]);
    $o2=strToMs($argv[2]);
    $r=(strToMs($argv[4])-$o2)/(strToMs($argv[5])-$o1);
    echo "RATIO       : $r\n";
    $f=$argv[1].'.sync_'.$o1.'_'.$o2.'_'.$r.'.yb';
    file_put_contents($f,preg_replace_callback('#(\d+:\d+:\d+,\d+) --> (\d+:\d+:\d+,\d+)#sim','sync',file_get_contents($argv[1])));
    echo "OUTPUT FILE : $f\n";
  }
  else{
    echo <<<HELP
  Just delay :
    > sync.php file.srt sub_delay_in_ms
  Resync (date format : 01:23:45,678 ; leading zeros are not mandatory) :
    > sync.php file.srt time_A_in_movie time_A_in_srt time_B_in_movie time_B_in_srt\n
HELP;
  }
  function sync($m){
    global $o1,$r,$o2;
    return msToStr(round((strToMs($m[1])-$o1)*$r)+$o2).' --> '.msToStr(round((strToMs($m[2])-$o1)*$r)+$o2);
  }
  function delay($m){
    global $d;
    return msToStr(strToMs($m[1])+$d).' --> '.msToStr(strToMs($m[2])+$d);
  }
  function strToMs($s){
    preg_match('#^(\d+):(\d+):(\d+),(\d+)$#Usi',$s,$m);
    return $m[4]+1000*$m[3]+60*1000*$m[2]+3600*1000*$m[1];
  }
  function msToStr($t){
    $nbH=floor($t/3600000);
    $nbM=floor(($t-3600000*$nbH)/60000);
    $nbS=floor(($t-3600000*$nbH-60000*$nbM)/1000);
    $nbMs=$t-3600000*$nbH-60000*$nbM-1000*$nbS;
    return sprintf("%02d:%02d:%02d,%03d",$nbH,$nbM,$nbS,$nbMs);
  }

PHP FTP advanced synchronization system (v2.5)

, , ,

ybvs_2.6.7z
Nov, 5th 2011
  1. Install PHP
    - On Linux : use your package manager
    - On Windows : download php binaries
  2. Create an empty folder
  3. Open a console
  4. cd to the created folder
  5. Launch ybvs.php without any argument : [/path/to/php[.exe]] /path/to/ybvs.php
  6. Help is displayed : learn to create a config file and the commands


You may also refer to this previous post for further information.

PHP FTP or local versioning and synchronization system

, , ,

A new version has come ! Some pieces of information in this post might be incorrect.

I use both Linux and Windows and I need to code from different workstations.
I decided to create a simple synch system.
If you have any question ; post a comment, I will be glad to help you.

This current version only works over FTP ; another version (see at end of this post) has been developed to work with local directories or any php wrapper. Be careful, configuration variables may be different in that version.

ybvs_2.4.7z

FEATURES
  • uses a repository (stores info about released files) to compare local and remote working areas
  • can ignore files in get mode, in submit mode or in both modes
  • stores old files and allows diff with them
  • like any revision control system : get, submit, diff


COMMANDS
  • info : prints some info
  • get : get non-ignored files from the server
  • get directory : only gets the directory from the server
  • get file : only gets a file
  • submit : submit creations, modifications and deletions to server (unchanged files are ignored)
  • submit directory : only submit changes in that directory
  • submit file : only submit file
  • rmdir dir : to remove an empty dir from the server
  • diff : prints differences between local working area and the server
  • diff file : prints the differences (line to line) between local and remote versions
  • diff file1 vs file2 : prints the differences between two files
  • diff file loc|rem|all [[-]n] : prints diff between older versions (not implemented yet)
  • clean : not implemented (see and remove all files that are not in the repository)


INSTALL
Unzip the source.
Create a folder that will be your working area.
Open a console, cd to there. Execute "[php.exe] ../ybvs.php" (Windows ; for linux, make ybvs.php executable).
Help is displayed, create a .ybvs.cfg.php file here with advices from help.
Don't forget to place the '<?php' tag at the beginning of this file.
<?php
  // SAMPLE FILE
  $cFtpServer='ftp.serv.fr';
  $cFtpUser='username';
  //$cFtpPass='pass';
  $cIgnore=array('#^\.ybvs#');
  //$cIgnoreGet=array(...);
  //$cIgnoreSubmit=array(...);
?>

Don't worry, if your file is not compliant, an error will be triggered. The ugly error is when there is no configuration file !
Fill .ybvs.cfg.php with your info ($cFtpServer="ftp.serv.fr").
Generally, $cFtpDir will be "www" or "public_html" ('.' assumed if undefined).

NOTE : if no argument, help will be displayed.


TEST IT
Execute "ybvs.php get" in order to get the files from the server.
The first time you do it, you will get all the files (except those filtered through $cIgnore or $cIgnoreGet).

Try to modify a local file and then perform a get again.
You will be told that a local file is newer than its version on the server.
You will be pleased to perform a diff to see what are the differences and you can perform a get on this file if you want to override the local changes and replace this file by its original version from the server.

NOTE : when you are prompted, just type 'y' and enter for yes and anything else for no.

"ybvs.php diff my_file" : to compare local and remote files (my_file is the path on the server, considering $cFtpDir as .)
"ybvs.php get my_file" : to force the download of an older remote file (a copy of the local file will be placed in $cHistDir).

NOTE : don't panic : all the replaced files consecutive to a targeted get will be saved in $cHistDir.

Now redo a "ybvs.php get" and observe that your working area ($cLocalDir) is up to date!

Now modify a local file again and perform "ybvs.php submit".
You can save a copy of the file you are about to replace.

You can also try to perform a get (your working area is up to date) or a submit again : there are no files to submit.

Submit on a targeted file is not implemented yet but you will be prompted for each modified file during the submitting process.

You can remove empty remote directories thanks to ../ybvs.php rmdir myDir

NOTE : use $cIgnore to ingore platform specific files and folders such as .htacces.
NOTE : you can diff on $cIgnore-filtered files.
TODO :
- mysql database schema comparison
- ability to put website in a "maintenance state" during submission

WRAPPER VERSION
I tried to use wrappers (ftp://user:pass@ftp.serveur.fr/) but it was unsuccessful because one of my testing server was turning in ASCII mode and I couldn't get it to work (even with ;type=i).
The main benefit is that you can use that script in local (without any ftp connection) and of course in with an FTP server because it seems to be working with some.

Updated on Sept, 1st 2011
ybvs_1.2.zip

How to clean Windows winsxs

, , ,

Guess the language !
OPENSOURCED BY METRALLIK : http://my.opera.com/metrallik/blog/
Won't work with every file.
TODO : if backup enabled, only copy file (and create destination directory) if file successfully deleted
TODO : remove empty directories in winsxs
TODO : if backup, only copy if destination file does not exist
$user='Metrallik';
$min_size=100000;
$ext=array('png','txt','zip','rar','7z','txt','htm','html','xml','ppd','cat','avi','wma','mp3','mov','wmv','mpeg','ogg','ogv','mkv','chm','js','jpg','jpeg','bmp','gpd','ps','df','psd');
$max_date=time()-(3600*24*30*23);
$backup=true;
$floppy='d';
$dirs=array('c:\Windows\winsxs');

echo "OPENSOURCED BY METRALLIK : http://my.opera.com/metrallik/blog/\n";

while(current($dirs)){
  foreach(glob(current($dirs).DIRECTORY_SEPARATOR.'*',GLOB_NOSORT) as $d){
    if(is_dir($d)) array_push($dirs,$d);
    elseif((in_array(strtolower(substr(strrchr($d,'.'),1)),$ext) || filesize($d)>$min_size) && fileatime($d)<$max_date && file_exists($d)){
      echo $d,"\n";
      echo exec("takeown /f \"$d\""),"\n";
      echo exec("icacls \"$d\" /grant $user:F /t"),"\n";
      if($backup){
        if(!is_dir(dirname($floppy.substr($d,1)))) mkdir(dirname($floppy.substr($d,1)),null,true);
        echo copy($d,$floppy.substr($d,1)),"\n";
      }
      echo unlink($d),"\n";
      sleep(2);
    }
  }
  next($dirs);
}

La Duchesse - Lucien Bodard

, , , ...

Titre : La Duchesse

Auteur : Lucien Bodard

476 pages.

Paru en 1979.

Lucien Bodard ressucite dans La Duchesse l'Asie du début du siècle et nous plonge dans un univers foisonnant au-delà de l'imaginable. Le sang, la cruauté, la folie meurtrière, les massacres, la traîtrise y vont du même flot que l'érotisme sauvage d'une sensualité crue.

Roman d'amour et roman d'aventure aux innombrables et surprenants personnages, fresque historique et réquisitoire contre le colonialisme avide. Mais c'est l'ampleur, la formidable luxuriance de l'évocation qui emportent d'abord le lecteur, sans qu'il ait le temps de se poser des questions. Il ne lui reste qu'une certitude : la virtuosité d'un romancier visionnaire, plus que jamais sans pareil et fabuleux conteur.

Memory leak on Opera while using string

, , , ...

This little javascript error causes an Opera memory leak without error.
      var res='';
      for (sItem in r.results) { 
        res+=res+sItem.term;
      }

Form and button with Opera

, , , ...

In a previous version of Opera, the following HTML code will throw the button assigned action when pressing Enter instead of sending the form.
Now, the button's action is first done then, the form is sent.
The behavior does not seem appropriate either : the button has nothing to do with actions performed neither on the input field nor on the form.

<form action="http://wwww.opera.com" method="post">
	<input type="text" name="name" />
	<button onclick="alert('clicked')">Click me !</button>
	<input type="submit" />
</form>