Jump to content

The Little Guy

Members
  • Posts

    6,675
  • Joined

  • Last visited

Posts posted by The Little Guy

  1. I have been building a home page, and I have a script that fades images out for a slide show.

     

    for testing purposes, I made two scripts, one uses jQueries fadeOut() function an another is a jQuery plugin I made without the use of fadeOut().

    While testing, I opened chrome's "background pages" tool, and watched the site. Whenever jQuery's fadeOut() function was triggered, the cpu went up to about 50%. When I tested my plugin the cpu only went up to 32%.

     

    jQuery's: ciaobellaphotography.us

    My jQuery plugin: ciaobellaphotography.us/index2.php

     

    Do you guys see any noticeable difference between the two or have any additional thoughts?

  2. That would be the same as having the background image not repeat wouldn't it?

     

    I still need a way for the images to cleanly display. IMO having the image centered like that isn't clean with something on the sides (if that makes sense).

  3. My sister is into photography, and is kinda doing it as a side business, so she asked me to builder her a site. The site isn't finished, but It has a full concept.

     

    Things to note:

    1. The images on the main page are not hers, they are just their for visuals and testing purposes.

    2. "About" is the only page with content ATM.

     

    If you have suggestions for pages I haven't done yet feel free to let me know!

     

    And the website: http://ciaobellaphotography.us/

  4. Once you go to a members profile, put a list of the other members on that page as well, that drop down has too many levels and takes to long to navigate to another members profile.

     

    Give the menu items an effect, such as a color and/or background color change on hover.

     

    Make the logo a link.

  5. doesn't register_shutdown_function exit the current script once the function is done though?

     

    If that is the case I can't have that. I added a lint test which seems to work I will then take the errors from that and save them to a custom error logging system.

  6. Parse errors shouldn't happen outside of development.

     

    I am making a CMS, and you can create plugins for it right within the CMS, and if while developing a plugin you have a syntax error it can bring the entire system to a halt making it so you can no longer edit the file unless you edit it externally.

     

    Or maybe you download a plugin that was poorly coded, that could bring the server to a halt too.

  7. That would trigger a parse error as soon as the file is loaded. I don't remember for sure but you might be able to trap the error with set_error_handler() and interrupt the script however you see fit (such as by throwing an exception). Maybe. If not then you'd have to run the file through php -l and look for complaints.

     

    Or you could just let the error happen. It's a parse error after all. It should never, ever happen in real code.

     

    set_error_handler doesn't catch these errors:

    E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING

     

    So the only thing I could also think of was doing exec("php -l filename.php");.

     

    But I feel it would be better not to if possible.

  8. I got it, but it didn't seem to do what I wanted.

     

    I am looking to skip calling call_user_func(array($this->$hook, $method)); if the calling function has an error in it, such as a missing simi-colon.

     

    Any way I can do that?

  9. I added this to one of my methods:

    try{
    $this->hooksFired++;
    call_user_func(array($this->$hook, $method));
    }catch($e){ // Line 32
    
    }

     

    and I am getting this error:

     

    Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR in C:\Users\Ryan\Documents\NetBeansProjects\cleepcms\cleepcms\classes\Hook.php on line 32

     

    I am not sure what is wrong, anyone know why I am getting that error?

  10. I have been told, if your using InnoDB, that using count(*) is VERY slow and you should replace the * with a primary key. If you are using MyISAM, it may be faster it may not IDK. I have never tested that though (on either Engines).

     

    Also make sure you indexed the values on the joins.

  11. I want navigation links that kind of flip I guess you would call it.

     

    If you take a look at this and click on the arrow on the right, then mouseover the items you will see what I am looking for:

    http://www.templatemonster.com/demo/39175.html

     

    I can't find anything on how to do this using jQuery. I am not even sure what to search for. Anyone know of a plugin, or how to code this? I also want to swap the text on mouseover/mouseout.

     

    Thanks!

  12. I did test it, and the results looked perfect.

     

    BTW, this function is a little different that the previous post

     

    function path_to_url($current_url, $path){
    $pathi = pathinfo($current_url);
    $dir = $pathi["dirname"];
    $base = parse_url(pathinfo($dir, PATHINFO_DIRNAME));
    $split_path = explode("/", $dir);
    $url = "";
    if(preg_match("/^\.\./", $path)){
    	$total = substr_count($path, "../");
    	for($i=0;$i<$total;$i++){
    		array_pop($split_path);
    	}
    	$url = implode("/", $split_path)."/".str_replace("../", "", $path);
    }elseif(preg_match("/^\/|^.\//", $path)){
    	$url = $base["scheme"]."://".$base["host"].$path;
    }elseif(preg_match("/^[a-zA-Z0-9]/", $path)){
    	if(preg_match("/^http/", $path)){
    		$url = $path;
    	}else{
    		$url = $dir."/".$path;
    	}
    }
    return $url;
    }
    
    $current = "http://mysite.com/awesome/sub/file.php";
    echo "<p><b>Current Location:</b> $current</p>";
    
    echo path_to_url($current, "../../sweet/file.php");
    echo "<br>";
    echo path_to_url($current, "../sweet/file.php");
    echo "<br>";
    echo path_to_url($current, "./sweet/file.php");
    echo "<br>";
    echo path_to_url($current, "/sweet/file.php");
    echo "<br>";
    echo path_to_url($current, "sweet/file.php");
    echo "<br>";
    echo path_to_url($current, "http://google.com");

  13. I wasn't sure if there was already something for this or not, but here is what I came up with:

     

    function path_to_url($current_url, $path){
    $pathi = pathinfo($current_url);
    $dir = $pathi["dirname"];
    $split_path = explode("/", $dir);
    $url = "";
    if(preg_match("/^\.\./", $path)){
    	$total = substr_count($path, "../");
    	for($i=0;$i<$total;$i++){
    		array_pop($split_path);
    	}
    	$url = implode("/", $split_path)."/".str_replace("../", "", $path);
    }elseif(preg_match("/^\//", $path)){
    	$url = $dir.$path;
    }elseif(preg_match("/^[a-zA-Z0-9]/", $path)){
    	if(preg_match("/^http/", $path)){
    		$url = $path;
    	}else{
    		$url = $dir."/".$path;
    	}
    }
    return $url;
    }

  14.  

    Off topic, but you can convert the following from this:

    if($type==2){
    $oldImage = imagecreatefromjpeg($originalImage);	
    }elseif($type==1){
    $oldImage = imagecreatefromgif($originalImage);	
    }elseif($type==3){
    $oldImage = imagecreatefrompng($originalImage);	
    }

     

    to this:

    $originalImage = "uploads/$fileName";
    $string = file_get_contents($originalImage);
    $oldImage = imagecreatefromstring($string);

     

     

    <?php
    $sql2 = mysql_query("INSERT INTO files (id, userid, fname, lname, email)
    	VALUES
    	('', '$lastInsertedId', '$first_name', '$last_name', '$email_address')") or die('Error: ' . mysql_error());
    
    $lastInsertedId = mysql_insert_id(); //lets make a thumb for all clients.
    
    $thumbDir = "uploads/thumbs/";
    $thumbWidth = 200;
    $fileExt = strtolower($fileExt);
    $originalImage = "uploads/$fileName";
    $details = getimagesize($originalImage) or die("invalid image format.");
    $newThumb = $thumbDir . $lastInsertedId ."_". $fileName;
    
    $scale_ratio = $width / $height;
    $thumbHeight = $details[1] * ($thumbWidth / $details[0]); 
    
    $string = file_get_contents($originalImage);
    $oldImage = imagecreatefromstring($string);
    
    echo $width. " "; echo $height ." "; echo $thumbWidth. " "; echo$thumbHeight;
    $thumb = imagecreatetruecolor($thumbWidth, $thumbheight);
    imagecopyresampled($thumb, $oldImage, 0,0,0,0, $thumbWidth, $thumbHeight, $width, $height);
    imagejpeg($thumb, $newThumb);

  15. no, I am scraping web pages for urls, and then saving them in a database

     

    and some urls look like this:

    <a href="/somewhere/file.php">Click Me</a>

    <a href="../../somepage/file.php">Click Me</a>

×
×
  • 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.