Underline the main header when the sub header is clicked
<div id=wrapDesktopNavBar>
<ul class="desktopNavBar">
<li><a class="firstLevel" href="#">header 1</a></li>
<li><a onclick....></a><a class="firstLevel" href="#">header 2</a>
<ul>
<li><a class="secondLevel" href="#">1st sub header</a>
<li><a class="secondLevel" href="#">2nd sub header</a>
<li><a class="secondLevel" href="#">3rd sub header</a>
</ul>
<li><a class="firstLevel" href="#">header 3</a></li>
</ul></div>
$(function(){
$('.mainNavSection').hide();
$('.desktopNavBar a').bind('click', function(e){
$('.desktopNavBar a.current').removeClass('current');
$('.mainNavSection:visible').hide();
$(this.hash).show();
$(this).addClass('current');
$(this).closest('.desktopNavBar >
li').find('a:first').addClass('current');
e.preventDefault();
}).filter(':first').click();
});
Hi the above is my html and javascript. I have a class called "current"
which simply underlines the header and its subheader when it's being
clicked. I want to allow the main header to be underlined when the sub
header is being clicked. I've tried $(this).closest('.desktopNavBar >
li').find('a:first').addClass('current'); but it only underlines the first
a tag and not the second a tag. I want the 2nd tag to be underlined. And,
i can't swap my 2nd tag with my 1st a because it affects smth else.
is there soemthing like .find(a:second) to allow me to add class to the
2nd a tag?
Bustard
Sunday, 1 September 2013
Saturday, 31 August 2013
Python argument parsing get wrong result
Python argument parsing get wrong result
I have a python script to parse input argument from user .my code is like
this
try:
opts, args =
getopt.getopt(sys.argv[1:],"hd:i:ds:dm:db:ts:tm:",["ifile=","ofile="])
print args #['ds_val', '-dm', 'dm_val', '-ts', 'tas_val', '-tm',
'tm_val']
print opts #[('-i', 'ok.txt'), ('-d', 's')
except getopt.GetoptError:
sys.exit()
for opt, arg in opts:
if opt == '-h':
f_end_process(msg)
elif opt == "-i":
input_file = arg
elif opt == "-ds":
stag_db = arg
elif opt == "-dm":
main_tb = arg
elif opt == "-ts":
stag_table = arg
elif opt == "-tm":
main_table = arg
elif opt == "-db":
debug = arg
i am running code like this
python main.py -i ok.txt -ds ds_val -dm dm_val -ts tas_val -tm tm_val
now i am able to parse only -i input.How can i parse -tm,-ts ,-dm,-ds iputs?
I have a python script to parse input argument from user .my code is like
this
try:
opts, args =
getopt.getopt(sys.argv[1:],"hd:i:ds:dm:db:ts:tm:",["ifile=","ofile="])
print args #['ds_val', '-dm', 'dm_val', '-ts', 'tas_val', '-tm',
'tm_val']
print opts #[('-i', 'ok.txt'), ('-d', 's')
except getopt.GetoptError:
sys.exit()
for opt, arg in opts:
if opt == '-h':
f_end_process(msg)
elif opt == "-i":
input_file = arg
elif opt == "-ds":
stag_db = arg
elif opt == "-dm":
main_tb = arg
elif opt == "-ts":
stag_table = arg
elif opt == "-tm":
main_table = arg
elif opt == "-db":
debug = arg
i am running code like this
python main.py -i ok.txt -ds ds_val -dm dm_val -ts tas_val -tm tm_val
now i am able to parse only -i input.How can i parse -tm,-ts ,-dm,-ds iputs?
How do I set values inside a global, fixed-size array, in C (in Visual Studio)?
How do I set values inside a global, fixed-size array, in C (in Visual
Studio)?
A part of my VS2012 Windows Phone project is in C. I've been struggling
during one day trying to initialize an array to put stuff inside it.
Whenever I try to initialize it as global (outside any function), then I
get a message telling me that I can't initialize it with a value that
isn't a const.
const char* myArray = (const char*)malloc(256);
// Bad code: this isn't initialized with a const
If I don't initialize it with a value, then I'll have a message telling me
to give it a value. So I assign a NULL value to the array.
const char* myArray = NULL;
Then I need to set a size somewhere, so I set the size within my main, or
first function:
int myFirstFunctionInTheCode()
{
myArray = (char*)malloc(256);
}
Then I get something like: ';' expected before type
So I'm searching on forum and read that C in Visual Studio is C89, thus, I
need to declare then to assign on two separate line, which isn't true
elsewhere in my code, so I'm completely mixed-up about -real- standards.
But I still get the same error when doing it on two lines.
I then decide to use some other tools from the available VS libraries to
find out that in C, I can't include sstream, streambuf, etc, otherwise my
whole project fails with thousands of bugs. So I could use boost to get a
real stream libraries, but it's not compatible with Windows Phone because
of some thread usage.
How do I set values inside a global, fixed-size array, in C (in Visual
Studio)?
What I want to achieve is similar to something in C# like it:
static byte[] gentleCSharpArray = new byte[256];
private void easyShotCSharpFunction()
{
gentleCSharpArray[0] = 0x57;
gentleCSharpArray[1] = 0x54;
gentleCSharpArray[2] = 0x46;
}
I never spent so much time trying to assign a value to an array, so I
guess I'm totally wrong with my global char* arrays?
Studio)?
A part of my VS2012 Windows Phone project is in C. I've been struggling
during one day trying to initialize an array to put stuff inside it.
Whenever I try to initialize it as global (outside any function), then I
get a message telling me that I can't initialize it with a value that
isn't a const.
const char* myArray = (const char*)malloc(256);
// Bad code: this isn't initialized with a const
If I don't initialize it with a value, then I'll have a message telling me
to give it a value. So I assign a NULL value to the array.
const char* myArray = NULL;
Then I need to set a size somewhere, so I set the size within my main, or
first function:
int myFirstFunctionInTheCode()
{
myArray = (char*)malloc(256);
}
Then I get something like: ';' expected before type
So I'm searching on forum and read that C in Visual Studio is C89, thus, I
need to declare then to assign on two separate line, which isn't true
elsewhere in my code, so I'm completely mixed-up about -real- standards.
But I still get the same error when doing it on two lines.
I then decide to use some other tools from the available VS libraries to
find out that in C, I can't include sstream, streambuf, etc, otherwise my
whole project fails with thousands of bugs. So I could use boost to get a
real stream libraries, but it's not compatible with Windows Phone because
of some thread usage.
How do I set values inside a global, fixed-size array, in C (in Visual
Studio)?
What I want to achieve is similar to something in C# like it:
static byte[] gentleCSharpArray = new byte[256];
private void easyShotCSharpFunction()
{
gentleCSharpArray[0] = 0x57;
gentleCSharpArray[1] = 0x54;
gentleCSharpArray[2] = 0x46;
}
I never spent so much time trying to assign a value to an array, so I
guess I'm totally wrong with my global char* arrays?
Issues migrating Wordpress site from local to live
Issues migrating Wordpress site from local to live
I've migrated a local test of a Wordpress site to a live server but I'm
encountering a weird issue. Everything works fine, but one of the plugins
that I'm using (NextGEN Gallery) is attempting to download a few CSS and
JS files from the old location at 127.0.0.1/powwptest.1/.
I cannot figure this issue out for the life of me. I have done repeated
searches for 127.0.0.1, localhost, and powwptest.1 or powwptest in the
database through phpMyAdmin, I have manually searched the .SQL file with
Sublime Text, and searched all 1600+ PHP files with Sublime Text to no
avail. Absolutely nothing is found.
If there is no record of 127.0.0.1/powwptest.1 in the database or in any
of the files, why is it still attempting to download from the local
server?
A few of the calls, for an example:
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.css?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.easing-1.3.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.6
I've cleared cache, cookies, tried in multiple browsers, and even used a
third-party (Pingdom) to make sure I'm not crazy. They are all detecting
the connection errors as well. I've tried updating the Wordpress plugin on
the live server, to no avail. Any ideas?
I've migrated a local test of a Wordpress site to a live server but I'm
encountering a weird issue. Everything works fine, but one of the plugins
that I'm using (NextGEN Gallery) is attempting to download a few CSS and
JS files from the old location at 127.0.0.1/powwptest.1/.
I cannot figure this issue out for the life of me. I have done repeated
searches for 127.0.0.1, localhost, and powwptest.1 or powwptest in the
database through phpMyAdmin, I have manually searched the .SQL file with
Sublime Text, and searched all 1600+ PHP files with Sublime Text to no
avail. Absolutely nothing is found.
If there is no record of 127.0.0.1/powwptest.1 in the database or in any
of the files, why is it still attempting to download from the local
server?
A few of the calls, for an example:
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.css?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.easing-1.3.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.6
http://127.0.0.1/powwptest.1/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.6
I've cleared cache, cookies, tried in multiple browsers, and even used a
third-party (Pingdom) to make sure I'm not crazy. They are all detecting
the connection errors as well. I've tried updating the Wordpress plugin on
the live server, to no avail. Any ideas?
MySQL really unexpected error. BIGINT out of range
MySQL really unexpected error. BIGINT out of range
I have this kinda complicated query that is well explained in this
question. I haven't changed anything in the query or anything relating to
this system , however I suddenly started getting this error
BIGINT UNSIGNED value is out of range in '(_db.ads.impressions_total -
(cast(((curdate()) - cast(_db.ads.start as date)) as unsigned) *
_db.ads.impressions_perday))'
I'm really confused, I guess something is not caching right but what can I
do? I really need help..
I have this kinda complicated query that is well explained in this
question. I haven't changed anything in the query or anything relating to
this system , however I suddenly started getting this error
BIGINT UNSIGNED value is out of range in '(_db.ads.impressions_total -
(cast(((curdate()) - cast(_db.ads.start as date)) as unsigned) *
_db.ads.impressions_perday))'
I'm really confused, I guess something is not caching right but what can I
do? I really need help..
creating input fields row automatically in wpf
creating input fields row automatically in wpf
i am making the form for sales system so that user write data in one row
and automatically row adds to add data for other products, i have a
datagrid in wpf and i have input fields in datagrid, there are 6 fields in
one row, what i need when i write in first field then automatically inputs
fields row adds under the current row for new data.
i am making the form for sales system so that user write data in one row
and automatically row adds to add data for other products, i have a
datagrid in wpf and i have input fields in datagrid, there are 6 fields in
one row, what i need when i write in first field then automatically inputs
fields row adds under the current row for new data.
Divs not nesting correctly inside section tag
Divs not nesting correctly inside section tag
I'm using the following HTML and CSS code to try and create a section with
3 divs inside of it, the problem is that even though the divs are inside
the section tag, in the web page they appear outside and below the section
element?
HTML code
<section id="content">
<div class="homebox">
<h3>Who I am</h3>
<p>Here is some text Here is some text Here is some text Here is some
text </p>
</div>
<div class="homebox">
<h3>What I do</h3>
<p> Here is some text Here is some text Here is some text Here is some
text Here is some text Here is some text </p>
</div>
<div class="homebox">
<h3>Where I do it</h3>
<p> Here is some text Here is some text Here is some text Here is some
text Here is some text Here is some text </p>
</div>
</section>
Here is the CSS code I'm using
#content {
color:#FFF;
margin-top: 20px;
width: 100%;
padding-left: 20px;
}
#content h3 {
color:#FFF;
font-size: 40px;
font-family: Impact, Arial, sans-serif;
margin:0;
font-weight: 100;
}
#content > .homebox {
float:left;
width: 28%;
padding: 0px 20px 20px; /* Top 0 padding, left and right 20px, bottom
20px padding */
margin-right: 18px;
text-align:center;
border-radius:40px;
background: #818181;
background: -moz-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center
center, 100%, color-stop(0%,rgba(234,211,0,0.6)),
color-stop(63%,rgba(255,255,255,0.22)),
color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(234,211,0,0.6)
0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#99ead300', endColorstr='#00ffffff',GradientType=1 );
/* IE6-9 fallback on horizontal gradient */
}
.homebox > p {
margin: 0px;
color: #FFF;
font-family: Trebuchet MS, Arial, sans-serif;
}
I'm using the following HTML and CSS code to try and create a section with
3 divs inside of it, the problem is that even though the divs are inside
the section tag, in the web page they appear outside and below the section
element?
HTML code
<section id="content">
<div class="homebox">
<h3>Who I am</h3>
<p>Here is some text Here is some text Here is some text Here is some
text </p>
</div>
<div class="homebox">
<h3>What I do</h3>
<p> Here is some text Here is some text Here is some text Here is some
text Here is some text Here is some text </p>
</div>
<div class="homebox">
<h3>Where I do it</h3>
<p> Here is some text Here is some text Here is some text Here is some
text Here is some text Here is some text </p>
</div>
</section>
Here is the CSS code I'm using
#content {
color:#FFF;
margin-top: 20px;
width: 100%;
padding-left: 20px;
}
#content h3 {
color:#FFF;
font-size: 40px;
font-family: Impact, Arial, sans-serif;
margin:0;
font-weight: 100;
}
#content > .homebox {
float:left;
width: 28%;
padding: 0px 20px 20px; /* Top 0 padding, left and right 20px, bottom
20px padding */
margin-right: 18px;
text-align:center;
border-radius:40px;
background: #818181;
background: -moz-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center
center, 100%, color-stop(0%,rgba(234,211,0,0.6)),
color-stop(63%,rgba(255,255,255,0.22)),
color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,
rgba(234,211,0,0.6) 0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0)
100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(234,211,0,0.6)
0%,rgba(255,255,255,0.22) 63%,rgba(255,255,255,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(
startColorstr='#99ead300', endColorstr='#00ffffff',GradientType=1 );
/* IE6-9 fallback on horizontal gradient */
}
.homebox > p {
margin: 0px;
color: #FFF;
font-family: Trebuchet MS, Arial, sans-serif;
}
Subscribe to:
Posts (Atom)