• Register
  • TOS
  • Privacy
  • @NeoGAF
  • Like

Ambitious
Member
(07-27-2017, 11:46 AM)
Ambitious's Avatar
Windows users, which Git UI do you use?

I only ever used SourceTree, but it's a piece of shit. I'm so sick of it.
A coworker recommended me Git Kraken, and Tower also looks pretty neat, so I'm gonna try those two first.
Last edited by Ambitious; 07-27-2017 at 11:53 AM.
Antagon
Member
(07-27-2017, 12:30 PM)
Antagon's Avatar
I use a combination of the IntelliJ git integration and some commandline tools. Works well enough for me.
archnemesis
Member
(07-27-2017, 12:51 PM)
archnemesis's Avatar

Originally Posted by Ambitious

Windows users, which Git UI do you use?

In Windows I use SourceTree, but generally I prefer using the command line.
Somnid
Member
(07-27-2017, 01:05 PM)
Somnid's Avatar

Originally Posted by Ambitious

Windows users, which Git UI do you use?

I only ever used SourceTree, but it's a piece of shit. I'm so sick of it.
A coworker recommended me Git Kraken, and Tower also looks pretty neat, so I'm gonna try those two first.

Github for Windows if you need a GUI, but Git is probably one of the few things that's actually represented fairly well by a command line due to it's state-machine type usage.
Ambitious
Member
(07-27-2017, 01:33 PM)
Ambitious's Avatar

Originally Posted by Antagon

I use a combination of the IntelliJ git integration and some commandline tools. Works well enough for me.

Originally Posted by archnemesis

In Windows I use SourceTree, but generally I prefer using the command line.

Originally Posted by Somnid

Github for Windows if you need a GUI, but Git is probably one of the few things that's actually represented fairly well by a command line due to it's state-machine type usage.

I do still use the CLI rather frequently, but for things like browsing the history, staging changes, or reviewing staged/unstaged changes, I really prefer a GUI.
vypek
Member
(07-27-2017, 02:03 PM)

Originally Posted by Ambitious

Windows users, which Git UI do you use?

I only ever used SourceTree, but it's a piece of shit. I'm so sick of it.
A coworker recommended me Git Kraken, and Tower also looks pretty neat, so I'm gonna try those two first.

I'm using SourceTree at work. I'm not a fan but I don't really want to switch to tortoise git which is our alternative.

Actually I stopped applying updates to SourceTree cause I always had an issue afterwards
CS_Dan
Member
(07-27-2017, 02:48 PM)
CS_Dan's Avatar
I've always gone back to the CLI after trying Git GUIs
archnemesis
Member
(07-27-2017, 03:06 PM)
archnemesis's Avatar

Originally Posted by Ambitious

I do still use the CLI rather frequently, but for things like browsing the history, staging changes, or reviewing staged/unstaged changes, I really prefer a GUI.

Some of those functions are built-in into my IDE. I use version history and blame/annotation frequently.
cpp_is_king
(07-27-2017, 03:56 PM)
cpp_is_king's Avatar

Originally Posted by Ambitious

Windows users, which Git UI do you use?

I only ever used SourceTree, but it's a piece of shit. I'm so sick of it.
A coworker recommended me Git Kraken, and Tower also looks pretty neat, so I'm gonna try those two first.

Windows user here who hates command lines.

Use the git cli, it's great
Last edited by cpp_is_king; 07-28-2017 at 12:11 PM.
esmith08734
Member
(07-28-2017, 12:06 PM)
esmith08734's Avatar
I am a Mac user but I use git via Terminal.

Side note: Lambda's are so awesome.
Jokab
Member
(07-29-2017, 10:55 AM)
Jokab's Avatar

Originally Posted by esmith08734

I am a Mac user but I use git via Terminal.

Side note: Lambda's are so awesome.

Hell yeah. I'm so glad we can use Java 8 in the project I'm doing at my summer internship. Almost abusing lambdas and stream functions at this point, while of course keeping it readable. The oldies taking over this code will have to learn ;)
ethanny2
Member
(07-30-2017, 08:38 AM)
ethanny2's Avatar
Going to repost my question about Android applications from Stack Overflow if anyone has an answer

