13 Aralık 2009 Pazar

jQuery Custom Selector Creation Template

$.expr[':'].test = function(obj, index, meta, stack){
   
// obj - is a current DOM element
   
// index - the current loop index in stack
   
// meta - meta data about your selector
   
// stack - stack of all elements to loop
   
   
// Return true to include current element
   
// Return false to explude current element
};

// Usage:
$
('.someClasses:test').doSomething();

Let’s now create a very simple custom selector using the template above. Let’s say we want a custom jQuery selector that will return elements with nonempty rel attribute.

$.expr[':'].withRel = function(obj){
 
var $this = $(obj);
 
return ($this.attr('rel') != '');
};

// Usage:
$
('a:withRel').css('background-color', 'yellow');
Blogged with the Flock Browser

External links custom jQuery selector code

// Creating custom :external selector
$
.expr[':'].external = function(obj){
   
return !obj.href.match(/^mailto\:/)
           
&& (obj.hostname != location.hostname);
};

// Add 'external' CSS class to all external links
$
('a:external').addClass('external');

Blogged with the Flock Browser

01 Eylül 2009 Salı

PDF'i otomatik pilota bağlamak! - ALTI ÜSTÜ TASARIM – Mehmet Doğan


"İyi yazılımcı, tembel yazılımcıdır". Bunu ilk defa, eski çalıştığım yerde, yeteneği inanılmaz sınırlara uzanan bir yazılımcıdan işitmiştim. Anlamı şu: bir yazılımcıya, en fazla ayni rutin işlemi iki kez yaptırabilirisiniz. Üçüncü defa, yazılımcı bir yolunu bulup, isi otomasyon haline getirecek bir yol bulup, kendi beynini kullanmak yerine, bilgisayarının işlemcisini kullanmayı tercih edecektir.

Kısa bir zaman önce, böyle bir yazılımcı ve/veya işlemci gücü aranmaya başladım. Çünkü elimde bir PDF şablon, 300 kişinin ismi ve soyad ve bunlardan üretmem gereken 300 tane PDF dosyası duruyordu. Normal işlem, PDF şablon açılır, teker teker isimler kopyalanıp, yapıştırılır ve üretilen PDF dosyası saklanır. Ben, iyi bir yazılımcı değilim. Hatta yazılımcı bile değilim ama tembellim :-) Bu nedenle, bu proje için otomasyon yolu buldum ve belki günün birinde size de lazım olur diye paylaşayım dedim.

Diyelim ki elinizde bir PDF şablonunuz (örneğin yemek, parti, doğum günü davetisiyesinden oluşmuş bir PDF dosyası) ve bir dolu isim ve emailden oluşan bir Excel dosyanız var.

Öncellikle Excel dosyanızı, tekst dosyası olarak yeniden kayıt edin (örneğin veri.txt) ve aşağıda görülen bir veri dosyası oluşturun:

isim    soyad

Ali    Veli

Mehmet    Saricizmeli


Daha sonra, PDF şablonunuzu açın ve yukarıdaki verilerin görünmesi gereken yerlere PDF Form araçları sayesinde Textbox oluşturun. Textbox'in ismi ile veri dosyanızdaki sütun başlıklarının uyuşmasına dikkat edin.


Textbox ile süslediğiniz bu yeni PDF şablonu veri dosyası (veri.txt) ile aynı klasör içine saklayın ve daha sonra Adobe Acrobat içinde şablonunuz açıkken Ctrl+J'ye basıp, Acrobat Console'u ekrana çağırın ve aşağıda gördüğünüz JavaScript'i kopyalayıp, yapıştırın.


var targetDirectory ="/C/Temp/Sonuc/";
var re = /\.pdf$/i;
var filename = this.documentFileName.replace(re,"");
var i = 0, retn = 0;
while( retn == 0 ) {
retn = this.importTextData("veri.txt", i);
var f = this.getField("soyad");
if ( retn == 0 ) {
try {
this.extractPages({
nStart: 0,
cPath: targetDirectory + f.value + ".pdf"
});
} catch (e) { console.println("Aborted: " + e) }
i++;
}
}

Hepsi bu kadar! Ctrl+A'ya basıp, bütün kodu secili hale getirip, Ctrl+Enter'a basın. Voila! 300 tane PDF dosyası, isim ve email adresleri gereken yerlere yazılmış şekilde sizi bekliyor.

Yukarıda kod içinde değiştirebileceğiniz kısımlar:

var targetDirectory kısmı, bu scripte, üretilecek PDF dosyalarının saklanacağı dizini tanımlıyor. this.importTextData("veri.txt", i); ise veri dosyanızı ismini taşıyor. this.getField("soyad"); kısmı ise, bu dosyaların nasıl isimlendirileceğini tanımlıyor. Verdiğimiz örnek içinde, üretilen dosyalar, veri dosyanız içinde bulunan "soyad" sütunundaki verileri kullanarak isim verecek, örneğin "Veli.pdf".


