text:
Q: Ngrx effects not working when in a preloaded module I have two modules, let's call them EagerModule and PrealodedModule. Both of them have their own feature reducers and effects.
EagerModule is loaded eagerly in the app, meaning its in the list of AppModule's imports.
@NgModule({
    imports: [
        // .. other modules
        EagerModule
    ]

PreloadedModule, on the other hand, is loaded lazily, but since I am using preloadingStrategy: PreloadAllModules, we can say that it's basically preloaded (meaning, it's being loaded just after all eager modules are loaded).
I am trying to dispatch an action from PrealoadedModule in a EagerModule's component. However, it seems like the effects are not being initialized as my action doesn't perform the http request that it is supposed to. I tried hacking this by only dispatching this action after I have a value in PreloadedModule's state selector, however, this didn't work either.
The only way I can get this working is if I load PreloadedModule eagerly, but that is not what I want to achieve.
So, how can I make effects from a preloaded module work in another module?


text:
Q: Django floatformat with forms.FloatField objects {{ value }} works in my template.
{{ myForm.myFloatField }} works. myForm inherits from forms.Form and myFloatField is a forms.FloatField object.
{{ value|floatformat:3 }} presents the value with three numbers after the decimal, as expected.
{{ myForm.myFloatField|floatformat:3 }} does not work, not even rendering the field.
How do I get myForm.myFloatField to present with three numbers after the decimal?

redpajama_set_name: RedPajamaStackExchange


text:
Q: finding intersection of intervals in pandas I have two dataframes
df_a=

     Start Stop Value
    0  0     100  0.0
    1  101   200  1.0
    2  201  1000  0.0

df_b=
       Start Stop Value
    0  0     50 0.0
    1  51   300 1.0
    2  301 1000  0.0

I would like to generate a DataFrame which contains the intervals as identified by Start and Stop, where Value was the same in df_a and df_b. For each interval I would like to store: if Value was the same, and which was the value in df_a and df_b.
Desired output:
df_out=
  Start Stop SameValue Value_dfA Value_dfB
      0    50    1          0       0
      51   100   0          0       1
      101  200   1          1       1
      201  300   0          0       1
    [...]

A: Not sure if this is the best way to do this but you can reindex, join,  groupby and agg to get your intervals, e.g.:
Expand each df so that the index is every single value of the range (Start to Stop) using reindex() and padding the values:
In []:
df_a_expanded = df_a.set_index('Start').reindex(range(max(df_a['Stop'])+1)).fillna(method='pad')
df_a_expanded

Out[]:
         Stop  Value
Start
0       100.0    0.0
1       100.0    0.0
2       100.0    0.0
3       100.0    0.0
4       100.0    0.0
...
997    1000.0    0.0
998    1000.0    0.0
999    1000.0    0.0
1000   1000.0    0.0

[1001 rows x 2 columns]

In []:
df_b_expanded = df_b.set_index('Start').reindex(range(max(df_b['Stop'])+1)).fillna(method='pad')

Join the two expanded dfs:
In []:
df = df_a_expanded.join(df_b_expanded, lsuffix='_dfA', rsuffix='_dfB').reset_index()
df

Out[]:
      Start  Stop_dfA  Value_dfA  Stop_dfB  Value_dfB
0         0     100.0        0.0      50.0        0.0
1         1     100.0        0.0      50.0        0.0
2         2     100.0        0.0      50.0        0.0
3         3     100.0        0.0      50.0        0.0
4         4     100.0        0.0      50.0        0.0
...

Note: you can ignore the Stop columns and could have dropped them in the previous step.
There is no standard way to groupby only consecutive values (à la itertools.groupby), so resorting to a cumsum() hack:
In []:
groups = (df[['Value_dfA', 'Value_dfB']] != df[['Value_dfA', 'Value_dfB']].shift()).any(axis=1).cumsum()
g = df.groupby([groups, 'Value_dfA', 'Value_dfB'], as_index=False)

Now you can get the result you want by aggregating the group with min, max:
In []:
df_out = g['Start'].agg({'Start': 'min', 'Stop': 'max'})
df_out

Out[]:
   Value_dfA  Value_dfB  Start  Stop
0        0.0        0.0      0    50
1        0.0        1.0     51   100
2        1.0        1.0    101   200
3        0.0        1.0    201   300
4        0.0        0.0    301  1000

Now you just have to add the SameValue column and, if desired, order the columns to get the exact output you want:
In []:
df_out['SameValue'] = (df_out['Value_dfA'] == df_out['Value_dfB'])*1
df_out[['Start', 'Stop', 'SameValue', 'Value_dfA', 'Value_dfB']]

Out[]:
   Start  Stop  SameValue  Value_dfA  Value_dfB
0      0    50          1        0.0        0.0
1     51   100          0        0.0        1.0
2    101   200          1        1.0        1.0
3    201   300          0        0.0        1.0
4    301  1000          1        0.0        0.0

This assumes the ranges of the two dataframes are the same, or you will need to handle the NaNs you will get with the join().

A: I found a way but not sure it is the most efficient. You have the input data:
import pandas as pd
dfa = pd.DataFrame({'Start': [0, 101, 201], 'Stop': [100, 200, 1000], 'Value': [0., 1., 0.]})
dfb = pd.DataFrame({'Start': [0, 51, 301], 'Stop': [50, 300, 1000], 'Value': [0., 1., 0.]})

First I would create the columns Start and Stop of df_out with:
df_out = pd.DataFrame({'Start': sorted(set(dfa['Start'])|set(dfb['Start'])),
                       'Stop': sorted(set(dfa['Stop'])|set(dfb['Stop']))})

Then to get the value of dfa (and dfb) associated to the right range(Start,Stop) in a column named Value_dfA (and Value_dfB), I would do:
df_out['Value_dfA'] = df_out['Start'].apply(lambda x: dfa['Value'][dfa['Start'] <= x].iloc[-1])
df_out['Value_dfB'] = df_out['Start'].apply(lambda x: dfb['Value'][dfb['Start'] <= x].iloc[-1])

To get the column SameValue, do:
df_out['SameValue'] = df_out.apply(lambda x: 1 if x['Value_dfA'] == x['Value_dfB'] else 0,axis=1)

If it matters, you can reorder the columns with:
df_out = df_out[['Start', 'Stop', 'SameValue', 'Value_dfA', 'Value_dfB']]

Your output is then
   Start  Stop  SameValue  Value_dfA  Value_dfB
0      0    50          1        0.0        0.0
1     51   100          0        0.0        1.0
2    101   200          1        1.0        1.0
3    201   300          0        0.0        1.0
4    301  1000          1        0.0        0.0

A: I have O(nlog(n)) solution where n is the sum of rows of df_a and df_b. Here's how it goes:
Rename value column of both dataframes to value_a and value_b repsectively. Next append df_b to df_a.
df = df_a.append(df_b)

Sort the df with respect to start column.
df = df.sort_values('start')

Resulting dataframe will look like this:
 start  stop    value_a value_b
0   0   100     0.0      NaN
0   0   50      NaN      0.0
1   51  300     NaN      1.0
1   101 200     1.0      NaN
2   201 1000    0.0      NaN
2   301 1000    NaN      0.0

Forward fill the missing values:
df = df.fillna(method='ffill')

Compute same_value column:
df['same_value'] = df['value_a'] == df['value_b']

Recompute stop column:
df.stop = df.start.shift(-1)

You will get the dataframe you desire (except the first and last row which is pretty easy to fix):
 start   stop value_a value_b   same_value
0   0     0.0   0.0   NaN     False
0   0     51.0  0.0   0.0     True
1   51    101.0 0.0   1.0     False
1   101   201.0 1.0   1.0     True
2   201   301.0 0.0   1.0     False
2   301   NaN   0.0   0.0     True

A: Here is an answer which computes the overlapping intervals really quickly (which answers the question in the title):
from io import StringIO
import pandas as pd
from ncls import NCLS

c1 = StringIO("""Start Stop Value
0     100  0.0
101   200  1.0
201  1000  0.0""")

c2 = StringIO("""Start Stop Value
0     50 0.0
51   300 1.0
301 1000  0.0""")

df1 = pd.read_table(c1, sep="\s+")
df2 = pd.read_table(c2, sep="\s+")

ncls = NCLS(df1.Start.values, df1.Stop.values, df1.index.values)

x1, x2 = ncls.all_overlaps_both(df2.Start.values, df2.Stop.values, df2.index.values)

df1 = df1.reindex(x2).reset_index(drop=True)
df2 = df2.reindex(x1).reset_index(drop=True)

# print(df1)
# print(df2)

df = df1.join(df2, rsuffix="2")

print(df)
#    Start  Stop  Value  Start2  Stop2  Value2
# 0      0   100    0.0       0     50     0.0
# 1      0   100    0.0      51    300     1.0
# 2    101   200    1.0      51    300     1.0
# 3    201  1000    0.0      51    300     1.0
# 4    201  1000    0.0     301   1000     0.0

With this final df it should be simple to get to the result you need (but it is left as an exercise for the reader).
See NCLS for the interval overlap data structure.


text:
Q: Why this java application print "true"? This is my first Class Hello.java
public class Hello {
    String name = "";
}

This is my second Class Test1.java
public class Test1 {
    public static void main(String[] args) {
        Hello h = new Hello();
        Test1 t = new Test1();
        t.build(h);
        System.out.println(h.name);
    }
    void build(Hello h){
        h.name = "me";
    }
}

When I run Test1.java, it prints "me". I think I understand, because of "reference transfer".
This is my third Class Test2.java
public class Test2 {
    public static void main(String[] args) {
        Hello h = null;
        Test2 t = new Test2();
        t.build(h);
        System.out.println(h == null);
    }
    void build(Hello h){
        h = new Hello();
    }
}

When I run Test2.java, it prints "true", why ? Is it "reference transfer" no longer? I am confused.

A: As you probably know, Java is call-by-value. Wenn you pass a reference, that reference gets copied. To be sure: The reference itself and not the reference's target gets copied.
Let's have a look at your first sample: When calling build(), the reference h will be copied. Because h(the copy in build()) does not get overwritten somewhere in build(), it always points to the memory location of the original h. So changing h.name affects the original h.
Sample 2 is different: reference h gets copied, too. But h gets overwritten in build(). The effect is that the original h and the h in build() point to different memory locations! The h in build() points to the newly generated Hello object, which will be garbage collected somewhen after the return of method build().

A: Java is always pass by value. When you have references, it just passes a copy of the reference pointing to the same object. In your case, you just reroute the copied reference to another object. That's why your original one is not changed.

A: You have two different variables h. The first one is local to main. The second one is local to build.
If you rename your build variable to x, it should become obvious why h in main is not affected.
Edit:
public class Test2 {
    public static void main(String[] args) {
        Hello h = null;
        Test2 t = new Test2();
        t.build(h);
        System.out.println(((h == null)));
    }
    void build(Hello x){
        x = new Hello();
    }
}

Here you can see clearly, x starts as null. Then x becomes a new object. Then x dies. h doesn't know anything about what's going on in x's life.

A: h.name = "me" changes the object that is referenced by h. This change will be visible from any other place where the same object is referenced. h = new Hello() makes h reference another (new) object. This change only affects that particular variable h - not any other variable that previously referenced the same object.

A: Mybe this explains why: http://www.yoda.arachsys.com/java/passing.html

A: In Test1.java, when you pass Hello object h to build() method, the variable main().h and build().h are pointing to same object in memory.
i.e. main().h = build().h => pointing same object
But in Test2.java, even though you pass main().h to build() method, later on inside build method, you're repointing build().h to a new object. But this does not affect the main().h
i.e. main().h != build().h // they both point different objects.
that is why main().h still contains null and your program prints true.

A: First of all you need to understand difference between Object and Reference.
In the first case, you are directly accessing object(memory in heap) and changing a value, where as in the second case the reference will have the new Object till the end of method. After that it will be no longer accessible.
    public static void main(String[] args){
           String str = null;
           System.out.println(getString(str)== null);
   }

    public static String getString(String s){
            s = new String();
            return s;
    }

The above code will print false

A: To put it simple:
1) You first create a variable 'h' and point it to null
2) When you come into the method "void build(Hello h)" you create a new variabel (also called 'h') which gets pointed to null (the pointer to what the variable is pointing towards is COPIED).
3) When you do 'h = new Hello()' you then change the new 'h' variable in the method to point towards a new instance of Hello (new Hello()).
The original variable called 'h' is unchanged.
Simple as pie.

