1. GD and WBMP

    Date: 03/01/05 (PHP Community)    Keywords: php

    Ok, so I'm trying to create a WBMP image on the fly. I want to add text to an already existing image. for some reason my code isn't working, it's just outputting the original image. here's my code:

    $im = imagecreatefromwbmp('diamonds.wbmp');
    imagestring($im, 5, 0, 0, "1", 0);
    header("Content-type: image/vnd.wap.wbmp");
    imagewbmp($im);

    to see this in action you can view just the WBMP output at http://wap.xenogame.com/image.php (or http://wap.xenogame.com for the file in context)

    Source: http://www.livejournal.com/community/php/267892.html

  2. Dictionary API?

    Date: 03/02/05 (PHP Community)    Keywords: php, web, google

    Hey,

    So I made this AIM bot using the PHP:TOC class that plays a word game. See, you give it a word, let's say "cow" and he replies with another 3 letter word that's different from your word by a letter, like "how". It gets its words from a list I found on the internet, about 26,870 words.

    Here's the thing: I wanna get it to learn new words. Let's say someone says "mow" after "cow" but it's not in the listing. Right now, it'll say that "mow" isn't a real word, but I want some way of verifying if in fact it is a real word, and adding it to the list. Is there some web API for dictionary.com or something similar I could talk to with PHP?

    I'm think Google API might do it, but I haven't gotten to poke around with it yet. Anyone familiar with that API? How easy is it to use with PHP5?

    Source: http://www.livejournal.com/community/php/268380.html

  3. Why Java is my language of choice?

    Date: 02/11/05 (Java Web)    Keywords: php, java

    Background I started my career with C then move to C++ and finally stuck on with Java ever since late 1995. I learnt other languages like VB, Basic, Fortran, Pascal (I loved it!) and recently php and some smattering of perl, lisp etc. Yes I also dabbled in C#. As you know structurally all [...]

    Source: http://blog.taragana.com/index.php/archive/why-java-is-my-language-of-choice/

  4. Decimal Unicode or Hex Unicode?

    Date: 02/25/05 (Mozilla)    Keywords: php, mysql, html, xml, sql

    Do any of you bright minds know WHY some programmers decide to use Decimal Unicode notation (e.g., Firefox), whereas others decide to use Hex Unicode notation (e.g. the Gnome/libxml2/xmllint folks)?

    My wish is that:

    1.) They had all gotten together and decided on just one,
    2.) They had all chosen Hex, padded on the left with zeroes so that all characters are represented by a full four digits (e.g.  rather than  for Â), the latter of which is NOT conformant to the Unicode specification, which requires four to six digits, not bloody darn one, two or three).

    I know they are functionally equivalent, and I know it's a simple mathematical calculation to go from one to the other, and that Perl and PHP both probably have built-in functions that I could use to convert from one to the other, but GRRRR. I long for consistency, and god forbid, standards-compliance.

    Also, why if Firefox smart enough to take UTF-8 input in an HTML form and convert it automatically to Decimal Unicode (which mySQL 4.0 can actually understand), but Safari is not smart enough (and of course, neither is I.E., duh).

    --

    Don't get me wrong, I don't hate Safari. Safari is FAR better than Firefox at rendering certain difficult Unicode glyphs, like Devanagari (Sanskrit) that has internal HTML markup inside conjunct consonants (Opera 6.03 comes close on this). However, when it comes to Hebrew, Greek, and Romanian (the others I've had to deal with recently), Firefox is just hands-down better.

    Source: http://www.livejournal.com/community/mozilla/254172.html

  5. PHP4 GD module on Debian

    Date: 02/11/05 (IT Professionals)    Keywords: php, mysql, sql, google

    Does anybody have experience setting up PHP4 on Debian (woody) such that the GD module is recognized?

    I've installed PHP4 and three modules: mysql, mcrypt, gd2:

    apt-get install php4
    apt-get install php4-mysql
    apt-get install php4-mcrypt
    apt-get install php4-gd2
    During the install process for php4-gd2, I was prompted to modify php.ini with "extension=gd.so". I answered "Yes". I then verified that the line was added to php.ini.

    However, if I view PHP's info, there's no "GD" section.

    And if I create a test PHP script utilizing a GD function, I get the following:
    Fatal error: Call to undefined function: imagecreatefrompng() in /var/www/cparker15/test.php on line 3
    Anybody know what I might be doing wrong? I've Googled and have come up with nothing. I'm thinking of asking on debian-user, but the last time I posted there, I didn't get any answers.

    crossposted to '[info]'debian

    Source: http://www.livejournal.com/community/itprofessionals/5053.html

  6. a JS question (lazy code format)

    Date: 03/01/05 (WebDesign)    Keywords: php, java

    Lazy formatting cause I cant recall how to show code, so here is the quick and dirty. Inherited site with clickable menu, client is nitpicking over the fact that the menu does not disapear when you click on another object.
    (source http://gateway.rossoptical.com/nav.htm )
    is there a simple way to pull this off? Drop down menu's with mouse over focus is not what the client wants (sadly).

    script type="text/javascript"
    function toggle(obj) {
    var menu = document.getElementById(obj);
    if (menu.style.display == 'none'){
    menu.style.display = 'block';
    } else {
    menu.style.display = 'none';
    }
    }
    /script


    a href="#" onclick="toggle('menu2')">DOUBLETS and TRIPLETS/a
    ul style="display: none;"
    li a href="./php/product-doublets_standard_achromats.php" target="mainFrame" Standard Achromats /a /li>
    li a href="./php/product-doublets_precision_aplanats.php" target="mainFrame" Precision Aplants /a /li>
    li a href="./php/product-doublets_negative_achromats.php" target="mainFrame" Negative Achromats /a /li>
    li a href="./php/product-doublets_laser_achromats.php" target="mainFrame" Laser Achromats /a /li>
    li a href="./php/product-steinheil_triplets.php" target="mainFrame" Steinheil Triplets /a /li>
    /ul

    Source: http://www.livejournal.com/community/webdesign/818419.html

  7. CSS Bug

    Date: 02/25/05 (WebDesign)    Keywords: php, software, html

    Here's a good one for you XHTML junkies...

    http://www.gearboxsoftware.com/index.php?p=gearblogs&entry=6

    Check out the image of the tank.. it's in a div that's floated right... and that div is also in a div that's floated left (to make the left column).

    The problem is - the image is linked. It works fine in IE, but you can't "get to" the link in firefox.

    The page validates... I don't *see* anything particularly odd...

    Does anyone know what's causing it?

    Source: http://www.livejournal.com/community/webdesign/814663.html

  8. T-SQL Function to strip HTML tags

    Date: 02/10/05 (SQL Server)    Keywords: php, html, sql, web

    My boss called me over and asked me to write a T-SQL function on behalf of our web guy, that would arbitrarily strip out all HTML tags from a VARCHAR. In any other language like PHP, Perl, etc., I'd employ Regular Expressions to do this globally. However, T-SQL only really has PATINDEX and CHARINDEX, those aren't all that powerful.

    I did wind up coming up with an iterative solution, which I thought I'd share with everyone to get suggestions and feedback.



    CREATE TABLE #tmpText (
    id INT IDENTITY(1, 1),
    data varchar(4000)
    )

    INSERT INTO #tmpText (data)
    VALUES ('this is some html')

    INSERT #tmpText VALUES (
    'Some Name


    SOME HTML text after the body'
    )

    INSERT #tmpText VALUES (
    'Another Name

    Another HTML text after the body'
    )

    -- WHILE a '<' and '>' pair are present and the former's position is less than the latter's position value
    -- Find a '<' then the next '>' positions, and run a stuff to remove whatever's in between!

    BEGIN TRANSACTION
    WHILE EXISTS (SELECT 1
    FROM #tmpText
    WHERE PATINDEX('%<%>%', data) > 0
    )
    BEGIN
    UPDATE #tmpText
    SET data = STUFF(data, PATINDEX('%<%>%', data), CHARINDEX('>', data) - PATINDEX('%<%>%', data) + 1, '')
    WHERE PATINDEX('%<%>%', data) > 0
    END

    SELECT *
    FROM #tmpText

    ROLLBACK



    I'm going to keep trying to dissect this in order to come up with a cleaner, non-iterative solution. If anyone else already has a function that does this in one fell-swoop, rather than via looping, PLEASE share it! :-)

    UPDATE: I've made further code changes to handle a few odd circumstances and have finished the function. Thought I'd share it with everyone for a "peer review." Please comment away!


    ALTER FUNCTION uf_stripHTML
    (
       @strHTML varchar(8000),
       @flgFormat int = 1
    )
    RETURNS varchar(8000)
    AS
    BEGIN

    --------------------------------------------------------------------------------------------------
    -- Date Written: 02-10-2005
    -- Purpose: Arbitrarily strip all text between all pairs of < > tags. This SHOULD be
    -- HTML but theoretically could be other data?
    ----------------------------------------------------------------------------------------------------
    -- Input Parameters: @strHTML = The string that we are stripping HTML from.
    -- @flgFormat = If set to 1 (DEFAULT), then the function will attempt to
    -- preserve basic formatting by detecting non-breaking spaces, start and end
    -- paragraph tags, and break-return tags, and replacing them with their
    -- ASCII equivalents.
    ----------------------------------------------------------------------------------------------------
    -- Comments: This solution employs an iterative algorithm to repeatedly sweep through
    -- the variable's text, removing HTML tags one at a time.
    ----------------------------------------------------------------------------------------------------

    DECLARE @ltPosition int

    -- If flgFormat is 1, then replace pre-determined list of tags and characters with
    -- corresponding values!
    IF @flgFormat = 1
    BEGIN
       SET @strHTML = REPLACE(@strHTML, '

    ', CHAR(10) + CHAR(13))
       SET @strHTML = REPLACE(@strHTML, '

    ', CHAR(10) + CHAR(13))
       SET @strHTML = REPLACE(@strHTML, '
    ', CHAR(10))
    END


    -- Arbitrarily replace &_nbsp; (intentionally mistyped)
    SET @strHTML = REPLACE(@strHTML, '&_nbsp;', CHAR(32))

    -- STRIP OUT HTML HERE
    WHILE (SELECT PATINDEX('%<[^ ]%>%', @strHTML)) > 0
    BEGIN
       -- Must search for the correct '>' because any unmatched ones will cause errors!
       SET @ltPosition = 0
       WHILE (PATINDEX('%<[^ ]%>%', @strHTML) > @ltPosition)
          SET @ltPosition = CHARINDEX('>', @strHTML, @ltPosition + 1)

       SET @strHTML = STUFF(@strHTML, PATINDEX('%<[^ ]%>%', @strHTML), @ltPosition - PATINDEX('%<[^ ]%>%', @strHTML) + 1, '')
    END

    RETURN @strHTML

    END
    GO

    Source: http://www.livejournal.com/community/sqlserver/17939.html

  9. Online Photo Gallery

    Date: 03/03/05 (WebDesign)    Keywords: php

    Can anyone recommend a good PHP based photo gallery, that's easily editable (header and footer), and can handle multiple file (or ideally folder) uploads at once.

    Thanks in advance.

    Andrej

    Source: http://www.livejournal.com/community/webdesign/819164.html

  10. Including an Invision Power Board login..

    Date: 03/03/05 (PHP Community)    Keywords: php, google

    Hi everyone!

    Now that my cookie problem is all fixed, I find myself with another delimma. Already. ;)

    I'd like to have an include on the main page of my site that would be something along the lines of, "Hello Name, you have 0 new private messages. Click to jump to the forums." Or, if the person visiting is not a member of the forums/not logged in, something like, "Hello guest, please login or register. [ login box ]"

    I'm sure this must be possible, I just can't seem to figure it out, and Google searches are turning up nothing. I am still new to PHP so you'll have to excuse me. :)

    I'm using Invision Board Board v1.3.

    Any help would be appreciated! Thanks in advance!

    Source: http://www.livejournal.com/community/php/268612.html

  11. uploaded site to client and this happens!

    Date: 03/03/05 (PHP Community)    Keywords: php, html, web

    All my php scripts or pages ending in PHP are not available to see. I get a 403 error saying...


    You are not authorized to view this page
    You might not have permission to view this directory or page using the credentials you supplied.

    --------------------------------------------------------------------------------

    If you believe you should be able to view this directory or page, please try to contact the Web site by using any e-mail address or phone number that may be listed on the www.cakesbytammy.com home page.

    You can click Search to look for information on the Internet.




    HTTP Error 403 - Forbidden
    Internet Explorer


    I also get this when I type in her domain name, minus the specific HTML file. suchas http://www.somedomain.com/ Any suggestions as to WTF is going on?!??!

    Source: http://www.livejournal.com/community/php/269157.html

  12. Quotes - Single or Double

    Date: 03/04/05 (PHP Community)    Keywords: php

    Just starting to switch over from Cold Fusion development to PHP development. I have a question about the apparent switchability between single (') abd double (") quotes. For instance, the following seem to be analagous:

    $str = 'string';
    $str = "string";


    Same with:

    $x = some_function('string');
    $x = some_function("string");


    But the following are not equal:

    $string = explode('\t', $string);
    $string = explode("\t", $string);


    Can anyone explain to me the differences between double and single quotes in PHP? When to use one and not the other? Still not sure what the real difference is between those two explode statements.

    Source: http://www.livejournal.com/community/php/269499.html

  13. column text wrapping?

    Date: 03/04/05 (WebDesign)    Keywords: php, programming, css, html

    i doubt you can do this.. but i was wondering if there was a way to use any sort of programming to text wrap between 2 columns.

    i have a page with 2 columns of text, side by side, and i don't want the white space at the bottom. however, since text is displayed differently on different platforms [mac and pc] i have to just leave it and increase the padding an paragraph set up specifically for the pc. i still have the white space and i can't stand it.

    so, i was wondering if anyone knew of any code to text wrap in html, css, js, php - anything - between columns.

    thanks :]

    Source: http://www.livejournal.com/community/webdesign/820379.html

  14. PHP Security Guide

    Date: 01/01/70 (Webmaster View)    Keywords: php, security, web

    The PHP Security Consortium is officially launched. The group's flagship project is a PHP Security Guide

    Via Web Security Blog

    Comments

    Source: http://www.webmasterview.com/programming/php_security_guide

  15. Lots of questions...

    Date: 03/05/05 (Computer Geeks)    Keywords: php, yahoo

    Okay... here goes:

    1.)PHP. Can someone please help me? I'm confused about it. See, I want to create a forum and a thing where you can post comments on articles of sorts, and maybe chatrooms, I'm not sure yet about that.

    2.)Videos. Is there any way I can take out the actual video part and just have the audio? Like converting it to .MP3?

    Thanks,
    Brad

    P.S. If you want to help me, my AIM screen name is imakebrainstew, my MSN screen name is imakepoprocksandcoke@hotmail.com, and my e-mail is bassilik@yahoo.com

    Source: http://www.livejournal.com/community/computergeeks/621211.html

  16. JAMA (for PHP)

    Date: 03/08/05 (PHP Community)    Keywords: php, java

    If you ever did any physics, engineering, or statistics work in Java, I'm sure you'll remember the classic Java Matrix package. We just finished porting it over to PHP over at phpMath.com, and the results are pretty cool. Anyone who's ever done clickstream modelling or any sort of complex online data analysis will really benefit from this package too. Just a few examples:

  17. With JAMA, you can perform a least-squares regression for an n-th degree polynomial - this function returns the coefficients of the polynomial. $X and $Y are arrays of x- and y-values and $n is the degree of the polynomial. Make sure you provide at least $n+1 values for each. Check out the test script here: http://phpmath.com/~jama/add-ons/polyfit.php.



  18. function polyfit($X, $Y, $n) {  
      if(count($X)!=count($Y) || count($X) < $n)
        return false;
      for ($i = 0; $i < sizeof($X); $i++)
    	for ($j = 0; $j <= $n; $j++)
    	  $A[$i][$j] = pow($X[$i], $j);
      for ($i=0; $i < sizeof($Y); $i++)
    	$B[$i] = array($Y[$i]);   
      $matrixA = new Matrix($A);
      $matrixB = new Matrix($B);
      return $matrixA->solve($matrixB);
    }
    



  19. Multivariate distributions are also a real breeze with JAMA. Check out how easy it is to calculate values for the probability distribution of a multivariate normal distribution, even when the correlation between variates is non-zero (e.g., not just the sum of the marginal probabilities). $a is the covariance matrix and $mu is the vector of means. This little snippet just iterates through [0,1] with Δ0.1, calculating the PDF for the standardized bivariate normal.



  20. $a = new Matrix(array(array(1, 0), array(0, 1)));
    $ai = $a->inverse();
    $sqadet = sqrt(pow(2*pi(), 2) * $a->det());
    $mu = new Matrix(1, 2, 0);
    for($i = 0; $i < 1; $i += 0.1) {
    $y = new Matrix(array(array_fill(0, 2, $i)));
    $y->minusEquals($mu);
    $yt = $y->transpose();
    $y = $y->times($ai);
    $y = $y->times($yt);
    $Q = -$y->get(0, 0) / 2;
    echo exp($Q)/$sqadet . '
    ';
    }
    We're also doing some work on implementing a complete statistical distribution library. They're both open-source community works, so if you're into this sort of thing, feel free to sign up for the mailing list and contribute too.

    Source: http://www.livejournal.com/community/php/270125.html

  21. Multidimensional Arrays

    Date: 03/08/05 (PHP Community)    Keywords: php

    Multidimensional arrays are kicking my ass. The book I have barely covers them and php.net is difficult to follow.

    If anyone could recommend a good site or book for this subject, please let me know!

    Source: http://www.livejournal.com/community/php/270465.html

  22. Kojo Nnamdi Show publicitiy

    Date: 03/09/05 (Mozilla)    Keywords: php, browser, security, web

    I know this isn't totally an advocacy group, but I think some of you might enjoy seeing the publicity that moz and firefox are getting. The Kojo Nnamdi show, on WAMU-FM
    (Howard University PBS radio) had a show on browsers today, and what I was able to catch of it sounded pretty positive to firefox. For a while they'll have a stream up on their web site: (updated edit: seems they're up for quite a while, the archive is back to 2003).

    http://www.wamu.org/programs/kn/index.php

    The Kojo Nnamdi show is always pretty interesting. Glad I found out about it. Too bad it wasn't in time for the show to post here so folks could call in or email. :( It aired Tuesday at 12.06 hours Eastern US time. On air were guests columnist Mark Kelner from the Washington Times (bleh ..to the paper not the columnist) and Alan Paller, research director of The Sans Institue (computer security).

    And if folks really don't want these kinds of posts, let me know. :)

    Source: http://www.livejournal.com/community/mozilla/259189.html

  23. chown and chmod

    Date: 03/09/05 (PHP Community)    Keywords: php, apache

    I'm using a script to upload files to my system. That means the files are created by Apache, and I can't access them with my FTP/SSH login. I need to back up the files uploaded, and mirror them.

    So, what I'm looking for is a simple (php) script to recursively chown, chgrp and chmod the files and folders on a given path.

    Yes, it's easy, and yes I could write it myself. But, I don't have time to do it tonight, and it's the kind of thing loads of people have hanging around, so if anyone has code they can 'lend' me to do the job that I can just run in the morning, that'd be great.

    Cheers.

    Source: http://www.livejournal.com/community/php/271272.html

  24. galleries!

    Date: 03/10/05 (WebDesign)    Keywords: php, mysql, sql, java, web

    so, my quest for the perfect gallery continues. my question to you all is this: what gallery applications do you use and what do you think of them? I prefer php and no need for mysql, but I'm open to other options. the only thing I'm adamant about is not using javascript. ;)


    x-posted to '[info]'webdesign and '[info]'webdev.

    Source: http://www.livejournal.com/community/webdesign/826746.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home