News aggregator

Neil Mitchell: Generating Open 3D Viewer Models

Planet Haskell - Wed, 09/24/2014 - 10:00am

Summary: It's not obvious how to generate suitable Open 3D Viewer models, but with the right tools it isn't hard.

The Open 3D Viewer project is very cool, as an example here is a demo of a spinning cow rendered in the browser. For my wife's work I wanted to generate a 3D model of a fossil bedding plane. Effectively, given some x/y/z coordinates, produce a pretty rendering. It took a fair bit of guess work, so I wrote down the steps.

Step 1: Generate an OBJ file

Generate an OBJ file. You probably want an MTL file too, but it seems the 3D viewer only uses the Kd field. There are a few ways to get an OBJ file:

  • There are many samples on the web, including a snail in the Open 3D Viewer repo.
  • You can create OBJ files in a tool such as Blender, but the Blender interface confused me a lot (I am definitely not their intended audience).
  • You can generate an OBJ file using a Haskell script. I picked this method, and I'll write a blog about the script later, once I have some pretty pictures to show.

Step 2: Get the tools

There are some tools in the WebGL Loader project. Alas, that project says "for now I recommend r50 as the last stable revision". So now there are two tools to try, the latest and r50. I tried both. I had some limited success with r50 (it didn't seem to render properly, but it did run) while the latest revision segfaulted. Fortunately I found the tools in a Google Groups post, and have mirrored them in my repo (with trivial tweaks to support Python 2.7).

Step 3: Run objcompress

You need to run:

objcompress mymodel.obj mymodel.utf8 > mymodel.js

This will generate lots of mymodel*.utf8 files and mymodel.js.

Step 3: Run part_grouping.py

You need to run:

py part_grouping.py

(The file in the email is part&grouping.py, but I renamed my copy.) This script will interactively ask a really long list of questions. I generate the correct inputs into a file and pipe it in:

py part_grouping.py < response.txt

This generates the files groupings.txt and part_info.txt.

Step 4: Run make_viewer_metadata.py

Run:

py make_viewer_metadata.py

This generates the file entity_metadata.json.

Step 5: Get the viewer source

You can get the viewer source from the Open 3D Viewer repo. I have mirrored it in my repo, but I may tweak the viewer over time to match my wife's needs - you should get the original.

Step 6: Copy your files

Copy all the files from steps 1 to 4 to a directory inside the viewer named models/mymodel.

Step 7: Update the model list

Open up scripts/models.js and edit it to point at your model. For example:

o3v.MODELS = [{
name:'mymodel.obj',
scriptName:'mymodel.js',
modelPath:'models/mymodel/',
metadataFile:'entity_metadata.json',
numLayers:12
}];

Step 8: View the result

You can view the result by opening index.html. In Chrome you may need to pass the flag --allow-file-access-from-files.

Categories: Offsite Blogs

Nottingham Research Fellowships (deadline 20th October)

General haskell list - Wed, 09/24/2014 - 8:30am
Dear all, The University of Nottingham is seeking applications for a number of Nottingham Research Fellowships: http://tinyurl.com/notts-fellows These are highly prestigious three-year fellowships, which are normally expected to lead into permenant academic positions. Candidates should have no more than 8 years postdoctoral experience, and fellowships normally start in October 2015. The deadline for submission of initial Expressions of Interest is ** 20th October 2014 **. Applicants in the area of the Functional Programming (FP) lab would be most welcome. The FP lab is keen to receive applications from outstanding candidates with an excellent publication record, experience in combining theory with practice, and the ability to secure external funding to support their research. Further information about the FP lab is available from http://fp.cs.nott.ac.uk As an approximate guideline, candidates in the area of the FP lab would normally be expected to have at least 3 years postdoc experience, and a nu
Categories: Incoming News

[ANN] Declarative Game Programming & haskanoid (FRP,SDL, Android)

haskell-cafe - Wed, 09/24/2014 - 8:24am
Hi Café A few weeks ago Henrik Nilsson gave a tutorial at PPDP 14 on Declarative Game Programming, demoing an SDL game using the FRP implementation Yampa. Additional material has been made available now: * Announcement and slides: http://fplab.bitbucket.org/posts/2014-09-23-declarative-game-programm.html * Game: http://github.com/ivanperez-keera/haskanoid The game includes wiimote support, SDL graphics and sound. We have other versions working with a kinect, if anyone is particularly interested. This is, IMHO, very fun to play, since you have to actually run around the room. Also, Keera Studios (my company) is working on an Android version of the game and a video of an early demo running on a Galaxy Tab is available ( http://keera.co.uk/blog/2014/09/24/game-programming-videos-code/ <http://keera.co.uk/blog/?p=690&preview=true>). Our internal, latest version runs now much faster than the ones in either video (new videos will be released soon). I hope we can soon give you a great excuse to be playing
Categories: Offsite Discussion

JFP special issue on parallel and concurrent FP

General haskell list - Wed, 09/24/2014 - 7:06am
Hi, If you’re working on parallel or concurrent FP, please consider submitting an article to this special issue of JFP, Cheers, Gabriele ------------------------------------------------------------------------------ CALL FOR PAPERS JFP Special Issue on Parallel and Concurrent Programming Submission Deadline: 22 December 2014 Expected Publication Date: November/December issue 2015 * Scope Functional languages are uniquely suited to provide programmers with a programming model for parallel and concurrent computing. This is reflected in the wide range of work that is currently underway, both on parallel and concurrent functional languages, but also on bringing functional language features to other programming languages. This has resulted in a rapidly growing number of practical applications. The Journal of Functional Programming will devote a special issue to functional progra
Categories: Incoming News

Numerals in input vs numerals in source

haskell-cafe - Wed, 09/24/2014 - 4:19am
Consider e1 = read "1" :: Integer e2 = read "1" :: Rational e3 = read "1" :: Double e1 and e3 evaluate to 1 and 1.0 respectively e2 produces an error: "Prelude.read: no parse" Yet (1::Integer, 1::Rational, 1::Double) evaluates to (1, 1%1, 1.0) Is the inconsistent parsing defensible, or just an (irrational!) fact? I believe a reconciliation would break nothing. Doug McIlroy
Categories: Offsite Discussion

Snap Framework: Announcing: Heist v0.14

Planet Haskell - Wed, 09/24/2014 - 4:10am

The Snap team is happy to announce the release of version 0.14 of Heist.

Major ChangesNamespace Support

Heist now has support for namespaces. This allows you to configure Heist so that all of your splices require a namespace. Requiring a namespace allows Heist to be more aggressive with errors for unbound splices. For instance, imagine you set the hcNamespace field in your HeistConfig to “h”, and you bind two splices.

mySplices = do "foo" #! fooSplice "bar" #! barSplice

With this setup, you would put the “h” namespace on all of the splice tags in your templates. Instead of calling those splices with “<foo>” and “<bar>”, you would use “<h:foo>” and “<h:bar>”. So why go to all this trouble so you have to type more? Because it allows Heist to do more error checking. Without namespaces there is no way for Heist to know whether a tag is supposed to be a splice or not. We could use the list of valid HTML tags to infer it, but that significantly constrains the scope of what we intended for Heist. This approach allows the user to be explicit about which tags should be splices. If you do not want to use namespaces, set the namespace to the empty string.

Along with the namespace field, we introduced the hcErrorNotBound for controlling the error checking. When hcErrorNotBound is True, Heist will generate an error message if it encounters any namespaced tags that do not have splices bound for them. This eliminates a large class of bugs where users were using a splice in their templates, but forgot to bind it in their code. The intent is that users will usually want to have this error checking turned on. But we felt it was also important to be able to use namespacing without the strict enforcement, so we included this flag to give users full control.

Generalized Error Reporting

Since this release is doing more error checking, we decided to expose error facilities to the user. This release exposes a new function tellSpliceError that you can use when error conditions are detected in your splices. If you are using compiled Heist, then all your templates will be processed up front at load time. If any of your load time or compiled splices detect an error condition that the user needs to fix, you can call tellSpliceError with an error message. If there are any errors, Heist initialization will fail and all the errors will be returned.

Restructured HeistConfig

The addition of hcNamespace and hcErrorNotBound to HeistConfig required some restructuring. Previously HeistConfig had a Monoid instance, but we removed that since the new fields make it unclear which instance should be used. But we also did not want to completely get rid of the monoid functionality either. So in order to get the best of both worlds, we refactored all of HeistConfig’s previous fields into another data structure called SpliceConfig. This way we can keep the Monoid instance for SpliceConfig and still avoid imposing a weird set of semantics on the user.

Unfortunately, given the use of field accessors it was impossible to make this change without breaking backwards compatibility. What seems like it should have been a simple addition of a couple parameters ended up being a more significant refactoring. To make these kinds of changes easier in the future Heist now exports lenses to all of the HeistConfig fields as well as an emptyHeistConfig value to use as a starting point. These lenses work with both the lens and lens-family-core packages and we export them without incurring a dependency on either lens package.

The HeistConfig constructor and field accessors have been moved to the Heist.Internal.Types module, so if you really need them, they are still available. However, be aware that Internal modules are subject to change without the deprecation cycle that we use for other modules.

Minor improvements
  • Factored out SpliceAPI module into separate map-syntax package and deprecated the old module which will be removed in the next major release.

  • Snap has been updated to support this Heist 0.14.

Categories: Offsite Blogs

Nottingham Research Fellowships (deadline 20 October)

Haskell on Reddit - Wed, 09/24/2014 - 1:31am

The University of Nottingham is seeking applications for a number of Nottingham Research Fellowships:

http://tinyurl.com/notts-fellows

These are highly prestigious three-year fellowships, which are normally expected to lead into permenant academic positions. Candidates should have no more than 8 years postdoctoral experience, and fellowships normally start in October 2015. The deadline for submission of initial Expressions of Interest is ** 20th October 2014 **.

Applicants in the area of the Functional Programming (FP) lab would be most welcome. The FP lab is keen to receive applications from outstanding candidates with an excellent publication record, experience in combining theory with practice, and the ability to secure external funding to support their research. Further information about the FP lab is available from http://fp.cs.nott.ac.uk

As an approximate guideline, candidates in the area of the FP lab would normally be expected to have at least 3 years postdoc experience, and a number of strong publications in leading international venues such as ICFP, POPL, LICS, JFP, Haskell Symposium, etc.

Graham Hutton

submitted by grahamhutton
[link] [comment]
Categories: Incoming News

Announcing: Heist v0.14

Haskell on Reddit - Wed, 09/24/2014 - 12:17am
Categories: Incoming News

[ANN] cabal-dev officially deprecated in favor of cabalsandboxes

General haskell list - Tue, 09/23/2014 - 11:59pm
Greetings, I'm pleased to announce (really!) that cabal-dev is being deprecated in favor of cabal sandboxes. Cabal sandboxes have been around long enough that it's clear that cabal-dev has served its purpose and we are left in good hands with the newer Cabal features. As a result: * No further cabal-dev releases will be pushed to Hackage. * For the sake of at least keeping the codebase buildable for those depending on it, we will accept pull requests adjusting version bounds in the cabal file on the cabal-dev repository at https://github.com/creswick/cabal-dev * If you are still using cabal-dev, we strongly encourage you to migrate to sandboxes. 'cabal sandbox' is a fantastic alternative; migrating to it is just about as simple as rm -r cabal-dev && cabal sandbox init && cabal install * If you need assistance using 'cabal sandbox', a very good introduction (and cabal-dev migration guide!) can be found at http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html Huge thanks a
Categories: Incoming News

Proposal: remove versionTags from Data.Version

libraries list - Tue, 09/23/2014 - 10:57pm
Version in Data.Version from base is defined as: data Version = Version { versionBranch :: [Int], versionTags :: [String] } instance Eq Version where v1 == v2 = versionBranch v1 == versionBranch v2 && sort (versionTags v1) == sort (versionTags v2) -- tags may be in any order instance Ord Version where v1 `compare` v2 = versionBranch v1 `compare` versionBranch v2 ## Proposal Remove the `versionTags` field from this type. ## Motivation * The Eq and Ord instances of Version don't agree whether two versions with different versionTags are equal or not [1]: > a = Version [1] ["a"] > b = Version [1] ["b"] > compare a b EQ > a == b False * The Package versioning policy does not include version tags [2]. * Cabal no longer supports package version tags [3,4]. Discussion period: 2 weeks. Note: this is not a proposal to ignore trailing zeros when comparing versions. Neither is this is a proposal to change the Eq instance
Categories: Offsite Discussion

Proposal: make nubBy obey the 98 report semantics

libraries list - Tue, 09/23/2014 - 10:45pm
The implementation of nubBy in Data.List is as follows, where USE_REPORT_PRELUDE refers to [1]: #ifdef USE_REPORT_PRELUDE nubBy eq [] = [] nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs) #else nubBy eq l = nubBy' l [] where nubBy' [] _ = [] nubBy' (y:ys) xs | elem_by eq y xs = nubBy' ys xs | otherwise = y : nubBy' ys (y:xs) -- Not exported: -- Note that we keep the call to `eq` with arguments in the -- same order as in the reference implementation -- 'xs' is the list of things we've seen so far, -- 'y' is the potential new element elem_by :: (a -> a -> Bool) -> a -> [a] -> Bool elem_by _ _ [] = False elem_by eq y (x:xs) = y `eq` x || elem_by eq y xs #endif That comment is actually not correct [2], and the report version and the base version don't have the same semantics when used on asymmetric relations: MyReportPrelude> nubBy (<) [1] [1]
Categories: Offsite Discussion

How do I install Haskell-mode on emacs?

Haskell on Reddit - Tue, 09/23/2014 - 7:47pm

New to Haskell and I can't figure out how to install Haskell-mode. I've downloaded the latest version of Haskell platform for Mac and emacs 24. However when I get to the packages buffer I can't see an option to install Haskell-mode??

submitted by willrobertshaw
[link] [4 comments]
Categories: Incoming News

foreign ccall export / ghc 7.6.3

haskell-cafe - Tue, 09/23/2014 - 6:31pm
Are there examples of "foreign ccall export" that work with GHC 7.6.3?
Categories: Offsite Discussion

Multicast receiver thread fails to receive last fewmessages

haskell-cafe - Tue, 09/23/2014 - 4:14pm
I am trying to send multicast messages from one thread, and receive them on another. The sending thread reads lines from a file and sends them. However, the receiving thread does not receive all the messages - it seems to miss the last 10 message or so. If I run other programs to listen for the multicast message, they receive them fine. So I think the issue is something to do with receiving, not sending. I keep the program alive with a threadDelay, so it shouldn't be halting prematurely. If I add a small delay after each send, it works fine. And if I make the input file smaller, it works fine. On the provided data file, on my system (64-bit Ubuntu, GHC 7.8.2), the receiver fails to receive lines 125-140. Compiled with no optimizations. Thanks for any help! The relevant code snippets are below, and the sample data file and full program are attached. -- Loop to receive all the packets let receiveMulticast = do (msg, _) <- recvFrom recvSock 32628 putStrLn . BS.unpack $ BS.tak
Categories: Offsite Discussion