Umarım günün birinde, bu scriptin size de yardımı dokunur.


PDF'i otomatik pilota bağlamak! - ALTI ÜSTÜ TASARIM – Mehmet Doğan
Blogged with the Flock Browser

31 Ağustos 2009 Pazartesi

işinizi kolaylaştıracak ücretsiz 5 arşivleme aracı | bildirgec.org

4 - bir resmin içine zipli dosya gizlemek

bu olay gerçekten çok güzel ve bazen de oldukça kullanışlı olabilecek bir yöntem. resmi ya da fotoyu normal açtığınızda her şey normal, fakat resmi rar programıyla birlikte açınca gizli dosya ortaya çıkıyor. kolay anlaşılır videosu. yazılı olarak da şurada bulabilirsiniz.
işinizi kolaylaştıracak ücretsiz 5 arşivleme aracı | bildirgec.org
Blogged with the Flock Browser

16 Eylül 2008 Salı

CSS - CSS Reset Çeşitleri

Minimalistic Reset — Version 1


*
{
padding: 0;
margin: 0;
}


Minimalistic Reset — Version 2


*
{
padding: 0;
margin: 0;
border: 0;
}


Minimalistic Reset — Version 3


*
{
outline: 0;
padding: 0;
margin: 0;
border: 0;
}


Condensed Universal Reset


*
{
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: 0 none;
outline: 0;
padding: 0;
margin: 0;
}


Poor Man’s Reset


html, body
{
padding: 0;
margin: 0;
}

html
{
font-size: 1em;
}

body
{
font-size: 100%;
}

a img, :link img, :visited img
{
border: 0;
}


Siolon’s Global Reset


*
{
vertical-align: baseline;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: none;
padding: 0;
margin: 0;
}

body
{
padding: 5px;
}

h1, h2, h3, h4, h5, h6, p, pre, blockquote, form, ul, ol, dl
{
margin: 20px 0;
}

li, dd, blockquote
{
margin-left: 40px;
}

table
{
border-collapse: collapse;
border-spacing: 0;
}


Shaun Inman’s Global Reset


body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre,
form, fieldset, input, p, blockquote, table, th, td, embed, object
{
padding: 0;
margin: 0;
}

table
{
border-collapse: collapse;
border-spacing: 0;
}

fieldset, img, abbr
{
border: 0;
}

address, caption, cite, code, dfn, em,
h1, h2, h3, h4, h5, h6, strong, th, var
{
font-weight: normal;
font-style: normal;
}

ul
{
list-style: none;
}

caption, th
{
text-align: left;
}

h1, h2, h3, h4, h5, h6
{
font-size: 1.0em;
}

q:before, q:after
{
content: '';
}

a, ins
{
text-decoration: none;
}


Yahoo CSS Reset


body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td
{
padding: 0;
margin: 0;
}

table
{
border-collapse: collapse;
border-spacing: 0;
}

fieldset,img
{
border: 0;
}

address,caption,cite,code,dfn,em,strong,th,var
{
font-weight: normal;
font-style: normal;
}

ol,ul
{
list-style: none;
}

caption,th
{
text-align: left;
}

h1,h2,h3,h4,h5,h6
{
font-weight: normal;
font-size: 100%;
}

q:before,q:after
{
content:'';
}

abbr,acronym
{ border: 0;
}


Eric Meyer’s CSS Reset


html, body, div, span, applet, object, iframe, table, caption, tbody, tfoot, thead, tr, th, td,
del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
dl, dt, dd, ol, ul, li, fieldset, form, label, legend
{
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
outline: 0;
padding: 0;
margin: 0;
border: 0;
}

/* remember to define focus styles! */
:focus
{
outline: 0;
}

body
{
background: white;
line-height: 1;
color: black;
}

ol, ul
{
list-style: none;
}

/* tables still need cellspacing="0" in the markup */
table
{
border-collapse: separate;
border-spacing: 0;
}

caption, th, td
{
font-weight: normal;
text-align: left;
}

/* remove possible quote marks (") from <q> & <blockquote> */
blockquote:before, blockquote:after, q:before, q:after
{
content: "";
}

blockquote, q
{
quotes: "" "";
}


Condensed Meyer Reset


body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,
pre, form, fieldset, input, textarea, p, blockquote, th, td
{
padding: 0;
margin: 0;
}

fieldset, img
{
border: 0;
}

table
{
border-collapse: collapse;
border-spacing: 0;
}

ol, ul
{
list-style: none;
}

address, caption, cite, code, dfn, em, strong, th, var
{
font-weight: normal;
font-style: normal;
}

caption, th
{
text-align: left;
}

h1, h2, h3, h4, h5, h6
{
font-weight: normal;
font-size: 100%;
}

q:before, q:after
{
content: '';
}

abbr, acronym
{
border: 0;
}


Tantek’s CSS Reset

Sitesinden alınan hali ile:


