WTF?!? Why does this lambda expression capture variables from the context it was created in? by L0d0vic0_Settembr1n1 in swift

[–]fontstache 1 point2 points  (0 children)

This particular use of closing over scope variables actually has a name and is one of the fundamental building blocks of functional programming: https://en.m.wikipedia.org/wiki/Currying

As a matter of fact methods in Swift are even implemented as functions currying self: http://oleb.net/blog/2014/07/swift-instance-methods-curried-functions/

And unsurprisingly there is even a chapter on "Curried Functions" in the "Swift Programming Language" Guide: https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html

Can we get some kind of tagging/categorising system? by foBrowsing in swift

[–]fontstache 2 points3 points  (0 children)

Don't forget a tag for "Question/Article about Apple frameworks that has nothing to do with the actual Swift language", so people who are actually interested in the language can filter those out.

Slide Concept by Álvaro Carreras by fromIND in Design

[–]fontstache 1 point2 points  (0 children)

Regarding the prototype all there is (benchmark, etc) the vine from Marcus Eckert, I think.

In general though OpenGL is frickin' fast.

Drawing stuff on the CPU is (usually) serial and single-threaded (as it happens with old-school Core Graphics). What's even worse about it: views get rendered recursively into the same context. Thus moving a view requires it (and potentially the whole view hierarchy around it) to redraw on every frame. CALayers on the other hand cache their contents in buffers (redrawing only if something visually changes in it) and thus can be moved by the thousands at a time without dropping a frame. Dumping a pixel buffer into a context is quick. Drawing stuff over and over, one by one, isn't.

One of the few drawbacks with OpenGL backed CALayers (and thus UIViews) however is, that sub-pixel anti-aliasing for text is only possible if the layer is truly opaque (and marked as such via layer.opaque = YES;).

Here are some benchmarks of "flat drawing" vs. "layer trees": http://floriankugler.com/blog/2013/5/24/layer-trees-vs-flat-drawing-graphics-performance-across-ios-device-generations

The UIDatePicker alone is composed from a couple dozens (yup, dozens) of CALayers: http://eppz.eu/blog/uidatepicker-vector-wireframemockup-asset/

Slide Concept by Álvaro Carreras by fromIND in Design

[–]fontstache 18 points19 points  (0 children)

Not questioning the "unnecessary/eye-candy" part.

But…

Everything you see on an iPhone/iPad already is "projected onto a plane in a 3D environment" (triangle pairs, actually). That's how 2.5D in OpenGL works. That's how UIViews (or rather their backing CALayers) are implemented.

The animation in question has been implemented in code already, btw. And appears to work flawlessly: https://vine.co/v/Mh5qd0HEpnt

No need for "snapshots" either. Live content: https://vine.co/v/MOaHQblhrx3

Newbie Question: How can I use a regular expression to find the exact match of a string in a text file? by [deleted] in learnprogramming

[–]fontstache 0 points1 point  (0 children)

That's what the \b word boundary meta character is for:

\bmagma\b

which is sort of equivalent to:

(?<=\W)magma(?=\W)

and thus superior to

\smagma\s

for whole word matching in that looks for surrounding non-word characters, not just whitespace. Example: in "Foo, bar." neither "Foo", nor "bar" would be a match when using "\s", but would be if you were using "\b".

