text:
Q: How can I fix DNS resolution on second router in home network? Symptom:
Delays of up to 30 seconds resolving DNS when plugged in to or Wif Connected to second router.
Ping can take just as long via domain name, near instant via IP
No problems when connecting directly to the router with direct internet connection
Problem presents regardless of OS or of the connection method (wired vs wifi)
Infrastructure Physical Setup:
Plusnet provided Technicolor TG582n (4 x 100 Mbit, Wifi) - Connected to ISP over ADSL
D-Link DSR-250n (8 x 1000 Mbit, Wifi) - Connected to above router using WAN port
PC - Connected to D-Link, wired
Laptop - Connected to D-Link, Wi-Fi
Numerous android devices
Software / Firmware Settings:

*

*ADSL router - Wifi off. DMZ set to 2nd router. IP 192.168.1.254

*D-Link router - WAN interface IP 192.168.1.66. Internet set up as "Dynamic IP (DHCP)" and DNS as "Get dynamically from ISP"
LAN IP 192.168.0.200. DHCP server on. DNS servers 212.159.13.49 (primary) 8.8.4.4 (secondary). DNS Proxy off.

Attempted fixes:
Setting DNS server IPs manually on client PC, tablet etc... No improvement
Disabling DNS Proxy on Router no effect
Disabling DHCP on second router manually setting IP/DNS/Gateway

A: The Tecnicolor modem/routers allow you to give one device (by its MAC address) on your internal LAN the "public" IP. This, essentially, puts that device in the DMZ but, at the same time, the device is contactable through your public IP - basically turning the Tecnicolor into just a modem.
As your DMZ device is also a router providing NAT and DHCP I would recommend you disable the DHCP server capabilities of your Tecnicolor router as this will cause problems. I would also recommend turning off the LAN and WiFi capabilities of the Tecnicolor as accidentally connecting to these will only give you Internet and no ability to connect to the other LAN.
Apart from managing the Tecnicolor modem through its GUI you'll never need to use its addresses as your other router is doing all the work.

A: I can't comment yet so will put this as an answer. Try first pinging a host name with a . on the end. Eg if ping www.google.com takes 30s to resolve then try ping www.google.com. and see if you get a response right away. If you do you have a DNS suffix issue. You should be able to adjust this in the DHCP settings.


text:
Q: Problem with Identity generation when using nHibernate with MySql Please, help! I new to nHibernate and I stuck on problem - I can't create new persisted object via NHibernate (2)
In this code:
foreach (var item in items)
{
 if (item.price > 0)
 {
  if (_itemsForBuy.FirstOrDefault(i => item.itemid == i.itemId) == null)
  {
   var ifb = new ItemForBuy()
   {
    id = 0,
    item = item,
    count = 100
   };

   ISession session = SessionHelper.CurrentSession;
   ifb.id = (int)session.Save(ifb); //at first iteration returs 0, at second - exception
   _itemsForBuy.Add(ifb);
  }
 }
}

...on second iteration thrown exception:

could not insert:
  [xxx.ItemForBuy][SQL: INSERT INTO
  itemsforbuy (count, itemid) VALUES (?,
  ?)]

with inner exception:

Duplicate entry '0' for key 'PRIMARY'

ItemForBuy.hbm.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="xxx"
                   namespace="xxx">

  <class name="ItemForBuy" table="itemsforbuy" lazy ="false">

    <id name="id" type="Int32" column="id" unsaved-value="0">
      <generator class="identity"/>
    </id>
...

