text:
Q: How to Store List of selected value from multiselect dropdown list in array in asp.net? I used Bootstrap multiselect dropdown item, in which if I select many values it only select the first values, whats wrong in my code logic.
Asp dropdown list
<asp:dropdownlist  Width="320px" id="drplstGetDb" runat="server"  multiple="Multiple">  </asp:dropdownlist>

Javascript to enable multiple check feature from bootstrap.
$(function() {
    $('[id*=drplstGetDb]').multiselect({
        includeSelectAllOption: true
    });
});

C# Code to store in array.
int[] stopWordArray = new int[drplstGetDb.Items.Count];

foreach(ListItem listItem in drplstGetDb.Items) {
    if (listItem.Selected) {
        int i = 0;
        stopWordArray[i] = Convert.ToInt32(drplstGetDb.Items[i].Value.ToString());
        i++;
    }
}

I am only getting first checked value in array, If I don't use this if if (listItem.Selected) I can Store all values in array. Can anyone suggest about this error,, Specially with Selected Logic. or Alternative to this..

A: Because you are setting
int i = 0

inside the loop, you are setting the first array element of stopWordArray ALL THE TIME, no matter what. Move the
int i = 0

to the outside of the foreach and you should have better luck there.
Try this
int[] stopWordArray = new int[drplstGetDb.Items.Count];
int i = 0;
foreach(ListItem listItem in drplstGetDb.Items)
{
    if (listItem.Selected)
    {
        stopWordArray[i] = Convert.ToInt32(listItem.Value.ToString()); //something like this
        i++;
    }
}

Maybe even easier would be to get rid of the int array and use a list
List<int> stopWordArray = new List<int>();

foreach (ListItem listItem in drplstGetDb.Items)
 {
     if (listItem.Selected)
      {
          stopWordArray.Add(Convert.ToInt32(listItem.Value.ToString()));
      }
 }


text:
Q: C# Instance of Lists In Data Model I've not been able to find an answer so am posting this. If this has already been answered then please point me in that direction.
I have a class model in MVC as below:
public class SearchModel
{
    public int id { get; set; }
    public string ActivityName { get; set; }
    public string Subject { get; set; }
    public string Level { get; set; }
    public List<LocationModel> Locations { get; set; }
}

public class LocationModel
{
    public int LocationID {get; set;}
    public string Location { get; set; }
}

I am trying to populate the Locations list in my code but can't seem to get the code to create an instance of it properly.
I have a List of SearchModel as there are multiple items. This is populating fine by doing the following:
List<SearchModel> items = new List<SearchModel>();

and then looping through the following to populate the model.
SearchModel item = new SearchModel();
item.ActivityName = reader["ActivityName"].ToString();
item.Level = reader["LevelNames"].ToString();
item.Subject = reader["SubjectNames"].ToString();
item.id = Convert.ToInt32(reader["ActivityID"]);
items.Add(item);

How do I add the data to the Locations List in the SearchModel? This will contain multiple records also.

A: item.Locations = new List<LocationModel>();

you can add some data in it
var myLocationModel = new LocationModel();
myLocationModel.Location = "Africa";
item.Locations.Add(myLocationModel);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Tensorflow Audio Recognition - Training Data I want to test out Tensorflow's audio recognition by training my own set of data. Following the instructions from the Tensorflow Simple Audio Recognition Tutorial:
https://www.tensorflow.org/tutorials/sequences/audio_recognition
I receive an error when I run the train.py:
SyntaxErorr:  'unicodescape' codec can't decode byes in position 2-3...
I changed the --data_dir=/your/data/folder/ to a folder in my computer with my own set of data by like this in the train script:
parser.add_argument(
  '--data_dir',
  type=str,
  default='C:\Users\Matthew Chen\Documents\GSF\ALL',
  help="""\
  Where to download the speech training data to.
  """)

where ALL is the folder with all of my WAV files.
I assume that I have not disabled --data_url= correctly but the documentation does not seem to provide enough detail onto how to disable it.
This is what the --data_url=  looks like:
parser.add_argument(
  '--data_url',
  type=str,
  pylint: disable=line-too-long
  #default='C:\Users\Matthew Chen\Documents\GSF\...\ALL',
  # pylint: enable=line-too-long
  help='Location of speech training data archive on the web.')

Is it possible that I have to input a specific string to disable it?


text:
Q: Find rows with the longest matching string I have a dataframe composed of groups with corresponding animals as a string:
data = data.frame(group = c(1,2,3,4), animal = c("cat, dog, horse, mouse", "cat, dog, horse", "cat, dog,", "cat, dog, frog, cow"))

I would like to return groups where the longest string match. In this example, group 1 and 2 would match, as 3 out of 4 animals are the same. Also group 2 and 3 would match as 2 out of 3 animals match. But, no groups with match with group 4 because only 2 out of 4 animals match.
I'd like to return a dataframe like this showing the matching groups:
group_a group_b
   1       2
   2       3

I'm not sure if this is possible. I've looked into how to match partial strings but struggling to find similar examples to adapt. Any ideas?
Thank you.

A: Is this what you are looking for?
lst <- regmatches(data$animal,gregexpr("\\w+",data$animal))

u <- lapply(seq_along(lst)[-length(lst)],
            function(p) subset(data.frame(group_a = p,
                                          group_b = seq_along(lst)[-(1:p)],
                                          longestmatch = sapply(seq_along(lst)[-(1:p)],
                                                                function(q) length(intersect(lst[[p]],lst[[q]])))),
                               longestmatch == max(longestmatch)))

res <- do.call(rbind,c(make.row.names = FALSE,u))

such that
> res
  group_a group_b longestmatch
1       1       2            3
2       2       3            2
3       2       4            2
4       3       4            2

A: Given your comment about wanting to match words, here is the start of a text approach that might be helpful. Basically we want to split out each word and count the occurrence in each statement.
library(tidytext)
library(dplyr)
library(tidyr)

dtm <- data %>%
  unnest_tokens("word", "animal", token = "regex", pattern = ",") %>%
  mutate(word = str_trim(word)) %>%
  count(group, word) %>%
  pivot_wider(names_from = "word", values_from = "n", values_fill = list(n = 0))

What you know have is a document term matrix. We have now changed your problem from a regex matching one to finding the vectors with the most matches.
# A tibble: 4 x 7
  group   cat   dog horse mouse   cow  frog
  <dbl> <int> <int> <int> <int> <int> <int>
1     1     1     1     1     1     0     0
2     2     1     1     1     0     0     0
3     3     1     1     0     0     0     0
4     4     1     1     0     0     1     1

An easy thing to do would be to extract the matrix part and just multiply.
mat <- as.matrix(select(dtm, -group))
matches <- (mat %*% t(mat))

This would give you a matrix for each group matches. For example, row 1, column 2 shows the three word matches (cat, dog, and horse) between groups 1 and 2.
matches
     [,1] [,2] [,3] [,4]
[1,]    4    3    2    2
[2,]    3    3    2    2
[3,]    2    2    2    2
[4,]    2    2    2    4

Then you can play with things from there. For example, pulling the row and column IDs and then the upper triangular part of the matrix can give you a summary. I think from here it is just a matter of how you want to filter the table.
data.frame(row = c(row(matches)),
           col = c(col(matches)),
           value = c(matches),
           upper = c(upper.tri(matches))) %>%
  filter(upper == TRUE)

  row col value upper
1   1   2     3  TRUE
2   1   3     2  TRUE
3   2   3     2  TRUE
4   1   4     2  TRUE
5   2   4     2  TRUE
6   3   4     2  TRUE


text:
Q: Prove that $\sum_{r=1}^{3k} r \tan(60r)^{\text{o}}=-k\sqrt{3}$
Prove that $$\sum_{r=1}^{3k} r \tan(60r)^{\text{o}}=-k\sqrt{3}$$

I did this by re-writing the sum as
$$\sum_{r=1}^{3k} r \tan(60r)^{\text{o}}=-k\sqrt{3} = \sum_{r=1}^{k} \left((3r-2)\tan(60(3r-2))^{\text{o}} + (3r-1)\tan(120(3r-1))^{\text{o}} + 3r\tan(180(3r))^{\text{o}} \right)$$
Then note that the last term is $0$ for all $r$
Next, for any $r$, $\tan(60(3r-2))^{\text{o}} = - \tan(120(3r-1))^{\text{o}}$.
Therefore,
$$\sum_{r=1}^{3k} r \tan(60r)^{\text{o}} = \sum_{r=1}^{k} \left((3r-2)\tan(60)^{\text{o}} - (3r-1)\tan(60)^{\text{o}} \right)$$
$$= \sum_{r=1}^{k} -\tan(60)^{\text{o}}$$
$$= -k\sqrt{3}$$
Two things with this:

*

*Is everything fully correct with what I have done?

*This was for two marks on an exam, is there an easier way??

A: Everything that you did was correct.
The easier approach is by induction, with the $k = 1$ case proved by manual inspection.
Inductively assume that
$\displaystyle \sum_{r=1}^{3K} r\tan(r \times 60)^\circ = -K\sqrt{3}.$
To show that the assertion then applies when taking the summation from $r=1$ to $r = (3[K+1])$ is it sufficient to verify that
$\displaystyle \sum_{r = 3K+1}^{3K+3} r\tan(r \times 60)^\circ = -\sqrt{3}.$
Following much the same analysis as you did, the term by term summation of the above three terms is
$\displaystyle (K+1)\sqrt{3} + (K+2)(-1)\sqrt{3} + 0 = -\sqrt{3}.$


text:
Q: Material UI Element css not working, why?
What could be going wrong for the css to not be working(The top bar - heading overlap)?
here is the component:
<FormControl fullWidth>
  {/* eslint-disable-next-line */}
  <InputLabel id="simple-select-label">GT Template</InputLabel>
  <Select labelId="simple-select-label" id="demo-simple-select-label" onChange={handleChange} value={gtTemplate}>
    <MenuItem value="employee/addemployeeimport">Add Employee Importer</MenuItem>
    <MenuItem value="lop-days">Employee LOP</MenuItem>
    <MenuItem value="lop-reversal">LOP Reversal Importer</MenuItem>
    <MenuItem value="employee/bankdetails">Employee Bank Details</MenuItem>
    <MenuItem value="loan-detail">Employee Loan Details</MenuItem>
    <MenuItem value="employee/employeecategory">Employee Category</MenuItem>
    <MenuItem value="resignation">Employee Resignation</MenuItem>

  </Select>
</FormControl>

A: You need to add label attribute to the Select element
<Select labelId="simple-select-label" id="demo-simple-select-label" onChange={handleChange} value={gtTemplate} label="GT Template">

And this may be usefull too https://mui.com/material-ui/react-select/


text:
Q: How to apply Hyperlink TextDecorations property via style in XAML for WPF I have this xaml
<Button.Content>
  <Hyperlink>
    <Hyperlink.TextDecorations>
      <TextDecoration>
        <TextDecoration.Pen>
          <Pen Thickness="0" />
        </TextDecoration.Pen>
      </TextDecoration>
    </Hyperlink.TextDecorations>
    <Run Text="jumped over" />
  </Hyperlink>
</Button.Content>

I need to apply this from a style. My style looks like this
<Style x:Key="Button_Link" TargetType="{x:Type Hyperlink}">
  <Setter Property="TextDecorations" >
    <Setter.Value>
      <TextDecorations>
        <TextDecoration>
          <TextDecoration.Pen>
            <Pen Thickness="0" />
          </TextDecoration.Pen>
        </TextDecoration>
      </TextDecorations>
    </Setter.Value>
  </Setter>
</Style>

This is causing an error in my style file which is a ResourceDictionary used for loose XAML
I am applying the style to Hyperlink like this
Style="{DynamicResource Button_Link}"

A: You don't need to set the pen thickness to zero to remove the underline you can using the following style:
<Style x:Key="Button_Link" TargetType="{x:Type Hyperlink}">
     <Setter Property="TextDecorations" Value="None" />
</Style>

In case this is just a simplified example, you can fix your existing style by replacing <TextDecorations> with <TextDecorationsCollection> like so:
<Style x:Key="Button_Link" TargetType="{x:Type Hyperlink}">
    <Setter Property="TextDecorations">
        <Setter.Value>
            <TextDecorationCollection>
                <TextDecoration>
                    <TextDecoration.Pen>
                        <Pen Thickness="0" />
                    </TextDecoration.Pen>
                </TextDecoration>
            </TextDecorationCollection>
        </Setter.Value>
    </Setter>
</Style>

Also, although not needed, your style is static so can be applied like
Style="{StaticResource Button_Link}"


text:
Q: Creating dynamic nested dictionary of counts I have a text file abc.txt:
abc/pqr/lmn/xyz:pass
abc/pqr/lmn/bcd:pass

I need to parse these statements and output should be in nested dictionary as below:
{'abc':{'pqr':{'lmn':{'xyz':{'pass':1},{'bcd':{'pass':1}}}}}}

where 1 is 'pass' count.
I'm able to do as much as this:
import re

d={}
p=re.compile('[a-zA-z]+')
for line in open('abc.txt'):
    for key in p.findall(line):
        d['key']={}

A: Check out the setdefault method on dictionaries.
d = {}
d.setdefault('pqr', {}).setdefault('lmn', {}).setdefault('xyz', {})['pass'] = 1
d.setdefault('pqr', {}).setdefault('lmn', {}).setdefault('bcd', {})['pass'] = 1
d

gives
{'pqr': {'lmn': {'bcd': {'pass': 1}, 'xyz': {'pass': 1}}}}

A: Here's an updated version of my answer in which leaves of the tree data-structure are now different from those in rest of it. Instead of the tree being strictly a dict-of-nested-dicts, the "leaves" on each branch are now instances of a different subclass of dict named collections.Counter which are useful for counting the number of times each of their keys occur. I did this because of your response to my question about what should happen if the last part of each line was something other than ":pass" (which was "we have to put new count for that key").
Nested dictionaries are often called Tree data-structures and can be defined recursively — the root is a dictionary as are the branches. The following uses a dict subclass instead of a plain dict because it makes constructing them easier since you don't need to special case the creation of the first branch of next level down (except I still do when adding the "leaves" because they are a different subclass, collections.Counter).
from collections import Counter
from functools import reduce
import re

# (Optional) trick to make Counter subclass print like a regular dict.
class Counter(Counter):
    def __repr__(self):
        return dict(self).__repr__()

# Borrowed from answer @ https://stackoverflow.com/a/19829714/355230
class Tree(dict):
    def __missing__(self, key):
        value = self[key] = type(self)()
        return value

# Utility functions based on answer @ https://stackoverflow.com/a/14692747/355230
def nested_dict_get(nested_dict, keys):
    return reduce(lambda d, k: d[k], keys, nested_dict)

def nested_dict_set(nested_dict, keys, value):
    nested_dict_get(nested_dict, keys[:-1])[keys[-1]] = value

def nested_dict_update_count(nested_dict, keys):
    counter = nested_dict_get(nested_dict, keys[:-1])
    if counter:  # Update existing Counter.
        counter.update([keys[-1]])
    else:  # Create a new  Counter.
        nested_dict_set(nested_dict, keys[:-1], Counter([keys[-1]]))

d = Tree()
pat = re.compile(r'[a-zA-z]+')
with open('abc.txt') as file:
    for line in file:
        nested_dict_update_count(d, [w for w in pat.findall(line.rstrip())])

print(d)  # Prints like a regular dict.

To test the leaf-counting capabilities of the revised code, I used the following test file which includes the same line twice, once ending again with :pass and another ending in :fail.
Expanded abc.txt test file:
abc/pqr/lmn/xyz:pass
abc/pqr/lmn/bcd:pass
abc/pqr/lmn/xyz:fail
abc/pqr/lmn/xyz:pass

Output:
{'abc': {'pqr': {'lmn': {'bcd': {'pass': 1}, 'xyz': {'fail': 1, 'pass': 2}}}}}

A: If i understand your question:
sources = ["abc/pqr/lmn/xyz:pass", "abc/pqr/lmn/bcd:pass", "abc/pqr/lmn/xyz:pass"]

def prepare_source(source):
    path, value = source.split(':')
    elements = path.split('/')
    return elements, value

def add_key(elements, value):
    result = dict()
    if len(elements) > 1:
        result[elements[0]] = add_key(elements[1:], value)

    else:
        result[elements[0]] = {value: 1}

    return result

# base merge function get from here:
# http://stackoverflow.com/questions/7204805/dictionaries-of-dictionaries-merge
def merge(a, b, path=None):
    "merges b into a"
    if path is None: path = []
    for key in b:
        if key in a:
            if isinstance(a[key], dict) and isinstance(b[key], dict):
                merge(a[key], b[key], path + [str(key)])
            elif isinstance(a[key], int) and isinstance(b[key], int):
                a[key] += b[key]
            else:
                raise Exception('Conflict at %s' % '.'.join(path + [str(key)]))
        else:
            a[key] = b[key]
    return a

result = dict()

for source in sources:
    result = merge(result, add_key(*prepare_source(source)))

print result

Output will be:
{'abc': {'pqr': {'lmn': {'bcd': {'pass': 1}, 'xyz': {'pass': 2}}}}}


text:
Q: how to remove null pointerException in android? @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
         if(!ConstantVariable.isfilterOccured){
             View v = convertView;
            if (v == null) {
                LayoutInflater mInflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = mInflater.inflate(R.layout.row_listitem, null);
            }

            final TextView platFormName = (TextView) v
                    .findViewById(R.id.item_platform);

            final TextView schDepart = (TextView) v
                    .findViewById(R.id.item_schDepart);
            final TextView expDepart = (TextView) v
                    .findViewById(R.id.item_expectdepart);
            final TextView arrival = (TextView) v
                    .findViewById(R.id.item_arrival);
            final TextView exparrival = (TextView) v
                    .findViewById(R.id.item_expertarrival);
            final TextView stationName = (TextView) v
                    .findViewById(R.id.item_stationName);
            final ImageView alertStatusImage = (ImageView) v
                    .findViewById(R.id.alertStatus);

            final String platformValue = deparaturedaseboarddto.get(position).getPlatformNo();
            final String schDepartValue= deparaturedaseboarddto.get(position).getSchDepart();
            final String schExpectValue= deparaturedaseboarddto.get(position).getExpDepart();
            final String arrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
            final String exparrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
           String stationNameValue= deparaturedaseboarddto.get(position).getDestinationStation().getStationName();
           if(deparaturedaseboarddto.get(position).getAlertsId()!=0){
               alertStatusImage.setVisibility(View.VISIBLE);
           }else {
               alertStatusImage.setVisibility(View.INVISIBLE);
           }

            platFormName.setText(platformValue);

            schDepart.setText(schDepartValue);
            expDepart.setText(schExpectValue);
            arrival.setText(arrivalValue);
            exparrival.setText(exparrivalValue);
            stationName.setText(stationNameValue);
            if (position%2==0) {
                Log.d("--------", "old");
                v.setBackgroundColor(Color.parseColor("#FFFFFF"));
            } else {
                Log.d("--------", "even");

                v.setBackgroundColor(Color.parseColor("#f3f3f3"));
            }
            return v;
         }else {
             View vv = convertView;

                if (vv == null) {
                    LayoutInflater mInflater = (LayoutInflater) context
                            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    vv = mInflater.inflate(R.layout.filterdashboard, null);
                }

                final TextView platFormName = (TextView) vv
                        .findViewById(R.id.platFormId);

                final TextView destinationName = (TextView) vv
                        .findViewById(R.id.destinationStationName);
                final TextView filterStationName = (TextView) vv
                        .findViewById(R.id.filterStationNameId);
                final TextView toSchArrival = (TextView) vv
                        .findViewById(R.id.toschArrivalID);
                final TextView toExpArrival = (TextView) vv
                        .findViewById(R.id.toExpArrivalID);
                final TextView destinationSchArrival = (TextView) vv
                        .findViewById(R.id.destSchArrivalID);
                final TextView destinationExpArrival = (TextView) vv
                        .findViewById(R.id.destExpArrivalID);

                final TextView schDepart = (TextView) vv
                        .findViewById(R.id.schDepartID);
                final TextView expDepart = (TextView) vv
                        .findViewById(R.id.expDepartID);

                final ImageView alertStatusImage = (ImageView) vv
                        .findViewById(R.id.alertStatus);

                final String platformValue = deparaturedaseboarddto.get(position).getPlatformNo();
                final String toSchArrivalValue= deparaturedaseboarddto.get(position).getToSchArrival();
                final String toExpArrivalValue= deparaturedaseboarddto.get(position).getToExpArrival();
                final String destSchArrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
                final String destExpArrivalValue= deparaturedaseboarddto.get(position).getDestExpArrival();

                final String schDepartValue= deparaturedaseboarddto.get(position).getSchDepart();
                final String expDepartValue= deparaturedaseboarddto.get(position).getExpDepart();
               String destinationStationNamValue= deparaturedaseboarddto.get(position).getDestinationStation().getStationName();
               String filterStationNameValue= deparaturedaseboarddto.get(position).getFilteredStation().getStationName();

               if(deparaturedaseboarddto.get(position).getAlertsId()!=0){
                   alertStatusImage.setVisibility(View.VISIBLE);
               }else {
                   alertStatusImage.setVisibility(View.INVISIBLE);
               }

                platFormName.setText(platformValue);

                destinationName.setText(destinationStationNamValue);
                filterStationName.setText(filterStationNameValue);
                toSchArrival.setText(toSchArrivalValue);
                toExpArrival.setText(toExpArrivalValue);
                destinationSchArrival.setText(destSchArrivalValue);
                destinationExpArrival.setText(destExpArrivalValue);
                schDepart.setText(schDepartValue);
                expDepart.setText(expDepartValue);

                if (position%2==0) {
                    Log.d("--------", "old");
                    vv.setBackgroundColor(Color.parseColor("#FFFFFF"));
                } else {
                    Log.d("--------", "even");

                    vv.setBackgroundColor(Color.parseColor("#f3f3f3"));
                }
                return vv;
         }
    }

