text:
Q: How to get Navigation bar Height in Xamarin Android? how to get top navigation bar Height in Xamarin Android? below is the java code
public static int getSceenHeight(Activity activity) {
   //obsolete now
    return activity.getWindowManager().getDefaultDisplay().getHeight()+getNavigationBarHeight(activity);
}

 public static int getNavigationBarHeight(Activity activity) {
    if (!isNavigationBarShow(activity)){
        return 0;
    }
    Resources resources = activity.getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height",
            "dimen", "android");
    int height = resources.getDimensionPixelSize(resourceId);
    return height;
}

public static boolean isNavigationBarShow(Activity activity){

        Display display = activity.getWindowManager().getDefaultDisplay();
        Point size = new Point();
        Point realSize = new Point();
        display.getSize(size);
        display.getRealSize(realSize);
        return realSize.y!=size.y;

    }
}

how to apply this in Xamarin Android ?

A: Seem like there is this forever ongoing confusion about what is called a NavigationBar when it comes to Xamarin/Xamarin.Form and Android. I really wish that Xamarin would fix this naming so that it is in line with android.
Anyway, Calling ...
int resourceId = resources.GetIdentifier("navigation_bar_height",
            "dimen", "android");

...is going to return the value for the bottom NavigationBar(Android)(the buttons that is part of the OS). From the comments above it seems like you are looking for the Xamarin NavigationBar(The Top one that contains menu Title and so on (Bellow status bar)).
Please try the following
var styledAttributes = Context.Theme.ObtainStyledAttributes(new[] { Android.Resource.Attribute.ActionBarSize });
var actionBarSize = (int)styledAttributes.GetDimension(0, 0);
styledAttributes.Recycle();

Thanks to Fred for his post here

A: I have no idea how you gonna use it, as you said I have converted above you methods to C#
public static int getSceenHeight(Activity activity)
{
    //obsolete now
    return activity.WindowManager.DefaultDisplay.Height + getNavigationBarHeight(activity);
}

public static int getNavigationBarHeight(Activity activity)
{
    if (!isNavigationBarShow(activity))
    {
        return 0;
    }
    Resources resources = activity.Resources;
    int resourceId = resources.GetIdentifier("navigation_bar_height",
            "dimen", "android");
    int height = resources.GetDimensionPixelSize(resourceId);
    return height;
}

public static bool isNavigationBarShow(Activity activity)
{
    if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBeanMr1)
    {
        Display display = activity.WindowManager.DefaultDisplay;
        Point size = new Point();
        Point realSize = new Point();
        display.GetSize(size);
        display.GetRealSize(realSize);
        return realSize.Y != size.Y;
    }
    else
    {
        bool menu = ViewConfiguration.Get(activity).HasPermanentMenuKey;
        bool back = KeyCharacterMap.DeviceHasKey(Keycode.Back);
        if (menu || back)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
}

A: The method to get status bar(top one that displays signal, battery etc as you said)
private int getStatusBarHeight()
{
    Resources res = this.Resources;
    int resourceId = res.GetIdentifier("status_bar_height", "dimen", "android");
    int height = res.GetDimensionPixelSize(resourceId);
    return height;
}

The method to get navigation bar
        private int getNavigationBarHeight()
{
            Resources res = this.Resources;
            int resourceId = res.GetIdentifier("navigation_bar_height", "dimen", "android");
            int height = res.GetDimensionPixelSize(resourceId);
            return height;
}


text:
Q: Running matplotlib in tkinter I have this beautiful sphere I made in matplotlib. How would I go about putting it in a tkinter frame widget? It'd be nice to be able to integrate it into an existing tkinter GUI. Also is it possible to rid of the menu bar below the display? I have no need to save the output or zoom, so it's useless to me.
from mpl_toolkits.mplot3d import  axes3d,Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np

fig = plt.figure()
ax = Axes3D(fig) #<-- Note the difference from your original code..

u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)

x = 10 * np.outer(np.cos(u), np.sin(v))
y = 10 * np.outer(np.sin(u), np.sin(v))
z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))

ax.plot_surface(x, y, z,  rstride=4, cstride=4, color='lightgreen',linewidth=0)
#,antialiased=False
#cmap=cm.jet
plt.show()

A: Have a look at the examples for embedding plots in a tk GUI, it should be enough to get you started in the right direction.
user_interfaces example code: embedding_in_tk.py
user_interfaces example code: embedding_in_tk2.py
As for removing the toolbar, it's a case of not adding it when you are embedding plots in a GUI.

If you are using matplotlib.pyplot the
  toolbar will be created automatically
  for every figure. If you are writing
  your own user interface code, you can
  add the toolbar as a widget.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Create a xml file in rails 4 My xml file is this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
      <key>items</key>
      <array>
          <dict>
              <key>assets</key>
              <array>
                  <dict>
                      <key>kind</key>
                      <string>software-package</string>
                      <key>url</key>
                      <string>http://172.16.147.75:3000/testfile/TestInstall.ipa</string>
                  </dict>
              </array>
              <key>metadata</key>
              <dict>
                  <key>bundle-identifier</key>
                  <string>MainStoryboard_iPad</string>
                  <key>bundle-version</key>
                  <string>1.0</string>
                  <key>kind</key>
                  <string>software</string>
                  <key>title</key>
                  <string>TestInstall</string>
              </dict>
          </dict>
      </array>
  </dict>
</plist>

and i want to generate this file using nokogiri or any other method or gem  please someone help me.

A: Ofcourse you can use the nokogiri builder as recommended byBaldrick
and to generate xml output to the file
you can do:
xml_file = open(filename, 'w')
xml_file.write xml_string
xml_file.close

Or using the block syntax to achieve this in one line:
File.open(local_filename, 'w') { |f| f.write(xml_string) }

A: Try this :
Below link provide you how to generate xml using nokogiri.
http://runnable.com/UjY9hE5ZnwIjAAED/how-to-create-xml-with-nokogiri-for-ruby-on-rails-and-csv


text:
Q: DNS Configuration for Exchange Autodiscover service I need to publish the exchange service to the internet.
I need a basic help with the DNS configuration of my unique registrar service.
On the registrar site:
I configure a DNS "A" Record that reference to my enterprise public IP
exchange.myenterprise.com -> Public Static Ip of my enterprise.
It Works.
Now I've to do the same thing with the "autodiscover" service.
Have I to introduce a new DNS record type A that reference with the same public IP of my enterpise?
autodiscover.myenterprise.com -> Public Static Ip of my enterprise
Is it possible to have a multiple host that reference with the same public IP?
Can this interfere with the other DNS record (exchange.myenterprise.com) that works correctly up to now?
Note: the autodiscover service runs correctly into the enterpise LAN.
Thank you so much for your help.

A: Yes you can have multiple A Records that point to the same Public IP address and internal server. That is quite normal.
The way to look at it is:
Your exchange server runs both the autodiscover & the mail service so you can indeed have both pointing to the same exchange server.


text:
Q: Compare two CSV files using Java with the condition to ignore a particular column in both I need to to compare two CSV files using Java.
I have two CSV files (containing, for example, 10 columns). Among 10, one of the columns contains a Date-Time value. The files are generated at a different time, hence these values will never match. I have to compare these two files ignoring the Date-Time column.
Any help over this would be highly appreciated.

A: If you know the index of the columns that will contain the date time value ahead of time, simply check the index of columns before you compare them to make sure they are not the date time columns.
Otherwise, check the first value of the column, and if it is a date time value, then do not proceed.


text:
Q: Starting ASP.NET Core from Visual Studio doesn't start from build folder When you start an ASP.NET Core project from Visual Studio (2017) it assumes the working directory is where the source code is located, not where the built files are actually placed.
Which means that when I run my project it reads the config file from C:\Path\To\My\Project\appsettings.json, and not from C:\Path\To\My\Project\bin\Debug\appsettings.json.
I can see that this is the case when I debug this code:
WebHost.CreateDefaultBuilder(args)
    .UseStartup<Startup>()
    .ConfigureAppConfiguration((context, config) => {
        config.SetBasePath(context.HostingEnvironment.ContentRootPath);
        config.AddJsonFile("appsettings.json", true, false);
    });

Where ContentRootPath points to the project folder, not where the built files are placed.
I could probably fix this by setting the Working Directory in Project Properties > Debug, but seeing as we're also using configuration transforms (SlowCheetah), each developer will have their own build configuration for debug output (bin\Debug[CustomConfiguration]), and changing .csproj for one developer breaks it for all the other developers.
Is there any way of having ASP.NET Core read the config files from where the built files are placed instead of the project folder, without having to change the Working Directory, yet still working for multiple "Build Configurations"?

A: If I understand the problem correctly, every developer has a different output folder with respect to their username. So, if you make up something like this,
        var debug = string.Empty;
        #if DEBUG
            debug = "Debug";
        #else
            debug = "Release";
        #endif

        var userNameVariable = System.Environment.GetEnvironmentVariable("USER");
        debug += $"[{userNameVariable}]";

        var path = System.IO.Path.Combine(env.ContentRootPath, "bin", debug);
        var builder = new ConfigurationBuilder()
            .SetBasePath(path) //env.ContentRootPath
            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
            .AddEnvironmentVariables();

I have tested this on Mac OS and result is
/Users/johndoe/Documents/Temp/contentasp/bin/Debug[johndoe]

Other solution.
In visual studio you have pre-build and post-build scripts. In Visual Studio you can get the OutputFolder and set the path into a environment variable on pre-build script. For example:
powershell.exe -ExecutionPolicy Bypass -File "$(ProjectDir)outputscript.ps1" -OutputFolder $(OutputPath)
And in the powershell script (outputscript.ps1)
Param(
    [Parameter(Mandatory = $true, Position = 1)]
        [string]$OutputFolder
)

$env:OutputFolder = $OutputFolder

And you can get the value on the startup with
var outputFolder = System.Environment.GetEnvironmentVariable("OutputFolder");
var builder = new ConfigurationBuilder()
    .SetBasePath(outputFolder) //env.ContentRootPath

A: Maybe this will help is set to directory as application working directory by:
Directory.SetCurrentDirectory(context.HostingEnvironment.ContentRootPath);

A: Config files are read from the place that you configure via SetBasePath. What happens in Development mode is that when you use WebHost.CreateDefaultBuilder it sets BasePath to source code folder which is logical for most developer cases.
It actually does not work out of the box for Console applications e.g., so I specifically do the same in there.
There are probably few ways you can fix this:

*

*Using the existing system as it is quite convenient by default. Perhaps you can explain in more details why does it not work for you?

*Not using CreateDefaultBuilder and creating the builder yourself, then you'll be able to configure it exactly as you want.

