Search Results

Search found 1588 results on 64 pages for 'pure'.

Page 6/64 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How do I code a tree of objects in Haskell with pointers to parent and children?

    - by axilmar
    I've got the following problem: I have a tree of objects of different classes where an action in the child class invalidates the parent. In imperative languages, it is trivial to do. For example, in Java: public class A { private List<B> m_children = new LinkedList<B>(); private boolean m_valid = true; public void invalidate() { m_valid = false; } public void addChild(B child) { m_children.add(child); child.m_parent = this; } } public class B { public A m_parent = null; private int m_data = 0; public void setData(int data) { m_data = 0; m_parent.invalidate(); } } public class Main { public static void main(String[] args) { A a = new A(); B b = new B(); b.setData(0); //invalidates A } } How do I do the above in Haskell? I cannot wrap my mind around this, since once I construct an object in Haskell, it cannot be changed. I would be much obliged if the relevant Haskell code is posted.

    Read the article

  • Server stops responding, can't find issue?

    - by Corey W
    I've had a pretty basic server up and running CentOS with webserver/database, and have noticed that it has locked up a few times in the middle of the night. It seems to happen randomly. When it locks up I can ssh in, (although it seems to hang once connected), but can't access cpanel/whm and have to reboot the server to get everything back up. Checking the messages log I see the below like clockwork every 5minutes 1 second, and then it just stops logging anything until I reboot. I can't seem to find any log showing any issue? Is there somewhere I can check to try to figure out what is happening? Could this be caused by CPU being maxed? Nov 17 08:01:35 s1 pure-ftpd: (__cpanel__service__auth__ftpd__Q13SKrtaCJCHjBezTfU8Iqmsi@127.0.0.1) [INFO] Logout. Nov 17 08:06:36 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:06:36 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__mxidFBSnQXmR0QzqSxlqrXLIH0CmJ0GPh9bZ5V3 is now l ogged in Nov 17 08:06:37 s1 pure-ftpd: (__cpanel__service__auth__ftpd__mxidBDaCgnqSxlqrXLIH0CmJ0GPh9bZ5V3@127.0.0.1) [INFO] Logout. Nov 17 08:11:37 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:11:38 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__T4B7F71acf1dsdJSeJHdqKNcbOdpzNnN_GttgcM is now l ogged in Nov 17 08:11:38 s1 pure-ftpd: (__cpanel__service__auth__ftpd__T4B7F71acf1KNcbOdpzNnN_GttgcM@127.0.0.1) [INFO] Logout. Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] New connection from 127.0.0.1 Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] __cpanel__service__auth__ftpd__W5C1RzumtaNwe4cU8Lt1 is now logged in Nov 17 08:16:38 s1 pure-ftpd: ([email protected]) [INFO] Logout. Nov 17 09:10:58 s1 kernel: imklog 4.6.2, log source = /proc/kmsg started. Nov 17 09:10:58 s1 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1094" x-info="http://www.rsyslog.com"] (re)start Nov 17 09:10:58 s1 kernel: Initializing cgroup subsys cpuset

    Read the article

  • how a pure functional programming language manage without assignment statements?

    - by Gnijuohz
    When reading the famous SICP,I found the authors seem rather reluctant to introduce the assignment statement to Scheme in Chapter 3.I read the text and kind of understand why they feel so. As Scheme is the first functional programming language I ever know something about,I am kind of surprised that there are some functional programming languages(not Scheme of course) can do without assignments. Let use the example the book offers,the bank account example.If there is no assignment statement,how can this be done?How to change the balance variable?I ask so because I know there are some so-called pure functional languages out there and according to the Turing complete theory,this must can be done too. I learned C,Java,Python and use assignments a lot in every program I wrote.So it's really an eye-opening experience.I really hope someone can briefly explain how assignments are avoided in those functional programming languages and what profound impact(if any) it has on these languages. The example mentioned above is here: (define (make-withdraw balance) (lambda (amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds"))) This changed the balance by set!.To me it looks a lot like a class method to change the class member balance. As I said,I am not familiar with functional programming languages,so if I said something wrong about them,feel free to point out.

    Read the article

  • Are lambda expressions/delegates in C# "pure", or can they be?

    - by Bob
    I recently asked about functional programs having no side effects, and learned what this means for making parallelized tasks trivial. Specifically, that "pure" functions make this trivial as they have no side effects. I've also recently been looking into LINQ and lambda expressions as I've run across examples many times here on StackOverflow involving enumeration. That got me to wondering if parallelizing an enumeration or loop can be "easier" in C# now. Are lambda expressions "pure" enough to pull off trivial parallelizing? Maybe it depends on what you're doing with the expression, but can they be pure enough? Would something like this be theoretically possible/trivial in C#?: Break the loop into chunks Run a thread to loop through each chunk Run a function that does something with the value from the current loop position of each thread For instance, say I had a bunch of objects in a game loop (as I am developing a game and was thinking about the possibility of multiple threads) and had to do something with each of them every frame, would the above be trivial to pull off? Looking at IEnumerable it seems it only keeps track of the current position, so I'm not sure I could use the normal generic collections to break the enumeration into "chunks". Sorry about this question. I used bullets above instead of pseudo-code because I don't even know enough to write pseudo-code off the top of my head. My .NET knowledge has been purely simple business stuff and I'm new to delegates and threads, etc. I mainly want to know if the above approach is good for pursuing, and if delegates/lambdas don't have to be worried about when it comes to their parallelization.

    Read the article

  • When to decide to introduce interfaces (pure abstract base classes) in C++?

    - by Honza Brabec
    Assume that you are developing a functionality and are 90% sure that the implementation class will stay alone. If I was in this position in Java I would probably not use the interface right now to keep the things simple. In Java it is easy to refactor the code and extract the interface later. In C++ the refactoring is not always so easy. It may require replacing values with smart pointers (because of the introduction of polymorphism) and other non-trivial tasks. On the other hand I don't much like the idea of introducing virtual calls when I am 90% sure they won't be needed. After all speed is one of the reasons to prefer C++ over simpler languages.

    Read the article

  • What to learn for a pure practical developer to get better?

    - by ChrisRamakers
    I'm a self taught developer that currently has more than enough experience to hold up against my colleagues waving with their degrees, yet I feel that I'm lacking some important skills to advance further into being a senior level professional in a leading role. More specific in the engineering, planning and designing aspect of software. I've touched the surface of UML, ERM/ERD, have experienced both waterfall and scrum projectmanagement, ... yet I feel there is something missing as every time I start on a new project I don't know where to begin. Should I start diagramming and how? should I start writing an xx page document describing the project on a technical level first, should I dive head first into writing the first tests and code or pseudo-code? I would like to know what, in my case, would be the best way forward, to learn how I can tackle this problem in the future and get better at leading and starting a project. There is not much i don't know about my technical tools and languages but when it gets abstract i'm in trouble.

    Read the article

  • Architecting persistence (and other internal systems). Interfaces, composition, pure inheritance or centralization?

    - by Vandell
    Suppose that you need to implement persistence, I think that you're generally limited to four options (correct me if I'm wrong, please) Each persistant class: Should implement an interface (IPersistent) Contains a 'persist-me' object that is a specialized object (or class) that's made only to be used the class that contains it. Inherit from Persistent (a base class) Or you can create a gigantic class (or package) called Database and make your persistence logic there. What are the advantages and problems that can come from each of one? In a small (5kloc) and algorithmically (or organisationally) simple app what is probably the best option?

    Read the article

  • Is there a way to extracting semantic informations from PDF? (converting PDF to pure XHTML)

    - by Eonil
    Hi. I'm finding a way to extract semantic structural informations (like title, heading, paragraph or lists) from PDF. Because I want to get a pure structural data from PDF. Finally, I want to create an pure XHTML from the PDF. With only structural informations. No design or layout. I know, PDF can be created without any structural information. I don't consider those PDFs. Only regularly well-structured PDFs are considered. I'm new to PDF. So I don't know it offers regular semantic structure or not. If it exists, it's library will offer it. So I want to know whether PDF spec has those information, and best way to get those information if exists.

    Read the article

  • Pure Java open-source libraries for portfolio selection (= constrained, non-linear optimization)?

    - by __roland__
    Does anyone know or has experience with a pure Java library to select portfolios or do some similar kinds of quadratic programming with constraints? There seems to be a lot of tools, as already discussed elsewhere - but what I would like to use is a pure Java implementation. Since I want to call the library from within another open-source software with a BSD-ish license I would prefer LGPL over GPL. Any help is appreciated. If you don't know such libraries, which is the most simple algorithm you would suggest to implement? It has to cope with an inequality constraint (all x_i = 0) and an equality constraint (sum of all x_i = 1).

    Read the article

  • What's the best example of pure show-off code you've seen?

    - by Damovisa
    Let's face it, programmers can be show-offs. I've seen a lot of code that was only done a particular way to prove how smart the person who wrote it was. What's the best example of pure show-off code you've seen (or been responsible for) in your time? For me, it'd have to be the guy who wrote FizzBuzz in one line on a whiteboard during a programming interview. Not really that impressive in the scheme of things, but completely unnecessary and pure, "look-what-I-can-do". I've lost the original code, but I think it was something like this (linebreaks for readability): Enumerable.Range(1,100).ToList().ForEach( n => Console.WriteLine( (n%3==0) ? (n%5==0) ? "FizzBuzz" : "Fizz" : (n%5==0) ? "Buzz" : n ) );

    Read the article

  • How to change the app name in OSX menubar in a pure-Python application bundle?

    - by gyim
    I am trying to create a pure-Python application bundle for a wxPython app. I created the .app directory with the files described in Apple docs, with an Info.plist file etc. The only difference between a "normal" app and this bundle is that the entry point (CFBundleExecutable) is a script which starts with the following line: #!/usr/bin/env python2.5 Everything works fine except that the application name in the OSX menubar is still "Python" although I have set the CFBundleName in Info.plist (I copied the result of py2app, actually). The full Info.plist can be viewed here: http://tinyurl.com/32qgpjt How can I change this? I have read everywhere that the menubar name is only determined by CFBundleName. How is it possible that the Python interpreter can change this in runtime? Note: I was using py2app before, but the result was too large (50 MB instead of the current 100KB) and it was not even portable between Leopard and Snow Leopard... so it seems to be much easier to create a pure-Python app bundle "by hand" than transforming the output of py2app.

    Read the article

  • Is there any LAME c++ wraper\simplifier (working on Linux Mac and Win from pure code)?

    - by Ole Jak
    So I want to create simple pcm to mp3 C++ project. I want it to use LAME. I love LAME but It is realy biiig. so I need some kind of OpenSource working from pure code with pure lame code workflow simplifier. So to say I give it File with PCM and DEST file. Call something like LameSimple.ToMP3(file with PCM, File with MP3 , 44100, 16, MP3, VBR); ore such thing in 4 - 5 lines (examples ofcourse should exist) and I have vhat I needed It should be light, simple, powerfool, opensource, crossplatform. Is there any thing like this?!?

    Read the article

  • Suggestions for entering mobile development -- pure iPhone SDK, Andorid SDK. Mono Touch or Titanium?

    - by Tom Cabanski
    I am entering mobile development. I have been working primarily in .NET since 1.0 came out in beta. Before that, I was mostly a C++ and Delphi guy and still dabble in C++ from time to time. I do web apps quite a bit so I am reasonably proficient with Javascript, JQuery and CSS. I have also done a few Java applications. I started web programming with CGI and live mostly in the ASP.NET MVC world these days. I am trying to decide on which platform/OS and tool to select. I am concerned with the size of the market available for my applications as well as the marketibility of the skills I will pick up. The apps I have in mind would work on both phones and pads. Some aspects of what I have in mind will play better on the bigger screens that will be available on pads. Here are the options I am considering: Apple iPhone/iPad using pure Apple SDK (Objective-C) Apple iPhone/iPad using Mono Touch (C#) Android using pure Android SDK (Java) Multiple platforms using something like Titanium to generate native apps from web technologies (HTML, CSS and Javascript) Multiple platforms using HTML5 web applications that run in the browser (HTML, CSS and Javascript). Which option would you choose? Do you have a different suggestion? What are the pros and cons?

    Read the article

  • What (pure) Python library to use for AES 256 encryption?

    - by Daren Thomas
    I am looking for a (preferably pure) python library to do AES 256 encription and decryption. This library should support the CBC cipher mode and use PKCS7 padding according to the answer to an earlier question of mine. The library should at least work on Mac OS X (10.4) and Windows XP. Ideally just by dropping it into the source directory of my project. I have seen this by Josh Davis, but am not sure about how good it is and if it does the required CBC cipher mode... Scanning the source suggests it doesn't

    Read the article

  • pure as3 benefits to compiling with flex4 instead of flex3?

    - by jedierikb
    If I have a pure as3 project that I have been compiling with flex3 from mxmlc, is there any reason to switch to using the mxmlc with flex4? I can use all of the flash 10 language features like Vector, 3D, etc., so that is not a reason to switch (or is there something I can't do?). But maybe there is a performance boost? Or is the exact same compiling tool and the flex code base is the only difference?

    Read the article

  • Where to get pure C++ Lame MP3 encoder - PCM to MP3 example?

    - by Ole Jak
    So all I need is a simple function that sets it up (eating incoming PCM RATE (for example: rate near to 44100) It's channels (for example: 2) and -bits (for example: 16) and desirable 128 kb\s rate) and another one that takes PCM data and encodes it into pure MP3 frames. I know it looks like a silly homework task but I assure you - it is not. I hope it will be of help to all C++ developers starting with MP3s. So can anybody please help me with that?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >