text:
Q: What should i load from collada files, in order to see my 3D model in c++? i have a problem loading a model in my c++ opengl glut project, i created a parser which gets in  and its  node, but if i try to load from those vertexes i see my model streched, i can only see the shape but the inner parts like doors or walls have some triangles missing, my program is more than 3,000+ characters(source code) and i use my Android phn here to post the question, theres no error in my program only it does is get the file position of  and another function will use that position to read and convert string data into floats, then opengl display function uses those floats to render models, so my question is why is my model dont looks the same as i created?
EDIT: No, small cube is one file, and the other i made is over 4+ mb, and i dont mean by dont want to show, i said can't show, how can one write huge 3000+ chars long source code, and 10000+ chars long file with a phone?? Sorry i also know it might help u answering my question, and i must provide it but i'am unable to write the whole code, and i know my loader is wrong because it just looks in  of  and convert it to floating point value and the draw function uses it to draw on a 3d world. Pls tell me what things should i take in order to only load vertices from any file, not just a specific one...


text:
Q: Access matplotlib objects of scatter plot Given a matplotlib 2.0.0 scatter plot with few points, I want to annotate some of the points without overlapping other points. For the annotation, I use adjustText which takes an optional list of matplotlib objects (with the .get_window_extent() method) to avoid. But I could not yet find out how to get those objects for the points in the scatter plot.
How can I get a list of (point) objects having .get_window_extent() from the scatter plot?
Consider for example:
import matplotlib.pyplot as plt
from adjustText import adjust_text
x,y = [1,2,3,4,5],[2,4,6,8,10]
scatter = plt.scatter(x,y)
annotations = []
for x_i, y_i in zip(x[:-3],y[:-3]):
    annotations.append(plt.text(x_i,y_i, 'foobar'))
adjust_text(annotations, add_objects=scatter)

Using add_objects=

*

*scatter throws a TypeError: 'PathCollection' object is not iterable

*scatter.get_paths() throws a AttributeError: 'Path' object has no attribute 'get_window_extent'

A: I think you simply missed the additional arguments in adjust_text. You may supply the x and y coordinates of the points directly to the function:
adjust_text(annotations,x=x,y=y)

Full example:
import matplotlib.pyplot as plt
from adjustText import adjust_text
plt.rcParams["figure.figsize"] = 3,2
x,y = [1,2,3,4,5],[2,4,2,8,10]
scatter = plt.scatter(x,y)
annotations = []
for x_i, y_i in zip(x,y):
    annotations.append(plt.text(x_i,y_i, 'foobar {},{}'.format(x_i,y_i)))
adjust_text(annotations,x=x,y=y)

plt.show()

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't inject scope in service (angular 1.5 / es6)  const taskServiceModule = angular.module('taskServiceModule');
 class taskService {
  constructor ($scope) {
    console.log($scope)
  }
}
taskService.$inject = ['$scope'];
taskServiceModule.service('tasksService', taskService);
export default taskServiceModule;

const app = angular.module(`app`, [taskServiceModule.name]);

I get error, why? who can explain?

Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <-
  tasksService


text:
Q: MKMapView center and zoom the view towards the annotations,  MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
 MKPointAnnotation *annotation1 = [[MKPointAnnotation alloc] init];
 MKPointAnnotation *annotation2 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation3 = [[MKPointAnnotation alloc] init];
 MKPointAnnotation *annotation4 = [[MKPointAnnotation alloc] init];
 MKPointAnnotation *annotation5 = [[MKPointAnnotation alloc] init];
 MKPointAnnotation *annotation6 = [[MKPointAnnotation alloc] init];
annotation.coordinate=CLLocationCoordinate2DMake(40.748736,-73.892523);
annotation.title=@"Head Office";
annotation1.coordinate=CLLocationCoordinate2DMake(40.747972,-73.891858);
annotation1.title=@"Kalpana Chawla";
annotation2.coordinate=CLLocationCoordinate2DMake(40.74768,-73.891818);
annotation2.title=@"New Jackson Heights";
annotation3.coordinate=CLLocationCoordinate2DMake(40.642973,-73.979019);
annotation3.title=@"Brooklyn";
annotation4.coordinate=CLLocationCoordinate2DMake(40.617862,-73.962418);
annotation4.title=@"Coney Islands";
annotation5.coordinate=CLLocationCoordinate2DMake(40.83659,-73.853234);
annotation5.title=@"Bronx";
annotation6.coordinate=CLLocationCoordinate2DMake(40.635336,-73.963204);
annotation6.title=@"Malborough";

[mapView addAnnotation:annotation];
[mapView addAnnotation:annotation1];
[mapView addAnnotation:annotation2];
[mapView addAnnotation:annotation3];
[mapView addAnnotation:annotation4];
[mapView addAnnotation:annotation5];
[mapView addAnnotation:annotation6];
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
    NSLog(@"%@",annotation);
    MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
    MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
    if (MKMapRectIsNull(zoomRect)) {
        zoomRect = pointRect;
    } else {
        zoomRect = MKMapRectUnion(zoomRect, pointRect);
    }
}
[mapView setVisibleMapRect:zoomRect animated:YES];

I have these 6 static locations I have to show on the MK Map. After manually declaring all the annotation, I used the for loop code I found on stackoverflow to center and zoom my map to the annotations declared. But when I run my application, the map gives me a default zoom level view towards the Atlantic Ocean. Help please.
I am running the app in simulator

A: MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
    NSLog(@"%@",annotation);
    MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
    MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0.1, 0.1);
    if (MKMapRectIsNull(zoomRect)) {
        zoomRect = pointRect;
    } else {
        zoomRect = MKMapRectUnion(zoomRect, pointRect);
    }
}
[mapView setVisibleMapRect:zoomRect animated:YES];


text:
Q: Plotly update customdata with dropdown button I have a quick question: basically I have created a plot with some hover information and I have a dropdown button, where the user can chose from which dataframe (filtered or not) the plot is going to be based on.
So i initiate my figure like so:
first_df = pd.DataFrame({'gene':['gene'+str(i) for i in range(10)],
                        'x':range(10),'y':range(10),'z':range(10),
                        'columnA':['info A '+str(i) for i in range(10)],
                        'columnB':['info B '+str(i) for i in range(10)]})
second_df = pd.DataFrame({'gene':['gene'+str(i) for i in range(10,20)],
                        'x':range(10,20),'y':range(10,20),'z':range(10,20),
                        'columnA':['info A '+str(i) for i in range(10,20)],
                        'columnB':['info B '+str(i) for i in range(10,20)]})
first_df_filtered = first_df.iloc[[0,2,4,6,8]]
second_df_filtered = second_df.iloc[[0,2,4,6,8]]

fig = go.Figure()

fig.add_scatter3d(x = first_df['x'],
                y = first_df['y'],
                z = first_df['z'],
                customdata = first_df[['columnA', 'columnB']],
                hovertemplate = "
".join(["%{text}
",
                                             "info on y = %{y:.2f}",
                                             "info on x = %{x:.2f}",
                                             "info customdata 0 = %{customdata[0]}",
                                             "info customdata 1 = %{customdata[1]}"
                                            ]),
                text = first_df['gene'],
                mode='markers'
                )

fig.add_scatter3d(x = second_df['x'],
                y = second_df['y'],
                z = second_df['z'],
                customdata = second_df[['columnA', 'columnB']],
                hovertemplate = "
".join(["%{text}
",
                                             "info on y = %{y:.2f}",
                                             "info on x = %{x:.2f}",
                                             "info customdata 0 = %{customdata[0]}",
                                             "info customdata 1 = %{customdata[1]}"
                                            ]),
                text = second_df['gene'],
                mode='markers'
                )

fig.update_layout(updatemenus=[

                                #------------------------------------------------------------------
                                dict(
                                    active=0,
                                    y=0.5,
                                    buttons = list(
                                        [dict(label = 'No filter',
                                              method = 'update',
                                              args = [{'x': [first_df['x'], second_df['x']],
                                                       'y': [first_df['y'], second_df['y']],
                                                       'z': [first_df['z'], second_df['z']],
                                                       'text': [first_df['gene'], second_df['gene']],
                                                       'customdata[0]':[first_df['columnA'], second_df['columnA']],
                                                       'customdata[1]':[first_df['columnB'], second_df['columnB']],
                                                      },
                                                      ]),
                                         dict(label = 'Filter on',
                                              method = 'update',
                                              args = [{'x': [first_df_filtered['x'], second_df_filtered['x']],
                                                       'y': [first_df_filtered['y'], second_df_filtered['y']],
                                                       'z': [first_df_filtered['z'], second_df_filtered['z']],
                                                       'text': [first_df_filtered['gene'], second_df_filtered['gene']],
                                                       'customdata[0]':[first_df_filtered['columnA'], second_df_filtered['columnA']],
                                                       'customdata[1]':[first_df_filtered['columnB'], second_df_filtered['columnB']],
                                                      },
                                                    ]),
                                        ])
                                    ),

                    ])

When I click on the button 'No filter', all the information shown on the hoverbox for each point is correct, but when I click on the button 'Filter on' the information shown in the hoverbox for the customdata is not correct. However if I click again on the 'No filter' button the information is correct again. Here is a picture showing an example of my problem


text:
Q: Animate Zurb Foundation top-bar dropdown I'm trying to slide down the top-bar menus dropdown elements using Zurb foundation.
So far i have:
$('.top-bar .has-dropdown').hover(function() {
    $(this).find('.dropdown').first().stop(true, true).slideDown();
}, function() {
    $(this).find('.dropdown').first().stop(true, true).slideUp()
});

But it doesn't slide the whole thing down, it just shows the menu and then moves it down a bit!


text:
Q: Hex integer to decimal integer in Java I need to parse hex integer to decimal integer.
For example, Hex: 02 01 (513 in decimal mode) should represent 201.
In code it could pass:
Assert.assertEquals(201, parse(0x201));

How can I implement the method parse()? Thanks!

A: You can use the two-parameter version of parseInt:
Assert.assertEquals(513, Integer.parseInt("201", 16));

A: I think you just need to convert base 16 digits to base 10 digits, as follows:
int parse(int n) {
  if (n == 0) return 0;
  int digit = n & 0xf;
  assert digit >= 0 && digit <= 9;
  return parse(n >> 4) * 10 + digit;
}

probably won't work for negative numbers.
Why do you want to do this anyway?  Seems a pretty silly thing to do.

A: Use Integer.toHexString()

System.out.println(Integer.toHexString(0x201));

Output : 201

A: I find String.format("%x", t) works for the function. Anyway, thanks for Mark anirvan and Keith!


text:
Q: Dynamic views with two attributes in same table yii2 I have an APPLICATION table like this:
ID | APP_NAME | PARAM_VIEWS |
1   INDRA       _indra
2   ACIM        _acim

In my case, I need to create view action with two attributes ID and PARAM_VIEWS. If APP_NAME is INDRA, a view is _indra, etc.
My basic controller is
public function actionView($id)
{
    $model = $this->findModel($id);

    return $this->render('view', [
        'model' => $model
    ]);
}

How to create an action for my case? I'm still beginner in php and yii 2 framework. Thank you.

A: your finding one record using id and you can call $model->PARAM_VIEWS in the render.
public function actionView($id)
{
    $model = $this->findModel($id);

    return $this->render($model->PARAM_VIEWS, [
        'model' => $model
    ]);
}


text:
Q: Printing from Class in python with list comprehension Why does my print function from my Class work when I am using a loop, but return memory locations when I print using a list comprehension?
stocks= ['STY','STY','PRC','STY','PRC','STY','PRC','STY','PRC','STY']
price=[48,46,35,46,235,46,34,64,26,53]
quantity=[10,24,60,24,54,64,10,10,35,10]
type=['sell','sell','sell','sell','sell','buy','buy','buy','buy','buy']

data=list(zip(stocks,price,quantity,type))
print(list(data))

class Order():
    def __init__(self, stock_name, cost, quantity, trx_type):
        self.stock_name = stock_name
        self.cost = cost
        self.cost = cost
        self.quantity = quantity
        self.trx_type = trx_type

    def __str__(self):
        return '{stock}: {trx} {quant} at ${cost}'.format(stock = self.stock_name, trx = self.trx_type.title(), quant = self.quantity, cost = self.cost)

order_list=[]
for order in data:
    stock = Order(stock_name  = order[0], cost = order[1], quantity = order[2], trx_type = order[3])
    order_list.append(stock)

print([order for order in order_list])  ## This returns list of memory locations

for order in order_list:  ## this returns print statements from __str)__
    print(order)

A: [order for order in order_list]

Here you're storing instances in a list using list comprehension. And when you print them using:
print([order for order in order_list])

it prints the list of instances (not a single instance or instances one by one but a complete list). Since you have stored instances in the list, it will store their location.
Similarly when you use loop:
for order in order_list:
    print(order)

Now you're accessing single instances one by one and printing them and it will use the __str__() function of the class.


text:
Q: check if there are duplicate values in 2 datagridview I'm trying to compare the rows and columns with 2 datagridview. The first column s1 in (DGV1) has found the duplicate values in s1 (DGV2). The second column  s2  in (DGV1) is mismatched with the second column  s2  in (DGV2). What's wrong with the code?
for (int i = 0; i < dataGridView1.RowCount ; i++)
 {
   for (int j = 0; j < dataGridView2.RowCount; j++)
       {
         if ( dataGridView1.Rows[i].Cells[0].Value.ToString() ==
              dataGridView2.Rows[j].Cells[0].Value.ToString())
            {
               dataGridView1.Rows[i].Cells[0].Style.BackColor =
               Color.Yellow;
               dataGridView2.Rows[j].Cells[0].Style.BackColor =
               Color.YellowGreen;
            }
       }
  }

enter image description here

A: try this
for (int i = 0; i < dataGridView1.RowCount ; i++)
 {
   for (int j = 0; j < dataGridView2.RowCount; j++)
       {
         if ( (dataGridView1.Rows[i].Cells[0].Value.ToString() ==
               dataGridView2.Rows[j].Cells[0].Value.ToString()) &&
              (dataGridView1.Rows[i].Cells[1].Value.ToString() ==
               dataGridView2.Rows[j].Cells[1].Value.ToString()) )

            {
               dataGridView1.Rows[i].Cells[0].Style.BackColor =
               Color.Yellow;
               dataGridView1.Rows[i].Cells[1].Style.BackColor =
               Color.Yellow;
               dataGridView2.Rows[j].Cells[0].Style.BackColor =
               Color.YellowGreen;
               dataGridView2.Rows[j].Cells[1].Style.BackColor =
               Color.YellowGreen;
            }
       }
  }

A: foreach (DataGridViewRow row1 in table1.Rows) //LOOP ROWS TABLE 1
{
    foreach (DataGridViewCell cell1 in row1.Cells) //LOOP COLUMNS TABLE 1
    {
        foreach (DataGridViewRow row2 in table2.Rows) //LOOP ROWS TABLE 2
        {
            foreach (DataGridViewCell cell2 in row2.Cells) //LOOP COLUMNS TABLE 2
            {
                if (cell1.Value != null && cell2.Value != null&& cell2.Value.ToString() == cell1.Value.ToString())
                {
                    cell1.Style.BackColor = Color.Yellow;
                    cell2.Style.BackColor = Color.YellowGreen;
                }
            }
        }
    }
}

Hey Marcel16, this should solve your problem:


text:
Q: Problems with variables working outside idle loops in apple script I have a problem with variables not working outside an idle. What should I do to make it work? My code looks like this:
set currentdate to current date
set currentminute to currentdate's minutes
on idle
    display dialog currentminute
    if idle_time < 0 then set idle_time to days - (time of (current date))
    return idle_time
end idle

A: on idle is not a loop, it's a handler having its own scope.
Mark currentminute as global or declare it as property for example. Both ways makes the variable available in handlers on lower levels.
property currentminute : 0

set currentdate to current date
set currentminute to currentdate's minutes

 on idle
    display dialog currentminute
    if idle_time < 0 then set idle_time to days - (time of (current date))
    return idle_time
end idle


text:
Q: android Firestore document cannot delete array child please find attached my documents array structure:
Structure of my documents arry
I try to delete this entry using this code, but unfortunately it doesnt work:
      Map<String, Object> docData = new HashMap<>();
            Map<String, Object> deleteObject = new HashMap<>();

            deleteObject.put("chatId", users.get(position).getChatId());
            deleteObject.put("contactId", users.get(position).getId());
            deleteObject.put("isGroup", users.get(position).isGroup());
            deleteObject.put("isRead", users.get(position).isRead());
            deleteObject.put("lastMsg", users.get(position).getLastMsg());
            deleteObject.put("lastMsgTs", users.get(position).getLastMsgTs());
            deleteObject.put("sentBy", users.get(position).getSentBy());
            deleteObject.put("active", false);
            docData.put("openChats", FieldValue.arrayUnion(deleteObject));

            db.collection("Users").document(FirebaseAuth.getInstance().getCurrentUser().getUid())
                    .set(docData, SetOptions.merge()).addOnSuccessListener(new OnSuccessListener<Void>() {
                @Override
                public void onSuccess(Void aVoid) {
                    Toast.makeText(mActivity, "deleted", Toast.LENGTH_LONG).show();

                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Toast.makeText(mActivity, "Unable to delete", Toast.LENGTH_LONG).show();

                }
            });

I cannot see any error and also the onSuccess gets called. Does someone know how i can one map entry without using arrays position


text:
Q: How do I include all endings for a url except for a specific ending with Javascript regexs? I'm trying to make a regex to capture all endings in:
hello://a.b.c/d/

that is, hello://a.b.c/d/.*
except for "Main_Page" ending, that is:
hello://a.b.c/d/Main_Page

I tried using this answer but when I try my string, the dots between a and b seem to get in the way, so that something like:
hello://a.b.c/d/(?!Main_Page)([-\w]*\.)(?!Main_Page)([-\w]*\.)(?!Main_Page)\S*

does not work. So as an example, I would like to match to the first 2 lines and not the third below:

hello://a.b.c/d/Running
hello://a.b.c/d/Maine
hello://a.b.c/d/Main_Page

A: This seems to work just fine:
/hello:\/\/a\.b\.c\/d\/(?!Main_Page).*/g

Online Demo


text:
Q: Javascript Appear() function does not run, while Hide() does My problem is that the Hide function runs perfectly, but the Appear one does not.
I have 2 panels: One for Sign Up and one for Register, i want that if the user clicks on the register button, then the login panel disappears and the register one appears at the same place, as login was.
I have the following code:
HTML:

    function Hide() {
       var x = document.getElementById("bejelentkezes");
       if (x.display.style === "block") {
        x.display.style = "none";
       }
    }

    function Appear() {
     var y = document.getElementById("regisztracio");
     if (y.display.style === "none") {
      y.display.style = "block";
     }
    }

Bejelentkezés

                <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                  <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                  Regisztráció
                </form>

Regisztráció

                <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                  <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                  Regisztráció
                </form>

A: The syntax is
element.style.display=value

not
element.display.style=value

function Hide() {
       var x = document.getElementById("bejelentkezes");
       if (x.style.display === "block") {
        x.style.display = "none";
       }
    }

    function Appear() {
     var y = document.getElementById("regisztracio");
     if (y.style.display === "none") {
      y.style.display = "block";
     }
    }

Bejelentkezés

                <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                  <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                  Regisztráció
                </form>

Regisztráció

                <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                  <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                  Regisztráció
                </form>

Refer

A: A better way to achieve toggle functionality.

window.addEventListener('DOMContentLoaded', () => {

            document.querySelectorAll('.reg').forEach(function (elem) {
                elem.addEventListener('click', function (e) {
                    var x = document.getElementById("bejelentkezes");
                    var y = document.getElementById("regisztracio");
                    if (y.style.display === "none") {
                        y.style.display = "block";
                        x.style.display = "none";
                    } else {
                        y.style.display = "none";
                        x.style.display = "block";
                    }
                })
            });
        });

Bejelentkezés

            <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"
                        placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                Regisztráció
            </form>

Regisztráció

            <form>

                    Email cím
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"
                        placeholder="Email">

                    Jelszó
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

                <button type="submit" class="btn btn-dark">Bejelentkezés</button>

                Regisztráció
            </form>

A: *

*You cant get or set y.display.style you wanted y.style.display (display is a property of style and not the opposite).

*based on your code, you should do it more simple and maintainable, I would use one function - HandleView() that will check the state of the panels and will activate Hide() and Appear(). please see my suggestion.

LIVE DEMO
<!DOCTYPE html>

    <meta charset="UTF-8">

Bejelentkezés

          <form>

              Email cím

              <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

              Jelszó

              <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

            <button type="submit" class="btn btn-dark">Bejelentkezés
            </button>

            Regisztráció

          </form>

Regisztráció

          <form>

              Email cím

              <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">

              Jelszó

              <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Jelszó">

            <button type="submit" class="btn btn-dark">Bejelentkezés
            </button>

            Regisztráció

          </form>


text:
Q: Dialog controlled by remote server in Android? Is there any possible way to control a Dialog in Android from remote server? Let say I have an application and there I created an If Statement. For example: When the number 2 is not equal the number in my remote server, the Dialog should pop out in my application. Is there any simple way to accomplish this? Please guide me, thanks in advance!

A: Good Question.
First of all to implement push server mechanism before android 2.2 you need to implement a novel workaround. The idea is to invoke a intent. One way to do is to  register a broadcast receiver for an event (eg: receiving sms message) , check for the format of the message and invoke the corresponding Intent. ( which will invoke the dialog or you might use Notification).
But if you are using android 2.2 and above, you are lucky. Google introduced Cloud To Device Messaging Framework. Check this link.


text:
Q: eCharts Tooltip Formatter - Possible to use Angular ng-container? I want to include ng-container in my eCharts Tooltip formatter.
I found the following link (How to format the tooltip value in echart (angular)) and it is working to create a simple HTML output, but I want to create something more sophisticated in my tooltip.
Here is what I tried:
Component HTML:
...
<ng-template #templateHistogram let-myData="paramData">
   <app-chart-bar [histogramData]='myData'> </app-chart-bar>
</ng-template>
...

My "app-chart-bar" component is working fine (with my histogramData input) when I use this somewhere else in my app. Did I maybe mix up with the parameter assignments?
Component TS:
...
tooltip: {
   ...
   formatter: function (params: any) {
      // transforming Formatter params into paramData which I want to display in my Histogram. I checked that paramData is working and has correct format
      const returnString = `<ng-container *ngIf="paramData" *ngTemplateOutlet="templateHistogram; context: {paramData: ${paramData}}"> </ng-container>`;
      return returnString
   }
},

Unfortunately, during the rendering it seems that my returnString is changed slightly:

*

*ngIf was changed to ngif

*ngTemplateOutlet was changed to ngtemplateoutlet

*Wired though that #templateHistogram and paramData has not been changed

See DOM Element in Google Chrome Dev Tool:
<ng-container *ngif="paramData" *ngtemplateoutlet="templateHistogram; context: {paramData: [object Object],[object Object],...,[object Object]}"> </ng-container>

Since Angular is case sensitive here, I guess that this is the issue here. However, I have no clue on how to fix that. Has anyone ever encountered that issue?
Any help would be highly appreciated - Thanks!


text:
Q: How to wait for Akka Persistent Actor to persistAll? I want to send a reply after I have persisted and updated the state of the actor using persistAll. Unfortunately I have not found a callback or onSucces handler to send back a reply after the last event has been persisted.

A: This is a shortcoming of the API, there is no built in way to react on all persistAll completing, you will have to keep a counter or a set of completed persists yourself and only trigger your logic when the last persist completes.
As far as I remember this cannot be easily fixed because it would break binary and source compatibility.
In the "next generation" persistent actors (in Akka typed) this works more as you would expect and the side effect you want to execute on successful persist of the events will only execute once, when all the events are complete.


text:
Q: How to Import Widgets | Orchard CMS While mporting the Content/Metadata from ORchard CMS 1.9.1 to earlier version 1.7, whenever I export the Widgets, There is an error thrown as seen below:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 20:                 @if (count > 0) {
Line 21:                     int i = 0;
Line 22:                     foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
Line 23:                         <li class="widgets-@(widget.LayerId == Model.CurrentLayer.Id ? "this" : "other")-layer widgets-layer-@widget.LayerId@(i == 0 ? " first" : (i == count ? " last" : ""))">
Line 24:                             @using (Html.BeginFormAntiForgeryPost()) {

Source File: e:\inetpub\wwwroot\TestWebsite\Modules\Orchard.Widgets\Views\WidgetPlacement.Zones.cshtml    Line: 22

whenever i export any of my widgets this error happens. Can you please help me understand the stepss to export Widgets ? What else i need to export before exporting Widgets ?

A: It could either be that the export from 1.9.1 is not compatible with 1.7, you'd have to compare your export from 1.9.1 and an export from 1.7, see what is different.
Or, you could be importing widgets onto a layer that does not exist yet, which also will throw an error when you load the widgets management page.


text:
Q: Programmatically adding string.concat For a side project I need to make this function work. Basically what I need is to concat strings for each string returned from a list (of strings)
For Each art As String In artikli

Next

'This part below should be programatically changed String.Concat()
Dim QueryString As String = String.Concat(query, ";", query2, ";", query3, ";", query4)

Each 'art' in 'Artikli' is a string (query) which I need to concat.
There can be any number of strings in 'Artikli'

A: This should work:
Dim QueryString As String = String.Join(";", artikli)

A: Another way
    Dim artikli() As String = {"Test 1", "Test 2", "Test 3"}
    Dim QueryString As String = ""
    For Each art As String In artikli
        QueryString += String.Concat(art, ";")
    Next


text:
Q: Vuetify Preview image with avatar icon Is it possible to do Preview image with avatar  before upload using Vuetify.I was searching for that a lot.If yes please guide me.

A: I dont know if this answer to your question but
 <v-avatar size="120">
  <v-img
    :src="'URL FULL SIZE IMAGE'"
    :lazy-src="'URL BEFORE LOADING (OR PREVIEW) '"
    @error="'URL ON ERROR'"
  >
  <!-- ALSO, YOU CAN USE A LOADING ANIMATION -->
    <template v-slot:placeholder>
      <v-progress-circular
        style="margin-top:40px"
        indeterminate
        color="custm_theme_6"
      ></v-progress-circular>
    </template>
  </v-img>
</v-avatar>


text:
Q: Trying to combine 2 queries that are a count of filtered records and a count of all records into 3 columns I have two queries yielding results:
Date    Count of Converted Leads
07/22/2013  3
07/23/2013  10
07/24/2013  4
07/25/2013  5
07/26/2013  3
07/27/2013  3
--and
Date    Count of All Leads
07/22/2013  105
07/23/2013  517
07/24/2013  291
07/25/2013  170
07/26/2013  122
07/27/2013  79
07/28/2013  86

I want to combine these into 3 columns results:
Date    Count of Converted Leads      Count of All Leads

Get an error"  Subquery returned more than 1 value
Select convert(varchar(10), [LeadCreatedDate], 101) as Date
,(select count(leadid)
    from [dbo].[SalesforceProspectConversion]
    where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
    and [LeadSourceOriginal] != 'Jigsaw'
    and [LeadSourceOriginal] != 'Other'
    and [LeadConverted] = 'Y'
    Group by convert(varchar(10), [LeadCreatedDate], 101)) as 'Count of       Converted Leads'
,(select count(leadid)
    from [dbo].[SalesforceProspectConversion]
    where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
    and [LeadSourceOriginal] != 'Jigsaw'
    and [LeadSourceOriginal] != 'Other'
    Group by convert(varchar(10), [LeadCreatedDate], 101)) as 'Count of All   Leads'
from [dbo].[SalesforceProspectConversion]
where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
and [LeadSourceOriginal] != 'Jigsaw'
and [LeadSourceOriginal] != 'Other'
Group by convert(varchar(10), [LeadCreatedDate], 101)

A: You don't want your Group by in the subqueries anymore.  And if you want to go this route (subquery), you only need one subquery (for the count of converted leads; for the overall count you can just use count(leadid) as the 2nd field in the parent select).  Then remove the date range part of the where clause in the subquery and reference the parent driver table where the dates are equivalent (use table aliases to do this).  Let me know if you need more specific details.

A: This worked!
select convert(varchar(10), [LeadCreatedDate], 101) as Date
          ,sum(case when leadconverted = 'Y' then 1 else 0 end) as 'Count of Converted     Leads'
          ,count(leadid) as 'Count of All Leads'
from [dbo].[SalesforceProspectConversion]
where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
and [LeadSourceOriginal] != 'Jigsaw'
and [LeadSourceOriginal] != 'Other'
Group by convert(varchar(10), [LeadCreatedDate], 101)
Order by convert(varchar(10), [LeadCreatedDate], 101)


text:
Q: Oracle DB SQL select variables with certain suffix Is anyone know how to get all the columns of a table with a certain suffix?
Maybe something like:
select * from table_name where name like '%_cd';

A: This will return all columns for the table THE_TABLE that end with _CD
select column_name
from user_tab_columns
where column_name like '%\_CD%' escape '\'
  and table_name = 'THE_TABLE'
order by column_id;

Remember that Oracle stores table and column names in uppercase unless you quoted them using double quotes in the CREATE TABLE statement. Therefor you need '%_CD' and not '%_cd%'


text:
Q: Results are wrong when using SUM returns values 3 times higher ALTER PROCEDURE [dbo].[STOR_totalforadmin]
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- Interfering with SELECT statements.

    SET NOCOUNT ON;

    -- SELECT * FROM tblDraw

    SELECT tblretailer.ID,Name as retailername, tblretailer.AbcRate,   tblretailer.AbRate,
           tblretailer.BoxRate, tblretailer.StraightRate,
           sum(isnull(ACount, 0)) as atotal ,
           sum(isnull(BCount, 0)) as Btotal,
           sum(isnull(CCount, 0)) as Ctotal,
           SUM(isnull(Count,0)) as strtotal,
           SUM(isnull(BoxCount,0)) as boxtotal,
           SUM(isnull(ABCount,0))as abtotal,
           SUM(isnull(ACCount,0))as actotal,
           SUM(isnull(BCCount,0)) as bctotal
    FROM tblretailer  FULL JOIN Tbl_ABC abc  ON (abc.RetailerID=tblretailer.ID)
    FULL JOIN TblDraw  Draw ON (Draw.RetailerID=tblretailer.ID)
    FULL JOIN Tbl_ABACBC abbc  ON (abbc.RetailerID=tblretailer.ID)
    GROUP BY Name, tblretailer.ID, tblretailer.AbcRate, tblretailer.AbRate, tblretailer.BoxRate, tblretailer.StraightRate
END

A: Assume you have two table like following:
declare @table1 table(Id int, Value int)
declare @table2 table(Id int, Value int)

we insert some value like following:
insert into @table1(Id, Value) values (1, 10)
insert into @table1(Id, Value) values (2, 20)
insert into @table1(Id, Value) values (3, 30)

insert into @table2(Id, Value) values (1, 10)
insert into @table2(Id, Value) values (1, 20)
insert into @table2(Id, Value) values (2, 30)

first we run following query for getting summary:
select
        t1.Id,
        SUM(ISNULL(t1.Value, 0)) t1Sum,
        SUM(ISNULL(t2.Value, 0)) t2Sum
from
        @table1 t1
        full join @table2 t2 on t1.id = t2.id
group by
        t1.Id

Result:
Id    t1Sum    t2Sum
1     20       30
2     20       30
3     30       0

Id 1 in table1 has sum value of 10 but why result is 20?
then we run following query(no summary and group by):
select
        *
from
        @table1 t1 full join @table2 t2 on t1.id = t2.id

Result:
Id    Value     Id    Value
1     10        1     10
1     10        1     20
2     20        2     30
3     30        NULL  NULL

since we use full join, record with Id = 1 in @table1 is duplicated because of two record with Id = 1 in @table2.

A: Divide your sum by 3 like this:
sum(isnull(ACount, 0))/3

for all.


text:
Q: What are Tom Banks's arguments against a QFT of QG cont..? What are Tom Banks's arguments against a QFT of quantum gravity?
I do not feel that the answer given here includes all of his arguments. The answer given in the other question only included his argument for BH entropy, but as you can see by reading pages 1-9 in the link paper, he give lots of arguments that I would like to have an explanation to (on a laymen level).
Can someone go through each of the arguments he gives and just give a detailed explanation of what he is saying?
https://arxiv.org/abs/1007.4001


text:
Q: java.lang.ClassNotFoundException: InputFileProgressEvent I have application developed using JSF, IceFaces and deployed inside Tomcat but when I tried to start tomcat, I am getting below exception.
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener
java.lang.NoClassDefFoundError: InputFileProgressEvent
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.privateGetPublicMethods(Class.java:2547)
        at java.lang.Class.getMethods(Class.java:1410)
        at com.sun.faces.config.ManagedBeanFactoryImpl.getMethodsWithAnnotation(ManagedBeanFactoryImpl.java:1164)
        at com.sun.faces.config.ManagedBeanFactoryImpl.<init>(ManagedBeanFactoryImpl.java:188)
        at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:1201)
        at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:772)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:529)
        at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4971)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: InputFileProgressEvent
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
        ... 24 more
