[Solved] Custom hierarchy

[ad_1] Here is a generic method regardless of the level of the hierarchy. SQL — DDL and sample data population, start DECLARE @tbl table ( idGeo INT IDENTITY PRIMARY KEY, GEO VARCHAR(64), PARENTID INT ); insert into @tbl (GEO, PARENTID) values ( ‘EMEA’, NULL), ( ‘France’, 1), ( ‘mIDCAPSfRANCE’, 2), ( ‘Germany’, 1), ( ‘France … Read more

[Solved] How to use .jar file in as3 [closed]

[ad_1] JAR files are typically compiled Java code, which can be opened by the Java Virtual Machine. Java is owned and updated by Sun Microsystems. SWF files are compiled ActionScript code, which can by opened by the ActionScript Virtual Machine. ActionScript (used by Flash) is owned and updated by Adobe. The two are similar, but … Read more

[Solved] Programmatically get the time at clock-change [closed]

[ad_1] To find out DST transitions, you could access Olson timezone database e.g., to find out the time of the next DST transition, in Python: #!/usr/bin/env python from bisect import bisect from datetime import datetime import pytz # $ pip install pytz def next_dst(tz): dst_transitions = getattr(tz, ‘_utc_transition_times’, []) index = bisect(dst_transitions, datetime.utcnow()) if 0 … Read more

[Solved] Python Recursion Puzzle: Buying n McNuggets at McDonalds (using 6, 9 and 20 packs) [closed]

[ad_1] Recursion works by breaking down each problem to a “smaller” version of the same problem. In this case, you can insert this code: elif n < 0: return False elif is_buyable(n – 20) or is_buyable(n – 9) or is_buyable(n – 6): return True 4 [ad_2] solved Python Recursion Puzzle: Buying n McNuggets at McDonalds … Read more

[Solved] Differences in these syntaxes for CSS? [closed]

[ad_1] The # symbol indicates that it’s an ID selector, so it will only apply to the single element that has that particular ID on the page. You’re incorrect about example A – that’s actually a selector for the element with the ID input, not a general selector for all inputs. The . symbol indicates … Read more

[Solved] How to convert these PHP functions to C#?

[ad_1] In c#, the timezone is built into the DateTime structure, so you should not need to set the default. Instead when you are manipulating DateTime instances you use the UTC version of methods. For example, in the constructor you can specify if the date supplied is local or UTC. With regards to the second … Read more

[Solved] JavaScript equivalent of PHP passing parameter

[ad_1] Neither of the two are correct. In PHP var1 will get that value in the function. In JS, if you don’t want to assign something to the first parameter, make it null. do_it(null, ‘something_cool’); And then inside the function, check if it’s null and perhaps give it a default value if it is. Or … Read more

[Solved] Is there way to replace ranged data (eg 18-25) by its mean in a dataframe?

[ad_1] There are several ways to transform this variable. In the picture I see, that there are not only bins, but also value ’55+’, it needs to be considered. 1) One liner: df[‘age’].apply(lambda x: np.mean([int(x.split(‘-‘)[0]), int(x.split(‘-‘)[1])]) if ‘+’ not in x else x[:-1]) It checks whether the value contains ‘+’ (like 55+), if yes than … Read more

[Solved] How does a software-based context-switch with TSS work? [closed]

[ad_1] First of all, the TSS is a historical wart. Once in a time (a.k.a: early 1980’s), people at Intel tought that hardware context-switching, instead of software context-switching, was a great idea. They were greatly wrong. Hardware context-switching has several noticeable disadvantages, and, as it was never implemented appropiately, had miserable performance. No sane OS … Read more