Search Results

Search found 123 results on 5 pages for 'eli polonsky'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • RotatingFileHandler throws an exception when delay parameter is set

    - by Eli Courtwright
    When I run the following code under Python 2.6 import logging from logging.handlers import RotatingFileHandler rfh = RotatingFileHandler("testing.log", delay=True) logging.getLogger().addHandler(rfh) logging.warning("Boo!") then the last line throws AttributeError: RotatingFileHandler instance has no attribute 'level'. So I add the line rfh.setLevel(logging.DEBUG) before the call to addHandler, and then the last line throws AttributeError: RotatingFileHandler instance has no attribute 'filters'. So if I manually set filters to be an empty list, then it complains about not having the attribute lock, etc. When I remove the delay=True to leave it as the default value of False as documented here, the problem completely goes away. Am I missing something? How do I properly use the delay parameter of the RotatingFileHandler class? EDIT: Upon further analysis (presented in my own answer below), this looks like a bug, but I can't find a bug report on this in the Python bug tracker, even trying different search terms, so I guess I'll report it. However, if someone can locate the actual bug report, then I can avoid submitting a duplicate reporting and wasting the time of the Python developers. I'll hold off on reporting the bug for a few hours, and if someone posts an answer that has the current bug report, then I'll accept that answer for this question.

    Read the article

  • Reciving UDP packets on iPhone

    - by Eli
    I'm trying to establish UDP communication between a MAC OS and an iPod through Wi-Fi, at this point I'm able to send packets from the iPod and I can see those packets have the right MAC and ip addresses (I'm using wireshark to monitor the network) but the MAC receives the packets only when the wireshark is on, otherwise recvfrom() returns -1. When I try to transmit from MAC to iPhone I have the same result, I can see the packets are sent but the iPhone doesn't seem to get them. I'm using the next code to send: struct addrinfo hints; int rv; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; if ((rv = getaddrinfo(IP, SERVERPORT, &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); return 1; } // loop through all the results and make a socket for(p = servinfo; p != NULL; p = p->ai_next) { if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { perror("talker: socket"); continue; } break; } if (p == NULL) { fprintf(stderr, "talker: failed to bind socket\n"); return 2; } while (cond) sntBytes += sendto(sockfd, message, strlen(message), 0, p->ai_addr, p->ai_addrlen); return 0; and this code to receive: struct addrinfo hints, *p; int rv; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; // set hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE; // use to AF_INET to force IPv4 my IP if ((rv = getaddrinfo(NULL, MYPORT, &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); return 1; } // loop through all the results and bind to the first we can for(p = servinfo; p != NULL; p = p->ai_next) { if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { perror("listener: socket"); continue; } if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) { close(sockfd); perror("listener: bind"); continue; } break; } if (p == NULL) { fprintf(stderr, "listener: failed to bind socket\n"); return 2; } addr_len = sizeof their_addr; fcntl(sockfd, F_SETFL,O_NONBLOCK); int rcvbuf_size = 128 * 1024; // That's 128Kb of buffer space. setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, sizeof(rcvbuf_size)); printf("listener: waiting to recvfrom...\n"); while (cond) rcvBytes = recvfrom(sockfd, buf, MAXBUFLEN-1 , 0, (struct sockaddr *)&their_addr, &addr_len); return 0; What am I missing?

    Read the article

  • Value of text box disapears - binding viewmodel to a tab (content control)

    - by Eli Perpinyal
    Based on the MVVM example by Josh Smith, I have implemented the multi tab option which binds to a different tab to a different view model using a simple datatemplate that binds a viewmodel to a view. <DataTemplate DataType="{x:Type fixtureVM:SearchViewModel}"> <SearchVw:SearchView/> </DataTemplate> The issue that I'm having, is when I switch tabs and then switch back again, the value in the textbox disappears. When I bind the Text in the textbox to a value in the ViewModel it does not disappear. This is fine, and I can overcome this but I am having another issue for example with the position of the scroll bar in a grid disappearing once the tab has lost focus. Why is the value disappearing? I'm assuming it is a WPF sub system task that cleans up resources!? how can I avoid this? I also feel it might be slowing down my app.

    Read the article

  • "TypeError: CreateText() takes exactly 8 arguments (5 given)" with default arguments

    - by Eli Nahon
    def CreateText(win, text, x, y, size, font, color, style): txtObject = Text(Point(x,y), text) if size==None: txtObject.setSize(12) else: txtObject.setSize(size) if font==None: txtObject.setFace("courier") else: txtObject.setFace(font) if color==None: txtObject.setTextColor("black") else: txtObject.setTextColor(color) if style==None: txtObject.setStyle("normal") else: txtObject.setStyle(style) return txtObject def FlashingIntro(win, numTimes): txtIntro = CreateText(win, "CELSIUS CONVERTER!", 5,5,28) for i in range(numTimes): txtIntro.draw(win) sleep(.5) txtIntro.undraw() sleep(.5) I'm trying to get the CreateText function to create a text object with my "default" values if the parameters are not used. (I've tried it with blank strings "" instead of None and no luck) I'm fairly new to Python and have little programming knowledge.

    Read the article

  • Is any solution the correct solution?

    - by Eli
    I always think to myself after solving a programming challenge that I have been tied up with for some time, "It works, thats good enough". I don't think this is really the correct mindset, in my opinion and I think I should always be trying to code with the greatest performance. Anyway, with this said, I just tried a ProjectEuler question. Specifically question #2. How could I have improved this solution. I feel like its really verbose. Like I'm passing the previous number in recursion. <?php /* Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not exceed four million. */ function fibonacci ( $number, $previous = 1 ) { global $answer; $fibonacci = $number + $previous; if($fibonacci > 4000000) return; if($fibonacci % 2 == 0) { $answer = is_numeric($answer) ? $answer + $fibonacci : $fibonacci; } return fibonacci($fibonacci, $number); } fibonacci(1); echo $answer; ?> Note this isn't homework. I left school hundreds of years ago. I am just feeling bored and going through the Project Euler questions

    Read the article

  • iPhone UI addSubview causing concurrency exception

    - by Eli
    This is really odd... I run my app, and while it is opening and the views are constructing I get: Collection <CALayerArray: 0x124650> was mutated while being enumerated. The code trace goes through the following: main UIApplicationMain -[UIApplication _run] CFRunLoopRunInMode CFRunLoopRunSpecific _UIApplicationHandleEvent -[UIApplication sendEvent:] -[UIApplication handleEvent:withNewEvent:] -[UIApplication _runWithURL:sourceBundleID:] -[UIApplication _performInitilizationWithURL:sourceBundleID:] -[AppDelegate applicationDidFinishLaunching:] +[Controller initializeController] //This is my own function [window addSubview: pauseMenuController.view] //This is the last point of my code it goes through -[UIView(Hierarchy) addSubview:] -[UIView(Internal) _addSubview:positioned:relativeTo:] -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:] -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] _NSFastEnumerationMutationHandler objc_exception_throw I've run the game lots and lots and lots of times and I've never seen this, then suddenly it popped up. The weird thing is that I'm not creating any other threads (that I know of) until after this code all gets called. It'll be easier for me to debug this if someone can give me some explanation of what might be getting modified while it's being accessed in a UIView. Does it have something to do with adding something to the view while it's already adding something, maybe? Any ideas?

    Read the article

  • Testing warnings with doctest

    - by Eli Courtwright
    I'd like to use doctests to test the presence of certain warnings. For example, suppose I have the following module: from warnings import warn class Foo(object): """ Instantiating Foo always gives a warning: >>> foo = Foo() testdocs.py:14: UserWarning: Boo! warn("Boo!", UserWarning) >>> """ def __init__(self): warn("Boo!", UserWarning) If I run python -m doctest testdocs.py to run the doctest in my class and make sure that the warning is printed, I get: testdocs.py:14: UserWarning: Boo! warn("Boo!", UserWarning) ********************************************************************** File "testdocs.py", line 7, in testdocs.Foo Failed example: foo = Foo() Expected: testdocs.py:14: UserWarning: Boo! warn("Boo!", UserWarning) Got nothing ********************************************************************** 1 items had failures: 1 of 1 in testdocs.Foo ***Test Failed*** 1 failures. It looks like the warning is getting printed but not captured or noticed by doctest. I'm guessing that this is because warnings are printed to sys.stderr instead of sys.stdout. But this happens even when I say sys.stderr = sys.stdout at the end of my module. So is there any way to use doctests to test for warnings? I can find no mention of this one way or the other in the documentation or in my Google searching.

    Read the article

  • How to make a GRANT persist for a table that's being dropped and re-created?

    - by Eli Courtwright
    I'm on a fairly new project where we're still modifying the design of our Oracle 11g database tables. As such, we drop and re-create our tables fairly often to make sure that our table creation scripts work as expected whenever we make a change. Our database consists of 2 schemas. One schema has some tables with INSERT triggers which cause the data to sometimes be copied into tables in our second schema. This requires us to log into the database with an admin account such as sysdba and GRANT access to the first schema to the necessary tables on the second schema, e.g. GRANT ALL ON schema_two.SomeTable TO schema_one; Our problem is that every time we make a change to our database design and want to drop and re-create our database tables, the access we GRANT-ed to schema_one went away when the table was dropped. Thus, this creates another annoying step wherein we must log in with an admin account to re-GRANT the access every time one of these tables is dropped and re-created. This isn't a huge deal, but I'd love to eliminate as many steps as possible from our development and testing procedures. Is there any way to GRANT access to a table in such a way that the GRANT-ed permissions survive a table being dropped and then re-created? And if this isn't possible, then is there a better way to go about this?

    Read the article

  • is delete p where p is a pointer to array a memory leak ?

    - by Eli
    following a discussion in a software meeting I setup to find out if deleting an dynamically allocated primitive array with plain delete will cause a memory leak. I have written this tiny program and compiled with visual studio 2008 running on windows XP: #include "stdafx.h" #include "Windows.h" const unsigned long BLOCK_SIZE = 1024*100000; int _tmain() { for (unsigned int i =0; i < 1024*1000; i++) { int* p = new int[1024*100000]; for (int j =0;j<BLOCK_SIZE;j++) p[j]= j % 2; Sleep(1000); delete p; } } I than monitored the memory consumption of my application using task manager, surprisingly the memory was allocated and freed correctly, allocated memory did not steadily increase as was expected I've modified my test program to allocate a non primitive type array : #include "stdafx.h" #include "Windows.h" struct aStruct { aStruct() : i(1), j(0) {} int i; char j; } NonePrimitive; const unsigned long BLOCK_SIZE = 1024*100000; int _tmain() { for (unsigned int i =0; i < 1024*100000; i++) { aStruct* p = new aStruct[1024*100000]; Sleep(1000); delete p; } } after running for for 10 minutes there was no meaningful increase in memory I compiled the project with warning level 4 and got no warnings. is it possible that the visual studio run time keep track of the allocated objects types so there is no different between delete and delete[] in that environment ?

    Read the article

  • Regular expression works normally, but fails when placed in an XML schema

    - by Eli Courtwright
    I have a simple doc.xml file which contains a single root element with a Timestamp attribute: <?xml version="1.0" encoding="utf-8"?> <root Timestamp="04-21-2010 16:00:19.000" /> I'd like to validate this document against a my simple schema.xsd to make sure that the Timestamp is in the correct format: <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="root"> <xs:complexType> <xs:attribute name="Timestamp" use="required" type="timeStampType"/> </xs:complexType> </xs:element> <xs:simpleType name="timeStampType"> <xs:restriction base="xs:string"> <xs:pattern value="(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}" /> </xs:restriction> </xs:simpleType> </xs:schema> So I use the lxml Python module and try to perform a simple schema validation and report any errors: from lxml import etree schema = etree.XMLSchema( etree.parse("schema.xsd") ) doc = etree.parse("doc.xml") if not schema.validate(doc): for e in schema.error_log: print e.message My XML document fails validation with the following error messages: Element 'root', attribute 'Timestamp': [facet 'pattern'] The value '04-21-2010 16:00:19.000' is not accepted by the pattern '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}'. Element 'root', attribute 'Timestamp': '04-21-2010 16:00:19.000' is not a valid value of the atomic type 'timeStampType'. So it looks like my regular expression must be faulty. But when I try to validate the regular expression at the command line, it passes: >>> import re >>> pat = '(0[0-9]{1})|(1[0-2]{1})-(3[0-1]{1}|[0-2]{1}[0-9]{1})-[2-9]{1}[0-9]{3} ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}.[0-9]{3}' >>> assert re.match(pat, '04-21-2010 16:00:19.000') >>> I'm aware that XSD regular expressions don't have every feature, but the documentation I've found indicates that every feature that I'm using should work. So what am I mis-understanding, and why does my document fail?

    Read the article

  • Are you a good or bad programmer?

    - by Eli
    Hi All, I see a lot of questions on SO that are asked about 'good' programmers vs 'bad' programmers. For example, what is a good/bad programmer, how to tell a good/bad programmer, what to do about a bad programmer on a team, how to hire a good programmer. I know it's pretty easy to apply the words to other people, but I find myself wondering if anyone out there would actually define THEMSELVES in a Boolean fashion like this, rather than "good in some areas, weak in others..." I'm not asking as an either/or where you have to be one or the other, but as a 'both' - are you a good or bad programmer? If so (either one), why? Please note this isn't meant to be argumentative, or to define good/bad practices, etc. I just want to know how many people think they are good, bad, or neither out there.

    Read the article

  • Destructuring assignment problem

    - by Eli Grey
    Why does for ([] in iterable); work fine but [void 0 for ([] in iterable)] throw a syntax error for invalid left-hand assignment? For example, I would expect the following code to work, but it doesn't (the assertion isn't even done due to the syntax error): let (i = 0, iterable = (i for (i in [1, 2, 3, 4]))) { for ([] in iterable) i++; console.assertNotGreater([void 0 for ([] in iterable)].length, i); }

    Read the article

  • Process RECEIVED email attatchment with PHP.

    - by Eli
    Hi All, I have a php script that will an catch email passed to it and process it. #!/usr/local/bin/php -q <?php while (!feof(STDIN)) {$s .= fgets(STDIN);} // Now do some work on the email source in $s. ?> This works fine. My question is how to save an attachment into the file system from the source. For example, if I isolate the section below, how do I need to process it before saving it into a gif file to create a valid gif? I assume I need to change the encoding, or otherwise process it, but does anyone know exactly? Thanks! --------------090607000609050308090504 Content-Type: image/gif; name="tfk.gif" Content-Transfer-Encoding: base64 Content-ID: <part1.06050801.05020504@etc....> Content-Disposition: attachment; filename="tfk.gif" R0lGODlheAA8APcAAAAAAP/////Wgv+xEgliOAEcDxAnFiAyHTA+JEBKK0BKLFBWM2BhOv// nf//tfz60dDEPdnPT//0Z3BtQf/kBv/pKM/KoO3UHendgoB5SOTGB/HSCNm8D7+oEvrhRcW1 U+visL2dA3hlAqqNBM+vB52DBo+ET4+EUJp+AnNgCmdUCZV9EredLJuKQ4x9PVNCB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050308090504--

    Read the article

  • Capistrano configuration

    - by Eli
    I'm having some issues with variable scope with the capistrano-ext gem's multistage module. I currently have, in config/deploy/staging.rb. set(:settings) { YAML.load_file("config/deploy.yml")['staging'] } set :repository, settings["repository"] set :deploy_to, settings["deploy_to"] set :branch, settings["branch"] set :domain, settings["domain"] set :user, settings["user"] role :app, domain role :web, domain role :db, domain, :primary => true My config/deploy/production.rb file is similar. This doesn't seem very DRY. Ideally, I think I'd like everything to be in the deploy.rb file. If there were a variable set with the current stage, everything would be really clean. UPDATE: I found a solution. I defined this function in deploy.rb: def set_settings(params) params.each_pair do |k,v| set k.to_sym, v end if exists? :domain role :app, domain role :web, domain role :db, domain, :primary => true end end Then my staging.rb file is just set_settings(YAML.load_file("config/deploy.yml")['staging'])

    Read the article

  • How do I require that an element has either one set of attributes or another in an XSD schema?

    - by Eli Courtwright
    I'm working with an XML document where a tag must either have one set of attributes or another. For example, it needs to either look like <tag foo="hello" bar="kitty" /> or <tag spam="goodbye" eggs="world" /> e.g. <root> <tag foo="hello" bar="kitty" /> <tag spam="goodbye" eggs="world" /> </root> So I have an XSD schema where I use the xs:choice element to choose between two different attribute groups: <xsi:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="tag"> <xs:choice> <xs:complexType> <xs:attribute name="foo" type="xs:string" use="required" /> <xs:attribute name="bar" type="xs:string" use="required" /> </xs:complexType> <xs:complexType> <xs:attribute name="spam" type="xs:string" use="required" /> <xs:attribute name="eggs" type="xs:string" use="required" /> </xs:complexType> </xs:choice> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xsi:schema> However, when using lxml to attempt to load this schema, I get the following error: >>> from lxml import etree >>> etree.XMLSchema( etree.parse("schema_choice.xsd") ) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "xmlschema.pxi", line 85, in lxml.etree.XMLSchema.__init__ (src/lxml/lxml.etree.c:118685) lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}element': The content is not valid. Expected is (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))., line 7 Since the error is with the placement of my xs:choice element, I've tried putting it in different places, but no matter what I try, I can't seem to use it to define a tag to have either one set of attributes (foo and bar) or another (spam and eggs). Is this even possible? And if so, then what is the correct syntax?

    Read the article

  • Dynamic/runtime method creation (code generation) in Python

    - by Eli Bendersky
    Hello, I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring. I came up with a solution combining exec and setattr, here's a dummy example: class Viking(object): def __init__(self): code = ''' def dynamo(self, arg): """ dynamo's a dynamic method! """ self.weight += 1 return arg * self.weight ''' self.weight = 50 d = {} exec code.strip() in d setattr(self.__class__, 'dynamo', d['dynamo']) if __name__ == "__main__": v = Viking() print v.dynamo(10) print v.dynamo(10) print v.dynamo.__doc__ Is there a better / safer / more idiomatic way of achieving the same result?

    Read the article

  • How to create Server-side Progress indicator in Javascript

    - by Eli
    Hey Guys, I want to create a section in my site, where a user has a few simple update buttons. Each of these update buttons will be going to the server, and will do a long crunching behind the scene. While the server crunches data, I want the user to have a some kind of progress indicator, like progress bar or textual percentage. I'm using jQuery as my javascript library, and CodeIgniter (PHP) as the server-side framework, if it's important... What I was thinking about is using PHP's flush() function to report progress status to jQuery, but I'm not sure that jQuery's ajax functions are reading the output before it's complete... So any advice/explanation would be useful and helpful! Thanks :)

    Read the article

  • A way for a file to have its own MD5 inside? Or a string that is it's own MD5?

    - by Eli
    Hi all, In considering several possible solutions to a recent task, I found myself considering how to get a php file that includes it's own MD5 hash. I ended up doing something else, but the question stayed with me. Something along the lines of: <?php echo("Hello, my MD5 is [MD5 OF THIS FILE HERE]"); ?> Whatever placeholder you have in the file, the second you take its MD5 and insert it, you've changed it, which changes it's MD5, etc. Edit: Perhaps I should rephrase my question: Does anyone know if it has been proven impossible, or if there has been any research on an algorithm that would result in a file containing it's own MD5 (or other hash)? I suppose if the MD5 was the only content in the file, then the problem can be restated as how to find a string that is it's own MD5. It may well be impossible for us to create a process that will result in such a thing, but I can't think of any reason the solution itself can't exist. The question is basically whether it really is impossible, simply improbable (on the order of monkeys randomly typing Shakespeare), or actually solvable by somebody smarter than myself.

    Read the article

  • Pushing data once a URL is requested

    - by Eli Grey
    Given, when a user requests /foo on my server, I send the following HTTP response (not closing the connection): Content-Type: multipart/x-mixed-replace; boundary=----------------------- ----------------------- Content-Type: text/html <a href="/bar">foo</a> When the user clicks on foo (which will send 204 No Content so the view doesn't change), I want to send the following data in the initial response. ----------------------- Content-Type: text/html bar How would could I get the second request to trigger this from the initial response? I'm planning on possibly creating a fancy [engines that support multipart/x-mixed-replace (currently only Gecko)]-only email webapp that does server-push and Ajax effects without any JavaScript, just for fun.

    Read the article

  • antlr: is there a simple example ?

    - by Eli
    I'd like to get started with antlr, but after spending a few hours reviewing the examples at the antlr.org site, I still cant get a clear understanding of the grammar to java process. is there some simple example? something like a four operations calculator implemented with antlr going through the parser definition and all the way to the java source code?

    Read the article

  • Why do socket.makefile objects fail after the first read for UDP sockets?

    - by Eli Courtwright
    I'm using the socket.makefile method to create a file-like object on a UDP socket for the purposes of reading. When I receive a UDP packet, I can read the entire contents of the packet all at once by using the read method, but if I try to split it up into multiple reads, my program hangs. Here's a program which demonstrates this problem: import socket from sys import argv SERVER_ADDR = ("localhost", 12345) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(SERVER_ADDR) f = sock.makefile("rb") sock.sendto("HelloWorld", SERVER_ADDR) if "--all" in argv: print f.read(10) else: print f.read(5) print f.read(5) If I run the above program with the --all option, then it works perfectly and prints HelloWorld. If I run it without that option, it prints Hello and then hangs on the second read. I do not have this problem with socket.makefile objects when using TCP sockets. Why is this happening and what can I do to stop it?

    Read the article

  • What Scheme Does Ghuloum Use?

    - by Don Wakefield
    I'm trying to work my way through Compilers: Backend to Frontend (and Back to Front Again) by Abdulaziz Ghuloum. It seems abbreviated from what one would expect in a full course/seminar, so I'm trying to fill in the pieces myself. For instance, I have tried to use his testing framework in the R5RS flavor of DrScheme, but it doesn't seem to like the macro stuff: src/ghuloum/tests/tests-driver.scm:6:4: read: illegal use of open square bracket I've read his intro paper on the course, An Incremental Approach to Compiler Construction, which gives a great overview of the techniques used, and mentions a couple of Schemes with features one might want to implement for 'extra credit', but he doesn't mention the Scheme he uses in the course. Update I'm still digging into the original question (investigating options such as Petit Scheme suggested by Eli below), but found an interesting link relating to Gholoum's work, so I am including it here. [Ikarus Scheme](http://en.wikipedia.org/wiki/Ikarus_(Scheme_implementation)) is the actual implementation of Ghuloum's ideas, and appears to have been part of his Ph.D. work. It's supposed to be one of the first implementations of R6RS. I'm trying to install Ikarus now, but the configure script doesn't want to recognize my system's install of libgmp.so, so my problems are still unresolved. Example The following example seems to work in PLT 2.4.2 running in DrEd using the Pretty Big (require lang/plt-pretty-big) (load "/Users/donaldwakefield/ghuloum/tests/tests-driver.scm") (load "/Users/donaldwakefield/ghuloum/tests/tests-1.1-req.scm") (define (emit-program x) (unless (integer? x) (error "---")) (emit " .text") (emit " .globl scheme_entry") (emit " .type scheme_entry, @function") (emit "scheme_entry:") (emit " movl $~s, %eax" x) (emit " ret") ) Attempting to replace the require directive with #lang scheme results in the error message foo.scm:7:3: expand: unbound identifier in module in: emit which appears to be due to a failure to load tests-driver.scm. Attempting to use #lang r6rs disables the REPL, which I'd really like to use, so I'm going to try to continue with Pretty Big. My thanks to Eli Barzilay for his patient help.

    Read the article

  • Essential Firefox Plugins/Extensions?

    - by Eli
    Hi All, What firefox plugins could you not live without, as relates to webdev? My list would be: DBGBar Dom Inspector Firebug Firecookie Google toolbar (useful for seo) Live HTTP ReloadEvery TamperData Web Developer I am always on the lookout for new ones though, so I wonder if anyone knows of any great ones that I may have missed?

    Read the article

  • Destructuring assignment in generator expressions and array comprehensions

    - by Eli Grey
    Why does for ([] in object); work fine but [void 0 for ([] in object)] or (void 0 for ([] in object)) throw a syntax error for invalid left-hand assignment? For example, I would expect the following code to work, but it doesn't (the assertion isn't even done due to the syntax error): let ( i = 0, arr = [1, 2, 3, 4], gen = (i for (i in arr) if (arr.hasOwnProperty(i)) ) { for ([] in gen) i++; console.assertEquals([void 0 for ([] in gen)].length, i); }

    Read the article

  • Nusphere PHPEd: PHP Function Hints Lost Arguments?

    - by Eli
    Hi All, My PHPEd suddenly stopped showing arguments and arg order in the hints, and now just shows a basic description of the function. Before I go digging around in the config files, has anyone else had this problem? Thanks! Edit: Sorry, I may not have been entirely clear on this. There is no problem with my own classes, only with the actual php functions. Example: How it used to work: I type a PHP function, say strpos. As soon as I type the '(' at the end of it, I get the little yellow box, showing something like this: int strpos ( string $haystack , mixed $needle [, int $offset=0 ] ) with the first argument bold. If I type it, and then a comma, it bolds the second arg, and so on. This is really nice, since PHP functions are a bit scrambled as far as argument order, and I don't have to look them up every time. How it works now: I type a php function, say strpos. As soon as I type the '(' at the end of it, I get the little yellow box. It says something like "strpos - Returns the numeric position of the first occurrence of needle in the haystack string." There are no arguments shown, which makes the little box basically worthless - I know what strpos does, I just want a reminder of the argument order. I think this may be a problem with the included PHPDoc, which I never use, but may be the source of the data for the hint box. I did recently upgrade to 5.6, but ended up removing it and restoring 5.2. I installed to a different folder, and uninstalled from there, but it may have overwritten something in the original folder? I'm using v5.2 (5220). Thanks!

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >