How can I see a list of what global variables are defined in MATLAB? (I am using R2009a).
I have hunted unfruitfully for this on Google and SO, so apologies if it has been asked before.
For debug reasons, and curiosity, I wish to list all classes loaded to a specific class loader.
Seeing as most methods of a class loader are protected, what is the best way to accomplish what I want?
Thanks!
I put a list strings as validTypes in velocity. When I do :
#if (${validTypes}.contains("aaa"))
// do something
#end
it throws an error. But when I do :
#foreach (${validType} in ${validTypes})
${validType}
#end
it works fine. Do I need to use velocity tools for this? How do I use it in an eclipse plugin?
Are there any work around without using velocity tools?
Guys is there any better way to list all the months other than this
select to_char(add_months(to_date('01/01/1000', 'DD/MM/RRRR'), ind.l-1),
'MONTH') as
month_descr
, ind.l as month_ind
from dual descr
, (
select l
from (select level l from dual connect by level <=
12)
) ind
order by 2;
ANSWER :
SELECT to_char(add_months(SYSDATE, (LEVEL-1 )),'MONTH') as months FROM dual CONNECT BY LEVEL <= 12
So far i have this, which prints out every word in my list, but i am trying to print only one word at random. Any suggestions?
def main():
# open a file
wordsf = open('words.txt', 'r')
word=random.choice('wordsf')
words_count=0
for line in wordsf:
word= line.rstrip('\n')
print(word)
words_count+=1
# close the file
wordsf.close()
I have a list of dictionaries:
[{'title':'New York Times', 'title_url':'New_York_Times','id':4},
{'title':'USA Today','title_url':'USA_Today','id':6},
{'title':'Apple News','title_url':'Apple_News','id':2}]
I'd like to sort it by the title, so elements with A go before Z:
[{'title':'Apple News','title_url':'Apple_News','id':2},
{'title':'New York Times', 'title_url':'New_York_Times','id':4},
{'title':'USA Today','title_url':'USA_Today','id':6}]
What's the best way to do this?
Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id?
Thank you.
Is it possible to get a list of files that are in the working directory tree, but not in the current branch/tag? I currently diff the working copy with another directory updated to the same module and tag/branch but without the local non-repo files. It works, but doesn't honor the .cvsignore files. I figure there must be an option using a variation of 'cvs diff'.
Thanks in advance.
It seems JAXB can't read what it writes. Consider the following code:
interface IFoo {
void jump();
}
@XmlRootElement
class Bar implements IFoo {
@XmlElement
public String y;
public Bar() {
y = "";
}
public Bar(String y) {
this.y = y;
}
@Override
public void jump() {
System.out.println(y);
}
}
@XmlRootElement
class Baz implements IFoo {
@XmlElement
public int x;
public Baz() {
x = 0;
}
public Baz(int x) {
this.x = x;
}
@Override
public void jump() {
System.out.println(x);
}
}
@XmlRootElement
public class Holder {
private List<IFoo> things;
public Holder() {
things = new ArrayList<>();
}
@XmlElementWrapper
@XmlAnyElement
public List<IFoo> getThings() {
return things;
}
public void addThing(IFoo thing) {
things.add(thing);
}
}
// ...
try {
JAXBContext context = JAXBContext.newInstance(Holder.class, Bar.class, Baz.class);
Holder holder = new Holder();
holder.addThing(new Bar("1"));
holder.addThing(new Baz(2));
holder.addThing(new Baz(3));
for (IFoo thing : holder.getThings()) {
thing.jump();
}
StringWriter s = new StringWriter();
context.createMarshaller().marshal(holder, s);
String data = s.toString();
System.out.println(data);
StringReader t = new StringReader(data);
Holder holder2 = (Holder)context.createUnmarshaller().unmarshal(t);
for (IFoo thing : holder2.getThings()) {
thing.jump();
}
}
catch (Exception e) {
System.err.println(e.getMessage());
}
It's a simplified example, of course. The point is that I have to store two very differently implemented classes, Bar and Baz, in one collection. Well, I observed that they have pretty similar public interface, so I created an interface IFoo and made them two to implement it. Now, I want to have tools to save and load this collection to/from XML. Unfortunately, this code doesn't quite work: the collection is saved, but then it cannot be loaded! The intended output is
1
2
3
some xml
1
2
3
But unfortunately, the actual output is
1
2
3
some xml
com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to testapplication1.IFoo
Apparently, I need to use the annotations in a different way? Or to give up on JAXB and look for something else? I, well, can write "XMLNode toXML()" method for all classes I wan't to (de)marshal, but...
I am trying to get a list of webparts deployed on a web page in sharepoint 3.0. Is there way I can retrieve it from sharepoint content database or can I do it programmatically?
I have a fairly large makefile that creates a number of targets on the fly by computing names from variables. (eg foo$(VAR) : $(PREREQS)). Is there any way that gnu make can be convinced to spit out a list of targets after it has expanded these variables?
So I have this dictionary:
ScoreDict = {"Blue": {'R1': 89, 'R2': 80},
"Brown": {'R1': 61, 'R2': 77},
"Purple": {'R1': 60, 'R2': 98},
"Green": {'R1': 74, 'R2': 91},
"Red": {'R1': 87, 'Lon': 74}}
Is there any way how I can convert this dictionary into a list like this:
ScoreList = [['Blue', 89, 80], ['Brown', 61, 77],
['Purple', 60, 98], ['Green', 74, 91], ['Red', 87, 74]]
I'm not too familiar with dictionaries, so I really need some help here. Thanks in advance!
I am trying to add a list of linked lables to a listview. I amd doing so like this
foreach (String s in values)
{
LinkLabel label = new LinkLabel();
label.Text = s;
txtBox.Controls.Add(label);
}
}
It keeps adding just one item to the listbox even tho there are more. Any ideas?
ps) i can tell there are more items from adding a breakbpoint and using console.writeline when iterating
Thanks
I want to be able to get information about the selected item in the ordered list whose ID is #selectable. The below code returns the ID #selectable, I'm looking for the id of the item I just selected.
$('#selectable').selectable({
selected: function (event, ui) {
alert($(this).attr('id').toString());
}
});
Any ideas?
Given an IEnumerable<T> and row count, I would like to convert it to an IEnumerable<IEnumerable<T>> like so:
Input:
Row Count: 3
List: [1,2,3,4,5,6,7]
Output
[
[1,4,7]
[2,5]
[3,6]
]
How can I do this using LINQ?
Is there any add-in for VS2008 Pro that provides me the ability to expand and see the list of members of each class - methods, properties,etc... - by expanding its tree node in Solution Explorer?
As part of a homework assignment in Lisp, I am to use apply or funcall on any predicates I find. My question (uncovered in the coursework) is: how do I know when I've found a predicate in my list of arguments? I've done some basic google searching and come up with nothing so far. We're allowed to use Lisp references for the assignment - even a pointer to a good online resource (and perhaps a specific page within one) would be great!
Is it possible that the Android browser renders the HTML list box, such as:
item 1
item 2
item 3
item 4
All
as a dropdown? I can't seem to get it to display a proper multiline listbox. Anyone knows what the trick is?
How do I convert this:
[True, True, False, True, True, False, True]
Into this:
'AB DE G'
Note: C and F are missing in the output because the corresponding items in the input list are False.
I put a list strings as validTypes in velocity. When I do :
#if (${validTypes}.contains("aaa"))
// do something
#end
it throws an error. But when I do :
#foreach (${validType} in ${validTypes})
${validType}
#end
it works fine. Do I need to use velocity tools for this? How do I use it in an eclipse plugin?
Are there any work around without using velocity tools?
Hi all,
I would like to know if it is possible to get audit logs on only one document library or list. I wouldn't like to do it at site collection or server farm level.
Also, is it possible in the audit logs to get information for the case of editing, what the original information was before editing and the new information?
Thanks in advance,
Matrich
I made a table of contents using \tableofcontents Each section is made using \section yet when I do \subsection it is not listed in the table. How do I get it to list there? Thanks.
Hi All,
I want to import contact list from Yahoo and MSN by giving user name and password in Java.
I can do this with Gmail easily. Can anybody give me code sample in Java for this? Any type of help we be appreciated.
Thanks
Hi,
I'm having a problem displaying events in the correct order in wordpress. I think the problem is because wordpress is treating the date as a string and ordering it by the day because it's in british date format.
The goal is to display a list of future events with the most current event at the top of the list. But I must use the british date format of dd/mm/yyyy.
Do I need to go back to the drawing board or is there a way of converting the date to achieve the result I need?
Thanks in advance :)
<ul>
<?php // Get today's date in the right format
$todaysDate = date('d/m/Y');?>
<?php query_posts('showposts=50&category_name=Training&meta_key=date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
<h3><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></h3>
<?php $getDate = get_post_meta($post->ID, 'date', TRUE);
$dateArray = explode('/', $getDate); ?>
<?php if($getDate != '') { ?>
<div class="coursedate rounded"><?php echo date('d F Y', mktime(0, 0, 0, $dateArray[1], $dateArray[0], $dateArray[2])); ?></div>
<?php } ?>
<p><?php get_clean_excerpt(140, get_the_content()); ?>...</p>
<p><strong><a class="link" href="<?php the_permalink(); ?>">For further details and booking click here</a></strong></p>
</li>
<?php endwhile; ?>
<?php else : ?>
<li>Sorry, no upcoming events!</li>
<?php endif; ?>