text:
Q: Declaring a parameter in html and receiving it in Javascript My js function goes like this:
function tester (message) {
    alert(message);
}

And in the markup I have:
Link

But it doesn't work. Can someone please tell me why?

A: text to show is not a string unless you wrap it with quotes, either single or double.
Like this:
Link

Notice that you can't use the same kind of quote for both the Javascript code and the HTML.
Your code is probably giving errors. Check the console when the code doesn't do what you expect it to.

A: You are almost there. All you have to do is wrap text to show in quotes, like this:
Link

What's happening here is that you have an  tag with two attributes, href and onclick. In the href you write the URL that the link points to. In the onclick attribute, you write Javascript. The Javascript here is:
tester('text to show');

which runs a function called tester, passing it the string 'text to show'. Your original code had Javascript like this:
tester(text to show);

which results in a Syntax Error. As an aside, if you had Javascript like this:
tester(text);

it would have looked for a variable named text, and if this variable was defined, you would get an alert with that text.
One more thing: when you include text inside HTML attributes, like you did here, you should be careful not to use the same quotes you used to enclose the attribute. That is why we used single quotes. Suppose you wanted to use double-quotes or other fancy characters, such as the © symbol ... then you replace them with their "HTML-escaped" value, in this case ©. Click here for some common values.


text:
Q: java.lang.ArrayIndexOutOfBoundsException error in nested if statements     }

I have an input.txt file, i want call that from console. This file includes whitespaces and quotes. I write this code but it give me the error. Where is my fault in this code, guys?
Also, if (chars[i]=='"'){
                j = i ;
                i++ ;
                while (chars[i] != '"'){
                    i++;
                }
                System.out.println(str.substring(j,i));
            }
because of the error, the print does not work.

A: while(i < chars.length)

and
i++ ;

will get you into trouble at
if (chars[i]=='"'){

A: What happens if the last character of the string is ' '?
Look at the case of the string " " (single space)
while(i < chars.length) // i == 0
  chars[0] == ' ' // true;
  i++; // i = 1 (past array end)
  if (chars[1] == '"') // you've accessed past the end of the array and you get the exception

A: I think you should check "i" variable always after "i++" operation - checking it in most outside while isn't enough, you can go out the array size

redpajama_set_name: RedPajamaStackExchange


text:
Q: Capacitor splash screen animation I have an Angular 2+ app wrapped with Capacitor.
I want to add a splash screen animation to it.
After researching this issue I understood that animating the splash screen is not possible, but we can wait until the app is launched and add the animation to it.
Can someone explain the process of loading animation into an app?
How do applications load an animation upon app startup?
Sharing Android/iOS code is appreciated.

A: Creating Splash Screens and Icons
Follow the steps in here

*

*First install
npm install -g cordova-res

*Create a resources folder in the project with icon.png ( must be at least 1024×1024px) and splash.png (must be at least 2732×2732px). The resources folder should be at the same level as src folder.

*Run the following commands for iOS/Android:
 cordova-res ios --skip-config --copy
 cordova-res android --skip-config --copy

Good luck! :)


text:
Q: Create a hyperlink that is dynamic In Excel 2010
On the same worksheet
I want to be able to click on Cell # A3
that click has it jump to # A8 (in the same worksheet).
and then be able to insert a row at # A6,
and still have A3 automatically jump linked to #A8
My apologies, my searches do not seem to point me to a solution.  If it is there just point me there and I will see what my limited Excel skills will allow me to learn.  The hardest part is learning the terminology to discover what my solution will be.  FYI - I have never done a "VBA' solution in my past so that part will be a little difficult for me to understand, but I can try.
I was hoping the 'Edit Hyperlink' window's 'Type the cell reference' field would have allowed for $ character to keep the 'mapped' cell as dynamic.

A: In cell A3 enter the formula:
=HYPERLINK("#A8","A8")

and as Tim Williams points out, that is where it will always go.
If, however, you wanted the destination to "move" as A8 moves, you would assign a Name to the destination

A: You can use 'DEFINED NAME' in hyperlink. Use name box to create the defined name for your 'to be' hyperlinked cell and use that defined name to link. More step by step details is available here

A: Well I have a friend that found my answer that worked
One liner:
  The technique is 'define the name' for the cell to be linked and use that 'defined name' in hyper link.
Ref:
http://sivajankan.blogspot.com/2015/04/excel-hyperlink-tying-to-cell.html
Before going on step by step, please find what is 'Name Box'.
Name box:
The left most cell in 'Formula bar' is the Name Box. When you hover the Name Box cell, it shows 'Enter a name for a cell range, or select a named range from the list' [in MSOffice 2013]
Step by Step:
Create the Defined Name:
Select the cell you want to be hyperlinked (to be jumped to). In the 'Name Box' [check the image above], enter a 'reference' name and press return key. [Assumed 'Reference1' for our example case]
Use the Defined Name in Hyperlink
Go to the cell where you want to place the hyperlink (to be jumped from), right click and click on 'Hyperlink' from the menu
In the 'Insert Hyperlink' popup window, in 'Anchor' ['Link to' for older version] section, click on 'locate'; which opens another popup window
In the 'Select Place in Document' popup, expand the 'Defined Names' by clicking the small triangle [or + icon] next to it [make the triangle point down, or change + to -, by clicking], and select the reference you made in step 2. [Our example 'Reference1']
Now your hyperlink pointed to the reference; so inserting or deleting any rows or columns won't affect your hyperlink pointing cell location.


text:
Q: Is this the correct way to make a postrequest to login into a website Hi guys Id like to start with requests and just login into a website.
Somehow it doesnt work right or how can I post a status code
import requests

LOGIN = 'https://www.snipes.com/login'
payload = {
'username': 'username',
'password': 'password'
}

with requests.session() as s:
s.post(LOGIN, data=payload)

A: You can get status code as,
In [38]: import requests

In [39]: LOGIN = 'https://www.snipes.com/login'

In [40]: payload = {
    ...: 'username': 'username',
    ...: 'password': 'password'
    ...: }

In [41]: with requests.session() as s:
    ...:     res = s.post(LOGIN, data=payload)
    ...:

In [42]: res
Out[42]: <Response [410]>

In [43]: res.status_code
Out[43]: 410


text:
Q: Use ffmpeg to record 2 webcams on raspberry pi I want to record 2 webcams using ffmpeg, i have a simple python script but it doesn't work when I run the 2 subprocesses at the same time.
ROOT_PATH = os.getenv("ROOT_PATH", "/home/pi")
ENCODING = os.getenv("ENCODING", "copy")
new_dir = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
RECORDINGS_PATH1 = os.getenv("RECORDINGS_PATH", "RecordingsCam1")
RECORDINGS_PATH2 = os.getenv("RECORDINGS_PATH", "RecordingsCam2")
recording_path1 = os.path.join(ROOT_PATH, RECORDINGS_PATH1, new_dir)
recording_path2 = os.path.join(ROOT_PATH, RECORDINGS_PATH2, new_dir)
os.mkdir(recording_path1)
os.mkdir(recording_path2)
segments_path1 = os.path.join(recording_path1, "%03d.avi")
segments_path2 = os.path.join(recording_path2, "%03d.avi")
record1 = "ffmpeg -nostdin -i /dev/video0 -c:v {} -an -sn -dn -segment_time 30 -f segment {}".format(ENCODING, segments_path1)
record2 = "ffmpeg -nostdin -i /dev/video2 -c:v {} -an -sn -dn -segment_time 30 -f segment {}".format(ENCODING, segments_path2)
subprocess.Popen(record1, shell=True)
subprocess.Popen(record2, shell=True)