class:
public class ItemForBuy
{
 public int id
 {
  get;
  set;
 }
...

in db:
CREATE  TABLE IF NOT EXISTS `xxx`.`itemsforbuy` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `itemid` INT NOT NULL ,
  `count` INT NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB

What I doing wrong?

A: Try this generator:
<id name="Id" column="Id" type="int">
    <generator class="native"></generator>
</id>

NHibernate and MySql - a simple example on how to use it

A: Problem solved. The reason was in not AUTO_INCREMENT 'id' field. I didn't synchronize MySQL Workbench with DB, and I thought that id is auto increment, but it wasn't true.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Projections of set on coordinate planes I want to take the projection of this ellipsoid into x-y, y-z and z-x plane. How can I do it?
ContourPlot3D[200.456+2.340*10^10*x^2+7.99*10^7*y^2+y*(2.80*10^(-9)-1.1735*10^6*z) -
29150.591*z+1.895*10^6*z^2+x*(-4.329*10^6-9.731*10^7*y+3.135*10^8*z)==1,
{x,0.00008,0.00011},{y,-0.00011,0.00022},{z,-0.0015,0.0015}]

A: 3D ellipsoid surface:
L[x_, y_, z_] = 200.4 + 2.3*10^10 x^2 + 8*10^7 y^2 + y*(2.8*10^-9 - 1.17*10^6*z) -
  29150.6*z + 1.9*10^6*z^2 + x*(-4.3*10^6 - 9.73*10^7*y + 3.13*10^8*z) == 1;

project onto the $yz$ plane:
fx[y_, z_] = Resolve[Exists[x, L[x, y, z]], Reals]
(*    -1.97537*10^-8 - 0.000113839 y + 1. y^2 + 1.35294*10^-6 z - 0.00635739 y z + 0.0104524 z^2 <= 0    *)

project onto the $xz$ plane:
fy[x_, z_] = Resolve[Exists[y, L[x, y, z]], Reals]
(*    8.68073*10^-9 - 0.000187197 x + 1. x^2 - 1.26905*10^-6 z + 0.0135952 x z + 0.0000825289 z^2 <= 0    *)

project onto the $xy$ plane:
fz[x_, y_] = Resolve[Exists[z, L[x, y, z]], Reals]
(*    8.66424*10^-9 - 0.000187837 x + 1. x^2 - 8.87824*10^-7 y - 0.00009189 x y + 0.00789566 y^2 <= 0    *)

plots:
{RegionPlot[fx[y, z], {y, -0.00011, 0.00022}, {z, -0.0015, 0.0015}],
 RegionPlot[fy[x, z], {x, 0.00008, 0.00011}, {z, -0.0015, 0.0015}],
 RegionPlot[fz[x, y], {x, 0.00008, 0.00011}, {y, -0.00011, 0.00022}]} // GraphicsRow

A: If I correctly understand it, the OP asked about the subset within ranges {x,0.00008,0.00011}, {y,-0.00011,0.00022}, {z,-0.0015,0.0015}, This subset can be treated as
r = ImplicitRegion[200.4 + 2.3*10^10 x^2 + 8*10^7 y^2 + y*(2.8*10^-9 - 1.17*10^6*z) -
 29150.6*z + 1.9*10^6*z^2 +
 x*(-4.3*10^6 - 9.73*10^7*y + 3.13*10^8*z) == 1 && x >= 0.00008 &&
x <= 0.00011 && y >= -0.00011 && y <= 0.00022 && z >= -0.0015 && z <= 0.0015, {x, y, z}]

One of the ways to see its projection on $xOy$ plane consists in the specific point view, namely,
Region[r, ViewPoint -> {0, 0, Infinity}]

The two other projections are obtained by
Region[r, ViewPoint -> {0, Infinity, 0}]

and
Region[r, ViewPoint -> {Infinity, 0, 0}]

You may improve the qualities of the plots on your own.


text:
Q: How to upgrade Redhat 5.5 to 5.6 We have two server running on RHEL 5.5. Now we have to upgrade it to 5.6
What are the steps to upgrade it and also the prerequisites

A: Some sources say to:

Aquire the 5.6 repository information from the RedHat website, then do
# yum update

Although the RHEL documentation, albeit not very clear, says to use the CD/installer and select the "upgrade" option. See Common Tasks (chapter 24).

A: Have a look at CentOS 5.6 Release-Notes - Known Issues. The same should be true for RHEL 5.6.
Since you are upgrading from 5.5 (and NOT an earlier version) to 5.6
yum update after

*

*Applying the most recent 5.5 patches

*Changing of the 5.5 repositories to the 5.6 repositories

Should be enough. The described iSCSI-client-bug might apply to you.


text:
Q: Enumerate, print previous I have a dictionary that looks something like this:
{'NM_014043': [(0, 34), (13176, 13268), (18191, 18386), (22352, 22455), (25881, 25988), (26189, 26300)],

and a file that contains a positions, as such:
isoform    pos_rein
NM_014043    13177

I've written my script as shown below:
import csv
with open('splicing_reinitialized.txt') as f:
    reader = csv.DictReader(f,delimiter="\t")
    for row in reader:
        pos = row['pos_rein']
        name = row['isoform']
        ppos1 = int(pos)
        if name in exons:
            y = exons[name]
            for i, (low,high) in enumerate(exons[name]):
                if low -3 <= ppos1 <= high + 6:
                    exonnumber = i+1
                    values = (low,high)
                    print values

My problems is that my values variable prints the current set of numbers it's associated with (in this case (13176, 13268)), but what I want to do is to print the previous numbers (0, 34) instead of the numbers the position is associated with. Is there anyway to do such a thing easily?

A: Just store the current numbers in the loop; the next iteration they'll be the previous values until you assign again:
previous = None
for i, (low,high) in enumerate(exons[name]):
    if low -3 <= ppos1 <= high + 6:
        exonnumber = i+1
        print previous
        previous = low, high

A: Like this?
previous_values = exons[name][i-1]

Note that Martijn's solution handles the first value more gracefully (previous == None rather than having to check for i==0).

A: First you may alter this rows (to be more transparent):
y = exons[name]
for i, (low,high) in enumerate(y)

then you will get the previous element with y[i-1] for further processing and as print e.g.:
print y[i-1]


text:
Q: Enforce testing order in python's unittest test suite I have written code that finds all of the tests that can be run in a package and gathers them into a single test suite. The only thing is that some of the tests are dependent on other tests already being run.
That might seem like bad test architecture but what I'm testing is the startup and shutdown of an application. So I have tests that makes sure everything comes to life appropriately, and then another set of tests that make sure that everything is cleaned up properly. Obviously though, I can't run the shutdown tests until the startup tests have finished.
Is it possible within Python's unittest to say "only run this test if the following is true, otherwise run other tests and come back to me"?
I understand that I could enforce this ordering by explicitly saying run the startup tests, now run the shutdown tests. But I'm using test discovery so that you can write more tests without explicitly having to invoke them so I am trying to avoid doing that.

A: The unittest module requires each test to be able to run independently:  no dependence on other tests running before or after. However, you can depend on other code to run before or after each test by adding setUp() or tearDown() methods to a test class. You can also depend on other code to run before or after a group of tests with setUpClass(), setUpModule(), and their tear downs.
I think there's even more flexibility in the PyTest fixtures, but I haven't used them much.


text:
Q: How to execute a bash script to configure channel MQ? #!/bin/bash
su - mqm -c " echo 'define channel(CLSTQ1.ESBQM) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('example.corp(1414)') CLUSTER(CLSTQ1) DESCR('tcp cluster receirver channel for QM ESBQM')' | runmqsc ESBQM "

when i execute this script I have the following errors:

-bash: -c: line 0: syntax error near unexpected token \`('
-bash: -c: line 0: ` echo 'define channel(CLSTQ1.ESBQM) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('example.corp(1414)')  CLUSTER(CLSTQ1) DESCR(tcp cluster receirver channel for QM ESBQM)' | runmqsc ESBQM '

A: That's not a good way to do it.
Do the following:
(1) Put your MQSC commands in a file.  Lets call it crt_chl.mqsc
define channel(CLSTQ1.ESBQM) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('example.corp(1414)') CLUSTER(CLSTQ1) DESCR('tcp cluster receirver channel for QM ESBQM')

(2) Issue the command as follows:
su - mqm -c "runmqsc ESBQM < crt_chl.mqsc > crt_chl.mqsc.out"
(3) Now check the bottom of the crt_chl.mqsc.out file to see if it was successful or had errors.

A: You could also do it this way in one line:
echo "define channel(CLSTQ1.ESBQM) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('example.corp(1414)') CLUSTER(CLSTQ1) DESCR('tcp cluster receirver channel for QM ESBQM')" | su - mqm -c "runmqsc ESBQM"


text:
Q: Malayalam on LaTeX with Ubuntu 18.04 Long back (on SuSE) i used to have the Malayalam package for LaTeX. It worked well. I could use the old script (old "lipi"). Now I am on Ubuntu (18.04). I installed the Malayalam package again but it does not work. When compiling I get
mal: Command not found
The advantage of the package is that I don't have to type in Malayalam.
Posted the question on usenet. Until now no response. Also wrote to Alex (who created the package). No response
Has anybody got a solution. It will be a great help.
Also need help for Malayalam typing on Ubuntu but in the old "lipi" (script).Tried Rachana, Anjali, Mira etc. All I get is the new "lipi"

A: At first we need to install TeXLive:
sudo apt-get install texlive-latex-base texlive-latex-extra texlive-latex-recommended

Then get LaTeX for Malayalam tarball:
cd ~/Downloads
wget https://alex.org.in/wp-content/alex.org.in-uploads/2017/07/malayalam-latex-0.9.7.tar.gz
tar -xf malayalam-latex-0.9.7.tar.gz
cd malayalam-latex-0.9.7/
sudo ./install.sh # install agreeing with all default

Then create example file with contents from 3.3.1 of official PDF:
cat << EOF > test.mm
\documentclass[a4,12pt]{article}
\usepackage[rachana]{malayalam}
\begin{document}
\noindent

<m>
atiprAcInakAlaMmutalkkutanne shabdan"n"aLuTEyuM
bhAvahAvAdikaLuTEyuM sahAyattOTukUTi AshayaprakaTanaM
naTattAn manuSyaR paThiccukazhin~n~irunnu.
manuSyasharIrattinnuLLilttanneyuLLa h.rdayaM,
shvAsakOshaM ennI avayavan"n"aLuTe kramaMteRRAteyuLLa
calanaM avann tALabOdhattinnuLLa AdyapAThan"n"aL
nalkiyirikkaNaM. atupOlettanne prak.rtiyilninnuM
avan nityEna kELkkunna saMgItaM---atAyat pakSikaLuTe
kaLakUjanan"n"aL, kARRinRe maRmmarashabdaM, tEnIccakaLuTe
mULakkaM, ozhukunna veLLattinRe kaLakaLashabdaM,
muLan"kATukaLkkiTayilUTe kARRaTikkunpOzhuNTAkunna
cULaMviLi, m.rgan"n"aLuTe vividharItiyiluLLa shabdan"n"aL
tuTan"n"iyavayellAM---avanRe saMgItAsvAdanashESiyEyuM
kramaprav.rddhamAyi vaLaRttikkoNTuvannu. manuSyamastiSkkattinRe
vaLaRccayuTe tOtanusaricc madhurasvaran"n"aL kETTAsvadikkAnuLLa
ceviyuTe kazhiv dinaMprati vaLaRnnuvannu. jIvitOpAdhikaL
sanpAdikkAnuLLa kUTTAya pravaRttanan"n"aLkkiTayil
AshayavinimayattinRe AvashyakatayuM tanmUlaM bhASayuM
utbhaviccu vikasiccatupOlettanne jIvitaklEshan"n"aLkkiTayil
ninnu niR{}v.rtiyuM, kUTTAya addhvAnattinnuLLa pracOdanavuM
nETENTa AvashyattinnanusariccAN<<+ manuSyanRe
saMgItaparamAya kazhivukaLuM vaLaRnnu vikasiccat.
</m>

\end{document}
EOF

Note: I know nothing about Malayalam scripts, adjust file above for correct script.
Then pre-process this file:
mal test.mm rachana

Utility for pre-processing Malayalam LaTeX source files
Alex A.J. <tex@alex.org.in>

Using Rachana (old lipi)...

File successfully preprocessed.

Please run (pdf)LaTeX on the generated tex file.

run LaTeX
pdflatex test.tex

and see the output:
xdg-open test.pdf


text:
Q: Affine neighbourhood containing two given points
Let $X$ be a quasi-projective variety and two distinct points $P,Q\in X$. Prove there is an affine open subset $\mathcal{U}\subset X$ containing both $P$ and $Q$.

Assuming $X\subset \mathbb{A}^n$ is an affine variety, we can take any linear form $L$ with $L(P)=L(Q)=0$. Therefore $P,Q\notin V(L+1)$, so that $P,Q\in X\setminus V(L+1)$, which is an affine open subset of $X$.
I'm trying to argue that we can assume $X$ is affine without loss of generality, but I don't know if this is possible. If not, how could I solve this?


text:
Q: Integrating Twitter like IOS - 5 i want to integrate twitter like IOS- 5 in my app. like IOS-5 i want to tweet images from my app. is there any library for this ?

A: Hi i got sample code for this http://developer.apple.com/library/ios/#samplecode/Tweeting/Introduction/Intro.html here.
in this code inside - (IBAction)sendEasyTweet:(id)sender {
    [tweetViewController addImage:[UIImage imageNamed:@"Icon.png"]];
}
you can send image too.thanks devXcode and Irene for your help

A: Or you can try ShareKit, http://getsharekit.com/.
If you just want to integrate twitter, you can follow https://dev.twitter.com/docs/ios.
If you just want to support iOS 5, there is built in twitter integration in iOS 5.


text:
Q: node - On kill event Is there a way to run a function when the node.js process is killed?
This is what I'm aiming for (in C):
signal(SIGSEGV, sig_handler);

void sig_handler(int sig) {
    if (sig == SIGSEGV) {
        // do stuff
    }
}

So, is it possible to do this in node.js?

A: Yep,
process.on('SIGINT', function() {
  console.log('Got SIGINT.  Press Control-D to exit.');
});

Taken from the documentation:
http://nodejs.org/api/process.html#process_signal_events


text:
Q: substitute for System.Net.Icertificatepolicy in WP7 I was trying to use secure web service URL in my WP7 Application but do not want to for installation  of certificates on each device. I find that there is no IcertificatePolicy Interface in WP7, which available in .Net.
In .Net i have used this many times to communicate with secure web services without installing certificates on the the client machine.
The code for .Net is available in this article Click here
But not able to find its substitute in WP7. Is this available in WP7 or 7.1?
Please suggest what can i do.

A: Windows Phone 7 has limited support for working with anything but a very small number of Root CAs and does not include (as you've discovered) an easy way to work around this.
I'd expect that the cost of a suitable SSL certificate will be much less than the time you spend trying to find a workaround.

A: Be aware this disables certification validation!
You can try this, data will still be encrypted.
public class CustomCertificationPolicy: ICertificatePolicy
{
    /// <summary>
    /// Disable validation and accept the certificate.
    /// </summary>
    /// <param name="srvPoint"></param>
    /// <param name="certificate"></param>
    /// <param name="request"></param>
    /// <param name="certificateProblem"></param>
    /// <returns></returns>
    public bool CheckValidationResult(ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, WebRequest request, int certificateProblem)
    {
        return true;
    }
}

Be aware this disables certification validation!


text:
Q: How can I search through a 2D array to make sure that the there are not more than 3 consecutive chars? I have a 2D array of 3 random chars, a, b, and c.  I need to make sure that no column or row has three or more repeating chars.
I'm not really sure how to check the arrays. I think I need to use a loop to go through the array but I'm not sure how to check if there are repeats. To clarify,
if a column has three A's in a row that would not be allowed or could 3 B's be in a column, etc.
So if it is like AAA in 3 consecutive array index (in terms of rows and columns), it should stop.

A: You need to use for loops if you know the indexes of your array.
so lets say:
char[][] arr= new char[20][20];

for(int i=0; i<18;i++){
  for(int j=0; j<18;j++){
   if( arr[i][j] ==arr[i][j+1] && arr[i][j] == arr[i][j+2]))
     {
      break;//mark it as Duplicate
      }
   else if (arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+2][j])
      {
      break;//mark it as Duplicate
      }
   else
     continue;
   }
 }

So basically you are traversing the array and comparing 3 consecutive elements together. if they are equal it breaks.

A: You can use an automaton.  One to recognize sequences of AAA, BBB and CCC is:
state   input   next   stop
=====   =====   ====   ====
0       A       a1     no
0       B       b1     no
0       C       c1     no
a1      A       a2     no
a1      B       b1     no
a1      C       c1     no
b1      A       a1     no
b1      B       b2     no
b1      C       c1     no
c1      A       a1     no
c1      B       b1     no
c1      C       c2     no
a2      A       3      yes
a2      B       b1     no
a2      C       c1     no
b2      A       a1     no
b2      B       3      yes
b2      C       c1     no
c2      A       a1     no
c2      B       b1     no
c2      C       3      yes
3       A       3      yes
3       B       3      yes
3       C       3      yes

you can run this automaton for each row and for each column and stop as soon as you get output yes (it has detected three consecutive letters)  You'll get stopped as soon as you recognize the first occurrence of three consecutive letters with only two passes (one for the rows, other for the columns) through the matrix.  Of course, initial state is 0.


text:
Q: How to deal with binary data in php (not binary string)? I wrote a C++ program which send POST data to php. My data is 123456 in binary, which is 0x0001e240.
My php file reads like
$f=fopen("php://input", "r");
if (!$f) die ("cannot open");
$data = fread($f, 4);
echo $data;

In my receiving program (in C++), I can see the echoed data is exactly 0x0001e240, so I believe php did accept a pure binary thing and saved into $data.
However, I want to get 123456 in php. I tried functions like bindec, hexdec, and so on but none of them works. How can I get the number from $data.
Also, do I need to care about endians in php? I am working locally now with windows environment but I will finally put my codes onto cloud.
Edit
$f=fopen("test.bin", "rb");
if (!$f) die ("cannot open");
$data = fread($f, 4);
echo $data;

where test.bin is a bin file which contains 0x0001e240. It seems that I got a string in $data which is composited with ASCII of 0x00, 0x01, 0xe2, and 0x40. How can I make them into a number value?

A: You can use unpack:
$num = unpack('n', $data);

Use an uppercase letter for an unsigned integer, and a v (or V) for little-endian. Yes, you have to worry about endianness. Just find out what it is and stick with it.


text:
Q: Complex Analysis proof Suppose that $z_0$ is a pole of $f$ of order $n$. Then:
$$Res_{z=z_0} (f(z)) = \frac{1}{(n-1)!} \lim _{z \to z_0} \frac{d^{n-1}}{dz^{n-1}} ((z-z_0)^{n} f(z))$$
How would I go about proving this?

A: Do you know that the residue is the coefficient of $(z-z_0)^{-1}$?

A: The $(z-z_0)^{-1}$ coefficient of $f(z)$ is the $(z-z_0)^{n-1}$ coefficient of $(z-z_0)^nf(z)$, the latter of which is analytic in a neighborhood of $z_0$. Take a Taylor expansion then and note the $(n-1)$th coefficient...

A: Consider the Cauchy integral formula.
It implies for $g(z)$ analytic in neighborhood of $z_0$
$$\frac{1}{2\pi i} \oint_\gamma \frac{g(z)}{(z-z_0)^n} dz
= \frac{1}{(n-1)!} \frac{d^{n-1}}{dz^{n-1}} g(z)|_{z=z_0}.$$
Let $g(z) = (z-z_0)^n f(z)$.
Since the singularity of $f(z)$ at $z_0$ is isolated and of order $n$, $g(z)$ is analytic in a neighborhood of $z_0$.
Therefore,
$$\begin{eqnarray}
\frac{1}{2\pi i} \oint_\gamma f(z) dz
&=& \mathrm{Res}_{z=z_0} f(z)\\
&=& \frac{1}{(n-1)!} \frac{d^{n-1}}{dz^{n-1}} [(z-z_0)^n f(z)]|_{z=z_0}.
\end{eqnarray}$$

A: If $f(z)$ has a pole of order $n$ at $z_0$, then for some neighborhood $U$ of $z_0$, we have
$$f(z)=g(z)+\frac{a_{-1}}{z-z_0}+\frac{a_{-2}}{(z-z_0)^2}+\cdots+\frac{a_{-n}}{(z-z_0)^n}\mbox{ for }z\in U-\{z_0\},$$
where $g$ is a holomorphic function in $U$.
This implies that
$$(z-z_0)^nf(z)=(z-z_0)^ng(z)+(z-z_0)^{n-1}a_{-1}+(z-z_0)^{n-2}a_{-2}+\cdots+a_{-n} \mbox{ for }z\in U-\{z_0\}.$$
Differentiate it $(n-1)$-times, we have
$$\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^nf(z)$$
$$=\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^ng(z)+\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^{n-1}a_{-1}+\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^{n-2}a_{-2}+\cdots+\frac{d^{n-1}}{dz^{n-1}}a_{-n}$$
$$=\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^ng(z)+\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^{n-1}a_{-1}$$
$$=(z-z_0)G(z)+(n-1)!a_{-1}$$
for some holomorphic function $G$ in $U$. (In fact, $G$ can be written down explicitly in terms of $g$ and its derivative by using binormal theorem). Taking limit, we obtain
$$\lim_{z\to z_0}\frac{d^{n-1}}{dz^{n-1}}(z-z_0)^nf(z)=\lim_{z\to z_0}(z-z_0)G(z)+(n-1)!a_{-1}=(n-1)!a_{-1}=
(n-1)!Res_{z=z_0}(f(z)).$$


text:
Q: Have I misunderstood the scope of this default argument shared_ptr? Take a look at this:
#include <iostream>
#include <memory>

using Foo = int;
using FooPtr = std::shared_ptr<Foo>;

FooPtr makeFoo()
{
    FooPtr f{
        new Foo(),
        [](Foo* ptr) {
            delete ptr;

            std::cerr << "!\n";
        }
    };

    return f;
}

void bar(FooPtr p = {})
{
    p = makeFoo();
}

int main()
{
    bar();
}

// Expected output: '!'
// Failure case: no output (deleter not invoked?)

I expected the shared_ptr deleter to be called when bar() returns, and on my 64-bit CentOS 7 system using GCC 4.8.5, it does.
However, on my 32-bit CentOS 6 system using GCC 4.8.2 under devtoolset-2 (also I think under gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux, my Raspberry Pi toolchain), it doesn't.
Looking at the code, and given C++11's experimental nature in 4.8, this smells like a compiler bug to me. But I could also be falling into a UB trap somewhere (or just generally misunderstanding how this stuff ought to work).
Who's at fault? And how should I fix it?

Works on
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

Fails on
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/i686-redhat-linux/4.8.2/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-i686-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-i686-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-i686-redhat-linux/mpc-install --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

A: The destructor should be called either when bar returns or and the end of the full expression in which bar is called.
If we look at [expr.call]/4 (C++17 draft) we have

When a function is called, each parameter (11.3.5) shall be initialized (11.6, 15.8, 15.1) with its corresponding argument.[...]It is implementation-defined whether the lifetime of a parameter ends when the function in which it is defined returns or at the end of the enclosing full-expression.[...]

So p should be initialized to a null FooPtr at the start of the function, move assigned the return of MakeFoo, and then finally destroyed (in turn calling the deleter) at the end of bar or after bar returns in main.

A: As Nathan has shown, my assumptions about the pointer's lifetime were standard-correct.
That the deleter isn't being invoked does appear to be a GCC or libstdc++ bug, possibly bug 60367 given that the linked comment solves it, the symptoms seem similarish and it was fixed before GCC 4.8.5.
Replacing = {} with = FooPtr{} appears to be a viable workaround.

Note well, there is also a regression in 7.2 and some older "8.0" trunk builds that may cause bad behaviour in similar circumstances (thanks Arne Vogel!).


text:
Q: HTML Strict validation is not recognizing my imported documents? I am just validating my webpage and working through the errors. the scenario I have is that I have the structure where I import a header file, through <?php include ('header.php') ?> and also with my navigation file. Now in terms of seeing it in the browser this works, but when I validate with XHMTL1.1 strict it comes up with the error.
So I have an index.php which imports both the header.php and navigation.php - now as I am writing this I am realizing that the navigation.php does not get the css file imported into it, but does the validator not just read the html? so there it should pick it up and see that it gets the information?
Please let me know if I am on the right track with this, otherwise it seems that you sacrifice validation for a structured website??
Cheers Jeff PS Happy New Year:-)
EDIT CODE:

