Thursday, December 22, 2011

Christmas Magic!

n-am mai scris de ceva timp. nu mai țin minte de la ce m-am luat...poate e doar vechea mea imposibilitate de a asimila concepte gen blogging sau facebook sau justin bieber (la nivel de concept, nu de entități singulare și/sau contextuale...bla bla bla)
oricum, ca reminder, fiindcă memoria, pe bază de asociații, cine cunoaște știe și alte vorbe de duh pline de înțelepciune.
săptămâna asta m-a ajuns oboseala de sfârșit de an. știu că sună stupid, dar pe 31 decembrie la 12 fără 5 ajung o epavă și după countdown renasc ca o păsărică phoenix. am ajuns să mă trezesc după 7 ceea ce m-a îngrijorat puțin. dar azi m-am trezit (iar) la 3 jumate și creieru era pe-acolo (ready boots?!) și am avut o viziune...am avut viziunea unui mesaj de maintenance (de fapt primul gând a fost chiar să pun mesajul ala pe un site...știu eu unu bun pe care merge ca uns).

javascript error-ul nu e un ajax call...nu găsea un nod in DOM. magic magic magic!!!

mai am un reminder de făcut. http://wordpressapi.com/2011/06/21/increase-the-file-upload-limit-in-wordpress/

și ultimul reminder. primit email de la bizzard că dacă vreau să vând contul meu de wow (inexistent) voi fi bântuită de fantoma chinezului ginger. nu chiar așa, dar oricum, dacă nu intram pe nuș' ce link, moartea cărioarei, căderea constantinopolului, blestemul trabantului galben. dacă mai are cineva dubii, nu m-am putut abține, o mică verificare. am primit email-ul pe yahoo. cu email-ul deschis sus ai o opțiune ca o rotiță și acolo găsești View Full Headers. în pop-up-ul care se deschide poți citi minunății de genul:
  • Received-SPF: fail (domain of battle.net does not designate 60.14.158.146 as permitted sender)
  • check IP location...CHINA:)))))))))))))))))))))))))))))))))))))


===========
Edit 17.02.2012
Big issue...(in my particular case on ExtJs) to write URL (dynamic content) between '' characters. How to escape the ' inside the unknown content? For URLs special case I decided to use this:
$my_url = str_replace("'", '%27', $my_url);

Monday, October 31, 2011

New Wordpress Plugin: Search Simple Fields

In one of my recent projects I had to modify the Wordpress search to include some custom fields defined with Simple Fields plugin. Then I had to add some new fields to the upload form of the Wordpress Media Gallery and also include some of them in the search. After hard enthusiastic successful work of course my code had to be commented (let's say for "business consideration") so I ended up in making a new plugin, maybe other people would really benefit of my work.

When you should use this plugin:
  • if you have registered post types
  • if you use Simple Fields plugin
  • if you created Media custom fields
How to use this plugin:
  • download it
  • install and activate it
  • a new option will appear in Settings: Search Simple Fiels
  • go to the new option
1. - list of registered post types
2. - if the Simple Fields plugin is not activated, a warning message will appear, otherwise a list of defined field groups will be displayed
3.a. - if a function (see 3.b.) is defined for media custom fields, the defined fields are listed. For each field the user must insert the name of the option with which the field is saved in wp_postmeta table
3.b. - function used for Media custom fields (, for example insert in the Custom function field value xxx_custom_fields_function_name if you have in functions.php of your theme something like this: add_filter("attachment_fields_to_edit", "xxx_custom_fields_function_name", null, 2); )

To include the selected fields in the front wordpress search, add to your theme function.php file the lines below:

if(!is_admin()) :
   if(function_exists('search_simple_fields_search_posts')) :
      search_simple_fields_search_posts();
   endif;
endif;

Note: for Media type items the result of the search will be the posts (any type of registered post types which were initially included in the search query) it is attached to.

Friday, October 21, 2011

one of those days

azi. foarte grea zi. tocmai am descoperit că am pierdut toate posturile de pe vechiul blog de pe yahoo. cumva...ura atavică față de nou/tehnologie/internet/facebook se ițește din dulap cu pancarta mare roz "I've toooold youuuu!!!..."


dar totuși, după tristețea pierderii plus toată ziua în care mi s-a servit toată pleiada de clișee de care crezusem că am scăpat (dar! dar...desigur...tot ce mi se întâmplă este numai și numai din cauza mea), ce putea să fie mai binevenit decât un nou episod din House?

știu că am un Wilson. nu lucrez cu "el", dar e Wilson-ul meu. oare o să dau și peste vreun 13?

Edit
mi s-a sugerat azi să încerc să scriu un blog local, fără "publicat" pe internet. după câte semne, lipsite de minuni, au fost în ultimul timp, cred că e timpul pentru așa ceva...și public post-mortem:))))))

Monday, October 17, 2011

insomniaca

m-am trezit cu gândul clar că viața e penibilă. toate ideile, gândurile, frământările, iubirile, urile, frustrările, lenile, elenile, vasilii, vasiliscii și balaurienii noștri într-o bună zi se vor sfărși, vor dispărea într-un neant inaccesibil...nu am avut decât un singur cuvânt: P E N I B I L.

de ce mai am insomnii? s-a terminat luna plină!!! nu știu...m-au ajuns și pe mine grijile...las'  că trece.

we all are star dust!

Sunday, October 16, 2011

între obsesia morții și obsedată de moarte

