Last visited

Community Reputation

About fatkatie

@#$@#$@!
You spend all day on something that has nothing to do with anything. It was a stupid join.
mb_check_encoding
But, I would like to know if mb_check_encoding() is worth anything. I've relied on binding which has never failed me.
Thank you.

while ($pending || $row = $sth->fetch(PDO::FETCH_OBJ)) {
$pending = false;
$hn = $row->houseid;
writeData("READ $hn", __FILE__, __LINE__);
}
There's the loop. houseid starts repeating. I found the record but I don't see anything wrong yet. Newlines? I'm going to rewrite the record with the check and see what that does.

I just started populating a mysql table with data collected from a form posting. I do the dance ...
$post_partnumber_source = html_entity_decode(trim(fvs($_POST['nsel_pnsrc'])));where fvs is
function fvs($string){$string = filter_var($string, FILTER_SANITIZE_STRING); return $string; }
And then I use PDO and binding.
Something has happened. Something bad.
My PHP $sth->fetch(PDO::FETCH_OBJ) loops are failing. All the records are not
being read (some seem to be read twice)... and it happens around the record when form input was starting to be used.
It's got to illegal data messing this up. So, my question is, what now?
Will
mb_check_encoding()
solve this or am I missing something very basic.
Thank you.
mysql Ver 15.1 Distrib 10.1.37-MariaDB, for Win32 (AMD64), Using configuration as supplied by xampp

I have a search function that finds parts. It's a callback that constructs a new form with all items found contained in a table. This form/table is returned and appended to the html using this (within a div element)
jQuery('#iddiv_searchresultsarea').empty().append(html);
Each of the input text areas, available for updating, has a proper element id. Here's an example row (within a table; within a form):
<tr>
<td>73T3590</td>
<td>Hinge, Blum Plus</td>
<td><input type="text" id="idin_loc_73T3590" value="A206" maxlength="20" size="4"></td>
<td><input type="text" id="idin_qty_73T3590" value="1" maxlength="20" size="4"></td>
<td>
<button class="btn btn-primary" type="button" id="idbut_73T3590" name="nbut_73T3590" value="UPDATE" onclick="updateStock('73T3590')">
</button></td>
<td>Blum Hinge Plus Inserta Full O/L 110 Deg</td>
<td>no image</td>
</tr>
For some reason, jQuery does not see any of this. javascript getElementById() works just fine. Here is a simple snip of the problem:
function updateStock(pn) {
var qty_value = document.getElementById('idin_qty_263.16.705').value;
alert("qty value " + qty_value); // ok
jQuery(document).ready(function() {
var stock_qty = jQuery('#idin_qty_263.16.705').val();
alert("stock qty " + stock_qty ); // undefined
.
.
.
Do I have to do something else after the append to 'sync' up the page? Or is this a scope issue that I won't figure out until next week.
Thanks.

I had no idea! Scope, closure, hoisting ... I really don't know this stuff.
I did get the function parameter pn into the jQuery part by simply assigning it as in (ff65):
function updateStock(pn) {
alert("here is the pn: " + pn);
var mypn = pn;
jQuery(document).ready(function() {
alert("I want to see pn here: " + mypn);
});
}
Lots of reading and re-reading to do.
Thanks

The onclick event is set to call a javascript function. I need to use jQuery within that javascript function. Is that possible?
Thank you.
function updateStock(pn) {
alert("here is the pn: " + pn);
jQuery(document).ready(function() {
alert("I want to see pn here: " + pn);
});
}

I have to move to W10 from my beloved W7 box. I found that most software I used on W7 is ported for W10 but I didn't find a free mysql Toad for W10. I really loved that thing. The web based 'workbench' is so clunky. Is there a free toad out there to work with mysql? Please suggest alternatives if you have something you like. (using xampp mysql) Thank you.

I just replaced the single line if using the second index array with a single value. It's still slower.
$val = 22;
while($count_samples--) {
//if ($a_true_and_false[$count_samples] && $a_random_int_stuff[$count_samples]) {
if ($a_true_and_false[$count_samples] && $val) {
$hit_1_count++;
}
}
Done. Out.

I'm not trying to undermine gizmola here. It's a fine answer. But since the topic of recognizing a name showed up, here's an interesting post: in_array vs strpos for performance in php. It concerns the fastest way to find that needle (within some constraints).
https://stackoverflow.com/questions/21070691/in-array-vs-strpos-for-performance-in-php#21070786
If posting links are not welcome here, administrator, feel free to nuke the post. Thanks.

barand - yah, I think you're correct. Timing the loop may be the best way. There are just too many things going on. I imagine the second assignment might change according to optimization rules - of which I have no clue. I'll try a few later. My bet? These will run at different speeds. We'll see. But ...
Will microtime return the time spent actually executing? What if there is a process swap?
For others, I should have stated the changing value was an integer. I've always wondered about the word 'redundant' as it relates to verbose. (Does RTFM mean what I think it does? )
Thanks again.

This is simple curiosity. I'd like to know if someone really knows the answer. I've always been suspicious of performance testing with loops.
I have a loop in php. Within that loop I act based on two values, let's call them MOSTLY_FALSE and ALWAYS_CHANGING.
Given MOSTLY_FALSE is seldom true, is the second "double" IF faster than the 'single', or will the short-circuit take care of it? I sometimes code with the double form just to let people know that truth is exceptional. Thanks.
(Just curious.)
if ( MOSTLY_FALSE == true && ALWAYS_CHANGING == 1) {
// do this exceptional thing
}
if ( MOSTLY_FALSE == true) {
// access ALWAYS_CHANGING for the first time (is a field returned in sql query
if (ALWAYS_CHANGING == 1) {
// do this exceptional thing
}
}

navbar breakpoint stuff. I have 'linear' lists, as menu items, that vary in length, and if they wrap before the nav 'breaks' the contents leak. I guess I can mess about dynamically with it's breakpoint setting. Was just wondering if I could do it myself. Thanks.