text:
Q: whats wrong with this code? for some reason everything i input anything i keep on getting empty lines
i am trying to make a program that reads the input , removes all unnecessary white spaces but one space between each word. then print out all the lines.
not using any sentinels to stop .
import java.util.Scanner ;
import java.lang.Character;
import java.lang.String ;
public class trim
{
        public static void main (String[]args)
        {

          String SongName = " " ;
          String Song = " " ;
          int i = 0 ;
          int count = 0 ;

                 Scanner scan = new Scanner(System.in);
                while(scan.hasNextLine())
                {
                  count++;
                  scan.nextLine();
                }

                 for (  ; i < count ; i ++)
                 {
                   if (scan.hasNext())
                   {
                    SongName =scan.nextLine() ;
                    SongName = SongName.trim() ;
                    SongName = SongName.replaceAll("\\s+"," ");
                    if (Song== " " )
                    {
                    Song = SongName;
                    }
                    else
                    {
                    Song  = Song + "\n" +SongName ;
                    }
                   }
                   System.out.println(Song) ;

                }

         }
}

A: while(scan.hasNextLine()){
       count++;
       scan.nextLine();
}

This will read all input before your program even really starts.
After that (if the program even gets that far, STDIN usually does not ever close on a console), scan has nothing more to read in the second loop.
Also, lower-case class names are as confusing as upper-case variable names. At least you are consistent here ;-)

A: while (scan.hasNextLine()) {
    count++;
    scan.nextLine();
}

This seems to be an infinite loop to me. It just keeps reading input from the console. You keep typing and this keeps reading.

A: Add your inputs to a list and then you can proceed the logic. I have modified the code as below.
import java.util.Scanner ;
import java.util.ArrayList ;
import java.lang.Character;
import java.lang.String ;

public class trim {

public static void main (String[]args) {
    String SongName = " " ;
    String Song = " " ;
    int count = 0 ;
ArrayList lst = new ArrayList();

    Scanner scan = new Scanner(System.in);
    while(scan.hasNextLine()) {
        lst.add(scan.nextLine());
        count++;
    }

for (int i=0 ; i < count ; i ++)  {
    SongName = (String)lst.get(i);
    SongName = SongName.trim() ;
    SongName = SongName.replaceAll("\\s+"," ");
    if (Song== " " ) {
       Song = SongName;
    }
    else  {
       Song  = Song + "\n" +SongName ;
    }
    }
System.out.println(Song) ;
  }
}


text:
Q: How to simply excel formula? I have a query that will generate the following formula in an array from SQL and set into a range in worksheet, but it's difficult to read:
=SUMIF(INDIRECT(ADDRESS(ROW()-1,5)&":"&ADDRESS(ROW()-6,5)),"+",INDIRECT(ADDRESS(ROW()-1,COLUMN())&":"&ADDRESS(ROW()-6,COLUMN())))-SUMIF(INDIRECT(ADDRESS(ROW()-1,5)&":"&ADDRESS(ROW()-6,5)),"-",INDIRECT(ADDRESS(ROW()-1,COLUMN())&":"&ADDRESS(ROW()-6,COLUMN())))
So dose excel contain any method to change only the address part INDIRECT(ADDRESS(ROW()-1,5)&":"&ADDRESS(ROW()-6,5)) to E10:E5 for easy to trace?
Because of the formula is needed to be dynamic generate before set to worksheet (i.e. dynamic column and row), so it should be needed to simplify after set the array to cell.
Any method can do the similar thing like Evaluate function in excel but only apply for INDIRECT and ADDRESS which allow user to read the simply formula like =SUMIF(E10:E5,"+",J10:J5)-SUMIF(E10:E5,"-",J10:J5)

A: To simplify the formulas, you could enter in RC notation by changing the reference style to R1C1 or using .FormulaR1C1. The advantage of RC notation is that the formula text is consistent down the whole column. For your formula above you could enter either as:
=SUMIF(R[-6]C5:R[-1]C5,"+",R[-6]C:R[-1]C)-SUMIF(R[-6]C5:R[-1]C5,"-",R[-6]C:R[-1]C)

or =SUM(SUMIF(R[-6]C5:R[-1]C5,{"+","-"},R[-6]C:R[-1]C)*{1,-1})
and the formulas should be easy to read in A1 notation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get SendGrid bulk-email statuses in C# I need to send an emails (bulk sending), and I have two cases:

*

*The same email sent into multiple recipients

*Different emails sent into different recipients

How, in both cases, I can control statuses?
First case will return single x-message-id, but how it can be translated into separate status for each recipients? (delivered, opened and so on?)
Second case, I believe, need to be done by sending one-by one, is that correct? Or there is also method to send bulk emails in that case?
I'm using C# and official .NET library.

A: *

*To send the same email sent to multiple recipients:

*

*You can use the MailHelper.CreateSingleEmailToMultipleRecipients and you'll need to specify the text and HTML content in code. (Sample)

*You can also use the MailHelper.CreateSingleTemplateEmailToMultipleRecipients method which will use a SendGrid Dynamic Email Template. In that case the email template is already stored in SendGrid and you simply provide the ID of the template.

*There's a showAllRecipients named parameter which defaults to false. When false recipients cannot see other recipients, when true recipients can see other recipients.

*I'll talk about retrieving the status's of the individual emails later.

*To send different email to different people:

*

*You can use MailHelper.CreateMultipleEmailsToMultipleRecipients which will use a single text and HTML body template, but you can add substitution tags and pass in substitution data so the email will be personalized for every recipient. (Sample)

*You can construct a single MailMessage but use multiple Personalization objects to override any of the MailMessage properties for specific recipients. (Sample)

*You can also construct multiple MailMessage objects and submit them individually to the API, although the above options are made for this scenario.

To send any of these emails, your API key must have the mail.send permission.
There are additional ways to send bulk email with SendGrid, which I documented here in much more detail.

As you noted, when you send email in bulk, only a single message ID is returned via the x-message-id header.
When you later try to retrieve the details using that message ID, you will not find any messages.
That is because the message ID in the x-message-id header is used as a base ID and the real message IDs will append another ID.
For example, x-message-id will return "W86EgYT6SQKk0lRflfLRsA", but when you retrieve one of the individual messages, it will looks something like this: "W86EgYT6SQKk0lRflfLRsA.filterdrecv-5645d9c87f-78xgx-1-62841247-82.1".
You can retrieve these messages via the E-Mail Activity API like this:
var queryParams = JsonSerializer.Serialize(new
{
  query = $"msg_id LIKE '{messageId}%'",
  limit = 10
});

var response = await client.RequestAsync(
  method: SendGridClient.Method.GET,
  urlPath: "messages",
  queryParams: queryParams
);

Console.WriteLine(await response.Body.ReadAsStringAsync());

Take note of the query property which is has the $"msg_id LIKE '{messageId}%'" value.
This query will filter to messages that begin with the message ID returned from the bulk email (messageId), and as a result retrieve all the individual messages.
You cannot query these messages immediately after submitting the bulk email to SendGrid's queue as it takes some time for them to become available through the API.
In my code I queried these messages every 30 seconds until the count of the recipients in the bulk email matched the messages returned.
The resulting JSON data looks like this:
{
  "messages": [
    {
      "from_email": "some@email.address",
      "msg_id": "5QSczogTRHqFtiIkLxMtWA.filterdrecv-5645d9c87f-6r2ch-1-62847C63-2D.0",
      "subject": "Sending with Twilio SendGrid is Fun",
      "to_email": "some@email.address",
      "status": "delivered",
      "opens_count": 0,
      "clicks_count": 0,
      "last_event_time": "2022-05-18T05: 01: 05Z"
    },
    {
      "from_email": "some@email.address",
      "msg_id": "5QSczogTRHqFtiIkLxMtWA.filterdrecv-5645d9c87f-6r2ch-1-62847C63-2D.1",
      "subject": "Sending with Twilio SendGrid is Fun",
      "to_email": "some@email.address",
      "status": "delivered",
      "opens_count": 0,
      "clicks_count": 0,
      "last_event_time": "2022-05-18T05: 01: 05Z"
    },
        ...
  ]
}

As you can see, this includes the status property.
Note: You must purchase additional email activity history to gain access to the Email Activity Feed API.
Note: To retrieve message via the Email Activity Feed API, your API key must have the email_activity.read permission.
This would be one way to retrieve the status of your email messages.
Another way to keep track of the status of email messages would be to create a public ASP.NET endpoint configure the URL as the SendGrid Event Webhook.
SendGrid will send an HTTP request to your ASP.NET endpoint for every event which you can use to update the status of email messages.

PS: You may already be doing this, but whether you're sending a single email to multiple recipients or multiple emails to multiple recipients, Twilio recommends setting the SendAt property on the SendGridMessage when sending bulk emails.
Quoting from the SendGrid docs:

This technique allows for a more efficient way to distribute large
email requests and can improve overall mail delivery time performance.
This functionality:

*

*Improves efficiency of processing and distributing large volumes of email.

*Reduces email pre-processing time.

*Enables you to time email arrival to increase open rates.

*Is available for free to all SendGrid customers.

I hope that answered all your questions, if not let me know. I can't wait to see what you build!


text:
Q: Specify the require-attribute for two submit-buttons I have two submit-buttons:

<form>
  <button type="submit" name="submit" value="save">save</button>
  <button type="submit" name="submit" value="delete">delete</button>

  <input name="text" placeholder="Text here" required/>
</form>

I want to use the required-attribute for the save-button, but not for the delete-button.
How can I do this?

A: You can add novalidate attribute to your form when you click on delete btn with an onclick listener to skip form validation.

function skipValidate() {
  document.querySelector("#form").setAttribute("novalidate", true)
}
<form id="form">
  <button type="submit" name="submit" value="save">save</button>
  <button type="submit" name="submit" value="delete" onclick="skipValidate()">delete</button>

  <input name="text" placeholder="Text here" required/>
</form>