*Override SetBasePath with the value you want afterwards. I assume that e.g. AppContext.BaseDirectory or Directory.GetCurrentDirectory() will return the path that you are looking for

*Not using name "Development" for your environment will probably do the trick as well, though you will have some other consequences that you need to consider.
P.S. Why would you use slowcheetah at all to do the old styled transformation when you can use agile config? You can read config from multiple files and the last one in order always win, so it will be the same effect as from using slowcheetah in practice.


text:
Q: How to estimate the Graphite(whisper) database size when I'm using it in monitoring Apache Spark I'm gonna set up monitoring Spark application via $SPARK_HOME/conf/metrics.propetries.
And decided to use Graphite.
Is there any way to estimate the database size of Graphite especially for monitoring Spark application?

A: Regardless of what you are monitoring, Graphite has its own configuration about retention and rollup of metrics. It stores file (called whisper) per metric and you can use the calculator to estimate how much disk space it can take https://m30m.github.io/whisper-calculator/


text:
Q: Rails 4 set config.time_zone through form In my app, I've created a /configure view that allows admin users to adjust some of the features and records.
One of the things I'd like them to able to customize is the config.time_zone setting through a select field.
I've been trying to use the time_zone_select tag, but with no success.
Is it even possible to change the config.time_zone variable stored in the application.rb file through a view / form?

A: I would think changes to config.time_zone would require a restart of the rails process, however you can save the configured setting in the database and then change Time.zone for each request in a before or around filter of the application_controller
you might find this blog post helpful: http://jessehouse.com/blog/2013/11/15/working-with-timezones-and-ruby-on-rails/


text:
Q: Is there a way to create a like button inside iOS app for Facebook page? Is there a way to create a like button inside a native iOS app for Facebook page?

A: You can follow this tutorial here: http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app
It shows you everything you need to do to set up Like box with your iOS app.

A: See the url:https://developers.facebook.com/docs/ios/like-button
This is the easiest way to show the like button in ios app but it still beta feature.
Here is the code:
[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];
FBLikeControl *like = [[FBLikeControl alloc] init];
like.objectID = @"http://shareitexampleapp.parseapp.com/photo1/";
like.likeControlHorizontalAlignment=FBLikeControlHorizontalAlignmentRight;
like.likeControlStyle=FBLikeControlStyleBoxCount;
[self.view addSubview like];

A: This is no longer possible since 2017... could be possible another way.
reference: https://marketingland.com/facebook-will-disable-like-button-third-party-mobile-apps-228159


text:
Q: Install header file of R package I am working on an R package with the following directory structure at the root:
CMakeLists.txt
configure
configure.win
NAMESPACE
DESCRIPTION
README
src
cmake
examples
man
R

I build and install like so :
R CMD build .
R CMD INSTALL mypackage*.tar.gz -l /home/myname/Rlibs/

This installs the .so file into my installation directory, but I'd also like to install some of the header files of the package in my installation area. The header files are in the 'src' folder with the .h extension. I can't find a way to do that. Can someone help? BTW As you might see from the directory listing I'm using cmake.
Edit :
The configure file in the root directory looks like this :
#!/bin/bash -e

set -x

unset CXX
unset CC

which cmake
cmake --version
cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="`pwd`/_install" -DCMAKE_SHARED_LIBRARY_PREFIX_CXX=""
cmake --build _builds --config Release --target install

mv _install/lib/mypackage.so src/mypackage.so || echo -n ""

The CMakeLists.txt in the root directory :
cmake_minimum_required(VERSION 2.8)
project(mypackage)

if(NOT MSVC)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

if(MSVC AND MYPACKAGE_DISABLE_AUTOLINK)
  add_definitions(-DBOOST_ALL_NO_LIB=1)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

add_subdirectory(src)

And the CMakeLists.txt in the src directory :
include(GenerateExportHeader)

include_directories("${CMAKE_CURRENT_BINARY_DIR}")

find_package(GSL REQUIRED)
find_package(Boost REQUIRED filesystem system regex log thread date_time chrono)
find_package(GDAL REQUIRED)

if(NOT WIN32)
  add_definitions(-DBOOST_ALL_DYN_LINK=1)
endif()

add_library(
    mypackage
    SHARED
    SomeAlgo.cpp
    SomeAlgo.h
    MyParam.h
    SomeList.cpp
    SomeList.h
)
generate_export_header(mypackage)

target_include_directories(mypackage PUBLIC "${R_INCLUDE_DIR}")
target_link_libraries(mypackage "${R_LIBRARIES}")

install(TARGETS mypackage DESTINATION lib)
install(FILES SomeList.h DESTINATION include) # <-- I added this

Edit 2
I get this output from R CMD INSTALL
* installing *source* package 'mypackage' ...
+ unset CXX
+ unset CC
+ which cmake
/usr/bin/cmake
+ cmake --version
cmake version 3.0.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
++ pwd
+ cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/RtmpSaU3wb/R.INSTALL761c2555d904/mypackage/_install -DCMAKE_SHARED_LIBRARY_PREFIX_CXX=
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
.....
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/RtmpSaU3wb/R.INSTALL761c2555d904/mypackage/_builds
+ cmake --build _builds --config Release --target install
Scanning dependencies of target mypackage_fpredict
[  3%] Building CXX object src/mypackage/CMakeFiles/mypackage_fpredict.dir/__/OpusReader.cpp.o
....
[100%] Building CXX object src/CMakeFiles/mypackage.dir/mypackage/RBackend.cpp.o
Linking CXX shared library mypackage.so
[100%] Built target mypackage
Install the project...
-- Install configuration: "Release"
-- Installing: /tmp/RtmpSaU3wb/R.INSTALL761c2555d904/mypackage/_install/lib/mypackage.so
-- Removed runtime path from "/tmp/RtmpSaU3wb/R.INSTALL761c2555d904/mypackage/_install/lib/mypackage.so"
+ mv _install/lib/mypackage.so src/mypackage.so
+ echo -n ''
** libs
** arch -
make: Nothing to be done for 'all'.
installing to /home/myname/Rlibs/mypackage/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (mypackage)

Only the .so file ends up in /home/myname/Rlibs/mypackage/libs/, there's no include directory or header file. However I see the include directory in the temporary build directory (added a ls to the configure to see it). So basically the problem is to move the include directory from the temporary build directory to my Rlibs area

A: Okay, so R CMD INSTALL checks if there is a directory called "inst" and installs files or directories in that directory into the library installation path. In the R package I'm working on this "inst" package doesn't exist so I create it on the fly when compiling with cmake under the temporary build directory, so I modified the configure file :
#!/bin/bash -e

set -x

unset CXX
unset CC

which cmake
cmake --version
cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="`pwd`/_install" -DCMAKE_SHARED_LIBRARY_PREFIX_CXX=""
cmake --build _builds --config Release --target install

## Added two lines below ##
mkdir inst
mv  _install/include inst

mv _install/lib/mypackage.so src/mypackage.so || echo -n ""

and finally I get /home/myname/Rlibs/mypackage/include/SomeList.h


text:
Q: ggplot geom_point position_jitterdodge not working when color specified? I have plotted a boxplot+points. I want to add colors to the points. The position_jitterdodge worked fine without color as shown in Figure B, the points are close, which is I intended to do. But when I try to add colors to the points, the jitter.width parameter doesn't work any more (Figure A). The points are too far apart. I tried different numbers for jitter.width, not working. How do I solve this problem?
library(tidyverse)
library(ggpubr)
mtcars$cyl <- factor(mtcars$cyl)

p1 <- mtcars %>% ggplot(aes(x = cyl, y = mpg, fill = cyl)) +
  geom_boxplot() +
  geom_point(position = position_jitterdodge(jitter.width = 0.2),
             aes(color = factor(wt)), show.legend = FALSE)

p2 <- mtcars %>% ggplot(aes(x = cyl, y = mpg, fill = cyl)) +
  geom_boxplot() +
  geom_point(position = position_jitterdodge(jitter.width = 0.2))

ggarrange(p1, p2, labels = c("A", "B"))

A: In p1, the points are not only jittered, they are also dodged by factor(wt). If you only want jitter, set dodge.width = 0 in position_jitterdodge.

A: It looks like the problem is that the points have a discrete color aesthetic, but no group aesthetic. If you want to keep coloring by a discrete variable, add group = cyl to the aesthetics for the geom_point layer. If you're plotting with another dataset, the grouping variable would be the same variable you plot along the x axis.
One catch: you have to increase the jitter.width when you apply grouping for it to be visible. I had to dial it up from 0.2 to 3 here.
Another option would be to color by a continuous variable.
library(tidyverse)
library(ggpubr)

mtcars$cyl=factor(mtcars$cyl)

p3=mtcars %>% ggplot(aes(x=cyl, y=mpg, fill=cyl))+
  geom_boxplot()+
  geom_point(aes(color = factor(wt), group = cyl),
         position=position_jitterdodge(jitter.width=0.2),
         show.legend = F)

p4=mtcars %>% ggplot(aes(x=cyl, y=mpg, fill=cyl))+
  geom_boxplot()+
  geom_point(aes(color = wt),
         position=position_jitterdodge(jitter.width=0.2),
         show.legend = F)

ggarrange(p3, p4)

This will render inline eventually, but for now a link: color_and_jitter


text:
Q: how to send email from localhost "wamp" by php? I try to send email from wampserver "localhost" by this php code
<?php

$to      = 'test1@gmail.com';
$subject = 'Fake sendmail test';
$message = 'If we can read this, it means that our fake Sendmail setup works!';
$headers = 'From: test2@gmail.com' . "\r\n" .
'Reply-To: eng.jirjawi@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

if(mail($to, $subject, $message, $headers)) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}

?>

I used the file "sendmail" and put it inside the file "C:\wamp\sendmail" i changed setting sendmail.ini file to -->
smtp_server=smtp.gmail.com

smtp_port=465

smtp_ssl=ssl

default_domain=localhost

error_logfile=error.log

auth_username=test2@gmail.com
auth_password=xxxxxxx

pop3_server=
pop3_username=
pop3_password=

force_sender=

force_recipient=

hostname=localhost

i changed setting php.ini file in C:\wamp\bin\apache\apache2.2.22\bin
and
i changed setting php.ini file in C:\wamp\bin\php\php5.4.3
to
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP =
; http://php.net/smtp-port
;smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you@yourdomain

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

and i changed setting appach module "SSL module" checked
and i changed setting php extension "php openssl" & "php sockets"
And it did not work with the code did not send email
Discussed a lot in the internet and tried many ways
Why does not happen transmitter and what the correct way
Apologized for the mistakes my English language
Please help and thank you

