text:
Q: how to make  scrollable? I am using <display:table> tag to display table in jsp page.
now i can navigate records using page numbers.
Now i want display all records in single page but with scrolling.(no pagination)
this table is set as a part of page so like only one div can be scrollable.rest of page should be as it is.
Please suggest..!

A: Try to put your table in the div tag then edit the css file:

    <display:table cellpadding="5" cellspacing="1" name="myList" class="dataTable">
        <display:column class="colId" property="id" title="ID" />
        <display:column class="colName" property="name" />
        <display:column class="colEmail" property="email" />
        <display:column class="colStatus" property="status" />
        <display:column class="colComments" property="description" title="Comments" />
    </display:table>

For example, the div tag is displayTableFrame. Then css:
.displayTableFrame {
    background-color: green;
    overflow-x: scroll;
    height: 320px
    width: 100%;
}

give it a fixed heigth then overflow-x: scroll.
Try and let us know.
Update:
Thanks to Jaimon and his magical codes, the solution for fixed header can be found here:
Jaimon's Blog
I have tested and it works smoothly with IE8 and FF14.
Good luck Ruchi!
Best regards,
Khanh Tran

A: Try with this!!!
$(document).ready(
        function()  {
            scrolify($('#idOfDisplayTable'), 100); // 100 = HEIGHT
        }
    );

    function scrolify(tblAsJQueryObject, height){
        var oTbl = tblAsJQueryObject;
        var oTblDiv = $("
");
        oTblDiv.css('height', height);
        oTblDiv.css('overflow-y','scroll');
        oTbl.wrap(oTblDiv);

        // save original width
        oTbl.attr("data-item-original-width", oTbl.width());
        oTbl.find('thead tr td').each(function(){
            $(this).attr("data-item-original-width",$(this).width());
        });
        oTbl.find('tbody tr:eq(0) td').each(function(){
            $(this).attr("data-item-original-width",$(this).width());
        });

        // clone the original table
        var newTbl = oTbl.clone();
        oTbl.parent().parent().prepend(newTbl);
        newTbl.wrap("
");

        // remove table header from original table
        oTbl.find('thead tr').remove();
        // remove table body from new table
        newTbl.find('tbody tr').remove();

        // replace ORIGINAL COLUMN width
        newTbl.width(newTbl.attr('data-item-original-width'));
        newTbl.find('thead tr td').each(function(){
            $(this).width($(this).attr("data-item-original-width"));
        });
        oTbl.width(oTbl.attr('data-item-original-width'));
        oTbl.find('tbody tr:eq(0) td').each(function(){
            $(this).width($(this).attr("data-item-original-width"));
        });
    }

A: @Sweety
As I have answered to vary similar question already, I am going to pass you the example I have made for that answer.
The main thing is for you to define div outside table data. Something like this:

               <display:table name="CustomerList" export="true" id="customerList" class="dataTable" defaultorder="ascending" cellspacing="1" requestURI="" frame="true" decorator="org.displaytag.decorator.TotalTableDecorator">
                 <display:setProperty name="export.pdf.filename" value="OverallOverdue.pdf" />
                 <display:setProperty name="export.excel.filename" value="OverallOverdue.xls" />
                 <display:setProperty name="export.csv" value="true" />
                 <display:setProperty name="export.csv.filename" value="OverallOverdue.csv" />
                 <display:setProperty name="export.xml" value="true" />
                 <display:setProperty name="export.xml.filename" value="OverallOverdue.xml" />
                 <display:setProperty name="paging.banner.placement">top</display:setProperty>
                 .........
                 </display:table>

  This is not scroll-able. It will stay in position

Then you could position the div and do with it separately from the table (or any other div, as a matter of a fact)
You can just try and see how this is working on a live example here: http://jsfiddle.net/LQJY5/2/

A: Place it in your JSP Javascript code
if(navigator.appName == 'Microsoft Internet Explorer')
{
document.write('<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/pages/styles/locked-column.css" />');
}
else
{
document.write('<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/pages/styles/displaytagex.css" />');
}

and make a locked-column.css class as
div#tbl-container {
width: 400px;
/ default value will be overrided by minimum of table width or screen resolution/
height: 300px;
overflow: auto;
/
scrollbar-base-color: #ffeaff;

/
}
.dataTable { /table-layout: fixed; /
border-collapse: collapse;
/ background-color: WhiteSmoke; /
}
.dataTable th {
top: expression(document . getElementById("tbl-container") . scrollTop-2
); / IE5+ only /
z-index: 20;
font-size: small;
padding: 3px 3px 3px 3px !important;
text-align: center;
position: relative;
cursor: default;
font-family: sans-serif;
font-size: small;
font-weight: bold;
background-color: rgb(46, 54, 64);
color: #FFFFF;
}
.dataTable thead tr {
position: relative;
height: 10px;
background-color: #7CA4E0;
}
.dataTable th a:link,th a:visited {
color: #FFFFFF;
text-decoration: none;
font-family: sans-serif;
font-weight: normal;
}
.dataTable a:hover {
color: #FFFFFF;
text-decoration: none;
font-family: sans-serif;
font-weight: bold;
}
.dataTable thead th.sorted A {
font-weight: bolder;
}
.dataTable td {
padding: 3px 3px 3px 3px !important;
}
.dataTable tbody tr {
height: auto;
white-space: nowrap;
}
.dataTable tbody tr.odd {
background-color: #eee;
font-size: x-small;
}
.dataTable tbody tr.tableRowEven,tr.even {
background-color: #ddd
font-size: x-small;
}
.dataTable tbody tr td:last-child { / padding-right: 20px; /
}
/these styles have nothing to do with the locked column/
.dataTable body {
background-color: white;
color: black;
font-family: sans-serif;
}
.dataTable tbody td {
padding: 2px 4px 2px 4px !important;
font-family: sans-serif;
font-size: x-small;
}
.exportlinks {
font-family: sans-serif;
}
/ style sheet to display light blue color for a mouse on row over event /
.dataTable tr.rowMouseOver {
color: white;
background-repeat: repeat-x;
background-color: rgb(228, 59, 47); /#8888FF;/
}
.dataTable .order1 {
background-position: right 50%;
background-image: url('../Images/arrow_up.gif');
background-repeat: no-repeat;
font-weight: bold;
}
.dataTable .order2 {
background-position: right 50%;
background-image: url('../Images/arrow_down.gif');
background-repeat: no-repeat;
font-weight: bold;
}
span.export {
padding: 0 4px 1px 20px;
font-size: x-small;
text-align: center;
}
span.excel {
background-image: url('../Images/ico_file_excel.png');
background-repeat: no-repeat;
width: 16px;
}
span.csv {
background-image: url('../Images/ico_file_csv.png');
background-repeat: no-repeat;
width: 16px;
}
span.xml {
background-image: url('../Images/ico_file_xml.png');
background-repeat: no-repeat;
width: 16px;
}
span.first {
background-image: url('../Images/first.jpg');
background-repeat: no-repeat;
width: 16px;
}
span.last {
background-image: url('../Images/last.jpg');
background-repeat: no-repeat;
width: 16px;
}
span.pdf {
background-image: url('../Images/ico_file_pdf.png');
background-repeat: no-repeat;
width: 16px;
}
span.rtf {
background-image: url('../Images/ico_file_rtf.png');
background-repeat: no-repeat;
width: 16px;
}
.rightAlignedPadded {
text-align: right;
padding-right: 10px;
}

and antoher css as displaytagex.css, contains
input.displayTableFirst {
background-image: url('../Images/first.jpg');
background-repeat: no-repeat;
border: 0px;
width: 27px;
height: 24px;
}
input.displayTableNext {
background-image: url(../Images/next.jpg);
background-repeat: no-repeat;
border: 0px;
width: 27px;
height: 24px;
border: 10px;
}
input.displayTablePrevious {
background-image: url(../Images/previous.jpg);
background-repeat: no-repeat;
border: 0px;
width: 27px;
height: 24px;
border: 10px;
}
input.displayTableLast {
background-image: url(../Images/last.jpg);
background-repeat: no-repeat;
border: 0px;
width: 27px;
height: 24px;
border: 10px;
}
.displayPageButtonSimple {
background: #AEAFAD;
font-family: "Times New Roman", Times, serif;
font-size: small;
color: black;
}
.displayPageButton {
background: #AEAFAD;
font-family: "Times New Roman", Times, serif;
font-size: small;
width: 70px;
color: black;
}
overlay {
background-image: url(../Images/blackDot.png);
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
}
.displayTableFrame {
background-color: white;
height: 320px;
width: 100%;
}
.dataTable {
text-decoration: none;
border: 1px solid #CCC;
/
width: 98%; /
}
.dataTable th {
font-family: sans-serif;
font-size: small;
font-weight: bold;
padding: 3px 3px 3px 3px !important;
background-color: rgb(46, 54, 64);
color: #FFFFF;
}
.dataTable td {
padding: 3px 3px 3px 3px !important;
}
.dataTable thead tr {
position: relative;
height: 10px;
}
.dataTable th a:link,th a:visited {
color: #FFFFFF;
text-decoration: none;
font-family: sans-serif;
font-weight: normal;
}
.dataTable a:hover {
color: #FFFFFF;
text-decoration: none;
font-family: sans-serif;
font-weight: bold;
}
.dataTable thead th.sorted A {
font-weight: bolder;
}
.dataTable tbody {
width: 400px;
height: 230px;
overflow-x: hidden;
overflow-y: auto;
}
.dataTable tbody tr {
height: auto;
white-space: nowrap;
}
.dataTable tbody tr.odd {
background-color: #eee
}
.dataTable tbody tr.tableRowEven,tr.even {
background-color: #ddd
}
.dataTable tbody tr td:last-child {
padding-right: 20px;
}
.dataTable tbody td {
padding: 2px 4px 2px 4px !important;
font-family: sans-serif;
font-size: small;
}
.exportlinks {
font-family: sans-serif;
}
/ style sheet to display light blue color for a mouse on row over event /
.dataTable tr.rowMouseOver {
color: white;
background-repeat: repeat-x;
background-color: rgb(228, 59, 47); / #7CA4E0; /
}
.dataTable .order1 {
background-position: right 50%;
background-image: url('../Images/arrow_up.gif');
background-repeat: no-repeat;
font-weight: bold;
}
.dataTable .order2 {
background-position: right 50%;
background-image: url('../Images/arrow_down.gif');
background-repeat: no-repeat;
font-weight: bold;
}
.defaultDataTable {
background-color: white;
border: 1px solid #000066;
font-size: xx-small;
margin: 5px;
font: bold normal normal xx-small "Arial Black";
}
.defaultDataTable th {
border-right: 1px solid #c8c8ff;
padding-left: 2px;
padding-right: 12px;
font-family: arial, helvetica, sans-serif;
font-weight: bold;
color: black;
background-color: #AEAFAD;
margin-right: 10px;
white-space: nowrap;
}
.defaultDataTable td {
font-family: verdana, arial, helvetica, sans-serif;
padding-left: 2px;
}
.defaultDataTable tr.total td {
white-space: nowrap;
vertical-align: top;
font-weight: bold;
border-top: 1px solid black;
padding-bottom: 10px;
}
.defaultDataTable tr.total td.customer {
visibility: hidden;
}
.defaultDataTable td.hidden {
display: none;
}
.defaultDataTable th.hidden {
display: none;
}
.defaultDataTable th.r {
text-align: right;
padding-right: 10px;
}
.defaultDataTable th.c {
text-align: center;
}
.defaultDataTable td.r {
text-align: right;
padding-right: 10px;
}
.defaultDataTable td.c {
text-align: center;
}
.defaultDataTable tr.odd {
background-color: #eee
}
.defaultDataTable tr.even {
background-color: #ddd;
}
.defaultDataTable th a {
text-align: left;
color: black;
}
.defaultDataTable .order1 {
background-position: right 50%;
background-image: url('../Images/arrow_up.gif');
background-repeat: no-repeat
}
.defaultDataTable .order2 {
background-position: right 50%;
background-image: url('../Images/arrow_down.gif');
background-repeat: no-repeat
}
span.export {
padding: 0 4px 1px 20px;
font-size: x-small;
text-align: center;
}
span.excel {
background-image: url('../Images/ico_file_excel.png');
background-repeat: no-repeat;
width: 16px;
}
span.csv {
background-image: url('../Images/ico_file_csv.png');
background-repeat: no-repeat;
width: 16px;
}
span.xml {
background-image: url('../Images/ico_file_xml.png');
background-repeat: no-repeat;
width: 16px;
}
span.first {
background-image: url('../Images/first.jpg');
background-repeat: no-repeat;
width: 16px;
}
span.last {
background-image: url('../Images/last.jpg');
background-repeat: no-repeat;
width: 16px;
}
span.pdf {
background-image: url('../Images/ico_file_pdf.png');
background-repeat: no-repeat;
width: 16px;
}
span.rtf {
background-image: url('../Images/ico_file_rtf.png');
background-repeat: no-repeat;
width: 16px;
}
.pageHeader {
height: 60px;
background-image: url('../Images/header.gif');
background-repeat: repeat-x
}
.pageHeaderText {
font-size: 30px;
margin-left: 5px;
color: black;
font-family: "century gothic", verdana, arial, helvetica, sans-serif;
font-weight: bold;
text-align: left;
display: inline;
white-space: nowrap;
}
.content {
width: 50%;
padding: 10px;
}
.rightColumn {
width: 3px;
}
.customer {
width: 10%;
text-align: left;
}
.company {
width: 10%;
text-align: left;
}
.email {
width: 14%;
text-align: left;
}
.broker {
width: 10%;
text-align: right;
}
.company {
width: 10%;
text-align: left;
}
.fmv {
width: 13%;
text-align: left;
}
.country {
width: 12%;
text-align: left;
}
.tax {
width: 14%;
text-align: left;
}
.size9 {
width: 9%;
text-align: left;
}
.hideColumn {
display: none;
}
.so {
width: 10%;
text-align: left;
}
.type {
width: 10%;
text-align: left;
}
.fmv {
width: 20%;
text-align: left;
}
.plan {
width: 13%;
text-align: left;
}
.eid {
width: 15%;
text-align: left;
}
.orderNumber {
width: 10%;
text-align: left;
}
.orderDate {
text-align: left;
width: 14%;
}
.productName {
width: 25%;
}
.size35 {
width: 35%;
text-align: left;
}
.quantity {
text-align: center;
width: 10%;
}
.rightAlignedPadded {
text-align: right;
padding-right: 10px;
}
.logo {
border-top: 1px solid #000066;
border-left: 1px solid #000066;
border-bottom: 1px solid #000066;
display: inline;
text-align: right;
}
.code {
font-family: verdana, arial, helvetica, "courier new", monospace;
font-size: xx-small;
}
.borderedInline {
display: inline;
border: 1px solid black;
}
img {
border: 0px;
}
.pagelinks {
color: #999999;
margin: 5px;
}
.pagelinks img {
vertical-align: middle;
}

and make a jsp like

   <display:table name="sessionScope.participantList" export="true" id="tmpId" class="dataTable" defaultorder="ascending" cellspacing="1" >
   <display:setProperty name="decorator.media.html" value="displaytag.sample.decorators.MyHtmlTotalWrapper" />
    <display:setProperty name="export.pdf.decorator" value="displaytag.sample.decorators.MyITextTotalWrapper" />
    <display:setProperty name="export.pdf.filename" value="ParticipantProfile.pdf"
/>
    <display:setProperty name="export.rtf.decorator" value="displaytag.sample.decorators.MyITextTotalWrapper" />
    <display:setProperty name="export.rtf.filename" value="ParticipantProfile.rtf"
/>
    <display:setProperty name="export.excel.filename" value="ParticipantProfile.xls"
/>
    <display:setProperty name="export.csv" value="true" />
    <display:setProperty name="export.csv.filename" value="ParticipantProfile.csv"
/>
    <display:setProperty name="export.xml" value="true" />
    <display:setProperty name="export.xml.filename" value="ParticipantProfile.xml"
/>
    <display:setProperty name="paging.banner.placement">top</display:setProperty>
    <display:column title="" >
    </display:column>

    </display:table>


text:
Q: entity framework dbset which models? Using entity framework 6 and mvc 5, assuming I have the following models:
class Employee
{
   public int EmployeeID { get; set; }
   public String Name { get; set; }
   public Department Department { get; set; }
}

class Department
{
   public int DepartmentID { get; set; }
   public String DepartmentName { get; set; }
   public int FloorNumber { get; set; }
}

In my DbContext class where the DbSet goes, do I do DbSet<Employee> only or do I also have to do DbSet<Department>? Right now I'm only doing DbSet<Employee> because the way I understand it, the main model is Employee which has a complex type Department inside, so theoretically if Employee loads then Department should load passively (load as in create a table)?
Currently, I have Department as a virtual field for lazy loading because when I try to access it without the virtual attribute I get a null pointer exception.
Also, my model is a little more complex than this with multiple complex objects, do each of these need their own DbSet?
Thank you

A: According to the documentation (emphasis is mine):

Type Discovery
<snip>
In the following example, there is only one DbSet property defined on
  the SchoolEntities class (Departments). Code First uses this property
  to discover and pull in any referenced types.

However, if you ever wish to manipulate lists of Employees independent from your Department, then you should include it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Xcode test : clean up code, even when stopped I am running some xcode test (with XCTest/XCUITest).
I need some clean up to be performed at the end of each test, even when the test is stopped manually (via the square stop button in xcode).
Unfortunately in that case, the tearDownWithError is not called.
How can I write a piece of code that I am guaranteed will always run, even when the test is manually stopped?

A: Have you already tried to override tearDown()? I think it will help

A: You most likely can't. The stop button basically sends SIGKILL to the running test suite. While you could maybe try installing a signal handler to intercept SIGKILL and do the cleanup, I expect this would be difficult to do reliably.
It would probably be more fruitful to focus your energy on re-designing the test suite to be resilient in the face of a missed cleanup. What exactly do you need to do in the clean up?


text:
Q: Limit of complex hyperbolic tan For the hyperbolic tan function, we have the property
$\displaystyle \lim_{a \to \infty} \tanh(a(z-b)) = \mathrm{signum}(z-b)$
where $z$, $a$ and $b$ are real.
But what happens if $b$ is complex (say, $b=b_1+ib_2$)? Does the above relation still hold and how can we prove it?

A: Using the angle-addition formula
$$\tanh{(A+B)} = \frac{\tanh{A}+\tanh{B}}{1+\tanh{A}\tanh{B}} = \frac{\sinh{A}\cosh{B}+\sinh{B}\cosh{A}}{\cosh{A}\cosh{B}+\sinh{A}\sinh{B}}, $$
we can expand the hyperbolic tangent. The real part of $b$ makes no difference, because we can just set $x=z-b_1$ to remove it, so suppose $b=ic$. Then
$$ \tanh{a(x-ic)} = \frac{\sinh{ax}\cosh{(-iac)}+\sinh{(-iac)}\cosh{ax}}{\cosh{ax}\cosh{(-iac)}+\sinh{ax}\sinh{(-iac)}}, $$
and $\sinh{(-iz)}=i\sin{z}$, $\cosh{(-iz)}=\cos{z}$, so we have
$$ \tanh{a(x-ic)} = \frac{\sinh{ax}\cos{ac}+i\sin{ac}\cosh{ax}}{\cosh{ax}\cos{ac}+i\sinh{ax}\sin{ac}}, $$
Multiplying this by $1$ in the form $(\cosh{ax}\cos{ac}-i\sinh{ax}\sin{ac})/(\cosh{ax}\cos{ac}-i\sinh{ax}\sin{ac})$, and then using the Pythagorean and double-angle formulae, we find eventually that
$$ \tanh{a(x-ic)} = \frac{\sinh{2az}-i\sin{2ac}}{\cosh{2az}+\cos{2ac}}. $$
Here, we know that the trigonometric terms are bounded by $1$, so the limiting behaviour is dominated by the limit of $\sinh{2az}/\cosh{2az}=\tanh{2az}$, which tends to $\sgn{(z)}$ as $a\to +\infty$. So the answer is yes, the formula is valid for complex $b$.


text:
Q: ipfw on Mac OS X 10.8 I'm trying to setup local transparent proxy with ipfw and squid and ran into some problems. I have a single rule 00100 fwd 127.0.0.1,3128 log tcp from any to any dst-port 80 but it either gets into infinite loop or doesn't work for some other reason. There's a ipfw: 100 Forward to 127.0.0.1:3128 TCP 172.17.244.135:56788 74.125.232.0:80 out via en0 message in system.log when I curl something but nc listening on port 3128 doesn't receive anything. Any ideas?

A: If squid is running on the same machine you will have an infinite loop I guess as the request from squid will trigger from any to any dst-port 80 again. I don't think you would be able to devise a rule that ignores traffic from specific programs, unless you start using multiple routing tables (fib's in FreeBSD parlance).
I suggest you look at configuring a proxy in your software by setting environment variables like HTTP_PROXY for curl, wget, fetch, etc. and configuring the proxy in your browser.