text:
Q: Angular2 Saving/Loading JSON to Local Storage I'm trying to save and load data from a JSON file on a user's computer using Angular2. Basically I save a user's data to LocalStorage. I want to add a way for them to back up their data in case they need to clear their browser for some reason. I'm using HTML's File API to save/load. I can successfully write the JSON data from LocalStorage to file. However, when I try to reload the file back to LocalStorage, all the quotes end up with a backslash in front of it.
[{\"buildname\":\"\",\"unitname\":\"Jack\",\"id\":\"314\",\"rarity\":5,\"name_rarity\":\"jack-5\",\"createdOn\":\"2017-03-06T08:49:54.165Z\",\"totalHP\":2538,\"totalMP\":110,\"totalATK\":141}]

I'm trying to get it to save to LocalStorage like this:
[{"buildname":"","unitname":"Jack","id":"314","rarity":5,"name_rarity":"jack-5","createdOn":"2017-03-06T08:49:54.165Z","totalHP":2538,"totalMP":110,"totalATK":141}]

Heres my app.component.ts file:
builds = [];
      backUpData()
    {
      var textToSave = localStorage.getItem('builds');
      var textToSaveAsBlob = new Blob([textToSave], {type:"octet/stream"});
      var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
      var fileNameToSaveAs = 'newsavetotext.json'
      var downloadLink = document.createElement("a");
      downloadLink.download = fileNameToSaveAs;
      downloadLink.innerHTML = "Download File";
      downloadLink.href = textToSaveAsURL;
      downloadLink.style.display = "none";
      document.body.appendChild(downloadLink);

      downloadLink.click();
    }

    changeListener($event) : void {
      this.loadData($event.target);
    }

    loadData(inputValue: any) {
      var file:File = inputValue.files[0];
      var myReader:FileReader = new FileReader();
      myReader.onloadend = function(e){
        localStorage.setItem('builds', JSON.stringify(myReader.result));
        console.log(myReader.result);
      }
      this.builds = JSON.parse(localStorage.getItem('builds'));
      myReader.readAsText(file);
    }

My app.component.html:
<button type="button" name="button" (click)="backUpData()">Back Up Data</button>

<div>
  Select file: <input type="file" (change)="changeListener($event)">
</div>

I can't figure out what I'm doing wrong.


text:
Q: C# Datagridview method Rows.Add works incorrectly - it add line on previous, not on last I have a problem with datagridview.Rows.Add method. I want to add a new line but in the last line, not in previous. I don't know why the method Add doesn't work in this case. My code:
        dataGridView1.RowCount = 3;
        dataGridView1.ColumnCount = 4;

        dataGridView1.Rows[0].Cells[0].Value = 1;
        dataGridView1.Rows[0].Cells[1].Value = 2;
        dataGridView1.Rows[0].Cells[2].Value = 3;
        dataGridView1.Rows[0].Cells[3].Value = 4;

        dataGridView1.Rows[1].Cells[0].Value = 5;
        dataGridView1.Rows[1].Cells[1].Value = 6;
        dataGridView1.Rows[1].Cells[2].Value = 7;
        dataGridView1.Rows[1].Cells[3].Value = 8;

        dataGridView1.Rows[2].Cells[0].Value = 9;
        dataGridView1.Rows[2].Cells[1].Value = 10;
        dataGridView1.Rows[2].Cells[2].Value = 11;
        dataGridView1.Rows[2].Cells[3].Value = 12;

        dataGridView1.Rows.Add(13,14,15,16);

And result:

I will be thrilled for any help or advice!

A: A better idea is not to set RowCount when you will be entering new rows. So if open to a alternate read on.
In the example below there is no assertion to validate row.Cells[3].Value is an int but in the 2nd block shows how to check correctly.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        dataGridView1.ColumnCount = 4;

        for (int index = 0; index < dataGridView1.Columns.Count; index++)
        {
            dataGridView1.Columns[index].HeaderText = $"Column {index +1}";
        }

        dataGridView1.Rows.Add(1, 2, 3, 4);

    }

    private void button1_Click(object sender, EventArgs e)
    {

        if (dataGridView1.Rows.Count == 1)
        {
            dataGridView1.Rows.Add(1, 2, 3, 4);
        }

        for (int index = 0; index < 4; index++)
        {
            var row = dataGridView1.Rows.Cast<DataGridViewRow>()
                .LastOrDefault(gridRow => !gridRow.IsNewRow);

            var lastValue = Convert.ToInt32(row.Cells[3].Value) + 1;

            dataGridView1.Rows.Add(
                lastValue,
                lastValue += 1,
                lastValue += 1,
                lastValue += 1);
        }

    }
}

Assert cell value can represent an int
for (int index = 0; index < 4; index++)
{
    var row = dataGridView1.Rows.Cast<DataGridViewRow>()
        .LastOrDefault(gridRow => !gridRow.IsNewRow);

    if (int.TryParse(row.Cells[3].Value.ToString(), out var lastValue))
    {
        lastValue  += 1;

        dataGridView1.Rows.Add(
            lastValue,
            lastValue += 1,
            lastValue += 1,
            lastValue += 1);
    }

}

A: This is the correct way to insert a line in a grid view:
dataGridView1.Rows.Add(13,14,15,16);

The last line marked with * is in fact a placeholder for new lines and it is better not to insert it directly


text:
Q: Differences in FP and FN rates between two algorithems I am conducting binary classification using logistic regression with and without applying PCA. The application of PCA before logistic regression gives a higher accuracy and lower FNs in comparison to logistic regression alone. I would like to find out why this is happening, specifically why PCA produces less FNs. I have read that cost sensitivity analysis could help explain this, but I am not sure if this is correct. Any suggestions?

A: There is no need of fancy analysis to explain this behavior.
PCA is used just for "clean" the data by limiting its variance. Let me explain this concept with an example, and then I will turn back to your question.
In general, in any ML problem, the available samples are never sufficient in number to cover all the possible variety of the sample space. You can never have a dataset with all the possible human faces, with all the possible expressions, etc.
So, instead of using all the available features you engineer the features (the pixels, in this example) in a way that you get more meaningful higher level features. You can reduce the resolution of the pictures, as easy example; you will loose the informations on the pictures background, but your model will focus better on the most important part of the picture, i.e. the faces.
When you deal with tabular data, a technique similar to the resolution lowering is cutting off parts of the original features, and that's what PCA do: it keeps the most important components of the features, the "Principal Components", dropping the less important ones.
So, the model trained with PCA gives better results because, by cutting off part of the features, your model focus better on the most important part of your samples, and so it gains robustness against overfitting.
cheers


text:
Q: How to set a custom logs to S3 with AWS Elastic Beanstalk environment? I have an AWS Elastic Beanstalk environment with some amazon linux instances running multi docker.
I have enabled log rotation from the beanstalk console and I can see the logs getting published to S3 every hour.
I want to change this default S3 path( elasticbeanstalk-aws-region-xxxxx/resources/environments/logs/publish/yyyyy/i-zzzzz ) to my-bucket/eb/apps/logs.
How do I set a cutom path?

A:
How do I set a cutom path?

You can't change it. Its name is fixed for EB service in general.

A: The default path where it gets saved to the Elastic Beanstalk bucket is fixed but you can perform so post-processing in a Lambda to copy them to any bucket structure you want.
The high-level steps are:

*

*Create a lambda with appropriate execution role permissions to read/write to the source and destination buckets.

*Have the lambda copy logs from the beanstalk bucket to your destination bucket.

*Create a CloudWatch event to trigger the lambda on a schedule.


text:
Q: ggplot label color category I am working in ggplot and I would like to manually change the fill color of my labels according to a factor. There is a column called 'Gene' and it works when I use fill=factor(Gene) but I would like to chose my colors, since I have two graphs and now the "Genes" are colored differently in the two graphs.
My code looks like this:
dat<- read.delim("SCN.study_Pvariants_42.txt",sep="\t",check.names=F)
ggplot(dat, aes(x = dat$Index, y = as.numeric(dat$Parazscore))) +
  geom_bar(stat = "identity", fill = "darkcyan") +
  theme_bw() +
  labs(title="SCN Paralog conservation",
       y="Parazscore",
       x="aminoacid sequence") +
  geom_label_repel(aes(label=dat$'Variant',fill=factor(Gene)))

I changed it with using the scale_color_manual function and adding a vector cols:
dat<- read.delim("SCN.study_Pvariants_42.txt",sep="\t",check.names=F)
cols <- c("GENE1"="lightblue","GENE2"="green","GENE3"="yellow",etc)
ggplot(dat, aes(x = dat$Index, y = as.numeric(dat$Parazscore))) +
  geom_bar(stat = "identity", fill = "darkcyan") +
  theme_bw() +
  labs(title="SCN Paralog conservation",
       y="Parazscore",
       x="aminoacid sequence") +
  geom_label_repel(aes(label=dat$'Variant', fill=factor(Gene))) +
                         scale_color_manual(values=cols)

But regrettably, this does not work.
Could someone help me to solve this?
Thank you,
Anne


text:
Q: Reordering SlickGrid Columns Resets Column Header HTML I have a grid of data where we have added a filter icon to the header of each column after initializing the grid like so:
function selectHeaderIcon(searchActive){
        if (searchActive) {
            return "ui-icon-zoomin";
        } else {
            return "ui-icon-search";
        }
    }

function updateColumnHeader(searchActive){
        self.grid.updateColumnHeader(column.id, name + '', 'Search');
    }

I have also enabled column reordering on the grid.  However, whenever I reorder the columns, my search icons disappear!  I did some further testing in chrome debugger by manually adding text to change a column name as well as adding a random new span to the html.  After reordering the columns, both changes disappeared.  Is SlickGrid storing a different copy of my column headers somewhere instead of using what is displayed to do the reordering?  If so, why?  How do I get around this issue?

A: It sounds like you need to subscribe to the onColumnsReordered event, something like the following:
GridName.onColumnsReordered.subscribe(function(e, args) {
    updateColumnHeader(searchActive);
});


text:
Q: How to change the brand word in Wordpress How do I change the word BRAND text in WooCommerce WordPress?
I have a website which features painting artists.
I am looking to use woocommerce brands plugins to use artists as brands,
but when you click on a brand (Artist) it shows something like this on the archive title:
Brand: Jeremy

A: The easiest method is to use the WordPress plugin SEO Yoast.
When installed and activated, go to: Yoast SEO -> Search Appearance -> Taxonomies. Then remove or rename the string 'Brand' from the SEO Title.
See attachment below. In your case it would be 'Brands'.


text:
Q: System.Data.DataRowView' does not contain a property with the name error when click link button whork on run
when I clicked it give me this error 'System.Web.HttpException: 'DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'catId'.'
code to load data to list view
string categoryQuery = "SELECT COUNT(b.catId) as noOfBlogByCategory, b.catId as catId, c.categoryName
                        FROM category c
                        JOIN blog b ON c.categoryId = b.catId
                        GROUP BY c.categoryName, b.catId";
DataTable tableCat = da.dataFromQuery(categoryQuery);
noOfCategoryByBlog.DataSource = tableCat;
noOfCategoryByBlog.DataBind();

my list view code
<asp:ListView ID="noOfCategoryByBlog" runat="server">
  <ItemTemplate>
    <asp:LinkButton ID="LinkButton1"
      runat="server"
      class="list-group-item list-group-item-action"
      onClick="btnCategorizedBlog_Click"
      CommandArgument='<%#Eval("catId") %>' >
      <%#Eval("categoryName") %>
      <span class="badge badge-secondary"><%#Eval("noOfBlogByCategory") %>
    </asp:LinkButton>
  </ItemTemplate>
