• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

No. I don't believe that will work in this case.

<EDIT>

Actualy it might since the methods are static and he does it like this

Code:
List<Integer> a = HelloWorld.<Integer>methodA(Arrays.asList(1, 2, 3), Arrays.asList(1, 2, 3));

but I'm not in front of a compiler right now to test it.

I admit I come from C++ and only pretend to know Java, but why wouldn't it work?

Also, SMH at putting the type parameterization before the method name. Who designed this crap!

Im slowly getting the grip on VBA, but I ran into an issue where if I convert the contents of a cell to a string, modify it and write it back, it omits the last nr if its a 0.

My code is here
Code:
s = "T" + Left(CStr(ws.Cells(1, i)), 4) + "." + Right(CStr(ws.Cells(1, i)), 2)
ws.Cells(1, i).Value = s

Ideally that should take a value like "2016.06" and convert it into "T2016.06"
But with October "2016.10" it gives me "T2016.,1"

Worst case I can go and change that one cell every time I convert but Id like to find a solution for this.

Not sure you will find any VBA people around here, but try setting s to just the Left string and seeing what gets printed. Then try setting s to just the Right string. You should be able to narrow it down and figure out why you're getting a comma. Also, if I'm not mistaken the Excel VBA editor supports debugging. Just stick a breakpoint on the line and evaluate your function.
 

Koren

Member
Problem with VBA is that there's an awful lot of versions (and they even managed to localize the keywords, while storing them into ascii, and without providing translation, which means software developped on an Excel configured for french won't run on an english one o_O ). Also, you keep getting into locales problems, like . and ,

I've done a lot of it, but was so annoying that I tend to avoid it if I can now, and I'm all rusty.


I'm pretty sure that the issue here is that 2016.10 is stored like "2016,1" (well, not exactly, but even if the display is %.2f, the float to string convertion is %f, dropping the 0)

So the right 2 characters are indeed ",1" and not "10"

A quick'n dirty fix would be (although I'd be cautious of rounding errors, that's NOT the right solution)

Code:
s = "T" + Left(CStr(ws.Cells(1, i)), 4) + "." + Right(CStr(100*ws.Cells(1, i)), 2)

but there's proper functions for that, IIRC.


Would you mind exactly telling us what's the type of the cell (numeric, I guess) and the formatting? Are you using , as a decimal delimiter?

Edit : A cleaner (although still not nice) solution could be

Code:
val = ws.Cells(1, i)

year  = INT(val)
month = INT(ROUND(100*(val-year)))

s = "T" + CStr(year) + "." + CStr(month)

ws.Cells(1, i).Value = s


Re-Edit: to programmers: yes, there's a Format function to convert a number into a string into a specified format. But since it's locale-dependant, it's mostly useless...
 
The excel text() function isn't locale dependent though.

Honestly it sounds to me like he should be storing the original cell as a number, not as text. Then you can skip the vba and just use ="T" & TEXT(A1) in another cell
 

JesseZao

Member
I've avoided VBA at work for almost six months now. I only have to look at it occasionally to extract business logic out of existing systems. I could see it gaining more favor with the better SQL Server integration in Excel 2016, though.
 

Kylarean

Member
I admit I come from C++ and only pretend to know Java, but why wouldn't it work?

My edit does in fact work because the methods are static. So you were right, just the wrong syntax. If the methods weren't static then I'd have no idea how to make the parameterization work without adding the third Class parameter.

Also, SMH at putting the type parameterization before the method name. Who designed this crap!

They only took C/C++ as a base then mucked with it. I first looked at Java with 1.1.8 and absolutely hated it. Didn't look at it again until my company went all in Java with 1.5 (continued on so far to 1.8). Still hate some parts, like type erasure, but it is what it is.
 

Two Words

Member
I'm studying for my Organization of Programming Languages final exam. The book talks about things called "records" and "associative arrays", but the description sounds like records are basically structs and associative arrays are basically hash tables. Is it simply a different name for the same thing or are there subtle differences?
 
I'm studying for my Organization of Programming Languages final exam. The book talks about things called "records" and "associative arrays", but the description sounds like records are basically structs and associative arrays are basically hash tables. Is it simply a different name for the same thing or are there subtle differences?