numesc obsesia morții (vezi nota) recunoașterea valorii vieții prin existența morții. viața are valoare tocmai fiindcă există un final: moartea. obsesia morții are ca referință viața și, implicit, moartea, ca și concepte generale, generalizate și generatoare. să fii obsedat de moarte nu e echivalent cu obsesia morții. o persoană obsedată de moarte nu este preocupată permanent de moarte în general ci este măcinată de gânduri persistente privind propria moarte, propria dispariție, propria futilitate și neputință în fața unui destin implacabil. obsedatul de moarte poate să se panicheze, să se covrigească înfrigurat și să se trezească dimineață ceea ce numim "ipohondru", sau...se poate simți atras într-un mod nu neapărat rațional de acest fapt de care nu va putea scăpa toată viața: faptul că într-o bună zi va muri și atunci să înceapă să-și dorească mai mult sau mai puțin propria morte. ceea ce numim "sinucigași" sau poate doar "tendințe suicidale".
obsesia morții își are rădăcinile și duce, inevitabil, la celebrarea vieții, la o atitudine optimistă și constructivă. avem puțin timp, de aceea totul trebuie făcut, trăit, simțit până la capăt cu o intensitate vitalizatoare.
obsedații de moarte nu mai văd nici o luminiță la capătul tunelului. poate văd o luminiță în ei pe care simt cumva că moartea lor o va elibera. pe tema asta se poate abera incontrolabil. ce știu cert este că există stări psihice în care obsesia morții se pliază pe persoane/personalități/mentalități mai mult sau mai puțin patologice obsedate de moarte. așa se nasc stări contradictorii. există depresivi care iubesc viața. există depresivi care au obsesia morții și în același timp, când depresia se acutizeaza, încep lungul, delirantul, sfâșietorul proces de a "deal with" tot ce înseamnă pentru ei a fi obsedați de moarte.


nota: starea respectivă o numesc așa fiindcă este un fel de proprietate a unei personalități. ajungi la ea sau nu. poți să-ți repeți în fiecare dimineață în fața oglinzii cu voce tare...dacă e să nu, nu se va. pe când a fi obsedat de moarte este o stare în care poate ajunge - și rămâne mai mult sau mai puțin timp - o persoană la nivel psihic, mental, rațional sau nu. obsesia morții o ai. cealaltă - ești.


Saturday, October 15, 2011

zgribulituri de maimuță


postezi și eu, poate se mai dezmorțesc degetele. de când cu tehnologiile astea avansate laptopu din poală nu mă mai încălzește deloc. sau poate e zgribulit și el...tre să-l botez. pe el, pe laptop. și fiindcă l-am "botezat" deja cu o cană de ness fierbinte cam așa cum mi-am botezat și picioru drept, printr-un șir bizar și deloc interesant de cunjuncții și dizjuncții logice am să-i spun sec "pedus (și da! dacă aveți dubii check here


am stat cinci minute și m-am uitat la monitorul aproape alb/gol. nu știu exact dacă nu am nimic de zis - se contractă creierul de la aerul rece pe care îl inspir... - sau dacă am ceva de spus și nu știu cum. mai degrabă a doua variantă (da da...eu îmi acord mie cele mai multe șanse. păi dacă nu eu, atunci cine???!!!). revenindu-mi (mai are cineva în afară de mine fascinația gerunziului?) am revelația zilnică a faptului că nu sunt înțeleasă (sic!) pauză. sorbind (aaaah). am destulă imaginație să nu dau vina pe ceilalți. este foarte inhibantă (da da...din când în când și un adjectiv face treabă bună) ideea descoperirii, auto-descoperirii, self-revealing cum ar zice americanii. dacă știu de de-astea. majoritatea nu știu (scriu în propoziții scurte fiindcă îmi clănțăne neuronii. ai mei neuroni clănțănind. oooooh!) 

de prima dată de când am citit dune m-a fascinat ideea mentatului. am spus clar atunci "idaho I am". acum că o recitesc nu fac decât să-mi confirm toate intuițiile inițiale. să privești lumea cu o minte deschisă, fără prejudecăți, să iei toate lucrurile ca și cum ar fi noi. iar ulterior să le analizezi și să creezi rețele, plase de idei din care să nu extragi (pre)judecăți, concluzii decât atunci când esti sigur că ai suficiente date. nu încep să trag concluzii despre oamenii pe care îi cunosc decât în momentul când știu că nu mai am de-a face cu ei. și atunci mi se pare inutil, o pierdere de timp, așa că oamenii ar putea (da da, condițional optativ...cu ceilalți nu suntem atât de darnici! ha!), oamenii ar putea să mă uimească oricând, să aducă o culoare nouă, o tușă, o măslină, o atenție nouă, care să ducă la o reconfigurare a ideilor inițiale. am fost pesimisto-nihilisto-egoisto-narcisistă în fraza de mai sus din cauza experienței. 