URI: http://thepalmsmarket.co.nz/index.php    a
  276   9     there is no attribute "id"  a
  276   24    there is no attribute "class"   a
  276   38    element "nav" undefined

I these are the last errors and they are related to this code:
index.php:
<?php include_once ("01includes/header.php"); ?>

<?php include_once ("01includes/navigation.php"); ?>

navigation.php:

    <?php
        $subject_set = mysql_query("SELECT * FROM webMenu", $dbconnect);
        if (!$subject_set) {
        die("Database query failed: " . mysql_error());
        }
        while ($subject = mysql_fetch_array($subject_set)) {
        echo "
{$subject["menuItem"]}
"; }
    ?>

The css is declared in desktop.css which is imported into header.php, but not into navigation.php as that would be a double up - hope that makes sense:-)

A: Good news: nothing to do with PHP. You appear to be using the nav tag, which is new in HTML5, while validating against the XHTML 1.1 Strict.  If you switch to an HTML5 declaration, so that you can use  nav in a nice, valid, semantic way, then you'll have to chase down a few other validation errors (mostly related to the meta tags, and then use of a deprecated border attribute further on in your code -- the validation errors should be self-explanatory).  If you want to keep on with XHTML, then drop the use of  nav to be valid.


text:
Q: faithful irreducible representation of linear algebraic group over reals Is it true that if a linear algebraic group defined over $\mathbb{R}$ has a faithful irreducible representation, then it is reductive?

A: Being defined over $\mathbf{R}$ is not really an issue (since $\mathbf{R}$ is perfect). In fact, a linear algebraic group $G$ over a perfect field $k$ is reductive if and only if the group $G_K$ obtained by base change is reductive, where $K$ is an algebraic closure of $k$. So you may as well ask the question for linear algebraic groups over $\mathbf{C}$, or any algebraically closed field $k$.
Now suppose that $V$ is a faithful irreducible representation over the algebraically closed field $k$. Our goal is to argue that the unipotent radical $R$ of $G$ is trivial.
Since $R$ is unipotent, the only irreducible linear representation of $R$ is the trivial representation $k$. It follows that the space of $R$-fixed points $V^R$ is non-zero (this space is just the socle of $V$ as an $R$-module, and the socle is always non-zero).
Since $R$ is normal in $G$, the subspace $V^R$ is $G$-invariant. Since $V$ is an irreducible $G$-module, conclude that $V = V^R$, so that $R$ acts trivially on $V$. Since $V$ is a faithful representation for $G$, it now follows that $R$ is trivial, as required.


text:
Q: How to connect a Glassfish client to Glassfish JMS server when thread creation is not allowed? I have an application in which a client component is run in a "managed" environment (as an Adobe InDesign plugin). In this "managed" environment, it doesn't seem possible to create threads during execution, but only at application startup.
This client component connects to a Glassfish server through JNDI and RMI/IIOP to perform various EJB method calls that all work perfectly (except for some cumbersome CORBA serialization issues that are not important here). I would like to have it also connect using JMS, to perform some topic reading. The code I use to perform those topic reading is already under unit tests, making sure it can start, read the topic, and perform required integration (this is more an integration test than an unit test, but I have to be sure of my application communication layer, no ?). This code, when run in a unit test, perfectly works. Unfortunatly, when run from my client component (embedded in Indesign, and having no ability to create threads), it fails with a NullPointerException the following way :
29 mai 2012 18:07:22 com.sun.enterprise.connectors.ActiveRAFactory getActiveRA
INFO: Deployed RAR [ jmsra ] has inbound artifacts, but the runtime does not support it. Providing only outbound support
29 mai 2012 18:07:22 org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator 4.2.0.Final
29 mai 2012 18:07:24 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:  4.5  (Build 29-b) Compile:  Wed Feb  9 22:53:30 PST 2011
29 mai 2012 18:07:24 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is EMBEDDED, connection mode is Direct
29 mai 2012 18:12:58 com.sun.messaging.jms.blc.LifecycleManagedBroker start
GRAVE: MQJMSRA_RA4001: start:Aborting:Exception starting EMBEDDED broker=java.lang.NullPointerException
29 mai 2012 18:12:58 com.sun.messaging.jms.blc.LifecycleManagedBroker start
INFO: SJSMQ LifecycleManagedBroker configuration=
    brokerInstanceName       =imqbroker
    brokerBindAddress        =null
    brokerPort               =7676
    brokerHomeDir            =C:\Java-ext\glassfish3\mq
    brokerLibDir             =C:\Java-ext\glassfish3\mq\lib
    brokerVarDir             =C:\Java-ext\glassfish3\glassfish\domains\autocat\imq
    brokerJavaDir            =C:\Program Files\Java\jdk1.6.0_30\jre
    brokerArgs               =null
    MasterBroker             =null
    brokerId                 =null
    adminUsername            =admin
    adminPassword            =<default>
    adminPassFile            =null
    ConnectionURL            =mq://localhost:7676/
    dbType                   =null
    dbProps                  ={}
    dsProps                  ={}
    useJNDIRmiServiceURL     =true
    useSSLJMXConnector       =true
    brokerEnableHA           =false
    clusterId                =null
    rmiRegistryPort          =7776
    startRmiRegistry         =true
    brokerStartTimeout       =  jmxServiceURL            =null
60000

29 mai 2012 18:12:58 com.sun.enterprise.connectors.ActiveOutboundResourceAdapter init
GRAVE: RAR6035 : Resource adapter start failed.
javax.resource.spi.ResourceAdapterInternalException: MQJMSRA_RA4001: start:Aborting:Exception starting EMBEDDED broker=java.lang.NullPointerException
    at com.sun.messaging.jms.blc.LifecycleManagedBroker.start(LifecycleManagedBroker.java:458)
    at com.sun.messaging.jms.ra.ResourceAdapter.start(ResourceAdapter.java:380)
    at com.sun.enterprise.connectors.ActiveOutboundResourceAdapter.startResourceAdapter(ActiveOutboundResourceAdapter.java:182)
    at com.sun.enterprise.connectors.ActiveOutboundResourceAdapter.init(ActiveOutboundResourceAdapter.java:129)
    at com.sun.enterprise.connectors.ActiveRAFactory.instantiateActiveResourceAdapter(ActiveRAFactory.java:135)
    at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:106)
    at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:212)
    at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:379)
    at com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:107)
    at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
    at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at fr.perigee.autocat.indesign.remoting.jndi.jms.AdapterJMSListener.getConsumer(AdapterJMSListener.java:261)
    at fr.perigee.autocat.indesign.remoting.jndi.jms.AdapterJMSListener$AdapterJMSListenerRunnable.run(AdapterJMSListener.java:50)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at com.sun.messaging.jmq.jmsclient.runtime.impl.BrokerInstanceImpl.start(BrokerInstanceImpl.java:211)
    at com.sun.messaging.jms.blc.EmbeddedBrokerRunner.start(EmbeddedBrokerRunner.java:331)
    at com.sun.messaging.jms.blc.LifecycleManagedBroker.start(LifecycleManagedBroker.java:454)
    ... 24 more
Caused by: java.lang.NullPointerException
    at com.sun.messaging.jmq.jmsserver.data.TransactionList.<init>(TransactionList.java:182)
    at com.sun.messaging.jmq.jmsserver.Broker._start(Broker.java:1170)
    at com.sun.messaging.jmq.jmsserver.Broker.start(Broker.java:456)
    at com.sun.messaging.jmq.jmsserver.BrokerProcess.start(BrokerProcess.java:164)
    at com.sun.messaging.jmq.jmsserver.DirectBrokerProcess.start(DirectBrokerProcess.java:92)
    at com.sun.messaging.jmq.jmsclient.runtime.impl.BrokerInstanceImpl.start(BrokerInstanceImpl.java:206)
    ... 26 more

From what I have discovered so far, client code obtains connection to JMS server (connection to mq://localhost://7676), but then fail to start a TransactionList. Uncompiled source code (thanks Jad !) shows that it fails there :
    /* 182*/Globals.getClusterManager().addEventListener(((ClusterListener) (this)));

Trying to debug that, I also found that my client can't start the org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager due to the same impossibility to create threads.
I guess there is something wrong somewhere, but what ? I don't know.
So, how can I tell the glassfish client environment that threads can only obtained from my personnal thread pool (created at application startup) instead of trying to create its own and failing miserably ?

A: Short version
I deployed my aplication using maven forgotting the jms-core.jar of Glassfish, as it is a runtime dependency of gf-client-module.jar, and my maven build only copied compile dependencies. Fixing the maven build fixed the issue.
Long version
Long version is more a story of fear, tears, and blood.
How did that clusterManager got null ?
As I initially had problems with that TransactionList associated ClusterManager, I tried to look into com.sun.messaging.jmq.jmsserver.Globals code how it was initialized. I foun d it was in a method aptly called Globals#initCLusterManager(MQAddress) which, using various class parameters (including a Properties object), loaded a ClusterManager that was to be used by my application. What ? A ClusterManager ? In client code ? What the hell is that (more on that later) ?
Anyway, that ClusterManager was loaded, but set to null afterwards (mainly due to a a use of loopback address in cluster config - once again, incredibly weird in a JMS client) ... So looking how it was initialized was apparently not the correct path to bug solving, which left me puzzled.
What to do when test pass, but production code stills bugs ?
As I said in question, I have a test, which does (to my understanding) exactly the same thing. Test always succeed, and production always fail. So there must be something different there, no ?
So i did something new to me : I put a breakpoint in that Globals#initClusterManager code, and tried to reach it using both code : production and test. As one may guess, breakpoint was reached in prod, but not in test ! So I moved my breakpoint at some place where I already knew it would be reached : ActiveRAFactory#getActiveRA(ConnectorDescriptor, String) ... (oh wait, no, I didn't put it there, but the place where I put that breakpoint told me the point where execution path became different was that method call, so I finally put my breakpoint there).
With that breakpoint, I immediatly noticed something strange : the call to
    Collection<ActiveResourceAdapter> activeRAs =  activeRAHabitat.getAllByContract(ActiveResourceAdapter.class);

returned different results depending upon the fact I was in test or in prod : I got 4 elements in my list in test (including the ActiveJmsResourceAdapter), but only 3 in production.
Different ResourceAdapter, but why ?
Then I was puzzled : I then tended to blame Glassfish HK2 for no other reason than being an IoC container I didn't yet know ... Turned out I was wrong, oh so wrong !
Revelation came from an expression eval in Eclipse debugger : I typed as an expression
com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.class

And all i got was a ClassNotFoundException ... wait ... a ClassNotFoundException ? And this class is in jms-core.jar ? I'm pretty sure that jar is in my production folder, no ? ... No ? NO ?
God damn it !
Turned out the maven-dependency-plugin I use to copy jars in that folder uses copy-dependencies with an includeScope configured to "compile".
Crazy bug with simple solution
So I added an other execution to copy-dependencies, configured to incldueScope "runtime", and all worked OK.


text:
Q: Problem on some Android devices (Empty view) I have an app on google play and since the latest release I've gotten two reviews about the content of the app not showing up. I've googled a whole bunch but can't seem to find anyone with the same problem. Can somebody help me?
If you look in the first picture, that's how the app is supposed to look like
https://imgur.com/a/MafFiw6
If you now look in the same gif which one of my users sent, you can see that the app is completely blank, except for the tabbar
https://imgur.com/a/39kNHiZ
I am calling setContentView in onCreate so that can't be it I guess
 override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.main_activity)

}
Any clues?


text:
Q: layout, layout-large, layout-normal and so on I restart to develop an app which I stop to work on it years ago.
I would to move from Eclipse to Android Studio, but before I tried to check if it works with the Nexus5 I actually have. The app was tested on Nexus S.
After compiling and starting I get a lot of NullPointerException and I saw that depends on different findViewById not resolved.
I was using only the res/layout folder.
I tryed to copy that folder to a new folder named res/layout-large and all works fine.
My questions are:

*

*Is there no way to use only res/layout ?

*I have to rename it to res/layout-normal because res/layout isn't anymore the default layout folder, or not?

*Do I need to introduce also the other folders (res/layout-normal and so on) ?

Thanks
Luca

A: -large -xlarge and so on have been deprecated for quite some time.
The documentation is not always up to date but it is recommended to use -sw<N>dp instead, for example layout-sw600dp
You don't have to use anything else than the base selector (layout, values, drawable, etc) for any kind of resource, so your problem seems to be in how you declare and use these resources.


text:
Q: JQuery controls associated to ASP.NET controls inside a TabContainer inside an UpdatePanel does not work I have an UpdatePanel control on my page that contains some ASP.NET controls that I need to associate with JQuery controls (DatePicker, TimePicker ...):
<script language="javascript" type="text/javascript">

function $(LoadDateAndTimePickers() {

    $("#" + '<%=fromDateTextBox.ClientID%>').datepicker();
    $("#" + '<%=toDateTextBox.ClientID%>').datepicker();
    $("#" + '<%=fromTimeTextBox.ClientID%>').timepicker({ showPeriod: true });
    $("#" + '<%=toTimeTextBox.ClientID%>').timepicker({ showPeriod: true }));

};

</script>

That is working fine on IE. However, that does not work on Chrome and FireFox as my ASP.NET controls are inside an UpdatePanel.
So, I have handled the Sys.WebForms.PageRequestManager endRequest event inside the UpdatePanel to be able to make it work on the mentioned browsers.
 <asp:UpdatePanel ID="updatePanel" runat="server">
    <ContentTemplate>
        <script  type="text/javascript" language="javascript">
            Sys.WebForms.PageRequestManager.getInstance().
                add_endRequest(LoadDateAndTimePickers)
        </script>

    .....

</asp:UpdatePanel>

That has worked just fine. But, on other pages I am placing my ASP.NET controls inside an *AJAX ToolKit * TabContainer control inside the UpdatePanel. Here endRequest handling stops working even if I place the handling script inside the TabContainer control.
Appreciate your help..

A: Maybe I don't understand you question yet but this simply worked when i tried it in all browsers that jquery supports:
This is my content head:
    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link href="ui/development-bundle/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet"
        type="text/css" />
    <script src="ui/development-bundle/ui/jquery-ui-1.8.12.custom.js" type="text/javascript"></script>
    <script src="ui/development-bundle/ui/jquery.effects.core.js" type="text/javascript"></script>
    <script src="ui/development-bundle/ui/jquery.ui.widget.js" type="text/javascript"></script>
    <script src="ui/development-bundle/ui/jquery.ui.datepicker.js" type="text/javascript"></script>

</asp:Content>

and this is on the page:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:UpdatePanel ID="pnlAjax" runat="server" ClientIDMode="Static">
    <ContentTemplate>
        <asp:TextBox runat="server" ID='txtMyFirstField'></asp:TextBox>
    </ContentTemplate>
</asp:UpdatePanel>

<script type="text/javascript">
    $(function () {
        $("#pnlAjax input").datepicker();
    });
</script>

A: I suggest to place the javascript out side the update panel. The render of the update panel did not ensure that the javascript inside panel will run, and that why you register the endRequest, to re-run javascript initialization after the update panel updates him self.


text:
Q: rails 3.2, how to write route for HTTP verb put, and use it in link_to? I am trying to write two links for reject& approve actions,
but, I don't know how to write the correct route,
my route.rb
put 'approve_class_room/:id(.:format)', :to => 'class_room_member_ships#approve'
put 'reject_class_room/:id(.:format)', :to => 'class_room_member_ships#reject'

but, in rake routes, I get:
PUT    /approve_class_room/:id(.:format) class_room_member_ships#approve
PUT    /reject_class_room/:id(.:format)  class_room_member_ships#reject

so, what would be the correct link_to path ?
my link is
= link_to 'approve', approve_class_room_path

