how would I print a 2d array in c using scanf for user input, array called grid[ ][ ] and a for loop?
say if the user types in 3 5, the output will be:
.....
.....
.....
I want to subclass a numeric type (say, int) in python and give it a shiny complex constructor. Something like this:
class NamedInteger(int):
def __init__(self, value):
super(NamedInteger, self).__init__(value)
self.name = 'pony'
def __str__(self):
return self.name
x = NamedInteger(5)
print x + 3
print str(x)
This works fine under Python 2.4, but Python 2.6 gives a deprecation warning. What is the best way to subclass a numeric type and to redefine constructors for builtin types in newer Python versions?
What potential memory leaks won't an implicit destructor handle? I know that if you have anything stored on the heap it won't handle it, and if you have a connection to a file or a database, that needs to be handled manually. Is there anything else? What about, say, non-base data types like vectors?
Also, in an explicit destructor, need you destroy non-heap variables which would have been destroyed by the implicit, or are they handled automatically?
Thanks
I have a user profile property. user not assigned any value that property. If I use below code. It is thorwing exception " object reference not set to an instance of an object "
userprof["OptOut"].ToString()
I tried all types
like
if (userprof["OptOut"] != null)
OR
if(userprof["OptOut"].Value != null)
nothing worked out for me.
Here userProf object has value. userprof["OptOut"].Value is null
How to handle this?
i have a problem which is that i want to extract information about FAT(file allocation table) in C# but the restriction is i cannot use System.IO
so How i get drive types?cluster information e.t.c
I have two domains set up in nginx.conf. Both are using SSL with their own certificates, and proxy to Apache.
However the second domain is completely ignored, and nginx always resolves to the first domain. I can't see what in the issue is with this configuration, having set the server_name in each case correctly (as far as I can see):
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
upstream site {
# real IP addresses masked
server xx.xxx.x.xxx;
server xx.xxx.x.xxx;
}
server {
# this domain always works
listen 443;
server_name *.first-site.com;
ssl on;
ssl_certificate /var/ssl/first-site.crt;
ssl_certificate_key /var/ssl/first-site.key;
location / {
access_log off;
proxy_connect_timeout 15;
proxy_next_upstream error;
proxy_pass http://site;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Protocol https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
}
server {
# this domain is ignored, always resolves to first-site.com
listen 443;
server_name *.second-site.com;
ssl on;
ssl_certificate /var/ssl/second-site.crt;
ssl_certificate_key /var/ssl/second-site.key;
location / {
access_log off;
proxy_connect_timeout 15;
proxy_next_upstream error;
proxy_pass http://site;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Protocol https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
}
}
Is there a way to "declare" a variable with a particular user-defined type in MATLAB? zeros() only works for built-in numeric types. The only solution I've come up with involves using repmat() to duplicate a dummy object zero times:
arr = repmat(myClass(), [1 0])
Without declaring variables this way, any code which does "arr(end+1) = myClass()" has to include a special case for the default empty matrix which is of type double.
Have I missed something a little more sensible?
Hey guys,
i have a list of items containig names.
then i have a eventlistener, which ckecks for keypress event.
if the user types i.g. an A all names starting with an A should be viewed with the A bold. so all starting As should be bold.
what is the best way using jquery to highlite only a part of a string?
thanks for your help
What is the minimum set of primitives required such that a language is Turing complete and a lisp variant?
Seems like car, cdr and some flow control and something for REPL is enough. It be nice if there is such list.
Assume there are only 3 types of data, integers, symbols and lists.(like in picolisp)
I think I know what a build is. But I am not sure. My definition of a build is another word for saying compiled application. Can someone please tell me what exactly a build is. And why do people ask for 2 types of builds. Such as Debug Build, Profile Build and a Release Build. What are the differences.
For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.
What is the optimal way to create such a function?
I want to use a field (kind of QTextEdit), which is capabale of storing picture and text (like MS Word is doing) and it serializes and deserialaizes picture+text data. Is there any Qt Widget that allows us to manipulate with picture and text simultaniously and it has set/get functions which operate with serializable type? In othger words, I want to know if there exsists any Qt widget that can store picture+text and has "get" types of function that returns the content of that widgets editable area, which is a Type that could be serialized with QDataStream.
$ bc
BC> ibase=2
BC> 110&101 // wanna get 100
(standar_in) 8: syntax error
Wikipedia informs that the ops are "|, & and ^". It may be that they work only in certain BC-types or I misread something.
I have list of urls of types:
http://www.abc.com/pk/etc
http://www.abc.com/pk/etc/
http://www.abc.com/pk/etc/etc
where etc can be anything.
So I want to search only those urls that contains www.abc.com/pk/etc or www.abc.com/pk/etc/
I've heard/read about people not wanting to reference the assembly because of the Windows component (e.g. "I don't want to reference Windows for my Web App).
I'd like to hear what a large community feels about this.
For which project types (business, data access, etc.) is it considered acceptable to reference WindowsBase.dll.
we have three types of data (tables):
Book (id,name,author...) ( about 3 million of rows)
Category (id,name) ( about 2000 rows)
Location (id,name) ( about 10000 rows)
A Book must have at least 1 type of Category (up to 3) AND a Book must have only one Location.
I need to correlate this data to get this query faster:
Select Books where Category = 'cat_id' AND Location = 'loc_id'
Select Books where match(name) against ('name of book') AND Location = 'loc_id'
Please I need some help.
Thanks
When you ask for a new HierarchyID between two others, the result gets progressively longer. For example, between 2/5.6 and 2/5.7 there's only 2/5.6.1 and other 4 component paths. The HierarchyID data type is limited to 800 some bytes, so you can't repeat this forever. Then again, integer types are also limited, but it isn't a problem in practice. Should I periodically defragment my table so that height doesn't grow unbounded?
how to get a Dictionary key by value in C#?
Dictionary<string, string> types = new Dictionary<string, string>()
{
{"1", "one"},
{"2", "two"},
{"3", "three"}
};
I want simething like this:
getByValueKey(string value);
getByValueKey("one") must be return "1".
What is the best way do this? may be HashTable, SortedLists?
I've got a batch script that does some processing and calls some perl scripts.
My question is if there was a way to put the perl code directly into the batch script and have it run both types of scripts.
Per MSDN, calling Type.GetMethods() stores reflected method information in a MemberInfo cache so the expensive operation doesn't have to be performed again.
I have an application that scans assemblies/types, looking for methods that match a given specification. The problem is that memory consumption increases significantly (especially with large numbers of referenced assemblies) since .NET hangs onto the method metadata.
Is there any way to clear or disable this MemberInfo cache?
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
I am thinking of using phplist to manage newsletter and other types of subscriptions. but i guess there is a limit applied by ISP on how much email i can send..
Any tips and tricks around how to use phplist and have a professional mass mailing software running
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?