Hi, When trying to install
'bcrypt-ruby', :lib = 'bcrypt'
and
'hpricot'
I get this in both cases (Using Windows XP)
C:/Ruby/bin/ruby.exe: No such file or directory -- extconf.rb (LoadError)
I installed from here http://rubyinstaller.org/downloads/ Rb 1.8.6, including the devkit
any hints?, thanks
I'm profiling a program using sampling profiling in YourKit and JProfiler, and also "manually" (I launch it and press Ctrl-Break several times to get thread dumps).
All three methods give me extremely strange results: some tens of percents of time spent in a 3-line method that does not even do any allocation or synchronization and doesn't have loops etc. Moreover, after I made this method into a NOP and even removed its invocation completely, the observable program performance didn't change at all (although it got a negligible memory leak, since it was a method for freeing a cheap resource).
I'm thinking that this might be because of the constraints that JVM puts on the moments at which a thread's stacktrace may be taken, and it somehow turns out that in my program it is exactly the moments where this method is invoked, although there is absolutely nothing special about it or the context in which it is invoked.
What can be the explanation for this phenomenon?
What are the aforementioned constraints?
What further measurements can I take to clarify the situation?
Hi,
I have an abstract class with some methods,including an abstract method(Execute()).This method is overridden in child class.Now, an event is raised(somewhere in application),and for this event there is a handler in base class.And,in this handler,I call Execute.
Now, the method of chilobject is executed.I am bit confused,how this works under the hood?
Given file names like these:
/the/path/foo.txt
bar.txt
I hope to get
foo
bar
Why this doesn't work?
#!/bin/bash
fullfile=$1
fname=$(basename $fullfile)
fbname=${filename%.*}
echo $fbname
What's the right way to do it?
I can't figure out how to call a base class method from a derived class method but concurrently applying this method call at an object passed as argument.
What I mean is this:
class Animal
{
virtual void eat(Animal& to_be_eaten) = 0;
};
class Carnivores: public Animal
{
virtual void eat(Animal& to_be_eaten) { /*implementation here*/}
};
class Wolf : public Carnivores
{
virtual void eat(Animal& to_be_eaten)
{ /*call eat method(of Base class) of Base to_be_eaten here*/ }
}
I thought of something like this
dynamic_cast<Carnivores&>(to_be_eaten).eat(*this) //and got a segmentation fault
Is there any way for this to be done?
Thank you!
New edit::
Updated the code
hi, is it possible to call a synchronized method from inside a synchronized method while waiting for resource to become available (using wait())? thanks
Hi guys. I have a few text fields and text views on my application's view. The keyboard comes up when I click in anyone of them. I have a method that gets called when any one of these objects is tapped in. However, I would like the method to execute its code only if the a certain Text Field(s) or a certain Text View(s) is tapped in. I would therefore like to have something like this in the method body:
{
if(currentField != mySpecialField)
{return;}
//Rest of the method code...
}
Now, my question is, how do I get a reference to the currently tapped in field so that I can perform the if-check.
Thanks guys. I'm a total noobee in Objective-C. :(
Hey guys,
i need a method to capitalize every first letter of a word.
This is what i got so far and it is working for almost every string...but it fails on this one "WELLNESS & RENOMME".
// method in stringModify Class
function capitalizeWords($words, $charList) {
$capitalizeNext = true;
for ($i = 0, $max = strlen($words); $i < $max; $i++) {
if (strpos($charList, $words[$i]) !== false) {
$`capitalizeNext` = true;
} else if ($capitalizeNext) {
$capitalizeNext = false;
$words[$i] = strtoupper($words[$i]);
}
}
return $words;
}
// Calling method
$stringModify->capitalizeWords("WELLNESS & RENOMME", " -&");
I hope someone can help me out...i tried for 1,5 hours now and don't have a clue. Thanks in advance for any tips or hints.
Greetz
Paulie
Consider this snippet of code:
public static class MatchCollectionExtensions
{
public static IEnumerable<T> AsEnumerable<T>(this MatchCollection mc)
{
return new T[mc.Count];
}
}
And this class:
public class Ingredient
{
public String Name { get; set; }
}
Is there any way to magically transform a MatchCollection object to a collection of Ingredient? The use-case would look something like this:
var matches = new Regex("([a-z])+,?").Matches("tomato,potato,carrot");
var ingredients = matches.AsEnumerable<Ingredient>();
In Ruby, how do you call a class method from one of that class's instances? Say I have
class Truck
def self.default_make
# Class method.
"mac"
end
def initialize
# Instance method.
Truck.default_make # gets the default via the class's method.
# But: I wish to avoid mentioning Truck. Seems I'm repeating myself.
end
end
the line Truck.default_make retrieves the default. But is there a way of saying this without mentioning Truck? It seems like there should be.
I have just asked which one is better?
Static Vs Non-Static?
http://stackoverflow.com/questions/3016717/static-vs-non-static-method-performance-c
I would like to take this discussion one step ahead.
Consider If i pass reference of Panel control as parameter to Public static method, will static method still rules in performance?
I have a method, which I wish to execute on the UI message pump and thus do the following:
private void SomeMethod() {
BeginInvoke(new MethodInvoker(MethodToInvoke));
}
private void MethodToInvoke() {
// This method contains code that I wish to execute on UI message pump.
}
Now, the above works just fine when I create a Debug build of the project. However, when I create a Release build, the "MethodToInvoke" method does not get invoked.
Does anyone have any idea why this might be?
Thanks, Elan
Is there any method that will restart the iPhone on call? It can be undocumented method (and probably will end up being since I can not find a method like it in the iPhone SDK reference).
My application is an auto-reply application for text messages. I have a BroadcastReceiver for when a message arrives, and I need it to run a public method (Send_SMS).
SMS_Sender.sendSMS(phoneNumber, messageText);
does not work however, and eclipse wants to change my method to static. This would not be an issue if I did not have more receivers that catch when the message is sent/delivered/etc in this class. These receivers are then errors for being contained in a static method.
So my question is, how do I run this method from a broadcast receiver so I can send the auto reply whenever it is triggered with a received message?
-Thank you in advance,
Nate
Hi friends,
i would like to retrive the value from post method..
I know its possible to retrive the get method value - from query string..
So how possible it for post method ?
Thanks,
Praveen jayapal
Cannot call action method 'System.Web.Mvc.PartialViewResult FooT' on controller 'Controller' because the action method is a generic method
<% Html.RenderAction("Foo", model = Model}); %>
Is there a workaround for this limitation on ASP MVC 2? I would really prefer to use a generic. The workaround that I have come up with is to change the model type to be an object. It works, but is not preferred:
public PartialViewResult Foo<T>(T model) where T : class
{
// do stuff
}
You may have already come across some of my other questions related to question, but I was having an issue with a SplitView iPad app where my application:didFinishLaunchingWithOptions method stopped executing after I went into Interface Builder and changed around the structure of my apps interface. I couldn't figure out what was preventing my didFinishLauchingWithOptions method from executing, but then I removed a "view" object I had in my view heirarchy (shown below) and suddenly my didFinishLauchingWithOptions method started executing again. I've moved passed it now, but I'm still unclear why that would cause the problem.
Any ideas why that "view" object would prevent the didFinishLaunchingWithOptions method from executing?
Hi,
I am trying to call a simple method in my code behind using Jquery with Ajax. But I get a 404 not found exception everytime. Unfortunately this is a web forms solution. So I dont have all the perks of MVC :(
It does get into the javascript method and gives the alert but won't go into my c# method. My previous experience of using this Jquery method is in an MVC website. Is it compatible with webforms sites?
Here is the code:
http://pastebin.com/Xdey4XTS
Thanks
Merry Christmas!
Hi there!
I'm trying to invoke a method with reflection that has a generic return type, like this:
public class SomeClass<T>
{
public List<T> GetStuff();
}
I get an instance of SomeClass with a call to a Repository's GetClass<T> generic method.
MethodInfo lGetSomeClassMethodInfo = typeof(IRepository)
.GetMethod("GetClass")
.MakeGenericMethod(typeof(SomeClass<>);
object lSomeClassInstance = lGetSomeClassMethodInfo.Invoke(
lRepositoryInstance, null);
After that, I this is where I try to invoke the GetStuff method:
typeof(SomeClass<>).GetMethod("GetStuff").Invoke(lSomeClassInstance, null)
I get an exception about the fact that the method has generic arguments. However, I can't use MakeGenericMethod to resolve the return type. Also, if instead of typeof(SomeClass<>) I use lSomeClassInstance.GetType() (which should have resolved types) GetMethod("GetStuff") returns null!
UPDATE
I have found the solution and will post the answer shortly.