text:
Q: How to store sensitive user data for webservers Is there any way to store sensitive user data in database such that even if the server and db are compromised the attacker cannot read the original data? You can obviously encrypt the data but then the keys have to be accessible by the server for decryption, and would be compromised along with the server.
EDIT: i'll be using vps hosting such as linode. Assume attacker can gain root access to the server (which also has the database and source code) for an hour.

A: Get Keys from an Admin User
Only store the keys in memory in the server. The memory only copies are used to decrypt data as it is needed. When the server starts up it has to get the key information from the administrator. There are variations on this, of course. The administrator could plug in a USB drive for just that moment. The admin could provide a password providing momentary access to another machine where the keys are in a database or whatever. The admin could type in the password for the keystore file which would be on the server in response to a prompt on the console. The web site wouldn't work until the admin logs in and chooses the "Enter keys" option.
This makes it so the attacker has to find the keys in memory before they can decrypt the data.
Keys on a 2nd Machine
There is a 2nd method used that is less secure than relying on the admin but still somewhat safer. Put the keys on a 2nd machine somewhere on the network. Make sure it doesn't have the same user accounts as the server. When the server starts up, it has to connect to the other machine somehow and get the keys, storing them only in memory. You could, again, rely on the admin to provide the password to an account on the other machine or, in Linux, use SCP with a stored key. It is important to make the communications secure so the attacker can't just see the keys as they cross the network.
In this case the attacker has to compromise two machines to get the data from one and the keys from another. So it is safer than having keys on the same machine.
Other Points
You can find all this and more on the web. Google is your friend.
But remember some obvious security precautions to make it harder for the bad guys:

*

*Physically secure the system. Don't let the bad guys get their hands on the keyboard.

*Use an OS with good security features and make use of those features.

*Disable the root password and require all users to log in via their identifiable account and then do something to gain root privileges if needed. (Then keep a log of all logins and access to root so you can tell who did what.)

*Monitor what is going on on the machine. This may mean video surveillance or just checking out the logs.

*Keep backup "tapes" secure. They contain the same secrets as the disk drives.

*Don't leave memory dumps lying around where they could give up their secrets.

*Consider the people who do have access. Are they reliable? Can they be bribed? Can you check on their actions? Are they low paid or disgruntled?

A: You could try using a key fob / USB to hold the relevant encryption data but typically if physical security is compromised, all bets are off.


text:
Q: Jasmine tests check if html contains text and return boolean expect(view.$el.html()).toContain('Admin');

The view does contain the word 'Admin' so I was expecting it to return true. How can I achieve this?
expect(view.$el.html()).toContain('Admin');

This returns undefined. How can I make it return true?

  Help

Admin

This is what is returned from view.$el.html
Please help.

A: toContain() now can actually be used for substring in string checks:
expect(view.$el.html()).toContain('Admin');

A: From the Jasmine docs:

The 'toContain' matcher is for finding an item in an Array

You are trying to find a string inside a string so I would do something like this:
expect(view.$el.html().indexOf('Admin') !== -1).toBe(true);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can I group twice a Stacked bar with Chart.js? Can I group this chart in 4 seasons (Season 1, Season 2, Season 3, Season 4) and still show above each month on the chart (January, February, [...])
Starting example: https://fiddle.jshell.net/9xrb0vhe/2855/
Season 1: January,February,March
Season 2: April,May,June
Season 3: July,August,September
Season 4: October,November,December
Like for example: https://i.stack.imgur.com/4ym8u.png


text:
Q: Oracle get sql redo from log_history I run into a problem with a customer which had no proper backup.
His last backup (meaning exp-dump) is from 1st Aug 2011.
However he lost due to batch DELETE statements all data.
My plan was now to get the redo-sql from the logs, import the dump and replay all sql from 1st Aug up to 2nd Sept (just before the batch DELETE happened).
However I am stuck because V$LOG_HISTORY shows me logs back to February 2011 but no V$ARCHIVED_LOG entries to know which logs to include into LogMiner.
So: How can i load this V$LOG_HISTORY logs into the LogMiner to get the redo-sql or how else can I get the redo-sql or replay it based on the dump-file fromn 1st Aug?
Side notes: This is a single alone (like an orphant) oracle 9.2 installation on a linux server.

A: First of all export is not backup. You will not recover a physical copy of a database from exp-dump, only an unconsistent copy of its data (you can make them consistent but the option is rarely used). I'm really not sure you can apply the contents of logMiner on such a copy.
Your best bet would be to apply undo statements to your current copy of the DB to return it to its original state, such as described in the documentation:

If you fully understand and take into account existing dependencies, it may be possible to perform a table-specific undo operation to return the table to its original state. This is achieved by applying table-specific reconstructed SQL statements that LogMiner provides in the reverse order from which they were originally issued. See Scenario 1: Using LogMiner to Track Changes Made by a Specific User for an example.

Unfortunately it would seem that your customer is running its DB in NOARCHIVELOG mode since the view V$ARCHIVED_LOG is empty. V$LOG_HISTORY only records the switchs of the online redo logs which all DBs have. Only databases that are setup in ARCHIVELOG mode will archive redo logs.
I'm afraid your customer is out of luck.
At this point you should probably consider contacting Oracle support.

A: v$log_history may show the log switches for a long time ago, but as you said, the DB is not in archivelog mode, so this information is not helpful here.
With 9i, you cannot do flashback database (apart from that it requires archivelog mode also) - there is a slight chance that you can do flashback query far enough into the past, because it is using undo information.
Try select * from tab as of timestamp systimestamp - interval 'n' day and increase n as much as you can. Good luck!

A:
But there are only around 165MB of data and the UNDO tablespaces uses
  currently 1.2GB - there is no chance any information is in that?

Have you considered flashback instead of LogMiner?

Data in the undo tablespace can be overwritten as soon as its
  transaction has commited.

Not true, it depends on undo_retention

It is unlikely you would have the delete data available.

Worth a try though


text:
Q: Getting null in ViewModel from DependencyProperty after SetValue I have this extended ListBox with a SelectedItems property to be able to get the selected items from when SelectionMode is set to Extended.
public class BindableMultiSelectListBox : ListBox
{
    public static new readonly DependencyProperty SelectedItemsProperty =
        DependencyProperty.Register("SelectedItems", typeof(IList), typeof(BindableMultiSelectListBox),
            new PropertyMetadata(default(IList)));

    public new IList SelectedItems
    {
        get => (IList)GetValue(SelectedItemsProperty);
        set => throw new Exception("This property is read-only. To bind to it you must use 'Mode=OneWayToSource'.");
    }

    protected override void OnSelectionChanged(SelectionChangedEventArgs e)
    {
        base.OnSelectionChanged(e);
        SetValue(SelectedItemsProperty, base.SelectedItems);
    }
}

I use this in a view like this:
<usercontrols:BindableMultiSelectListBox SelectedItems="{Binding SelectedDogs, Mode=OneWayToSource}" ItemsSource="{Binding Dogs}" SelectionMode="Extended"/>

and bind to an ObservableCollection in my viewModel:
private ObservableCollection<string> _selectedDogs;

public ObservableCollection<string> SelectedDogs
{
    get
    {
        return _selectedDogs;
    }
    set
    {
        _selectedDogs = value;
        OnPropertyChanged(nameof(SelectedDogs));
    }
}

When I debug the OnSelectionChanged base.SelectedItems have the selected values as expected, but when the SelectedDogs setter is hit the value is null!
What have I done wrong here?

A: The target property is supposed to bind to the source property.
Initialize the source collection in the view model:
public ObservableCollection<string> SelectedDogs { get; } = new ObservableCollection<string>();

...and implement the synchronization in the control:
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
    base.OnSelectionChanged(e);
    if (SelectedItems != null)
    {
        foreach (var removed in e.RemovedItems)
            SelectedItems.Remove(removed);
        foreach (var added in e.AddedItems)
            SelectedItems.Add(added);
    }
}

XAML:
... SelectedItems="{Binding SelectedDogs}"

If you want to set the source property, you should initialize the collection in the control.

A: Changing the SelectedDogs property in the viewModel from ObservableCollection<string> to just IList fixed the problem.
It seems to make little difference in practice, but what if I want to be able to specify ObservableCollection in my viewModel? Why doesn't ObservableCollection work? It does inherit from Collection which implements IList.


text:
Q: How can I fix a "*.sty not found" error in Lyx, when it works in pdflatex? I've just installed a gantt chart package, which I'm trying to use it in LyX.
I attempted to use the first minimal example, but this failed in LyX with LaTeX Error: File 'forloop.sty' not found. However, compiling the pdf from raw LaTeX works fine. I attempted both creating the example file from scratch, and exporting the LaTeX (plain) from LyX, and attempting a manual pdflatex example.tex. This worked in both cases.
Back in LyX, I tried following the instructions on the wiki. Specifically,
$ kpsewhich forloop.sty
./forloop.sty
$ sudo texhash
texhash: Updating /etc/texmf/ls-R...
texhash: Updating /usr/share/texmf/ls-R...
texhash: Updating /usr/share/texmf-dist/ls-R...
texhash: Updating /var/lib/texmf/ls-R...
texhash: Done.

Then in LyX, Tools→Reconfigure and restart. It still failed with the same error. How can I fix this problem in LyX?
I'm using LyX 2.1.1 and on Arch Linux. pdflatex details are below.
$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014/Arch Linux)
kpathsea version 6.2.0
...
Compiled with libpng 1.6.13; using libpng 1.6.13
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with poppler version 0.26.5

Details of the LyX file
I created a new LyX file, and put the following into the header.
\usepackage{tikz}
\usepackage{gantt}

I then created ERT and copy pasted from the first minimal example here, from \begin{gantt}{10}{12} to \end{gantt}.

A: My best guess is that you did not install the forloop.sty file correctly, but just save it to the folder, where you have your project. If this is the case, it will work with pdflatex, as pdflatex will install search you current directory for .sty files, but LyX will not. To install a package you have to choices. You can use the texlive install utitlity, if the package is aviliable in the texlive mirror.
tlmgr install <package1> <package2>

