0
голосов
4ответов
1296 просмотров

Bash Can not get IF to work like I want to

I need to understand bash if expressions. Sure, I've used Google. I know that it goes something like this: if [ expr operator expr ] then doSomeThing fi However, I understand that Bash doesn't have a boolean data type. I want to check if the file passed as an argument ($1) exists. The way I w...

44
голосов
6ответов
30300 просмотров

Difference between "var" and "object" in C#

Is the var type an equivalent to Variant in VB? When object can accept any datatype, what is the difference between those two?

1277
голосов
7ответов
731615 просмотров

What are the differences between type() and isinstance()?

What are the differences between these two code fragments? Using type(): import types if type(a) is types.DictType: do_something() if type(b) in types.StringTypes: do_something_else() Using isinstance(): if isinstance(a, dict): do_something() if isinstance(b, str) or isinstanc...

2
голосов
2ответов
5421 просмотров

JavaScript constructor parameter types

I have a JavaScript class representing a car, which is constructed using two parameters, which represent the make and model of the car: function Car(make, model) { this.getMake = function( ) { return make; } this.getModel = function( ) { return model; } } Is there a way to verify tha...

42
голосов
6ответов
14855 просмотров

Check if a parameter is a Python module?

How can I (pythonically) check if a parameter is a Python module? There's no type like module or package. >>> os <module 'os' from '/usr/lib/python2.6/os.pyc'> >>> isinstance(os, module) Traceback (most recent call last): File "/usr/lib/gedit-2/plugins/pythonconsole/co...

0
голосов
1ответов
327 просмотров

Has the way excel evaluates the Date type changed in Excel 2007

I have some fairly old code that runs just fine in Excel versions before 2007. In 2007, it throws a runtime error: run-time error 16 : expression is too complex. The expression is pretty simple and the error seems unrelated to the actual problem. I'm trying to compare 2 dates. Example code fo...

1
голосов
1ответов
83 просмотров

Is there a procedure required for updating mysql column types?

I'm trying to optimize my mysql tables (MyISAM) and I changed some column types with phpmyadmin, mostly from int to smallint, medium int, etc. After I did that mysql really bogged down and the server load went really high. I did this on a live site, which I figured was the problem, but even after...

3
голосов
4ответов
313 просмотров

Is this an abuse of the type system?

I'm working on a hobby project of the game Baroque Chess. For those that haven't played it, it has the same basic rules as chess, but the methods for movement and capturing are different. Naturally I created standard classes for the game: GameState, Board, Square, and a class designated for each...

3
голосов
3ответов
634 просмотров

C# get the the type Generic<t> given T</t>

I have a generic class in C#, like this: public class GenericClass&lt;T&gt; { ... } Now, I have the Type object for an object, and would like to, through reflection or otherwise, to get the Type object for GenericClass&lt;T&gt; where T corresponds to that Type object I have my object. Like...

15
голосов
1ответов
18770 просмотров

Proper way to check QObject derived class type in Qt

