Updates from November, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • Shafiul Azam 12:06 am on November 24, 2010 Permalink | Reply
    Tags: free php wall, opensource wall code, php wall code   

    LanWall – Free PHP Comment Wall for LAN users! Opensource! 

    Live Demo Here!

    Screenshots:


    LanWall is a PHP-based project for creating community among users connected in a Local Area Network (LAN). Users can post messages in the wall and make replies.

    In administrative mode, admin can modify comments & posts, ban certain IPs, restrict access or reset anything.

    Pros:

    • Requires no database! You do not need any database server. Unzip and use!

    Cons:

    • Requires a web server, i.e Apache/Xampp. Requires PHP
    • Not coded in Object-oriented fashion, kinda hard to edit codes :(

    The product is released as opensource and can be redistributed or modified keeping the file license.php intact.

    OpenSource Project released by
    PROGmaatic Developer Network

    For bug reports feel free to mail the author


    Download Links

    Current Version: 1.0 beta:  Download from SourceForge.net

     
    • Sabuj kundu aka manchumahara 11:48 am on December 20, 2010 Permalink | Reply

      seems you work with Bahar :)

      • Shafiul Azam 12:35 pm on December 20, 2010 Permalink | Reply

        yup vaiya… thanks a lot for visiting n dropping comment :)

  • Shafiul Azam 1:10 pm on November 17, 2010 Permalink | Reply
    Tags: python equivalent for mysql_insert_id   

    Python MySQLdb equivalent for PHP’s mysql_insert_id() 

    What you’re looking for is lastrowid property of a cursor object.

    Code:

    import MySQLdb # MySQLdb module must be installed on the system
    connection = MySQLdb.connect(...) # Details skipped
    cursor = connection.cursor()
    query = "INSERT INTO ... " # put query here
    cursor.execute(query)
    print cursor.lastrowid # BINGO! This will print the id (auto-increment column) of the last inserted row
    # Other codes here
    

    Thanks to this article on the Internet

     
    • philihp 10:31 pm on February 12, 2012 Permalink | Reply

      I’m glad it was useful for someone :)

      • Shafiul Azam 11:46 pm on February 12, 2012 Permalink | Reply

        Haha…. lol :P

  • Shafiul Azam 12:23 pm on November 14, 2010 Permalink | Reply
    Tags: Cannot access empty property   

    PHP Fatal error: Cannot access empty property in 

    Are you trying to access any object’s property (variables/functions) using: $this->$property ?

    Check out the red $ should not appear before object properties. In contrast:

    <?php
    	class A{
    		$b = "some value";
    
    		public function get_b(){
    			return $this->$b;	// WRONG !!!
    		}
    	}
    
    	// Using the class
    
    	$myObject = new A();
    	echo $myObject-$get_b();	// WRONG!!!
    ?>
    

    the above code segment is wrong. You should use $ only once – before ‘ this’ only. No need to use $ sign before class variables or methods.

    Correct version of the above code segment:

    <?php
    	class A{
    		$b = "some value";
    
    		public function get_b(){
    			return $this->b;
    		}
    	}
    
    	// Using the class
    
    	$myObject = new A();
    	echo $myObject-get_b();
    ?>
    

     
    • Tom 9:50 pm on May 26, 2011 Permalink | Reply

      Good job man. Exactly what I needed. I find PHP’s OOP notation a little tricky coming from EMACS.

    • Shafiul Azam 2:09 am on May 27, 2011 Permalink | Reply

      :)

  • Shafiul Azam 1:11 am on November 13, 2010 Permalink | Reply
    Tags: c style for loop python, java style for loop in python, php for loop in python   

    C style For loop in Python 

    A for loop in C/C++/PHP/Java Or many well-known programming language will appear as:

    int loopStartVariable = 0;
    int loopEndVariable = 5;
    for(i=loopStartVariable; i < loopEndVariable; i++){
    	// do something with i
    }
    

    Python has no C-style for loop, which is has is for in loop like foreach loop available in PHP.

    To achive the same goal as the code snippet written in C above, we may write following code in python:

    loopStartVariable = 0;
    loopEndVariable = 5;
    for i in range(loopStartVariable, loopEndVariable):
    	# Do something with i
    print "loop ends here"
    

     
    • disappointed 8:31 pm on March 21, 2012 Permalink | Reply

      You just showed how the python for worked with ranges.
      Actually, c-style “for” loops are much more generic. Their shape is :
      for( initialisation statement ; end test ; post-iteration satement)
      Which allows complex things like :
      for (i=1,j=2 ; (i+j)%17 != 0 ; i=j+2i, j=3j-i)

      That’s what people are looking for when they ask about c-style for loops.

      • Shafiul Azam 11:25 pm on March 30, 2012 Permalink | Reply

        Hmm, agreed. :(

  • Shafiul Azam 11:24 am on November 8, 2010 Permalink | Reply
    Tags: 500 internal server error, , premature end, python cgi programming   

    Premature end of script headers 

    This is a pretty common error appearing in the Apache servers… along with the disgusting Error 500 – Internal server error on the browser. Usually the error indicates that it was unable to send necessary header information correctly.

    What makes the problem terrible – it does not explain much of the cause. The best way to solve this problem is to find your apache Log and examine it. Usually the log file is available in /var/log/apache2/error.log file in Linux.

    Examine the file for a detailed description. For example, if the error message is associated with preceding -

    (13)Permission denied: exec of ‘<location of  the file>’ failed

    • message, then your script is not marked as executable. Give file permission to run the file as executable, and your problem will be solved.

    What if you can’t find the LOG file?

    If you’re not allowed to access the log files in any server, then what to do? You may check the apache.conf file for the location of the log file (usually all hosting providers give access to error logs, you just need to find our where the file resides.) Ask your hosting provider for more help.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.