If not you need to create a new texmf folder (typically in ~/texmf/) and then make a subfolder in ~/texmf/tex/latex/forloop/ and save your forloop.sty file to there. Then run
texhash ~/texmf

For TeX to recognize your package


text:
Q: Decimal precision and scale This expression uses implicit conversion:
SELECT 9.999 * '9.999'

and evaluates 99.980001.
If I log the type information using this:
SELECT
    SQL_VARIANT_PROPERTY(9.999 * '9.999', 'BaseType'),
    SQL_VARIANT_PROPERTY(9.999 * '9.999', 'Precision'),
    SQL_VARIANT_PROPERTY(9.999 * '9.999', 'Scale'),
    SQL_VARIANT_PROPERTY(9.999 * '9.999', 'MaxLength')

I get:

*

*BaseType numeric

*Precision 9

*Scale 6

*MaxLength 5
I believe I understand all the results except the precision.
If number of the digits left to the decimal point is 2 and right is 6, this totals 8.
Why does SQL Server calculate 9 here?
P.S. I use SQL Server 2008 R2

A: From Precision, Scale, and Length (Transact-SQL)
Looking at the section
Operation:
e1 * e2

you will find
Result precision
p1 + p2 + 1

So in your case 4+4+1 => 9
Further to that, you will notice that
SELECT  SQL_VARIANT_PROPERTY(99.999 * '9.999', 'Precision'), --11 => p1+p1+1
        SQL_VARIANT_PROPERTY(99.999 * '99.999', 'Precision'), --11 => p1+p1+1
        SQL_VARIANT_PROPERTY(99.999 * 9.999, 'Precision'), --10 => p1+p2+1
        SQL_VARIANT_PROPERTY(99.999 * 99.999, 'Precision') -- 11 => p1+p2+1

whereas
SELECT  SQL_VARIANT_PROPERTY(9.999 * '9.999', 'Precision') --9 => p1+p1+1

and
SELECT  SQL_VARIANT_PROPERTY(9.99 * '9.999', 'Precision')

cuases
Arithmetic overflow error converting varchar to data type numeric.


text:
Q: Filter rows in df based on number of string occurances I'd like to filter rows in a df based on the condition that the row contains mentions of 2+ strings in a long list of strings. I'm having trouble specifying the number of occurrences. Here is my code so far:
brands = ["a", "b", "c"]
df[df.Column.str.contains('|'.join(brands), re.IGNORECASE, regex=True, na=False)]

A: Maybe using count instead of contains:
df = pd.DataFrame({'Column':['ab','ABx','axy']})

df[df.Column.str.count('|'.join(brands), re.IGNORECASE, na=False)>=2]

Output:
  Column
0     ab
1    ABx

A: Here's an example of the check. Is this what you are trying to do?
import pandas as pd
df = pd.DataFrame({'Test':['a','b','cat','dog']})
print (df)
df['check']= df['Test'].isin(['a','b','c'])
print (df)

This will result in:
  Test  check
0    a   True
1    b   True
2  cat  False
3  dog  False


text:
Q: Jenkins: How to resolve resolve plugin errors? I have a server on which Jenkins(2.12) is installed.
There are no plugins are installed(actually I uninstalled every plugin from the plugin manager), though I get the error messages complaining about something related to the plugin dependency.
How can I get rid of this error?

A: Removing the corresponding plugins did the trick.
Plugin location ↓
$JENKINS_HOME/plugins/name_of_plugins


text:
Q: map and hover on a provinces, shows info about that particular province at the bottom of this link:
http://www.offerkhan.com/control4
you can see a section with a map that has lots of provinces. i intend to have a code that by hovering over every province, an information section become visible at the right side of that section. consider that im on wordpress platform and using ENFOLD theme.
tnx.

A: Although you provided a very weak question (for future reference you might want to review this help article), from what I can understand you want to display some information when hovering on something else.
Utilising jQuery very simply you could give each "province" a unique id (such as id="province2"), and then use the following jQuery to change text when you hover on a specific "province":
$('#1').hover(function(){
$('.info').text('Here is a whole lot of interesting information about the first button (Info #1) that you just hovered!');
});

$('#2').hover(function(){
$('.info').text('Here is a whole lot of interesting information about the second button (Info #2) that you just hovered!');
});

Put simply, when you hover on a div, it changes the text in another div.
See a full working example here:
Example
This may not be what you are looking for seeming as your question was so vague, but hopefully it will point you in the right direction.


text:
Q: How can I programmaticatly check if a source is in sources.list? For both 10.04 LTS and 12.04 LTS, is there a way check to see if a source is in /etc/apt/sources.list from a bash script, other than using grep?

A: apt-cache policy shows all available sources. Example output (trimmed):
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main i386 Packages
     release v=12.04,o=LP-PPA-lekensteyn-wacom-tablet,a=precise,n=precise,l=Wacom Tablet Drivers,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main amd64 Packages
     release v=12.04,o=LP-PPA-lekensteyn-wacom-tablet,a=precise,n=precise,l=Wacom Tablet Drivers,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main i386 Packages
     release v=12.04,o=LP-PPA-bumblebee-testing,a=precise,n=precise,l=Bumblebee Developer releases,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main amd64 Packages
     release v=12.04,o=LP-PPA-bumblebee-testing,a=precise,n=precise,l=Bumblebee Developer releases,c=main
     origin ppa.launchpad.net
 500 http://archive.canonical.com/ubuntu/ precise/partner i386 Packages
     release v=12.04,o=Canonical,a=precise,n=precise,l=Partner archive,c=partner
     origin archive.canonical.com
...
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/main Translation-nl
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/main Translation-en
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/multiverse i386 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=multiverse
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/universe i386 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=universe
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/restricted i386 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=restricted
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=main
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/multiverse amd64 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=multiverse
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=universe
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/restricted amd64 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=restricted
     origin nl.archive.ubuntu.com
 500 http://nl.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
     release v=12.04,o=Ubuntu,a=precise,n=precise,l=Ubuntu,c=main
     origin nl.archive.ubuntu.com
Pinned packages

Using awk to retrieve the actual source (URL or file):
$ apt-cache policy | awk '/^ *[0-9]/{print $2 " " $3}'
/var/lib/dpkg/status
http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main
http://ppa.launchpad.net/lekensteyn/wacom-tablet/ubuntu/ precise/main
http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main
http://ppa.launchpad.net/bumblebee/testing/ubuntu/ precise/main
...
http://nl.archive.ubuntu.com/ubuntu/ precise/universe
http://nl.archive.ubuntu.com/ubuntu/ precise/restricted
http://nl.archive.ubuntu.com/ubuntu/ precise/main

A: I wound up using grep to check the sources.list and also checking in sources.list.dfor the presence of a foo.list.
While not as clean of a solution as I had hoped for, it does the job well enough for what I needed.


text:
Q: how to manage 100's of else if statement in javascript? better way? I am learning javascript. I am trying to answer my quiz - classify urls. How can I improve my answer for classifying 100 urls.. my answer is not so efficient.. any help? thanks.
var pageURL = document.location.href;
var isHealth = pageURL.indexOf("http://www.domain.com/health/");
var isCar = pageURL.indexOf("http://www.domain.com/car/");
var isFuel = pageURL.indexOf("http://www.domain.com/fuel/");
var isRoadside = pageURL.indexOf("http://www.domain.com/roadside/");

if (isHealth > -1) {
return 'health';
} else if (isCar > -1) {
return 'car';
} else if (isRoadside > -1) {
return 'roadside';
} else if (isFuel > -1) {
return 'fuel';
} else return 'other';

A: You can use map object and for loop to check what url matches current page:
var urls = {
    health: "http://www.domain.com/health/",
    car: "http://www.domain.com/car/",
    roadside: "http://www.domain.com/fuel/",
    fuel: "http://www.domain.com/roadside/"
};

var pageURL = document.location.href;

for (var key in urls) {
    if (pageUrl.indexOf(urls[key]) > -1) {
        return key;
    }
}
return "other";

A: You can map them together like this, but I'm not sure if it's worth it:
var map = {
    'health': isHealth,
    'car': isCar,
    'roadside': isRoadside,
    'fuel': isFuel
}

for (var i in map) {
    if (map[i] > -1) {
        return i;
    }
}
return 'other';

That's the general approach.