records and structs are the same thing. struct is a programming language term though. Not every language calls them that. Pascal for example calls them records. Lisp calls them objects. C++ calls them classes or structs. "Records" transcends any specific language and just refers to the concept in the abstract.

associative is sort of the same, but is subtly different. hash table specifically describes the algorithm used to associate the key to the value. associative array doesn't. You could have an associative array that is implemented with something other than a hash table if you wanted to.
 

Two Words

Member
records and structs are the same thing. struct is a programming language term though. Not every language calls them that. Pascal for example calls them records. Lisp calls them objects. C++ calls them classes or structs. "Records" transcends any specific language and just refers to the concept in the abstract.

associative is sort of the same, but is subtly different. hash table specifically describes the algorithm used to associate the key to the value. associative array doesn't. You could have an associative array that is implemented with something other than a hash table if you wanted to.

The book says:

"An associative array is an unordered collection of data elements that are indexed by an equal number of values called keys"

I'm having trouble parsing this statement.
 
The book says:

"An associative array is an unordered collection of data elements that are indexed by an equal number of values called keys"

I'm having trouble parsing this statement.

A collection of key-value pairs. Basically the same as a record but the keys aren't predefined and final.

Code:
{
  "foo": "bar",
  "neo": "gaf"
}
 

Two Words

Member
Something else that is throwing me off is our professor is saying the difference between a pointer and a reference is that a pointer holds the absolute physical memory address on the actual RAM hardware while a reference holds a relative address that is related to the memory space allocated to the executing program. But I thought that's how all pointer addresses work. The OS and hardware work together to create a virtual memory space that is a mix of RAM and HDD space, but the executing program thinks it has the full set of memory available based on its bit-size (4GB for 32 bit). So wouldn't a C style pointer's address also be relative to the allocation of memory? I thought a reference is simply an entity that is a pointer behind the scenes but automatically does dereferencing for you.

I guess a way to test this would be to make a pointer in C that simply increments byte by byte and setting the value it is pointing to to 0. Is this going to eventually get you outside of the program's memory space and into other executable memory spaces?

A collection of key-value pairs. Basically the same as a record but the keys aren't predefined and final.

Code:
{
  "foo": "bar",
  "neo": "gaf"
}

Assuming the left-side are keys, it is simply mapping a key to a value? so "foo" maps to "bar" instead of a integer value index mapping to an element?
 
If it helps, an associative array is the same as a Dictionary, HashMap, Unordered Map or just Hash, depending on what language you're using.

Although technically Hash is just the implementation.
 

Koren

Member
Aren't "00.0" and "00,0" two distinct formats that are each locale independent?
Maybe it's a version thing, but I'm pretty sure that I suffer from the fact that . meant "the decimal separator" and , "the thousands separator"

After, it depends about what you're after. Producing a string that doesn't change depending on the locale is hard, but the format string at least is common among locales. Makes sense for Excel, but not easy in this case.


Having comma as decimal separator has been a nightmare with csv files, especially when data are produced by programming languages that produce number with a point... I think I used more often conversion scripts on this than dos2unix tools... which is telling.
 
Something else that is throwing me off is our professor is saying the difference between a pointer and a reference is that a pointer holds the absolute physical memory address on the actual RAM hardware while a reference holds a relative address that is related to the memory space allocated to the executing program. But I thought that's how all pointer addresses work. The OS and hardware work together to create a virtual memory space that is a mix of RAM and HDD space, but the executing program thinks it has the full set of memory available based on its bit-size (4GB for 32 bit). So wouldn't a C style pointer's address also be relative to the allocation of memory? I thought a reference is simply an entity that is a pointer behind the scenes but automatically does dereferencing for you.
If your professor said that a pointer contains a physical memory address then he's nuts, because that's completely wrong. It is impossible, by design, for a user mode program to refer to physical memory, otherwise the entire point of virtual memory is defeated.
 
Maybe it's a version thing, but I'm pretty sure that I suffer from the fact that . meant "the decimal separator" and , "the thousands separator"

After, it depends about what you're after. Producing a string that doesn't change depending on the locale is hard, but the format string at least is common among locales. Makes sense for Excel, but not easy in this case.


Having comma as decimal separator has been a nightmare with csv files, especially when data are produced by programming languages that produce number with a point... I think I used more often conversion scripts on this than dos2unix tools... which is telling.