Hi
I am getting null pointer exception.I know this will come when I am trying to access something from null value .But I don't know how to remove that .I will explain my problem .I have a list view I need to show data on listview which is coming from service.Actully I take one condition   if(!ConstantVariable.isfilterOccured){ intially isfilterOccured is false .it goes inside this condition
if (v == null) {
                    LayoutInflater mInflater = (LayoutInflater) context
                            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    v = mInflater.inflate(R.layout.row_listitem, null);
                }

But when I call another webservice if(!ConstantVariable.isfilterOccured){ intially isfilterOccured is true  why it is not going inside the condition that is the reason I am getting null.
View vv = convertView;

                    if (vv == null) {
                        LayoutInflater mInflater = (LayoutInflater) context
                                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        vv = mInflater.inflate(R.layout.filterdashboard, null);
                    }

then it not find this item
  final TextView platFormName = (TextView) vv
                            .findViewById(R.id.platFormId);

please see update:
11-02 06:42:30.634: E/AndroidRuntime(743): FATAL EXCEPTION: main
11-02 06:42:30.634: E/AndroidRuntime(743): java.lang.NullPointerException
11-02 06:42:30.634: E/AndroidRuntime(743):  at com.firstgroup.components.DepartureListAdapter.getView(DepartureListAdapter.java:156)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.AbsListView.obtainView(AbsListView.java:2012)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.ListView.onMeasure(ListView.java:1155)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.View.measure(View.java:12603)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.RelativeLayout.measureChild(RelativeLayout.java:579)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:392)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.View.measure(View.java:12603)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.View.measure(View.java:12603)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.View.measure(View.java:12603)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
11-02 06:42:30.634: E/AndroidRuntime(743):  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2072)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.View.measure(View.java:12603)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1044)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.os.Looper.loop(Looper.java:137)
11-02 06:42:30.634: E/AndroidRuntime(743):  at android.app.ActivityThread.main(ActivityThread.java:4340)
11-02 06:42:30.634: E/AndroidRuntime(743):  at java.lang.reflect.Method.invokeNative(Native Method)
11-02 06:42:30.634: E/AndroidRuntime(743):  at java.lang.reflect.Method.invoke(Method.java:511)
11-02 06:42:30.634: E/AndroidRuntime(743):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-02 06:42:30.634: E/AndroidRuntime(743):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-02 06:42:30.634: E/AndroidRuntime(743):  at dalvik.system.NativeStart.main(Native Method)

I am getting exception on this line
platFormName.setText(platformValue);
because platFormName is null .I think it is null because it id not use this xml
LayoutInflater mInflater = (LayoutInflater) context
                                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        vv = mInflater.inflate(R.layout.filterdashboard, null);

platFormId defined in this filterdashboard.xml
working like that
public class DepartureListAdapter extends BaseAdapter{
    ArrayList<Deparaturedaseboarddto> deparaturedaseboarddto;
    private Context context;
    public DepartureListAdapter( Context context, ArrayList<Deparaturedaseboarddto> deparaturedaseboarddto){
        this.deparaturedaseboarddto=deparaturedaseboarddto;
        this.context = context;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return deparaturedaseboarddto.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return deparaturedaseboarddto.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
         if(!ConstantVariable.isfilterOccured){
             View v = convertView;
            if (v == null) {
                LayoutInflater mInflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = mInflater.inflate(R.layout.row_listitem, null);
            }

            final TextView platFormName = (TextView) v
                    .findViewById(R.id.item_platform);

            final TextView schDepart = (TextView) v
                    .findViewById(R.id.item_schDepart);
            final TextView expDepart = (TextView) v
                    .findViewById(R.id.item_expectdepart);
            final TextView arrival = (TextView) v
                    .findViewById(R.id.item_arrival);
            final TextView exparrival = (TextView) v
                    .findViewById(R.id.item_expertarrival);
            final TextView stationName = (TextView) v
                    .findViewById(R.id.item_stationName);
            final ImageView alertStatusImage = (ImageView) v
                    .findViewById(R.id.alertStatus);

            final String platformValue = deparaturedaseboarddto.get(position).getPlatformNo();
            final String schDepartValue= deparaturedaseboarddto.get(position).getSchDepart();
            final String schExpectValue= deparaturedaseboarddto.get(position).getExpDepart();
            final String arrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
            final String exparrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
           String stationNameValue= deparaturedaseboarddto.get(position).getDestinationStation().getStationName();
           if(deparaturedaseboarddto.get(position).getAlertsId()!=0){
               alertStatusImage.setVisibility(View.VISIBLE);
           }else {
               alertStatusImage.setVisibility(View.INVISIBLE);
           }

            platFormName.setText(platformValue);

            schDepart.setText(schDepartValue);
            expDepart.setText(schExpectValue);
            arrival.setText(arrivalValue);
            exparrival.setText(exparrivalValue);
            stationName.setText(stationNameValue);
            if (position%2==0) {
                Log.d("--------", "old");
                v.setBackgroundColor(Color.parseColor("#FFFFFF"));
            } else {
                Log.d("--------", "even");

                v.setBackgroundColor(Color.parseColor("#f3f3f3"));
            }
            return v;
         }else {
             View vv = convertView;

//              if (vv == null) {
//                  LayoutInflater mInflater = (LayoutInflater) context
//                          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//                  vv = mInflater.inflate(R.layout.filterdashboard, null);
//              }
             LayoutInflater mInflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              vv = mInflater.inflate(R.layout.filterdashboard, null);

                final TextView platFormName = (TextView) vv
                        .findViewById(R.id.platFormId);

                final TextView destinationName = (TextView) vv
                        .findViewById(R.id.destinationStationName);
                final TextView filterStationName = (TextView) vv
                        .findViewById(R.id.filterStationNameId);
                final TextView toSchArrival = (TextView) vv
                        .findViewById(R.id.toschArrivalID);
                final TextView toExpArrival = (TextView) vv
                        .findViewById(R.id.toExpArrivalID);
                final TextView destinationSchArrival = (TextView) vv
                        .findViewById(R.id.destSchArrivalID);
                final TextView destinationExpArrival = (TextView) vv
                        .findViewById(R.id.destExpArrivalID);

                final TextView schDepart = (TextView) vv
                        .findViewById(R.id.schDepartID);
                final TextView expDepart = (TextView) vv
                        .findViewById(R.id.expDepartID);

                final ImageView alertStatusImage = (ImageView) vv
                        .findViewById(R.id.alertStatusImage);

                final String platformValue = deparaturedaseboarddto.get(position).getPlatformNo();
                final String toSchArrivalValue= deparaturedaseboarddto.get(position).getToSchArrival();
                final String toExpArrivalValue= deparaturedaseboarddto.get(position).getToExpArrival();
                final String destSchArrivalValue= deparaturedaseboarddto.get(position).getDestSchArrival();
                final String destExpArrivalValue= deparaturedaseboarddto.get(position).getDestExpArrival();

                final String schDepartValue= deparaturedaseboarddto.get(position).getSchDepart();
                final String expDepartValue= deparaturedaseboarddto.get(position).getExpDepart();
               String destinationStationNamValue= deparaturedaseboarddto.get(position).getDestinationStation().getStationName();
               String filterStationNameValue= deparaturedaseboarddto.get(position).getFilteredStation().getStationName();

               if(deparaturedaseboarddto.get(position).getAlertsId()!=0){
                   alertStatusImage.setVisibility(View.VISIBLE);
               }else {
                   alertStatusImage.setVisibility(View.INVISIBLE);
               }

                platFormName.setText(platformValue);

                destinationName.setText(destinationStationNamValue);
                filterStationName.setText(filterStationNameValue);
                toSchArrival.setText(toSchArrivalValue);
                toExpArrival.setText(toExpArrivalValue);
                destinationSchArrival.setText(destSchArrivalValue);
                destinationExpArrival.setText(destExpArrivalValue);
                schDepart.setText(schDepartValue);
                expDepart.setText(expDepartValue);

                if (position%2==0) {
                    Log.d("--------", "old");
                    vv.setBackgroundColor(Color.parseColor("#FFFFFF"));
                } else {
                    Log.d("--------", "even");

                    vv.setBackgroundColor(Color.parseColor("#f3f3f3"));
                }
                return vv;
         }
    }