în naivitatea mea practic neîncrederea în înțelepciunea populară. dacă mi se spune "ăla e un dobitoc" ar trebui să cred pe cuvânt. dacă mi se spune "aia e o superificial bitch", ar trebui să cred pe cuvânt. dacă mi se spune "ăla e un arrogant psycho", ar trebui să cred pe cuvânt. înțelepciunea populară nu se înșeală. prima impresie și intuiția sunt prietenii mei cei mai buni, cred că de aia îmi permit să îi tratez așa de nasol. eu nu. dacă mi se spune că x e dobitoc eu nu cred. de când am aflat că există sute de tipuri de inteligență mă tot gândesc că există o posibilitată foarte mare ca orice persoană să aibă o chestie în care să fie mai bună decât mine. și sunt perfect conștientă că societatea actuală nu are nevoie de toate tipurile de inteligență. că multe dintre ele rămân ascunse chiar și posesorilor lor. când eram mai tânără și îmi păsa chiar aveam pretenția că îi pot ajuta pe ceilalți să își descopere "talantul", să-i conduc de mânuță către lumina din ei. wasn't I cute????!! no panic, că mi-am revenit. oarecum. nu, n-am renunțat la ideea că oricine are ceva de descoperit în el. doar că nu mă mai interesează. oricum nu dau nici o șansă omenirii, ca specie. și dacă oamenii nu vor să descopere ce au mai bun și mai frumos în ei, cine sunt eu să le vorbesc sau arăt așa ceva?? ca în bancu cu bula și cu baba care nu vroia să traverseze strada...las toate babele în pace, pe partea lor de trotuar. să hie ele sănătoase! știu...știu...voi fi acuzată de aroganță. și lipsă de umanitate. și impotență afectivă. și multe de-astea. dar eu acum nu scriu ca să mă expun judecății exterioare (muhahahhaha...asta se întâmplă și dacă mă retrag într-o peșteră, practic budismul zen, mor o sfântă și peste 200 de ani o iau pe sf. paraschieva în materie de pelerini și pelerine), oamenilor oricum le este mai comod să vadă paiele din ochii celorlalți. cum să nu ne judecăm unii pe ceilalți? nu ne suntem noi zei și zeițe?

și totuși, uneori...ca un fel de nostalgie a umanității, mă izbește (dacă aș avea, aș zice clar...in boașe!) cât de bine baricadați suntem, cu scuturile activate la maxim crezând că nimeni și nimic nu le poate străpunge. și asta este foarte adevărat: nimeni și nimic nu le va străpunge. partea cea mai liniștitoare este că nimeni și nimic NU VREA să le străpungă.

am vrut neapărat să închei cu un gerunziu. dar n-am altul mai bun decât   g e r u n z i n d!

P.S.: dați-mi un Om și vă voi da Umanitate. până atunci: mai ușor cu maimuțărelile!

Saturday, October 1, 2011

facebook rage again

uu-uuu-huuuu - not another friend request!!!!
i logged in this morning to facebook to reply a comment on one of my posts and i ended up in browsing through pictures of some people i don't know about for years and...it hit me! facebook exploits our "voyeuristic" inclinations in quite a sick and ugly manner. i am sick of seeing people with 300+ friends. i mean, com' on, do you really give a sh*t for all of them? do u actually read all their posts? do u want to know everything they have to say? do you really have to know all that stuff? my head hurts. i will take another pill in 30 mins, until then i am grumpy as i can be...

i went to my friends list (i still have problems in finding that in fb). they changed the options display. one more reason for my headache to go nuts. now they don't say "remove friend"...what is that? remove friend is equivalent to "kill friend"? remove/delete/shift+delete/fuck off! now they call it: "unfriend". UNFRIEND!!!????? i felt sorry for myself seeing i had over 60 friends....since when???!! i deleted more than half of them! proudly!  deleted all my test users (yeah...i had around 5 of them...shame on me), all the people i really don't care about and all people i am sure i will remember their names if i really need to find them on fb in the future...kept some i really care about and some i thought would not be really polite to delete them right now (like my co-workers...you know...i will delete them as soon as i change my job:)))))...not really...some of them are really ok:D). but i would definitely delete the company test account. it still has in "his" albums photos with jb...bleah!)

it's really hard to keep a proper level of sincerity with myself these days. so many delusional traps. these morning, replying to the post comment, felt like i was doing something wrong. when the headache first hit i went back and deleted my last comment:)))) oooops! i don't try to blame the headache for my behaviour. perhaps just the determination.

i suppose i will go out tonight, so i will avoid going back there and delete all my friends:). i don't go out just not to delete all my fb  friends...or....?

Thursday, September 29, 2011

Wordpress Comment Extra Fields Plugin

I made the first version of a plugin I will continue to develop for the next weeks. How to use it/features list:
  • install the plugin (copy it to wp-content/plugins);
  • activate it
  • go to Settings. The plugin adds a new option under that menu: Comment Extra Fields
  • in Comment Extra Fields page you can see the extra fields already defined (and edit / delete each of them) or define new extra fields to be added to your comment form
  • all fields are mandatory (even not all tested for that)
  • the types of fields one can define on admin are:
    • text field
    • textarea
    • checkboxes: field to define the values to display on front comment form
    • radio buttons: field for values
    • drop down: field for values
    • file: the upload on front is made using swfupload for jquery
    • (database) db select: fill in the name of a table (with or without the wordpress prefix) and 2 column names for id and values and on front the drop down will be populated with the database values
  • mouse over the labels and, if there are any, tooltips with hints will be shown
  • on front the plugin comes with a .css using twentyeleven form style
More features to come:
  • allow extra fields to be required
  • add date extra field type
  • allow extra fields to be shown on logged in user or not logged in user
  • add option to remove the default comment fields: author, url and email
  • on admin side allow user to define the HTML code for more flexible DOM display
The first version can be found at this link.

Edit
WordPress.org accepted my plugin, just added it to their SVN (heh:D). I will post link here asap it is available (where's the wittle happy monkey? where's the wittle happy monkey? a-gu-gu-gu to me!).

Edit
Best link

Saturday, September 17, 2011

Wordpress WPML Edits