A: PHPMailer has always worked for me on development servers (localhost), as well as on live websites.
Download PHPMailer here, unzip it and put it in your application's directory.
When you want to send a mail, use the following code :
require 'PHPMailerAutoload.php'; //Your path to PHPMailer's directory
$Mail = new PHPMailer();
$Mail->IsSMTP(); // Use SMTP
$Mail->Host        = "smtp.gmail.com"; // Sets SMTP server for gmail
$Mail->SMTPDebug   = 0; // 2 to enable SMTP debug information
$Mail->SMTPAuth    = TRUE; // enable SMTP authentication
$Mail->SMTPSecure  = "tls"; //Secure conection
$Mail->Port        = 587; // set the SMTP port to gmail's port
$Mail->Username    = 'yourusername@gmail.com'; // gmail account username
$Mail->Password    = 'yourpassword'; // gmail account password
$Mail->Priority    = 1; // Highest priority - Email priority (1 = High, 3 = Normal, 5 =   low)
$Mail->CharSet     = 'UTF-8';
$Mail->Encoding    = '8bit';
$Mail->Subject     = 'Mail test';
$Mail->ContentType = 'text/html; charset=utf-8\r\n';
$Mail->From        = 'test2@gmail.com'; //Your email adress (Gmail overwrites it anyway)
$Mail->FromName    = 'Test';
$Mail->WordWrap    = 900; // RFC 2822 Compliant for Max 998 characters per line

$Mail->addAddress('test1@gmail.com'); // To: test1@gmail.com
$Mail->isHTML( TRUE );
$Mail->Body    = 'This is a test mail';
$Mail->AltBody = 'This is a test mail';
$Mail->Send();
$Mail->SmtpClose();

if(!$Mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $Mail->ErrorInfo;
exit;
}

echo 'Message has been sent';

Update : You should update your PHP installation for this to work correctly.
For the error you're getting, try this :
In your php.ini search for line
; extension=php_openssl.dll

and remove ; so it becomes:
extension=php_openssl.dll

A: salem alaykùm (hey)
check this it works for me,
<?php

if ($_SERVER["REQUEST_METHOD"] == 'POST'){
    //print_r($_POST);
    if (mail('name@example.com', 'New Test Email', htmlspecialchars($_POST['msg']))){
        $cas = "thanks for the msg";
    }

 }

?>

<!doctype html>

 <title>my test company</title>

Contactez nous

<form action="" method="post">

            Name:
            <input type="text" name="name" id="name">

            Email :
            <input type="text" name="email" id="email">

            Message:

            <textarea name="msg" id="msg"></textarea>

            <input type="submit" value="Go!">

</form>
<?php
if (isset($cas)) echo $cas;
?>


text:
Q: What would the electromagnetic field of a massless electron look like The Standard Model gives non-zero mass to the electron via the coupling to the Higgs field. Issues of renormalizability aside, this is fundamentally unrelated to the fact that the electron couples to the EM field. However, if the Higgs mechanism did not operate - that is, if there were no vacuum symmetry breaking, the electron field would have no effective mass term. In QFT perturbation theory, this model offers no special difficulty.
My question is, what is the classical limit of this theory, if it has one? Does the electron acquire a purely EM mass? If the low energy renormalized mass is set to zero (is there an obstacle to doing that?) what do the classical field configurations look like? My puzzlement is related to the classical description of the EM field of a relativistic charged particle - namely, that it becomes "flattened" in the direction of motion, just like a Lorentz-contracted sphere. That is, the field is weaker than for a motionless particle in the longitudinal direction, and stronger in the transverse directions. The limiting case is that the field becomes concentrated on a 2-d surface transverse to the particle location, where it has infinite strength - obviously an unphysical situation. So what actually happens?

A: This has some bearing on the question in your title
http://arXiv.org/abs/hep-th/9112020
There is an analogous problem in general relativity, the gravitational field generated by a massless particle is called the Aichelburg - Sexl metric.
Couple more comments:
Perturbation theory in the presence of massless charged fields is not unproblematic, there are infrared divergences one has to deal with. These are much more problematic than soft photon divergences. I think Weinberg's field theory book has a discussion of this.
Massless electrons would have an extra chiral symmetry, which should forbid the appearance of mass term.
But, I don't think these quantum field theory issues are directly related to your question, which is essentially one in classical electrodynamics.

A: With a massless charged fermion, the electromagnetic coupling strength will be totally screened, with $1/e^2$ increasing logarithmically with the scale $R$. The electric field will be Coulomb multiplied by this logarithmic factor in $R$.
Actually, the massless charged fermion will be travelling at the speed of light, but this logarithmic screening will still happen.


text:
Q: widgets for Category choice in Django I just want add a class 'form control' in category choices
class BlogForm(forms.ModelForm):
    # blog_title= forms.TextInput(label='Title',widget=forms.TextInput(attrs={'class':'form-control'}))
    # blog_content= forms.Textarea(label='Blog Content',widget=forms.Textarea(attrs={'class':'form-control'}))
    # blog_image= forms.ImageField(label='Blog Thambnail',widget=forms.ClearableFileInput(attrs={'class':'form-control'}))

    class Meta:
        model=Blog
        fields=['blog_title','category','blog_content','blog_image']
        widgets={
            'blog_title':forms.TextInput(attrs={'class':'form-control'}),
            'blog_content':forms.Textarea(attrs={'class':'form-control'}),
            'category':forms.?
            'blog_image':forms.ClearableFileInput(attrs={'class':'form-control'}),
        }

is there any specific input field for that?i have given a question mark there.


text:
Q: Get count of rows after a unique date for each row I have a 1:1 table (we will call this table 1) which looks like this:
| id | date                |
|----|---------------------|
| 1  | 2011-01-02 00:00:00 |
| 2  | 2012-01-02 00:00:00 |

I have a second many:1 table (we will call this table 2) which looks like this:
| id | date                |
|----|---------------------|
| 1  | 2011-01-01 00:00:00 |
| 1  | 2011-01-02 00:00:00 |
| 1  | 2011-01-03 00:00:00 |
| 2  | 2011-12-31 00:00:00 |
| 2  | 2012-01-01 00:00:00 |
| 2  | 2012-01-03 00:00:00 |

I would like to left join table 1 and table 2 (table 1 is the left table) on id, but I only want the count of dates from table 2 that are greater than or equal to the date column in table 1.
Thus, the resultant table would look like this:
| id | date                | count_dates |
|----|---------------------|-------------|
| 1  | 2011-01-02 00:00:00 | 2           |
| 2  | 2012-01-02 00:00:00 | 1           |

How can I do this using SQL Server?

A: Don't bother with a left join, just use a sub-query with the appropriate where clause e.g.
select id, [date]
  , (select count(*) from dbo.Table2 T2 where T2.id = T1.id and T2.[date] >= T1.[date])
from dbo.Table1 T1;


text:
Q: How to change color in Python? from tkinter import *

def move():
    global x1, y1, dx, dy, flag, n

    x1, y1 = x1 + dx, y1 + dy

    if x1 > 360:
        n = 0
        x1, dx, dy = 360, 0, 15

    if y1 > 360:
        n = 1
        y1, dx, dy = 360, -15, 0

    if x1 < 10:
        x1, dx, dy = 10, 0, -15
        n = 2

    if y1 < 10:
        y1, dx, dy = 10, 15, 0
        n = 3

    can1.coords(oval1, x1, y1, x1 + 30, y1 + 30)

    if flag > 0:
        abl1.after(50, move)

def stop():
    global flag
    flag = 0

def start():
    global flag
    if flag == 0:
        flag = 1
        move()

###

x1, y1 = 10, 10
dx, dy = 15, 0
color = [["white"], ["red"], ["green"], ["blue"]]
n = 0

flag = 0

###

abl1 = Tk()
abl1.title("Animációs gyakorlat Tkinter-rel")

can1 = Canvas(abl1, bg = "dark grey", height = 400, width = 400)
can1.pack(side=LEFT)

oval1 = can1.create_oval(x1, y1, x1 + 30, y1 + 30, fill = color[n])

but1 = Button(abl1, text = "Quit", command = abl1.destroy).pack(side=BOTTOM)
but2 = Button(abl1, text = "Start", command = start).pack()
but3 = Button(abl1, text = "Stop", command = stop).pack()

abl1.mainloop()

When the ball reaches the edge of the square, it has to change color. Now with this list of colors and with ifs it doesn't do anything and I don't know what's wrong. I tried a lot of different variants but did not work either.
Thank you for your help.

A: Inside of your x1 > 360 check in move(), n == 1 should be n = 1.
I assume n is the variable you're using as your list index. If so, you need to add the following line before your flag > 0 check at the bottom of move():
can1.itemconfig(oval1, fill=color[n])

That should change the colours like you wanted.
Copy-paste of my version of your move():
def move():
    global x1, y1, dx, dy, flag, n

    x1, y1 = x1 + dx, y1 + dy

    if x1 > 360:
        n = 1
        x1, dx, dy = 360, 0, 15

    if y1 > 360:
        n += 2
        y1, dx, dy = 360, -15, 0

    if x1 < 10:
        x1, dx, dy = 10, 0, -15
        n = 2

    if y1 < 10:
        y1, dx, dy = 10, 15, 0
        n = 3

    can1.coords(oval1, x1, y1, x1 + 30, y1 + 30)

    can1.itemconfig(oval1, fill=color[n])

    if flag > 0:
        abl1.after(50, move)

Edit: Jaredp37's answer would definitely be more efficient than mine, since mine tries to change the colour every time the function gets called.

A: In your move function you have to set the itemconfig() fill parameter on each iteration.  The call to can1.create_oval() returns an ID for the oval which you can pass into the itemconfig() method as the first argument.  You can then set the fill from there as in the code below.  This is not the most efficient way to code this though.  With all your globals it may be best to make this script into a class.
def move():
    global x1, y1, dx, dy, flag, n

    x1, y1 = x1 + dx, y1 + dy

    if x1 > 360:
        n = 1
        x1, dx, dy = 360, 0, 15
        can1.itemconfig(1, fill=color[n])

    if y1 > 360:
        n = n + 2
        y1, dx, dy = 360, -15, 0
        can1.itemconfig(1, fill=color[n])

    if x1 < 10:
        n = 2
        x1, dx, dy = 10, 0, -15
        can1.itemconfig(1, fill=color[n])

    if y1 < 10:
        n = 3
        y1, dx, dy = 10, 15, 0
        can1.itemconfig(1, fill=color[n])

    can1.coords(oval1, x1, y1, x1 + 30, y1 + 30)

    if flag > 0:
        abl1.after(50, move)