Lets say I have a two classes: class A : public QObject {}; class B : public QObject {}; then I go QObject *a = new A(); QObject *b = new B(); now, how do I make sure that "a" is an instance of class A, and "b" is an instance of class B? currently I do something like this: if (a-&gt;inhe...

14
голосов
3ответов
2756 просмотров

Return specific type within Haskell

I have a pretty general question about Haskell's type system. I'm trying to become familiar with it, and I have the following function: getN :: Num a =&gt; a getN = 5.0 :: Double When I try to compile this, I get the following error: Couldn't match expected type `a' against inferred type `Dou...

2
голосов
5ответов
4515 просмотров

C++ specialization, type_of or just typeid

I would like to know what is better to use in my situation and why. First of all I heard that using RTTI (typeid) is bad. Anyone could explain why? If I know exactly types what is wrong to compare them in a runtime? Furthermore is there any example how to use boost::type_of? I have found none sea...

3
голосов
3ответов
2954 просмотров

Assembly.GetType() and typeof() return different types?

Suppose you are given a Class.dll assembly compiled from the following simple code: namespace ClassLibrary { public class Class { } } And consider a different project with the above Class.dll as a project reference and with the following code: Assembly assembly = Assembly.LoadFrom...

1
голосов
2ответов
714 просмотров

SQL Server 2008 data types

What are the different SQL Server 2008 data types? I am specifically trying to find the equivalent of a long int.

1
голосов
2ответов
361 просмотров

What Is the difference between how the char datatype is stored or represented in 32bit vs 64bit in C?

What Is the difference between how the char datatype is stored or represented in 32bit vs 64bit in C?

0
голосов
1ответов
1406 просмотров

How to SetValue a Dynamic Type Field

string typeName = Request.QueryString["TypeName"]; Type t = Type.GetType(typeName); t.GetField("SomeField").SetValue(?,"Hello"); In the code above, I am creating Type object which holds the information of a Custom Type whose name comes from QueryString. Now the problem is this Custom Ty...

1
голосов
1ответов
512 просмотров

Why is the .TLB not being re-compiled by MIDL?

In my main project directory, there is a .TLB file. It has old information in it, and it is compiled into the binary -- which I can tell from looking at the compiled binary in a hex editor. What's weird is that I updated my .IDL in the main VC++ directory and that's compiled into a .TLB in the p...

12
голосов
7ответов
3029 просмотров

What libraries are available for parsing c++ to extract type information

I'm looking for a way to parse c++ code to retrieve some basic information about classes. I don't actually need much information from the code itself, but I do need it to handle things like macros and templates. In short, I want to extract the "structure" of the code, what you would show in a UML...

6
голосов
1ответов
463 просмотров

C++ : has_trivial_X type traits

The boost library, and it seems the upcoming C++0x standard, define various type trait templates to differentiate between objects which have trivial constructors, copy constructors, assignment, or destructors, versus objects which don't. One of the most significant uses of this is to optimize al...

1
голосов
2ответов
2671 просмотров

Dynamic Generic declaration of type T

I have an array which stores a dictionary of Types: //The dictionary: Dictionary&lt;CacheKey,Type&gt; TypeLookup; //This is the enum: public enum CacheKey { UserProfile, CustomerQuickSearch, CommissionConfiguration } I would like to use this Dictionary to declare a variable of typ...

2
голосов
11ответов
13311 просмотров

Declaring Unknown Type Variable in Python?

I have a situation in Python(cough, homework) where I need to multiply EACH ELEMENT in a given list of objects a specified number of times and return the output of the elements. The problem is that the sample inputs given are of different types. For example, one case may input a list of strings...

1
голосов
2ответов
411 просмотров

Pattern match data types and their nested name in Haskell

I have: data Color = Blue | Green | Red | White | Yellow deriving (Eq,Ord) And then data Term = Color | ... data Bag = Bag { color :: Color ... } Now I want to be able to pattern match to make sure that the term given is a Color and if so check it's "value" (Blue/Green...). Something like t...

1
голосов
8ответов
1467 просмотров

Java terminology for differentiating runtime type from compile-time type

In Java, an Object can have a runtime type (which is what it was created as) and a casted type (the type you have casted it to be). I'm wondering what are the proper name for these types. For instance class A { } class B extends A { } A a = new B(); a was created as a B however it was dec...

2
голосов
4ответов
2435 просмотров

PHP MySQL SELECT text truncated

I have a MySQL table with a column 'full_description' of type 'text'. In that column is a standard lorem ipsum (plus the word END): Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, qui...

3
голосов
4ответов
6772 просмотров

Can I have negative tinyint in SQLite?

I need to create a table (in SQLite) with a column which contains either "-1" or "+1". To save memory it is better not to use "int" as a type of the column. So, I thought about "smallint" and "tinyint". But smallint is not so small (from -32,768 to 32,767) and tinyint can be only positive (from 0...

2
голосов
2ответов
481 просмотров

SWIG / Lua: Determine member field data type

SWIG graciously provides the swig_type() function to get a string representation of the data type of a passed userdata object. However, in the case of member fields, SWIG and Lua consider those to be simple "number" items and so prints only "number" instead of the data type's name. e.g. typedef...

1
голосов
5ответов
3815 просмотров

How do I get Acrobat Reader Imported into Delphi 2007?

I have imported Acrobat Reader using Components | Import Components. The AcroPdf_TLB unit is created in the Imports directory. When I try to use the AcrobatReader component, as follows ... AcroDoc := TAcroPDF.Create(nil); ... I get an 'Unspecified Error' exception (EOleSysError). Any ideas? ...

4
голосов
4ответов
617 просмотров

Is there a built-in more elegant way of filtering-and-mapping a collection by element type?

If I want to narrow, say, an Iterable[A] for all elements of a particular type (e.g. String) I can do: as filter { _.isInstanceOf[String] } However, it's obviously desirable to use this as an Iterable[String] which can be done via a map: as filter { _.isInstanceOf[String] } map { _.asInstance...

2
голосов
4ответов
885 просмотров

Emulating a value type structure class in PHP

Is there any way to emulate a structure class in PHP? ie a class which passes by value and not by reference, so it can still be type hinted... And if so, what different techniques could be used? What's the best technique? If this is possible you could obviously create a fully type safe layer fo...

0
голосов
1ответов
970 просмотров

Type Error running feature in Rail's Cucumber

I'm trying to run Cucumber for my Rails application and keep getting this error: &gt; superclass mismatch for class Point (TypeError) There's a huge stack trace from this error, but it does not point to anything specific except a missing requirement. Here's the trace: rake features (in ...