text:
Q: proving $\frac{1}{1\cdot 2}+\frac{1}{3\cdot 4}+\frac{1}{5\cdot 6}+\cdots+$ Without Induction i proved that:
$$
\begin{align}
& {} \quad \frac{1}{1\cdot 2}+\frac{1}{3\cdot 4}+\frac{1}{5\cdot 6}+\cdots+\frac{1}{(2n-1)\cdot 2n} \\[10pt]
& =\frac{1}{n+1}+\frac{1}{n+2}+\frac{1}{n+1}+\cdots+\frac{1}{2n}\text{ for }n\in \mathbb{N}
\end{align}
$$
by induction.
i wonder if it can be done without using induction. if so, i'll appreciate if someone could show how.
thanks.

A: We have
$$\frac{1}{2k(2k-1)}=\frac{1}{2k-1}-\frac{1}{2k}=\frac{1}{2k-1}+\frac{1}{2k}-\frac{1}{k}$$
so
$$\sum_{k=1}^n\frac{1}{2k(2k-1)}=\sum_{k=1}^n\left(\frac{1}{2k-1}+\frac{1}{2k}\right)-\sum_{k=1}^n\frac{1}{k}=\sum_{k=1}^{2n}\frac{1}{k}-\sum_{k=1}^n\frac{1}{k}=\sum_{k=n+1}^{2n}\frac{1}{k}$$

A: $$\text{As }\frac1{(2r-1)2r}=\frac{2r-(2r-1)}{(2r-1)2r}=\frac1{2r-1}-\frac1{2r},$$
$$\text{we can write }\frac{1}{1\cdot 2}+\frac{1}{3\cdot 4}+\frac{1}{5\cdot 6}+...+\frac{1}{(2n-1)\cdot 2n}$$
$$=\left(\frac11-\frac12\right)+\left(\frac13-\frac14\right)+\cdots+\left(\frac1{2n-1}-\frac1{2n}\right)$$
$$=\left(\frac11+\frac12-2\cdot\frac12\right)+\left(\frac13+\frac14-2\cdot\frac14\right)+\cdots+\left(\frac1{2n-1}+\frac1{2n}-2\cdot\frac1{2n}\right)$$
$$=\frac11+\frac12+\frac13+\frac14+\cdots+\frac1{n-1}+\frac1n+\frac1{n+1}+\cdots+\frac1{2n-1}+\frac1{2n}-2\left(\frac12+\frac14+\frac16+\cdots+\frac1{2n}\right)$$
$$=\frac11+\frac12+\frac13+\frac14+\cdots+\frac1{n-1}+\frac1n+\frac1{n+1}+\cdots+\frac1{2n-1}+\frac1{2n}-\left(1+\frac12+\frac13+\cdots+\frac1n\right)$$
$$=\frac1{n+1}+\frac1{n+2}+\cdots+\frac1{2n-1}+\frac1{2n}$$

A: Let it be true for n
Then for $n+1$ we have,
$\displaystyle \frac{1}{1\cdot 2}+\frac{1}{3\cdot 4}+\frac{1}{5\cdot 6}+...+\frac{1}{(2n+1)\cdot 2(n+1)}$
$\displaystyle =(\frac{1}{1\cdot 2}+\frac{1}{3\cdot 4}+\frac{1}{5\cdot 6}+...+\frac{1}{(2n-1)\cdot 2n})+\frac{1}{(2n+1)\cdot 2(n+1)}$(Using induction hypothesis for $n$)
$\displaystyle =\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{(2n+1)\cdot 2(n+1)}$
$\displaystyle =\frac{1}{n+1}+\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{2n+1}+\frac{1}{2(n+1)}-\frac{1}{2n+1}-\frac{1}{2(n+1)}+\frac{1}{(2n+1)\cdot 2(n+1)}$
$\displaystyle =\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{2n+1}+\frac{1}{2(n+1)}-\frac{4n+3}{(2n+1)2(n+1)}+\frac{1}{(2n+1)2(n+1)}$
$\displaystyle =\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{2n+1}+\frac{1}{2(n+1)}-\frac{4n+2}{(2n+1)2(n+1)}$
$\displaystyle =\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{2n+1}+\frac{1}{2(n+1)}-\frac{1}{(n+1)}$
$\displaystyle =\frac{1}{n+2}+...+\frac{1}{2n}+\frac{1}{2n+1}+\frac{1}{2(n+1)}$


text:
Q: don't understand some code from a RailsCast tutorial I watched the RailCasts tutorial #274 on Remember Me and Reset Password.  The code he adds is the following inside user.rb
def send_password_reset
  generate_token(:password_reset_token)
  save!
  UserMailer.password_reset(self).deliver
end

def generate_token(column)
  begin
    self[column] = SecureRandom.urlsafe_base64
  end while User.exists?(column => self[column])
end

Here what I don't understand is why the save! call inside send_password_reset?  Also, I'm not familiar with the syntax in generate_token: self[column]=. Is this the way to set a column inside a database table?
Here's the create action of the password_resets_controller
  def create
    user = User.find_by_email(params[:email])
    user.send_password_reset if user
    redirect_to root_path, notice: "Email sent with password reset instructions."
  end

A: save! saves the object and raises an exception if it fails.

self[column]=, is a slight meta-programming.
Usually, when you know the column name, you'd do: self.password_reset_token=. Which is the same as self[:password_reset_token]= or self["password_reset_token"]=.
So it's easy to abstract it a bit passing column name as string/symbol.
Clearer?

A: 1) save! is like save, but raise a RecordInvalid exception instead of returning false if the record is not valid.
Example from my console:
User.new().save  # => false
User.new().save! # ActiveRecord::RecordInvalid: Validation failed: Password can't be blank,  Email can't be blank

2) self[column]= there for setting users column.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Selling software instead of on-demand work Doing on-demand work stresses me out and is not good for my back.
What tips could you offer if you have experience in spotting needs and writing custom software to suit ?

A: In my experience, customers are rarely interested in non-custom software that doesn't come with support and/or enhancements. So unless you are writing defect-free and complete software, you will end up doing "on-demand" work on your custom software to patch bugs or add critical features. That is, developing your own code doesn't do much to avoid stressful on-demand work. I suspect the scale and culture of your company is the best way to moderate stressful on-demand work.
But the software I've been involved in, even our non-customer specific is still oriented towards large sales and heavy customization. I suppose if you can avoid that, you will go further to controlling your release cycle. The more customers you have, the less they need to pay; the less they pay, the less they expect immediate fixes from you.


text:
Q: file_put_contents doesn't work with json laravel & php I tried everything to push item into json file but when call
file_put_contents("file.json",$data) doesn't work and the page shutdown.
Here's my controller code.
public function addJson()
{
    $titulo = Input::get('title');
    $name = Input::file('image')->getClientOriginalName();

    $arr = json_decode(file_get_contents("js/data.json"), true);
    array_push($arr['galerias'], array('id' => count($arr['galerias'])+1, 'name' => $name, 'img' => 'galeria/'.$name));
    $arr2 = $arr['galerias'];
    $arr = json_encode($arr);
    echo $arr;
    file_put_contents('js/data.json', $arr);
    return view('main.prueba')->with('name',$arr2);
}

And here is the json file.
{
 "galerias": [
{
  "id": 1,
  "name": "Fiesta Privada",
  "img": "galeria/FP.JPG"
},
{
  "id": 2,
  "name": "Fiesta Privada",
  "img": "galeria/FP2.JPG"
},
{
  "id": 3,
  "name": "Fiesta Privada",
  "img": "galeria/FP3.JPG"
},
{
  "id": 4,
  "name": "Fiesta Privada",
  "img": "galeria/FP4.JPG"
},
{
  "id": 5,
  "name": "Fiesta Privada",
  "img": "galeria/FP5.JPG"
},
{
  "id": 6,
  "name": "Fiesta Privada",
  "img": "galeria/FP6.JPG"
},
{
  "id": 7,
  "name": "Los Kjarkas",
  "img": "galeria/Los_Kjarkas.jpg"
},
{
  "id": 8,
  "name": "Palmenia Pizarro",
  "img": "galeria/Palmenia_Pizarro.jpg"
},
{
  "id": 9,
  "name": "Palmenia Pizarro",
  "img": "galeria/Palmenia_Pizarro_2.jpg"
},
{
  "id": 10,
  "name": "Palmenia Pizarro",
  "img": "galeria/Palmenia_Pizarro_3.jpg"
}
]
}

Heeeelp me pls :C

A: It could be a permission problem
Is the directory /js chmoded to 777? sometimes php won't allow you to access directories if they don't have enough permission. I don't know about blank errors though.
Try to see if it has enough permissions, if not, then set it to 777 and try it.


text:
Q: ls: command not found BASH This script tries to copy a text file into another directory.
I don't understand why I'm having this problem:
./move_in.sh: line 36: ls: command not found
It was working ok until I added the if-statements.
update_file=pwd
echo ""
echo "You can move a text file from your PC into the repository"
echo ""
echo "You need to know where is your text file"
cd /
ls
times=1
echo ""
echo "Where is your text file?"
read directory

while [ -d $directory ]
do
echo $times
if [ $times == 1 ]
then
LAST=$directory
fi

if [ $times != 1 ]
then
LAST=$PATH/$directory
fi

cd $directory
ls
echo ""
echo "Where is your text file?"
read directory
PATH=$LAST
echo $PATH
times=$((times + 1))
done

PATH=$PATH/$directory
echo $PATH
open $PATH
cp $PATH /\$update_file
echo "You found the text file!"
exit 0

I want to have the complete path of the file when the process finishes, thats why I used LAST and PATH, and I equalize them.

A: You are deleting your $PATH use PATH=$PATH:
ls is not a builtin command, so it must be in PATH env


text:
Q: Issue with clearing a Div with dynamically created content I am having an issue with the following. I have a form which contains a button to allow the selection of am image. when the image is selected the script display the dimensions of the image along with a tumb nail.
The issue is, if the user selects another image the dimensions are displayed twice. At the moment the dimensions are repeated. How can I prevent this.
See the line below in my code marked "THE LINE BELOW"
window.URL = window.URL || window.webkitURL;
var elBrowse = document.getElementById("browse2"),
  elPreview = document.getElementById("preview6"),
  elPreviewtext = document.getElementById("previewtext6"),
  useBlob = false && window.URL;