    public void referhList( ArrayList<Deparaturedaseboarddto> deparaturedaseboarddto){
        this.deparaturedaseboarddto=deparaturedaseboarddto;

        notifyDataSetChanged();
    }

}

private void showFilterWebDashBoard(String response) {
        Log.d("--",response);
        ConstantVariable.isfilterOccured=true;
        DepartureHolder localdata = new Gson().fromJson(response, DepartureHolder.class);
        data=localdata;

        adapter.referhList(data.getData());
    }

A: I would recommend you create a layout for the list items that contains both of your current layouts R.layout.row_listitem and R.layout.filterdashboard (so now you'll inflate R.layout.merged_layouts), and based on
ConstantVariable.isfilterOccured

you can change visibility of the corresponding container layout, and keep the view reusability (you could even add a ViewHolder pattern for boosting performance).
Hope it helps.


text:
Q: How to manage session in MVC Application I am new to MVC but not known how to manage session.in my application for login I am using simple membership function.when i am first login to application works properly,but when logout is done and in address bar giving proper controller and action wihtout login it opens directly without login.I think at this situation session is required but how that apply is not known.
Please suggest some solution for this.
Advanced thank you.

A: ASP.NET provides a framework for handling user authentication, called "Identity". This is available in both ASP.NET Core (latest) and ASP.NET 4, with good documentation available for both.
ASP.NET Core: https://docs.asp.net/en/latest/security/authentication/identity.html
ASP.NET 4.6: http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity
Both sites have examples of how to build up the applications with it.


text:
Q: Angular 2 refresh http request based on value As I'm new to angular, I want to know what should be the best practice to achieve what I want.
I want to request an API until I have the result I want with intervals between requests.
I use two nested services (GiftsService and ApiService) :
gifts.service.ts :
import { Injectable } from '@angular/core';
import { URLSearchParams } from '@angular/http';
import { environment } from '../../../environments/environment';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

import { ApiService } from './api.service';
import { Gift } from '../models';

@Injectable()
export class GiftsService {
  constructor (
    private apiService: ApiService
  ) {}

  get(id): Observable<Gift> {
    return this.apiService.get('/gifts/' + id)
           .map(data => data);
  }
  ...

api.service.ts
import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';
import { Headers, Http, Response, URLSearchParams } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';

import { JwtService } from './jwt.service';

@Injectable()
export class ApiService {
  constructor(
    private http: Http,
    private jwtService: JwtService
    ) {}

  get(path: string, params: URLSearchParams = new URLSearchParams()): Observable<any> {
    return this.http.get(path, { headers: this.setHeaders(), search: params })
    .catch(this.formatErrors)
    .map((res:Response) => res.json());
  }
...

And I call GiftsService.get in a component like this :
this.giftsService.get(this.gift.id)
.subscribe(data => {
    // if data.status != "ok" retry
})

Update
Here how I did it
this.giftsService.get(this.gift.id)
      .switchMap(data => data.status !== 'success' ? Observable.throw(new Error('status not successful')) : Observable.of(data))
      .retryWhen(attempts => {
        return Observable
        .range(1,10)
        .zip(attempts, function(i) {
          return(i);
        })
        .flatMap(function(i) {
          return Observable.timer(1000);
        })
      })
      .subscribe((
        data => {
          this.gift = data
        })
      );

A: You can do something like this:
this.giftsService.get(this.gift.id)
  .switchMap(data => data.status !== 'OK' ? Observable.throw() : Observable.of(data))
  .retryWhen(errors => { /* setup retry logic here */ })
  .subscribe(data => {})

A: You could the retryWhen operator in combination with range and timer.
get(path: string, params = new URLSearchParams()) {
   return this.http.get(path, {
       headers: this.setHeaders(), search: params
   })
   .map(response => {
     response = response.json();
     if(response.status !== 'ok') {
       throw new Error('status not okay');
     }
     return response;
   })
   .retryWhen(errors => {
     return Observable
       .range(1, 3 /* maximum retry attempts */)
       .zip(errors)
       .flatMap([attempt, error] => {
         if(attempt >= 3) {
           return Observable.throw(error);
         }
         return Observable.timer(attempt*500 /* the retry timeout which increases after each attempt */);
       })
   })
   .catch(this.formatErrors)
}


text:
Q: How to hold "ALT" and then "Esc" key in Selenium WebDriver using python? I am doing automated testing using Selenium WebDriver with Python In Internet Explorer. I have opened multiple windows in IE 11 and I closed the current window, after that second last opened window is not getting any focus so to give focus to second last window I want to click and hold on ALT button and then click on ESC button so that second last window get focus.
Basically, I need to achieve the focus on second last window.
eg:
SendKeys.SendKeys("{ALT}" + "{ESC}")
Please help me. Thanks in advance.

A: ActionChains is what you're looking for.
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

combine_keys = ActionChains(driver)
combine_keys.key_down(Keys.ALT).send_keys(Keys.ESCAPE).key_up(Keys.ALT).perform()


text:
Q: Submitting app to appstore Is hyphen allowed in app name in iTunesConnect?
For example : abcd - efgh
I searched in google found the link https://developer.apple.com/library/content/qa/qa1892/_index.html,
No where they mentioned whether hyphen(-) allowed as app name in itunes?

A: It is allowed.. You can enter A-Za-z0-9.-_ (those are the only ones I've tried). However, if you abuse it, Apple can reject the app. Example: Foo___Bar can get rejected. I'm not sure if they allow consecutive characters that are not A-Za-z.
It also depends on the AppStore you submit to. They allow Chinese, Japanese, etc.
You can have AppNames like:
"StackOverflow.com", "Foo.ca", "Scotia-Bank", "Meh_Bar", "Food-Noob.ca", etc..
Note: I do not have an official citation for this. This is just from what I have submitted.


text:
Q: Paginator limit not working I am using cakephp 2.4 .I am trying to use cake Paginator component.But here Paginator limit not working.I have tried below code in controller.
class TutorialsController extends AppController
    {
        public $components = array('Paginator');
        public $paginate = array(
        'limit' => 3
        );

        public function index()
        {
            $this->Tutorial->recursive =0;
            $this->set('tutorials', $this->Paginator->paginate());
        }

    }

A: Never mix component and controller pagination. Both itself work just fine, but mixing them can cause trouble as you can see.
So either don't include the component and use $paginate alone, or use
$this->Paginator->settings()

inside the actions. You can also directly pass settings in your $components array, as well.

A: class TutorialsController extends AppController
{
    public $components = array('Paginator');
    public $paginate = array(
    'limit' => 3
    );

    public function index()
    {
        $this->Tutorial->recursive =0;
        $this->Paginator->settings = $this->paginate; //This line does the trick.
        $this->set('tutorials', $this->Paginator->paginate());
    }

}

And if you need some bootstrap looking for your paginator, check this post out: Bootstrap pagination with CakePHP pagination helper


text:
Q: How can I host a Java Swing component in a .NET application I have some Java user interface controls that I want to host in my .NET application as I can't afford to rewrite them. How can I do that? Do I need to wrap them up in COM? How do I do that? I want the component to sit on a form with other components written in .NET.

A: If you're using VS2005, have you considered compiling said Java component in J#?
I've never tried J#, but I seem to recall Microsoft claiming that it would convert Swing calls to their WinForms equivalent.

A: There's no way to force this high level of integration; you cannot make a .NET form host a Java component.  Even COM wrapping wouldn't get you the level of integration necessary to host the component in the form.

A: Conceptually I find it almost impossible to believe that it is possible to do this.
However, you might try migrating the existing components to J#.

A: There's a product called JNBridge that claims to do this - I've never heard of it before.
See also, this previous post.


text:
Q: Adding a dot separator instead of comma in datagrid column I have a datagrid column that shows int values from the database.
The output looks like this:
4,561,876.
I need it to look like this:
4.561,876.
I tried with to put in my Main() System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(3098); , but it shows no results.
This is my formating in the xaml for the cell:
<DataGridTextColumn Binding="{Binding Ulaz, StringFormat={}{0:n2}}" Width="Auto" Header="Column"/>

A: Try setting the xml:lang to DataGridTextColumn to appropriate culture to set the control's value in the specific culture.


text:
Q: How to replace AsyncTask onProgressUpdate() using Runnable callbacks I'm trying to replace deprecated AsyncTask without using Kotlin Coroutines or others libraries, so I have
MyTask objects with following structure
public abstract class MyTask<R> implements MyCallable<R> {
    @Override
    public void setUiForLoading() {
       //runs on ui
    }

    @Override
    public void setDataAfterLoading(R result) {
        //runs on ui
    }

    @Override
    public R call() throws Exception {
        //runs in background
        return null;
    }
}

MyCallable is just a simple interface
public interface MyCallable<R> extends Callable<R>{
    void setDataAfterLoading(R result);
    void setUiForLoading();
}

And use this MyTaskRunner to execute them
public class MyTaskRunner {

    private final Handler handler = new Handler(Looper.getMainLooper());
    private final Executor executor = Executors.newCachedThreadPool();

    public <R> void executeAsync(MyCallable<R> callable) {
        try {
            callable.setUiForLoading();
            executor.execute(new RunnableTask<R>(handler, callable));
        } catch (Exception e) {

        }
    }

    public static class RunnableTask<R> implements Runnable{
        private final Handler handler;
        private final MyCallable<R> callable;

        public RunnableTask(Handler handler, MyCallable<R> callable) {
            this.handler = handler;
            this.callable = callable;
        }

        @Override
        public void run() {
            try {
                final R result = callable.call();
                handler.post(new RunnableTaskForHandler(callable, result));
            } catch (Exception e) {

            }
        }
    }

    public static class RunnableTaskForHandler<R> implements Runnable{

        private MyCallable<R> callable;
        private R result;

        public RunnableTaskForHandler(MyCallable<R> callable, R result) {
            this.callable = callable;
            this.result = result;
        }

        @Override
        public void run() {
            callable.setDataAfterLoading(result);
        }
    }
}

it works, but I cannot figure how I could replicate correctly the behaviour of publishProgress() and onProgressUpdate() of AsyncTask useful to show actual progress rather that just indeterminate

A: I cannot give the same code as yours but hopefully you get the idea.
Everything is self explain in code itself.
import android.app.*;
import android.graphics.*;
import android.os.*;
import android.widget.*;
import java.lang.ref.*;

public class MainActivity extends Activity
{
    private static final class HeavyJob implements Runnable
    {
        private final WeakReference<Handler> handler;
        private final Thread thread;
        private boolean isAlive;
        private boolean state;
        private int progress;

        public final HeavyJob(final Handler handler)
        {
            this.handler = new WeakReference<Handler>(handler);
            thread = new Thread(this);
            isAlive = true;
            thread.setPriority(Thread.NORM_PRIORITY);
            thread.start();
        }

        @Override
        public final void run()
        {
            while(isAlive) {
                try {
                    synchronized(this) {
                        while(!state) this.wait();
                    }
                    Thread.sleep(200L); //Let say this a heavy job which takes 200 m/s each round.
                    progress += 10;
                    final Handler hanRef = handler.get();
                    if(hanRef == null) {
                        isAlive = false;
                        handler.clear();
                        break;
                    }
                    final Message msg = Message.obtain();
                    msg.what = 0;
                    msg.arg1 = progress;
                    hanRef.sendMessageAtTime(msg, SystemClock.uptimeMillis()); //Update its progress each round.
                } catch(final InterruptedException e) {}
            }
            //Finished ???
            final Handler hanRef = handler.get();
            if(hanRef != null) {
                final Message msg = Message.obtain();
                msg.what = 1;
                msg.arg1 = progress; //Make your progress is 100% completed and updated.
                //msg.obj = bitmap;
                hanRef.sendMessageAtTime(msg, SystemClock.uptimeMillis());
            }
        }

        public final synchronized void resume()
        {
            if(isAlive) {
                state = true;
                this.notify();
            }
        }

        public final void suspend()
        {
            state = false;
            thread.interrupt();
        }

        public final void stop()
        {
            isAlive = false; // In case interrupt() does nothing (Thread was not in sleep nor wait mode).
            thread.interrupt();
            handler.clear();
        }
    }

    private static final class UIHandler extends Handler
    {
        private final WeakReference<MainActivity> activity;

        public final UIHandler(final MainActivity activity)
        {
            super(Looper.getMainLooper());
            this.activity = new WeakReference<MainActivity>(activity);
        }

        @Override
        public final void handleMessage(final Message msg)
        {
            final MainActivity referent = activity.get();
            if(referent != null) {
                switch(msg.what) {
                    case 0: referent.onProgress(msg.arg1); break;
                    case 1: referent.onPostExecute(msg.arg1, (Bitmap)msg.obj); break;
                }
            }
        }
    }

    private ProgressBar pb;
    private ImageView iv;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        pb = findViewById(R.id.pb);
        iv = findViewById(R.id.next);

        UIHandler handler = new UIHandler(this);
        //Initilize the object but will not run yet.
        HeavyJob hj = new HeavyJob(handler);

        //Run the job
        hj.resume();
        //Pause the job
        hj.suspend();
        //Resume the job
        hj.resume();
        //Stop the job
        hj.stop();

        //Multiple jobs
        for(int i=0; i<10; i++) {
            new HeavyJob(handler);
        }
    }

    public final void onProgress(final int progress) {
        pb.setProgress(progress);
    }

    public final void onPostExecute(final int progress, Bitmap bitmap)
    {
        pb.setProgress(progress);
        if(bitmap != null) iv.setImageBitmap(bitmap);
    }

}

A: The best I founded to do it is:
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MainActivity extends AppCompatActivity {

    Button btn_start;
    TextView text;
    ProgressBar progressBar1, progressBar2;
    int num = 0;
    ExecutorService service;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        text = findViewById(R.id.textHello);
        btn_start = findViewById(R.id.btn_start);
        progressBar1 = findViewById(R.id.progressbar1);
        progressBar2 = findViewById(R.id.progressBar2);
        btn_start.setOnClickListener(v -> toDo());

    }

    private void toDo() {
        service = Executors.newSingleThreadExecutor();
        service.execute(() -> {

            runOnUiThread(() -> {
                // onPreExecute method of AsyncTask
                progressBar1.setVisibility(View.VISIBLE);
                progressBar2.setVisibility(View.VISIBLE);

            });

            // doInBackground of AsyncTask
            for (int i = 1; i <= 10000; i++) {
                num = i;
                runOnUiThread(() -> {
                    // onProgressUpdate method of AsyncTask
                    progressUpdate(num);
                });
            }

            runOnUiThread(() -> {
                // onPostExecute method of AsyncTask
                progressBar1.setVisibility(View.GONE);
                progressBar2.setVisibility(View.GONE);
            });

        });

    }

    public void progressUpdate(Integer i) {
        text.setText(String.valueOf(i));
        progressBar2.setProgress(i);
    }

}


text:
Q: Help with using VNC on remote Fedora Linux machine at login screen I have a linux machine at work running Fedora 29 / gnome.  I always leave it logged on at work so that when I get home I can remote VNC to it and keep working.
In previous Fedora's (16 I think) I found info on the web on how to have x11vnc start on the login screen so that if there was a power fail / crash / etc I could restart the machine and see the login screen via VNC.  This was in the pre-systemd days.
I haven't found a way to do this with Fedora 29.  Although x11vnc is running once there is a login at work I can't find the magic potion that will allow me to login remotely via VNC.  Now that I'm working at home full time I have no way to start a session that will remain even after logging off.  I have to try to find someone physically at work and explain how to get to the machine and give them my password to get a VNC session running (Yes, VNC is password protected).
Does anyone out there know how to setup Fedora 29 / gnome to start with the login screen?  Lacking that, is there a way to cause this to happen via telnet/ssh?  Tunneling through ssh doesn't seem to be a viable option since I'm running Win10 on a company configured laptop.
Here's /usr/lib/systemd/system/x11vnc.service:
[Unit]
Description=X11vnc
After=graphical.target

[Service]
Type=forking
ExecStart=/root/X11vnc_init
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=X11VNC
SyslogFacility=local5
SyslogLevel=debug
[Install]
WantedBy=graphical.target

...and here's /root/X11vnc_init:
#!/usr/bin/perl

if($ARGV[0] eq "stop"){system("killall -9 x11vnc"); exit 0;}
$DM="";
$LIGHT=`pgrep -x lightdm`; chomp $LIGHT;
if($LIGHT){
 $DM="lightdm";
 print "Found Lightdm Display manager\n";
 goto nextstep;
}
$KDM=`pgrep -x kdm`; chomp $KDM;
if($KDM){
 $DM="kdm";
 print "Found KDM Display manager\n";
 goto nextstep;
}
$GDM=`pgrep -x gdm`; chomp $GDM;
if($GDM){
 $DM="gdm";
 $dm=`ps ax |grep gdm |grep \\\\-auth |grep -v grep`;chomp $dm;
 ($junk1,$junk2)=split(/-auth /,$dm);
 ($junk3,$junk4)=split(/\/gdm\/Xauthority /,$junk2);
 $authfile="$junk3/gdm/Xauthority";
 print "Found GDM Display manager with authfile $authfile\n";
 goto nextstep;
}
$XDM=`pgrep -x xdm`; chomp $XDM;
if($XDM){
 $dm=`ps ax |grep xdm |grep authdir |grep -v grep`; chomp $dm;
 ($a,$filename)=split(/authdir\/authfiles\//,$dm);
 $authfile="/var/lib/xdm/authdir/authfiles/$filename";
 $DM="xdm";
 print "Found XDM Display manager with authfile $authfile\n";
 goto nextstep;
}
$SDDM=`pgrep -x sddm`; chomp $SDDM;
if($SDDM){
 $dm=`ps ax |grep sddm |grep var/run |grep -v grep`; chomp $dm;
 ($junk1,$junk2)=split(/-background/,$dm);
 ($junk3,$junk4)=split(/var\/run\/sddm\//,$junk1);
 $filename="/var/run/sddm/$junk4";
 $authfile="$filename";
 $DM="sddm";
 print "Found SDDM Display manager with authfile $authfile\n";
 goto nextstep;
}
nextstep:
if($DM eq "gdm"){$AUTH="-auth $authfile";}
if($DM eq "lightdm"){ $AUTH="-auth /var/run/lightdm/root/:0 ";}
if($DM eq "kdm" ){ $AUTH="-auth guess ";}
if($DM eq "xdm" || $DM eq "sddm"){$AUTH="-auth $authfile ";}
if(!$DM){
 print "NO Compatible dm found\n";
 exit 0;
}
my $pid = fork();
$XCMD="/usr/bin/x11vnc \
-rfbauth /root/x11vncpasswd \
-nap -many -norepeat 5 -alwaysshared -dontdisconnect \
-shared -nolookup \
$AUTH \
-rfbport 5900 -no6 -xkb -display :0 &";
$XCMD=~s/\n/ /gm;
open tmpsh,">/tmp/tmpvnc.sh";
print tmpsh "#!/bin/bash
sleep 10;
$XCMD
";
close tmpsh;
system("chmod 755 /tmp/tmpvnc.sh");
system("/tmp/tmpvnc.sh &");
exit 0;

Thanks,
Marc


text:
Q: How does EnableCollectionSynchronization work? There are several posts that explain the usage of BindingOperations.EnableCollectionSynchronization. E.g. BindingOperations.EnableCollectionSynchronization mystery in WPF or Using BindingOperations.EnableCollectionSynchronization
However, my understanding of a "lock" does not match the behavior of the following demonstration.
private void Button_Click(object sender, RoutedEventArgs e)
{
    var itemsLock = new object();
    var items = new ObservableCollection<string>();
    BindingOperations.EnableCollectionSynchronization(items, itemsLock);

    Task.Run(() =>
    {
        lock (itemsLock)
        {
            Debug.WriteLine("task inside lock");
            Thread.Sleep(5000);
            items.Where(m => m == "foo").ToArray();
        }
        Debug.WriteLine("task outside lock");
    });

    Thread.Sleep(1000);
    Debug.WriteLine("UI thread add..");
    items.Add("foo");
    Debug.WriteLine("UI thread add..done");
}

Due to the lock, I expected Debug Output like this:
task inside lock
UI thread add..
task outside lock
UI thread add..done

But I find an Debug Output like this:
task inside lock
UI thread add..
UI thread add..done
task outside lock

Background info: I occasionally experience InvalidOperationExceptions "collection was modified" when running LINQ queries on a frequently changed ObservableCollection. This lead me to breaking it down to the previous sample. Then I found that my assumption of how EnableCollectionSynchronization works is wrong.

A: You should synchronize all access to the collection using the same lock, i.e. you should lock around the call to Add:
lock (itemsLock)
    items.Add("foo");

The documentation is pretty clear on this:

To use a collection on multiple threads, one of which is the UI thread that owns the ItemsControl, an application has the following responsibilities:

*

*Choose a synchronization mechanism.

*Synchronize all access from the application to the collection using that mechanism.

*Call EnableCollectionSynchronization to inform WPF of the mechanism.

*...


text:
Q: JavaScript not loading after partial update in ASP.Net I have a problem with Javascript not load in asp.net when an updatepanel postback to the server and the problem is that javascript code is not in the same page where the updatepanel is so I can put it in pageLoad() function it is like this:

and i use ASP.Net 4 and c# and this is my code code:
<link href="css/keyboard.css" rel="stylesheet" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

            <dx:aspxcombobox id="comboBoxLangauge" clientinstancename="comboboxLang"
                cssclass="combo" runat="server" width="140px" clientidmode="Static">
                <Items>
                    <dx:ListEditItem Text="English to Kurdish" Value="1" Selected="true" />
                    <dx:ListEditItem Text="Kurdish to English" Value="2" />
                </Items>
                <ClientSideEvents SelectedIndexChanged="IndexChanged" />
            </dx:aspxcombobox>

        <asp:Button ID="btnTranslate" runat="server" Text="Search" ClientIDMode="Static"
            CssClass="Search" OnClick="btnTranslate_Click" />
        <asp:TextBox ID="txtBoxWord" runat="server" ClientIDMode="Static"
            class="keyboardInput Search" Style="width: 260px; direction: ltr"></asp:TextBox>

        <asp:AutoCompleteExtender ID="autocom" ClientIDMode="Static" runat="server" CompletionSetCount="10"
            EnableCaching="true" MinimumPrefixLength="1" TargetControlID="txtBoxWord" ServicePath="~/translator/AutoComplete.asmx" ServiceMethod="GetCompletionList">
        </asp:AutoCompleteExtender>

        <asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="OutPanel"
            Corners="All" Radius="5" BorderColor="Silver">
        </asp:RoundedCornersExtender>

    </ContentTemplate>
</asp:UpdatePanel>

        </ContentTemplate>
    </asp:UpdatePanel>

A:
"The problem is that javascript code is not in the same page where the updatepanel is"

Whereas make sure your JavaScript is available on the page with UpdatePanel to load it properly.


text:
Q: SSRS Delivery Extension not found I'm trying to develop a delivery extension for SSRS.
I created a dll with one class. The class implements both IExtension and IDeliveryExtension interfaces. I copied the built dll file (MyExtension.dll) to the report's server bin folder. It is not in default location, but it should not be a problem:

D:\SSRS\MSRS13.MyInstanceName\Reporting Services\ReportServer\bin

In rsreportserver.config I added this in Extensions/Delivery:
<Extensions>
        <Delivery>
            <Extension Name="My Extension" Type="My.Extensions.MyExtension,MyExtension" Visible="true" />

In rssrvpolicy.config I have something like this:
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust">
    <IMembershipCondition class="UrlMembershipCondition" version="1" Url="$CodeGen$/*" />
</CodeGroup>
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="MyCustomCodeGroup" Description="trying out delivery extension">
    <IMembershipCondition class="UrlMembershipCondition" version="1" Url="D:\SSRS\MSRS13.MyInstanceName\Reporting Services\ReportServer\bin\MyExtension.dll" />
</CodeGroup>

I do not see the extension when I create a new subscription. In log I keep getting this error:

extensionfactory!ReportServer_0-1!155c!02/18/2019-17:34:56:: e ERROR: Exception caught instantiating My Extension report server extension:
  Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
  Konfigurationsfehler beim Berichtsserver: . --->
  System.IO.FileNotFoundException: Could not load file or assembly
  'MyExtension.dll' or one of its dependencies. The system cannot find
  the file specified..
  library!ReportServer_0-1!1c78!02/18/2019-17:34:56:: e ERROR: Throwing
  Microsoft.ReportingServices.Diagnostics.Utilities.NotEnabledException:
  ,
  Microsoft.ReportingServices.Diagnostics.Utilities.NotEnabledException:
  Die angeforderte Funktionalität ist zurzeit nicht aktiviert.;

I added the MyExtension.dll to GAC and restarted report server. I granted full permissions for the dll file to the SSRS windows service account and verified the account can see it. Still no success...
What am I missing?

A: I finally found the problem, it was .NET framework version. My assembly was compiled for .NET Framework 4.6.1. When I switched to .NET Framework 3.5, all worked fine.
Here are details:
https://support.microsoft.com/en-us/help/2869522/the-net-framework-4-x-assemblies-are-not-supported-in-sql-server-repor

Microsoft SQL Server Reporting Services (SSRS) supports extensions by including custom extensions and custom code. However, SSRS does not support Microsoft .NET Framework 4.x-based assemblies. Therefore, you cannot load a .NET Framework 4.x assembly.

There is another problem, because I cannot reference assemblies built with .NET Framework 4.x ...
Anyway, I hope this can help someone...


text:
Q: Java : SimpleDateFormat - Unable to parse a string to a date of desired format I am trying to parse one string to a format yyyy-MM-dd and one to yyyy-MM-dd HH:mm:ss.
I am using SimpleDateFormat.
I have used the same method successfully earlier, but now something is going wrong. I get the date in the standard format i.e. Tue Mar 05 00:00:00 GMT+05:30 2012 (for yyyy-MM-dd) and Mon Mar 05 13:01:35 GMT+05:30 2012 (for yyyy-MM-dd HH:mm:ss) where as I need them to be 2012-03-05 and 2012-03-05 13:01:35 repectively.
This is what I do :
Date today = new Date();
SimpleDateFormat tsdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
    today = tsdf.parse(tsdf.format(new Date()));
} catch(Exception e) {
    System.out.println("Error occurred"+ e.getMessage());
}

System.out.println(today);

AND
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
    // I recieve a string in this format here (refers to 5 march 2012).
    myDate = sdf.parse('2012-03-05');
    System.out.println(myDate);
} catch(Exception e) {
    System.out.println("Error occurred "+ e.getMessage());
}

A: You're not outputting the string that is the result of the formatter, you're outputting the actual date object.  That will always be the result of Date.toString(), which for the JDK you're using is the format you see.  Don't turn the formatted String back into a date object, just print it out!
SimpleDateFormat tsdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
    String formattedDate = tsdf.format(new Date());
} catch(Exception e) {
    System.out.println("Error occurred"+ e.getMessage());
}

System.out.println(formattedDate);

You cannot apply a "format" to a java.util.Date object for later use.  It's just a raw number of milliseconds and its toString method will always print the same representation.  You have to convert it into a formatted string and use that string.

A: today = tsdf.parse(tsdf.format(new Date()));
System.out.println(today);

Looks to me like you expect, that the Date instance gets formatted. That is not the case. A Date instance represents a date that can be formatted "to" a string. It is a class that simply holds a long value (meaning something like "time in milliseconds").
This would give the expected result:
Date today = new Date();
String formattedDate = tsdf.format(today);
System.println(formattedDate);     // <- we print the string!!

A: If you want format a Date instance, you don't must using parse method, you have to use format method as following:
    Date today = new Date();
    SimpleDateFormat tsdf = new SimpleDateFormat("yyyy-MM-dd");
    try
    {
        System.out.println(tsdf.format(today));
    }
    catch (Exception e)
    {
        System.out.println("Error occurred" + e.getMessage());
    }

parse method use for convert a string to date and format method for format a Date instance to string by specified format.

A: java.time
You are using old troublesome date-time classes now supplanted by the java.time classes.
The java.time framework is built into Java 8 and later. These classes supplant the old troublesome date-time classes such as java.util.Date, .Calendar, & java.text.SimpleDateFormat. The Joda-Time team also advises migration to java.time.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations.
Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP.
LocalDate
For date-only values, use the LocalDate class. Your input value is in standard ISO 8601 format. The ISO 8601 formats are used by default in java.time classes for parsing and generating strings that represent the date-time values. So no need to specify a formatting pattern.
LocalDate localDate = LocalDate.parse( "2012-03-05" );

To generate such a string, call toString.
String output = localDate.toString();

LocalDateTime
For a string such as 2012-03-05 12:34:56 we have a problem. No offset-from-UTC or time zone is indicated. So it does not represent an actual moment on the timeline, but rather a rough idea about possible moments. This non-moment is represented in java.time by the LocalDateTime class.
Your string's format is a variation on ISO 8601 while the canonical version has a T in the middle rather than a space. So one option is to replace the SPACE with a T.
LocalDateTime ldt = LocalDateTime.parse( "2012-03-05 12:34:56".replace( " " , "T" );

Or define a pattern.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "yyyy-MM-dd hh:mm:ss" );
LocalDateTime ldt = LocalDateTime.parse( "2012-03-05 12:34:56" , formatter );

Avoid using such date-time formats lacking in offset or time zone info if indeed they are meant to represent actual moments on the timeline.
ZonedDateTime
To give that value meaning, to determine an actual moment on the timeline, we need to assign the time zone for which the date-time is intended.
ZoneId zoneId = ZoneId.of( "America/Montreal" );
ZonedDateTime zdt = ldt.atZone( zoneId );

Calling toString generates a String in a format that extends the ISO 8601 standard format by appending the name of the time zone in square brackets.
String output = zdt.toString(); // Yields: 2012-03-05T12:34:56-04:00[America/Montreal]

If you want to omit the T you could replace with a SPACE using String::replace method. Or use a formatter. If you really want a string as seen in the Question lacking any offset or time zone info (against my recommendation) use the same formatter shown above.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern( "yyyy-MM-dd hh:mm:ss" );  // Not recommended as it lacks offset/zone info.
String output = zdt.format( formatter );  // Yields: 2012-03-05 12:34:56


text:
Q: make sure the service has been deployed successfully, and the server is runnig I creating new java web application, add web service to project. I testing web service  without no edit on project after make clean and built and deploy, and I see this error message "make sure the service has been deployed successfully, and the server is runnig."
why  I may taking error message.
the image of project directory .
package Service;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author seref
 */
@WebService(serviceName = "NewWebService")
public class NewWebService {

    /**
     * This is a sample web service operation
     */
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String txt) {
        return "Hello " + txt + " !";
    }
}