A: Because h is equal to null.


text:
Q: Split data in sql with multiple delimiters ( , and - ) with owns rule I have data like this 1,2,3,4-8,10,11
I want split the data into rows with these 2 rules :

*

*The , will only split the data into rows. Ex 1,2,3 become :
1
2
3

*The - will split into series number. Ex 4-8 become :
4
5
6
7
8

How can a SQL query do that? Please answer and keep it simple.

A: This will work as long as your intervals are less than 2048 (let me know if that numbers can go higher) and you @data follow your current syntax:
declare @data varchar(50) = '1,2,3,4-8,10,11'

;with x as
(
     SELECT t.c.value('.', 'VARCHAR(2000)') subrow
     FROM (
         SELECT x = CAST('<t>' +
               REPLACE(@data, ',', '</t><t>') + '</t>' AS XML)
     ) a
     CROSS APPLY x.nodes('/t') t(c)
), y as
(
SELECT
CAST(coalesce(PARSENAME(REPLACE(subrow, '-', '.'), 2),
              PARSENAME(REPLACE(subrow, '-', '.'), 1)) as int) f,
CAST(PARSENAME(REPLACE(subrow, '-', '.'), 1) as int) t from x
)
select z.number from y
cross apply
(select y.f + number number
from master..spt_values
where number <= y.t - y.f and type = 'p'
) z

Result:
1
2
3
4
5
6
7
8
10
11

A: CREATE FUNCTION dbo.MultipleDelemiterSplit
(
   @List       NVARCHAR(MAX),
   @Delemiter1 Varchar(100),
   @Delemiter2 Varchar(100)
)
RETURNS  TABLE
AS

   RETURN
   (
      SELECT Item = FirstSet.cnt.value('(./text())[1]', 'nvarchar(4000)')
      FROM
      (
        SELECT x = CONVERT(XML, '<cnt>'
          + REPLACE(REPLACE(@List, ISNULL(@Delemiter1,''), '</cnt><cnt>') , ISNULL(@Delemiter2,''), '</cnt><cnt>')
          + '</cnt>').query('.')
      ) AS a CROSS APPLY x.nodes('cnt') AS FirstSet(cnt)
   );

GO

Select * From dbo.MultipleDelemiterSplit ('10:0,11:1,12:3,13:4,15:5,16:6',',',':')

A: I just created a sample for two delimiters, need to do something for generic
CREATE FUNCTION dbo.SplitStrings
(
   @List       NVARCHAR(MAX),
   @Separator1 Varchar(100),
   @Separator2 Varchar(100)
)
RETURNS  TABLE
AS

   RETURN
   (
      SELECT Item = y.i.value('(./text())[1]', 'nvarchar(4000)')
      FROM
      (
        SELECT x = CONVERT(XML, ''
          + REPLACE(REPLACE(@List, ISNULL(@Separator1,''), '') , ISNULL(@Separator2,''), '')
          + '').query('.')
      ) AS a CROSS APPLY x.nodes('i') AS y(i)
   );

GO

Select * From dbo.SplitStrings ('1,2,3,4 5,6,7',',','-')

Just Pass null or empty if second separator is not required

A: SQL Server 2016 (13.x) and later;
example
SELECT * FROM STRING_SPLIT(REPLACE('1,2,3,4-8,10,11', '-', ','), ',')

result
value
-----------
1
2
3
4
8
10
11

Syntax
STRING_SPLIT ( string , separator [ , enable_ordinal ] )

documentation : https://learn.microsoft.com/en-us/sql/t-sql/functions/string-split-transact-sql?view=sql-server-ver15

A: For the first part of the question you could use a recursive CTE:
select '1,2,3,4-8,10,11' as value into #testtab

with tst(DelimValue,Value) as
(
    select cast(LEFT(value,charindex(',',value+',')-1) as varchar(50)),stuff(value,1,charindex(',',value+','),'')
    from #testtab
     union all
    select cast(LEFT(value,charindex(',',value+',')-1) as varchar(50)),stuff(value,1,charindex(',',value+','),'')
    from tst
    where value > ''
)
select DelimValue
from tst

This will give you the results:
1
2
3
4-8
10
11

To give credit where it is due, I learned this from here: Turning a Comma Separated string into individual rows.
Now for the ranges, I would imagine you could write a procedure with a loop that will find the first integer before the dash as the start, and the second integer as the end, and then insert / return rows for that range. Though I imagine there must be a smarter way of doing this.


text:
Q: Display more options in list of store categories How would I display only 6 categories on an archive listing page then a button to show more if there is more than 6 selected?
<?php
$terms = get_the_terms($post->ID, 'store_categories');
if ($terms && !is_wp_error($terms)):
    $store = array();
    foreach ($terms as $term) {
        $store[] = $term->name;
    }
    $store_category = join(" | ", $store);
?>

            <?php
    $url = site_url();
    foreach ($terms as $term) {
        $linklist .= "slug . "' target='_blank'>" . $term->name . "" . "  ";
    }
        echo $linklist;
?>

        <?php
endif;
?>


text:
Q: Query with alternating orders on ruby on rails I have this code to query patients:
Patients.order(params[:sort])

how can I implement this so that each time this query will be executed the results are in an alternating order thus: (ascending -> descending -> ascending -> ...) ?
This code is implemented on a Controller on a Ruby on Rails application.

A: To implement this, you should store some key anywhere, right? Storing it in a database is not a good idea, because it's a +1 extra select and +1 extra update query for each page loading. If we store it anywhere on the server, e.g., in Redis, it will be global for all users, or we will have to store as many keys as many users we have. So why not to store it on the side of a user? I think the best way is to store it in cookies and invert the key each time after the query. Or in the session.
sort_order = cookies[:sort_order] || 'asc'

Patients.order("#{params[:sort]} #{sort_order}")

cookies[:inverted_sort_order] = sort_order == 'asc' ? 'desc' : 'asc'

A: You can implemente this behaviour with a class variable, that increments every time you go to a particular action in your controller
#In your controller
@@hit_number ||= 0                  #This will set your hit_number the first time
@@hit_number = @@hit_number + 1     #Increment your hit_number

if (@@hit_number%2) == 0            #Switch for :asc or :desc
  @my_order = :asc
else
  @my_order = :desc
end

@patients = Patients.order(name: @my_order)

And then, in your view the order will change every time it loads the view.
Note: This is not the best way to achieve this, but it is the easiest way for someone new to rails in my opinion.


text:
Q: React-native Android app not showing local pictures/assets I'm building a react native app and while the iOS version works fine, the android version isn`t showing the assets pictures.
In directory android/app/assets i have a default index.android.bundle and some fonts. (we dont have any images)
I tried
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

but it returned "Module scheduler does not exist in the Haste module map"
Gradle version 3.2.1
React-Native version: 0.57.8
React version:16.5.0

A: I also encountered similar problem few days ago, in my case it was enough to add in dependencies section of android/app/build.gradle 'com.facebook.fresco:fresco:1.+'.


text:
Q: Refresh the parent page after closing a pop up window I have aspx page that has a gridview in which there is an update button. when I click update button a pop up window opens. The second aspx page (pop up windows) has fields a delete button. when I click the delete button the second aspx page close and the row is deleted from the gridview in the first aspx page. I'm not able to see the row has been deleted from the gridview until i refresh manually the page.
How can I refresh the parent page(the page that has the gridview) right after closing the second page (the pop up window page)?? I tried this but didn't work :
Response.Write("<script>window.close();</" + "script>");
Response.Write("<script>window.opener.location.reload();</" + "script>");

A: You can use window.opener in the pop up window, just add
window.opener.location.reload();

in pop up window on onbeforeunload or onunload event. but that won't work on chrome, it works on firefox.
Another work around you can use setInterval to check if pop up window is closed or not in the main page:
var page = null;
function openPopUp() {
    page = window.open("desiredPage.html","windowName", "width=200,height=200");
    setInterval(function() {
        if(page != null && page.closed) {
            window.location.reload();
        }
    }, 1000);
}

Second solution works on all browsers.


text:
Q: Learning Rails, workshop, course, resources Trying to learn rails, but the beast is quite complex for a beginner :)
Anybody knows of courses, workshops, mentoring etc  In London Uk.
I don't have a programming background, bu i'm a web designer/developper.
Cheers

A: I know this doesn't directly answer you current question but I found that the Ruby On Rails Tutorial by Michael Hartl really helped me.
Here is a link: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2


