I want to take two lists and find the values that appear in both.
a = [1, 2, 3, 4, 5]
b = [9, 8, 7, 6, 5]
returnMatches(a, b)
would return [5], for instance.
Hi, I have a structs action object instance that loads a variable from a properties file.I want it to happen only the first time the action is called, so in further executions its read from memory. Any hints ? Thanks.
For instance, if I have:
C:\42\main.py
and
C:\42\info.txt
and I want to read info.txt from main.py, I have to input "C:\42\info.txt" instad of just "info.txt".
Is it supposed to be like that?
If not, how can I fix it?
consider this class,with no instance variables and only methods which are non-synchronous can we infer from this info that this class in Thread-safe?
public class test{
public void test1{
// do something
}
public void test2{
// do something
}
public void test3{
// do something
}
}
Ive tried to gather information on as to how core data works, but can someone give me a clear explanation of all the stuff required...For instance NSDataContext, Fetchcontroller, NSDataModel, Presistent...
Perhaps all the steps involved to get a data...Now I'm also unclear about an SQLite file, like how do we load the data into the core data , once we have created our entities etc..
Thanks
Hello,
I would like to know how I can find the length of an integer in C.
For instance:
1 = 1
25 = 2
12512 = 5
etc. etc.
How do I do this and is this even possible in C ?
Hey Guys, I am trying to find the way to use same view-state but with different views so that based on where it is being called, I can provide different view to the user.
For instance, trying to achieve as follows:
Please share your experience so that I can achieve this functionality easily.
I am trying to code a game following instructions contained in an OU TMA document which read:
In the constructor, write code to assign a new instance of Random to ran which you should create using the Random class's zero argument constructor
Will this code work?
Random ran = new Random(0) ;
I am a relative newbie to Java, and I don't understand exactly what the instructions mean
Hey,
I'm looking for a way to use something similar to link_to_unless_current but for sub URLs, so for instance for both these URLs:
/entity_name/
/entity_name/123
it will not result as a link. How can I achieve that in Rails?
I've had a big problem in some library code, which I've pinned down to a single statement:
System.out.println((String) null);
Ok, the code doesn't actually look like that, but it certainly calls println with a null argument. Doing this causes my whole applicaio to throw an unexpected NullPointerException.
In general, should println throw this exception under that circumstance, or is this non-standard behavior due to a poor implementation of the out instance?
I maintain a product that is installed at multiple locations which as been haphazardly upgraded. Unique constraints were added to a number of tables, but I have no idea what the names are at any particular instance. What I do know is the table/columnname pair that has the unique constraints and I would like to write a script to delete any unique constraint on these column/table combinations. This is MSSQL 2000 and later. Something that works on 2000/2005/2008 would be best!
I am using Netbeans 6.8
The problem is that the projects explorer (that displays all the projects and their contents) displays each package as a node. For instance, if there is package hierarchy like this;
com.mycompany.myproject.package1.package1.1
then it displays 5 nodes for the five packages which is very disturbing while development.
Is there any way by which I can configure it(Netbeans) so that it groups all the subpackages of a package under one node and displays the subpackages only when I expand the package node?
If I want to save a linked instance as null in a database, what should I do?
I cannot simply pass null to obj.setOneToOneAssociatedObject(null)
Still, I want to save this link as null (table allows it).
I have a lot of classes and want to create some kind of 'directory'.
So that I can create menus automatically.
Clicking a menu-item would then create an instance of the class and shows the window.
What I want for this is an array of System.Type where I can stuff in all the classes without instantiating them.
Though from my test and (unsuccessful) googling, this doesn't seem possible.
Any ideas?
How to disable errors just for particular php function, and in the same time to know that the error occurred? For instance, I use a php function parse_url, to parse an array of urls, sometimes it returns an error, what I want to do is to parse next url once error occurs, and not to show it(error) on the screen.
Hello!
How do i get the actual max length of a specified column in php?
For instance, this table:
id - int(11)
name - string(20)
I want in php to select the maximum number of characters that a field can have, like
SELECT length(name) from table1
and it should then return 20 (since its the maximum number of characters for that field).
Say that I have a table with one column named CustomerId.
The example of the instance of this table is :
CustomerId
14
12
11
204
14
204
I want to write a query that counts the number of occurences of customer IDs.
At the end, I would like to have a result like this :
CustomerId NumberOfOccurences
14 2
12 1
11 1
204 2
14 1
I cannot think of a way to do this.
Hey I'm wondering when accessing Zend_Registry in an application if you need to include getInstance() and if so, why?
for example
Zend_Registry::getInstance()-get('db');
vs.
Zend_Registry::get('db');
they both seem to work with the later being less verbose.
I vaguely understand that Zend_Registry is a singleton, which I think means there can only be one instance of it? so why would you need getInstance()?
How to write a query that can find me all item_number start with a certain value ?
For instance there are item_numbers like these :
123_abc
123_xyz
ierireire
321_add
999_pop
My current query looks like this :
"select from "+PayPal_Message.class.getName()+" where item_number == '"+Item_Number+"' order by item_number desc"
What's a query look like that can return all item_numbers start with "123_" ?
For instance this code:
function stuff() {
this.onlyMethod = function () {
return something;
}
}
// some error is thrown
stuff().nonExistant();
Is there a way to do something like PHP's __call as a fallback from inside the object?
function stuff() {
this.onlyMethod = function () {
return something;
}
this.__call__ = function (name, params) {
alert(name + " can't be called.");
}
}
// would then raise the alert "nonExistant can't be called".
stuff().nonExistant();
hi
I have created an application in VStudio. It ran nicely in debugging mode, but my computer became slower and slower as I worked until it finaly became frozen.
after I manualy restarted it, the app wasn't running any more in debug and I get this execption in the browser.
Only I am connected right now to the app.
I have restarted the computer so there coudn't be any instance of a client connected
I have removed and reinstalled the IIS
what is wrong?
Hi,
I have a server where I installed SQL Server 2008 and after I applied the SP1.
Now, I want also to add the Analysis Services to this instance by using the "Add or remove features...".
My questions are:
Is it possible to add the Analysis Services on a server with SP1 already installed?
How can I apply the SP1 also to the new Analysis Service feature?
THANKS!