Basically I want to control the margin on the left of the list. Here's how I have it structured:
<li>
<a href="http://link.com">Main</a>
<ul>
<li>
<a href="http://link.com" title="">Sub1</a>
</li>
<li>
<a href="http://link.com" title="">Sub2</a>
</li>
</ul>
</li>
The sub-sections are ...
I'm using acts_as_list plugin to sort my to do lists.
* [drag] Test 1
* [drag] sadf 2
* [drag] asdf 3
However I want the numbering to the DESC instead. So it shows as
* [drag] Test 3
* [drag] sadf 2
* [drag] asdf 1
How do I do that?
Thanks
...
I have the following problem in scala. I have to find the first element in al list which satisfies a predicate function with two conditions in OR. The problem is that I would like to get the element but also know which of the two conditions has been satisfied. Here is a simple example:
val l1 = List("A", "B", "AA", "BB")
val l2 = List("...
I have a class that maintains list of objects of another class. List of objects is a public property. I would like to prevent users from adding and removing objects directly to list like this:
MyObject.MyListProperty.Add(object);
Instead I want them to use method that will internally do some processing and then add object to li...
I have a program like this
public class no_of_letters_count {
static int i;
public static void main(String[] args)
{
String sMessage="hello how r u";
String saMessage[] = sMessage.split("");
List sList = Arrays.asList(saMessage);
Collections.sort(sList);
Iterator i=sList.iterator();
while (i.hasNext())
...
I have to correct some C++/STL code. Unfortunately I have very little C++ experience and know nothing about STL. Nevertheless I finished most of it, but the function below is still giving me problems:
C++ source:
double MyClass::CalculateAvg(const std::list<double> &list)
{
double avg = 0;
std::list<int>::iterator it;
for(i...
I'm trying to use the property grid in the designer for Visual Studio.
I have a list of classes that I want the developer to be able to add to at design time so that the user can have access to extra features.
Here is some example code of what I have in the code already. The problem is when the developer goes to the design mode he c...
Please observe the following behavior:
a = u"foo"
b = u"b\xe1r" # \xe1 is an 'a' with an accent
s = [a, b]
print a, b
print s
for x in s: print x,
The result is:
foo bár
[u'foo', u'b\xe1r']
foo bár
When I just print the two values sitting in variables a and b, I get what I expect; when I put the string values in a list and print...
Is there a way to first sort then search for an objects within a linked list of objects.
I thought just to you one of the sorting way and a binary search what do you think?
Thanks
...
I have an ObservableCollection, and I'd like to set the content of an IList to this one. Now I could just create a new instance of the collection..:
public ObservableCollection<Bar> obs = new ObservableCollection<Bar>();
public void Foo(IList<Bar> list)
{
obs = new ObservableCollection<Bar>(list);
}
But how can I actually take ...
Hi,
I have an array with some objects, and there are several objects that are alike. E.g: fruit = [apple, orange, apple, banana, banana, orange, apple, apple]
What is the most efficient way to get the most represented object from this array? In this case it would be "apple" but how would you go out and calculate that in an efficient wa...
I am working on a C# application which consists of objects Department, Course, and Section. Each Department has many Courses, and each Course has many Sections. Currently I have three classes: Department, Course, and Section. Department contains some properties and then a List Courses, which contains the courses the department offers....
In python, what's the best way to test if a variable contains a list or a tuple? (ie. a collection)
Is isinstance as evil as suggested here? http://www.canonical.org/~kragen/isinstance/
...
Hi, I'm looking for a "nice" way to process a list where some elements need to be expanded into more elements (only once, no expansion on the results).
Standard iterative way would be to do:
i=0
while i < len(l):
if needs_expanding(l[i]):
new_is = expand(l[i])
l[i:i] = new_is
i += len(new_is)
else:
i += 1
...
Say you have a List of 32-bit Integers and the same collection of 32-bit Integers in a Multiset (a set that allows duplicate members)
Since Sets don't preserve order but List do, does this mean we can encode a Multiset in less bits than the List?
If so how would you encode the Multiset?
If this is true what other examples are there wh...
I know this is the basic.
I'm just wondering what is the elegant way to do it.
For example:
I want the the 'python01.wav' and 'py*thon' strings from this list
The list is like this:
[
[('name', 'entry')],
[('class', 'entry')],
[('type', 'text/javascript'), ('src', '/term_added.php?hw=python')],
[('type', 'text/javascript')],
[('clas...
I have a two lists, a List[A] and a List[B]. What I want is a Map[A,B] but I want the semantics of zip. So started out like so:
var tuplesOfAB = listOfA zip listOfB
Now I'm not sure how to construct a Map from my tuplesOfAB.
As a follow-up question, I also want to invert my map so that from a Map[A,B] I can create a Map[B,A]. Can an...
I have one list that contains Student informations
lsStudents = context.GetTable<Student>().Where(p => p.M_Id.Equals(1)).ToList();
And I have another one that contains Student Lessons
lsMarks = context.GetTable<Mark>().Where(p => p.M_StudentId.Equals(1)).ToList();
I want to merge these lists to one ObjectDataSource to bind to a rep...
I have a strange error with Hibernate3 here:
Got a SoftwareDescription class, persisting it with the following field commented out works just fine:
@OneToMany
@JoinColumn(name = "id")
private List<SoftwarePrice> prices = new ArrayList<SoftwarePrice>();
Got getters and setters for this field. When I try to persist a SoftwareDescriptio...
Good evening, people!
I'm trying to solve a rather simple problem, but.. well, it seems that I can't. :)
The idea is that I have a FIFO list (FIFO queue) with n elements and it's given a value, k (k < n). My little program has to move the elements to the left with k elements. (e.g. for n=4, k=3, a[]=(1, 2, 3, 4), the result is 4 1 2 3)...