Recommended Posts

  On 18/03/2014 at 19:04, Brando212 said:

well then. wasn't expecting that for another year or two. 

are there any major improvements from version 7?

 

mostly just use java for minecraft so only slightly interested

 

I found this post on reddit: http://winterbe.com/posts/2014/03/16/java-8-tutorial/

  On 18/03/2014 at 19:09, Zlip792 said:

that's a decent tutorial on the JDK but i'm wondering from a general user perspective what's new & what's improved in the run-time environment (JRE)

  On 18/03/2014 at 19:26, Andre S. said:

Lambda expressions! 6 years after C# and 3 years after C++, but better late than never.

 

I think Scala will still make more sense for new development, but for legacy code having lambdas will make for nicer refactoring capabilities.

Having never used lambdas, what is the benefit?  I have read up on their use in C#.. but not sure where the benefit is.  It seems almost like it just replaces a function that could be cleanly written anyways?

  On 18/03/2014 at 19:47, firey said:

Having never used lambdas, what is the benefit?  I have read up on their use in C#.. but not sure where the benefit is.  It seems almost like it just replaces a function that could be cleanly written anyways?

Lambdas are more than just functions because they capture all the variables in scope, so they're syntactic sugar for classes, not functions - that's actually what they compile to in C#. They're essential for programming in a functional style because they allow for easy creation and composition of functions. Usually classes in these languages occupy an entire file by themselves - reducing it to a single line enables very powerful techniques that would be awkward without!

 

If you haven't tried functional programming, you should check out F# (if you're on .NET) or Scala (for the JVM). http://www.tryfsharp.org/

  On 18/03/2014 at 19:56, Andre S. said:

Lambdas are more than just functions because they capture all the variables in scope, so they're syntactic sugar for classes, not functions - that's actually what they compile to in C#. They're essential for programming in a functional style because they allow for easy creation and composition of functions. Usually classes in these languages occupy an entire file by themselves - reducing it to a single line enables very powerful techniques that would be awkward without!

 

If you haven't tried functional programming, you should check out F# (if you're on .NET) or Scala (for the JVM). http://www.tryfsharp.org/

 

I think I understand.  I guess I just don't see why you would do like:

 

delegate int del(int i);
static void Main(string[] args)
{
    del myDelegate = x => x * x;
    int j = myDelegate(5); //j = 25
}
 

 

when you could either do:

 

static void Main(string[] args)
{
    int j = 5*5;
}

or

static void Main(string[] args)
{
    int j = square(5)
}

int square(int num)
{
   return num*num;
}

And achieve the same while being a little more readable.

 

Having never programmed functionally maybe I just don't understand it.   I'll take a look at F#.  In your opinion what makes functional programming beneficial / good?

  On 18/03/2014 at 19:13, Brando212 said:

that's a decent tutorial on the JDK but i'm wondering from a general user perspective what's new & what's improved in the run-time environment (JRE)

 

Maybe this: https://blogs.oracle.com/thejavatutorials/entry/jdk_8_is_released

  On 18/03/2014 at 19:45, thatguyandrew1992 said:

Does anyone know if Java 8 has better HighDPI support?

 

Unless Java8 includes a new graphical library I believe the answer is no. as that would be down to the graphical libraries like Swing and such. 

  On 18/03/2014 at 20:25, firey said:

I think I understand.  I guess I just don't see why you would do like:

 

delegate int del(int i);
static void Main(string[] args)
{
    del myDelegate = x => x * x;
    int j = myDelegate(5); //j = 25
}
 

 

when you could either do:

 

static void Main(string[] args)
{
    int j = 5*5;
}

or

static void Main(string[] args)
{
    int j = square(5)
}

int square(int num)
{
   return num*num;
}

And achieve the same while being a little more readable.

 

Having never programmed functionally maybe I just don't understand it.   I'll take a look at F#.  In your opinion what makes functional programming beneficial / good?

If the delegate is doing work in a separate thread, than you can deal with the separate thread as a single line (or two) instead of a separate class.

  On 18/03/2014 at 20:25, firey said:

Having never programmed functionally maybe I just don't understand it.   I'll take a look at F#.  In your opinion what makes functional programming beneficial / good?

 

