gon1387 22 Newbie Poster

hi chr.s,

I have just checked the code, and there was a bug in MaxImage, I'm currently rechecking the code and will be sending a fix to the developer.
Look at line 106 here: Max Image

//Instead of this
for(var i in $.Slides) {

//Change it to this
for(var i=0, len = $.Slides.length; i<len; i++) {

Apply the change above.

riahc3 commented: Nice find. +4
gon1387 22 Newbie Poster

Hi riahc3,

you can do the following to parse your string result, hopefully this will give you an idea on how to implement one.

var dataStr = "Name: Bob Last: Han Ken Age: 36#Name: George Last: Alan Age: 45#Name: Amy Last: James Age: 36#",
    storage;

// Split the string using '#' then remove the last empty element in the result
//  Afterwards, go through each results
storage = (dataStr.split("#")).slice(0,-1).map(
                // Check any name & value pattern then run through 
                //  each name and value string
                function(str){
                        return (str.match(/\w+:([\w ]+)(?![\w+:])/g)).map(
                            // Convert the name and value match to array
                            function(str){
                                    return str.match(/[\w]+(?=:)|[\w ]+/g);
                                })  ;
                    });

//Sample Result
[
[["Name"," Bob"],["Last"," Han Keno"],["Age"," 36"]]
...
]
// You just have to trim each values
// to access the value of name bob you have to do this storage[0][0][1], 
//  it will return " Bob"
riahc3 commented: Not too understandable but its the one Ill use for now +4
gon1387 22 Newbie Poster

jQuery thinks you're looking for #cart with attributes [1223686][qty].

if you want to look for that element, you have to specify the id attribute and value instead. Like this :

$j("[id='cart[1223686][qty]']").click(function() {
    alert("Handler for .click() called.");
});
gon1387 22 Newbie Poster

Hi delta_frost,

You have to do it this way, as on the initial load of the page, it can't find any set $_FILE["file"], in the $_FILE global. Why? there where no form submissions yet.

     if(isset($_FILES['file'])){
         $filename = $_FILES['file']['name'];
         $tempname = $_FILES['file']['tmp_name'];
          //echo $filename;
          $directory = 'E:/php_uploads/';
gon1387 22 Newbie Poster

Hi Faisal,
You can show the loading image right in the click event and use jquery's deferred method always() to hide the loading image. Here's a sample script:

$(document).ready(function() {
        $("#submit").click(function(){
            var acc = $("#accountNumber").val();
            src = "pass.php";
            //show your loading image
            $("#loading").show();
            $.ajax({
                url: src,
                data: 'action=account&type=viewDetail&accNo='+acc,
                cache: false,
                type:'GET',
                success: function(data, textStatus, XMLHttpRequest){
                    if(data!=0) {
                        $("#userInfo").html("");                        
                        $("#userInfo").css("display","block");
                        $("#userInfo").append(data);
                    }else {
                        $("#userInfo").html('');                        
                        $("#userInfo").append('<span class="alert-red alert-icon">Please Enter correct Account Number.</span>');
                        $("#userInfo").css("display","block");
                    }
                },
                error:function(XMLHttpRequest, textStatus, errorThrown){alert(textStatus); alert(errorThrown);}
            //hide your loading image
            }).always(function(){
                $("#loading").hide();
            });  
        });
});
gon1387 22 Newbie Poster

Hi pin89,

Here's a sample implementation and extraction from the data format you have.

var jsonData = [
        {"ID":10,"Duration":24235},
        {"ID":21,"Duration":9034},
        {"ID":12,"Duration":13681},
        {"ID":1,"Duration":23053},
        {"ID":13,"Duration":22863},
        {"ID":22,"Duration":57163}
    ];
//container for the idList and duration in array
var idList = [];
var durationList = [];

//Extract data from the recieved json data
for(var i=0, dataLen = jsonData.length; i<datalen; i++){
    idList.push(jsonData[i].ID);
    durationList.push(jsonData[i].Duration);
}

// Sample Kendo Chart Code
$("#chart").kendoChart({
    title: {
         text: "Duration by ID"
    },
    series: [
         { name: "Durations", data: durationList }
    ],
    categoryAxis:{
         categories: idList
    }
});
gon1387 22 Newbie Poster

If by what you mean "explicit website blocker" is programmatically blocking sites in your list; then, there goes the cons. I can't thought of any other pros except you have more control or options on this one.

For manually editing the host file, it's a systemwide approach, all users will share the same hostfile and all website being accessed will be blocked by the hostfile.

Here's a summary of CONS and PROS, assuming this one's in the context of a dedicated server, not virtual:

MANUALLY EDITING THE HOSTFILE

PROS

  • All users in the same system will share the host file, and updates to the hostfile will be a lot easier. Any additional blacklisted website will be blocked system-wide.
  • Any programs attempting to access the blacklisted website may or may not be able to run properly.
  • Blocking is done on the OS level.

CONS

  • You need to be admin or root to access and edit the files.
  • Editing might or will be a problem if you have virus scanners safe-guarding the file.
  • The same issue with the PRO, having a system-wide implementation of blocking website might be a burden for some benign programs who needs access. Especially if you're running the blacklisted website, hosting it on the same server. LOL.
  • Have to clear the DNS cache for some programs to use the updated host file, and sometimes, restart the server.
PROGRAMATICALLY EDITING THE HOSTFILE

PROS

  • You have more controll on how you will be handling the blacklist. A very …
gon1387 22 Newbie Poster

Hi diafol,
It was a typo:

function addInputs(){
    var str = '<label>MyNumber</label> <input class="numbertexbox" type="number" min="1" max = "20" value="7" /><br />';
    var numToAdd = parseInt($('#numinputs').val());
    $('#sync').before(str.repeat(numToAdd));
}

please check the class name in the input element. It has a missing 't' in 'text'.

$('#sync').click(function(e){
    e.preventDefault();
    // This one has 't'
    $('.numbertextbox').val('15');
});
diafol commented: hangs head in shame -thanks +14
gon1387 22 Newbie Poster

Hi mr0277,

If the problem was going beyond the table's bound, here's the code I edited: edited code

jQuery.fn.setTopAtClickedElement = function (element) {

    if (element.offset().top + this.height() > jQuery(document).height())
    {
      this.css('top', jQuery(document).height() - this.height() + 'px');
    } else {
      this.css('top', element.offset().top + 'px');
    }
};

You were always setting the top of the element based from it's parent's top or the current element's offsetTop. So the problem was, the moment you set the top of the lower elements, subsequently, the height of it's parent change. When you check if (element.offset().top + this.height() > jQuery(document).height()) the antecedent of your "if", the jQuery(document).height() and element.offset().top + this.height() have already been equal. To better explain this, please access this JS Fiddle Example and open your console.

mr0277 commented: The problem was solved, the explanation was short and concise, and above all the solution was illustrated with two jsfiddle examples. If life was like this one wouldn't have to bother at all. Thank you, very much +0
gon1387 22 Newbie Poster

Hi Webville, I think you mistook the second 's' character as a dollar sign.

Hi Hwoarang,
Simplypixie was right, you should make the $_post all-caps. Change it to $_POST

ERRATA:
Hi Webville, you were right. LOL
Hoarang, you are also echoing the wrong variable. See line 15 and 16 of your sample.

gon1387 22 Newbie Poster

Eventhough we have our own preference in programming, the style or language we use, it's better to explore all/some options, for us to know what's best on a partic stituation. What I mean is it's better for us to spend time to explore different avenues of learning and commiting mistakes, so for us to save time in the future; than staying or sticking into what we know and commiting the same mistakes without any other options of selecting a better solution for a particular situation. To cut it short, spend time to save time. :D

Anyway, I almost thought your script was a background work though, with all the number of stuffs running. If you want it modular, why not make the pos_create modular in a way you create a funtion out of it. Then, just call the function instead of including the same file all over. In that way, you save resources for including the file multiple time.

include 'pos_funcs.php'; \\Where your pos_create() is

while(...){
    pos_create(..some arguments...);
}
gon1387 22 Newbie Poster

It is taxing local resources?

YES

Here's a simple example:
inc.php

<?php

echo "Hello World!";

includePerfCheck.php

<?php
$count = 0;

$start = memory_get_peak_usage();
while($count<1000){
    include 'inc.php';
    $count++;
}
$end = memory_get_peak_usage();

echo "<br />".$start."::".$end;

simpleRunCheck.php

<?php
$count = 0;

$start = memory_get_peak_usage();
while($count<1000){
    echo  "Hello World!";
    $count++;
}
$end = memory_get_peak_usage();

echo "<br />".$start."::".$end;

Run the includePerfCheck.php and simpleRunCheck.php.
I hope it clearly tells how bad-a$$ including a lot of script is. :D
Anyway, just a question how many includes are we talking about, with your script?
If possible can you show us your script?

gon1387 22 Newbie Poster

You can use HTML5's localStorage/ Cookie if you want it to be retained. you can do the following steps

  1. Passively/Actively save the option value to localStorage/cookie
  2. Refresh
  3. Check which radio button was selected, then put a "checked" tag
gon1387 22 Newbie Poster

Executing external scripts.

By the way I just found one, this one's an extention. pthreads

Anyway, I'm gonna try this one too. Thanks you too for opening this thread up. :D

gon1387 22 Newbie Poster

It's ok. :)

Anyway, the problem with how you echo your table is it really wanted to show a one column table. It's structure looks like this:

<table>
<tr>
    <td>... [IMAGE] ...</td>
</tr>
<tr>
    <td>... [USERNAME] ...</td>
</tr>
<tr>
    <td>... [PRICE] ...</td>
</tr>
<tr>
    <td>... [IMAGE] ...</td>
</tr>
<tr>
    <td>... [USERNAME] ...</td>
</tr>
<tr>
    <td>... [PRICE] ...</td>
</tr>
<tr>
    <td>... [IMAGE] ...</td>
</tr>
<tr>
    <td>... [USERNAME] ...</td>
</tr>
<tr>
    <td>... [PRICE] ...</td>
</tr>
</table>

And this is what you currently have.

What you need is a structure like this one
Sample Structure in Table 1
Sample Structure in Table 2

gon1387 22 Newbie Poster

Please use "and" than "than" in you sentence, especially when you're not comparing. Sorry if I sound rude, but I just want to help you out so people will be able to better understand and help you as well.

Anyway, I do understand that you wanted to place the path of your image in your image tag. But what we need to know if you were able to access the images using the path you provided in your image tag. Say if your path is "/IMAGE/ITEMS/" and your image filename is "a.png", you can access your image in your browser through:
http://localhost/IMAGE/ITEMS/a.png
See the difference?
Now, if you can access the image, you shouldn't have any problem displaying it in the IMG tag. By the way, put the '/' before your image path: from this src='IMAGE/ITEMS/$image_folder_name_db' to this src='/IMAGE/ITEMS/$image_folder_name_db'

Let us know what happened.

gon1387 22 Newbie Poster

So what you mean is it contains the actual filename of the images. And once $image_folder_name_db is resolved, example $image_folder_name_db = "myImage.jpeg". The src='IMAGE/ITEMS/$image_folder_name_db would echo this src='IMAGE/ITEMS/myImage.jpeg"?

If so, you have to check and access your image with a relative path in your Browser like this:
http://yourdomain.com/IMAGE/ITEMS/myImage.jpeg

Make sure to change the filename. Then if you can't access it, be sure the path and your image exist in your Web Doc Root. Otherwise, you have a problem of either, a misplaced or non-existent images or worse having a misconfigured server.

Tell us your findings, though. So we can help. :)

gon1387 22 Newbie Poster

Your HTML code for your image is correct, but I want to know if your
$image_folder_name_db
says what it is, just a folder? or misnamed vatiable of image filename?

you have to have this as an output, for you to view an image. (example in JPEG format)
<img src='IMAGE/ITEMS/someImageFilename.jpeg' />

gon1387 22 Newbie Poster

pritaeas tutorial's a good one, it explains the fundamentals a lot. It's pretty much a good start before diving into google.
pritaeas OOP tutorial

gon1387 22 Newbie Poster

skip non php strandard variable

What I mean by this, str_split produces numerical array. So if you're going to put it to extract, it'll be disregarded.

But then, it'll take time extracting all the value. you can just use str_split alone, to optimize your code, and put all splitted value in the database.

gon1387 22 Newbie Poster

You can use str_split(). And extract, except that extract will skip non php strandard variable. You can just run through the array and assign a key on each value. Let me know if you got this, I'll be happy to create an example if you want to.