Glassfish Server error message
Info:   Invoking wsimport with http://localhost:8080/WebServiceApp/NewWebService?WSDL
Warning:   StandardWrapperValve[NewWebService]: Servlet.service() for servlet NewWebService threw exception
java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: bundle://218.0:1/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'bundle' access is not allowed due to restriction set by the accessExternalSchema property.
    at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:80)
    at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:237)
    at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
    at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
    at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
    at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsimport(WSToolsObjectFactoryImpl.java:60)
    at com.sun.tools.ws.spi.WSToolsObjectFactory.wsimport(WSToolsObjectFactory.java:88)
    at org.glassfish.webservices.monitoring.WebServiceTesterServlet.wsImport(WebServiceTesterServlet.java:642)
    at org.glassfish.webservices.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:528)
    at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doGet(WebServiceTesterServlet.java:169)
    at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:104)
    at org.glassfish.webservices.JAXWSServlet.doGet(JAXWSServlet.java:210)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.xml.sax.SAXParseException; systemId: bundle://218.0:1/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'bundle' access is not allowed due to restriction set by the accessExternalSchema property.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4162)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4141)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2168)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2078)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1008)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:620)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:616)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:574)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:540)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:670)
    at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:77)
    ... 47 more

Info:   parsing WSDL...
Info:   [WARNING] schema_reference: Failed to read schema document 'NewWebService?xsd=1', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
Info:   line 4 of http://localhost:8080/WebServiceApp/NewWebService?WSDL#types?schema1

