Hello.
How can I define shared keys in my config/locales/lang.yml ?
For example I want to use
f.label :date
and to see translated word "date" in all forms for all models.
Is there a way to just put an attribute to a method so that the whole code in the method is executed in a transaction scope? I've seen this done in sharp architecture but I'm using Linq to sql not nhibernate. Thanks!
Let's assume I have a class called MyClass with an attribute called MyAttribute and a method called MyMethod(). Inside that method I'd like to have a variable called MyVariable. I'd like to set the value of MyVariable to "MyVariable" and MyAttribute to "MyAttribute" inside the call to MyMethod(). How can I do this in a Collaboration Diagram?
I can't find any info of this kind on the internet and the book I'm studying from (Applying UML and Patterns) is very vague in the details.
Thanks
Hi!
Im trying to find a good way to handle memcache keys for storing, retrieving and updating data to/from the cache layer in a more civilized way.
Found this pattern, which looks great, but how do I turn it into a functional part of a PHP application?
The Identity Map pattern: http://martinfowler.com/eaaCatalog/identityMap.html
Thanks!
Hi, trying to parse an XML with Beautifulsoup, but hit a brick wall when trying to use the "recursive" attribute with findall()
I have a pretty odd xml format shown below:
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
<catalog>true</catalog>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
<catalog>false</catalog>
</book>
</catalog>
As you can see, the catalog tag repeats inside the book tag, which causes an error when I try to to something like:
from BeautifulSoup import BeautifulStoneSoup as BSS
catalog = "catalog.xml"
def open_rss():
f = open(catalog, 'r')
return f.read()
def rss_parser():
rss_contents = open_rss()
soup = BSS(rss_contents)
items = soup.findAll('catalog', recursive=False)
for item in items:
print item.title.string
rss_parser()
As you will see, on my soup.findAll I've added recursive=false, which in theory would make it no recurse through the item found, but skip to the next one.
This doesn't seem to work, as I always get the following error:
File "catalog.py", line 17, in rss_parser
print item.title.string
AttributeError: 'NoneType' object has no attribute 'string'
I'm sure I'm doing something stupid here, and would appreciate if someone could give me some help on how to solve this problem.
Changing the HTML structure is not an option, this this code needs to perform well as it will potentially parse a large XML file.
Thanks in advance,
Marcos
Session[Constant] vs Session["String Literal"] Performance
I'm retrieving user-specific data like ViewData["CartItems"] = Session["CartItems"]; with a string literal for keys on every request. Should I be using constants for this?
If yes, how should I go about implementing frequently used string literals and will it significantly affect performance on a high-traffic site?
Related question does not address ASP.NET MVC or Session.
My JSON looks like this:
{
"[email protected]":"Person1",
"[email protected]":"Person65",
"[email protected]":"Person24"
}
It's returned in various number of elements, and various keys. How do I traverse the data if my code is like this:
$.post("includes/ajax.php", {
group_id : $('#group').val()
}, function(data) {
//how do i traverse data here?
}, "json");
Any help will be appreciated :)
Thanks!
How do you check if there is an attribute on an element in jquery? Similar to hasClass but with attr?
For example,
if ($(this).hasAttr("name")) {
function etc()
}
Thanks.
I am using few facebook social plugins and I am using the meta header. When validating the page, the W3C validator is throwing the error - "Error: there is no attribute "property".
I am using the XHTML Transitional doctype -
Pls Suggest if I have to change the doctype to something else.
Is it possible to get all keys in a column family using SimpleCassie?
I looked at SimpleCassie's google code, but do not figure out.
Another issue is that I used following code to access column value.
$price = $cassie-keyspace('ToyStore')-cf('Toys')-key('Transformer')-column('Price')-get();
echo $price;
It always complains "object of cassandra columnorsupercolumn cannot be converted to string".
Is it possible to print out the column value?
In wcf, what is the difference between applying the DataMember attribute on a property
private int m_SomeValue;
[DataMember]
public int SomeValue {
get {...}
set {...}
}
instead of a member variable
[DataMember]
private int m_SomeValue;
public int SomeValue {
get {...}
set {...}
}
?
Hibernate criteria, using DB2 dialect, generates the following sql with
composite keys in the IN clause, but DB2 answers that the query is incorrect:
select * from tableA where (x, y) IN ( ( 'x1', y1) )
but, DB2 throws this:
SQL0104N An unexpected token "," was found following ", y) in
( ('x1'".
Expected tokens may include: "+". SQLSTATE=42601
Array(0= blabla
1 = blabla
2 = blblll) etc..
Is there a way to change all the numeric keys to "Name" without looping through the array (so a php function)?
I'm trying to get the latest revision ID from my SVN project using Phing.
What I'm trying to do is the following:
get latest revision/commit number
from svn
store this revision number as an
attribute (so that I can use this
to append it to the archive I'm
already creating using phing)
I don't have a working copy on my server where phing is running, so I cannot use the Phing SvnLastRevisionTask.
Hello, I have two tables that are connected via a join table in a many-to-many relationship in the Entity Framework. I need to add a composite primary key in the join table for the two columns that are related to the joined tables via standard foreign keys but I'm sure how to do that.
Hi,
If I delete every keys in a ColumnFamily in a Cassandra db using remove(key), then if I use get_range_slices, rows are still there but without columns. How could I remove entire rows?
Thanks
Tobia Loschiavo
actually i got to the cause of the issue.
if you feed the textarea text attribute with an tag that has a valid src url, then for some reason flex will try to render everything as html.
Eg, try this:
<mx:TextArea id="textArea" width="100%" height="90%" text="<img src='http://url-to-a-valid-img"/>
and instead of it rendering it as raw text it will render it as an html.
any idea?
I am trying to do something like this:
property = 'name'
value = Thing()
class A:
setattr(A, property, value)
other_thing = 'normal attribute'
def __init__(self, etc)
#etc..........
But I can't seem to find the reference to the class to get the setattr to work the same as just assigning a variable in the class definition. How can I do this?
I'm trying to set up the NERDComment plugin in vim, but I'm having some trouble with the keys. I'd like to set the basic toggle functionality (comment a line if it's uncommented, uncomment if it's commented) to be c. The problem is that I've remapped the Leader to be ,, which is the same key that NERD wants for all of it's hotkeys. Anyone have any idea as to how to set this up?
Lets say we have some basic AR model.
class User < ActiveRecord::Base
attr_accessible :firstname, :lastname, :email
end
...
some_helper_method(attrib)
...
def
Now I would like to pass someuser.firstname to helper and I would like to get both the value and the attribute name, for example:
some_helper_method(someuser.firstname)
> "firstname: Joe"
some_helper_method(someuser.lastname)
> "lastname: Doe"
Suppose I have a python object x and a string s, how do I set the attribute s on x? So:
>>> x = SomeObject()
>>> attr = 'myAttr'
>>> # magic goes here
>>> x.myAttr
'magic'
What's the magic? The goal of this, incidentally, is to cache calls to x.__getattr__().
Is it possible to navigate an NSTableView's editable cell around the NSTableView using arrow keys and enter/tab? For example, I want to make it feel more like a spreadsheet.
The users of this application are expected to edit quite a lot of cells (but not all of them), and I think it would be easier to do so if they didn't have to double-click on each cell.
I'm getting strange error "'int' object has no attribute 'startswith'"
I haven't used the word "startswith" in my python program. ?
Does any one how to fix this -- or what it refers to ?
I would like to select all elements that have certain attribute or don't have it at all:
//job[@salary<"100" or !@salary]
This code is not valid. Which one is? Thanks!