text:
Q: How does Google One Tap know my Google Sessions across domains? When Google One Tap is used on a website and if the user has signed in to Google before loading the web page, the user is presented with a consent and sign-in dialog including information about his/her Google session(s) (email address, profile picture, etc.), even if the user visits the website for the first time.
How does it work? How does Google get the user identity on the third party website to display the correct session information? Does it rely on a third-party cookie? If yes, which one?

A: Google one tap relies on iframe & cookies. Since the iframe origin points to google the cookies will be accessible within the iframe once it's load. So when you click on sign-in a request is made to sign you in and return a JWT. check this article to learn more.
However, there is one missing piece that I don't understand, which was how does that JWT get passed to the parent frame. In Oauth you would get redirected to the Authorized/domain/path and the JWT will be passed there.
But in my testing of google one tap there is no redirect or refresh of any kind (at least nothing that I noticed). I know that the google one tap client takes a callback which you can use to react to the response of the authentication request, but have no idea how does the callback gets the JWT from the iframe


text:
Q: how to match one variable in row and return value than another condition which return another row in r code i) I want to match file1 column is equal to "CL" then return CL row and immediate "NQ" row should be returned if file1 column is equal to "NQ" and file2 column equal to "IL"  form as table
                file1  file2 file3 file4
                 NQ      85    1      S
                 NQ      IL    1      S
                 NQ      PR    2      A
                 CL      49    60     J
                 NQ      IL    1      K
                 DM      D8    9      F
                 NQ      PR    2      N
                 CL      21    4      3
                 HI      B     5      1
                 NQ      IL   11     10
                 3       8     2     11
                 CL      2     8     18
                 REF     X     9     19

 This data is in data table format.please help me to achieve the expected table.
 file1 file2 file3 file4
  NQ    IL   1     S
  CL    49   60    J
  NQ    IL   1     K
  CL    21   4     3
  NQ    IL   11    10
  CL    2    8     18

A: You can use subset
subset(df, file1 == 'NQ' & file2 == 'IL' | file1 == 'CL')
#file1 file2 file3 file4
#   NQ    IL     1     S
#   CL    49    60     J
#   NQ    IL     1     K
#   CL    21     4     3
#   NQ    IL    11    10
#   CL     2     8    18

data
df <- read.table(text = "file1  file2 file3 file4
NQ      85    1      S
NQ      IL    1      S
NQ      PR    2      A
CL      49    60     J
NQ      IL    1      K
DM      D8    9      F
NQ      PR    2      N
CL      21    4      3
HI      B     5      1
NQ      IL   11     10
3       8     2     11
CL      2     8     18
REF     X     9     19", header = TRUE)


text:
Q: Slider issue in react js I am integrating this template by converting its HTML to jsx.
I could not found the issue as there are no errors in the console. I already have a react developer tool in chrome.
Below is the code for slider in react slider component.
import React from 'react';
export default class Slider extends React.Component {
    render() {
        return (

Safe
 Betting

With 100% Risk-Free Guarantee
Get started

Easy Bets

With the lowest commissions
Join Us

        );
    };
}

I am stuck here and I cannot debug further.


text:
Q: Excel get cell value from multiple workbooks Good morning all,
I'm looking for possible alternatives to my current system of importing data from multiple "unit" workbooks into a "master" workbook. Each of my "unit" workbooks is built from a fixed template, so their sheet names and cell references are always the same. (Sheet names are: Jan, Feb, Mar, Apr, ... Dec)(File names are: YYYY_Location_Description)
Ideally I would like to be able to simply do a sumproduct through all open workbook files. I know I can do it through sheets using Jan:Dec!A2:D5. But is there a way to adapt this to run through all open workbook files?
Currently I have a macro that systematically runs through all files listed by DIR and copies the data out of the "unit" sheets one entry at a time and pastes it in a summary sheet.
Each monthly "unit" sheet consists of a row for each day of the month and columns as shown:
UnitA
Date   HrsA    HrsB    ValueA    ValueB    ValueC  ...
1      24      0       0.01      0.02      0.01
2      0       24      0.01      0.015     0.012
...

The macro copied data is then placed in the format:
Master
Date   Location    Value    HrsA    HrsB    Entry
1      UnitA       ValueA   24      0       0.01
1      UnitA       ValueB   24      0       0.02
1      UnitA       ValueC   24      0       0.01
1      UnitA       ValueA   0       24      0.01
1      UnitA       ValueB   0       24      0.015
1      UnitA       ValueC   0       24      0.012

Which is a lot of data in the "master" summary sheet. What I'd rather be able to do is:
=sum('[Workbook1.xls:WorkbookN.xls]Jan:Dec'!$A$2:$D$5)

Is it possible to do anything like this?
Thanks,

A: Try something like this, just loop over each of the open workbooks and evaluate the Sum of the specified range, and then write that value to ActiveCell (or wherever it needs to be placed)
Sub foo()
Dim wb as Workbook
Dim ret

For Each wb in Application.Workbooks
    '[Workbook1.xls:WorkbookN.xls]Jan:Dec'!$A$2:$D$5)
    ret = ret + Application.WorksheetFunction.Sum( _
                    "'[" & wb.Name & "]Jan:Dec'!$A$2:$D$5")
Next

ActiveCell.Value = ret
End Function

Or try this to build the formula string:
Sub foo(Optional sheetRange As String = "Jan:Dec", Optional cellsRange As String = "A2:D5")
Dim wb As Workbook
Dim ret

For Each wb In Application.Workbooks
    ret = ret & "SUM('[" & wb.Name & "]" & sheetRange & "'!" & cellsRange & ")+"
Next
ret = Left(ret, Len(ret) - 1)
ret = "=" & ret
ActiveCell.Formula = ret
End Sub


text:
Q: Why is my Azure Pipeline not able to run a basic Git add I'm trying to commit a change that I make to a build file in my build process. This job runs on MacOS as a Bash task. All sorts of other scripts and tasks are working correctly, but trying to execute these git commands is giving back a 127 error.
- task: Bash@3
    inputs:
      targetType: 'inline'
      script: |
        echo $PATH
        git add $(System.DefaultWorkingDirectory)/MyFilePath/my.file
        git commit -m "update file [skip ci]"
        git push origin
      workingDirectory: '$(Build.SourcesDirectory)'
    displayName: 'Git commit'
    continueOnError: true
    condition: and(succeeded(), eq(variables.ChangeFile, 'true'))

What I get back is the following error(s):
========================== Starting Command Output ===========================
##[debug]which '/bin/bash'
##[debug]found: '/bin/bash'
##[debug]/bin/bash arg: /Users/runner/work/_temp/7d35e773-5913-44d8-b4fd-0d22787e7680.sh
##[debug]exec tool: /bin/bash
##[debug]arguments:
##[debug]   /Users/runner/work/_temp/7d35e773-5913-44d8-b4fd-0d22787e7680.sh
/bin/bash /Users/runner/work/_temp/7d35e773-5913-44d8-b4fd-0d22787e7680.sh
/Users/runner/hostedtoolcache/NuGet/6.2.1/x64:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/opt/ruby@2.7/bin:/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.7.5/x64
git: 'add /Users/runner/work/1/s/MyFilePath/my.file' is not a git command. See 'git --help'.
/Users/runner/work/_temp/7d35e773-5913-44d8-b4fd-0d22787e7680.sh: line 3: git commit -m update file [skip ci]: command not found
/Users/runner/work/_temp/7d35e773-5913-44d8-b4fd-0d22787e7680.sh: line 4: git push origin: command not found
##[debug]Exit code 127 received from tool '/bin/bash'
##[debug]STDIO streams have closed for tool '/bin/bash'
##[error]Bash exited with code '127'.

Pretty vague, but here are some things I've tried:
  - checkout: self
    persistCredentials: true
    clean: true
    displayName: Checkout from git

  - script: git checkout $(Build.SourceBranchName)
    workingDirectory: $(Build.SourcesDirectory)
    displayName: Checkout branch from git to receive commits on
    failOnStderr: false
    condition: and(succeeded(), eq(variables.ChangeFile, 'true'))

*

*Making sure to checkout the code first. I've used some mostly
pre-defined Git steps for this, but that git checkout script works dandy.

*Running a very similar add on the same file on my machine locally. The casing for that path needed to be fixed, but then it worked.

*Using echo path to determine if Git is even in my path, as you can see before the commands. Looks like it's not, but then, wouldn't it be saying git itself is not a recognised command, rather than add, commit and push?

*I've tried Googling error code 127 and using Git on a MacOS agent in Azure, but to no avail. People don't seem to be having quite the same problem as me.

Any help would be most pleasant!

A: To call git add, aren't a couple of things required?:

*

*Doesn't the agent's current directory need to be a git repo folder, i.e. a folder containing a ".git" folder? You're not showing that your script ensures or verifies this.

*AFAICT, git add's pathspec doesn't allow a leading slash like your "/Users/runner/work/1/s/MyFilePath/my.file" example. I have difficulty finding a good doc for the pathspec, but I can't find any examples using a leading slash. I'd suggest experimenting with git add on your local machine.

A: From the issue output, It seems that git treats the entire latter as a command parameter. I think the issue comes from the $(System.DefaultWorkingDirectory) in your OS type(You are based on Mac OS).
This should work:
trigger:
- none

pool:
  vmImage: 'windows-latest'

steps:
- task: PythonScript@0
  inputs:
    scriptSource: 'inline'
    script: |
      from encodings import utf_8
      import os

      rootpath = "./MyFilePath"
      dictpath = "./MyFilePath2"

      for filename in os.listdir(rootpath):
          with open(rootpath+'/'+filename, encoding='gb2312') as f:
              with open(dictpath+'/'+filename, "w+", encoding='utf-8') as f1:
                  for line in f:
                      f1.write(line)
- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      git config --global user.email "xxx@xxx.com"
      git config --global user.name "Bowman Zhu(In Microsoft Agent)"
      git add '$(System.DefaultWorkingDirectory)/MyFilePath2/my.file'
      git commit -m 1

Success:

My repo structure:


text:
Q: Colspan and table-layout:fixed break my table style I have a table where I need the rows to have specific widths. But colspan and table-layout:fixed break the style I want.
Note that I can NOT change anything in the html code, I also can't remove the table-layout:fixed. Is what I want possible to do with only css? Or is it something that can't be done unless the html is changed?

table {
  table-layout: fixed;
  width: 100%;
}

