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 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?
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?
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
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?
What is the least amount of code you can write to create, sort (ascending), and print a list of 100 random positive integers? By least amount of code I mean characters contained in the entire source file, so get to minifying.
I'm interested in seeing the answers using any and all programming languages. Let's try to keep one answer per language, edit the previous to correct or simplify. If you can't edit, comment?
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?
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 attempting to locate the nth element of a List in Prolog. Here is the code I am attempting to use:
Cells = [OK, _, _, _, _, _] .
...
next_safe(_) :-
facing(CurrentDirection),
delta(CurrentDirection, Delta),
in_cell(OldLoc),
NewLoc is OldLoc + Delta,
nth1(NewLoc, Cells, SafetyIdentifier),
SafetyIdentifier = OK .
Basically, I am trying to check to see if a given cell is "OK" to move into. Am I missing something?
I would like to display all resource drawables in a list so that the user can select one. Is there any way to loop through all R.drawable items so I don't have to hard code them into my program?
Hello,
I have the following question about JPA:
Can I save the order of the elements in a java.util.List? In my application the order in which I put elements in the Lists is important but after I get those collections from the database the order is not the same (as expected). Can you show me a way to deal with this problem?
P.S. There is not a field in the entities that I put in the collections by which I can order them.
Rosen
i want to do some actions when all items in checked list box are unchecked. There is only event ItemCheck but the check state is not updated until after the ItemCheck event occurs.
Is there a way for a jQuery function to "skip" an li? Such as Having 3 list items, you click on the 1st one, it calls a next() function, and skips the 2nd li and goes to the 3rd.
Current code is here:
$('ul.gallery li').click(function() {
$(window).scrollTo($(this).next('li'), 800, {easing:'easeOutCirc', axis:'x', offset:-50 } );
});
I want it to skip the immediate li and go to the one after that.
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 have column called "Date Submitted" as Date/time in one of the Custom list in sharepoint 2007.
it always set to today's date and 12AM time instead of that I want to display today's date with current time hh:mm:ss.
I tried creating calculated column TestDate and formula is : =TEXT(([Date Submitted]),"mm dd yyyy h:MM:SS")
result is 04 28 2010 0:00:00 I wanted to be 04/28/2010 10:50:34
Is it possible to achive this?
Thank you
kanta
I'd like to do had a dynamic number of one start/end time pairs passed to a function as an input parameter. The function would then use the list instead of just one start, and one end time in a select statement.
CREATE FUNCTION [dbo].[GetData]
(
@StartTime datetime,
@EndTime datetime
)
RETURNS int
AS
BEGIN
SELECT @EndTime = CASE WHEN @EndTime > CURRENT_TIMESTAMP THEN CURRENT_TIMESTAMP ELSE @EndTime END
DECLARE @TempStates TABLE
(StartTime datetime NOT NULL
, EndTime datetime NOT NULL
, StateIdentity int NOT NULL
)
INSERT INTO @TempStates
SELECT StartTime
, EndTime
, StateIdentity
FROM State
WHERE StartTime <= @EndTime AND EndTime >= @StartTime
RETURN 0
END
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; ?>
var phoneBookTableValue = [];
phoneBookTableValue.push({ "key":"1", "value":["3396,Accounting ,CCH,,,,","1"]});
phoneBookTableValue.push({ "key":"2", "value":["3284,Acute Care ,CCH,,,,","2"]});
phoneBookTableValue.push({ "key":"3", "value":["3265,Acute'Care East ,CCH,,,,","3"]});
When running the javascript file I get the error "missing ] after element list. Can U help me? PLZ!
Hi Experts,
I have a list of int values some thing like below (upper bound and lower bounds are dynamic)
1, 2, 3
4, 6, 0
5, 7, 1
I want to calculate the column values in vertical wise like
1 + 4 + 5 = 10
2 + 6 + 7 = 15
3 + 0 + 1 = 4
Expected Result = 10,15,4
Any help would be appreciated
Thanks
Deepu
Does anyone know of a Webmail Contact List Importer scripts (ColdFusion, PHP etc) like those used on Twitter and LinkedIn ? I've found some but they are paid for and I want some more bespoke & open.
To clarify a little more I'm not looking for a way to process .csv files :) I'm looking for a bit of code that can logging into gmail, yahoo mail, hotmail, aol and pull out the users address book.
hi all,
I am wondering what the best approach is for creating a horizontal list with custom buttons. I read there is no native control for that:
I am considering a UIView with a scroll view inside. On this scrollview I visualize my array of button objects.
Any thoughts?
I have a custom class in F# and I want to implement the [] list operator such that
let myClass = new myClassObj()
let someVal = myClass.[2]
I can't seem to find this on the web - I probably don't know the right term to search for... thanks in advance