li:hover doesn't get triggered
I haven't done this in a long time and I looked it up aswell but when I
hover over an li I expect its child UL to open up (display), but it isn't:
<nav>
<ul>
<li><a href="#">Products <img
src="~/Shared/Assets/Images/LIItemArrow.png" /></a>
<ul>
<li>Hi</li>
</ul>
</li>
<li><a href="#">Services <img
src="~/Shared/Assets/Images/LIItemArrow.png" /></a></li>
<li><a href="#">Shop <img
src="~/Shared/Assets/Images/LIItemArrow.png" /></a></li>
</ul>
</nav>
CSS:
ul li ul { display: none; }
ul li:hover > ul {
display: block;
}
According to the several articles I looked up, I believe that I'm doing
this right, so why won't this work?
Bushorn
Sunday, 1 September 2013
Why I got this MySql Error on update sql
Why I got this MySql Error on update sql
I have a table like.
CREATE TABLE `chart` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`item` char(6) NOT NULL DEFAULT '',
`IsLeaf` char(1) NULL DEFAULT 'Y',
`ParentId` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
)
Where parentId contains an id of another row , which is the parent of that
row Like
-----------------------------------------------------------------
| Id | item | IsLeaf | ParentId
-----------------------------------------------------------------
| 1 | Test1 | D |
-----------------------------------------------------------------
| 2 | Test3 | D |
-----------------------------------------------------------------
| 3 | Test4 | D | 1
-----------------------------------------------------------------
| 4 | Test5 | D | 1
-----------------------------------------------------------------
I want to update those rows which have at least one child row. I tried
like this
UPDATE chart AS c1 SET c1.IsLeaf='Y' JOIN chart c2 ON c2.ParentId=c1.id;
and got this error
[Err] 1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'JOIN chart c2 ON c2.ParentId=c1.id' at line 1
I have a table like.
CREATE TABLE `chart` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`item` char(6) NOT NULL DEFAULT '',
`IsLeaf` char(1) NULL DEFAULT 'Y',
`ParentId` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
)
Where parentId contains an id of another row , which is the parent of that
row Like
-----------------------------------------------------------------
| Id | item | IsLeaf | ParentId
-----------------------------------------------------------------
| 1 | Test1 | D |
-----------------------------------------------------------------
| 2 | Test3 | D |
-----------------------------------------------------------------
| 3 | Test4 | D | 1
-----------------------------------------------------------------
| 4 | Test5 | D | 1
-----------------------------------------------------------------
I want to update those rows which have at least one child row. I tried
like this
UPDATE chart AS c1 SET c1.IsLeaf='Y' JOIN chart c2 ON c2.ParentId=c1.id;
and got this error
[Err] 1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'JOIN chart c2 ON c2.ParentId=c1.id' at line 1
Operating System tuned for High Performance Computing
Operating System tuned for High Performance Computing
I am trying to write efficient kernels in the area of scientific
computing. I use C. I do not know which operating system is better to
obtain correct timing results; since I do not want daemons, etc. to
interrupt my code. When I run my code, the CPUs of the system should
execute only my code.
I have installed Ubuntu Server on the systems that I test my code on. Is
there a document that shows how to tune Ubuntu for high performance
computing (HPC)? Or is there any other OS which is freely available for
HPC?
I am trying to write efficient kernels in the area of scientific
computing. I use C. I do not know which operating system is better to
obtain correct timing results; since I do not want daemons, etc. to
interrupt my code. When I run my code, the CPUs of the system should
execute only my code.
I have installed Ubuntu Server on the systems that I test my code on. Is
there a document that shows how to tune Ubuntu for high performance
computing (HPC)? Or is there any other OS which is freely available for
HPC?
Saturday, 31 August 2013
uploading all data in a database row
uploading all data in a database row
I'm trying to display all my table rows in an ordered fashion
database table = u_visits
rows = id/ip_adress/visits/dates
here is my code:
<html>
<body>
<?php
include 'includes/connect3.php';
$result = mysqli_query($con,"SELECT * FROM u_visits");
$num = mysqli_num_rows($result);
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td>
<font face="Arial, Helvetica, sans-serif">Value1</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value2</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value3</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value4</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value5</font>
</td>
</tr>
<?php
$i=0;
while ($i < $num) {
$f1 = mysqli_result($result,$i,"id");
$f2 = mysqli_result($result,$i,"ip_adress");
$f3 = mysqli_result($result,$i,"visits");
$f4 = mysqli_result($result,$i,"dates");
?>
<tr>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font>
</td>
</tr>
<?php$i++;}
?>
</body>
</html>
Thanks in advance for all your help! If this is not the way to go about
for what im trying to accomplish i am open to new suggestions Thanks
again.
I'm trying to display all my table rows in an ordered fashion
database table = u_visits
rows = id/ip_adress/visits/dates
here is my code:
<html>
<body>
<?php
include 'includes/connect3.php';
$result = mysqli_query($con,"SELECT * FROM u_visits");
$num = mysqli_num_rows($result);
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td>
<font face="Arial, Helvetica, sans-serif">Value1</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value2</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value3</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value4</font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif">Value5</font>
</td>
</tr>
<?php
$i=0;
while ($i < $num) {
$f1 = mysqli_result($result,$i,"id");
$f2 = mysqli_result($result,$i,"ip_adress");
$f3 = mysqli_result($result,$i,"visits");
$f4 = mysqli_result($result,$i,"dates");
?>
<tr>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font>
</td>
<td>
<font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font>
</td>
</tr>
<?php$i++;}
?>
</body>
</html>
Thanks in advance for all your help! If this is not the way to go about
for what im trying to accomplish i am open to new suggestions Thanks
again.
Implement universal, lightweight, and unobtrusive tagging of arbitrary objects?
Implement universal, lightweight, and unobtrusive tagging of arbitrary
objects?
I'd like to implement a universal, lightweight, and "unobtrusive" way to
"tag" arbitrary objects.
More specifically, I want to define the equivalent of the (abstract)
functions tag, isTagged, and getTagged, such that:
isTagged(t) is true if and only if t was the value returned by tag(o), for
some object o;
getTagged(tag(o)) is identical to o, for every object o;
if t = tag(o), then tag(t) should be identical to t;
with the exception of the behaviors described in (1), (2), and (3) above,
and strict identity tests involving ===, tag(o) and o should behave the
same way.
For example:
>>> isTagged(o = "foo")
false
>>> isTagged(t = tag(o))
true
>>> getTagged(t) === o
true
>>> tag(t) === t
true
>>> t.length
3
>>> t.toUpperCase()
"FOO"
Below I give my best shot at solving this problem. It is (almost)
universal, but, as it will soon be clear, it is anything but
lightweight!!! (Also, it falls rather short of fully satisfying
requirement 4 above, so it is not as "unobtrusive" as I'd like. Moreover,
I have serious doubts as to its "semantic correctness".)
This solution consists of wrapping the object o to be tagged with a "proxy
object" p, and copying all the properties of o (whether "owned" or
"inherited") to p.
My question is:
is it possible to achieve the specifications given above without having to
copy all the properties of the tagged object?
Here's the implementation alluded to above. It relies on the utility
function getProperties, whose definition (FWIW) is given at the very end.
function Proxy (o) { this.__obj = o }
function isTagged(t) {
return t instanceof Proxy;
}
function getTagged(t) {
return t.__obj;
}
var tag = (function () {
function _proxy_property(o, pr) {
return (typeof pr === "function")
? function () { return pr.apply(o, arguments) }
: pr;
}
return function (o) {
if (isTagged(o)) return o;
if (typeof o.__obj !== "undefined") {
throw TypeError('object cannot be proxied ' +
'(already has an "__obj" property)');
}
var proxy = new Proxy(o);
var props = getProperties(o); // definition of getProperties given below
for (var i = 0; i < props.length; ++i) {
proxy[props[i]] = _proxy_property(o, o[props[i]]);
}
return proxy;
}
})();
This approach, ham-fisted though it is, at least seems to work:
// requirement 1
>>> isTagged(o = "foo")
false
>>> isTagged(p = tag(o))
true
// requirement 2
>>> getTagged(p) === o
true
// requirement 3
>>> tag(p) === p
true
// requirement 4
>>> p.length
3
>>> p.toUpperCase()
"FOO"
...well, almost; requirement (4) is not always satisfied:
>>> o == "foo"
true
>>> p == "foo"
false
>>> o == o
true
>>> p == o
false
FWIW, here's the definition of the function getProperties, which is used
by the tag function. Criticisms welcome. (WARNING: I'm a completely
clueless JS noob who doesn't know what he's doing! Use this function at
your own risk!)
function getProperties(o) {
var seen = {};
function _properties(obj) {
var ret = [];
if (obj === null) {
return ret;
}
try {
var ps = Object.getOwnPropertyNames(obj);
}
catch (e if e instanceof TypeError &&
e.message === "obj is not an object") {
return _properties(obj.constructor);
}
for (var i = 0; i < ps.length; ++i) {
if (typeof seen[ps[i]] === "undefined") {
ret.push(ps[i]);
seen[ps[i]] = true;
}
}
return ret.concat(_properties(Object.getPrototypeOf(obj)));
}
return _properties(o);
}
objects?
I'd like to implement a universal, lightweight, and "unobtrusive" way to
"tag" arbitrary objects.
More specifically, I want to define the equivalent of the (abstract)
functions tag, isTagged, and getTagged, such that:
isTagged(t) is true if and only if t was the value returned by tag(o), for
some object o;
getTagged(tag(o)) is identical to o, for every object o;
if t = tag(o), then tag(t) should be identical to t;
with the exception of the behaviors described in (1), (2), and (3) above,
and strict identity tests involving ===, tag(o) and o should behave the
same way.
For example:
>>> isTagged(o = "foo")
false
>>> isTagged(t = tag(o))
true
>>> getTagged(t) === o
true
>>> tag(t) === t
true
>>> t.length
3
>>> t.toUpperCase()
"FOO"
Below I give my best shot at solving this problem. It is (almost)
universal, but, as it will soon be clear, it is anything but
lightweight!!! (Also, it falls rather short of fully satisfying
requirement 4 above, so it is not as "unobtrusive" as I'd like. Moreover,
I have serious doubts as to its "semantic correctness".)
This solution consists of wrapping the object o to be tagged with a "proxy
object" p, and copying all the properties of o (whether "owned" or
"inherited") to p.
My question is:
is it possible to achieve the specifications given above without having to
copy all the properties of the tagged object?
Here's the implementation alluded to above. It relies on the utility
function getProperties, whose definition (FWIW) is given at the very end.
function Proxy (o) { this.__obj = o }
function isTagged(t) {
return t instanceof Proxy;
}
function getTagged(t) {
return t.__obj;
}
var tag = (function () {
function _proxy_property(o, pr) {
return (typeof pr === "function")
? function () { return pr.apply(o, arguments) }
: pr;
}
return function (o) {
if (isTagged(o)) return o;
if (typeof o.__obj !== "undefined") {
throw TypeError('object cannot be proxied ' +
'(already has an "__obj" property)');
}
var proxy = new Proxy(o);
var props = getProperties(o); // definition of getProperties given below
for (var i = 0; i < props.length; ++i) {
proxy[props[i]] = _proxy_property(o, o[props[i]]);
}
return proxy;
}
})();
This approach, ham-fisted though it is, at least seems to work:
// requirement 1
>>> isTagged(o = "foo")
false
>>> isTagged(p = tag(o))
true
// requirement 2
>>> getTagged(p) === o
true
// requirement 3
>>> tag(p) === p
true
// requirement 4
>>> p.length
3
>>> p.toUpperCase()
"FOO"
...well, almost; requirement (4) is not always satisfied:
>>> o == "foo"
true
>>> p == "foo"
false
>>> o == o
true
>>> p == o
false
FWIW, here's the definition of the function getProperties, which is used
by the tag function. Criticisms welcome. (WARNING: I'm a completely
clueless JS noob who doesn't know what he's doing! Use this function at
your own risk!)
function getProperties(o) {
var seen = {};
function _properties(obj) {
var ret = [];
if (obj === null) {
return ret;
}
try {
var ps = Object.getOwnPropertyNames(obj);
}
catch (e if e instanceof TypeError &&
e.message === "obj is not an object") {
return _properties(obj.constructor);
}
for (var i = 0; i < ps.length; ++i) {
if (typeof seen[ps[i]] === "undefined") {
ret.push(ps[i]);
seen[ps[i]] = true;
}
}
return ret.concat(_properties(Object.getPrototypeOf(obj)));
}
return _properties(o);
}
Windows 8 Custom Autorun Flashdrive
Windows 8 Custom Autorun Flashdrive
I recently got a new flash drive that I am devoting entirely to my
programming work (mainly python).
Because I use my flash drive all of the time, I have a lot of important
documents that I have on my flash drive, that would be disastrous to lose.
The nature of my job, however, is that I am constantly switching
computers, and sometimes don't have time to upload documents I worked on
to the cloud as a backup. Plus downloading of some of my projects can take
quite a bit of my time if I'm working on a large project, so using only a
cloud storage system like dropbox would be bad. What I want to do is
create a python autorun script so that the moment I plug in my flashdrive,
it uploads the program files in the background while I work in the
foreground. The actual python script I will ask about later, if I have
troubles.
Right now, however, my issue is getting autorun to work. I looked up a
bunch of tutorials and followed their instructions to the letter about
creating autoruns and batches and such, but every time I try to run the
program when I plug in my flashdrive, Windows 8 (my home computer) tells
me there's a problem with the flashdrive and asks if it can scan and
repair it.
autorun.inf:
[Autorun]
open=autorun.bat
icon=python.ico
label=PythonDrive
autorun.bat:
"Portable Python 2.7.5.1\Python-Portable.exe" "autorun.py"
I have the files all in the main directory of the flashdrive. The icon and
label command seem to work for my flashdrive, but if I get rid of the open
command, the computer still complains. I would prefer just executing the
python without a batch, but I was hoping that a batch file might work
better than a python file being executed from portablepython. the batch
file does work, if I manually open it.
I found this article which mentions that you can no longer (in windows 7)
use the open command in autorun.inf. Is this true? If so, how do I work
around it?
I recently got a new flash drive that I am devoting entirely to my
programming work (mainly python).
Because I use my flash drive all of the time, I have a lot of important
documents that I have on my flash drive, that would be disastrous to lose.
The nature of my job, however, is that I am constantly switching
computers, and sometimes don't have time to upload documents I worked on
to the cloud as a backup. Plus downloading of some of my projects can take
quite a bit of my time if I'm working on a large project, so using only a
cloud storage system like dropbox would be bad. What I want to do is
create a python autorun script so that the moment I plug in my flashdrive,
it uploads the program files in the background while I work in the
foreground. The actual python script I will ask about later, if I have
troubles.
Right now, however, my issue is getting autorun to work. I looked up a
bunch of tutorials and followed their instructions to the letter about
creating autoruns and batches and such, but every time I try to run the
program when I plug in my flashdrive, Windows 8 (my home computer) tells
me there's a problem with the flashdrive and asks if it can scan and
repair it.
autorun.inf:
[Autorun]
open=autorun.bat
icon=python.ico
label=PythonDrive
autorun.bat:
"Portable Python 2.7.5.1\Python-Portable.exe" "autorun.py"
I have the files all in the main directory of the flashdrive. The icon and
label command seem to work for my flashdrive, but if I get rid of the open
command, the computer still complains. I would prefer just executing the
python without a batch, but I was hoping that a batch file might work
better than a python file being executed from portablepython. the batch
file does work, if I manually open it.
I found this article which mentions that you can no longer (in windows 7)
use the open command in autorun.inf. Is this true? If so, how do I work
around it?
How to get rid of NullReferenceExcetion error
How to get rid of NullReferenceExcetion error
Hi I got this error NullReferenceException was unhandled by user code. The
error occurs in PropertyChanged(this, new
PropertyChangedEventArgs("AboveAircraft")); I tried if( this != null) and
it still got the error. How do I get rid of it. The code is like this:
public int AboveAircraft
{
get { return _above; }
set
{
if (SetProperty(ref _above, value, "AboveAircraft") &&
_updateModel)
{
if (Model.AltitudeBand == null)
{
Model.AltitudeBand = new AltitudeBand();
}
if (this != null && AboveAircraft != null)
{
PropertyChanged(this, new
PropertyChangedEventArgs("AboveAircraft"));
if (_above < _below)
{
BelowAircraft = _above;
}
}
Model.AltitudeBand .Above = new AltitudeBandLimit() { Unit
= AltitudeUnit.Foot, Value = _above };
}
}
}
Hi I got this error NullReferenceException was unhandled by user code. The
error occurs in PropertyChanged(this, new
PropertyChangedEventArgs("AboveAircraft")); I tried if( this != null) and
it still got the error. How do I get rid of it. The code is like this:
public int AboveAircraft
{
get { return _above; }
set
{
if (SetProperty(ref _above, value, "AboveAircraft") &&
_updateModel)
{
if (Model.AltitudeBand == null)
{
Model.AltitudeBand = new AltitudeBand();
}
if (this != null && AboveAircraft != null)
{
PropertyChanged(this, new
PropertyChangedEventArgs("AboveAircraft"));
if (_above < _below)
{
BelowAircraft = _above;
}
}
Model.AltitudeBand .Above = new AltitudeBandLimit() { Unit
= AltitudeUnit.Foot, Value = _above };
}
}
}
Subscribe to:
Comments (Atom)