function readImage(file) {
  console.log("elPreviewtext", elPreviewtext);
  var reader = new FileReader();
  reader.addEventListener("load", function() {
    var image = new Image();
    image.addEventListener("load", function() {
      var imageInfo = file.name;
      var filetype = imageInfo;
      var ext = filetype.split('.').pop();
      if (image.width != editw && image.height != edith) {
        $.alert({
          title: 'Image select error!',
          content: 'The image you have seleted is incorrect, ' + image.width + ' by ' + image.height + ' portrate.

 "Please resize your image to the correct size in landscape.

Resizing upwards reduces the quality of the image. Start with a large image and resize downwards.',
          animation: 'zoom',
          boxWidth: '50%',
          closeAnimation: 'zoom',
          buttons: {
            okay: {
              text: 'Try again',
              btnClass: 'btn-blue'
            }
          }
        });
      } else {
        var imageInfotext = '';
        var imageInfotext = 'Display width: ' + image.width + ',
Display height: ' + image.height;
elPreviewtext.innerHtml = "";
elPreview.appendChild(this);
        // THE LINE BELOW DISPLAYS THE IMAGE DIMENTION IN A DIV ON THE FORM "

"
        elPreviewtext.insertAdjacentHTML("beforeend", imageInfotext + '
');
        if (useBlob) {
          window.URL.revokeObjectURL(image.src);
        }
      }
    });
    image.src = useBlob ? window.URL.createObjectURL(file) : reader.result;
  });
  reader.readAsDataURL(file);
}

Many thanks in advance for your help and time.

A: Just clear the element before adding the info (just added some lines of your code):
var imageInfotext = '';
var imageInfotext = 'Display width: ' + image.width + ',
Display height: ' + image.height;
elPreview.appendChild(this);
// HERE CLEAR THE CONTENT
elPreviewtext.innerHtml = "";
// THE LINE BELOW DISPLAYS THE IMAGE DIMENTION IN A DIV ON THE FORM "

"
elPreviewtext.insertAdjacentHTML("beforeend", imageInfotext + '
');


text:
Q: Path.GetFileNameWithoutExtension returns hidden characters in string I have a problem with System.IO.Path.GetFileNameWithoutExtension. If i load a file, the string which is returned by the method contains some hidden chars. In HEX: 3F.
The follwing pictures contains the problem. See the hex editor:

The texfiles were created with Notepad++ and the Encoding is UTF-8 without BOM.
Maybe some one has a solution, thank you!

A: I created file with Notepad++ v6.6.4 and put the file in debug folder called myFile.txt and the Encoding is "UTF-8 without BOM" and if you apply the next code which read all the text from the original file created above and put all the content in new file in the same directory you will find exactly all the content without any difference.

using System;
using System.IO;
namespace FilePathWithNotepad__
{
    class Program
    {
        static void Main(string[] args)
        {
            string originalFilePath = Environment.CurrentDirectory + "\\myFile.txt";
            string title = Path.GetFileNameWithoutExtension(originalFilePath);
            string content = File.ReadAllText(originalFilePath);
            string newfile = Path.GetFileName(Environment.CurrentDirectory + "\\new.txt");
            File.WriteAllText(newfile,content);
        }
    }
}


text:
Q: Drawing multiple sprites in XNA with an increment in position So I'm new to XNA and am attempting to draw multiple sprites to the screen in the easiest way. I want each sprite to be incremented in the X axis so that I am left with multiple sprites drawn across the screen.
I have defined:
Vector2 pos;

In the LoadContent function I have:
pos = new Vector2(0, 0);

and in Draw I have:
spriteBatch.Draw (circle, pos, Color.White); //Draws sprite to screen in correct position
spriteBatch.Draw(circle, (pos.X += 1), Color.White); //causes error and doesnt draw

Hopefully I've explained this well enough and you can see what I'm trying to do, the compiler doesn't agree with (pos.X += 50) (me trying to increment the X position by 50).
I know I could go about this a longer way and create a new Vector2 for each draw but that would create multiple lines of what I think surely is unnecessary code and there must be a quick way like this to go about doing it?

A: The method signature of Draw expects the second parameter to be a Vector2, right?
If so, then (pos.X += 1) isn't a Vector2.  It's a statement which increments the X parameter of the pos Vector2 variable, but the statement doesn't return an instance of a Vector2 object.
Edit: Code is as follows:
public void DrawSprites()
{
    // setup circle here
    // setup spritebatch here
    // setup initial pos here
    // setup MAX_ITERATIONS here

    var INCREMENT_VALUE = 50;

    for (var i = 0; i < MAX_ITERATIONS; i++) {
        var iteratedPos = pos + new Vector2((INCREMENT_VALUE * i), 0); // per Nikola's comment
        spriteBatch.Draw(circle, iteratedPos, 0), Color.White);
    }
}

A: You need to make a list of the draw rectangles of your textures.
//implement Texture2D (called "image") and SpriteBatch (called "spriteBatch")
List<Rectangle> rectangles = new List<Rectangle>();
const int ITERATIONS = 10; //or whatever you want the iterations to be
const int INCREMENT_VALUE = 50; //again, whatever you want it to be

for (int i = 0; i < ITERATIONS; i++)
{
    for (int j = 0; j < rectangles.Count; j++)
    {
        rectangles[j].X += INCREMENT_VALUE * i;
        spriteBatch.Draw(image, rectangles[j], Color.White);
    }
}

Like said earlier, you need a list of Rectangles that have all the image rectangles in them. Hope I helped, and good luck!


text:
Q: Exporting JSON API result into CSV file (Vertically AND with Header) I'm trying to export JSON API result into a CSV with a right format.
Note: SmartMover API can help determine whether an individual address is up to date by inputting individual address, first name, last name, etc.
Below is my API result in a JSON format.
JSON API result

{'CASSReportLink': 'https://smartmover.melissadata.net/v3/Reports/CASSReport.aspx?tkenrpt=YvBDs39g52jKhLJyl5RgHKpuj5HwDMe1pE2lcQrczqRiG3/3y5yMlixj5S7lIvLJpDyAOkD8fE8vDCg56s3UogNuAkdTbS2aqoYF5FvyovUjnXzoQaHaL8TaQbwyCQ2RB7tIlszGy5+LqFnI7Xdr6sjYX93FDkSGei6Omck5OF4=', 'NCOAReportLink': 'https://smartmover.melissadata.net/v3/Reports/NCOAReport.aspx?tkenrpt=8anQa424W7NYg8ueROFirapuj5HwDMe1pE2lcQrczqRiG3/3y5yMlixj5S7lIvLJpDyAOkD8fE8vDCg56s3UogNuAkdTbS2aqoYF5FvyovUjnXzoQaHaL8TaQbwyCQ2RB7tIlszGy5+LqFnI7Xdr6sjYX93FDkSGei6Omck5OF4=', 'Records': [{'AddressExtras': '', 'AddressKey': '78704,78704', 'AddressLine1': '                                                            ,                                                            ,                                                            ,STE C-100                                                   ', 'AddressLine2': '1009 W MONROE ST                                            ,1600 S 5TH ST                                               ,1008 W MILTON ST                                            ,3939 BEE CAVES RD                                           ', 'AddressTypeCode': '', 'BaseMelissaAddressKey': '', 'CarrierRoute': '', 'City': 'Austin                                            ,Austin                                            ,Austin                                            ,Austin                                            ', 'CityAbbreviation': 'Austin                                            ,Austin                                            ,Austin                                            ,Austin                                            ', 'CompanyName': '', 'CountryCode': 'US', 'CountryName': 'United States', 'DeliveryIndicator': '', 'DeliveryPointCheckDigit': '', 'DeliveryPointCode': '', 'MelissaAddressKey': '', 'MoveEffectiveDate': '', 'MoveTypeCode': '', 'PostalCode': '78704,78704,78704,78746', 'RecordID': '1', 'Results': 'AE07', 'State': '', 'StateName': 'TX                                                ,TX                                                ,TX                                                ,TX                                                ', 'Urbanization': ''}], 'TotalRecords': '1', 'TransmissionReference': '1353', 'TransmissionResults': '', 'Version': '4.0.4.48'}
  [Finished in 2.6s]

From this result, I want to extract 4 output values in AddressLine2 header. (I input 4 values into the API)  For example,

'Records':..............'AddressLine2': '1009 W MONROE ST', ............

So I wrote the following Python query:
r = response.json()

df = pd.read_csv(r"C:\users\testu\documents\travis_test.csv",delimiter = ',',na_values="nan")

with open(r'C:\users\testu\documents\travis3.csv', 'w+') as f:
    cf = csv.writer(f)
    cf.writerow(r['Records'][0]['AddressLine2'].split(','))

print(r['Records'][0]['AddressLine2'].split(','))

However, it only extracted values without Header AND horizontally as you can see the picture below:

How can I extract values with a Header (AddressLine2) AND vertically?
THanks for any help!

A: I had to do something similar to this recently. I ended up using a different approach though, and didn't use Pandas.
I am assuming that you are using the python requests library, the csv library, pandas, and python 3.
Assuming you are only trying to get the one column with header AddressLine2, then something like this should work:
import requests
import unicodedata
import csv

url = "The API endpoint"

# Build an array to contain the Address values. Add the header AddressLine2
# by appending the string to output_1.
output_1 = []
output_1.append("AddressLine2")

# Get the information from the API using requests.
response = requests.get(url)
data = response.json()

# Collect only Address Line 2 from the JSON output. properly encode/decode the
# string and add it to output_1.
for record in data['records']:
    addressline2 = record['addressline2']
    decode_1 = unicodedata.normalize('NFKD', addressline2)
    output_1.append(decode_1)

# Write the values to a column
with open(csvfile, 'w') as fp:
    writer = csv.writer(fp, dialect = 'excel')
    for val in output_1:
        writer.writerow([val])

I realize I didn't use pandas for this. So this might be too much extra work if you need that pandas dataframe for other calculations. If not, though, then this will hopefully get you that column!


text:
Q: Is having too many comparisons a valid reason to increase FDR threshold level? To briefly summarize, I have a bootstrapped data set that needs to be corrected for multiple comparisons. The figure below provides a snapshot of one set of the data. The x-axis is in bins of 60ms. That makes 51 data points (including 0.0s) for each of the experimental conditions.
I am using the Benjamini–Hochberg FDR method and the BH critical value is defaulted to 0.05. The problem I have here is, given that I have 51 x 3 time points (red vs green, blue vs green, red vs blue), I have a whooping 153 p-values. The critical values at the top of the chart are currently so stringent that even a p-value of 0.02 did not make the mark of being significant.
In this scenario, is it a good reason to justify an increase in FDR value? If yes, what is a reasonable value to use? If not, what would be an alternative solution that I can use without needing to sacrifice too much lost in power?


text:
Q: Animate vertical sub menu with css We have menu and some of this menu has a sub-menu. i want to display sub-menu when come to display block with animation. specially height of sub-menu.
for example:
#menu ul.sub_menu {
    display             : none;
}