it wont' work, I get:
undefined local variable or method `approve_class_room_path'

p.s: I am trying to have the link_to works using AJAX, to do the approve in the same page,
AM I on the right way ? what would be the link_to path ?
Any idea please ?

A: First, to clear the error you need to use named routes:
put 'approve_class_room/:id(.:format)', :to => 'class_room_member_ships#approve',
                                        :as => :approve_class_room
put 'reject_class_room/:id(.:format)', :to => 'class_room_member_ships#reject',
                                       :as => :reject_class_room

Then, to perform a PUT request, you need to include the :method option in your link_to call:
link_to 'approve', approve_class_room_path, :method => :put
link_to 'reject', reject_class_room_path, :method => :put

If you are getting a 404 that results in a GET request instead of a PUT request, it's because the :method => :put option relied on JavaScript.  You'll need to make sure jquery-rails is properly integrated in your app.

A: This may not clear that error, but since the request is a put, you need to specify that in the link_to:
= link_to 'approve', approve_class_room_path, :method => :put

For the route, I think adding this would make the error go away:
put 'approve_class_room/:id(.:format)', :to => 'class_room_member_ships#approve', :as => :approve_class_room


text:
Q: MUI Modal/Popover/Drawer don't allow Usersnap to register input I use MUI v4 in my react gastby app and integrated Usersnap with gatsby-base.js using
import React from 'react'
import { Helmet } from 'react-helmet'

// Replace with the API keys from your widget installation page
const USERSNAP_GLOBAL_API_KEY = '<YOUR_USERSNAP_GLOBAL_API_KEY>'

/* Render this anywhere in your tree (preferably at the top of your app) to invoke the usersnap widget.
 */
const UserSnap = () => {
  return (
    <Helmet>
      <script type="text/javascript">
        {`
          window.onUsersnapCXLoad = function(api) {
            api.init();
          }
          var script = document.createElement('script');
          script.defer = 1;
          script.src = 'https://widget.usersnap.com/global/load/${USERSNAP_GLOBAL_API_KEY}?onload=onUsersnapCXLoad';
          document.getElementsByTagName('head')[0].appendChild(script);
      `}
      </script>
    </Helmet>
  )
}

export default UserSnap

and then import UserSnap.jsx in gatsby-config.js
import React from 'react'
import UserSnap from './src/wherever'

/* This is how to use with gatsby... this wraps every page component to include UserSnap.
 * Depending on your setup you may also need do the same in gatsby-browser.js
 */
export const wrapPageElement = ({ element }) => {
  return (
    <>
      <UserSnap />
      {element}
    </>
  )
}

The usersnap mode removes focus from it's input whenever a modal or similar component is open but works fine otherwise.
head tag continuously keeps flashing whenever Usersnap is opened
Found a workaround to deal with modals by wrapping the block in a react fragment like this
<>
   <Modal
     open={open}
     className={classes.root}
     closeAfterTransition
     onClose={handleCancel}
   >
     <Fade in={open}>
       <Container maxWidth="md" className={classes.container}>
         <Paper className={classes.paper}>
           <AssumptionsEditor
             onCancel={handleCancel}
             onSave={handleSave}
             {...rest}
           />
         </Paper>
       </Container>
     </Fade>
   </Modal>
</>

but that's not the ideal solution and doesn't work on popover and drawer.
Help please?


text:
Q: Call functions in the form f(T&& t) repeatedly without using std::move(t) again? #include <iostream>
#include <cstdlib>
#include "A.h"

void second(const A& a)
{
    std::cout << "void second(const A& a)." << std::endl;
}

void second(A&& a)
{
    std::cout << "void second(A&& a)." << std::endl;
}

void first(const A& a)
{
    std::cout << "void first(const A& a)." << std::endl;
    second(a);
}

void first(A&& a)
{
    std::cout << "void first(A&& a)." << std::endl;
    second(a); //Make this call void second(A&& a) without using std::move(a) again?
}

int main()
{
    std::cout << "int main()." << std::endl;

    A a;
    first(std::move(a));

    std::cin.sync();
    std::cin.get();
    return EXIT_SUCCESS;
}

A: second(a);

It cannot call second(A&&) because a is an lvalue (as it has a name).
To call second(A&&) you need an rvalue. So you need to convert a into an rvalue, for which you have to use move or do manual explicit conversion:
second(std::move(a));        //invokes second(A&&)
second(static_cast<A&&>(a)); //invokes second(A&&)

Hope that helps.

A: Inside the function
void first(A&& a)

the parameter a is a named value, and thus an lvalue.
You really wouldn't want it to be moved away at the first function call anyway, as that would cause a lot of trouble if you want to use a several times in your function. Consider
void first(A&& a)
{
    second(a);
    third(a);
    fourth(a);
}

You wouldn't want the call to second move the value away from a.

A: Do you find the process of writing rvalue reference overloads for every function tedious, and are looking for a way to save yourself from that tedium?  Consider condensing your overloads into a single function which takes its parameters by value, then moves them where they need to go.
So, in other words, these two functions...
void foo(X const& x) {
    bar(x);
}
void foo(X&& x) {
    bar(std::move(x));
}

...become this one function
void foo(X x) {
    bar(std::move(x));
}

The savings (in typing and maintainability) become exponentially greater for each extra parameter.  It sometimes costs an extra move, but never an extra copy (unless of course, there is no move constructor).


text:
Q: How filter all methods by user ID? I'm using:

*

*spring-boot-starter-web

*spring-boot-starter-data-rest

*spring-boot-starter-data-mongodb

*spring-boot-starter-security
and with spring data-rest I created REST API. Every entity has property userId. How can I use it to restrict all repository methods (e.g.: findAll(), save(), ...)?
I want that only owner can see, edit, and delete his data.


text:
Q: how to generate below list of week data using Excel or some other tool? The typical week  starts from August 29th - Sept 4th. (i.e. week is starting from Friday and ends on next Thursday). how can i get list of all Start Week Date (i.e Friday) and End Week Date (i.e. Thursday).
is this possible using Excel or some other tool?
Thanks
CP

A: Enter any date in A1
In A2 enter:
=A1+(4-WEEKDAY(A1,2)+1)  this is the first Friday following the date in A1

In A3 enter:
=A2+7  and copy down

For the week end dates in B2 enter:
=A2+6  and copy down


text:
Q: Redirect in Reactjs program not working with window.location = 'url'; The application I am working on there is a way to pass a parameter with the URL
www.myurl.com/?token=xyz
Which works fine.  The problem is when you have processed the form a button appears on the SPA last page with the following code.

<buttonclassName="btn btn-primary btn-sm" onClick={(e) => onCancelClick={(e) => onCancelClick(e)}>Create Another Fo<rm/button>

The code for the onCancelClick is as follows:
        changeNavLinkStatus(true):
        let result = window.location.href.split('?')[0];
        console.log(result); // returning www.myurl.com
        window.location = result;

However, the page is redirecting with the www.myurl.com/?token=xyz not to www.myurl.com.  In other words dropping the queryString.
Can anybody tell me why this is not working?


text:
Q: Problems with SSL to non-SSL htaccess redirect I need some help with URL rewriting.
I need just 1 dynamic page (signin) to be handled via SSL, all other pages need to be redirected to HTTP.
So here my .htaccess file for :443 virtualhost:
RewriteEngine on
RewriteRule ^signin$  https://www.page.com/?s=signin [L,NC]

RewriteCond %{REQUEST_URI} !^\/(signin)+ [NC]
RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [R=302,L]

What happens is, that https://www.page.com/signin gets redirected via the 302 redirect to http://www.page.com/?s=signin
What am I doing wrong?

A: Your question is tagged with PHP.  Is your signin page PHP?
Add this to the top of your signin page and that page will force itself to the HTTPS.
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "") {
    $redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    header("Location: $redirect");
}

A: Ok, I take this as an apache question. To explain what seems to happen first:
Your first rule redirects to
https://www.page.com/?s=signin

This does not match the REQUEST_URI Condition !^/(signin)+; so the second rule redirects to
http://www.page.com/?s=signin

Probably your condition should read something along the lines of:
RewriteCond %{REQUEST_URI} !^\/\?s=signin [NC]

To see what exactly mod_rewrite does, enable the rewrite log, if you can - how to do this depends on the apache version.


text:
Q: Responsive chords above lyrics I would like to use HTML and CSS (and if really necessary, some JS) to find a responsive way to put chords above lyrics.
I already checked this post: Styling text to make it appear above the line (for chords above the lyrics)
Here is what I have so far:

        body {
          padding:20px;
          font-size: 30px;
        }
        .chord{
            position    : absolute;
            top         : -50px;
            width       : 0;
            font-style  : italic;
            font-weight : bold;
            font-size: 50px;
        }

        .chord-lyrics{
            position: relative;
            display: inline-block;
            margin-top: 50px;
        }

C Imagine
 there's

Cmaj7no

Fheaven

The goals:

*

*always keep the chord above the right lyrics

*if screen is smaller than the line, each word must overflow on the next line

*if the chords are larger than the text below it should create space between the lyrics
EDIT:

*a chord can also be in the middle of a word

For now, everything works fine for 1. and 2. but not for 3. and this last one is also really important!
Thanks

A: Another possibility is to use Flexbox:

body {
  padding: 20px;
  font-size: 30px;
}

.container {
  max-width: 450px;
}

.line {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
}

.chord-letter {
  display: flex;
  flex-direction: column;
  padding: 0 5px;
  align-items: center; /* center chord */
}

.chord {
  font-style: italic;
  font-weight: bold;
  font-size: 25px;
}

C Imagine
 there's

Cmaj7no

Fheaven

This code is fully responsive. Each chord-text-combo will be moved to the next line if there's not enough space.
Here is a Fiddle for you to play with.

A: Using position: absolute removes the elements from the flow of the page and prevents them from having an effect on the other elements.
If you change this to position: relative you can get something close to what you're looking for.
Just as a footnote, using px measurements isn't responsive. You should look to use ems, rems or even vw/vh!

        body {
          padding:20px;
          font-size: 30px;
        }
        .chord{
            position    : relative;
            top         : -50px;
            left        : 50px;
            width       : 0;
            font-style  : italic;
            font-weight : bold;
            font-size: 50px;
        }

        .chord-lyrics{
            position: relative;
            display: inline-block;
            margin-top: 50px;
        }

C Imagine
 there's

Cmaj7no

Fheaven

A: I'd rather do smthg like that :

div.part {
    float  : left;
    margin : .3em;

}
div.chord {
    font-weight : bolder;
    font-style  : italic;
}
div.lyric {
    text-align  : center;
}

C

Imagine

there's

Cmaj7

no

F

heaven

A: Alternatively, "flexbox" can be used.

body {
  padding: 20px;
  font-size: 30px;
}

.line {
  display: flex;
  align-items: flex-end;
  justify-content: start;
  flex-wrap: wrap;
}

.chord {
  font-style: italic;
  font-weight: bold;
  font-size: 50px;
}

.chord-lyrics {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: end;
}

.space {
  margin-right: .3em;
  margin-top: .3em;
  margin-bottom: .3em;
}

C Imagine

  there's

Cmaj7no

Fheaven

C Imagine

  there's

Cmaj7no

Fheaven

C Imagine

  there's

Cmaj7no

Fheaven

Fheaven

For your second question:

In overflows, the word and the chord behave as a whole, and the chord and word are always centered.

body {
  padding: 20px;
  font-size: 30px;
}

.line {
  display: flex;
  align-items: flex-end;
  justify-content: start;
  flex-wrap: wrap;
}

.chord {
  font-style: italic;
  font-weight: bold;
  font-size: 50px;
}

.chord-lyrics {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
}

.space {
  margin-right: .3em;
  margin-top: .3em;
  margin-bottom: .3em;
}

C Imagine

  there's

Cmaj7no

Fheaven

C Imagine

  there's

Cmaj7no

Fheaven

C Imagine

  there's

Cmaj7no

Fheaven

Fheaven

A: Thanks to everyone, here is what I was able to do:

body {
    padding: 20px;
    font-size: 30px;
}

.line {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
}

.chord-letter {
    display: flex;
    flex-direction: column;
    align-items: left;
}

.no-space {
    margin-right: 0;
    border: solid 1px red;
}

.space {
    margin-right: 0.33em;
    border: solid 1px green;
}

.chord {
    color: gray;
    font-style: italic;
    font-weight: bold;
    font-size: 1.2em;
    border: solid 1px blue;
}

.no-space .chord {
    margin-right: 0.33em;
}

.word {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
}

      Ima

Cgine

   there's

Cmaj7no

Fheaven

      Ima

Cgine

It is:

*

*Fully responsive

*Allow chords inside a word

*Avoid breaking the words on wrapping


text:
Q: SQL Select inner join from (Select inner join)? Hi I try to select data inner join from inner join from another table (It weird when I say it without example,that why I didn't get any result from Google).
this is my Database.
My Database flowchart Picture
I want to select Product_Total.Product_Name from Product_Total instant of Product_Id in table Product_Customer
| Barcode_Id  | Product_Name  | Sub_Id  | Department_Name | Status |
--------------------------------------------------------------------
| KS4815874   | DELL Server   | S47811  | Store Main Unit | Spare  |

Select Product_Name inner join Product_Customer.Product_Id = Product.Product_Id then inner join Product.Product_Id_T = Product_Total.Product_Id_T

but how I can write it in sql command
and if i want to select some data from all the table using select join [or other option],how can i do it??
Select Project_Name,Project_Detail,PR_Id,PO,PO_Date,Delivery_Id,Delivery_Date,Brand_Name,Product_Name,EQ,Price_PerUnit,etc... (very long)

A: the inner join is produce a new virtual table with the rows according to the ON condition
so you can do as much as you want from inner join
select ......

from table1 inner join table2 on table1.id = table2.id // produce a new table
            inner join table3 on table2.id = table3.id
            and so on .....

so after the first inner join :
table1     * table2                           table3
**********************    inner join with    ********
column...  * column...                        column...

after the second inner join:
table1      *      table2      *    table3
*******************************************
column...   *   column...      *    column...


text:
Q: DXTn texture support, no "Enable S3TC..." option I am having the same problem as described here.
I'm looking for support for DXTn textures. I ran worldwind in terminal and got the following error message:
Aug 22, 2012 5:28:12 PM gov.nasa.worldwind.layers.TextureTile initializeTexture
SEVERE: Exception attempting to read texture file
javax.media.opengl.GLException: DXTn compressed textures not supported by this graphics card

I tried the suggested solution from here
sudo apt-get install driconf
driconf

Under "Image Quality" change "Enable S3TC ..." to Yes. Save.

The driconf solution did not fix the problem. There was no "Enable S3TC..." option in the Image Quality tab.
I think I am using Nouveau driver and I wonder if I should switch to the Nvidia driver?

*

*Computer: Dell Precision M6400

*Processor: Intel® Core™2 Duo CPU T9550 @ 2.66GHz × 2 Ubuntu: 12.0.4 LTS

*Video Card: NVIDIA Quadro FX 2700M

*Graphics: Gallium 0.4 on NV94

Any ideas?

A: Have a look: http://en.wikipedia.org/wiki/S3_Texture_Compression

While S3 Graphics is no longer a competitor in the graphics
  accelerator market, license fees are still levied and collected for
  the use of S3TC technology, for example in game consoles and graphics
  cards. The patent-encumbered status of S3TC and its wide use in
  software, despite non-encumbered alternatives, have led to a de facto
  requirement for OpenGL drivers to support it and present a major
  obstacle to open source implementations.

Which explains why Nouveau driver does not support it. I guess you need to switch to the binary NVidia drivers.

A: Otherwise:

..and tell WorldWind not to use S3 texture compression (.dds format) but rather PNG default texture format.
You can download the sources (SDK 2.0 now):
wget http://builds.worldwind.arc.nasa.gov/worldwind-releases/2.0/builds/worldwind-2.0.0.zip
unzip worldwind-2.0.0.zip -d worldwind-2.0.0

Then apply the changes to the source files listed here and here.
Since those links are a little outdated, there are a few more changes you should apply in order to make things work on WW 2.0 release (see appendix).
Afterwards, you can re-build your new worldwind.jar:
cd worldwind-2.0.0/
ant worldwind.jarfile # or simply `ant'