Also, i tried capturing the 2 sources side by side but it gives the error:`Filtering and streamcopy cannot be used together.

A: This has nothing to do with running two processes at the same time. FFmpeg clearly states that it cannot find /dev/video0 and /dev/video2. It seems your video camera is not detected. You can check this with following command :
$ ls /dev/ | grep video

will list all devices which have video in their name. If video0 and video2 do not exist, its clear FFmpeg gives such error. If they do exist, i do not know how to resolve this. You may try to run the FFmpeg commands directly in terminal.


text:
Q: setDataAsync with Office.CoercionType.Table My first day hacking with Napa and I'm struggling...
I'm struggling to understand the binding process for TableData. I've worked out a simple example with the Matrix type and can read data from an existing table:
Office.context.document.bindings.addFromNamedItemAsync("Sheet1!Table1", Office.BindingType.Table, { id: "bindingTable" }, function (asyncResult) {
    if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        asyncResult.value.getDataAsync(function (asyncResult) {
            if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
                console.log(asyncResult.value);
            }
        });
    }
});

but I am unable to write data to a table:
Office.context.document.bindings.addFromNamedItemAsync("Sheet1!Table1", Office.BindingType.Table, { id: "bindingTable" }, function (asyncResult) {
    if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        var myTable = new Office.TableData;
        myTable.headers = [["ID"],["Name"]];
        myTable.rows = [[1,"Fred"],[2,"Jane"]];
        asyncResult.value.setDataAsync(myTable, { coercionType: Office.CoercionType.Table }, function (asyncResult) {
            console.log(asyncResult.status);
        });
    }
});

Specifically, the error thrown is "Data Write Error", "The supplied data object type is not supported".
What am I doing wrong?
Also, can I programmatically generate tables on a sheet?
Thanks!

A: Aha! I think I may have stumbled upon the answer.... the binding returned from a Office.BindingType.Table is an abstract class BindingTable that has additional methods including addRowsAsync.
Office.context.document.bindings.addFromNamedItemAsync("Sheet1!Table1", Office.BindingType.Table, { id: "bindingTable" }, function (asyncResult) {
    if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
        asyncResult.value.addRowsAsync([[3, "Henry"]], null, function (asyncResult) {
        console.log(asyncResult.status);
    });
}

});


text:
Q: Help manipulating this equation I have this equation:
$$A(f)=\frac{1}{\sqrt{\left(1-\left(\frac{f}{F}\right)^2\right)^2+c^2\left(\frac{f}{F}\right)^2}}$$
and I am told this:

Note that for a fixed amplitude $A$, the equation relating amplitude and $f$ can be converted to a 4th degree polynomial in $f$ by squaring both sides (to eliminate the square root), taking the reciprocal of both sides, and then subtracting $A$. Do this algebraic manipulation "by hand."

I got it down to a quadratic:
$$f^2 = \frac{F^4-F^4y^2}{y^2(F^2C^2-2F^2+1)}$$
Please help :)

A: $$A=\frac{1}{\sqrt{\left(1-\left(\frac{f}{F}\right)^2\right)^2+c^2\left(\frac{f}{F}\right)^2}}$$
$$A^2 = \frac{1}{(1-(\frac{f}{F})^2)^2+c^2(\frac{f}{F})^2}$$
$$\frac{1}{A^2} =  (1-(\frac{f}{F})^2)^2+c^2(\frac{f}{F})^2$$
$$\frac{1}{A^2} = 1+\frac{f^4}{F^4} - \frac{2f^2}{F^2} + \frac{c^2f^2}{F^2}$$
$$\frac{1}{A^2} = \frac{1}{F^4} f^4 + \left( \frac{c^2-2}{F^2}\right)f^2+1$$
where the last line gives a 4 degree polynomial in $f$. (Not sure where to subtract $A$!)


text:
Q: using a dll with node-ffi I'm using node-ffi to access a dll supplied by a custom hardware i bought, the dll uses device driver to do things, they don't supply dll docs but they have a sample app in c#, the dll is used in c# like this:
[DllImport("POS_CIDR.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr CIDR_Info();
...
result = Marshal.PtrToStringUni(CIDR.CIDR_Info());
...

now i try to access CIDR_Info function of dll with following node code:
var ffi = require('ffi')
var ref = require('ref')
var int = ref.types.int;
    var libprime = ffi.Library('POS_CIDR.dll', {
  'CIDR_Info': [ int ,[]],
});
console.log(libprime.CIDR_Info()); // 73402156

now from what i understad the function returns an integer containing the address of a string, how can i dereference that integer to string in node?
i couldnt find any way to set address of a buffer in node.
update
ok i found how to read that string with this code :
var ffi = require('ffi')
var ref = require('ref')
var stringPtr = ref.refType(ref.types.CString);
var int = ref.types.int
var libprime = ffi.Library('POS_CIDR.dll', {
      'CIDR_Info': [ stringPtr ,[]],
    });
buf = new Buffer(255);
buf=libprime.CIDR_Info();
console.log(ref.readCString(buf, 0));

now the console outputs p which is the first char of string, if i set the offset to 2 it gives o which is the second char, i think there is a problem with encoding that readCString sees a null char after each char.
any idea how to fix that?


text:
Q: SelectItem disappear when use div in selectOneRadio I'm trying to put a div for each selectItem inside a selectOneRadio, see:]
<h:selectOneRadio styleClass="radio"
                    value="#{cursandoMB.alternativasEscolhidas[questaoCurso]}"
                    converter="entityConverter" layout="pageDirection">
                    <c:forEach var="c"
                        items="#{questaoCurso.questao.alternativasPreenchidas}">
                        <h:panelGroup style="color:red;">
                            <f:selectItem itemValue="#{c}" itemLabel="#{c.letra}) #{c.texto}" />
                        </h:panelGroup>
                    </c:forEach>
                </h:selectOneRadio>

Nothing is rendered when i do it, but if i comment the lines <h:panelGroup> everything works. How can i solve this ?


text:
Q: Midlet doesnt respond to touch in older touch screen phone I am very new to j2me. I have developed a basic SMS Banking app. My app works in most phones which are touch and non touch devices (Samsung duos, Monte, Nokia 6120c …, Sony Ericson w300). But when I installed it in a Samsung SGH-D980 it installs and starts fine. But the list element which is the first screen after my loading splash screen does not respond to the touch. I have developed the app using Net beans 7.0.1 and uses CLDC 1.0 and MIDP 2.0. I have tried the defaultfxtouchphone emulator and works fine on it too. My problem is why does it work on some touch phones but not in the above mentioned touch phone. thank you,

A: The fact that touch events are available to MIDlet at any other phones means nothing in your case.
MIDP specification (JSR 118) does not force implementation to make touch (pointer) events available to MIDlets even for touch device. According to data provided at club-java page, this is exactly the case for SGH-D980:

Touch screen or mouse (hasPointerEvents()) No
  Stylus motion events (HasPointerMotionEvents()) No

As soon as device allows to work with your list in non-touch fashion (you wrote nothing that says it ain't so), there is no problem - you just have to live with that.

 of course not passing touch events to MIDlets when these are available natively means that MIDP implementation on this device sucks. But that's a different story


text:
Q: How to get a date in the URL My router.rb
resources :post_categories, :path => '', :only => [:show] do
    resources :posts, :path => '', :only => [:show]
end

I get what you need
/category/id
/category

How do I get this URL?
/category/2015/11/08/id

I wanted to do something like this
  resources :post_categories, path: '', only: :show do
    resources :posts, path: '/:year/:month/:day', only: :show, constraints: { year: /\d{4}/, month: /\d{2}/, day: /\d{2}/ }
  end

But I do not understand how to make workers


text:
Q: How do I get native smooth scrolling using Ionic, Angular and Cordova? Here's my environment:

*

*Visual Studio 2015

*Cordova CLI: 5.3.3

*AngularJs: 1.4.8

*Ionic: 1.1.1

*Test mobile device: Nexus 5, Android 6.0.1 (The goal is that the app should work in Android and iOS, but not tested in iOS yet)

I have a finite list of ionic cards created by ng-repeat. The problem is that:

*

*I don't get a scrollbar at all

*I don't get a smooth native scroll over the list as shown in the gif in this post: ionic framework - no smooth springy scroll effect on Android , The scroll works but it's sort of dry, I don't get that feeling of when you scroll rapidly, and the scroll is fast in the beginning and then it slows down until it stops, just like scrolling in native apps like the Gmail app, I hope you understand what I mean, Instead, when I scroll, it's like shifting the page up and down.

I use

overflow-scroll="true"

and

has-bouncing="true" , as suggested in this post: ionic framework - no smooth springy scroll effect on Android

in my ion-content. Here's my code:
<ion-content ng-controller="CountryController as controller" overflow-scroll="true" has-bouncing="true">

{{::country.name}}

and I have even this config in my index.js to disable jsScrolling:
    angular.module('app', ['ionic']).config(function ($ionicConfigProvider) {
        $ionicConfigProvider.scrolling.jsScrolling(false);
    });

What am I missing here? Is it what I get with ionic or am I supposed to get the real native scrolling? Any clues is very much appreciated. Thank you.


text:
Q: Why isn't my background clipping to the text like it's supposed to? I'm new to CSS so I don't know a whole lot, but I'm trying to make my header text a gradient. I've made the background gradient, made the text transparent, and still, the background just will not clip to the text like it's supposed to. I can't find anyone else with this problem. (originally my background was a gradient, but for simplicity I changed it to red)
h1 {
    color: transparent;
    background-clip: text;
    background: red;
}


text:
Q: Prove this is an equivalence relation. Define a relation of $\mathbb{Q} -$ {$0$} as follows:
$x$ ~ $y$ $\Leftrightarrow$ $\dfrac {x} {y} = 2^k $ for some $k  \in \mathbb{Z}$
Prove this is an equivalence relation.
ATTEMPT:
Reflexive: For any $x\in\mathbb Z$, $\dfrac {x} {x}=1$ and $2^0 = 1$.
Symmetric: For any $x,y\in\mathbb Z$, if $\dfrac {x} {y}= 2^k$ for some $k\in\mathbb Z$, then $\dfrac {y} {x}= 2^k$ where $k\in\mathbb Z$.
Transitive: For any $x,y,z\in\mathbb Z$, if $\dfrac {x} {y}= 2^k$ and $\dfrac {x} {z}= 2^l$ for some $k,l\in Z$, then $\dfrac {x} {z}= 2^\frac{k} {l} -  ^y$ where $\frac{k} {l}-y\in\mathbb Z$.

A: As we're working with the rationals of form $\frac{x}{y}$ here, we'll need the restriction that $x,y \neq 0$, else we'd get $\frac{x}{0}$, etc. I will work with the assumption that $x,y \neq 0$ in all problems.
Reflexivity:
$x \sim x \Rightarrow \frac{x}x = 2^k$. Obviously, $\frac{x}x = 1 \forall x \in \mathbb{Z}$, so let $k = 0 \in \mathbb{Z}$.
Symmetry:
WTS if $x \sim y$ then $y \sim x$, i.e. $\frac{x}{y} = 2^k$ implies $\frac{y}{x} = 2^l$ for some $k,l \in \mathbb{Z}$. Note that $\frac{y}{x} = \frac{1}{x/y}$. So take $\frac{x}{y} = 2^k$. Then $\frac{1}{x/y} = \frac{1}{2^k}$. Note that $\frac{1}{2^k} = 2^{-k}$. Let $-k = l$, where $l \in \mathbb{Z}$ because of additive inverses. Then we have $\frac{y}{x} = 2^l$.
In this discussion, it is important to note that our fractions $\frac{1}{2^k}, \frac{1}{x/y}$, etc. are never equal to $0$ (because of nonzero numerators, and we have $\frac{x}{y}$ defined as nonzero, and $2^k \neq 0 \forall k$.), so they are in $\mathbb{Q} \setminus \{0\}$.
Transitivity:
Note that your approach is confused: either you made a typo, or you were trying to show that if $x \sim y$ and $x \sim z$, then you can draw some conclusion about $x\sim z$.
WTS: For any $x,y,z \neq 0 \in \mathbb{Z}$, if $x \sim y$ and $y \sim z$, then $x \sim z$. So WTS if $\frac{x}{y} = 2^k$ and $\frac{y}{z} = 2^l$, then $\frac{x}{z} = 2^m$ for some $k,l,m \in \mathbb{Z}$.
Take $\frac{y}{z} = 2^l$. Then $y = 2^l \cdot z$. Now take $\frac{x}{y} = 2^k$. By substitution, we get $\frac{x}{2^l \cdot z} = 2^k$. Now note $\frac{x}{2^l \cdot z} = \frac{x}{z} \cdot \frac{1}{2^l}$. So $\frac{x}{z} \cdot \frac{1}{2^l} = 2^k$. So $\frac{x}{z} = 2^l \cdot 2^k = 2^{l+k}$.
I.e. if $\frac{x}{y} = 2^k$ and $\frac{y}{z} = 2^l$, then $\frac{x}{z} = 2^{k+l}$. Done.


text:
Q: Max width of absolute positioned element I have a centered div (using absolute positioning and transform:translate(-50%,-50%) as described here). When the content of the child div is short everything works fine. When the content is long, then the child div width is limited to 50% of the container div (probably because left is set to 50%).
Is there a way to allow the child div to expand to the full width only when the content is long?

.container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  margin-left: auto;
  margin-right: auto;
  border: 2px solid black;
}

.child {
  position: absolute;
  transform: translate(-50%, -50%);
  left:50%;
  top:50%;
  background:lightgreen;
}

short

long long long long long long long

Edit: I found an explanation that helped me wrap my head around this in this answer.

A: Just add an display: table to the child div, this should give you the desired result.

.container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  margin-left: auto;
  margin-right: auto;
  border: 2px solid black;
}

.child {
  display: table;
  position: relative;
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
  background:lightgreen;
}

short

long long long long long long long

If you could use flexbox you can also do this:

.container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: top;

  width: 200px;
  height: 200px;
  border: 2px solid black;
}

.child {
  background:lightgreen;
}

short

long long long long long long long

A: Add in an additional nested element to allow yourself more control over dynamic positioning and scaling of the elements in question.

.container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  margin-left: auto;
  margin-right: auto;
  border: 2px solid black;
  box-sizing: border-box;
}

.child {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    text-align: center;
}

.child-inner {
    background: lightgreen;
    left: 0;
    right: 0;
    display: inline-block;
}

short

long long long long long long long


text:
Q: I can't see the errors on MAMP PRO I changed the three of php.ini files on my MAMP but it is still not showing the errors??
Does anyone know what to do in this? How can I show errors in MAMP PRO?
Thanks in advance!


text:
Q: Python is unexpectedly iterating over each element in a list twice In the function down below, I am trying to normalize prices (converting them to percentage differences from the starting price) in dataframes contained in a list of dataframes. Each dataframe has two columns: date and price.
    def normalize_windows(window_data: List[DataFrame]):

        starting_price = window_data[0]['price'].values[0]

        for window in window_data:
           for index, row in window.iterrows():
               window.at[index, 'price'] = (row['price'] / starting_price) - 1

        return window_data

Right now, when I debug the code in python, each dataframe in the list gets looped over twice thus, making all values a bit more or less -1.

Is there an unexpected behavior about the way I am looping that I don't know?

A: You don't need to iterate:
>>> df
   price
0     12
1     15
2     10
3     12
4     12
5     18
6     11
7     12
8     15
9     10

>>> df['price'] / df.iloc[0]['price'] - 1
0    0.000000
1    0.250000
2   -0.166667
3    0.000000
4    0.000000
5    0.500000
6   -0.083333
7    0.000000
8    0.250000
9   -0.166667
Name: price, dtype: float64

def normalize_windows(window_data: List[DataFrame]):

    starting_price = window_data.iloc[0]['price']
    window_data = (window_data['price'] / starting_price - 1)

    return window_data


text:
Q: Error Running Sonar connected to SQL Server 2005. SONAR.dbo.rules for column description When I start Sonar (StartSonar.bat), I get the following error in the log file.

Wrong column type in SONAR.dbo.rules for column description.
  Found: ntext, expected: nvarchar(max)

Looking at the column in SQL Server Management Studio it is nvarchar(max)
I'm running:

*

*DB: SQL Server 2005

*OS: Windows 7 64 bit

*Sonar: 2.11

Tried these drivers:

*

*sqljdbc-1.2.2828.100.jar

*sqljdbc4.jar (Microsoft SQL Server JDBC Driver 2.0)

*sqljdbc4.jar (Microsoft SQL Server JDBC Driver 3.0)

*sqljdbc4.jar (Microsoft SQL Server JDBC Driver 4.0)

My MSSQL Properties:

*

*sonar.jdbc.url:                        jdbc:sqlserver://localhost;databaseName=SONAR;

*sonar.jdbc.driverClassName:            com.microsoft.sqlserver.jdbc.SQLServerDriver

*sonar.jdbc.validationQuery:            select 1

*sonar.jdbc.dialect:                    mssql

I'm using a user name and password (SQL Authentication) to connect the DB
Note to self: When trying to connect to MSSQL remember to Enable TCP/IP. This is found in the SQL Sever Configuration Manager;SQL Server 2005 Network Configuration;Protocols for MSSQLSERVER;TCP/IP
I thought it might be a driver issue, but I'm not sure
Anyone else seen this?

A: I wasn't able to solve this via the sqljdbc drivers so I took some advise from another post and fell back to the jTDS driver http://jtds.sourceforge.net/index.html
The post I used was Sonar MsSql Database Issue
My Setup:

*

*Sonar 2.11 unzipped to C:\Sonar\sonar-2.11

The steps I made (paraphrased)

*

*Download jTDS drivers from jTDS Drivers Unzip it somewhere, I suggest C:\jDST

*Add the DLL to the system path. (C:\jDST\jtds-1.2.5-dist\x64\SSO)

*Copy the jar file (C:\jDST\jtds-1.2.5-dist\jtds-1.2.5.jar) to the extensions folder
(C:\Sonar\sonar-2.11\extensions\jdbc-driver\mssql)

*Update the sonar.properties

*

*sonar.jdbc.url:                          jdbc:jtds:sqlserver://localhost:1433/SONAR

*sonar.jdbc.driverClassName:                net.sourceforge.jtds.jdbc.Driver

*sonar.jdbc.validationQuery:                select 1

*sonar.jdbc.dialect: mssql

Note: in case you connect to the named instance, this must be specified explicitly in the connection URL: jdbc:jtds:sqlserver://localhost/SONAR;instance=SQLEXPRESS
Run the bat file StartSonar.bat (C:\Sonar\sonar-2.11\bin\windows-x86-64\StartSonar.bat)
Check your logs and go to  the site http:// localhost:9000


text:
Q: Cannot get object through the defined url in django I was building a blog using django.
My Article model include a field that display publishing date:
publish = models.DateTimeField(default = timezone.now)

and a get_absolute_url function:
def get_absolute_url(self):
    return reverse('article:post_detail',
                args = [self.publish.year,
                        self.publish.strftime('%m'),
                        self.publish.strftime('%d'),
                        self.slug])

This is my view displaying articles:
def post_detail(request, year, month, day, post):
    post = get_object_or_404(Article, slug = post,
                                  status = 'published',
                                  publish__year = year,
                                  publish__month = month,
                                  publish__day = day)
return render(request, 'post.html', {'post': post})

This is my urls in the blog project:
url(r'^article/', include('article.urls', namespace = 'article',app_name = 'article')),

and the urls of the article app within the project:
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<post>[-\w]+)/$',views.post_detail, name = 'post_detail'),

My expected results is like: When the url is article is /article/2016/04/18/first-article/, it will display the article published on the specific date with the slug first-article, but instead it displayed:

No article matches the given query.

When I tasted it using python manage.py shell, I found the problem seemed related to the month and day in the publish field:
>>> Article.objects.get(pk=1).get_absolute_url()
u'/article/2016/04/18/first-article/'
>>> Article.objects.get(pk=1).publish.year
2016
>>> Article.objects.get(pk=1).publish.month
4
>>> Article.objects.get(pk=1).publish.day
18

But when I searched for the article:
>>> from django.shortcuts import get_object_or_404
>>> get_object_or_404(Article, publish__year='2016')
<Article: This is the first article>
>>> get_object_or_404(Article, publish__year='2016', slug='first-article', status='published')
<Article: This is the first article>
>>> get_object_or_404(Article, publish__year='2016', publish__month='04')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/media/psf/Home/Porject/env/my_blog_new/lib/python2.7/site-packages/django/shortcuts.py", line 157, in get_object_or_404
  raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
Http404: No Article matches the given query.
>>> get_object_or_404(Article, publish__year='2016', publish__day='18')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/media/psf/Home/Porject/env/my_blog_new/lib/python2.7/site-packages/django/shortcuts.py", line 157, in get_object_or_404
    raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
Http404: No Article matches the given query.

It seemed that anything relate to the month and day didn't work but I was unable to figure out why.
I was using mysql, though I don't think it is related to this problem because my home page worked fine.
Is is the bug of mysql handling datetime field?
I stuck on this problem for several days and appreciated any opinions and tips. Thank you in advance.

A: Please modify USE_TZ value into False in settings.py,
USE_TZ = False

Here is original answer.

A: Are you sure the article has the flag set to status = 'published'?

A: This is use in view.py
    def post_detail(request,year,month,day,post):
         post=get_object_or_404(Post,
         publish__year=year,publish__month=month,publish__day=day,status='published', slug=post)
         return render(request, 'blog/post/detail.html', {'post': post})


text:
Q: Best compression method for sequence of uint64s when order preservation doesn't matter I am storing arrays of 10,000 uint64s. The values are hashes so are pretty evenly distributed across the full 64-bit space, making them not great for compression (zip only manages around 3% saving).
However, the order of the values is not important. Can I use this extra piece of knowledge to craft a more effective compression routine? An immediate thought was to sort them in order and then bucketize them, eg "next x values all have prefix a1b2c3" or something. This can certainly improve on zip, but can I do better? Thanks

A: The theoretical best benefit you can get is log2(10000!) bits, which is about 15K bytes out of your initial 80K bytes. Less than a 20% reduction.
If you really want to try to squeeze most of that out, you can try to compress the differences between successive hashes in sorted order. The first hash would be sent as is, followed by 9,999 differences. I would separate the high 12 bits of each 64-bit difference off into a different block, and compress that with a standard lossless compressor. The low 52 bits of each hash difference will essentially be noise, and so send that as is without trying to compress it.
You can play with the number 12 to see what gives you the best compression. Maybe 11 or 13 will work better.


text:
Q: How can I find the uncertainty of derivatives? Suppose I have a quadratic (weighted) least-square fit result obtained from a given set of data:
$$
f(x) = \underbrace{-0.243(\pm0.3324)}_{quad\_a}x^2\underbrace{-0.921(\pm0.061)}_{quad\_b}x\underbrace{-2.12(\pm0.0223)}_{quad\_c}
$$
If I'm taking the derivative of $f(x)$ to have $f'(x) = Ax+B$, I wonder how can I figure out the uncertainties on $A$ and $B$? I also have the correlations
C(quad_a, quad_c) = -0.422
C(quad_a, quad_b) = -0.278

Thanks for the help!


text:
Q: sails.js custom layout is not working in production environment I'm using sails 0.11.0 and in controller custom layout in not working when i start server with --prod flag(its working without prod flag). e.g
Controller:

index: function (req, res) {
  return res.view('administrators/index', {
    layout: 'user'
  });
},

A: You can try :
res.locals.layout = "user";
res.view("administrators/index");


text:
Q: Dropped keys while typing and inability to hold while gaming While typing a key will randomly not register and require several attempts at retyping it. In addition, if I'm playing a game that requires holding a key, it'll switch between either refusing to repeat at all or stop after a couple seconds.
Looking at xev, it seems like holding a key down will randomly generate this sequence of events:
FocusOut event, serial 33, synthetic NO, window 0x2c00001,
    mode NotifyGrab, detail NotifyAncestor

FocusOut event, serial 33, synthetic NO, window 0x2c00001,
    mode NotifyUngrab, detail NotifyPointer

FocusIn event, serial 33, synthetic NO, window 0x2c00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 33, synthetic NO, window 0x0,
    keys:  0   0   0   0   4294967168 0   0   0   0   0   0   0   0   0   0   0
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

The KeymapNotify at the end seems to be 2 followed by all 0s usually, or that large number (-128?) in a random spot. After that event, no more keypress events are generated until a release.
This comes after a similar but worse problem I had for a while wherein this sequence of events would occur at regular intervals without user input (confirmed via xev). This didn't affect me too much, infrequent key drops and my terminal's titlebar flashing at random, but was unusable when it came to gaming. In desperation I uninstalled everything related to X and reinstalled it, which traded that problem for this.


text:
Q: set-header for HAProxy responses New in version 1.5 is the http-response add-header directive. As written in the documentation -- this can be used in frontend, backend and listen.
What I was trying to within a frontend section:
use_backend some_backend                if some_condition
http-response add-header Vary Origin    if some_condition

But this has no effect. The same line placed in the backend section works perfectly fine.
Can someone please help me understand, what I am missing here? I don't understand, why this does not work in the frontend section.
My guess would be that within the fronted there is no response yet and so the directive fails. I tried using it before and after die use_backend directive.

A: Running haproxy in foreground (haproxy -d -V -f haproxy.cfg) with your sample displayed the following warning:
acl 'some_condition' will never match because it only involves keywords that are incompatible with 'frontend http-response header rule'

Fiddling with my config, I found that this warning is displayed when using this ACL:
acl some_condition req.hdr(Content-Type) -i application/json

But not when using this ACL:
acl some_condition res.hdr(Content-Type) -i application/json

The difference being res vs. req, so checking response headers instead of request headers. This leads me to believe that a http-response header rule in a frontend is incapable of inspecting request headers.
I don't know if this is intended functionality by HAProxy, but it certainly hasn't been clearly documented.


text:
Q: Surface Integral without using Gauss Divergence Theorem Evaluate $\iint_s $$\vec{F}\cdot $$\vec{dS}$ where $\vec{F}=4xi-2y^2j+z^2k$ and $S$ is the surface bounding the region $x^2+y^2=4, z=0$  and $z=3$

When I solve it by Gauss Divergence Theorem it's answer was 84$\pi$ but again when I tried to verified it by direct integral it doesn't gives me the same answer.

Please Don't use Cylindrical Coordinate system :)

A: By the divergence theorm.
$\iiint 4+2y+2z\ dV$
Integrating with respect to $z$
$\iint (\int_0^3 4+2y+2z \ dz) \ dA$
$\iint 12 + 3y+ 9 \ dA$
The region is symmetric around the y axis, that term will drop on integration.
$21(4\pi) = 84\pi$  we agree on that!
Evaluating the surfaces independently.  We have two disks and the wall of the cyinder.
$z = 0$  The normal is $(0,0,-1).$  Negative, because we want the normals pointing out.
$F\cdot n = -2z$  But z is zero.
$0$ on that disk.
$z = 3, n = (0,0,1)$
$\iint  6 \ dA  = 24\pi$
You don't want to convert to cylindrical, we can paramertize by $x,z$
$y = \pm\sqrt{4-x^2}$
We can take the positive root and double the integral to cover both the positive and negative cases.
$n = (-\frac {\partial y}{\partial x}, 1, -\frac {\partial y}{\partial z}) = (\frac{x}{\sqrt {4-x^2}}, 1 , 0)$
$F\cdot n = \frac {4x^2}{\sqrt {4-x^2}} + 2\sqrt {4-x^2}$
$2\int_0^3 \int_{-2}^2 \frac {4x^2}{\sqrt{4-x^2}} + 2\sqrt {4-x^2} \ dx \ dz\\
2\int_0^3 \int_{-2}^2 \frac {4x^2 + 8 - 2x^2}{\sqrt {4-x^2}}\ dx \ dz\\
2\int_0^3 \int_{-2}^2 \frac {2x^2}{\sqrt{4-x^2}} + \frac{8}{\sqrt {4-x^2}}\ dx \ dz$
$x = 2\sin\theta, dx = 2\cos \theta.$  While this is a Calc 1 substitution, it is effectively the same thing as converting to cylindrical...
$2\int_0^3 \int_{-\frac{\pi}{2}}^{\frac \pi2} 4\sin^2\theta + 8 \ dx \ dz\\
2\int_0^3 10\pi \ dz\\
60\pi$
$60\pi + 24\pi = 84\pi$


text:
Q: Array not printing called method Hello I have an issue with my code when ever I am printing the method nothing shows. The method is not printing as it should. I am trying to get the language of the user. I want it so that every time it asks the question what language you speak it will get the response but in a function. Instead I get code printed and not the language.

let questions = [
  {text:'What is your name?', audio:'music/openmind.ogg', response : input => 'Hello ' + input + '!' },
  {text:'How old are you?', response : input => 'That means you were born in ' + (2017 - input) + '.'},
  {text:'Where are you from?', audio:'music/beone.ogg', response: input => 'You are from ' + (input) + '.'},
  {text: 'Do you eat healthy?', audio: 'music/becoming.ogg', response: input => 'Acording to my data you are eating ' + (input) + ' and that is healthy!'},
  {text: 'What is your time?', audio: 'music/becoming.ogg', response: input => 'Where I am located' + (new Date().toLocaleTimeString()) + 'that is the day!'},
  {text: 'What language do you speak', audio: 'music/becoming.ogg', response: input => 'Acording to me you speak: ' + (language) + '!'}
 ];

let output = $('#output'),
    input = $("#input"),
    curQuestion;

function ask() {
  let qi = Math.floor(Math.random() *  questions.length); //depending on your needs, a check could be added if it's been asked directly before or only recycle questions when all are asked
  curQuestion = questions[qi];
  setOutput(curQuestion.text);
  input.val('');
}

ask(); //first call

function respond(){
  let q = curQuestion;
  if(q.audio)
    new Audio(q.audio).play();
  setOutput(q.response(input.val()));
  setTimeout(ask, 5000);
}

function setOutput(txt){
  output.html($('
').text(txt));
}

$(document).keypress(function(e) {
  if (e.which == 13) {
    respond();
    return false;
  }
});

function language(){
  var userLang = navigator.language || navigator.userLanguage;
  document.write (userLang);
}

     Responce:
            <input type="text" class="form-control" id="input" value="">

A: You just need to call a language function:
{
  text: 'What language do you speak',
  audio: 'music/becoming.ogg',
  response: input => 'Acording to me you speak: ' + language() + '!'
}

And make sure you return from language function:
function language () {
  var userLang = navigator.language || navigator.userLanguage;
  return userLang;
}


text:
Q: нужно сравнить есть ли вводимый мной ключ в инпут в ассоциативном массиве, и если есть вернуть его значение мой код выглядит так:
let a8 = {"b": 17, "e": 22};

function f8() {let out = document.querySelector(".out-8")
let out = document.querySelector(".out-8")

    let input = document.querySelector(".i-8")

    for (let key in a8) {
        input.value += key
        if (input.value.includes(key)) out.innerHTML = a8.b
        if (input.value.includes(key)) out.innerHTML = a8.e
    }

}

я получаю одинаковое значение для каждого ключа

A:
я получаю одинаковое значение для каждого ключа

Какое значение - секрет?

out.innerHTML = Object.keys(a8).includes(input.value)? a8[input.value] : '';


text:
Q: HTML5 appcache in play! framework I am trying to use HTML5 application cache in play! framework to use my app for offline usage. But I am not finding steps to configure application cache manifest in play! framework. I am able to do this in apache tomcat. My requirement is , I will have few html pages with form fields which user should be able to see even play server is down.

A: You should use common HTTP server as a reverse-proxy and... HTTP server than like described in the documentation: Setting up front end HTTP server
It gives you opportunity to run more than one app on the machine at port 80, support for SSL, ability for serving static assets without Play app (that's what you need), load balancer, etc.


text:
Q: $2^n-1 = \sum_{jI am having trouble understanding the following analysis after we arrived to the conclusion:
$2^k - \sum_{j=0}^{j=k-1}2^j = 1$
after arriving to the conclusion, they say, I think to explain that the left side is equal to 1:
"In fact, by induction on $n$ in $2^n-1 = \sum_{j<n}2^j$, in fact, $2^{n+1} - 1 = 2(2^n - 1) + 1 = 1 + \sum_{0<j<n+1}2^j = \sum_{j<n+1}2^j.$"
I am not even sure if the wrote the last part to prove
$2^k - \sum_{j=0}^{j=k-1}2^j = 1$, is it to do that? If it is so, why?
Also, I do not see how we pass from $2(2^n - 1) + 1$ to $1 + \sum_{0<j<n+1}2^j$, and from $1 + \sum_{0<j<n+1}2^j$ to $\sum_{j<n+1}2^j$.
Thank you!

A: Here is my solution by using induction explanation:

*

*For $n=1$, we have $\displaystyle 2^{1}-1=1=\sum_{i=0}^{n-1}{2^{i}}$. So when $n=1$, the equation holds.

*We suppose the equation holds when $n=k$, that is to say $\displaystyle 2^{k}-1=\sum_{i=0}^{k-1}{2^{i}}.$
For $n=k+1$, we have $\displaystyle 2^{k+1}-1=2^{k}+2^{k}-1=2^{k}+\sum_{i=0}^{k-1}{2^{i}}=\sum_{i=0}^{k}{2^{i}}.$
So we can get from 1. and 2. that the statement is true.
Actually, we needn't prove it in a induction explanation way, we can simply add all the number up in the right side by using subtract dislocation method and we can get the answer.

A: Here's a less apocalyptic induction solution.
Let's note for all $n \in \mathbb{N}$, $P(n) : 2^n-1 = \sum_{j<n}2^j$.
$\sum_{j<0}2^j = 0 = 2^0-1$ so $P(0)$ is true.
Let's suppose that $\exists n \in \mathbb{N}$ such as $P(n)$ is true.
So we have $2^n-1 = \sum_{j<n}2^j$.
$\sum_{j<n+1}2^j = 2^n+\sum_{j<n}2^j = 2^n +2^n-1$ according to the recurrence hypothesis.
So $\sum_{j<n+1}2^j = 2^{n+1}-1$ and consequently, $P(n+1)$ is true.
By recurrence over $\mathbb{N}$, $\forall n \in \mathbb{N}$, $P(n)$ is true.
Note : There is a much more straightforward proof : if we define $S_n$ to be $\sum_{j<n}2^j$, $2S_n = 2\sum_{j<n}2^j = \sum_{j<n}2^{j+1} = \sum_{j\in [1,n]}2^j = -1+2^{n}+\sum_{j<{n}}2^j = -1+2^{n}+S_n$.
So $S_n = 2^n-1$.


text:
Q: What is the difference between an iteration and a loop? I am doing Cs50 Harvard University online and I'm on week 3 but while watching the video I noticed that I iterations and loops seem the same, as they repeat things over and over. But there must be a difference or else they wouldn't have two names for the same thing. No matter how many times I re-watch the video I can't find a difference. Please help me understand.

A: "Loop" refers to language constructs that are used to repeatedly execute some code. (for loops, while loops, etc.)
"Loop" can also refer to code being executed repeatedly. (e.g. "It's stuck in a loop.")
Iterating is the process of doing something repeatedly. (e.g. "This loop iterates over the elements of the array.")
An iteration is a single pass of a loop. (e.g. "In the first iteration of that for loop, i will be 0.")

A: Usually "loop" refers to the code and "iteration" refers to the conceptual process of repeating some steps. In this case, they are more or less the same. Additionally, you could use "iteration" to refer to a single repetition within a loop which gives it a different meaning.
A case example for the first usage of "iteration" would be:

You can print a linked list either by using iteration or recursion. If you use iteration, simply create a while-loop that propagates a "current" node through the list and stops when it becomes NULL.

And an example refering to specific repetitions:

The following loop outputs numbers 1 to 10 in reverse order. At the k-th iteration, 10-k+1 is printed:

for (i=10; i>=1; i--){
    printf("%d\n", i);
}

A: That's how I would define it:
"Loop" - A control flow statement that iterates the code in the loop's body dependent upon a provided loop condition. It is a language construct and in C we have three kinds of these constructs: for, while and do-while.
"Iteration" - One specific walkthrough of the code inside of the loop's body after the first walkthrough. In other words, a single repetition of the execution of the loop body's code.
When doing looping/iterating (as verb they can be seen equal indeed), you repeat over the code in the loop's body. Every single repetition is an iteration.
A loop's purpose is the capability to do iterations. Without being able to do iterations the loop construct is useless.
So, both terms are closely related, but not the same.


text:
Q: Mandelbrot set—efficiently iterate over a list of initial points OP edit:  This is a Mathematica-specific question about an approach it attempted for a fractal visualization problem described HERE.  I'm using the Mandelbrot set there and here as an example, but the solutions apply to a broader fractal problem.
I need to apply an iterative function z to a list.
z1[n_, c_] := If[n > 0, z1[n - 1, c]^2 + c, c];
c = {-1, -.5, 0, .5, 1};
z1[7, c]

(* {0, -0.350234, 0, 12005.5, 44127887745906175987802}  *)
It happens that if Abs[z[n, c]] > 2 at n, then all subsequent evaluations are also greater than 2. I only need to know the values of c for which the z series satisfies Abs[z] < 2.
I tried to make my calculation more efficient by defining my function like this:
z2[n_, c_] := NestWhile[(#^2 + c) &, c, Abs[#] <= 2 &, 1, n];

This works great on single values of c:
z2[12, 1]

(* 5 *)
but it just returns the List back to me if c is a List:
z2[12, c]

(* {-1, -0.5, 0, 0.5, 1} *)
How can I fix this?  I don't want to use a loop because I need to process long lists to high iterations values. In the example below, a lot of time is wasted iterating values that already satisfy Abs[z] < 2.
stepSize = .0001;
iter = 46;
c = Flatten[Table[x + I*y, {x, -1.42, -1.39, stepSize}, {y, -.005, .025, stepSize}]];
p = z1[iter, c];
r = Pick[c, Abs[#] <= 2 & /@ p];
ListPlot[Transpose[{Re[r], Im[r]}]]

A: You can do it probably most efficiently in compiled code, if you're not too concerned about precision. Here you can use the listability of compiled functions over tensor arguments.
Your function is basically the Mandelbrot iteration:
mandelbrot = Compile[{{c, _Complex, 0}, {d, _Integer, 0}},
   Block[{i = 0, z = c}, While[Abs[z] < 2.0 && i < d, z = z*z + c; i++]; i],
   RuntimeOptions -> "Speed",
   RuntimeAttributes -> Listable, Parallelization -> True
  ];

AbsoluteTiming[
 result = mandelbrot[
    Outer[Complex, Range[-1.42, -1.39, .0001], Range[-.005, .025, .0001]],
    80
  ];
 ] (* -> 0.219 seconds *)

ArrayPlot[result, Frame -> False, PlotRangePadding -> None, PixelConstrained -> {1, 1}]

If precision is very important, you will not be able to use compiled code, so the best you can do is probably just have to give your function the Listable attribute. This is not particularly efficient; it just uses Thread when the function is called with lists in the arguments.

A: Again I will propose solving the problem by a recursive function.
helper[c0_, c_] :=
  Module[{r = (Abs[#] < 2 & /@ c)}, Pick[#, r] & /@ {c0, c^2 + c0}]
z[n_Integer?Positive, c0_List] := z[n - 1, c0, c0^2 + c0]
z[0, c0_, _] := c0
z[n_, c0_, c_] := z[n - 1, Sequence @@ helper[c0, c]]

With[{stepSize = .0001, n = 46},
  Module[{c0, p},
    c0 =
      Flatten[
        Table[x + I*y,
          {x, -1.42, -1.39, stepSize}, {y, -.005, .025, stepSize}]];
    p = z[n, c0];
    ListPlot[Transpose[{Re[p], Im[p]}]]]]

Note: because z is tail recursive,  Mathematica eliminates the recursion and evaluates it iteratively. So this should be considered an iterative solution as requested.


text:
Q: Side Scrolling Inside HTML Widget So I am making a weather widget for the iPhone and was wondering how to be able to be able to 'scroll' to another page per se. What should I include in order to be able to scroll to the right? How do I make it so I'll be able to scroll sideways? I've already tried doubling the width but nothing happened... Please be as detailed as possible :) Thank you!

<title>Forecast</title>

<link href="css/main.css" rel="stylesheet" type="text/css" />

 <meta name="viewport" content="width=320, height=583, initial-scale=1, maximum-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

A: I made little demo that works in computer browser and mobile too..
DEMO: http://mediakuu.fi/mobile_demo/
Add this to your html header to prevent user resizing your site:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

To make things work smooth and easy:

*

*Use this plugin (hammer.js) http://eightmedia.github.io/hammer.js/ to get user gestures.

*Use this plugin (jquery.transit) http://ricostacruz.com/jquery.transit/ to create smooth movement

Full source:
<!DOCTYPE html>

    <title>MOBILE SCROLL DEMO</title>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

section1

section2

section3

section4


text:
Q: Does fundamental theorem of calculus hold for weakly differentiable function? Does fundamental theorem of calculus hold for weakly differentiable function?
That is $\int^b_a$$f'$=$f(b)-f(b)$ for $f$ being    weakly differentiable??

A: In a sense, yes. Precisely, we have the following result:

Let $I$ be an interval (possibly unbounded) and $f\in W^{1,p}(I)$ with $1 \leq p \leq \infty$. Then there exists a function $\tilde{f}\in C(\overline{I})$ such that $f = \tilde{f}$ a.e. on $I$ and
  $$\int_y^x f'(t)\,dt=\tilde{f}(x)- \tilde{f}(y),\qquad \forall\ x,y\in \overline{I}.$$

Particularly, we can state:

Let $f$ be a function in $L^p(a,b)$ ($1 \leq p \leq \infty$). Assume that $f$ has a weak derivative $f'$ that also belongs to $L^p(a,b)$. Then there exists a function $\tilde{f}\in C([a,b])$ such that $f = \tilde{f}$ a.e. on $(a,b)$ and
  $$\int_a^b f'(t)\,dt=\tilde{f}(b)- \tilde{f}(a).$$

The proof can be found in Brezis book (Theorem 8.2).
Can you figure out why we need $\tilde{f}$ (instead of $f$) in the right hand side of the formula?


text:
Q: Cloudwatch alarm for ec2 launching without specific tags I am trying to set an cloutwatch alarm, if any new ec2 instance without specific tag assigned to it while launching. Checked the cloudwatch metric but seems there is no such alarm pre-exist
thanks

A: You will have to configure the alarm using the Cloudwatch dashboard.


text:
Q: Message returning object HTMLSpanElement in email Whenever i use a contact form on my website, everything is working fine except message. It is returning [object HTMLSpanElement]
Here is my code of mail.js i have created separate files because i am also using this file for error handling.
function submit_form()
{
var letters = /^[A-Za-z]+$/;
var message     =   document.getElementById('subject').value;

$.ajax({
type:'post',
url:'enquiry.php',
data:'name='+name+'&email='+email+'&contactno='+contactno+'&message='+message1,
success:function(data)
{
if(data=="1")
{
//document.getElementById('success').innerHTML="Your message has been sent successfully.";
$('#success').html("Your message has been sent successfully.")

and here is the code of enquiry.php
$name           =   $_POST['name'];
$email          =   $_POST['email'];
$contactno      =   $_POST['contactno'];
$message1       =   $_POST['message'];
$to         =   "emailaddress@email.com";
$subject    =   "Enquiry";
$from       =   "emailaddress@email.com";
$message = "

<title>ENQUIRY</title>

ENQUIRY

Full Name: $name

Email Id: $email

Contact: $contactno

Message : $message1

";

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: <".$from. ">" ;

if(mail($to,$subject,$message,$headers))
{
    echo 1;
}

And here is the html for that
<input type="text" name="contactno" maxlength="10" pattern="[1-9]{1}[0-9]{9}" id="contactno" placeholder="Enter 10 digit Contact Number" class="footer-form1" value="" onchange="removeerr();" required>

<textarea id="subject" name="message" id="subject" placeholder="Write your message here.." class="footer-massage" value="" onchange="removeerr();" required></textarea>

A: When you send the data with:
data:'name='+name+'&email='+email+'&contactno='+contactno+'&message='+message1,

message1 is a reference to the HTML span element with that id. Your message appears to be inside of the textarea element with an id of subject and you are correctly getting that data and storing it, but you are calling your variable message (not message1), so the line that sends the data should be:
data:'name='+name+'&email='+email+'&contactno='+contactno+'&message='+message,


text:
Q: JavaScript ES6 side nav issue when function call I'm building a side nav with JavaScript ES6 and I started with the Supercharged-Show code example. I made a toggle button to replace the show and the hide ones. I try to use my toggleSideNav function to call the showSideNav but nothing happen. I'm probably missing something with the this.
My HTML page looks like this :

    <hc-hamburger role="button" class="js-menu">

    </hc-hamburger>

        Side Nav

One

Two

Three

Four

And my JS file like this :
'use strict';

class SideNav {
  constructor () {
    this.toggleMenuEl = document.querySelector('.js-menu');
    this.showButtonEl = document.querySelector('.js-menu-show');
    this.hideButtonEl = document.querySelector('.js-menu-hide');
    this.sideNavEl = document.querySelector('.js-side-nav');
    this.sideNavContainerEl = document.querySelector('.js-side-nav-container');
    // Control whether the container's children can be focused
    // Set initial state to inert since the drawer is offscreen
    this.detabinator = new Detabinator(this.sideNavContainerEl);
    this.detabinator.inert = true;

    this.toggleSideNav = this.toggleSideNav.bind(this);
    this.showSideNav = this.showSideNav.bind(this);
    this.hideSideNav = this.hideSideNav.bind(this);
    this.blockClicks = this.blockClicks.bind(this);
    this.onTouchStart = this.onTouchStart.bind(this);
    this.onTouchMove = this.onTouchMove.bind(this);
    this.onTouchEnd = this.onTouchEnd.bind(this);
    this.onTransitionEnd = this.onTransitionEnd.bind(this);
    this.update = this.update.bind(this);

    this.startX = 0;
    this.currentX = 0;
    this.touchingSideNav = false;

    this.supportsPassive = undefined;
    this.addEventListeners();
  }

  // apply passive event listening if it's supported
  applyPassive () {
    if (this.supportsPassive !== undefined) {
      return this.supportsPassive ? {passive: true} : false;
    }
    // feature detect
    let isSupported = false;
    try {
      document.addEventListener('test', null, {get passive () {
        isSupported = true;
      }});
    } catch (e) { }
    this.supportsPassive = isSupported;
    return this.applyPassive();
  }

  addEventListeners () {
    this.toggleMenuEl.addEventListener('click', this.toggleSideNav);
    // this.showButtonEl.addEventListener('click', this.showSideNav);
    // this.hideButtonEl.addEventListener('click', this.hideSideNav);
    this.sideNavEl.addEventListener('click', this.hideSideNav);
    this.sideNavContainerEl.addEventListener('click', this.blockClicks);

    this.sideNavEl.addEventListener('touchstart', this.onTouchStart, this.applyPassive());
    this.sideNavEl.addEventListener('touchmove', this.onTouchMove, this.applyPassive());
    this.sideNavEl.addEventListener('touchend', this.onTouchEnd);
  }

  onTouchStart (evt) {
    if (!this.sideNavEl.classList.contains('side-nav--visible'))
      return;

    this.startX = evt.touches[0].pageX;
    this.currentX = this.startX;

    this.touchingSideNav = true;
    requestAnimationFrame(this.update);
  }

  onTouchMove (evt) {
    if (!this.touchingSideNav)
      return;

    this.currentX = evt.touches[0].pageX;
    const translateX = Math.min(0, this.currentX - this.startX);

    if (translateX < 0) {
      evt.preventDefault();
    }
  }

  onTouchEnd (evt) {
    if (!this.touchingSideNav)
      return;

    this.touchingSideNav = false;

    const translateX = Math.min(0, this.currentX - this.startX);
    this.sideNavContainerEl.style.transform = '';

    if (translateX < 0) {
      this.hideSideNav();
    }
  }

  update () {
    if (!this.touchingSideNav)
      return;

    requestAnimationFrame(this.update);

    const translateX = Math.min(0, this.currentX - this.startX);
    this.sideNavContainerEl.style.transform = `translateX(${translateX}px)`;
  }

  blockClicks (evt) {
    evt.stopPropagation();
  }

  onTransitionEnd (evt) {
    this.sideNavEl.classList.remove('side-nav--animatable');
    this.sideNavEl.removeEventListener('transitionend', this.onTransitionEnd);
  }

  showSideNav () {
    console.log('toto');
    this.sideNavEl.classList.add('side-nav--animatable');
    this.sideNavEl.classList.add('side-nav--visible');
    this.detabinator.inert = false;
    this.sideNavEl.addEventListener('transitionend', this.onTransitionEnd);
  }

  hideSideNav () {
    this.sideNavEl.classList.add('side-nav--animatable');
    this.sideNavEl.classList.remove('side-nav--visible');
    this.detabinator.inert = true;
    this.sideNavEl.addEventListener('transitionend', this.onTransitionEnd);
  }

  toggleSideNav () {
    this.showSideNav;
    debugger
  }
}

new SideNav();

I also have an hamburger.js file to animate my hamburger button but I don't think that cause any trouble.
Thank's for the help.

A: You are missing brackets in the method invocation:
toggleSideNav () {
    this.showSideNav;
    debugger // what is that for ?
}

Should be:
toggleSideNav () {
    this.showSideNav();
    debugger // what is that for ?
}


text:
Q: use if-statement to recognize arraylist data in android i want to use condition " if " for my array list
here is my code in (activity 1) to send string in textview with button to static variable that is in (exchange activity) :
    Button btn1 = (Button) findViewById(R.id.btn1);
    final TextView text = (TextView) findViewById(R.id.txt1);

    btn1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            exchange.in =text.getText().toString();

        }
    });

here is my static variable in (exchange activity)
public static String in;

and here is my (activity 2) code that i use array list in it to receive & store string from (activity 1) that is in static variable (exchange.in)
    ListView list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ArrayList<String> web = new ArrayList<String>(10);
        for (int i = 0; i < 10; i++) {
            web.add("");
        }

        CustomList adapter = new
        CustomList(activity_main.this, web);
        list = (ListView) findViewById(R.id.list);
        list.setAdapter(adapter);

    }

now i don't know how to store data from (exchange.in) to arraylist  and then use if condition to recognize that, if arraylist(0) was full, put data that is in (exchange.in) to arraylist(1) and it will continue like this...
is anyone know about this?


text:
Q: Cell with 2 options and I want to add a third So I have this excel file where when I select a particular cell a little box with an upside down triangle appears to the right of the cell.
When I click on this there is a small list of options to select, "Monday" and "Thursday" and whatever option I choose the cell will be filled with that text.
So my question is, how do I add a third option? So if I want to add "Friday" to that list of options how do I go about it.
Thanks!
Also when I click Macros or go into VBA there are no macros shown so I am assuming this spreadsheet is using none.

A: To create or add data validation, Select cell, then go to Data tab, click Data Validation

See Apply data validation to cells


text:
Q: General pip commands with Visual Studio I'm currently trying to get my python project into an executable. I installed pyinstaller via the python environments on Visual studio:

and ran the command via this line:

Despite having found how to install packages using pip in this environment, I have not found how to actually run package commands. For example, I am trying to run the following pip command to generate an executable of my file:

pyinstaller --onefile --windowed database.py

Am I missing something here? Where do I do this?
(ps, I have git bash. Because I installed Python via Visual Studio, I cannot run pip or packages on my general bash shell)


text:
Q: HTML Form Automation Using Ampersand (&) and Dollar Sign ($) Characters So I am trying to automate a basic HTML form I fill out a few times each day.  I am trying to open the web browser with the form completely filled out.  This is often a simple task, as the & character followed by the name of the form element and a value, usually works.  Where this becomes tricky is that my form elements have a placeholder that uses the $ character in its name.  The code is shown below:
 <input name="username" type="text" />
 <input name="ctl00$ContentPlaceHolder1$PasswordTextBox" type="password"
     id="ctl00_ContentPlaceHolder1_PasswordTextBox" />
  <input name="submit" type="submit" value="Click" />

If you look at the name of the password tag you will see the use of the $ character twice.  Normally I could just type my URL into Chrome like the folowing:
 wwww.theWebSite.html&username=myName&ctl00$ContentPlaceHolder1$PasswordTextBox=myPassword
 &submit=Click

The above code would normally work but it doesn't in this case.  I don't know why I am getting the error but I think it is due to the use of the $ character.  All I am trying to do is load my page into the browser with the above form completely filled out.  Any ideas?


text:
Q: How to divide one matrix by another in Stata I have created two matrices with the following commands:
tab year region if x==1, matcell(cases)
tab year region, matcell(total)

Both matrices are 10 columns by 9 rows.
I now want to create a new matrix with percents which
equals:  p = (cases/total)*100
But I cannot find the command to do so in Stata? is there an easy way?

A: We don't have your own data to experiment, so consider this analogue.
We want the first table as a percent of the second table. It is easy to get there directly, as we can just calculate first what we want to show.
. webuse nlsw88, clear
(NLSW, 1988 extract)

. tab race collgrad if married == 1

           |   college graduate
      race | not colle  college g |     Total
-----------+----------------------+----------
     white |       862        288 |     1,150
     black |       224         50 |       274
     other |        12          6 |        18
-----------+----------------------+----------
     Total |     1,098        344 |     1,442

. tab race collgrad

           |   college graduate
      race | not colle  college g |     Total
-----------+----------------------+----------
     white |     1,217        420 |     1,637
     black |       480        103 |       583
     other |        17          9 |        26
-----------+----------------------+----------
     Total |     1,714        532 |     2,246

. egen toshow = mean(100 * (married == 1)), by(race collgrad)

. tabdisp race collgrad, c(toshow) format(%2.1f)

----------------------------------------------
          |          college graduate
     race | not college grad      college grad
----------+-----------------------------------
    white |             70.8              68.6
    black |             46.7              48.5
    other |             70.6              66.7
----------------------------------------------

But let's show how to work with the matrices. Note that what you ask for is not matrix division as usually understood in linear algebra, as the division
is elementwise. The easiest way to do that (now) is to call up Mata.
quietly tab race collgrad if married == 1, matcell(num)
quietly tab race collgrad, matcell(den)
mata : st_matrix("wanted", 100 * st_matrix("num") :/ st_matrix("den"))
mat li wanted

wanted[3,2]
           c1         c2
r1   70.82991  68.571429
r2  46.666667  48.543689
r3  70.588235  66.666667

Note that it's more awkward to do in Stata alone, but perfectly possible with matewd once installed. But Stata fairly tags such programs as "historical" as since Stata 9 Mata has allowed a one-line solution. matewd is included in dm69, even though it is not mentioned in the brief summary.
. search dm69, entry historical

STB-50  dm69  . . . . . . . . . . . . . . . . . .  Further new matrix commands
        (help matdelrc, matewm, matmad, matpow if installed)  . . .  N. J. Cox
        7/99    pp.5--9; STB Reprints Vol 9, pp.29--34
        collection of new matrix commands providing additional matrix
        checking, management, element-wise operators, maximum absolute
        difference, and power


text:
Q: Sharepoint list workflow stuck I have written a Sharepoint workflow that starts automatically when an item is created. It has two stages. The first stage sets a yes/no field to yes. then transitions to stage 3(Got rid of stage 2). The workflow gets stuck in stage 1. Any ideas?

A: The workflow might require the item to be checked out before it can update the yes/no field.
It would helpful to know what version of SharePoint you are running, along with how the workflow was created, (e.g. Designer or Visual Studio)


text:
Q: Want to make a schema for a timetable in mongodb/mongoose for my project and how to model it with the user Now the problem is which data modeling should I use I am confused about embedding or referencing.
My project is about that a faculty can login and each faculty will have its own Time-Table and time-table is looking like this : It is time-table of the faculty now how do I make its schema and how should i model it with the faculty like with embedding or referencing.
Anyone's help is Appericiated.


text:
Q: Inserting Multiple rows in mysql using codeigniter : it inserts only one row and in that one row stores only one first character I tried to insert multiple rows in sql . But it inserts only the last one row and in that one row only storing first character of each column. I prints the query by echo, it shows only one last row, but gives all characters of each column. one more thing is iam inserting values in two tables by clicking on submit button. can anyone help on this.
Here it is the view :
    <form class="" method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>dashboard/addnewjobmela" >

                        <input type="hidden" name="csrfmiddlewaretoken" value="LgVIVf7yFe5bL9k2Rcj9TGLLpgKJX1LkmfiiptEZnN95y9WqKXHk7V4vGixmo6Wd">
                        <input type="hidden" id="cperson_no" value="1">

                            Job Mela Title
                            <input class="form-control" type="text" name="title"  required="" id="title">

                            Job Mela Date
                            <input class="form-control" type="date" name="date"  required="" id="date">

                            Last Date To Register
                            <input class="form-control" type="date" name="laastdatetoregister"  required="" id="laastdatetoregister">

                            Venue Details
                            <textarea class="form-control" name="venuedetails" cols="40" rows="2" required="" id="venuedetails"></textarea>

                            Contact Person
                            <input class="form-control" type="text" name="contactperson"  required="" id="contactperson">

                            Contact Emailid
                            <input class="form-control" type="text" name="emailid"  required="" id="emailid">

                            Contact Number
                            <input class="form-control" type="text" name="contactnumber"  required="" id="contactnumber">

Participating Companies

                        <button class="btn btn-success" type="button" onclick="addingcompanies()">Add More</button>

                            Company Name
                            <input class="form-control" type="text" name="company"  required="" id="company">

                            Job Title
                            <input class="form-control" type="text" name="jobtitle"  required="" id="jobtitle">

                            Required Qualification
                            <?php
                                echo form_dropdown('qualification', $education,'' ,'required="" class="form-control"');
                            ?>

                            Specialization
                            <input class="form-control" type="text" name="specialization"  required="" id="specialization">

                            Sector
                            <input class="form-control" type="text" name="sector"  required="" id="sector">

                            Job Type
                            <?php
                                echo form_dropdown('jobtype', $jobtype,'' ,'required="" class="form-control"');
                            ?>

                            Job Location
                            <input class="form-control" type="text" name="joblocation"  required="" id="joblocation">

                            <button class="btn btn-success" type="submit" value="Save Profile">Submit</button>

                    </form>

Javascript/Jquery to add ADD More Fields

Here it is the controller :
public function addnewjob()
        {

            $this->load->model('dashboard_model');
            $result = $this->dashboard_model->addnewjob();
            $this->session->msg = "New Job Added Successfully";
            redirect('dashboard');

        }
                public function addnewjobmela()
                {

                        $this->load->model('dashboard_model');
                        $result = $this->dashboard_model->addnewjobmela();
                        $this->session->msg = "New Job Mela Added Successfully";
                        redirect('dashboard');

                }

Model :
public function addnewjobmela() {
        $data['title'] = $this->input->post('title');
        $data['date'] = $this->input->post('date');
        $data['lastdate'] = $this->input->post('laastdatetoregister');
        $data['venue'] = $this->input->post('venuedetails');
        $data['contactperson'] = $this->input->post('contactperson');
        $data['emailid'] = $this->input->post('emailid');
        $data['contactnumber'] = $this->input->post('contactnumber');
        $data['status'] = 1;
        $data['id'] = $this->db->insert_id();
        print_r($data);
        $this->db->insert('jobmelas', $data);
        $jobmelaid = $this->db->insert_id();
        $jcdata['company'] = $this->input->post('company');
        $jcdata['jobtitle'] = $this->input->post('jobtitle');
        $jcdata['qualification'] = $this->input->post('qualification');
        $jcdata['specialization'] = $this->input->post('specialization');
        $jcdata['sector'] = $this->input->post('sector');
        $jcdata['jobtype'] = $this->input->post('jobtype');
        $this->insCompanies($jobmelaid, $jcdata);
    }
    public function insCompanies($jobmelaid, $jcdata, $update='') {
            if($update == 'update'){
                $this->db->query('delete from job_mela_companies where jobmelaid = '.$jobmelaid.'');
            }
            print_r($jcdata);
            for ($i = 0; $i < count($jcdata['company']); $i++) {
                $cp_data[] = array(
                    'jobmelaid' => $jobmelaid,
                    'company' => $jcdata['company'][$i],
                    'jobtitle' => $jcdata['jobtitle'][$i],
                    'qualification' => $jcdata['qualification'][$i],
                    'specialization' => $jcdata['specialization'][$i],
                    'jobtype' => $jcdata['jobtype'][$i],
                    'sector' => $jcdata['sector'][$i]
                );

                $this->db->insert('job_mela_companies', $cp_data);
            }
        }

First table is giving result correct but
The output of more fields giving like this:

A: try below array and remove $cp_data[] = array(....) from insCompanies function.
$cp_data = array(
                'jobmelaid' => $jobmelaid,
                'company' => $jcdata['company'][$i],
                'jobtitle' => $jcdata['jobtitle'][$i],
                'qualification' => $jcdata['qualification'][$i],
                'specialization' => $jcdata['specialization'][$i],
                'jobtype' => $jcdata['jobtype'][$i],
                'sector' => $jcdata['sector'][$i]
                );


text:
Q: Parallax effect scrolling for fixed timeline I am trying to create a bootstrap timeline where parallax effect is applied to content only with timeline selected, contents moves with parallax effect.
Thanks in advance.

A: You need to create 2 divs. First one will be your parallax picture, second - all your content. For an any id(for example parallax ) and give next
#parallax {
    position: fixed;
    z-index: -1;
    width: 100%;
    height: 100%;
    padding-left: 0;
    padding-right: 0;
    background-image: url('background-picture.jpg');
    background-size: cover;
}
you will get affect like this https://alexk89.github.io/Portfolio-page/


text:
Q: I can't download images uploaded with "move_uploaded_file()" code on filezilla When I use move_uploaded_file() code everything works fine and my files are being moved to my server. But later if I want to download those files from my server using filezilla, it says:

"Could not start the transfer process"

But I can download other files crate with imagejpeg() code. So what is the problem?

A: Suppose you rename one of the files which does not works for download to test.jpg to test.gif (assuming that jpg are not working).
If it does not work.. Check the permission for read and writes in your control panel for ftp user


text:
Q: Control bluetooth speaker volume with keys and tray icon Asked in order to provide the answer.

In the LXQt desktop (installed on top of Kubuntu 18.04) I use a bluetooth speaker with a laptop which has volume keys that only control the internal speakers. The volume panel applet does the same.
I can only modify/mute the external speaker's volume with pavucontrol.
Is it possible to control bluetooth speaker volume with keyboard and/or a panel button?

A: In fact the default volume widget can control bluetooth speakers: on that, see the last part of the answer.

Short-keys can be assigned to the following commands:

*

*Toggle mute: amixer -q -D pulse sset Master toggle

*Volume up by 5%: amixer -D pulse sset Master 5%+

*Volume down by 5%: amixer -D pulse sset Master 5%-
For a panel/tray button, install qasmixer.
In Debian, Ubuntu: sudo apt install qasmixer.

To have it in system tray, go to File-Settings-System tray and, in case the tray icon doesn't appear, un-check then check again the "Show tray icon" option. Be sure to check also Mini mixer device - Current so that the tray icon actions like mouse scroll act upon the desired device.

Normally it will control volume of all kind of speakers. In case it stops controlling the bluetooth speaker(s), check File-Settings-Startup and View-Show device selection-Mixer device.
Make it start with the system by adding it to startup application list with an argument for start minimized in tray:
/usr/bin/qasmixer -t

Sources here and here.

And in fact the panel volume widget can control the bluetooth speaker volume, in two ways:

*

*Right click the panel widget and select Configure...

There, you can switch between the internal or other speakers controlled by the widget. In the same window you can set the external mixer that will be used below. Normally that is pavucontrol-qt, but there is also qasmixer.

*

*Left click the panel widget and select "Mixer"

The mixer allows to change the bluetooth speaker volume.


text:
Q: Using Stirling's Formula I am trying to use Stirling's formula to show that
$${{2n} \choose {n}} \cdot .5^n \cdot .5^{2n-n} \approx \frac{1}{\sqrt{\pi n}}$$
Stirling's Formula is $n!=n^ne^{-n}\sqrt{2\pi n}$
I have attempted the below and am having a hard time showing this.
$${{2n} \choose {n}} \cdot .5^n \cdot .5^{2n-n}=$$
$$\frac{2n!}{n!(2n-n)!} \cdot .5^n \cdot .5^{n}=$$
$$\frac{2n!}{(n!)^2}\cdot .5^n \cdot.5^n=$$
$$\frac{2}{n!}\cdot .5^n \cdot.5^n = $$
Here I substitute in for the formula
$$\frac{2}{n^ne^{-n}\sqrt{2\pi n}}\cdot .5^n \cdot.5^n =$$
$$\sqrt{\frac{2}{\pi}}e^nn^{-n-\frac{1}{2}}\cdot .5^n \cdot.5^n$$
I do not think this equals what I am trying to show and I do not know where to go from here.

A: It is
$\dfrac{(2n)!}{n!n!}$,
not
$\dfrac{2(n)!}{n!n!}$.


text:
Q: [Android]action another app I use Htc's phone.
My phone's lock screen can show the icons which are added in my main screen's bottom bar.
The bar allow me add app and shortcut.
If I type the password to unlock my phone,it took me 10 second.
So I have a thinking:
I write a app to create a shortcut and the shortcut can broadcast to the record app to start record.
{
    Intent shortCutContain =new Intent("example.app.REC");
    shortCutContain.setClassName("example.app",  "example.app.AudioService");
    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortCutContain);
}
this is what I do......but it failed
Please help me

A: Here's the code to start the recorder:
Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(intent, RQS_RECORDING);

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if(requestCode == RQS_RECORDING){
savedUri = data.getData();
Toast.makeText(AndroidIntentAudioRecording.this,"Saved: " + savedUri.getPath(),
Toast.LENGTH_LONG).show();
 }
}

Put this code on your onCreate() if you want to launch the recorder automatically.