|
Thank you for all this. It is just the kind of thing I was looking for.
Real programmers use butterflies
|
|
|
|
|
Until recently I lived in Vermont. The Burlington NBC station is so popular across the border that they run commercials for Canadians. One of the most common ones was for health insurance. Apparently they use it to pay for private care in Canada and the US. Canadians often go to Burlington for care they can't get in Canada and Vermonters and New Yorkers go to Canada for cheap eye surgery.
|
|
|
|
|
The PBS stations in Erie, PA and Watertown, NY receive a majority of their contributions from Canadians.
|
|
|
|
|
I've been living in Canada for 30 years and for 25 years I've been working remotely for a US company, so I think I know pretty well both sides of the border.
Worst thing about Canada: it's not US. Best thing about Canada: it's not US.
Seriously now, for almost every aspect you can find two sides of the coin. Yes, taxes are higher but in general you get better services. Yes, health system waiting times can be longer but life expectancy is higher, so maybe they know what they are doing. Yes, selection of movies on Netflix is smaller but who wants to see all the movies on Netflix.
Canada is no paradise on Earth (otherwise all Americans would move North) but it's not a bad place to live either (otherwise all Canadians would go South). In the end it's a personal decision. If you manage to live in Canada and get paid in US$ you can even make a comfortable living.
Mircea
|
|
|
|
|
Not to mention the fact that if you want to watch American Netflix in Canada, you can always use a VPN.
|
|
|
|
|
A friend of mine came to India about 10 days back for his wife to get a knee replaced surgically.
The wait in Canada was going to be 18 months and he decided he would rather pay $10,000 out of pocket than have his wife wait that long and live with excruciating pain.
Another friend in Toronto had chest pains and was taken to the hospital where they performed coronary artery bypass on him. When he was discharged, he asked for strong pain medication (there are opioids that are non-habit forming and are prescribed for cases such as his). He was told there was no money in the budget and he has to make do with Tylenol! So, excellent care for acute cardiac conditions but abysmal care for acute pain!
|
|
|
|
|
honey the codewitch wrote: What's your least favorite part about living in Canada, for those of you that do or have?
Their southern neighbours?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
You should definitely consult with an attorney familiar with all of the issues to help you setup a US(Delaware?) and/or off shore corporation and/or Canadian corporation with a Canadian based employee or contractor (you) if you want to continue your free lancing while living in Canada.
You do not want to find out 10 years later that you owe a particular jurisdiction tens or hundreds of thousands of dollars in back taxes.
I had a friend that ended up owing the US IRS $35K from an out of country 18 month engagement. Imagine a 5 year accounting mistake?
|
|
|
|
|
Good advice. I'll definitely look into getting something incorporated.
Real programmers use butterflies
|
|
|
|
|
i think its a good idea to move north !
|
|
|
|
|
Windows 11 made it very easy to use multiple desktop...
But.. I just can't get used to it.
Anyone here use multiple desktops? What for?
|
|
|
|
|
I've been using multiple desktops (aka workspaces) under Ubuntu on all my laptops (currently 3 in use ) for ages.
I find it is easier to generally work in a "one window per desktop" space, and flip (ctrl-alt-left/right in my case) between them, rather than alt-tab or whatever to switch windows in a single workspace. My layout is embedded somewhere in muscle memory, so switching to the window I want is near automatic. (Alt-tab doesn't always work as you'd expect! You need to keep at least half an eye open.)
On my main work machine, I run a horizontal row of 6 desktops. When it's at home, I have an external monitor above the laptop screen.
The six are typically:
File manager (explorer). If I'm home, mapped server file system/s on the top screen. (Deploy = drag'n'drop )
Alternate browser for website testing
IDE of the day. Often a reference/help above.
Primary browser
Command window. ssh prompt on server above.
Email/calendar
On this ("social") machine, 4 wide: Browser, text editor for notes, skype/zoom/etc, command/file manager.
I also run "workspace affinity", so that common programs are preassigned to specific workspaces. In conjunction with autostart, I boot straight into a complete environment, ready to run. And if I fire up a music player, I know its window is above the secondary browser...
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
very organized!
|
|
|
|
|
It relieves a few more ageing brain cells for more important pursuits.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Yes, but on Linux (LMDE). Email, casual Internet on one. Virtual machines, usually 3 open for programming on another. ESXi server on the third. If I want to do disk things, like backup and such, I open another. Same for my website tinkering on a Pi, just for learning. Once you get used to switching, it is second nature. Even this old dog learned a couple of new tricks a few years ago.
>64
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
mm.. do you have multiple screens though?
I think it might reduce the need for multiple desktop...
come to think of it, I should try them on my little tablet!
|
|
|
|
|
True. Worked that way back in the day. No, how I have one 34" monitor. I put multiple windows on each desktop.
I have 2 monitors (28 and 22") that are gathering dust (plus a 7" on my Pi). Like my current way with the large monitor best. Next one will be a large 4K TV.
Happy New Year.
>64
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
This is not a programming question. I will figure this out, and I don't really need help with it, although if an idea is burning a hole in your brain, go ahead and let me know.
I have the following structures:
struct FATransition : IComparable<FATransition> {
public int Min;
public int Max;
public FA To;
public FATransition(int min,int max,FA to) {
Min = min;
Max = max;
To = to;
}
public FATransition(FA to) {
Min = Max = -1;
To = to;
}
public int CompareTo([AllowNull] FATransition other) {
var c = Min.CompareTo(other.Min);
if (c != 0) return c;
return Max.CompareTo(other.Max);
}
}
...
class FA {
...
public bool IsDeterministic { get; private set; } = true;
List<FATransition> _transitions = new List<FATransition>();
public IList<FATransition> Transitions { get { return _transitions.AsReadOnly(); } }
...
}
The upshot is _transitions contains a list of range+state pairs.
The list should be sorted at all times, meaning inserts should be sorted. There will not be a way to remove FATransition items, except for clearing the list altogether, I think? I'm not sure yet. If I can avoid it I will.
There's a wrinkle. The ranges should not overlap for FATransitions where the To state is the same. On insert, they need to be merged into one transition if they overlap.
If there ever ends up a situation where more than one range or part of a range points to more than one To state I mark the IsDeterministic property false.
It's not that I don't know how to do this - it's just that there's no clean way to do it that is also efficient.
If I simply collated and merged over the entire list and rebuilt the list on each insert, that wouldn't be much code.
But to do it inline, only messing with the parts of the list that need messed with is corner case city.
I hate corner cases.
A) It broadens the test matrix
B) It is often *hard* to get full code coverage the more corner cases you have
C) It's harder to write
D) Ergo it's harder to read
E) 9 times out of 10 it's due to an anti-pattern
In this case, it's not an anti-pattern, or at least not one I can readily identify. It's just complicated. Dealing with sorted inserts is not a problem, but dealing with sorted range inserts gets tricky. The naive way to do it is to "expand" the ranges into individual items so 0-9 would be 10 entries, and then work with that, recombining when done, but that's not efficient.
By itself, that's not terrible. But when you add the rules about the ranges being able to overlap as long as their destination (To) states are different it gets weird fast.
I hate code like this. I hate writing it, and I hate that I want to put it off so badly that I write posts like this.
I only hope getting this out there inspires me to somehow come up with a better way to skin this particular cat. Sometimes just writing out my frustration brings me answers.
Real programmers use butterflies
|
|
|
|
|
I really appreciate your articles, and also your over all contribution to the forum. But sorry, for my feeling you are misusing your status and post programming questions (even you don't count this as such) here in the lounge.
Only my 2 cents.
|
|
|
|
|
Sorry, honey(only going by your username).
Wish I could help. But I am not even gonna use C# in my life. I'm just gonna be using HTML, Java, Python, and C++.
|
|
|
|
|
Having just seen an episode of the Simpsons, you almost lost me with the first "fat ran". I can almost imagine Homer saying "I have to run too?"
I do not know C# but maybe you are trying to do too much on a single list. Try looking at your problem from a different perspective. Instead of looking at the problem bottom-up try top-down, sideways, mad scientist user or... you know... like Homer
I have a custom list implemented (over the default list) in Java that, because it must be ordered, it does not use only a default list. It uses a default list to keep track of the order of the data, but the actual data is stored in a map of lists.
In your case data could be stored in the map indexed by "To" (your almost non-overlapping property) where each position of the map has a list with the actual data.
Good luck and try not to start the new year frustrated
|
|
|
|
|
Yeah, they could be indexed by To states. I actually do that in some of my previous code. I'd consider it here, but it means rewriting some very complicated code that acts on that FATransition list.
Real programmers use butterflies
|
|
|
|
|
I do not know what is possible to do in C# but, when a default data structure does not directly implement everything I need, I always try to make my data storage classes independent of the underlying storage type (data structure) by using templates and abstract classes.
Let us say that I want to store ClassA instances ordered by something that is a combination of some of its fields. I would probably make it ClassAStorage implements ClassStorageBase<actualstorageclass> where ClassStorageBase<t> implements the methods I need to make ClassStorage easier to work with including some abstract methods that will depend on ClassAStorage to be implemented and will be used in other methods of ClassStorageBase.
This also helps reusing code for, say, a ClassB that can be easily implemented as a ClassBStorage implements ClassStorageBase<anotherstorageclass>.
Simple snippet using my custom list:
- My storage class
public abstract class IndexedSet<TYPE_KEY extends Object,TYPE_DATA extends Object> {
private HashMap<TYPE_KEY,TYPE_DATA > cells;
}
- My ordered storage class
public abstract class IndexedSequence<TYPE_KEY extends Object,TYPE_DATA extends Object> extends IndexedSet<TYPE_KEY,TYPE_DATA>{
private ArrayList<TYPE_KEY> cellsOrder;
public Entry<TYPE_KEY, TYPE_DATA> get(int pos) {
TYPE_KEY k=cellsOrder.get(pos);
return new Pair<TYPE_KEY, TYPE_DATA>(k,internal().get(k));
}
}
- My base storage table (indexed rows that have indexed columns)
public abstract class TableCore<TYPE_KEY extends Object,TYPE_DATA extends Object>{
protected abstract TYPE_KEY getKey(TYPE_ROW r);
}
- finally, my class
public class TableBasic<TYPE_DATA extends Object> extends TableCore<Integer, TYPE_DATA>{
@Override
protected Integer getKey(TYPE_DATA r) {
return r.hashCode();
}
}
- and my other class
public class Table extends TableCore<UUID, TYPE_DATA extends MyData>{
@Override
protected UUID getKey(TYPE_DATA r) {
return r.id();
}
}
And, yes, it is a lot of work.
|
|
|
|
|
Yeah, I mean, I already do something like that in another part of my code, but it's not really appropriate here. It would add maintenance, but since it's only used by one thing, it doesn't need to be heavily abstracted.
Real programmers use butterflies
|
|
|
|
|
I don't quite see the problem here?
I mean, at the risk of being silly and obvious, I will state you should do a binary search when inserting (start an N/2, then N/4 or 3N/4 and so on...) for a quick match and then insert or merge. Elementary my dear Watson... or not?
FA being an ICollection<FATransition> , isn't it?
|
|
|
|
|