#menu li:hover ul.sub_menu {
    display             : block;
}

please see my code jsfiddle.net/oa6ftrL8/, thanks

A: You cannot animate the display property. Go with opacity: 0; instead of display: none; and opacity: 1; instead of display: block;
Add some max-height: 0; and max-height: fartoomanypx; for the animation (because height cannot be animated to auto).
https://jsfiddle.net/oa6ftrL8/1/
You will have to start fiddling yourself to make it beautiful.


text:
Q: Forecasting of highly correlated time series In time series forecasting using various models like AR,MA,ARMA, etc, we usually focus on the modeling of the data in the change of time. But when we have 2 time series that Pearson correlation coefficient show they are highly correlated, is it possible to model their dependency and forecast values of one from the other?
For example, when one serie have a linear relationship with the other, it seems possible. But is there a general method for this kind of dependency analysis?

A: The AR, MA, and ARMA models are examples of univariate time series models. Each of these models has a multivariate counterpart: Vector Autogression (VAR), Vector Moving Average (VMA), and Vector Autoregressive Moving Average (VARMA), respectively.
VAR might be the simplest to reason about if you are more familiar with linear regression. An AR(p) model regresses a time series against its p lags. Correspondingly, a VAR(p) model is a series of regressions, such that each series is regressed against its p lags and the p lags of all the other variables. After performing the regressions, you can calculate residuals from each series and evaluate how correlated the residuals are.
As with univariate models, stationarity is also an important issue for multivariate models. This leads to models like the Vector Error Correction Model (VECM), which allows for variables to have share a stable long-term trend with short-term deviations.


text:
Q: My autocomplete suggestion list takes much time to appear and it freezes the keyboard? In Ui, I am suggesting a list if anyone enters any character by filtering it from a list. I am using listview.itemsource. It takes much time to appear and the keyboard gets frozen until the list appears.
I am filtering a list based on the character entered and storing it in listview.itemsource. the filtered list takes much time to appear on the UI side and till then my keyboard stays frozen, not able to enter the next character.
    list2 = list.Where(x => x.CardHolderName.Trim().ToLower().Contains(e.NewTextValue.Trim().ToLower())).ToList();

    FilteredPersonList = ConvertListToObservableCollection(list2);
                            if (FilteredPersonList != null && FilteredPersonList.Count > 0)
                            {
                                this.listView.IsVisible = true;
                                this.searchBarStack.HeightRequest = 250;
                                this.listView.ItemsSource = FilteredPersonList;
                            }

here listView is a variable that denotes ListView.

A: You could try the code below which shows a SearchBar query with results displayed in a ListView. It would not take much time to appear and it does not freeze the keyboard.
Xaml:
 <StackLayout>
        <StackLayout>
            <SearchBar x:Name="_searchbar" Placeholder="Search..." TextChanged="_searchbar_TextChanged"/>
        </StackLayout>

        <ListView x:Name="list" ItemsSource="{Binding Items}">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Label Text="{Binding Name}" />
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>

Code:
 public partial class Page22 : ContentPage
{
    public List<ListViewItem> Items { get; set; }
    public Page22()
    {
        InitializeComponent();
        Items = new List<ListViewItem>
    {
          new ListViewItem { Name = "AAAA" },
          new ListViewItem { Name = "ABBB" },
          new ListViewItem { Name = "AAAA" },
          new ListViewItem { Name = "CCCC" },
          new ListViewItem { Name = "DAAB" },
          new ListViewItem { Name = "DDDC" }
    };
        this.BindingContext = this;
    }

    private void _searchbar_TextChanged(object sender, TextChangedEventArgs e)
    {
        list.ItemsSource = FilterItem(e.NewTextValue);
    }
    IEnumerable<ListViewItem> FilterItem(string filter = null)
    {

        if (string.IsNullOrEmpty(filter))
            return Items;
        return Items.Where(p => p.Name.StartsWith(filter));
    }
}
public class ListViewItem
{
    public string Name { get; set; }
}


text:
Q: Writing an image using NdefMessage I am trying to write an image on a Ndef Tag, currently, i am able to write it, but when I try to read it with any market application, they treat it like a text message. here is my piece of code writing the image :
        Bitmap mBitmap = Bitmap.createScaledBitmap(mPhoto, 100, 100, true);
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        mBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
        byte[] byteArray = stream.toByteArray();
        NdefRecord picRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, "image/png".getBytes(), null, byteArray);
        String informations = "name: "+name + "\ntitle: " + title + "\naddress: "+ address + "\ncity: "+ city + "\nphone: "+ phone + "\nmail: "+mail;
        NdefRecord textRecord = createTextRecord(informations);
        NdefMessage message = new NdefMessage(new NdefRecord[]{picRecord, textRecord});

i also tryed writting the image this way :
        NdefMessage msg = new NdefMessage(new NdefRecord[] {createMimeRecord("image/png", byteArray), textRecord});

with the method createMimeRecord :
        public NdefRecord createMimeRecord(String mimeType, byte[]payload) {
        byte[] mimeBytes = mimeType.getBytes(Charset.forName("USASCII"));
        NdefRecord mimeRecord = new
        NdefRecord(NdefRecord.TNF_MIME_MEDIA,
        mimeBytes, new byte[0], payload);
        return mimeRecord;
        }

Here is the result i get when trying to read my image with applications like "TagInfo" :
The text message is well writen and can be read normally. I've tried to use the "createMime(String mime type, byte[] data) but this method seems "undefined".I've tried to compress the bitmap image in Jpeg format with the same result. Also I've tried to find examples of sending images via NdefMessages, but didn't find any. Any suggestion ?

A: Finally after searching for an application writting and reading Business card on NFC tag and finding nothing. I decided to create my own kind of business card and read it myself. here is the code i used to write the card using Ndef Message :
        Bitmap mBitmap = mPhoto;
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        mBitmap.compress(Bitmap.CompressFormat.JPEG, 80, stream);
        byte[] byteArray = stream.toByteArray();
        NdefRecord picRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,  "image/jpeg".getBytes(), null, byteArray);
        String informations = "name: "+name + "\ntitle: " + title + "\naddress: "+ address + "\ncity: "+ city + "\nphone: "+ phone + "\nmail: "+mail + "\n";
        NdefRecord textRecord = createTextRecord(informations);
        NdefMessage message = new NdefMessage(new NdefRecord[]{picRecord, textRecord});

and here is the code for the reading part :
        NdefRecord picRecord = records[0];
        NdefRecord infoRecord = records[1];
        byte[] picload = picRecord.getPayload();
        byte[] infoload = infoRecord.getPayload();
        Bitmap photo = BitmapFactory.decodeByteArray(picload, 0, picload.length);
        String textEncoding = ((infoload[0] & 0200) == 0) ? "UTF-8" : "UTF-16";
        int languageCodeLength = infoload[0] & 0077;
        String text = null;
        try{
            String languageCode = new String(infoload, 1, languageCodeLength, "US-ASCII");
            text = new String(infoload, languageCodeLength + 1,infoload.length - languageCodeLength - 1, textEncoding);
        }catch(Exception e){
            Alert("String decoding", e.toString());
            return;
        }

The Jpeg encryption helps a lot to compress the image without loosing too much quality. The transfer on the tag take 2-3 seconds but the solution works well.

A: If your use case is storing business card on NFC tag, I would suggest that you do not store the image data but rather a link to the image. Otherwise you will have hard time storing the business card on a normal tags (usual size of the tags is 1K or 4K) and also time for transferring the data will be too long. According to the vCard specification you can do both: storing binary image data in base64 format and also url link(which I strongly recommend).
For more information about the format of the vCard look at here:
http://en.wikipedia.org/wiki/VCard
or in more details here:
https://www.rfc-editor.org/rfc/rfc2426#section-3.1.4


text:
Q: What JavaScript, HTML, APIs are Google using in the World Cup Pin It Live Tool? Google have just launched a new tool that "Pins" World Cup scores on Android. The Pin lives outside the browser. What Javascript APIs/HTML are they using to do this?
See example:
https://storage.googleapis.com/gweb-uniblog-publish-prod/original_images/Game_Bubble_v1.gif


text:
Q: Hittesting a Path which may be very dense I am working on a UserControl which displays many line segments.
This is done with a GraphicsPath.
When the user moves the mouse a hittest is done to check if it is over any of the line segments, the cursor is changed accordingly, the line can then be clicked.
As long as there are few segments (as in the left example) this works OK and makes sense.
But when there are more and more segments, the hittest becomes senseless and of course very slow (in the example there are 75, 750 and 2500 segments).

What strategy could I use to avoid useless testing and simplify the path if it becomes "dense"?
The line segments are of unknown pattern, they may not be of obvious rectangular outline, but are always some kind of data chart as in the example image.


text:
Q: How do I select which view when adding document library web part to a page in my site definition? In my custom SharePoint 2010 site definition:

*

*I have a custom list instance in my site definition with multiple views...

*I have a page that I want to display one of the views on...

*In the page's Elements.xml definition, where can I select to show either the "Correspondence" or "Accounting" views shown in the list instance's Schema.xml below?

XML has been cleaned up for simplicity of reading.
List Instance's Schema.xml
<List Title="Client Documents" Direction="none" Url="Client Documents" BaseType="1" Type="101" BrowserFileHandling="Permissive" EnableContentTypes="TRUE" DisableAttachments="TRUE" Catalog="FALSE" VersioningEnabled="TRUE" SendToLocation="|" ImageUrl="/_layouts/images/itdl.png" xmlns:ows="Microsoft SharePoint" xmlns:spctf="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms" xmlns="http://schemas.microsoft.com/sharepoint/">
  <MetaData>
    <ContentTypes>...</ContentTypes>
    <Fields>...</Fields>
    <Forms />
    <Views>
      ...
      <View DisplayName="CORE Client - Accounting" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client  Accounting.aspx" SetupPath="pages\viewpage.aspx">
        <XslLink>main.xsl</XslLink>
        <Query>
          <Where>
            <Eq>
              <FieldRef Name="ContentType" />
              <Value Type="Computed">Client - Accounting</Value>
            </Eq>
          </Where>
        </Query>
        <ViewFields>...</ViewFields>
        <RowLimit Paged="TRUE">30</RowLimit>
        <Aggregations Value="Off" />
      </View>
      <View DisplayName="CORE Client - Correspondence" BaseViewID="1" Type="HTML" MobileView="TRUE" ImageUrl="/_layouts/images/dlicon.png" XslLink="main.xsl" WebPartZoneID="Main" WebPartOrder="1" Url="Forms/CORE Client  Correspondence.aspx" SetupPath="pages\viewpage.aspx">
        <XslLink>main.xsl</XslLink>
        <Query>
          <GroupBy Collapse="TRUE" GroupLimit="30">
            <FieldRef Name="Client_x0020_Correspondence_x0020_Type" />
          </GroupBy>
          <Where>
            <Eq>
              <FieldRef Name="ContentType" />
              <Value Type="Computed">Client - Correspondence</Value>
            </Eq>
          </Where>
        </Query>
        <ViewFields>...</ViewFields>
        <RowLimit Paged="TRUE">30</RowLimit>
        <Aggregations Value="Off" />
      </View>
      ...
    </Views>
  </MetaData>