</asp:ListView>

Link button click code
protected void btnCategorizedBlog_Click(object sender, EventArgs e)
{
    LinkButton btn = (LinkButton)(sender);
    int categoryId = Convert.ToInt32(btn.CommandArgument);
    string categoryQuery = " SELECT blogId,blogHeader, blogImg, blogIntro FROM blog WHERE catId = '" + categoryId + "' ";
    DataTable tableCat = da.dataFromQuery(categoryQuery);
    noOfCategoryByBlog.DataSource = tableCat;
    noOfCategoryByBlog.DataBind();
    blogByCategory();
}


text:
Q: Detects Redirect and open a modal (Popup) I have a scenario trying to redirect DNS to another URL and i.e http://oldexample.com to another page of new website https://example.com.com/newpage
I am trying to make a script that detects traffic to https://example.com/newpage from http://oldexample.com and if it's detects that trigger to open modal/popup/alert message will saying some information on this page (https://example.com/newpage).
I have tried following solution but it does not work? Is it right way to implement it?
$(document).ready(function($) {
    var isExternal = document.referrer;
    console.log(isExternal);
    if (isExternal === "https://oldexample.com") {
     // Do something
    alert('Referred from expected page. Probably.');
    }
});


text:
Q: Finding $\sin(x/2)$ given a $\tan$ using half-angle identities How can I find $\sin(x/2)$ given $\tan(x) = -5.099$ and $x$ is in Quadrant IV, assuming that $0 < x < 2\pi$?
I know I have to use half-angle identities in some way, but cannot figure it out.

A: Your first goal is to find $\sin x$ and $\cos x$. You know the following things:

*

*$\sin^2 x + \cos^2 x = 1$.

*$\frac{\sin x}{\cos x} = -5.099$.

*Because $x$ is in Quadrant IV, $\cos x > 0$ and $\sin x < 0$.

We will only need $\cos x$ for now, but finding $\sin x$ and finding $\cos x$ goes hand in hand.
Once you know that, you want to solve for $$\sin \frac x2 = \pm \sqrt{\frac{1 - \cos x}{2}}.$$
The sign of $\sin \frac x2$, once again, cannot be determined from the value of $\cos x$. You have to ask yourself: if $x$ is in Quadrant IV, what is the range of possible values of $x$ (as an angle)? What, then, is the range of possible values of $\frac x2$? Is $\sin x$ positive or negative for those values?

A: Hint:
Using the double angle formula for $\cos$
$$\cos^2 (x)=1-2\sin^2\left(\frac{x}{2}\right)$$
$$\tan^2(x)+1=\sec^2(x)=\frac{1}{\cos^2(x)}$$


text:
Q: Visual Studio 2017 Build Pack CLI I have a NetStandard 2.0 class library project that includes references to two another class library project as follows. (A -> B -> C)  Where  A,B and C are all class library created by me.   When I pack using the VS Menu Build -> Pack or cli msbuild /t:pack the resulting nupkg only contains A.dll.  How to i get the nupkg that includes A,B and C.
Library B  has dependencies Newtonsoft.Json and Microsoft.Csharp and library C has dependencies to RestSharp.  for those external dependencies, is it possible to include in the nupkg ?  Thank you.


text:
Q: Transferring each elemnt in a text file into an array I have made this method to take in a file.txt and transfer its elements into an array list.
My problem is, I dont want to transfer a whole line into one string. I want to take each element on the line as string.
   public ArrayList<String> readData() throws IOException  {
     FileReader pp=new FileReader(filename);
     BufferedReader nn=new BufferedReader(pp);
     ArrayList<String> data=new ArrayList<String>();
     String line;

     while((line=nn.readLine()) != null){
        data.add(line);
      }
     xoxo.close();
     return data;

    }

is it possible ?

A: What about reading the lines, but splitting each line into the single words?
while ((line = nn.readLine()) != null) {
    for (String word : line.split(" ")) {
        data.add(line);
    }
}

The method split(" ") in this example will split the line on each whitespace " " and put the single words into an array.
In case the words in the file are separated by another character (like a comma for example) you can use that too in split():
line.split(",");

If I may, here is a somewhat easier way to read a text file:
Scanner scanner = new Scanner(filename);
while (scanner.hasNextLine()) {
    String line = scanner.nextLine();
    for (String word : line.split(" ")) {
        data.add(word);
    }
}

Well not easier but shorter :)
And one last advice: if you give your variables a more.. readable name like bufferedReader  instead of naming them all nn, pp, xoxo you might have less problems when the code grows more and more complex later on

A: Use split function for String.
String line = "This is line";
String [] a = line.split("\\s");// \\s is regular expression for space

a[0] = This
a[1] = is
a[2] = line

A: If by 'Element' you mean each word, then simply changing
line = nn.readLine()

to
line = nn.read()

should fix your problem, as the read method will take in every character it reads until it hits a space character in which it will return the processed characters. However if by element you mean each character then the problem is much harder. You will need to read each word and split that string up using any of the various functions Java provides.


text:
Q: C# Assembly ressolver doesn't start when instantiating variable but from function it does Hi I have simple client to write value to UA server. I am using OpcLabs libraries in VS2017, Win10 NetFr 4.8. Libraries are loaded from other folder than executable. When dlls are in the same folder both methods below works, when resolver should be triggered = dlls are not in folder - it is not.
The problem is simple. Resolver:
private static Assembly OpcAssRes(object sender, ResolveEventArgs args)
    {
        var ProgramFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
        string OpcAsmPath = Path.Combine(ProgramFiles, "OPC Labs QuickOPC 2020.2", "Assemblies", "net47");
        var ReqAss = new AssemblyName(args.Name).Name;
        foreach (string FAssName in Directory.GetFiles(OpcAsmPath, "*.dll"))
        {
            if (Path.GetFileNameWithoutExtension(FAssName) == ReqAss)
            {
                var DLL = Assembly.LoadFrom(FAssName);
                return DLL;
            }
        }
        return null;
    }

And when I want to instantiate the client using the method from libraries:
Works:
   static void Main(string[] args)
    {
        AppDomain.CurrentDomain.AssemblyResolve += OpcAssRes;
        ClCon();
    }

    static void ClCon()
    {
        var cl = new EasyUAClient();
    }

Does NOT work - Exception is immediately raised, that the library cannot be found. I tried even sleep it before resolver, but it doesnt - instant Exception- like the resolver isnt triggered. When breakpoint is added in resolver, it does not get to it = it is not started.:
       static void Main(string[] args)
    {
        AppDomain.CurrentDomain.AssemblyResolve += OpcAssRes;
        var cl = new EasyUAClient();
    }

Is it normal? Thanks for your advices.

A: Types used in a method are loaded before the method is called. If you bind your assembly resolver inside a method that uses a type in an external assembly, the loader won't be bound yet.


text:
Q: Use of Buffer in C++ I am new to c++, learning through Accelerated C++ by Andrew Koenig and Barbara E. Moo.
I am unable to grasp the concept of buffer in C++ as the book says "Most systems take a significant amount of time to write characters to an output device,
regardless of how many characters there are to write. To avoid the overhead of writing in
response to each output request, the library uses the buffer to accumulate the characters to
be written, and flushes the buffer, by writing its contents to the output device, only when
necessary. By doing so, it can combine several output operations into a single write."
Why do most systems take a significant amount of time to write characters to an output device?
What is this buffer and why do we require it?Why do we require flushing buffers?

A: There are multiple reasons that leads to systems taking significant amount of time for I/O operations : the device may be slow (Hard disk drives), it may require to perform various operations before and/or after writing to it, etc.
Then, a buffer reduces the number of interaction with the device by making bigger but less frequent read/write. Then, it reduces the overhead necessary to perform the operation (in the case of a hard drive, you'll want to write big chunk of data infrequently, rather than small chunks frequently, as it costs to find where to write, etc.).
Moreover, with a buffer, you can even control when you want the I/O operation to be done which can be interesting in particular cases (for example, in a real time application, you'll want to avoid I/O operation while you are running the time-constrained part of the code, storing your data in the buffer, and only doing the I/O operations once you've exited the time-constrained part of the code).

A:
Why do most systems take a significant amount of time to write characters to an output device?

Because most devices are separated from the CPU by a bus, which is much slower to send data across than it is to write to CPU registers or (cached) memory. And many devices involve moving parts (spinning discs or motorised lasers or whatever) which are much, much slower again.

What is this buffer and why do we require it?

It's a lump of memory that we can write individual characters to very quickly, and then send them all to the device in a single batch later. Usually, this is more efficient (often much, much more efficient) than sending each character individually.
For example, storage devices are often only capable of reading and writing a fairly large block of data at a time; typically, a few kilobytes. So writing a single character requires reading a block, modifying a character and writing back the whole block; while flushing a larger buffer might only require writing each block once.

Why do we require flushing buffers?

Because if the data stays in the buffer, it will never reach the device.

A: The output device might be a hard disk, for instance, and writing to the hard disk involved moving the write head around and waiting for the platter to spin to the right place.  Doing that for every character you write to a file would be painfully slow.
A buffer is a queue of characters that are ready to write.  When there are enough characters in the queue, they are all written together in one operation.

A: Some devices are slow, and so it is not efficient to write one character at a time. The efficient way to write to a device is to write a bigger chunk of data at a time. So the buffer is used to accumulate more characters and write them all in one write operation.

A: Let's consider HDD as an output device. Writing to HDD is very slow compared to RAM. It is much faster to write a big chunk of data at once on the HDD then to write a lot of small chunks. The buffer is used to accumulate these chunks. For example, it may wait until you asked to write 1 MB of data total. After that the buffer gets flushed (written) onto the disk. So buffer is just a storage

A:
Why do most systems take a significant amount of time to write characters to an output device?

For common computers, writing anything to a typical output device will take longer than writing to internal volatile memory.

What is this buffer and why do we require it?

A buffer is temporary storage for data that is to be moved somewhere else.

Why do we require flushing buffers?

That is a function of a buffer, described in the link above.

A: I'm unfamiliar with the book, or the quote, so this may not answer your precise point.
Essentially, computers are very fast. It's very quick to move electrons around the place and perform calculations and whatnot. Input/output devices, by contrast, are much slower - disks need to turn around so that the correct part of the surface can be written or read, screens take some time to make the correct part glow in the right colour, etc. etc.
However, a lot of the overhead in writing to an output device is spent writing the first character (or byte, or whatever) and there's very little additional overhead writing several more - once the disk is in the correct position for the first byte, it's in almost the right place for the next and so on; people don't really read the screen a character at a time, they tend to read words or whole sentences so getting that first letter on screen fast isn't worth worying about, you may as well wait until you have several.
Thus, it makes sense to collect many bytes, characters or whatever together and write them all at once. This process is called buffering, and the area of memory in which the data is collected is known as a buffer.
Writing the data in the buffer to the device is known as flushing the buffer.


text:
Q: Writing PHP extension with C++ PHP's core is written in C. But there are (I think) wrappers in C++ to make extension development possible for C++ programmers.
Now doesn't the speed suck if we use C++ to write PHP extensions? Because then the C++ has to be converted into C and then executed properly (I think, if I'm wrong then correct me).