Better idea
But, your specific problem is easily solvable using regex:
var match = pageURL.match(/http:\/\/www.domain.com\/(.+)\//);
return (match && match[1]) || 'other';

See this live example:

function test(pageURL) {
  var match = pageURL.match(/http:\/\/www.domain.com\/(.+)\//);
  return (match && match[1]) || 'other';
}

alert(test('http://www.domain.com/health/'));   // health
alert(test('http://www.domain.com/whatever/')); // whatever
alert(test('http://www.domain.com/'));          // other

A: why not ?
    var pages = ['health', 'car', 'fuel']
    var page = pageURL.split('//')[1].split('/')[1] || -1;
    var index = pages.indexOf(page)

if (index !=-1)
    return pages[index]
else
  return 'other'

A: "JavaScript Trie Performance Analysis" discusses how to use Tries in JavaScript to do compact, efficient prefix lookup.
It looks like most of your checks can be boiled down to "does the string s start with a URL prefix."  This kind of longest prefix check is exactly what Tries were designed to do.
If the bodies of your if ... else if ... else are not formulaic, you could store functions encapsulating those bodies as the value of the trie.


text:
Q: Check if checked multiple checkboxes I have one input where if his value is higher than 32 I display a button where on click display a modal with 3 tables where on each row checkboxes, and I want to validate if is not checked do block user to click on save button, here is my code:

$(document).ready(function() {
  var vals = $('.valtotal').val();
  if (vals > 32) {
    $('.post-abs').show();

  } else {
    $('.post-abs').hide();

  }

})

function toggle1(source) {
  checkboxes = document.getElementsByName('caiet_tabel1[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle2(source) {
  checkboxes = document.getElementsByName('caiet_tabel2[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle3(source) {
  checkboxes = document.getElementsByName('caiet_tabel3[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle4(source) {
  checkboxes = document.getElementsByName('caiet_tabel4[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle5(source) {
  checkboxes = document.getElementsByName('caiet_tabel5[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle6(source) {
  checkboxes = document.getElementsByName('caiet_tabel6[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle7(source) {
  checkboxes = document.getElementsByName('caiet_tabel7[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle8(source) {
  checkboxes = document.getElementsByName('caiet_tabel8[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle11(source) {
  checkboxes = document.getElementsByName('caiet_tabel11[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle22(source) {
  checkboxes = document.getElementsByName('caiet_tabel22[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle33(source) {
  checkboxes = document.getElementsByName('caiet_tabel33[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle44(source) {
  checkboxes = document.getElementsByName('caiet_tabel44[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle55(source) {
  checkboxes = document.getElementsByName('caiet_tabel55[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle66(source) {
  checkboxes = document.getElementsByName('caiet_tabel66[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle77(source) {
  checkboxes = document.getElementsByName('caiet_tabel77[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle88(source) {
  checkboxes = document.getElementsByName('caiet_tabel88[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle111(source) {
  checkboxes = document.getElementsByName('caiet_tabel111[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle222(source) {
  checkboxes = document.getElementsByName('caiet_tabel222[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle333(source) {
  checkboxes = document.getElementsByName('caiet_tabel333[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle444(source) {
  checkboxes = document.getElementsByName('caiet_tabel444[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle555(source) {
  checkboxes = document.getElementsByName('caiet_tabel555[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle666(source) {
  checkboxes = document.getElementsByName('caiet_tabel666[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle777(source) {
  checkboxes = document.getElementsByName('caiet_tabel777[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

function toggle888(source) {
  checkboxes = document.getElementsByName('caiet_tabel888[]');
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    checkboxes[i].checked = source.checked;
  }
}

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />

<input type="text" value="34" class="valtotal">

<button type="button" data-toggle="modal" data-target="#myModal" class="post-abs btn btn-primary float-left"> Multiple</button>

<button class="btn-save">Save button</button>

        <form class="">

            <button type="button" class="close" data-dismiss="modal">×</button>

Multiple caiete de tipar

                      Nr pag Caietul 1

                    <input type="text" class="form-control">

                        #
                        Toate
                        C
                        M
                        Y
                        K

                        T1F1
                        <input type="checkbox" onClick="toggle1(this)">
                        <input type="checkbox" name="caiet_tabel1[]">
                        <input type="checkbox" name="caiet_tabel1[]">
                        <input type="checkbox" name="caiet_tabel1[]">
                        <input type="checkbox" name="caiet_tabel1[]">

                        T1F2
                        <input type="checkbox" onClick="toggle2(this)">
                        <input type="checkbox" name="caiet_tabel2[]">
                        <input type="checkbox" name="caiet_tabel2[]">
                        <input type="checkbox" name="caiet_tabel2[]">
                        <input type="checkbox" name="caiet_tabel2[]">

                        T2F1
                        <input type="checkbox" onClick="toggle3(this)">
                        <input type="checkbox" name="caiet_tabel3[]">
                        <input type="checkbox" name="caiet_tabel3[]">
                        <input type="checkbox" name="caiet_tabel3[]">
                        <input type="checkbox" name="caiet_tabel3[]">

                        T2F2
                        <input type="checkbox" onClick="toggle4(this)">
                        <input type="checkbox" name="caiet_tabel4[]">
                        <input type="checkbox" name="caiet_tabel4[]">
                        <input type="checkbox" name="caiet_tabel4[]">
                        <input type="checkbox" name="caiet_tabel4[]">

                        T3F1
                        <input type="checkbox" onClick="toggle5(this)">
                        <input type="checkbox" name="caiet_tabel5[]">
                        <input type="checkbox" name="caiet_tabel5[]">
                        <input type="checkbox" name="caiet_tabel5[]">
                        <input type="checkbox" name="caiet_tabel5[]">

                        T3F2
                        <input type="checkbox" onClick="toggle6(this)">
                        <input type="checkbox" name="caiet_tabel6[]">
                        <input type="checkbox" name="caiet_tabel6[]">
                        <input type="checkbox" name="caiet_tabel6[]">
                        <input type="checkbox" name="caiet_tabel6[]">

                        T4F1
                        <input type="checkbox" onClick="toggle7(this)">
                        <input type="checkbox" name="caiet_tabel7[]">
                        <input type="checkbox" name="caiet_tabel7[]">
                        <input type="checkbox" name="caiet_tabel7[]">
                        <input type="checkbox" name="caiet_tabel7[]">

                        T4F2
                        <input type="checkbox" onClick="toggle8(this)">
                        <input type="checkbox" name="caiet_tabel8[]">
                        <input type="checkbox" name="caiet_tabel8[]">
                        <input type="checkbox" name="caiet_tabel8[]">
                        <input type="checkbox" name="caiet_tabel8[]">

                      Nr pag Caietul 2

                    <input type="text" class="form-control">

                        #
                        Toate
                        C
                        M
                        Y
                        K

                        T1F1
                        <input type="checkbox" onClick="toggle11(this)">
                        <input type="checkbox" name="caiet_tabel11[]">
                        <input type="checkbox" name="caiet_tabel11[]">
                        <input type="checkbox" name="caiet_tabel11[]">
                        <input type="checkbox" name="caiet_tabel11[]">

                        T1F2
                        <input type="checkbox" onClick="toggle22(this)">
                        <input type="checkbox" name="caiet_tabel22[]">
                        <input type="checkbox" name="caiet_tabel22[]">
                        <input type="checkbox" name="caiet_tabel22[]">
                        <input type="checkbox" name="caiet_tabel22[]">

                        T2F1
                        <input type="checkbox" onClick="toggle33(this)">
                        <input type="checkbox" name="caiet_tabel33[]">
                        <input type="checkbox" name="caiet_tabel33[]">
                        <input type="checkbox" name="caiet_tabel33[]">
                        <input type="checkbox" name="caiet_tabel33[]">

                        T2F2
                        <input type="checkbox" onClick="toggle44(this)">
                        <input type="checkbox" name="caiet_tabel44[]">
                        <input type="checkbox" name="caiet_tabel44[]">
                        <input type="checkbox" name="caiet_tabel44[]">
                        <input type="checkbox" name="caiet_tabel44[]">

                        T3F1
                        <input type="checkbox" onClick="toggle55(this)">
                        <input type="checkbox" name="caiet_tabel55[]">
                        <input type="checkbox" name="caiet_tabel55[]">
                        <input type="checkbox" name="caiet_tabel55[]">
                        <input type="checkbox" name="caiet_tabel55[]">

                        T3F2
                        <input type="checkbox" onClick="toggle66(this)">
                        <input type="checkbox" name="caiet_tabel66[]">
                        <input type="checkbox" name="caiet_tabel66[]">
                        <input type="checkbox" name="caiet_tabel66[]">
                        <input type="checkbox" name="caiet_tabel66[]">

                        T4F1
                        <input type="checkbox" onClick="toggle77(this)">
                        <input type="checkbox" name="caiet_tabel77[]">
                        <input type="checkbox" name="caiet_tabel77[]">
                        <input type="checkbox" name="caiet_tabel77[]">
                        <input type="checkbox" name="caiet_tabel77[]">

                        T4F2
                        <input type="checkbox" onClick="toggle88(this)">
                        <input type="checkbox" name="caiet_tabel88[]">
                        <input type="checkbox" name="caiet_tabel88[]">
                        <input type="checkbox" name="caiet_tabel88[]">
                        <input type="checkbox" name="caiet_tabel88[]">

                      Nr pag Caietul 2

                    <input type="text" class="form-control">

                        #
                        Toate
                        C
                        M
                        Y
                        K

                        T1F1
                        <input type="checkbox" onClick="toggle111(this)">
                        <input type="checkbox" name="caiet_tabel111[]">
                        <input type="checkbox" name="caiet_tabel111[]">
                        <input type="checkbox" name="caiet_tabel111[]">
                        <input type="checkbox" name="caiet_tabel111[]">

                        T1F2
                        <input type="checkbox" onClick="toggle222(this)">
                        <input type="checkbox" name="caiet_tabel222[]">
                        <input type="checkbox" name="caiet_tabel222[]">
                        <input type="checkbox" name="caiet_tabel222[]">
                        <input type="checkbox" name="caiet_tabel222[]">

                        T2F1
                        <input type="checkbox" onClick="toggle333(this)">
                        <input type="checkbox" name="caiet_tabel333[]">
                        <input type="checkbox" name="caiet_tabel333[]">
                        <input type="checkbox" name="caiet_tabel333[]">
                        <input type="checkbox" name="caiet_tabel333[]">

                        T2F2
                        <input type="checkbox" onClick="toggle444(this)">
                        <input type="checkbox" name="caiet_tabel444[]">
                        <input type="checkbox" name="caiet_tabel444[]">
                        <input type="checkbox" name="caiet_tabel444[]">
                        <input type="checkbox" name="caiet_tabel444[]">

                        T3F1
                        <input type="checkbox" onClick="toggle555(this)">
                        <input type="checkbox" name="caiet_tabel555[]">
                        <input type="checkbox" name="caiet_tabel555[]">
                        <input type="checkbox" name="caiet_tabel555[]">
                        <input type="checkbox" name="caiet_tabel555[]">

                        T3F2
                        <input type="checkbox" onClick="toggle666(this)">
                        <input type="checkbox" name="caiet_tabel666[]">
                        <input type="checkbox" name="caiet_tabel666[]">
                        <input type="checkbox" name="caiet_tabel666[]">
                        <input type="checkbox" name="caiet_tabel666[]">

                        T4F1
                        <input type="checkbox" onClick="toggle777(this)">
                        <input type="checkbox" name="caiet_tabel777[]">
                        <input type="checkbox" name="caiet_tabel777[]">
                        <input type="checkbox" name="caiet_tabel777[]">
                        <input type="checkbox" name="caiet_tabel777[]">

                        T4F2
                        <input type="checkbox" onClick="toggle888(this)">
                        <input type="checkbox" name="caiet_tabel888[]">
                        <input type="checkbox" name="caiet_tabel888[]">
                        <input type="checkbox" name="caiet_tabel888[]">
                        <input type="checkbox" name="caiet_tabel888[]">

                <button type="button" class="btn btn-default" data-dismiss="modal">Inchide</button>

                <button type="button" value="insert" class="btn btn-success float-right">Salveaza</button>

        </form>

So what i need is if value is greater than 32 display button for modal and validation for each checkbox but not for the checkbox who if is checked check all checkboxes from his line.

A: As has been indicated in the comments, it is quite difficult to grasp exactly what your validation entails. What I understand is that once the value in the input with class valtotal is greater than 32, a button needs to appear which initializes a modal. You can achieve that with something like this using jquery:
$(".valtotal").on("keyup", function(){
   if($(".valtotal").val() >32  ){
      $('.post-abs').show();
   } else {
      $('.post-abs').hide();
   }
});

Similarly, to check whether a particular checkbox has been checked you can do something similar:
$('#theCheckBoxId').change(function(){
   if($('#theCheckBoxId').is(':checked')) {
     //Disable the save button
     $("#saveButtonId").prop("disabled", false);
   } else {
     $("#saveButtonId").prop("disabled", true);
   }
});

If you need a better explanation, try and be more specific regarding your validation


text:
Q: Cutting HTML in bash I am currently trying to cut a HTML file to a certain phrase, or between two phrases.

unneeded text and top of webpage

text1

text2:
admin (you)
    password: password1
adminline2
    password: password2
adminline3
    password: password3
adminline4
    password: password4

Authorized Users:
userline
userline2
userline3

text3</span

more unneeded text and bottem of the web page

Using the Bash Terminal, I am trying to cut out the top and the bottom of the html of this webpage, to get:

text1

text2:
    admin (you)
        password: password1
    adminline2
        password: password2
    adminline3
        password: password3
    adminline4
        password: password4

    Authorized Users:
    userline
    userline2
    userline3

text3</span

I tried using cut, but you can only have a one character delim. I also tried using awk to cut down the top like this:
STARTHTML='
text1

text2:'
awk 'BEGIN {FS="$STARTHTML";}{print $2}' ~/Desktop/input.txt

But the output ends up being a bunch of blank lines.
How can I cut down this .txt or .html file of a webpage, down to these specific lines using just bash.

A: As per your desired output,Can you check if this works:
sed -n '/
/,/<\/pre>/p' file_name

Explanation:
As you need the lines between the patterns starting with
--start pattern and
 --End pattern, i included those inside  the sed syntax
sed -n '/start_pattern_here/,/end_pattern_here/p' file_name

-n     : Suppress automatic printing of pattern space
p      : Print the current pattern space


text:
Q: Theory related to choosing high-information representative samples of a distribution Let $X$ be a random variable of human height and suppose that $X$ is normally distributed.
If our goal is to select 'representatives' of the concept 'height', a reasonable way to choose representative samples for $X$ is to choose those having values far from the mean. (Since $X$ is normally distributed, samples having values near mean would be not meaningful.. (less information)).
However, if $X$ is not bell shaped, so that it looks like a beta distribution B(0.5,0.5)  (which is not bell-shaped), samples having values far from the mean must not be representatives for the concept 'height'.
Is there any theory related to this? (choosing representatives)


text:
Q: Excel VBA crashing when referencing a PowerPoint slide index number A couple of years ago I posted a question about an issue I was having with Excel and Powerpoint VBA on Mac OS X. I never managed to solve the problem, and instead worked around it by installing bootcamp and running it on Windows 10. However, I now have exactly the same problem again, I'd rather not use Windows, and the issue doesn't seem to have resolved itself through updates (I'm now using 365, having started with Office 2016) so I'm back here asking for help.
I have some VBA code that starts a Powerpoint session from Excel and manipulates PowerPoint using content from the Excel workbook. The problem comes whenever I try to reference a specific slide. No matter how I do it, Excel crashes. The crash always occurs at the point of making the reference to the slide index. Here's some simplified code that will trigger the crash:
Sub test()
Dim myApp As PowerPoint.Application
Dim myPres As PowerPoint.Presentation
Dim mySlide As PowerPoint.Slide

Set myApp = CreateObject("PowerPoint.Application")
Set myPres = myApp.Presentations.Add
Set mySlide = myPres.Slides.Add(Index:=1, Layout:=ppLayoutTitleOnly)
Set mySlide = myPres.Slides.Add(Index:=2, Layout:=ppLayoutTitleOnly)

Set mySlide = myPres.Slides(1)

End Sub

That last  line before the end sub will cause the crash. This doesn't happen running on Windows. What on earth is going on?
It's incredibly frustrating. I've wasted tons of time trying to fix this, or work around it. I've seen one or two people asking similar questions elsewhere, but never seen a solution to it.
Grateful for any assistance
Thanks


text:
Q: Didnt return a response - Duplicate django users I have a django project. I have integrated djangos signup and login system into my application. I have a method for creating a user and logging them into the current session. I notices that when I try to create a record for a users with an existing username in the database, instead of giving a unique constraint fail or redirecting to another page, it just throws the following error:
ValueError at /signup/
The view users.views.user_signup didn't return an HttpResponse object. It returned None instead.
Request Method: POST
Request URL:    http://127.0.0.1:8000/signup/
Django Version: 1.11.5
Exception Type: ValueError
Exception Value:
The view users.views.user_signup didn't return an HttpResponse object. It returned None instead.
Exception Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py in _get_response, line 198
Python Executable:  /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Python Version: 3.6.2
Python Path:
['/Users/omarjandali/Desktop/split/split',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
 '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']

Now I am using printing and logging to see where this issue is occuring and there is nothing printing. I feel like the form is not going to the method it was called from... I have no idea what is going on with this. Can anyone help...
process =
if form not submitted -> display from
fill out for -> grab info from form -> grab useranem and see if there is already a account with this username or email -> if no account -> create and save user object -> login the user to session ===> if account -> redirect to the test page... Here is my code:
def user_signup(request):
    if request.method == "POST":
        form = SignupForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            username = cd['username']
            password = cd['password']
            verify = cd['verify']
            email = cd['email']
            valid_user = User.objects.filter(username = username).first()
            if valid_user == None:
                if password == verify:
                    secure_password = make_password(password)
                    user = User.objects.create(
                        username = username,
                        password = secure_password,
                        email = email,
                    )
                    login(request, user)
                    return redirect('test')
                else:
                    form = SignupForm()
                    parameters = {
                        'form':form,
                    }
                    return render(request, 'users/signup.html', parameters)
            else:
                return redirect('test')
    else:
        form = SignupForm()
        parameters = {
            'form':form
        }
        return render(request, 'users/signup.html', parameters)

the form shows up and I can fill it out but the second i submit the form, everything goes wrong.... The form exists in my forms.py file. I have no idea why it is telling me there is no http response when there is.

I have a retruned validation error within the form and I want to grab the message from the error response.
the response is a json repsonse below:
{"username":
  [
    {
     "message": "A user with that username already exists.",
     "code": "unique"
     }
   ]
}

I want to grab just the message. I have the following code to grab the message... it is not working...
error_json['username'][0]['message']

the error message:
string indices must be integers

A: You haven't processed case when form.is_valid() returns False. In such case your view returns None.


text:
Q: Delphi XE7 code navigation problems Just started to use Delphi XE7 and experiencing a terrible code navigation lags on all my big Delphi projects (when clicking some identifier with Ctrl pressed). When I click some identifier, I can see a lots of messages appearing in the IDE console, seems like it parsing all my units again and again without caching anything.
I switched off Tooltip symbol insight, Tooltip help insight, Error insight and Code templates, however it doesn't help.
Delphi 2010 works without a problem on my machine with the same projects.
Maybe you know some secret command line option to make code navigation fast again?

A: The Delphi compilers have indeed grown worse over the years in this aspect. If you jump from D2010 I can imagine it feels horrible.
This is especially bad when you have just switched to a new project.
One thing that helps is building your project so that all cache info is up to date. You'll notice that it is not so bad once you are in your edit/compile cycles (and after your first Ctrl-Click).

As an additional note, my XE2 from time to time looses its Ctrl-Click functionality, and I have to shut down/restart the IDE.


text:
Q: Sharepoint Blog: enable/disable comments regarding field value of Posts I need to enable/disable post comments regarding the value of a new field in Post list. I don't see how to do this... Any ideas?
Why is there an error when converts to XSLT? Is possible to get the querystring to do this?

A: I don't think you'll be able to get that level of control with the standard blog component. Should be reasonably easy to implement using CKSEBE though.
Easiest method I can think of within the standard blog is to use jQuery to hide the comment form - that way you only need to get the value of the field appearing somewhere on the page.


text:
Q: Adding PDF revocation information as an signed attribute pdfRevocationInfoArchival OID 1.2.840.113583.1.1.8
We have added pdfRevocationInfoArchival OID (1.2.840.113583.1.1.8) as a signed attribute while generating signature. While building this attribute we used external CRL file (ca-crl.crl) and builds the OID 1.2.840.113583.1.1.8 as ASN1 object. After signing pdf and timestamping signature, everything works fine. But we are not able to understand the identifier (adbe-revocationInfoArchival) which added is in the PDF is correct and which can be used to verify this PDF by fetching this OID. Also we are not able to check that this attribute is in proper format in which PDF can verify it. Is there any tool or utility available to check this attribute which is inserted as a signed attribute is valid.

If any PDF tool/utility is available to visualize attribute are available in PDF please share.

We have build the issuers CRL info at position [0] is this correct to way add the CRL in this OID? I have share the code below code snippet

The following object identifier identifies Adobe's revocation information attribute:
adbe-revocationInfoArchival OBJECT IDENTIFIER ::=
        { adbe(1.2.840.113583) acrobat(1) security(1) 8 }

Adobe's Revocation Information attribute value has ASN.1 type RevocationInfoArchival:
    /**
     ** RevocationInfoArchival ::= SEQUENCE {
     **   crl [0] EXPLICIT SEQUENCE of CRLs, OPTIONAL
     **   ocsp [1] EXPLICIT SEQUENCE of OCSP Responses, OPTIONAL
     **   otherRevInfo [2] EXPLICIT SEQUENCE of OtherRevInfo, OPTIONAL
      }
    */

Adobe's Revocation Information attribute value building using in Java Bouncy Castle API:
private ASN1EncodableVector genPdfInfoArchival(ASN1EncodableVector v) {

        ASN1EncodableVector v1 = new ASN1EncodableVector();

        List<X509CRL> crls = new ArrayList<X509CRL>();
        ASN1InputStream t = null;
        try {

            CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
            CRL crl = certFactory.generateCRL(new FileInputStream(new File("e://app//esp//crl//NSDLe-GovCA2019-Test-2.crl")));
            System.out.println("crl:" + crl);
            crls.add((X509CRL)crl);

            if (!crls.isEmpty()) {
                ASN1EncodableVector v11 = new ASN1EncodableVector();
                for (Iterator<X509CRL> i = crls.iterator(); i.hasNext();) {
                    t = new ASN1InputStream(new ByteArrayInputStream(i.next().getEncoded()));
                    v11.add(t.readObject());
                }
                //0 for CRL
                v1.add(new DERTaggedObject(true, 0, new DERSequence(v11)));
            }
}

        return v1;}

After building OID adding it in SignerInforGeneratorBuilder as a signed attribute and generating the signature and then adding this signature in PDF

            CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
            ASN1EncodableVector signedAttr = new ASN1EncodableVector();
            String ID_ADBE_REVOCATION = "1.2.840.113583.1.1.8";

            //TODO add message digest for sgning - nikhilW
            Attribute attr = new Attribute(CMSAttributes.messageDigest,  new DERSet(new DEROctetString(IOUtils.toByteArray(hashdata))));
            signedAttr.add(attr);

            //TODO generate pdf info archival and add it as CMS signed attribute - nikhilW
            ASN1EncodableVector pdfInfo = genPdfInfoArchival(signedAttr);
            Attribute ar = new Attribute(new ASN1ObjectIdentifier(ID_ADBE_REVOCATION),   new DERSet (new DERSequence(pdfInfo)));
            signedAttr.add(ar);

            List<Certificate> certList = new ArrayList<Certificate>();
            certList.addAll(Arrays.asList(certificateChain));
            Store certs = new JcaCertStore(certList);

            DefaultSignedAttributeTableGenerator sa = new DefaultSignedAttributeTableGenerator(new AttributeTable(signedAttr));
            SignerInfoGeneratorBuilder builder = new SignerInfoGeneratorBuilder(new BcDigestCalculatorProvider());

            builder.setSignedAttributeGenerator(sa);

Please find below google drive link contains sample signed pdf file hello_signed_ts_pdfarchivalinfo.pdf
pdf_sample_signed

Any help would be appreciated.

A: I have checked for the attribute added in pdf using below java source code. Also there is iText Java utility which will debug pdf object tree iText RUP or download it from my google drive link Download iTextRUP Java Jar run it with java -jar jar-name may it will help debuging pdf objects.
Pdf Archival Info Retrieval Source Code Returns CRL stream object at position [0]
private void getPdfRevoInfoArch(SignerInformation signerInform) {

        AttributeTable at = signerInform.getSignedAttributes();

        ASN1Encodable arch =    at.get(new ASN1ObjectIdentifier("1.2.840.113583.1.1.8")).getAttrValues().getObjectAt(0);

        //ASN1Encodable arch1 = at.get(new ASN1ObjectIdentifier("1.2.840.113583.1.1.8")).getAttrValues().getObjectAt(1);

        System.out.println("arc:" + arch);
        System.out.println("archSize:" + at.get(new ASN1ObjectIdentifier("1.2.840.113583.1.1.8")).getAttrValues().size());

    }


text:
Q: Нумерация страниц mpdf Застрял с нумерацией страниц в mpdf.
Вот код:
for ($i=0; $i<400; $i++){
  $text = "HELLO PEOPLE #:".$i."
";
  $ht=$ht.$text;
}
$HTML="

    <link href='../css/style_pdf1.css' rel='stylesheet'>

 Џривет! HO HO HO

".$ht."

";
include("../tools/mpdf/mpdf.php");
$mpdf = new mPDF('utf-8','A4', 8, '', 10, 10, 7, 7, 10, 10); //задаем формат, отступы и.т.д.
$mpdf->charset_in = 'windows-1251'; //не забываем про русский
$mpdf->setFooter("Page {PAGENO} of {nb}");
ob_start();
echo $HTML;
$xhtml=ob_get_contents();
ob_end_clean();
$mpdf->WriteHTML($xhtml,0); //формируем pdf
$mpdf->Output();
exit;

Выдает ошибку:

Warning: Illegal string offset 'ID' in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1138

  Warning: Cannot assign an empty string to a string offset in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1138

  Warning: Illegal string offset 'LANG' in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1142

  Warning: Cannot assign an empty string to a string offset in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1142

  Warning: Illegal string offset 'ID' in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1193

  Warning: Illegal string offset 'LANG' in D:\Sites\Portal\tools\mpdf\classes\cssmgr.php on line 1193

Подскажите, как побороть?

A: Вдруг поможет. У себя мы используем нумерацию в Header. Вот такой код
$mpdf->SetHeader(date("d.m.Y") . '|{PAGENO}/{nb}|' . $pdf_header . '');


text:
Q: How to show Play from start/Resume Playing on tvOS AVPlayerViewController Usecase:
Video is watched by user to some time, than user interupts it. Bookmark is saved. Than later on I want to offer user to continue from last watched position.
Is it possible to get that behavior in AVPlayerViewController?
This screen:
https://i.imgsafe.org/b69204ca24.jpg
I have seen this in youtube app and Apple build in TV app.

A: You can save the timing when the video get interrupted, and then use the seek function to start playing from that same time frame:
Seek


text:
Q: bind-address = ::1 # however, netstat shows 0.0.0.0:3306 LISTENING I'm running MySQL 5.6 on 64-bit Windows 7 with IPv6 and IPv4 enabled.
In my.ini:
port=3306
bind-address = ::1

I was hoping to use IPv6 and restrict to the loop-back adapter.  I used ::1 instead of 127.0.0.1 because win7 with IPv6 defaults to ::1 for localhost.
With this configuration netstat reports the following:
C:\>netstat -an |findstr 3306
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
  TCP    [::1]:3306             [::]:0                 LISTENING

It seems like connections may be getting blocked on the IPv4 interface, but seeing netstat report that 0.0.0.0 port 3306 is open makes me uneasy.
The MySQL documentation specifies:

If the address is a "regular" IPv4 or IPv6 address (such as 127.0.0.1
  or ::1), the server accepts TCP/IP connections only for that IPv4 or
  IPv6 address.

TCPView gave me the same info as netstat.  I couldn't get TDIMon working on my system.
How can I prevent mysql from listening on 0.0.0.0?

A: I see two possibilities here:

*

*You actually have two copies of MySQL running, one of which bound to IPv4, and the other which bound to IPv6. This is probably not very likely, but it's something you should check for anyway.

*You've found a bug in the Windows port of MySQL. When I tried this on Linux, bind-address = ::1 caused MySQL to bind only to ::1 and not to any IPv4 addresses. In this case you should report it as a bug to MySQL.

A: I've finally had time to dig into the mysql 5.6 source.  Line 2405 of mysqld.cc seems to hold some answers.
 /*
   For interoperability with older clients, IPv6 socket should
   listen on both IPv6 and IPv4 wildcard addresses.
   Turn off IPV6_V6ONLY option.

   NOTE: this will work starting from Windows Vista only.
   On Windows XP dual stack is not available, so it will not
   listen on the corresponding IPv4-address.
 */
if (a->ai_family == AF_INET6)
{
  arg= 0;

  if (mysql_socket_setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY,/* Line: 2405 */
                              (char *) &arg, sizeof (arg)))
  {
    sql_print_warning("Failed to reset IPV6_V6ONLY flag (error: %d). "
                      "The server will listen to IPv6 addresses only.",
                      (int) socket_errno);
  }
}

Setting this socket option causes the extra line 0.0.0.0:3306 to show up in netstat.  However, I'm still not able to connect by specifying 127.0.0.1 to telnet.
The comments do make it sound like this option should only be used when wildcard is applied, but it seems the option is applied even when bind-address is specified.
Possibly related discussion here: http://serverdown.ttwait.com/que/486038
google cache: http://webcache.googleusercontent.com/search?q=cache:14aq4-3tRLsJ:serverdown.ttwait.com/que/486038+&cd=4&hl=en&ct=clnk&gl=us
EDIT: In the bug report (which is still in triage), I've proposed MySQL only clear IPV6_V6ONLY when binding to the wildcard address *.  This seems to give the most flexibility of configuration in my.ini.  If some admins are binding :: and then connecting to 127.0.0.1 they could be surprised.  Binding * instead of :: would fix it.

A: 0.0.0.0:3306 means that MySQL is listening on all adapters/addresses for IPv4.  I would put the following lines in my.cnf:
bind-address = 127.0.0.1
bind-address = ::1

That should restrict IPv4 access to localhost; it shouldn't matter which version Windows defaults to, you'll still be able to connect to it.  If that doesn't resolve it, then you likely have bind-address set in another file somewhere.
Also, make sure that mysql is actually stopped when you restart it; it could simply be that an older instance is still running and listening on 0.0.0.0.
EDIT
See MySQL Documentation section 4.2.3.3 Using Option Files for other files that the bind-address parameter may be specified in.

A: The solution is in conf file .Try to Remove all -I or --interface options from /etc/default/ntp and insert the following into your /etc/ntp.conf:
interface ignore wildcard
interface listen 127.0.0.1

*

*Without interface ignore wildcard NTP will also listen on 0.0.0.0

*Without interface listen  NTP will only listen on 127.0.0.1 (of course)
If you already have that line:
0.0.0.0:3306

then just comment it to
# 0.0.0.0:3306

** Secondly try change following line in my.ini
 bind-address = ::1

to
 bind-address = 127.0.0.1

EDIT:
if you using windows7 64-bit,
you have to go to that file here:
 C:\WINDOWS\system32\drivers\etc\hosts

Localhost should be the first entry in that file.That hosts file may have ::1 for localhost. To fix it, add (or uncomment) the line:
   127.0.0.1       localhost

and comment that line:
   ::1             localhost

to
   # ::1             localhost

and then you can connect via localhost.


text:
Q: Retrieving Soundex Codes from a Data Column in mysql is it possible to make such a query in SQL: there is a column with names, let's say FirstName, you need to get the soundex code for each name in the column and write these codes into the FirstNamesdx column?

A: Are you trying something like this:
CREATE TABLE test_tbl(
             first_name VARCHAR(50),
             FirstNamesdx VARCHAR(50)
                     );

insert into test_tbl(first_name) values ('Earbuds'),
                                        ('Phone'),
                                        ('Charger'),
                                        ('Data Cable'),
                                        ('Speakers');

Then you can use an update with the same table to get the needed values:
update test_tbl a
inner join
( select first_name, SOUNDEX(first_name) as soundex_first_name
  from test_tbl
) as b
on a.first_name=b.first_name
set a.FirstNamesdx=b.soundex_first_name;

You have an easy way:
update test_tbl
set FirstNamesdx= SOUNDEX(first_name);

Demo: https://www.db-fiddle.com/f/pB6b5xrgPKCivFWcpQHsyE/8
Results:


text:
Q: NUnit cannot recognise a TestCase when it contains an Nullable Array I have test like this:
[Test]
[TestCase(new RequestStatus?[] {RequestStatus.Created, null, RequestStatus.Complete, null})]
public void MyClass_MyMethod( RequestStatus?[] testCaseRequest )
{
  ...
}

Nuint doesn't recognise Nullable Array as TestCase param. I got this:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

A: You may use params as a method argument:
[TestCase(RequestStatus.Created, null, RequestStatus.Complete, null)]
public void MyClass_MyMethod(params RequestStatus?[] requestStatus)
{
    // ...
}


text:
Q: Is there a way to stop Julia using scientific (exponential) notation with BigFloats? OK, I have what seems to be, on the face of it, a simple problem. I want to take the decimal part of an irrational number up to a specified number of digits and treat that as an integer. For example, if my irrational number is 2.657829... and I want five digits, I'm looking for 65782 (though I'm actually dealing with 'Big' numbers).
This is easily achieved using strings, for example if I wanted the decimal part of root 3 to 50 digits:
function main_1(n::Int, m::Int)::BigInt
    setprecision(Int(trunc((m + 3) * log2(10))))
    sr = string(sqrt(big(n)))
    ff = findfirst(sr, '.')
    dp = parse(BigInt, sr[ff + 1:ff + m])
    return dp
end

@time main_1(3, 50)

The output is 73205080756887729352744634150587236694280525381038.
However, I resent using strings when I'm dealing solely with numbers! What I want to be able to do is start with a BigFloat, subtract the integer part, multiply the result by the appropriate factor of 10, round the result to zero, and then convert it to a BigInt. The problem is that Julia uses scientific / exponential notation, so I don't seem to be able to achieve what I want using only numbers. The following (partial) code shows the problem:
function main_2(n::Int, m::Int)::BigFloat
    setprecision(Int(trunc((m + 3) * log2(10))))
    sr = sqrt(big(n))
    tr = trunc(sr)
    dp = (sr - tr) * big(10.0) ^ 50
    return dp
end

@time main_2(3, 50)

The output in this case is 7.32050807568877293527446341505872366942805253810380625e+49 (there's a few extra digits that would have been removed at the rounding stage).
So my question is, is there any way to achieve my objective without resorting to strings?

A: One way to achive this, without using strings, is to convert the result and it's integer part to BigInt before do the subtract (and change the function type from BigFloat to BigInt):
function main_2(n::Int, m::Int)::BigInt
    setprecision(Int(trunc((m + 3) * log2(10))))

    # Calc the sqrt
    result = sqrt(big(n))

    # Convert the whole number to BigInt to the specified precision
    sr = convert(BigInt, trunc(result*big(10)^m))

    # Convert the integer part to BigInt
    tr = convert(BigInt, trunc(result)*big(10)^m)

    dp = sr - tr
    return dp
end

Comparing the above implementation with the main_1 function, there is a little improvement:
julia> @time main_1(3, 50)
  0.000042 seconds (36 allocations: 5.254 KiB)
73205080756887729352744634150587236694280525381038

julia> @time main_2(3, 50)
  0.000028 seconds (51 allocations: 1.617 KiB)
73205080756887729352744634150587236694280525381038

Edit:
Other way (as commented by @Bill) is just trunc the result (to get rid of InexactError()) and change the function type to BigInt:
function main_2(n::Int, m::Int)::BigInt
    setprecision(Int(trunc((m + 3) * log2(10))))
    sr = sqrt(big(n))
    tr = trunc(sr)
    dp = (sr - tr) * big(10.0) ^ 50
    return trunc(dp)
end

After testing:
julia> @time main_2(3,50)
  0.000026 seconds (28 allocations: 1.016 KiB)
73205080756887729352744634150587236694280525381038


text:
Q: JS animation writes over itself instead of replacing I have this code for a digital clock using Raphaël library which prints over itself instead of replacing itself each time, does anyone know how to edit the code so it replaces instead of writes over?
JS file referenced within HTML file:
window .onload= function (){
var paper = new Raphael( 0,0, 400, 400);
var backGround = paper.rect(0,0,400,400);
   backGround.attr({ fill: "none"});
function startTime() {
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m = checkTime(m);
s = checkTime(s);
var dig = h+":"+m+":"+s;
var display = paper.text(200, 200, dig).attr({text:dig});
 }
  function checkTime(i) {
     if (i<10) {i = "0" + i};  // add zero in front of numbers < 10
       return i;
    }
 setInterval(function(){
 startTime();
 },1000);
 };

HTML file:
<!DOCTYPE html>
<html>
<head>
<script src="digital.js" type="text/javascript"></script>
<script src="raphael-min.js" type="text/javascript"> </script>

</head>

</html>

Thank you

A: It isn't really an animation, since you are drawing an image of the clock.
What paper.text is doing is drawing a new text every second on the canvas over the text that is already there.
using display.attr('text', dig); instead of you can edit the existing text.
This is the corrected code:
window .onload= function (){
var paper = new Raphael( 0,0, 400, 400);
var backGround = paper.rect(0,0,400,400);
var display = paper.text(200, 200, "00:00:00").attr({text:"00:00:00"});
   backGround.attr({ fill: "none"});
function startTime() {
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
m = checkTime(m);
s = checkTime(s);
var dig = h+":"+m+":"+s;
display.attr('text', dig);
}
function checkTime(i) {
     if (i<10) {i = "0" + i};  // add zero in front of numbers < 10
       return i;
}
setInterval(function(){
  startTime();
},1000);
};


text:
Q: Unresolved externals on linking yaml-cpp against my project When I try to link my project against yaml-cpp library, I get unresolved externals

Error 1680    error LNK2019: unresolved external symbol "class YAML::Node
  __cdecl YAML::LoadFile(class std::basic_string,class std::allocator > const &)"
  (?LoadFile@YAML@@YA?AVNode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

I built the lib using CMake and then building the project 'ALL BUILD'
The code is very simple:
#include <yaml-cpp/yaml.h>
int main(int argc, char **argv)
{
    YAML::LoadFile("config.yaml");
    return 0;
}


text:
Q: How to get syndaemon to work every time I restart the computer or switch accounts? What is the surefire way to disable the touchpad while typing?
I run syndaemon and it works for a bit.  But it's notoriously unreliable.  Every time my wife uses the computer it's stopped again.  We have different accounts.  I get the problem too but I don't seem to knock the touchpad like she does.
I suspect it's an issue with how it starts.  I've tried starting it from all sorts of places.  Why cant Ubuntu get this right?  It should be started by default on laptops.
Hints please.  My wife is bugging me every time she goes to use to the computer and she's getting quite grumpy about it.

A: Try to config the auto generated .desktop file in ~/.config/autostart
Something like:
Exec=/bin/bash -c "sleep 10&&/usr/bin/syndaemon -i 0.5 -d -K"


text:
Q: Inserting a Note based on Cell Value I'm trying (and failing) at getting excel to automatically insert a Note based on a specific cell value.
I have my conditional formatting set up so that when a WBS code is inserted it changes to a specific pattern/colour, and that is working fine.
What I want it to do is insert a note based on that cell value to show a name when you hover over the cell.
For example;
cell Value = "PF1" - insert note "First Name, Last Name" into that cell
Cell Value = "CH1" - Insert note " first Name, Last Name" and so on...
I have a hidden sheet with my name data, I'm just unsure if this would be a formula, a macro, or conditional formatting.
I've tried conditional formatting based on a formula but to no avail and I'm not clued up enough to write a macro by hand!


text:
Q: use of python super function in django model Here's some code in a django tutorial that I'm going through.  I've never come across the super function in python before and the way it's used here is different from the examples I've seen online.  I.e., usually when you use super, don't you have multiple classes?  It's in the last line:  super(Snippet, self).save(force_insert, force_update)
Could you explain exactly what's going on there and what would be an alternative way to write that.  It just seems like the save method is calling itself here?
class Snippet(models.Model):
    title = models.CharField(max_length=255)
    language = models.ForeignKey(Language)
    author = models.ForeignKey(User)
    description = models.TextField()
    description_html = models.TextField(editable=False)
    code = models.TextField()
    highlighted_code = models.TextField(editable=False)
    tags = TagField()
    pub_date = models.DateTimeField(editable=False)
    updated_date = models.DateTimeField(editable=False)

    class Meta:
        ordering = ['-pub_date']

    def __unicode__(self):
        return self.title

    def save(self, force_insert=False, force_update=False):
        if not self.id:
            self.pub_date = datetime.datetime.now()
        self.updated_date = datetime.datetime.now()
        self.description_html = markdown(self.description)
        self.highlighted_code = self.highlight()
        super(Snippet, self).save(force_insert, force_update)

A: super(Snippet, self) causes Python to look in the MRO of the class of self (i.e. self.__class__.mro() for the next class listed after Snippet. It returns a super object which acts as a proxy for that class. That is, calling a method on the super object acts like calling that method on the class.
super(Snippet, self).save(...) calls that class's save method, with self bound to the first argument.
So super(Snippet, self).save(...) will not call Snippet's save method; it will call some other class's save method. It is tempting to think this "other class" is the "parent class" or "superclass" of Snippet, that is,
models.Model, but that may not be true and it is absolutely wrong to apprehend super this way. Which class super(Snippet, self) ultimately represents depends on self and in particular its class's MRO.
A very good description of the MRO and super (complete with pictures!) can be found here.

A: I won't explain again what unutbu explained on super classes, however you obtain the same effect with the following code :
models.Model.save(self, force_insert, force_update)

This is NOT a better way to write it since, if you come to change the class inheritance by adding an intermediate class between Model and Snippet you would also have to change this line (which you would most likely forget). Anyway it's a good thing to know.
I can also add that the super instruction only works if the class you inherit from extends from object, otherwise you get an exception.


text:
Q: Semantic ui dropdown with multiple selections not clearing text after selecting an option I have recently started working on the html and css and I was stuck in this situation where I have used semantic ui dropdown with multiple selections feature and not working as expected. (Reference: http://semantic-ui.com/modules/dropdown.html#multiple-selection)
I have exactly used the same way as it was given in the example. But I don't know what have I missed while implementing it. I am getting the following error

Here is my html code for this dropdown
<select id="view_options_dd" multiple="multiple" class="ui fluid search dropdown view_ns_dropdown" data-ng-model="selected_options">
    <option data-ng-repeat="item in all_options.name">{{item}}</option>
</select>

And corresponding javascript
$(document).ready(function() {
            $('select.dropdown').dropdown({ fullTextSearch: true ,sortSelect:true} ,'set selected', ['meteor', 'ember']);
        });

Even after selecting the 'test' option, I am still getting the text in the dropdown box. Any idea how to fix this issue?

A: i think that is happening cuz you don't have value="" field in option. So semantic thinks that first option is a placeholder
Just put:
<select id="view_options_dd" multiple="multiple" class="ui fluid search dropdown view_ns_dropdown" data-ng-model="selected_options">
    <option data-ng-repeat="item in all_options.name" value='{{item}}'>{{item}}</option>
</select>


text:
Q: Angular equivalent of JQUERY/file upload/multipart form I have a simple file upload in my multipart form:

What I want to do is customize it so that it looks like this:

Although my first solution works fine - below is my code:
HTML snippet

                <input type="file" name="file" onchange="angular.element(this).scope().uploadFile(this.files)" />

Controller snippet:
$scope.uploadFile = function(files) {
    var fd = new FormData();
    console.log('test', files[0]);
    //Take the first selected file
    fd.append("file", files[0]);

    $http.post(uploadUrl, fd, {
        withCredentials: true,
        headers: {
            'Content-Type': undefined
        },
        transformRequest: angular.identity
    }).success('...all right!...').error('..damn!...');

};

I have very little control of the customisation for it to look like the second example.
I have thought about creating the button first seperately, then using jquery to store the file name into an input box like this:

$("inputBox").html(filename);

but I am unsure on how to do this in angular or if this is the right way in solving the problem. Any ideas? Thanks

A: The following is how you solve it:
1) Create a directive which gets file input value and replaces the value in the input box. In AngularJS DOM elements can only be manipulated this way.
//directive to add input file name in image upload
app.directive('imageupload', function() {
    return {
        restrict: 'A',
        link: function(scope, element, attrs) {
            $(element).change(function() {
                // on change update upload file
                  $("#uploadFile").val($(element).val());
            });
        }
    };
});

2) HTML in view
            <input id="uploadFile" placeholder="Choose File" disabled="disabled" />

                Upload
                <input id="uploadBtn" imageupload type="file" onchange="angular.element(this).scope().uploadFile(this.files)" class="upload" />

3) CSS
/* upload */

.fileUpload {
    position: relative;
    overflow: hidden;
    margin: 10px;
}
.fileUpload input.upload {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    padding: 0;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    filter: alpha(opacity=0);
}


text:
Q: Fetch data from firebase database and componentDidMount I have a problem fetching data from firebase with componentDidMount().
Fetching the data working fine but the problem is when it comes to lifecycle method. I console.log out the fetched data.
it fetched data when the component renders and after it fetched, the data become undefined and my render method appeared and disappeared in 0.001sec.
Do I need to store the props data into the state in order to not to disappear
Thank you for the help!
Action
export const fetchUserAddressbook = () => {
    const { currentUser } = auth;
    return dispatch => {
     database
      .ref(`users/${currentUser.uid}/shippingAddress`)
      .on('value', snapshot => {
        dispatch({
          type: FETCH_SHIPPING_ADDRESS_SUCCESS,
          payload: snapshot.val()
          });
        });
      };
    };

class
componentDidMount() {
  this.props.fetchUserAddressbook();
}

 render(){
 return
 (
  <div>{this.renderAddressCard(this.props.shippingAddressBook)}</div>
 )

const mapStateToProps = state => {
  return {
   shippingAddressBook: state.user.shippingAddressBook
  };
 }

renderMethod
renderAddressCard(shippingAddressBook) {
    return _.map(shippingAddressBook, (value, uid) => {
      return (
        <Card header={value.companyName} />

      );
    });
  }


text: Q: How to check control visibility in WPF app using Test Studio, Ranorex or TestComplete test tool I have a WPF application and I have to make several automation tests for GUI. I need to check if some control is visible but I don't have possibility to rebuild the application every time I change visibility option. I have a WPF Inspector and can change control options online but I'm not sure that it'll work because my test runs application every time. Could you give me a piece of advice?


text:
Q: Front facing camera recorded not work in android 4.1.2 I am using the code for front camera recorder. Its working well in android 4.0.4. but not working in android 4.1.2. Error occurred when start the media recorder. how to fix.
My class:
public class RecoredVideo extends Activity implements OnClickListener,
    OnInfoListener {

private Camera myCamera;
private MyCameraSurfaceView myCameraSurfaceView;
private MediaRecorder mediaRecorder;
File file;
FrameLayout myCameraPreview;
String Webpath;
String localSdpath;
Button recordstart, close,cameraChange;
boolean recording;
ProgressBar progressBar;
String VideoPath;
CountDownTimer mCountDown;
 int myProgress = 0;
 Camera camera = null;
 int currentCameraId;
 int Rotate=270;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.camera);
    RecorderPrepare();
    recordstart = (Button) findViewById(R.id.videostart);
    recordstart.setOnClickListener(this);
    recording = false;

    close = (Button) findViewById(R.id.CloseBtn);
    close.setOnClickListener(this);
    progressBar = (ProgressBar) findViewById(R.id.recordbar);
    progressBar.setVisibility(View.GONE);

    cameraChange=(Button) findViewById(R.id.CamerachangeBtn);
    cameraChange.setOnClickListener(this);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

}

@SuppressLint("NewApi")
public int getFrontCameraId() {
    CameraInfo ci = new CameraInfo();
    for (int i = 0 ; i < Camera.getNumberOfCameras(); i++) {
        Camera.getCameraInfo(i, ci);
        if (ci.facing == CameraInfo.CAMERA_FACING_FRONT) return i;
    }

    return -1; // No front-facing camera found
}
@SuppressLint("NewApi")
private Camera getCameraInstance() {
    // TODO Auto-generated method stub

    try {
         int index = getFrontCameraId();
         if(index == -1){
             currentCameraId=Camera.CameraInfo.CAMERA_FACING_BACK;
         }else{
             currentCameraId=Camera.CameraInfo.CAMERA_FACING_FRONT;
         }

        camera = Camera.open(currentCameraId);
        camera.setDisplayOrientation(90);

        // camera = Camera.open();
        Camera.Parameters param = camera.getParameters();
        param.set("cam_mode", 1);

        // startCamera(Camera.Parameters.CAMERA_FACING_BACK);

        // param.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
        param.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);

        camera.setParameters(param);// attempt to get a Camera instance
    } catch (Exception e) {
        // Camera is not available (in use or does not exist)
    }
    return camera; // returns null if camera is unavailable
}
@SuppressLint("NewApi")
private void cameraChange() {

    camera.stopPreview();

    camera.release();

    if(currentCameraId == Camera.CameraInfo.CAMERA_FACING_BACK){
        currentCameraId = Camera.CameraInfo.CAMERA_FACING_FRONT;
        Rotate=270;
    }
    else {
        currentCameraId = Camera.CameraInfo.CAMERA_FACING_BACK;
        Rotate=90;
    }

    camera = Camera.open(currentCameraId);
    camera.setDisplayOrientation(90);

    myCameraSurfaceView = new MyCameraSurfaceView(this, camera);
    myCameraSurfaceView.requestFocus();
    myCameraPreview = (FrameLayout) findViewById(R.id.firstrecordview);
    int count=myCameraPreview.getChildCount();
    if(count!=0){
        myCameraPreview.removeAllViews();
    }

    if (myCameraPreview != null && myCameraSurfaceView != null) {
        myCameraPreview.addView(myCameraSurfaceView);
    }

}

@SuppressLint("NewApi")
private boolean prepareMediaRecorder() {

    myCamera = getCameraInstance();
    // myCamera.setDisplayOrientation(90);
    mediaRecorder = new MediaRecorder();

    myCamera.unlock();

    mediaRecorder.setCamera(myCamera);
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
    mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    mediaRecorder.setProfile(CamcorderProfile
            .get(CamcorderProfile.QUALITY_HIGH));

     VideoPath=initFile().getAbsolutePath();
    mediaRecorder.setOutputFile(VideoPath);
    mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.
    mediaRecorder.setOnInfoListener(this);
    mediaRecorder.setMaxFileSize(5242880 * 4);// Set max file size 5M

    //if(currentCameraId == Camera.CameraInfo.CAMERA_FACING_BACK){
       //mediaRecorder.setOrientationHint(90);
    //}
    //else {
        mediaRecorder.setOrientationHint(Rotate);
    //}

    mediaRecorder.setPreviewDisplay(myCameraSurfaceView.getHolder()
            .getSurface());

    try {
        mediaRecorder.prepare();
    } catch (IllegalStateException e) {
        releaseMediaRecorder();
        return false;
    } catch (IOException e) {
        releaseMediaRecorder();
        return false;
    }
    return true;

}

public void onInfo(MediaRecorder mr, int what, int extra) {
    Log.i("onInfo:", what + ":::"
            + MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED );
    if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED ) {
        Log.i("VIDEOCAPTURE", "Maximum Duration Reached");

        Stop();

    }
}

private void releaseMediaRecorder() {

    if (mediaRecorder != null) {
        // mediaRecorder.reset(); // clear recorder configuration
        mediaRecorder.release(); // release the recorder object
        mediaRecorder = null;
        myCamera.lock(); // lock camera for later use
    }
}

private void releaseCamera() {
    if (myCamera != null) {
        myCamera.release(); // release the camera for other applications
        myCamera = null;
    }
}

private File initFile() {
    File dir = new File(
            Environment
                    .getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES),
            this.getClass().getPackage().getName());
    if (!dir.exists() && !dir.mkdirs()) {

        this.file = null;
    } else {
        this.file = new File(dir.getAbsolutePath(), new SimpleDateFormat(
                "'MOV_'yyyyMMddHHmmss'.mp4'").format(new Date()));
        System.out.println(this.file + "::::::this.file");
    }
    return this.file;
}

private void RecorderPrepare() {
    myCamera = getCameraInstance();
    if (myCamera == null) {

    }
    myCameraSurfaceView = new MyCameraSurfaceView(this, myCamera);

    myCameraSurfaceView.requestFocus();

    myCameraPreview = (FrameLayout) findViewById(R.id.firstrecordview);

    if (myCameraSurfaceView != null) {

    }
    if (myCameraPreview != null && myCameraSurfaceView != null) {

        myCameraPreview.addView(myCameraSurfaceView);

    }

}

private void RecordStart() {

    if (recording) {
        recordstart
                .setBackgroundResource(R.drawable.record_button_inactive_2);
        // stop recording and release camera
        Stop();

    } else {

        // Release Camera before MediaRecorder start
        releaseCamera();

        if (!prepareMediaRecorder()) {

            finish();

        }

        recordstart.setBackgroundResource(R.drawable.record_button_active_2);
        mediaRecorder.start();
        recording = true;

    }

}

private void Stop() {

    if (mediaRecorder != null)
        mediaRecorder.stop();

    progressBar.setVisibility(View.GONE);
    if (mCountDown != null) {
        mCountDown.cancel();
    }
    releaseMediaRecorder(); // release the MediaRecorder object
    releaseCamera();
    Intent Intent_imageview = new Intent(RecoredVideo.this,
            ViewAndSend.class);
    Intent_imageview.putExtra("path", VideoPath);
    startActivity(Intent_imageview);
    finish();

}

@Override
protected void onPause() {
    super.onPause();
    System.out.println("onPause::::00" + ":::::");
    if (mCountDown != null) {
        mCountDown.cancel();
    }
    try {

        releaseMediaRecorder(); // if you are using MediaRecorder, release
        releaseCamera(); // release the camera immediately on pause event
    } catch (Exception e) {
        Log.e("onPause", e + "");

    }
    finish();

}

@Override
protected void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();
    System.out.println("onPause::::00" + ":::::");
    if (mCountDown != null) {
        mCountDown.cancel();
    }
    try {

        releaseMediaRecorder(); // if you are using MediaRecorder, release
                                // it
        releaseCamera(); // release the camera immediately on pause event
    } catch (Exception e) {
        Log.e("onPause", e + "");

    }
}

@Override
public void onClick(View v) {
    if (v.getId() == R.id.videostart) {
        cameraChange.setVisibility(View.GONE);
        RecordStart();
        startTimer1();

    } else if (v.getId() == R.id.CloseBtn) {
        progressBar.setVisibility(View.GONE);
        if (mediaRecorder != null)
            mediaRecorder.stop();
        if (mCountDown != null) {
            mCountDown.cancel();
        }

        releaseMediaRecorder(); // release the MediaRecorder object
        releaseCamera();
        finish();
    }else if(v.getId() == R.id.CamerachangeBtn){
        cameraChange();
    }

}
private void startTimer1() {
    progressBar.setVisibility(View.VISIBLE);
    myProgress=0;
    progressBar.setSecondaryProgress(0);
    progressBar.setMax(60);
    // Log.i("bulb", "msg");
    if (mCountDown != null) {
        mCountDown.cancel();
    }

    mCountDown = new CountDownTimer(60000, 1000) {
        @Override
        public void onTick(long millisUntilFinished) {
            myProgress++;
            progressBar.setProgress(myProgress);
        }

        @Override
        public void onFinish() {
            // Log.i("bulb", "msg");
            progressBar.setVisibility(View.GONE);

        }
    }.start();

}

}

Error :
    java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.gigglemail.giggle.RecoredVideo.RecordStart(RecoredVideo.java:272)
at com.gigglemail.giggle.RecoredVideo.onClick(RecoredVideo.java:340)
at android.view.View.performClick(View.java:4223)
at android.view.View$PerformClick.run(View.java:17275)

All permission added in manifast xml


text:
Q: Book about a boy with a father named Daed (short for Daedalus) who sends him into some virtual reality to play a game Read this book about a few years back about a boy who lives in a corporation where his supposed dad (named "Daed" short for "Daedalus") worked. If memory serves me right the father sent him on a quest and it was revealed that he wasn't the boy's actual father, the boy just mistook him for his father because of his nickname "Daed". Also pretty sure there was a commanding woman from the corporation who was somehow involved with Daed.

A: Could it be the book Gamerunner? I haven't read the book, but it's easy to see that a lot of the details line up with your description.
Boy plays a game in virtual reality and lives in a corporation:

Rick is a Gamerunner. His job is to test there are no glitches or bugs in The Maze - the computer game that is much more than just a computer game. In The Maze you physically become your avatar. You fight, run and loot, all the time avoiding the deadly slicing traps - whirling blades that appear from nowhere. Rick has known nothing outside The Maze and his life at the headquarters of Crater, the company that created The Maze.
   —Synopsis

Supposed father named Daed:

Daed was a mystery, even — no, especially — to Rick. Even if Daed was
  his father, he didn't know who his mother was. Or if he'd had one. When he was small — smaller, anyway — he'd tried to pretend Perdita was his mother, but it didn't really work.
   —Page 15

I can't find anywhere that says Daed's full name is Daedalus, but the word "Daedalus" appears several times in the book, and I think it's implied.
Daed sends him on a quest:

'Better,' Daed said, in the dark. 'Now listen. I want you to
  go into the Maze —'
  —Page 16


text:
Q: System.Globalization.CultureInfo.GetCultures returning null in dev environment (Visual Studio) First of all, this could very well be a rookie mistake on my part, I'm fairly new to .net and c#.
I'm using the CMS system Umbraco on our latest project, and a recent update has meant the system has started using the System.Globalization.CultureInfo class to deal with localization. This has resulted in multiple "Culture Not Found" errors in the CMS back office that renders it unusable. Here's a stack trace from one of them:
Server Error in '/' Application.

Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[CultureNotFoundException: Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.]
   System.Globalization.CultureInfo.GetCultureInfo(String name) +12488971
   Umbraco.Core.Services.LocalizedTextServiceFileSources.<.ctor>b__0() +573
   System.Lazy`1.CreateValue() +180
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +26
   System.Lazy`1.get_Value() +12446617
   Umbraco.Core.Services.LocalizedTextServiceFileSources.TryConvert2LetterCultureTo4Letter(String twoLetterCulture) +61
   Umbraco.Core.Services.LocalizedTextService.ConvertToSupportedCultureWithRegionCode(CultureInfo currentCulture) +110
   Umbraco.Core.Services.LocalizedTextService.GetAllStoredValues(CultureInfo culture) +72
   Umbraco.Web.Editors.BackOfficeController.LocalizedText(String culture) +123
   lambda_method(Closure , ControllerBase , Object[] ) +77
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9765121
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

I'm still not completely sure where the .-no is coming from, but after some amount of research into this I tried running the following code with a breakpoint inserted:
var locale = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);

This returned null, and doesn't seem to be throwing an exception anywhere. I'm guessing this might be the cause of the errors, judging by the stack trace. Could this be an issue with my local setup? I'm running Windows 10, mainly in a virtualization environment, but it can also run natively via OSX Bootcamp, where the problem still seems to be present. I've also tried using Powershell to output the list of installed cultures, and that works fine.
If it helps, I'm using IISExpress for the web server and the database is running under SQL Server 2016 Express.
Thanks in advance! Let me know if I can supply any extra info to help out with this.

A: Make use of the fact that Umbraco is open source.
Judging from the stack trace and exception details you have provided, problem is caused by this line:
https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs#L102
Apparently invalid value .-no is passed into GetCultureInfo method. If you look a bit up in the source code, it seems that this value comes from XML file name or XML file content.
I cannot provide complete solution for your problem, but here are some things to try to pinpoint root cause of it:
1) Clean deployment folder
Do full clean & rebuild cycle
2) Check localization XML files to check if they contain valid cultures
If you have edited files manually, make sure there is no typo there.
3) Compare folders of "fresh" install and your non-working solution folder
Check if update hasn't left behind some XML files from previous versions;


text:
Q: IAM & Admin Roles issue GCP The IAM & Admin Roles some issue with load the Roles. I am not able to manage roles and also my App Engine default service account is disable. and also my firebase not working which is linked to this project.
There is screenshots:
Roles
Service account