In one of my recent projects I had to use WPML, a very well done plugin for Wordpress for Multi Languages sites. It is based on the idea of keeping translations of different posts in another posts linked to the first one. This way the problem of translated URLs is solved in a very elegant manner. Also all fields appear only one time per translation (which is really nice. If you have 10 fields and you need to translate it in almost 30 languages you won't end up with almost 300 fields on a post edit page).

My problem appeared when I had to define some custom languages and then I wanted to change their names. On a site there can be different content for users whith IP from Europe and have their browser set to English and users with IP from US and their browser language set to English...so I need the default en plus some user defined language, let's say en-euro. If instead of en-euro I wanted to use en-emea the only possible solution would have been to define the new language and use the new one. So, I ended up looking in all _icl tables and try to figure out where the language codes are used. Same thing for a language name. After updating information in those tables the changes were not visible unless I deleted the plugin's cache (kept in wp_options, option_name='_icl_cache').

There are some risks in using my new plugin:
  • I didn't test it for all types of WPML translations;
  • I don't know what happens if one had already made mane translations and then deletes the plugin's cache from wordpress' database (of course, I can figure out from WPML code, but I had been too busy for that. If I get any emails with problems related to this issue described I will try to go deeper into this issue);
  • There might be still hidden issues with this approach (maybe the creators of the WPML plugin had their reasons not to include this option. On edit languages form the fields for language name and code are disabled...)
I recommend using my plugin before starting to translate, if possible. The plugin can be downloaded from here.

After you copy the .zip's content into wp-content/plugins directory and you activate it, a new option will appear under Settings menu called WPML Edits. When you click on it a form will appear where you can set the Old code, New code, Old name and/or New name and when you click Apply changes the database updates run. You need to use an already existing code/language name for Old code and Old name values and a not already existing code/language name for New fields values.

Tuesday, August 30, 2011

tocanița de gânduri

știți ce aș fi vrut să aud pe transalpina? după ce am urcat cu Bella până la 2100m prin serpentine fără bare de protecție care mi-au declanșat frica de înălțime și litania "frica este irațională. frica este irațională. frica distruge mintea. frica este irațională. nu trebuie să-mi fie frică"? de preferat ar fi fost să nu aud nimic. aerul rarefiat de pe platou creând un vid de liniște în minte nu cerea decât, la rându-i, liniște. de foarte mult timp sunt în căutarea liniștei la nivelul cel mai pur senzorial. decibeli zero. după aceea mi-am dat seama că ar fi mers la fel de bine partea a doua din Concertul Italian de Bach. ghici ce se auzea? desigur...manele! știu că "zicala" cu România este minunată, păcat că este populată este deja răsuflată, de-a dreptul kitsch-oasă, dar o resimt la nivel visceral, atomic. dacă aș ști că am dispărea cu toții, inclusiv eu, nu mi-ar părea rău. din contră, chiar aș începe (așa, în ultimele clipe) să am un dram de speranță. vrabia mălai visează:))))))))

durerea. azi am avut o experiență apropiată de extazul mistic, epifanie pură când am reușit să mă ridic din pat fără să urlu. încă nu pot merge dreaptă, mai icnesc când pășesc, durerea persistă, dar față de ce a fost e doar ca un fel de warning sign, ca să nu uit de durerea agonizantă care poate a fi. am stat cu gura căscată gândind. gândindu. gândindu mă. mă gândeam de ce nu am aceeași frenezie când trec printr-o "ridicare" similară la nivel psihic. fiindcă există paralele. și fiindcă am trecut prin dureri acute și "vindecări" și la nivelul mentalului și a psihicului. singura explicație care mi s-a părut acceptabilă pentru mine în momentul de față (recunosc...am luat multe pastile în ultimele zile. nu știu cât de ale mele sunt gândurile mele acum) este că la nivelul mentalului lucrurile îmi sunt mult mai previzibile. și la nivelul mentalului și a psihismului meritul este în cea mai mare măsură al meu, la un nivel strict în mare parte conștient. la nivelul fizicului mecanismele îmi rămân obscure, vegetative și intangibile. și în clipe de astea mi-aș dori să devin o Cucernică Maică.

Monday, August 29, 2011

pain...the final frontier

cu capul blocat între pat și canapea. trunchiul blocat în durerea țipătoare. disperarea și furia amestecate în fiecare celulă într-o otravă atomică. senzația de dizlocare organică. mâinile scrâșnind tăcut pe lemnul mânerului. liniște. zbucium. liniște. urlet crunt. liniște. lacrimi țâșnind impudic pe obraz. o dâră de salivă scurgându-se calm pe fața întoarsă câș, schimonosindu-se ca la un circ halucinant.
un cuțit și tai în venă. nu mai suport!!!! dar la dracul...nu pot să mă mișc nici măcar până la el...la cuțit.
"reacționezi foarte prost la durere" "no shit!!!"
de fiecare dată când trebuie să mă ridic în picioare (???) - mai degrabă pe picioare, mai corect ar fi între mersul în patru labe și mersul cocoșat - îmi vine în minte genericul de la 2001: A Space Odyssey (Richard Strauss - Also Sprach Zarathustra). încă două-trei scrâșnete, cinci-șase gâfâituri și sunt aproape în picioare.
și Muntele Vrăjit, al lui Thomas Mann...nu mai sunt Hans Castorp? nu mai sunt copilul vieții? habar n-am și acum chiar nu ma interesează. încep să mă gândesc la diferite forme de "răzbunare", cum am să "i-o trag" durerii...după ce-mi trece. dacă nu-mi trece oricum reacționez prost, deci ce se mai poate întâmpla?


Sunday, August 28, 2011

August - 2011 trip

You can see some pictures here, click on My Pictures and then on :: August - 2011 ::. It has a big loading time, so if you really have nothing better to do...
I will try to put them here too, but right now I fight against a crazy backache...

