text:
Q: htdocs permissions issue with XAMPP When I am saving something as a php file in htdocs for xampp it gives me this error
The document "Untitled" could not be saved as "index.php". You do not have appropriate access privileges.
The system is a Mac machine.

A: Sounds like you don't have the necessary permissions to save in the directory.  You will need to talk to your system admin about that.

A: I think you are in shared server, may be you have assigned a sub-directory under htdocs, so try to save your file in different directory or check your administrator to witch directory you granted.

A: Based on the answer you gave to Felipe Almeida I see that you have a permission problem on your mac. Apple has a good Knowledge Base article about this. After you have read this you should be able to solve your problem. They have pictures where you can see what you have to click. (You have to read from the chapter "Permissions Defined" on. The beginning is not of interest for you.)

A: I have found on some installs, the whole tree of folders is read only. HTdocs is in a folder. Check to see if that is read only.


text:
Q: Where to keep user's id? I am designing a web application which should keep the user's profile that has lots of information,
obviously it reads the data from database.
Currently, I have the username in my session and everytime I need the user's info should read the session then create an object of profile class (that read the data from database again) to retrieve user's info, is it the best practice for such an issue?

A: Generally a 'best practice' is to maintain the User profile data in session and load all needed information only the first time from the database.
In other words mantain an instance of Profileclass in your http session (must implement Serializable). Profile must hold all the informations used more frequently.
Note that 'reading the session' is like reading an HashMap (so has a minimum cost in term of performances).
When the HttpSession will expire, Profile will be garbage collected.
UPDATE (based on your comments) :
to count (or find) active users (inactive are all the others), a typical solution is make Profile implements the HttpSessionBindingListener interface. When Profile is bound to a session, is notified, so you can increment a static counter (a static attribute of Profile class for example),and you can decrement it when the Profile is unbound (programmatically unbound or because its session has expired)

A: This is a typical trade-of between performance and memory consumption. If you want a fast application, keep the whole user profile in HTTP session but make sure you have enough memory in your server.
If you want to keep resource consumption low, store only user ID in session and load it from a database every time you need it. This also makes clustering simpler as there is less data to migrate.
Reasonable compromise is to use the latter approach with some caching. This way hot users (currently using the system) are kept in memory, while idle users or infrequently accessing new pages are swept out from cache (assuming cache is smaller then the number of HTTP sessions).

A: Agreed with Obe6 response,
Best practice is to ensure if the profile is not in session then to retreive from a datasource and then attach it to a session.
When session is invalidated then all information is removed from session.
There is a good article on this from IBM.
http://www.ibm.com/developerworks/websphere/library/bestpractices/store_objects_in_httpsession.html

A: Session is generally a good enough place to keep the user profile data.  You need to quantify how much of data you are talking here. Let's say its 5KB per session, then, you could store up to 20000 user profile in memory using 100 MB of RAM. You can allocate heap to JVM accordingly based on the max. number of active sessions you expect on your site.
This is just one aspect. When you plan to scale the app by adding more app servers, then, you can even think of moving the sessions out to a out-of-process cache/memory stores such as memcached.
If all the user profile data you keep in session does not get rendered on each page, then, it may be a good idea only to keep bare minimum in session and fetch other data as per need.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Animate UIView embedded in UITableViewCell On didSelectRowAtIndexPath, I am reloading selected row and changing heightForRowAtIndexPath so that selected tableview cell can expand. This is working fine. So as soon reloading expanding done I have to animate a UIView which is in the back of a UIImageView.
Animation should be like its coming from behind of imageView and stop at certain position like its revealing from image. It should be simple ? by changing y origin and doing in it animation block.
But the problem is its not at all animating with simple UIView beginAnimations code. I think it should be possible using CAKeyframeAnimation applying to the layer of UIView.
I have never played with layers. Can anybody guide me ?
Thanks

A: You could try something like this:
CABasicAnimation *myViewAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
[myViewAnimation setFromValue:[NSValue valueWithCGPoint:CGPointMake(INITIAL_X,INITIAL_Y)]];
[myViewAnimation setToValue:[NSValue valueWithCGPoint:CGPointMake(FINAL_X,FINAL_Y)]];
[myViewAnimation setDuration:0.5];
[myView.layer setPosition:CGPointMake(FINAL_X,FINAL_Y)];
[myView.layer addAnimation:myViewAnimation forKey:@"position"];

You'll need to link the QuartzCore framework to your project and import it (#import <QuartzCore/QuartzCore.h>)


text:
Q: Capturing pattern in a DataFrame and counting its length I have a dataframe which looks like this:

>>>df
    Str
0   .....(((((................((((.(...).))))(((((....))))).(((((((((...))))))).))))))).................
1   .(((((..(((....(((((((........)))))))..)))..))).)).((((((((((.((..(((....)))....)).)))))))))).......
2   ((((((.(((((.(((...))))))))))....(((.((((.((.(((....))).)).))))..)))))))(..((((...))))..)...........
3   (((((((.((....((.((.((((..((.......(((...))).((((((((...))))))))....))..)))).)).))....))..)))))))...

I want to capture the portion starting from first opening bracket to the last opening bracket. I tried the following code for that:
df["stem"] = df["Str"].str.findall('[(][(.)]+[)]')
df["stem"] = df["stem"].astype("str")

The code does capture the blocks but prints it inside an array starting and ending with square brackets:

['regexblock']

>>>df
        Str stem
0   .....(((((................((((.(...).))))(((((....))))).(((((((((...))))))).))))))).................    ['(((((................((((.(...).))))(((((....))))).(((((((((...))))))).)))))))']
1   .(((((..(((....(((((((........)))))))..)))..))).)).((((((((((.((..(((....)))....)).)))))))))).......    ['(((((..(((....(((((((........)))))))..)))..))).)).((((((((((.((..(((....)))....)).))))))))))']
2   ((((((.(((((.(((...))))))))))....(((.((((.((.(((....))).)).))))..)))))))(..((((...))))..)...........    ['((((((.(((((.(((...))))))))))....(((.((((.((.(((....))).)).))))..)))))))(..((((...))))..)']
3   (((((((.((....((.((.((((..((.......(((...))).((((((((...))))))))....))..)))).)).))....))..)))))))...    ['(((((((.((....((.((.((((..((.......(((...))).((((((((...))))))))....))..)))).)).))....))..)))))))']

I need to find the length of each block, but due to this addition of special characters I get 4 extra counts. Is there anyway to get rid of these characters while handling regex?Thanks in advance.

A: This one should do it:
df['Str'].str.extract('(\(.*\))')


text:
Q: How to reinstall OSX on a Macbook Air whose screen is broken, and OS has been erased? So I've had this Macbook Air for a while with a completely broken screen, and I wanted to give it to a friend who would work with it using a second screen.
I plugged a second screen to start reformating, but of course once it rebooted, the image wouldn't go to the second screen.
So I'm stuck with a Macbook with a broken screen in the middle of the process of reformatting.
I'd like to reinstall OSX on it.
What do?

A: There are several options:

*

*Plug in an external monitor and then you should be able to follow the install process.

*Target disk mode, but as it's a MacBook Air this would be dependent on having a Thunderbolt port, that you can connect directly to another Thunderbolt port, or a Thunderbolt to Firewire adapter into an older Mac with Firewire.

A: Wow, a sticky situation for sure!
Shot in the dark... Never tried this, so YMMV.
Try putting your broken Macbook in Target Disk Mode (https://support.apple.com/kb/PH10725?locale=en_US) and connect it up to the working Macbook. I'm reasonably certain Target Disk Mode is a firmware thing so you should be able to get it working without an OS. You'll know if that part works if the drive appears on the working Mac.
From there, you should be able to install an OS on the target disk from the working Macbook.
But, and this is a big one: For this to potentially not end badly, the working Macbook MUST be the exact same model with the same stats as your broken Macbook. Otherwise I suspect the wrong drivers will be delivered to the target drive by the installer.


text:
Q: how to convert cv::Mat to json format in ios -(void) processImage:(cv::Mat &)image{

    cvtColor(image, img2, CV_BGR2GRAY);

    orb -> detect(img2, keypoints1);

    orb -> compute(img2, keypoints1, descriptors1);

    drawKeypoints(img2, keypoints1, outImage);

}

OutImage is in cv::Mat format. How to convert it into NSDictionary format, using openCV ORB algorithm for my project.


text:
Q: Enumeration question. How many days does it take for a postman to deliver mail before he repeats a delivery pattern? I've been struggling with this question for a bit, however here is the detail of the question-
" a postman delivers mail to 19 terraced houses in a single row. He notices that no two adjacent houses ever get mail on the same day and that there are never more than two adjacent houses that do not receive mail on any day. What is maximum number of days that he can deliver mail before he repeats a mail delivery? "
I stared off using 5 houses and drew out houses he could/couldn't deliver too and got a maximum number of 6 days. (Not sure if this is right)
I've been trying to identify a pattern to be able to solve it for 19 houses but have no clue!
Thanks!

A: I think the problem consists of counting the number of binary sequences containing no $000$ and no $11$ of length $19$, we call such a sequence a good sequence. This can be done using a recursion.
Let $f_n$ be the number of good sequences of length $n$ ending in $1$ and $g_n$ be the number of good sequence of length $n$ ending in $0$.
Then we have: $f_1=1,f_2=1,g_1=1,g_2=2$
We also have the following recursions for $n\geq 3$
$f_n=g_{n-1}$, This is beacause if a sequence ends in $1$, it ends in $01$.
We also have $g_n=f_{n-1}+f_{n-2}$. Because there are $f_{n-1}$ good sequences of length $n$ ending in $10$ and $g_{n-2}$ good sequences of length $n$ ending in $100$.
From here:
$$\begin{array}
n && 1 && 2 && 3 && 4 && 5 && 6 && 7 && 8 && 9 && 10 && 11 && 12 && 13 && 14 && 15 && 16 && 17 && 18 && 19 \\
f_n && 1 && 1 && 2 && 2 && 3 && 4 && 5 && 7 && 9 && 12 && 16 && 21 && 28 && 37 && 49 && 65 && 86 && 114 && 151 && \\
g_n && 1 && 2 && 2 && 3 && 4 && 5 && 7 && 9 && 12 && 16 && 21 && 28 && 37 && 49 && 65 && 86 && 114 && 151 && 200 && \\
\end{array}$$
So the answer is $151+200=351$.


text:
Q: Change text when file attached I want change text, when i check file and want to submit form. This is my form
    $(" #client-form input[type='file'], .webform-client-form input[type='file'], #contact-form input[type='file']").click(function() {
    $(this).change(function(){
        $('p.pull-left > span').text('Attached');
    });
});

I have check for input with type text. If it's valid, i remove border and in this moment my action work and change my text on "Attached" but i don't click on this field and doesn't attache anything. Please, help me

A: Use .change() directly instead of binding for the .click() event:
jQuery(function($) {

    $('#client-form input[type=file], .webform-client-form input[type=file], #contact-form input[type=file]').on('change', function() {
         $('p.pull-left > span').text('Attached');
    });

});

The change event is sent to an element when its value changes.


text:
Q: bbPress - Post count increases after every edit I've installed bbPress 2.4 recently and I've noticed that each time I edit a post, my post count increases. Is there a way to stop that from happening? Thanks.

P.S. Is it normal for this to happen or is there something wrong on my end?

A: This is not related to bbPress 2.4, bbPress 2.x at this stage does not include this functionality out of the box. I expect you are using an additional plugin to add the 'Post count: 1' functionality to bbPress and your issues relate to that plugin.


text:
Q: VNC server not showing icons in Ubuntu 18.04 I have installed vnc4server on my Ubuntu 18.04 vps server. Used ssh tunnel to connect on and via VNCviewer connected to it. I can't see icons in the start menu or the icons of the folders. Please see the screenshot attached.

This is my xstartup file
nset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

A: After trying all the various vnc servers and many settings I have found the solution right under the spotlight.
In the Applications > Settings > Appearance I have changed the icons to different from the default and suddenly all the icons are there and working.
Finally!


text:
Q: Disable miniframes but keep the background title rectangle on the title page For aesthetic reasons, I would like to disable the text of the header bar on my title page.
This is what I have :

And this is what I would like :

Is there an easy way to do this ? I couldn't find anything other than \begin{frame}[plain] but this also removes the colored rectangles.
Here is my current code :
\documentclass[xcolor=x11names,compress]{beamer}

\useoutertheme[subsection=false,shadow]{miniframes}
\useinnertheme{default}

\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}