A: Extensions written in C++ will only be marginally slower than those written in C, due to the language overhead.  However, they will still be much faster than writing directly in PHP.
It's not the case the the C++ is "converted into C and then executed properly" - PHP's C source code is compiled down to machine language.  Extensions written in C++ are also compiled to machine language.


text:
Q: Translations with Lighthouse GraphQL I'm using lighthouse on laravel to create APIs for a portal for which I only deal with the development of the backend.
Basically I have to extract a list from a table in the db and so far everything is ok: in the schema file I define the type and the query itself
type StandardLibrary @guard{
    id: ID!
    code: String!
    title: String!
....
}

type Query{
...
    standardLibraries: [StandardLibrary!] @all
...
}

At this point, however, I need to get the translations of the title field from the dedicated json files, and I should have solved it by making a @translate directive that I call next to the field that interests me and implemented as follows
type StandardLibrary @guard{
    id: ID!
    code: String!
    title: String! @translate
....
}

namespace App\GraphQL\Directives;

use Closure;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Schema\Directives\BaseDirective;
use Nuwave\Lighthouse\Schema\Values\FieldValue;
use Nuwave\Lighthouse\Support\Contracts\FieldMiddleware;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;

class TranslateDirective extends BaseDirective implements FieldMiddleware
{
    public static function definition(): string
    {
        return /** @lang GraphQL */ <<<'GRAPHQL'
directive @example on FIELD_DEFINITION
GRAPHQL;
    }

    public function handleField(FieldValue $fieldValue, Closure $next): FieldValue
    {
        $resolver = $fieldValue->getResolver();

        // If you have any work to do that does not require the resolver arguments, do it here.
        // This code is executed only once per field, whereas the resolver can be called often.

        $fieldValue->setResolver(function ($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo) use ($resolver) {
            // Do something before the resolver, e.g. validate $args, check authentication

            // Call the actual resolver
            $result = $resolver($root, $args, $context, $resolveInfo);

            // Do something with the result, e.g. transform some fields

            return __($result,[],'en');
        });

        // Keep the chain of adding field middleware going by calling the next handler.
        // Calling this before or after ->setResolver() allows you to control the
        // order in which middleware is wrapped around the field.
        return $next($fieldValue);
    }
}

It works and if it doesn't find the corresponding translation it returns the contents of the field in the db.
But my problem is: how do I dynamically give the language in the query? I've tried declaring a custom client directive but I can't figure out how to implement it, could someone help me out? At some point I'll also have to fetch from the json other fields (such as the description) not present in the db, so I'd need to fetch the translations via the record id and not directly looking for the column content.

A: You can either do it based on client locale (using the Accept-Language header), or ask API client to explicitly specify expected locales, or even mix both a choose the first-one as a fallback of the second one.
For the header part, I would recommend a Laravel middleware that would simply set the app()->setLocale() based on available locales, and header values.
For the argument, schema would look like this :
title(locale: string): String! @translate

(Yes, argument can exist at any level, not only Query/Mutation)
Value is retrieved as following on directive class:
return __($result,[],$args['locale'] ?? app()->getLocale());


text:
Q: Selenium won't Start headless on remote server I try to automate a routine task on web with Selenium on remote Server.
So when I try to start webdriver in python it fails with connection refused error:
instance-1@instance-1:~$ python
Python 2.7.17 (default, Apr 15 2020, 17:20:14)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> from selenium.webdriver.firefox.options import Options
>>> options = Options()
>>> options.headless = True
>>> options.log.level = "trace"
>>> driver = webdriver.Firefox(options=options )

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/instance1/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/home/instance-1/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/instance-1/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/instance-1/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/instance-1/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: connection refused

I use Python 2.7 and Firefox, detailed versions are below.
instance-1@instance-1:~$
instance-1@instance-1:~$ which firefox
/usr/bin/firefox
instance-1@instance-1:~$ firefox --version
Mozilla Firefox 75.0
instance-1@instance-1:~$ python -c "import selenium; print(selenium.__version__)"
3.141.0
instance-1@instance-1:~$ geckodriver --version
geckodriver 0.26.0 (e9783a644016 2019-10-10 13:38 +0000)

The source code of this program is available from
testing/geckodriver in https://hg.mozilla.org/mozilla-central.

This program is subject to the terms of the Mozilla Public License 2.0.
You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.
instance-1@instance-1:~$ which geckodriver
/usr/local/bin/geckodriver
instance-1@instance-1:~$

Also, I've setted virtual display via Xvbf like this
instance-1@instance-1:~$ Xvfb :99 -ac &
[1] 16171
instance-1@instance-1:~$ export DISPLAY=:99

My geckotrace output is
1588545824498   mozrunner::runner       INFO    Running command: "/usr/bin/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileOn8vbe"
1588545824519   geckodriver::marionette DEBUG   Waiting 60s to connect to browser on 127.0.0.1:44835
*** You are running in headless mode.
1588545828833   addons.webextension.doh-rollout@mozilla.org     WARN    Loading extension 'doh-rollout@mozilla.org': Reading manifest: Invalid extension permission: networkStatus
1588545829585   addons.webextension.screenshots@mozilla.org     WARN    Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1588545829585   addons.webextension.screenshots@mozilla.org     WARN    Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1588545829585   addons.webextension.screenshots@mozilla.org     WARN    Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1588545829585   addons.webextension.screenshots@mozilla.org     WARN    Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1588545830466   Marionette      TRACE   Marionette enabled
1588545831067   Marionette      TRACE   Received observer notification toplevel-window-ready
1588545884800   mozrunner::runner       DEBUG   Killing process 16183
Exiting due to channel error.
Exiting due to channel error.
1588545885811   webdriver::server       DEBUG   <- 500 Internal Server Error {"value":{"error":"timeout","message":"connection refused","stacktrace":""}}

Should I specify something else?

A: Solved problem like this:

*

*Reboot node in order to drop all settings made and processes locked

*Use xvfbwrapper instead of running headless Firefox

*Be sure to close driver and virtual display

Code example
from xvfbwrapper import Xvfb
from selenium import webdriver
vdisplay = Xvfb()
vdisplay.start()
driver = webdriver.Firefox()
driver.quit()
vdisplay.stop()


text:
Q: Problems with Proxy in Eclipse I have a proxy in my clipse. The settings are all ok, it's the same proxy I have on Chrome.
When I debug my application and try to acess a webservice from my client's application, the proxy should let me through.
The problem is that there's no request being sent to the proxy. I've been monitoring the network traffic with WireShark and I see no request to the proxy when I debug my application.
When I open Chrome and the proxy asks for authentication, the request appears on WireShark.
Anyone has any idea why??
Tks in advance

A: The Eclipse proxy setting is just for Eclipse itself.
You need to explicitly configure your own applications to use the same proxy settings.


text:
Q: Delete PDF file in iText I am creating PDF using iText
 FileOutputStream fileOutputStream=new FileOutputStream(filePath);
 PdfWriter writer = PdfWriter.getInstance(document,fileOutputStream);
 document.open();

and that particular file is going to save in given path(mention Folder) and path is mention in PripertyLibrary file.
I can see the generated file in mention path. Now I want to delete the generated PDF file from the folder after function.
Please help me out!
Thanks in Advance...

A: close() all you can: document, writer, fileOutputStream; maybe with try {} finally {} or try (...) {}. Probably the application keeps the file open.
And then
File file = new File(filePath);
if (!file.delete()) {
    ... error
}

The background is, that iText uses some partial APIs with with their own close method.


text:
Q: ZipFile inside a ZipFile (Python) BACKGROUND
I have some directory in my home directory called delivery_content. Inside that directory there are two folders content_123 and content_456. Each directory contains a text file. So the over all structure looks like the following.
-delivery_content
 -content_123/
   -content_123.txt
 -content_456/
   -content_456.txt

I am writing code that when given a directory it will zip all of it's contents.
CODE
import os
import shutil
from pathlib import Path
from datetime import datetime

DOWNLOAD_DIR = Path(os.getenv("HOME")) / "delivery_content"

date = datetime.today().strftime("%Y-%m-%d")
delivery_name = f"foo_{date}"
shutil.make_archive(str(DOWNLOAD_DIR / delivery_name), "zip", str(DOWNLOAD_DIR))
print("Zipping Has Complete")

So for the given code above i expect to see a foo_todays_date.zip in the DOWNLOAD_DIR and when i unzip it i expect to see the following
 -content_123/
   -content_123.txt
 -content_456/
   -content_456.txt

However I see the following
Is there a way i can avoid having a .zip inside my zipfile?

A: The problem is that you are putting the zip file inside the directory that you are archiving. make_archive is probably creating an empty file to verify it can write to the destination before it starts archiving. So it then sees the empty zip file as a file to archive. The only way I see around this using the make_archive function is to put the archive file outside of the directory to archive like below:
shutil.make_archive(str(DOWNLOAD_DIR / ".."/ delivery_name), "zip", str(DOWNLOAD_DIR))

You can always move the zip file into the DOWNLOAD_DIR afterward.


text:
Q: Is it worth unlocking potential only to merge? I have kind of a Nino-centric team which is obviously led by a 5☆ Nino. I also recently obtained another Nino, but this time, she is a 4☆.
I have been trying to decide whether I should unlock the 4☆ Nino's potential for the sole purpose of merging with my existing 5☆ Nino or if I should just save the feathers to unlock another hero's potential later on, for instance, the heroes that are obtained through Grand Hero Battles as 3☆ or 4☆ only.
What I want to know is whether the benefit of having a level 40+1 5☆ Nino outweighs the benefit of unlocking the potential of a 4☆ hero into a 5☆ one. In general, is promoting for the sole purpose of merging worthwhile or cost-effective, or is it best to only merge heroes if I happen to get two of the same 5☆ hero?
For context, I have been managing to get quite a bit of feathers per Arena season (5k+). Combined with regular missions, I think I'm making roughly 7k feathers per month.
UPDATE - Just to give a little update on how my experience went
I did promote some heroes to 5*, but ended up sticking with my original Nino-centric team. Putting up a new solid team together is pretty hard, and I decided to focus on my main team while I don't have enought 5* heroes to make another arena competitive team.
I found that promoting the Askr trio was the most benefical choice to do with the feathers, and after that I went for the Super Nino, which is now +7, truly a powerhouse.