</List>

Module's Elements.xml
<File Url="ClientDocumentsCorrespondence.aspx" Path="default.aspx" Type="GhostableInLibrary" >
    <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/PLClientDocuments.aspx" />
    <Property Name="Title" Value="GASOP Client Documents - Correspondence" />
    <Property Name="ContentType" Value="Welcome Page" />
    <AllUsersWebPart WebPartOrder="0" WebPartZoneID="zone1">...</AllUsersWebPart>
    <AllUsersWebPart WebPartOrder="1" WebPartZoneID="zone1">...</AllUsersWebPart>
    <View List="Client Documents"
        DisplayName=""
        Url=""
        DefaultView="FALSE"
        BaseViewID="1"
        Type="HTML"
        WebPartOrder="0"
        WebPartZoneID="zone2"
        ContentTypeID="0x"
        ID="g_4d8c86ec_b324_4f6a_a2e9_ba1a36466c68"
        Hidden="TRUE">
    <![CDATA[<webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
            <metaData>
            <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
            </metaData>
            <data>
            <properties>...</properties>
            </data>
        </webPart>
    </webParts>]]>
    </View>
</File>

A: its seem to on schema.xml you have creating two views but both have same BaseViewID. you must be unique BaseViewID for each view. 1 is the ID of the AllItems view(Default View).
Refer to this post: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/52e45ddd-73a8-400f-890c-323a0eaaeccb
copy-paste default view and giv unique Id of BaseViewID.
than on your Module's Elements.xml
  <View List="Lists/Client Documents" BaseViewID="<<Your View Unique ID>>"  DisplayName="Client Documents" Name="Client Documents" RecurrenceRowset="TRUE" WebPartZoneID="Main" WebPartOrder="0">
      <![CDATA[
          <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                  <metaData>
                      <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                  </metaData>
                  <data>
                      <properties>
                          <property name="Title">Invoice Approved</property>
                          <property name="AllowConnect" type="bool">True</property>
                          <property name="AllowClose" type="bool">False</property>
                      </properties>
                  </data>
              </webPart>
          </webParts>
      ]]>
    </View>

Please read for more details : http://blog.qumsieh.ca/2010/09/01/sharepoint-2010-schema-xml-onet-xml-and-toolbar-type/


text:
Q: Error MySQL CentOS - Starting MySQLCouldn't find MySQL server I can not make any operation in mysql:
root@server2 [~]# /etc/init.d/mysql status
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
root@server2 [~]# /etc/init.d/mysql restart
MySQL server PID file could not be found!                  [FAILED]
/etc/init.d/mysql: line 301: cd: /usr/local/mysql: No such file or directory
Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)
root@server2 [~]# /etc/init.d/mysql stop
MySQL server PID file could not be found!                  [FAILED]
root@server2 [~]# /etc/init.d/mysql start
/etc/init.d/mysql: line 301: cd: /usr/local/mysql: No such file or directory
Starting MySQLCouldn't find MySQL server (/usr/local/mysql/[FAILED]ld_safe)
root@server2 [~]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

My file /etc/my.cnf:
root@server2 [~]# cat /etc/my.cnf
[mysqld]
user = mysql
basedir = /usr/local/mysql
skip-external-locking
key_buffer = 384M
max_allowed_packet=268435456
max_connections = 500
max_user_connections = 35
wait_timeout=40
connect_timeout=10
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8
server-id       = 1
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

Searching in some posts, I found that some program may be holding mysql. Follow the command checked:
root@server2 [~]# lsof | grep mysql
tailwatch 20718      root  mem       REG        3,5    206553    8922204 /usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/auto/DBD/mysql/mysql.so

yum info mysql-server
root@server2 [~]# yum info mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.com
 * extras: centos.chi.host-engine.com
 * updates: mirror.lug.udel.edu
Excluding Packages in global exclude list
Finished
Error: No matching Packages to list

Other information ..

*

*There is no process running mysql.

*CentOS release 5.10 (Final)

*I already deleted files with extension .err and tried again. But it did not work.

*When I try to start mysql in safe mode, apparently there is no error. But still does not work and any subsequent operation does not work.


text:
Q: Python Tkinter validation command not working after deleting entry In my program, the entry widget no longer validates after the delete command has been used on it - the idea is that if it meets a certain requirement, the text in the box is automatically deleted but continues to validate the input.
from tkinter import *

TEXT_TO_MATCH = 'APPLE'

def validate(userinput):
   if userinput == TEXT_TO_MATCH:
       print(True)
        input_box.delete(0, END)
   else:
        print(False)
   return True

window = Tk()

window.title('Delete after validation')

reg = window.register(validate)

input_box = Entry(window, validatecommand=(reg, '%P'), validate='all')
input_box.pack()

window.mainloop()

A: The entry widget automatically resets the validate option to "none" when you edit the entry widget from within the validation function.
You can re-enable the validation by using after_idle to reset the validate option after control has been returned to mainloop
def validate(userinput):
    if userinput == TEXT_TO_MATCH:
        input_box.delete(0, END)
        input_box.after_idle(lambda: input_box.configure(validate="all"))
    return True


text:
Q: how to open a process in a remote server using apache telnet i encountered a problem using the apache commons-net telnet api, and hope you can help me with it.
i am connecting to a remote unix server via telnet and running a script , that at some point run an .sh file. that file open a server that needs to continue running even after the telnet connection to the client is closed. the problem is that when i close the client connection the process stops. i think that when the connection is lost there is no reference to the running process and the os is killing it but im not sure.
if that is the case i understand that if a could open the server process as a deamon process the problem will be resolve.
maybe there are other ways to do it...
can someone help me to solve this thing?
thank
moshe ben noun

A: A combination of nohup and running the process in the background using & should do what you are looking for.
http://www.livefirelabs.com/unix_tip_trick_shell_script/june_2003/06022003.htm


text:
Q: static SEO friendly page generated from react with redux, I need only index page I have web app built on react, redux, nodejs, scss, ... I would like to generate static page from index of the web app. What library would you choose? The home page need to be indexed, but I would like to keep it DRY. The best would be to render the page and the react components would be fully functional. One way would be to render the items and then replace with react components, but it seem redundant for me.

A: If it is a truly static page I would consider not using React for it at all; alternatively you could look at server side rendering to process your React on the server and output HTML. Look into renderToString.


text:
Q: How do you connect to multiple databases on a single webpage? I was wondering  how i can connect to multiple databases on a single PHP webpage.
i know how to connecet to a single database  using:
enter code here:
               $dbh=mysql_connect($hostname,$username,$password)or die("unable to connect to MYSQL");

However,can i just use multiple "mysql_connect"commands to open the other databases,and how would PHP know what databases i want the informaion pulled from if I do have multiple databases connected

A: You can use multiple variables to point at different database connections. Just call the connect and assign the handle to another variable.


text:
Q: SQL Server 2012 SQL Log "the log file is not using Unicode format": On only one server of many, the SQL log is blank and shows a message "the log file is not using Unicode Format" when viewed via SSMS. The log is in the right location as specified in the service properties and is readable with notepad. Log looks normal, just won't show up in Log File Viewer in SSMS. Any ideas why?
SQL Server 2012 in active passive Windows failover cluster on Windows 2012. SQL Server ver 11.0.3368
This instance is the SQL Server for MS SCCM. It has trace flags -T8295 and -T4199 as service startup parms. These were added by SCCM when its DB's were installed.
Thanks

A: I had an idea which worked. I forced creation of a new log using sp_cycle_errorlog and the new log can be read fine in SSMS. This server recently had a bad crash due to a SAN connection failure. I think that the SQL log file may have bcome corrupted as a result of that.


text:
Q: Why are there extra parameters in Webservice when called from Powershell? I have been passed-on a very simple C# asp.net web service with it's supposed source-code, that has just one public method called Sync(). Also, I am provided a Powershell script that calls this method of Web Service as shown in following code:
$ws = New-WebServiceProxy -uri <http://webservice.svc?wsdl>
$arg1 = $true
$arg2 = $true
$ws.Sync([ref] $arg1, [ref] $arg2)

When I look at the provided source-code, the Sync() method doesn't have any parameters. However, as you can notice that the Powershell is calling the Sync method with two arguments.
And the powershell runs fine with these two arguments being passed. When I remove the arguments from the call, it fails saying Cannot find an overload for "Sync" and the argument count: "0"
When I reverse-engineer the deployed DLL using dotPeek, it also shows the Sync method without any parameters.
This is quite confusing to me as I expected that the Webservice call from PowerShell to have no parameters so not sure why these additional parameters are passed and service call doesn't run without them.
Is this peculiar to Webservice being called from Powershell (that we need to pass additional params) or I am missing something obvious? Any pointers highly appreciated.
EDIT: Adding the wsdl section
<wsdl:operation name="Sync">
  <soap:operation soapAction="http://tempuri.org/ISyncService/Sync" style="document"/>
  <wsdl:input>
    <soap:body use="literal"/>
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal"/>
  </wsdl:output>
</wsdl:operation>


text:
Q: Is there a RegEx to extract semicolon separated values from a string... possibly containing string with semicolon I would like to extract values from a string semicolon separated values that could also contains semicolon but not as separator. The RegEx I found on this website (I lost the post) is almost complete because it separates the key and it's value.
Example:
my.parameter 10; the.foo "Procedural Map"; pve; server.description "This; is \"my\", my description,.\n"
Current result with [^; "]+|"(?:\\"|[^"])*"/g
[
  'server.seed',
  '10',
  'pve',
  'server.level',
  '"Procedural Map"',
  'server.description',
  '"This; is \\"my\\", server; description,."'
]

Desired result
[
  'my.parameter 10',
  'the.foo "Procedural Map"',
  'pve',
  'server.description "This; is \"my\", server; description,.\n"'
]

Can you help me to improve the RegEx to group the parameter and it's value?

