Jan 29

Screenshot of an Entire Page

Captured Using Page SaverPearl Crescent Page Saver is an extension for Mozilla Firefox that lets you capture images of web pages, including Flash content.

These images can be saved in PNG or JPEG format. Using Page Saver, you can capture an entire page or just the visible portion. You can control the image capture process via a wide variety of settings, including the image file name and scale (e.g., save at 50% of original size).

Source: here

Jan 29

HTML Regex Data Extractor

This extension is useful for those who want to test the regular expression on the live HTML content.
They can also use their custom content.

Usage :
- Press Alt-R to test with your custom content
- Press Ctrl-U or right-click and choose “View Page Source” to test with HTML source of current page
- When you are viewing the source code, to show/hide the Regular Expression Bar, on Toolbar, choose View -> RegexHTML

Source : here

Jan 26

How does it work?

Rather than creating a SWFUpload instance and assigning handlers directly, it associates the SWFUpload instance with an element in the DOM, and all events handlers are bound to that DOM element.

Live Examples

Here are some live examples you can pull apart. Although the UI is not pretty, it demonstrates how you listen to events, and from there you can create whatever UI you want.

Download source here

Jan 26

Editing Methods

Editing functionality is applied to selected page content through scripts that apply the document.execCommand() method. Parameters are passed to this method giving the edit command to apply. The general format for the execCommand() method is shown below. It is applied through the document object.

document.execCommand("command" [,0] [,"value"])
<button title="Bold"
  onclick="document.execCommand('Bold')">
  <img src="Bold.gif"/>
</button>

Editing Commands

All of the available editing commands are too numerous to list here. The following table gives a sampling of what types of editing can be applied to selected text a page.

Command Description

document.execCommand(“BackColor“,0,”color“)
Sets the background color of the selected element; color
is a color name or hexadecimal value.

document.execCommand(“Bold“)
Sets the current selection to bold style.

document.execCommand(“Copy“)
Copies the current selection to the clipboard.

document.execCommand(“CreateLink“)
Displays a dialogue box for entering a URL which is applied to the selected text.

document.execCommand(“Cut“)
Cuts the current selection to the clipboard.

document.execCommand(“Delete“)
Deletes the current selection.

document.execCommand(“FontName“,0,”name“)
Sets the font face of the current selection; name
is a font name.

document.execCommand(“FontSize“,0,”size“)
Sets the font size of the current selection; size
is an integer from 1 (smallest) to 7 (largest).

document.execCommand(“ForeColor“,0,”color“)
Sets the text (foreground) color of the selected element; color
is a color name or hexadecimal value.

document.execCommand(“Indent“)
Increases the indent of the selected text by one indentation increment.

document.execCommand(“InsertImage“,1)
Displays a dialogue box for selecting and positioning a graphic image.

document.execCommand(“InsertMarquee“)
Inserts an empty marquee for entering displayed text.

document.execCommand(“InsertOrderedList“)
Formats an ordered list of current selection.

document.execCommand(“InsertUnorderedList“)
Formats an unordered list of current selection.

document.execCommand(“Italic“)
Sets the current selection to italic style.

document.execCommand(“JustifyCenter“)
Centers the text block in which the current selection is located.

document.execCommand(“JustifyFull“)
Justifies the text block in which the current selection is located.

document.execCommand(“JustifyLeft“)
Left justifies the text block in which the current selection is located.

document.execCommand(“JustifyRight“)
Right justifies the text block in which the current selection is located.

document.execCommand(“Outdent“)
Decreases the indent of the selected text by one indentation increment.

document.execCommand(“Paste“)
Pastes the current clipboard contents to current selection.

document.execCommand(“Print“)
Opens the print dialog box so the user can print the current page.

document.execCommand(“RemoveFormat“)
Removes all formatting from current selection.

document.execCommand(“SelectAll“)
Selects the entire document.

document.execCommand(“StrikeThrough“)
Sets the current selection to strike-through style.

document.execCommand(“Subscript“)
Sets the current selection to subscript style.

document.execCommand(“Superscript“)
Sets the current selection to superscript style.

document.execCommand(“Underline“)
Sets the current selection to underline style.

document.execCommand(“Unlink“)
Removes any hyperlink from the current selection.

document.execCommand(“Unselect“)
Clears the current selection.
Jan 26

The line-layering technique uses no images and no javascript, only display: block bold tags layered on top of each other. We simply create lines with decreasing side margins, stick them on top of each other and we have a well-emulated round corner.

.b1f, .b2f, .b3f, .b4f{font-size:1px; overflow:hidden; display:block;}
.b1f {height:1px; background:#ddd; margin:0 5px;}
.b2f {height:1px; background:#ddd; margin:0 3px;}
.b3f {height:1px; background:#ddd; margin:0 2px;}
.b4f {height:2px; background:#ddd; margin:0 1px;}
.contentf {background: #ddd;}
.contentf div {margin-left: 5px;}


<b class="b1f"></b><b class="b2f"></b><b class="b3f"></b><b class="b4f"></b>
    <div class="contentf">

        <div>Round FILL!!</div>
    </div>
<b class="b4f"></b><b class="b3f"></b><b class="b2f"></b><b class="b1f"></b>

Din cauza framework-ului wordpress se injecteaza tag-urile HTML in editor, de acea nu pot sa afisez corect exemple, le puteti vedea [ aici ]

Round Border!!

Jan 13

La un moment dat am avut nevoie de a accesa un serviciu ssl din php folosind cURL. NU intentionam sa folosesc cURL, dar asta folosea PEAR : SOAP. Dupa mai mutle incercari, gaseam eroarea de ssl, de certificat invalid.

Rezolvarea e una simpla : Dezactivam din cURL verificarea PEER (CURLOPT_SSL_VERIFYPEER), insa nu e elegant.
Metoda eleganta presupune insa, salvarea certificatului si trimiterea lui in requestul cURL.

Trimiterea se face astfel :

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, 'fisierul in care se tine certificatul salvat in format PEM');

Fisierul trebuie sa fie salvat in format X.509 Certificate (PEM). Asta se paote face din browser, la view certificate/export.

Ce facem insa cand aplicatia ruleaza si se depaseste expire date ?
Folosind functiile php stream, putem accesa certificatul. Cu ajutorul extensiei openssl il putem salva.


$url = 'url'; //url-ul care necesita certificatul ,fara protocol.
$context = stream_context_create();
$res = stream_context_set_option($context, 'ssl', 'capture_peer_cert', true);
$res = stream_context_set_option($context, 'ssl', 'verify_host', true);
if ($socket = stream_socket_client("tls://$url:443/", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context))
{
    if ($options = stream_context_get_options($context))
    {
      if ( isset ($options['ssl']) && isset ($options['ssl']['peer_certificate']))
      {
        $keyinfo = openssl_x509_export_to_file($options['ssl']['peer_certificate'], 'file to save to');
      }
    }
}

Data de expirare a certificatului curent se poate lua astfel :

$keyinfo = openssl_x509_parse(file_get_contents($filename));
var_dump($keyinfo['validTo']);

Data este in format YYMMDDHHMMSS.

Spor la conectare SSL.

Powered By Wordpress - Theme Provided By Wordpress Theme - Credit Loan