I have data nested in to levels:
L1 L2 x1 x2 x3 x4
A This 20 14 12 15
A That 11 NA 8 16
A Bat Na 22 13 9
B This 10 9 11 6
B That 3 3 1 NA
B Bat 4 10 2 8
Now I want something simply - and I feel I have been able to do this just last month. But something has gone missing in my head: I want percentages (ignoring NA), ...
Possible Duplicates:
Enumerable.Cast<T> extension method fails to cast from int to long, why ?
Puzzling Enumerable.Cast InvalidCastException
Cast/Convert IEnumerable<T> to IEnumerable<U> ?
I'm trying to convert an array of integers to an array of doubles (so I can pass it to a function that takes an array of doubles).
The...
Hi,
I have a resultset class:
Public Class AResultSet
Implements IEnumerable(Of ConcreteResult)
Private _list As List(Of ConcreteResult)
Public Sub New()
_list = New List(Of ConcreteResult)
End Sub
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of ConcreteResult) Implements Syst...
I can't find a simple way to do this in T-SQL.
I have for example a column (SortExport_CSV) that returns an integer '2' thru 90.
If the stored number is a single digit, I need it to convert to a 2 digit string that begins with a 0.
I have tried to use CAST but I get stuck on how to display the style in the preferred format (0#)
Of cour...
I'm specifically referring to how stored procedure input parameters are handled. Does it just change how SQL Server interprets the data, or does it require SQL Server to make a copy of the data?
Thanks!
...
Here's the problem
I'm trying to cast form List to an object MyTypes which is defined as
public class MyTypes : List<MyType> { ... }
It won't cast directly with (MyTypes) - compiler error
Or with as MyTypes - returns null
I would think this would be possible, but clearly I have to overload some casting operation.
Help!
...
I've a Servlet filter which performs the following type cast:
HttpServletRequest httpRequest = (HttpServletRequest) req;
At present my filter is responsible for two tasks that would be better separated into two filters. If I'd split the logic into two filters I'd need two casts.
What is the performance impact of such a cast? Is it wo...
I am try to convert the following NHibernate query using dyanmic instantiation into an IList<t> rather than an IList.
IList<AllName> allNames =
(IList<AllName>)Session.CreateQuery(
@"select new AllName(
name.NameId, name.FirstName, origin.OriginId, origin.Description,
name.Sex, name.Description, name.SoundEx
) from Name name j...
I have two very simple classes, one extends the other:
public class LocationType implements Parcelable {
protected int locid = -1;
protected String desc = "";
protected String dir = "";
protected double lat = -1000;
protected double lng = -1000;
public LocationType() {}
public int getLocid() {
...
I'm trying to figure out how to execute machine code stored in memory.
I have the following code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
FILE* f = fopen(argv[1], "rb");
fseek(f, 0, SEEK_END);
unsigned int len = ftell(f);
fseek(f, 0, SEEK_SET);
char* bin = (char*)malloc(len);
...
i have this piece of code:
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
public class ClientLookup<T extends Remote> {
private T sharedObject;
public void lookup(String adress) throws MalformedURLException, RemoteException, N...
If I have a array with objects:
$a = array($objA, $objB);
(each object has a __toString()-method)
How can I cast all array elements to string so that array $a contains no more objects but their string representation? Is there a one-liner or do I have to manually loop through the array?
...
I have a query which uses the GROUP_CONCAT of mysql on an integer field.
I am using PHPMYADMIN to develop this query. My problem that instead of showing 1,2 which is the result of the concatenated field, I get [BLOB - 3B].
Query is
SELECT rec_id,GROUP_CONCAT(user_id)
FROM t1
GROUP BY rec_id
(both fields are unsigned int, both are n...
In the following snippet my intention is to convert a System.Object (which could be an FSharpList) to a list of whatever generic type it is holding.
match o with
| :? list<_> -> addChildList(o :?> list<_>)
| _ -> addChild(o)
Unfortunately only list<obj> is ever matched as a list. I would ...
I have a query looks like this
@NamedQuery(name="WorkingDayLog.getExpectedWorkingHours",query="select ((count(o.id)-:approvedVacs)*(:shiftDuration/60.0)*:factor) from WorkingDayLog o where o.workingDayDate between :appraisalStart and :appraisalEnd")`
it compiles fine but when executed it throws the following exception
ClassCastExce...
Ive some clases that share some attributes, and i would like to do something like:
$dog = (Dog) $cat;
is it posible or is there any generic work around?
Its not a superclass, or a interface or related in any way. They are just 2 different clases i would like php map the attributes from a cat class to a dog and give me the new object. –...
hello,
I have this piece of code can you explain me the output
unsigned int x=3;
~x;
printf("%d",x);
output is 10
I am not able to make it how.
I have compiled the code on turbo c
...
Are there any scenarios where it is absolutely necessary to perform an explicit cast of a variable in JavaScript to a String
In the following example it is not necessary:
var n=1;
var s = "Hello" + n;
var s = "Hello"+String(n); //not necessary
I've used a numeric value above, although this need not apply only to numerics.
...
Hi,
I am able to read the excel sheet from c# + asp.net application with MS interop Excel services (namespace). Data retrieving fine. But my excel sheet have a colummn whose formate type is of hh:mm:ss type. while retriving data i found value of this column fetching as General column getting some 0.45645646... like value. What should thi...
I know the type of object (let's say IAnimal) I need to instantiate, and the name (lets say Tiger). How do I write the code to instantiate Tiger, given that the variable that knows the object name is a string. I'm likely missing something simple here, but am currently stuck on this.
Update: I meant Class Tiger : IAnimal, changed abov...