I am just getting back into Android programming after a while and I know that separate Android applications are allowed to communicate with each other in some capacity, but is it possible for one to build a proprietary application that can modify the features of an already existing application?

I don't mean applications like those 3rd Instagram applications (which were most likely built using their api ). I mean is it possible to create an application that would for example run in the background and possibly add features on already existing applications?

For example making an extension application for that runs in the background when you use the Twitter application that could potentially add features, or disable existing features?

(Sorry if this is not directly relevant I did not know where else to post this question)

CS_Dan
Member
(07-30-2017, 10:17 AM)
CS_Dan's Avatar

Originally Posted by ethanny2

Going to repost my question about Android applications from Stack Overflow if anyone has an answer

Potentially, through some weird service calls and intents. But the original app would have to be written to do that, which makes it a bit pointless.
Alternatively there's the option of having an overlay which catches touches, but that's dodgy as fuck.

It's not really how Android apps are meant to work. The main way to do it would be like what Facebook have done with messenger - have a button in the main app which calls a custom URL to the second, sending you to the store if you don't have the second app installed.
barnone
Member
(07-30-2017, 04:21 PM)
barnone's Avatar

Originally Posted by ethanny2

Going to repost my question about Android applications from Stack Overflow if anyone has an answer

Why not build the background service that modifies the main application directly into the main application? I am guessing you may not control the main application source code, and in that case the above poster is correct: the author of the main app would have to provide some hooks for you.
ethanny2
Member
(07-30-2017, 09:54 PM)
ethanny2's Avatar

Originally Posted by CS_Dan

Potentially, through some weird service calls and intents. But the original app would have to be written to do that, which makes it a bit pointless.
Alternatively there's the option of having an overlay which catches touches, but that's dodgy as fuck.

It's not really how Android apps are meant to work. The main way to do it would be like what Facebook have done with messenger - have a button in the main app which calls a custom URL to the second, sending you to the store if you don't have the second app installed.

I was looking into the whole overlay/ drawing over other applications, if I used that could I only detect the pattern of touch? Or would it be possible to detect if a certain button or feature/ activity was called in an application that wasn't my own? And furthermore would it be possible to override the default implementation of a feature in an application that was not my own?

More specifically I am trying to do something similar to uBlock Origin where you can choose an element and remove it from the site. I know that Android apps do not have 'elements' like on the web but I was wondering if any sort of implementation like this is possible nonetheless.
Kieli
Member
(07-30-2017, 10:35 PM)
Kieli's Avatar

Originally Posted by Spoiled Milk