A:  <jvm-options>-Duser.language=tr-TR</jvm-options>
 <jvm-options>-Xrs</jvm-options>
 <jvm-options>-Dfile.encoding=UTF8</jvm-options>
 <jvm-options>-Dcom.sun.metro.soap.dump=true</jvm-options>
 <jvm-options>-Djavax.xml.accessExternalSchema=all</jvm-options>

Add the above code "glassfish-4.0 \ glassfish \ domains \ domain1 \ config \ domain.xml" directory.
Ex:
1- )
.
.
.
<jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
<jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-Duser.language=tr-TR</jvm-options>
<jvm-options>-Xrs</jvm-options>
<jvm-options>-Dfile.encoding=UTF8</jvm-options>
<jvm-options>-Dcom.sun.metro.soap.dump=true</jvm-options>
<jvm-options>-Djavax.xml.accessExternalSchema=all</jvm-options>
.
.
.

2- )
.
.
.
<jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
<jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
<jvm-options>-Duser.language=tr-TR</jvm-options>
<jvm-options>-Xrs</jvm-options>
<jvm-options>-Dfile.encoding=UTF8</jvm-options>
<jvm-options>-Dcom.sun.metro.soap.dump=true</jvm-options>
<jvm-options>-Djavax.xml.accessExternalSchema=all</jvm-options>
.
.
.