EDIT:
Managed to add Cooliris Live on a page in blogspot. Uploaded the photos on Picasa. Published the album, then tried to figure out the feed URL. Took me a while and used in the end the direct link (extracted with Firebug). So, instead of using api://picasaweb.google.com/?user=jajonet&album=BLIJDORP (as they tell us on their developers site), I used http://photos.googleapis.com/data/feed/api/user/SimonaIlie/album/August282011?max-results=60 which is the final url to get the feed content.

Cooliris can be found here.

Saturday, July 30, 2011

saga (from bleah to lol and back)

A week ago I finished my compressed saga with PayPal. I learned many things from that experience (that I think to share) and also now I have many dilemmas (I will survive them, soon I will forget everything).
The story starts in a lovely hot afternoon at work when a friend of mine asked me if I could receive some money in my PayPal account for her mother. Considering that a few months ago I called the bank to activate my e-payment card so I can use it with my PayPal account I thought it would be such a great opportunity to see how their services work. I lost any sense of curiosity about PayPal meanwhile.
I get the money in the account, all nice and happy. I set my credit card to the PayPal account. No funcky messages, no warnings, no blinking exclamation marks. Why? Because "The Horror" is always kept hidden. You don't see it first.
After a few days I am told I should try to withdraw those money. Ooooh! you have to withdraw them???! (trust me, I made tones of google searches, I read most of their FAQs, I had to be told by someone and then figure out from the support how the whole system works. or doesn't.) So, the idea is this. You have the PayPal account and your bank account. Even you have a credit card in your PayPal account that they verify with your bank, after you get money in your PP account they don't send it to your bank account, they just keep them there. And one of the most hilarious things after all this is that PP actually has a withdraw limit. So...yeah...fool people around to send you money in your PP account and you will be able to actually benefit of those money when we tell you to (even you think you are free to get them from you superb PP account when you want to) Bleah!.
As I said before, I go into the adventure of withdrawing the money from my PP account. Now, some info. I click happy on Withdraw option, choose Withdraw funds to your card and I can see the eyes of the Horror: warning telling me I can withdraw only to a card with Visa or MasterCard logo. I have a MasterCard card. I smile happily. I...poor naive. The only options I have is to insert info for a Visa card. On that page I can see I have 1 active card. When I try to select "Choose another card", the Horror shows me his tail. I can't choose any card. Damn...now starts the amazing information exchange with the PP support. I talked with Angelina, Thomas, Paulina and Michelle. You don't have to tell me these are not their real names (duuuuh!). They are the unknown soldiers, I know very well. First, Angelina tells me a stupid thing, such as "I verified your account and you have a Visa card.". I am like...whoaaat??!! But still, I continue. Thomas tells me something really interesting...he told me he understood my frustration...and it was just my 2nd of 3rd email!!!He was a cute! He tells me he verified my account too (wow! how many people are able to verify my account??!!) and indeed I have a MasterCard card and...sorry, but they only accept Visa cards. Ok, I start to talk around, to ask people what is going on, what I can do?, Google and the conclusion was that actually no, you can use MasterCard on PP, you can't use Visa Electron, for example. Meanwhile I receive some stupid emails from my bank. One imbecile lady confounded me and after she spams me she tells me to go to the bank to solve the issue so I don't receive emails that do not concern me!!! retard. I called the bank to tell them about this issue and also to ask them if there are any problems with my e-payment card and PP. They tell me there is no problem, only that it seems it was not verified, because the 4 digits code does not appear. Ooooh....oh...other retards on the plane. My e-payment card expired 4 months ago. So when they gave me a new one of course the idiots forgot to copy all data! why do I wonder? I live in the country where people cut each others with swords! I share this new info with the boys and girls from PP support. As my card appeared to be verified in PP I ask them if they can reset my code and repeat the verification. I forgive Paulina because she completely ignored my suggestion, but she told me something new: that I could try to send the money back or to someone else with a PP account (I have tried that before, but there were issues too....the Horror...the Horror!). My heart trembles in excitement! I start to google again, I found out alot of new info about PP that they don't tell you or make it visible. I even found a book about How to use your PP account! only 7 dollars!!!!! For example Profile, in PP account is an option itself (it has sub-options). There you can see if your card is usable on PP, add currencies to your PP account, change amounts in your PP account from a currency to another and alot of kinky stuff. I tried to send the money back. Guess what? That's how I met Michelle...the hero that made my day. My last email to PP which had the chance or the misfortune to be read by Michelle contained phrases like these:
"[...]I google it and I find out how to. You won't have to explain me the steps, I know them: History, Issue Refund....right? Well...why on this page(issue refund) I get this message:

Your money can't be transferred from your bank account to cover this refund at this time. Please add money to your PayPal account, or add another payment method.

I think I deserve some explanations, more than "we are sorry but you can't do this". Please contact your technical support and ask them if there are inconsistencies in your databases, because the messages are contradictory. And by the way, if the money can't be transferred from my bank account, how to add money to my paypal account??!! If I can't do this but those money are in PayPal system, please ask someone in charge to do the transfer because this is taking far too long time (not me, don't tell me to go in my account and click on some links because it seems that I can't do anything in my account and those money are stuck in the void). If my PayPal account is a black hole for money, let me know that too!

thank you very much[...]"
Do you think I snapped???!Michelle sensed she should be sorry for my frustrations too. And gave me the solution.

Now, for the completion of the transfer PP took 4% of the amount. To change the currency forth and back took another 5% and to send them back took another 4% from the remaining sum. In the end, during all this mabmo-jumbo there were lost 12.5% of the initial amount. If there were my own money, I would have closed my PP account after the 2nd email.
My only conclusion was this: This is the horror parody of the comedy called "life" (gosh, nothing can destroy my pathos:D)

Tuesday, July 12, 2011

În lumina soarelui - elegie

pierdut minţi
 în zona podului-de-fier sau a podului-de-piatră.
le declar nule
sau vide.
ba nu. invalide.
oricum se vor dezintegra
în lumina soarelui.





doctorul mi-a zis
"între trei şi şase luni".
am fugit speriat la picioarele Mamei
ca şi cum dacă mi-a dat viaţă o dată
poate merge şi a doua oară.
m-a îndepărtat uşor cu picioru'i sidefiu
şi a păşit liniştit
în lumina soarelui.





nu sunt decât un prol
cu Victoria în colţul buzelor
rânjind candid
în lumina soarelui.

Tuesday, June 14, 2011

me and my monkey...

no monkey. just "me and my code" concept, because of course there is a sense of (intellectual) property over the code a programmer writes. for those who even heard (not necessarely to read) of Hackers and Painter, by Paul Graham this post might sound very funny. of course, programming is a craft, and programmers are crafters, but still.


I am somehow intrigued by the voracity of marketing over the quality. I admit it is a mentality of a whole society. If you are born in a society where the individual rights are not strengthened by the higher state hierarchies, where the law of intellectual copyright is imported from foreign economies and societies without any effort to adapt it to "cruel reality", it is funny and perceived as a huge arrogance the simple fact I am about to describe in my next paragraph.

I am looking through a project which seems to be written by a single person (over 1500 files of PHP + HTML + CSS + JS code). I had different contradictory feelings: first I thought I am going to spend a whole day to make it work on localhost. Well...besides the 3 different configuration files with functions with same name and the comment of lines which made redirects to exactly the same link but with https instead of http - of course, no check if the request already comes from a secure url - nothing "spooky" yet. Then I find a class file (yeah...a class...who would have thought of that?). 'til line 137 we have the definition of private variables. 'til line 250 or so we have the constructor which initialize each variable with values (like '' or 0). then, 'til line 1200+ we have getters and setters for each variable:). I scroll down the file with over 3500 lines. Guess what? NO COMMENTS! none! zip! zilch! nada! until...the last lines which contain a copyright note, the author's name (for god's sake, at least don't put your real name there!!!) and of course the magic lines:
// This code may not be copied, sold, or used as a derivative work
// without the express written permission XXX
and here I am, wondering...who on earth would want to copy your code? I swear and cross my heart I will never be able to sell that code (I think the author of it actually had that problem). I would never say making that code to work that I am using it as a derived work. And no one should say that too. I am fixing it, improving it, make it run properly, use common sense and basic logic on a bumble-mumble product which, funny or not, is the INTELLECTUAL PROPERTY of another human being. Now I am the arrogant one, but I am forced to it, and I hate it. And believe me or not, but this kind of people have all the chances to rule the world.

Isn't it sad?

P.S.

Thursday, June 9, 2011

Timthumb and filenames with spaces issue

It is known that some of older timthumb.php versions have an issue with displaying pictures with spaces in their file names.
Altering the timthumb.php file:
1. just because I am paranoid, before the call of clean_source($src); (around line 40) function I added
$src = urldecode($src);
On front side I generate the pictures sources from jQuery + jquery.urldecoder.min.js and use $.url.encode(picture_source)
2. comment line (about 672) containing the code:
$src = str_replace (' ', '%20', $src);

Or best thing to do: update the timthumb.php file to last version!

Tuesday, April 19, 2011

Create dynamic images in php

Simple task: user input as string to be applied with a custom font on a given image.


You can view a demo here.

Features:
  • the font size is calculated depending on image's height;
  • the number of characters displayed on a row is calculated depending on image's width and calculated font size;
  • the text is split to pe displayed on multiple lines;
  • user can pick the text color on image;
  • the text has transparency;
  • the resulting picture is provided for download.
If you have suggestions or need the code, feel free to email me (write a suggestive email subject)

Friday, April 15, 2011

me and my facebook(s) - part 2

Friday evening, at the office, waiting for a server to "get real"...it won't
Anyway, the last weeks I had to do some stuff with the new Facebook API (which is really ok, I suppose...only it is not documented in a very efficient manner, so I end up spending hours for some simple tasks).

So, 2 easy hints if you want to upload a picture with the API (you will find tones of examples of code of how-to, the actual algorithm, using a PHP library which wraps the requests in a more elegant way, or directly with CURL):
1.For upload need special permissions - main permissions: read_stream, publish_stream, photo_upload, user_photos
2. Before the upload code you need to set the upload file support
$facebook->setFileUploadSupport(true); 
Now, some other things I had to do were 1. to save a picture (from the disk) to a Facebook user Profile album and 2. eventually open it so the user has the possibility to set it as his/her Profile Picture. The first thing is possible if the user already has a Profile Picture album. Otherwise you can not create from API that type of album (with type = 'profile' ). If the user did not have a profile picture yet it will be saved in an album with the application name.
The second part is alittle tricky, because Facebook would not allow an application to mess around with stuff which is part of user's privacy - such as the profile picture, so all you can do is open a new window with the saved picture in Facebook and let the user decide if he/she wants that picture to be his/her profile picture. How to do that? The action of saving a picture to profile/or_not_profile_yet album will return you the ID of the picture (in the Facebook graph), say it's $pid. The url where the user can see the picture and take the decision I've talked above looks something like this:

http://www.facebook.com/photo.php?fbid=$pid&makeprofile=1

Sunday, March 20, 2011

me and my facebook(s)

I just read an article about the new scams that moved on Facebook. One of the comments was that it is actually impossible to delete your account on Facebook so I wanted to give it a try. By the way, about 2 weeks ago I activated the option so that no one can comment on my wall and there was 1 person who seized talking to me any more and another who really felt like asking me if I am mad on her or not (which is hilarious...I am sorry, I still can't believe there are people out there who take social networks so seriously).
Anyway, two years ago I had to develop some applications for Facebook and I made like 14-15 users (because I needed to activate the pagination on friends list) so I picked one of them that I still remembered the credentials and tried to delete it. No, you can't delete the account, but you can "Deactivate" it from the Account Settings. Clicking on that option gets you to a very pathetic page with a list of the "friends" that will miss you if you do that (!!!!). Then they ask you the reason, which is ok...then, and that kinda freaked me out (just for 2 seconds, I am still sick so my mind doesn't react properly, or the way it used to) I read this:

Note: Even after you deactivate, your friends can still invite you to events, tag you in photos, or ask you to join groups. If you opt out, you will NOT receive these email invitations and notifications from your friends.

After 2 seconds I made a search on Google on "permanently delete your Facebook account" and I found some info here. So they have an application that deletes accounts for good. They give you an interval of 14 days to come back and cancel the deletion: Your account has been deactivated from the site and will be permanently deleted within 14 days. If you log into your account within the next 14 days, you will have the option to cancel your request.

P.S. I just deleted the account I made on the name of "Sandra Bullock"...after 13-14 sign ins I was totally out of inspiration

Tuesday, March 15, 2011

Când am încetat să mai fiu un zeu

Când am încetat să mai fiu un zeu?

Neuronii'ţi sincopau în 
 ritmul respiraţiei mele
Frunzele veştede toamna cădeau în 
cadenţa paşilor mei
Stelele apăreau pe cer după 
extrasistolele inimii mele.

În zvâcniri nevinovate
Ne dădeam cu capul de pereţii 
imaculaţi de sticlă
Ai propriei noastre voinţe.

Când am încetat să mai fiu un zeu?...
Nici că mai contează
În umanitatea-mi sieşi însăşi atot-suficientă.

Nu...acest text nu a fost generat de un script...dar ar fi putut fi.

Wednesday, February 9, 2011

WordPress plugin - Domains Update

I dared a few days ago to share a plugin I made with my work mates. It took me about 10 days to decide to do it (the sharing part). Last night my boss called me to ask me how to use it and in the end his conclusion was that it was not doing what I said it would...but, as usual, I had the "revelation" in the morning - meaning like 10 minutes ago.

So, I decided to put it here and see what kind of problems other people might have with it(omg...I am so evil).

What I pretend this plugin to do: updates values in database.

When you should use it: when you move your Wordpress site from one domain to another and you want to keep the database consistent.


Let's imagine the scenario when you move your Wordpress site from location A to B.

Options description:
1. Old domain - in our case would be A
2. New domain - in our case would be B
3. URL format - uncheck it if any of the domains does not have an URL format (e.g. localhost)
4. Select custom table(s) - when you press this button a list of the Wordpress' database tables is shown. When you select a table, a list of its columns is shown. Use this to update the values of old to new domain in other tables than wp_posts and other columns than wp_posts.guid and wp_posts.post_content (these are the default location of the update).
5.Update only custom tables - if this option is selected the default locations are skipped.
6. Run changes - runs the database updates.

Note 1: you can run this plugin multiple times.
Note 2: if you need to make updates in custom tables make sure you selected at least one table and for each table at least one column (otherwise it will tell you that there was no data to update).
Note 3: you might wonder why the plugin's name is Domains Switcher and in administrator's dashboard the name is Update Domains. Because I like to screw users' mind.

One more thing. The steps I follow when I need to move a Wordpress site from domain A to domain B and on domain A there is already content that needs to pe kept on domain B:
  1. Copy all needed files from A to B
  2. Export-import database from A to B
  3. On B, go to database and in table wp_options where column option_name has value siteurl and home the column option_value should have value A. Change it to B.
  4. On B, open file wp_config.php and update the information for database connection on B
  5. Enter wordpress admin on B (now you should be able to do that) and install and activate the Domains Switcher aka Update Domains plugin
  6. If all you need to update are posts and pages, run it with simplest configuration (without custom tables). The files uploaded and inserted into posts now will be taken from B, instead of A.
  7. If you used plugins which create their own tables, run the plugin against tables and columns that you know might contain URLs (e.g. for a slideshow plugin, it might keep in a custom table the links to images it uses)
  8. Sometimes plugins which do not create their own tables might insert links in column wp_postmeta.meta_value

You can download the plugin from here.

Known issue: Don't use it to update the information in cformsII plugin. It will alter the serialized string containing the cforms settings (and the plugin will stop from working). If you need to move cformsII to another domain, my suggestion is to install the plugin to the new locationa and backup-restore the forms from the old domain to the new one. If you have more than one form created with cformsII, just add new forms and backup-restore them. The global forms settings need to be update "manually" though.

Tuesday, February 8, 2011

How to add different custom content on WordPress pages

In the last few months I had to work on different WordPress sites which required different content on different pages. That content was supposed to be manageable from WordPress administrator account. As I was new to WordPress I decided to create a plugin each time I needed manageable content to appear on different pages. This morning I just figured out how to take advantage of some already made WordPress plugins which would make this task much easier and much efficient, from my point of view.

Let's take the example of adding different Sidebars on each page of a site.
1. The plugin I am using is Custom Post Type UI. After installing and activating it I define my custom type Sidebars. From plugin's Advanced Options I choose it to support Title, Editor and Custom Fields. I also define a taxonomy for this custom type, called Page Sidebars and I attach it to Post Type pages.



2. Now in Dashboard I have a new option to administrate the custom type I just defined. So all I have to do is to go to Sidebars and start adding new content of this type.


3. When I insert new pages in the left of the editing window I can add the custom types by their title.


4. Now the code I use in sidebar.php from my theme to get for each page the content of each custom type sidebar related to each page.
/* get the global post variable to know on what page you are on */
global $post;
/* for the given page, get the taxonomies of type page_sidebars */
$data          = get_the_terms($post->ID, 'page_sidebars');
$my_sidebars   = array();
foreach($data as $sidebar):
/* get the post of type sidebars with the name of the page_sidebars taxonomy */
$my_sidebars[] = get_post_by_name($sidebar->slug, 'sidebars');
endforeach;


In functions.php of your theme define
function get_post_by_name($page_name, $post_type = 'post', $output = OBJECT) {
   global $wpdb;
   $post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s", $page_name, $post_type ));
   if ( $post )
      return get_post($post, $output);

   return null;
}
Note: If you need new fields for your custom types, there is another plugin easy to use and integrate with Custom Types UI: Custom Field Template

Sunday, January 30, 2011

PhpMyAdmin for beginners

First of all, what is PhpMyAdmin? The name itself reveals all needed information: PhpMyAdmin is a tool for administration of MySQL servers and it is written in PHP. The "thing" about PhpMyAdmin is that it is a browser application and it is used over World Wide Web.

Some of the main things you can do with id: create/drop a database, create users with different privileges for databases, create/empty/drop tables, insert/update/delete tables' information, run SQL queries in databases, import/export databases/tables.

1. Set the language for PhpMyAdmin

In the login window you have the option for language. Choose the one you want to work in, insert the username and password for th application and login to it.

2. Create a database


After you successfully login to PhpMyAdmin you can create a new database. One of the details is the Collation. If you plan to store in database data that will contain diacritics, than choose at least utf8_general_ci as collation. After you create the database, you can create tables (which are related to that database)





3. Create a table


4. Define the column types of a table
More about MySQL types here.


For data kept in a certain column you can set the default value as NULL (the information kept in that table does not need to be initially defined, it can be "inserted" in that table after the reference to it is defined - in SQL representation it means that data can be added in the table at UPDATE), or you can define a default value (as shown in the picture below). This is used especially for columns which keep flag values.


When creating a table another important issue is the INDEX - in SQL a primary key. It usually is set as auto-increment. The options to do that are shown in the picture below:


Also, for table's columns which might contain diacritics (such as title and content for an article) you can define the needed collation.


If you find out you need more columns, you can write the number of extra needed columns in the text field in right bottom of the columns definition page and click Add, or if you finished defining the description of table's columns click Save. Now you can see the structure of the defined table as shown in the picture below. The actions that can be taken to a column(from left to right) are: Browse (view the values of that column), Edit, Delete, Make Primary key, Make Unique key, Fulltext (used in fulltext searches, available in MyISAM tables)



A detail regarding DATE fields. Per table can be defined one TIMESTAMP column. There also can be used INT(11) to manipulate fields containing date. In the picture below is edited the created_at column to be timestamp and the default value to be the current timestamp.



4. Insert data into table

When you click on Insert in the main tabs on the page (between Search and Export), you can put down the values for each column. The default null columns can contain no data, also the primary key or the columns which have defined a default value. After you insert the needed information, click Go. As you will see in the first image below, at the bottom of the columns editing there are some more actions you can take:
  • what action to be taken after insertion, Default is: "Go back to previous page". Another option here is "Insert another new row". You can choose this if you want to continue to insert values into the table.
  • Also, you can insert in one action more than 2 rows. "Restart insertion with n rows", The n can be selected from a list.
After you finish inserting you can Browse data into table (second image below).





5. Writing interrogation for data in tables
This is not so a "beginners" field, but for those who want to learn more about SQL queries, can read for a start here. To write SQL queries go to SQL tab and after you write the query, click on GO to run it.
Below are 2 examples:
1. How select only data which has flag is_published set on 1 (first picture, the query, second the select result)






2. for all rows which are not published (flag is_published is 0), make the content NULL



6. Export a database
Before you start "playing" with tables and queries a wise think to do is to Export the database, so you make sure you can recover the data if you mess up something. For that go to Export tab (between Insert and Import). You can backup data on the database's server or save them in a file (which can be used to import the database to another location).



7. Delete a database
On the top of the PhpMyAdmin page you can see some links which are a breadcrumb. Click on Server:your_server_name and now you have in the main tabs the option of databases. When click a list of all databases defined on server will be displayed. You can select the checkbox(es) for the database(s) you want to delete and click the red X button below the list (if you mouse over that button it will show you the text "Drop").
Note: to be able to delete a database the user you are logged in must have the privileges to do that action.



8. Create users and give them privileges for your databases
As mentioned above (section 7.) an user can have different privileges on a database. To define an user and set his rights on a database, go to Server link and choose Privileges. Here you can Add a new user or edit the already existing ones.
Note: be careful with what you set in this section. Don't give everyone the right to delete your databases:)



9. Import a database
If you exported a database and save it in a file, now you can go to another location (MySQL server) and import it there. In my example, I have dropped the for_example database and created a new one called second_example. Now I want to bring all I had in the first database into the second one with only 2 clicks (metaphorically speaking...or not!). Go to the new database where you want to do the import. First click would be on the Import tab (between Export and Designer). Select the file you created on the export of the first database. The second click should be on Go.