\setbeamercolor*{lower separation line head}{bg=AntiqueWhite4}
\setbeamercolor*{normal text}{fg=black,bg=white}
\setbeamercolor*{alerted text}{fg=red}
\setbeamercolor*{example text}{fg=black}
\setbeamercolor*{structure}{fg=black}
\setbeamercolor*{palette tertiary}{fg=black,bg=black!10}
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10}

\title{Presentation}

\begin{document}
\begin{frame}
\titlepage
\end{frame}

\section{Section 1}
\begin{frame}
\end{frame}

\section{Section 2}
\subsection{Sub 1}
\begin{frame}
\end{frame}

\subsection{Sub 2}
\begin{frame}
\end{frame}
\end{document}

A: Replacing the first frame with the following should do the trick:
{
\defbeamertemplate*{headline}{mytheme}
{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\phantom{\insertnavigation{\paperwidth}}\vskip2pt
  \end{beamercolorbox}%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}

\begin{frame}
\titlepage
\end{frame}
}

Here is a little how to: I went to the definition of the miniframes theme (search for beamerouterthememiniframes.sty) copied the part of the headline definition, changed the theme name and made the \insertnavigation invisible. There was also a part for the "subsection" option of the theme. This part I removed, since you disabled subsections.

A: I finally came with the solution of hiding it by setting the same color for foreground and background, and then reverting the foreground to black :
\setbeamercolor*{palette tertiary}{fg=black!10,bg=black!10}
\setbeamercolor*{palette quaternary}{fg=black!10,bg=black!10}

\title{Presentation}

\begin{document}
\begin{frame}
\titlepage
\end{frame}

\setbeamercolor*{palette tertiary}{fg=black,bg=black!10}
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10}


text:
Q: python not removing punctuation i have a text file i want to remove punctuation and save it as a new file but it is not removing anything any idea why?
code:
def punctuation(string):
    punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''

    for x in string.lower():
        if x in punctuations:
            string = string.replace(x, "")

            # Print string without punctuation
    print(string)

file = open('ir500.txt', 'r+')
file_no_punc = (file.read())

punctuation(l)

with open('ir500_no_punc.txt', 'w') as file:
    file.write(file_no_punc)

removing any punctuation why?

A: def punctuation(string):
    punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''

    for x in string.lower():
        if x in punctuations:
            string = string.replace(x, "")

    # return string without punctuation
    return string

file = open('ir500.txt', 'r+')
file_no_punc = (file.read())

file_no_punc = punctuation(file_no_punc)

with open('ir500_no_punc.txt', 'w') as file:
    file.write(file_no_punc)

Explanation:
I changed only punctuation(l) to file_no_punc = punctuation(file_no_punc) and print(string) to return string
1) what is l in punctuation(l) ?
2) you are calling punctuation() - which works correctly - but do not use its return value
3) because it is not currently returning a value, just printing it ;-)
Please note that I made only the minimal change to make it work. You might want to post it to our code review site, to see how it could be improved.
Also, I would recommend that you get a good IDE. In my opinion, you cannot beat PyCharm community edition. Learn how to use the debugger; it is your best friend. Set breakpoints, run the code; it will stop when it hits a breakpoint; you can then examine the values of your variables.

A: taking out the file reading/writing, you could to remove the punctuation from a string like this:
table = str.maketrans("", "", r"!()-[]{};:'\"\,<>./?@#$%^&*_~")

# # or maybe even better
# import string
# table = str.maketrans("", "", string.punctuation)

file_with_punc = r"abc!()-[]{};:'\"\,<>./?@#$%^&*_~def"
file_no_punc = file_with_punc.lower().translate(table)
# abcdef

where i use str.maketrans and str.translate.
note that python strings are immutable. there is no way to change a given string; every operation you perform on a string will return a new instance.


text:
Q: MsgBox for a range of cells I'm trying to create a code that displays a MsgBox if contents in cells of column G are not equal to 0. Code works with just one cell but not with the full range (G20:G100).
can you please help.
thanks
Private Sub Worksheet_Calculate()

If Sheets("Sheet1").Range("G20:G100").Value <> 0 Then
    MsgBox "Not equal to 0", vbOKOnly
End If

End Sub

A: Try like this:
Private Sub Worksheet_Calculate()

    Dim myCell As Range

    For Each myCell In Range("G20:G100")
        If myCell <> 0 Then
            MsgBox myCell.Address & " is not equal to 0", vbOKOnly
            Exit Sub
        End If
    Next myCell
End Sub

It checks every cell in the range. For the first cell it finds with a different value than 0, it gives a MsgBox with its address and it exits.
You can make the MsgBox a bit more informative, showing the current value of the cell like this:
MsgBox myCell.Address & " is " & myCell.Text, vbOKOnly

If you remove the Exit Sub it will show different MsgBox-es for each cell that is different than 0.

A: The code below is a little longer, but you will get the result in 1 summary MsgBox with a list of all cells in the Range("G20:G" &LastRow) which are <>0.
Code
Private Sub Worksheet_Calculate()

    Dim myCell As Range, LastRow As Long
    Dim MsgString As String

    LastRow = Cells(Rows.Count, "G").End(xlUp).Row ' get last row with data in Column G
    ' making sure there is at least 1 cell with data in it below "G20"
    If LastRow < 20 Then
        MsgBox "Your range from G20 and below is empty", vbCritical
        Exit Sub
    End If

    For Each myCell In Range("G20:G" & LastRow)
        If myCell.Value <> 0 Then
            If MsgString <> "" Then  ' not first cell which is <> 0
                MsgString = MsgString & vbCr & myCell.Address
            Else
                MsgString = myCell.Address
            End If
        End If
    Next myCell

    MsgBox "The following cells are not equal to 0 :" & vbCr & MsgString, vbOKOnly

End Sub

Note: cell which are Empty do not enter the criteria of <>0, so if you want also to find empty cells as well, the code will need some slight modifications.


text:
Q: Htaccess not working when hyphen (-) is used in url I have the below code in my htaccess
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .?- [S=2]
RewriteRule ^abc/(.*)/(.*)$ index.php?aa=$1&bb=$2 [NE,L,QSA]
RewriteRule ^abc/(.*)$ index.php?aa=$1 [NE,L,QSA]

and when I pass the below url
http://example.com/abc/some-example?id=123

As per me I am supposed to ge $aa = some-example and $id = 123 in PHP
but I am getting the below error
Not Found

The requested URL /abc/[S=2] was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

and the above .htaccess file works fine when I pass the url as below
http://example.com/abc/someexample?id=123

A: I think you're missing a space before the dash on this line:
RewriteRule .?- [S=2]

Should be:
RewriteRule .? - [S=2]

EDIT: Why do you even have this rule? Try removing it.
As far as I can tell, if the request doesn't match a specific file, you're telling apache to skip your next two rules, which results in a 404 instead of a rewrite.
You might also want to add a rule at the end for a friendly 404 page in case the url requested doesn't match your rewrite regexes.

A: Thanks to Ryan,
Changing my
RewriteRule .?- [s=2]
to
RewriteRule ./ - [s=2]

helped me get what I was looking for
thanks to Ryan again.


text:
Q: Configuration of a pie chart and a legend in the dojo Sorry for my english.
I want to program a web application where a user fills out a form and sends it to the server. The server sends the requested data as a JSON object. With these data, a diagram and a legend with Dojo to create.
The graph and legend look like this:
http://www.gm.fh-koeln.de/~mi932/chart_with_legend.PNG
1 Question: In the legend, the number 47, 14, 11, ... are not displayed, but a given text to be displayed, which is located in the JSON object. How do I do that?
2 Question: I use the Claro theme of the dojo. But the subject has only 5 colors, then repeat the colors. How can I do that every sector of a circle given a different color?
3 Question: If the user makes a new query, the old chart and the old legend will be deleted and the new chart and legend. This only works with the chart. The legend will be hidden and not displayed. What am I doing wrong?
Client looks like this:
<script>
require(["dojo/dom",
         "dojo/on",
     "dojo/request",
     "dojo/dom-form",
     "statsDiagramme/kreisDiagramm",
     "statsDiagramme/stabDiagramm",
     "dojo/json",
     "dojox/json/query",
     "dijit/Dialog",
     "dijit/form/Button",
      "dojo/domReady!"],

function(dom, on, request, domForm, kreisdiagramm, stabdiagramm, json){

     var form = dom.byId('sqlOptForm');
     on(form, "submit", function(evt){
         evt.stopPropagation();
         evt.preventDefault();

         request.post("ServletStatsSQLOPT", {

    data: domForm.toObject("sqlOptForm"),
    handleAs: "json"

     }).then(function(response){

    var fehler = dojox.json.query("fehlermeldung", response);

    if(fehler == ""){
                                dojo.html._emptyNode("statsKreisDiagramm");
                                dojo.html._emptyNode("statsStabDiagramm");
                                dojo.html._emptyNode("legende");

                                stabdiagramm.setStabDiagramm(response);
                                kreisdiagramm.setKreisDiagramm(response);
                                dom.byId("statsKreisDiagramm").style.visibility = 'visible';
                                dom.byId("statsStabDiagramm").style.visibility = 'hidden';
                                dom.byId("statsMenuButton").style.visibility = 'visible';
                                dom.byId("legende").style.visibility = 'visible';

    }
    else {
        // ERROR

    }

    }, function(error) {
        // ERROR

        });
        });
    }
    );