Well, let's take a simple example. Say you have a collection of numbers, and you want the sum of all even numbers in that list. With lambdas and higher-order functions, in a language like F#, you would do:

let sum = collection
          |> Seq.filter(fun n -> n % 2 = 0)
          |> Seq.fold (+) 0

In an imperative style, using C# for example, you would do:

int runningTotal = 0;
foreach(var n in collection) {
    if (n % 2 == 0) {
        runningTotal += n;
    }
}

There's a big conceptual difference between the two. The F# code is declarative: it states that we take a collection, take the elements divisible by 2, and "fold" (compute a single value) using the + operator and starting from 0. We are not stating how to perform this computation, we are stating what the computation is.

 

The C# code is all about implementation, state and control flow. We implement sum using a variable that holds the current state of the computation (runningTotal). We explicitely iterate over a collection, and alter control flow using an if statement to skip certain elements. 

 

This might not mean that much, until we run this over 1000000 elements doing a more complicated computation, and suddenly we'd like to run this in parallel to take advantage of our multi-core CPUs. Since the F# code states nothing about how the computation is performed, it's trivial to make it parallel:

 

let sum = collection
          |> PSeq.filter(fun n -> n % 2 = 0)
          |> PSeq.fold (+) 0

That's it, I changed 2 characters to use the Parallel Sequence module rather than the regular Sequence module. 

 

Because the imperative code is all about implementation, state and control flow, it would have to be changed dramatically to work with multiple threads.

 

Multithreading in imperative, object-oriented code is very hard, because it's difficult to reason about the order of state changes with concurrency; functional programming can help greatly because it favors pure (stateless) functions and a more declarative style.

 

Functional programming means functions that are more reusable, more obviously correct, easier to understand, easier to test, easier to parallelize, easier to compose, etc., etc. The advantages are many. http://fpbridge.co.uk/why-fsharp.html

  On 18/03/2014 at 21:01, Andre S. said:

 

Well, let's take a simple example. Say you have a collection of numbers, and you want the sum of all even numbers in that list. With lambdas and higher-order functions, in a language like F#, you would do:

let sum = collection
          |> Seq.filter(fun n -> n % 2 = 0)
          |> Seq.fold (+) 0

In an imperative style, using C# for example, you would do:

int runningTotal = 0;
foreach(var n in collection) {
    if (n % 2 == 0) {
        runningTotal += n;
    }
}

There's a big conceptual difference between the two. The F# code is declarative: it states that we take a collection, take the elements divisible by 2, and "fold" (compute a single value) using the + operator and starting from 0. We are not stating how to perform this computation, we are stating what the computation is.

 

The C# code is all about implementation, state and control flow. We implement sum using a variable that holds the current state of the computation (runningTotal). We explicitely iterate over a collection, and alter control flow using an if statement to skip certain elements. 

 

This might not mean that much, until we run this over 1000000 elements doing a more complicated computation, and suddenly we'd like to run this in parallel to take advantage of our multi-core CPUs. Since the F# code states nothing about how the computation is performed, it's trivial to make it parallel:

 

let sum = collection
          |> PSeq.filter(fun n -> n % 2 = 0)
          |> PSeq.fold (+) 0

That's it, I changed 2 characters to use the Parallel Sequence module rather than the regular Sequence module. 

 

Because the imperative code is all about implementation, state and control flow, it would have to be changed dramatically to work with multiple threads.

 

Multithreading in imperative, object-oriented code is very hard, because it's difficult to reason about the order of state changes with concurrency; functional programming can help greatly because it favors pure (stateless) functions and a more declarative style.

 

Functional programming means functions that are more reusable, more obviously correct, easier to understand, easier to test, easier to parallelize, easier to compose, etc., etc. The advantages are many. http://fpbridge.co.uk/why-fsharp.html

 

Ah okay.  So doing calculations and such makes a lot of sense to go with the Functional.  But would it be viable for like.. a forms style app, or game? Or is it meant more for computational style applications?   As for the lambdas I think I see the benefit.  A lot of it comes down to flexiblity, using different functions cross thread without issue.  Declaring on the fly functions and using them without needing separate code or redundant code.

  On 18/03/2014 at 23:08, firey said:

Ah okay.  So doing calculations and such makes a lot of sense to go with the Functional.  But would it be viable for like.. a forms style app, or game? Or is it meant more for computational style applications?   As for the lambdas I think I see the benefit.  A lot of it comes down to flexiblity, using different functions cross thread without issue.  Declaring on the fly functions and using them without needing separate code or redundant code.

If your application consists mainly of boilerplate code like setting up forms and hooking up events, then there's not much that a functional language can do about it. You'll have the same boilerplate in a slightly different syntax. But if you have any sort of complexity beyond that then there's no doubt that at least being able to think functionally, regardless of language, helps tremendously. Few things have been as efficient in terms of improving my coding skills than learning a bit of F#. 

On the topic of functional programming in games, John Carmack has written a good article about how to apply functional techniques in C++: http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/

This topic is now closed to further replies.
  • Posts

    • OBS Studio 31.1.2 by Razvan Serea OBS Studio is software designed for capturing, compositing, encoding, recording, and streaming video content, efficiently. It is the re-write of the widely used Open Broadcaster Software, to allow even more features and multi-platform support. OBS Studio supports multiple sources, including media files, games, web pages, application windows, webcams, your desktop, microphone and more. OBS Studio Features: High performance real time video/audio capturing and mixing, with unlimited scenes you can switch between seamlessly via custom transitions. Live streaming to Twitch, YouTube, Periscope, Mixer, GoodGame, DailyMotion, Hitbox, VK and any other RTMP server Filters for video sources such as image masking, color correction, chroma/color keying, and more. x264, H.264 and AAC for your live streams and video recordings Intel Quick Sync Video (QSV) and NVIDIA NVENC support Intuitive audio mixer with per-source filters such as noise gate, noise suppression, and gain. Take full control with VST plugin support. GPU-based game capture for high performance game streaming Unlimited number of scenes and sources Number of different and customizable transitions for when you switch between scenes Hotkeys for almost any action such as start or stop your stream or recording, push-to-talk, fast mute of any audio source, show or hide any video source, switch between scenes,and much more Live preview of any changes on your scenes and sources using Studio Mode before pushing them to your stream where your viewers will see those changes DirectShow capture device support (webcams, capture cards, etc) Powerful and easy to use configuration options. Add new Sources, duplicate existing ones, and adjust their properties effortlessly. Streamlined Settings panel for quickly configuring your broadcasts and recordings. Switch between different profiles with ease. Light and dark themes available to fit your environment. …and many other features. For free. At all. OBS Studio 31.1.2 hotfix changes: Fixed an issue in OBS Studio 31.1.0 and 31.1.1 causing Multitrack Video to set the Maximum Video Tracks to 10 if the user had set it to "Auto" [dsaedtler] Fixed an issue in OBS Studio 31.1.0 and 31.1.1 causing Browser Source hardware acceleration to fail in the Flatpak version [reitowo/tytan652] Fixed an issue in OBS Studio 31.1.0 and 31.1.1 where progress bars were styled incorrectly [Warchamp7] Fixed an issue in OBS Studio 31.1.0 and 31.1.1 where spacing around scrollbars was incorrect [Warchamp7] Fixed an issue in OBS Studio 31.1.0 and 31.1.1 where Decklink Output did not work [CyBeRoni] Fixed a freeze in OBS Studio 31.1.0 and 31.1.1 on Linux when using PipeWire capture with explicit sync [YaLTeR] Fixed an issue where Video Capture Devices on Linux could unexpectedly stop capturing video [JiangXsong] Fixed an issue with PipeWire capture on Linux where video filters could cause gamma shift [tytan652] This was done by reverting a fix for white-tinted PipeWire captures in 10-bit or 16-bit color formats, so that issue will return for now. Download: OBS Studio 31.1.2 | Portable | ARM64 | ~200.0 MB (Open Source) View: OBS Studio Homepage | Other Operating Systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Sandboxie Plus 1.16.2 / Classic 5.71.2 by Razvan Serea Run programs in a sandbox to prevent malware from making permanent changes to your PC. Sandboxie allows you to run your browser, or any other program, so that all changes that result from the usage are kept in a sandbox environment, which can then be deleted later. Sandboxie is a sandbox-based isolation software for 32- and 64-bit Windows NT-based operating systems. It is being developed by David Xanatos since it became open source, before that it was developed by Sophos (which acquired it from Invincea, which acquired it earlier from the original author Ronen Tzur). It creates a sandbox-like isolated operating environment in which applications can be run or installed without permanently modifying the local or mapped drive. An isolated virtual environment allows controlled testing of untrusted programs and web surfing. Sandboxie is available in two flavors Plus and Classic. Both have the same core components, this means they have the same level of security and compatibility. What's different is the user interface the Plus build has a modern Qt based UI which supports all new features that have been added since the project went open source. The Classic build has the old no longer developed MFC based UI, hence it lacks support for modern features, these features can however still be used when manually configured in the Sandboxie.ini. Sandboxie Plus 1.16.2 / Classic 5.71.2 changelog: Added added toggleable INI key validation to "Edit ini Section" #4915 (thanks offhub) added toggleable per-key tooltip support #4928 (thanks offhub) added option to use the new Qt Windows 11 style on SandMan #4927 (thanks LumitoLuma) Changed ImBox no longer updates container file timestamps when accessing an encrypted box volume Fixed fixed Windows 11 24H2 build 26100.4770 causes Firefox Portable 140.0.4 / 141.0 to stop responding upon starting it sandboxed #4920 fixed leak of encrypted sandbox key during password change (backported hardened ImBox from MajorPrivacy) CVE-2025-54422 fixed Firefox Nightly sandbox hook errors Removed removed obsolete Bullguard Internet Security template removed obsolete Bsecure CloudCare template removed obsolete CyberPatrol template Download: Sandboxie Plus (64-bit) | 23.6 MB (Open Source) Download: Sandboxie Classic (64-bit) | 3.0 MB Links: Sandboxie Website | GitHub | ARM64 | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Indians never sing "I Think Indian" near giraffes.
    • Malwarebytes 5.3.5.204 by Razvan Serea Malwarebytes is a high performance anti-malware application that thoroughly removes even the most advanced malware and spyware. Malwarebytes version 5.xx brings comprehensive protection against today’s threat landscape so that you can finally replace your traditional antivirus. You can finally replace your traditional antivirus, thanks to a innovative and layered approach to prevent malware infections using a healthy combination of proactive and signature-less technologies. While signatures are still effective against threats like potentially unwanted programs, the majority of malware detection events already come from signature-less technologies like Malwarebytes Anti-Exploit and Malwarebytes Anti-Ransomware; that trend will only continue to grow. For many of you, this is something you already know, since over 50% of the users already run Malwarebytes as their sole security software, without any third-party antivirus. What's new in Malwarebytes 5.xx: Unified user experience - For the first time, Malwarebytes now provides a consistent experience across all of our desktop and mobile products courtesy of an all new and reimagined user experience powered by a faster and more responsive UI all managed through an intuitive dashboard. Modern security and privacy integrations - Antivirus and ultra-fast VPN come together seamlessly in one easy-to-use solution. Whether you’re looking for a next-gen VPN to secure your online activity, or harnessing the power of Browser Guard to block ad trackers and scam sites, taking charge of your privacy is simple. Trusted Advisor - Empowers you with real-time insights, easy-to-read protection score and expert guidance that puts you in control over your security and privacy. Malwarebytes 5.3.5.204 changelog: Introduced Deep Scan, a new Advanced Scan type recommended after blocking or removing threats Added new Windows Firewall Control feature preview to the Tools, feel free to try it and provide your feedback Revisited Dashboard layout for free version Minor usability and localization issues Download: Malwarebytes 5.3.5.204 | 397.0 MB (Free, paid upgrade available) Links: Malwarebytes Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • let's be honest here, it was in the line of secret doxing app
  • Recent Achievements

    • Dedicated
      ataho31016 earned a badge
      Dedicated
    • First Post
      Gladiattore earned a badge
      First Post
    • Reacting Well
      Gladiattore earned a badge
      Reacting Well
    • Week One Done
      NeoWeen earned a badge
      Week One Done
    • One Month Later
      BA the Curmudgeon earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      652
    2. 2
      ATLien_0
      261
    3. 3
      Xenon
      165
    4. 4
      neufuse
      142
    5. 5
      +FloatingFatMan
      107
  • Tell a friend

    Love Neowin? Tell a friend!