th,
td {
  border: 1px solid black;
}

th:first-child,
td:first-child {
  width: 5%;
  background-color: lightblue;
}

td:nth-child(2),
tr:last-child th:nth-child(2) {
  width: 70%;
  background-color: lightpink;
}

td:nth-child(3),
th:nth-child(3) {
  width: 10%;
  background-color: lightgreen;
}

td:nth-child(4),
th:nth-child(4) {
  width: 10%;
  background-color: #a9a9a9;
}

td:last-child,
th:nth-child(5) {
  width: 5%;
  background-color: #d4d4d4;
}

      1
      2

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

Here is the visual of what I want
Here is the visual of what I get

A: Table layout fixed means that the table will use the first row to define it styles - as you have a colspan of 4 in your first row, it will not know what widths to give to the columns in the second row and therefore splits them equally.
From MDN about table layout fixed:

Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.

In order to get around this, you can define a colgroup and then give your widths to those columns and they will be applied to the rest of the table:

table {
  table-layout: fixed;
  width: 100%;
}

th,
td {
  border: 1px solid black;
}

col:first-child {
  width: 5%;
  background-color: lightblue;
}

col:nth-child(2) {
  width: 70%;
  background-color: lightpink;
}

col:nth-child(3) {
  width: 10%;
  background-color: lightgreen;
}

col:nth-child(4) {
  width: 10%;
  background-color: #a9a9a9;
}

col:nth-child(5) {
  width: 5%;
  background-color: #d4d4d4;
}

    <colgroup>
        <col>
        <col>
        <col>
        <col>
        <col>
    </colgroup>

      1
      2

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

If you cannot change the html, and you have to have layout fixed, then you cannot do anything about the widths of the second row.
The best you can do with purely css is to remove the layout fixed (you didn't explain why this is needed) and just style the tds:

table {
  width: 100%;
}

th,
td {
  border: 1px solid black;
}

td:first-child {
  width: 5%;
  background-color: lightblue;
}

td:nth-child(2) {
  width: 70%;
  background-color: lightpink;
}

td:nth-child(3) {
  width: 10%;
  background-color: lightgreen;
}

td:nth-child(4) {
  width: 10%;
  background-color: #a9a9a9;
}

td:nth-child(5) {
  width: 5%;
  background-color: #d4d4d4;
}

      1
      2

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

A: table-layout:fixed

apply when the table and column widths are set by the widths of table and col or by the width of the first row of cells. Cells in other rows do not affect column widths - table-layout property understanding, so you need to give
table {
table-layout: auto!important;
}

A:

table {
  table-layout: fixed;
  width: 100%;
}

th,
td {
  border: 1px solid black;
}

th:first-child,
td:first-child {
  background-color: lightblue;
}

td:nth-child(2),
tr:last-child th:nth-child(2) {
  background-color: lightpink;
}

td:nth-child(3),
th:nth-child(3) {
  background-color: lightgreen;
}

td:nth-child(4),
th:nth-child(4) {
  background-color: #a9a9a9;
}

td:last-child,
th:nth-child(5) {
  background-color: #d4d4d4;
}

      1
      2

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

A: jsfiddle link here

/*I think this is the minimal way**/
table {
  table-layout: fixed;
  width: 100%;
}

th,
td {
  border: 1px solid black;
}
.text-center{
  text-align:center;
}

      1
      2

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e

      a
      b
      c
      d
      e


text:
Q: php image swap. swap files instead I want to be able to swap files instead of images. I've changed some of the code myself but wasn't very successful. What do I need to change to make it work? Thanks in advance.
<?php

$url = "http://site.com/days";
$monImage = "$url"."monday.jpg";
$tueImage = "$url"."tuesday.jpg";
$wedImage = "$url"."wednesday.jpg";
$thurImage = "$url"."thursday.jpg";
$friImage = "$url"."friday.jpg";
$weekendImage = "$url"."weekend.jpg";
$d = date("D");

switch ($d)
{
case Mon:
echo "\n";
break;
case Tue:
echo "\n";
break;
case Wed:
echo "\n";
break;
case Thu:
echo "\n";
break;
case Fri:
echo "\n";
break;
default:
echo "\n";
}

?>

A: echo '';


text:
Q: Xcode/iPhone: Remember login information + next window I have made a login app which connects to a mysql database. When signed in I want the app to take me to a new screen where it says ex: "Hi Helle", using the information I just signed in with. Where do I start? The login function works.

A: you'll need to store your login session somewhere. When you successfully log in, you should probably get some sort of token or something that says "I'm logged in as this user". Store it somewhere, probably with Keychain(https://github.com/ldandersen/scifihifi-iphone/tree/master/security) or NSUserDefaults. Then you can access it from anywhere in your app.
If you don't need to persist it, just pass the login information around the app keeping it in memory.


text:
Q: Golang: How to run the same logic at the beginning of every struct member functions? For example, I want to print out the function name of every functions of some struct.
Besides I use fmt.Println at the beginning of every member function, any better way to do it?

A: package main

import "fmt"
import "runtime"

func main() {
    pc, _, _, _ := runtime.Caller(0)
    fmt.Println("Name of function: " + runtime.FuncForPC(pc).Name())
    fmt.Println()

    // or, define a function for it
    fmt.Println("Name of function: " + funcName())
    x()
}

func funcName() string {
    pc, _, _, _ := runtime.Caller(1)
    return runtime.FuncForPC(pc).Name()
}

func x() {
    fmt.Println("Name of function: " + funcName())
    y()
}

func y() {
    fmt.Println("Name of function: " + funcName())
    z()
}
func z() {
    fmt.Println("Name of function: " + funcName())
}

Output:

Name of function: main.main

Name of function: main.main
Name of function: main.x
Name of function: main.y
Name of function: main.z

(Copyed from here )


text:
Q: Subclassing based on iOS platform version I am using AFNetworking, I have a subclass created for AFHTTPSessionManager which works on iOS7, i would like to know it is possible that i can inherit the same subclass but with a different super class say AFHTTPRequestOperationManager based on some preprocessor directives.
Thanks

A: The "standard" way to deal with this would be to define an interface for your class functions, then create "old" and "new" classes to implement the interface.  Use a "factory" to create the correct one for the runtime environment.
You could instead use a "wrapper" class instead of the interface -- one that creates the version-specific class internally and forwards calls to it.

A: Applying the use of a Factory (in the form of a class cluster)
note that code below is only an indication, it won't compile from a copy/paste
@interface MyHTTPClient

- (void) post:(NSURLRequest *)request params:(NSDictionary *)params
@end

@implementation MyHTTPClient

- (id) init {
    if(iOS_version < 7) {
        return [[_MyiOS7HttpClient] alloc] init];
    } else {
        return [[_MyiOS6HttpClient alloc] init];
    }
}

- (void) post:(NSURLRequest *)request params:(NSDictionary *)params {
    NSAssert(NO, @"private instances should respond to this");
}
@end

now the private instances, which are not visible from the project (only via MyHttpClient)
#import "MyHttpClient.h"

@implementation _MyiOS7HttpClient

- (void) post:(NSURLRequest *)request params:(NSDictionary *)params {
    // use new ios7 session manager here to do stuff
}
@end

and create a similar class for MyiOS6HttpClient which uses none of the iOS7 Session management.
So the Class Cluster in this case gives you:

*

*A Clean interface to either MyiOS7HttpClient or MyIos6HttpClient via MyHttpClient,

*Other code does not need to know which instance you are actually using.

*No Need for message forwarding.

A: You can't do this at compile-time. The compiler has no idea which of the supported iOS version(s) your app will run on. You may create several versions of the class, and create the correct one based on a runtime version check.


text:
Q: Shift images in tensorflow (with periodic boundary) I want to translate an image in Tensorflow and fill zeros with those elements cropped when using tf.contrib.image.transform. It means pictures have a periodic boundary condition. Suppose I have an image:
1  2  3  4
5  6  7  8
9  10 11 12

And I want to shift the image by dx = -1 (to left), dy = -1 (upward). The result should look like
6  7  8  5
10 11 12 9
2  3  4  1

Does any one have an efficient way to do this? (This operation appears a lot in the net).
Thanks.

A: You are looking for tf.manip.roll
import tensorflow as tf
import numpy as np

a = np.array([[1, 2, 3, 4, ],
              [5, 6, 7, 8, ],
              [9, 10, 11, 12]]).astype(np.float32)

data_in = tf.placeholder(tf.float32)

data = tf.manip.roll(data_in, -1, 1)
data = tf.manip.roll(data, -1, 2)

with tf.Session() as sess:
    print(sess.run(data, {data_in: a[None, :, :, None]}))


text:
Q: Do we really need to call flush() just before close() today? I read this question Using flush() before close() , and the accepted answer is this only means you follow the pattern.
Just like BufferedWriter#close() or FilterOutputStream.#close() , if all of buffered Stream/Writer  will call its flush() when we call close() and if we (the dev and the dev who will review the code) all  know the that,  do we really still need this? If yes, what will be the reason?

A: As the javadoc says, you don't need to flush yourself.
But, it's still good to do, considering your readers, and common sense.
Few experts know the javadoc by heart.
I wouldn't know for sure if the stream will be flushed or not without looking it up,
and I'm probably not alone.
Seeing the explicit flush() call makes this perfectly clear,
and therefore makes the code easier to read.
Furthermore, the method name close() implies nothing about flushing.
It's from the Closeable interface,
and naturally, it says nothing about flushing.
If you don't flush a buffered output stream before closing,
despite wanting to flush it,
you'll be relying on assumptions that may or may not be true.
It would weaken your implementation.
Any assumptions you make,
you should somehow pass on to future maintainers.
One way to do that is by leaving a comment:

// no need to flush() manually, close() will do it automatically

If you don't leave this comment,
future maintainers may have to lookup the javadoc too,
if like me they don't have it memorized.
But then, why would you write such comment when it's easier and better to just call it yourself now and be done with it.
In short, flushing first before closing is simply following good logic.
No need for assumptions and second guesses,
and no need to make your readers think.

A: For output,  it is important that we do call flush() and close() because buffered data could be lost, as explained by the first answer here. If your program's output is smalland your writer finishes quickly, it won't make much difference to close() and flush() in my experience.
For input, it won't matter if we don't call close() before the system exits.