</script>

The chart is created as:
define([
"dojox/charting/Chart",
"dojox/charting/themes/Claro",
"dojox/charting/plot2d/Pie",
"dojox/charting/action2d/Tooltip",
"dojox/charting/action2d/MoveSlice",
"dojox/charting/widget/Legend",
"dojox/charting/plot2d/Markers",
"dojox/charting/widget/Legend",
"dojox/charting/axis2d/Default",

"dojo/domReady!"
],
function(Chart, theme, PiePlot, Tooltip, MoveSlice, Legend){

    return{
        setKreisDiagramm: function(response) {

            var daten = new Array(response.summeArray.length);
            // response => JSON-Objekt
            for(var i=0; i < response.summeArray.length; i++) {
                daten[i] = { x: 1, y: response.summeArray[i].summe };
            }

            var kreisDiag = new Chart("statsKreisDiagramm");

            kreisDiag.setTheme(theme);

            kreisDiag.addPlot("default", {
                type: PiePlot,
                radius: 180,
                fontColor: "black",
                labelOffset: 30,
                markers: true
            });

            kreisDiag.addSeries("Zusammenfassung", daten);

            var tip = new Tooltip(kreisDiag, "default");

            var mag = new MoveSlice(kreisDiag,"default");

            kreisDiag.render();

            var legend = new Legend({ chart: kreisDiag, horizontal: false },   "legende");

        }
    };
}
);

Can any one help me?
I thank you in advance.

A: For question 2:
You can define your own theme or use a predefined dojo theme for your pie-chart.
You can find an Example and Explanations here:
http://dojotoolkit.org/documentation/tutorials/1.9/charting/ under the Point Chart Themes
Here's the API for the themes:
http://dojotoolkit.org/api/dojox/charting/themes/Minty
and a Preview for them:
http://download.dojotoolkit.org/release-1.5.0/dojo-release-1.5.0/dojox/charting/tests/theme_preview.html
Maybe this helps a bit.
Regards, Miriam

A: When a legend is present, it must first be destroyed.
The question 3 can be solved:
var legend = dijit.byId("legende");
if (legend) {
  legend.destroyRecursive(true);
}

var legend = new dojox.charting.widget.Legend({ chart: kreisDiag, horizontal: false }, "legende");


text:
Q: WPF UI update specifics Illustration for my general question:
Working with WPF I'm often stuck with the following problem: before firing up a UI-heavy operation I turn on a visual feedback control for showing  that the system is busy (some sort of a busy indicator); however the UI freezes without showing the busy indicator before it.
private void MyTree_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        this.MyBusyIndicator.IsBusy = true;
        ...
        //then some UI related operation
        ...
        this.MyBusyIndicator.IsBusy = false;
    }

(I can't move that time consuming operation to another thread, because it is the UI-thread related operation.)
Searching around for a possible solution or recommendation on solving such a problem, I read something about some WPF (or even .NET framework) UI updating specifics  which is the main cause for this type of problem.
So my question:
What is those WPF (or .NET framework) UI updating mechanism specifics, which prevents UI to be updated in exactly the same sequence as it was defined in a code?
Is it specific to WPF only indeed?
What are possible solutions or workarounds?
Is it a real problem or maybe just a result of my poor understanding?

A: The problem isn't specific to WPF - most UI frameworks behave the same way.
The problem here is that your UI won't update until the UI thread can process messages.  As long as you're doing work (the UI related operations), the UI thread is busy and can't process the messages required to redraw the screen.  In this case, that means that busy indicator won't redraw until after everything is completed.
The real solution here is to move the operations into a background thread.  While you say that all of these are UI-thread related, there's typically a way to separate out portions of this in WPF.  The key is to think about the parts that are taking a long time, and move them, and only them, out.  This typically means loading your data, but not setting it to the UI (ie: setting the bound property) until after it's completely loaded and processed.
If that's completely not possible, the only real option is to set your busy indicator, then use some mechanism to push the other work off until after the UI thread can process.  This can be done by using Dispatcher.BeginInvoke to push the remaining work off until "later", though it's somewhat hackish to do.  This would look like:
private void MyTree_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    this.MyBusyIndicator.IsBusy = true;

    this.Dispatcher.BeginInvoke( (Action) () =>
    {
        // This is now sent to the dispatcher to process later, which gives the busy indicator a chance to refresh...

        //then some UI related operation
        this.MyBusyIndicator.IsBusy = false;
    });
}

That being said, this isn't always perfectly reliable, either - as you're still locking your UI thread.  Ideally, you should never block the UI, as it will prevent redraws from occurring correctly...  A DispatcherTimer would work more reliably, but again, is really not a very good way to handle it.

A: In .NET You can use Thread Queue
private void Button_Click( object sender, RoutedEventArgs e )
{
  ThreadPool.QueueUserWorkItem(
        delegate
        {
            // GUI Thread call
            this.Dispatcher.BeginInvoke(
                    DispatcherPriority.Normal,
                    new Action( () => { this.MyBusyIndicator.IsBusy = true; }) )

            // Action in non-GUI Thread
            ...

            // GUI Thread call
            this.Dispatcher.BeginInvoke(
                    DispatcherPriority.Normal,
                    new Action( () => { this.MyBusyIndicator.IsBusy = false; }) )
        } );
   }
}


text:
Q: how to fix jupyter notebook read-only I'm creating another environment with Anaconda on WSL(Windows Subsystem for Linux).
- Ubuntu , conda 4.5.12, python3.6
I've actually copied windows files stored in /mnt/c/ to wsl home directory.
And I tried to use them in jupyter notebook, it always comes with "read-only" file and am not even able to create a new python file in jupyter notebook.
I've checked on permission on those files:
-rwxr-xr-x 1 root root     599226 Jan 22 21:14 test.ipynb
-rwxr-xr-x 1 root root     706198 Jan 22 21:14 test2.ipynb

Suppose it says I can write them.
Then I went through jupyter permission as well:
-rwxrwxr-x 1 myname myname      240 Jan 23 18:25 jupyter

So I guess I can fully handle jupyter notebook too.
Is there anything I should look into to solve this problem?
Thanks much!

A: In my case, I was copying the notebook to the server under the root, and later trying to use it from under another account. Copying/creating the file from the same acc that is used to run the file is the key to success )


text:
Q: reverse a character in array using recusion in C this is my recursion function
void reverseArray(char *str,int len)
    {
        char temp;
        if(len==(0.5*len))
        {
            return;
        }
        temp=*(str+len-1);
        *(str+len-1)=*str;
        *str=temp;
        reverseArray(str+1,len-1);
    }

iam trying to reverse the charcters but when i send {'1', '2', '3', '4', '5', '6','7'} to function i always get 7123456 only the last charcter become first the other not changing .

A: In this call
reverseArray(str+1,len-1);

the second argument is incorrect. You have to write
reverseArray(str+1,len-2);

Also instead of this condition
if(len==(0.5*len))

it is much better to write
if ( len < 2 )

The function can look the following way
void reverseArray( char *str, size_t n )
{
    if ( !( n < 2 ) )
    {
        char tmp = *str;
        *str = *( str + n - 1 );
        *( str + n - 1 ) = tmp;

        reverseArray( str + 1, n - 2 );
    }
}

Or
char * reverseArray( char *str, size_t n )
{
    if ( !( n < 2 ) )
    {
        char tmp = *str;
        *str = *( str + n - 1 );
        *( str + n - 1 ) = tmp;

        reverseArray( str + 1, n - 2 );
    }

    return str;
}

Pay attention that the function strlen or the operator sizeof  returns a value of the type size_t. This type you should use to specify the length of a character array instead of the type int.
For example the last function can be called like
char str[] = "Hello World!";
puts( reverseArray( str, strlen( str ) ) );


text:
Q: Firefox won't remember passwords, and throws weird javascript exceptions Two days ago Firefox started throwing strange javascript errors
e.g.
Error: Cc[contractID] is undefined
Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsLoginManager.js
Line: 113