A: It ultimately depends on your personal preference, but there are some pros and cons to each side.
If you want to promote your 4☆ Nino solely to merge, then it would be best to stick to that plan and promote up any 4☆ Ninos you get in the future to merge with your "master" Nino. A level 40+1 Nino is nothing special. It's not until +4 or +5 where it really starts making a difference. However, you have to really be sure you want to commit to that. The feather cost of getting a +10 hero is astronomical, assuming you have to promote all 10 merged heroes, that's a minimum of 200,000 feathers. However, in the end, your Nino would be exceptionally strong and pretty tough, especially in the Arena.
On the other hand, the jump from a 4☆ hero to a 5☆ hero is quite drastic and, in many cases, unlocks unique weapons or third tier skills that are very useful. In your question, you mentioned Grand Hero Battle heroes, who never come as 5☆ units, requiring you to promote them to unlock their full potential. Of the past handful of these GHB heroes were Xander and Camus, two top-tier heroes whose true potential is only realized once they've been promoted to 5☆ so that they have access to their unique Distant Counter weapons. Dropping 20,000 feathers on these units as they come up is not a bad strategy, as it allows you to diversify your teams to handle different types of challenges.
The choice really boils down to whether you want to commit a lot of time and effort (and likely, money) to create a super Nino or use feathers on various units as you see fit to have an army of relatively good 5☆ heroes.


text:
Q: Are the stars in map A obtainable during your first time in the map? I'm in Map A on my first time through.  I've encountered a couple of stars that are behind a force field that's controlled by a red connector, however there are no red power sources in that puzzle.  Does this mean I have to come back later, after I've gotten more experience, to solve access to these stars?

A: At times you have to think outside the box or more specifically outside the puzzle. From memory all stars are achievable the first time you get to their maps but I may be wrong.
I can certainly say that at no point will you get the ability to change blue power to red power or anything like that.

A: I'm pretty sure just about every star is attainable as soon as you come across it.  I know of one that isn't (provided you go right to it):

 The one in the building behind the tower.  You'll need a couple connectors from the tower itself (and the axe) to get that one

Other than that; It's really thinking outside the box.  If you're in a level where you need a Red Connector, but there are only blues; you're going to have to find a way to access assets from another puzzle than the one you're currently in.

A: All stars in the "room" are achievable once you can do all puzzles in the "room", this is for sure.
To get them you need to think like with usual puzzles and explore, much more than at usual puzzles.


text:
Q: Sidebar missing from Cases Record Detail page None of the sidebar items (Create New, Recent Items) show up. There is essentially no sidebar on the Case Record Detail page.
I have "Show Custom Sidebar Components on All Pages" checked in Setup>Customize>User Interface. I also have Enable Collapsible Sidebar turned off.
I checked the css and:
.sidebarCollapsed #sidebarDiv {
    display: none
}

is the only thing that would hide it, but I have collapsible sidebars turned off.
It appears that the whole sidebar is just missing on the Case Details View page. Any ideas?
Force.com Quick Access Menu is missing as well.
EDIT - Someone brought up that it might be something related to Feed based Case Layout pages introduced in Spring '14. Here are the page layouts I have available - http://screencast.com/t/rNRX0ChD
Found this 'Hide Sidebar' option on the Feed Layout Editor. Already was unchecked - http://screencast.com/t/Pubeg1hiT

A: I had a similar problem when trying to set up Case Feed in the last few days.
One item that confused me was that after making changes in the "Custom Console Components" I went back into the Console view and refreshed my browser to see if changes had taken effect - nothing seemed to have happened. HOWEVER - I was observing this on a case that was already open in the console view. Closing the Case and reopening it allowed me to see that the changes HAD taken effect. Simple - but annoying.
Another thing to look out for is to check that you are looking at the right Page Layout. Obvious I know, but even as Sys Admin it might be that you have not enabled the Page Layout for your profile.
I made a large number of configuration changes in my attempt to work out what was going wrong, so I may have done something else to get it working - including removing all the components showing in the Left and Right pane (in the Other Feed View>Other Tools & Components). But this may have been inconsequential - and the primary issue of not closing and reopening the case being the thing that was confusing me.
Perhaps my frustrating experience will help some other poor unfortunate soul who is struggling with this!

A: On the feed view of the case feed page layout, we have a checkbox to hide the sidebar.  You need to uncheck this to make the Sidebar visible on the case detail page.
Hope, this helps you.

A: Can you check if case feeds are enabled for your org?
Setup --> cases --> support settings --> Enable Case Feed Actions

Enable Case Feed Actions and Feed Items
Checked
Use this setting to
turn on Case Feed-specific actions and feed items. When you select
this option, existing cases are upgraded to the Case Feed user
interface.