To quote a poster from many months ago: concurrency is hard. :( I cannot remember which synchronization points I have are used for what.

That is all.

I'm looking at promises, and I do not see their purpose at all. Like, asynchronous callbacks are much easier to use and understand. What the hell are "thens" and "catches"? Is JS promise trying to do a poor man's version of try-catch?
Kalnos
Member
(07-30-2017, 11:03 PM)
Kalnos's Avatar

Originally Posted by Kieli

I'm looking at promises, and I do not see their purpose at all. Like, asynchronous callbacks are much easier to use and understand. What the hell are "thens" and "catches"? Is JS promise trying to do a poor man's version of try-catch?

They're chainable, with async/await they let your code read like it's synchronous, they improve readability a fuck ton, you can bubble up the error handling, utility like Promise.all(). There are very few reasons to use a callback... and even when people do they wrap it in a promise in my experience.

To quote a stackoverflow post, would you rather deal with:

Code:

api(function(result){
    api2(function(result2){
        api3(function(result3){
             // do work
        });
    });
});
that or:

Code:

api().then(function(result){
    return api2();
}).then(function(result2){
    return api3();
}).then(function(result3){
     // do work
});
this?

How about with async/await?

Code:

const result = await api();
const result2 = await api2();
const result3 = await api3();
Since none of them depend on one another you could even run all 3 simuiltaneously using Promise.all if you wanted:

Code:

const results = await Promise.all([api(), api2(), api3()]);
Last edited by Kalnos; 07-30-2017 at 11:18 PM.
Somnid
Member
(07-31-2017, 03:18 AM)
Somnid's Avatar

Originally Posted by Kieli

I'm looking at promises, and I do not see their purpose at all. Like, asynchronous callbacks are much easier to use and understand. What the hell are "thens" and "catches"? Is JS promise trying to do a poor man's version of try-catch?

I think Kalnos generally got the gist of promises across but to go even further:

Try catch is generally an anti-pattern that can also be fixed the same way. For example many functional-based languages do not throw exceptions and use algebraic types to represent success or failure typically called "Result". This forces you not only to handle exceptions as the caller but also greatly simplifies the code because you always know what is expected and you can chain them. If you implemented one in js it might look like this:

Code:

parseInt(x)
  .andThen(x => x * 2)
  .andThen(x => 1/x)
  .andThen(x => x.toString())
  .orElse(e => `invalid input: ${e}`)
We can do the same thing to eliminate null with a type typically called "Option" or "Maybe" (this looks almost the same as result except it does not have an error type so the else function just excepts no parameters):

Code:

dictionary.get(x)
  .andThen(x => x.toString())
  .orElse(() => `invalid input: ${e}`)
You're probably already familiar with method chaining for lists:

Code:

list.filter(x => x > 10)
  .map(x => x * 2)
and if you've used RxJx you'll see the same thing happening for observables.

So then why not with an async result?

In general this generic structure that wraps values is called a monad and is heavily used in functional programming. Try out a functional language like Elm (which is designed for front-end web) and you might get an appreciation for it.
Beerman462
Member
(08-02-2017, 10:08 PM)
Beerman462's Avatar
Scripting question. I used this script twice to rename PC on two different domains no issue.

Now I am in the same domain as my first rename
job and this is what I get.

Rename-Computer : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ComputerName'. Specified method is not supported.
At C:scriptsOldNew.ps1:6 char:31
+ Rename-Computer -ComputerName $computers.Oldname -NewName $computers. ...


Script

$DomainCredential = Get-Credential
$computers = import-csv -Path "c:scriptscomputers.csv"

foreach ($oldname in $computers)
{
Rename-Computer -ComputerName $computers.oldname -NewName $computers.newname -DomainCredential $DomainCredential -Force -Restart
}


CSV content

oldname,newname
KTP-Helpdesk,SUPPORT3
cbeers1,SUPPORT2
cpp_is_king
(08-02-2017, 10:15 PM)
cpp_is_king's Avatar
Anybody here planning on going to CppCon this year, or am I the only idiot crazy enough to get this into c++?
Spoiled Milk
Banned
(08-02-2017, 10:19 PM)

Originally Posted by Somnid

Code:

parseInt(x)
  .andThen(x => x * 2)
  .andThen(x => 1/x)
  .andThen(x => x.toString())
  .orElse(e => `invalid input: ${e}`)

I've lost my taste for method chaining like this. They increase token count unnecessarily. And indentation. And they're worst of all for replacing null. Promises are good but I'd prefer async-await. Same thing with erroring and nullability. I prefer first class language support for common control flow semantics.

Originally Posted by cpp_is_king

Anybody here planning on going to CppCon this year, or am I the only idiot crazy enough to get this into c++?

Please let us know how it goes :S I'm still skeptical of metaclasses!

Originally Posted by Kieli

I'm looking at promises, and I do not see their purpose at all. Like, asynchronous callbacks are much easier to use and understand. What the hell are "thens" and "catches"? Is JS promise trying to do a poor man's version of try-catch?

Turning your application inside out like a klein flask is way harder for me than using functions from one type to another. I wish my problems were as easy as promises. I'm currently trying to put a memory barrier so the gpu doesn't touch some device memory while I update it. And symmetrically, I have to make sure my memory allocator isn't touching that memory while I render using it.

Stuff like this makes me really skeptical of claims from other people about immutability and functional programming being better for concurrency. All the real concurrency I've ever experienced isn't solved by the new fancy stuff at all.
Last edited by Spoiled Milk; 08-02-2017 at 10:27 PM.
cpp_is_king
(08-02-2017, 10:57 PM)
cpp_is_king's Avatar

Originally Posted by Spoiled Milk

Please let us know how it goes :S I'm still skeptical of metaclasses!

Yea there is a whole session on metaclasses so I'm looking forward to it.
Somnid
Member
(08-02-2017, 11:41 PM)
Somnid's Avatar

Originally Posted by Spoiled Milk

I've lost my taste for method chaining like this. They increase token count unnecessarily. And indentation. And they're worst of all for replacing null.

You can guarantee that there will never be a null pointer exception. Why would you ever want to defer that to runtime where it's harder to catch and more costly if it gets through? And if your answer is "well I'm good at checking" then great, let the language help you. Token count is language specific but interestingly functional languages tend to be more terse if that's what you truely want: http://redmonk.com/dberkholz/2013/03...xpressiveness/

Stuff like this makes me really skeptical of claims from other people about immutability and functional programming being better for concurrency. All the real concurrency I've ever experienced isn't solved by the new fancy stuff at all

You have two things that can mutate a shared state, functional programming doesn't typically allow that. It's probably hard because you are throwing away concurrency guarantees to reduce a memory footprint.
Spoiled Milk
Banned
(08-03-2017, 01:26 AM)

Originally Posted by cpp_is_king

Yea there is a whole session on metaclasses so I'm looking forward to it.

Off the top of your head can you think of things you might have used it for? I think a simple "data" metaclass is probably pretty useful. I've wanted something like that before. Common Lisp has metaclasses and I saw some really wild bastardizations uses for it.

Originally Posted by Somnid

You can guarantee that there will never be a null pointer exception. Why would you ever want to defer that to runtime where it's harder to catch and more costly if it gets through? And if your answer is "well I'm good at checking" then great, let the language help you.

I didn't say defer that to the runtime, I said integrate it into the language semantics in a more privileged way. For instance, Swift semantically has option types but in practice the compiler checks execution paths for null checks. Also, Rust introduced its ? operator which unwraps a Some/Ok but early returns a None/Error. Eventually (eventually >.>) they'll stabilize their own try-catch which functions the same as a match decomposition but saves you the ugly method chaining.

Although none of that satisfies my biggest gripe with using error values over exceptions, namely the union of error types from other parts of a large application. Ocaml figured this out a long time ago with "polymorphic variants" aka open unions but, well, it isn't efficient, it doesn't namespace, etc. Hopefully koren can correct me here if I'm wrong. Also I think Elm has open unions, I can't remember.

You have two things that can mutate a shared state, functional programming doesn't typically allow that. It's probably hard because you are throwing away concurrency guarantees to reduce a memory footprint.

And thank god for shared state, otherwise things would never be fast. How do I do work cancellation to cancel fork join tasks (like tree searches) which have become unnecessary... without CAS'ing a boolean? Why should I use "persistent" data structures like hash tries when I lose superlinear speedups due to cache locality? Even something basic like having n worker threads depends on using a mutable (and lock-free, of course) work queue. In my task especially I have no choice; I'm updating GPU memory. My PCIe bus (and the memory allocator for that matter) just isn't fast enough to allocate a gigantic chunk of memory every ~32ms frame. And even if it were, I'd be wasting all that time on something unnecessary and losing out on absolute buckets of performance that could have gone to shading.

Obviously you minimize this surface area. But you don't get rid of it completely. And for the record, Haskell has MVars, Clojure has atomics, etc. You just try to make the synchronization points as small as possible (because contention is bad for performance, too). Keeping track of unique ownership is a good idea, too. I believe in Go this is enshrined as the adage "share by communicating, don't communicate by sharing".
Last edited by Spoiled Milk; 08-03-2017 at 01:31 AM.
Somnid
Member
(08-03-2017, 04:32 AM)
Somnid's Avatar

Originally Posted by Spoiled Milk

I didn't say defer that to the runtime, I said integrate it into the language semantics in a more privileged way. For instance, Swift semantically has option types but in practice the compiler checks execution paths for null checks. Also, Rust introduced its ? operator which unwraps a Some/Ok but early returns a None/Error. Eventually (eventually >.>) they'll stabilize their own try-catch which functions the same as a match decomposition but saves you the ugly method chaining.

Idiomatic Rust prefers method chains over control structures precisely because the latter is considered "uglier" in that community. But what's cool about Option<T> over null is you get a bunch of benefits over null like forcing it to be dealt with and the caller knowing what to expect, but it's a normal Enum with a bit of sugar, no special privilege necessary.

Although none of that satisfies my biggest gripe with using error values over exceptions, namely the union of error types from other parts of a large application. Ocaml figured this out a long time ago with "polymorphic variants" aka open unions but, well, it isn't efficient, it doesn't namespace, etc. Hopefully koren can correct me here if I'm wrong. Also I think Elm has open unions, I can't remember.

That's all about standard types, you can use strings if you really want. Exceptions are objects in most languages, the difference is using a tagged union type it only comes out of the function in one way that is explicitly represented by the type signature with no upward propagation so you don't wind up with large catch-alls or not catching at all.

And thank god for shared state, otherwise things would never be fast. How do I do work cancellation to cancel fork join tasks (like tree searches) which have become unnecessary... without CAS'ing a boolean? Why should I use "persistent" data structures like hash tries when I lose superlinear speedups due to cache locality? Even something basic like having n worker threads depends on using a mutable (and lock-free, of course) work queue. In my task especially I have no choice; I'm updating GPU memory. My PCIe bus (and the memory allocator for that matter) just isn't fast enough to allocate a gigantic chunk of memory every ~32ms frame. And even if it were, I'd be wasting all that time on something unnecessary and losing out on absolute buckets of performance that could have gone to shading.

Obviously you minimize this surface area. But you don't get rid of it completely. And for the record, Haskell has MVars, Clojure has atomics, etc. You just try to make the synchronization points as small as possible (because contention is bad for performance, too). Keeping track of unique ownership is a good idea, too. I believe in Go this is enshrined as the adage "share by communicating, don't communicate by sharing".

Exactly, function programming keeps the sync to a very small surface area where it's most obvious and explicit. And like anything there is a tradeoff, lose formal verification to eek out some more speed out of a domain specific problem. But if you can spare it correctness is usually preferred to something blazing fast that crashes.
Spoiled Milk
Banned
(08-03-2017, 05:04 AM)

Originally Posted by Somnid

Idiomatic Rust prefers method chains over control structures precisely because the latter is considered "uglier" in that community. But what's cool about Option<T> over null is you get a bunch of benefits over null like forcing it to be dealt with and the caller knowing what to expect, but it's a normal Enum with a bit of sugar, no special privilege necessary.

I agree with forced handling, I'm just saying that it's really onerous when you do it through methods and closures. And you're wrong about it being considered "uglier" - a huge amount of people in Rust clamored for the ? early return syntax and the try! macro had been in the std since the beginning. I think the RFC that added ? was the most commented-on RFC in rust history.

That's all about standard types, you can use strings if you really want. Exceptions are objects in most languages, the difference is using a tagged union type it only comes out of the function in one way that is explicitly represented by the type signature with no upward propagation so you don't wind up with large catch-alls or not catching at all.

The bolded is pretty rarely the case for me. I've experienced writing subsystems that all have their own set of possible errors but which eventually bubble up to the orchestration of the main program and need to be logged or handled there. I either have to make huge unions that represent every error in the entire application or (more commonly) make separate, redundant definitions for all the subsets I plan on using and implement the Into trait (which is why try! has always expanded into "return error.into()" in the erroring case, btw). My point is that I'd much prefer starting with a large set and then writing subsets of cases as type synonyms.

Exactly, function programming keeps the sync to a very small surface area where it's most obvious and explicit. And like anything there is a tradeoff, lose formal verification to eek out some more speed out of a domain specific problem. But if you can spare it correctness is usually preferred to something blazing fast that crashes.

This is tautological. If speed doesn't matter, speed doesn't matter? I'm not saying everything has to be as fast as humanly possible, but my brain twitches when people say that the slowdown of Moore's Law + need for concurrency means that people should move to a paradigm of immutability. Speed is the sine qua non of parallelism. If it's not going to be fast, then why are you doing it? And don't underestimate the fantastic slowdown of functional datastructures. My experience is they can be an order to two orders of magnitude slower than the equivalent mutable, data-contiguous, ephemeral solution.

Also boo at "formal verification". I've never seen a functional program actually formally verified beyond what the type system already affords (which is not much except memory and exception safety). The safest programs in the world that are actually, really formally verified are being written in mutable C and Ada under DOD software engineering standards. These are your rockets, your airplanes, your infrastructure, you name it.
cpp_is_king
(08-03-2017, 05:56 AM)
cpp_is_king's Avatar
Formal verification isn't how you harden software, fuzz testing is
Kieli
Member
(08-03-2017, 06:48 AM)
Kieli's Avatar

Code:

x=0;\n\twhile (x < 10) { \n \tx++; \n }
Does anyone know where there's 9 whitespace tokens in the code above?

I'm counting 11 whitespace tokens. They are, in order from left to right:

\n, \t, blank space, blank space, blank space, blank space, \n, \t, blank space, \n, blank space
Koren
Member
(08-03-2017, 10:59 AM)
Koren's Avatar

Originally Posted by Kieli

Code:

x=0;\n\twhile (x < 10) { \n \tx++; \n }
Does anyone know where there's 9 whitespace tokens in the code above?

I'm counting 11 whitespace tokens. They are, in order from left to right:

\n, \t, blank space, blank space, blank space, blank space, \n, \t, blank space, \n, blank space

If you're counting those, I have 2 more:

\n, \t, blank space, blank space, blank space, blank space, blank space, \n, blank space, \t, blank space, \n, blank space

?
Koren
Member
(08-03-2017, 11:02 AM)
Koren's Avatar

Originally Posted by Spoiled Milk

And don't underestimate the fantastic slowdown of functional datastructures. My experience is they can be an order to two orders of magnitude slower than the equivalent mutable, data-contiguous, ephemeral solution.

I'm probably misunderstanding what you're saying, but I can't see why functional would be slower than other paradigms... (Especially since OCaml is often the fastest language in programming speed contests)
Somnid
Member
(08-03-2017, 02:21 PM)
Somnid's Avatar

Originally Posted by Spoiled Milk

I agree with forced handling, I'm just saying that it's really onerous when you do it through methods and closures. And you're wrong about it being considered "uglier" - a huge amount of people in Rust clamored for the ? early return syntax and the try! macro had been in the std since the beginning. I think the RFC that added ? was the most commented-on RFC in rust history.

? itself is used in method chaining:

Code:

try!(try!(try!(foo()).bar()).baz())

// becomes:
foo()?.bar()?.baz()?

The bolded is pretty rarely the case for me. I've experienced writing subsystems that all have their own set of possible errors but which eventually bubble up to the orchestration of the main program and need to be logged or handled there. I either have to make huge unions that represent every error in the entire application or (more commonly) make separate, redundant definitions for all the subsets I plan on using and implement the Into trait (which is why try! has always expanded into "return error.into()" in the erroring case, btw). My point is that I'd much prefer starting with a large set and then writing subsets of cases as type synonyms.

I'm having trouble understanding this one. You only have to deal with one error type, the one from the function call and not other propagated exceptions from nested calls which can be unpredictable and numerous requiring things like ..catch(Exception e){ ... } to get it all. You could also have aggregate error types if you need to preserve everything or simply pass the logger down. Both are easy enough to reason about.

This is tautological. If speed doesn't matter, speed doesn't matter? I'm not saying everything has to be as fast as humanly possible, but my brain twitches when people say that the slowdown of Moore's Law + need for concurrency means that people should move to a paradigm of immutability. Speed is the sine qua non of parallelism. If it's not going to be fast, then why are you doing it? And don't underestimate the fantastic slowdown of functional datastructures. My experience is they can be an order to two orders of magnitude slower than the equivalent mutable, data-contiguous, ephemeral solution.

What I'm saying is that you need something that works and then make it fast, solve concurrency first. Sometimes you don't even need concurrency at all, a good single threaded app is just fine if your getting good performance already. A fast program that crashes periodically isn't worth much. Users eventually have to use it. I also think you're exaggerating the "slowness" of the underlying structures, it's probably more that you are very familiar with your domain and use some more specific implementations.

Also boo at "formal verification". I've never seen a functional program actually formally verified beyond what the type system already affords (which is not much except memory and exception safety). The safest programs in the world that are actually, really formally verified are being written in mutable C and Ada under DOD software engineering standards. These are your rockets, your airplanes, your infrastructure, you name it.

Memory is the biggest one because it's harder to test for. The rest can usually be handled with testing. And C was not chosen for it's verifiability.

To circle back around, yes you can do lots of things without functional paradigms but they make code easier to reason about. Somethings will look uglier when ported to languages that don't have first class support for certain features. But I'd say null propagation, exception propagation and concurrency are 3 of the biggest things that functional programming really helps with.
cpp_is_king
(08-03-2017, 05:01 PM)
cpp_is_king's Avatar

Originally Posted by Spoiled Milk

Off the top of your head can you think of things you might have used it for? I think a simple "data" metaclass is probably pretty useful. I've wanted something like that before. Common Lisp has metaclasses and I saw some really wild bastardizations uses for it.

So if I understand correctly, the way they work is that you can write compile-time code to iterate over the methods and fields of the class, modifying them in various ways. One idea I had was a metaclass that can time all of its methods. For example, its initialization code could iterate every public method of the class, and add code at the beginning and end to compute a start time, end time, delta, and log that somewhere.

Another idea would be serialization. If you mark a class as serializable, the metaclass scans all public and private fields that are serializable and generates code to serialize them. It also adds a public method called Serialize() that does all this automatically.

One example from Herb Sutter's original paper is that of an interface metaclass, which marks every method as pure virtual, so that you could write:

Code:

interface foo {
  int x();
  int y();
};
but what you're actually getting is:

Code:

struct foo {
  virtual ~foo() = 0;
  virtual int x() = 0;
  virtual int y() = 0;
};
something like that could be interesting.

It's even more interesting when you combine this all with templates. For example, normally you write "template <typename T>" or "template <class T>". But with metaclasses, you might be able to write "template <interface T>", and it's enforced at compile time that the only thing you can parameterize this with are types which use the interface metaclass.

So I think it opens up some interesting possibilities, but it's definitely subtle enough that it will take some years before the interesting design patterns begin to emerge.
Kieli
Member
(08-04-2017, 08:46 AM)
Kieli's Avatar

Originally Posted by Koren

If you're counting those, I have 2 more:

\n, \t, blank space, blank space, blank space, blank space, blank space, \n, blank space, \t, blank space, \n, blank space

?

Oh yes, you are right! I'm even more confused now...

I looked at the solution, and it says \t\n is counted as 1 whitespace, but there's no \t\n. There's only \n\t. Even then, that would mean we go from 13 down to 11 blank spaces.

I guess I won't worry about it too much.
Jokab
Member
(08-07-2017, 09:42 AM)
Jokab's Avatar
Which tense do you all use for git commit messages? Personally I prefer past tense, but I've seen wildly varying opinions and arguments for different tenses.
Spoiled Milk
Banned
(08-07-2017, 09:57 AM)

Originally Posted by Jokab

Which tense do you all use for git commit messages? Personally I prefer past tense, but I've seen wildly varying opinions and arguments for different tenses.

imperative
cpp_is_king
(08-07-2017, 03:53 PM)
cpp_is_king's Avatar

Originally Posted by Spoiled Milk

imperative

+1

"Teach Foo to handle bar"
"Don't crash when X is null"

Etc
Somnid
Member
(08-07-2017, 03:56 PM)
Somnid's Avatar

Originally Posted by Jokab

Which tense do you all use for git commit messages? Personally I prefer past tense, but I've seen wildly varying opinions and arguments for different tenses.

Usually past tense but I am not consistent because it doesn't actually matter, it's useless bikeshedding. Just ask yourself, "if I was looking for something from this commit in the commit history, what would I want it to say?"
Spoiled Milk
Banned
(08-09-2017, 06:40 AM)

Originally Posted by Koren

I'm probably misunderstanding what you're saying, but I can't see why functional would be slower than other paradigms... (Especially since OCaml is often the fastest language in programming speed contests)

Not the paradigm, but the datastructures commonly associated with this. Immutable hash maps, for instance. There's a huge performance cost.

Originally Posted by Somnid

? itself is used in method chaining:

Code:

try!(try!(try!(foo()).bar()).baz())

// becomes:
foo()?.bar()?.baz()?

By method chaining I meant using .and_then. I much prefer ? to the former with closures. :) That's all I mean.