text:
Q: Can't find _T or fRprintf in xutility for vs2008 I'm trying to get this project to work in VS2008 Windows 7 on a 64-bits machine.
Their source code is at the bottom.
I keep getting two types of errors:

*

*error C3861: 'fRprintf': identifier not found c:\program files (x86)\microsoft visual studio 9.0\vc\include\xutility 3605

*error C3861: '_T': identifier not found c:\program files (x86)\microsoft visual studio 9.0\vc\include\xutility 3605
I have been looking online for a resolution but with no luck. I'm still new to C++ so there could be something I'm missing.
One of the comments here is the closest thing I have found for an answer.
The error seems to be from the SimpleString.h but I'm not sure.
Any help would be appreciated.


text:
Q: Calculating total underneath a gridview I have a gridview that has a quantity and calculated price right next to it. When I change the quantity inside the Gridview, the price changes right away. I want to show total price outside the gridview . I am showing the total price outside the gridview, but the price is not changing dynamically when the quantity and price changes for individual items. Below is the image of what I want. I want to $560 to be displayed and calculated right away as soon as price changes.

Below is my gridview code:
<asp:GridView ID="grdShoppingCart" runat="server" AutoGenerateColumns="false" class="ui-responsive table-stroke ss-table ui-search-result-table" GridLines="None" OnRowDataBound="grdShoppingCart_RowDataBound"  >
                <Columns>
                    <asp:BoundField DataField="item" HeaderText="Item" HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="250px" ControlStyle-CssClass="ss-row"    />
                    <asp:TemplateField HeaderText="Description" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="300px" ControlStyle-CssClass="ss-row"    >
                        <ItemTemplate>
                            <asp:Label ID="lblDesc" runat="server" Text='<%# Eval("child") %>' /><br />
                             Requested By:  <asp:Label ID="lblDesc1" runat="server" Text='<%# Eval("RequestedBy") %>' />
                        </ItemTemplate>

                    </asp:TemplateField>
                       <asp:TemplateField HeaderText="Quantity" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"  ControlStyle-CssClass="ss-row"  >
                        <ItemTemplate>
                                    <asp:TextBox Width="45px" TextMode="Number" ID="txtQuantity"  Text='<%#Eval("Quantity") %>'    runat="server" AutoPostBack="true" OnTextChanged="txtQuantity_TextChanged" ></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Price" HeaderStyle-HorizontalAlign="right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" ControlStyle-CssClass="ss-row" >
                        <ItemTemplate>
                            <asp:Label ID="lblPrice" runat="server"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                     <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center" ItemStyle-Width="150px" ControlStyle-CssClass="ss-row" >
                        <ItemTemplate>
                             <asp:ImageButton CommandArgument='<%# Eval("recordId") %>' ID="imgbtnDelete" runat="server" ImageUrl="~/Images/delete1.png"  CommandName="Delete"   ToolTip="Click To Dletee" AlternateText="Click To Dletee"/>
                      </ItemTemplate>
                        </asp:TemplateField>

                </Columns>

            </asp:GridView>

his is what I tried to do in my code behind to show the total:
I declared this variable inside my class and put the value of price text box in total variable in rowDatabound
public string total;
protected void grdShoppingCart_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbl = (e.Row.FindControl("lblPrice") as Label);
                TextBox tbq = (e.Row.FindControl("txtQuantity") as TextBox);

                if(tbq.Text !="")
                {
                    lbl.Text = (Convert.ToInt32(tbq.Text) * 28).ToString();
                    total= lbl.Text.ToString();
                }

            }
        }

and in the aspx page, I wrote this:
Total: <%=total %>

below is the code that changes the price and quantity:
 protected void txtQuantity_TextChanged(object sender, EventArgs e)
        {
            TextBox changeTextbox = sender as TextBox;
            GridViewRow row = (GridViewRow)changeTextbox.NamingContainer;
            TextBox tbq = (row.FindControl("txtQuantity") as TextBox);
            Label lblPrice = (row.FindControl("lblPrice") as Label);
            lblPrice.Text = (Convert.ToInt32(tbq.Text) * 28).ToString();
     }

any help will be highly apprecaited.

A: Your code is close. just remember that a data grid will persist in a round trip (post back), and MORE important that if  you ONLY data bind the grid on the FIRST postback = false?
Then the grid will display but the row data bind event does not re-fire (and thus no total)
So, we assume that on page back we re-bind.
Now you have this code:
total= lbl.Text.ToString();

You need
total = total + lbl.Text.ToString()

Or, of course this:
total += lbl.Text.ToString()

Or more so, you want a final total, then
total += lbl.Text * tbq.Text

but, what you have should work.
Edit:
I now see the problem is that the total price is not updating right away. But we should at least GET the final total working upon page re-fresh.
If you want the total to update as you edit? Then most easy would be in your text changed event to re-calc the total. So say code like this:
So, you can have your existing code first, and THEN add this loop in the same text changed event:
protected void TextBoxE_TextChanged(object sender, EventArgs e)
{

// total the grid
sTotal = 0;
GridViewRow gvr;

foreach (var gvr in GridView1.Rows)
{
    TextBox txtV = gvr.FindControl("lblPrice");
    if (txtV.Text != "")
        sTotal += lblprice.Text;
}
}

So in your text changed, you can (and need to) re-loop the rows after you updated the one row. So the above loop needs to be run. Keep in mind that the row data bound event fires for EACH row on a databind. If you on post back do a gridview databind, then you will of course loose the values in the grid. However, my bets is that you NOT doing a databind, and thus a simple loop to re-total the amount should work just fine.
The MAJOR issue here is that you left out the WHOPPER of a issue. What is that? Why of course you left out where you total things up in the first place. Since that part of yours was wrong (or at least looks to be), then my post FIRST addresed that issue and you need the +=. If your total on intitail load works, then you shoud have posted that code and how it works - since what you posted will not work.
So now that we cleared up why my post addressed the lack of total on first render.
Once you get that working (and you should have posted how that works), then and ONLY then can we address the text changed event. As above shows, it is a easy matter to re-loop and total up all rows since your changes will persist and be in that data - so right after your text changed - run/add/do the above loop to re-total.