text:
Q: ECHOLIFE HG8245c not resetting nor i can access 192.168.1.1 i have GPON router mode number EchoLie hg8245C It was working fine untill i uncheck the option ofenable SSID now neither the wifi is turning on nor i can access the router via lan cable i.e it is not taking me to 192.168.1.1 . ifconfig gives following out out in terminal
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet6 fe80::ee71:6727:7413:430b  prefixlen 64  scopeid 0x20<link>
    ether d0:17:c2:17:59:40  txqueuelen 1000  (Ethernet)
    RX packets 15709  bytes 10971495 (10.9 MB)
    RX errors 0  dropped 58  overruns 0  frame 0
    TX packets 16621  bytes 12300903 (12.3 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

i also tried to rest it via reset button but it is not resetting even tried pressing button for 1 minute

A: solved. i set my ip,default gateway and subnet manually and tried again.finally was able to access the router page and problem resloved.
actually previously i was trying to set 192.168.1.1 ip address [ as written on back of my router] and it didnt worked today i tries 192.168.100.1 as ip [provided by my isp who provided this router] and it worked like charm.


text:
Q: What happens when you call glClearColor with a negative argument? I'm working on a simple OpenGL application that allows the user to adjust the background color of a simple window by clicking and dragging to either then left (make it less intense) or the right (more intense). When dragging to the right, for example, I have something like this:
intensity += 0.0001*x;  //where x is the current mouse location

...and to the left, the other way:
intensity -= 0.0001*x;

intensity is global static GLfloat that gets passed to glClearColor in the display function, which is called multiple times. This strategy works just fine when the user intensifies the color while dragging right, but it messes up after a certain point when dragging left: the color becomes less intense as I drag along and returns to black as it should, but then intensifies back into the original color.
I think the problem is that the intensity, which should be between 0 and 1, is becoming negative when I drag too far and, thus, glClearColor is fixing the problem by just changing the sign back to positive (?). If that is the case, how can I enforce that the values passed to glClearColor stay in the proper range? I tried to fix the problem by making sure that the current intensity would not become negative/adjustment would not happen if it is already too low, but it didn't seem to work:
if(x <= xPrev && intensity >= (.0001*x))  //moving left to de-intensify color
  intensity -= 0.0001*x;

...Am I doing this incorrectly, or is glClearColor handling negative values differently than I expect?
Another interesting issue that came up is that my "intensity" adjustments only seem to work on the r, g, and/or b values (i.e., I pass "intensity" as one of those in glClearColor. Using the a value didn't work...but isn't it supposed to change color intensity?

A: This sounds a bit like a hysteresis problem. It's not clear how events are received, or what coordinate system x is in. Perhaps drop an 'anchor' (xStart) when the button is pressed, and handle all subsequent values while dragging as an offset from this value. What toolkit / library are you using for windows and events? If you launch from a console, perhaps add a trace statements like:
fprintf(stderr, "%.8e\n", x);
to see if the values of x correspond to what you're expecting on each frame.
glClearColor clamps values to [0, 1], so it's probably not the issue. Perhaps a trace for intensity would be useful?


text:
Q: Reset of reactive form removes disabled fields How to prevent removing disabled fields while reset.
This is part of my code:
this.updateInformationForm = this.fb.group({
  'first_name': [first_name, Validators.required],
  'last_name': [last_name, Validators.required],
  'address1': [address1, Validators.required],
  'address2': [address2, Validators.required],
  'city': [city, Validators.required],
  'state': [state, Validators.required],
  'zip': [zip, Validators.required],
  'phone': [phone, Validators.required],
  'dob': [dob, Validators.required],
  'gender': [gender, Validators.required],
  'email': [email, Validators.required],
});

this.updateInformationForm.controls['first_name'].disable();
this.updateInformationForm.controls['last_name'].disable();
this.updateInformationForm.controls['email'].disable();

and my reset method:
  clear(): void {
    this.updateInformationForm.reset();
  }

A: Add your disabling when you build the form instead. Assumingly here you don't want to set any default values when resetting, but just emptying all fields, but if you initially set a field as disabled when building the form, it will stay disabled after reset:
constructor(private fb: FormBuilder) {
  this.updateInformationForm = this.fb.group({
    // set as disabled already here!
    first_name: [{ value: 'first name', disabled: true }],
    last_name: ['last name']
  });
}

DEMO


text:
Q: Relation between different inner products on space of functions on an interval $[a,b]$. I was wondering whether we can say something about different inner product spaces of the form:
$L_\omega^2[a,b]= \Big \{f:[a,b]\rightarrow \mathbb{R}: \langle f,  f\rangle_\omega<\infty \Big\}$ where $\omega:[a,b]\rightarrow \mathbb{R}$ is an almost sure positive function (with respect to the Lebesgue measure) such that $\langle 1,1 \rangle_{\omega}$ is finite.
Are there conditions under which we can say for two such "weight" functions, $\omega_1, \omega_2$, that $L_{\omega_1}^2[a,b]\subseteq L_{\omega_2}^2[a,b]$?
This stems from a particular case which I encountered where $[a,b]=[-1,1]$, $\omega_1(x)\equiv 1$ and $\omega_2(x)=\frac{1}{\sqrt{1-x^2}}$. I was wondering whether every $f\in L^2[-1,1]$ can be written as a generalized Fourier series with respect to an orthonormal basis in $L^2_{\frac{1}{\sqrt{1-x^2}}}[-1,1]$?

A: $L_{\omega_1}^2[a,b]\subseteq L_{\omega_2}^2[a,b]$ iff $w_2 \leq C w_1$ almost everywhere for some finite constant $C$. Proof. Using Closed Graph Theorem we can see easily that  the inclusion map is continuous. [You will have to use the fact that convergence in the these norms imply almost sure convergence for a subsequence].  Hence $\|f\|_{L_{\omega_2}^2[a,b]} \leq C \|f\|_{L_{\omega_2}^2[a,b]} $ for some $C$ and for  all $f$  which implies that $w_2 \leq C w_1$ almost everywhere


text:
Q: Proof of Herglotz Theorem in Time Series Analysis I am studying time series, following Time Series Theory and Methods by Brockwell and Davis. I am reading the proof of the Herglotz Theorem, I have the following questions.
First, the proof given in the book is the next one:

I don´t understand the equality given in the proof (I drew an arrow there)
 How to get $\frac{1}{2\pi N}\displaystyle\sum_{|m|-N}(N-|m|)e^{imv}\gamma(v)$
Aditionally, I don't have clear why is possible to say that $f_N(.)I_{(-\pi,\pi]}$ is a density function?
I add the part where is mentioned that $f_N$ is a density, I don´t have clear why it is true.

A: It's something similar to the change of variable trick in integration. The two expressions in the text clearly indicate you to consider substituting $r - s$ with $m$. The details are spelled out as follows.
For simplicity, let's denote the summand $e^{-i(r - s)v}\gamma(r - s)$ by a bivariate function $K(r, s)$, whose domain is the set of $N \times N$ grid points $\{1, 2, \ldots, N\} \times \{1, 2, \ldots, N\}$. On the other hand, note that $K(r, s)$ is completely determined by the coordinate differences $m := r - s$, therefore may also be denoted by $\tilde{K}(m)$. The challenge is to express the double sum $S := \sum_{r = 1}^N \sum_{s = 1}^N K(r, s)$ in terms of the new summing index $m$. I will illustrate this transformation process in matrix form as follows.
In terms of $(r, s)$, we are effectively summing over the matrix (think the row corresponds to $r$ and the column corresponds to $s$):
\begin{align}
\begin{bmatrix}
K(1, 1) & K(1, 2) & \cdots & K(1, N) \\
K(2, 1) & K(2, 2) & \cdots & K(2, N) \\
\vdots & \vdots & \ddots & \vdots \\
K(N, 1) & K(N, 2) & \cdots & K(N, N)
\end{bmatrix}. \tag{1}
\end{align}
As stated before, since $K(r, s) = \tilde{K}(r - s) = \tilde{K}(m)$, matrix
$(1)$ is equal to
\begin{align}
\begin{bmatrix}
\tilde{K}(0) & \tilde{K}(-1) & \cdots & \tilde{K}(1 - N) \\
\tilde{K}(1) & \tilde{K}(0) & \cdots & \tilde{K}(2 - N) \\
\vdots & \vdots & \ddots & \vdots \\
\tilde{K}(N - 1) & \tilde{K}(N - 2) & \cdots & \tilde{K}(0)
\end{bmatrix}. \tag{2}
\end{align}
The entries in matrix $(2)$ can be summed over diagonally. For example, there are $N$ terms $\tilde{K}(0)$ lie on the main diagonal line, which corresponds to $m = 0$. There are $N - 1$ terms of $\tilde{K}(-1)$ and
$\tilde{K}(1)$ lie on the first off-diagonal line of the upper triangle and that of the lower triangle, which correspond to $m = -1$ and $m = 1$, respectively. In general, on the $m$-th off-diagonal line of the upper triangle, there are $N - m$ terms of $\tilde{K}(-m)$, while on the $m$-th
off-diagonal line of the lower triangle, there are $N - m$ terms of $\tilde{K}(m)$. Summing all the $N^2$ terms of $\tilde{K}(\cdot)$ in this way, we obtain
\begin{align}
S = & \sum_{\text{upper triangle}} \tilde{K}(\cdot) + \sum_{\text{diagonal}}\tilde{K}(\cdot) + \sum_{\text{lower triangle}}\tilde{K}(\cdot) \\
= & \sum_{m = 1}^{N - 1} (N - m)\tilde{K}(-m) + N\tilde{K}(0) + \sum_{m = 1}^{N - 1}(N - m)\tilde{K}(m) \\
= & \sum_{|m| < N} (N - |m|)\tilde{K}(m).
\end{align}
This completes the proof.
For your second question, to show $f_N(\cdot)I_{(-\pi, \pi]}(\cdot)$ is a density function, since $f_N(v) \geq 0$ for all $v \in (-\pi, \pi]$, it suffices to show that
$$\int_{-\pi}^{\pi}f_N(v) dv = 1.$$
By the identity we just proved, together with the linearity of the integral,
$$\int_{-\pi}^{\pi} f_N(v) dv = \frac{1}{2\pi N}\sum_{|m| < N} (N - |m|)\gamma(m) \int_{-\pi}^{\pi} e^{imv} dv.$$
It is easy to show (also well-known as the orthogonality of Fourier basis) that
\begin{align}
\int_{-\pi}^{\pi} e^{imv} dv = \begin{cases}
0 & m \neq 0, \\
2\pi & m = 0.
\end{cases}
\end{align}
Combining this with the fact $\gamma(0) = 1$, it follows that $\int_{-\pi}^{\pi} f_N(v) dv = 1$.
PS: I found your question is more about pure mathematical derivation, which may be more appropriate to be asked at Mathematics Stack Exchange. Indeed, this time series book you are reading is written in a very rigorous way.


text:
Q: Using JQuery to Style form elements I've seen jquery used to change a form select drop down box in to a 'pretty' drop down list widget.  I can't remember where I saw this but does anyone have any links or example code which show examples of how to use jquery to style form elements?  I'd prefer it if it was code rather than a built in plug in.
Thanks

A: You can't really style drop-downs. They're OS-level elements, not CSS elements. You can replace them with a combination of DIVs to emulate a drop-down, but styling on drop-downs themselves is rather limited.

A: try the select box replacement from filament group that support jquery ui theme roll!

http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/

for check boxes try this:

http://www.thecssninja.com/css/custom-inputs-using-css

for other form elements just use CSS and images!

A: You might like this or this (smoother initial look) plugin. Both plugins aim at unobtrusively replacing the default <select> box.

A: jQtransform is the best Plugin i found so far, This one is very easy to implement, and progressive enhanced.
This one also unobtrusively replaces the default <select> box.
Also Here is another one:  uniform plugin this one has many options.


text:
Q: Binary search in array cannot find number correctly Binary search is not working for number 5,3 and 7 in the array when I change the target value program shows no result.
package com.company;
public class Main {

    public static void main(String[] args) {

        int[] array = {8, 2, 5, 3, 4, 7, 6, 1,9};

         int low=0;
         int target=4;
         int high=array.length-1;
         while (low<=high){
             int middle=low+(high-low)/2;
             int value=array[middle];
             System.out.println(middle);
             if(value<target){
                 low=middle+1;

             }
             else if(value>target)
                 high=middle-1;

             else
             {
                 System.out.println("found "+middle);
                break;
             }

         }

    }

}

what do I need to change in code

A: The array must be sorted for binary search to work. Try adding Arrays.sort(array); right before the search. (Here's the documentation for that method.)


text:
Q: Invoke list of methods by using reflection I'm using the publish subscribe pattern inside a WCF environment.
When I want to publish a message from the pub\sub service to the subscribers
i'm doing it by using reflection.
i'm invoking the methods one by one using foreach.
How can I do this operation async?
thanks

A: If you would like to run each method invocation asynchronously and don't care about return values you can just spin of each one of them on a new thread pool thread, for example using System.Threading.ThreadPool.QueueUserWorkItem(WaitCallback).
If you're in a more advanced scenario, there's the TPL (Task Parallel Library), Rx.NET (Reactive Extensions) and other more structured and capable ways of doing this.


text:
Q: Restrict system.log logging to particular error level? By default Magento logs notices, warnings and errors into the system.log file. Is it possible to restrict the log level so that Magento doesn't log PHP notices?
Magento's Mage::log() method offers the option to set the log level by providing, e.g. Zend_Log::DEBUG as a parameter, and it'd be great to suppress logging of PHP notices.
ps. I do know that fixing the code producing the errors would be recommended, but the errors originate from third-party code and extensions, so that'd be impossible to manage.

A: I think you'd like to set the level to Zend_Log::WARN, according to Zend_Log:
const EMERG   = 0;  // Emergency: system is unusable
const ALERT   = 1;  // Alert: action must be taken immediately
const CRIT    = 2;  // Critical: critical conditions
const ERR     = 3;  // Error: error conditions
const WARN    = 4;  // Warning: warning conditions
const NOTICE  = 5;  // Notice: normal but significant condition
const INFO    = 6;  // Informational: informational messages
const DEBUG   = 7;  // Debug: debug messages

As I see you cannot and won't go through the 3rd party code and set this globally, you could try to adjust the PHP error reporting this way:
error_reporting(E_ALL ^ E_NOTICE);

I didn't test it but maybe it helps to get rid of the entries in the log.

A: For advanced logging capabilities, take a look at https://github.com/magento-hackathon/Logger


text:
Q: How make kendoUI Drag-and-drop work correct? I'm using kendoUI drag-and-drop control to make sort to my list. I find this jsfiddle http://jsfiddle.net/rusev/nmB69/ and there everything works correct, but when I implement this in my website It isn't work.
I use jquery-1.7.1.min.js and kendo.all.min.js on my page.
If you look to fiddle you can see some console.log. Values which I log in this are different for fiddle and my application for example:
in fiddle i get in console:
1
u.extend.f
[3	]
u.extend.f

in the same situation in my application I get:
undefined
undefined
[Text 1	]
undefined

And element which is created in hint parameter is displaying after I drop it.
I'm new in Kendo UI so I have no idea how fix it.
Any help would be appreciated.

A: I tried this and had the same problem as you. Then I noticed that the jsfiddle example is using Kendo UI v2011.3.1129 and I was using Kendo UI Beta v2012.2.621. There were breaking changes between these versions.
The solution would be to either use the same version as the jsfiddle example or to change your code. I changed my code in two places when getting the datasouce. The Grid widget is now using the uid field of the Model instead of the id, which represents its unique id. Also, in order to retrieve Model instance by its uid, DataSource's getByUid method should be used.
jsfiddle example:
var target = dataSource.get($(e.draggable.currentTarget).data("id"))

changed code
var target = dataSource.getByUid($(e.draggable.currentTarget).data("uid"))

This has to be done for both the target and destination.
    grid.table/*.find("tbody > tr")*/.kendoDropTarget({
      group: "gridGroup",
      drop: function (e) {
        var target = dataSource.getByUid($(e.draggable.currentTarget).data("uid")),
              dest = $(e.target);

        if (dest.is("th")) {
          return;
        }
        dest = dataSource.getByUid(dest.parent().data("uid"));

        //not on same item
        if (target.get("id") !== dest.get("id")) {
          //reorder the items
          var tmp = target.get("position");
          target.set("position", dest.get("position"));
          dest.set("position", tmp);

          dataSource.sort({ field: "position", dir: "asc" });
        }
      }
    });


text:
Q: CSS: Is height:100% Reliable for initial page loading for container? When a user lands on the page, I'd like the container that houses the "search" to take up the whole page.
Easy enough: height: 100%;
User scrolls down if desired, sees rest of content.
This is one of those instances where it seems too good to be true...
Perhaps in many cases the user will scroll down and the page will get bigger...
Is this a good solution?
code:
.ss_search{
    clear: both;
    margin-top: 25px;
    height: 100%;
}

A: Several things you need to watch out for:
Padding and Margins: These will mess with height:100% depending with the margin is applied. For instance if you put a h1 inside a div with height:100% the margin on the h1 will cause issues for you. Also note: html (or body, I forget which one) also have a 5px or 10px padding associated with them.
Height on html/body: Depending on the browser you may experience a div with height:100% not going 100%. You may need to set html and body to a height of 100%. This is what I usually do.
Nothing more comes to mind. Take a look at this. It will have a full screen green area, then when you scroll you will see a full screen red area:


text:
Q: PHP Header not Working (No Errors!) so I had my website for a while now and now the host made some changes, so I had to change all my file names from *.html to *.php. Obviously made the necessary changes, yet now the .php extension seems to have done a couple of additional things.
Header("Location: page.php"); doesn't work anymore, as seen in this example:
if(isset($_GET['logoff']))
{
    $_SESSION = array();
    session_destroy();
    header("Location: index.php");
    exit;
}

The chunk of code above does what it's supposed to do, but instead of re-directing to index.php page, it adds a ?logoff in page name, and I have to manually head to another page to fix this. Could you explain me why, and how I can solve this ?
What is strange is that Header works perfectly fine in other files. This is really frustrating.

A: for the first...  $_SESSION is a global var... why you declare it? And for use $_SESSION, on top of the page you must write session_start() and, for header , i'll suggest you to use: ob_start

A: Try adding:
ini_set('display_errors', 'On');
error_reporting(E_ALL);
on the top of the file to debug the PHP Errors

A: Couldn't figure out the issue, none of the solutions worked so I will just use the client-sided alternative:
printf("<script>window.location = 'link';</script>");


text:
Q: Admin Page Error after login admin I got 404 error after login to admin.

And if click other item, it is working correctly now.

A: Please share the url you are accessing.
I think you are going to a custom page and not to the magento dashboard!
This is magento dashboard url.


text:
Q: Using basic authentication with SyncFusion ej.DataManager I'm struggling to setup SyncFusions ej.Grid to use basic authentication when getting or updating data with my API. Has anyone had experience with this? Their examples seem sparse.
I've got some examples below of what I've tried. Given the following setup code:
var ticket = "Basic " + Base64.encode("username:password");

$('#Grid').ejGrid({
    dataSource: dataManager,
    allowPaging: true,
    columns: ["AccountName", "CompanyName"]
});

This code brings up chrome basic auth prompt:
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor()
});

This code brings up chrome basic auth prompt.
Attempted because there is a "headers" object used in data.min.js
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor(),
    headers: {
        Authorization: ticket
    }
});