A: I found a workaround by replacing separator by the ASCII separator (␟) then splitting the result.
const separatorPattern = /; (?=([^"]*"[^"]*")*[^"]*$)/g;

const myRawString = "server.seed 10; server.pve, server.level \"Procedural Map\"; server.description \"This; is \\\"my\\\", server; description,.\"";
const replacedSeparator = myRawString.replace(separatorPattern, "␟");
const parameters = replacedSeparator.split("␟");

console.log(parameters);
/*[
  'server.seed 10',
  'server.pve, server.level "Procedural Map"',
  'server.description "This; is \\"my\\", server; description,."'
]*/

A: You could use a repeating pattern to first match any char except the ; and then optionally match from an opening till closing double quote and match the escaped double quotes in between.
After that optionally repeat the character class [^";\\]* to also match what comes after the closing double quote.
[^;"\\]+(?:"(?:[^"\\]*(?:\\.[^"\\]*)*)"[^";\\]*)*

*

*[^;"\\]+ Match 1+ times any char except ; " \

*(?: Non capture group to repeat as a whole

*

*" Match literally

*(?: Non capture group

*

*[^"\\]* Match 0+ times any char except " \

*(?:\\.[^"\\]*)* Optionally repeat matching \ and any char followed by 0+ times any char except " and \

*) Close the non capture group

*" Match literally

*[^";\\]* Optionally match any char except " ; \

*)* Close the outer non capture group and optionally repeat

Regex demo


text:
Q: App Development - Logcat errors and "Unfortunately  has stopped" I'm working on an independent app and am following some basic tutorials. From what I can tell, the code is virtually the same as the guides I'm following, but when I try to run the application on the emulator, I'm getting the "unfortunately  has stopped working" message. I'm having some difficulty interpreting the errors in the logcat because a lot of the directed lines of code are the default code created when I started the new files. Any help would be appreciiated, thanks
03-28 18:45:27.390: D/FragmentManager(1033):     mCreated=truemResumed=false mStopped=false mReallyStopped=false
03-28 18:45:27.390: D/FragmentManager(1033):     mLoadersStarted=false
03-28 18:45:27.400: D/FragmentManager(1033):   Active Fragments in b3d357b8:
03-28 18:45:27.400: D/FragmentManager(1033):     #0: PlaceholderFragment{b3d35b68 #0 id=0x7f06003c}
03-28 18:45:27.400: D/FragmentManager(1033):       mFragmentId=#7f06003c mContainerId=#7f06003c mTag=null
03-28 18:45:27.400: D/FragmentManager(1033):       mState=0 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0
03-28 18:45:27.400: D/FragmentManager(1033):       mAdded=true mRemoving=false mResumed=false mFromLayout=false mInLayout=false
03-28 18:45:27.400: D/FragmentManager(1033):       mHidden=false mDetached=false mMenuVisible=true mHasMenu=false
03-28 18:45:27.400: D/FragmentManager(1033):       mRetainInstance=false mRetaining=false mUserVisibleHint=true
03-28 18:45:27.400: D/FragmentManager(1033):       mFragmentManager=FragmentManager{b3d357b8 in MainActivity{b3d34660}}
03-28 18:45:27.400: D/FragmentManager(1033):       mActivity=com.example.cooldog.MainActivity@b3d34660
03-28 18:45:27.400: D/FragmentManager(1033):   Added Fragments:
03-28 18:45:27.400: D/FragmentManager(1033):     #0: PlaceholderFragment{b3d35b68 #0 id=0x7f06003c}
03-28 18:45:27.410: D/FragmentManager(1033):   FragmentManager misc state:
03-28 18:45:27.410: D/FragmentManager(1033):     mActivity=com.example.cooldog.MainActivity@b3d34660
03-28 18:45:27.170: D/dalvikvm(1033): GC_FOR_ALLOC freed 83K, 6% free 2860K/3012K, paused 52ms, total 54ms
03-28 18:45:27.180: I/dalvikvm-heap(1033): Grow heap (frag case) to 3.575MB for 756876-byte allocation
03-28 18:45:27.260: D/dalvikvm(1033): GC_FOR_ALLOC freed 2K, 5% free 3596K/3752K, paused 74ms, total 74ms
03-28 18:45:27.380: E/FragmentManager(1033): No view found for id 0x7f06003c (com.example.cooldog:id/container) for fragment PlaceholderFragment{b3d35b68 #0 id=0x7f06003c}
03-28 18:45:27.380: E/FragmentManager(1033): Activity state:
03-28 18:45:27.390: D/FragmentManager(1033):   Local FragmentActivity b3d34660 State:
03-28 18:45:27.420: D/FragmentManager(1033):     mContainer=android.support.v4.app.FragmentActivity$2@b3d36130
03-28 18:45:27.420: D/FragmentManager(1033):     mCurState=2 mStateSaved=false mDestroyed=false
03-28 18:45:27.420: D/FragmentManager(1033):   View Hierarchy:
03-28 18:45:27.420: D/FragmentManager(1033):     com.android.internal.policy.impl.PhoneWindow$DecorView{b3d3acc0 V.E..... ... 0,0-0,0}
03-28 18:45:27.430: D/FragmentManager(1033):       com.android.internal.widget.ActionBarOverlayLayout{b3d3bdb8 V.ED.... ... 0,0-0,0 #1020313 android:id/action_bar_overlay_layout}
03-28 18:45:27.430: D/FragmentManager(1033):         android.widget.FrameLayout{b3d3d528 V.E..... ... 0,0-0,0 #1020002 android:id/content}
03-28 18:45:27.430: D/FragmentManager(1033):           android.widget.RelativeLayout{b3d52388 V.E..... ... 0,0-0,0 #7f06003d app:id/RelativeLayout1}
03-28 18:45:27.430: D/FragmentManager(1033):             android.widget.TextView{b3d33db8 V.ED.... ... 0,0-0,0 #7f06003e app:id/TextView1}
03-28 18:45:27.440: D/FragmentManager(1033):             android.widget.Button{b3d336a0 VFED..C. ... 0,0-0,0 #7f06003f app:id/readWish}
03-28 18:45:27.440: D/FragmentManager(1033):         com.android.internal.widget.ActionBarContainer{b3d3dac0 V.ED.... ... 0,0-0,0 #1020314 android:id/action_bar_container}
03-28 18:45:27.440: D/FragmentManager(1033):           com.android.internal.widget.ActionBarView{b3d40678 V.E..... ... 0,0-0,0 #1020315 android:id/action_bar}
03-28 18:45:27.440: D/FragmentManager(1033):             android.widget.LinearLayout{b3d40e58 V.....C. ... 0,0-0,0}
03-28 18:45:27.440: D/FragmentManager(1033):               com.android.internal.widget.ActionBarView$HomeView{b3d44d30 V.E..... ... 0,0-0,0}
03-28 18:45:27.440: D/FragmentManager(1033):                 android.widget.ImageView{b3d45278 G.ED.... ... 0,0-0,0 #102025a android:id/up}
03-28 18:45:27.440: D/FragmentManager(1033):                 android.widget.ImageView{b3d463d8 V.ED.... ... 0,0-0,0 #102002c android:id/home}
03-28 18:45:27.440: D/FragmentManager(1033):               android.widget.LinearLayout{b3d47a88 G.E..... ... 0,0-0,0}
03-28 18:45:27.440: D/FragmentManager(1033):                 android.widget.TextView{b3d47fa8 V.ED.... ... 0,0-0,0 #1020265 android:id/action_bar_title}
03-28 18:45:27.440: D/FragmentManager(1033):                 android.widget.TextView{b3d48d10 G.ED.... ... 0,0-0,0 #1020266 android:id/action_bar_subtitle}
03-28 18:45:27.440: D/FragmentManager(1033):           com.android.internal.widget.ActionBarContextView{b3d49478 G.E..... ... 0,0-0,0 #1020316 android:id/action_context_bar}
03-28 18:45:27.440: D/FragmentManager(1033):         com.android.internal.widget.ActionBarContainer{b3d4bee8 G.ED.... ... 0,0-0,0 #1020317 android:id/split_action_bar}
03-28 18:45:27.460: D/AndroidRuntime(1033): Shutting down VM
03-28 18:45:27.460: W/dalvikvm(1033): threadid=1: thread exiting with uncaught exception (group=0xb3a72ba8)
03-28 18:45:27.480: E/AndroidRuntime(1033): FATAL EXCEPTION: main
03-28 18:45:27.480: E/AndroidRuntime(1033): Process: com.example.cooldog, PID: 1033
03-28 18:45:27.480: E/AndroidRuntime(1033): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cooldog/com.example.cooldog.MainActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f06003c (com.example.cooldog:id/container) for fragment PlaceholderFragment{b3d35b68 #0 id=0x7f06003c}
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.os.Handler.dispatchMessage(Handler.java:102)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.os.Looper.loop(Looper.java:136)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at java.lang.reflect.Method.invokeNative(Native Method)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at java.lang.reflect.Method.invoke(Method.java:515)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at dalvik.system.NativeStart.main(Native Method)
03-28 18:45:27.480: E/AndroidRuntime(1033): Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f06003c (com.example.cooldog:id/container) for fragment PlaceholderFragment{b3d35b68 #0 id=0x7f06003c}
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.Activity.performStart(Activity.java:5241)
03-28 18:45:27.480: E/AndroidRuntime(1033):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
03-28 18:45:27.480: E/AndroidRuntime(1033):     ... 11 more
03-28 18:45:33.480: I/Process(1033): Sending signal. PID: 1033 SIG: 9

==============================================================
CODE
==============================================================
MainActivity (java file)
package com.example.cooldog;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.os.Build;

public class MainActivity extends ActionBarActivity {

//Fields//
int wishes;
Button read;
TextView currentlyReadWish; //travis's display

//Methods//

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_main);
    wishes = 0;
    read = (Button) findViewById(R.id.readWish);
    currentlyReadWish = (TextView) findViewById(wishes); //REPLACE WITH DATABASE MSG
    read.setOnClickListener(new View.OnClickListener() { //new View.onClickListener might be wrong, this changes whats already on the screen, we want it to transition to another one with a different view entirely
        public void onClick(View v) {
            //Auto-generated method stub WHAT HAPPENS WHEN U CLICK
            //BRINGS YOU TO NEW SCREEN OR POPS UP A ENCOMPASSING WINDOW ON ABOVE SCREEN
            //DISPLAYS WISH
            currentlyReadWish.setText("THEWISHMSG");
        }
    });
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container,
                false);
        return rootView;
    }
}

}

==============================================================
main_fragment (xml file)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ice_cream"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.cooldog.MainActivity$PlaceholderFragment" >

<TextView
    android:id="@+id/TextView1"
    android:layout_width="207dp"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:layout_marginLeft="26dp"
    android:gravity="center"
    android:text="@string/greeting1"
    android:textSize="18sp" />

<Button
    android:id="@+id/readWish"
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:layout_alignRight="@+id/TextView1"
    android:layout_centerVertical="true"
    android:orientation="horizontal" />

==============================================================
AndroidManifest (xml file)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cooldog"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="19" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.cooldog.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" /> <!-- WHAT ACTIVITY OPENS UPON LAUNCH, HAVE JUST ONE IDIOT -->
        </intent-filter>
    </activity>
            <activity
        android:name="com.example.cooldog.WishingCenter"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.cooldog.WISHINGCENTER" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

==============================================================
Transition1 (java file)
package com.example.cooldog;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;

public class Transition1 extends Activity {

MediaPlayer transitionSong;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ice_cream);
    transitionSong = MediaPlayer.create(Transition1.this, R.raw.beasts);
    transitionSong.start();
    Thread timer = new Thread() {
        public void run(){
            try{
                sleep(1000);

            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                Intent openNextWindow = new Intent("com.example.cooldog.WISHINGCENTER");
                startActivity(openNextWindow);
            }
        }
    };
    timer.start();
}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    transitionSong.release();
    finish();
}

}
==============================================================
WishingCenter (java file)
package com.example.cooldog;

import android.app.Activity;
import android.os.Bundle;

public class WishingCenter extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ice_cream);
}

}
==============================================================
ice_cream (xml file)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/ice_cream">
</FrameLayout>

==============================================================
strings (xml file)
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<string android:id="@+id/app_name" name="app_name">cooldog</string>
<string android:id="@+id/hello_world" name="hello_world">Hello world!</string>
<string android:id="@+id/action_settings" name="action_settings">Settings</string>
<string android:id="@+id/greeting1" name="greeting1">Welcome back, </string>
<string android:id="@+id/greeting2" android:layout_height="wrap_content"       android:layout_width="wrap_content" name="greeting2"> new messages</string>

</resources>

A: I think you have specified the wrong layout in setContentView() of the onCreate() method of the Fragment activity.
Android Fragment no view found for ID?

A: Ok, so it turns out some of the default code that was automatically implemented when I started the app is what was causing my issues. After deleting it, it worked as intended. thanks all for your help and contributions.


text:
Q: How to break Latex Long Table at the start of merged rows? I am using the following code to create a long table-
\begin{longtable}[c]{lllllll}
\caption{Random Data}
\label{tab:my-table}\\
Instance   No. & Concept No. & 1 & 2 & 3 & 4 & 5 \\
\endfirsthead
%
\multicolumn{7}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
Instance   No. & Concept No. & 1 & 2 & 3 & 4 & 5 \\
\endhead
%
\multirow{5}{*}{1-1} & Name & A & B & C & D & E \\
 & a & 2 & 2 & 2 & 2 & 2 \\
 & b & 6 & 7 & 8 & 9 & 6 \\
 & x & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} \\
 & y & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} \\
\multirow{5}{*}{1-2} & Name & A & B & C & D &  \\
 & a & 2 & 2 & 2 & 2 &  \\
 & b & 6 & 7 & 8 & 9 &  \\
 & x & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} &  \\
 & y & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} &  \\
\multirow{5}{*}{1-3} & Name & A & B & C & D &  \\
 & a & 2 & 2 & 2 & 2 &  \\
 & b & 7 & 7 & 8 & 9 &  \\
 & x & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} &  \\
 & y & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} & {[}1,1{]} &
\end{longtable}

However, sometimes, the table breaks in the middle of a merged row to run into the next page. How can I prevent breaking at the merged rows? I want the table to break before the start of the merged row.


text:
Q: How to copy / transer files from ubuntu terminal into a digital-ocean space Can I scp files to digital ocean space from ubuntu terminal?
I setup a space in my digital ocean account, I can drag and drop files into the space, but I cant figure it out the way that I can copy files to the space from the command line.
Do I have to use droplets, but its a additional server right? I dont want a server. I just want a space to store some files.

A: There is a tool called s3cmd which used to upload files and folders to s3 buckets in amazon. You can use this for the same purpose. But for digitalocean you will need an updated version of s3cmd (version 2 or above)
There is a digitalocean documentation about setting up s3cmd you can check it out from here as well
I got s3cmd latest python tarball
wget https://sourceforge.net/projects/s3tools/files/s3cmd/2.0.1/s3cmd-2.0.1.tar.gz
extract it
tar xzf s3cmd-2.0.1.tar.gz
Now install it using below command with source files.
cd s3cmd-2.0.1
sudo python setup.py install
Now you will need to obtain the access token and the secret key from digital ocean api
You can find the procedure here
after getting the token and the key run
s3cmd --configure
provide your region, and the bucket url, etc. then after the configuration
simply run
s3cmd ls to find out the bucket url
then you can upload files by running
s3cmd put file.txt BUCKETURL
if you want to upload directories
s3cmd put -r folderName bucketname


text:
Q: fortran: Identify intrinsic type of a variable *after* the variable is in memory I am a bit new to fortran, coming to it from the Python, R and SAS.  In all of these languages, data type formatting is embedded in output functions, but fortran requires (among other things) an explicit format indicator for each variable being written.  I'd like to dynamically build the format string by leveraging variable introspection to have fortran tell me what the data type is, along with the applicable attributes (KIND, LEN, etc).  Such introspection would also assist in the construction of universally applicable program subunits.
In the OO world of Python and R, this is a trivial inquiry.  For example, testing whether a value is a string in Python is just...
isinstance('foo',basestring)

There are other methods of course.  In any event, I just can't shake the idea that such an intrinsic inquiry must exist in fortran.  To date, all I have seen are methods that would be unable to distinguish between a whole real value and integers.
Others have proposed using the IOSTAT parameter in the READ statement.  I have not yet figured out how to leverage this statement for variables that already exist in memory.  (At this point, I have only encountered use of the READ statement in conjunction with reading from the keyboard or a file on the hard drive.)
Someone please tell me I have made an egregious oversight somewhere.  I feel like this capability has to exist.  Thanks.

A: This capability does not exist. You always know what type is the variable you are working with. At least the declared type. With polymorphic types you must use select type to get the actual type, but again you know the type at compile time then.
You can use the gw.d or g0 descriptor for universal formatting of intrinsic types. You do not need to think what type of number it belongs to. For user defined derived types there is a possibility to define own I/O routines.
For very simple I/O you can use the list-directed I/O, e.g.,
print *, x
read(*,*) x
write(*,*) x

There are some restrictions on when you can use it and you don't have much control of the behavior.
Otherwise I do not think this capability is something that obviously must be present in an OO language. Both languages you mean (R, Python) are dynamically typed and therefore have much larger need for this. In C++98 there is typeid() but most people do not need it.


text:
Q: Convert .csv to xlsx using bash shell script I'm trying to convert pipe delimited .csv file to .xlsx using bash shell scripting. Tried the below shell script. csv file has valid records. The script is converting .csv to .xlsx but when I tried opening the Excel file, it says file format or file extension is not valid. How to convert .csv to .xlsx using shell script?
#!/bin/bash
for f in *.csv; do
mv -- "$f" "${f%.csv}.xlsx"
done


text:
Q: Magento 2 : Adding Custom Attribute "color" to Order Items in Backend How do I add custom attribute "color". I have made to order items in backend.
I have tried:

*

*$_item->getColor()

*$_item->getAttributes()

*$_item->getAttribute('color')

And a bunch of other stuff:
vendor\magento\module-sales\view\adminhtml\templates\items\column\name.phtml
<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * @see \Magento\Sales\Block\Adminhtml\Items\Column\Name
 */
?>

<?php if ($_item = $block->getItem()): ?>
    <div id="order_item_<?php /* @escapeNotVerified */ echo $_item->getId() ?>_title"
         class="product-title">
        <?php echo $block->escapeHtml($_item->getName()) ?>

        <?php /* @escapeNotVerified */ echo __('SKU') ?>: <?php echo implode('
', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($block->getSku()))); ?>

    <?php if ($block->getOrderOptions()): ?>

            <?php foreach ($block->getOrderOptions() as $_option): ?>

<?php /* @escapeNotVerified */ echo $_option['label'] ?>:

                    <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?>
                        <?php /* @escapeNotVerified */ echo $block->getCustomizedOptionValue($_option); ?>
                    <?php else: ?>
                        <?php $_option = $block->getFormattedOption($_option['value']); ?>
                        <?php /* @escapeNotVerified */ echo $_option['value']; ?><?php if (isset($_option['remainder']) && $_option['remainder']): ?><span id="<?php /* @escapeNotVerified */ echo $_dots = 'dots' . uniqid()?>"> ...<span id="<?php /* @escapeNotVerified */ echo $_id = 'id' . uniqid()?>"><?php /* @escapeNotVerified */ echo $_option['remainder'] ?>

                        <?php endif; ?>
                    <?php endif; ?>

            <?php endforeach; ?>

    <?php endif; ?>
    <?php echo $block->escapeHtml($_item->getDescription()) ?>
<?php endif; ?>

A: Item object has a product property that you can retrieve by
       `$product = $_item->getProduct();
        $color = $product->getData('color');

Make sure that $_item is instance of Magento\Sales\Model\Order\Item

A: Try this
$objectManager = Magento\Framework\App\ObjectManager::getInstance();

$product = $objectManager->create('Magento\Catalog\Model\Product')->load($_item->getProductId());

$color = $product->getAttributeText('color');

A: It worked for me.
for get value from drop-down attribute:
$color = $product->getAttributeText('color');

instead of:
$color = $product->getData('color');


text:
Q: Converting to lambda and unexpected results So, I got the "Type1" code working and it's working fine.  My question is why doesn't "Type2" work?  I thought they were, in essence, doing the same thing but obviously "Type2" isn't doing what I expected it to build the JSON string for a google chart.
StringBuilder pieData = new StringBuilder();

//Type2 - Empty string ""
pieData.Clear();
data.Select(point => pieData.Append($@"['{point.Category}', {point.Count}],"));
pieData.ToString().Dump("JSON");

//Type1 - works fine "['F-01', 10],['A-01', 8],"
foreach (PieDatapoint point in data)
{
    pieData.Append($@"['{point.Category}', {point.Count}],");
}
pieData.ToString().Dump("JSON");

A: Select is a deferred operation. By simply calling Select you're not executing it. You must also include a .ToArray() or .ToList() or execute it using a foreach loop.
Had you executed this:
data.Select(point => pieData.Append($@"['{point.Category}', {point.Count}],")).ToArray();

Or this:
foreach (var x in data.Select(point => pieData.Append($@"['{point.Category}', {point.Count}],")))
{ }

Then the code would have worked.
Please keep in mind that this only works because pieData.Append(...) returns a value. If it didn't then neither approach would even compile.

A: You csn use ForEach instead of Select for target response if data is List or Array:
data.ForEach(point => pieData.Append($@"['{point.Category}', {point.Count}],"));

Or by Select and Join:
var strings = data.Select(point => $@"['{point.Category}', {point.Count}]").ToList();

string pieData = string.Join(",", strings);


text:
Q: How to remove the outline on my video player I have got a basic video player and when clicked to play the video then i get a kind of blue outline, which i wish to remove.
I have tried the basic like outline:none, but nothing has changed. I have also researched on the internet, including w3 schools and it tell may to use the outline attribute. Am I putting it in the wrong place?
HTML

        <video id="video" controls autoplay preload="metadata" poster="img/poster.jpg">
            <source src="../videoplayer/intro.mkv" type="video/mp4">

            Download MP4
        </video>

<button id="playpause" type="button">Play/Pause</button>

<button id="stop" type="button">Stop</button>

                <progress id="progress" value="0" min="0">

                </progress>

<button id="mute" type="button">Mute/Unmute</button>

<button id="volinc" type="button">Vol+</button>

<button id="voldec" type="button">Vol-</button>

<button id="fs" type="button">Fullscreen</button>

css
.video-container{
    background-color: #191919;
    width: 100%;
    height: 1000px;
}
figure {
    max-width:1024px;
    max-width:64rem;
    width:250%;
    height:auto;
    margin:20px 0 0;
    margin:1.25rem 0 0;
}
figcaption {
    display:block;
    font-size:16px;
    font-size:1rem;
}
video {
    width:1150px;
    margin-top:200px;
    margin-left: 390px;
}
video#video {
    outline: none
}
/* controls */
.controls, .controls li {
    padding:0;
    margin:0;
}
.controls {
    display:none;
    list-style-type:none;
    overflow:hidden;
    background:transparent;
}
.controls li {
    float:left;
    width:10%;
    margin-left:0.3%;
}
.controls li:first-child {
    margin-left:0;
}
.controls .progress {
    width:38%;
    cursor:pointer;
}
.controls button {
    width:100%;
    text-align:center;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
}
.controls progress {
    display:block;
    width:100%;
    height:20px;
    height:1.25rem;
    margin-top:2px;
    margin-top:0.125rem;
    border:1px solid #aaa;
    overflow:hidden;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    border-radius:5px;
}
.controls progress span {
    width:0%;
    height:100%;
    display:inline-block;
    background-color:#2a84cd;
}

/* fullscreen */
html:-ms-fullscreen {
    width:100%;
}
:-webkit-full-screen {
    background-color:transparent;
}
/* hide controls on fullscreen with WebKit */
figure[data-fullscreen=true] video::-webkit-media-controls {
    display:none !important;
}
figure[data-fullscreen=true] {
    max-width:100%;
    width:100%;
    margin:0;
    padding:0;
}
figure[data-fullscreen=true] video {
    height:auto;
}
figure[data-fullscreen=true] figcaption {
    display:none;
}
figure[data-fullscreen=true] .controls {
    position:absolute;
    bottom:2%;
    width:100%;
    z-index:2147483647;
}
figure[data-fullscreen=true] .controls li {
    width:5%;
}
figure[data-fullscreen=true] .controls .progress {
    width:68%;
}

Screenshot of the outline that i wish to remove
https://imgur.com/HTDiIo4
Any help  appreciated and thanks in advance

A: Try this:
.video-container:focus {
    outline: none;
}

A: An outline is a line that is drawn around elements, outside the borders, to make the element "stand out".
https://www.w3schools.com/cssref/pr_outline.asp
.video-container{
  background-color: #191919;
  width: 100%;
  height: 1000px;
  // add this
  outline :none;
}

As Marko Sikman said you can also add
.video-container:focus{
  outline :none;
}

focus tells that when you click on that element then the outline appears, so if you set it to none then it doesn't appear on click

A: Try adding the following to your CSS:
#video:focus {
    outline:none !important;
}


text:
Q: I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page How can I  display the same time on another page without using cookies because its just a local website and database isn't such a good idea? Is there something else I can do?

A: local storage should be very ok.

example :
    //page A
var counted_time=[your algorithm result];
    localStorage.setItem("mytime_hey", counted_time);

    //page B
        var mytime = localStorage.mytime_hey;
    $("#mydiv").html("your time is"+mytime+" !");

//// if your question is : how to count ? that s another matter. make a difference between 2 date : How Many Seconds Between Two Dates?


text:
Q: Change the class of the span according to the text of the span I want to change span class according to text of span.
I tried this:

$(".f1").each(function (x, span) {
    var text = $(span).html();
    if (text == 'x1') {
        $(span).addClass('badge bg-label-danger me-1').removeClass('f1');
    }
    else if (text == 'x2') {
        $(span).addClass('badge bg-label-success me-1').removeClass('f1');
    }
});

x1

A: SOLVED
x1


text:
Q: Where can i find CoreNLP Lexicon and how to differentiate between action and stative verbs I am using CoreNLP for semantic network project and i want to know what words does CoreNLP contains and how is it categorized.

A: Why don't you Google search first? http://nlp.stanford.edu/nlp/javadoc/javanlp-3.5.0/edu/stanford/nlp/parser/lexparser/BaseLexicon.html


text:
Q: asp.net - RadioButton "CheckedChanged" event does not work when it is unchecked I have two RadioButtons on my Web Form and here is the code:
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{

}

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
        Response.Write(DateTime.Now.ToLongTimeString());
}

When I check RadioButton2, time appears on the page but when I check RadioButton1(RadioButton2 is unchecked now) it does not update the shown time and removes it.
the event function must be called when it checks and unchecks.I don't understand what is wrong here and why the time disappears
(As it is obvious, I know about GroupName property and AutoPostBack. My problem is something else)

A: You can check property of each control and check  AutoPostBack=True
and also if checked="true"

A: I tried it on different ways and opened my pages with different browsers and I figured out a few things. the most important of them which is related to my problem:

*

*When a control Calls back, the page refreshes and that is why the time disappears. It sends the status of all controls using post method to itself and they would be the same way as they were. But the time is not written on a control and it would not be saved.
As I said if it was for example on a Label, the text would be kept:

Label1.Text = DateTime.Now.ToLongTimeString();
It answers the first question but I still think that the event function must be called when the RadioButton is being unchecked.


text:
Q: get data from two different cores in solr i have two different-different core i want join and get all fields from both core as mysql inner join does.
Core Product :
product_id
product_details
author_id

Core Author:
 author_id
    author_name
    author_detail

i need all fields from both core with joining using author_id. i have tried with join but it will return me data from one core either product or author or need to make two query and combine dataset.

A: You can't. Solr joins are not able to retrieve information from both sides of the join - they're only able to filter by a value on the other side, not retrieve the information.
You'll have to either structure the documents as suitable for block joins, or make two queries - first retrieve the content on one side of the join, then fetch all the documents that match on the other side. This might be the most flexible and quickest solution, and will scale well (as the other lookup is just on the joined field as field:(foo OR bar OR baz) after iterating through the first set).
A third option is to just index the author_name and author_detail together with your core products. As long as those values isn't present in a million documents and changes every second, the performance will be fine.


text:
Q: Problem about proving not cyclic Prove that if p is a prime number and G is a finite group containing at least p elements of order p, then G is not cyclic.
I thought I start with contradiction, suppose that G is cyclic and G=$<g>$, then $|G|=kp$, then I have not idea. could somebody give me some hit. Thanks.

A: Hint: if $G = \langle g \rangle$ with order $k\cdot p$, then how many elements will have order $p$?  That is, which elements of $G$ will have some order dividing $p$, and of those, which will be of exactly order $p$?

A: Hint: In a cyclic group of order $n$, if $1\le d|n$ then there are exactly $\phi(d)$ elements of order $d$, where $\phi$ is the Euler's phi function.

A: Hint:
A finite cyclic group of order $\;n\;$ has, for each divisor $\;d\;$ of $\;n\;$ , a unique subgroup of order $\;d\;$ .
But how many elements of order $\;p\;$ does a cyclic group of order $\;p\;$ have? And yet you have $\;p\;$ element of order $\;p\;$ , so....


text:
Q: php -S 0.0.0.0:8000 command can't do "Listening" I have a strange problem, that I can't spin up a php server on my machine.
I just want to access my php app remotely.
Firstly I have root access on server, and using ufw for port management. (It doesn't work also when ufw inactive)
I allowed ports like 80,8000,7171 which I used on ufw.
When I try to spin up a php server I usually type php -S localhost:8000
if I want to access the server remotely php -S 0.0.0.0:8000 then get an log screen like this.
[Sun Jan  9 20:16:03 2022] PHP 7.4.3 Development Server (http://0.0.0.0:8000) started

Listening on 0.0.0.0:8000

And I can access the server both localy and remotely.
For now if I use localhost or 127.0.0.1 I can access my files locally. But remote access still doesn't work.
By the way I can't see the Listening... part. This could cause this problem? Have you any ideas?
My system information
php -v
PHP 7.4.3 (cli) (built: Nov 25 2021 23:16:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Linux kernel  5.4.0-84-generic
Description: Ubuntu 20.04.3 LTS

I am using Godaddy's vps. I contact them. But can't resolve.
Is there a way about check firewall or something else blocking my requests?
SOLVED!
Finally found the problem! As you guess, it was firewall.
Neither ufw nor iptables solved my problem. Then I found the answer here
https://stackoverflow.com/a/49722535/5481342
This command in answers solved my problem.
firewall-cmd --list-ports
I only see the ssh port as my expect.
Then I add firewall-cmd --add-port=7171/tcp  --permanent
and don't forget to firewall-cmd --reload
now works!!
Thank you all for your comments. I hope this question will be helpful.
Thanks.

A: The reason I think this is a firewall problem is because:

For now if I use localhost or 127.0.0.1 I can access my files locally. But remote access still doesn't work.

It indicates that the PHP service has been started and the port is opened correctly.

yes I can ping the IP

It indicates that the network between the local computer and the server is unblocked.
So only a firewall will block your access, but I'm just not sure which one is.


text:
Q: What is the difference between these two syntax types? (Objective-C) I'm just trying to get my head around this type of syntax
I know that the
[instanceOfClass  Method];

eg. [myImage setImage:[NSImage imageNamed:@"picture.jpg"]];
performs a method on the instance of the class.
but how does this work..
Variable = [Class methodName];

eg. int Value = [sender intValue];
can someone explain this to me. I get that the first example performs a method on instance of class, class or variable..
but how does the latter part work?
Thank you very much.

A: There are instance methods (defined with a -) and class methods (with a +). Instance methods are called in instances and class methods in classes.
- (void)instanceMethod;
+ (void)classMethod;

Apart from this, you example:
int Value = [sender intValue];

Seems to be an instance method. If it's inside an action, keep in mind sender is just an argument:
- (IBAction)startWork:(id)sender
{
  ...
}

A: The second example also performs a method on an instance of a class, but that method returns a value which is assigned to the value on the left side of the equation.
I'd recommend spending a little time reading the introduction provided by Apple.  This specific question is discussed in this part of the document:

Like standard C functions, methods can return values. The following
  example sets the variable isFilled to YES if myRectangle is drawn as a
  solid rectangle, or NO if it's drawn in outline form only.
BOOL isFilled;

isFilled = [myRectangle isFilled];


text:
Q: Update db on successful payment django I have a model named 'Exhibition', where i enable users to create a new exhibition/event after filling out a form they are asked to pay some amount and are redirected to a payment gateway (paypal as per django-paypal), after successful payment i want to update my 'Exhibition' table only for those who have paid, users are requested to login before creating an event and i am also saving the user with the form in my db.
This is my view for saving the form:
def new_event(request):
    form = NewEventForm(request.POST or None)
    if form.is_valid():
        save_it = form.save(commit=False)
        save_it.user = request.user
        save_it.save()

    return render_to_response('new_event.html',locals(), context_instance=RequestContext(request))

and my model:
class Exhibition(models.Model):
    user = models.ForeignKey(User, blank=True, null = True)
    Type = models.ForeignKey('home.Type')
    Category = models.ForeignKey('home.Category')
    Country = models.ForeignKey('home.Country')
    City = models.ForeignKey('home.City')
    Event_name = models.CharField(max_length = 250)
    Video_url = models.URLField(blank = True)
    Event_start_date = models.DateField(blank = False)
    Event_end_date = models.DateField(blank = False)
    Discription = RichTextField(blank = False)
    Contact_person = models.CharField(max_length=50,blank = True )
    Company = models.CharField(max_length = 100,blank = True)
    Company_website = models.URLField(blank = True)
    Email  = models.EmailField(blank = True)
    Event_website = models.URLField(blank = True)
    Event_email = models.EmailField(blank = True)
    Venue = models.CharField(max_length = 250, blank = False)
    Address = models.CharField(max_length = 250, blank = False)
    Paid = models.IntegerField(max_length=2, default='0')

    def __unicode__(self):
        return '%s' % self.Event_name

    @permalink
    def get_absolute_url(self):
        return ('view_category', None, { 'slug': self.Event_name })

If i use django-paypal view, i would be able to process payment but i don't know how to get the correct 'Exhibition - id' to update the db, shall i store it in cookies and how to do it?

A: I would try adding a post_save signal handler to django-paypal's model PayPalStandardBase and then use the transaction record's fields to identify your exhibition record. You could use the primary key field of your model and tell paypal that it is your item number for the transaction, or just add any other unique field you want to use as common identifier.
Check out the model here:
https://github.com/spookylukey/django-paypal/blob/master/paypal/standard/models.py
The signal handler would look like:
@receiver(post_save, sender=PayPalStandardBase)
def mark_as_paid(sender, instance=None, created=False, **kwargs):
    if created:
        e = Exhibition.objects.get(pk=instance.item_number)
        e.Paid = ...
        e.save()

You can add it to a models.py of yours or a signals.py which you then import elsewhere.

A: I would suggest adding a custom field containing the user id , and recover it when paypal notify you back.
See custom below :
https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/


text:
Q: How can I vectorize this Sigmoid function? How can this sigmoid function be vectorized? Currently it is using a two-dimensional array.
double[][] data = z.getData();
for (int i = 0; i < data.length; i++) {
    double[] row = data[i];
    for (int j = 0; j < row.length; j++) {
        double newVal = 1 / (1 + e.value(data[i][j]));
        data[i][j] = newVal;
    }
}


text:
Q: Using Cursor to write CSV and Insert into Table I need to fetch data that both writes csv data to a file, and updates a table with that same record. This cursor could potentially find 100k-300k records.
Is there a more efficient way to do this rather than looping over? I was thinking of doing an insert with a Select outside the loop, but there's no way of knowing that each record was successfully written to file.
DECLARE
...

   file_output VARCHAR2 (3000);
   col2 column2%type;
   col3 column3%type;

 CURSOR my_cursor
   IS
    select
      csv_val1 || ',' || csv_val2|| ',' || csv_val3,
      column2,
      column3
    from my_cursor_table

...

BEGIN

...
   FETCH my_cursor INTO file_output,col2,col3;

   WHILE my_cursor%FOUND
   LOOP
      BEGIN
         UTL_FILE.PUT_LINE (ID, file_output);
         insert into my_insert_table values(col2,col3);
..

END;

A: You can:

*

*bulk collect the query into an array with a limit

*Loop through the array, writing each element to the file

*Wrap the utl_file call in an exception handler that logs the error and deletes that element from the array

*Use forall i in indices of to only insert the values that succeeded

This should come out notably faster than single row processing. In this simple example processing 100k rows:

*

*Row-by-row processing was ~15s

*Bulk collect/forall was ~1.5s

So about 10x faster:
create table t (
  c1 int, c2 int
);

set timing on
declare
  cursor cur is
    select level c1, mod ( level, 10 ) c2
    from   dual
    connect by level <= 100000;
  rec cur%rowtype;
  f utl_file.file_type;
begin
  f := utl_file.fopen ('TMP', 'test.csv', 'w');
  open cur;
  loop
    fetch cur into rec;
    exit when cur%notfound;

    begin
      utl_file.put_line ( f, rec.c1 || ',' || rec.c2 );
      insert into t values ( rec.c1, rec.c2 );
    exception
      when others then
        dbms_output.put_line( 'Error logging' );
    end;
  end loop;
  close cur;
  utl_file.fclose(f);
end;
/

PL/SQL procedure successfully completed.

Elapsed: 00:00:15.192

declare
  cursor cur is
    select level c1, mod ( level, 10 ) c2
    from   dual
    connect by level <= 100000;
  type rec_arr is table of cur%rowtype
    index by pls_integer;
  rec rec_arr;
  f utl_file.file_type;
begin
  f := utl_file.fopen ('TMP', 'test.csv', 'w');
  open cur;
  loop
    fetch cur bulk collect into rec
    limit 100;
    exit when rec.count = 0;

    for i in 1 .. rec.count loop
      begin
        utl_file.put_line ( f, rec(i).c1 || ',' || rec(i).c2 );
      exception
        when others then
          dbms_output.put_line( 'Error logging' );
          rec.delete(i);
      end;
    end loop;
    forall i in indices of rec
      insert into t values ( rec(i).c1, rec(i).c2 );
  end loop;
  close cur;
  utl_file.fclose(f);
end;
/

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.578

Note this doesn't handle the case where the write succeeds, but the insert fails...
To get around that, You can do something like:

*

*Insert the rows (with forall ... save exceptions or insert ... log errors)

*Write the rows that succeeded

*Delete the rows that failed to write to the file


text:
Q: how to filter json values to an array I have a json file like this
let myfile = [
    {"name":"John","eid":664,"socialid":399,"testid":799},
    {"name":"Sam","testid":249,"eid":64,"socialid":80},
    {"name":"Albert","eid":422,"testid":20,"socialid":10},
    {"name":"Michel","eid":497,"testid":15,"socialid":60}]

from this above json I want to filter all values by it's key name and push it to an array.
expected output is:
"name": ["John", "Sam", "Albert", "Michel"],
"eid": [664, 64, 422, 497],
"testid": [799, 249, 20, 15],
"socialid": [399, 80, 10, 60]

How to make this happen ?
I tried like this
let arr3 = [];
$.each( myfile, function( key, value ) {
  if(this.hasOwnProperty('name'))
  {
    console.log("is there")
    arr3.push(value);
  }
});
console.log(arr3);

it's not working as expected.

A: You can reduce the array into one object:

let myfile = [
    { name: 'John', eid: 664, socialid: 399, testid: 799 },
    { name: 'Sam', testid: 249, eid: 64, socialid: 80 },
    { name: 'Albert', eid: 422, testid: 20, socialid: 10 },
    { name: 'Michel', eid: 497, testid: 15, socialid: 60 },
];

console.log(
    myfile.reduce(
        (result, item) =>
            Object.entries(item).reduce((result, [key, value]) => {
                result[key] = result[key] || [];
                result[key].push(value);
                return result;
            }, result),
        {},
    ),
);

A: You can use array#reduce to accumulate value corresponding to each key in an object.

let myfile = [{"name":"John","eid":664,"socialid":399,"testid":799}, {"name":"Sam","testid":249,"eid":64,"socialid":80}, {"name":"Albert","eid":422,"testid":20,"socialid":10}, {"name":"Michel","eid":497,"testid":15,"socialid":60}],
    result = myfile.reduce((r,o) => {
      Object.entries(o).forEach(([key,value]) => {
        r[key] = r[key] || [];
        r[key].push(value);
      });
      return r;
    },{});
console.log(result);

A: You main problem is, you try to access publication which does not exist in the inner objects.
For an inline renaming, you could take an object with the given name as key and the new name as value and take the actual key as default value. Then create a new array, if not exists and push the value to it.
Finally, you get an object with wanted keys with all value from the given data.

var myfile = [{ "name": "John", "eid": 664, "socialid": 399, "testid": 799 }, { "name": "Sam", "testid": 249, "eid": 64, "socialid": 80 }, { "name": "Albert", "eid": 422, "testid": 20, "socialid": 10 }, { "name": "Michel", "eid": 497, "testid": 15, "socialid": 60 }],
    replace = { name: 'publication' },
    result = myfile.reduce((r, o) => Object.entries(o).reduce((p, [k, v]) => {
        k = replace[k] || k;
        (p[k] = p[k] || []).push(v);
        return p;
    }, r), Object.create(null));

console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }

A: Like this?

let json=[
    {"name":"John","eid":664,"socialid":399,"testid":799},
    {"name":"Sam","testid":249,"eid":64,"socialid":80},
    {"name":"Albert","eid":422,"testid":20,"socialid":10},
    {"name":"Michel","eid":497,"testid":15,"socialid":60}
]
let output={
  publication:[],
  eid:[],
  testid:[],
  socialid:[]
}
for(let i in json){
    output.publication.push(json[i].name)
    output.eid.push(json[i].eid)
    output.testid.push(json[i].testid)
    output.socialid.push(json[i].socialid)
}
console.log(output)

I hope that this will help you!