May 1, 2015 7:41:59 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
May 1, 2015 7:41:59 PM org.apache.catalina.core.StandardContext startInternal

Please help me to trace out the issue.


text:
Q: Android: Widget not updating when it should I have a widget layout of two ImageViews and a button. Whenever I tap the button, the two image views should get some random images in my resource files. My problem is for the first few clicks, the image views are properly getting new images, but after that, even though I am setting images using the setImageViewBitmap(), but to no use.
Any help would be appreciated.

A: I found the problem. It is due to the exception " FAILED BINDER TRANSACTION".
Please look into this discussion.
https://groups.google.com/d/topic/android-developers/KKEyW6XdDvg/discussion
Thx@
rahul.


text:
Q: Custom Gtk.CellRenderer with a Toggle cycling between True, None (displayed as inconsistent) and False, python GTK 3 I need to write a custom Gtk.CellRenderer (let's call it CellRendererToogleWithNone) that behaves similar to Gtk.CellRendererToggle, but instead of only supporting True and False I also want it to support None which should be displayed as inconsistent state like this:
On toggle I want to rotate in some defined order, for example like so: True -> False -> None
(But that's probably the easy part, I still thought I mention that)
I also don't know how to make it work with TreeStore because if I do
self.treestore = Gtk.TreeStore.new(types = (bool,))
iter = self.treestore.append(parent = None, row = (None,))

it will convert any None value to False because bool seems not to allow for None values
I failed to find any helpful custom Gtk.CellRenderer examples online.
I want to do it by inheriting from Gtk.CellRenderer and NOT from Gtk.CellRendererToggle because this should also serve me as a helpful example to implement more cell renderers like this.
I can only guess that I have to define some custom data type for the TreeStore, something like bool_or_none instead of bool (no idea how to do that either) and hold my own Gtk.ToggleButton inside of my custom CellRendererToogleWithNone.
Edit 0:
This post about how to write custom Gtk.CellRenderer gives a couple of hints which maybe can be reused but does not solve my problem. It doesn't show how to make Gtk.TreeStore accept None values for bool variables and I don't understand everything there. It doesn't even use a Gtk.Button, instead it seems to paint a box inside of a widget that I'm guessing may be the parent. I don't want to paint my own Toggle, I want to reuse Gtk.ToggleButton and its inconsistent property
Edit 1:
Since it seems custom cell renderers are not easy, I think it would be especially useful to see a minimal working example in python. I should also mention that I want to display the data as compactly as possible which excludes suggested workarounds such as having two toggles for one value.

A:
Question: Custom Gtk.CellRendererToggle with a Toggle cycling between True, None (displayed as inconsistent) and False.

You are misguided, it's not the part of a Gtk.CellRendererToggle object to set the inconsistant flag. It's implemented allready there. You have to implement a Gtk.TreeCellDataFunc instead.

I also want it to support None

I don't get it to work with a None value,
    therefore i use type int with values: [False, True, 2]

Note:

*

*In def on_toggle(...) the model values get changed to 0 == False and 1 == True. If you want it to be stay of type boolean, implement accordingly.

*You should be aware, that the value 2, evaluates to True also.

Reference:

*

*Gtk.TreeViewColumn.set_cell_data_func

This function is used instead of the standard attributes mapping for setting the column value, and should set the value of self's cell renderer as appropriate.

*Gtk.TreeCellDataFunc

A function to set the properties of a cell instead of just using the straight mapping between the cell and the model. This is useful for customizing the cell renderer

Implementation:  Core point: .set_cell_data_func(cell_renderer, .set_status)

class TreeViewColumnTriState(Gtk.TreeViewColumn):

    def __init__(self, title='', model=None, **attributes):
        cell_renderer = Gtk.CellRendererToggle()
        cell_renderer.connect("toggled", self.on_toggle, model)

        self.inconsistent = attributes.pop('inconsistent', None)
        super().__init__(title, cell_renderer, active=0, **attributes)
        self.set_cell_data_func(cell_renderer, self.set_status)

    def set_status(self, column, cell, model, _iter, *ignore):
        if model.get_value(_iter, 0) == self.inconsistent:
            cell.set_property('inconsistent', True)
        else:
            cell.set_property('inconsistent', False)

    def on_toggle(self, cell, path, model, *ignore):
        if path is not None:
            model = model[model.get_iter(path)]
            model[0] += 1
            if model[0] == 3:
                model[0] = 0

Usage:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib

class App(Gtk.ApplicationWindow):
    def __init__(self):
        super().__init__()
        self.connect("destroy", Gtk.main_quit)

        model = Gtk.ListStore(int)

        #  Some initial data
        for n in [False, True, 2]:
            model.append([n])

        col = TreeViewColumnTriState("Foo", model, inconsistent=2)

        tv = Gtk.TreeView(model)
        tv.append_column(col)
        self.add(tv)

        self.show_all()

if __name__ == "__main__":
    main = App()
    Gtk.main()

Tested with Python: 3.5 - gi.__version__: 3.22.0


text:
Q: Python string strip I am trying to use strip() to remove the end of some HTML. The idea is to eventually build this into a loop, but for now I am just trying to figure out how to make this work:
httpKey=("Degree Programs")
httpKeyEnd=">"

#the number in the httpKey that the httpKey end is at
stripNumber=(httpKey.find(httpKeyEnd))
#This is where I am trying to strip the rest of the information that I do not need.
httpKey.strip(httpKey.find(httpKeyEnd))
print (httpKey)

The end result being to print httpKey to screen with just:

a href="http://www.uaf.edu/academics/degreeprograms/index.html

A: find will return the index where a string is found (a number), and strip removes characters from the ends of a string; it doesn't remove "everything from that point forward".
You want to use string slicing instead:
>>> s = 'hello there: world!'
>>> s.index(':')
11
>>> s[s.index(':')+1:]
' world!'

If you just want to find out what the link is, use a library like BeautifulSoup:
>>> from bs4 import BeautifulSoup as bs
>>> doc = bs('Degree Programs')
>>> for link in doc.find_all('a'):
...     print(link.get('href'))
...
http://www.uaf.edu/academics/degreeprograms/index.html

A: For your case this will work:
>>> httpKey=("Degree Programs")
>>> httpKey[1:httpKey.index('>')]
'a href="http://www.uaf.edu/academics/degreeprograms/index.html'


text:
Q: apt install older version of gcc (not working) i want to install a previous version of gcc (7.3.0).
Currently, i have installed gcc in version 7.4.0.
I uninstalled gcc with sudo apt-get remove gcc; sudo apt-get autoremove and tried to install the previous version with
sudo apt-get install gcc=4:7.3.0-3ubuntu2

After installing it, the output ofgcc --version shows:
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So the installed version of gcc is still 7.4.0.
Why does apt not install the specified version?
Thank you for ur help!

A: The gcc package is a metapackage which pulls in the appropriate compiler package; downgrading it won't downgrade the compiler itself. You need to downgrade gcc-7, which is the appropriate compiler package in Ubuntu 18.04:
sudo apt install gcc-7=7.3.0-16ubuntu3

and any required package.


text:
Q: Teams Calling Bot - OnMessageActivityAsync return null value and AdaptiveCard not working Trying to create and debug Teams calling and meeting bot from Bot Framework v4 for CPI project. found here: CallingBotSample
I have gone through all the steps correctly But I have some problems which got me stuck.
Tunneling with Ngrok work fine (200 OK) for /api/callback and /api/messages
Problem 1: AdaptiveCard v1.3 is not showing when the Bot is starting.
Fact:   I want the card to show every time the bot is starting as shown in this link: Calling Bot

Problem 2: OnMessageActivityAsync()get the request from user such as createcall However the turnContext.Activity.Text has the value But turnContext.Activity.Value returns null and that will result on Bot showing message but not calling or joining meeting.
Snip:
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
        {

            if (string.IsNullOrEmpty(turnContext.Activity.Text))
            {
                //turnContext.Activity.Text = null;
                dynamic value = turnContext.Activity.Value;
                if (value != null)
                {
                    string type = value["type"];
                    type = string.IsNullOrEmpty(type) ? "." : type.ToLower();
                    await SendReponse(turnContext, type, cancellationToken);
                }
            }
            else
            {
                await SendReponse(turnContext, turnContext.Activity.Text.Trim().ToLower(), cancellationToken);
                //await OnTurnAsync(turnContext, cancellationToken);
            }
        }

What I want is a 100% working calling bot that can join any user calls and record it

Does anyone have a subjection or a solution to my questions?

A: We tried to repro this issue at our end, but everything works for us. We are able to get Welcome card and calls are getting placed without any issue.We can record the call as well. Also able to join scheduled meeting and Invite participants to meetings as mentioned.

Please make sure you have enabled calling and configured proper endpoint on Teams channel page.


text:
Q: Ionic Build Android Failed I am really stuck on building Ionic for Android
System Information
Cordova CLI: 5.3.3
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v0.12.6
Xcode version: Xcode 7.0.1 Build version 7A1001

When I run
$ ionic build android
it produces
Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/010_add_platform_class.js /Users/umer/Workspace/Ionic/blank
add to body class: platform-android
Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/umer/Workspace/Ionic/blank
Running command: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build
ANDROID_HOME=/Users/umer/Documents/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
Running: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew cdvBuildDebug -b /Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle -Dorg.gradle.daemon=true
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /var/root/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
    at org.gradle.wrapper.Install.createDist(Install.java:47)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

/Users/umer/Workspace/Ionic/blank/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I have tried changing var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip'; to point it to local distribution but it does not look into specified path but look into project's android directory.
When I build using Ant
cordova build android -- --ant
It builds successfully but I am unable to build the way docs are suggesting.

I already followed
ionic build android error when download gradle

A: I got this error when I was running the android command several times. I ran (on Linux):
ps aux | grep -i android

And I discovered the android command was running more than once.
I typed
sudo kill -9 (ids of running android(s) )

It seems android was denying ionic access to gradle.


text:
Q: Format number with two zeros after comma? I have a property on my model like this:
[DisplayFormat(DataFormatString = "{0:C2}")]
public decimal TotalPrice { get; set; }

When the TotalPrice is for example 800,00 then the view shows $ 800,00 and if the TotalPrice is 800,01 (or something like that), the view shows $ 800,01 and this is also correct but my client want's that if the TotalPrice contains decimals, then the view must show ,00 instead of the decimals.
I can't format the number with [DisplayFormat(DataFormatString = "{0:C0}")] because it will show $ 800 and i don't want that.
What's the right formatting for this case?
To make an example:
TotalPrice = 800
//Output: $ 800,00
TotalPrice = 800.23
//Output: $ 800,00
TotalPrice = 800.63
//Output: $ 801,00

A: [DisplayFormat(DataFormatString = "{0:C2}")]
public decimal TotalPrice {
    get ()
    {return Math.Round(this.TotalPrice);}
    set;

}
or if you need to be able to get the decimals from totalprice then
[DisplayFormat(DataFormatString = "{0:C2}")]
public decimal TotalPrice { get; set; }

[DisplayFormat(DataFormatString = "{0:C2}")]
public readonly decimal TotalRoundedPrice
{
    get ()
    {return Math.Round(this.TotalPrice);}
}

A: Make a new string property in your model that outputs the correct value:
public string TotalPriceDisplay
{
    get { return Math.Round(this.TotalPrice).ToString ("F"); }
}


text:
Q: How may I SELECT the right row for my trigger I'm new to Stored procedures and triggers. After doing an UPDATE to my LeaveRequest table for a specific row, I have the following trigger :
ALTER TRIGGER [dbo].[LeaveRequestTrig]

 ON  [dbo].[LeaveRequest]
   AFTER UPDATE
AS
BEGIN

    DECLARE @StateId int

SET @StateId = (SELECT LeaveRequest.LeaveRequestStateId FROM LeaveRequest)

IF (@StateId = 2)
    PRINT 'yes'
ELSE
    PRINT 'no'

END

But here's the problem, how may I SELECT the row that has just been UPDATEd if I don't have the same parameters as the last Query?
Say that my UPDATE was for user = kade and where id = 55 how may I SELECT the same row in my trigger?

A: There are pseudo-tables called DELETED and INSERTED available to you inside trigger, you can get the updated ID(s) there. Note that in general case, there may be multiple rows updated in one query and therefore you may get multiple rows in the DELETED and INSERTED pseudo-tables.

A: use
SET @StateId = (SELECT LeaveRequest.LeaveRequestStateId FROM Inserted)

for more reference Trigger insert.
For you concern about returning multiple rows,follow this link that shows how to join the psuedotables to get single row


text:
Q: Do I have to open couchbase port range 21100 to 21199? I'm using couchbase the lastest version.
Must I open port all of range 21100 to 21199?
Do I have any problem to open port only one of them?(ex, 21100 port)
please help me.

A: Yes you have to open these ports. They are used by Erlang for the inter-nodes communication.


text:
Q: Is messaging from two pools to one pool allowed in BPMN? I have three pools, senders A (a human task), B (a Service Task) and receiver C (doesn't matter). The pools are asynchronous and there is no callback.
Pools A and B both send message1 to pool C StartMessage event.
Is this a valid use of send message, from multiple sources to one receiver, or do I have to duplicate the message and have two StartMessage events?

A: The BPMN spec says YES, this is valid (on p. 246 of the 2.0 version): "A Start Event MAY be the target for a Message Flow; it can have zero (0) or more incoming Message Flows. Each Message Flow targeting a Start Event represents an instantiation mechanism (a trigger) for the Process. Only one of the triggers is REQUIRED to start a new Process."
(In your case you have one type of message 'message1', so this is straightforward, as just said. In case you have different messages, the spec would require either a "multiple event" - which allows multiple event definitions behind the scenes - or as an alternative would require you to display those different message start events separately in the diagram.)


text:
Q: Return a max date from a range of dates but only if all cells contain a date I am trying to get a formula that will give me a max date only if all cells have a date in them.
If one cell contains a blank value or N/C I do not want the formula to populate a date in column R.
I have tried =max(C7:Q7) but this populates even though there is a blank or not complete within the range.
I have tried to use ISBLANK and IF / NOT but this is not working for me.


text:
Q: Classic Asp Application pool hanging and generate freezes Dim objXMLHTTP,xml,gString
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
 xml.Open "GET", "http://www.ourdomain.com/checkout/receiptdisplay.asp?orderid=" & ORDERNUMBER , False
xml.Send
ObjSendMail.HTMLBody    =   xml.responseText
Set xml = Nothing

I am talking about very often situations that for some unknown reason, IIS Application Pool hangs and most classic ASP sites do not load (loading forever) and then i have to recycle application pool to make all work.
i use defaultAppPool for website.

A: Separate your application in to different app pools if certain parts are more memory intensive than others.  Instead of using Microsoft.XMLHTTP, which may be causing your issue, use a newer version:  http://msdn.microsoft.com/en-us/library/ms766431%28v=vs.85%29.aspx
On another note, If you're doing HTTPRequests to the same website in the same application pool, you'll experience thread starving, which will cause issues like this.  To help resolve this, you need to separate them in their own application pools, like this:
This HTTPRequest script should be in one Application Pool
and your receiptdisplay.asp script should be in a different Application pool.
Microsoft goes more into detail why you should do this here:
Do Not Send ServerXMLHTTP or WinHTTP Requests to the Same Server


text:
Q: How to create and configure a sinon stub in a single command If I want to create and configure a Sinon stub in a single line, is it possible? The naive implementation:
const a = sinon.stub().withArgs(myArg1).returns(15);

doesn't set a to the stub- it sets it to 15. I would like a to be equivalent to
const a = sinon.stub();
a.withArgs(myArg1).returns(15);

I have looked through the docs but nothing jumped out at me - is what I want possible?

A: This is the signature of returns method for "sinon": "^8.1.1":
returns(obj: TReturnValue): SinonStub<TArgs, TReturnValue>;

So the return value of the returns method is a sinon stub. E.g.
import sinon from 'sinon';
import { expect } from 'chai';

describe('56876050', () => {
  it('should pass', () => {
    const a = sinon
      .stub()
      .withArgs('myArg1')
      .returns(15);
    const actual = a();
    expect(actual).to.eql(15);
    sinon.assert.calledOnce(a);
  });
});

unit test results:
  56876050
    ✓ should pass

  1 passing (8ms)


text:
Q: Is it possible to change update interval in Conky for specific variables? Is it possible to change the update interval in Conky for specific variables? Can I change it just like I would change the font in a Conky?

A: As far as I know, conky has a single update_interval parameter which applies to all of the running .conkyrc file.
If you want some parameters to be monitored at different intervals, use a separate rc file and run 2 (or more) instances of conky.

A: I was googling the same thing and this came up as a result so I wanted to set it straight.
It IS possible to do so, conky provides the following :

execi
                Same as exec but with specific interval. Interval can't be less than update_interval in configuration. See also $texeci

Usage:
${execi time-in-second bash-command-here}
Reference:
http://conky.sourceforge.net/variables.html

A: Short answer: It is not possible when sticking to conky's built in variables and functions alone.
Long answer: There is a way. First of all, what Csaba said in the other comment, is not entirely true:  So if you don't update tens of parameters every second, you shouldn't see more thant 2-3% extra CPU usage. It's not necessarily about amounts of parameters. You might already require update_interval to be set to 0.5 or smaller, if you use just one mere line of scrolling text (like in my case). Try it out yourself. Scrolling text will run literally at snail's pace at standard value of update_interval.
But you won't want other things to update as hectically as this (except for graphs perhaps), so what can you do?
Outsource the code which needs to be in a greater interval. Even though some conky functions might exist for it, use replacement functions from bash (or even Python), put them in a script and ${execi} respectively ${texeci} them with your desired greater interval. In some cases, you may as well want to use ${execpi} resp. ${texecpi} since the latter two will also allow you to use a line like echo "${color aabbcc}" in a bash script parsed by conky for built-in parameters / variables.


text:
Q: Why won't my regex parse this http request correctly? I have the following http request payload.
X-gmsv=9879480&X-subtype=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-X-subscription=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-gcm.topic=%2Ftopics%2Fphenotype_com.google.android.gms.icing%25servingVersion&X-X-subtype=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-app_ver=9879480&X-kid=%7CID%7C7%7C&X-osv=25&X-sig=vWteecmhHl5q2AsrHaGcOOgaF956SpVk6KAdjijNyeX1uADvPgpgvMkNH-Nu-N8IHc-1Z1ujTytjkQDPZot4zjf_FLSjR0ucPIkFXkZhrRi5RU6uFq-ZlQCEBSPpYuHsx27lC5H3xv-TNe_zC0PaX8h8bTqrImtArVSZjMY6-RFG9TUEj2VkCvs1ixAK21vHxE4ladiXALZO-lhZIvbDIGkY4c-fUMaMBN8EhMr1zH31N41S6cUItkPRe0lTOB4YddkrS2FNRI_LZGfW-cc9h9om-80MskZD0IyJtM4AFsumHxVIQQJwSScASSoFd7e7tANTp5ZPJi2hwr6wQqpveQ&X-cliv=iid-9879000&X-gmsv=9879480&X-pub2=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9VWXXfudfnoAAl-u_RbBClmI6uvaOH8AFEMvjrtOpL1FuLrUYQzdntRwlMyiL4Nba7WUGeb6CrkEAbwTFcR689QYQ87ytkyY65rD2InSUD3eMLWpiaTciFj-n5sUK6hyci5Je5T8Svgsb-VHSy6vWVKQZ4vGsiGqmkj8sDhCa1UbltWOyhywfG95ENiGKuO_ec55Rmvrew9tFNGIit7FzcNiEAmfSrkEifK6dydjnpahu3lAx4U_MTw5Yo0ou5EGrsByXY2P_tkWg78hq1E_SQORk7q7droAY_wupXHlqSwGCAfbGtRs2gXM-64MSZ1iQX7N7pPojkT4akomcyP2JQIDAQAB&X-X-kid=%7CID%7C7%7C&X-appid=cIIP-1V_bTg&X-scope=%2Ftopics%2Fphenotype_com.google.android.gms.icing%25servingVersion&X-subscription=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-app_ver_name=9.8.79+%28480-137224771%29&app=com.google.android.gms&sender=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&device=4374365252386389758&cert=58e1c4133f7441ec3d2c270270a14802da47ba0e&app_ver=9879480&info=AoehgPKryS4XzDpwLBRWN3IuplGtswI&gcm_ver=987948

I want to pull out all the pairs of <key>=<value>.  For example the first key value pair is X-gmsv=9879480.
The best regex I have come up with is .*?\=.*?& but it get's everything but the last key value pair because there is no ampersand at the end of the last variable.  So I tried .*?\=.*?[&|$] which in theory should either match a key value pair ending with an ampersand or the end of the string.
It doesn't get the last string.  I've played around with a couple other regexes and can't figure out what's going on.
Any ideas?

A: If you insist regex... here it is.
.*?\=.*?(?:&|$)

It captures 24 groups. And
len(input.split('&'))

is 24 too.

A: I would highly recommend not to use a regex for that. Use the stdlib urlparse.parse_qs() function. It will also take care of URL-encoding and such for you:
>>> import urlparse
>>> urlparse.parse_qs('X-gmsv=9879480&X-subtype=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-X-subscription=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-gcm.topic=%2Ftopics%2Fphenotype_com.google.android.gms.icing%25servingVersion&X-X-subtype=cIIP-1V_bTg%3AAPA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW&X-app_ver=9879480&X-kid=%7CID%7C7%7C&X-osv=25')
{'X-subtype': ['cIIP-1V_bTg:APA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW'], 'X-osv': ['25'], 'X-X-subscription': ['cIIP-1V_bTg:APA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW'], 'X-kid': ['|ID|7|'], 'X-app_ver': ['9879480'], 'X-gmsv': ['9879480'], 'X-X-subtype': ['cIIP-1V_bTg:APA91bG-C3lFgSEzXCnuaLgpa4oJ0mI3NRk8Yv03NBOTfARjfBMWGhwy9J3d2dKUtGZHt6IKFmt7BBWRrQBqbvPoMobfZ2DP1Za0EyDzBqtfTLz9j-EYUHU1PWVjM2kMnOtIuA1s4EHW'], 'X-gcm.topic': ['/topics/phenotype_com.google.android.gms.icing%servingVersion']}

Note: In Python 3 this is urllib.parse.parse_qs()


text:
Q: unable to place a task because no container instance met all of its requirements I'm using the latest ECS Agent v1.22.0 for Windows ECS cluster. I want to try out the new feature https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html?shortFooter=true but with the following failed error message:
service XXX was unable to place a task because no container instance met
all of its requirements. The closest matching container-instance YYY is
missing an attribute required by your task.

It doesn't appear ECS Agent logs show any error. My Task has the following attributes:
"requiresAttributes": [
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.execution-role-ecr-pull"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.ecr-auth"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.task-iam-role"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.execution-role-awslogs"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.secrets.ssm.environment-variables"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
    }
  ]

A: fwiw the windows instructions seem to include a gotcha here:

For Windows tasks that are configured to use the awslogs logging driver, you must also set the ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE environment variable on your container instance. This can be done with User Data using the following syntax:

see the instructions here


text:
Q: Composer autoload in own package / class not found I've tried now some different approaches and read articles here and elsewhere but i can't figure out what i'm doing wrong.
I'm developing a package and I want it to be installed via symlink in a different project to develop both parts simultaneously without the need of updating the dependencies over and over again.
The thing I cant get to work is the autoloading.
Here is my setup:
Project composer.json
{
  "repositories": [
    {
        "type": "path",
        "url": "../../FormTableComponent",
        "options": {
            "symlink": true
        }
    }
  ],
  "require": {
    [...]
    "bluechord/formtablecomponent": "@dev"
  }
}

FormtableComponent Folder Structure
FormTableComponent/
  src/
  | Container.php
  composer.json

FormtableComponent composer.json
{
  "name": "bluechord/formtablecomponent",
  "description": "...",
  "autoload": {
    "psr-4": {
      "BlueChord\\FormTableComponent\\": "src/"
    }
  },
  "require" : {
    [...]
  }
}

FormtableComponent Container.php
<?php

/**
 * FormTable Container. The Container Class that registers all Parts of the
 * Component.
 */

 namespace BlueChord\FormTableComponent;

 class Container {

    function __construct() {

    }
 }

When I try to use the class and instantiate it I get
Uncaught Error: Class 'BlueChord\FormTableComponent\Container' not found

Thanks for your help!
ADDITIONAL INFO:
A simple Test.php which reproduces the error inside the project
<?php

require_once 'bin/vendor/autoload.php';
echo "BCOSP Test";

use DebugBar\StandardDebugBar;
use BlueChord\FormTableComponent\Container;

$debugbar = new StandardDebugBar(); --> WORKS
echo StandardDebugBar::class ."\n";

$container = new Container();  --> ERROR
echo Container::class . "\n";

Composer
The vendor/composer/autoload_psr4.php does NOT contain any array key for my package.
If I run composer dump-autoload inside my main project nothing changes.
If I run composer dump-autoload inside my package it creates the correct autoload_psr4.php


text:
Q: Can I force a program to load a weakly-named assembly when it's linked to a strongly-named assembly? I have a program that references a strongly named assembly which is in the gac.  I have a debug build of this assembly which I want to debug into, but it isn't strongly named.  Can I use a policy file or something to force the program to use the weakly named assembly?  Or do I have to recompile the program to reference the weakly named assembly?  (These assembles are purchased from a 3rd-party.  I have the source to them but I don't have the company's private key to strongly name my own build of them with the same key.)
Thanks,
Phil

A: You should add the assemblies to the Verification skip list by running sn -Vr in the Visual Studio Command Prompt.
This will tell the runtime not to verify the assemblies' signatures.
For security reasons, you should remove them when you finish.

A: Just changing the [AssemblyVersion] of the debug version would be the quick fix.  Running gacutil.exe to temporarily remove the assembly from the GAC would be another.


text:
Q: HLookup - Run-time error 424 - Object required i'm basic at VBasic. Would like some help in an error (damn, appeared suddenly without changing nothing). Found some questions similar to mine, but couldn't resolve the problem. Here's the error line.
Camposcomplementares.Portar1.Text = Application.WorksheetFunction.HLookup(Sheets("Admin_Lists").Range("BH45"), Sheets("Admin_Lists").Range("BB11:BG38"), 14, False)

After that : Camposcomplementares.Show -> opens the userform (if it wasn't the error)
Camposcomplementares = userform
Portar1 = is a textbox's name in the userform (double checked for errors in name)
Range("BH45") is an integer number - checked and it's ok
Range("BB11:BG38") = is the table with the values
Notes : - checked the similar formula in excel and it works ok.
        - dont use "explicit" and no variable defined
Hope is enough for someone to help me.It worked before :( . Tkx.

A: Try to start with something really small. Like this:
Public Sub TestMe()
    With Application.WorksheetFunction
       Debug.Print .HLookup(Sheets("A_L").Range("A1"), Sheets("A_L").Range("B1:C100"), 2,0)
    End With
End Sub

and to make it work.
Then slowly exchange the Range("A1") with Range("BH45") and Range("B1:C100") with Range("B1:C100"). Does it work? Is it because Range(BH45) has a !Div/0 error or sheet "A_L" does not exist?
Probably it works so far. You may continue debugging, writing something like this:
Public Sub TestMe2()
    Camposcomplementares.Portar1.Text = "Something"
End Sub

Does it work? How do you refer to the UserForm? Where is the text located? In the userform or in a module?


text:
Q: IE can't place focus and cursor on input text boxes after focusing out of tinyMCE editor I've just reproduced the same error in tinyMCE fiddle.
here's the link : http://fiddle.tinymce.com/39daab
There are brief descriptions on the page...
following the steps will show you the error I run into...
I've been trying to solve this problem by my own, but I think I'm not able to.
I looked through tinyMCE documentation and bug report pages like a thousand of times,
but I couldn't get a hint for this.
It's really weird that IE can place focus, but can't cursor on input elements.
You can check the current focused element by selecting $('*:focus')...
focusing does work, but placing cursor doesn't.

A: Posting this in case it helps someone else who runs into this. I had a similar issue. It seems like IE9+ has a bug where if the focus is on a dom element that is removed, the focus event on other elements stops working.
In my case I was able to resolve it by doing an $('input').focus() before destroying the rich text editor (CKEditor).
Bug is outlined here:
Why can I sometimes not type into my <input> in IE?
and here:
http://bugs.jqueryui.com/ticket/9122

A: Another similar issue: on our web page we hide and show divs using a fast animation ( .slideDown(100) / .slideUp(100) ). The divs contain input boxes that randomly will fail to get focus on IE9, 10 and 11.
The input boxes show up, but the cursor doesn't change when you hover over them, nothing happens if you click on the input, it's like the input doesn't exist. Sometimes if you hit the tab key it will fix itself and you can focus and get a cursor in the input.
When we removed the animation, or increased the time (to e.g. .slideDown(500) ) it seemed like it started working - we couldn't reproduce the issue.

A: I reproduce the same problem with tinyMce 4.4.0 version.
window.focus() resolve the problem in iE11.
function closeTinyMce(){
  tinymce.remove();
  setTimeout(function(){
    window.focus();
  },10)
}

http://fiddle.tinymce.com/DWfaab/1


text:
Q: Slim Framework - PHP not routing correctly - any ideas? I am running a Web Server using XAMPP - it runs on 'http://localhost/mvc-framework/public/' as the root.
But when I try and navigate using the 'Contact' link it goes to 'http://localhost/contact' and I get a '404' error.
My routes.php currently looks like this:
<?php
// Routes

$app->get('mvc-framework/public/contact', function ($request, $response, $args) {
    // Render index view
    return $this->view->render($response, 'contact-form.phtml', $args);
});

$app->get('/[{name}]', function ($request, $response, $args) {
    // Sample log message
    $this->logger->info("Slim-Skeleton '/' route");

    // Render index view
    return $this->view->render($response, 'about.phtml', $args);
});

Is there somewhere obvious I am going wrong?

A: The public/ directory is only the DocumentRoot of the webserver and therefore should never be part of the url base path.
The correct url: http://localhost/mvc-framework/
When you run your Slim app within a sub-directory of the DocumentRoot, you also have to define the Slim basePath. In your specific case it's /mvc-framework:
$app->setBasePath('/mvc-framework');

The routes should be defined without the base path:
<?php

$app->get('/contact', function ($request, $response, $args) {
    // Render index view
    return $this->view->render($response, 'contact-form.phtml', $args);
});

Also make sure to add the correct .htaccess files when you run a Slim app within a sub-directory of the DocumentRoot. Slim 4 BasePath


text:
Q: How to delete snapshot based on the description? I am trying to delete any previous snapshot with description having tags_description , how can i do so ? The following code throws me error :
def call_cleaner(data):
    regions = ['us-west-2', 'eu-central-1', 'ap-southeast-1']
for index, region in enumerate(regions):
    for ip_address, tags_descrip, regions_az, volume_id in data[index]:
        ec2 = boto3.resource('ec2', region, aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY, )
        delete_snapshot = ec2.describe_snapshots(Filters=tags_descrip)
        for snap in delete_snapshot['Snapshots']:
            print "Deleting snapshot %s" % snap['SnapshotId']
            ec2.delete_snapshot(SnapshotId=snap['SnapshotId'])

ERROR
delete_snapshot = ec2.describe_snapshots(Filters=tags_descrip)
AttributeError: 'ec2.ServiceResource' object has no attribute 'describe_snapshots'

A: In order to use these functions in boto3 you need to use ec2 client which can be initialized like this: client = boto3.client('ec2'). (Basically, replace ec2.* with client.*


text:
Q: Парсинг данных с сайта Django Я написал простой парсер, который с книжного сайта хватает авторов книг и загружает их в мою базу данных. Вопросы следующие:
-Куда мне его поместить (догадываюсь, в models.py)?
-Как оформить правильно? (представляю, как класс)
-Как вызывать его по нажатию кнопки в админке?
class Parsing:

    def __init__(self, page):
        self.page = page
        self.html_doc = urlopen(f'https://www.litmir.me/bs?rs=5%7C1%7C0&o=20&p={self.page}').read()
        self.soup = BeautifulSoup(self.html_doc)
        self.cards = self.soup.find_all('div', itemtype='http://schema.org/Book')

    def get_author(self, card):
        return card.find('span', itemprop='author').find_all('a')[0].get_text()

    def load_authors(self):
        for card in self.cards:
            Author.objects.create(f'{self.get_author(card)}')


text:
Q: Machine learning random forest classifier data=pd.DataFrame({'gender':['m','f','m'],'icds':[['i10'],['i20','i30'],['i40']],'med':[[1,2,4,5],[3,4,6],[5,6,7]]})

Which machine learning algorithm shall I use for this type of data? I think of the inconsistent length of arrays in the med column. Whenever I try to pass it in the random forest classifier, med column is basically the labels.

A: Yeah, you are right, the algorithm you should use is RF or logistic also should be good. The issue is with the inconsistent length of data in 'med' column. If its not necessary you can use the following functions to average/sum out the numerical data in med columns arrays:
def sum_out(x):
return np.nansum(x)

def avg_out(x):
    return np.nanmean(x)
data=pd.DataFrame({'gender':['m','f','m'],'icds':[['i10'],['i20','i30'],['i40']],'med':[[1,2,4,5],[3,4,6],[5,6,7]]})
data['med_sum']= data['med'].map(sum_out)
data['med_avg']= data['med'].map(avg_out)

A: You can actually add those meds as features, something like this:
data=pd.DataFrame({'gender':['m','f','m'],'icds':[['i10'],['i20','i30'],['i40']],'med':[['xanex','isotopin'],['cz3','hicet','t-montair'],['t-montair','xanex']]})

all_med= list(np.unique(flatten(list(data['med'].values))))

for meds in all_med:
    med_list=[]
    for i in xrange(len(data)):
        d= data['med'][i]
        if meds in d:
            med_list.append(1)
        else:
            med_list.append(0)
    data[meds]=med_list

Output:
  gender        icds                      med  cz3  hicet  isotopin  \
0      m       [i10]        [xanex, isotopin]    0      0         1
1      f  [i20, i30]  [cz3, hicet, t-montair]    1      1         0
2      m       [i40]       [t-montair, xanex]    0      0         0

   t-montair  xanex
0          0      1
1          1      0
2          1      1


text:
Q: Hardware based magnitude for accelerometer In the past I've taken the magnitude of an accelerometer digitally, using the following equation:
magnitude = sqrt(x^2 + y^2 + z^2)

However, in order to do this I need to sample all three accelerometer planes (x, y, and z) which takes up three channels in my DAQ. This is fine for a single accelerometer, but now that I'm starting to use multiple accelerometer this means I need a lot of channels!
Seeing as I'm just taking the magnitude anyway, I was wondering how I would perform the same calculation in hardware, prior to sampling the planes, so that I only have to sample one channel per accelerometer as opposed to three.
Would someone be able to show me what the circuitry would look like for me to perform this magnitude calculation?
Thanks in advance.

A: This is a classic problem, and has a classic answer.

simulate this circuit – Schematic created using CircuitLab
While straightforward, it is marked by considerable inaccuracies if you try for a wide dynamic range. 1% accuracy is pretty much standard. Such multipliers are still available, such as theAnalog Devices AD532.


text:
Q: using a legacy (VB6) DLL in new visual studio express (C++ prefrred) project I've got an old legacy application for communicating via serial port to an embedded controller communications bus. that someone else developed.
The application is written in VB6, and is structured as two projects - a DLL to handle the connection and communications logic, with an application GUI project.
I was hoping to be able to write a new application GUI (in C++ ideally) to use the existing DLL as-is, but I'm having lots of problems working out how to import it.
So I'm wondering, is it even going to be possible to use this old DLL into a C++ project as is? or is it possible to import into a C# project? or a VB.NET project? (would prefer not to use VB, but can if I have to)
Where I am now:
I have the existing compiled executable and DLL, and these run on my system.
I also have the project files, and they're all readable in notepad++ but I don't have VB6, and importing the project into visual studio VB.NET 2008 express isn't at all straightforward. Especially not without a working example to dig through and play with first (DLL project may be importable, but has 50+ things indicated as needing changing in the upgrade report. It also seems to be ignoring three .cls files that look very important to my not particularly VB6-savvy eyes... The application project has a message in the upgrade report about something "missing a design time license" and the only project files that actually seem to come into the project explorer for imported project is the project file itself, and the assembly info file.)
Most examples of how to import a DLL into VS C++ assume you have a solution with the DLL project all compiling nicely alongside your project that will use it. Or at least a .DLL and .lib and .h file... I spoke with the original developer of the code (in another city, we don't work directly) and got a .lib to match my .dll, but still have no .h file.
I'm usually fine to bash through something new, but without a baseline working example of the project even in VB6 that I can get my understanding from, it makes this very hard. Also a lack of similar questions anywher google can find them on the net makes me wonder if this is something i should be even attempting.
I'm working on getting a non-express copy of visual studio if that will make any difference (express worked fine for everything up until now so I never needed anything more) but that will take a number of weeks, most likely.
Any suggestions would be very much appreciated.
thanks for reading!

A: I have to disclaim this as I have no experience doing it, but merely found that it should be possible given some reading of the docs on the subject.
I'm not sure you'll have much luck with the VB to .NET import/conversion process if there is a lot of low level stuff going on. The existing dll is likely a COM object, no?
It seems like there is some MSDN documentation to get you started from C++ using COM object dlls - and it looks like the #import directive will generate some .h (header) files as well.
http://msdn.microsoft.com/en-us/library/8etzzkb6.aspx
So I would try simply adding an #import directive for it.
#import "somelibrary.dll"
and see what visual studio generates.
Have a look at the following example as well, (copied shamelessly from another forum)
 #import "F:\proj\VB6\ActiveXDLL\VBTestDLL.dll"
 using namespace VBTestLib;

void CDialogTestDlg::OnButton1()
{

 HRESULT hresult;
 CLSID clsid;
 _CTest *t; // a pointer to the CTest object
 _bstr_t bstrA = L"hello";
 _bstr_t bstrB = L" world";
 _bstr_t bstrR;
 ::CoInitialize(NULL);
  hresult=CLSIDFromProgID(OLESTR("VBTestLib.CTest"), &clsid);
  hresult= CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,
                               __uuidof(_CTest),(LPVOID*) &t);
  if(hresult == S_OK)
  {
     bstrR  = t->vbConcat(bstrA , bstrB);
     AfxMessageBox((char*)bstrR);
   }
 }


text:
Q: CUDA functions failing after initializing Spinnaker API I am using the C++ Spinnaker API to capture images from cameras, and then using CUDA to process the images. The CUDA code works if I do not call the Spinnaker API, but once I call the Spinnaker API various CUDA functions start crashing (such as cudaMemset, or cudaMemcpy, or my custom CUDA kernels). The Spinnaker API works if I do not use CUDA code, so it is like the two API's cannot co-exist. The error is consistently:
terminate called after throwing an instance of 'std::system_error' what():  Bad address

The code looks like this:
// get cameras
SystemPtr system = System::GetInstance();
CameraList camList = system->GetCameras();

// fails on any of the following CUDA functions
cudaMemset(...);
myKernel();
cudaMemcpy(...);

Any ideas what is going on here?

A: Downgrading from spinnaker-2.6.0.160 to spinnaker-2.0.0.146 fixed this issue on ARM64 Ubuntu 18.04.


text:
Q: Create a stored procedure to populate a table from other (multiple) table columns I need to create a stored procedure transaction that will pull data from two tables and create a random integer to populate a third table (dbo.patient_address).
I want the following, but I am having a hard time understanding how to script this as a stored procedure.
dbo.address AddressID = dbo.patient_address AddressID,
dbo.patient PatientID = dbo.patient_address PatientID,
RAND is an integer between 1-3 (see dbo.addresstype) = dbo.patient_address AddressTypeID
Below are create statements of all of these tables.
ADDRESS TABLE -  30000 rows in place (complete data set)
CREATE TABLE [dbo].[ADDRESS](
    [AddressID] [int] NOT NULL,
    [StreetAddress] [varchar](50) NULL,
    [City] [varchar](50) NULL,
    [State] [varchar](50) NULL,
    [PostalCode] [varchar](50) NULL,
 CONSTRAINT [ADDRESS_PK] PRIMARY KEY CLUSTERED
(
    [AddressID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

PATIENT TABLE - 30000 rows in place (complete data set)
CREATE TABLE [dbo].[PATIENT](
    [PatientID] [int] NOT NULL,
    [PatientFName] [varchar](50) NOT NULL,
    [PatientLName] [varchar](50) NOT NULL,
    [GenderID] [int] NOT NULL,
    [DateOfBirth] [date] NOT NULL,
 CONSTRAINT [PATIENT_PK] PRIMARY KEY CLUSTERED
(
    [PatientID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ADDRESS TYPE - 3 choices (home, billing, work) – integer between 1 - 3
CREATE TABLE [dbo].[ADDRESS_TYPE](
    [AddressTypeID] [int] NOT NULL,
    [AddressTypeName] [varchar](10) NOT NULL,
    [AddressTypeDescr] [varchar](10) NULL,
 CONSTRAINT [ADDRESS_TYPE_PK] PRIMARY KEY CLUSTERED
(
    [AddressTypeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

INSERT INTO [dbo].[ADDRESS_TYPE]
([AddressTypeID],[AddressTypeName],[AddressTypeDescr])
Values ('1','Home','Home'), ('2','Bill','Billing'), ('3','Work','Work')

This is the final table that I want to populate from all of the above tables using a stored procedure transaction.
CREATE TABLE [dbo].[PATIENT_ADDRESS](
    [PatientID] [int] NOT NULL,
    [AddressID] [int] NOT NULL,
    [AddressTypeID] [int] NULL,
 CONSTRAINT [PATIENT_ADDRESS_PK] PRIMARY KEY CLUSTERED
(
    [PatientID] ASC,
    [AddressID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

A: Try this:
INSERT INTO PATIENT_ADDRESS
SELECT PatientID, AddressID,
    CONVERT(INT,(ABS(CHECKSUM(NEWID())/2148000000.))*3)+1 AS AddressTypeID
FROM (
    SELECT PatientID, ROW_NUMBER() OVER (ORDER BY PatientID) AS RowNum
    FROM dbo.PATIENT
) x
INNER JOIN (
    SELECT AddressID, ROW_NUMBER() OVER (ORDER BY AddressID) AS RowNum
    FROM dbo.ADDRESS
) y ON x.RowNum = y.RowNum


text:
Q: Quaternion angle - Opengl rendering I have been using a 6dof LSM6DS0 IMU unit (with accelerometer and gyroscope). I am trying to calculate the angle of rotation around all the three axes and Render a 3D cube using opengl to immitate the rotations being done with IMU, like the one in this link. I have previously posted a question here and with the help of the members, I got my solution.
I used Madgwick's quaternion method and rendered a cube, but
Now I have been facing some issues in the result I got,
The quaternion gets updated for every accelerometer and gyroscope value(even for small changes when the IMU is completely static). This causes the cube rendered to rotate when the IMU unit is static. Fix : I compared the current IMU values with previous values and update the quaternion only when there is notable difference. The issues, I am facing currently are,

*

*After a few rotation, when I bring back the IMU to its original position, I am not getting the same initial rendered result, there has been a big change. Why is this happening, what can be done to nullify this effect?

*When the IMU is rotated faster, the rendering is not proper?
Any help could be really appreciated. Thanks in advance.

A: From my experience in the past with things like this, your first problem is because of accumulated error. You can't simply "throw away" sensor data like that and expect it work out. This is because  the sensors you have - a gyro that measures $\omega$ only gives you the rate of change of $\theta$. True, you're using the accelerometer to correct for this, but there will be some error that creeps in (even if you use an EKF)
What I would suggest for smooth movement is to take the raw gyro values, and interpolate using them. Do not render the cube with the instantaneous gyro reading. Rather, have the gyro reading be an "ideal target value" that you smoothly approach (by using something like exponential smoothing)
One nice way to smooth data like this is to use a damped spring system. Use your current state as the "current angle" of the particle, with the "target angle" being the raw gyro value. Propogate the system using the equations of an ideal, critically damped spring:
$$
\delta \phi = \theta_{current} - \theta_{ideal} \\
\alpha_{t} = -\delta\phi - \omega \\
\omega_{t} = \omega_{t - 1} + \alpha_t . \small \Delta t \\
\theta_{current_{t}} = \theta_{current_{t - 1}} + \omega_t.\Delta t + \frac{1}{2}\alpha_t^2
$$
Here, $\delta \phi = \theta_{current} - \theta_{ideal}$  where $\theta_{current}$ is the current angle of the cube, $\theta_{ideal}$ is the ideal position the cube must have (which is the raw gyro value). $\alpha$ is the angular acceleration, $\omega$ the angular velocity, $\theta$ is the angular position.
You will realize that I am simply propogating the spring equation using Euler integration. IF you wish, you can use a better / more numerically stable algorithm such as RK4

A: I wanted to add a comment by I do not have sufficient points to do so. I do not know the model of the IMU, but from a quick search seems to be a rather expensive one, so I assume it is fairly accurate (please feel free to contradict me). The fact that the problem is coupled to a software of which you have not shared any line, makes answering more difficult.
From what you are describing you have an fairly large integration error. What integration method are you using?
The highest is the order of the integration the most accurate the estimation, however it becomes more computationally expensive. You can also use a filtering state estimation method such as the Extended Kalman Filter. But you have to use an IMU model and integration method that are suitable. The task is non-trivial and it falls in the category of the state estimation problem.
A couple of references are Savage for a classical approach or a modern integration is exposed as part of the overall estimation algorithm by Leutenegger. You have to focus to the attitude estimation part.
This is everything I can tell from all the information you gave us.
Cheers
Andrea


text:
Q: HTML bold tag issue -  String text="<b>Interesting ,"+titletext+"\n"+location+"</b>";
    Bundle parameters = new Bundle();
    parameters.putString("message",Html.fromHtml(text).toString());

and am posting it to facebook by
facebookClient.request("me/feed", parameters, "POST");

I want the message posting should be in bold. but its not working
Any correct way to achieve this bold text to wall?
Thanks

A: Unfortunately, feed posting functionality in Facebook Graph API does not support bold or italic formats in the feed.
It is only allowed to attach links, images or videos in your feed.


text:
Q: Vuejs update a value used with v-for dynamically So I'm making an attendance tracker with Vuejs and Vuetify, and I want it to look like this:
A Calender made up of v-card components, and a list of absences read in from a database. I have my API set up and am able to retrieve a list of absences without any issues, but when it comes to putting them on the screen I have some issues. What I want to do is this:
The user selects the month and year. Each card then shows one day of this month. I have a function called getAbsDate(date) that returns a list of absences for the date passed to it. I want it to work something like this in each card:
<v-card min-height="170" tile>
  <v-card-text class="text-center black--text">
    {{i}}
    <v-sheet
      color="blue"
      class="pa-1"
      v-for="abs in getAbsDate(i+'.'+monthsNums[selMonth]+'.'+selYear)"
      :key="abs['id']"
    >{{abs["name"]}}</v-sheet>
  </v-card-text>
 </v-card>

selMonth is the month the user selected, and selYear is the year the user selected. This doesn't work however. I don't get any errors, the cards are just empty. getAbsDate() returns a list of objects. Any ideas as to why this doesn't work?
Thanks!
EDIT
Here is the declaration of my getAbsDate() function.
getAbsDate: function(date) {
  let l = [];
  this.absences.forEach(abs => {
    if (abs["start"] == date) {
      l.push(abs);
    }
    if (abs["end"] == date) {
      l.push(abs);
    }
    let day_start = moment(abs["start"].replace(".", "/"), "DD/MM/YYYY")
          .toDate()
          .getTime();
    let day_end = moment(abs["end"].replace(".", "/"), "DD/MM/YYYY")
          .toDate()
          .getTime();
    let day_date = moment(date.replace(".", "/"), "DD/MM/YYYY")
          .toDate()
          .getTime();
    if (day_start <= day_date && day_date <= day_end) {
     l.push(abs);
    }
  });
  return l;
  }
}

The formatting is not quite right at the .toDate() and the .getTime(), but in my file it is, s it is not the issue.


text:
Q: How to use http to send json I am very new to http commands and apache bench, trying to do a simple benchmark. I had a question about how to send a json file usine httpie.
I saw an old example that used an older cli to do it like this:
http --verbose post example.org file.json --content-type="application/json"

However, I am unsure how to do this in httpie. I know that this part:
http --verbose post example.org

Would remain the same. But I don't know how I would do:
file.json --content-type="application/json

in httpie

A: This is the simplest HTTPie command for sending a JSON file:
$ http example.org @file.json

https://github.com/jkbrzt/httpie#request-data-from-a-filename