What I'm saying is that you need something that works and then make it fast, solve concurrency first. Sometimes you don't even need concurrency at all, a good single threaded app is just fine if your getting good performance already. A fast program that crashes periodically isn't worth much. Users eventually have to use it. I also think you're exaggerating the "slowness" of the underlying structures, it's probably more that you are very familiar with your domain and use some more specific implementations.

Fair criticism.

Somethings will look uglier when ported to languages that don't have first class support for certain features. But I'd say null propagation, exception propagation and concurrency are 3 of the biggest things that functional programming really helps with.

This is true. I'm coming at this from a different end, mind you: I listened to a lot of Rich Hickey years ago, drank the kool-aid so to speak, and learned Haskell and all that and while I value my time there, there was a sense of feeling like I had been lied to when I did more advanced concurrency in real applications and I realized all the tricks weren't going to cut it. Suddenly I was back to utilizing mutable state, globals, locks (!), etc.
BeforeU
Oft hope is born when all is forlorn.
(08-13-2017, 03:05 AM)
BeforeU's Avatar
Can someone suggest a good Data Structure and Algorithm online course?

I am doing sample problems from Codefights and Codingbat as suggested before, but most of the time I see myself copying and modifying others code rather than coming up with my own functions from scratch.

I need to clear my basic fundamentals, so looking for a proper course that I can take.
Massa
Member
(08-13-2017, 05:19 AM)