text:
Q: Pisano Period length finding Can  0 and 1 come together in other positions of the Pisano Period except the first two positions? I am trying to solve a problem where it's needed to know the Pisano Period length. So I was thinking about searching 0 and 1 in the period.

A: Yes, if 0 and 1 are adjacent, you're at a point where the sequence is repeating.
A quick proof idea: suppose that you find 0 and 1 adjacent to one another in a Fibonacci sequence mod some number n. In other words, you've found some positions k and k+1 in the sequence such that the kth position is equal to F0 mod n and the (k+1)st position is equal to F1 mod n. That means that position k+2 is equal to F0 + F1 = F2 mod n, and the position after that is equal to F1 + F2 = F3 mod n, etc. This means that if you see 0 and 1 adjacent in the sequence, what follows must be equivalent to the sequence of numbers that you'd find if you started the Fibonacci sequence again from scratch.
Hope this helps!

A: Here's a quick Python code to determine the Pisano Period
def pisanoPeriod(m):
previous, current = 0, 1
for i in range(0, m * m):
    previous, current \
    = current, (previous + current) % m

    # A Pisano Period starts with 01
    if (previous == 0 and current == 1):
        return i + 1


text:
Q: Does replacing an assembly in the GAC cause a reset? So, I have a web part I wrote that is not working correctly, I get "object reference not set to an instance of an object." it works fine in dev, but when I installed in prod, it doesn't.
Anyway, if I replace the assembly in the GAC, does that cause any kind of iis reset, or app pools to recycle? Or do I need to reset anything for it to pick up the new assembly?
I only ask because I will not be allow to reset anything on the SP server during business hours, so I don't want to copy the new assembly if it will reset anything. In dev, I deploy using WSPBuilder, and I think that recycles the app pools when I click "Copy to GAC".

A: Yea, you'll need to do an iisreset or an app pool recycle for it to pick up the new dll in the gac.

A: If you got RDP access to the server, I'd do it this way.

*

*Open the C:\Windows\assembly folder

*Open the folder where your dll is located

*Copy the dll to the assembly folder

*Wait untill you can reset the webserver

*Do an iisreset /noforce or recycle the application pools via IIS Manager

If you don't have (RDP) access to the server you could write a script (or use the ones from WSP Builder). Just be carefull. I think the default scripts of WSP Builder cause a reset automatically. You'll have to edit those manually.


text:
Q: Ubuntu Focal Server with Desktop I used a Focal Server Image and then installed:
apt-get install --yes --no-install-recommends ubuntu-unity-desktop ttf-ubuntu-font-family gnome-shell-extensions

but the desktop still looks different to the original desktop from the desktop version.
I then tried several packages like gnome-shell-extension-desktop-icons but without success.
Does someone know what exactly needs to be done to get the same icons and possibly settings?
Left Server Version, Right Desktop Installer Version:

A: Looks like you're missing the Yaru theme. You may be able to get the look somewhat close to the stock desktop with:
sudo apt install yaru-theme-unity yaru-theme-gtk yaru-theme-icon yaru-theme-sound

There are a number of Yaru theme packages available, and you can find them in apt like this:
sudo apt search yaru

This will give you something like:
yaru-theme-gnome-shell/focal-updates,focal-updates,now 20.04.11.1 all [installed,automatic]
  Yaru GNOME Shell desktop theme from the Ubuntu Community

yaru-theme-gtk/focal-updates,focal-updates,now 20.04.11.1 all [installed,automatic]
  Yaru GTK theme from the Ubuntu Community

yaru-theme-icon/focal-updates,focal-updates,now 20.04.11.1 all [installed,automatic]
  Yaru icon theme from the Ubuntu Community

yaru-theme-sound/focal-updates,focal-updates,now 20.04.11.1 all [installed,automatic]
  Yaru sound theme from the Ubuntu Community

yaru-theme-unity/focal-updates,focal-updates 20.04.11.1 all
  Yaru Unity theme from the Ubuntu Community

Note: The above output comes from a 20.04 LTS Desktop installation. As you've installed the Unity theme, the first apt command in this answer replaces yaru-theme-gnome-shell with yaru-theme-unity.


text:
Q: python receiving data from a friend I'm new to this whole shazam and I'm a little confused. I want to have a server receive data on my computer, and a friend send data on his own computer. The code for my server is as follows:
import socket

HOST = 'HOST'
PORT = PORT

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind((HOST, PORT))
    s.listen()
    conn, addr = s.accept()
    with conn:
        print('Connected by', addr)
        while True:
            data = conn.recv(1024)
            if not data:
                break
            conn.sendall(data)

I've blanked out the host ip and the port but I'm not really sure which one I'm supposed to be using for either tbh. The client code goes as follows
import socket

HOST = 'HOST'
PORT = PORT

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    s.sendall(b'Hello, world')
    data = s.recv(1024)

print('Received', repr(data))

So my server receives it only when I run the client, not my friend. My question is what IP and ports am i supposed to use? Where can i find these numbers? Why does it only work when I run the client and how can I fix this? And if anybody can direct me to some resources about this topic I don't know what to search up :(
Thanks in advance!

A: The server should bind to the IP address of whatever interface it expects to receive traffic on. If it might receive traffic on multiple interfaces, you could bind to 0.0.0.0, which means 'all interfaces'. Whatever IP you decide on is what you should set for the server HOST value. For the server port, it could be a specific port or any port (port 0). Just be aware that the client will need to know which port the server is listening on.
The client should connect to the IP address or hostname and port of your server whose address is publicly accessible. This really depends on the network setup.
I suggest having your client connect to the same network as your server and trying again. If it doesn't work, make sure you're server is listening on 0.0.0.0.
If you are on different networks, these networks need to be bridged in some way.


text:
Q: Ruby: Split / Sort array based on condition I have an array of holidays:
Holiday.all
Holiday Load (0.7ms)  SELECT "holidays".* FROM "holidays"
=> #<ActiveRecord::Relation [#<Holiday id: 1, name: "Dia da Confraternização Universal", holidayable_id: 1, holidayable_type: "Country", date: "2014-01-01", created_at: "2014-11-05 21:38:13", updated_at: "2014-11-05 21:38:13", verified?: false>, #<Holiday id: 2, name: "Natal", holidayable_id: 1, holidayable_type: "Country", date: "2014-12-25", created_at: "2014-11-05 22:02:33", updated_at: "2014-11-05 22:02:33", verified?: false>]>

I'd like to split this big array of dates by it's dates months, so I'd end up with 12 arrays (one for each month).

A: What you want to use is the Enumerable#group_by method.

Groups the collection by result of the block. Returns a hash where the keys are the evaluated result from the block and the values are arrays of elements in the collection that correspond to the key.
If no block is given an enumerator is returned.
(1..6).group_by { |i| i%3 }   #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}

For instance
["12/25", "01/01", (...)].group_by { |date| date.split("/").first }


text:
Q: Angualar JS $location.path not working when invoked from video.onended I want to start at view Intro, run a video, then at conclusion have it switch to registration view.
Unfortunately this is not working however.
Controller:
function() {
'use strict';

var controllerId = 'intro';

// create angular controller
angular.module('app').controller(controllerId, ['common', 'datacontext', '$http', '$location', '$scope', intro]);

function intro(common, datacontext, $http, $location, $scope) {

    var app = this;
    app.ready = false;

    var log = common.logger.getLogFn(controllerId);
    var logSuccess = common.logger.getLogFn(controllerId, 'success');
    var logError = common.logger.getLogFn(controllerId, 'error');

    var video = document.getElementsByTagName('video')[0];

    activate();

    $scope.changeView = function (view) {
        $location.path(view); // path not hash
    }

    video.onended = function (e) {
        // do stuff
        log('video done!');
        $location.path('/registration'); <-- this doesnt work

    }

    function activate() {
        log('Intro', null, true);
        common.activateController([], controllerId);
        $location.path('/registration'); // <---- this does work
    }

}})();

Partial view
<div ng-controller="intro as app" >
    <video width="100%" height="100%" onclick="this.play();">
        <source src="vid/intro.mp4" type="video/mp4">
    </video>
</div>

Any sugestions would be great!


text:
Q: Run LDA algorithm on Spark 2.0 I use spark 2.0.0 and I'd like to train a LDA model to Tweets dataset, when I try to execute
val ldaModel = new LDA().setK(3).run(corpus)

I get this error
error: reference to LDA is ambiguous;
it is imported twice in the same scope by import org.apache.spark.ml.clustering.LDA and import org.apache.spark.mllib.clustering.LDA

Could someone please help me ?
Thanks !

A: It looks like you have both of the following import statements:
import org.apache.spark.ml.clustering.LDA
import org.apache.spark.mllib.clustering.LDA

You would need to remove one of them.
If you are using Spark ML (data frame based API), the proper syntax would be:
import org.apache.spark.ml.clustering.LDA

/*feature extraction step*/

val lda = new LDA().setK(3)
val model = lda.fit(corpus)

if you are using RDD-based API then you would have to write:
import org.apache.spark.mllib.clustering.LDA

/*feature extraction step*/

val lda = new LDA().setK(3)
val model = lda.run(corpus)


text:
Q: Blue spec compiler issue I am trying to download blue spec compiler and I have tried these following steps-
sudo apt install ghc libghc-regex-compat-dev libghc-syb-dev iverilog
sudo apt install libghc-old-time-dev libfontconfig1-dev libx11-dev
sudo apt install libghc-split-dev libxft-dev flex bison libxft-dev
sudo apt install tcl-dev tk-dev libfontconfig1-dev libx11-dev gperf
sudo apt install itcl3-dev itk3-dev autoconf git

git clone --recursive https://github.com/B-Lang-org/bsc
cd bsc

make all

But while running "make all" command it stops showing progress after a particular point .

I have also tried adding --debug option to get more detailed output , but there wan't much difference shown .

Can anybody help me with this issue ? How to solve this? I am running Ubuntu(20.04 LTS) on Vmware.