It's throwing these on every page on every site I visit.
If I browse to a site that requires http authentication (e.g. http://seo.dizzyheights.com - one of our test sites), the authentication dialog no longer includes the "Remember this password" checkbox, even though I'm not in Private Browsing mode, and "Remember passwords for sites" is still ticked in the Firefox options. It also throws an even bigger javascript error:
Error: LoginManagerPrompter: Epic fail in promptAuth: [Exception... "'[JavaScript Error: "Cc[contractID] is undefined" {file: "file:///C:/Program%20Files/Mozilla%20Firefox/components/nsLoginManager.js" line: 113}]' when calling method: [nsILoginManager::findLogins]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsLoginManagerPrompter.js :: anonymous :: line 585"  data: yes]

Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsLoginManagerPrompter.js
Line: 607

If I view saved passwords in the Firefox options dialog, there are none.
I've deleted my key3.db and signons.sqlite files from my profile, but that didn't help.
These errors continue if I run Firefox in safe mode, so I don't think it's related to any of my add-ons. I'm running Firefox 3.6.6 on Vista SP2.
Any ideas?

A: Maybe your FF installation is simply corrupt. Have you tried reinstalling FF? This will leave your profile folders untouched, so no settings should be lost (you only need to reinstall addons that were installed for everyone).
If you are curious, you could also backup your old files under Program Files/Mozilla, and compare them after the reinstall.


text:
Q: watir ruby Follow link redirection and get final url Hello I see there is way to handle redirect with ruby, but I was thinking aybe there is the way to do it with watir and then it will be same browser and coockie etc.
So if anyon can give me example how to follow url.
Let's write exapmle:
This is link www. ly.by/ldkfjfjgii
in watir I already have destination link
and I could say
link = b.frame(:id => 'main_top_right').link(:index => 0).click

so is there a way to catch redirected url (final destination url), where it lands
example it could land on http:// somesite. com/jdkdjfk.
I want that final url after redirect with watir, I hope I was clear.
tnx

A: After clicking on any link, you can get the current URL of the page by using
browser.url

in case clicking URL opening the link in new window/tab, you can use
browser.windows.last.use do
browser.url
end

A: After clicking the link, the .url method from the Watir::Browser class can obtain the URL.
This is a link to the rdoc: http://rubydoc.info/gems/watir-webdriver/0.6.0/Watir/Browser#url-instance_method
Example:
b.frame(:id => 'main_top_right').link(:index => 0).click
url_after_click = b.url


text:
Q: Responsive web design Bootstrap I am creating a website with bootstrap. The site will have main div which has a heigh set to 100% and a margin of 5% on all 4 sides, then it has another div which contains all content (this div also has a border), now I want to make it responsive, I want that I change the screen the content should has margin on all 4 sides and then box should have all content and it should scale but I am unable to do so. I have also used chartjs to place 6 charts on the page.Can someone plesae help me with this? Following is the page code (I have removed most of scripts as of now) :

    Right First Time - Summary

  <button type="btn" class="btn btn-light btn-sm visible" style="padding:5px;font-size:8px" onclick="toPercentage()" id="showpercentage">Percentage</button>
  <button type="btn" class="btn btn-light btn-sm visible" style="padding:5px;font-size:8px" onclick="toNumbers()"  id="shownumbers">Numbers</button>

  Updated ON:14-07-2022

RFT

39%

Case close same day

    48%<canvas id="24hoursclosed" ></canvas>

No Repeat in 7 days

  88%<canvas id="norepeats" width="50" height="50" style="width:100px;height:100px"></canvas>

One Contact Only

     93%<canvas id="ocr7" width="50" height="50" style="width:100px;height:100px"></canvas>

Less than 3 transfers

  95%<canvas id="scr7" width="50" height="50" style="width:100px;height:100px"></canvas>

Total Cases

      7765

Chart Frequency

    <button type="btn" class="btn btn-light btn-sm visible" style="padding:1px;font-size:10px" value="Daily" onclick="frequencyselected('Daily')">Daily</button>
    <button type="btn" class="btn btn-light btn-sm visible" style="padding:1px;font-size:10px" value="Weekly" onclick="frequencyselected('Weekly')">Weekly</button>

    FILTERS

       Business Segment

               <input class="form-check-input businesssegmentselect" type="checkbox" value="Blank" id="businesssegmentselect">

                  Blank

               <input class="form-check-input businesssegmentselect" type="checkbox" value="Individual" id="businesssegmentselect">

                  Individual

               <input class="form-check-input businesssegmentselect" type="checkbox" value="SMB" id="businesssegmentselect">

                  SMB

       Employee Manager

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Akash Joshi" id="employeemanagerselect">

                  Akash Joshi

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Bijendra Yadav" id="employeemanagerselect">

                  Bijendra Yadav

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Dixita Agarwal" id="employeemanagerselect">

                  Dixita Agarwal

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Lokesh Yadav" id="employeemanagerselect">

                  Lokesh Yadav

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Sajan singh" id="employeemanagerselect">

                  Sajan singh

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Shivam Sharma" id="employeemanagerselect">

                  Shivam Sharma

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Subhendu Nandy" id="employeemanagerselect">

                  Subhendu Nandy

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Varsha Pathak" id="employeemanagerselect">

                  Varsha Pathak

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Vijay Bhatia" id="employeemanagerselect">

                  Vijay Bhatia

               <input class="form-check-input employeemanagerselect" type="checkbox" value="Vishvamohan Ajay" id="employeemanagerselect">

                  Vishvamohan Ajay

          Channel

                  <input class="form-check-input channelselect" type="checkbox" value="EDU Form" id="channelselect">

                     EDU Form

                  <input class="form-check-input channelselect" type="checkbox" value="Phone" id="channelselect">

                     Phone

                  <input class="form-check-input channelselect" type="checkbox" value="Web Messaging" id="channelselect">

                     Web Messaging

       Call Center

               <input class="form-check-input callcenterselect" type="checkbox" value="TP Jaipur" id="callcenterselect">

                  TP Jaipur

       LOB

               <input class="form-check-input lobselect" type="checkbox" value="Customer Support" id="lobselect">

                  Customer Support

               <input class="form-check-input lobselect" type="checkbox" value="Operations" id="lobselect">

                  Operations

               <input class="form-check-input lobselect" type="checkbox" value="Retention" id="lobselect">

                  Retention

<canvas id="myChart" width="400px" height="400px" style="border:1px solid #000000;border-radius: 5px;">

<canvas id="myChart2" width="400" height="400" style="border:1px solid #000000;border-radius: 5px;"></canvas>


text:
Q: Update column of a large set of records with a calculated value I am trying to figure out what a good way would be to write the pseudo query below in TSQL taking into account that there will be about 50 actualResult records and 100.000 prediction records per actual result involved.
update prediction
set points = (
    @points = 0
    if(prediction.valueA = actualResult.valueA AND prediction.valueB = actualResult.valueB)
        @points = @points + 3
    if (prediction.valueA = actualResult.valueA OR prediction.valueB = actualResult.valueB)
        @points = @points + 1
    select @points
)
join actualResult on prediction.actualid = actualResult.id
where actualResult.id in (some subquery)

what I am wondering about is:

*

*Is there a way of doing the calculation which in reality is more complex inline? Right now I can only get it to work if I put it in a function but from what I understand this means it's constantly re-calculted even if the input is the same (which I quite likely in allot of the predictions)

*Would this way lock the entire range of records? And if so is there a way to prevent this? For example by copying it all to a table variable and then doing the calculation on that and then updating the records once all calculations are done?

am I on the right track here or would you write it in a different way?

A: Try this:
update prediction
set points =
    (
        0
        +
        CASE WHEN prediction.valueA = actualResult.valueA AND prediction.valueB = actualResult.valueB
        THEN 3 ELSE 0 END
        +
        CASE WHEN prediction.valueA = actualResult.valueA OR prediction.valueB = actualResult.valueB
        THEN 1 ELSE 0 END
    )
join actualResult on prediction.actualid = actualResult.id
where actualResult.id in (some subquery)

AFAIK - if function is not depend on data in query, then it calls one time per query,
AND
if the function is deterministic and schema bound - it will not call multiple times for the same data, BUT there has to be an index on argument data AND optimizer must want to use that index
If you want per-row locking, use ROWLOCK hint

A:
Is there a way of doing the calculation which in reality is more complex inline?

If you can fold the logic in to an inline statement, perhaps using CASE as shown below, it will typically outperform a scalar UDF (user defined function) by orders of magnitude. The argument for a UDF is usually encapsulation of a complex or common calculation but if its only required in this one query, might as well inline it.
UPDATE
    p
SET
    p.Points = p.Points +
            CASE
                WHEN p.valueA = a.valueA AND p.valueB = a.valueB THEN 3
                WHEN p.valueA = a.valueA OR p.valueB = a.valueB THEN 1
                ELSE 0
            END
FROM
    dbo.Prediction p
INNER JOIN
    dbo.ActualResult a
ON  a.Id = p.ActualId
WHERE
    a.Id IN (subquery)

Would this way lock the entire range of records?

You need to understand the concept of isolation levels to determine a) what will be locked and perhaps more importantly b) what should be locked. In short, at the default READ COMMITTED isolation level a shared lock will be taken and immediately released on each row in each table as it is read to perform the join. Rows in Prediction that will be updated will be protected with update and then exclusive locks on the rows which will be held until the statement (or parent transaction) is committed.
Depending on the distribution and volume of updates, you may find rows in the above substituted for pages or worst case tables.

And if so is there a way to prevent this? For example by copying it
  all to a table variable and then doing the calculation on that and
  then updating the records once all calculations are done?

You can't prevent the locking of rows that are being updated or inserted, else ACID compliance would be compromised. You can reduce the locking on rows that are being read but you may need to consider the opposite and increase the isolation level. If other processes insert or update records while this update occurs, you could end up with a miscalculation.
As per Isolation Levels in the Database Engine...

Transactions specify an isolation level that defines the degree to
  which one transaction must be isolated from resource or data
  modifications made by other transactions. Isolation levels are
  described in terms of which concurrency side-effects, such as dirty
  reads or phantom reads, are allowed.

A Profiler trace on Lock:Acquired/Released events and/or use of trace flag 1200 on an isolated test machine can be very useful for understanding the sequence of locks applied and released at different isolation levels.

A: One other thing you could possibly do if you're worried about locking large portions of a table or involving an underlying trigger in thousands of calls at the same time is to look at more of a looping / chunk approach. Given that you have ~50 ActualResult records, you could loop through those 1-5 at a time and most likely get decent performance.  That might also save you from having your row locks escalate into table locks.

A: If goal is to keep prediction up-to-date according to data in actualResult table, you may try using a different approach. Write AFTER INSERT,UPDATE,DELETE trigger that UPDATE prediction set valueA = valueA +3(or -,depends on dml) WHERE ....


text:
Q: ERROR in Cannot find module './_Stack' @ multi main - webpack I am trying to use react-music (https://github.com/FormidableLabs/react-music), after npm start i get this error message
ERROR in Cannot find module './_Stack'
 @ multi main
webpack: bundle is now VALID.
webpack.config.js
    const path = require('path');
const webpack = require('webpack');

module.exports = {
  entry: [
    './demo/index',
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/dist/',
  },
  plugins: [
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production'),
      },
    }),
  ],
  module: {
    loaders: [{
      test: /\.js$/,
      exclude: /node_modules/,
      loader: 'babel',
    }, {
      test: /\.css$/,
      loader: 'style!css!postcss',
    }],
  },
};


text:
Q: Simple CSS style - positioning div's
This is a really simple question about CSS. I want to get the style depicted in the picture, I tried this code:
#parent {
    overflow: hidden;
text-align:center;
}
.navbar {
position:absolute;
top:0px;
right:3px;
}
.logo {
float:left;
}
.table {
float:left;
}

but it doesn't work for me, I get this:

A: Try:
#parent {
overflow: hidden;
text-align:center;
margin:auto;
width:80%;
}
.navbar {
position:absolute;
top:0px;
right:3px;
}
.logo {
float:left;
}
.table {
float:left;
}

In order to accomplish what you want, you'll need to center your parent divider using margin:auto and placing a fluid width using width:80%.

A: I'd give your parent element an explicit width, then position from there:
#parent {
  width: 960px;
  margin: 0 auto;
  position: relative;
}

.navbar {
  position: absolute;
  top: 0;
  right: 3px;
}

.logo {
  margin-bottom: 20px;
  display: inline-block;
}

.table {
   width: 100%;
 }

I don't know what other contents you have on the page, but your .logo element should appear where you want using default HTML flow. If the table is 100%, it will clear. You should be able to pull this off without floats.