This code errors: Uncaught TypeError: this.adaptor.processQuery is not a function
Attempted due to https://www.syncfusion.com/forums/117024/does-datamanager-support-odata-v4
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor().extend({
        beforeSend: function() {
            request.setRequestHeader("Authorization", ticket);
        }
    })
});

This code brings up chrome basic auth prompt:
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor(),
    beforeSend: function() {
        request.setRequestHeader("Authorization", ticket);
    }
});

This code brings up chrome basic auth prompt:
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor()
});

dataManager.dataSource.beforeSend = function() {
    request.setRequestHeader("Authorization", ticket);
}

A: After much debugging of minified code I have found that the ej.DataManager constructor does accept a headers property, but requires a list of objects and uses each of the properties of each of those objects as HTTP headers. So the following code will include the header you are looking for:
var dataManager = ej.DataManager({
    url: "/api/app/imports/3",
    adaptor: new ej.WebApiAdaptor(),
    headers: [{
        Authorization: ticket
    }]
});


text:
Q: GNU make: Execute target but take dependency from file I want the rules of a target to be executed but all dependent targets shall regard this target as satisfied.
How can I achieve this?
Example:
$(NETWORK_SHARE)/foo.log:
    @echo Warning: server offline, still continue ...
    @exit 0

foo.csv: $(NETWORK_SHARE)/foo.log
    @echo Long export from a (different) server
    @echo sleep 20
    @echo foo > $@

If $(NETWORK_SHARE)/foo.log exists: foo.csv shall be rebuilt if $(NETWORK_SHARE)/foo.log is newer than foo.csv; otherwise nothing should happen (default)
If $(NETWORK_SHARE)/foo.log does not exist (e.g., server offline, failure, ...) only a message indicating a problem should be printed but foo.csv shall only be built if foo.csv does not exist.
I played around with .PHONY and returning different return values but for case 2, the expensive "export" happens as soon as I execute something on $(NETWORK_SHARE)/foo.log ...
Regards
divB

A: Looks like instead of using some old file (that someone can accidentally touch), you can use an order-only prerequisite. Here's a quote from the GNU makefile manual (chapter 4.3)

Occasionally, however, you have a situation where you want to impose a
  specific ordering on the rules to be invoked without forcing the
  target to be updated if one of those rules is executed. In that case,
  you want to define order-only prerequisites. Order-only prerequisites
  can be specified by placing a pipe symbol (|) in the prerequisites
  list: any prerequisites to the left of the pipe symbol are normal; any
  prerequisites to the right are order-only:
 targets : normal-prerequisites | order-only-prerequisites

A: Great, thanks to Thiton's answer in my related question (Force make to find out-of-date condition from file) I can now provide a hack to solve this:
.PHONY: always-remake

NETWORK_SHARE = //server/dfs/common/logs

.PHONY: all
all: foo.csv

# file does not exist ...
ifeq "$(wildcard $(NETWORK_SHARE)/foo.log)" ""

old_file: always-remake
    @echo Warning: network is not available ....

foo.csv: old_file
    @echo Expensive export
    @sleep 10
    @echo $@ > $@
else
foo.csv: $(NETWORK_SHARE)/foo.log
    @echo Doing expensive export since log file changed ...
    @sleep 10
    @echo $@ > $@
endif

"old_file" is a dummy file which must exist and should never be newer than any other file (e.g. 1/1/1971, 00:00)
Regards
divB


text:
Q: Como transformar Y-m-d para Unix timestamp à meia noite em PHP? Boa tarde,
Estou precisando converter os dados de um formulário que vem no formato ex: 2018-02-13 para UNIX à meia-noite.
Se eu converto normalmente usando o strtotime ele vem certo mas com o horário as 6:00AM.
Alguem pode dar uma luz?
Obrigado =)

A: Resolvido,
$check_in = strtotime('-6 hour' , strtotime($arrival));


text:
Q: Getting 2 last elements of a url address I'm trying to reach only the the site name and the domain, for example in case of images.google.com/thisIsJustAnExample it will return google.com.
this is what I tried to do,
  $url = 'https://images.google.com/thisIsJustAnExample';
  $zobrazeni = array();
  $zobrazeni = parse_url($url);
  $zobrazeni["host"] = explode(".", $zobrazeni["host"]);
  $zobrazeni["host"] = $zobrazeni["host"][count($zobrazeni["host"])-2] .".". $zobrazeni["host"][count($zobrazni["host"])-1];

And this is the Error I get:
Notice: Undefined offset: -1 in C:\xampp\htdocs\retezce.php on line 25
Notice: Undefined variable: zobrazni in C:\xampp\htdocs\retezce.php on line 25
Notice: Undefined offset: -1 in C:\xampp\htdocs\retezce.php on line 25

A: just play with this code, it should print "google"."com" if thats what you meant.
just remember that count($verb) (in case $verb is array) will return the number of the objects in the array.
$url = "http://stackoverflow.com/questions/29731201/getting-2-last-elements-of-a-url-address/29731258#29731258";
$verbs = explode('.', $url);

$domainName = explode('/', $verbs[count($verbs)-2]);
$domainExt = explode('/', $verbs[count($verbs)-1]);

echo $domainName[2] . "." . $domainExt[0];

A: There are a few ways to do this but one would be:
  $url = 'https://images.google.com/thisIsJustAnExample';
  $zobrazeni = array();
  $zobrazeni = parse_url($url);
  $zobrazeni = explode(".", $zobrazeni["host"]);
  $zobrazeni =  array_reverse($zobrazeni);
  $zobrazeni = $zobrazeni[1] . ' .' . $zobrazeni[0];

Or you could get the length of the array and use that instead of trying to subtract 2.


text:
Q: Change default Maximum Row Height SETTING in Excel 2010+ I'm using Excel for a variety of tasks. In this case, I'm analyzing CSV files of logs exported from Splunk, which often include stack traces, debugs with large XML documents, etc.
I know the maximum row height is 409 (or 409.5). I know how to select rows and do AutoSize Height.
What I cannot find is how to change the default maximum row height setting from 409 to 45 (3 lines in the default font size) so I don't have to do "AutoSize Height" every time I open an exported log file.
I thought this setting might be in Options->Advanced but it is not. Is it accessible? If so, where can I find it?


text:
Q: Parse JSON without a particular standard structure into a Map or Java Object It will be great if I can map the json to a Java object but the structure is pretty weird, it is different for all the json I am trying to parse. eg categories and topics can have different. How I can map it to a Java object, or any other suggestion??
"name":"url",
"categories":
{
"249":{"catID":"249","score":33.43533451973102},
"34":{"catID":"34","score":3.0000000447034836},
.,.,so on
},
"topics":{
"DSLR":{"weight":1.6690950917579026,"noun":1},
"illuminated":{"weight":7.6470197510265105,"noun":0},
.
.so on
}}

A: Can you at least count on the JSON representation being consistent for each type of response / object mapping? If so, you can use the Google GSON library, and create a custom deserializer to handle the non-standard JSON representation.  Here is a link to the project:
http://code.google.com/p/google-gson/
and to the user guide on how to create custom serializers / deserializers:
https://sites.google.com/site/gson/gson-user-guide#TOC-Custom-Serialization-and-Deserialization

A: There is a library for that: org.json . To parse a JSONObject from a String, you say:
JSONObject jo = new JSONObject(string);

However, if the string represents an array instead of a map, use:
JSONArray ja = new JSONArray(string);


