types

html javascript type=file

With a html type=file, how can I validate to determine if a file was uploaded, (for client side validation using javascript or jquery) <form action="program" enctype="multipart/form-data" method="post"> <input type="text" name="textline" size="30"> <input type="file" name="datafile"> <input type="submit" value="Send"> </form> <script> ...

how to check assignability of types at runtime in C#?

The Type class has a method IsAssignableFrom() that almost works. Unfortunately it only returns true if the two types are the same or the first is in the hierarchy of the second. It says that decimal is not assignable from int, but I'd like a method that would indicate that decimals are assignable from ints, but ints are not always assi...

If characters can hold what integers can then why is there a need to use integers?

Why do we at all use integers in C? #include<stdio.h> int main() { char c=10; printf("%d",c); return 0; } Is same as: #include<stdio.h> int main() { int c=10; printf("%d",c); return 0; } ...

Issue understanding the distinction between Methods, Generic Types etc...

In the code below the "Move" public class derives fromthe generic type "Submit". "Submit" is a method, part of the DSS model, which handles messages and accepts two parameters, one is the message body and one is the message response. My question is: How or WHY does a class derive from a method?! It seems to me (since i'm only a beginne...

Is there anyway to use a numeric type as an object key?

It seems that when I use a numeric type as a key name in an object, it always gets converted to a string. Is there anyway to actually get it to store as a numeric? The normal typecasting does not seem to work. Example: var userId = 1; console.log( typeof userId ); // number myObject[userId] = 'a value'; console.dir(myObject); Dir Out...

Jstree set_type

I'm binding a set_type method to my jstree instance, and then calling the set_type method when clicking a button. Here's my code: $("#treeDiv").jstree({..}).bind("set_type.jstree", function(e, data) { $.post( "./classes/jstree/_demo/server.php", { "operation" : "set_type",...

[c++] How can I store types and affect them identifiers ?

Hi, I need to store types in a list with one identifier for each one; I need a random access to the elements of the list without knowing the identifier at compilation time I tried the meta-programming typelist but I don't know how to return types with the identifier, i get compilation error : 'cannot appear in a constant-expression' ...

@font-face for all fonts on a website

It seems as though the use of custom fonts on webpages is becoming increasingly common. With services like TypeKit, there is a also an increasing selection of high-quality fonts to work with. I'm wondering: Has anyone started building sites that use @font-face fonts exclusively? (Can I finally get rid of Verdana / arial and swap in M...

What class of object would a serialized ajax form be translated to in an action aparameter of a Spring controller?

If a HTML form contains multiple input fields: <form> <input id="in1" type="text" value="one"> <input id="in2" type="text" value="two"> <input id="in3" type="text" value="three"> </form> and is passed to a Spring controller as a serialized form like this: new Ajax.Request('/doajax', {asynchronous:true, evalScripts:true, parame...

Can we define a higher-kinded type-level identity function in Scala?

In Scala we can define the type-level identity function for lower-kinded types like so, type Id[A] = A Can we also define something similar for higher-kinded types? Ie. can we fill in the blanks in, type HKId[A[...]] = ... so that something similar to HKId[List] gets us back to the List type constructor? Binding of free names in t...

"Instance of Integral Float required" error

The file with following function: type Point = (Float, Float) type Circle = (Float, Float, Float) getCircle :: Point -> Point -> Point -> Circle getCircle (a, b) (c, d) (e, f) = (x, y, r) where x = ((a^2+b^2)*(f-d) + (c^2+d^2)*(b-f) + (e^2+f^2)*(d-b)) `div` (a*(f-d)+c*(b-f)+e*(d-b)) `div` 2 y = ((a^2+b^2)*(e-c) + (c^...

is the "is" operator just syntactic sugar for the "IsInstanceOfType" method

Are the following code snippets equivalent? class a {} class b:a {} b foo=new b(); //here it comes foo is a //...is the same as... typeof(a).isinstanceoftype(foo) Or maybe one of the other Type Methods map closer to the is operator. e.g. "IsAssignableFrom" or "IsSubclassOf" ...

Alter Type: add attribute if it doesn't already exist

Is there a way to alter an object type to add an attribute only if it doesn't already exist? I am writing a script that will be run on multiple databases. I'm trying to avoid unnecessary PLS-00410 errors (duplicate fields in RECORD,TABLE or argument list are not permitted). Something like the following: ALTER TYPE employee ADD ATTRIBUT...

Scala collection filter by type

Hi, im new to scala and ran into the following problem: I want to get a subcollection of an existing collection that only contains elements of a specific type. The following works: class C(val name : String) class D(name : String) extends C(name) { } val collection = Set[C](new C("C1"),new D("D1"),new C("C2"),new D("D2")) collection.c...

[C++] Data type problems

I'm pretty sure i'm the one who's just dumb and don't know my data structures... None the less, i'm going to post it here for you brilliant guys, so one of you may explain to me why this doesn't work: #include <iostream> using namespace std; double data_convert(int n); int main(void) { cout << data_convert(sizeof(int)); } double...

Why are C# 3.0 object initializer constructor parentheses optional?

It seems that the C# 3.0 object initializer syntax allows one to exclude the open/close pair of parentheses in the constructor when there is a parameterless constructor existing. Example: var x = new XTypeName { PropA = value, PropB = value }; As opposed to: var x = new XTypeName() { PropA = value, PropB = value }; I'm curious why ...

How to know the security type like OPEN, WPA, WPA2, WEP, when using Apple80211 api?

The wifi scanning apps like eWifi, WiFiFoFum and so on in Cydia can know the security type. How the apps know the security type like OPEN, WPA, WPA2, WEP, when using Apple80211 api? The value of CAPABILITIES is 1057, 1025,34,33,2,1073,1041 and 3121, etc... It is too various. I don't know what it represents. I am using "WEP" and "WPA_...

wordpress custom post type; query by id works, by post_name doesn't

Hi, I would need some help with Wordpress and custom post types/permalinks. I registered custom post type by the name "services" with the following arguments: $args = array( 'labels' => $labels, 'singular_label' => __('services'), 'public' => true, 'query_var' => true, 'show_ui' => true, 'menu_icon' => get_stylesheet_direct...

GHC compilation error arising from import of Control.Exception

Continuing roadblocks when trying to learn Haskell. I am following the "Real World Haskell" and when it comes to getting one of their complex examples to work, I obtain the following error "Ambiguous type variable e' in the constraint: GHC.Exception.Exception e' arising from a use of `handle' at FoldDir.hs:88:14-61 Probabl...

Would .NET be able to function just as well without the use of type Object?

I am asking this because it seems like using Object seems to be an easy way out to solve certain problems, like "I don't have a specific type, so use Object", etc. Also the reason this made me curious is because a colleague of mine told me that if .NET was a true object-oriented platform then it wouldn't have to have a catch all type li...