Apparently you're right, I'm just dumb. But I just found this:

pbAs0qL.jpg
 

Koren

Member
Apparently you're right, I'm just dumb. But I just found this:

change-decimal-separator-excel-2013-4.jpg
Yes, you can use locale or override the default, but I'm reluctant to write macros that depends on options. Most of the things I wrote were fir associations or people I knew, it can easily be broken by a simple update without the user understanding anything.

I think you could save the option, set it as you like, and restaure it, but a crash/error and you've a side effect on the user's options :/
 

Two Words

Member
If your professor said that a pointer contains a physical memory address then he's nuts, because that's completely wrong. It is impossible, by design, for a user mode program to refer to physical memory, otherwise the entire point of virtual memory is defeated.

Yeah, that's what I was thinking too. Plus, wouldn't that mean that if you're using a 64-bit compiler for C++ and you print the value of a random pointer, that the hex value would have a lot of 0s on the left side if pointer addresses were the actually directly mapped to the RAM's hardware address? Any computer typical computer is going to have somewhere between 4-32GB of RAM. But a 64bit address is going to be around 18 quintillion bytes. In hex, that number would have a lot of 0s on the left side when written as 16 hex digits.
 
Yeah, that's what I was thinking too. Plus, wouldn't that mean that if you're using a 64-bit compiler for C++ and you print the value of a random pointer, that the hex value would have a lot of 0s on the left side if pointer addresses were the actually directly mapped to the RAM's hardware address? Any computer typical computer is going to have somewhere between 4-32GB of RAM. But a 64bit address is going to be around 18 quintillion bytes. In hex, that number would have a lot of 0s on the left side when written as 16 hex digits.

Yea. He's basically just wrong.

I have to assume he's talking about C++ since it is the only language that has both pointers and references.

The C++ standard doesn't say how references should be implemented. So there's no guarantee that references and pointers have anything to do with each other. But in practice, references are always implemented as pointers with some additional restrictions (can't be null, can't be re-assigned).

Because of those restrictions, sometimes references can be optimized better than pointers (optimization is really just applied data-flow analysis, and the more assumptions you can make, the more aggressively you can optimize), but for all practical purposes there is no difference.

You can prove to yourself that they're the same by writing this code:

Code:
int main(int argc, char **argv) {
  int *P = &argc;
  int &R = argc;
  return *P + R;
}

and then disassembling it. Here's the full sequence of commands I ran (assembly comments added by me)

Code:
D:\>type PR.cpp
int main(int argc, char **argv) {
  int *P = &argc;
  int &R = argc;
  return *P + R;
}

D:\>cl /Zi PR.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23918 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

PR.cpp
Microsoft (R) Incremental Linker Version 14.00.23918.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:PR.exe
/debug
PR.obj

D:\>dumpbin /disasm PR.obj | grep _main -C 20
Microsoft (R) COFF/PE Dumper Version 14.00.23918.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file PR.obj

File Type: COFF OBJECT

_main:
  00000000: 55                 push        ebp
  00000001: 8B EC              mov         ebp,esp
  00000003: 83 EC 08           sub         esp,8
  00000006: 8D 45 08           lea         eax,[ebp+8]            ; eax = &argc
  00000009: 89 45 FC           mov         dword ptr [ebp-4],eax  ; P = eax
  0000000C: 8D 4D 08           lea         ecx,[ebp+8]            ; ecx = &argc
  0000000F: 89 4D F8           mov         dword ptr [ebp-8],ecx  ; R = ecx
  00000012: 8B 55 FC           mov         edx,dword ptr [ebp-4]  ; edx = P;
  00000015: 8B 02              mov         eax,dword ptr [edx]    ; eax = *edx;
  00000017: 8B 4D F8           mov         ecx,dword ptr [ebp-8]  ; ecx = R;
  0000001A: 03 01              add         eax,dword ptr [ecx]    ; eax += *ecx;
  0000001C: 8B E5              mov         esp,ebp
  0000001E: 5D                 pop         ebp
  0000001F: C3                 ret

  Summary

         520 .debug$S
          2C .debug$T
          2F .drectve

So even though one is a reference and one is a pointer, the generated code treats them identically.

