יום חמישי, 23 באוקטובר 2014

quick mysqli dev tip

if you get the following error in
/var/log/nginx/error.log
/var/log/apache2/error.log

PHP Fatal error:  Call to a member function bind_param() on a non-object in /var/www/functions.php on line #



most chances are its due to a bad mysql query you are trying to bind your parameter to...

i wasted 2 hours figuring that out after changing a function to a procedure and forgetting to change the invocation to call instead of select :P

 update (nginx):

2014/11/12 11:09:51 [error] 1726#0: *33 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to a member function bind_param() on a non-object in /var/www/functions.php on line 96" while reading response header from upstream, client: 10.0.0.6, server: localhost, request: "POST zzz.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.0.0.126"

another bad query with an ambiguous error

יום שבת, 29 בדצמבר 2012

Best (hebrew supporting) E-reader for android

I have found the best E-reader for android:

ideal group reader, it is still in beta stages but it is awesome!
has the following:
  1. javascript support
  2. hebrew support
  3. epub3 support
  4. hebrew ordered list support!!
    but that is interesting only to those who like me , are trying to read epubs in hebrew on their android devices :)


    יום שבת, 1 בדצמבר 2012

    the best way to learn BFS


    best BFS and DFS lecture ever, made this ruby BFS implementation as a tribute :P

    יום שבת, 17 בנובמבר 2012

    makefile cheatsheet

    kinda chaotic i know, but i made it for myself :P

    under binsem.a
     "gcc -c binsem.c"  creates the binsem.o 
    binsem.o is then inserted by ar into libbinsem.a
    then ranlib does some indexing (not a must afaik)

    libbinsem.a is then used by the first gcc command where you see -lbinsem.
    if you want to use a static lib that doesnt have the lib prefix -lbinsem can be replaces with binsem.a for example if you want to call it binsem.a 

    like so:

    ph: ph.c binsem.a
        gcc ${FLAGS} ph.c binsem.a -lut -o ph
    binsem.a:
        gcc $(FLAGS) -c binsem.c
        ar rcu binsem.a binsem.o
        ranlib binsem.a


    here is the makefile itself:

    #all: binsem.a ut.a ph
    FLAGS = -Wall -Werror  -L./


    ph: ph.c binsem.a
        gcc ${FLAGS} ph.c -lbinsem -lut -o ph


    binsem.a:
        gcc $(FLAGS) -c binsem.c
        ar rcu libbinsem.a binsem.o
        ranlib libbinsem.a


    ut.a:
        gcc $(FLAGS)  -c ut.c
        ar rcu libut.a ut.o
        ranlib libut.a

    clean:
        rm -f *.o
        rm -f a.out
        rm -f *~
        rm -f ph
        rm -f *a

    יום שישי, 24 בפברואר 2012

    Php Old spice Joke


    //hello, programmers, look at your string
    // now back to mine
    // now back to your string
    // now back to mine
    $foo = "0";  
     // sadly it isnt mine
    // but if you stopped using strict typing it could look like mine
    // look down , back up , where are you
    // you're on a site , with the string your string could look like
    //whats in your Text Editor now back at me  
    $foo += 2;
    // its a 2 Integer made from the string you love
    $foo = $foo + 1.3;  //(3.3)
    // look again the Integer is now a FLOAT
    // anything is possible when you are using weakly typed languages...
    // and not ADA
    $foo = "I'm on a horse"


    יום שבת, 7 בינואר 2012

    תוכנת חקר טקסט SEO (חזרת ביטויים)

    כתבתי איזה תוכנה קטנה ברובי שבודקת חזרה של ביטויים בטקסט , נגיד יש לי את הטקסט הבא....
    "משה הלך לגן, קנה לו פנקס צ'קים. כחלון הלך לגן , קנה לו פרחים"
    התוצאה:
    הלך לגן 2
    קנה לו 2

    אפשר להגדיר כמה מילים שבא בביטויים , אבל בטקסטים ממש גדולים תהיה איטיות
    הרצתי את התוכנה על טקסט של 6000 מילים כשהיא בודקת את כל הביטויים מ6 מילים ומטה וזה לקח 1.8 שניות (הרבה בזמן מחשב, למי שמעוניין לדעת I3 4G-RAM)

    הלינק לתוכנה שכתבתי:
    https://github.com/solekiller/Programming/blob/master/ruby/ngrams.rb

    מה שהאלגוריטם שלי עושה הוא, שהוא בצורה יעילה עושה טבלאות גיבוב מהביטויים שבטקסט ולכל שדה של ביטוי מעלה את הקאונטר פעם אחת כשהוא נפגש איתו בטקסט... אנשים אחרים היו מנסים שיטות אחרות, אבל בעולם האמיתי הן איטיות מאוד.
    נראה לי (תקנו אותי אם אפשר יותר מהר) שזו השיטה הכי מהירה לחקור טקסט.

    לדעתי זה האלגוריטם הכי מהיר שאפשר לפתח (לפחות ברובי), מי שיש לו הצעות אני אשמח לשמוע, ומי שרוצה שאני אצור ממשק משתמש ולא רק ממשק למתכנתים יכול לבקש ממני אני אשמח להוסיף משהו קטן ודבילי :)

    יום רביעי, 31 באוגוסט 2011

    גנבו סרטיפיקט SSL של גוגל והוא הגיע לידי איראן

    או במילים אחרות, עכשיו אפשר לפרוץ לכם לחשבון ג'ימייל בלי שתהיה אזהרה ולו הכי קטנה של הדפדפן :)
    בעזרת סרטיפיקט שנראה לגיטימי התוקף יכול לגרום לכם לחשוב שהחיבור לג'ימייל מאובטח כרגיל ואף לדפדפן ולכן לא תצוץ שום הזהרה, בהחלט החיבור יהיה מוצפן אבל הוא יצא מהצפנה כשיגיע לידיו של התוקף ויחזור שוב להצפנה אחריו וממנו יזוז לג'ימייל
    או במילים אחרות, גם אחרי המתקפה לא תדעו מה קרה :)


    פתרון?
    בנתיים אין פאטש אז כל מה שאפשר לעשות זה להוריד את הסטריפיקט ידנית מהרשימה של הסרטיפיקטים המאושרים של הדפדפן שלכם ולמנוע מאיראנים "חביבים" להכנס לכם לחיים :)

    שם הסרטיפיקט הוא digiNotar
    בפיירפוקס: -
    Edit -> Preferences -> View Certificates
    גללו עד הסרטיפיקט המתאים והסירו אותו (delete or distruct)
    (השם digiNotar יופיע)
    אם לא בא לכם להסירו אפשר גם לערוך את האמון בו edit trust
    אבל אני די בטוח שזה לא מספיק (לא רוצה להתחייב עד שלא בדקתי)