I have the following in the view:
<% unless contact_email.statuses.empty?%>
(<%= contact_email.statuses.find(:last).status%>)
<% end %>
contact_email is an instance of a specific model.
Could I do something like this?
class ContactEmail < ActiveRecord::Base
attr_accessible…
I have some code that does an awful lot of string formatting, Often, I end up with code along the lines of:
"...".format(x=x, y=y, z=z, foo=foo, ...)
Where I'm trying to interpolate a large number of variables into a large string.
Is there a good reason not to write a function like this that uses the inspect module to find variables to…
Let's say I have the following code:
struct mytype
{
~mytype() { /* do something like call Mix_CloseAudio etc */ }
};
int main()
{
mytype instant;
init_stuff();
start();
return 0;
}
Is that destructor guaranteed to be called even if exit() is used from somewhere inside start() ?
This is an extension of an earlier question. I realized, what I really want is to go to a URL /report/thisweek and it will do a .find (or named_scope) across contact_emails.date_sent where date_sent is between MONDAY and FRIDAY of the week to which Date.today belongs.
In other words, if today is THURSDAY, it will do a search for all…
I have a Ubuntu 12.04/Zentyal 2.3 server configured with WAN NATed on eth0, local interfaces eth1 and wlan0 bridged on br1 on which DHCP runs, and an OpenVPN connection on tun0. I only need the VPN for some things running on the gateway itself and I need to make sure that everything running on the gateway goes through the VPNs tun0.
…
We have 5 static IP addresses from our ISP:
XXX.XXX.XXX.180
XXX.XXX.XXX.181
XXX.XXX.XXX.182
XXX.XXX.XXX.183
XXX.XXX.XXX.184
On our firewall box, the NIC that is connected to our cable modem, appears to have all 5 IP addresses set on it. A previous IT guy set this thing up, and I'm not sure exactly what he did. Are these virtual…
Hi,
I cannot manage to run keepalived correctly on xen domU.
I am following this link for configuration, and it works great on some local VM (running with KVM). If I set up the exact same configuration, but on xen domU, it does not work: both servers do not see each other and decide to be master (10.120.100.99 being the virtual…
I'm having issues routing traffic thru VPN.
Here's my setup
I have 3 hosts, let's call them A, B and Z
B and Z have a VPN connection in the 10.10.10.x SUBNET
A and B have a direct connection in the 10.10.12.x SUBNET
I want to be able to route traffic from A to Z, like :
A <= 10.10.12.254 [LAN] 10.10.12.111 => B <=…
I've done lots of research on how to disable IPv6 on RedHat Linux and I have it almost completely disabled. However the loopback interface is still getting an inet6 loopback address (::1/128). I can't find where IPV6 is still enabled for loopback.
To disable IPV6 I added the following settings to /etc/sysctl.conf:
…
I am a bit stuck with an experiment of mine.
I have a network looking somewhat like this.
| Internet |
|
---- |Switch| ----
| |
Server w/pub IP | DD-WRT router 192.168.1.1 |
|
RFC1918 clients 192.168.1.0/24
…
When I try to compile my program I get these errors:
btio.c:19: error: ‘O_RDWR’ was not declared in this scope
btio.c:19: error: ‘open’ was not declared in this scope
btio.c: In function ‘short int create_tree()’:
btio.c:56: error: ‘creat’ was not declared in this scope
btio.c: In function ‘short int…
I am trying out the new Spring 4 release, and I found out that the BeanDefinition interface has been removed, if so what is the replacement class we should use in a scenario where we define a scope for a bean ?
Prior to Spring release of 4 you could do this.
@Bean…
Hello everyone,
I'm using the rails-settings gem, and I'm trying to understand how you add functions to ActiveRecord classes (I'm building my own library for card games), and I noticed that this gem uses one of the Meta-programming techniques to add the function to…
I am currently using Autofac, but am open to commentary regarding other IOC containers as well. I would prefer a solution using Autofac if possible. I am also somewhat new to IOC so I may be grossly misunderstanding what I should be using an IOC container for.
…
i have centos 6 with openvz installed on it, switch with vlan support.
I need following setup:
1) eth0 on openvz have be tagged multiple vlans.
2) each virtualhost have to be in single vlan.
yes,i already read wiki on openvz, but it is just not work.
I…
i am trying to set up policy routing on my home server. My network looks like this:
Host routed VPN gateway Internet link
through VPN
192.168.0.35/24 ---> 192.168.0.5/24 ---> 192.168.0.1 DSL router
…
I just started to experiment with LXC containers. I was able to create a container and start it up but I cannot get dhcp to assign the container an IP address. If I assign a static address the container can ping the host IP but not outside the…
We have the following XHTML table:
<tr class="encabezado">
<th scope="col" width="2%">1</th>
<th scope="col" width="2%">2</th>
<th scope="col" width="2%">3</th>
<th scope="col"…
An important part of Agile is the concept of transparency and visibility. In proper functioning teams, stakeholders can look at any team at any time in the iteration or release and see how that team is doing by simply looking at what we…
I am having an intermittent issue that is appearing on one server only, and is causing all MVC pages to fail to load with the error "An item with the same key has already been added."
Restarting the application pool fixes the issue,…
In normal JS I can do this:
function Droppable() {
this.relevant = true;
this.uuid = generateUUID();
};
var generateUUID = function() {
return '12345';
}
console.log(new Droppable); // returns Droppable {relevant:…
Hello All,
I have an IEnumerable<someClass>. I need to transform it into XML. There is a property called 'ZoneId'. I need to write some XML based on this property, then I need some decendent elements that provide data…
I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope.
Module 2 -
<dependency>
<groupId>blah</groupId>
…