Originally Posted by BeforeU

Can someone suggest a good Data Structure and Algorithm online course?

I am doing sample problems from Codefights and Codingbat as suggested before, but most of the time I see myself copying and modifying others code rather than coming up with my own functions from scratch.

I need to clear my basic fundamentals, so looking for a proper course that I can take.

Get one of the classic books and go through it doing the exercises. Doing the exercises is the important part.

I personally prefer Cormen.
leroidys
Member
(08-13-2017, 07:49 AM)
leroidys's Avatar

Originally Posted by Massa

Get one of the classic books and go through it doing the exercises. Doing the exercises is the important part.

I personally prefer Cormen.

+1 for Cormen. Essential textbook.
Somnid
Member
(08-13-2017, 04:57 PM)
Somnid's Avatar
Finally got a new job out in Washington! It's been a gruelling 9 months of studying and interviews but finally paid off.
Jokab
Member
(08-13-2017, 05:00 PM)
Jokab's Avatar
Starting my first full-time position in software development next Monday, after 5 years of studying. I have done some internships during the summers so I'm not totally foreign to a workplace though. Will be doing full-stack development in .NET and Angular2 mainly. Pretty nervous.
Shadowlink
Member
(08-13-2017, 08:59 PM)
Shadowlink's Avatar
What are some good resources to re-review coding? I'd love a companion book for Cracking the Code in case I do get stuck.
Megasoum
Member
(08-13-2017, 11:17 PM)
Megasoum's Avatar
So I'm looking into learning Python.