text:
Q: zfloat directive for angular no work I'm using breeze 1.5.0 and angular 1.3.0 rc1 I'm binding directly to a breeze entity to a property of type decimal? using the input in html table like this:

        Column1

                <input ng-model="c.value" z-float />

But comma and decimal point are ignored after entered a number [0-9]. For example I did'n enter the value "9.99".
I try this, but It didn't work. I did'n enter decimal values:
<input ng-model="vm.items[0].children[0].value" z-float />

I used "Angular Float Directive" more information here.

A: Nothing wrong with Breeze. They broke it in Angular.1.3.0.  Now I have to find how and why.
FWIW, commas NEVER worked. JavaScript doesn't support ',' when parsing numeric strings and neither does it support internationalization of numbers (e.g., ',' for a decimal point).
Update 22 Sept 2014
Discovered they broke the signature of $formatters for v.1.3.0 and didn't tell anyone.See https://github.com/angular/angular.js/issues/9218
I have updated breeze.angular.directives to v.1.3.9 so it should now work with both versions.
See updated plunker: http://plnkr.co/edit/E2HgF7ASNWIdwsvzs5G0?p=preview which changed the zFloat model-value/element-value comparison from
return (value === +viewValue) ? viewValue : value;

to
return (+viewValue === +modelValue) ? viewValue : modelValue;

A: I don't know the reason but some how below code is working for me. I changed zFloat directive in my local file.
return (+viewValue === +modelValue) ? viewValue : modelValue;

to
return (+viewValue === +modelValue) ? modelValue: viewValue;


text:
Q: how to go bottom of a website like back to top using javascript? I include coding on my blog for Back to top using HTML, CSS & JavaScript combination. Now I want to include which may work as opposition of Back to top that means Go to Bottom. For back to top I include code like this:
HTML

Top

CSS
#back-top a{text-decoration: none;}
#back-top {
color: #ff0000;
position: fixed;
bottom: 25px;
left: 125px;
font-weight: bold;
}

JavaScript
$(function (){
$(window).scroll(function (){
if ($(this).scrollTop() > 300){
$('#back-top').fadeIn();
}
else{
$('#back-top').fadeOut();
}
});

How can alternate this?

A: A very simple trick is to include at the very bottom of your page a div like so:

Then link to it with
Go To Bottom

A: To smoothly scroll to the body's end you can use this:
DEMO
$(function (){
    var bodyHeight = $('body').height();

    $('#back-bottom a').on('click', function(){
        $('html, body').animate({scrollTop: bodyHeight}, 300);
    });
});

A:

Bottom

Try the above!


text:
Q: Which is correct: considered vs considerably The target sentence is from TOEIC and goes:

The latest version of the TR21 printer is _____ more reliable than previous models.

A. considered
B. considerably
The answer according to the book is 'considered', but I am not totally convinced. In my opinion, the second option 'considerably' is not wrong either. Please share your ideas.

A: If you have used considered, the meaning of the sentence would be that that specific printer is commonly recognised to be more reliable than those before.
In the second case, the afterglow you get resembles more a personal evaluation based on experience than a widely known thing.
Still, both sentences are correct. I agree with you. I think the phrase should have been clearer.

A: This a bad test question, because both choices would create correct and plausible sentences, with different meanings.

*

*The latest version of the TR21 printer is considered more reliable than previous models. (people hold the opinion that the TR21 is more reliable)

*The latest version of the TR21 printer is considerably more reliable than previous models. (The TR21 is much more reliable)

There is no wrong answer here.


text:
Q: ionic-native/network-interface, gives error the 'plugin not installed'? I am using ionic-native/network-interface for getting the ip address of wifi I am connected with but It gives error Plugin not installed but I have installed it using official documentation.
This is the code I have written
export class HomePage {

  constructor(public navCtrl: NavController, private networkInterface: NetworkInterface ) {

    this.networkInterface.getWiFiIPAddress().then(a=>alert(a)).catch(e=>alert(e));
  }
}

Error:

plugin not installed

And I have addeed NetworkInterface in the providers in app.module.ts

A: In resume, ionic cache is boring. These lines helped me.
$ ionic cordova plugin add cordova-plugin-networkinterface -f
$ ionic cordova platform add browser
$ ionic cordova run browser

A: try this:
Use this: Run "ionic cordova platform add [platform]" then "ionic cordova build [platform]" and run in your device.
It worked for me!.

A: I'm using capacitor 2.2.1 and I had the same problem "plugin_not_installed"... I was missing the actual module, at the end I did this:
ionic cordova plugin add cordova-plugin-networkinterface
npm install @ionic-native/network-interface
npm install cordova-plugin-networkinterface


text:
Q: Assigning hotkeys to DigitalMicrograph functions and scripts? In GMS2, there was an area to easily assign hotkeys to certain built-in functions (eg. Save As..., Rotate). It seems that was removed in GMS3. Is it possible to script a hotkey for those items and any installed scripts?

A: I think you want to look at this section of the F1 help documentation for detail:

Behavior may depend on the GMS version you are using. I found a script that states that it works for GMS 1, GMS 2 and from GMS 3.4 and onward, but not for GMS 3.0 to GMS 3.3

Pre-installed menu items (such as File/Save as...) cannot get accelerator keys assigned or changed. They are provided by the system.

In general, having too many accelerators or hot-key is dangerous, as there is no global management and one can easily over-use combinations. Also, some in-build functionality uses hot-keys while certain images are front-most etc.
Proceed with care.

The example below installs a custom menu with a key accelerator.
// //////////////////////////////////////////////////// //
// Example of installing a menu with a key accelerator.
// //////////////////////////////////////////////////// //
Class CMyMenuAction
{
    CMyMenuAction(object self){result("\n Created object: "+ self.ScriptObjectGetClassName() + " - " + self.ScriptObjectGetID());}
    ~CMyMenuAction(object self){result("\n Killed object: "+ self.ScriptObjectGetClassName() + " - " +self.ScriptObjectGetID());}

    void Action( object self ) { OKDialog("Action!"); }
}

Class CMyMenuInstaller
{
    CMyMenuInstaller(object self){result("\n Created object: "+ self.ScriptObjectGetClassName() + " - " + self.ScriptObjectGetID());}
    ~CMyMenuInstaller(object self){result("\n Killed object: "+ self.ScriptObjectGetClassName() + " - " +self.ScriptObjectGetID());}

    object UnInstallMenu( object self , string menuName){

        object menuBar = GetMenuBar()
        object customMenu = menuBar.FindMenuItemByName(menuName)
        if ( customMenu.ScriptObjectIsValid() )
        {
            customMenu.ClearMenuItems()
            menuBar.RemoveMenuItem( customMenu )
        }
        return self
    }

    object InstallMenu( object self, string menuName ){

        object menuBar = GetMenuBar()

        // Find or add test-menu
        object customMenu = menuBar.FindMenuItemByName(menuName)
        if ( !customMenu.ScriptObjectIsValid() )    {
            customMenu  = NewMenu( menuName )
            menuBar.AddMenu( customMenu )
        }

        // Create command
        object menuActions = Alloc(CMyMenuAction)

        object item1 = alloc( menuItem ).init( "Do something" )
        item1.SetAction( menuActions, "Action" )
        item1.SetIsEnabled(1)
        item1.SetAccelerator( MakeKeyStroke( "alt-shift-x" ) )

        // Building the menu
        customMenu.ClearMenuItems()         // Reset/Clear existing items
        customMenu.AddMenuItem( item1 )

        return self
    }
}

ClearResults()
Alloc(CMyMenuInstaller).InstallMenu("Test Menu")
//Alloc(CMyMenuInstaller).UnInstallMenu("Test Menu")```

----------
You can also use *global key accelerators* to tie script functionality to a key-stroke.

```c
// NB: This works only in GMS 1 & GMS 2 and from GSM 3.4 onwards
//      Since GMS 3 the accelerator can no longer be replaced and will
//      remain registered until application shutdown.
//      Alternatively, one can use keyboard-accellerators

class Custom_Action{
    void DoAction( Object self ){Beep();Result("beep.");}
};

void do(){
object handler = alloc( Custom_Action )
object action = NewMenuAction( handler, "DoAction" )
object accelerator = NewMenuAccelerator( MakeKeyStroke( "f7" ), action )
accelerator.SetIsEnabled(1)
object menuBar = GetMenuBar()
menuBar.AddAccelerator( accelerator )
}
do()


text:
Q: using WebServices vs using Dynamic Entities in Microsoft CRM 4.0 I'm on a debate with a colleague regarding using webservices in a plugin or a workflow
he says using dynamic entites is the best practice as suggested by microsoft, as web-service require authentication.
I think using the wsdl and the strong typed entities is cleaner and less error prone, and the authentication delay is negligable
also, we are planning on updating to CRM 2011
so, which one of us is right ?

A: Both dynamic entities and strongly typed entities will require authentication.  I don't believe there is a delay in authentication between the two.
If you are writing generic code that can be applied to other CRM organizations (as an ISV would) then dynamic entities is the way to go.  Otherwise I would suggest strongly typed entities is the better option as the code is cleaner and more readable as you say.
Both sets of code are going to require re-work with CRM 2011.
All the best,

A: Both strongly typed and dynamic entities use web services, which both require authentication, so theres no real difference there.
In terms of upgrade to Crm 2011, the web services have changed in 2011, so if you wanted to re-code you could, but both would have to be re-coded. Or you could just continue using the Crm 4 webservices and not re-code. So again no real difference.
I couldnt find anything from Microsoft saying they prefer Dynamic Entities. In Best Practices for Developing with Microsoft Dynamics CRM 2011 they actually say to use both depending your situation.

Use the Entity class when your code must work on entities and
  attributes that are not known at the time the code is written.
  However, this flexibility has a disadvantage because you cannot verify
  entity and attribute names at compile time. If your entities are
  already defined at code time, you should use the early-bound types
  that you can generate by using the CrmSvcUtil tool. For more
  information, see Use the Early Bound Entity Classes in Code.

I think this mostly comes down to style and preference (no one can be right) - personally I prefer Dynamic Entities.
Strongly Typed - Pros:

*

*Intellisense

*Design\Compile time validation

*You dont have to check Crm for all the entity, field and relationships names

*The compiled executable contains the code necessary to invoke the types' properties, methods, and events

Strongly Typed - Cons:

*

*You have to generate the WSDL (and keep regenerating it everytime Crm changes)

*The generated classes dont pass code analysis last time I checked

*It can be a bit 'heavy handed', e.g. to create a new record with dynamic entities is generally a couple of lines. Having to generate hundreds of strongly typed classes to write a couple of lines seems like an overkill.