Skip to main content

Posts

Showing posts from May 10, 2012

Most elegant way to force a TEXTAREA element to line-wrap, *regardless* of whitespace

Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line breaks (eg.: even if it results in "loooooooooooo \n ooooooooooong").

Can I debug PHP files under Eclipse PDT without using Apache?

I have just installed Eclipse PDT 3.0.2 (I don't know what Eclipse base this is, Galileo or Helios), and have been enjoying the step up from NetBeans. In getting more serious about my PHP development (I have recently expanded from only ASP.NET), I decided to move from editing my PHP files directly under my Xampp Apache doc root (htdocs), and have created a workspace under my usual source location, c:\development.

How to print on already printed paper from a webpage?

i have already printed pages of A4 size in printer image is attached! now i want to print data in blank fields from webpage any one guide me how to achieve this?

Why all my files are not cached with apc op code?

I'm using APC (3.1.9) and Zend Framework, however, only a bunch of file are being cached (something like 10 / 400).

PHP weird Seg-faults on mysqli_stmt_bind_result

When migrating a PHP script from PHP 5.2 to PHP 5.3, I've stumbled to the following problem: The general purpose of the script is data mining. I have a procedure inside that adds data to the MySQL server. Since it is really repetitive, I've rewritten it (a while ago) to use MySQLi, in particular prepared statements, since there are a total of 3 possible queries to perform. Anyway, now, on the PHP 5.3 server, the script is crashing on the following line:

Is it bad to declare an empty class?

In my spare time, I am building a Sudoku solver to try to get the hang of OOP in PHP. A Sudoku puzzle, for those of you who don't know, is in its most common form a 9x9 matrix of numbers from 1 to 9, with 3x3 squares delineated in a tic-tac-toe like pattern. Some numbers are filled in in advance. The goal of the puzzle is to fill in the remaining numbers, so that no row, column or 3x3 square contains the same number more than once.

Does PHP have a built in optimizer?

Like how MySQL Optimizer will convert queries into more efficient queries as it sees fit, is there a similar optimization process going on behind the scenes with PHP? Where PHP takes your code, analyzes it and converts it to be more efficient all before executing it?

Few questions about PHP sessions

I have a few a few question about php sessions: Since the default value for session.gc_maxlifetime is 24 mins then that means any session file that isn't modified for 24 mins will be deleted and the session will expire automatically.

PHP unlink function

This is the code $query = mysql_query("SELECT avatar FROM users WHERE UserID = ".$userID.""); $row = mysql_fetch_array($query); $user_avatar = trim($row['avatar']); unlink($user_avatar);

MySQL Query doesn"t update rows

I've got a weird problem here. I've been trying to find out whats wrong for several hours now. I've got a function that should update a table in my database and set the "date_vente" (date_sold for english) to NOW(). The query is mighty simple but it keeps reporting 1 matched row, 0 changed.

Validating URL in Java

I wanted to know if there is any standard APIs in Java to validate a given URL? I want to check both if the URL string is right i.e. the given protocol is valid and then to check if a connection can be established.

Java constructor with large arguments or Java bean getter/setter approach

I can't decide which approach is better for creating objects with a large number of fields (10+) (all mandatory) the constructor approach of the getter/setter. Constructor at least you enforce that all the fields are set. Java Beans easier to see which variables are being set instead of a huge list. The builder pattern DOES NOT seem suitable here as all the fields are mandatory and the builder requires you put all mandatory parameters in the builder constructor.

How to improve the builder pattern?

Motivation Recently I searched for a way to initialize a complex object without passing a lot of parameter to the constructor. I tried it with the builder pattern, but I don't like the fact, that I'm not able to check at compile time if I really set all needed values.

Android: TextView automatically truncate and replace last 3 char of String

If a String is longer than the TextView's width it automatically wraps onto the next line. I can avoid this by using android:singleLine (deprecated) or by setting android:inputType="text" . What I now need is something that replaces the last 3 characters of my String with " ... ". Since I'm not using a monospace font this will always be different depending on the letters used in my String. So I'm wondering what's the best way to get the last 3 characters of a String in a TextView and replace them. Maybe there's already something implemented in the Android framework, since this must me a common problem.

Eclipse as an IDE - What do you find missing as a beginner in Java?

I am working on a solution that aims at solving problems that newbie programmers experience when they are "modifying code" while bug fixing / doing change requests, on code in production. Eclipse, as we all know is a great IDE. Features such as Code Completion, Open Declaration, Type Hierarchy, Package Explorer, Navigator, Finding References etc aids people in fixing things quicker compared to say using something like Textpad.