Thursday, 3 October 2013

Leaflet - Mousehover effect not working in safari

Leaflet - Mousehover effect not working in safari

I have a problem with Safari and a map create with Leaflet : this is a
little demo http://jsfiddle.net/DBJb7/ .
The CSS property 'hover' works except in Safari. I try to solve it with
z-index but it doesn't work.
Does anyone have an idea ?
Thx :)
Matthieu

Wednesday, 2 October 2013

Event for reference variable assigned to new instance?

Event for reference variable assigned to new instance?

Is there any design pattern or proper way to notify an Object A ,which
references an instance of an Object B through a reference variable B b =
new B(); A = b;, that the reference variable is referencing something
else\new? b = new B(); The reason I am asking is because this becomes
relevant to me when Object B contains data that is used for data binding.
I included some more explicit code to show my intent.
public class Person : INotifyPropertyChanged
{
//Fields
private string _name;
private int _age;
//Properties
public string Name { get { return _name; } set { if (Name != value) {
_name = value; OnPropertyChanged("Name"); } } }
public int Age { get { return _age; } set { if (Age != value) { _age =
value; OnPropertyChanged("Age"); } } }
//Events
public event PropertyChangedEventHandler PropertyChanged;
//Event-related Methods
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
//Constructors
public Person()
{
Name = "Default";
Age = 0;
}
public Person(string name, int age)
{
this.Name = name;
this.Age = age;
}
}
public partial class MainWindow : Window
{
private ObservableCollection<Person> people;
public MainWindow()
{
people = new ObservableCollection<Person>();
people.Add(new Person { Name = "Scott", Age = 23 });
people.Add(new Person { Name = "Joe", Age = 40 });
dataGrid1.ItemsSource = people;
InitializeComponent();
}
//Change a name in the person collection
private void btnChangeName_Click(object sender, RoutedEventArgs e)
{
if (people.Count > 0)
{
people.First().Name = "Name Changed";
}
}
//Add a name in the person collection
private void btnAddName_Click(object sender, RoutedEventArgs e)
{
people.Add(new Person { Name = "New Guy", Age = 18 });
}
//Change 'people' to a new person collection
private void btnChangeCollection_Click(object sender, RoutedEventArgs e)
{
people = new ObservableCollection<Person>();
people.Add(new Person { Name = "Pinky", Age = 24 });
people.Add(new Person { Name = "Brain", Age = 65 });
//The follow line must be in place for this to work
dataGrid1.ItemsSource = people;
}
}
If I change any data within the object such as the Name, it will reflect
properly to an object that is data bound to it. However if I reassign
people, then the object that is databound to people will not receive the
new reference unless I explicitly tell it to. My main question would be
what would be the proper way to setup an event that triggers whenever
people references a different object?

I'm receiving NoMethodError on Assert, Ruby 1.9.3

I'm receiving NoMethodError on Assert, Ruby 1.9.3

I'm new to Ruby, and running this test:
require 'selenium-webdriver'
require 'capybara'
require 'capybara/cucumber'
require 'rspec/expectations'
require 'test/unit'
driver = Selenium::WebDriver.for :firefox
Capybara.default_driver = :selenium
Given /^I am on the homepage$/ do
driver.navigate.to "http://testurl:8080/"
end
When(/^I enter admin authentication$/) do
usrname = > driver.find_element(:name, 'username')
usrname.send_keys "admin"
puts "Username Entered"
passwd = driver.find_element(:name, 'password')
passwd.send_keys "admin"
puts "Password Entered"
passwd.submit
puts "Details Submitted"
end
Then(/^I should be on the homepage$/) do
sleep 5
displayName = driver.find_element(:id, 'prefs_menu')
assert displayName.text == "Administrator" #
puts "Correct User Display Name"
end
And I keep getting the error
undefined method `assert' for #<Object:0x2895258> (NoMethodError)
./features/login_steps.rb:42:in `/^I should be on the homepage$/'
features\login.feature:10:in `Then I should be on the homepage'
Its probably something I'm overlooking completely - but any help?

Tuesday, 1 October 2013

How do I just extract the second component of a Python array?

How do I just extract the second component of a Python array?

E.g.
training_set
[((1, 0, 0), 1), ((1, 0, 1), 1), ((1, 1, 0), 1), ((1, 1, 1), 0), [(1, 1,
10), 1]]
How can I just extract the second part of each matrix within the array?
Just the 1,1,1,0,1?

MVC4 Twitter Bootstrap 3

MVC4 Twitter Bootstrap 3

I have an MVC4 application. I'm currently using GridMVC to show my data,
that all works fine. When a user clicks a row i want to show a bootstrap
modal to edit the data. I all ready have a partial view with the edit
fields. Whats the best way to implement a modal popup for the user to edit
the data? Anyone tried this before successfully?

Building maven from source

Building maven from source

pI'm trying to build maven from source (on Ubuntu 12.04) following the
tutorial:/p pa
href=http://maven.apache.org/guides/development/guide-building-m2.html
rel=nofollowhttp://maven.apache.org/guides/development/guide-building-m2.html/a/p
pI installed a previous version of maven using /p precodesudo apt-get
install maven /code/pre pI then checked out maven using:/p precodegit
clone https://git-wip-us.apache.org/repos/asf/maven.git maven /code/pre pI
then built maven using maven according to the apache guide, so I cd into
the checkout version of maven and did:/p precodemvn install /code/pre
pthis seemed to work fine, no errors or anything, but when I do /p pmvn
-version/p pMy output is:/p precodeApache Maven 3.0.4 Maven home:
/usr/share/maven Java version: 1.7.0_40, vendor: Oracle Corporation Java
home: /usr/lib/jvm/jdk1.7.0_40/jre Default locale: en_US, platform
encoding: UTF-8 OS name: linux, version: 3.5.0-37-generic, arch: amd64,
family: unix /code/pre pWhich is not the version I checked out, it's the
version of maven I got from apt-get. What exactly did mvn install do?
Where did it install maven to, and how do I update the mvn command?/p

Finding integral of functions involving e raised to another function.

Finding integral of functions involving e raised to another function.

$$\int_0^{\pi/4}(1+e^{\tan\theta})\sec^2\theta\, d\theta$$
I have tried to let $u=\sec^2\theta$ so that $du=\tan\theta \, d\theta$.
After doing that I was unable to figure a way to substitute $u$ and $du$
back into my integrand. The integrand I ended up with was
$(1+e^{du/d\theta}) u\, d\theta$. This does not seem right to me because I
have never learned to deal with the exponent of $e$ if it's even possible.
What other approach can I use that involves $u$-substitution?