text:
Q: C# How to create a zip file from 3 directory contents pseudo code:
c:\temp\Backup.zip = (c:\Temp\Config*.* , c:\Temp\Data*., c:\Temp\scripts*.)
Thanks in Advance!

A: Try DotNetZip library. DotNetZip
Here is a very simple example:
ZipFile zipFile = new ZipFile();
zipFile.AddFile("{path}/file.txt");
zipFile.Save("{path}/filename.zip");
zipFile.Dispose();

For doing this with files in a directory you can use
string [] files = Directory.GetFiles("directoryPath", "*.txt");

And add to zipFile instance each file in the array. Notice: Second parameter in Directory.GetFiles function is the search pattern


text:
Q: Is it valid/acceptable to define an instance method named 'new' in Ruby? When I do the following in irb I get this output:
>> class TestMe
>>   def new
>>     puts 'hi!'
>>   end
>> end
=> nil
>> TestMe.new.new
hi!

Additionally:
>> class TestMe
>> end
=> nil
>> TestMe.new.new
NoMethodError: undefined method `new' for #<TestMe:0x00000101038750>

But when I'm writing some code in my text editor of choice that is calling an instance method named new (but is not the Object method new that instantiates new objects) it highlights new as if it were a reserved keyword:
@page = current_user.locations.new

Note that locations here returns a delegator class that does some heavy lifting (via this new method) and eventually does return a Location.new instance with some basic setup data ready to go, but new is not itself being called on a class object.  Is this an acceptable use of the method name or will I run into issues with it?

A: The first call to .new will invoke the constructor, and return an instance of your class. The second call to .new will invoke an instance method on that object. It's completely acceptable to define a new instance method.
In order to interfere with the constructor, you would have to define a class-level method called new. That method can invoke super#new (which invokes Class#new) to perform the actual creation of the object:
class Test
  def self.new
    puts "hi!"
    super
  end
end

x = Test.new # outputs "hi"

It's completely valid to overwrite new at both an instance and class level, so long as you define your custom new method to do something sane.


text:
Q: Show that $\int_{-\pi}^\pi ~f(x) \cos (nx) \mathrm{d}\mu(x)$ converges to $0$ I need some help on the following problem.

Let $f\in L_1([-\pi,\pi])$. Then $\int_{-\pi}^\pi ~f(x) \cos (nx) \mathrm{d}\mu(x) \to 0$, where $\mu$ is the Lebesgue measure on $[\pi,\pi]$.

Any hints and suggestions on how to begin is very much welcomed. Thanks.

A: First, let's examine the functions $C_n(x)=\cos (nx)$.  For large  $n$, the graph of this function consists of many cosine waves of small common period. If you integrate this function over $[-\pi,\pi]$, you'll, of course, obtain 0.
Now if $I$ is any interval in $[-\pi,\pi]$, for $n$ big, the graph of $C_n$ over $I$   will consist of  many cosine waves of small common period together with a portion  of a cosine wave near each endpoint  of $I$. Here, $\int_I C_n$ will  be the same as integrating $C_n$ just "near the endpoints" of $I$ (the middle portion will integrate to 0). But as $n$ grows large, the measure of those portions gets small, and as a result,
$\lim\limits_{n\rightarrow\infty} \int_I C_n =0$.
Thus, for any interval $I$ and for any number $a$, we have
$$\lim_{n\rightarrow\infty} \int_I a\cdot C_n =0.$$
Using the above result and linearity of integration, we can show  that if $g$ is a function of the form $$g(x)=\sum_{i=1}^n a_i \chi_{I_i},{\text{ where } }\ I_j\cap I_k\ \buildrel{j\ne k}\over=\ \emptyset{\text{ and }}\bigcup_{i=1}^n I_i=[-\pi,\pi],$$
then
$$\lim_{n\rightarrow\infty} \int_{[-\pi,\pi]} g C_n =0.$$
Thus, the theorem is true for any step function in $L_1$.
The general result follows from the fact that the step functions are dense in $L_1$ (that is, given $f\in L_1$ and $\epsilon>0$, there is a step function $g$ with $\Vert f-g\Vert_{L_1}<\epsilon$).
I can provide more details here if you like, just let me know.

A: This statement is true for any $f\in C^1([-\pi,\pi])$. Note that $C^1([-\pi,\pi])$ is dense in $L_1([-\pi,\pi])$ hence equality holds for all $f\in L_1([-\pi,\pi])$


text:
Q: merge origin/master not behaving as expected My understanding of using origin as part of a path in git is that you are dealing with the server version of the code; as a result (conflicts, etc aside), I would expect the following two sets of commands to behave in the same manner (assume my branch in mytestbranch, and starting with that branch checked out):
git checkout master
git pull
git checkout mytestbranch
git merge master

And the more terse:
git merge origin/master

However, it would appear that origin/master doesn't always get the latest version from the server.  Am I misunderstanding what this is intended to do?

A: origin/<branch> merely contains the remote content since the last time you've fetched from it.
git pull is the same as a git fetch + git merge origin/<branch> (technically, git merge FETCH_HEAD, see here):
git fetch will bring your remote branches up to date and git merge origin/master will merge the changes just fetched to your local branch (I assume here that' you have remote tracking branches set up).
The key here is that only when you do a git fetch or git push (or git pull, as just explained), your repository will connect to a remote. All other operations are performed locally.
Another small difference between your two examples is that git merge origin/master on some branch different than master will merge in the latest fetched changes of remote master to that branch, but it won't update your local master (you can only update a local branch when it's currently checked out).
By the way, a nice website to learn about remotes and remote branches "graphically" is https://learngitbranching.js.org/?NODEMO. The official git documentation contains a more thorough explanation.

A: origin/master is a remote-tracking branch.
Its job is to track the state of the remote branch, even offline. Which means that each time you want to sync between the real remote branch and the image you use to represent it (the remote-tracking branch in question, origin/master), you have to explicitly do it with
git fetch

Then, git will send a request to your remote for an updated version of all branches (if any are updated or new). (check doc)


text: Q: Mersenne semiprimes with square indices A Mersenne semiprime is a semiprime of the form $2^n-1$, it can be shown that $2^n-1$ can be a semiprime if and only if $n$ is either a prime or a square of a prime. There are plenty  Mersenne semiprimes with prime indices $n$, but Mersenne semiprimes with square indices are very rare, only three are known to date: $2^4-1,  2^9-1,$  and $2^{49}-1.$ So where is the next square index $n$?


text:
Q: Should use Kafka Schema Registry server When I used Schema registry server, I found I could not change schema in the same topic anymore. but without schema registry each record has it's own schema inside, so it's easy to change schema anytime.
So how can I change the schema when I'm using schema registry server.

A: You can change schemas stored in the Confluent Schema Registry, it's just that the default config enforces backward compatibility. You can change that compatibility config using the following parameter:
avro.compatibility.level

The Avro compatibility type. Valid values are:

*

*none (new schema can be any valid Avro schema),

*backward (new schema can read data produced by latest registered schema),

*backward_transitive (new schema can read data produced by all previously registered schemas),

*forward (latest registered schema can read data produced by the new schema),

*forward_transitive (all previously registered schemas can read data produced by the new schema),

*full (new schema is backward and forward compatible with latest registered schema),

*full_transitive (new schema is backward and forward compatible with all previously registered schemas)
Type: string Default: "backward" Importance: high


text:
Q: Issue in reading Gzip file in C# With below method I am trying to read a .gz file but I am getting error as "Stream does not support reading. (Parameter 'stream')". I have no clue about this error and would like to know what this mean here and if possible any suggestion on fixing it. File is of this format test1.csv.gz and The error is returned at line using(var unzipper....
public async Task<string> ReadStream(string containerName, string digestFileName,string fileName, string connectionString)
{
    string data = string.Empty;
    string fileExtension = Path.GetExtension(fileName);
    MemoryStream contents = await DownloadBlob(containerName, digestFileName, connectionString);
    if (fileExtension == ".gz")
    {
        using (var unzipper = new GZipStream(contents, CompressionMode.Decompress))
        using (StreamReader reader = new StreamReader(unzipper, Encoding.UTF8))
        {
            data = reader.ReadToEnd();
        }
    }
    else
    {
       data = Encoding.UTF8.GetString(contents.ToArray());
    }
    return data;
}

DownloadBlob:
public async Task<MemoryStream> DownloadBlob(string containerName, string fileName, string connectionString)
{
    MemoryStream memoryStream = new MemoryStream();
    Microsoft.Azure.Storage.CloudStorageAccount storageAccount = Microsoft.Azure.Storage.CloudStorageAccount.Parse(connectionString);
    CloudBlobClient serviceClient = storageAccount.CreateCloudBlobClient();
    CloudBlobContainer container = serviceClient.GetContainerReference(containerName);
    CloudBlockBlob blob = container.GetBlockBlobReference(fileName);
    if (blob.Exists())
        using (memoryStream = new MemoryStream())
        {
            await blob.DownloadToStreamAsync(memoryStream);
        }
    return memoryStream;
}

A: With your using statement, you dispose the stream.
Don't do that there, the caller should do that.

A: Your DownloadBlob method returns a MemoryStream, but it puts that MemoryStream in a using statement, which disposes the MemoryStream.
Once a MemoryStream has been disposed, you can't (really) continue to use in. In particular, GzipStream will throw an exception if you ask it to decompress from a stream which has been disposed.
You should remove that using statement: you shouldn't be disposing the MemoryStream. In fact, you end up creating two MemoryStream instances, which is pointless.
You'll also find that you need to rewind the MemoryStream before you can read it again, which you do by setting its Position = 0.
public async Task<MemoryStream> DownloadBlob(string containerName, string fileName, string connectionString)
{
    MemoryStream memoryStream = new MemoryStream();

    Microsoft.Azure.Storage.CloudStorageAccount storageAccount = Microsoft.Azure.Storage.CloudStorageAccount.Parse(connectionString);
    CloudBlobClient serviceClient = storageAccount.CreateCloudBlobClient();
    CloudBlobContainer container = serviceClient.GetContainerReference(containerName);
    CloudBlockBlob blob = container.GetBlockBlobReference(fileName);
    if (blob.Exists())
    {
        await blob.DownloadToStreamAsync(memoryStream);
    }

    memoryStream.Position = 0;
    return memoryStream;
}

However, think carefully about what should happen if blob.Exists() returns false. At the moment you'll return a MemoryStream which doesn't contain anything, and so trying to decompress it will fail. You probably want to throw an exception in this case, and handle that exception further up the call stack.


text:
Q: How to check if file is in use in c#? How can I check if the excel file on which I am working (manipulating its data, deleting it or overwriting it) is in use by another program? And how to release it from the same?
Please guide me using C#.

A: Attempt to open in with flags "for writing". If it fails, the file is "taken" by some other process.
FileStream fileStream = null;

try
{
    fileStream =
        new FileStream(@"c:\file.txt", FileMode.Open, FileAccess.Write);
}
catch (UnauthorizedAccessException e)
{
    // The access requested is not permitted by the operating system
    // for the specified path, such as when access is Write or ReadWrite
    // and the file or directory is set for read-only access.
}
finally
{
    if (fileStream != null)
        fileStream.Close ();
}

P.S. Just found a very similar question with basically the same answer:
C#: Is there a way to check if a file is in use?


text:
Q: Python: use of eval in interactive terminal. how to get return value. what compile-mode I have some code like:
    try:
        c = compile(s, COMPILE_STRING_FN, "single")
    except Exception as e:
        answer = (idx, "compile-exception", (e.__class__.__name__, str(e)))
    else:
        try:
            ret = eval(c, globals, locals)
        except Exception as e:
            answer = (idx, "eval-exception", (e.__class__.__name__, str(e)))
        else:
            if ret is not None:
                try:
                    ret = str(ret)
                except Exception as e:
                    ret = "<str-cast exception: %s: %s>" % (e.__class__.__name__, str(e))
            answer = (idx, "return", ret)

This doesn't work as expected because ret is always None - the value, if there is any, will be printed instead. This is not what I want - I want to have it in ret.
It seems that "single" is not the correct compile-mode for me. Also, s = "def f(): return 42" does not work.
However, neither is "eval" because I want to support any commands, not just single expressions.
And with mode "exec", I also would not get the return value.
So, what would be the solution?

An upstream suggestion: compile-flag for single-execution to return value instead of printing it

Use case: Python remote shell. I have this implemented for my application to be able to attach it whenever I want. server socketcontrol module and client interactive shell implementation.

A: Instead of compile(s, COMPILE_STRING_FN, "single"), I can use this function:
def interactive_py_compile(source, filename="<interactive>"):
    c = compile(source, filename, "single")

    # we expect this at the end:
    #   PRINT_EXPR
    #   LOAD_CONST
    #   RETURN_VALUE
    import dis
    if ord(c.co_code[-5]) != dis.opmap["PRINT_EXPR"]:
        return c
    assert ord(c.co_code[-4]) == dis.opmap["LOAD_CONST"]
    assert ord(c.co_code[-1]) == dis.opmap["RETURN_VALUE"]

    code = c.co_code[:-5]
    code += chr(dis.opmap["RETURN_VALUE"])

    CodeArgs = [
        "argcount", "nlocals", "stacksize", "flags", "code",
        "consts", "names", "varnames", "filename", "name",
        "firstlineno", "lnotab", "freevars", "cellvars"]
    c_dict = dict([(arg, getattr(c, "co_" + arg)) for arg in CodeArgs])
    c_dict["code"] = code

    import types
    c = types.CodeType(*[c_dict[arg] for arg in CodeArgs])
    return c


text:
Q: Binary Search in List of 2 Flavors This happens to be in JavaScript, but the question applies also to other languages.
I have this very long list of words, sorted alphabetically, such as:
var myList= [
    {word:"abstract", flavor:"old", extraData:...},
    {word:"aircraft", flavor:"old", extraData:...},
    {word:"airplane", flavor:"new", extraData:...},
    {word:"banana", flavor:"old", extraData:...},
    {word:"calories", flavor:"new", extraData:...},
    ...
];

My goal is to use some search method (probably a binary search), in order to find how many words start with a given substring. In the example above, given the substring "air" - the result should be 2.
However, sometimes I need to search the whole list, while other times I need to search only the "old" items (which should result in 1 per the example above).
An obvious solution is to duplicate the list, such as:
var wholeList= [
    {word:"abstract", flavor:"old", extraData:...},
    {word:"aircraft", flavor:"old", extraData:...},
    {word:"airplane", flavor:"new", extraData:...},
    {word:"banana", flavor:"old", extraData:...},
    {word:"calories", flavor:"new", extraData:...},
    ...
];

var oldList= [
    {word:"abstract", flavor:"old", extraData:...},
    {word:"aircraft", flavor:"old", extraData:...},
    {word:"banana", flavor:"old", extraData:...},
    ...
];

This is of course very wasteful in terms of memory.
Any other/known solutions for such a problem?

A: To filter after a word:
const search ="air";
const result = myList.filter(word => word.word.substr(0,search.length) === search);

To just get the old ones:
const result = myList.filter( word => word.flavor === "old");

Both at once:
const search ="air", flavor = "old";
const result = myList.filter(word =>
   word.flavor === flavor &&
   word.word.substr(0,search.length) === search
);

To improve that, one could use nested Maps as lookup trees, or you could pregroup them. However thats just worth if you search more than once.

A: To find how many words start with a given substring for the whole list:
myList.filter(data => data.word.includes('air')).length
To find it for a list with only old as the value for flavor:
myList.filter(data => data.word.includes('air') && data.flavor === "old").length
If you need to add more constraints to the search, just add more ampersands and some logic for filter to process.

A: I would say avoid any sort of algorithm that requires walking the list twice. That being said, whenever it comes to huge lists I prefer to dump any sort of abstraction and use good old-fashioned loops. Just iterate through your list and count the words that match, something like:
let count = 0;
const testValue = 'air';
const testFlavor = 'old';

for(var i = 0, len = wholeList.length; i < len; i += 1) {
  const current = wholeList[i];

  if (current.word.startsWith(testValue) && current.flavor === testFlavor) {
    count += 1;
  }
}

Of course you can formulate your test condition differently if it's faster, that's up to you to try out. You can optimize this further by indexing your list alphabetically beforehand. Let's say you do something like:
const indices = {
  a: [0, 2],
  b: [3, 4]
  // ...
}

You can then only loop through the relevant segment rather than the whole list:
const index = indices[testValue[0]];
for(var i = index[0], len = index[1]; i < len; i += 1) {
  // ...
}

A: Here's a method that will count the number of entries that start with the given substring, using a binary search as the base algorithm:

function countEntries (array, key, prefix) {
  var l = prefix.length
  var i = 0
  var j = array.length - 1
  var lower, upper, k

  while (j - i > 1) {
    k = (i + j) >> 1

    if (prefix > array[k][key]) {
      i = k
    } else {
      j = k
    }
  }

  lower = j
  i = 0
  j = array.length - 1

  while (j - i > 1) {
    k = (i + j) >> 1

    if (prefix < array[k][key].substr(0, l)) {
      j = k
    } else {
      i = k
    }
  }

  upper = j

  return upper - lower // array.slice(lower, upper) to confirm
}

// usage

var myList= [
  {word:"aardvark", flavor:"old"},
  {word:"abstract", flavor:"old"},
  {word:"air", flavor:"old"},
  {word:"aircraft", flavor:"old"},
  {word:"airplane", flavor:"new"},
  {word:"banana", flavor:"old"},
  {word:"calories", flavor:"new"},
  {word:"danger", flavor:"old"}
];

console.log(countEntries(myList, 'word', 'air'))

If we modify this with an optional filter, we can do a linear scan of the target range for prefix and check each element:

function countEntries (array, key, prefix, filter) {
  filter = Array.isArray(filter) && filter || []

  var l = prefix.length
  var i = 0
  var j = array.length - 1
  var lower, upper, k

  while (j - i > 1) {
    k = (i + j) >> 1

    if (prefix > array[k][key]) {
      i = k
    } else {
      j = k
    }
  }

  lower = j
  i = 0
  j = array.length - 1

  while (j - i > 1) {
    k = (i + j) >> 1

    if (prefix < array[k][key].substr(0, l)) {
      j = k
    } else {
      i = k
    }
  }

  upper = j

  if (filter.length === 0) {
    return upper - lower
  }

  k = 0

  outer: for (i = lower; i < upper; i++) {
    for (j = 0; j < filter.length; j++) {
      if (array[i][filter[j][0]] !== filter[j][1]) {
        continue outer
      }
    }

    k++
  }

  return k
}

// usage

var myList= [
  {word:"aardvark", flavor:"old"},
  {word:"abstract", flavor:"old"},
  {word:"air", flavor:"old"},
  {word:"aircraft", flavor:"old", other:"test"},
  {word:"airflow", flavor:"old", other:"test"},
  {word:"airplane", flavor:"new"},
  {word:"banana", flavor:"old"},
  {word:"calories", flavor:"new"},
  {word:"danger", flavor:"old"}
];

// basic usage still works
console.log(countEntries(myList, 'word', 'air'))

// filters accept multiple key/value pairs
console.log(countEntries(myList, 'word', 'air', [['flavor','old']]))
console.log(countEntries(myList, 'word', 'air', [['flavor','old'],['other','test']]))

A: Please find following code in c# but it should not be a big problem to any other language:
    public class Item {
        public string Word { get; set; }
        public string Flavour { get; set; }
    }

public int BinarySearch(Item[] ary, string start, string flavor)
        {
            int upperBound = ary.Length - 1, lowerBound = 0, mid,count=0;
            while (lowerBound <= upperBound)
            {
                mid= (int)((lowerBound + upperBound)/ 2);
                if (ary[mid].Word.StartsWith(start))
                {
                    if (!String.IsNullOrEmpty(flavor)) {
                        if (ary[mid].Flavour == flavor) {
                            // if flavor is provided then increment count only if string starts with value and flavor
                            count += 1;
                        }

                    }
                    else
                    {
                        // flavor is not provided so increment cound for whole array
                        count += 1;
                    }
                }
                else if (start[0] < ary[mid].Word[0]) {
                    upperBound -= 1;
                }
                else if (start[0] > ary[mid].Word[0])
                {
                    lowerBound += 1;
                }

            }
            // if method returns 0 means no item starts with specified value
            return count;

        }


text:
Q: Ionic Installation issue (typescript) I have used the regular ionic start projectName to open my project.
I'm getting TS errors such as TypeError: Cannot read property "length" of undefined
and this is coming from a simple ionic task (ionic g provider GoldService)
I am not sure  but a good reason would be because I didn't runn the --ts attribute on the start project command.
My question is if I would need to start the app from start or can I remedy this situation with acquiring the --ts attribute into ionic in this current ionic project.


text:
Q: get current page from url I want to write a c# method to retrieve the current page. eg Default6.aspx I know I can do the following:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx

string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx

string host = HttpContext.Current.Request.Url.Host;
// localhost

but how can I get Default6.aspx? And if the url is http://localhost:1302/TESTERS/, my method should return default.aspx

A: Try this:
path.Substring(path.LastIndexOf("/");

A: A simple function like below will help :
public string GetCurrentPageName()
{
    string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
    System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);
    string sRet = oInfo.Name;
    return sRet;
}

A: Path.GetFileName( Request.Url.AbsolutePath )

A: The class you need is System.Uri
Dim url As System.Uri = Request.UrlReferrer
Debug.WriteLine(url.AbsoluteUri)   ' => http://www.mysite.com/default.aspx
Debug.WriteLine(url.AbsolutePath)  ' => /default.aspx
Debug.WriteLine(url.Host)          ' => http:/www.mysite.com
Debug.WriteLine(url.Port)          ' => 80
Debug.WriteLine(url.IsLoopback)    ' => False

http://www.devx.com/vb2themax/Tip/18709

A: You could try this below.
string url = "http://localhost:1302/TESTERS/Default6.aspx";

string fileName = System.IO.Path.GetFileName(url);

Hope this helps.

A: Request.Url.Segments.Last()

Another option.


text:
Q: Change state conditioned on in useEffect without triggering the hook and without breaking the exhaustive dependencies rule I am trying to register a mutation as being inFlight in a useEffect hook. The registration should only occur if the mutation has not already been registered. Thus, I have a boolean variable in state to keep track of whether the mutation has already been registered and I register conditionally based on it. Right after I register the mutation in the useEffect, I set this variable to true. Consequently, I set it to false in my deregister mutation function right after I conduct the deregistration.
Here comes the issue: In order to adhere to the exhaustive dependency rule of useEffect, I have to include the boolean state variable in the dependency array. However, that means that as soon as I deregister, the useEffect will run and re-register the mutation. Instead, I want the deregister to simply "prepare" for registration and then only have registration occur once a specific value changes. Is that even possible while complying with the exhaustive dependency rule?
I've tried to change the boolean variable to an ENUM containing three states (AwaitingValueChange, ShouldDispatch, HasDispatched), only dispatch if its value is ShouldDispatch, and set the value to AwaitingValueChange in the deregister. Then I've created a new hook to be run every time the value that should trigger registration changes and set the state variable to ShouldDispatch if its current value is AwaitingValueChange. However, the new hook is conditioned on the state variable too, so I run into the exact same problem, just this time around the call chain is: Deregister -> new hook -> old hook -> register instead of deregister -> old hook -> register.
The register code:
useEffect(() => {
  if (hasRegisteredMutationInFlight && inFlightDispatch) {
        inFlightDispatch({ type: 'registerMutation', mutationName });
        setHasRegisteredMutationInFlight(true);
      }
  }, [hasRegisteredMutationInFlight, ...]);

The deregister code:
const deregisterMutation = () => {
  inFlightDispatch({ type: 'deregisterMutation', mutationName });
  setHasRegisteredMutationInFlight(false);
};

I would like some way to set a state, not have it trigger my useEffect but use that state to carry out an action conditionally in that same useEffect. I also would like to not break the exhaustive dependency rule. To me, it sounds impossible with the current implementation of useEffect, but I hope someone in here is a bit smarter than me and can see some solution I am overlooking

A: You cannot use the same flag to register and deregister mutation. It doesn't make sense at all. Why do you need to setHasRegisteredMutationInFlight (false) in deregisterMutation? You can just deregister and while you register back on some value you set the flag to false such that it doesn't depend on the same value. Just a working example of what I mean
You can also let me know what specific use case you are catering for such that I can help you more
import React, { useEffect, useCallback, useState } from "react";
import ReactDOM from "react-dom";

const mutationName = "MUTATION_NAME";

function App() {
  const [type, setType] = useState("");
  const [isMutationSet, setMutationToRegister] = useState(true);
  const inFlightDispatch = useCallback(
    stuff => {
      setType(stuff.type);
    },
    [setType]
  );

  useEffect(() => {
    if (isMutationSet && inFlightDispatch) {
      inFlightDispatch({ type: "registerMutation", mutationName });
      setMutationToRegister(false);
    }
  }, [isMutationSet, inFlightDispatch]);

  const deregisterMutation = () => {
    inFlightDispatch({ type: "deregisterMutation", mutationName });
  };

  const registerMutation = () => {
    setMutationToRegister(true);
  };

  return (
    <div className="App">
      {type}
      <button onClick={deregisterMutation}>Degister</button>
      <button onClick={registerMutation}>Register</button>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);


text:
Q: Terraform - can modules have a Subversion source? I don't see Subversion listed as a source for Terraform modules here:
https://www.terraform.io/docs/modules/sources.html
Is it possible to use Subversion?
I don't see any documentation on this.

A: At the time of this writing, Terraform does not support Subversion as a first-class module installation source. If you have modules in Subversion then at present it would be necessary to have some sort of build process package them up as archive files (e.g. .zip or .tar.gz) and then reference the archive files as the module source.


text:
Q: Typescript: How can I construct an object of a particular type when I only have a type name? I have some code that is needs to hydrate objects with types that are not known at compile time.  (The code is in a library)  From the type name, I would like to discover the type and construct it dynamically at runtime. The important operation here is running the default constructor and doing the other setup expected from the prototype.   Is that even possible in typescript?   How would I do it?

A: As @pan93412 said, Typescript's types are largely erased and not reified at runtime, and this is an explicit project goal.  I would suggest trying to create a map of known type names to class constructors (or factory methods), and using those to reconstitute the objects:
https://www.typescriptlang.org/play?#code/MYGwhgzhAEDqCWATA5gUwC7QN4Chr+gHck10B9AM3lREWgF5oByMJnAXx1EhgBUALeADtk2PAXSCRlarQbMARm05cA9kIiZeATQAKAUQDK83ATgkMALnMoMAGnH4Bw5NeciO0SNmgBtdACeAA6o1poATi4AutZgQgHQKsDqmtAQqJFgIPAAXqh0jKYEqgoAVqjA6BDWvkwItuhMdszuyExRHDhqGqogqAB0IKrIABTpmdl5iP0l5ZUQ-QC2YEEjqgwAfNBCqITQOgaGvqpRIwCUF0A

A: Did you ask something about something like interface or type alias? Well, it is not possible since TypeScript will clean out all the type information in the compiled JS - The type information would only be used on the type-checking of tsc, the metadata (need to be explicitly enabled) and the generated .d.ts which can't be used in runtime.
It is better to give us more explicit examples so we would be able to provide a better answer. :-)

I'm not sure about how the metadata in TypeScript works. I didn't write such a code before.


text:
Q: Symlink support in IIS Express (Visual Studio 2010) Can I use symbolic links to files created by mklink <link> <target> in IIS7 and/or IIS Express?
I have created a simple HTML (it's MVC3 Razor but it's not the problem) project with line:
<link href="foo.js">
Then I moved foo.js file to another directory and created a link to this file using:
mklink foo.js bar\foo.js
HTML remains the same.
FireBug shows (on network tab) file size 0B (for discussion), because such a file in the system actually is 0B. The problem is that FireBug does not read the contents of a file or file is not served by IIS Express properly.
IE behaves similarly.
I'm using IIS Express with VS2010 for development, not tested yet on IIS7, the operating system is Windows 7 x64.
Hard links created by command:
mklink / h <link> <target>
works properly.

A: I tried the same thing for an image but using a symbolic link - so without the "/H" - and got the same result when I tried to use Visual Studio 2010's internal web server (Cassini).
Perhaps IIS Express does have the same the limitation, because when I retried using IIS on my Win 7 (64bit) laptop the image was server correctly.
Cheers


text:
Q: Latitude specifications: in $45^{\circ} 23' N$, what does the $23'$ represent? When the latitude of a location on Earth is specified I notice that there are two numbers. For instance a latitude could be given as $45^{\circ} 23' N$ I understand that the $45^{\circ}$ is the elevation from the equator towards the North Pole, but in the simplest terms possible, what does the $23'$ represent?

A: The $23'$ represents arcminutes (angular minutes). One arcminute is ${1\over60}$ of one degree.
So $45^\circ23'$ is the same as $45{23\over60}$ degrees, which is about $45.383^\circ$.


text:
Q: How to get id vertex from name vertex in R and Igraph? I have a graph with names from 1 to 10
library(igraph)
library(Cairo)

    g<- graph(c(0,1,0,4,0,9,1,7,1,9,2,9,2,3,2,5,3,6,3,9,4,5,4,8,5,8,6,7,6,8,7,8),n=10,dir=FALSE)
    V(g)$name<-c(1:10)
    V(g)$label<-V(g)$name
    coords <- c(0,0,13.0000,0,5.9982,5.9991,7.9973,7.0009,-1.0008,11.9999,0.9993,11.0002,7.9989,13.0009,10.9989,14.0009,5.9989,14.0009,7.0000,4.0000)
    coords <- matrix(coords, 10,2,byrow=T)
    plot(g,layout=coords)

listMn<-neighborhood(g,1,0:9)

I'd like to do this but in opposite way
m1<-V(g)[listMn[[7]]]$name

the above instructions gets,
7 4 8 9

how to get listMn[[7]]=6 3 7 8 from names 7 4 8 9?

A: Node numbering starts at zero: listMn[[7]] gives the numbers of the neighbours of the seventh node (number 6, name 7), i.e., 6, 3, 7, 8, corresponding to names (add 1 to the numbers) 7, 4, 8, 9.
Using strings for the names may be less confusing:
V(g)$name <- as.character( 1:10 )


text:
Q: resize an image with unknown size to a specific size without deformation? I want to get an image from a user in Asp.net MVC and resize it to a specific size but I have to resize it to a certain size without deformation. i do not have problem if some part of the image cropped but I do not want if user uploads 4000X2000px image I crop 600X600 of it and lose many part of the image.
how can I do that? is there any algorithm according to that? or is there any source code in .net?

A: I found the solution:
               using (var bitmap = new Bitmap(image.InputStream))
                       {
                           var width = bitmap.Width;
                           var height = bitmap.Height;

                           double widthRatio = (double)600 / width;
                           double heightRatio = (double)600 / height;
                           double ratio = widthRatio > heightRatio ? widthRatio : heightRatio;

                           var resizedWidth = width < height ? 600 : (int)(width * ratio);
                           var resizedHeight = height < width ? 600 : (int) (height * ratio);

                           var converter = new ImageConverter();
                           var image =
                      new WebImage((byte[])converter.ConvertTo(bitmap, typeof(byte[])))
                      .Resize(resizedWidth, resizedHeight)
                      .Crop((resizedHeight - 600) / 2, ((resizedWidth - 600)/ 2), ((resizedHeight - 600) / 2), ((resizedWidth - 600) / 2));
          }


text:
Q: Proposal: Free downvoting of answers for users that have 200 rep or less? For some users (talk about myself!) reaching 200 rep can mean jolly hard work, and often take up to 2 years to happen because not every user is a "SO-addict" and will daily hunt for "fresh" questions to answer to boost up their rep (Face it, thinking a few hours too long about your own answer on the very same day will mean that you'll be beaten to it by 5 others with identical or even better answers; hence, there will be no longer any point in posting yours as well, "re-inventing the wheel.")
This is why I've thought that the "payment" of rep for downvotes is not unfair per se, but should simply be free for users that are still struggling to reach the "magic 200" mark.
I will summarize again:

*

*Users between 125 rep (lowest possible for downvoting anyway) and 199 rep ought to have the chance to downvote useless or (e. g. in "Unix & Linux") totally non-working and badly tested answers without losing ANY rep, because they're still working hard on reaching their "magic mark."

*From 200 rep, rules should remain the same as they are at the moment.
What do you think about it?

A: Changing such a fundamental thing about how the site operates requires an extremely good reason. Something that benefits the site as a whole, to a great degree.
The lack of reputation is not one such reason - you need to earn the reputation and put in the time in the site if you want to participate in it more meaningfully.
The biggest problem with 0 rep loss for downvoting answers is that it opens up too much of a window for abuse - downvoting competing answers, downvoting answer because we don't like the avatar and so on. There needs to be something that stops spurious downvotes on answers - the -1 reputation is the minimal possible penalty. Consider that a single upvote on an answer give one 10 reputation - the ratio is more than generous.

The solution to the rep issue? Gain reputation. You don't have to ask or answer in order to gain reputation at this level - suggested edits are a great mechanism to improve the site and gain reputation at the same time.
You get 2 rep for every approved suggested edit - good suggested edits improve formatting, grammar and spelling. Which doesn't mean you change the meaning of the post, but are improving it for everyone.
If you are reluctant to use this mechanism and/or are not willing to put in the time to post good questions/answers, then, yes, you are left out. So is life.


text:
Q: OpenGL Back Face Culling Causing Weird Results I'm trying to create a simple cell shader effect, and it involves back and front face culling. But so far, my culling results are rather odd.
Setup OpenGL source code:
// init matrices
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, 800 / 600, 0.01f, 150);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// enable opengl caps
glEnable(GL_NORMALIZE);
glEnable(GL_CULL_FACE);
// cell shading effects
glLineWidth(3.5f);
// setup display list
pDList = glGenLists(1);
glNewList(pDList, GL_COMPILE);
    glBegin(GL_QUADS);
        // front
        glNormal3f(0, 0, 1);
        glVertex3f(-0.25f, -0.5f, -3);
        glVertex3f(0.25f, -0.5f, -3);
        glVertex3f(0.25f, -1, -3);
        glVertex3f(-0.25f, -1, -3);
        // back
        glNormal3f(0, 0, -1);
        glVertex3f(-0.25f, -0.5f, -3.5f);
        glVertex3f(0.25f, -0.5f, -3.5f);
        glVertex3f(0.25f, -1, -3.5f);
        glVertex3f(-0.25f, -1, -3.5f);
        // top
        glNormal3f(0, 1, 0);
        glVertex3f(-0.25f, -0.5f, -3.5f);
        glVertex3f(0.25f, -0.5f, -3.5f);
        glVertex3f(0.25f, -0.5f, -3);
        glVertex3f(-0.25f, -0.5f, -3);
        // bottom
        glNormal3f(0, -1, 0);
        glVertex3f(-0.25f, -1, -3.5f);
        glVertex3f(0.25f, -1, -3.5f);
        glVertex3f(0.25f, -1, -3);
        glVertex3f(-0.25f, -1, -3);
        // right
        glNormal3f(1, 0, 0);
        glVertex3f(0.25f, -0.5f, -3);
        glVertex3f(0.25f, -0.5f, -3.5f);
        glVertex3f(0.25f, -1, -3.5f);
        glVertex3f(0.25f, -1, -3);
        // left
        glNormal3f(-1, 0, 0);
        glVertex3f(-0.25f, -0.5f, -3);
        glVertex3f(-0.25f, -0.5f, -3.5f);
        glVertex3f(-0.25f, -1, -3.5f);
        glVertex3f(-0.25f, -1, -3);
    glEnd();
glEndList();

Render source code:
// clear
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.75f, 0.75f, 0.75f, 1);
// reset matrix
glLoadIdentity();
// draw cube
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glCullFace(GL_BACK);
glColor3i(0, 0, 0);
glCallList(pDList);

This is what I got:

For some reason it's only drawing the right side of the cube. Weird.
I changed the glCullFace(GL_BACK); to glCullFace(GL_FRONT); in my render function.
I got this:

Now it's drawing every side? It seems to think that the right side of the cube is both back and front facing, and the rest of the cube is facing back. I also get this same result shown in the picture above when i have culling disabled.
Any other relevant info I can think of is that I'm using SDL, and that I'm sure this isn't a graphics card issue, as I've ran this on two different computers, each yielding the same result.
I just started to learn how to set normals for a primitive so chances are this is a big n00b mistake, or some dumb error. I'd be a millionaire if I got a penny every time I did the most thoughtless obvious mistake and have been stuck on it for hours.
So, in a nutshell, what have I done wrong, and how to I get the proper faced sides to cull or not cull in the proper way?

A: If you look at each triangle from the vector of its minus-normal you can define the order in which your vertices are specified (it is called winding): clockwise or counterclockwise.
You have to be consistent with it and specify all vertices in either CW or CCW winding to make the culling work correctly.


text:
Q: What is the use of var app = express(); in the process of creating a Node.Js Application? I am new to the world of Node.js.I am trying to learn through an example.I have encountered the following statements in the "app.js" .
  var express = require("express");----->1
  var app = express(); --------->2

So I understand the first statement is to load express module .What is the need for second statement??
Inorder to load a MYSQL module in my app.js we use
 var mysql = require("MYSQL");

We access SQL properties by mysql.connect("") etc.
so why cannot we write  "express.get()" instead of "app.get()"????
Why do we need var express = require("express");??
Any help would be highly appreciated.

A: The real difference between require('express') and express() is that require('express') allows you to have access to any public functions or properties exposed by module.exports.
The express() syntax is the equivalent of saying new express(). It creates a new instance of express that you can then assign to a variable and interact with.
That is why the standard creation pattern for Express is
// Import the Express module
var express = require('express');

// Create a new Express Instance
var app = express();

A: express is a module that can be used to create more than one application.
var ex = require('express')

puts this module into the variable ex. Once you have a reference to the module, you can use it to create application. Each module has its own API. According to the expressjs documentation - http://expressjs.com/en/4x/api.html, the module is in fact a function that can be used to create applications
var app1 = ex();
var app2 = ex();

you could for example want to have several web applications listening on different ports.
If you only want one application (but it would be less readable) you could write
var app = require('express')();


text:
Q: Calling WCF Service Using jquery Ajax failed with bad request response calling wcf web service Using jquery-Ajax failed with bad request without knowing the exact problem.
it's not even calling any methods success or failure.
both the web service and the website is deployed on the same server using iis
the error:
Failed to load resource: the server responded with a status of 400 (Bad Request)

the code is used to call the service methods :
function test(){
     try {

        code = getValuesWrittenInTheURL[0] + "";

        var query = "select taskstatus,tasksubstatus,Lat,Lng,elementID from tasks_gvt where code = '" + code + "'";

        $.ajax({
            type: "POST",
            async: true,
            url: IP + "/GetData",
            data: JSON.stringify({ Query: query }),
            dataType: "json",
            success: function (data) {
                debugger;
                console.log("data: ",data);

            },
            failure: function (errMsg) {
                debugger;
                console.log("err",errMsg);

            }

        });
    } catch (error) {
        console.log("alaaError", error.message);
    }

}

the wcf web service Operation contract:
 [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "GetData", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        Response GetData(String Query);

ready to provide you with any more details.

A: Below is the Ajax I successfully accessed the service, you can refer to it:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Ajax</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
    <script>
$(document).ready(function(){
    $("button").click(function () {
        code = "code";
        var query = "select taskstatus,tasksubstatus,Lat,Lng,elementID from tasks_gvt where code = '" + code + "'";
        da={"Query":query}
        $.ajax({
            type: "Post",
            dataType: "json",
           contentType: "application/json;charset=utf-8",
           data: JSON.stringify(da),
            url: "http://localhost/Service1.svc/GetData", success: function (result) {
        }});
    });
});
    </script>
</head>
<body>

    <button>Call WCF Rest Service</button>

</body>
</html>

You need to set contentType, and I see that you set BodyStyle to Wrapped,if it is set to Wrapped, the request format should be like this:
{"Query":query}


text:
Q: Thymeleaf and Spring Boot not reading properties from localization files - Question marks appear instead of the localized string When attempting to localize a static string the message is displayed surrounded with questionmarks "??"
e.g. ??ticket.type_en_US??

Blah

*

*I am using SpringBoot 1.3.6.RELEASE

*Thymeleaf: 3.0.0.RELEASE

*thymeleaf-spring4 artifact

I have configured the basename of my messages in application.properties
and the contents of that messages.properties and messages_en_US.properties is:
ticket.type=BUGS!!!!

Config:
spring.messages.basename=messages

Output on startup:

2016-07-19 08:38:28.673 DEBUG 5175 --- [           main]
  ationConfigEmbeddedWebApplicationContext : Using MessageSource
  [org.springframework.context.support.ResourceBundleMessageSource:
  basenames=[messages]]

I also tried programatically using the MessageResource in the code below. I placed the messages.properties file in the same folder as the application.properties file. src/main/resources/
@Configuration
@ComponentScan("controller")
public class WebConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware{

    private ApplicationContext applicationContext;

    @Autowired
    private MessageSource messageSource;

    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    @Bean
    public ViewResolver viewResolver() {
        ThymeleafViewResolver resolver = new ThymeleafViewResolver();
        resolver.setTemplateEngine(templateEngine());
        resolver.setCharacterEncoding("UTF-8");
        return resolver;
    }

    @Bean
    public TemplateEngine templateEngine() {
        SpringTemplateEngine engine = new SpringTemplateEngine();
        engine.setTemplateResolver(templateResolver());
        engine.setMessageSource(messageSource);
        return engine;
    }

    @Bean
    public ITemplateResolver templateResolver() {
        SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
        resolver.setApplicationContext(applicationContext);
        resolver.setPrefix("/WEB-INF/templates/");
        resolver.setTemplateMode(TemplateMode.HTML);
        return resolver;
    }
}

For completeness here is my application config (like others I had to exluse the Thymeleaf class):
@SpringBootApplication(exclude={org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.class})
public class Application {

    public static void main(String[] args) {

        ApplicationContext ctx = SpringApplication.run(Application.class, args);

    }

}

I have also verified that the message bundles are being loaded by pring out the contents on one of my REST end-point calls:
@Autowired
    private MessageSource messageSource;

    @GET
    @Produces("application/json")
    public List<MyData> getData() {
        System.out.println("HERE 1 in Conversions");

        System.out.println(messageSource.getMessage("ticket.type", null, Locale.US));

        return getTheData();
    }

This prints out the following so I know spring-boot is loading the resource bundles, but Thymeleaf is not picking them up somehow:
BUGS!!!!

Here is my full HTML page, perhaps there is an issue with it:

    <title>Kitchen Sink</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <link href="http://cdn.jsdelivr.net/webjars/bootstrap/3.3.4/css/bootstrap.min.css"
          th:href="@{/webjars/bootstrap/3.3.4/css/bootstrap.min.css}"
          rel="stylesheet" media="screen" />

    <link href="../static/css/mike.css"
          th:href="@{css/mike.css}" rel="stylesheet" media="screen"/>

Hello

Welcome to the Kitchen Sink!

Blah

dssfgf

A: ok, so I figured it out. Thanks @M.Deinum for poitning out that I should just let spring-boot and Thymeleaf do what they are supposed to do.
I had to set the:
engine.setMessageSource(messageSource);

and also add the:
@Bean

to the 2 other functions. This allowed the MessageSource to be passed into the engine and resolve the properties correctly.
I will update the question above with the correct source so people can use it for referene

A: Please add

@EnableAutoConfiguration

in your Spring boot startup its look like
@EnableAutoConfiguration
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);

    }
}

A: I had a similar problem, and code from your post didn't work for me. The source of my issue was, that I didn't have message.proprerties (without any language).
I had:
messages_en.properties
messages_de.properties
messages_es.properties

but it didn't work.
It started working only when I added
messages.properties


text:
Q: How to make a node to rotate around a point outside of the node in a spritekit game project I came across this answer, but the answer is not clear to me. Can someone provide some sample code?
Create an SKNode and set its position to the center of rotation. Add the node that should rotate around that center as child to the center node. Set the child node's position to the desired offset (ie radius, say x + 100). Change the rotation property of the center node to make the child node(s) rotate around the center point.
Specifically, "Change the rotation property of the center node" to what?
var centerNode: SKSpriteNode = SKSpriteNode(imageNamed: "image1")
centerNode.position = CGPointMake(self.frame.width/2, self.frame.height/2)
self.addChild(centerNode)

var nodeRotateMe: SKSpriteNode = SKSpriteNode(imageNamged: "image2")
nodeRotateMe.position = CGPointMake(self.frame.width/2 + 100, self.frame.height/2 + 100)
centerNode.addChild(nodeRotateMe)

// Change the rotation property of the center node to what??
centerNode.zRotation = ?

A: You have a couple of options:
1) You could rotate the centerNode over time in your SKScene's update: method by changing its zRotation property manually.  You'll have to change the value slowly, at every call to update: to achieve a gradual rotation.
Note that the zRotation property is in radians, with means a 180 degree rotation would be equal to pi (M_PI).  SKScene strives to update: at 60 FPS, which means to rotate 360 degrees over 5 seconds, you'd need to increment by 1/300th of a degree every call to update, which would be 1/150th of pi every update.
centerNode.zRotation = centerNode.zRotation + CGFloat(1.0/150.0 * M_PI)

Of course, there is no guarantee that your scene will be able to update at 60 FPS, so you may have to monitor the currentTime variable in update: and adjust accordingly.
2) Probably better, you could use an SKAction to rotate the centerNode for you.
let rotateAction = SKAction.rotateByAngle(CGFloat(2 * M_PI), duration: 5.0)
centerNode.runAction(rotateAction)

Note that the rotation angle is in radians, not degrees.  Also note that the centerNode need not be a Sprite Node if you don't want to display an image there; it could be a regular SKNode.


text:
Q: Ornstein-Uhlenbeck vs. Random Normal? I was asked to implement an Ornstein-Uhlenbeck process in one of my simulations. I have coded the process to visualize the results and I was wondering, if my first value is at the mean, why bother using an O-U process? I thought the advantage of an O-U process is that it is mean-reverting, but if I am starting at the mean and just want to fluctuate about the mean, would a random Normal generator work equally well? Do I gain anything with the O-U model?

A: A random normal generator would not expose serial correlations (it looks like noise and is not path-dependent), whereas a OU process is path-dependent:
See here for an example of an OU process
( Unfortunately this web-app can't display a random normal generator. )
The choice between the two depends on the application.


text:
Q: Solving indeterminate limit form without L'Hopital's rule
$$\lim_{x\to2}\frac{\sqrt[4]{x}-\sqrt[4]{2}}{\sqrt[3]{x}-\sqrt[3]{2}}$$

Using L'Hopital's rule the simplified form of the above limit is found to be $\frac{3}{4\sqrt[12]{2}}$
However, is it possible to simplify it without using derivatives? Trying to rationalize the denominator using difference of cubes leads to:

A: Let $a=\sqrt[12]{x}$ and $b=\sqrt[12]{2}$.
$$\lim_{x\to2}\frac{\sqrt[4]{x}-\sqrt[4]{2}}{\sqrt[3]{x}-\sqrt[3]{2}}=\lim_{a\to b}\frac{a^3-b^3}{a^4-b^4}=\lim_{a\to b}\frac{(a-b)(a^2+ab+b^2)}{(a-b)(a+b)(a^2+b^2)}=\lim_{a\to b}\frac{a^2+ab+b^2}{(a+b)(a^2+b^2)}.$$
Can you take it from here?

A: So you have $$L=\lim_{x\to2}\frac{x^{\frac{1}{4}}-2^{\frac{1}{4}}}{x^{\frac{1}{3}}-2^{\frac{1}{3}}}$$
Note $\text{lcm}(3,4)=12$ thus let $x=u^{12}$ so that as $x\to2 $ we'll have $u\to\sqrt[12]{2}$. Thus $$L=\lim_{u\to\sqrt[12]{2}}\frac{(u^{12})^{\frac{1}{4}}-\sqrt[4]{2}}{(u^{12})^{\frac{1}{3}}-\sqrt[3]{2}}=\lim_{u\to\sqrt[12]{2}}\frac{u^3-c}{u^4-d}$$
where $c=\sqrt[4]{2}$ and $d=\sqrt[3]{2}$. Factoring $$L=\lim_{u\to\sqrt[12]{2}}\frac{(u-\sqrt[3]{c})(u^2+u\sqrt[3]{c}+\sqrt[3]{c^2})}{(u-\sqrt{\sqrt{d}})(u+\sqrt{\sqrt{d}})(u^2+\sqrt{d})}=\lim_{u\to\sqrt[12]{2}}\frac{(u-\sqrt[12]{2})(u^2+\sqrt[12]{2}u+\sqrt[6]{2})}{(u-\sqrt[12]{2})(u+\sqrt[12]{2})(u^2+\sqrt[6]{2})}$$ $$=\lim_{u\to\sqrt[12]{2}}\frac{u^2+\sqrt[12]{2}u+\sqrt[6]{2}}{(u+\sqrt[12]{2})(u^2+\sqrt[6]{2})}=\frac{(2^{\frac{1}{12}})^2+(2^{\frac{1}{12}})^2+\sqrt[6]{2}}{2\sqrt[12]{2}\cdot((2^{\frac{1}{12}})^2+\sqrt[6]{2})}$$ $$=\frac{3\sqrt[6]{2}}{4\sqrt[4]{2}}=\frac{3}{4\sqrt[12]{2}}$$

A: $\sqrt[4]{x}\  -\ \sqrt[4]{2}\ =\ (\sqrt[12]{x}\ -\ \sqrt[12]{2})(\sqrt[12]{x^2}\ +\ \sqrt[12]{2x}\ +\ \sqrt[12]{2^2})$
$\sqrt[3]{x}\ -\ \sqrt[3]{2}\ =\ (\sqrt[12]{x}\ +\ \sqrt[12]{2})(\sqrt[12]{x^3}\ +\ \sqrt[12]{2x^2}\ +\ \sqrt[12]{4x}\ +\sqrt[12]{8})$
Now cancelling the common factor and putting your limit you will get your required answer.

A: Start with $x=y+2$ to make
$$\lim_{x\to2}\frac{\sqrt[4]{x}-\sqrt[4]{2}}{\sqrt[3]{x}-\sqrt[3]{2}}=\lim_{y\to0}\frac{\sqrt[4]{2+y}-\sqrt[4]{2}}{\sqrt[3]{2+y}-\sqrt[3]{2}}$$ and use the binomial expansion
$$\sqrt[4]{2+y}=\sqrt[4]{2}+\frac{y}{4\ 2^{3/4}}-\frac{3 y^2}{64\ 2^{3/4}}+\cdots$$
$$\sqrt[3]{2+y}=\sqrt[3]{2}+\frac{y}{3\ 2^{2/3}}-\frac{y^2}{18\ 2^{2/3}}+\cdots$$
$$\frac{\sqrt[4]{2+y}-\sqrt[4]{2}}{\sqrt[3]{2+y}-\sqrt[3]{2}}=\frac{\frac{y}{4\ 2^{3/4}}-\frac{3 y^2}{64\ 2^{3/4}} +\cdots}{\frac{y}{3\ 2^{2/3}}-\frac{y^2}{18\ 2^{2/3}}+\cdots }$$ Now, long division to get
$$\frac{\sqrt[4]{2+y}-\sqrt[4]{2}}{\sqrt[3]{2+y}-\sqrt[3]{2}}=\frac{3}{4 \sqrt[12]{2}}-\frac{y}{64 \sqrt[12]{2}}+\cdots=\frac{3}{4 \sqrt[12]{2}}-\frac{x-2}{64 \sqrt[12]{2}}+\cdots$$ which shows the limit and how it is approached.
Edit
Doing the same for
$$\lim_{x\to a}\frac{\sqrt[m]{x}-\sqrt[m]{a}}{\sqrt[n]{x}-\sqrt[n]{a}}$$ you could establish that
$$\frac{\sqrt[m]{x}-\sqrt[m]{a}}{\sqrt[n]{x}-\sqrt[n]{a}}=\frac{n }{m}a^{\frac{1}{m}-\frac{1}{n}}+\frac{(n-m) }{2 m^2}a^{\frac{1}{m}-\frac{1}{n}-1}(x-a)+\cdots$$ that is to say
$$\frac{n }{m}a^{\frac{n-m}{m n}}\left(1+\frac{n-m}{2 amn}(x-a) \right)+\cdots$$


text:
Q: Orchard CMS 1.7 Media with S3 Storage Wanting to use Orchard 1.7 with Media storage on S3 (as I'm deploying to AppHarbor)
So far I'm looking at the S3 Storage provider But its a bit out of date.
Has anyone done this ? is there a better way to use S3 with the new media manager?
I've got images uploading to s3, but they don't display when I click the folder.
here is the Gist of my updated S3Provider
Missing methods for create file, rename folder, get file, and Get storage path. any help on how to complete these would be appreciated.... however stepping through the debugger in VS this doesn't seem to be the root cause of my displaying images issue above.
Edit
Looks like the file is up loading to s3 but not to the database, due to the GetFile method throwing an error...
Edit 2
Added some code to the Get file method. Now that works; (gist updated) Can up load images. However the thumbnails are still not working, they just come back as empty  tags ...Think this is because the media manager is using the Open get method - which is supposed to open a file so you can write a stream to it. Don't know how to achieve this with S3... any ideas welcome

A: As Part of the AWSSKD NuGet package version 1.5.28.3 you can access a S3FileInfo object. I've used this in my S3 Storage File and updated the S3 Storage provider.
This seem to work, need to do a bit more testing on it.
NOTE: I had to add some code on the GetFile Method to ensure the permissions where set correctly otherwise the updating of thumbnails overwrote permissions on the file.... I'm sure there is a better way to do this.


text:
Q: How can I change the source folder setting in querydsl plugin? I am using QueryDSL jpa to my application and generated the Q helper entities.
<plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>apt-maven-plugin</artifactId>
        <version>1.1.3</version>
        <executions>
            <execution>
                <goals>
                    <goal>process</goal>
                </goals>
                <configuration>
                    <outputDirectory>target/generated-  /java</outputDirectory>
                    <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                </configuration>
            </execution>
        </executions>
    </plugin>

But When  the plugin generates those java files, it got errors. Because it added target/generated-sources directory to the source folders  , not  target/generated-sources/java
How can I change the setting of source folder of this plugin? I want to specify the java directory where is under target/generated-sources

A: I am sorry for this. I should have taken a look more.
I changed the output directory and solved the errors.
<outputDirectory>target/generated-sources<outputDirectory>


text:
Q: How can I combine preventDefault with Timeout in VueJS? How to do to allow a link to be deactivated 1500ms before I can click on it again? I want to be able a click every 1500ms and not nonstop. I tried something like this and without success. I don't want to use via CSS pointer-events, i want combine somehow preventdefault into my code.
<router-link :to="item.path" @click="blockedLinkOnClick(e)">{{ item.name }}</router-link>

And my method:
blockedLinkOnClick(e) {
  setTimeout(() => e.preventDefault(), 1500);
}

A: I would do it this way
<router-link :to="item.path" :event="!isBlocked ? 'click' : ''">{{ item.name }}</router-link>
isBlocked = false;

clickable() {
    if (this.isBlocked)
    {
        setTimeout(() => this.isBlocked = false, 1500);
    }
    else
    {
        this.isBlocked = true;
    }
}

A: In the template, we added a class of blocked to the router-link when isLinkActive is false. You can style this class however you like to visually indicate that the link is not currently active.
So, like this:
<template>
  <router-link :to="item.path" @click="blockedLinkOnClick(item.path)" :class="{ 'blocked': !isLinkActive }">{{ item.name }}</router-link>
</template>
<script>
export default {
  data() {
    return {
      isLinkActive: true
    }
  },
  methods: {
    blockedLinkOnClick(path) {
      if (this.isLinkActive) {
        this.isLinkActive = false;
        this.$router.push(path);
        setTimeout(() => {
          this.isLinkActive = true;
        }, 1500);
      }
    }
  }
}
</script>


text:
Q: Cannot read property 'getInstance' of undefined in Salesforce CLI while deploy and retrieve command VSCode is using for Salesforce development and couple of days back this issue is started whenever I am try to Deploy and retrieve changes from Org to my VScode Connected org. It is throwing Error
Cannot read property 'getInstance' of undefined. Can anyone please help to resolve this.

A: I am able to resolve by uninstalling and reinstalling the Salesforce CLI from installed program on machine.

*

*Uninstall Salesforce CLI from installed program. Do not do it through VSCode.

*Download exe again from Salesforce https://developer.salesforce.com/tools/sfdxcli and install again.

A: 1- Uninstall Salesforce CLI
2- Go to windows explorer and use this path "%LOCALAPPDATA%\sfdx"
3- Delete all the files from there
4- Reinstall Salesforce CLI


text:
Q: Advanced Custom Fields Repeater Fields Bootstrap tabs I'm trying to integrate Bootstrap Tabs with ACF.
But how should I pull data when I create more than one tab?
When I use a tab at this time I can pull in this way but when I use more than one, how should I do?
How do I create a loop to use multiple tabs?
How to pull Tab links and content?
Front-end Codes

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Asset Management

Allow healthcare facilities to easily determine the exact location of tagged assets to reduce equipment shrinkage/hoarding, decrease the time staff spend searching for equipment, and automate PAR-level management.

Menu 1

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Now:

<?php $image = get_field('marka_logo');
 ?>

<img class="img-responsive" src="<?php echo $image['url']; ?>">

     <?php

     // check if the repeater field has rows of data
     if( have_rows('marka_ozellikler') ):

       // loop through the rows of data
         while ( have_rows('marka_ozellikler') ) : the_row();
     ?>

       <div class="media-left" style="border-color: <?php the_sub_field('marka_color'); ?>;">

         <img class="media-object" src="<?php the_sub_field('marka_sol_gorsel'); ?>">

        <h4 class="media-heading" style="color: <?php the_sub_field('marka_color'); ?>;"><?php the_sub_field('marka_baslik'); ?>

<?php the_sub_field('marka_aciklama'); ?>

             <?php
         endwhile;
     else :
         // no rows found
     endif;
      ?>

What I want:
Image:
Thank you

A: So you will have to do two while(have_rows('repeater')){}. One for the tabs, one for the content.
Example:

  <?php while(have_rows('repeater')) : the_row(); ?>

<?php the_sub_field('tab_name'); ?>

  <?php endwhile;?>

  <?php while(have_rows('repeater')) : the_row(); ?>

<?php the_sub_field('tab_content'); ?>

  <?php endwhile; ?>


text:
Q: Mysql select oldest record for each user I'm trying to create a list in PHP of the oldest entries for each user in the database.
SELECT *,
MIN(`entries`.`entry_date`)
AS entry_date
FROM (`entries`)
JOIN `user_profiles`
ON `user_profiles`.`user_id` = `entries`.`user_id`
WHERE `status` = 1
GROUP BY `entries`.`user_id`

I'm using the query to retrieve from the entries table the oldest dated entry using MIN()and joining with table user_profiles for other data. The query should select the oldest entry for each user. It seems to work but it retrieves the wrong entry_date field on some entries when I echo them. Please help, I can't spot what I'm doing wrong..

A: You need to use a subquery to obtain the (user_id, entry_date) pairs for each user, then join that with a query that selects the records of interest:
SELECT *
FROM   entries
  NATURAL JOIN (
    SELECT   user_id, MIN(entry_date) AS entry_date
    FROM     entries
    GROUP BY user_id
  ) AS tmin
  JOIN user_profiles USING (user_id)
WHERE  status = 1

A: Have you tried approaching the problem from the user_profiles table instead of the entries table? If a user has no entries, they will not appear in the above query.
This may help, but I'm not sure if it's the full solution:
SELECT *, MIN(entries.entry_date) as entry_date
FROM user_profiles LEFT JOIN entries USING (user_id)
WHERE status = 1
GROUP BY user_profiles.user_id

Also, you're renaming the MIN(entires.entry_date) as entry_date... but you already have a column named entry_date. Try renaming the derived columns to something unique like "min_entry_date"?


text:
Q: When running mvn versions:set, any way to automatically suppress the effect on unmodified code? I'm working on a large system with several projects and modules, and sometimes I need to do a mvn versions:set -DnewVersion=... to bump up the version number. I'd like to be able to do this globally (looping over all projects in a script), but I don't want to bump up the version on modules that have not been modified (e.g. there are no commits and no workspace changes since the last time the version was bumped).
What's the simplest way to accomplish this?


text:
Q: Excel - Power Query TrimStart With condition I want to trim 2 chars. if it's Start with "20"
https://i.stack.imgur.com/MlmmE.png

A: You can test whether the text starts with "20", and if so, then return the text after "20":
if Text.StartsWith(Example, "20") then Text.AfterDelimiter(Example,"20") else Example

Edited answer:
A similar approach, but this step transforms values in a table column. Change Source and MyValue references to suit.
= Table.TransformColumns(Source, {{"MyValue", each Number.From(let x = Number.ToText(_) in if Text.Start(x,2) = "20" then Text.AfterDelimiter(x,"20") else x), type number}})

A: I started with a basic text file that looks like this ...
Example
20456 208899 123 366420
20324 535435 654 533454
852 929492 583 283832

... and for transparency and to show you how I got through it, all steps are outlined below.  I suspect this could be done in a more efficient manner but it does the job.
Step 1

Step 2

Step 3

= Table.AddColumn(
#"Promoted Headers",
"Result",
each if Text.StartsWith([Example], "20") then Text.Middle([Example], 2) else [Example])

Step 4

Step 5 (Result)

A: *

*Split your string by the space into a List.

*Transform the list by checking each element to see if it starts with 20
eg:  As an added column:
   #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom",
        each
            Text.Combine(
                List.Transform(
                    Text.Split([Column1]," "),
                        each
                            if Text.StartsWith(_,"20")
                            then Text.Middle(_,2)
                            else _)," ")
            )

Original and Results

Note:
If you don't want to add a column, you can transform the existing column with the same algorithm, but you need to use the Advanced Editor to enter the code:
    trim20 = Table.TransformColumns(#"Previous Step", {"Column1", (c)=>
        Text.Combine(
            List.Transform(Text.Split(c," "),
                each if Text.StartsWith(_,"20") then Text.Middle(_,2) else _)," ")})

A: If you're doing it on sheet directly, it's very straight forward.

=IF(LEFT(A1,2) = "20", MID(A1, 3, 1000), A1)


text:
Q: how to access the dynamic object in angular My Code:
export class AppComponent implements OnInit {
 public manipulate: any ;
 ...
 this.results.forEach(result => {
   var index = result.date_value;
   if (!this.manipulate.hasOwnProperty(index)) {
     this.manipulate.{index} = [];
   }
   this.manupulate.{index}.push(result);
 });
}

Expected Result:
this.manupulate = {
  20171001 : [
     0: { resultset },
     ...
  ]
}

How to write the program.
If I use Array the browser handed. the reason is a high range of the index value.
The below javascript code is run perfectly.
manupulate[20171001] =
  [
     0: { resultset },
     ...
  ]
}

If I use typescript the browser handed.
this.manupulate[20171001] =
  [
     0: { resultset },
     ...
  ]
}

Thanks for all.

A: Try this :
use this.manupulate[index].push(result); instead of this.manupulate.{index}.push(result);
if (!this.manipulate.hasOwnProperty(index)) {
    this.manipulate[index] = [];
}
this.manupulate[index].push(result);


text:
Q: "I told him I am 20" vs. "I told him I was 20" Suppose I am 20 years old.  Which the following is correct?

*

*Someone asked me how old I am.  I told him I am 20.

*Someone asked me how old I was.  I told him I was 20.

A: In that particular case, the second would be the normal way of saying it. Elsewhere in indirect speech, you might find the present tense preserved.


text:
Q: selective display of the groups text on a stacked ggplot2 I'm creating several stacked barplots using ggplot. I'm grouping my results by year and I want to sort my data by a factor variable that has many levels (around 30). I want to display my cumulative summs but there are so many of them that they overlap.
My barplot looks OK for categories with big values, but I haven't managed to find a solution for categories that have small values.I tried setting different geom_text arguments. Now I would like to simply exclude the text for those categories from the barplot but dont know how.
ggplot(data=pivot, aes(x=YEAR, y=SUM, fill=GROUP))+
  geom_bar(stat="identity")+
  geom_text(aes(label=round(SUM)), vjust=1.6,
        position = position_stack(), size=2.5)+
  labs(x = "YEAR", y="Amount sold in EUR")

I think that my graphs look better with text over categories with bigger values so I want to include them in the final results but don't know how to select only a few for display.
My dataframe looks as follows:
> pivot

A tibble: 86 x 3
 Groups:   value [31]
   value Year      SUM

 1 1     2011   771.
 2 1     2012   999.
 3 1     2013  1479.
 4 1     2014   512.
 5 1     2015   677.
 6 3     2012   4.07
 7 4     2012   7.92
 8 4     2013   3.97
 9 4     2014   41.2
10 5     2011   12.0
 ... with 76 more rows
I would like to display text on the barplot for values of SUM for category 1 as they are bigger but not for categories 3, 4 and 5. In the final result I would be content with displaying text only for categories 1, 24 and 26 but dont know how to select only them.


text:
Q: Create an apk that's a slideshow of images? (Android) Non-developer UI / UX designer here.  Looking at ways to show android prototypes on some dev tablets that are locked down. Locked down in a sense that they can't get to android market they only have access to their own suite of apps but new apps can be loaded to their system for testing. So a loadable apk is really the only way to do this.
The ways that I'm interested in pursuing are from a set of a number of images, creating an APK that is essentially a slideshow of those images, press to proceed, slide to proceed, doesn't matter all that much.  And aside from that, wrapping an HTML clickable prototype (again could be images with image map hot spots) that could be generated into an APK.
Anyone know of an existing utility or easy method for a non-developer to work from? I've been doing a little research on the various drag drop builders, like app inventor but so far nothing has clicked as far as a method or process.

A: I think it would be best to get apk file of some slide show app and install it on tablet, but if making app is only solution, here is some help.
You could try Sketchware app on Play Store, but if that does not work you will have to make it on you own. It is not hard to do, here is list of some things i think you wil need look for on net to make it.
1.ImageView
Next thing are in java and android so make sure you search from this in java and android or you will end up with solution for other languages
2.OnClickListener (implement it on ImageView just like you wolud on normal button, it will work
3.if, else if, else (to switch between images)
4.int (to hold the number of current image)

*Also look for "how to change image in ImageView in android"

Here is an idea how it could work:
1.When app is started ImageView is set to show image 1
2.OnClickListener is seted on ImageView (you don't have to set listener again after every click, once set it will react every time ImageView is clicked).
3.Int is created to hold number of current image and is set to 1
4.Every time user clicks ImageView if int is bigger than number of images it is reseted to 1 else it is incerased by 1. ImageView is set specific picture using if and else if.
Happy coding :)
Add a comment if you have more questions


text:
Q: Laravel how to remove index.php from url I've created an about page in Laravel and pointed it to routes, but the problem is when I go to the URL: http://localhost:8080/bsms/public/about
it doesn't work, and it says

Sorry, the page you are looking for could not be found.

However, http://localhost:8080/bsms/public/index.php/about is working fine. I want to my URL free from index!
These are my routes

A: go to /public/index.php
and add blow code after define('LARAVEL_START', microtime(true));
/*
 * redirecting addresses with /index.php/
 * */
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if (strpos($url, '/index.php')) {
    $url = str_replace('/index.php', '', $url);
    header('Location: ' . $url);
    die();
}

A: Are you in localhost?
Try adding this line to your .htaccess file in your public folder:
RewriteBase /

So it should be like this:
<IfModule mod_rewrite.c>
RewriteBase /
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

If it doesn't work, try to give some more details about your project environment.
Also, url should be pointing to something like this:
bsms.test
or similar.

A: You should be able to access your about page through this url http://localhost:8080/bsms/about (taking in consideration that your view files are in resources folder and not in public folder).
Give it a try using these comands
php artisan config:clear
php artisan cache:clear
composer dump-autoload

And let us know how it goes.


text:
Q: Django doesn't email 500 error when using handler500 My Django app sends emails correctly to all the ADMINS as long as I don't have a custom error handler.
However, when I add a handler500 to show my custom 500_error.html page, no emails are sent. The 500_error.html page is shown properly. It seems that when you have a handler Django assumes that you take care of the error and thus does not mail anything. (Does this make any sense?)
My questions are:

*

*How can I still force Django to send emails even when the handler500 is used?, or

*How can I get the error description and mail it within my handler500 view function using send_email?
Thanks!

A: If all you want is to show a customized error page, then no handler is required.
Django will search for a template named 500.html in the root of your templates folder; if available it will be shown. If DEBUG = False, an email will be sent.
See the documentation:

If a view results in an exception, Django will, by default, call the
view django.views.defaults.server_error, which either produces a
"Server Error" message or loads and renders the template 500.html if
you created it in your root template directory.

See also Django, creating a custom 500/404 error page

A: Ok, the issue was that the function called by handler500 needs to return a 500 status code for Django to sed the email.
Setting this handler sends the email to the Admins and also shows the custom template:
def handler500(request):
    t = loader.get_template('500_error.html')
    response = HttpResponseServerError(t.render())
    response.status_code = 500
    return response