In Java, is there a way to force a JVM instance to run on a single CPU/Core.
Additionally is there a way for given thread to figure out what CPU it is running on?
I have 2 integer fields that represent dates in the YYYYMMDD format. What is the best way to subtract 2 of these fields to get the correct # of days between them?
For instance, if I take the difference between 20100511 and 20100428 I would like the result to be 13 and not 83. I know I need to convert the integer fields into date formats but everything I have tried either throws an exception or doesn't work correctly.
What am I missing? Answers in vb.net please
Does anyone know the proper interpretation of the accuracy measurements returned by getAccuracy()? For instance, are they calculated as:
Circular Error Probability (meaning, if i understand correctly, radius of a 50% confidence circle)?
Radius of 95% confidence circle?
something else?
Many thanks for any advice you can give me.
I have a WPF UI Bound to a collection of AwesomeClass
Now, AwesomeClass has a collection of AwesomeParts objects.
How can I make my UI In such a way that (as an example)
for each AwesomeClass instance, there is a Tab on a tab panel
and then for each awesome part in that, there is an object on a listbox, on that tab.
Basically: Awesomes-Tabs
And Then : Awesome.Awesomeparts-Tabs.Listbox
Yes, I'm being lazy.
What happens when I call performSelector:onThread:... and pass in a thread that's currently blocked (on synchronous I/O, for instance)? Does the selector just get queued to be executed later?
Hey,
I need to call "panel.invalidate" outside my form (WINform) class also I need to change some other controls as well, I read similar question here, and tried what they said, but it didn't work and I wasn't convinced at all.
The answer I read was about exposing a public method like this:
public void EnableButton(bool enable)
{
this.myButton.Enabled = enable;
}
Also I made a static instance in the other file
static Form1 myForm = new Form1();
Any useful suggestions??
I'm building an e-commerce website in ASP.Net/C# and I'm having some difficulties with my shopping cart...
I want my costumers to be able to say "I want X boxes, and each box carries Y items".
Let's say, for instance, my website sells flowers. A client logs in and then chooses X bouquets and then for each bouquet he adds flowers from the catalog.
Can you point me out some links or tips in order to achieve this behaviour?
Thanks
I'd like to implement "Always on top" configuration option in my application that takes effect immediately.
I know that I can call Shell constructor with ON_TOP style. Is there a way to do that at runtime, that is after Shell instance has already been created?
Another opinion question:
What is the proper (in your opinion) to check for nulls in an MVC controller. For instance, if you have an edit controller that fetches a record from the db based on an id, what do you do if that record is not found? I found this article, but I'm not sure I like that method. Do you just check for it with an if statement and redirect to a 404 page? What solution do you use?
Hi,
The basic question is: How do I perform a basic override of a plugin method without editing the original plugin file?
Is it possible to create an override for a specific instance:
Example:
An rtf plugin uses:
$('selector').wysiwyg('setContent',newContent);
In order to display the rtf text as readonly I would like for the same method to be applied to a div instead of the body of the IFRAME
I would like to overwrite the original 'setContent' with my own code, just for this one element.
Thanks
Hi,
Is there any way to completely ignore link break and tab characters etc. in RegEx?
For instance, the line break and tab characters could be found anywhere and in any order in the content string.
... [CustomToken \t \r\n Type="" \t \r\n Property="" \n /] ... [CT ...
The is the RegularExpression that I am currently using:
(\[CustomToken).*?(\/\])
.NET API
Regex.Matches(string input, string pattern)
Thanks for your suggestion.
I need to create an aspect with a pointcut matching a method if:
- Is public
- Its class is annotated with @Controller
- One of its parameters (can have many) is annotated with @MyParamAnnotation.
I think the first two conditions are easy, but I don't know if its possible to accomplish the third with Spring. If it is not, maybe I can change it into:
- One of its parameters is an instance of type com.me.MyType (or implements some interface)
Do you think it's possible to achieve this? And will performance be good?
Thanks
Of the control sets I've seen for ASP.Net they all exhibit a strange property. They rewrite everything in the ASP.Net control set. For instance both DevExpress and Telerik have their own Panel, Label, and UpdatePanel controls among others.
Why do vendors do this? Is it just to create a form of lock in or is it actually necessary?
On Windows, it's possible to program an LSP service on top of Winsock which provides the ability to do a lot of manipulation/etc. with networked applications. For instance, some anti virus applications register an LSP and analyse network traffic that way. Is there a friendly way to accomplish the same sort of thing on OSX?
hi,
How can I make upper-case the first character of each word in a string accept a couple of words which I don't want to transform them, like - and, to, etc?
For instance, I want this - ucwords('art and design') to output the string below,
'Art and Design'
is it possible to be like - strip_tags($text, '<p><a>') which we allow and in the string?
or I should use something else? please advise!
thanks.
I heard a lot of people saying that it is a bad practice to use IoC.Resolve(), but I never heard a good reason why (if it's all about testing than you can just mock the container, and you're done).
now the advantages of using Resolve instead of Constructor Injection is that you don't need to create
classes that have 5 parameters in the constructor, and whenever you are going to create a instance of
that class you're not gonna need to provide it with anything
Hi guys,
I need to save files with non-latin filenames on a filesytem, using PHP.
I want to make this work cross-platform. How do I know what encoding I can use to write the file? I understand many modern filesystems are UTF-8 based (is this correct?), but I doubt Windows XP is (for instance).
So, is there a robust detection mechanism?
Evert
I've got a set of data that has three attributes, say A, B, and C, where A is kind of the index (i.e., A is used to look up the other two attributes.) What would be the best data structure for such data?
I used two dictionaries, with A as the index of each. However, there's key errors when the query to the data doesn't match any instance of A.
Hi
I am using asp.net 2.0
I set a hidden text box from javascript and on postback, i want to check the value stored on the text box in page init event. Here is what i tried
string t = Request.Form["currentMode"].ToString();
but i get an error saying " Object reference not set to an instance of an object."
Any idea?asp.
I have Ubuntu running in VMware Player. I am able to access an Apache instance on this VM by using the IP address but not by machine name.
How do I make the name of the VM visible to the host?
Edit: How do I add the machine name to my DNS? I am running within a Windows network.
Hi I am little new to SharePoint. Here is my question
How can we make different views for administrator VS logged in user. For instance I need to display the
quicklaunch only to admin and not for user. And user should not see site actions tab.
How can we set this. Please can anyone come up with solution or any blog that we can refer?
Thanks in advance.
I can use __LINE__ as a method parameter just fine, but I would like an easy way to use it in a function that uses strings.
For instance say I have this:
11 string myTest()
12 {
13 if(!testCondition)
14 return logError("testcondition failed");
15 }
And I want the result of the function to be:
"myTest line 14: testcondition failed"
How can I write logError? Does it have to be some monstrosity of a macro?
If a string in Perl 5 passes looks_like_number, it might as well be a number. For instance,
my $s = "10" + 5;
results in $s being assigned 15.
Are there any cases where a string does not behave like it's numeric equivalent would have?
Hello people.
I'd like to know if the absence of element ordering of the Python's built-in set structure is "random enough". For instance, taking the iterator of a set, can it be considered a shuffled view of its elements?
(If it matters, I'm running Python 2.6.5 on a Windows host.)
Hi
How to protect files (documents, images..) that r being sold over internet.
Is it possible to Deny access to all except a particular php file that lists those documents.
for instance www.mysite.com/list