Search Results

Search found 451 results on 19 pages for 'fp'.

Page 14/19 | < Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Consuming an iCal/.ics file in YQL

    - by Josh
    How would one consume an iCal/.ics file in YQL? Given an .ics such as: http://www.hebcal.com/export/ba/8a35a5efbb27548bc0272b94b8de96.ics?subscribe=1&v=1&year=2010&month=x&nh=on&tag=fp.ql&c=off How would I go about using YQL to select certain events based on fields, etc. I've tried the standard formats, and the only format that seems to even parse the file is HTML - which puts it all in a <p>, and removes the line returns that give the file meaning. I've had some success with using Yahoo Pipes' Fetch Feed Source, but was wondering if it's possible to do this entirely in YQL. Any ideas?

    Read the article

  • Seeking Functional Programming Lexicon

    - by Randall Schulz
    Hi, Knowing the argot of a field helps me a lot, especially since it allows me to converse intelligently with those who know a lot more than I, so I would like to find a good lexicon of Functional Programming terms. E.g., I repeatedly encounter these: Functor, Arrow, Category, Kleisli, Monad, Monoid, a veritable zoo of Morphisms, etc. I also notice many of these appear with prefixes such as "covariant", "co-", "endo-" etc. Of these, I can say I actually understand Monoid and Covariant and sort of get Monad, but the rest are still gibberish to me. (Note that I don't mean this list as exhaustive and I'm not looking to have these defined or described for me here, I'm looking for learning resources.) Can someone point me towards an FP lexicon? It need not be on-line, as long as it's possible to find it (and it's not a rare volume for which I'd have to pay many tens of dollars).

    Read the article

  • Functional Programming - Lots of emphasis on recursion, why?

    - by peakit
    I am getting introduced to Functional Programming [FP] (using Scala). One thing that is coming out from my initial learnings is that FPs rely heavily on recursion. And also it seems like, in pure FPs the only way to do iterative stuff is by writing recursive functions. And because of the heavy usage of recursion seems the next thing that FPs had to worry about were StackoverflowExceptions typically due to long winding recursive calls. This was tackled by introducing some optimizations (tail recursion related optimizations in maintenance of stackframes and @tailrec annotation from Scala v2.8 onwards) Can someone please enlighten me why recursion is so important to functional programming paradigm? Is there something in the specifications of functional programming languages which gets "violated" if we do stuff iteratively? If yes, then I am keen to know that as well. PS: Note that I am newbie to functional programming so feel free to point me to existing resources if they explain/answer my question. Also I do understand that Scala in particular provides support for doing iterative stuff as well.

    Read the article

  • feof() in C file handling

    - by Neeraj
    I am reading a binary file byte-by-byte,i need determine that whether or not eof has reached. feof() doesn't works as "eof is set only when a read request for non-existent byte is made". So, I can have my custom check_eof like: if ( fread(&byte,sizeof(byte),1,fp) != 1) { if(feof()) return true; } return false; But the problem is, in case when eof is not reached, my file pointer is moved a byte ahead. So a solution might be to use ftell() and then fseek() to get it to correct position. Another solution might be to buffer the byte ahead in some temporary storage. Any better solutions?

    Read the article

  • Facebook publish HTTP Error 400 : bad request

    - by Abhishek
    Hey I am trying to publish a score to Facebook through python's urllib2 library. import urllib2,urllib url = "https://graph.facebook.com/USER_ID/scores" data = {} data['score']=SCORE data['access_token']='APP_ACCESS_TOKEN' data_encode = urllib.urlencode(data) request = urllib2.Request(url, data_encode) response = urllib2.urlopen(request) responseAsString = response.read() I am getting this error: response = urllib2.urlopen(request) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 389, in open response = meth(req, response) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 502, in http_response 'http', request, response, code, msg, hdrs) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 427, in error return self._call_chain(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain result = func(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 510, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 400: Bad Request Not sure if this is relating to Facebook's Open Graph or improper urllib2 API use.

    Read the article

  • Functional data structures in C++

    - by drg
    Does anyone know of a C++ data structure library providing functional (a.k.a. immutable, or "persistent" in the FP sense) equivalents of the familiar STL structures? By "functional" I mean that the objects themselves are immutable, while modifications to those objects return new objects sharing the same internals as the parent object where appropriate. Ideally, such a library would resemble STL, and would work well with Boost.Phoenix (caveat- I haven't actually used Phoenix, but as far as I can tell it provides many algorithms but no data structures, unless a lazily-computed change to an existing data structure counts - does it?)

    Read the article

  • cgi.FieldStorage translating unicode strangely

    - by trydyingtolive
    I have a form that is on a UTF-8 encoded page. When I submit the form cgi.FieldStorage converts any non-ascii character to an odd format. For example if I submit the value c. The browser will send %c4%87. I want to convert that to the string \xc4\x87. However, cgi.FieldStorage is converting it to \\xc4\\x87. post = cgi.FieldStorage(fp=env['wsgi.input'], environ=env, keep_blank_values=True) Python 2.6 on Ubuntu 9.10SE, Apache2, mod_wsgi.

    Read the article

  • Weird stack trace in exception "The incoming request does not match any route"

    - by Tassadaque
    i have published asp.net mvc application on iis 6 on the server(windows server 2003) from local machine. On server i have set the default page to default.aspx. but when i try to browse the site on server, it gives me exception "The incoming request does not match any route" One thing i noticed is that. Stack trace on line 5 is shown below. it has one weird thing that exception is still pointing to my local machine path [HttpException (0x80004005): The incoming request does not match any route.] System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext) +15589 System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext) +40 System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +7 **UserManagement._Default.Page_Load(Object sender, EventArgs e) in D:\Evoletpublishnew\UserManagement\UserManagement\Default.aspx.cs:18** System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

    Read the article

  • C - Malloc or calloc...and how?

    - by Pedro
    Hi...i have a txt file where the first number define the size of the array's, i know that calloc or malloc can reserve memory, but how? this code: typedef struct alpha{ int *size; char name; int tot; char line[60]; }ALPHA; fgets(line,60,fp); tot=atoi(line); size=(int*)calloc(name,sizeof(int); Imagine that in the first line of the txt is the number 10, wiht this code the size of name will be 10? like name[10]???

    Read the article

  • Difference between URLLIB2 call in IDLE and from Django?

    - by danspants
    The following piece of code works as expected when running in a local install of django apache 2.2 fx = urllib2.Request(f); fx.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19'); url_opened = urllib2.urlopen(fx); However when I enter that code into IDLE on the same machine I get the following error: url_opened = urllib2.urlopen(fx); File "C:\Python25\lib\urllib2.py", line 124, in urlopen return _opener.open(url, data) File "C:\Python25\lib\urllib2.py", line 387, in open response = meth(req, response) File "C:\Python25\lib\urllib2.py", line 498, in http_response 'http', request, response, code, msg, hdrs) File "C:\Python25\lib\urllib2.py", line 425, in error return self._call_chain(*args) File "C:\Python25\lib\urllib2.py", line 360, in _call_chain result = func(*args) File "C:\Python25\lib\urllib2.py", line 506, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 407: Proxy Authentication Required Any ideas?

    Read the article

  • C - how to get fscanf() to determine whether what it read is only digits, and no characters

    - by hatorade
    Imagine I have a csv with and each value is an integer. so the first value is the INTEGER 100. I want fscanf() to read this line, and either tell me it's an integer ONLY, or not. So, it would pass 100 but fail on 100t. What i've been trying to get work is "%d," where the comma is the delimiter of my CSV. so the whole function is fscanf(fp, "%d,", &count) Unfortunately, this fails to fail on '100t,' works on '100' and works on 't'. so it just isn't distinguishing between 100 and 100t (all of these numbers are followed by commas, of course

    Read the article

  • File.OpenText method is not declared error

    - by Nandini
    Hi, i have a fileupload control from which i need the path of a text file. After selecting the file,i need to open the file for reading the data from the text file.For this, i used the following code to open the text file. fp=File.OpenText(FileUpload2.PostedFile.FileName) This is working fine in my system.The FileUpload2.PostedFile.FileName statement gives the path of the file.The File.OpenText method opens the selected file.But when i run my project in IIS,it gives the following error: "File.OpenText is not declared." The FileUpload2.PostedFile.FileName statement is not retrieving the path, it retrieves only only the filename.what could be the reason?

    Read the article

  • How do I do automatic data serialization of data objects in Haskell

    - by Adam Gent
    One of the huge benefits in languages that have some sort of reflection/introspecition is that objects can be automatically constructed from a variety of sources. For example in Java I can use the same objects for persisting to a db (with Hibernate) serializing to XML (with JAXB) or serializing to JSON (json-lib). You can do the same in Ruby and Python also usually following some simple rules for properties or annotations for Java. Thus I don't need lots "Domain Transfer Objects". I can concentrate on the domain I am working in. It seems in very strict FP like Haskell and Ocaml this is not possible. Particularly Haskell. The only thing I have seen is doing some sort of preprocessing or meta-programming (ocaml). Is it just accepted that you have to do all the transformations from the bottom upwards? In other words you have to do lot of boring work to turn a data type in haskell into JSON/XML/DB Row object and back again into a data object.

    Read the article

  • Loading url with cyrillic symbols

    - by Ockonal
    Hi guys, I have to load some url with cyrillic symbols. My script should work with this: http://wincode.org/%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5/ If I'll use this in browser it would replaced into normal symbols, but urllib code fails with 404 error. How to decode correctly this url? When I'm using that url directly in code, like address = 'that address', it works perfect. But I used parsing page for getting this url. I have a list of urls which contents cyrillic. Maybe they have uncorrect encoding? Here is more code: requestData = urllib2.Request( %SOME_ADDRESS%, None, {"User-Agent": user_agent}) requestHandler = pageHandler.open(requestData) pageData = requestHandler.read().decode('utf-8') soupHandler = BeautifulSoup(pageData) topicLinks = [] for postBlock in soupHandler.findAll('a', href=re.compile('%SOME_REGEXP%')): topicLinks.append(postBlock['href']) postAddress = choice(topicLinks) postRequestData = urllib2.Request(postAddress, None, {"User-Agent": user_agent}) postHandler = pageHandler.open(postRequestData) postData = postHandler.read() File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 404: Not Found

    Read the article

  • Search for a String and replace it with a variable

    - by chrissygormley
    Hello, I am trying to use regular expression to search a document fo a UUID number and replace the end of it with a new number. The code I have so far is: read_file = open('test.txt', 'r+') write_file = open('test.txt', 'w') r = re.compile(r'(self.uid\s*=\s*5EFF837F-EFC2-4c32-A3D4\s*)(\S+)') for l in read_file: m1 = r.match(l) if m1: new=(str,m1.group(2)) new?????? This where I get stuck. The file test.txt has the below UUID stored in it: self.uid = '5EFF837F-EFC2-4c32-A3D4-D15C7F9E1F22' I want to replace the part D15C7F9E1F22. I have also tried this: r = re.compile(r'(self.uid\s*=\s*)(\S+)') for l in fp: m1 = r.match(l) new=map(int,m1.group(2).split("-") new[4]='RHUI5345JO' But I cannot seem to match the string. Thanks in advance for any help.

    Read the article

  • Types in Bytecode

    - by HH
    Hey everyone, I've been working for some time on (Java) Bytecode, however, it had never occurred to me to ask why are some instructions typed? I understand that in an ADD operation, we need to distinguish between an integer addition and a FP addition (that's why we have IADD and FADD). However, why do we need to distinguish between ISTORE and FSTORE? They both involve the exact same operation, which is moving 32 bits from the stack to a local variable position? The only answer I can think of is for type-safety, to prevent this: (ILOAD, ILOAD, FADD). However, I believe that type-safety is already enforced at the Java language level. OK, the Class file format is not directly coupled with Java, so is this a way to enforce type-safety for languages that do not support it? Any thought? Thank you.

    Read the article

  • How to get repository for core-plot

    - by Omar
    I am not able to get the repository for core-plot. What I am doing is that I am typing this in the terminal: hg clone https://core-plot.googlecode.com/hg/ core-plot and this is what I get: Traceback (most recent call last): File "/usr/local/bin/hg", line 25, in mercurial.util.set_binary(fp) File "/Library/Python/2.5/site-packages/mercurial/demandimport.py", line 75, in __getattribute__ self._load() File "/Library/Python/2.5/site-packages/mercurial/demandimport.py", line 47, in _load mod = _origimport(head, globals, locals) File "/Library/Python/2.5/site-packages/mercurial/util.py", line 93, in _encoding = locale.getlocale()[1] File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py", line 460, in getlocale return _parse_localename(localename) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py", line 373, in _parse_localename raise ValueError, 'unknown locale: %s' % localename ValueError: unknown locale: UTF-8 I can't seem to get it to install. Please give me guidance on how to install the repository.

    Read the article

  • Write pointer to file in C

    - by Sergey
    I have a stucture: typedef structure student { char *name; char *surname; int age; } Student; I need to write it to binary file. Student *s = malloc(sizeof(*s)); I fill my structure with data and then i write in to the file: fwrite(s, sizeof(*s), 1, fp); In my file doesnt exist a name and surname, it have an adresses of char*. How can i write to file a word, not an adresses?

    Read the article

  • How well does Scala Perform Comapred to Java?

    - by Teja Kantamneni
    The Question actually says it all. The reason behind this question is I am about to start a small side project and want to do it in Scala. I am learning scala for the past one month and now I am comfortable working with it. The scala compiler itself is pretty slow (unless you use fsc). So how well does it perform on JVM? I previously worked on groovy and I had seen sometimes over performed than java. My Question is how well scala perform on JVM compared to Java. I know scala has some very good features(FP, dynamic lang, statically typed...) but end of the day we need the performance...

    Read the article

  • Translate imperative control flow with break-s/continue-s to haskell

    - by dorserg
    Consider the following imperative code which finds the largest palindrome among products of 3-digit numbers (yes, it's the one of the first tasks from "Project of [outstanding mathematician of 18th century]" site): curmax = 0 for i in range(999,100): for j in range(999,100): if ((i*j) < curmax): break if (pal(i*j)): curmax = i*j break print curmax As I'm learning Haskell currently, my question is, how do you translate this (and basically any imperative construct that contains something more complex than just plain iteration, e.g. breaks, continues, temporary variables and all this) to Haskell? My version is maxpal i curmax | i < 100 = curmax | otherwise = maxpal (i-1) (innerloop 999) where innerloop j | (j < 100) || (p < curmax) = curmax | pal p = p | otherwise = innerloop (j-1) where p = i*j main = print $ maxpal 999 0 but this looks like we're still in imperative uglytown. So what could you advise, what are the approaches of dealing with such cases FP-style?

    Read the article

  • how to open many files simultaneously for reading in c

    - by monkeyking
    I'm trying to port some of my c++ code into c. I have the following construct class reader{ private: FILE *fp; alot_of_data data;//updated by read_until() method public: reader(const char*filename) read_until(some conditional dependent on the contents of the file, and the arg supplied) } Im then instantiating hundreds of these object and iterate over them using several 'read_until()' for each file until allfiles is at eof. I'm failing to see any clever way to do this in c, the only solution I can come up with is making an array of FILE pointers, and do the same with all the private member data from my class. But this seems very messy, can I implement the functionality of my class as a function pointer, or anything better, I think I'm missing a fundamental design pattern? The files are way to big to have all in memory, so reading everything from every file is not feasible Thanks

    Read the article

  • Why and when should one call _fpreset( )?

    - by STingRaySC
    The only documentation I can find (on MSDN or otherwise) is that a call to _fpreset() "resets the floating-point package." What is the "floating point package?" Does this also clear the FPU status word? I see documentation that says to call _fpreset() when recovering from a SIGFPE, but doesn't _clearfp() do this as well? Do I need to call both? I am working on an application that unmasks some FP exceptions (using _controlfp()). When I want to reset the FPU to the default state (say, when calling to .NET code), should I just call _clearfp(), _fpreset(), or both. This is performance critical code, so I don't want to call both if I don't have to...

    Read the article

  • MD5 hash differences between Python and other file hashers

    - by Sam
    I have been doing a bit of programming in Python (still a n00b at it) and came across something odd. I made a small program to find the MD5 hash of a filename passed to it on the command line. I used a function I found here on SO. When I ran it against a file, I got a hash "58a...113". But when I ran Microsoft's FCIV or the md5sum.py in \Python26\Tools\Scripts\, I get a different hash, "591...ae6". The actual hashing part of the md5sum.py in Scripts is m = md5.new() while 1: data = fp.read(bufsize) if not data: break m.update(data) out.write('%s %s\n' % (m.hexdigest(), filename)) This looks functionally identical to the code in the function given in the other answer... What am I missing? (This is my first time posting to stackoverflow, please let me know if I am doing it wrong.)

    Read the article

  • Right rotate of tree in Haskell: how is it work?

    - by Roman
    I don't know haskell syntax, but I know some FP concepts (like algebraic data types, pattern matching, higher-order functions ect). Can someone explain please, what does this code mean: data Tree ? = Leaf ? | Fork ? (Tree ?) (Tree ?) rotateR tree = case tree of Fork q (Fork p a b) c -> Fork p a (Fork q b c) As I understand, first line is something like Tree-type declaration (but I don't understand it exactly). Second line includes pattern matching (I don't understand as well why do we need to use pattern matching here). And third line does something absolutely unreadable for non-haskell developer. I've found definition of Fork as fork (f,g) x = (f x, g x) but I can't move further anymore.

    Read the article

  • inode_operations , warning: initialization from incompatible pointer type

    - by djTeller
    Hi everyone, I'm trying to compile a simple Kernel program that read and write from a proc file. I'm trying to set permission to that file by overriding the permission fp in inode_operations struct (.permission) static int module_permission(struct inode *inode, int op, struct nameidata *foo) { . . . } static struct inode_operations Inode_Ops_4_Our_Proc_File = { .permission = module_permission, /* check for permissions */ }; Our_Proc_File->proc_iops = &Inode_Ops_4_Our_Proc_File; For some reason, when I compile this i get - warning: initialization from incompatible pointer type on the following line: .permission = module_permission, /* check for permissions */ Any idea how to solve this? Thanks!

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >