Sun Sep 23 12:58:22 2018
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2015-01-01

LEARN

2018-09-23 | 2018-08-23 | 2018-07-23 | 2018-06-23 | 2018-05-23 | 2018-04-23 | 2018-03-23 | 2018-02-23 | 2018-01-23 | 2017-12-23 | 2017-11-23 | 2017-10-23 | 2017-09-23 | 2017-08-23 | 2017-07-23 | 2017-06-23 | 2017-05-23 | 2017-04-23 | 2017-03-23 | 2017-02-23 | 2017-01-23 | 2016-12-23 | 2016-11-23 | 2016-10-23 | 2016-09-23 | 2016-08-23 | 2016-07-23 | 2016-06-23 | 2016-05-23 | 2016-04-23 | 2016-03-23 | 2016-02-23 | 2016-01-23 | 2015-12-23 | 2015-11-23 | 2015-10-23 | 2015-09-23 | 2015-08-23 | 2015-07-23 | 2015-06-23 | 2015-05-23 | 2015-04-23 | 2015-03-23 | 2015-02-23 | 2015-01-23 | 2014-12-23 | 2014-11-23 | 2014-10-23

Key: id Value: 542872

Key: archive_learn Value: 2015-01-01

MESSAGE
DATE 2015-01-29
FROM Ruben
SUBJECT Re: [LIU Comp Sci] Operating System Interupts
From owner-learn-outgoing-at-mrbrklyn.com Thu Jan 29 22:20:29 2015
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: by mrbrklyn.com (Postfix)
id 555F31612E4; Thu, 29 Jan 2015 22:20:29 -0500 (EST)
Delivered-To: learn-outgoing-at-mrbrklyn.com
Received: by mrbrklyn.com (Postfix, from userid 28)
id 4079D1612E7; Thu, 29 Jan 2015 22:20:29 -0500 (EST)
Delivered-To: learn-at-mrbrklyn.com
Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47])
by mrbrklyn.com (Postfix) with ESMTP id 6BAC51612E4
for ; Thu, 29 Jan 2015 22:20:28 -0500 (EST)
Received: by mail-qa0-f47.google.com with SMTP id n8so18361053qaq.6
for ; Thu, 29 Jan 2015 19:20:27 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
:subject:references:in-reply-to:content-type
:content-transfer-encoding;
bh=AZ4/C6nIsXkfmteGGFBzdl2cqnzkKMEcxgJyA8cN/Ng=;
b=BzdXiLykc/aJqyEdQYyxKDuOLwWn7E6AHZaOgehfvDkxN0xZMGdBWAhJuXar0VzotO
aneB5qTka7tKXZ9AqVQ9acx/J1DBkPCHovWq3dRQnB80Bp8BIIXddPYkf9m/10bYaGoc
rOhRGvBKfE8kFtDFU0azYCwexupmN1aaasJDu3HX6IZtKgYvq+3MxnTw5q6FueblVnZJ
wcQEI7ttW/tUsEktVbRVZpghdkLUQiWsrYommtTw5gCuuoivMBR/JSwCkvt+1ztra8IH
oso9ZXx3k+txnlHxVMgZbtkh3jmGGoTy+8+Miky7UwaVzoz/HYD9Qd2yHeUd+vUtQCYO
8Blg==
X-Gm-Message-State: ALoCoQkoXU83ia8effgAciDn+c+M5Azzpm6aSCdUR7RUY3p+ae9U/yaJMnc3IeB6P1xImt0M0p+v
X-Received: by 10.229.249.137 with SMTP id mk9mr8492641qcb.4.1422588027619;
Thu, 29 Jan 2015 19:20:27 -0800 (PST)
Received: from [10.0.0.19] ([96.57.23.82])
by mx.google.com with ESMTPSA id 11sm8858796qgt.41.2015.01.29.19.20.27
for
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 29 Jan 2015 19:20:27 -0800 (PST)
Message-ID: <54CAF87A.2070505-at-my.liu.edu>
Date: Thu, 29 Jan 2015 22:20:26 -0500
From: Ruben
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version: 1.0
To: learn-at-mrbrklyn.com
Subject: Re: [LIU Comp Sci] Operating System Interupts
References: <54CAAE57.1030900-at-panix.com> <54CAF652.5050609-at-panix.com>
In-Reply-To: <54CAF652.5050609-at-panix.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Sender: owner-learn-at-mrbrklyn.com
Precedence: bulk
Reply-To: learn-at-mrbrklyn.com

FWIW - Here is Lew in action
You won't find this in the database class, that is for sure...


https://groups.google.com/forum/#!topic/comp.databases.mysql/zCfMAXjDJA0

richard
6/19/14

Thanks for the code. It works fine except one or two things.
where a field contains a single quote, an error is generated.


Warning: mysqli_error() expects exactly 1 parameter, 0 given

Cant INSERT into table tracker, key=07-11-2014 60-003, asid=60-003. MySQL
error : Cathy's Clown...Everly Brothers, The Warning: mysqli_errno()
expects exactly 1 parameter, 0 given

All other entries produce the parameter error as well.

As for the date thing, I have decided to use the Julian calendar rather
than the Gregorian.Makes sorting easier.

BTW, in the $iresult section, you showed each new line beginning with ."
Not needed in php.


if ($con=mysqli_connect("localhost","","",""))
{
$dt = "07-11-2014";

for ($n = 0; $n < 100; ++$n)
{
$asid = sprintf("60-%03u",$n);
$key = sprintf("%s %s",$dt,$asid);

if ($result = mysqli_query($con,"SELECT * from sixty where sid =
'$asid'"))
{
$row = mysqli_fetch_assoc($result);
printf("%s...%s
$t = $row['title'];
$a = $row['artist'];

if (empty($a)) $a='x';

$iresult = mysqli_query($con,"INSERT INTO tracker
(event,date,songID,track,artist,hits)
VALUES
('$key','$dt','$asid','$t','$a',1)
ON DUPLICATE KEY UPDATE hits=hits+1");

if (!$iresult) printf("Cant INSERT into table tracker, key=%s,
asid=%s. MySQL error %s: %s",
$key, $asid, mysqli_errno(), mysqli_error());

}

else printf("Cant SELECT from table sixty, sid %s. MySQL error %s:
%s",
$asid, mysqli_errno(), mysqli_error());

}

mysqli_close($con);
}
else printf("Failed to connect to MySQL: Error %s: %s",
mysqli_errno(),mysqli_error());
Doug Miller
6/19/14

richard > wrote in
news:1wxtk83sxy8qy$.131kkds0czpxy.dlg-at-
40tude.net :

> Thanks for the code. It works fine except one or two things.
> where a field contains a single quote, an error is generated.

So fix it. Sheesh. He warned you that it was untested.
>
>
> Warning: mysqli_error() expects exactly 1 parameter, 0 given
>
> Cant INSERT into table tracker, key=07-11-2014 60-003, asid=60-003. MySQL
> error : Cathy's Clown...Everly Brothers, The Warning: mysqli_errno()
> expects exactly 1 parameter, 0 given

That's a pretty clear description of the problem, isn't it?

Lew, dontcha just love the way he's practically demanding that you fix
something you gave
him for free? "ATTN: Lew Pitcher"
Lew Pitcher
6/19/14

On Thursday 19 June 2014 09:18, in comp.databases.mysql, "richard"
> wrote:

> Thanks for the code. It works fine except one or two things.
> where a field contains a single quote, an error is generated.
>
> Warning: mysqli_error() expects exactly 1 parameter, 0 given

Oops. Looks like I goofed, when I changed your calls from
mysqli_connect_error()/mysqli_conect_errno() to
mysqli_error()/mysql_connect_errno().

The connection failure case /should/ use mysqli_connect_*() (as you had
them), and not mysqli_*() (as I had them). Please see /*C*/ in the code
below.

The other mysqli_ failures should use mysqli_error()/mysqli_errno() as I
had
intended, but with the connection parameter specified (which I missed).
Please see /*B*/ in the code below.

> Cant INSERT into table tracker, key=07-11-2014 60-003, asid=60-003. MySQL
> error : Cathy's Clown...Everly Brothers, The Warning: mysqli_errno()
> expects exactly 1 parameter, 0 given

This would be because none of the source data fields were "escaped".
This is
the same as the original code you posted. On writing to the database
(INSERT/UPDATE), you (we) need to "sanitize" input data to ensure that the
data will not interfere with the SQL (unescaped quotes, for instance,
causing premature closing of quoted fields). You do this by first passing
the data through the mysqli_real_escape_string() function, before passing
it to the query or bind.
See http://www.php.net/manual/en/mysqli.real-escape-string.php
for details.
Also, see /* A */ in the code below

> All other entries produce the parameter error as well.
>
> As for the date thing, I have decided to use the Julian calendar rather
> than the Gregorian.Makes sorting easier.
>
> BTW, in the $iresult section, you showed each new line beginning with ."
> Not needed in php.
>
>
> if ($con=mysqli_connect("localhost","","",""))
> {
> $dt = "07-11-2014";
>
> for ($n = 0; $n < 100; ++$n)
> {
> $asid = sprintf("60-%03u",$n);
> $key = sprintf("%s %s",$dt,$asid);
>
> if ($result = mysqli_query($con,"SELECT * from sixty where sid =
> '$asid'"))
> {
> $row = mysqli_fetch_assoc($result);
> printf("%s...%s
/* A
** changed from straight assignment to assignment through
** mysqli_real_escape_string()
*/
$t = mysqli_real_escape_string($con,$row['title']);
$a = mysqli_real_escape_string($con,$row['artist']);

> if (empty($a)) $a='x';

> $iresult = mysqli_query($con,"INSERT INTO tracker
> (event,date,songID,track,artist,hits)
> VALUES
> ('$key','$dt','$asid','$t','$a',1)
> ON DUPLICATE KEY UPDATE hits=hits+1");
>
> if (!$iresult) printf("Cant INSERT into table tracker, key=%s,
> asid=%s. MySQL error %s: %s",
// $key, $asid, mysqli_errno(), mysqli_error());
/*B*/ $key, $asid, mysqli_errno($con), mysqli_error($con));

>
> }
>
> else printf("Cant SELECT from table sixty, sid %s. MySQL error %s:
> %s",
// $asid, mysqli_errno(), mysqli_error());
/*B*/ $asid, mysqli_errno($con), mysqli_error($con));
> }
>
> mysqli_close($con);
> }
> else printf("Failed to connect to MySQL: Error %s: %s",
// mysqli_errno(),mysqli_error());
/*C*/ mysqli_connect_errno(), mysqli_connect_error());

--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

Lew Pitcher
6/19/14

On Thursday 19 June 2014 09:31, in comp.databases.mysql, "Doug Miller"
- show quoted text -
I fix what I break. He has a valid argument for asking.

Of course, he /could/ take the initiative, find and fix the problems,
and be
one up on me here. :-)
- show quoted text -
Lew Pitcher
6/19/14

On Thursday 19 June 2014 09:18, in comp.databases.mysql, "richard"
> wrote:

> Thanks for the code. It works fine except one or two things.
[snip]

Richard,

If you would like to discuss this offline, you can always email me.
- show quoted text -
Doug Miller
6/19/14

Lew Pitcher > wrote in
news:zTBov.4706$Id2.1366-at-fx05.iad:

> On Thursday 19 June 2014 09:31, in comp.databases.mysql, "Doug Miller"
> > wrote:
>> Lew, dontcha just love the way he's practically demanding that you fix
>> something you gave him for free? "ATTN: Lew Pitcher"
>
> I fix what I break. He has a valid argument for asking.

I don't understand why you're helping him at all -- history tells us
that he is not capable of
learning, and will be back next week with another problem -- but of
course that's your affair.
richard
6/19/14

- show quoted text -
Trust me, I tried fixing it.
Problem being that there are to many variables to figure out which one is
the correct paramater.
richard
6/19/14


Thanks. It all works just fine now.

I've seen various codes for "sanitizing" strings, yours is so far the
cleanest and most straight forward approach.
I believe I have learned a few new tricks here.
Lew Pitcher
6/19/14

On Thursday 19 June 2014 10:16, in comp.databases.mysql, "richard"
> wrote:

>
> Thanks. It all works just fine now.
>
> I've seen various codes for "sanitizing" strings, yours is so far the
> cleanest and most straight forward approach.

Not mine, but thanks for the credit.

This is just a standard part of the mysqli API to MySQL, provided for
exactly this purpose.

> I believe I have learned a few new tricks here.

Perhaps this is a good thing :-)
- show quoted text -
Denis McMahon
6/19/14

On Thu, 19 Jun 2014 10:08:49 -0400, richard wrote:

> Problem being that there are to many variables to figure out which one
> is the correct paramater.

If you read the function help for mysqli_error(). i's pretty obvious what
it expects for the parameter.

--
Denis McMahon, denismf...-at-gmail.com

  1. 2015-01-01 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] databse normalzation resources
  2. 2015-01-04 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Future of Computer Education
  3. 2015-01-04 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: [NYLXS - HANGOUT] Future of Computer Education
  4. 2015-01-21 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] pinging new semester...
  5. 2015-01-21 duodujames <duodujames-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  6. 2015-01-21 Maneesh Kongara <maneeshkongara-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  7. 2015-01-21 duodujames <duodujames-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  8. 2015-01-21 Maneesh Kongara <maneeshkongara-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  9. 2015-01-21 duodujames <duodujames-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  10. 2015-01-21 Maneesh Kongara <maneeshkongara-at-gmail.com> RE: [LIU Comp Sci] pinging new semester...
  11. 2015-01-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] pinging new semester...
  12. 2015-01-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] pinging new semester...
  13. 2015-01-21 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] pinging new semester...
  14. 2015-01-21 duodujames <duodujames-at-gmail.com> Re: [LIU Comp Sci] pinging new semester...
  15. 2015-01-21 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Class Virtual Machine
  16. 2015-01-21 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] pinging new semester...
  17. 2015-01-22 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  18. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  19. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  20. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  21. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  22. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  23. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  24. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  25. 2015-01-22 Ruben <ruben.safir-at-my.liu.edu> Re: [LIU Comp Sci] Normalization review
  26. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  27. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  28. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  29. 2015-01-22 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  30. 2015-01-22 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  31. 2015-01-22 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  32. 2015-01-22 Sergei Glikstein <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  33. 2015-01-22 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  34. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] study hall today
  35. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Algorithms Assignment 1 attempt
  36. 2015-01-22 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Algoritms
  37. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  38. 2015-01-23 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  39. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  40. 2015-01-23 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  41. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
  42. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  43. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  44. 2015-01-23 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  45. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  46. 2015-01-23 From: "Serge Glikstein" <serge.gl-at-gmail.com> Re: [LIU Comp Sci] Normalization review
  47. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Normalization review
  48. 2015-01-23 Kamran <kamran.mirzayev-at-my.liu.edu> Re: [LIU Comp Sci] study hall today
  49. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Re: [NYLXS - HANGOUT] Linux Job Crunch
  50. 2015-01-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Software compexity and history - must see video
  51. 2015-01-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Weather Emergency!!
  52. 2015-01-28 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] making the class up on the fly
  53. 2015-01-28 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] making the class up on the fly
  54. 2015-01-28 Tony Genao <tony.genao-at-my.liu.edu> Re: [LIU Comp Sci] making the class up on the fly
  55. 2015-01-28 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] making the class up on the fly
  56. 2015-01-28 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] making the class up on the fly
  57. 2015-01-28 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] making the class up on the fly
  58. 2015-01-28 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] NYLUG Open hacker hours
  59. 2015-01-28 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Operating Systems gibberish
  60. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] making the class up on the fly
  61. 2015-01-29 muhammad rizwan khalid <rizwankhalid316-at-gmail.com> Re: [LIU Comp Sci] making the class up on the fly
  62. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] making the class up on the fly
  63. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating System Interupts
  64. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating System Interupts
  65. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating System Interupts
  66. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating System Interupts
  67. 2015-01-29 Ruben <ruben.safir-at-my.liu.edu> Re: [LIU Comp Sci] Operating System Interupts
  68. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] LIU mailing list FAQ
  69. 2015-01-29 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] nixCraft Linux / UNIX Newsletter
  70. 2015-01-29 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Operating System Interupts
  71. 2015-01-30 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Operating System Interupts
  72. 2015-01-31 Maneesh Kongara <maneeshkongara-at-gmail.com> Re: [LIU Comp Sci] Linked List Homework
  73. 2015-01-31 Ruben Safir <mrbrklyn-at-panix.com> Re: [LIU Comp Sci] Linked List Homework
  74. 2015-01-31 Ruben Safir <mrbrklyn-at-panix.com> Subject: [LIU Comp Sci] Linked List Homework
  75. 2015-01-31 mrbrklyn-at-panix.com Subject: [LIU Comp Sci] linkedlist example

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!