Search Results

Search found 636 results on 26 pages for 'interpreter'.

Page 23/26 | < Previous Page | 19 20 21 22 23 24 25 26  | Next Page >

  • C# / IronPython Interop with shared C# Class Library

    - by Adam Haile
    I'm trying to use IronPython as an intermediary between a C# GUI and some C# libraries, so that it can be scripted post compile time. I have a Class library DLL that is used by both the GUI and the python and is something along the lines of this: namespace MyLib { public class MyClass { public string Name { get; set; } public MyClass(string name) { this.Name = name; } } } The IronPython code is as follows: import clr clr.AddReferenceToFile(r"MyLib.dll") from MyLib import MyClass ReturnObject = MyClass("Test") Then, in C# I would call it as follows: ScriptEngine engine = Python.CreateEngine(); ScriptScope scope = null; scope = engine.CreateScope(); ScriptSource source = engine.CreateScriptSourceFromFile("Script.py"); source.Execute(scope); MyClass mc = scope.GetVariable<MyClass>("ReturnObject ") When I call this last bit of code, source.Execute(scope) runs returns successfully, but when I try the GetVariable call, it throw the following exception Microsoft.Scripting.ArgumentTypeException: expected MyClass , got MyClass So, you can see that the class names are exactly the same, but for some reason it thinks they are different. The DLL is in a different directory than the .py file (I just didn't bother to write out all the path setup stuff), could it be that there is an issue with the interpreter for IronPython seeing these objects as difference because it's somehow seeing them as being in a different context or scope?

    Read the article

  • What is the best cross-platform language for desktop applications? (Java, Adobe Air, Flex, Silverlight??, Anything Else)

    - by Sootah
    My business partner needs a desktop application programmed, and it needs to be cross-platform as he wants Mac owners (OS X) to be able to run it as well. This, of course, is a bit of a problem for me as I program in PHP for my web projects and exclusively in C# (formerly used Visual Basic) for my desktop apps. I've been using (and love) NetBeans for my PHP stuff, and love Visual Studio just as much; they're both excellent IDEs. With this in mind, I'd like to find a language and IDE that's as similar to Visual Studio as possible (or at least something that makes development as easy as it does) for my cross-platform application development. In fact, if there is a language I can use with VS I'd be extremely happy. I realize that NetBeans has a Java Desktop App IDE, but have been having problems with it (my question in regards to that issue is here. I am also not sure that I really want to learn and use Java if there is a better, easier option out there. Obviously, the first language that came to mind that I can use cross-platform was Java, but I've also heard of people using Adobe Air, as well as Flex being used. I've never programmed in any of those languages, and as such have no frame of reference from which I can decide which would be best for me. I'm also not sure what other options there may be for me; perhaps there's another language I can use that'd be better than the three options I've already provided. (Can you make desktop apps with Silverlight? If so, did MS make an interpreter that will get them to work on OS X?) I like the syntax of C# quite a bit, and the Visual Studio IDE makes it extremely easy to make my apps with. As such, I'd like to find something that'll work as well for me with the cross-platform shatner as C# and its IDE does with my Windows apps. Thanks in advance for your help/opinions!

    Read the article

  • Why does this Haskell code produce the "infinite type" error?

    - by Charlie Flowers
    I am new to Haskell and facing a "cannot construct infinite type" error that I cannot make sense of. In fact, beyond that, I have not been able to find a good explanation of what this error even means, so if you could go beyond my basic question and explain the "infinite type" error, I'd really appreciate it. Here's the code: intersperse :: a -> [[a]] -> [a] -- intersperse '*' ["foo","bar","baz","quux"] -- should produce the following: -- "foo*bar*baz*quux" -- intersperse -99 [ [1,2,3],[4,5,6],[7,8,9]] -- should produce the following: -- [1,2,3,-99,4,5,6,-99,7,8,9] intersperse _ [] = [] intersperse _ [x] = x intersperse s (x:y:xs) = x:s:y:intersperse s xs And here's the error trying to load it into the interpreter: Prelude :load ./chapter.3.ending.real.world.haskell.exercises.hs [1 of 1] Compiling Main ( chapter.3.ending.real.world.haskell.exercises.hs, interpreted ) chapter.3.ending.real.world.haskell.exercises.hs:147:0: Occurs check: cannot construct the infinite type: a = [a] When generalising the type(s) for `intersperse' Failed, modules loaded: none. Thanks. EDIT: Thanks to the responses, I have corrected the code and I also have a general guideline for dealing with the "infinite type" error in Haskell: Corrected code intersperse _ [] = [] intersperse _ [x] = x intersperse s (x:xs) = x ++ s:intersperse s xs What the problem was: My type signature states that the second parameter to intersperse is a list of lists. Therefore, when I pattern matched against "s (x:y:xs)", x and y became lists. And yet I was treating x and y as elements, not lists. Guideline for dealing with the "infinite type" error: Most of the time, when you get this error, you have forgotten the types of the various variables you're dealing with, and you have attempted to use a variable as if it were some other type than what it is. Look carefully at what type everything is versus how you're using it, and this will usually uncover the problem.

    Read the article

  • MS Excel automation without macros in the generated reports. Any thoughts?

    - by ezeki77
    Hello! I know that the web is full of questions like this one, but I still haven't been able to apply the answers I can find to my situation. I realize there is VBA, but I always disliked having the program/macro living inside the Excel file, with the resulting bloat, security warnings, etc. I'm thinking along the lines of a VBScript that works on a set of Excel files while leaving them macro-free. Now, I've been able to "paint the first column blue" for all files in a directory following this approach, but I need to do more complex operations (charts, pivot tables, etc.), which would be much harder (impossible?) with VBScript than with VBA. For this specific example knowing how to remove all macros from all files after processing would be enough, but all suggestions are welcome. Any good references? Any advice on how to best approach external batch processing of Excel files will be appreciated. Thanks! PS: I eagerly tried Mark Hammond's great PyWin32 package, but the lack of documentation and interpreter feedback discouraged me.

    Read the article

  • Pass an array from IronRuby to C#

    - by cgyDeveloper
    I'm sure this is an easy fix and I just can't find it, but here goes: I have a C# class (let's call it Test) in an assembly (let's say SOTest.dll). Here is something along the lines of what I'm doing: private List<string> items; public List<string> list_items() { return this.items; } public void set_items(List<string> new_items) { this.items = new_items; } In the IronRuby interpreter I run: >>> require "SOTest.dll" true >>> include TestNamespace Object >>> myClass = Test.new TestNamespace.Test >>> myClass.list_items() ['Apples', 'Oranges', 'Pears'] >>> myClass.set_items ['Peaches', 'Plums'] TypeError: can't convert Array into System::Collections::Generic::List(string) I get a similar error whether I make the argument a 'List< string ', 'List< object ' or 'string[ ]'. What is the proper syntax? I can't find a documented mapping of types anywhere (because it's likely too complicated to define in certain scenarios given what Ruby can do).

    Read the article

  • Capabilities & Linux & Java

    - by Marek Jelen
    Hi, I am experimenting with linux capabilities for java application ... I do not want to add capabilities to interpreter (JVM), so I tried to write simple wrapper (with debugging information printed to stdout): #include <stdio.h> #include <stdlib.h> #include <sys/capability.h> #include <unistd.h> int main(int argc, char *argv[]){ cap_t cap = cap_get_proc(); if (!cap) { perror("cap_get_proc"); exit(1); } printf("%s: running with caps %s\n", argv[0], cap_to_text(cap, NULL)); return execlp("/usr/bin/java", "-server", "-jar", "project.jar", (char *)NULL); } This way, I can se that the capability is set for this execucatable: ./runner: running with caps = cap_net_bind_service+p And getcap shows runner = cap_net_bind_service+ip I have the capability set to be inheritable, so there should be no problem. However java still don't want to bind to privileged ports :-( I am getting this error: sun/nio/ch/Net.java:-2:in `bind': java.net.SocketException: Permission denied (NativeException) Can someone help me to resolve this? Thanks in advance

    Read the article

  • Tree-like queues

    - by Rehno Lindeque
    I'm implementing a interpreter-like project for which I need a strange little scheduling queue. Since I'd like to try and avoid wheel-reinvention I was hoping someone could give me references to a similar structure or existing work. I know I can simply instantiate multiple queues as I go along, I'm just looking for some perspective by other people who might have better ideas than me ;) I envision that it might work something like this: The structure is a tree with a single root. You get a kind of "insert_iterator" to the root and then push elements onto it (e.g. a and b in the example below). However, at any point you can also split the iterator into multiple iterators, effectively creating branches. The branches cannot merge into a single queue again, but you can start popping elements from the front of the queue (again, using a kind of "visitor_iterator") until empty branches can be discarded (at your discretion). x -> y -> z a -> b -> { g -> h -> i -> j } f -> b Any ideas? Seems like a relatively simple structure to implement myself using a pool of circular buffers but I'm following the "think first, code later" strategy :) Thanks

    Read the article

  • Can knowing C actually hurt the code you write in higher level languages?

    - by Jurily
    The question seems settled, beaten to death even. Smart people have said smart things on the subject. To be a really good programmer, you need to know C. Or do you? I was enlightened twice this week. The first one made me realize that my assumptions don't go further than my knowledge behind them, and given the complexity of software running on my machine, that's almost non-existent. But what really drove it home was this Slashdot comment: The end result is that I notice the many naive ways in which traditional C "bare metal" programmers assume that higher level languages are implemented. They make bad "optimization" decisions in projects they influence, because they have no idea how a compiler works or how different a good runtime system may be from the naive macro-assembler model they understand. Then it hit me: C is just one more abstraction, like all others. Even the CPU itself is only an abstraction! I've just never seen it break, because I don't have the tools to measure it. I'm confused. Has my mind been mutilated beyond recovery, like Dijkstra said about BASIC? Am I living in a constant state of premature optimization? Is there hope for me, now that I realized I know nothing about anything? Is there anything to know, even? And why is it so fascinating, that everything I've written in the last five years might have been fundamentally wrong? To sum it up: is there any value in knowing more than the API docs tell me? EDIT: Made CW. Of course this also means now you must post examples of the interpreter/runtime optimizing better than we do :)

    Read the article

  • OCaml delimiters and scopes

    - by Jack
    Hello! I'm learning OCaml and although I have years of experience with imperative programming languages (C, C++, Java) I'm getting some problems with delimiters between declarations or expressions in OCaml syntax. Basically I understood that I have to use ; to concatenate expressions and the value returned by the sequence will be the one of last expression used, so for example if I have exp1; exp2; exp3 it will be considered as an expression that returns the value of exp3. Starting from this I could use let t = something in exp1; exp2; exp3 and it should be ok, right? When am I supposed to use the double semicol ;;? What does it exactly mean? Are there other delimiters that I must use to avoid syntax errors? I'll give you an example: let rec satisfy dtmc state pformula = match (state, pformula) with (state, `Next sformula) -> let s = satisfy_each dtmc sformula and adder a state = let p = 0.; for i = 0 to dtmc.matrix.rows do p <- p +. get dtmc.matrix i state.index done; a +. p in List.fold_left adder 0. s | _ -> [] It gives me syntax error on | but I don't get why.. what am I missing? This is a problem that occurs often and I have to try many different solutions until it suddently works :/ A side question: declaring with let instead that let .. in will define a var binding that lasts whenever after it has been defined? What I basically ask is: what are the delimiters I have to use and when I have to use them. In addition are there differences I should consider while using the interpreter ocaml instead that the compiler ocamlc? Thanks in advance!

    Read the article

  • Cast base class object to derived class

    - by Popgalop
    Lets say I have two classes, animal and dog like this. class Animal { }; class Dog : public Animal { }; And I have an animal object named animal, that is actually an instance of dog, how would I cast it back to dog? This may seem like an odd question, but I need it because I am writing a programming language interpreter, and on the stack everything is stored as a BaseObject, and all the other datatypes extend BaseObject. How would I cast the base object from the stack, to a specific data type? I have tried something like this Dog dog = static_cast<Dog>(animal); But it gives me an error 1>------ Build started: Project: StackTests, Configuration: Debug Win32 ------ 1> StackTests.cpp 1>c:\users\owner\documents\visual studio 2012\projects\stacktests\stacktests\stacktests.cpp(173): error C2440: 'static_cast' : cannot convert from 'Animal' to 'Dog' 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1>c:\users\owner\documents\visual studio 2012\projects\stacktests\stacktests\stacktests.cpp(173): error C2512: 'Dog' : no appropriate default constructor available ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Read the article

  • Attempt to create nested for loops generating missing arguments error

    - by JerryK
    Am attempting to teach myself to program using Tcl. (I want to become more familiar with the language to understand someone else's code - SCID chess) The task i've set myself to motivate my learing of Tcl is to solve the 8 queens problem. My approach to creating a program is to sucessively 'prototype' a solution. So. I'm up to nesting a for loop holding the q pos on row 2 inside the for loop holding the q pos on row 1 Here is my code set allowd 1 set notallowd 0 for {set r1p 1} {$r1p <= 8} {incr r1p } { puts "1st row q placed at $r1p" ;# re-initialize r2 'free for q placemnt' array after every change of r1 q pos: for {set i 1 } {$i <= 8} {incr i} { set r2($i) $allowd } for { set r2($r1p) $notallowd ; set r2([eval $r1p-1]) $notallowd ; set r2([eval $r1p+1]) $notallowd ; set r2p 1} {$r2p <= 8} { incr r2p ;# end of 'next' arg of r2 forloop } ;# commnd arg of r2 forloop placed below: {puts "2nd row q placed at $r2p" } } My problem is that when i run the code the interpreter is aborting with the fatal error: "wrong #args should be for start test next command. I've gone over my code a few times and can't see that i've missed any of the for loop arguments.

    Read the article

  • Has anyone ever had OpenCV work with Python 2.7 on MacOS 10.6?

    - by ?????
    I've been trying on and off for the past 6 months to get OpenCV to work with Python on MacOS. Every time there's a new release, I try again and fail. I've tried both 64-bit and 32-bit, and both the xcode gcc and gcc installed via macports. I just spend the past two days on it, hopeful that the latest OpenCV release, that appears to include Python support directly would work. It doesn't. I've also tried and failed to use this: http://code.google.com/p/pyopencv/ I've been using OpenCV with C++ or Microsoft C++/CLI for the past few years, but I'd love to use it with Python on a Mac because that is my primary development environment. I'd love to hear from anyone who's actually been able to get the opencv python examples to run under Mac OS 10.6, either 32 or 64-bit. My last attempt was to follow the instructions on this page http://recursive-design.com/blog/2010/12/14/face-detection-with-osx-and-python/ with a clean, fresh install of 10.6 on a 64-bit capable Mac. My PYTHONPATH is set, and I can see the cv library in it. But an "import cv" from python fails. Previously, the closest I've ever gotten (again, staring on a clean, fresh 10.6 install) was this: Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv Fatal Python error: Interpreter not initialized (version mismatch?) Abort trap thrilllap-2:~ swirsky$ I've seen a lot of folks answering similar questions here, but have never seen an definitive answer for it.

    Read the article

  • removing a case clause: bash expansion in sed regexp: X='a\.b' ; Y=';;' sed -n '/${X}/,/${Y}/d'

    - by ChrisSM
    I'm trying to remove a case clause from a bash script. The clause will vary, but will always have backslashes as part of the case-match string. I was trying sed but could use awk or a perl one-liner within the bash script. The target of the edit is straightforward, resembles: $cat t.sh case N in a\.b); #[..etc., varies] ;; esac I am running afoul of the variable expansion escaping backslashes, semicolons or both. If I 'eval' I strip my backslash escapes. If I don't, the semi-colons catch me up. So I tried subshell expansion within the sed. This fouls the interpreter as I've written it. More escaping the semi-colons doesn't seem to help. X='a\.b' ; Y=';;' sed -i '/$(echo ${X} | sed -n 's/\\/\\\\/g')/,/$(echo ${Y} | sed -n s/\;/\\;/g')/d t.sh And this: perl -i.bak -ne 'print unless /${X}/ .. /{$Y}/' t.sh # which empties t.sh and eval perl -i.bak -ne \'print unless /${X}/ .. /{$Y}/' t.sh # which does nothing

    Read the article

  • Plugin architecture in C using libdl

    - by LukeN
    I've been toying around, writing a small IRC framework in C that I'm now going to expand with some core functionality - but beyond that, I'd like it to be extensible with plugins! Up until now, whenever I wrote something IRC related (and I wrote a lot, in about 6 different languages now... I'm on fire!) and actually went ahead to implement a plugin architecture, it was inside an interpreted language that had facilities for doing (read: abusing) so, like jamming a whole script file trough eval in Ruby (bad!). Now I want to abuse something in C! Basically there's three things I could do define a simple script language inside of my program use an existing one, embedding an interpreter use libdl to load *.so modules on runtime I'm fond of the third one and raather avoid the other two options if possible. Maybe I'm a masochist of some sort, but I think it could be both fun and useful for learning purposes. Logically thinking, the obvious "pain-chain" would be (lowest to highest) 2 - 1 - 3, for the simple reason that libdl is dealing with raw code that can (and will) explode in my face more often than not. So this question goes out to you, fellow users of stackoverflow, do you think libdl is up to this task, or even a realistic thought?

    Read the article

  • Entities used to serialize data have changed. How can the serialized data be upgraded for the new entities?

    - by i8abug
    Hi, I have a bunch of simple entity instances that I have serialized to a file. In the future, I know that the structure of these entities (ie, maybe I will rename Name to Header or something). The thing is, I don't want to lose the data that I have saved in all these old files. What is the proper way to either load the data from the old entities into new entities upgrade the old files so that they can be used with new entities Note: I think I am stuck with binary serialization, not xml serialization. Thanks in advance! Edit: So I have an answer for the case I have described. I can use a dataContractSerializer and do something like [DataMember("bar")] private string foo; and change the name in the code and keep the same name that was used for serialization. But what about the following additional cases: The original entity has new members which can be serialized Some serialized members that were in the original entity are removed Some members have actually changed in function (suppose that the original class had a FirstName and LastName member and it has been refactored to have only a FullName member which combines the two) To handle these, I need some sort of interpreter/translator deserialization class but I have no idea what I should use

    Read the article

  • Python list recursion type error

    - by Jacob J Callahan
    I can't seem to figure out why the following code is giving me a TypeError: 'type' object is not iterable pastebin: http://pastebin.com/VFZYY4v0 def genList(self): #recursively generates a sorted list of child node values numList = [] if self.leftChild != 'none': numList.extend(self.leftChild.genList()) #error numList.extend(list((self.Value,))) if self.rightChild != 'none': numList.extend(self.rightChild.genList()) #error return numList code that adds child nodes (works correctly) def addChild(self, child): #add a child node. working if child.Value < self.Value: if self.leftChild == 'none': self.leftChild = child child.parent = self else: self.leftChild.addChild(child) elif child.Value > self.Value: if self.rightChild == 'none': self.rightChild = child child.parent = self else: self.rightChild.addChild(child) Any help would be appreciated. Full interpreter session: >>> import BinTreeNode as BTN >>> node1 = BTN.BinaryTreeNode(5) >>> node2 = BTN.BinaryTreeNode(2) >>> node3 = BTN.BinaryTreeNode(12) >>> node3 = BTN.BinaryTreeNode(16) >>> node4 = BTN.BinaryTreeNode(4) >>> node5 = BTN.BinaryTreeNode(13) >>> node1.addChild(node2) >>> node1.addChild(node3) >>> node1.addChild(node4) >>> node1.addChild(node5) >>> node4.genList() <class 'list'> >>> node1.genList() Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:...\python\BinTreeNode.py", line 47, in genList numList.extend(self.leftChild.genList()) #error File "C:...\python\BinTreeNode.py", line 52, in genList TypeError: 'type' object is not iterable

    Read the article

  • C++: Conceptual problem in designing an intepreter

    - by sub
    I'm programming an interpreter for an experimental programming language (educational, fun,...) So far, everything went well (Tokenizer & Parser), but I'm getting a huge problem with some of the data structures in the part that actually runs the tokenized and parsed code. My programming language basically has only two types, int and string, and they are represented as C++ strings (std class) and ints Here is a short version of the data structure that I use to pass values around: enum DataType { Null, Int, String } class Symbol { public: string identifier; DataType type; string stringValue; int intValue; } I can't use union because string doesn't allow me to. This structure above is beginning to give me a headache. I have to scatter code like this everywhere in order to make it work, it is beginning to grow unmaintainable: if( mySymbol.type == Int ) { mySymbol.intValue = 1234; } else { mySymbol.stringValue = "abcde"; } I use the Symbol data structure for variables, return values for functions and general representation of values in the programming language. Is there any better way to solve this? I hope so!

    Read the article

  • C++ Function pointers vs Switch

    - by Perfix
    What is faster: Function pointers or switch? The switch statement would have around 30 cases, consisting of enumarated unsigned ints from 0 to 30. I could do the following: class myType { FunctionEnum func; string argv[123]; int someOtherValue; }; // In another file: myType current; // Iterate through a vector containing lots of myTypes // ... for ( i=0; i < myVecSize; i ++ ) switch ( current.func ) { case 1: //... break; // ........ case 30: // blah break; } And go trough the switch with func every time. The good thing about switch would also be that my code is more organized than with 30 functions. Or I could do that (not so sure with that): class myType { myReturnType (*func); string argv[123]; int someOtherValue; }; I'd have 30 different functions then, at the beginning a pointer to one of them is assigned to myType. What is probably faster: Switch statement or function pointer? Calls per second: Around 10 million. I can't just test it out - that would require me to rewrite the whole thing. Currently using switch. I'm building an interpreter which I want to be faster than Python & Ruby - every clock cycle matters!

    Read the article

  • What is good about php/what is php good for?

    - by Roman A. Taycher
    I have often seen php bashed around the webs as a loosely typed(loose typing as in a lot of type coercion and/or easy(and perhaps common) to cast object all over not dynamic typing) language without a great compiler/interpreter/vm, with even the standard library using a number of different naming conventions. A lot of people complain about perl but many (including a lot of the complainers) also give it a lot of credit for its regexes and general flexibility and power. Other then legacy code , giant web frameworks that can do tons(drupal,ect.), and easy cheap hosting what is good about php (,also what criticism are unfair, and how is the language evolving to overcome its problems). Why would i want to learn it? why would I want to do an independent project in it? The main thing I have heard is that its php codes simplicity is sometimes easier then the over-engineered complexity you find in certain Java frameworks and applications. I'm not just trolling, i'm genuinly curious what makes php programmers use it. try to convince me to put it on my languages to dabble in and languages to learn more in depth lists.

    Read the article

  • Guidelines for creating a programming-language enjoyable to write programs in?

    - by sub
    I'm currently working on the topic of programming-languages and interpreter-design. I have already created several programming languages but couldn't reach my goal so far: Create a programming-language which focuses on giving the programmer a good feeling when writing code in it. It should just be fun and/or interesting and in no case annoying to write something in it. I get this feeling when writing code in Python. I sometimes get the opposite with PHP and in rare cases when having to reinvent some wheel in C++. So I've tried to figure out some syntactical features to make programming in my new language fun, but I just can't find any. Which concrete features, maybe mainly in terms of syntax, do/could make programming in a language fun? Examples: I find it enjoyable to program in Ruby because of it's use of code blocks. It would be nice if you could include exactly one example in your answer Those features do not have to already exist in any language! I'm doing this because I have experienced extreme rises in (my own) productivity when programming in languages I love (because of particular features).

    Read the article

  • Objective-measures of the expressiveness of programming languages [closed]

    - by Casebash
    I am very interested in the expressiveness of different languages. Everyone who has programmed in multiple languages knows that sometimes a language allows you to express concepts which you can't express in other languages. You can have all kinds of subjective discussion about this, but naturally it would be better to have an objective measure. There do actually exist objective measures. One is Turing-Completeness, which means that a language is capable of generating any output that could be generated by following a sequential set of steps. There are also other lesser levels of expressiveness such as Finite State Automata. Now, except for domain specific languages, pretty much all modern languages are Turing complete. It is therefore natural to ask the following question: Can we can define any other formal measures of expressiveness which are greater than Turing completeness? Now of course we can't define this by considering the output that a program can generate, as Turing machines can already produce the same output that any other program can. But there are definitely different levels in what concepts can be expressed - surely no-one would argue that assembly language is as powerful as a modern object oriented language like Python. You could use your assembly to write a Python interpreter, so clearly any accurate objective measure would have to exclude this possibility. This also causes a problem with trying to define the expressiveness using the minimum number of symbols. How exactly to do so is not clear and indeed appears extremely difficult, but we can't assume that just because we don't know how to solve a problem, that nobody know how to. It is also doesn't really make sense to demand a definition of expressiveness before answering the question - after all the whole point of this question is to obtain such a definition. I think that my explanation will be clear enough for anyone with a strong theoretical background in computer science to understand what I am looking for. If you do have such a background and you disagree, please comment why, but if you don't thats probably why you don't understand the question.

    Read the article

  • JavaScript Browser Hacks

    Recently during one of my client side scripting classes, I was trying to show my students some basic examples of JavaScript as an introduction to the language.  My first basic example was to show an alert box using JavaScript via the address bar. The student’s reaction to my browser hack example really caught me off guard in a good way. After programming with a language for close to 10 years you start to lose the "Awe Cool!" effect that new learners of a language experience when writing code. New learns of JavaScript are the reason why I created this post. Please enjoy. Note: Place JavaScript in to address bar and then press the enter key. Example 1: JavaScript Alert box displaying My name: John Doe Javascript:alert('My name: \n John Doe') ; Example 2: JavaScript alert box displaying name entered by user. javascript:alert('My name: \n ' + prompt('Enter Name','Name')) ; Example 3: JavaScript alert box displaying name entered by user, and then displays the length of the name. javascript:var name= prompt('Enter Name','Name'); alert('My name: \n ' + name); alert(name.length); If you notice, the address bar will execute JavaScript on the current page loaded in the browser using the Document Object Model (DOM). Additionally, the address bar will allow multiple lines to be executed sequentially even though all of the code is contained within one line due to the fact that the JavaScript interpreter uses the “;” to indicate where a line of ends and a new one begins. After doing a little more research on the topic of JavaScript Browser Hacks I found a few other cool JavaScript hacks which I will list below. Example 4: Make any webpage editableSource: http://www.openjason.com/2008/09/02/browser-hack-make-any-web-page-editable/ javascript:document.body.contentEditable='true'; document.designMode='on'; void 0; Example 5: CHINESE DRAGON DANCING Source: http://nzeyi.wordpress.com/2009/06/01/dwrajaxjavascript-hacks-the-secrets-of-javascript-in-the-adress-bar/ javascript:R=0;x1=0.1;y1=0.05;x2=0.25;y2=0.24;x3=1.6; y3=0.24;x4=300;y4=200;x5=300;y5=200;DI=document.links; DIL=DI.length;A=function(){for(i=0;i-DIL;i++){DI[i].style. position='absolute';DI[i].style.left=Math.sin(R*x1+i*x2+x3)*x4+ x5;DI[i].style.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++;}; setInterval('A()',5);void(0); Example 6: Reveal content stored in password protected fields javascript:(function(){var s,F,j,f,i; s = “”; F = document.forms; for(j=0; j Example 7: Force user to close browser windowSource: http://forums.digitalpoint.com/showthread.php?t=767053 javascript:while(1){alert('Restart your brower to close this box!')} Learn more about JavaScript Browser Hacks.

    Read the article

  • Big Data – Interacting with Hadoop – What is Sqoop? – What is Zookeeper? – Day 17 of 21

    - by Pinal Dave
    In yesterday’s blog post we learned the importance of the Pig and Pig Latin in Big Data Story. In this article we will understand what is Sqoop and Zookeeper in Big Data Story. There are two most important components one should learn when learning about interacting with Hadoop – Sqoop and Zookper. What is Sqoop? Most of the business stores their data in RDBMS as well as other data warehouse solutions. They need a way to move data to the Hadoop system to do various processing and return it back to RDBMS from Hadoop system. The data movement can happen in real time or at various intervals in bulk. We need a tool which can help us move this data from SQL to Hadoop and from Hadoop to SQL. Sqoop (SQL to Hadoop) is such a tool which extract data from non-Hadoop data sources and transform them into the format which Hadoop can use it and later it loads them into HDFS. Essentially it is ETL tool where it Extracts, Transform and Load from SQL to Hadoop. The best part is that it also does extract data from Hadoop and loads them to Non-SQL (or RDBMS) data stores. Essentially, Sqoop is a command line tool which does SQL to Hadoop and Hadoop to SQL. It is a command line interpreter. It creates MapReduce job behinds the scene to import data from an external database to HDFS. It is very effective and easy to learn tool for nonprogrammers. What is Zookeeper? ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. In other words Zookeeper is a replicated synchronization service with eventual consistency. In simpler words – in Hadoop cluster there are many different nodes and one node is master. Let us assume that master node fails due to any reason. In this case, the role of the master node has to be transferred to a different node. The main role of the master node is managing the writers as that task requires persistence in order of writing. In this kind of scenario Zookeeper will assign new master node and make sure that Hadoop cluster performs without any glitch. Zookeeper is the Hadoop’s method of coordinating all the elements of these distributed systems. Here are few of the tasks which Zookeepr is responsible for. Zookeeper manages the entire workflow of starting and stopping various nodes in the Hadoop’s cluster. In Hadoop cluster when any processes need certain configuration to complete the task. Zookeeper makes sure that certain node gets necessary configuration consistently. In case of the master node fails, Zookeepr can assign new master node and make sure cluster works as expected. There many other tasks Zookeeper performance when it is about Hadoop cluster and communication. Basically without the help of Zookeeper it is not possible to design any new fault tolerant distributed application. Tomorrow In tomorrow’s blog post we will discuss about very important components of the Big Data Ecosystem – Big Data Analytics. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Big Data, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL

    Read the article

  • Fun with Python

    - by dotneteer
    I am taking a class on Coursera recently. My formal education is in physics. Although I have been working as a developer for over 18 years and have learnt a lot of programming on the job, I still would like to gain some systematic knowledge in computer science. Coursera courses taught by Standard professors provided me a wonderful chance. The three languages recommended for assignments are Java, C and Python. I am fluent in Java and have done some projects using C++/MFC/ATL in the past, but I would like to try something different this time. I first started with pure C. Soon I discover that I have to write a lot of code outside the question that I try to solve because the very limited C standard library. For example, to read a list of values from a file, I have to read characters by characters until I hit a delimiter. If I need a list that can grow, I have to create a data structure myself, something that I have taking for granted in .Net or Java. Out of frustration, I switched to Python. I was pleasantly surprised to find that Python is very easy to learn. The tutorial on the official Python site has the exactly the right pace for me, someone with experience in another programming. After a couple of hours on the tutorial and a few more minutes of toying with IDEL, I was in business. I like the “battery supplied” philosophy that gives everything that I need out of box. For someone from C# or Java background, curly braces are replaced by colon(:) and tab spaces. Although I tend to miss colon from time to time, I found that the idea of tab space is actually very nice once I get use to them. I also like to feature of multiple assignment and multiple return parameters. When I need to return a by-product, I just add it to the list of returns. When would use Python? I would use Python if I need to computer anything quick. The language is very easy to use. Python has a good collection of libraries (packages). The REPL of the interpreter allows me test ideas quickly before committing them into script. Lots of computer science work have been ported from Lisp to Python. Some universities are even teaching SICP in Python. When wouldn’t I use Python? I mostly would not use it in a managed environment, such as Ironpython or Jython. Both .Net and Java already have a rich library so one has to make a choice which library to use. If we use the managed runtime library, the code will tie to the particular runtime and thus not portable. If we use the Python library, then we will face the relatively long start-up time. For this reason, I would not recommend to use Ironpython for WP7 development. The only situation that I see merit with managed Python is in a server application where I can preload Python so that the start-up time is not a concern. Using Python as a managed glue language is an over-kill most of the time. A managed Scheme could be a better glue language as it is small enough to start-up very fast.

    Read the article

  • Government Mandates and Programming Languages

    A recent SEC proposal (which, at over 600 pages, I havent read in any detail) includes the following: We are proposing to require the filing of a computer program (the waterfall computer program, as defined in the proposed rule) of the contractual cash flow provisions of the securities in the form of downloadable source code in Python, a commonly used computer programming language that is open source and interpretive. The computer program would be tagged in XML and required to be filed with the Commission as an exhibit. Under our proposal, the filed source code for the computer program, when downloaded and run (by loading it into an open Python session on the investors computer), would be required to allow the user to programmatically input information from the asset data file that we are proposing to require as described above. We believe that, with the waterfall computer program and the asset data file, investors would be better able to conduct their own evaluations of ABS and may be less likely to be dependent on the opinions of credit rating agencies. With respect to any registration statement on Form SF-1 (Section 239.44) or Form SF-3 (Section 239.45) relating to an offering of an asset-backed security that is required to comply with Item 1113(h) of Regulation AB, the Waterfall Computer Program (as defined in Item 1113(h)(1) of Regulation AB) must be written in the Python programming language and able to be downloaded and run on a local computer properly configured with a Python interpreter. The Waterfall Computer Program should be filed in the manner specified in the EDGAR Filer Manual. I dont see how it can be in investors best interests that the SEC demand a particular programming language be used for software related to investment data.  I have a feeling that investors who use computers at all already have software with which they are familiar, and that the vast majority of them are not running an open source scripting language on their machines to do their financial analysis.  In fact, I would wager that most of them are using tools like Excel, and if they really need to script anything, its being done with VBA in Excel. Now, Im not proposing that the SEC should require that the data be provided in Excel format with VBA scripts included so everyone can easily access the data (despite the fact that this would actually be pretty useful generally).  Rather, I think it is ill-advised for a government agency to make recommendations of this nature, period.  If the goal of the recommendation is to ensure that the way things work is codified in a transparent manner, than I can certainly respect that.  It seems to me that this could be accomplished without dictating the technology to use.  To wit: An Excel document could contain all of the data as well as the formulae necessary, and most likely would not require the end-user to install anything on their machine The SEC could simply create a calculator in the cloud such that any/all investors could use a single canonical web-based (or web service based) tool Millions of Java and .NET developers could write their own implementations You can read more about this issue, including the favorable position on it, on Jayanth Varmas blog. Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26  | Next Page >