Jump to content

bibby

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Posts posted by bibby

  1. [code]Database error in Utopia News Pro:

    Invalid SQL Query: SELECT `varname` , `value` FROM `unp_setting`
    MySQL Error: Table 'dev_portal.unp_setting' doesn't exist

    MySQL Error Number: 1146

    Date: January 21, 2007 08:20 AM
    Script: /portal/news/news.php
    [/code]
  2. To go a little further,

    Say you had a generic class called red

    [code].red{
      background-color:#902100;
    }[/code]


    [code]
    <li class="red"></li> ..
    <td class="red"></td> ..
    <span class="red"></span> ..
    <span class="blue"></span> ..[/code]
    [list][*]You code apply that to many types of tags.[/list]

    If you wanted to beforehand in the css, you could call them out by tag and id.

    [code]span .red{  font-size:1.6em;  }[/code]
    [list]
    [*]This line only effects spans that are "red"
    [/list]

    [i]tag & class[/i] are one way to further divide class and id. It all depends on how many children you want your elements to have. Inheritence.

    I try to use classes for things that I'll most likely reuse, and ids for the known one-timers.
    That said, the more I use javascript, the more that I'm dropping [b]id[/b]s all over the place. I'll try to find a way to style away from the script. The last thing you need is style and javascript breaking together.

  3. This will write the actual new file.
    I've done this before, and I've always had to refresh the browser make it kick in.

    [code]<?
    //include_once(me?)
    //******** styleWrite.php [ ?col=336699 ]
    // look for this file to be written:
    $newFilename='styles.css';

    $content='body{background-color:#'.$_GET['col'].';}';

    $loc=$_SERVER['DOCUMENT_ROOT'].'/'.$newFilename;

    if( ($copy=fopen($loc,'w')) != FALSE)
    {
    fwrite($copy,$content);
    fclose($copy);
    $message= "I think i got it" . $loc;
    echo $content;
    }
    else $message= "couldnt open destination file";
    echo "<!-- " .$message." -->";


    ?>[/code]
  4. Here's a script that'll do better.
    It'll output all the html as it is, AND hook you up with a local hard copy.

    [code]<?

    //set these yourself//
    $newFilename='copy.html';
    $url= 'http://dev.mastercontrolprogram.org';


    if($f=file_get_contents($url))
    {
    $loc=$_SERVER['DOCUMENT_ROOT'].'/'.$newFilename;

    if( ($copy=fopen($loc,'w')) != FALSE)
    {
    fwrite($copy,$f);
    echo $f;
    fclose($copy);
    $message= "I think i got it" . $loc;
    }
    else $message= "couldnt open file";
    }
    else
    $message= "i dont know about ".$url;

    echo "<!-- " .$message." -->";
    ?>[/code]
  5. put this in your post handler.

    [code]
    $body= "Someone posted this \n";

    foreach($_POST as $k=>$v)
    {
      $body.= "[$k] => $v \r\n";  //<-- for mail, you may want the carriage return \r
    }


    mail ('you@yours.com',$body,'From: yourfile@yours.com');[/code]
  6. phpinfo() should make some mention of GD.

    To evaluate farther, try testing functions

    [code]
    function test($fxn)
    {
      if (function_exists($fxn))
          echo "Yep. I have $fxn <br />\n";
      else
          echo  "No sir-ee Bob, no $fxn for you <br />\n";
    }

    test('imagecreate');
    test('imagecreatefromgif');
    test('imagepng');
    // test ect..
    [/code]
  7. It sounds like you have a similar setup than I do on my laptop.

    http://localhost/  ==  C:\www\Apache\htdocs

    I keep a directory outside of htdocs where I keep htaccess password files and sql connects, but for the most part, htdocs has everything else. How you then setup your site is up to you, but since I have multiple projects with only one address, I have a directory for each.

    /htdocs/projectA/

    and these generally have the same subdirs

    /htdocs/projectA/cls
    /htdocs/projectA/css
    /htdocs/projectA/js
    /htdocs/projectA/docs
    and maybe
    /htdocs/projectA/tpl
  8. I'm support, not dev just so that's clear.
    At the workplace, there's a system of flags for users stored as a decimal integer, but represent bits.
    0001 means that the first flag is raised therefore the DB stores 1 (person A)
    0100 means the same for the third, and stores 4 (person B)
    0111 , first three flags raised , so I get 7. (person C)
    This I understand, and it's not the problem. We have 50 or so flags and it makes things pretty easy.

    What I don't get is the query we use to find out who has what flag raised..
    (example structure: id tinytext, bit bigint)

    If persons A,B, and C were in the database with the values 1,4,7 above, and I wanted to know who among
    them has the third flag raised, we query

    select id from persons where (bit & 4)=4;
    It returns B, C

    To get the first flag,
    select id from persons where (bit & 1)=1;
    It returns A, C

    It works like a charm,  but I can't for the life of me wrap my head around how the query statement finds what I'm looking for. Can anyone explain to me what is going on in "where(bit & 4)=4" ?

    Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.