I personally verified it by running the SDK from Netbeans.
$ sudo lshw -C video | egrep "product|driver"
   product: RV635/M86 [Mobility Radeon HD 3670]
   configuration: driver=radeon latency=0

HTH
APPENDIX: patch for SDK 2.0
diff --git a/src/config/Earth/BMNGWMSLayer.xml b/src/config/Earth/BMNGWMSLayer.xml
--- a/src/config/Earth/BMNGWMSLayer.xml
+++ b/src/config/Earth/BMNGWMSLayer.xml
@@ -19,12 +19,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>26 03 2009 00:00:00 GMT</LastUpdate>
     <DataCacheName>Earth/BMNGWMS/BMNG(Shaded + Bathymetry) Tiled - Version 1.1 - 5.2004</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="5" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
diff --git a/src/config/Earth/BMNGWMSLayer2.xml b/src/config/Earth/BMNGWMSLayer2.xml
--- a/src/config/Earth/BMNGWMSLayer2.xml
+++ b/src/config/Earth/BMNGWMSLayer2.xml
@@ -22,7 +22,7 @@
         <ImageFormat>image/jpeg</ImageFormat>
         <ImageFormat>image/png</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="5" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
diff --git a/src/config/Earth/CountryBoundariesLayer.xml b/src/config/Earth/CountryBoundariesLayer.xml
--- a/src/config/Earth/CountryBoundariesLayer.xml
+++ b/src/config/Earth/CountryBoundariesLayer.xml
@@ -21,7 +21,7 @@
     <AvailableImageFormats>
diff --git a/src/config/Earth/MSVirtualEarthHybridLayer.xml b/src/config/Earth/MSVirtualEarthHybridLayer.xml
--- a/src/config/Earth/MSVirtualEarthHybridLayer.xml
+++ b/src/config/Earth/MSVirtualEarthHybridLayer.xml
@@ -19,7 +19,7 @@
     <AvailableImageFormats>
         <ImageFormat>image/jpg</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.jpg</FormatSuffix>
     <NumLevels count="16" numEmpty="4"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -40,4 +40,4 @@
     </Sector>
     <ActiveAltitudes max="1000e3"/>
     <UseTransparentTextures>true</UseTransparentTextures>
diff --git a/src/config/Earth/MSVirtualEarthRoadsLayer.xml b/src/config/Earth/MSVirtualEarthRoadsLayer.xml
--- a/src/config/Earth/MSVirtualEarthRoadsLayer.xml
+++ b/src/config/Earth/MSVirtualEarthRoadsLayer.xml
@@ -19,7 +19,7 @@
     <AvailableImageFormats>
         <ImageFormat>image/jpg</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.jpg</FormatSuffix>
     <NumLevels count="16" numEmpty="4"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -40,4 +40,4 @@
     </Sector>
     <ActiveAltitudes max="1000e3"/>
     <UseTransparentTextures>true</UseTransparentTextures>
diff --git a/src/config/Earth/ScankortDenmarkImageLayer.xml b/src/config/Earth/ScankortDenmarkImageLayer.xml
--- a/src/config/Earth/ScankortDenmarkImageLayer.xml
+++ b/src/config/Earth/ScankortDenmarkImageLayer.xml
@@ -16,12 +16,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>25 06 2009 22:45:32 GMT</LastUpdate>
     <DataCacheName>Earth/Scankort Denmark</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="16" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -46,4 +46,4 @@
             <Time units="milliseconds" value="30000"/>
         </ReadTimeout>
     </RetrievalTimeouts>
diff --git a/src/config/Earth/USDANAIPWMSImageLayer.xml b/src/config/Earth/USDANAIPWMSImageLayer.xml
--- a/src/config/Earth/USDANAIPWMSImageLayer.xml
+++ b/src/config/Earth/USDANAIPWMSImageLayer.xml
@@ -17,12 +17,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>23 04 2009 17:55:00 GMT</LastUpdate>
     <DataCacheName>Earth/USDA NAIP</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="15" numEmpty="6"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -51,4 +51,4 @@
             <Time units="milliseconds" value="30000"/>
         </ReadTimeout>
     </RetrievalTimeouts>
diff --git a/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java b/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
--- a/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
+++ b/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
@@ -190,7 +190,7 @@ public class BasicTiledImageLayer extends TiledImageLayer implements BulkRetriev
             params.setValue(AVKey.TILE_HEIGHT, 512);

         if (params.getValue(AVKey.FORMAT_SUFFIX) == null)
-            params.setValue(AVKey.FORMAT_SUFFIX, ".dds");
+            params.setValue(AVKey.FORMAT_SUFFIX, ".png");

         if (params.getValue(AVKey.NUM_LEVELS) == null)
             params.setValue(AVKey.NUM_LEVELS, 19); // approximately 0.1 meters per pixel
diff --git a/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java b/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
--- a/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
+++ b/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
@@ -265,7 +265,7 @@ public class RPFTiledImageLayer extends TiledImageLayer
         if (params.getValue(AVKey.TILE_HEIGHT) == null)
             params.setValue(AVKey.TILE_HEIGHT, 512);
         if (params.getValue(AVKey.FORMAT_SUFFIX) == null)
-            params.setValue(AVKey.FORMAT_SUFFIX, ".dds");
+            params.setValue(AVKey.FORMAT_SUFFIX, ".png");
         if (params.getValue(AVKey.NUM_LEVELS) == null)
             params.setValue(AVKey.NUM_LEVELS, 14); // approximately 0.5 meters per pixel
         if (params.getValue(AVKey.NUM_EMPTY_LEVELS) == null)

A: After the WorldWind model is created, and before the window is displayed, you can loop through all the layers and force them to not use DDS for storing tile textures:
// Before the WorldWind window displays (which triggers the data retrievers)
// loop through the levels for each tiled image layer and mutate any level
// constructed to use DDS to instead use JPG (best compression) or PNG (best
// quality, but much larger files).
String cacheFormat = "jpg"; // could load this via configuration file
for (Layer layer : model.getLayers()) {
    if (layer instanceof BasicTiledImageLayer && ((BasicTiledImageLayer)layer).getTextureFormat() == null) {
        ((BasicTiledImageLayer)layer).setTextureFormat("image/" + cacheFormat);
        ((BasicTiledImageLayer)layer).setValue(AVKey.FORMAT_SUFFIX, "." + cacheFormat);
        ArrayList<Level> levels = ((BasicTiledImageLayer) layer).getLevels().getLevels();
        for (int i = 0; i < levels.size(); i++) {
            Level level = levels.get(i);
            if (level.getFormatSuffix().equals(".dds")) {
                AVList params = level.getParams();
                params.setValue(AVKey.FORMAT_SUFFIX, "." + cacheFormat);
                levels.set(i, new Level(params));
            }
        }
    }
}


text:
Q: FFmpeg RAW .tif to jpeg too dark I know this problem is known, but I cannot actually find a solution for this.
I am using Topaz JPEG to RAW. The output, I selected, is .tif. So a 4:3 4k image is 80MB large. Now I need to convert it back to JPEG (I used the AI just for noise removal.)
The output is darker. Many claim, it is not darker, it is just something with the raw whatever. I have the source, before it became RAW. I know, it is too dark. So how to fix it?
My command is the following:
Code:
C:\Users\Ultron\Downloads\rescale\ffmpeg_win64-shared\bin\ffmpeg -start_number 100136 -i "E:\remaster\JPEG_TO_RAW\episode_01_01\rescale-%06d-edit.tif" -start_number 100136 -pix_fmt yuv420p -qscale:v 1 E:\remaster\FFMPEG_TIF_TO_JPEG\episode_01_01\rescale-%06d.jpg

I also tried it without -pix_fmt yuv420p with identical output. So what to try next?

A: Solution is simple and free:

*

*Download XnConvert (Windows and Mac, Freeware, only 36MB download), very likely works in Linux via Wine > Multi platform solution, also efficient

*download ISO22028-2_ROMM-RGB.icc (or whatever color profile you are using!)

*Add the Files or a Folder to XnConvert as Input

*Go to 2nd Tab (something like "edit" or "filter" in english) and add the filter "Color conversion" or however it is called. This asks for an ICC file. Add the color profile.

*Go to Output tab and specifie folder, name, synthax of the name and file format including compression if neccesary.

Run button and wait - relax. ;)


text:
Q: Axler chapter 5 question 17
Here is my attempt. Suppose V is a complex vector space and $T \in L(V)$. By theorem, $T$ has an upper triangular matrix with respect to a basis of $V$, let the basis be $(v_1,...,v_{\dim V})$. Then by proposition, $span(v_1,...,v_{k})$ is invariant under $T$ for each $k=1,...,\dim V
$. So $T_{v_k}$ is an operator for each $k=1,...,\dim V$. Hence, each subspace of dimension $k$, where $1 \leq k \leq \dim V$ is invariant under $T$. Thus, $T$ has an invariant subspace for each dimension $k$, for $k=1,...,\dim V$.
Please tell me where I have gone wrong if I did and I appreciate alternate solutions as well. Thank you very much !