text:
Q: Is > 5000MB/s normal for a 1TB 7200RPM HDD? so I decided to do a full scan with windows defender and am really confused as to why the hard-drive exceeded its limit during the scan(except if 200MB/s isn't the maximum read-write limit), I got upto 5GB/s, should that not be impossible with a 7200RPM HDD?
`

How it all started:
> 200MB/s

> 800MB/s

> 2000MB/s

> 4500MB/s

> 5000MB/s


text:
Q: C Help creating a Process Tree I am trying to create a process tree, but here is what my output is right now: https://gyazo.com/a71f4e095b69080a6d6a11edd2c0df27
The problem is I want to make it look like the diagram I drew on the right, but can't seem to figure out how. I am printing each child processes parent ID and then after doing so I am going to delete them starting with 2, then 1 (by sending a SIGKILL signal after 5 seconds).
How can I make the process tree look like the desired result? Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    int root, t1, t2, i;

    root = getpid();
    printf("root %d\n", root);
    for (i = 1; i < 3; i++)
    {
        t1 = fork();
        //printf("%d\n", t1);
        if(t1!=0)
        {
        t2 = fork();
        }
        if (t1 !=0 && t2 != 0)
        {
            break;
        }

        printf("child pid %d    parent pid %d\n", getpid(), getppid());
    }
    sleep(10);

    return 0;
}

Thank you!

A: Your main for loop is run in all forks, which doesn't match your diagram.
What you actually want is that your if statements have the same structure as your tree:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    printf("root %d\n", getpid());

    if (fork())
    {
        fork();
    } else {
        if (fork())
        {
            if (fork())
            {
                fork();
            }
        }
    }

    printf("child pid %d    parent pid %d\n", getpid(), getppid());

    fflush(stdout);

    sleep(10);

    return 0;
}

This gives the desired result:
root 5140
child pid 5140    parent pid 377
child pid 5147    parent pid 5141
child pid 5149    parent pid 5141
child pid 5146    parent pid 5140
child pid 5148    parent pid 5141
child pid 5141    parent pid 5140

NB. the sleep() is to ensure none of the processes exit before their children, at which point their children would be reparented to have ppid = 1 (init).


text:
Q: How important is proper execution of QTEs in Fractured But Whole? I hate QTEs, especially if they are used as an integral aspect of combat. I've lost combat way more than I want in Stick of Truth because they introduced a new QTE and I couldn't figure out what to do in time.
I've started Fractured But Whole, played through until I started my origin story, immediately got faced with 2 QTEs and quit the game in disgust. Hell, even the "shitting in a toilet" minigame is something I never want to do ever again in this game if I can help it, because the keyboard controls are just horrendous.
However, I have a very morbid curiosity for the jokes and references in the game, so I want to continue playing. However, I'd prefer to avoid QTEs as much as possible, or at least only have to suffer those that are simple and don't have a big impact on my combat performance if I fail them. I'd preferably even avoid shitting in a toilet unless it's absolutely necessary to complete the game and all major sidequests (so no "shit in every toilet in the game").
Is this possible at all?

A: You don't have to shit in every toilet, I avoided 95% of them once I realized they were useless.
The QTE in the battle system enhance damage or status effects. You'll do extra damage for hard hitting moves, or inflict extra knockback, heal for more health, freeze enemies for 1 turn longer...etc.
You can certainly beat the game without nailing every single QTE, but they certainly help.
The ones that really matter are the ones with Mosquito who heals because the health gained was valuable I found. They were pretty easy too.
There are even some moves that are just a 1 time button press at the right time. I'd recommend finding the side kicks that have easier moves such as a single correct press or just mashing the X button for 2 seconds to achieve max damage.
The combat is much more focused on strategy than QTE performance, so you should be just fine.


text:
Q: Animate the rule in Cubism I am using cubism to display some data. Is it possible to animate the rule which appears when we hover the mouse over the graph.
I want to animate it in such a way so that it automatically displays data on each step from left to right then right to left.
i tried using the d3.timer but it doesn't solve the problem. Here is my code -
var x=30;
var ruler = d3.select("#viz").append("div")
    .attr("class", "rule")
    .attr("x", x)
    .call(context.rule());

var interval = 1000;

var makeCallback = function() {
    return function() {
        if(x<1116){
            x = x+1;
        }
        else{x=30;}
            ruler.transition().attr("x", x);
            d3.timer(makeCallback(),interval);
            return true;
        }
};
d3.timer(makeCallback(), interval);

It works if i use a normal svg but not in this case. Any ideas?


text:
Q: How to add custom code to active admin menu? For admin panel i am using active admin gem. In active admin menu i want to show a notification to admin user if any new user is registered or any message is transfer between admin and user in system. Any suggestion for adding custom code to Admin menu will be appreciated.
In my system i am using below code to show notification for new arrival message.
<%= link_to received_messages_path(), :remote => true, :data_type => 'message', :class => 'is-active' do %>
       <%= t('message') %>
       <% if (msg_count = user_unseen_message_count(current_user)) > 0 %>
            <span class="badge js-message-count" >
              <%= msg_count %>
            </span>
       <% end %>
    <% end %>

So, how can i add this code to active admin menu??

A: i'm new in rails but i hope this helps you. if you add a column with is_admin boolean type, you can validate user admin like this:
<%= if current_user.is_admin %>
 ...code...
 <% end %>


text:
Q: header de tabla html fijo dentro de div tengo una tabla html dentro de un div con scroll en Y, dentro de la tabla tengo un header que quiero que sea fijo, como puedo hacer para que el header de la tabla se quede fijo sabiendo que la tabla esta dentro de un div.

    div.tableContainer {
        width: 90%; /* table width will be 99% of this*/
        height: 320px; /* must be greater than tbody*/
        overflow: auto;
        margin: 0 auto;
    }

    table {
        width: 97%; /*100% of container produces horiz. scroll in Mozilla*/
        border: none;
        border-spacing: 0px;
        background-color: transparent;
    }

        table > tbody {
            overflow: auto;
            height: 280px;
            overflow-x: hidden;
        }

            table > tbody tr {
                height: auto;
            }

            First Name
            Last Name
            Job Title
            Favorite Color
            Wars or Trek?
            Secret Alias
            Date of Birth
            Dream Vacation City
            GPA
            Arbitrary Data

            James
            Matman
            Chief Sandwich Eater
            Lettuce Green
            Trek
            Digby Green
            January 13, 1979
            Gotham City
            3.1
            RBX-12

            The
            Tick
            Crimefighter Sorta
            Blue
            Wars
            John Smith
            July 19, 1968
            Athens
            N/A
            Edlund, Ben (July 1996).

            Jokey
            Smurf
            Giving Exploding Presents
            Smurflow
            Smurf
            Smurflane Smurfmutt
            Smurfuary Smurfteenth, 1945
            New Smurf City
            4.Smurf
            One

            Cindy
            Beyler
            Sales Representative
            Red
            Wars
            Lori Quivey
            July 5, 1956
            Paris
            3.4
            3451

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

A: te voy a dejar una opción

.fixedhead{
    display: table;
    width: 100%;
    table-layout: fixed;
}
.fixedbody{
    display: block;
    height: 7rem;
    overflow: auto;
    position: static;
}

            First Name
            Last Name
            Job Title
            Favorite Color
            Wars or Trek?
            Secret Alias
            Date of Birth
            Dream Vacation City
            GPA
            Arbitrary Data

            James
            Matman
            Chief Sandwich Eater
            Lettuce Green
            Trek
            Digby Green
            January 13, 1979
            Gotham City
            3.1
            RBX-12

            The
            Tick
            Crimefighter Sorta
            Blue
            Wars
            John Smith
            July 19, 1968
            Athens
            N/A
            Edlund, Ben (July 1996).

            Jokey
            Smurf
            Giving Exploding Presents
            Smurflow
            Smurf
            Smurflane Smurfmutt
            Smurfuary Smurfteenth, 1945
            New Smurf City
            4.Smurf
            One

            Cindy
            Beyler
            Sales Representative
            Red
            Wars
            Lori Quivey
            July 5, 1956
            Paris
            3.4
            3451

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

esta es la opcion mas facil pero tiene grandes desventajas; otra seria por javascript muy compleja y de pronto se pueda hacer una con flexbox pero creeme que ya no seria una tabla de html seria una personalizacion

A: Te sugiero revisar estas dos respuestas:

*

*Stackoverflow: Ajustar css Tabla html

*Stackoverflow: Duda con tabla responsive css y html
Básicamente la única forma de lograrlo es desarmando los estilos por defectos de la tabla y volverlos "tipo bloque". Hay una serie de características que tienes que tener en cuenta en soluciones sin js y una de ellas, es el tamaño en ancho que vincula a las celdas de una misma columna porque debes setearlas manualmente en css.
Ejemplo

*

*En el **html**, solo colócale la clase header-sticky o como la llames.

*Y en el **css**, añade los siguientes estilos:

.header-fixed{
  display: block;
  position: relative;
  height: 300px; /*la que necesites*/
  max-height: 80vh; /*la que necesites*/
  overflow: auto;
}

.header-fixed thead,
.header-fixed tbody{
  display: block;
}

.header-fixed thead{
  position: sticky;
  display: inline-block;
  top: 0;
}

.header-fixed tr{
  display: flex;
}

.header-fixed th,
.header-fixed td{
  min-width: 150px; /*La que necesites*/
  max-width: 150px; /*La que necesites*/
  padding: 0.5em;
}

Como en este ejemplo:

*{
box-sizing: border-box;
padding: 0;
margin: 0;
}

table {
  width: 90%; /*100% of container produces horiz. scroll in Mozilla*/
  border-spacing: 0px;
  background-color: transparent;
}

.header-fixed{
  display: block;
  position: relative;
  height: 300px;
  max-height: 80vh;
  overflow: auto;
}

.header-fixed thead,
.header-fixed tbody{
  display: block;
}

.header-fixed thead{
  position: sticky;
  display: inline-block;
  top: 0;
  right: 0;
  background-color: white;
  box-shadow: 0 5px 5px 0 rgba(0,0,0,.1)
}

.header-fixed tr{
  display: flex;
  align-items: center;
}

.header-fixed th,
.header-fixed td{
  min-width: 150px;
  max-width: 150px;
  padding: 0.5em;
}

.header-fixed th{
  text-align: left;
}

            First Name
            Last Name
            Job Title
            Favorite Color
            Wars or Trek?
            Secret Alias
            Date of Birth
            Dream Vacation City
            GPA
            Arbitrary Data

            James
            Matman
            Chief Sandwich Eater
            Lettuce Green
            Trek
            Digby Green
            January 13, 1979
            Gotham City
            3.1
            RBX-12

            The
            Tick
            Crimefighter Sorta
            Blue
            Wars
            John Smith
            July 19, 1968
            Athens
            N/A
            Edlund, Ben (July 1996).

            Jokey
            Smurf
            Giving Exploding Presents
            Smurflow
            Smurf
            Smurflane Smurfmutt
            Smurfuary Smurfteenth, 1945
            New Smurf City
            4.Smurf
            One

            Cindy
            Beyler
            Sales Representative
            Red
            Wars
            Lori Quivey
            July 5, 1956
            Paris
            3.4
            3451

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch

            Captain
            Cool
            Tree Crusher
            Blue
            Wars
            Steve 42nd
            December 13, 1982
            Las Vegas
            1.9
            Under the couch


text:
Q: Generate same random sample each time in loop using sample_frac How can I generate same random sample each time in loop using sample_frac
library(dplyr)

tbl = tibble(val = 1:50)

for (i in 1:3)
{
   tbl_sample = tbl %>% sample_frac(0.1)
   print(tbl_sample)
}

A: Create a list and then assign it to the list element by looping over the sequence - print only prints the output to the console
n <- 3
lst1 <- vector('list', n)
for(i in seq_len(n)) {
    lst1[[i]] <- tbl %>%
       sample_frac(0.1)
}

If we want to get 5 random indices
for(i in seq_len(n)) {
    lst1[[i]] <- tbl %>%
     mutate(rn = row_number()) %>%
     slice_sample(prop = 0.1)
}

In addition this can be automatically done with replicate
lst1 <- replicate(n, tbl %>%
                   sample_frac(0.1), simplify = FALSE)

A: We can use purrr, and loop through 1:3 with the same expression as the .fn argument:
library(purrr)
library(dplyr)

map(1:3, ~{
        tbl_sample = tbl %>% sample_frac(0.1)
        head(tbl_sample)
})

[[1]]
# A tibble: 5 x 1
    val
  <int>
1     1
2    20
3    35
4    32
5    19

[[2]]
# A tibble: 5 x 1
    val
  <int>
1    45
2    24
3    42
4    46
5    10

[[3]]
# A tibble: 5 x 1
    val
  <int>
1    35
2    23
3    28
4    49
5    43

You may want every sample in a single column in a dataframe. For that we may use imap_dfc:
imap_dfc(1:3, ~{
        tbl %>% sample_frac(0.1) %>% head %>% set_names(paste0('sample_', .y))
})

# A tibble: 5 x 3
  sample_1 sample_2 sample_3
     <int>    <int>    <int>
1       49       17        8
2       29        9        6
3       25       35       50
4        9        4       44
5       34       45        3
>


text:
Q: SSH'ing with force pseudo-tty allocation doesn't print my MOTD I know that -t option in ssh allocate pseudo-tty. I'm using -t to "jump" to different directory on login, something like this:
ssh -t my-server "cd /path/to/my/directory; bash --login".
Why if I log in without it (normally) /etc/motd is printed and with -t it is not? I know I can cat /etc/motd before cd but wondering is there cleaner solution and WHY is happening like that at all.
ps: As You can imagine I want MOTD to be prited on login even if I use -t.

A: The MOTD is typicaLLY displayed by login, not bash,  so if you don't run login you don't get MOTD.  sshd probably doe not even use login, but does print motd depending on the setting of several of its flags. (as noted by Jakuje ) The way you are connecting through sshd does not trigger the motd behavior.
I suspect that trying to get things to run the way you want is going to be altering your profile file to do MOTD when bash is started by sshd.  I suppose you can check to see if $tty is defined, but there will probably still be games to keep you from getting two MOTD on a real login.
It really seems like a lot of effort for little gain.
Or, if you like
ssh -t my-server "cd /path/to/my/directory; cat /etc/motd; bash --login"


text:
Q: False Acceptance Rate and False Rejection Rate calculation using a n*n confusion matrix FAR and FRR are used to express the results of biometric devices. Below is the confusion matrix produced by biometric data produced in weka. I couldn't find any resources explaining the procedure to calculate FAR and FRR using a n*n confusion matrix. Any help explaining the procedure would be of great help. Thanks in advance!
Weka also gives these values, TP Rate, FP Rate, Precision, Recall, F-Measure and ROC Area. Please suggest if the required values can be calculated using these.
=== Confusion Matrix ===
a b c d e f g h i j k l m n o   <-- classified as
 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 | a = user1
 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 | b = user2
 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 | c = user3
 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 | d = user4
 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 | e = user5
 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 | f = user6
 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 | g = user7
 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 | h = user9
 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 | i = user10
 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 | j = user11
 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 | k = user14
 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 | l = user15
 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 | m = user16
 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 | n = user17
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 | o = user19

A: The accepted answer here by user "chl"  has a reference to the Biometrics Literature: https://stats.stackexchange.com/questions/3489/calculating-false-acceptance-rate-for-a-gaussian-distribution-of-scores .
He says,

[the ROC curve] is a plot of   (TAR=1-FRR, the false rejection rate) against false
  acceptance rate (FAR).

However, commonly the ROC curve happens to be a plot of TP Rate as a function of False Positive Rate (FP Rate).
Seems you can use TP Rate and FP Rate.


text:
Q: Не могу понять логику bootstrap-меню (гамбургер) на сайте, как исправить? Пересмотрел уже все и никак не возьму в толк что случилось? А суть коротко вот в чем: есть  проект, при уменьшении размера экрана срабатывает гамбургер-меню bootstrap (на 768px), так вот при клике на этот гамбургер (toggle-menu) развертывается меню, но очень странно, сначала пункты меню и лишь потом фон этого меню. Не могу понять где косяк? Кто что думает?

A: Там все просто. Вот ваш код.

FAQ

Цены

Как мы работаем

Подарок

Контакты

Log in

Обратите внимание что после разворота <div class="navbar-collapse collapse" меняется на class="navbar-collapse collapse in"
Но между ними есть ТРЕТЬЕ состояние class="navbar-collapse collapsing" тоесть стили в процессе разворота, а у вас там прозрачно!


text:
Q: Does the new Gamecube controller work with Gamecube games on a Wii? I was wondering if the new Gamecube controller released with Smash Bros Ultimate would work with GC games on a Wii (like OoT in the Zelda Collector's Edition) since the connector is shaped exactly the same and requires an adapter to be connected to the Switch. Sorry if this is dumb or if this has already been answered but I didn't find anything on the subject. Thanks !

A: Assuming your Wii has ports for GameCube controllers, yes, the controller will work on the Wii.
According to Amazon:

About the product

*

*Some will always prefer that system's Controller

*The Nintendo GameCube Controller also could be used in the Super smash Bros. Brawl for the Wii system

*To honor that devoted loyalty to a classic way to play, this is the Super smash Bros. Ultimate Edition GameCube Controller

*Please note the controller can only be used when the Nintendo Switch console is in TV mode.

Emphasis mine.


text:
Q: R: sprintf list of variables of mixed type I am trying to generate an SQL query with multiple embedded variables with sprintf.
I store SQL (it is large one) with parameters as %s as a separate file, and then read it from within r. To improve readability, I've created a helper:
fillSQLQuery <- function(query, params){
  #' fill query with params
  do.call(sprintf, as.list(c(query, params)))
}

My parameters are dates, factors, and strings. When I pass them to the function directly, my dates are replaced with an integer, and my factor - with its index (?). On the other side, when I convert the whole vector with as.character, it tries to process all elements to string as dates, and return NA or wrong results for all non-strings).
do.call(sprintf,
        as.list(c(query,
        c(as.character(startDateSequence[1]),  # POSix DATE
          as.character(endDateSequence[1]),    # POSix DATE
          lotTypes[1], id_list[1] ))))         # string, factor

The only way to solve that I've found so far is to manually convert dates and types to characters beforehand. However, I wonder if there is any "clear" way to do that, something as simple and robust as pythons:
'query {p1}, {p2}'.format(p1=X, p2=Y)

A: Okay, you haven't provided a reproducible example but your intent is clear, so here's the code you should have provided to make this a nice example (self-contained and reproducible):
x1 = Sys.Date() # Date
x2 = Sys.time() # POSIX datetime
x3 = "hello"    # character
x4 = factor("world", levels = c("world", "something"))  # factor

qry = "Select %s, %s, %s, %s from blah"

Now that the set-up is established, we can work on a solution. A list is the natural structure for holding items of different classes:
params = list(x1, x2, x3, x4)

And we can modify your function to convert each list element to character before using sprintf:
fillSQLQuery = function(query, params){
  params = lapply(params, as.character)
  do.call(sprintf, c(query, params))
}

fillSQLQuery(qry, params)
# [1] "Select 2016-11-05, 2016-11-05 17:19:29, hello, world from blah"


text:
Q: How to echo symbols like "&" in a batch command processor? This is my first text based game and I have almost no experience in coding. I've recently run into a problem where I try to echo a "%" but it won't appear in the command processor. Here are some lines of the code:
echo 10. If an icosahedron die has 20 faces, what is the probability of rolling a number with 1 in its digits?
echo A) 40%
echo B) 70%
echo C) 55%
echo D) 95%

But when I run it on the processor, the "%" does not display. Next I've tried this:
echo A) 40^%^

But it does not work. So I searched and tried this:
echo A) 40"%"

But it does not work as well. Do you know anything that can help?

A: The characters &, %, ^, (, ), <, > and | are not usually printable by batch with the echo command.
This can be bypassed with the escape character ^.
echo A^) 65^%
echo B^) 70^%
echo C^) 55^%
echo D^) 95^%

outputs the desired result.
%% also evaluates to % as an alternative to ^%.


text:
Q: Django: Conflict Between Live & Staging Sites on Same Server I've recently pushed a Django app live. We built the app in a staging subdomain on the server. When I went live, I copied the files of the staging subdomain to the main site, created a staging database and pointed the old staging site at the new staging database (leaving the new live site pointed at the original database). This is on mod_python under Apache.
I've created unique SESSION_COOKIE_NAME settings for both sites and I've set SESSION_COOKIE_DOMAIN to ".sitename.com" for the live site and None for the staging site.
The problem we're seeing is users in the live admin are making edits that (it appears) are being saved to the staging site. Users are also being logged out of the admin site "randomly" during requests.
Is there something I'm clearly doing wrong here? Should SESSION_COOKIE_DOMAIN be "www.sitename.com" to restrict it since the subdomain is at "staging.sitename.com"? Did I leave behind old session info in the now-live database (I ran ./manage.py clean and deleted all the sessions from the live database before this issue cropped up)?
Thanks

A: We ran into this problem in the last few weeks.  There were a couple of places where this could overlap.
1) Are you running separate python interpreters?
There are a few ways to configure mod_python so that the threads don't step on each other.  The key points here are to provide a distinct ServerName (in this case, the domains staging.sitename.com and www.sitename.com), as well as provide a distinct PythonInterpreter configuration setting in your Apache vhosts configuration file.
PythonInterpreter mysite

Relevant Django docs on same-server deployments
2) Are you running a cache backend on the same port?
There is a configuration in settings.py that lets you prefix the cached content with several characters to separate staging content from live content.  This is implemented with the following configuration in settings.py:
CACHE_MIDDLEWARE_KEY_PREFIX = "STG_"

Another option could be to run on separate filesystem caches for awhile to see if the problem is resolved.  In settings.py, try adding
CACHE_BACKEND = 'file:///var/tmp/django_cache'

3) Have you tried deleting all of your .pyc files?
Bizarrely, when the above two solutions failed to resolve our issue, we ran a bash command to delete all of the compiled python files (.pyc files) while the server was stopped.
find ./ -type f -name "*.pyc" -exec rm -f {} \;

This would indicate that changes in your deployment were not recompiling for one reason or another.
Hope this helps!


text:
Q: Identify documents in mongodb when matching two key:value pairs within a single array I am trying to identify documents where both key-value pairs within an array match using the aggregate pipeline.  Specifically, if I want to find documents where one array contains user_attribute.Name = Quests_In_Progress and user_attribute.Value =3.  Below is an example of such a document that I'm trying to match.
If I use
db.myCollection.aggregate({
    $match: {
    "user_attribute.Name": "Quests_In_Progress",
    "user_attribute.Value": "3"
    }
})

It will match every document that contains Quests_In_Progress for user_attribute.Name in one element of the array and contains "3" for user_attribute.Value, regardless of whether they exist in the same element of the array or not.
i.e.
db.myCollection.aggregate({
    $match: {
    "user_attribute.Name": "Quests_In_Progress",
    "user_attribute.Value": "0"
    }
})

will match the same document simply because one element of the array has a key:Value pair of Value:0 and another element of the array contains a key:value pair of Quests_In_Progress.
What I want to do is identify documents where both of those conditions are met within one element of the array.
I tried to do this with $elemMatch, but I couldn't get it to work.  Plus the aggregate documentation doesn't indicate that $elemMatch works, so maybe that's why I couldn't get it to work.
Lastly, I need to use the aggregate pipeline, because there are a bunch of other things I have to do after finding these documents- specifically unwinding them.
{
    "_id": ObjectId("5555bb32de938ce667f78ce00"),
    "user_attribute": [{
    "Value": "Facebook",
    "Name": "Social_Connection"
    }, {
    "Name": "Total_Fireteam_Missions_Initiated",
    "Value": "0"
    }, {
    "Name": "Quests_Completed",
    "Value": "3"
    }, {
    "Name": "Item_Slots_Owned",
    "Value": "36"
    }, {
    "Name": "Quests_In_Progress",
    "Value": "3"
    }, {
    "Name": "Player_Progression",
    "Value": "0"
    }, {
    "Value": "1",
    "Name": "Characters_Owned"
    }, {
    "Name": "Quests_Started",
    "Value": "6"
    }, {
    "Name": "Total_Friends",
    "Value": "0"
    }, {
    "Name": "Device_Type",
    "Value": "Phone"
    }]
}

A: Try using $elemMatch
db.myCollection.aggregate([{$match: {"user_attribute": {$elemMatch: {"Name":"Quests_In_Progress", "Value":"0"}}}}, { $out, "temp"}])

That query will find anyone who has element of their array "Quests_In_Progress" with a value of 0 and put it into the collection temp


text:
Q: How to get value inside vuetify chip I have a vue application where I am displaying information inside of vuetify chips. When I want to click on a specific chip I want the console to log the value inside it. I tried accessing the array which the information originate from but I am getting an undefined error. Could someone look at my code and tell me what is wrong with it?
html:
 <v-chip-group
                v-model="selection"
                active-class="deep-purple--text text--accent-4"
                mandatory
            >
              <v-chip
                  v-for="(time, i) in dateTimeArray"
                  :key="time"
                  :value="time.startTime+' | '+time.endTime"
                  @click="pushSelected()"
              >
                {{ time.startTime +" : "+ time.endTime }}
              </v-chip>
            </v-chip-group>

Script:
export default {
  name: "MeetingAdminComponent",
  data : ()=>({
    singleSelect: false,
    selection: "",
    dateTimeArray:[],
    availableTimes: [
    ],

  }),

  created() {
    this.getAvailableMeetingTimes()
  },

  methods:{

    getAvailableMeetingTimes() {
      var pageURL = window.location.href;
      var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
      axios.get("http://localhost:8080/api/voterAvailableTime/findBy", {

        params: {
          meetingName: lastURLSegment,
        }

      })
          .then(response => (this.availableTimes = response.data)
          )
    },

 getTimesFilteredByDate() {
      var pageURL = window.location.href;
      var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
      var selectedDate = this.selectedDate
      axios.get("http://localhost:8080/api/voterAvailableTime/find", {

        params: {
          meetingName: lastURLSegment,
          date: selectedDate
        }
      })
          .then(response => (this.dateTimeArray = response.data))
    },

    pushSelected(){

      console.log(this.availableTimes.startTime+ " " + this.availableTimes.endTime)
    }
  }
};
</script>

A: Pass the current item as parameter to the method :
          <v-chip
              v-for="(time, i) in dateTimeArray"
              :key="time"
              :value="time.startTime+' | '+time.endTime"
              @click="pushSelected(item)"

in methods:
  pushSelected(item){

      console.log(item.startTime+ " " + item.endTime)
    }


text:
Q: Hide volume HUD view in MPVolumeView I use MPVolumeView and UISlider to control my device audio and below is my code:
extension MPVolumeView {
    var volumeSlider: UISlider {
        self.showsRouteButton = false
        self.showsVolumeSlider = true

        var slider = UISlider()
        for subview in self.subviews {
            if subview.isKind(of: UISlider.self){
                slider = subview as! UISlider
                slider.isContinuous = false
                slider.minimumTrackTintColor = UIColor.outlineStrokeColor
                slider.setThumbImage(#imageLiteral(resourceName: "volume"), for: .normal)
                slider.maximumTrackTintColor = UIColor.lightGray
                (subview as! UISlider).value = AVAudioSession.sharedInstance().outputVolume
                return slider
            }
        }
        return slider
    }
}

let mpVolumeView: MPVolumeView = {
    let view = MPVolumeView()
    return view
}()

override func viewDidLoad() {
    _ = mpVolumeView.volumeSlider
    view.addSubview(mpVolumeView)
}

Everything works great but everytime when I open my app, the volume HUD appears and fades away after a few seconds. It won't show up again after that but I wish there would be an option to hide it all the time. I have tried to set MPVolumeView's frame to .zero but it still doesn't work. Is there a way that I can do so?


text:
Q: Database redesign then reload approach using linq to excel and entity framework So I've got a few tables with a lot of data.  Let's say they are table A, B and C.  I want to add auto increment ID fields for each of those tables, normalize them by swapping some fields between the tables and add an additional table D.  Gulp.  There are three goals: 1) redesign the database, and reload the existing data.  2) Enable a data load from a spreadsheet to add/edit/delete the four tables.  3) Enable a web front end to add/edit/delete the four tables.
My current approach:

*

*I thought I would export a flat file for all the data in the 3 existing tables into a csv (spreadsheet).

*Then refactor the database design structure

*Then use linq to excel to read back the csv spreadsheet records into dto objects

*Then use the Entity Framework to transform those dto objects into Entities to update the database with the appropriate relationships between tables

*The spreadsheet would be re-used for future bulk data add/edit/deletes

What about the following tools?
SSIS
Bulk insert
Stored procedures
Am I over complicating this?  Is there a better way?

A: What's your definition of "a lot of data"? For some people it's 10,000 rows, for others it's billions of rows.
I would think that a few stored procedures should be able to do the trick, mostly made up of simple INSERT..SELECT statements. Use sp_rename to rename the existing tables, create your new tables, then move the data over.
If you already have to develop a bulk import process then it might make sense to get reuse out of that by doing an export, but I wouldn't create that whole process just for this scenario.
There might be cases where this approach isn't the best, but I don't see anything in your question that makes me think it would be a problem.
Make sure that you have a good back-up first of course.


text:
Q: Delphi XE7 iOs Developing I'm trying to set up the environment for installing an iOS App developed by Delphi XE7. The thing is my Mac OS X is the version 10.6.8 and the higgest Xcode I can install is the 3.2. Is it possible to work with such scenario?

A: The documentation answers your question

Requirements for Developing iOS Applications

*

*PC running Windows connected to an Intel-based Mac, or a Mac running Windows in a VM, with 2 GB RAM or more.

*The Mac must run OS X 10.9 or 10.8, with the latest version of Xcode that supports iOS 7 or iOS 8.

*An Apple Developer account is required to deploy iOS apps to physical devices.

*Platform Assistant server (paserver) installed on the Mac:

emphasis mine.


text:
Q: Augmenting Time Series Data for Deep Learning If I want to apply deep learning to the dataset from the sensors that I currently possess, I would require quite a lot data, or we may see overfitting. Unfortunately, the sensors have only been active for a month and therefore the data requires augmentation. I currently have data in the form of a dataframe that can be seen below:
index   timestamp              cas_pre        fl_rat         ...
0       2017-04-06 11:25:00    687.982849     1627.040283    ...
1       2017-04-06 11:30:00    693.427673     1506.217285    ...
2       2017-04-06 11:35:00    692.686310     1537.114807    ...
....
101003  2017-04-06 11:35:00    692.686310     1537.114807    ...

Now I want to augment some particular columns with the tsaug package. The augmentation can be in the form of:
my_aug = (
    RandomMagnify(max_zoom=1.2, min_zoom=0.8) * 2
    + RandomTimeWarp() * 2
    + RandomJitter(strength=0.1) @ 0.5
    + RandomTrend(min_anchor=-0.5, max_anchor=0.5) @ 0.5
)

The docs for the augmentation library proceed to use the augmentation in the manner below:
X_aug, Y_aug = my_aug.run(X, Y)

Upong further investigation on this site, it seems as though that the augmentation affects numpy arrays. While it states that it is a multivariate augmentation not really sure as to how that is happening effectively.
I would like to apply this consistent augmentation across the float numerical columns such as cas_pre and fl_rat in order not to diverge from the original data and the relationships between each of the columns too much. I would not like to appply it rows such as timestamp. I am not sure as to how to do this within Pandas.

A: This is my attempt:
#Convert Pandas dataframe to Numpy array and apply tsaug transformations

import numpy as np
import pandas as pd
from tsaug import TimeWarp, Crop, Quantize, Drift, Reverse

df = pd.DataFrame({"timestamp": [1, 2],"cas_pre": [687.982849, 693.427673], "fl_rat": [1627.040283, 1506.217285]})

my_aug = (
    Drift(max_drift=(0.1, 0.5))
)

aug = my_aug.augment(df[["timestamp","cas_pre","fl_rat"]].to_numpy())

print("Input:")
print(df[["timestamp","cas_pre","fl_rat"]].to_numpy()) #debug
print("Output:")
print(aug)

Console Output:
Input:
[[1.00000000e+00 6.87982849e+02 1.62704028e+03]
 [2.00000000e+00 6.93427673e+02 1.50621728e+03]]
Output:
[[1.00000000e+00 9.13389853e+02 2.03588979e+03]
 [2.00000000e+00 1.01536282e+03 1.43177109e+03]]

You may need to convert your timestamps to something numeric.
The tsaug functions you use don't seem to exist, so I only applied drift() as an example. After some experimentation, TimeWarp() doesn't affect timestamps (Column 1) by default, but TimeWarp()*5 inserts new samples by cloning each timestamp 5 times.


text:
Q: Regular Expression to find Chinese characters If a string contains atleast one chinese character then i have return a boolean. I am looking for exact regular expression to use in pattern.matches method.
Any help much appreciated.

A: Java/Apex has a script keyword for Chinese characters that you could use:
public static Boolean containsChineseCharacters(String InputString){
    Pattern p = Pattern.compile('\\p{IsHan}');
    Matcher m = p.matcher( InputString );
    return m.find();
}

If you want your regular expression to find characters that are Chinese Hanzi and not also Japanese Kanji, there isn't an easy way to do it.
The most commonly used CJKV ideographs are found in the Unicode CJK Unified Ideographs Block*. Many of these characters are used by multiple languages, and what will make your regex difficult is that the characters aren't separated by language. There is no sub-block for "Just Chinese" or "Chinese and Japanese". Unicode has the characters ordered by radical and stroke number, which means that they are all interspersed. Your regular expression would have to look for a very large number of small ranges and individual code points.
*There are other locations that contain CJKV ideographs, but this highlights the difficulty of the task.


text:
Q: NullPointerException while using RunningCount Aggregation with Engine API I'm trying to upgrade my application to use BIRT 3.7.1 version. Currently I'm using version 2.6.0.
I'm using the latest stable release 3.7.1.
During my testing I'm facing an exception with a report which is using a serial number(RunningCount Aggregation). This exception comes when I uses the report with the Report Engine API, if I uses the web viewer the report is working fine.
I've attached a small test case to recreate the issue. This includes the report design file and a class where I'm using there ReportEngine to generate the report.
Please find the error log below:
Jan 3, 2012 4:34:42 PM org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
SEVERE: An error happened while running the report. Cause:
java.lang.NullPointerException
    at org.eclipse.birt.core.util.IOUtil.writeInt(IOUtil.java:226)
    at org.eclipse.birt.core.util.IOUtil.writeObject(IOUtil.java:674)
    at org.eclipse.birt.data.engine.executor.transform.SimpleGroupCalculator.next(SimpleGroupCalculator.java:233)
    at org.eclipse.birt.data.engine.executor.transform.SimpleResultSet.next(SimpleResultSet.java:562)
    at org.eclipse.birt.data.engine.executor.transform.ResultSetWrapper.next(ResultSetWrapper.java:81)
    at org.eclipse.birt.data.engine.impl.ResultIterator.hasNextRow(ResultIterator.java:584)
    at org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:525)
    at org.eclipse.birt.data.engine.impl.ResultIterator.next(ResultIterator.java:475)
    at org.eclipse.birt.report.engine.data.dte.QueryResultSet.next(QueryResultSet.java:191)
    at org.eclipse.birt.report.engine.executor.ListingElementExecutor.hasNextChild(ListingElementExecutor.java:244)
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:62)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
    at com.eclipse.birt.test.RunningCountFieldTest.main(RunningCountFieldTest.java:52)
Exception in thread "main" org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:196)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
    at com.eclipse.birt.test.RunningCountFieldTest.main(RunningCountFieldTest.java:52)
Caused by: java.lang.NullPointerException
    at org.eclipse.birt.core.util.IOUtil.writeInt(IOUtil.java:226)
    at org.eclipse.birt.core.util.IOUtil.writeObject(IOUtil.java:674)
    at org.eclipse.birt.data.engine.executor.transform.SimpleGroupCalculator.next(SimpleGroupCalculator.java:233)
    at org.eclipse.birt.data.engine.executor.transform.SimpleResultSet.next(SimpleResultSet.java:562)
    at org.eclipse.birt.data.engine.executor.transform.ResultSetWrapper.next(ResultSetWrapper.java:81)
    at org.eclipse.birt.data.engine.impl.ResultIterator.hasNextRow(ResultIterator.java:584)
    at org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:525)
    at org.eclipse.birt.data.engine.impl.ResultIterator.next(ResultIterator.java:475)
    at org.eclipse.birt.report.engine.data.dte.QueryResultSet.next(QueryResultSet.java:191)
    at org.eclipse.birt.report.engine.executor.ListingElementExecutor.hasNextChild(ListingElementExecutor.java:244)
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
    at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:62)
    at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
    at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
    at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
    ... 2 more

You can find a sample program to recreate the issue in GitHub.
Please help me to fix this issue.

A: I solve this issue by separating both run and render tasks of the Report Engine API.
Instead of using IRunAndRenderTask task = engine.createRunAndRenderTask(design); run both IRunTask runTask = engine.createRunTask(design); and IRenderTask renderTask = engine.createRenderTask(iReportDocument); separatly.


text:
Q: Jquery: dynamically appending to context.childNodes[4] not working noobish aspiring front end engineer here.I am currently working on an html5 canvas vector drawing app that makes color palette swaps easy.
I am working on a function that creates a named color variable/object (such as 'primary' or 'secondary') and stores it in its own array for safe keeping BUT ALSO appends it to a color-selector/palette swapper for the menu's of every vector shape that has been created.
The idea is that you draw a shape, select 'primary' (or whatever color variables you have previously created) in that shapes menu and that shapes color is set to whatever primary is, which can be easily changed in the seperate menu for the 'primary' color variable.
I'm using html select's and when a new color is created I need to update the menu's for the vector shapes (info held in li's) that have been created. I am iterating through those in the color variables constructor using this:
var colorVar = function(name, hexstring){
   this.name = name;
   this.color = hexstring;
   //append colors to drop downs
   $( "li" ).each(function( index ) {
   $(this).context.childNodes[4].append("<option value='blue'>" + this.name + "</option>");
  });
}

but when i run that ^^ code i get this error:
     Uncaught TypeError: $(...).context.childNodes[4].append is not a function
when i run a console.log($(this).context.childNodes[4]) from within the each() i get
<select class='colorList'>
    <option value='blue'>primary color</option>
</select>

for every shape that i have made, so its definitely iterating through them.
(fyi i added primary color non-dynamically just as a test)
how do i append to the inside of the select?
Any other suggestions welcome!
(also Jquery is definitely working so its not an issue with including it in the html ;)

A: .append() is not a native javascript function. You can use .insertAdjacentHTML() to achieve what you want.
.....  .childNodes[4]
           .insertAdjacentHTML( 'beforeend', "<option value='blue'>" +
                                                  this.name + "</option>" );

A: Why not just select the drop down using it's class and do it like this:
$(".colorList").append("<option value='blue'>"+this.name+"</option>");


text:
Q: Is there any possibility to make my local machine as master/slave to access Jenkins myself without depending on any other machines I wanna execute jobs from my local machine by accessing jenkins page thru URL which can be active if master/slave machine is unlocked and batch files of Jenkins and SonarQube ran successfully. Now the issue I am facing is due to work from home i cannot go and unlock the machine which is available in office so that tried unlocking thru remote/VM. still not able to execute the jobs successfully. getting error like,
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "TechTalk.SpecFlow" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [C:\Jenkins\workspace\RegistrationSanity\RegressionTestSuite\BatchDataManager\BatchDataManager.csproj]
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "xunit.assert" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [C:\Jenkins\workspace\RegistrationSanity\RegressionTestSuite\BatchDataManager\BatchDataManager.csproj]
2 Warning(s)
0 Error(s)

Time Elapsed 00:00:09.99
[RegistrationSanity] $ cmd /c call C:\Users\AUTOMA~1.EMI\AppData\Local\Temp\jenkins7061082824491969029.bat
C:\Jenkins\workspace\RegistrationSanity>"C:\Jenkins\workspace\RegistrationSanity\RegressionTestSuite\packages\xunit.runner.console.2.3.1\tools\net452\xunit.console" "C:\Jenkins\workspace\RegistrationSanity\RegressionTestSuite\Tests\bin\Debug\Tests.dll" -trait "Description=Deductions - Re-register Option Validation - Inbox" -trait "Description=Amendment - Delete Option Validation - Inbox" -trait "Description=Add Private Patient --- passed from local"
xUnit.net Console Runner (64-bit Desktop .NET 4.0.30319.42000)
  Discovering: Tests
  Discovered:  Tests
  Starting:    Tests
-> Using app.config
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Could not send keyboard input. ErrorCode: 5
Kindly help me to resolve the problem. If possible suggest me with any other solution.
Thank you..

A: Please try out the agent setup of local machine with Jenkins Master, Find it here : https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+agent+machines+on+Windows
https://dzone.com/articles/jenkins-03-configure-master-and-slave
And in your job mention that on which agent / node the build or stage should execute.
If you are using pipeline script you can set the node[local machine after setup] or you should have Jenkins job type where you can set the agent.
If you are working in corporate, probably you need admin access to [Administrator can] do this setup in Jenkins master.
Hope it helps
-Madhan