I have done a LOT of scripting with AutoIT and a good amount of Powershell so I'm not a total newbie but I have never really worked with Python.

Any good online ressource you guys could suggest that would help me?
cyborg009
Member
(08-14-2017, 03:37 AM)
cyborg009's Avatar
Anyone here did some automation with outlook before? I wanted to use VBA to automate some stuff. I need a decent guide .

Also good guides on making a GUI with java? I really regret making this project in java instead of C# :(
cpp_is_king
(08-14-2017, 06:39 AM)
cpp_is_king's Avatar

Originally Posted by cyborg009

Anyone here did some automation with outlook before? I wanted to use VBA to automate some stuff. I need a decent guide .

Also good guides on making a GUI with java? I really regret making this project in java instead of C# :(

Sorry this isn't much help, but the only thing I know about office automation is that there's a 3 state bool with 5 states, only 2 of which are supported
phisheep
NeoGAF's Chief Barrister
(08-14-2017, 08:30 AM)
phisheep's Avatar

Originally Posted by Megasoum

So I'm looking into learning Python.

I have done a LOT of scripting with AutoIT and a good amount of Powershell so I'm not a total newbie but I have never really worked with Python.

Any good online ressource you guys could suggest that would help me?

I found this one really useful, then just used that to jump off into the Standard Library reference.
upandaway
Member
(08-14-2017, 07:24 PM)
upandaway's Avatar

Originally Posted by cyborg009

Anyone here did some automation with outlook before? I wanted to use VBA to automate some stuff. I need a decent guide .

Also good guides on making a GUI with java? I really regret making this project in java instead of C# :(

If you know how to WPF in C# then JavaFX is very very similar. Any beginner guide should let you catch up on the differences between the two and it'll be smooth from there. All of the good practices like keeping design out of the code are the same, too.

Thread Tools