text:
Q: while data == 1 run action one time From an api, I receive a data. It returns two values: 1 and -1.
I receive one data per second and in series of 1 or -1.
What I want is that when data goes to 1 you execute the action only once, and when it goes to -1 do the same action always once.
My problem is that for the moment I can't make the action happen only once. The action is repeated as long as data == 1 or data == -1
Moreover I need the code to continue to execute even if I'm not out of the loop.
Thanks for your help
signal_result = APIDATA

while signal_result == 1:
      self.action(signal_result)

while signal_result == -1:
      self.action(signal_result)

A: Just keep track of the previous value, and if it is different, perform the action:
# at the very start, initialise
previous_result = 0  # Some value that is different from 1 or -1

# ...
# ...

# When a signal is received:
    global previous_result
    signal_result = APIDATA
    if signal_result != previous_result:
        previous_result = signal_result
        self.action(signal_result)


text:
Q: Spring Cloud Turbine Amqp doesn't work I have a problem with spring cloud:  Turbine Amqp doesn't work. I exploit a local rabbit broker out of the box.
one of my services:
@EnableFeignClients(basePackages = "com.sample")
@EnableEurekaClient
@EnableAutoConfiguration
@SpringBootApplication

dependencies:
spring-cloud-config-client
spring-cloud-starter-eureka
spring-cloud-starter-feign
spring-boot-starter-actuator
spring-cloud-starter-hystrix
spring-cloud-netflix-hystrix-amqp
spring-cloud-starter-bus-amqp

bootstrap.yml:
spring:
  rabbitmq:
     host: 127.0.0.1
     port: 5672

my turbine service:
@EnableHystrixDashboard
@EnableTurbineAmqp
@EnableEurekaClient
@EnableAutoConfiguration
@SpringBootApplication

spring-cloud-config-client
spring-cloud-starter-eureka
spring-cloud-starter-bus-amqp
spring-cloud-starter-turbine-amqp
spring-cloud-starter-hystrix-dashboard

spring:
  rabbitmq:
    host: 127.0.0.1
    port: 5672

turbine:
  amqp:
  port: 8989

management:
  port: 8090

when i try to execute http://127.0.0.1:8989/turbine.stream, i've got:
data: {"type":"Ping"} in cycle
rabbitmqctl list_queues - shows a new queue ...f1d5cfa119f5 0  at the same time when my "client" service is executed. when i turn it off the queue is removed.
turbine server writes:
SSE Request Received
Unsubscribing RxNetty server connection

What am i doing wrong? thanks.


text:
Q: Searching for multiple values using REST I'm attempting to search for documents that contain match a value from list of values.
The list of values are ["AGA>23/180@23221" , "AGA>24/180@23221"  ,"AGA>25/180@23221"]
To find the documents a solution is to iterate over the each elements in the list and invoke multiple requests using a query for each element:
query 1:
{
  "query": {
    "term": {
      "mid.keyword": "AGA>23/180@20210212"
    }
  }
}

query 1:
{
  "query": {
    "term": {
      "mid.keyword": "AGA>24/180@20210212"
    }
  }
}

query 3:
{
  "query": {
    "term": {
      "mid.keyword": "AGA>25/180@20210212"
    }
  }
}

Can the search be combined into a single request ? When I try to combine into a single reuqest using payload:
{
  "query": {
    "term": {
      "mid.keyword": ["AGA>23/180@20210212" , "AGA>24/180@20210212" , "AGA>25/180@20210212"]
    }
  }
}

elastic search returns error:
'reason': '[term] query does not support array of values',

A: Use the terms query instead:
{
  "query": {
    "terms": {
      "mid.keyword": ["AGA>23/180@20210212" , "AGA>24/180@20210212" , "AGA>25/180@20210212"]
    }
  }
}


text:
Q: python replace string on files inside zipfile I'm trying to replace a specific string inside files that are inside a zip file (and keep the zip folder structure and other files intact) using the following python code but I keep receiving errors such as:
FileNotFoundError: [WinError 3] The system cannot find the path specified:
I'm still learning Python, so no I have no idea yet of whats is wrong
Does anyone have any idea? Thanks!
import zipfile

srcfile='test.zip'
dstfile='test2.zip'

with zipfile.ZipFile(srcfile) as inzip, zipfile.ZipFile(dstfile, "w") as outzip:
    for inzipinfo in inzip.infolist():
        with inzip.open(inzipinfo) as infile:
            if inzipinfo.filename.endswith('/') == False:
                if inzipinfo.filename.find("code.sas")>=0:
                    print(inzipinfo.filename)
                    content = infile.read()
                    content = content.replace("foo", "bar")
                    outzip.writestr(inzipinfo.filename, content)
                else:
                    content = infile.read()
                    outzip.write(inzipinfo.filename, content) #FileNotFoundError: [WinError 3]

EDIT:
Done in C#, way easier
csc.exe /preferreduilang:en-US /target:exe /reference:System.IO.Compression.dll /reference:System.IO.dll /reference:System.IO.Compression.FileSystem.dll /out:program.exe program.cs
using System.IO.Compression;
using System.IO;

namespace ReplaceZipString
{
    class Program
    {
        static string tmpfolder = @"tmp\";

        static void Main(string[] args)
        {
            string indir = @"indir\";

            foreach (string infile in Directory.GetFiles(indir, "*.zip"))
            {
                DoFile(infile);
            }

        }

        private static void DoFile(string infile)
        {
            string outfile = infile;
            if (Directory.Exists(tmpfolder)) Directory.Delete(tmpfolder, true);

            ZipArchive inzip = ZipFile.OpenRead(infile);
            inzip.ExtractToDirectory(tmpfolder);
            inzip.Dispose();

            DirectoryInfo di = new DirectoryInfo(tmpfolder);
            foreach (FileInfo f in di.EnumerateFiles("code.sas", SearchOption.AllDirectories))
            {
                string text = File.ReadAllText(f.FullName, System.Text.Encoding.Default);
                text = text.Replace("foo", "bar");
                File.WriteAllText(f.FullName, text, System.Text.Encoding.Default);
            }

            if (File.Exists(outfile)) File.Delete(outfile);
            ZipFile.CreateFromDirectory(tmpfolder, outfile);
        }
    }
}

A: Made a few modifications, this works for me
import zipfile

srcfile = '..tmp//test.zip'
dstfile = '..tmp//test_out.zip'

inzip = zipfile.ZipFile(srcfile, 'r')
outzip = zipfile.ZipFile(dstfile, "w")

# Iterate the input files
for inzipinfo in inzip.infolist():

    print(inzipinfo)

    # Read input file
    infile = inzip.open(inzipinfo)

    if inzipinfo.filename == "test.txt":

        content = infile.read()

        new_content = str(content, 'utf-8').replace("abc", "123")

        # Write content
        outzip.writestr(inzipinfo.filename, new_content)

    else:  # Other file, dont want to modify => just copy it
        content = infile.read()
        outzip.writestr(inzipinfo.filename, content)

inzip.close()
outzip.close()


text:
Q: Directive does not update on service model change I have a service that contains my application's model:
angular.module('adminClient').factory('myApi', function () {
    var model = {};
    model.myObject = {
        label: 'New York City'
    };

    return {
        model: function () {
            return model;
        }
    };
});

A partial/controller has access to the model and can set a new myObject:
angular.module('adminClient').controller('MySelectNetworkCtrl', function ($scope, myApi) {

    $scope.myObject = myApi.model().myObject;

});

In addition to this, I have a directive that should display the label contained in myObject:
angular.module('nav').directive('myTopBar', function(myApi) {
    return {
        restrict: 'E',
        replace: true,
        scope: {},
        templateUrl: 'nav/directive/my-top-bar/my-top-bar.html',
        link: function(scope, element, attrs, fn) {
            scope.myObject = myApi.model().myObject;
        }
    };
});

And here is the HTML:

When I run the application, the label is displayed fine (New York City), but as soon as the controller changes the myObject, the label in the directive remains unchanged. I can also see this in the Chrome Angular scope inspector.
Any idea how I can make the directive display the current value even after changed by the controller?

A: It all depends upon how the controller is updating the model object. Since your code
scope.myObject = myApi.model().myObject;
gets hold of this specific model object it works fine as long as model object myObject properties are changed.
But if the controller does
myApi.model().myObject= {};  //or any new object
Now the model returned by service has different myObject and the directive one is different. Therefore changes do not work.
Instead in directive do:
scope.myObject = myApi.model();  // bind to model
And update the bindings in the directive template accordingly. See if it works

A: Check this plunkr
If you want to modify your myObject inside your controller, and also want this change to be reflected inside your my-top-bar directive which then updates the directive's scope from myApi service, then you should do it like this.
Update the myObject in your controller and then also update it in your service through a setter method.
// Doing this will update your scope.myObject but
// will not change the moObject in your service
$scope.myObject = {
  label: 'updated label'
};

// This will update your service, and anyone making a myApi.myApi.model() after this will get an updated myObject
myApi.setModel($scope.myObject);
// Notify directive of the change
$scope.$broadcast('updateDirective');

And in the factory:
angular.module('plunker').factory('myApi', function() {
  var model = {};
  model.myObject = {
    label: 'New York City'
  };

  return {
    model: function() {
      return model;
    },
    setModel: function(newModel) {
      model.myObject = newModel;
    }
  };
});

Finally, the directive:
angular.module('plunker').directive('myTopBar', function(myApi) {
  return {
    restrict: 'E',
    replace: true,
    scope: {},
    templateUrl: 'top-bar.html',
    link: function(scope, element, attrs, fn) {
      console.log('in directive link', myApi.model().myObject);
      scope.myObject = myApi.model().myObject;
    },
    controller: function($scope) {
      $scope.$on('updateDirective', function() {
        console.log('updating the scope of directive so that ng-bind works');
        $scope.$apply(function() {
          $scope.myObject = myApi.model().myObject;
          console.log($scope.myObject);
        });
      });
    }
  };
});