Even at the machine language instruction level, there are literally no instructions that allow you to access physical memory. Every assembly instruction you run only operates on virtual memory, you couldn't even touch physical memory if you wanted to.
 

Koren

Member
I thought it was possible at low-level, or how could memtest86 check physical addresses?

(with interleaving and such, I guess you don't really know where each data is stored, but I thought you had a 1:1 mapping still)

Or you mean once you launched any OS with virtual memory support?
 
Assuming the left-side are keys, it is simply mapping a key to a value? so "foo" maps to "bar" instead of a integer value index mapping to an element?

Yes. if this variable was called A then you could do A.foo (or A['foo']) and it would print 'bar'. That's more convenient than A[0] an indexed array would give you. Depends on what kind of data the variable needs to hold of course.

(syntax in javascript)
 
I thought it was possible at low-level, or how could memtest86 check physical addresses?

(with interleaving and such, I guess you don't really know where each data is stored, but I thought you had a 1:1 mapping still)

Or you mean once you launched any OS with virtual memory support?

Yea memtest86 runs in real mode. The cpu always starts in real mode, but the bootloader of any operating system changes to protected mode at which point the only way to go back to real mode is to reset your computer. But memtest and similar tools have their own bootloaders.
 

Koren

Member
Yea memtest86 runs in real mode. The cpu always starts in real mode, but the bootloader of any operating system changes to protected mode at which point the only way to go back to real mode is to reset your computer. But memtest and similar tools have their own bootloaders.
That's what I thought... but I was wondering whether things had changed in the last 15 years ^_^ They mayy have ditched real mode somehow on IA64...

At this time, there used to be a (convoluted) way to go back to real mode, but it was so tricky that reboot was already the best solution.

I used to code in ASM in real mode when they produced the first pentium... I remember the low-level programmation "bible" I used at this time (still only two meters away from me), they explained how to launch protected mode, giving source to do so... then said "congratulation, you're in protected mode, you cannot do anything, you cannot go back, reboot the machine"...
 
Is anyone in this topic a good Java developer
JVM 1.5 vanilla, I need an experienced contractor with time available to port a working golang tool, for which I have source, or reimplement from spec. Non gui, just network with command line arguments and output.

I was going to go to freelancer etc and get all the Indian applications but thought I would give the opportunity here first. it should be doable inside a week for a good dev, and pay is a couple of K USD but I am flexible plus it could lead to some sporadic improvement work charged by the hour afterwards. PM me but please consider if you have time to devote to it almost immediately (not oh after school I can probably do it), and have a project you can show.
I will look at any messages in a day, and if I get more than one will pick one or two to discuss with my apologies if you put time into a reply and don't hear I honestly have no idea if this is the wrong place to find someone or I will get 10 PMs. Thanks.
Oh and if you know someone ideal by all means hook them up just they have to PM me here.
 

Kansoku

Member
Actualy it might since the methods are static and he does it like this

Code:
List<Integer> a = HelloWorld.<Integer>methodA(Arrays.asList(1, 2, 3), Arrays.asList(1, 2, 3));

but I'm not in front of a compiler right now to test it.

Thanks, this worked. Kinda sucks that this needed do be done. I was expecting that It wouldn't match the second method because the first parameter T = List<Integer> and the second T = Integer, so it would only fall on that if i called methodA(List<Integer>, List<List<Integer>>).
 
I might need to make a highly personalized UI for a program a friend wants to make. Are web tools the way to go? how much does it compromise on performance?
 

Pinewood

Member
Problem with VBA is that there's an awful lot of versions (and they even managed to localize the keywords, while storing them into ascii, and without providing translation, which means software developped on an Excel configured for french won't run on an english one o_O ). Also, you keep getting into locales problems, like . and ,

I've done a lot of it, but was so annoying that I tend to avoid it if I can now, and I'm all rusty.


I'm pretty sure that the issue here is that 2016.10 is stored like "2016,1" (well, not exactly, but even if the display is %.2f, the float to string convertion is %f, dropping the 0)

So the right 2 characters are indeed ",1" and not "10"

A quick'n dirty fix would be (although I'd be cautious of rounding errors, that's NOT the right solution)

Code:
s = "T" + Left(CStr(ws.Cells(1, i)), 4) + "." + Right(CStr(100*ws.Cells(1, i)), 2)

but there's proper functions for that, IIRC.


Would you mind exactly telling us what's the type of the cell (numeric, I guess) and the formatting? Are you using , as a decimal delimiter?

I formatted the rows containing the months as text and that seemed to do the trick, they were general(automatic?) before.

Im not sure if thats the proper way of fixing this, but it worked right now.

So far VBA hasn't been very kind, but Im getting around it with my somewhat basic programming skills (and maybe not the most optimal or smartest code, but alas).

The debugger isnt any help either. Yesterday I got an error for missing Wend in my While function although it was there. Turned out I was missing Endif in a IF sentence...
 

Somnid

Member
I might need to make a highly personalized UI for a program a friend wants to make. Are web tools the way to go? how much does it compromise on performance?

Ever used a website that had something similar? You can expect it to be that fast, faster if you know what you're doing.
 
Ever used a website that had something similar? You can expect it to be that fast, faster if you know what you're doing.

I was looking at electron, which seems to be all the rage lately. One of the feature my friend wants is continuous backup à la google docs, on google drive itself. Are there APIs that let you do that?
 

Somnid

Member
I was looking at electron, which seems to be all the rage lately. One of the feature my friend wants is continuous backup à la google docs, on google drive itself. Are there APIs that let you do that?

I'm pretty sure there's a REST API. The problem I have with electron is is basically: if you were going to build a desktop app with web technologies, why not build a web app? There's very few reasons I would limit myself like that, not that there aren't a few legitimate ones, but you need to understand them.
 

Two Words

Member
I was studying for an exam yesterday with some people who were a semester away from getting their bachelors in CS. During our studying, I was asked what is a multidimensional array, what is the difference between inheritance and encapsulation, and what is the difference between private, public, and protected. How.....
 
I'm pretty sure there's a REST API. The problem I have with electron is is basically: if you were going to build a desktop app with web technologies, why not build a web app?

Because most (if not all) other ways of building cross platform desktop apps is a fucking pain in the ass and everything is terrible? Web as a platform is robust as hell, insanely accessible and easy to get started with. And it's not like doing a electron app rules out running your code in some other web browser either.
 

Somnid

Member
Because most (if not all) other ways of building cross platform desktop apps is a fucking pain in the ass and everything is terrible? Web as a platform is robust as hell, insanely accessible and easy to get started with. And it's not like doing a electron app rules out running your code in some other web browser either.

Yes, but I'm asking why not start there. You list great reasons to use web, so why even bother with native unless there's a very specific feature you're targeting that it can't support?
 
Yes, but I'm asking why not start there. You list great reasons to use web, so why even bother with native unless there's a very specific feature you're targeting that it can't support?

My friend had a bad experience with google docs. This new program would need to be able to process large (several hundred pages-long) documents as a single file, plus a slew of extra feature he'd like to have. Google docs apparently chugs really hard in those situations. Hard to tell exactly where the problem lies, though.
 
Call me an old fart but I will never make a web app if a desktop app meets my needs. Notably that means that if I need a cross-platform UI then a desktop app may be out of the question, but I rarely find that I need that. Most of the time I'm writing apps for people to use on a fixed set of platforms. A web interface to the app is a different story, that can be useful. But in general I find performance and responsiveness of web apps to be garbage compared to desktop apps.
 

Somnid

Member
My friend had a bad experience with google docs. This new program would need to be able to process large (several hundred pages-long) documents as a single file, plus a slew of extra feature he'd like to have. Google docs apparently chugs really hard in those situations. Hard to tell exactly where the problem lies, though.

Heavy File IO is one place where web apps don't work because they can't access the filesystem directly and cannot manage them in a stream format. So, yes, electron might suit your needs.

Call me an old fart but I will never make a web app if a desktop app meets my needs. Notably that means that if I need a cross-platform UI then a desktop app may be out of the question, but I rarely find that I need that. Most of the time I'm writing apps for people to use on a fixed set of platforms. A web interface to the app is a different story, that can be useful. But in general I find performance and responsiveness of web apps to be garbage compared to desktop apps.

Web gives you accessibility, easy distribution, cross-platform support and security for free so it's really hard to not take all that over performance, especially considering the average power of even mobile devices. There's reasons, but you need to actually evaluate them. "JS is slow" isn't a good one, and there's always ASM.js to get close to native speed.
 
Heavy File IO is one place where web apps don't work because they can't access the filesystem directly and cannot manage them in a stream format. So, yes, electron might suit your needs.



Web gives you accessibility, easy distribution, cross-platform support and security for free so it's really hard to not take all that over performance, especially considering the average power of even mobile devices. There's reasons, but you need to actually evaluate them. "JS is slow" isn't a good one, and there's always ASM.js to get close to native speed.

It's not that JS is slow, it's that the web as a platform is slow. And obviously "slow" is a relative term, but no matter how fast your JS runs, you still can never escape the limitation that the responsiveness of your app is limited by the speed and stability of your internet connection.

There's a reason why I will always use Microsoft Excel unless sharing is required, at which point I will use Google Docs or Office Online as a last resort. I would much rather take a one time hit of installing software on a new machine so that I can use it natively rather than take an almost negligible performance hit every single time I click on something.

Even for enterprise level applications, there's always a desktop and a web version, for that very reason. Everyone will prefer the desktop version unless they need accessibility, at which point they will continue using the desktop version except in those situations where they are on the road, or at home, and the web interface is the only choice.

If I can have both, great. But if I can only have one, then it's going to be the one that is slick and responsive.
 

Somnid

Member
It's not that JS is slow, it's that the web as a platform is slow. And obviously "slow" is a relative term, but no matter how fast your JS runs, you still can never escape the limitation that the responsiveness of your app is limited by the speed and stability of your internet connection.

There's a reason why I will always use Microsoft Excel unless sharing is required, at which point I will use Google Docs or Office Online as a last resort. I would much rather take a one time hit of installing software on a new machine so that I can use it natively rather than take an almost negligible performance hit every single time I click on something.

Even for enterprise level applications, there's always a desktop and a web version, for that very reason. Everyone will prefer the desktop version unless they need accessibility, at which point they will continue using the desktop version except in those situations where they are on the road, or at home, and the web interface is the only choice.

If I can have both, great. But if I can only have one, then it's going to be the one that is slick and responsive.

We did escape it. There's a modern term going around called PWA (progressive web app). These are apps that use services workers and other tricks to function the same even if they were offline. They create push notifications, background sync data when able, store large amounts of persistent data, all sorts of stuff people normally associate with apps. They have icons in your app launcher, splash screens, can remove all the browser chrome, and behave like any other app except it's 100% web and gracefully falls back if your browser sucks. Android fully supports them, Windows is building that in probably with the next release and will infact start listing them in their store as well. If I were building a cool new thing today, that's probably my first target, unless I was sure I needed something that it didn't provide.
 
Yes, but I'm asking why not start there. You list great reasons to use web, so why even bother with native unless there's a very specific feature you're targeting that it can't support?

Okay, I thought it was a general jab at web technology based desktop apps, sorry about that. But anyway, I still think that starting with a electron based desktop app is a good idea if the concept in general fits desktop usage, which I think it does based on the loose concept the OP provided.

We did escape it. There's a modern term going around called PWA (progressive web app). These are apps that use services workers and other tricks to function the same even if they were offline. They create push notifications, background sync data when able, store large amounts of persistent data, all sorts of stuff people normally associate with apps. They have icons in your app launcher, splash screens, can remove all the browser chrome, and behave like any other app except it's 100% web and gracefully falls back if your browser sucks. Android fully supports them, Windows is building that in probably with the next release and will infact start listing them in their store as well. If I were building a cool new thing today, that's probably my first target, unless I was sure I needed something that it didn't provide.

Exactly.

Like I mentioned on the web design OT, I am now a collaborator on Adobe's Brackets code editor that is built on top of CEF. I switched from IntelliJ Idea to Atom for Scala coding stuff because Idea was the one that was way too slow; you always hear things about Atoms slowness, but it's a night and day difference for me in general performance; maybe it's the billion things in IDEA I don't need combined with the slowness of Scala in general, but after I switched to using Ensime (http://ensime.github.io/) as an Atom Plugin I got 99% features I wanted with 1% of the cruft. I have Slack always open, and I always hear things about Electron using too much memory but some hundreds of gigabytes is a non issue for me (and I say this as someone who used a computer from 2001 for over 12 years). Web based desktops aren't a silver bullet for everything, but they are pretty much for everything minus some domain specific things.
 
JavaScript is going to get multithreading support and I guess webapps shouldn't be significantly slower than native at that point.

With ES2015/ES2016 (Or TypeScript if that tickles your pickle. No to Coffeescript though) and the incoming MT support my hatred for JS has waned quite a bit from say 6 years ago.
 

digdug2k

Member
Not sure if this is OT or not, but will My wife's got a job offer in Thailand coming. We've always wanted to live over seas, and we love Thailand, so its going to be hard not to take it, but it'll mean giving up my programming gig. Anyone have any experience with getting work over seas or with trying to do contract work from a foreign country? I looked through some jobs on:

https://www.expatjobzth.com/

The salaries aren't great (compared to here) but I have no idea how to find jobs as a contractor either.
 
Okay, I thought it was a general jab at web technology based desktop apps, sorry about that. But anyway, I still think that starting with a electron based desktop app is a good idea if the concept in general fits desktop usage, which I think it does based on the loose concept the OP provided.



Exactly.

Like I mentioned on the web design OT, I am now a collaborator on Adobe's Brackets code editor that is built on top of CEF. I switched from IntelliJ Idea to Atom for Scala coding stuff because Idea was the one that was way too slow; you always hear things about Atoms slowness, but it's a night and day difference for me in general performance; maybe it's the billion things in IDEA I don't need combined with the slowness of Scala in general, but after I switched to using Ensime (http://ensime.github.io/) as an Atom Plugin I got 99% features I wanted with 1% of the cruft. I have Slack always open, and I always hear things about Electron using too much memory but some hundreds of gigabytes is a non issue for me (and I say this as someone who used a computer from 2001 for over 12 years). Web based desktops aren't a silver bullet for everything, but they are pretty much for everything minus some domain specific things.

You mention slack, are you talking about the Windows desktop client or the mobile app and/or website?
 

Kalnos

Banned
Not sure if this is OT or not, but will My wife's got a job offer in Thailand coming. We've always wanted to live over seas, and we love Thailand, so its going to be hard not to take it, but it'll mean giving up my programming gig. Anyone have any experience with getting work over seas or with trying to do contract work from a foreign country? I looked through some jobs on:

https://www.expatjobzth.com/

The salaries aren't great (compared to here) but I have no idea how to find jobs as a contractor either.

You might be able to get a remote/telecommute job, most of them require you to be in a close timezone but I imagine that Australia/etc may be close enough to allow it. Stackoverflow has a remote job board, https://www.wfh.io, https://weworkremotely.com, I'm sure there are more.
 

Jokab

Member
I have a programming problem that I posted on stackoverflow (view it there for better formatting, I just copied the plaintext here), but I haven't gotten any answers yet. Might as well ask here too.

I have the following bash script:
cd root_folder && find folder1 folder2 -name "doc" -exec cp -r --parents {} $1{} \;

The idea is to find all folders named doc under folder1 and folder2 and copying the structure starting from root_folder to the path which is specified by the user's argument (along with all the content of doc).

So for example
root_folder/folder1/other_folder/doc

becomes:
$1/folder1/other_folder/doc

This script works as long as I don't have the user specify the folder to be copied to, i.e. if I don't have the $1. However when I do have it, I get the error:
cp: with --parents, the destination must be a directory
Try `cp --help' for more information.

This despite the fact that 1) I have assured that the specified folder exists beforehand, and 2) If I output the full path to be copied to, it looks exactly as it should, i.e. $1/folder1/other_folder/doc.

I have also tried adding a / after $1 to make $1/{}, but that gives a forward slash too many, making the path contain // which is obviously wrong.

What am I missing here?
 

Koren

Member
I think that's doing what you want:
Code:
find d1 d2 -name "doc" -exec cp -r --parents {} `dirname $1/{}` \;
You're obviously need the /
Edit: well, not really... but I find handy to be able to use as argument a directory with or without the last /

But when doing cp --parents to copy a directory, you don't have to specify the name of the copied directory. dirname allow you to strip the last element of the path.
 
Speaking of bash, anyone have any good recommendations for learning from the ground up? Now that I have a bash shell on Windows I figure I might as well learn it.
 
Top Bottom