text:
Q: How many non-homeomorphic separable metrizable topological spaces are there? I am working in ZFC.
By the theorem of Urysohn, any separable metrizable topological space can be embedded as a subset of $I^\infty$, the Hilbert cube.
Therefore we get an upper bound on the number of non-homeomorphic separable metrizable topological spaces, there is at most $2^{\mathfrak{c}}$ of them.
Question: How many different separable metrizable topological spaces are there?
Note that separability is equivalent to second-countability in a metric space, so that we can ask the more general:
Question$^*$: How many different metrizable topological spaces of weight $\leq \aleph$ are there?
Weight, as usual, is the least cardinality of all of bases.

A: Let $\mathscr{X}=\{X\subseteq\Bbb R:\Bbb Q\subseteq X\}$; clearly $|\mathscr{X}|=2^{2^\omega}$ (or $2^{\mathfrak{c}}$, if you prefer). Let $X\in\mathscr{X}$; $\Bbb Q$ is dense in $X$, so any embedding $e$ of $X$ into $\Bbb R$ is completely determined by $e\upharpoonright\Bbb Q$. There are only $\left(2^\omega\right)^\omega=2^\omega$ functions from $\Bbb Q$ into $\Bbb R$, so there are at most $2^\omega$ members of $\mathscr{X}$ homeomorphic to $X$. Thus, $\mathscr{X}$ must have $2^{2^\omega}$ homeomorphism classes, and $\Bbb R$ must have $2^{2^\omega}$ pairwise non-homeomorphic subspaces, all of which are clearly separable and metrizable.
On the other hand, if a space $X$ is separable and metrizable, it's homeomorphic to a subspace of the Hilbert cube $H$. $|H|=2^\omega$, so $H$ has $2^{2^\omega}$ subsets, and there are therefore exactly $2^{2^\omega}$ pairwise non-homeomorphic separable, metrizable spaces.


text:
Q: control the execution of events in JavaScript I'm using "onkeydown" event to implement an OTP verification layout , so when I try to delete the event first focuses on the previous element before deleting the current element , how di I get the event to execute the default action first the move along
inputField[index].onkeydown = function (e) {
  if (e.keyCode == "8") {
    array[index].blur();
    array[index - 1].focus();
  }
}


text:
Q: Choosing new teammates My sister gave me a combinatorical riddle. It doesn't appear to be hard, but I ask you if my thoughts are right, just for certainty. Here it is.

Assume you belong to a group of $100$ people, and you are in a team of $10$ people, being a subset of those $100$ people. Assume that you break up, and you randomly choose people among the the $99$ persons to make a new team of $10$ persons. How big is the chance that you end up with a team without any old team mates?

I thought the chance would be
$$
\frac{90}{99} \cdot \frac{89}{98} \cdot \frac{88}{97} \cdots\frac{82}{91}
$$
Since you have to pick out $9$ persons, and every time you pick someone from A, the chance that the person is "new" is
$$
\frac{|A| \ - \ |\{\text{old team mates in } A\}|}{|A|}
$$
Multiplying the chances gives my guess. Do you think this is right?

A: Your result is correct numerically, but the argument leading to it is incomprehensible due to the fact that you don't explain what $A$ is (it seems to be changing during the selection process).
I'm assuming that you will be on the new team as a member; and the other members will be selected randomly from the population. For a success $9$ individuals out of the $99$ remaining are definitively forbidden.  There are ${99\choose 9}$ equally probable ways to choose $9$ people from $99$, and ${90\choose 9}$ of these are allowed. Therefore the probability $p$ you are asking for is given by
$$p={{90\choose 9}\over{99\choose 9}}={90\cdot89\cdot\ldots\cdot82\over 99\cdot98\cdot\ldots\cdot 91}\doteq0.408\ .$$

A: It seems to me you have the right idea. I will give a full discussion
for the your benefit and anticipating other students of combinatorics
may read this later.
This problem can be done using either ordered or unordered sample points.
If ordered, then both numerator and denominator of the probability fraction
must count ordered outcomes. If unordered, both numerator and denominator must count unordered ones. To begin, remove yourself from consideration because you are
already chosen. As you say, that leaves 99 people from which you might
choose 9 in random sampling, but only 90 of which are eligible to be
chosen if you are to get an entirely fresh team (other than yourself).
Ordered: Your answer is P(90, 9)/P(99, 9) =  0.4080 t0 four places,
where P(n, r) denotes the permutations of n things taken r at a time.
Unordered: An equivalent method is C(90, 9)/C(99, 9) = 0.4080,
where C(n, r) denotes a combination (or binomial coefficient).
Hypergeometric: You have an urn with 99 balls of which 90 are red (fresh
teammates) and 9 are black (former teammates). You withdraw 9 balls from
the urn without replacement, and X is the number of red balls drawn.
You seek $P\{X = 9\} = C(90,0)C(9,0)/C(99,9) = 0.4080.$ This is
obtained by plugging into the standard formula for a hypergeometric
PDF (or PMF). Note that C(9,0) = 1,
Simulation: The brief R program below simulates 100,000 performances
of your experiment. One run gave the approximate value 0.40758, where
the simulation error might be as much as
three digits in the third decimal place. (I always try to check my
combinatorial work, done before coffee on weekends. with a simulation.)

grp = c(rep(0, 9), rep(1, 90));  m = 10^5;  new = numeric(1)
for (i in 1:m) { new[i]=sum(sample(grp,9)) }
mean(new==9)

A: Suppose you are not allowed to choose any of your old-teammates. The number of ways to form your team now would be the number of ways to choose $9$ people from $90$ people, which is given by $90 \choose 9$.
Without any restrictions the number of ways to do so is $99 \choose 9$.
Therefore the prob that you don't have any of your team-mates  = $\dfrac{90 \choose 9}{99 \choose 9}$.
This is the same as the expression you have got.


text:
Q: Guava cache asynchronous reload I have followed guava cache documentation and coded asynchronous cache reloading in my application. Additionally, during application start, I am loading the cache using cache.put. I am reloading it every 15 mins afterwards (provided there is an incoming request at/after 15 mins).  While debugging, I found that reload is called correctly and my application is not waiting for the updated graph from DB.
My Question is: Do I need to continue to override load method in my application? As described above, the initial loading of cache is done on application startup.
Below is my paraphrased code (about same as in documentation):
private LoadingCache<String, Graph> cache = CacheBuilder.newBuilder()
        .refreshAfterWrite(2, TimeUnit.MINUTES)
        .recordStats()
        .build(new CacheLoader<String, Graph>() {
            @Override
            public Graph load(String key) {
                return getGraphFromDB(key);
            }

            public ListenableFuture<Graph> reload(final String key, Graph prev) {
                ListenableFutureTask<Graph> task = ListenableFutureTask.create(new Callable<Graph>() {
                    public Graph call() {
                        Graph graph = prev;
                        try {
                            graph = getGraphFromDB(key);
                        } catch (Exception e) {
                            logger.error("There was an exception when reloading the cache",e);
                        }
                        finally {
                            return graph;
                        }
                    }
                });
               executor.execute(task);
                return task;
            }
        });

A: I think its a good idea to use asyncReloading. In example we reload cache, containing PublicKeys every 1 minute. Also for debuging we use RemovalListener.
@Value("${security.jwks-cache-refresh-milliseconds:60000}") // 1 min
private Integer jwksCacheRefreshMilliseconds;

private Cache<String, PublicKey> jwksCache;

@PostConstruct
private void init() {
    TimeUnit timeUnit = TimeUnit.MILLISECONDS;

    RemovalListener<String, PublicKey> removalListener = n -> {
        if (n.wasEvicted() && log.isDebugEnabled()) {
            log.debug("jwksCache remove key : {}, reason : {}", n.getKey(), n.getCause().name());
        }
    };

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5);

    jwksCache = CacheBuilder.newBuilder()
            .refreshAfterWrite(Long.valueOf(jwksCacheRefreshMilliseconds), timeUnit)
            .removalListener(removalListener)
            .build(CacheLoader.asyncReloading(new CacheLoader<String, PublicKey>() {
                @Override
                public PublicKey load(String kid) throws Exception { // code to refresh key from jwks
                }
            }, scheduler));
}


text:
Q: If conditional execution I have come across a situation I have not encountered before using the IF control structure, with a further nested IF. Normally the nested IF would break down what I am checking in more fine grained detail, but in this instance it actually conflicts with the outer conditional - I am checking for a mouse click.
Here is the code -
if (mouseState.LeftButton == ButtonState.Pressed)
{
     if (mouseState.LeftButton == ButtonState.Released)
     {
          //move sprite to clicked position
          spritePos.X = mouseState.X;
          spritePos.Y = mouseState.Y;
     }
}

I have a couple of questions. I was taught that the conditional argument is only checked once, if it evaluates as true then the following statements are executed. Is this true, or is it actually checked before executing every statement within the block? - as the latter would obviously cause conflict with my nested if.
If this is true, then why does my button click method not work? The sprite never moves as though the mouse release never executes. Is it because the delay between performing a check on both conditionals is so small, that I can not physically have released the button within that time? Can I be slightly hackish about this and overcome it with a time delay which might be large enough to allow the release of the mouse button by the time of checking the nested conditional?
Methods for mouse click actions that I have seen, use properties of the mouse from the previous frame, and compare to the new frame to check for a mouse click. But this method must introduce a delay of at least one frame to actually process the action. This might not be noticeable with high framerates, but just for arguments sake say I had a game rendering 20fps. UpdateInput() would be called before rendering any frame, positions should update and then the frame should render last.
If the full mouse click operation could operate within less than 1/20th of a second, wouldn't it be preferrable to process the action at once rather than store a variable upon the initial press, and compare states in the next frame? This would surely be better than introducing further delay on input.
I'm sure this must have been considered by others before though, and perhaps I'm not thinking correctly about the time delay operation actually pausing execution of the code. Can time delays pause processor execution of code, or only the result of those executions such as rendering and accepting input? They are not something which I have any experience in using, and I may be confusing how a delay would work.
Thank you,
Andrew.

A: Oh there is so much wrong here...
What you are presumably doing before your block of if statements is:
MouseState mouseState = Mouse.GetState();

Now the GetState function is what actually determines the current state of the mouse and packs it into a MouseState structure. With the = you're assigning that state into the mouseState variable.
The only time that mouseState will change is when you change it yourself! So your conditional that looks like this:
if (mouseState.LeftButton == ButtonState.Pressed) {
    if (mouseState.LeftButton == ButtonState.Released) { /* "do stuff" */ }
}

You're checking if mouseState.LeftButton, which isn't changing, is equal to two completely different things! So obviously "do stuff" will never run.
Now the other part of the problem I can illustrate by making the code work the way you seem to think it should work:
if (Mouse.GetState().LeftButton == ButtonState.Pressed) {
    // Some kind of delay, perhaps?
    if (Mouse.GetState().LeftButton == ButtonState.Released) { /* "do stuff" */ }
}