text:
Q: Objective C: Detecting a Voice Good day! i just want to ask if what value should i need to input in my code and inside the condition in order to detect a regular voice of a user, in such that after i detected the voice, i will record it automatically and stop the recording when it is silent/the recorder didnt detect the voice, this is my code and i get that from detecting when a user blows into the mic.
- (void)levelTimerCallback:(NSTimer *)timer {
    [recorder updateMeters];

    const double ALPHA = 0.05;
    double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0]));
    lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;

    [recorder record];
    if (lowPassResults < 0.95)
        {NSLog(@"Recording");
             [recorder record];}

}

im new at objective c, any help would be very helpful to me... thanks in advance.

A: There is no set level you can use to detect the volume of normal speech. Leaving aside issues of background noise and so on, There is no standard translation between audio levels as numbers in a computer and sound levels in the air.
Think about it: what are the input levels? What type of mike is it? How far away is the user? You don't know any of these things, so there's no way to know the answer.
You might want to think about looking for relative change in volume, rather than absolute level (although this is iffy as well) or a different user experience entirely.


text:
Q: does the android webview version depends on the sdk or the device? Android 5 is upgrading the WebView to Chromium 37. Does it mean I have to use the latest sdk for android 5 to enjoy the benefits, or the WebView will be automatically updated for the app once the user has been upgraded to android 5? What if I use android 5 SDK to create an apk and run it on an older version of android device?
Thanks!

A: Starting with Lollipop, WebView is updated on the device through Play Store/Play Services.  Your app will use the WebView that is on the device, unless you specifically include another version in your apk and use that (not typically done).
The targetSdkVersion you build with will not have any affect on what WebView is installed on the device.

A: The initial release for Android 5.0 includes a version of Chromium for WebView based on the Chromium M37 release, adding support for WebRTC, WebAudio, and WebGL.
Chromium M37 also includes native support for all of the Web Components specifications: Custom Elements, Shadow DOM, HTML Imports, and Templates. This means you can use Polymer and its material design elements in a WebView without needing polyfills.
Although WebView has been based on Chromium since Android 4.4, the Chromium layer is now updatable from Google Play.
As new versions of Chromium become available, users can update from Google Play to ensure they get the latest enhancements and bug fixes for WebView, providing the latest web APIs and bug fixes for apps using WebView on Android 5.0 and higher.


text:
Q: LINQ to Twitter Support Xamarin.iOS? I wonder if anyone try using LINQ to Twitter 3.0 beta with Xamarin.iOS ? Joe Mayo provide an example of how using the library with Xamarin.Android However i can't seems to get that work on IOS > it's compiling, but it crashes at runtime because it's looking for not-existing assemblies

A: I wrote a blog, LINQ to Twitter Runs On Xamarin.iOS. A couple days ago, I also posted v3.0 as a pre-release on NuGet.


text:
Q: Why does using parentheses with a default constructor result in creation of the variable? After watching Louis Brandy talk at CppCon 2017 I was shocked to discover that this code actually compiles:
#include <string>

int main() {

    std::string(foo);

    return 0;
}

And for some reason std::string(foo) it is identical to std::string foo i.e. declaring a variable. I find it absolutely counterintuitive and can't see any reason for C++ to work that way. I would expect this to give an error about undefined identifier foo.
It actually makes expressions like token1(token2) have even more possible interpretations than I previously thought.
So my question is: what is the reason for this horror? When is this rule actually necessary?
P.S. Sorry for the poorly worded title, please, feel free to change it!

A: Since this question is tagged language-lawyer, the direct answer is that, from [stmt.ambig]:

There is an ambiguity in the grammar involving expression-statements and declarations: An expression-statement with a function-style explicit type conversion as its leftmost subexpression can be indistinguishable from a declaration where the first declarator starts with a (. In those cases the statement is a declaration.

And, similarly, for functions, in [dcl.ambig.res]:

The ambiguity arising from the similarity between a function-style cast and a declaration mentioned in [stmt.ambig] can also occur in the context of a declaration. In that context, the choice is between a function declaration with a redundant set of parentheses around a parameter name and an object declaration with a function-style cast as the initializer. Just as for the ambiguities mentioned in [stmt.ambig], the resolution is to consider any construct that could possibly be a declaration a declaration.

Hence:

Why oh why is std::string("foo") so different from std::string(foo)

The former cannot be a declaration. The latter can be a declaration, with a redundant set of parentheses. Thus, the former isn't a declaration and the latter is.
The underlying issue is that, grammaticaly, declarators can start with a ( which could make it indistinguishable from a function-style explicit type conversion. Rather than come up with arbitrary complex rules to try to determine what the user meant, the language just picks one, and it's easy enough for the user to fix the code to actually do what he meant.


text:
Q: Ubuntu Server Wifi and Ethernet I installed the Ubuntu 16.04LTS server version, downloaded and successfully installed Edimax EW-7811Un drivers, set up a webserver and connected to my WiFi. Both LAN and WiFi interface got a (different) IP.
Everything worked fine I tried to access the server through the WiFi adapter IP address and it worked fine. Then I unplugged the Ethernet cable, restarted the whole machine and tried again to connect but with no success.
The server was up and I was able to see that he's in the network, i just wasn't able to establish a connection.
I plugged in the LAN cable and voilà I was able to reach the server over the wife IP (and obviously also over the LAN IP).
Is there any explanation for this behavior?

A: If is the output the same, then you have problem with default gateway witch is stay on eth card. In you case enp0s25. Chack again command route -n, when eth is disconnected. Default route must be on wifi interface. If not check DHCP server setting. Do you got default gateway or only ip address and network mask.
You can add in /etc/network/if-down.d/ some script to put default gw to your wifi card wlx74da382e1752
Example:
sudo nano /etc/network/if-up.d/script

and put content
# Check for specific interface if desired
[ "$IFACE" != "enp0s25 " ] || exit 0
# Return put default gw to wifi
route add default dev wlx74da382e1752

give script privilege
chmod 755 /etc/network/if-down.d/script

if-down.d will trigger script called script when enp0s25 go down and put default gw to wlx74da382e1752
wlx74da382e1752 - i guess is name of your wifi card.


text:
Q: Can I add predicates at runtime? The context is a system of predicates: rules and facts, that together determine an amount to be paid to a client, depending on his situation. Most rules and facts are known at compile time, but facts about a specific situation are only known at runtime, when processing a pay out request. I know how to program a system in Mercury in the case that all predicates are known at compile time (i.e. are part of the source code), but I don't know how to introduce predicates at runtime. Is it possible to write a function that constructs a predicate with the given parameters and then be able to use the constructed predicate as part of the context against which amounts are calculated?

A: I am not sure exactly what your question is.
If by "construct a predicate with the given parameters", you are asking whether you can construct a closure that contains a reference to a
predicate in the originally compiled program and a list of values for its
initial arguments that are constructed at runtime, then the answer is "yes, you can do that".
If you mean whether you can construct at runtime a predicate whose code
is NOT part of the originally compiled program, then the answer is "no, you can't do that" in Mercury. However, it is possible to work around this, by

*

*writing the code of the new predicate to a new Mercury module;

*compiling that module to object code;

*using dynamic linking to make the new object file part of the existing executable; and

*using the foreign code interface to transfer a target-language C pointer, or its equivalents in other languages, to the original code, for it to call.

However, this method is not recommended for anyone who doesn't have an implementor's understanding of how the Mercury implementation works.


text:
Q: Would a google cloud platform machine with many different CPUs allow me to run API requests through several differen IP addresses? I am trying to query public utility data from an API (oasis.caiso.com) with a threaded script in R. Apparently this API will refuse requests from certain IP addresses if too many are made. Therefor I need to run many different API requests in parallel across different IP addresses, and am wondering if a machine with many different CPUs on google cloud platform will allow this?
I was looking at the n1-highcpu-96 option from this page: https://cloud.google.com/compute/docs/machine-types
If this is a poor solution can anyone suggest another distributed computing solution that can scale to allow dozens or even hundreds of API queries simultaneously from different IPs?

A: If I needed multiple IP to perform "light" API calls I would not scale vertically (with a machine having 96 core). I would create an instance group with 50 or 100 or n Debian micro or small preentible instances with the size depending on the kind of computation you need to perform.
You can set up a startup script loaded in the metadata or in a custom image that connects to the API server do what it has to do and save the result on a bucket and if the instance get a "API refuse" I would simply kill the instance automatically having the instances group creating a new one for me with possibly a new IP.
This I think is a possible easy solution to achieve what you want, but I guess there are multiple solutions.

I am not sure what you are trying to achieve and I think you need to check first that it is legal and if the owner of the API agree.


text:
Q: Wordpress Post/Pages redirect when using permalinks and do not when using default settings I have a webiste on which I use permalinks like /%category%/%postname%/ .
They were working fine a week or two ago. Now when I want to enter a page a get an error telling me that the page is not redirected correctly.
I have no redirects made in my htaccess file. NONE.
If I change the permalinks to default then every page/post works fine.
I do not know what to do. Please help
Here is the .htaccess
<ifModule mod_headers.c>
  ExpiresActive On
  # Expires after 1 month
  <filesMatch ".(gif|png|jpg|jpeg|ico|pdf|js|htm|html|txt)$">
    Header set Cache-Control "max-age=2592000"
  </filesMatch>
  # Expires after 1 day
  <filesMatch ".(css)$">
    Header set Cache-Control "max-age=2592000"
  </filesMatch>
</ifModule>
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

A: Very general way to fix wordpress redirect issues: (should work in all cases)

*

*/wp-admin/options-permalink.php Click "save changes". this will refresh WP redirect rules.

*check .htaccess, try to comment everything except WP part.

*Try to temporary disable plugins. Quick way is to rename wp-content/plugins/ folder, WP will not disable plugins, just will not load them. ATTENTION: do not visit /wp-admin/plugins.php when wp-content/plugins/ is renamed, becouse WP would auto disable them all.

*check your themes files, functions.php, try to activate WP another/default theme for test.

*If above do not work, download new fresh WP version.

TIP: try to never change files in wp-admin/ or wp-includes/ folder. These gives disaster  in future.


text:
Q: How to calculate R2 or contribution to RDA of each loading in a PCA in R? I've run a standard RDA analysis for my data. I am struggling to find a formal analysis for some important insights (i.e. I need a way to report these statements in my paper)

*

*The R2 value + rank or order of importance of each environmental variable? I can see that shrub explains the least variation, but between the other three, I cannot identify which is longer. Also, is there a way of getting R2 or Contribution to RDA model?
The anova.cca(mite.spe.rda.signif, step = 1000, by = "term") only provides the variance and p-value. I want to learn more about the strength and contributions. Basically I want to create a table like so (attached below) for my paper

*Consider the red x lying in between Shrub and WaterCont at ~(-0.5,-0.5). I want to estimate if Shru or WaterCont explains more of the variation. How can I calculate the distance from each loading to support my point?
# Load mite species abundance data
 data("mite")
 # Load environmental data
 data("mite.env")

 # Hellinger transform the community data
 mite.spe.hel <- decostand(mite, method = "hellinger")

 # Standardize quantitative environmental data
 mite.env$SubsDens <- decostand(mite.env$SubsDens, method = "standardize")
 mite.env$WatrCont <- decostand(mite.env$WatrCont, method = "standardize")

 mite.spe.rda.signif <- rda(mite.spe.hel ~ WatrCont + Shrub +
     Substrate + Topo + SubsDens, data = mite.env)

 # Find the adjusted R2 of the model with the retained env
 # variables
 RsquareAdj(mite.spe.rda.signif)$adj.r.squared

 anova.cca(mite.spe.rda.signif, step = 1000, by = "term")

 # Scaling 2
 ordiplot(mite.spe.rda.signif, scaling = 2, main = "Mite RDA - Scaling 2")

Table I want to create


text:
Q: Python Flask webserver stop responding I am running a flask web server, it works fine during testing, but now freezes at least once per day. All I need to do is to restart it and it will work again. Is there a good way to monitor it and maybe I should just kill/restart it every time it fails. Do people actually kill their web server periodically to avoid this kind thing from happening?

A: If you are using the default Flask webserver: Don't. It's intended for development ONLY.
As additional resource it's worth reading these two blog posts about deploying a Flask application:
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvii-deployment-on-linux-even-on-the-raspberry-pi
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xviii-deployment-on-the-heroku-cloud
And for monitoring processes in your webserver, you could give Watchy a try:
http://redbrain.github.io/watchy/

A: While the default web server might not be the best for production, it is probably not the root cause of the crashes.   I use it in a production environment on an internal network and it is very stable.  Before blaming the web server check to make sure your code can handle requests that that may collide with each other.   In my case I had lots of stability issues before I instituted locking on data base tables so that certain requests would be blocked until previous requests were done with updates.   Flask can't make sure your code is thread safe.  And changing the web server won't help if it is not.

A: In my case, I need to change worker_class from 'sync' to 'gevent', since I do some asynchronous tasks. Then no more hangs.


text:
Q: How to make JavaScript files show up in the list under "Scripts" in Google Chrome? I have added 4 JavaScript files to my page:
<script src="scripts/jquery/jquery-1.6.2.min.js"></script>
<script src="scripts/jquery/jquery.mobile-1.0b2.min.js"></script>
<script src="scripts/config.js"></script>
<script src="scripts/test.js"></script>

Google Chrome lists the first two files under scripts but not the last two. If I add the folloing JavaScript to the test.js the alert happens:
alert('test');

How can I make chrome pick up the file to debug?
In the Developer Tools the last two scripts are not showing up. How can I make them show up?

A: Your scripts probably get completely collected (by GC) before debugger has a chance to see them. I guess there are no global functions in these scripts.
If I'm right, you can try to put something simple like "function A111() {}" and check that the scripts are there now.

A: I would check the resources tab in dev tools and see if they are there under scripts.
also include type just to be safe
<script type="text/javascript" src="script.js"></script>

do you have a live example (link)?

A: I had this problem and the reason was:
there was a JavaScript syntax error in the script and so that script didn't load in.
If you do have a syntax error, simply go to the Console tab in Developer Tools and look for any red lines e.g. "Uncaught SyntaxError: Unexpected identifier".  On the right hand side is a link to the filename and line number so Chrome will tell you EXACTLY where your problem is.


text:
Q: MWAA: install python requirements behind proxy we've launched a private MWAA environment. We are able to access the UI, but we're having some trouble installing our python requirements.
MWAA picks up the requirements file from S3, but runs into a timeout when trying to install the python packages.
This is expected, because we're behind a proxy, so my question would be: how do we tell MWAA to use our proxy while installing our python dependencies?
This is what our CloudWatch logstream (requirements_install_ip*) tells us:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection
object at 0x7fda26b394d0>, 'Connection to pypi.org timed out. (connect timeout=15)')'

A: We have contacted AWS support on this, and apparently there is no such option as to pass the proxy variable. So we placed a feature request.
Even though I'm not sure if this is going to be implemented at all, anybody interested in this may feel free to subscribe to the MWAA document history feed.

A: You can set this in your  pip.ini
[global]
index = https://eg.nexus.repo.url
index-url = https://eg.nexus.repo.url

To get where your pip.ini is, you can do:
pip config -v list


text:
Q: How to add two numbers without concatenating them as strings? The parseInt(sum3) + parseInt(sum5) is not adding the two variables. It just concatenates them. How can I add the two?
I know I can just manually create another variable and put the output of sum3 there and put the output of sum5 in another variable and add them like that but I idk I think that's cheating. So how can I add the sum3 and sum5?
// sum of 3
let max3 = parseInt(1000);
let sum3 = 0;

for ( let three=3; three<=max3; three++ ){
    sum3+=three
}

// sum of 5
let max5 = parseInt(1000);
let sum5 = 0

for (let five=5; five<=max5; five++){
  sum5+=five
}

// sum of 3 and 5

document.write("Sum of 3 = " + sum3 + "
"
   + "Sum of 5 = " + sum5 + "
" +
    "Sum of 3 and 5 = " + parseInt(sum3) + parseInt(sum5));

A: It's just because you're using + in the context of string concatenation.
Should be:
document.write("Sum of 3 = " + sum3 + "
"
   + "Sum of 5 = " + sum5 + "
" +
    "Sum of 3 and 5 = " + (sum3 + sum5));

Or you really should use:
document.write(`Sum of 3 = ${sum3}

        Sum of 5 = ${sum5}

        Sum of 3 and 5 = ${sum3 + sum5}`);

A: You can just wrap parseInt(sum3) + parseInt(sum5) in a () bracket and it should do the job.

// sum of 3
let max3 = parseInt(1000);
let sum3 = 0;

for (let three = 3; three <= max3; three++) {
  sum3 += three
}

// sum of 5
let max5 = parseInt(1000);
let sum5 = 0

for (let five = 5; five <= max5; five++) {
  sum5 += five
}

// sum of 3 and 5

document.write("Sum of 3 = " + sum3 + "
" +
  "Sum of 5 = " + sum5 + "
" +
  "Sum of 3 and 5 = " + (parseInt(sum3) + parseInt(sum5)));

A: You concatenate both string values with the use of '+'.
Don't combine this with string so '+' will still work as expected.

// sum of 3
let max3 = 1000;
let sum3 = 0;

for (let three=3; three<=max3; three++){
    sum3+=three
}

// sum of 5
let max5 = 1000;
let sum5 = 0

for (let five=5; five<=max5; five++){
  sum5+=five
}

// sum of 3 and 5
let totalSum = sum3 + sum5

document.write("Sum of 3 = " + sum3 + "
"
   + "Sum of 5 = " + sum5 + "
" +
    "Sum of 3 and 5 = " + totalSum);


text:
Q: CSS simulate element move I have a site with two sidebars and the content in the middle. In the HTML it's positioned as:
sidebar 1 - floated left
middle content - floated left
sidebar 2 - floated right

And that's also how it looks on the site. All good. The problem is i'm trying to make the site responsive, and i want the content to be at the top and the sidebars to jump down below, and i'm not entirely sure how to do that. I could use javascript, but i would much prefer CSS to do it, if possible.
Here's the site i'm working on if it helps:
[URL no longer allowed]
Squeeze the window down a bit and watch the left sidebar appear above the content - not good.
Is it possible?

A: Reorder your divs so the body content div is first.
Then wrap the first sidebar and body content in a div floating the body content to the right. Use a media query so that once your down to mobile size you set the floats to none
<div float:left>
  <main-content float:right>
  <sidebar float:left>
<\div>
<sidebar float:right>


text:
Q: Using Angular, how can I show a DOM element only if its ID matches a scope variable? I am relatively new to AngularJS.
I have a series of DIVs in a partial view.   Each of the DIVs has a unique ID.   I want to show / hide these DIVs based on a scope value (that matches one of the unique ID).
I can successfully write out the scope value in the view using something like {{showdivwithid}}
What would be the cleanest way to hide all the sibling divs that dont have an ID of {{showdivwithid}}

A: I think you are approaching the problem with a jQuery mindset.
Easiest solution is to not use the id of each div and use ngIf.

content here

content here

content here

If you don't mind the other elements to appear in the DOM, you can replace ng-if with ng-show.
Alternatively use a little directive like this:
app.directive("keepIfId", function(){
    return {
        restrict: 'A',
        transclude: true,
        scope: {},
        template: '

',
        link: function (scope, element, atts) {
            if(atts.id != atts.keepIfId){
                element.remove();
            }
        }
    };
});

HTML

content here

content here

content here

A: First, I want to echo @david004's answer, this is almost certainly not the correct way to solve an AngularJS problem. You can think of it this way: you are trying to make decisions on what to show based on something in the view (the id of an element), rather than the model, as Angular encourages as an MVC framework.
However, if you disagree and believe you have a legitimate use case for this functionality, then there is a way to do this that will work even if you change the id that you wish to view. The limitation with @david004's approach is that unless showdivwithid is set by the time the directive's link function runs, it won't work. And if the property on the scope changes later, the DOM will not update at all correctly.
So here is a similar but different directive approach that will give you conditional hiding of an element based on its id, and will update if the keep-if-id attribute value changes:
app.directive("keepIfId", function(){
    return {
        restrict: 'A',
        transclude: true,
        scope: {
          keepIfId: '@'
        },
        template: '

',
        link: function (scope, element, atts) {
            scope.idMatches = false;
            scope.$watch('keepIfId', function (id) {
              scope.idMatches = atts.id === id;
            });
        }
    };
});

Here is the Plunkr to see it in action.
Update: Why your directives aren't working
As mentioned in the comments on @david004's answer, you are definitely doing things in the wrong way (for AngularJS) by trying to create your article markup in blog.js using jQuery. You should instead be querying for the XML data in BlogController and populating a property on the scope with the results (in JSON/JS format) as an array. Then you use ng-repeat in your markup to repeat the markup for each item in the array.
However, if you must just "get it working", and with full knowledge that you are doing a hacky thing, and that the people who have to maintain your code may hate you for it, then know the following: AngularJS directives do not work until the markup is compiled (using the $compile service).
Compilation happens automatically for you if you use AngularJS the expected, correct way. For example, when using ng-view, after it loads the HTML for the view, it compiles it.
But since you are going "behind Angular's back" and adding DOM without telling it, it has no idea it needs to compile your new markup.
However, you can tell it to do so in your jQuery code (again, if you must).
First, get a reference to the $compile service from the AngularJS dependency injector, $injector:
var $compile = angular.element(document.body).injector().get('$compile');

Next, get the correct scope for the place in the DOM where you are adding these nodes:
var scope = angular.element('.blog-main').scope();

Finally, call $compile for each item, passing in the item markup and the scope:
var compiledNode = $compile(itm)(scope);

This gives you back a compiled node that you should be able to insert into the DOM correctly:
$('.blog-main').append(compiledNode);

Note: I am not 100% sure you can compile before inserting into the DOM like this.
So your final $.each() in blog.js should be something like:
var $compile = angular.element(document.body).injector().get('$compile'),
    scope = angular.element('.blog-main').scope();
$.each(items, function(idx, itm) {
      var compiledNode = $compile(itm)(scope);
      $('.blog-main').append(compiledNode);
      compiledNode.readmore();
});


text:
Q: Create DateTime(long) in using JodaTime yields incorrect value I'm trying to use JodaTime (2.3) to store values returned from an API call in millis from epoch as a datetime string in SQLite3.
new DateTime(Instant.now).toString() or Instant.now().toDateTime().toString() both work as expected.
I'm having trouble with the DateTime(long) constructor, where I supply the long value.
For example:
new DateTime(1388067172).toString() gives "1970-01-17T..." (note, 17th not 1st so it is offsetting somewhat) whereas I expect it to be "2013-12-26T...".

A: My current unix-time is (was) 1388091226903. I think you have to multiply the value you get with 1000, it seems to be given in seconds since 1st Jan 1970, but you want the time given in milliseconds since 1st of Jan 1970...


text:
Q: How to show data of two firebase collection in table on the base of ids in react js I have these two collections. Now I want display these data in a table on the base of id that is highlighted.
Product Collections:

Category Table:

useEffect(() => {
   var list = [];
   const q = query(collection(db, "products"));
   onSnapshot( q,
        (snapShot) => {
            snapShot.docs.forEach((doc) => {
                list.push({ id: doc.id, ...doc.data() });
              });
              console.log(list);
        },
        (error) => {
            console.log(error);
        }
    );

}, []);

useEffect(() => {
    var list1 = [];
    const q = query(collection(db, "categories"));
   onSnapshot( q,
        (snapShot) => {
            snapShot.docs.forEach((doc) => {
                list1.push({ id: doc.id, ...doc.data() });
              });
            const children = list.concat(list1);
              console.log(children);
        },
        (error) => {
            console.log(error);
        }
    );
}, []);


text:
Q: Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient We have a project that uses WCF 5.0 and the WindowsAzure SDK.
There are two references Microsoft.Data.Services.Client.dll and System.Data.Services.Client.dll and they are in conflict.  If I remove the System DLL (as per this)  I am unable to use the windowsAzure SDK.  If I remove the Microsoft DLL I am unable to take advantage of the new features of WCF specifically OData version 3.0.
After I remove the System DLL reference:

cannot convert from
  'System.Data.Services.Client.SaveChangesOptions [c:\Program Files
  (x86)\Microsoft WCF Data
  Services\5.0\bin.NETFramework\Microsoft.Data.Services.Client.dll]' to
  'System.Data.Services.Client.SaveChangesOptions'

