Nov 30

in emailurile encodate cu quoted-printable apare un caracter “space” care nu poate fi parsat nici de php nici de C#, acesta reprezinta codul “=C2=A0″ in bytes “C2 A0″.

UTF-8 il translateaza in 00A0.

ca sa scapam de acest caracter trebuie sa-l decodam folosind functia “quoted_printable_decode” si apoi sa eliminam sir de caractere “=C2=A0″ sau “\xC2\xA0″

mai multe informatii gasiti aici

Nov 30

How to dynamically create  in PHP a property for an object?

If the object  is $foo you use this syntax: $this->{$property} = ‘a value’;

For example:

<?php

class foo {

public function setProperty($n, $v)
{
   $this->{$n} = $v;
}

}

$foo = new foo();
$foo->setProperty('property1','value1');
echo $foo->property1; //will display value1
?>

Oct 3

in the google custom search results pagination will not keep the number of page just visited,
for example if you go to the page 3 and go back via browser button you will get results from the first page.

To keep visited page some custom modifications should be implemented:

step 1:
In the function searchCompleteCallback(), we need to add to all links parameter &page= with calculated page counter

ex:

if(back_page == '')
 back_page = 0;
else
 back_page = (back_page*10)-10;

with javascript append all links with this parameter.

…’&page=’+back_page;

step 2:

in the function google.setOnLoadCallback(function(){ set the parameter with google custeom search key,to use this application, and concatinate parameter with page number

var customSearchControl = new google.search.CustomSearchControl(‘gcs_customer_key’+'&start=’.$_GET['page']);

This will point the results from the google custom serach to the right page number.

Sep 5

Creates and returns a stream context with any options supplied.

It can be used to send and receive information to/from the server, instead of using PEAR’s webservice.

example you can find here and here

Sep 1

jqGrid is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web. Since the grid is a client-side solution loading data dynamically through Ajax callbacks, it can be integrated with any server-side technology, including PHP, ASP, Java Servlets, JSP, ColdFusion, and Perl.

jqGrid’s Home page can be found here

Jul 5

un plugin foarte bun de jQuery, care permite uploadarea multipla de fisiere doar cu drag and drop

sursa aici

Jun 1

Excel interpreteaza < br > ca fiind un rand now, ca sa evitam aceasta problema si sa adaugam o linie noua in celula in MS Excel trebuie adaugat un CSS pentru break

< style >
br {mso-data-placement:same-cell;}
< / style >

May 17

Internet Explorer gives lower level of trust to IFRAME pages (IE calls this “third-party” content). If the page inside the IFRAME doesn’t have a Privacy Policy, its cookies are blocked.

However if you add  a header like this (in PHP) it will work:

header(‘P3P:CP=”NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT”‘);

This sets a  P3P header with a privacy policy that is acceptable to IE, and the cookies will be accepted.

More info: here and here.

A tool for generating policy privacy can be downloaded here.

May 3

Exemple de generare categoriilor ierarhic din SQL

exemplu:

LOCK TABLE nested_category WRITE;

SELECT @myRight := rgt FROM nested_category
WHERE name = ‘TELEVISIONS’;

UPDATE nested_category SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE nested_category SET lft = lft + 2 WHERE lft > @myRight;

INSERT INTO nested_category(name, lft, rgt) VALUES(‘GAME CONSOLES’, @myRight + 1, @myRight + 2);

UNLOCK TABLES;

SELECT CONCAT( REPEAT(‘ ‘, COUNT(parent.name) – 1), node.name) AS name
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
GROUP BY node.name
ORDER BY node.lft;

+———————–+
| name |
+———————–+
| ELECTRONICS |
| -TELEVISIONS |
| – -TUBE |
| – -LCD |
| – -PLASMA |
| -PORTABLE ELECTRONICS |
| – -MP3 PLAYERS |
| – -FLASH |
| –CD PLAYERS |
| –2 WAY RADIOS |
+———————–+

Soursa: aici

Apr 26

TCPDF is an Open Source PHP class for generating PDF documents. It continues where FPDF stopped, and contains all its goodies plus support of UTF-8 Unicode and Right-To-Left languages! Especially the missing UTF-8 Unicode support in FPDF is a problem for everyone living outside the English language only countries.

* Go to www.tcpdf.org and download the latest version of TCPDF.

Main Features:

* no external libraries are required for the basic functions;
* all ISO page formats, custom page formats, custom margins and units of measure;
* UTF-8 Unicode and Right-To-Left languages;
* TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
* methods to publish some XHTML code, Javascript and Forms;
* images, graphic (geometric figures) and transformation methods;
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index – Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, QR-Code;
* Grayscale, RGB, CMYK, Spot Colors and Transparencies;
* automatic page header and footer management;
* document encryption and digital signature certifications;
* transactions to UNDO commands;
* PDF annotations, including links, text and file attachments;
* text rendering modes (fill, stroke and clipping);
* multiple columns mode;
* bookmarks and table of content;
* text hyphenation;
* automatic page break, line break and text alignments including justification;
* automatic page numbering and page groups;
* move and delete pages;
* page compression.

Check the default TCPDF Examples.

« Previous Entries

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