So the state is updated each time you check it.
Now here's the problem with this code. Your mouse must make the transition from the "Pressed" state to the "Released" state between the two if statements. If it does not, the condition will not trigger.
Increasing the length of the delay will not fix it for many reasons: First of all it is taking time away from actually running your game. Second of all it is impossible to increase it to 100% of the frame's time - so there will always be a percentage chance that your condition will not trigger.
Therefore the better way to handle input is to track the state state between frames. And the best way to do this is, just like all the tutorials demonstrate, to store a MouseState lastMouseState; between calls to your Update function. So your code should look something like this:
MouseState mouseState = Mouse.GetState();
if (lastMouseState.LeftButton == ButtonState.Pressed)
{
    if (mouseState.LeftButton == ButtonState.Released)
    {
        /* "do stuff" */
    }
}
lastMouseState = mouseState;

Now, you might say, this still leaves you with the actual problem you mentioned in the first place: what if the use clicks so quickly that the mouse state changes and then changes back between calls to GetState?
Well - my first response to that is "don't worry about it". This is a known issue with the XNA input framework. But in practice you will find that people do not generally click or type so quickly that this causes actual problems at 60FPS.
If your game draws at significantly less than 60FPS, you can still run your updates at 60FPS. To reduce your draw rate you can use Game.SupressDraw or make Game.BeginDraw return false (see here and here). If you also need to run your updates at less than 60FPS, you can still update input at 60FPS (or faster!), but it's a lot more work. (Note that XNA input needs to be done on the main thread.)
(Personally I would suggest you just run at 60FPS and stop worrying about it!)
Finally, if that is not enough for you, you can mess about with interop and hook the message pump and catch WM_LBUTTONUP messages. This is massive overkill, but is the "correct" way to get what you want.

A: Andrew, your issue has nothing to do with the way if statements work. mouseState represents the state of the mouse when GetState() was called. It won't change just because the mouse changes its state. For you code snippet to work like you are expecting it to, you would have to call GetState() before each if statement. The mouse state only changes when you poll it or manually set it.

A: it doesn't work, because if you press Left Button then there is no way to release it before program checks if (mouseState.LeftButton == ButtonState.Released) condition.

Can time delays pause processor
  execution of code

Input delay by mouse and keyboard is unnoticeable.
I'd use variable to store Left Button state each frame:
while (1) // ininity loop
{
    if (mouseState.LeftButton == ButtonState.Pressed)
    {
         button_left_pressed = 1; // is pressed
    }
    else // Left Button is not pressed
    {
         if ( button_left_pressed ) // but was pressed (is released)
         {
             spritePos.X = mouseState.X;
             spritePos.Y = mouseState.Y;
             button_left_pressed = 0; // is not pressed
         }
    }
    // do another action
}


text:
Q: Independence inside Conditional Expectation Let $Y$ be a real-valued random variable, $X, Z$ be random elements, such that $X,Y$ are independent of $Z$. Then is it true that $E[Y|X, f(X,Z)]=E[Y|X]$ for any measurable function $f$?

A: If $σ(X,Y)$ is independent of $σ(Z)$, this follows with the tower property of conditional expectation from the more general fact that in this case, $$ \mathbb E[Y  | σ(X,Z)] = E[Y|X]. \tag{$*$}$$
To see this, note that both $ω ↦ X(ω)$ and $ω ↦ Z(ω)$ are $σ(X,Z)$-measurable, hence $φ: ω ↦ (X(ω),Z(ω))$ is, and this extends to the composition $ f \circ φ = f(X,Z) $. Hence we have the inclusions
$$ σ(X) ⊆ σ(X, f(X,Z)) ⊆ σ(X,Z).$$
Conditioning both sides of $(*)$ on $σ(X, f(X,Z))$ and using the tower property then yields the claim.


text:
Q: Do you need a privacy policy and terms/conditions for your android app? My app's operates on a simple couple of button clicks. However, as I am gearing up to release it, I couldn't help but notice nearly all the apps have at least a privacy policy and terms/conditions on there page. Is it legally necessary to have both? Or is it just good practice?

A: You don't need terms/conditions. Privacy policy are usually required, but that is depending on where you're going to release your app. For example in Europe and California you are required to have a certain type of privacy policy, that include certain specific elements.
"A Terms and Conditions is not required and it's not mandatory by law. Unlike Privacy Policies, which are required by laws such as the GDPR, CalOPPA and many others, there's no law or regulation on Terms and Conditions."
- https://www.termsfeed.com/blog/sample-terms-and-conditions-template/#Download_Terms_and_Conditions_Template
After some research I found that Shopify had decent templates: https://www.shopify.com/tools/policy-generator

A: If you plan to publish an app Google requires you to have privacy policy that you will link to the app so consumers see the privacy policy if they want to. You won't be able to publish without that providing a working link. The terms and conditions is not required by Google.


text:
Q: Ошибка при подключении "ORA-12505: TNS:listener does not currently know of SID given in connect descriptor" Установила Oracle11g, настроила подключение в идее - все ок.
Но в итоге выдает такую ошибку:
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
.....

A: В поле Service надо ввести имя сервиса БД, а не имя БД.
По умолчанию имя сервиса состоит из параметров:

*

*DB_NAME - имя БД, которое было задано при установке, например, myDB

*DOMAIN_NAME - по умолчанию домен сервера БД, например, mydomain.ru
То есть надо ввести: Service: [myDB.mydomain.ru   ]
Узнать, какие сервисы зарегистрированы в прослушивателе можно командой:
$ lsnrctl status


text:
Q: How do I scan a single file with Windows Defender? The number one way people are used to using virus scanners is by scanning a single file.
The number one OS viruses are found on is Windows.
Microsoft's official virus scanner, Windows Defender, seems to be missing the most common use case.
How do I scan a file with Windows Defender? Is it impossible to do?
Okay, there is a "Custom Scan" feature which is poorly implemented, takes forever to click through and find my file. So that's not very helpful.
You might say, "well, just turn real-time protection on" -- but that may work for the average use case. But what if I have a emulator that is responsible for running a file, and so the file isn't being ran through a normal process? Or what if I am simply delivering a file to another computer off the network, and I can't run it on this machine for compatibility reasons? There's many reasons why that approach is not sufficient.

A: You can add the Windows Defender in Context Menu in windows 8 then you can easily scan a single file or folder. Check the link it is well explained with images.
Reproducing the information below:

How to Add "Scan with Windows Defender" to the Context Menu in Windows 8

Windows Defender replaces Microsoft Security Essentials in Windows 8,
  but it does not include the ability to quickly right-click folders and
  scan them. However, you can add this option yourself with a quick
  registry hack.
This trick adds a "Scan with Windows Defender" option to the context
  menu that appears when you right-click a folder. It works similarly to
  the "Scan with Microsoft Security Essentials" option on previous
  versions of Windows.
Unfortunately, there is no command that launches Windows Defender in
  graphical mode and initiates a scan, so we will have to launch Windows
  Defender in a Command Prompt window.
Add the Context Menu Entry Manually
Press the Windows key to access the Start screen, type regedit at the
  Start screen, and press Enter to launch the Registry Editor.

Navigate to the following key:
HKEY_CLASSES_ROOT\Folder\shell

Right-click the shell key in the left pane, point to New, and create a
  new Key. Name it WindowsDefender.

With the WindowsDefender key selected in the left pane, right-click in
  the right pane and create a new String value. Name it Icon, then
  double-click it and enter the following value:
%ProgramFiles%\\Windows Defender\\EppManifest.dll

Right-click in the right pane again and create another new String
  value. Name it MUIVerb, then double-click it and enter the
  following value:
Scan with Windows Defender

Right-click the WindowsDefender key in the left pane, point to new,
  and create a new key. Name it Command.

Double-click the (Default) value in the right pane with the Command
  key selected and give it the following value:
"C:\Program Files\Windows Defender\MpCmdRun.exe" -scan -scantype 3
  -SignatureUpdate -file %1

When you use the option, you will see the scan happen in a Command
  Prompt window. You will only be alerted if a problem is found. If the
  scan is very quick, you will see a Command Prompt window appear and
  disappear quickly. If a problem is found, the window will alert you
  instead of closing.

A: Scan with Windows Defender has finally been added to Right-click menu.

A: Right-click > Scan with windows defender
Found a few more tricks to scan with windows defender using cmd & Powershell.


text:
Q: Simultaneous ajax requests I am trying to run the remote function in the code below every 5 seconds.  It runs only once if I remove the frequency option. I tried remoteTimer function, but when I use remoteTimer function, some code of the script goes outside the script tags and I see that in the webpage.
echo $ajax->form(array('type' => 'post', 'options' => array('model' => 'Thing',
        'url' => array('controller' => 'things', 'action' => 'xyz'),'update' => 'dy4', 'indicator' => 'ldng', 'loading' => ( $ajax->
        remoteFunction(array('url' => array('controller' => 'stories', 'action' =>
        'keep'), 'update' => 'dy3', 'frequency' => 5))))));echo $form->input('a', array('type' => 'checkbox'));echo $form->input('b', array('type' => 'checkbox')); echo $form->end('RUN');

If in case, this cannot be done using CakePHP helpers, how can I do it with JavaScript?

A: Use remoteTimer in a very simple controller. See the page source and between <script> tags you'll get code that does what you want.You can use that code as value for "loading" option.


text:
Q: Leaflet routing machine , how to add popup or tooltips to route path? I'm trying to add a tooltip or a popup when a user clicks on the route or the alternative route created by L.Routing.control.
I'm using Angular.
Example photo:

A: well after a whole weekend trying to figure out how to achieve this .
finely get it to work (i don't know if its the best way to do it ). so here is the solution in case some one need it .
 route.on('routeselected', function (e) {
     var route = e.route;
     var blankMarker = L.icon({
       iconUrl: "../../assets/imgs/home/map-marker.png",
       iconSize: [0, 0],
       iconAnchor: [0, 0],
     });
     var distance = (e.route.summary.totalDistance / 1000).toFixed(2);
     var time = Math.round(e.route.summary.totalTime % 3600 / 60);
     var pop = `

Distance : `+ distance + ` Km

Temps estimé: `+ time + ` Min

`;
     console.log('route selected ', e.type)
     var marker = L.marker([route.coordinates[50].lat, route.coordinates[50].lng], { icon: blankMarker }).bindTooltip(pop, {
       permanent: true,
       direction: 'top'
     });
     if (e.type === 'routeselected') {
       //marker.remove()
       group.clearLayers();
       group.addLayer(marker)
     }
   });


text:
Q: Let Visual Studio show default/current acccess modifier in Visual Studio? When hovering over a field or method etc. in Visual Studio, there's a popup showing the access modifier using a symbol, e.g. for
static void Main(string[] args)
{
    Console.WriteLine("Hello World!");
}

and the Main method it shows

because Main is private. Is it possible to let Visual Studio (I am on 2019) show the access modifier without having to hover a given field/method? Maybe similar to the number of references?

A: I am not aware of anything you can setup directly in Visual Studio.
There is a way how to provide such a visual output by creating CodeLens. You may want to search Visual Studio Marketplace for existing, before you create a new one.
Code Lens OOP Sample


text:
Q: Why history.push() not navigating? I'm building a login page. Where I want to redirect the user if the login successfully otherwise it should redirect to the login page.
Note: Without the use of redux.
I tried to create a router history by "react-router-dom" and when I push a new endpoint in the search bar the router gets updated but it doesn't change the screen. I also tried to change the screen by "window.location.reload()" but then the problem is how I'll send the user data to the next screen.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import * as serviceWorker from './serviceWorker';
import { Route, Link, BrowserRouter as Router } from 'react-router-dom'
import Login from "./components/Login"
import signUp from "./components/signUp"
import Dashboard from "./components/dashboard"
import Recordings from "./components/Recordings"
import RauteHistory from './components/routeHistory';
import callDetails from './components/callDetails'
const routing = (
  <Router history={RauteHistory}>
    <div>
      <Route exact path="/" component={Login} />
            <Route path="/login" component={Login} />
      <Route path="/signup" component={signUp} />
            <Route path="/dashboard" component={Dashboard} />
            <Route path="/recordings" component={Recordings} />
            <Route path="/calldetails" component={callDetails} />
    </div>
  </Router>
)

ReactDOM.render(routing, document.getElementById('root'));

const loginButtonClick = () => {
    let userId, password
    userId = document.getElementById("userId").value;
    password = document.getElementById("password").value;
  loginService(userId, password)
        .then(responseJson => {
            if (responseJson.user_id){
                RauteHistory.push('/dashboard')
                window.location.reload()
            }
            else {
                handleClick()
            }
        })
        .catch(error => {
            console.log(error.error);
        });
}


text:
Q: Open app or App Store item in one link Is it a way to determine link for iOS that will open app if installed(preferably with custom url scheme) or this app in App Store otherwise?
There is a way to open app store like
itms://
and app like
custom_scheme://
but is it any ability in iOS or other way around to do it in one link
for example
applnk://.../?params
will open app if installed and app store item of this app otherwise?


text:
Q: Cin is working for char array but not for int array So I'm using cin for taking input for a char array.
char mycroft[2];
    cin>>mycroft;
    cout<<mycroft;

It works fine. Now I'm using cin for taking input for an int array:
 int mycroft[2];
    cin>>mycroft;
    cout<<mycroft;

However, I am getting this error which I do not understand:

error: no match for 'operator>>' (operand types are 'std::istream {aka std::basic_istream}' and 'int [2]')|

Can someone please tell me why it's not working? Also my professor said taking input using cin isn't advisable. To what extent is that true?

A: You probably need:
for(i=0; i<2; i++)
{
   cin>>mycroft[i];
 ...
}

A: You have misunderstood the concept of char arrays and int (and others) arrays.
When you create a char variable[x] you reserve space in memory to x * 8 bits (length of char) and the language treat it like a continuous space.
To finish this chain you need to put the end character '\0'.
The char mycroft[2] has 1 usable char (in theory) with 16 bits (2 * 8 bits) space in memory.
In the other hand, when you create an int variable[x] you reserve space in memory to x * 32 bit (length of int) and despite the system allocate it continuously, the language treat every x elements individually.
In short, treat it like a real array.
The int mycroft[2] has 2 usable elements and takes 64 bits (2 * 32 bits) space in memory.
Because of that cin works with char directly (cin >> mycroft and cout << mycroft) and doesn't work and with the other arrays (in your case int) you need to access them individually (cin >> mycroft[position] and cout << mycroft[position]).

A: Because an array of characters can means it's a C-style string (if zero-terminated, i.e. the last element in the array is zero). The std::cout and the std::cin treat them in such way.
A char[] can be initialized as:
char mycroft[] = "Hello, World!";

An int[] can't be initialized in such way, it's an array of integers. The reason why your professor told you that taking input using std::cin isn't advisable is that it can cause overflows if you using it in a wrong way. In your first example the std::cin will write everything from the input into a two element long array causing the memory follows the char mycroft[2] will be overwritten.


text:
Q: PHP cURL Post to and display of External Page I am trying to rebuild a site that currently presents a form to the user, has the user click a button to post to a page that does some calcs based on the data entered, and has them hit another button to post to a payment vendor that presents a secure payment form utilizing the non-sensitive data entered.
I am trying to do the following.  I have written a page that presents the form for customer data entry, they click a submit button, that posts to a php file on my site, I make the calculations needed, and then post to the site using Curl.
I have only used cURL in the past to post to a site, check for a good process status, and continue on.  Can I use Curl to post to and then go to the other page in the browser, just like I do when I submit the form directly to it?
In Summary:

*

*Can I post to a form in Curl and have it act just as if I posted from HTML form with the action set to the external site url.

*If so, what I have I missed?
Here is the code from the cUrl call in the php file:
$fields = array(
    'x_invoice_num' => urlencode($x_invoice_num),
    'x_phone' => urlencode($x_phone),
    'x_email' => urlencode($x_email),
    'x_ship_to_address' => urlencode($x_ship_to_address),
    'x_first_name' => urlencode($x_first_name),
    'x_last_name' => urlencode($x_last_name),
    'x_address' => urlencode($x_address),
    'x_city' => urlencode($x_city),
    'x_state' => urlencode($x_state),
    'x_zip' => urlencode($x_zip),
    'x_amount' => urlencode($x_amount),
    'x_fp_hash' => urlencode($x_fp_hash),
    'x_fp_sequence' => urlencode($x_fp_sequence),
    'x_fp_timestamp' => urlencode($x_fp_timestamp),
    'x_login' => urlencode($x_login),
    'x_show_form' => urlencode($x_show_form),
    'x_description' => urlencode($x_description)
);

        //url-ify the data for the POST
       $fields_string="";
       foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
       rtrim($fields_string, '&');

       //set the url, number of POST vars, POST data

       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $postURL);
       curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
       curl_setopt($ch, CURLOPT_HEADER, FALSE);
       curl_setopt($ch, CURLOPT_POST, TRUE);
       curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

       $headers = array();
   $headers[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
   $headers[] = "Accept-Language: en-us,en;q=0.5";
   $headers[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

       //execute post
       //curl_exec($ch);

       $curl_result = curl_exec($ch);
       $OK = strpos($curl_result, 'OK');
       $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

       curl_close($ch);

A: The idea of having the user redirected to the secure payment provider is that he/she will enter some sensitive payment info (CC, expiry, ...) to be processed. I don't think that you have this info, among your "$fields" array, to be able to POST directly to the provider.
What you want to look at is probably a callback from the provider's website once the payment is successful and complete.


text:
Q: Problem with having two tasks calling the same action and want only one to be restricted to current_user I let users edit their videos and add tags to the videos. Since I set up adding tags as a virtual attribute in the video show view, both tasks hit the same controller method, the videos_controller update method:
  def update
    @video = current_user.videos.find(params[:id])

    respond_to do |format|
      if @video.update_attributes(params[:video])
        format.html { redirect_to(@video) }
        format.js
      else
        format.html { render :action => "edit" }
      end
    end
  end

The problem is that I only want the owner of the video to be able to edit their own video, while I want tags to be updated by any user. Is it possible to do this when both tasks hit the same action, or do I need to restructure my app? If so, how?

A: I fixed your problem in IRC. Give me the points or I will make fun of you elsewhere.

A: To start, you would want to make sure you block this in the browser.
It would be confusing for a user to be able to edit stuff and then get an error, because he is not the owner.
Secondly, to protect yourself against tampering, inside your controller you need to do something like:
def update
  @video = current_user.videos.find(params[:id])

  video_params = params[:video]
  unless current_user = @video.user_id
    # strip out all harmful parameters
    # this is an example, as i don know
    video_params.delete(:file_name)

    # maybe here you should do some check if there is anything left?
    # to generate an appropriate error?
  end

  respond_to do |format|
    if @video.update_attributes(video_params)
      format.html { redirect_to(@video) }
      format.js
    else
      format.html { render :action => "edit" }
    end
  end
end


text:
Q: Read paramlist Oracle Forms 10gR2 is it possible to read all paramlist in Oracle Forms?

A: You use GET_PARAMETER_LIST(name) to retrieve a parameter list in Forms. However, you must know what the name of the parameter list is. To find out, look at the code that is calling the form that sets the parameter list - e.g. look for code that calls CREATE_PARAMETER_LIST.
Generally I prefer to use a single standard name for all parameter lists, to avoid confusion.


text:
Q: Mathematica 11.1 BarLegend Bug Resurrected I am using Mathematica 11.1 and facing difficulty with BarLegend. When I specify custom ticks using "Ticks" and custom tick labels using "TickLabels", BarLegend is still sorting ticks in a strange way. I have, for example:
"Ticks"->{-10,-7.5,-5.,-2.5,0.},"TickLabels"->{"-10","-7.5","-5.","-2.5","0."}

But the Bar Legend shows up with something like this instead:
{-7.5,-5.,-2.5,0.,-7.5,-10.}

I have no idea what could be causing this. There is another post that deals with this issue here Problem with custom ticks in BarLegend in Mathematica 11.1, however, even explicitly specifying the tick labels via "TickLabels" isn't working.
Furthermore, both options "Ticks" and "TickLabels" show up in red highlights and are not being 'fully' recognised as options for BarLegend. I know that these options do work for positive numbers but the moment my z range contains negative numbers the BarLegend gets mixed up. This happens even when I convert the tick labels to strings before passing them to BarLegend.
**The same thing happens even when I try to shift the tick range so that it contains only positive numbers.


text:
Q: Failed to fetch for application/octet-stream for small subset of users I have two versions of an API I can toggle via a feature flag. (One that returns application/json and another that returns application/octet-stream)
When I enabled the feature flag to use the new application/octet-stream There seems to be a small subset of users for the API where they received failed to fetch. The users where the octet-stream API works and doesn't have the same browser versions and OS. The different users have same browser versions and operating system.
This is the request header I send for both API.
  "headers": {
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "...",
    "content-type": "application/json",
    "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"", // They would be using Chrome and it might be v102
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "// I believe this would be Windows 10",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site",
  },
  "referrer": "...",
  "referrerPolicy": "no-referrer-when-downgrade",
  "body": "...",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"

This is the error from the logs (its similar to errors where there's no connection but the server receives the request and the other APIs seem to be returning correctly based on the logs)
  "error": {
        "message": "Failed to fetch",
        "name": "TypeError",
        "stack": "TypeError: Failed to fetch\n (...the chunks it failed at)"
    },

Does anyone know what could be causing this issue? Am I missing an request or response header like maybe changing accept-encoding? or is it maybe a corporate firewall?

A: I had the same problem. The main cause of this - free space on disk where Chrome catalog located. See details https://stackoverflow.com/questions/10988569/storage-limits-on-chrome-browser,


text:
Q: Copy List Item to a new item in the same list with workflow designer 2007 I have a SharePoint list item with all of the fields filled in, and want to simply copy that item to create a new one. I want to create a button on a list item which will "copy to new" and then automatically bring up the new item to edit.
Is that possible with SharePoint and SharePoint Designer 2007 and how do I do this? I am new to SharePoint and Designer and not very familiar to the SPD GUI. So please keep this in mind when answering

A: Yes, you can do that. Take a look at this following great example explained by Laura Rogers with all the necessary detail: Click to Copy List Item to New in SharePoint 2007.
Hope this helps!


text:
Q: Create Background-blurred RoundedRectangle in SwiftUI I am using this code to create a background-blurred view:
struct Blur: UIViewRepresentable {
    let style: UIBlurEffect.Style = .systemUltraThinMaterial

    func makeUIView(context: Context) -> UIVisualEffectView {
        return UIVisualEffectView(effect: UIBlurEffect(style: style))
    }

    func updateUIView(_ uiView: UIVisualEffectView, context: Context) {
        uiView.effect = UIBlurEffect(style: style)
    }
}

However, this code returns a regular rectangle with background blur. How do I make it rounded?

A: You can create another SwiftUI view:
struct BlurCircle: View {
    var body: some View {
        Blur()
            .clipShape(Circle())
    }
}

and use it like this:
struct ContentView: View {
    var body: some View {
        BlurCircle()
            .frame(width: 100, height: 100)
    }
}

Alternatively, you can just do:
struct ContentView: View {
    var body: some View {
        Blur()
            .frame(width: 100, height: 100)
            .clipShape(Circle())
    }
}

If you don't want to do this outside the Blur struct, you can take a look at this answer:

*

*How can UIVisualEffectView be used inside of a circle?

A: You need to change 2 properies of your visual effect view, cornerRadius and clipsToBounds. Your makeUIView function would look like
func makeUIView(context: Context) -> UIVisualEffectView {[]
    let view = UIVisualEffectView(effect: UIBlurEffect(style: style))

    view.cornerRadius = 20  // change this to your radius
    view.clipsToBounds = true

    return view
}

A: ' struct BlurRectangle: View {
var body: some View {
RoundRectangle(cornerRadius: 25)
.background(Blur())
.frame(width: 100, height: 100)
}
} '
Hope it's helpful


text:
Q: Como fazer coleta de dados em web scrapping no Python? Dentro desta URL, tem vários links , tenho que pegar os links referentes ao mês de junho de 2017, fazer download deles e criar um dataframe com todos os arquivos em um só.
Porém travei aqui nesta parte, como posso fazer isso?
Estou tentando usar a biblioteca urllib, porém sem sucesso.
import urllib
from bs4 import BeautifulSoup
from urllib.request import urlopen, urlretrieve

url = 'https://s3.amazonaws.com/video.udacity-data.com/topher/2018/November/5bf32290_turnstile/turnstile.html'

#Criação da variável page com URL no método request.get
page = requests.get(url)

#coleta,analisa e configura como um objeto BeautifulSoup
soup = BeautifulSoup(page.text,'html.parser')
links = soup.find_all('a')

#retorna os todos os links do Junho de 2017 da página

totalArquivos = 0
for link in links:
    href= link.get('href')
    if href != None and '1706' in href:
        totalArquivos += 1

print(totalArquivos)

A: Resposta atualizada:21/05/19
url = 'https://s3.amazonaws.com/video.udacity-data.com/topher/2018/November/5bf32290_turnstile/turnstile.html'

#Este método retorna um objeto Response
page = requests.get(url)
if req.status_code == 200:
    print('Requisição bem sucedida!!!')
    content = page.content
else:
    print("ATENÇÃO ERRO DO TIPO:",page)

#aqui usamos o método soup
soup = BeautifulSoup(page.content,'html.parser')

links = soup.find_all('a')
totalArquivos = 0
for link in links:
    href= link.get('href')
    if href != None and '1706' in href:
        totalArquivos += 1

#Realizando o download dos arquivo

    insira o código aqui
        filename = href.rsplit('/', 1)[-1]
        print("Iniciando o download do arquivo %s" %(filename))
        print("Foi baixados o %s" %(totalArquivos),"arquivo")
        urlretrieve(url, filename)

A: Você não está utilizando urllib, pelo menos não na prática. Você apenas o importou e não vi utilização dele em código algum do programa. Pelo contrário, vi um código escrito
requests.get(url)

Que significa que você está tentando usar o módulo requests. No caso, modificando levemente o código consegui executá-lo sem problemas.
Eu apenas apaguei os imports do urllib e importei o módulo requests:
from bs4 import BeautifulSoup
import requests

url = 'https://s3.amazonaws.com/video.udacity-data.com/topher/2018/November/5bf32290_turnstile/turnstile.html'

#Criação da variável page com URL no método request.get
page = requests.get(url)

#coleta,analisa e configura como um objeto BeautifulSoup
soup = BeautifulSoup(page.text,'html.parser')
links = soup.find_all('a')

#retorna os todos os links do Junho de 2017 da página

totalArquivos = 0
for link in links:
    href= link.get('href')
    if href != None and '1706' in href:
        totalArquivos += 1

print(totalArquivos)

Com o urllib:
Para utilizar o módulo que você já está tentando usar, você pode usar apenas a função open() (a qual você já está importando) e ler a resposta com o método .read(). Para isso, do seu código original, modifiquemos apenas algumas linhas:
Isto
page = requests.get(url)

se torna isto
page = urlopen(url)

E no no lugar no page.text (que é do requests também) você deve utilizar page.read(). Ou seja:
soup = BeautifulSoup(page.read(),'html.parser')


text:
Q: Transform application compiled in jdk1.4 to jdk1.7 I'm working on an application that has been created long time ago (maybe 2008/2009). Now I got the task of upgrading the server.
Previously it was compiled in jdk1.4. Now I have to make the application compatible with jdk1.7. I tried to compile it with jre7 and I've changed source and target value of ant build.xml file to 1.7. And also in ANT build the jre7 is selected as compiler environment.
I'm getting the following error message:
 [javac] javac: invalid target release: 1.7
    [javac] Usage: javac <options> <source files>
    [javac] where possible options include:
    [javac]   -g                        Generate all debugging info
    [javac]   -g:none                   Generate no debugging info
    [javac]   -g:{lines,vars,source}    Generate only some debugging info
    [javac]   -nowarn                   Generate no warnings
    [javac]   -verbose                  Output messages about what the compiler is doing
    [javac]   -deprecation              Output source locations where deprecated APIs are used
    [javac]   -classpath <path>         Specify where to find user class files
    [javac]   -sourcepath <path>        Specify where to find input source files
    [javac]   -bootclasspath <path>     Override location of bootstrap class files
    [javac]   -extdirs <dirs>           Override location of installed extensions
    [javac]   -d <directory>            Specify where to place generated class files
    [javac]   -encoding <encoding>      Specify character encoding used by source files
    [javac]   -source <release>         Provide source compatibility with specified release
    [javac]   -target <release>         Generate class files for specific VM version
    [javac]   -help                     Print a synopsis of standard options

I tried to print the java version using following line:

and it shows :

[echo] Using Java version 1.7.

What (other) changes do I need to make to make it work with jdk1.7?

A: Problem Solved.
I was trying to compile with JRE7 instead of jdk1.7.
with jdk1.7 installed and target and source changed in ant build.xml file solved my problem.


text:
Q: Modifying "Delayed Choice Quantum Eraser" experiment to send messages in past Firstly, I am a science fiction writer --- please do not judge my technical knowledge harshly.  (Also, English is not my first language.)  I'd like to know whether it is nonsense or not to have the following concept in a novel:
In "Delayed Choice Quantum Eraser" experiment it is shown that if you measure in future in which slit particle went through you destroy interference pattern in past (https://www.youtube.com/watch?v=0ui9ovrQuKE).
If this is true then theoretically you can have a device with photon container in which you store the photon for a significant amount of time. Then in future you can measure a photon stored in device or destroy device without measuring. If you measure it you destroy interference pattern in past in the moment photon's twin was released. It means you can send 1 or 0 in past from future which in turns means you can send any kind of data if you store enough photons and than years after decide measure it or not.
Is the only problem a photon storing device for this to work (Alternatives like sending photon around blackholes to receive it back later are also welcome)? Or I completely wrongly understand the experiment?

A: The explanation in the video is mostly garbage.  (The "what the bleep" title card is a bit of a giveaway.)
The main problem in the video is a statement like "a photon must decide whether it is a particle or a wave."  That is a fundamental misunderstanding of quantum mechanics.  Photons are quantum mechanical objects whose behavior is, in some circumstances, subject to non-local correlations in the same way as classical waves in a classical fluid can interfere with each other.  In other circumstances, the behavior of a quantum-mechanical photon localized and quantized (a word which I use to mean "it comes in a lump") in the same way as a classical particle like a shotgun pellet or a brick.
The counterintuitive feature of quantum mechanics is that the non-local, wave-like features of the photon field include correlations among the particle-like behaviors.  For example, the rate at which photons interact (one at a time, like "particles") with position-sensitive photon-absorbing detectors depends on the intensity of the photon field, which you can vary by changing the amount of energy stored in a laser cavity.  Suppose you have some interferometer which is a foot across, so that a particle traveling at lightspeed would take a nanosecond to cross it, and you turn down your photon intensity so that you have one photon per second interacting with your detector.  If photons were countable, like shotgun pellets, that would mean that usually there are zero photons in your apparatus; there  would be one photon in your apparatus very briefly once per second, on average; the probability that there would be two photons in your detector simultaneously would be roughly a billion to one.  Each single photon shows up in a position-sensitive detector at exactly one location.  And yet, adding up the locations of those "single" photons reveals an intensity distribution that's exactly the same as you would predict using wave interference (e.g.).  Each "single" photon apparently interacts with the entire apparatus.  People who don't like non-local interactions are upset by this.
In the delayed-choice eraser experiment we take this a step further by having three opporunities for the photon field to behave non-locally:

*

*A photon from a laser passes through a double slit.

*After the double slit, the photon is converted into an entangled pair of photons.  One, the "signal," goes to a position-sensitive detector.

*The "idler" entangled photon goes to an interferometer, where it take take one of four paths.  Two of the paths definitely correspond to one or the other of the slits in phase 1; the other two are mixed and can come from either of the initial slits.

After running the experiment for a while, you have a large number of position measurements from the signal photon which don't show any interference pattern.  Each signal photon is associated with an idler photon which took one of the four paths through the second interferometer.  If you throw away all of the signal photons except where the idler photon took a path through the interferometer that corresponds to a particular slit, you still see no interference pattern in the signals' positions.  If you look at the signal photons from where the idler photon took either of the routes through the interferometer --- that is, the other half of your data --- you also see no interference pattern in the signals' positions.  But if you choose just the data where the idler photon took one of the ambiguous paths through the interferometer --- that is, a quarter of your data --- an interference pattern appears in the position data for those signal photons.  (If you choose the other ambiguous path, you get a complementary interference pattern; everyone is accounted for.)
What upsets people who don't like non-local interactions is that you can adjust the order of the signal and idler photons, so that the signal photon is detected (and destroyed) before the idler photon has a chance to interact with the final interferometer, and you still see the same interference effect.
There's a lot of controversy about exactly how to interpret these results.  The explanation in your linked video, in which the idler photon's choice of path in the interferometer goes back in time and changes whether the signal photon "was a particle or a wave", is garbage for several reasons, some of which I addressed above --- but it's so provocative that people respond to it, and repeat it, without examining the more complicated reality.  I've tried to write the answer using the language the I prefer, which is that the photon field is fundamentally non-local, including correlations among different detectors.
You suggest,

theoretically you can have a device with photon container in which you store the photon for a significant amount of time. Then in future you can measure a photon stored in device or destroy device without measuring. If you measure it you destroy interference pattern in past in the moment photon's twin was released. It means you can send 1 or 0 in past from future which in turns means you can send any kind of data

But that's not correct.  The "choice" which "goes back in time" (note the scare quotes) is a choice that the idler photon makes when it interacts with the final interferometer.  You can't make that choice on its behalf --- the choice is made by the way that the entire photon state, including both entangled photons, interacts with the entire apparatus.  The high-quality wikipedia particle on the delayed-choice quantum eraser includes the sentence

[A] theorem proved by Phillippe Eberhard shows that if the accepted equations of relativistic quantum field theory are correct, it should never be possible to experimentally violate causality using quantum effects.

which cites this and this reference.

A: I does not work that way,the interference pattern can only be seen retroactively once the idler photons have been detected and the experimenter has had information about them available, with the interference pattern being seen when the experimenter looks at particular subsets of signal photons that were matched with idlers that went to particular detectors. Thus, to see an interference pattern the other guys needs to send information classically.


text:
Q: Getting common value count of text array column in Postgres I have a table which looks like this:
id   num
---  ----
1    {'1','2','3','3'}
2    {'2','3'}
3    {'5','6','7'}

Here id is a unique column and num is a text array which can contain duplicate elements . I want to do something like an intersection between two consecutive rows so that I get the count of common elements between num of two rows. Consider something like a set where duplicates are considered only once. For example, for the above table I am expecting something like the following:
id1   id2  count
---   ---  -----
1      2    2
1      3    0
2      1    2
2      3    0
3      1    0
3      2    0

It is not necessary to get the output like the above. The only part I am concerned about is count.
I have the following query which gives the output only for one id compared with one other id:
select unnest(num) from emp where id=1
intersect
select unnest(num) from emp where id=2

How can I generalize it to get the required output?

A: A straight forward approach puts the intersection of the unnested arrays in a subquery and gets their count.
SELECT t1.id id1,
       t2.id id2,
       (SELECT count(*)
               FROM (SELECT num1.num
                            FROM unnest(t1.num) num1(num)
                     INTERSECT
                     SELECT num2.num
                            FROM unnest(t2.num) num2(num)) x) count
       FROM emp t1
            INNER JOIN emp t2
                       ON t2.id > t1.id
       ORDER BY t1.id,
                t2.id;

Should you be only interested in whether the arrays share elements or not but not in the exact count, you can also use the overlap operator &&.
SELECT t1.id id1,
       t2.id id2,
       t1.num && t2.num intersection_not_empty
       FROM emp t1
            INNER JOIN emp t2
                       ON t2.id > t1.id
       ORDER BY t1.id,
                t2.id;

A: For the example data, this works:
with t as (
      select v.*
      from (values (1000, array['acct', 'hr']), (1005, array['dev', hr'])) v(empid, depts)
     )
select t1.empid, t2.empid,
       (select count(distinct d1)
        from unnest(t1.depts) d1 join
             unnest(t2.depts) d2
             on d1 = d2
       ) cnt
from t t1 join
     t t2
     on t1.empid < t2.empid;

I'm not 100% sure this is what you intend, though.


text:
Q: URL rewrite errors, possible overwriting? I am fairly new to .htaccess and its applications, here is a very straight forward question. I have the following rewrite rule in my .htaccess. The first RewriteRule replaces all .php in my file, and the second RewriteRule is to overwrite a question mark in a link into a slash, but I do not know why the second rule doesn't work. In my other PHP file that has the link to the "profile" link, the link to it is <a href= "profile?'some id fetch from php'", the link works fine with the ? in it, however even after I apply my second rule, nothing happens to it when I click on it. Is it possible that the first rule is somehow preventing the second one from occurring? Or is it because something goes wrong in my href link? The following is my .htaccess.
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^profile/([0-9]+)$ profile?$1 [L]

Thanks in advance for any feedback.
Ray

A: Your first rewrite pattern accepts any characters in URI excluding a dot, so it also matches "/profile/123",
Change your regex pattern :
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/.]+)/?$ $1.php [NC,L]
RewriteRule ^profile/([0-9]+)/?$ profile?$1 [L]


text:
Q: Get image from scanner c# I want to get image from scanner. I have a simple application in Java, but i have see that not exist a free library to get image directly from scanner. So I have this idea, I create a simple project in C# to get image them call this exe file from java application. So I have find this code on codesource.
http://www.codeproject.com/Articles/1376/NET-TWAIN-image-scanner
If I try to run demo application, it found I can get image from scanner. But If I try to run the code project I have this error
System.DllNotFoundException non è stata gestita
  IsTransient=false
  Message=Impossibile caricare la DLL 'twain_32.dll': Routine di inizializzazione della libreria di collegamento dinamico (DLL) non riuscita. (Eccezione da HRESULT: 0x8007045A).
  Source=TwainGui
  TypeName=""
  StackTrace:
       in TwainLib.Twain.DSMparent(TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, IntPtr& refptr)
       in TwainLib.Twain.Init(IntPtr hwndp) in c:\Users\michele.castriotta\Downloads\twaingui_src\TwainGui\TwainLib.cs:riga 58
       in TwainGui.MainFrame..ctor() in c:\Users\michele.castriotta\Downloads\twaingui_src\TwainGui\MainFrame.cs:riga 29
       in TwainGui.MainFrame.Main() in c:\Users\michele.castriotta\Downloads\twaingui_src\TwainGui\MainFrame.cs:riga 234
       in System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       in System.Threading.ThreadHelper.ThreadStart()
  InnerException:

I have open the progect with Visual Studio 2013 then I have set the framework version at 2.0 and I have select x86 as CPU.
The error is in the class TwainLib.cs at this point
TwRC rc = DSMparent( appid, IntPtr.Zero, TwDG.Control, TwDAT.Parent, TwMSG.OpenDSM, ref hwndp );

I'm try to copy twain_32.dll directly into debug folder, but the error is the same. The system can't find the library. Where is the error?
If is possible to get image from another language for me is the same.

A: It's a permission issue, because the twain_32.dll is located under C:\Windows. If you right-click TwainGui.exe, and select "run as administrator", the app can run normally.

If you want to debug the program with admin permission, check the following steps:

*

*create a manifest file

*change level to "requireAdministrator"

*restart VS2013

By the way, you can call C# code directly in Java with jni4net. Here is a tutorial - Java TWAIN with Dynamic .NET TWAIN and jni4net.


text:
Q: Change study height in Tradingview charting library? After creating a new study and adding it to my chart with:
widget.chart().createStudy("abcd crypto index", false, true);

How can I change the height of the study? Is there a similar way like with the volume?
overrides: {
    "volumePaneSize": "medium",
    ...

A: Changing the height of all panes is available in Charting Library version 1.15 (currently the unstable branch) by accessing the specific pane using the Pane API - widget.chart().getPanes()
via https://github.com/tradingview/charting_library/wiki/Pane-Api (access to Charting Library private repo required to view wiki)
getHeight()
Starting from version 1.15.
Returns the pane's height.
setHeight()
Starting from version 1.15.
Sets the pane's height.


text:
Q: setting up a launchpad ppa: "bzr builddeb" fails i'm trying to setup a ppa for a library that i am writing. I've spent a couple of days now and slowly move forward, but now it seems i am stuck with an error because "bzr builddeb" cannot find the debian/changelog file.
My debian control files are in the following directory:
foo-ppa/trunk/foo/debian

When i run 'dpkg-buildpackage -rfakeroot -d -us -uc -S' then everything works fine.
But when i run "bzr builddep -S" then i get the following error:
Building using working tree
bzr: ERROR: Could not find changelog at /home/chris/prj/foo-ppa/trunk/debian/changelog in tree.

I understand that my directory structure is "wrong" (trunk/foo/debian instead of trunk/debian). But when i change the directory structure (using trunk/debian) then "bzr builddep -- -nc -us -uc" complains about the new path and returns the following error:
bzr: ERROR: [Errno 2] No such file or directory: '/home/chris/prj/foo-ppa/trunk/foo/debian/README.Debian'

The file exists, but it's in trunk/debian instead of trunk/foo/debian.
How do I have to set up the directories in order to get bzr and dpkg-buildpackage working?
Thanks
Christoph
-------------- edit:
i managed to fix this by removing the build-area directory and retrying a few times. I do not know what exactly was the problem, but it's working now.

A: Try the second command, but run "bzr rm" (no arguments) first. This will mark all of the files that have disappeared as removed in bazaar, and will prevent bzr-builddeb from printing that error.


text:
Q: ERROR: PleskFatalException: Unable to connect to database: mysql_connect(): Connection refused (auth.php:142) Today when I'm trying access to my VPS the plesk give me this error message
ERROR: PleskFatalException: Unable to connect to database: mysql_connect(): Connection refused (auth.php:142)

The message appears when I open the URL for plask's admin panel.
Last week when I accessed was working perfectly
The OS is Parallels Plesk 11.5.30, I think its linux based
I didn't tried anything because I have no idea what I can do, I'm not a linux guy.

A: Contact your VPS provider and send them the error message.  Their Plesk installation is broken.