Additional information:

The best overloaded method match for
  'Microsoft.WindowsAzure.StorageClient.TableServiceContext.SaveChangesWithRetries(System.Data.Services.Client.SaveChangesOptions)'
  has some invalid arguments
The type 'System.Data.Services.Client.DataServiceContext' is defined
  in an assembly that is not referenced. You must add a reference to
  assembly 'System.Data.Services.Client, Version=3.5.0.0,
  Culture=neutral, PublicKeyToken=b77a5c561934e089'.

If I remove the reference to Microsoft.Data.Services.Client and add reference to System.Data.Services.Client then we get no errors - we also get no WCF 5.0!

A: I was able to repro this problem fairly quickly. The Microsoft.WindowsAzure.StorageClient.Dll has direct reference dependency on System.Data.Service.Client.Dll as shown below so if you are going to use Azure Storage Client API you would have to reference System.Data.Service.Client.Dll in your application and sure you can not use oData 3.0 supplied by WCF 5.0 SDK. More info is posted in the SO question below:
WCF 5.0 and oData 3.0 API not work with azure table storage

A: You can use extern alias to differentiate between two type names that are identical apart from the assembly in which they are contained.

*

*Set an alias for System.Data.Services.Client - say SystemDataV4
(See MSDN Blogs - Extern Alais Walkthrough)

*At the very top of your .cs file use
extern alias SystemDataV4;
Then you can either have
using SystemDataV4.System.Data.Services.Client;

or
serviceContext.SaveChangesWithRetries(SystemDataV4.System.Data.Services.Client.SaveChangesOptions.ReplaceOnUpdate);

Note the prefix of the namespace with the alias, e.g. SystemDataV4.System.Data.Services...


text:
Q: Can you iterate over object properties in LWC? I know you can use the for:each directive to loop through Arrays, but is there some way to loop through an object's properties?

A: No, you cannot. However, it is pretty easy to do so with a getter:
get objectProperties() {
  return Object.entries(this.recordObject).map(([key,value])=>({ key, value }));
}

...
for:each={objectProperties} for:item="prop"


text:
Q: Height of UIScrollView in UITableview shorter than table height I have a pretty standard UITableView with only 1 section. My problem is that the length of the UIScrollView (That the UITableView inherits) seems to be shorter than the table itself. My table loads and presents the data as it should, seen here:

Yet, when I scroll to the bottom, the scroll bar on the right is displaying an incorrect height for the scroll view. The scroll bar stops scrolling about halfway down the UITableView, where it starts to contract. It is reaching the bottom of the data, but there is unnecessary whitespace at the bottom of the table that I would like to get rid of, as seen here:

The table is pretty standard, for I am using the Subtitle Style table view cell. Therefore, I am not implementing heightForRowAtIndexPath. I am using a custom font, but even when I take it out I get the same results. So I am unsure why this is happening?
This class is very simple. The only methods I am implementing are:
-(void)viewDidLoad
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

EDIT I now realize that after I make a selection and then select back on the navigation bar, the table displays properly as it should. Something that gets called upon hitting back on the navigation bar fixes it and I have no clue as to what it is!

A: Your table view has that whitespace at the bottom because its contentInset.bottom is greater than zero.
The content inset is non-zero because a UITableViewController automatically sets the content inset to the height of the keyboard when the keyboard is showing.  This allows the user to access all of the table view's cells, instead of leaving the bottom cells hidden under the keyboard.  Read about "Moving Content That Is Located Under the Keyboard" in the Text, Web, and Editing Programming Guide for iOS for details.
Since the keyboard is (I assume) going away when you perform the segue to the table view controller, I  consider this behavior a bug in UIKit.  The workaround is, as you have discovered, to make sure that you tell the first responder to resign before performing the segue to the table view controller.

A: Have you tried turning off autoresizesSubviews for you tableview?

A: As pointed out by @robmayoff , the contentInset.bottom had a nonzero value, throwing the scroll view of UITableView off. I am unsure where this was being changed. I checked the value in both viewDidLoad and viewDidAppear. viewDidLoad showed a value of zero, whereas viewDidAppear showed a value of nonzero.
All I did to fix the problem is implement viewDidAppear. The method is completely blank, and the contentInset.bottom is being correctly set. Very strange... but it works.


text:
Q: Codeigniter personal message error Helo. After sending message getting error:
is currently unable to handle this request.
    HTTP ERROR 500
it's ekkator school managment system.
How can i fix it ?

    <?php echo get_phrase('write_new_message'); ?>

<?php echo form_open(base_url() . 'index.php?admin/message/send_new/', array('class' => 'form', 'enctype' => 'multipart/form-data')); ?>

    <?php echo get_phrase('recipient'); ?>:

    <select class="form-control select2" name="reciever" required>

        <option value=""><?php echo get_phrase('select_a_user'); ?></option>
        <optgroup label="<?php echo get_phrase('student'); ?>">
            <?php
            $students = $this->db->get('student')->result_array();
            foreach ($students as $row):
                ?>

                <option value="student-<?php echo $row['student_id']; ?>">
                    - <?php echo $row['name']; ?></option>

            <?php endforeach; ?>
        </optgroup>
        <optgroup label="<?php echo get_phrase('teacher'); ?>">
            <?php
            $teachers = $this->db->get('teacher')->result_array();
            foreach ($teachers as $row):
                ?>

                <option value="teacher-<?php echo $row['teacher_id']; ?>">
                    - <?php echo $row['name']; ?></option>

            <?php endforeach; ?>
        </optgroup>
        <optgroup label="<?php echo get_phrase('parent'); ?>">
            <?php
            $parents = $this->db->get('parent')->result_array();
            foreach ($parents as $row):
                ?>

                <option value="parent-<?php echo $row['parent_id']; ?>">
                    - <?php echo $row['name']; ?></option>

            <?php endforeach; ?>
        </optgroup>
    </select>

    <textarea row="2" class="form-control wysihtml5" data-stylesheet-url="assets/css/wysihtml5-color.css"
        name="message" placeholder="<?php echo get_phrase('write_your_message'); ?>"
        id="sample_wysiwyg" required></textarea>

  <input type="file" class="form-control file2 inline btn btn-info" name="attached_file_on_messaging" accept=".pdf, .doc, .jpg, .jpeg, .png" data-label=" Browse" />

<button type="submit" class="btn btn-success btn-icon pull-right">
    <?php echo get_phrase('send'); ?>

</button>

Error from comment.

Fatal error: Call to undefined method Email_model::notify_email() in /home/mtschool/public_html/sms/application/models/Crud_model.php on line 343 A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home/mtschool/public_html/sms/application/models/Crud_model.php:343) Filename: core/Common.php Line Number: 569 Backtrace: A PHP Error was encountered Severity: Error Message: Call to undefined method Email_model::notify_email() Filename: models/Crud_model.php Line Number: 343 Backtrace:


text:
Q: Contour requires single `z` at each combination of `x` and `y` Warning message:
Computation failed in `stat_contour()`:
Contour requires single `z` at each combination of `x` and `y`.

