Shhow me a very simple one line example in C# to check if a given bit is set in given byte
function signature should be like
bool IsBitSet(Byte b,byte nPos)
{
return .....;
}
The Speed vs
This:
Console c = System.console();
String readline;
String u = c.readLine("%s", "args");
Throws a NullPointerException. Yet the signature of the method is:
public String readLine(String fmt, Object... args)
Why's this exception being thrown?
The signature of the hashCode() method is
public int hashCode(){
return x;
}
in this case x must be an int(primitive) but plz can anyone explain it to me that the number
which the hashCode() returns must be a prime number, even number...etc or there is no specification ? the reason behind i am asking this question is i have seen it in different ids the auto generated code always returns a prime number, so i need to know why?
thanks in advance
Hi (it is propably stupid question)
how can acquire Domain class from database in test?
class PollServiceTests extends GrailsUnitTestCase {
Integer id = 1
void testSomething() {
Teacher teacher1 = Teacher.get(id)
assert teacher1 != null
}
}
I always get null or
No signature of method:
cz.jak.Teacher.get() is applicable for
argument types: (java.lang.Integer)
values: [1]
thanks a lot
Tom
Given a ParameterInfo p from this:
void foo(int modopt(IsLong) n);
p.GetOptionalCustomModifiers() returns a System.Runtime.CompilerServices.IsLong; however, if the method signature happens to be:
void foo(out int modopt(IsLong) n);
It does not. Is there a work around for this?
My external hard disk often starts making an irritating scraping sound. It stops if I do something that causes disk activity on it. But then, after 3 minutes or so, it starts again. It's very annoying. Is there a way to disable it?
It's a Western Digital WD 10EAVS.
Could someone with more PC building experience than me tell me whether these PC components can cooperate fully as a self-made PC?
Processor: Intel Core i5-3570K
Video card: Asus Radeon HD 7870
Motherboard: Gigabyte GA-Z77-D3H
RAM: Corsair CMZ16GX3M2A1600C10 Vengeance 16GB 1600MHz CL10 DDR3 (x2)
Storage: Western Digital WD1002FAEX (x2)
Display: Samsung S24B300HL
Sound: Logitech X140
Chassis: Thermaltake V4 Black Edition VM30001W2Z
Power supply: Seagate OEM 500W Builder PSU
Optical drive: Asus DRW-24B1ST
Thanks in advance! (btw, I know 32 GB RAM is unnecessary, but I want to buy it to use as a reserve)
Very quick question for freshbooks oauth. When requesting a Request Token you need to provide (amoung others) the oauth_signature method.
Is the signature the consumer key and the consumer secret seperated by an ampersand? e.g.
_consumer_key_%26_consumer_secret_
where _consumer_key_ is the consumer key. _consumer_secret_ is the consumer secret and %26 is a urlencode ampersand.
Hey,
I'm trying to get the GUID of a given sharepoint URL. I don't mind using the API or the webservices or Sharepoint's database.
if i were to write a function, it's signature would be:
//get a GUID from path.
string GetGuidFromPath(string path){}
I had a lead: SPContentMapProvider but it doesn't seem to get the right info.
Thank you!
I have a controller method with the following signature:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateValues(int id, MyViewModel[] array)
{
}
The id is normally picked up as part of the Url on other GET controller methods (I have a working route that does this)
I am successfully passing the array1 from the form in my view to the controller method, but how do I also put the id onto my Url so that when the user clicks the Submit button, the controller method will pick up the ID?
I am binding a ListView a property that essentially wraps the Values collection (ICollection) on a generic dictionary.
When the values in the dictionary change, I call OnNotifyPropertyChanged(property). I don't see the updates on the screen, with no binding errors.
When I change the property getter to return the Linq extension dictionary.Values.ToList(), without changing the signature of the property (ICollection) it works with no problem.
Any reason why the Values collection bind and notify properly without projecting to an IList<?
Are they same ?
Came across this line when reading about Java's main method's signature
"String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings."
As far as I know, the copy constructor must be of the Form T(const T&) or T(T&). What if I wanted to add default arguments to the signature?
T(const T&, double f = 1.0);
Would that be standards compliant?
I keep getting this error lately when I try to copy large (200+ MB) files over to my external. Following this, the disk becomes unresponsive and I got to unplug it and plug it in again to work.
The copy process also is unreasonably slow.
It is worth noting that this happens on Windows too, so it's not the notorious "Error -36" bug OS X had prior to 10.6.3.
The disk is a Western Digital 3200BMV.
Any ideas?
println args
println args.size()
println args.each{arg-> println arg}
println args.class
if (args.contains("Hello"))
println "Found Hello"
when ran give following error:
[hello, somethingelse]
2
hello
somethingelse
[hello, somethingelse]
class [Ljava.lang.String;
Caught: groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.
String;.contains() is applicable for argument types: (java.lang.String) values:
[Hello]
why can I not do contains?
Hi all,
i'd like to call a function using an array as a parameters:
var x = [ 'p0', 'p1', 'p2' ];
call_me ( x[0], x[1], x[2] ); // i don't like it
function call_me (param0, param1, param2 ) {
// ...
}
Is there a better way of passing the contents of x into call_me()?
Ps. I can't change the signature of call_me(), nor the way x is defined.
Thanks in advance
I would like to convert a sound file (from a digital voice recorder) with the extension .voc to an .mp3 file or some other common sound files. I am on Windows 7 64 bit.
I have tried the program voc2wav but it gives me an error message saying that the program isn't 64 bit.
The program has to be free and able to run without installing. (The voice recorder did come with a program that I could install, but I would like to avoid that).
I've something like this
Object[] myObjects = ...(initialized in some way)...
int[] elemToRemove = new int[]{3,4,6,8,...}
What's the most efficient way of removing the elements of index position 3,4,6,8... from myObjects ?
I'd like to implement an efficient Utility method with a signature like
public Object[] removeElements(Object[] object, int[] elementsToRemove) {...}
The Object[] that is returned should be a new Object of size myObjects.length - elemToRemove.length
I want to add a 1.5 - 2 TB hard drive to a Linux file and backup server we have in the office.
Will it make a difference if I'm using 5400 RPM vs a 7200 RPM hard drive? I was thinking about getting a Western Digital Green Drive or Samsung Ecogreen or similar.
Hi,
both abstract and virtual are going to be override in child class than whats a difference.
is it Virtual method have body and abstract is just a signature ????
During a make, I'm seeing an error along the lines of:
cc1: warnings being treated as errors
somefile.c:200: error: the frame size of 1032 bytes is larger than 1024 bytes
The line number points to the closing brace of a c function that has a signature like this:
void trace(SomeEnum1 p1, SomeEnum2 p2, char* format, ...) {
Anyone know what this type of error means in general?
The .NET framework provides a few handy general-use delegates for common tasks, such as Predicate<T> and EventHandler<T>.
Is there a built-in delegate for the equivalent of CompareTo()?
The signature might be something like this:
delegate int Comparison<T>(T x, T y);
This is to implement sorting in such a way that I can provide a lambda expression for the actual sort routine (ListView.ListViewItemSorter, specifically), so any other approaches welcome.
I have a Western Digital My Passport Studio external hard drive. It works with either Firewire 800 or USB 2.0. I've noticed that when I have it connected to Firewire, after a few hours, processes on my Mac start to go into an uninterruptible wait state. Eventually the system becomes so hard locked that I can't even shut it down. I have Spotlight indexing of the drive disabled, and the mds process seems to be the one that triggers this eventual system collapse.
I need to calculate permutations iteratively. The method signature looks like:
int[][] permute(int n)
For n = 3 for example, the return value would be:
[[0,1,2],
[0,2,1],
[1,0,2],
[1,2,0],
[2,0,1],
[2,1,0]]
How would you go about doing this iteratively in the most efficient way possible? I can do this recursively, but I'm interested in seeing lots of alternate ways to doing it iteratively.
I need something like this:
class Node (left : Node*, right : Node*)
I understand the ambiguity of this signature.
Is there a way around it better than the following?
class Node (left : Array[Node, right : Array[Node])
val n = new Node (Array(n1, n2), Array(n3))
Maybe some kind of separator like this?
val n = new Node (n1, n2, Sep, n3)