fancy sliding form add more tabs
Using Fancy sliding form I'm adding more tabs (fieldset and li element ) .
i follow this link .
http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/
my code of navigation Div is
<div id="navigation">
<ul>
<li class="selected">
<a href="#" id="gi">General Info</a> </li>
<li><a href="#" id="ci">Contact Info</a> </li>
<li><a href="#" id="pd">Credentials</a></li>
<li><a href="#" id="pi">Alerts & Directives</a> </li>
<li><a href="#" id="si">Record Releases</a> </li>
<li><a href="#" id="em">Employer</a> </li>
<li><a href="#" id="pid">Patient ID</a> </li>
<li><a href="#" id="A1">Contact</a> </li>
<li><a href="#" id="abcd">AB</a> </li>
<li><a href="#" id="e">CD</a> </li>
<li><a href="#" id="d">EF</a> </li>
<li><a href="#" id="s">GH</a> </li>
<li><a href="#" id="Aew2">IJ</a> </li>
<li><a href="#" id="Awe2">KL</a> </li>
<li><a href="#" id="ewe">MN</a> </li>
</ul>
</div>
These are around 15 Tabs ,But i only can see first 7 tabs in form and
they sliding also.But after 7 tab i can not sliding form
below ,just can seenter code heree tabs name ,but when i click on tabs after
Patient ID
then its not work for me , Please give me any solution ,what should i need
change in JQuery files or Css.I've not idea . Thanks,
Thursday, 3 October 2013
Wednesday, 2 October 2013
turn a list of strings into a list of xyz cooridnates python
turn a list of strings into a list of xyz cooridnates python
First off i will start by saying I am new to python so any help will be
greatly appreciated.
I have a .dat file that is in the following format
J
366 -1722 583
366 356 1783
866 789 1033
866 -1289 -167
366 -1722 583
J
-500 -1472 150
0 -1039 -600
0 1039 600
-500 606 1350
-500 -1472 150
The numbers are xyz coordinates and the J represents a Jump bit so every
time the J occurs I need to lift the pencil and go to the next point to
continue drawing.
I want to read this file into a python file and store the values in a list
as xyz coordinates so i can draw lines from them using pygame.
So far i can read the file into a list using this code
file = open('file.dat', 'r')
vlist = file.readlines()
file.close
Thanks in advance for any help
First off i will start by saying I am new to python so any help will be
greatly appreciated.
I have a .dat file that is in the following format
J
366 -1722 583
366 356 1783
866 789 1033
866 -1289 -167
366 -1722 583
J
-500 -1472 150
0 -1039 -600
0 1039 600
-500 606 1350
-500 -1472 150
The numbers are xyz coordinates and the J represents a Jump bit so every
time the J occurs I need to lift the pencil and go to the next point to
continue drawing.
I want to read this file into a python file and store the values in a list
as xyz coordinates so i can draw lines from them using pygame.
So far i can read the file into a list using this code
file = open('file.dat', 'r')
vlist = file.readlines()
file.close
Thanks in advance for any help
PHP extending in "controllers"
PHP extending in "controllers"
I am creating web application with facebook login. And i have a problem
with stylizing login button. The default facebook login button is inside
iframe and my css styles doesn't aply to this element. I tried also to use
jquery .click() function to trigger hidden button but it doesn't work too.
this is default facebook button:
and this is the final effect what I want to achieve:
this button is already in my html, it looks great but it doesn't work
because default button must be clicked. My question are:
1)Is there any way to stylize facebook login button?
2)How to trigger working click event on facebook button using jquery?
I am creating web application with facebook login. And i have a problem
with stylizing login button. The default facebook login button is inside
iframe and my css styles doesn't aply to this element. I tried also to use
jquery .click() function to trigger hidden button but it doesn't work too.
this is default facebook button:
and this is the final effect what I want to achieve:
this button is already in my html, it looks great but it doesn't work
because default button must be clicked. My question are:
1)Is there any way to stylize facebook login button?
2)How to trigger working click event on facebook button using jquery?
Tuesday, 1 October 2013
AVCam example iPad landscape
AVCam example iPad landscape
I am working with Apple's AVCam code example. I have altered the interface
to work only with the iPad, things seem to be working okay. I have the
video preview on screen but it seems scaled and out of place, almost as if
it is a portrait orientation?
Here is a picture of what is going on:
Obviously I would like the preview to be in landscape (ie take up the full
width of the screen). Although it is not clear from the context of the
image, but it is zoomed in very far by default, I am assuming is is a
product of AVLayerVideoGravityResizeAspectFill and this view somehow being
in portrait?
I have the app setup to only allow Landscape Left and Right, and I would
like the video preview to flip when the device orientation is changed, I
can't seem to get it to do that, even in its current state.
Here are what I assume to be the important parts (if more is needed for
you all to see, please tell me!)
From AVCamViewController.m:
AVCaptureVideoPreviewLayer *newCaptureVideoPreviewLayer =
[[AVCaptureVideoPreviewLayer alloc] initWithSession:[[self
captureManager] session]];
UIView *view = [self videoPreviewView];
CALayer *viewLayer = [view layer];
[viewLayer setMasksToBounds:YES];
//orientation
newCaptureVideoPreviewLayer.orientation =
UIInterfaceOrientationLandscapeLeft;
CGRect bounds = [view bounds];
[newCaptureVideoPreviewLayer setFrame:bounds];
/*if ([newCaptureVideoPreviewLayer isOrientationSupported]) {
NSLog(@"Hello");
[newCaptureVideoPreviewLayer
setOrientation:AVCaptureVideoOrientationLandscapeLeft|AVCaptureVideoOrientationLandscapeRight];
}*/
if ([newCaptureVideoPreviewLayer
respondsToSelector:@selector(connection)])
{
if ([newCaptureVideoPreviewLayer.connection
isVideoOrientationSupported])
{
NSLog(@"hello1");
//self.interfaceOrientation
[newCaptureVideoPreviewLayer.connection
setVideoOrientation:self.interfaceOrientation];
}
}
else
{
// Deprecated in 6.0; here for backward compatibility
if ([newCaptureVideoPreviewLayer isOrientationSupported])
{
NSLog(@"hello2");
[newCaptureVideoPreviewLayer
setOrientation:self.interfaceOrientation];
}
}
Now AVCaptureManager.m:
- (void)deviceOrientationDidChange
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice]
orientation];
/*if (deviceOrientation == UIDeviceOrientationPortrait)
orientation = AVCaptureVideoOrientationPortrait;
else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown)
orientation = AVCaptureVideoOrientationPortraitUpsideDown;
// AVCapture and UIDevice have opposite meanings for landscape left
and right (AVCapture orientation is the same as
UIInterfaceOrientation)
else*/ if (deviceOrientation == UIDeviceOrientationLandscapeLeft){
orientation = AVCaptureVideoOrientationLandscapeRight;
NSLog(@"right");
}
else if (deviceOrientation == UIDeviceOrientationLandscapeRight){
orientation = AVCaptureVideoOrientationLandscapeLeft;
NSLog(@"left");
}
// Ignore device orientations for which there is no corresponding
still image orientation (e.g. UIDeviceOrientationFaceUp)
}
From the init method:
NSNotificationCenter *notificationCenter = [NSNotificationCenter
defaultCenter];
[self setDeviceConnectedObserver:[notificationCenter
addObserverForName:AVCaptureDeviceWasConnectedNotification
object:nil queue:nil usingBlock:deviceConnectedBlock]];
[self setDeviceDisconnectedObserver:[notificationCenter
addObserverForName:AVCaptureDeviceWasDisconnectedNotification
object:nil queue:nil usingBlock:deviceDisconnectedBlock]];
[[UIDevice currentDevice]
beginGeneratingDeviceOrientationNotifications];
[notificationCenter addObserver:self
selector:@selector(deviceOrientationDidChange)
name:UIDeviceOrientationDidChangeNotification object:nil];
orientation = AVCaptureVideoOrientationLandscapeLeft;
Any help is greatly appreciated!
I am working with Apple's AVCam code example. I have altered the interface
to work only with the iPad, things seem to be working okay. I have the
video preview on screen but it seems scaled and out of place, almost as if
it is a portrait orientation?
Here is a picture of what is going on:
Obviously I would like the preview to be in landscape (ie take up the full
width of the screen). Although it is not clear from the context of the
image, but it is zoomed in very far by default, I am assuming is is a
product of AVLayerVideoGravityResizeAspectFill and this view somehow being
in portrait?
I have the app setup to only allow Landscape Left and Right, and I would
like the video preview to flip when the device orientation is changed, I
can't seem to get it to do that, even in its current state.
Here are what I assume to be the important parts (if more is needed for
you all to see, please tell me!)
From AVCamViewController.m:
AVCaptureVideoPreviewLayer *newCaptureVideoPreviewLayer =
[[AVCaptureVideoPreviewLayer alloc] initWithSession:[[self
captureManager] session]];
UIView *view = [self videoPreviewView];
CALayer *viewLayer = [view layer];
[viewLayer setMasksToBounds:YES];
//orientation
newCaptureVideoPreviewLayer.orientation =
UIInterfaceOrientationLandscapeLeft;
CGRect bounds = [view bounds];
[newCaptureVideoPreviewLayer setFrame:bounds];
/*if ([newCaptureVideoPreviewLayer isOrientationSupported]) {
NSLog(@"Hello");
[newCaptureVideoPreviewLayer
setOrientation:AVCaptureVideoOrientationLandscapeLeft|AVCaptureVideoOrientationLandscapeRight];
}*/
if ([newCaptureVideoPreviewLayer
respondsToSelector:@selector(connection)])
{
if ([newCaptureVideoPreviewLayer.connection
isVideoOrientationSupported])
{
NSLog(@"hello1");
//self.interfaceOrientation
[newCaptureVideoPreviewLayer.connection
setVideoOrientation:self.interfaceOrientation];
}
}
else
{
// Deprecated in 6.0; here for backward compatibility
if ([newCaptureVideoPreviewLayer isOrientationSupported])
{
NSLog(@"hello2");
[newCaptureVideoPreviewLayer
setOrientation:self.interfaceOrientation];
}
}
Now AVCaptureManager.m:
- (void)deviceOrientationDidChange
{
UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice]
orientation];
/*if (deviceOrientation == UIDeviceOrientationPortrait)
orientation = AVCaptureVideoOrientationPortrait;
else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown)
orientation = AVCaptureVideoOrientationPortraitUpsideDown;
// AVCapture and UIDevice have opposite meanings for landscape left
and right (AVCapture orientation is the same as
UIInterfaceOrientation)
else*/ if (deviceOrientation == UIDeviceOrientationLandscapeLeft){
orientation = AVCaptureVideoOrientationLandscapeRight;
NSLog(@"right");
}
else if (deviceOrientation == UIDeviceOrientationLandscapeRight){
orientation = AVCaptureVideoOrientationLandscapeLeft;
NSLog(@"left");
}
// Ignore device orientations for which there is no corresponding
still image orientation (e.g. UIDeviceOrientationFaceUp)
}
From the init method:
NSNotificationCenter *notificationCenter = [NSNotificationCenter
defaultCenter];
[self setDeviceConnectedObserver:[notificationCenter
addObserverForName:AVCaptureDeviceWasConnectedNotification
object:nil queue:nil usingBlock:deviceConnectedBlock]];
[self setDeviceDisconnectedObserver:[notificationCenter
addObserverForName:AVCaptureDeviceWasDisconnectedNotification
object:nil queue:nil usingBlock:deviceDisconnectedBlock]];
[[UIDevice currentDevice]
beginGeneratingDeviceOrientationNotifications];
[notificationCenter addObserver:self
selector:@selector(deviceOrientationDidChange)
name:UIDeviceOrientationDidChangeNotification object:nil];
orientation = AVCaptureVideoOrientationLandscapeLeft;
Any help is greatly appreciated!
Error: Message: Expected '}'
Error: Message: Expected '}'
visit http://jsfiddle.net/ghAkB/4/
got an error from I8 saying :
Message: Expected '}'
Line: 59
which in this script is this:
backgroundColor: $el.attr("rel")
where second example is located
$(function(){
var $el, leftPos, newWidth,
$mainNav = $("#example-one"),
$mainNav2 = $("#example-two");
/*
EXAMPLE ONE
*/
$mainNav.append("<li id='magic-line'></li>");
var $magicLine = $("#magic-line");
$magicLine
.width($(".current_page_item").width())
.css("left", $(".current_page_item a").position().left)
.data("origLeft", $magicLine.position().left)
.data("origWidth", $magicLine.width());
$("#example-one li").find("a").hover(function() {
$el = $(this);
leftPos = $el.position().left;
newWidth = $el.parent().width();
$magicLine.stop().animate({
left: leftPos,
width: newWidth
});
}, function() {
$magicLine.stop().animate({
left: $magicLine.data("origLeft"),
width: $magicLine.data("origWidth")
});
});
/*
EXAMPLE TWO
*/
$mainNav2.append("<li id='magic-line-two'></li>");
var $magicLineTwo = $("#magic-line-two");
$magicLineTwo
.width($(".current_page_item_two").width())
.height($mainNav2.height())
.css("left", $(".current_page_item_two a").position().left)
.data("origLeft", $(".current_page_item_two a").position().left)
.data("origWidth", $magicLineTwo.width())
.data("origColor", $(".current_page_item_two a").attr("rel"));
$("#example-two li").find("a").hover(function() {
$el = $(this);
leftPos = $el.position().left;
newWidth = $el.parent().width();
$magicLineTwo.stop().animate({
left: leftPos,
width: newWidth
backgroundColor: $el.attr("rel")
});
}, function() {
$magicLineTwo.stop().animate({
left: $magicLineTwo.data("origLeft"),
width: $magicLineTwo.data("origWidth"),
backgroundColor: $magicLineTwo.data("origColor")
});
});
});
I would appreciate if someone can help me, it's been weeks since I've been
with this website :(
visit http://jsfiddle.net/ghAkB/4/
got an error from I8 saying :
Message: Expected '}'
Line: 59
which in this script is this:
backgroundColor: $el.attr("rel")
where second example is located
$(function(){
var $el, leftPos, newWidth,
$mainNav = $("#example-one"),
$mainNav2 = $("#example-two");
/*
EXAMPLE ONE
*/
$mainNav.append("<li id='magic-line'></li>");
var $magicLine = $("#magic-line");
$magicLine
.width($(".current_page_item").width())
.css("left", $(".current_page_item a").position().left)
.data("origLeft", $magicLine.position().left)
.data("origWidth", $magicLine.width());
$("#example-one li").find("a").hover(function() {
$el = $(this);
leftPos = $el.position().left;
newWidth = $el.parent().width();
$magicLine.stop().animate({
left: leftPos,
width: newWidth
});
}, function() {
$magicLine.stop().animate({
left: $magicLine.data("origLeft"),
width: $magicLine.data("origWidth")
});
});
/*
EXAMPLE TWO
*/
$mainNav2.append("<li id='magic-line-two'></li>");
var $magicLineTwo = $("#magic-line-two");
$magicLineTwo
.width($(".current_page_item_two").width())
.height($mainNav2.height())
.css("left", $(".current_page_item_two a").position().left)
.data("origLeft", $(".current_page_item_two a").position().left)
.data("origWidth", $magicLineTwo.width())
.data("origColor", $(".current_page_item_two a").attr("rel"));
$("#example-two li").find("a").hover(function() {
$el = $(this);
leftPos = $el.position().left;
newWidth = $el.parent().width();
$magicLineTwo.stop().animate({
left: leftPos,
width: newWidth
backgroundColor: $el.attr("rel")
});
}, function() {
$magicLineTwo.stop().animate({
left: $magicLineTwo.data("origLeft"),
width: $magicLineTwo.data("origWidth"),
backgroundColor: $magicLineTwo.data("origColor")
});
});
});
I would appreciate if someone can help me, it's been weeks since I've been
with this website :(
Can Helium Disappear from Earth=?iso-8859-1?Q?=3F_=96_physics.stackexchange.com?=
Can Helium Disappear from Earth? – physics.stackexchange.com
Can Helium disappear? As we know Helium is lighter than air, so basically
Helium fly off from Earth. Is it possible that in the future we will run
out Helium?
Can Helium disappear? As we know Helium is lighter than air, so basically
Helium fly off from Earth. Is it possible that in the future we will run
out Helium?
Why does nginx sometimes silently redirect?
Why does nginx sometimes silently redirect?
Nginx.conf, in brief:
...
server {
listen 80;
server_name ec2-54-234-175-21.compute-1.amazonaws.com;
location / {
root /var/www/static/;
default_type text/html;
try_files $uri $uri/index.html /index.html;
}
location /api/2.0 {
...
proxy_pass http://localhost:8080/;
}
location /api/ {
...
proxy_pass http://localhost:8000/;
}
}
I have two APIs. Essentially, I am trying to make them at reside at the
URIs of /api/1.0 and /api/2.0 respectively. Because of the internal
routing of the 1.0 app, it appends the 1.0 part, so to achieve the effect
I want, the nginx location for it is simply at /api/.
Without exactly understanding the location precedence rules that Nginx
uses, I was hoping /api/ coming after /api/2.0 in my configuration would
cause all things that began with /api/ but are not /api/2.0 to fall into
this second location block. This seems to work, however it is very
inconsistent.
The biggest problem--and I can't seem to find rhyme or reason to it--is
that sometimes /api/1.0 redirects to just /1.0, resulting in it being
handled by my try_files clause. If I put a full URI into the address bar,
'localhost/api/1.0/countyinmate?format=json', sometimes it redirects to
'localhost/1.0/countyinmate?format=json'. But then if I edit the URI by
putting 'api/' back in, this usually works. Anytime this problem occurs,
nginx is oblivious to it, and records in my access log that /1.0 was
accessed.
Any help is appreciated, sorry if I'm missing something obvious.
Nginx.conf, in brief:
...
server {
listen 80;
server_name ec2-54-234-175-21.compute-1.amazonaws.com;
location / {
root /var/www/static/;
default_type text/html;
try_files $uri $uri/index.html /index.html;
}
location /api/2.0 {
...
proxy_pass http://localhost:8080/;
}
location /api/ {
...
proxy_pass http://localhost:8000/;
}
}
I have two APIs. Essentially, I am trying to make them at reside at the
URIs of /api/1.0 and /api/2.0 respectively. Because of the internal
routing of the 1.0 app, it appends the 1.0 part, so to achieve the effect
I want, the nginx location for it is simply at /api/.
Without exactly understanding the location precedence rules that Nginx
uses, I was hoping /api/ coming after /api/2.0 in my configuration would
cause all things that began with /api/ but are not /api/2.0 to fall into
this second location block. This seems to work, however it is very
inconsistent.
The biggest problem--and I can't seem to find rhyme or reason to it--is
that sometimes /api/1.0 redirects to just /1.0, resulting in it being
handled by my try_files clause. If I put a full URI into the address bar,
'localhost/api/1.0/countyinmate?format=json', sometimes it redirects to
'localhost/1.0/countyinmate?format=json'. But then if I edit the URI by
putting 'api/' back in, this usually works. Anytime this problem occurs,
nginx is oblivious to it, and records in my access log that /1.0 was
accessed.
Any help is appreciated, sorry if I'm missing something obvious.
Monday, 30 September 2013
conflicts with home internet and VPN
conflicts with home internet and VPN
Sorry for my English.
I have a usb modem through which I go out to the Internet. I want to
connect via VPN to the corporative network. The connection is successful.
The corporation portal works okay, but I can't to connect to various
servers via rdp (or other services). This is my routes without vpn(on
Russian language, sorry):
This is routes with the vpn:
I think the problem is that the provider of the modem and the corporate
network(gateway address:192.168.0.1) use the same netmask. How to solve
it?
PS. When VPN is connected the Internet works okay.
PS2. I use the Kerio VPN Client.
Sorry for my English.
I have a usb modem through which I go out to the Internet. I want to
connect via VPN to the corporative network. The connection is successful.
The corporation portal works okay, but I can't to connect to various
servers via rdp (or other services). This is my routes without vpn(on
Russian language, sorry):
This is routes with the vpn:
I think the problem is that the provider of the modem and the corporate
network(gateway address:192.168.0.1) use the same netmask. How to solve
it?
PS. When VPN is connected the Internet works okay.
PS2. I use the Kerio VPN Client.
cant download windows installer wubi
cant download windows installer wubi
I was trying to download the windows installer through the link provided
on the page for the 12.04 version, but it is giving me to download the
707MB of iso file which I already have.
Please can anyone help me on this one?
Thank you.
I was trying to download the windows installer through the link provided
on the page for the 12.04 version, but it is giving me to download the
707MB of iso file which I already have.
Please can anyone help me on this one?
Thank you.
Waterfall with two series using Highcharts
Waterfall with two series using Highcharts
I'm trying to set two Waterfall series using Highcharts in the same chart,
I have only see one serie in this type of chart in Highcharts samples. I
have manipulate the data to be an array but still not working. Any ideas
pls.
I'm trying to set two Waterfall series using Highcharts in the same chart,
I have only see one serie in this type of chart in Highcharts samples. I
have manipulate the data to be an array but still not working. Any ideas
pls.
Disabling the dates before selected date and after today date
Disabling the dates before selected date and after today date
In Reports i am showing the startDate and endDate fields to select the
particular dates using jquery ui datepicker.For the startDate and endDate
fields i am giving the today date as the default date. My requirement is
1) If the customer directly clicks in the endDate the dates before today
date and after today date should be disable.
2) If the customer selects any particular date for startdate then for
enddate the dates before to the selected date and after to the today date
should be disabled.
I am using the below code to this.
var dates = $( "#startDate,
In Reports i am showing the startDate and endDate fields to select the
particular dates using jquery ui datepicker.For the startDate and endDate
fields i am giving the today date as the default date. My requirement is
1) If the customer directly clicks in the endDate the dates before today
date and after today date should be disable.
2) If the customer selects any particular date for startdate then for
enddate the dates before to the selected date and after to the today date
should be disabled.
I am using the below code to this.
var dates = $( "#startDate,
Sunday, 29 September 2013
Taking 2d list, and writing program for column max and average
Taking 2d list, and writing program for column max and average
i have a hw assignment i just finished up but it looks pretty horrendous
knowing that theres a much simpler and efficient way to get the correct
output but i just cant seem to figure it out. Heres the objective of the
assignment. Write a program that stores the following values in a 2D list
(these will be hardcoded):
2.42 11.42 13.86 72.32
56.59 88.52 4.33 87.70
73.72 50.50 7.97 84.47
The program should determine the maximum and average of each column
Output looks like
2.42 11.42 13.86 72.32
56.59 88.52 4.33 87.70
73.72 50.50 7.97 84.47
============================
73.72 88.52 13.86 87.70 column max
44.24 50.15 8.72 81.50 column average
The printing of the 2d list was done below, my problem is calculating the
max, and averages.
data = [ [ 2.42, 11.42, 13.86, 72.32],
[ 56.59, 88.52, 4.33, 87.70],
[ 73.72, 50.50, 7.97, 84.47] ]
emptylist = []
r = 0
while r < 3:
c = 0
while c < 4 :
print "%5.2f" % data[r][c] ,
c = c + 1
r = r + 1
print
print "=" * 25
This prints the top half but the code i wrote to calculate the max and
average is bad. for max i basically comapred all indexes in columns to
each other with if, elif, statements and for the average i added the each
column indency together and averaged, then printed. IS there anyway to
calculate the bottom stuff with some sort of loop. Maybe something like
the following
for numbers in data:
r = 0 #row index
c = 0 #column index
emptylist= []
while c < 4 :
while r < 3 :
sum = data[r][c]
totalsum = totalsum + sum
avg = totalsum / float(rows)
emptylist.append(avg) #not sure if this would work?
here im just trying to
r = r + 1 #dump averages into an emptylist
to print the values
c = c + 1 #in it later?
or something like that where im not manually adding each index number to
each column and row. The max one i have no clue how to do in a loop . also
NO LIST METHODS can be used. only append and len() can be used. Any help?
i have a hw assignment i just finished up but it looks pretty horrendous
knowing that theres a much simpler and efficient way to get the correct
output but i just cant seem to figure it out. Heres the objective of the
assignment. Write a program that stores the following values in a 2D list
(these will be hardcoded):
2.42 11.42 13.86 72.32
56.59 88.52 4.33 87.70
73.72 50.50 7.97 84.47
The program should determine the maximum and average of each column
Output looks like
2.42 11.42 13.86 72.32
56.59 88.52 4.33 87.70
73.72 50.50 7.97 84.47
============================
73.72 88.52 13.86 87.70 column max
44.24 50.15 8.72 81.50 column average
The printing of the 2d list was done below, my problem is calculating the
max, and averages.
data = [ [ 2.42, 11.42, 13.86, 72.32],
[ 56.59, 88.52, 4.33, 87.70],
[ 73.72, 50.50, 7.97, 84.47] ]
emptylist = []
r = 0
while r < 3:
c = 0
while c < 4 :
print "%5.2f" % data[r][c] ,
c = c + 1
r = r + 1
print "=" * 25
This prints the top half but the code i wrote to calculate the max and
average is bad. for max i basically comapred all indexes in columns to
each other with if, elif, statements and for the average i added the each
column indency together and averaged, then printed. IS there anyway to
calculate the bottom stuff with some sort of loop. Maybe something like
the following
for numbers in data:
r = 0 #row index
c = 0 #column index
emptylist= []
while c < 4 :
while r < 3 :
sum = data[r][c]
totalsum = totalsum + sum
avg = totalsum / float(rows)
emptylist.append(avg) #not sure if this would work?
here im just trying to
r = r + 1 #dump averages into an emptylist
to print the values
c = c + 1 #in it later?
or something like that where im not manually adding each index number to
each column and row. The max one i have no clue how to do in a loop . also
NO LIST METHODS can be used. only append and len() can be used. Any help?
Getting a child element with Selenium and Python
Getting a child element with Selenium and Python
I have this HTML:
<div id = "d029384">
<span>......</span>
</div>
and my code:
elem = browser.find_elements_by_xpath("//div[contains(@id,'d')]")
except the div isn't working for what my program is doing. I need to be
more specific. I need the span element instead. How can I get the span
element? Each div has an id that is d + numbers. I need those numbers so
that's why I used that xpath but I don't know how to make the final
WebElement point to the span and not to the div.
Anyone know?
I have this HTML:
<div id = "d029384">
<span>......</span>
</div>
and my code:
elem = browser.find_elements_by_xpath("//div[contains(@id,'d')]")
except the div isn't working for what my program is doing. I need to be
more specific. I need the span element instead. How can I get the span
element? Each div has an id that is d + numbers. I need those numbers so
that's why I used that xpath but I don't know how to make the final
WebElement point to the span and not to the div.
Anyone know?
Are Rails passwords generated with bcrypt portable?
Are Rails passwords generated with bcrypt portable?
I have an existing web application with a few thousand users which I'm
porting over to Rails. As I rewrite and refactor this app I may need to
run it on any number of different servers for development, testing, and
production purposes.
I'm using Rails' built-in has_secure_password method in my user model but
I'm concerned about the portability of password data. I will need to move
the contents of my database from machine to machine to test in different
environments and its very important that I can test the user
authentication functionality using the same set of users and passwords in
each environment.
So far its easy to find answers about how bcrypt-ruby works along with
Rails has_secure_password but after weeks of searching I haven't found a
clear answer.
If has_secure_password results in a WorkFactor + Salt + HashedPassword
concatenated and saved to the password_digest database column then can
that hash be regenerated and compared reliably if moved to any other
machine (assuming any other machine is running Rails on a Unix-like OS)?
OR To put it another way - are bcrypt-ruby passwords generated with Rails'
has_secure_password portable?
Follow up question: If the salt is always generated randomly (I've seen
the same password use different hashes so I don't think the salt is
created from the text of the password itself) then how would a Rails app
be able to reliably rehash the password on a login form submit and compare
it to what's in the database. Obviously it would have to know what the
salt is first in order to compare it. How does it do that?
I have an existing web application with a few thousand users which I'm
porting over to Rails. As I rewrite and refactor this app I may need to
run it on any number of different servers for development, testing, and
production purposes.
I'm using Rails' built-in has_secure_password method in my user model but
I'm concerned about the portability of password data. I will need to move
the contents of my database from machine to machine to test in different
environments and its very important that I can test the user
authentication functionality using the same set of users and passwords in
each environment.
So far its easy to find answers about how bcrypt-ruby works along with
Rails has_secure_password but after weeks of searching I haven't found a
clear answer.
If has_secure_password results in a WorkFactor + Salt + HashedPassword
concatenated and saved to the password_digest database column then can
that hash be regenerated and compared reliably if moved to any other
machine (assuming any other machine is running Rails on a Unix-like OS)?
OR To put it another way - are bcrypt-ruby passwords generated with Rails'
has_secure_password portable?
Follow up question: If the salt is always generated randomly (I've seen
the same password use different hashes so I don't think the salt is
created from the text of the password itself) then how would a Rails app
be able to reliably rehash the password on a login form submit and compare
it to what's in the database. Obviously it would have to know what the
salt is first in order to compare it. How does it do that?
Can the result of a bitwise AND operator be negative (in Java)
Can the result of a bitwise AND operator be negative (in Java)
I have the following piece of code:
int SOME_MASK = 0x0000ffff;
int value = /* some value */;
int something = SOME_MASK & value;
// WHY IS "something" guaranteed to be non-negative ?
if (something != NEGATIVE_CONSTANT) {
// do something here....
}
I keep getting the FindBugs analysis warning:
Correctness - Bad comparison of nonnegative value with negative constant
This code compares a value that is guaranteed to be non-negative with a
negative constant.
The warning pops up for the line where comparing the bitwise AND result
with the negative constant.
I am not sure why a Bitwise AND result is guaranteed to be non-negative?
is this always the case?
I have the following piece of code:
int SOME_MASK = 0x0000ffff;
int value = /* some value */;
int something = SOME_MASK & value;
// WHY IS "something" guaranteed to be non-negative ?
if (something != NEGATIVE_CONSTANT) {
// do something here....
}
I keep getting the FindBugs analysis warning:
Correctness - Bad comparison of nonnegative value with negative constant
This code compares a value that is guaranteed to be non-negative with a
negative constant.
The warning pops up for the line where comparing the bitwise AND result
with the negative constant.
I am not sure why a Bitwise AND result is guaranteed to be non-negative?
is this always the case?
Saturday, 28 September 2013
StrPtr not recognized in visual basic (VS 2012)?
StrPtr not recognized in visual basic (VS 2012)?
I'm using VS 2012:
Here's my situation:
I'm writing some code in visual basic that calls a dll function that I've
written in C++ (also written using vs 2012). One of my function's
arguments takes the wchar_t* data type, so I need to format my string from
vb accordingly using StrPtr.
Here's my problem:
Visual Basic does not recognize StrPtr as a function. I get: 'StrPtr' is
not declared. It may be inaccessible due to its protection level.'
What does this mean?
I'm using VS 2012:
Here's my situation:
I'm writing some code in visual basic that calls a dll function that I've
written in C++ (also written using vs 2012). One of my function's
arguments takes the wchar_t* data type, so I need to format my string from
vb accordingly using StrPtr.
Here's my problem:
Visual Basic does not recognize StrPtr as a function. I get: 'StrPtr' is
not declared. It may be inaccessible due to its protection level.'
What does this mean?
Nodejs using selenium-webdriver library with phantomjs as driver, attempting to return current URL
Nodejs using selenium-webdriver library with phantomjs as driver,
attempting to return current URL
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.phantomjs()).
build();
driver.get('http://www.duckduckgo.com');
driver.findElement(webdriver.By.id('search_form_input_homepage')).sendKeys('webdriver
books and stuff');
driver.findElement(webdriver.By.id('search_button_homepage')).click();
//this is the part I am having trouble with...
setTimeout(function() {
console.log(driver.getCurrentUrl());
}, 5000);
This all works as expected up to the setTimeout(), and for this example (I
have tried many options), I get...
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
attempting to return current URL
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.phantomjs()).
build();
driver.get('http://www.duckduckgo.com');
driver.findElement(webdriver.By.id('search_form_input_homepage')).sendKeys('webdriver
books and stuff');
driver.findElement(webdriver.By.id('search_button_homepage')).click();
//this is the part I am having trouble with...
setTimeout(function() {
console.log(driver.getCurrentUrl());
}, 5000);
This all works as expected up to the setTimeout(), and for this example (I
have tried many options), I get...
{ then: [Function: then],
cancel: [Function: cancel],
isPending: [Function: isPending] }
sqlite queries return nothing! (select statement)
sqlite queries return nothing! (select statement)
I have a table in which there's a column of type BLOB. Another column is
of type 'text'. Something like:
CREATE TABLE Tbl(TXT text, BLB blob);
Now I've inserted a few records using:
INSERT INTO Tbl(TXT) VALUES("whatever");
As you can see nothing was defined for BLB. But each time that I issue a
query like:
SELECT * FROM 'Tbl' WHERE 'TXT'="whatever";
I get nothing at all without any error message or anything. My primary
guess was that the problem might have something to do with BLB being null
or undefined or something like that. Any ideas?
I have a table in which there's a column of type BLOB. Another column is
of type 'text'. Something like:
CREATE TABLE Tbl(TXT text, BLB blob);
Now I've inserted a few records using:
INSERT INTO Tbl(TXT) VALUES("whatever");
As you can see nothing was defined for BLB. But each time that I issue a
query like:
SELECT * FROM 'Tbl' WHERE 'TXT'="whatever";
I get nothing at all without any error message or anything. My primary
guess was that the problem might have something to do with BLB being null
or undefined or something like that. Any ideas?
Dims activity except one bright view
Dims activity except one bright view
I am trying to do a guide for my app. I tries to dim the activity and
leaves one clickable bright view (like games and Android itself when its
runs first time).
But I don't know where to start to implement that.
Any idea or source-code?
I am trying to do a guide for my app. I tries to dim the activity and
leaves one clickable bright view (like games and Android itself when its
runs first time).
But I don't know where to start to implement that.
Any idea or source-code?
Friday, 27 September 2013
Var array to list box
Var array to list box
So on my last post, C# Json - to - Array I asked how to get the two values
to a array. But I was given a var, how do I get those variables in a list
box "main_Listbox"?
So on my last post, C# Json - to - Array I asked how to get the two values
to a array. But I was given a var, how do I get those variables in a list
box "main_Listbox"?
Subscribe to:
Posts (Atom)