Why am I having the error in the below codes? I just want to plot a boundary using the logit model..
library("ISLR")
glm1 <- glm(default ~ balance, data=Default, family=binomial())
summary(glm1)

    Default$glm_prob <- predict(glm1, newdata=data.frame(balance=Default$balance), type="response")
    default_plot <- ggplot() + geom_point(data=Default, aes(x=balance, y=default, color=default), size=4) +
      scale_color_manual(values=c("green", "red")) + theme_bw()
default_plot
glm1.contour <- default_plot + stat_contour(
      data=Default, aes(x=balance, y=default, z=glm_prob), breaks=c(0.7))
    glm1.contour

A: Default$balance[which.min(abs(glm1$fitted.values - 0.7))] #decision boundary


text:
Q: Multiple left joins and where clause with multiple values I had lots of tables and had performed multiple join lefts all the tables without incorrect or duplicate results. One of my table is multi-values, can accept duplicate same ids. When I left joins all the tables, the result shows correct, but that particular column show one of the values from  multi-values table.
Currently I'm doing filtering the multi-values table, but the result is unforseen because it only output single one of the value from multi-values table.
Menu Table
id cuisine_id
1  1

CuisineMenu Table (Multi-values / Accept duplicated menu's id)
cuisine_id menu_id
1          1
2          2 (Ignore)
3          1

Query
SELECT * FROM menu
LEFT JOIN (
       SELECT *
       FROM cuisinemenu
       GROUP BY menu_id
) cuisinemenu ON cuisinemenu.menu_id = menu.id
WHERE ( cuisine_id = '3')

Output
Without Where Clause
id cuisine_id
1  1

With Where Clause
Empty

Expected Result (With Where Clause)
id cuisine_id
1  3

A: You can use simple LEFT JOIN, try below:
SELECT m.*
FROM Menu m LEFT JOIN CuisineMenu cm ON m.id = cm.menu.id
WHERE cm.cuisine_id = 3;

This should result in 1 row.

A: Change your sql code from following:
   SELECT *
   FROM cuisinemenu
   GROUP BY menu_id

to this:
   SELECT *
   FROM cuisinemenu
   GROUP BY cuisine_id

the first one shows only menu_id without showing the cuisine_id.


text:
Q: Python and shell command I have next python code:
exec_cmd = "time"
print exec_cmd
gzip_cmd = subprocess.Popen(exec_cmd, shell=True, stdout=subprocess.PIPE)
out = gzip_cmd.communicate()[0]
print out

When I try to execute this code I got next:
time
Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose]
       [--portability] [--format=format] [--output=file] [--version]
       [--quiet] [--help] command [arg...]

But when I try to run this command in terminal I got:
time

real    0m0.000s
user    0m0.000s
sys     0m0.000s

So what is the problem?

A: The "problem" is that time is a Bash built-in, so it's different between Bash and /bin/sh (assuming that's not an alias for Bash--it isn't in Debian/Ubuntu).


text:
Q: Tell Launchpad what DEB_BUILD_OPTIONS to use when building PPA package When I generate and upload source packages to my PPA, what's the best way to pass DEB_BUILD_OPTIONS that Launchpad will use when building binary versions of the package?
In particular, I want to pass in the "nodocs" option so that the documentation isn't built.

A: The PPAs do not have a way to specify an environment variables (including DEB_BUILD_OPTIONS) unfortunately. Until they do, you will need to edit the debian/rules file and set it manually yourself near the top (but not the first line if it uses a "#!"):
DEB_BUILD_OPTIONS=nodocs

Optionally, just find the section of the rules file that looks for "nodocs" and change it to do what you need it to do.

A: Set it in your debian/rules file.


text:
Q: .htaccess 301 redirect, same server I set up a website at mywebsite.net, but recently bought the domain mywebsite.com.
Now I updated the information on Google via Webmaster Tools and it recommended we set up a 301 redirect from the .net to the .com. I have found how to do this by adding code like this to the .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

My problem is, both domains point to the same server, so am I correct in assuming this would try to redirect even if I visited the .com initially? If so, what is the correct way to accomplish this?
It may not matter, but I didn't want to cause any problems with my search rankings.
Thanks in advance!

A: For this use case I'd add a rewrite condition (RewriteCond) to be explicit about which domain you want to impose the rule against. E.g.:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.newdomain.net [NC]
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

This way if the condition isn't met, your redirect won't fire. Also note that these can be chained, so you can assign multiple conditions.
See http://httpd.apache.org/docs/current/mod/mod_rewrite.html#Solutions for more info. Very handy stuff lurking in that page.


text:
Q: how to use setModelValue(); in wicket 6. x or 7.x? In wicket 1.4.9 setModelValue("") was accepting string as a parameter, but in 1.5 it need String Array,
I have code as shown below, anybody knows how to modify setModelValue("") to 6.x or 7.x.
if (!onlineVerfStatus) {
    TextField captcha = class.getValue("captcha");

    captchaDisplayTxt.setModelObject(generateCaptcha());

    captcha.clearInput();
    captcha.setModelValue("");

    return;
}

A: captcha.setModelValue(new String[] {""});


text:
Q: segment fault for a simple std::shared_ptr construction case From cppreference I learn that there is a constructor for std::shared_ptr:
template< class Y > explicit shared_ptr( Y* ptr );

And I tried a piece of code as follows:
#include <string>
#include <memory>
#include <iostream>

int main(void) {
  /// block 1
  {
    std::shared_ptr<std::string> s1(new std::string("good"));
    std::shared_ptr<std::string> s2(s1.get()); /// s2
    std::cerr << s2.use_count() << std::endl;
  }
  /// block 2
  {
    std::shared_ptr<int> i1(new int(1));
    std::shared_ptr<int> i2(i1.get());  ///  i2
    std::cerr << i2.use_count() << std::endl;
  }
  return 0;
}

It causes segment fault for block 1 but not for block 2, but both use_count are 1. The difference I can think about is that that int is a primitive type while std::string is managed by allocator.
I read bits/shared_ptr.h of gcc-4.9 and find that there is a post condition for this constructor:
use_count() == 1 && get() == __p

Question 1:
Should std::shared_ptr NOT constructed with a raw pointer that has been referenced by another smart pointer? In this sense, is the preferred way to use this constructor as follow?
std::shared_ptr<T>(new T(...));

Question 2:
Does the standard has explicit requirement for this constructor, or this post condition is ONLY for libstdc++?

A: Both of these cases are invalid uses of std::shared_ptr.
You cannot pass the same raw pointer to two std::shared_ptr constructors and expect well-defined results.  Both std::shared_ptrs will believe that they own that pointer, and will attempt to delete it when they go out of scope.
This is a double free, and is invalid.
If you want to have two std::shared_ptrs that manage the same object, you can construct one of them with a raw pointer (or, better yet, use std::make_shared), and then copy construct/assign the second one from the first one.  This way the memory will only be deallocated (and the destructor for the object fired) when the last of those std::shared_ptrs goes out of scope.
The reason you're getting a segmentation fault in the first case, and not the second one, is likely because int is a trivial type, and therefore you're not looking through a freed pointer to run the destructor of int, because it doesn't have one.

A: This is undefined behavior, we can see this by going to cppreference section for std::shared_ptr constructors says this (emphasis mine):

Constructing a shared_ptr using the raw pointer overload for an object
  that is already managed by a shared_ptr leads to undefined behavior,
  even if the object is of a type derived from
  std::enable_shared_from_this (in other words, raw pointer overloads
  assume ownership of the pointed-to object).

Both shared_ptr will attempt to delete the object they believe they now hold sole ownership for. We know this is undefined behavior by going to the draft C++ standard section 3.7.4.2 Deallocation functions which says:

If the argument given to a deallocation function in the standard
  library is a pointer that is not the null pointer value (4.10), the
  deallocation function shall deallocate the storage referenced by the
  pointer, rendering invalid all pointers referring to any part of the
  deallocated storage. Indirection through an invalid pointer value and
  passing an invalid pointer value to a deallocation function have
  undefined behavior. [...]

Ownership can only be shared by using copy construction or copy assignment. The same cppreference page provides a correct example using the copy constructor:
 std::cout << "constructor with object\n";
 std::shared_ptr<Foo> sh2(new Foo);
 std::shared_ptr<Foo> sh3(sh2);     // <- using copy construction

An alternative method to creating a shared_ptr is to use std::make_shared, which is safer:

Moreover, code such as f(std::shared_ptr(new int(42)), g()) can
  cause a memory leak if g throws an exception because g() may be called
  after new int(42) and before the constructor of shared_ptr. This
  doesn't occur in f(std::make_shared(42), g()), since two function
  calls are never interleaved.


text:
Q: Spring Boot: How to properly send error logs to Stackdriver on GCP I have this Spring Boot application deployed on a kubernetes cluster on GCP.
Logs are sent to stackdriver and I can't see them on logging section as you can see below:

But they have the wrong severity (INFO) on the platform, that means they don't appear on the error reporting section.
My question is what is needed to be configured to get logs produced by a spring boot application to be read properly by Stackdriver.

A: Could you provide your logging code?
In the meantime, there's a Google-supported Spring Boot Logging integration, and here's a sample of that: https://github.com/spring-cloud/spring-cloud-gcp/blob/master/spring-cloud-gcp-samples/spring-cloud-gcp-logging-sample/src/main/java/com/example/ExampleController.java
This sample uses a org.apache.commons.logging.Log, so you could do Log.error().


text:
Q: flask peewee REST api authentication to limit GET I am using flask-peewee to build a new project. Also I am using the REST interface that is included in flask peewee. I followed the example here http://flask-peewee.readthedocs.org/en/latest/getting-started.html#exposing-content-using-a-rest-api and http://flask-peewee.readthedocs.org/en/latest/rest-api.html#rest-api
 so I ws able to get my rest api up and running including adding the Auth to Rest.
However my problem is I am not able to secure the GET request. I have so far browsed through the source code for rest.py https://github.com/coleifer/flask-peewee/blob/master/flask_peewee/rest.py but not able to find where this is coming from though I did find a lot of good stuff I can use later.
It seems by default the REST API only secure the POST/PUT/DELETE but not GET.
I don't want to make a hack of using flask url secure, I was hoping the flask peewee has some inbuilt method for this. Or if this is a known limitation then what is a good way to handle this
any ideas?

A: Sorry you had trouble finding this information.  You can specify a list of HTTP verbs to require authentication on when instantiating your auth class:
# when instantiating your authentication
api_auth = UserAuth(auth, protected_methods=['GET', 'POST', 'PUT', 'DELETE'])
read_only_auth = UserAuth(auth) # default protected methods are POST/PUT/DELETE

Here is a link to the docs:
http://flask-peewee.readthedocs.org/en/latest/api.html#authenticating-requests-to-the-api