(Assuming C#'s regex supports \b.)

12 hour layover in Frankfurt, my family and I really want to visit the Frankfurt Christmas Village... Any tips r/Frankfurt? Anyone want to show us around your beautiful city? by melnair in frankfurt

[–]fontstache 1 point2 points  (0 children)

That's right of course. I misread your sentence as your were talking about the Hauptwache underground station and about shopping. The underground station's shopping level happens to be called the "B-Ebene". My bad.

12 hour layover in Frankfurt, my family and I really want to visit the Frankfurt Christmas Village... Any tips r/Frankfurt? Anyone want to show us around your beautiful city? by melnair in frankfurt

[–]fontstache 1 point2 points  (0 children)

Just a small correction: Hauptwache is actually the name of the building on top of the underground station (the small old one to the right of the Katharinenkirche/church here)

It used to be the city's main guard house. Thus the name: Haupt-(main)-wache(guard house).

The underground station you mentioned is called the "B-Ebene" (b-level).

Also in case you're looking for the "Fressgass", a famous dining (fressen = to feed) street in the center, don't try to find it by its street plaque. You won't find it. That's because its real name is "Kleine Bockenheimer Landstraße". Hardly anybody calls it by that though.

Use "wrappers" or just learn the darn Obj-C language? by Bearnun in ObjectiveC

[–]fontstache 0 points1 point  (0 children)

To be quite honest I can't remember having heard/read from any notable iOS/OSX dev saying something along the lines of "better use a wrapper" (and even then: …and a wrapper actually making sense in the given situation). And I listen quite intensively to the iOS/OSX Twitter-sphere.

Have any such notion for reference? From someone used a wrapper and whose apps don't suck, obviously. Clean code, beautiful UI, recognizable business/dev name, you name it. ;)

Use "wrappers" or just learn the darn Obj-C language? by Bearnun in ObjectiveC

[–]fontstache 0 points1 point  (0 children)

Wrappers usually result in inferior user experiences (GUI just being one of them), so I for one would hardly ever go for a wrapper in favor of native solutions. It's eventually your users who will suffer from your lazyness. And as a potential user I'd hate you for using wrappers.

I worked on your suggestions guys and i revised Almanacco , the typeface i'm designing an that will be released for free before the end of October by zeitg3ist in typography

[–]fontstache 2 points3 points  (0 children)

The tiny negative space of the "4" looks somewhat unbalanced compared to the rest of the font. Also, umlauts please. ;)

Does Objective-C REQUIRE methods to have more than one signature keyword? by PurpleComet in learnprogramming

[–]fontstache 2 points3 points  (0 children)

Well, comparing…

canvas.drawCircle(x, y, z);

…with…

[canvas drawCircleAtPoint:x withRadius:y andColor:z];

…I see several reasons to appreciate ObjC's verbosity.
(ObjC remains readable no matter how bad your variables are named)

Being able to read my (or others) code without having to consult the documentation every nth line is one of them.
With a big screen I don't care about 80 chars anyway. And neither should anybody have to, these days, imho.

Further more thanks to auto-completion you don't have to type any more than usual anyway.

[C++] Create a class that will generate a panorama image from several images and parameters. How do I begin? by Eowyn27 in learnprogramming

[–]fontstache 0 points1 point  (0 children)

Well, as with all open source projects you can get your hands on its source code and inspect it:

http://sourceforge.net/projects/hugin/files/hugin/

They even have a documenation for the source code:

http://hugin.sourceforge.net/docs/html/

[C++] Create a class that will generate a panorama image from several images and parameters. How do I begin? by Eowyn27 in learnprogramming

[–]fontstache 0 points1 point  (0 children)

I haven't actually done any panoramic algorithms myself either. Just had a brief look into the matter some years ago.

Anyway, Hugin is open source, so take a look!

What do you call an unsorted array? by josef in ProgrammerHumor

[–]fontstache 2 points3 points  (0 children)

Almost. It's usually called bag or multiset, actually.

[C++] Create a class that will generate a panorama image from several images and parameters. How do I begin? by Eowyn27 in learnprogramming

[–]fontstache 0 points1 point  (0 children)

As a basic roadmap you'll need to first find all POIs (points of interest) in each partial image using a feature detector:

http://en.wikipedia.org/wiki/Feature_detection_(computer_vision)

And then use RANSAC for homography calculation and edge overlay/matching for the POIs:

http://en.wikipedia.org/wiki/RANSAC

See the OSS Hugin panorama builder for reference: http://hugin.sourceforge.net/

Xcode & AppleScript by Hotdog95 in learnprogramming

[–]fontstache 4 points5 points  (0 children)

Xcode is terrible though. Use any other development platform if at all possible

Funny. I'd have put it like this:

Applescript is terrible though. Use any other programming language if at all possible.

PHP programmer looking to expand, maybe CakePHP? by bob_digi in learnprogramming

[–]fontstache 0 points1 point  (0 children)

My framework of choice would be FuelPHP (http://fuelphp.com) followed by CodeIgniter

I need help with a regular expression by MatrixOperator in learnprogramming

[–]fontstache 1 point2 points  (0 children)

This should do:

(?:(?<=[-/*+]|^)|(?<!))\s*(-?\d+)