/* undohtml.css */
/* (CC) 2004 Tantek Celik. Some Rights Reserved.*/
/* http://creativecommons.org/licenses/by/2.0*/
/* This style sheet is licensed under a Creative Commons License. */
/* Purpose: undo some of the default styling of common (X)HTML browsers */

/* link underlines tend to make hypertext less readable,
because underlines obscure the shapes of the lower halves of words */
:link,:visited
{ text-decoration:none }


/* no list-markers by default, since lists are used more often for semantics */
ul,ol
{ list-style:none }


/* avoid browser default inconsistent heading font-sizes */
/* and pre/code too */
h1,h2,h3,h4,h5,h6,pre,code
{ font-size:1em; }


/* remove the inconsistent (among browsers) default ul,ol padding or margin*/
/* the default spacing on headings does not match nor align with
normal interline spacing at all, so let's get rid of it. */
/* zero out the spacing around pre, form, body, html, p, blockquote as well */
/* form elements are oddly inconsistent, and not quite CSS emulatable. */
/*nonetheless strip their margin and padding as well */
ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input

{ margin:0; padding:0 }


/* whoever thought blue linked image borders were a good idea? */
a img,:link img,:visited img
{ border:none }


/* de-italicize address */
address
{ font-style:normal }


/* more varnish stripping as necessary... */

Açıklama satırları olmadan düzenlenmiş hali:


/* undohtml.css */
/* (CC) 2004 Tantek Celik. Some Rights Reserved.*/
/* http://creativecommons.org/licenses/by/2.0*/
/* This style sheet is licensed under a Creative Commons License. */

:link, :visited
{
text-decoration: none;
}

ul, ol
{
list-style: none;
}

h1, h2, h3, h4, h5, h6, pre, code, p
{
font-size: 1em;
}

ul, ol, dl, li, dt, dd, h1, h2, h3, h4, h5, h6, pre,
form, body, html, p, blockquote, fieldset, input
{
padding: 0;
margin: 0;
}

a img, :link img, :visited img
{
border: none;
}

address
{
font-style: normal;
}


The Tripoli Reset

Sitesinden alınan hali ile:



/*
Tripoli is a generic CSS standard for HTML rendering.
Copyright (C) 2007David Hellsing

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/

*
{ margin: 0; padding: 0; text-decoration: none; font-size: 1em; outline: none; }

code, kbd, samp, pre, tt, var, textarea, input, select, isindex, listing, xmp, plaintext
{ font: inherit; font-size: 1em; white-space: normal; }

dfn, i, cite, var, address, em
{ font-style: normal; }

th, b, strong, h1, h2, h3, h4, h5, h6
{ font-weight: normal; }

a, img, a img, iframe, form, fieldset, abbr, acronym, object, applet, table
{ border: none; }

table
{ border-collapse: collapse; border-spacing: 0; }

caption, th, td, center
{ text-align: left; vertical-align: top; }

body
{ line-height: 1; background: white; color: black; }

q
{ quotes: "" ""; }

ul, ol, dir, menu
{ list-style: none; }

sub, sup
{ vertical-align: baseline; }

a
{ color: inherit; }

hr
{ display: none; } /* we don't need a visual hr in layout */
font
{ color: inherit !important; font: inherit !important; color: inherit !important; } /* disables some nasty font attributes in standard browsers */
marquee
{ overflow: inherit !important; -moz-binding: none; }

blink
{ text-decoration: none; }

nobr
{ white-space: normal; }


/*

CHANGELOG

23/8-07

Added deprecated tags <listing>, <xmp> and <plaintext> in the code block

Resorted to normal white-space in all code tags

Disabled the deprecated <marquee>, <blink> and <nobr> tag in some browsers

*/

Açıklama satırları olmadan düzenlenmiş hali:

*
{
text-decoration: none;
font-size: 1em;
outline: none;
padding: 0;
margin: 0;
}

code, kbd, samp, pre, tt, var, textarea,
input, select, isindex, listing, xmp, plaintext
{
white-space: normal;
font-size: 1em;
font: inherit;
}

dfn, i, cite, var, address, em
{
font-style: normal;
}

th, b, strong, h1, h2, h3, h4, h5, h6
{
font-weight: normal;
}

a, img, a img, iframe, form, fieldset,
abbr, acronym, object, applet, table
{
border: none;
}

table
{
border-collapse: collapse;
border-spacing: 0;
}

caption, th, td, center
{
vertical-align: top;
text-align: left;
}

body
{
background: white;
line-height: 1;
color: black;
}

q
{
quotes: "" "";
}

ul, ol, dir, menu
{
list-style: none;
}

sub, sup
{
vertical-align: baseline;
}

a
{
color: inherit;
}

hr
{
display: none;
}

font
{
color: inherit !important;
font: inherit !important;
color: inherit !important; /* editor's note: necessary? */
}

marquee
{
overflow: inherit !important;
-moz-binding: none;
}

blink
{
text-decoration: none;
}

nobr
{
white-space: normal;
}