text:
Q: OpenAM tries to serve mixed content which is prohibited by browser I am building a .net core application which uses ForgeRock OpenAM as authorization/authentication provider.
I have succesfully set up the client and I am able to login, but after login openam tries to redirect me through a javascript, but the javascript cannot be loaded because the URL is http and the rest of the URLS are https.
I am using the OpenID connect protocol.
This is my configuration:
      options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
        })
        .AddCookie()
        .AddOpenIdConnect("oauth", options =>
        {
            options.ClientSecret = "SomeVerySecretKey";
            options.ClientId = "account";
            options.MetadataAddress = "https://some.nice.site/openam/oauth2/.well-known/openid-configuration";
            options.CallbackPath = "/signin-oidc";
            options.Authority = "https://some.nice.site/openam/oauth2";
            options.ResponseType = "code";
            options.GetClaimsFromUserInfoEndpoint = true;

            options.Configuration = new OpenIdConnectConfiguration()
            {
                AuthorizationEndpoint = "https://some.nice.site/openam/oauth2/authorize",
                TokenEndpoint = "https://some.nice.site/openam/oauth2/access_token",
                UserInfoEndpoint = "https://some.nice.site/openam/oauth2/userinfo",
            };
        }
        );

My hunch is that this might be a setting in openam, but i cannot find it (we are using openam 6.5.3)
the message my browser sends to me is:
authorize:1

       Mixed Content: The page at 'https://some.very.nice.site/openam/oauth2/authorize?client_id=account&redirect_uri=some_secret_uri&x-client-SKU=ID_NETSTANDARD2_0&x-client-ver=6.10.0.0' was loaded over HTTPS, but requested an insecure script 'http://logint.delta.nl/openam/XUI/main-authorize.js'. This request has been blocked; the content must be served over HTTPS.

A: The issue was in the load balancer.


text:
Q: Get data from each dynamically created EditText Dynamically created EditTexts by Add button, and also I have assigned them unique ID's using setId(), Now what I want to do is to get values from the dynamically created EditTexts when the user taps a button, then store all of them as Sharedpreferences
This is the code
Thank you guys
ADDED CODES
    List<EditText> allEds = new ArrayList<EditText>();
Button btnSave, btnAdd;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final LinearLayout layoutmain = (LinearLayout) findViewById(R.id.layoutmain);
    btnAdd = (Button) findViewById(R.id.btnadd);
    btnSave = (Button) findViewById(R.id.btnsave);

    btnAdd.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            EditText ed = new EditText(ActivityOptions.this);
            ed.setId(ed.generateViewId());
            ed.setTag(allEds.size());
            ed.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));
            layoutmain.addView(ed);
            // Add also to the allEds
            allEds.add(ed);

        }
    });

    btnSave.setOnClickListener(new View.OnClickListener() {
        EditText ed = new EditText(ActivityOptions.this);
        @Override
        public void onClick(View arg0) {

            SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
            editor.putString("key" + ed.getTag().toString(), ed.getText().toString());

            for (EditText ed : allEds) {
                editor.putString("key" + ed.getTag().toString(), ed.getText().toString());
            }
            editor.commit();

        }

    });
    Intent intent = new Intent(this, MainActivity.class);
    ArrayList<String> allTexts = new ArrayList<>();
    for (EditText e : allEds) {
        allTexts.add(e.getText().toString());
    }
    intent.putExtra("Text", (Serializable) allTexts);

}

}

A: You forgot to add the EditText's to your list, so the save button will know about them and get their inputs.
After that you need to specify the save button (which I believe you did, but I cannot see a reference of it in your code).
Lastly just implement the logic for the save button in its onClick() (save in SharedPreferences).
List<EditText> allEds = new ArrayList<EditText>();
Button btnSave,btnAdd;

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final LinearLayout layoutmain = (LinearLayout)findViewById(R.id.layoutmain);
        btnAdd = (Button) findViewById(R.id.btnadd);
        btnSave = (Button) findViewById(R.id.btnsave);

        btnadd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                EditText ed = new EditText(MainActivity.this);
                ed.setId(ed.generateViewId());
                ed.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                        LinearLayout.LayoutParams.WRAP_CONTENT));
                layoutmain.addView(ed);
                // Add also to the allEds
                allEds.add(ed);
            }
        });

        btnSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
                SharedPreferences.Editor editor = sharedPref.edit();

                for (EditText ed : allEds) {
                    editor.putString("saved_text_key", ed.getText().toString());
                    editor.commit();
                }

            }
        });
    }

A: While creating every new EditText, you generate ids by setId() but I don't see how these are going to be useful in your code.
Instead set the tag of the EditText like this:
ed.setTag(allEds.size());

and add it to the list:
allEds.add(ed);

Now in each EditText's tag you have stored its ordinal number (zero based) in the list and when you want to store its value in SharedPreferences you can do:
SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
editor.putString("key" + et.getTag().toString(), ed.getText().toString());
editor.commit();

or by using a loop through all the items in the list:
for (EditText ed : allEds) {
    editor.putString("key" + et.getTag().toString(), ed.getText().toString());
}
editor.commit();

This way you stored all the text values of the EditTexts with keys like:
"key0", "key1", "key2",...

Edit
Of you want to open another activity and pass the list to it:
    Intent intent = new Intent(this, AnotherActivity.class);
    ArrayList<String> allTexts = new ArrayList<>();
    for (EditText e : allEds) {
        allTexts.add(e.getText().toString())
    }
    intent.putExtra("Text", (Serializable) allTexts);

and in the other activity's onCreate():
ArrayList<String> list = (ArrayList<String>) getIntent().getSerializableExtra("Texts");

Edit2
Replace the code in btnSave.setOnClickListener() and the lines below, with this code:
btnSave.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {
        SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit();
        for (EditText ed : allEds) {
            editor.putString("key" + ed.getTag().toString(), ed.getText().toString());
        }
        editor.commit();

        Intent intent = new Intent(this, MainActivity.class);
        ArrayList<String> allTexts = new ArrayList<>();
        for (EditText e : allEds) {
            allTexts.add(e.getText().toString());
        }
        intent.putExtra("Text", (Serializable) allTexts);
        startActivity(intent);
    }
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Changing color of circle mouse when moving to new section I have a little and simple js script (just starting) to make the mouse on my website a circle instead of a regular one.
I need to make it switch border color on the next website section. Is this thing to change in js or is it something is should change in HTML, css?
Here is the link for test web - https://naughty-cori-05cc08.netlify.app/
let navLinks = document.querySelectorAll('.nav-links li');

window.addEventListener('mousemove',cursor);

function cursor(e) {
    mouseCursor.style.top = e.pageY + 'px';
    mouseCursor.style.left = e.pageX + 'px';
    div.style.border = white;

}

navLinks.forEach(link => {
    link.addEventListener("mouseleave", () => {
        mouseCursor.classList.remove("link-grow");
        link.classList.remove("hovered");
        });
link.addEventListener("mouseover", () => {
mouseCursor.classList.add("link-grow");
link.classList.add("hovered");
});
});```

A: You can do this very simply in css:
cursor: url(your_image_path.png) (width) (height), (mode);

But for more details (and since i haven't used this property my self) go and see MDN's https://developer.mozilla.org/en-US/docs/Web/CSS/cursor and many other website's on this topic.
Now... if you weren't thinking of making an actual .png-.jpeg-.ani i don't know if there is way forward to do it Google it even more.


text:
Q: Making Google Calendar and Gmail the "Default Applications" for calendar and mail I wish to integrate the Gmail and Google Calendar web interfaces with Unity. This means several things.

*

*In System Info > Default Applications set firefox 'https://mail.google.com/mail/?shva=1#inbox' as the mail command. This would obviously require me to somehow add a custom command to the list of Gnome3's default applications for Mail.

*In System Info > Default Applications set firefox 'https://calendar.google.com' as the calendar command.

*When clicking on the date in the upper right, and selecting "Add Event..." run firefox 'https://calendar.google.com'.

*When clicking a mailto link somewhere open it in Gmail with the "To:" field set correctly. Perhaps something like firefox 'https://mail.google.com/mail/?extsrc=mailto'url=%s. Bonus points for also doing this when trying to mail a file from nautilus.

HINTS:

*

*I assume that (1) and (2) are achievable through setting some kind of .desktop files in ~.local/share/applications/ but the things I tried haven't worked.

*I also guess that (3) and (4) might require some editing of /desktop/gnome/url-handlers in gconf-editor.

EDIT: It seems that an elegant solution will finally be possible in 12.10 with integration of web apps.

A: 1) It is the "MimeType" line in the Desktop file, containing "x-scheme-handler/mailto;" which causes the application to show up as a preferred email handler.
The Preferred Applications "Default Applications" capability is fairly well hidden in GNOME 3, as the "Default Applications" tab in the "System Info" utility.
Consider using the GNOME Gmail package. It will take care of this for you, integrating your default browser as the desktop (Gmail) mail handler. It does not handle the calendar link - that would require an additional Desktop file.
4) You won't find better mailto URL handling for Gmail than GNOME Gmail (http://gnome-gmail.sf.net). It will properly work with Naultilus "Send To...", and even supports Libre Office 'Send -> Document as Email...".

A: You can install Gnome Gmail on Ubuntu Unity using the Ubuntu Software Centre Application.
Once installed, just run Gnome Gmail and check the box that says to use it as the default mail application.
Super simple :D

A: This is a half-baked solution to cover the transition period until a better one is available. Also good as an addition to the above. It crates a Gmail/Compose/Contacts/Calendar right-click entries on the Firefox Unity icon. Also adaptable to other browsers.
Create a custom Firefox launcher in `~/.local/share/applications/firefox.desktop' with the following it it.
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;
StartupWMClass=Firefox
StartupNotify=true
X-Ayatana-Desktop-Shortcuts=Gmail;Compose;Contacts;Calendar;SafeMode

[Gmail Shortcut Group]
Name=Gmail
Exec=firefox 'https://mail.google.com/mail/?shva=1#inbox'
TargetEnvironment=Unity

[Compose Shortcut Group]
Name=Compose
Exec=firefox 'https://mail.google.com/mail/?shva=1#compose'
TargetEnvironment=Unity

[Contacts Shortcut Group]
Name=Contacts
Exec=firefox 'https://www.google.com/contacts'
TargetEnvironment=Unity

[Calendar Shortcut Group]
Name=Calendar
Exec=firefox 'https://calendar.google.com'
TargetEnvironment=Unity

[SafeMode Shortcut Group]
Name=SAFE MODE
Exec=firefox -safe-mode
TargetEnvironment=Unity

A: To make gmail your standard app, there is a simpler solution using the Ubuntu SW Centre.
NOTE: Only works for gmail, not for Calendar!!!
Start Ubuntu SW Centre.
Search for "desktop webmail"
---> install this application
after successful installation, go into  the Unity Dash, type "desktop webmail" and choose "Desktop Webmail Configuration". There is only one choice to be made there: which webmail system do you prefer? In this case that will be "gmail".
Close the app, and go into System Settings, select Details > Standard Applications.
Click the "E-mail" selection box > "Desktop Webmail" and you are done.
From now on, every email link clicked will start-up Gmail in your default browser.


text:
Q: Flutter opening textfield reloaded the application just sharing this here.
for some reason, after I added a global variable for global width and height (so I don't have to call mediaQuery all the time),
whenever I opened text fields, the app reloaded or crashed the text editing.
I declared the variables in the main. dart in the global space,
but set their values on the splash screen page.
the issue was weirdly resolved by changing the app that main runs to a builder with a material app (and not directly material app) and set the value there instead of the splash screen.
if anyone has any clue as to why this occurred, I would be grateful to know.


text:
Q: Transformed Primitives - Compute the inverse of a matrix without using any function Let's say if I need to transform a cylinder, first I need to use a scaling matrix (sx, sy, sz) and multiply it with a translation matrix (tx, ty, tz) to form a new matrix that combined by these two matrix. => M = T*S.
Then I want to compute the inverse of a matrix M^-1 without using any function, I know that the inverse of a scaling matrix has a scale factors (1/sx, 1/sy, 1/sz) and a inverse of a translation matrix has (-tx, -ty, -tz), but how can I get M^-1 without any function in C++ ?

A: Suppose you want to scale a vector by some factors Sx, Sy, and Sz. The transformation matrix for this looks like:
Sx 0  0  0
0  Sy 0  0
0  0  Sz 0
0  0  0  1

Then, you want to translate the vector by some factors Tx, Ty, and Tz. The transformation matrix for this now looks like:
Sx 0  0  Tx
0  Sy 0  Ty
0  0  Sz Tz
0  0  0  1

The inverse of this matrix specifically is
1/Sx 0    0    -Tx/Sx
0    1/Sy 0    -Ty/Sy
0    0    1/Sz -Tz/Sz
0    0    0     1

.. as long as Sx, Sy, and Sz are all != 0.
Depending on your application, you may be better off writing a general purpose matrix inversion method. Note that there are cases in which a transformation (or any) matrix is not invertible... like if your scaling factor in one or more of the dimensions is 0. More generally, a matrix is invertible if and only if its determinant is nonzero.


text:
Q: Automate the SQL Server backup in C# I am writing a Windows Forms application to backup my SQL Server databases. I am using the following code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace SQL_Server_DB_Backup_and_Restore
{
    public partial class Form1 : Form
    {
        private SqlConnection conn;
        private SqlCommand command;
        private SqlDataReader reader;
        string sql = "";
        string connectionString = "";

        public Form1()
        {
            InitializeComponent();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            if(dlg.ShowDialog()==DialogResult.OK)
            {
                txtBackupFileLocation.Text = dlg.SelectedPath;
            }
        }

        private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                connectionString = "Data Source= " + txtDataSource.Text + "; User Id=" + txtUserId.Text + "; Password=" + txtPassword.Text + "";
                conn = new SqlConnection(connectionString);
                conn.Open();
                //sql = "EXEC sp_databases";
                sql = "SELECT * FROM sys.databases d WHERE d.database_id>4";
                command = new SqlCommand(sql, conn);
                reader = command.ExecuteReader();
                cmbDatabases.Items.Clear();

                while(reader.Read())
                {
                    cmbDatabases.Items.Add(reader[0].ToString());
                }

                txtDataSource.Enabled = false;
                txtUserId.Enabled = false;
                txtPassword.Enabled = false;
                btnConnect.Enabled = false;
                btnDisconnect.Enabled = true;

                btnBackup.Enabled = true;
                btnRestore.Enabled = true;
                cmbDatabases.Enabled = true;
            }

            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void btnDisconnect_Click(object sender, EventArgs e)
        {
            txtDataSource.Enabled = true;
            txtUserId.Enabled = true;
            txtPassword.Enabled = true;
            cmbDatabases.Enabled = false;
            btnBackup.Enabled = false;
            btnRestore.Enabled = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            btnDisconnect.Enabled = false;
            cmbDatabases.Enabled = false;
            btnBackup.Enabled = false;
            btnRestore.Enabled = false;
        }

        private void btnBackup_Click(object sender, EventArgs e)
        {
            try
            {
                if(cmbDatabases.Text.CompareTo("")==0)
                {
                    MessageBox.Show("Please select a database");
                    return;
                }
                conn = new SqlConnection(connectionString);
                conn.Open();
                sql = "BACKUP DATABASE " + cmbDatabases.Text + " TO DISK = '" + txtBackupFileLocation.Text + "\\" + cmbDatabases.Text + "-" + DateTime.Now.Ticks.ToString() + ".bak'";
                command = new SqlCommand(sql, conn);
                command.ExecuteNonQuery();
                MessageBox.Show("Database backup is completed successfully");
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }

Right now I have to press a button to take backup. How can I automate the process so that my application may take the backup weekly?

A: MS SQL Server has a functionality to automate/scheduled your database backup.  On your Object Explorer.  Go to
Management --> Maintenance Plan - > New Maintenance Plan
    and on Maintenance Plan Tasks drag Back up Database Task.
    And click the calendar icon above to set the time of backup.  This is for SQL Server 2008 above.


text:
Q: Are there advantages to only use stored procedures to access a database with merge replication? I have a project where SPs are the only way that the application uses to access or modify the Sql Server 2008 DB.
I have developers asking to abandon the SP only approach and let them use Linq to Sql on the DB directly. I have to decide if to allow this or not.
I have to add another piece of information, the project is growing and in the near future we might need a second Sql server machine with merge replication.
I said this because I believed (but I don't find any support to this on the Internet now) that having a SP only approach it's beneficial in a merge replication scenario as this will avoid conflicts and result in a better performance.
Is there any truth to this statement? Could you link to the reference that proves or disproves this statement? What's your opinion?
This has come down to be the decisive factor to make the decision.

A: I don't think Stored Procedures or any other method of changing the data is really a factor in Merge Replication as making an update doesn't directly trigger the change to be pushed down into the distribution database.
For example, if you edit a row via a stored procedure or via Linq to Sql, the change tracking, merging and publishing is the same.
There is a question about the potential for concurrency issues, and the advice is to test for this scenario.
If you are using Linq to SQL you need to make sure you understand when a statement will be executed - this is not specific to Merge Replication.
My final point is to take care of developers who want change for the sake of change. What benefit will Linq to SQL bring to your specific application? What other data access solutions have you looked at before you chose Linq to SQL.
Just because Linq to SQL is great for some applications, it doesn't mean it is perfect for every application and this is what I think should be influencing your decision.
Personally, in your case I would keep stored procedures until you have fully isolated your data access - that is a more important task at this stage.


text:
Q: Oracle Analytic Rolling Percentile Is it possible to use windowing with any of the percentile functions? Or do you know a work around to get a rolling percentile value?
It is easy with a moving average:
select avg(foo) over (order by foo_date rows
                      between 20 preceding and 1 preceding) foo_avg_ma
from foo_tab

But I can't figure out how to get the median (50% percentile) over the same window.

A: You can use PERCENTILE_CONT or PERCENTILE_DISC  function to find the median.

PERCENTILE_CONT is an inverse distribution function that assumes a
  continuous distribution model. It takes a percentile value and a sort
  specification, and returns an interpolated value that would fall into
  that percentile value with respect to the sort specification. Nulls
  are ignored in the calculation.

...

PERCENTILE_DISC is an inverse distribution function that assumes a
  discrete distribution model. It takes a percentile value and a sort
  specification and returns an element from the set. Nulls are ignored
  in the calculation.

...

The following example computes the median salary in each department:
SELECT department_id,
       PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY salary DESC) "Median cont",
       PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY salary DESC) "Median disc"
  FROM employees
  GROUP BY department_id
  ORDER BY department_id;

...

PERCENTILE_CONT and PERCENTILE_DISC may return different results.
  PERCENTILE_CONT returns a computed result after doing linear
  interpolation. PERCENTILE_DISC simply returns a value from the set of
  values that are aggregated over. When the percentile value is 0.5, as
  in this example, PERCENTILE_CONT returns the average of the two middle
  values for groups with even number of elements, whereas
  PERCENTILE_DISC returns the value of the first one among the two
  middle values. For aggregate groups with an odd number of elements,
  both functions return the value of the middle element.

a SAMPLE with windowing simulation trough range self-join
with sample_data as (
        select /*+materialize*/ora_hash(owner) as table_key,object_name,
            row_number() over (partition by owner order by object_name) as median_order,
            row_number() over (partition by owner order by dbms_random.value) as any_window_sort_criteria
        from dba_objects
    )
select table_key,x.any_window_sort_criteria,x.median_order,
    PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY y.median_order DESC) as rolling_median,
    listagg(to_char(y.median_order), ',' )WITHIN GROUP (ORDER BY y.median_order) as elements
from sample_data x
    join sample_data y using (table_key)
where y.any_window_sort_criteria between x.any_window_sort_criteria-3 and x.any_window_sort_criteria+3
group by table_key,x.any_window_sort_criteria,x.median_order
order by table_key, any_window_sort_criteria
/


text:
Q: Remove vertical space between two includegraphics, without random negative vspaces everyone.
I've lost hours on this dumb problem: if I write something like this
\includegraphics{img}\\*
\includegraphics{img}

a noticeable vertical space appears between the two images when I'm using documentclass "report" or "article". However, with the "minimal" class, this space disappears, so I thought there was some weird length defining this. I tried setting lots of lengths to zero, but with no luck so far.
There exist lots of questions of this type already, but most of theme deal with using figures, centering commands and such. I'm actually using a center environment in my real document, but removing it did not solve the problem. Furthermore, I think resorting to a negative vspace to solve such problems is a bit dirty: if its length were set incorrectly, the images might overlap, and I would not want to lose a single pixel, especially because it would be very surprising if there were no other way to solve this.
Here's an almost minimal working example, with lots of random setlengths that did not solve the problem:
\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[demo]{graphicx}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\setlength{\textfloatsep}{0pt}
\setlength{\dbltextfloatsep}{0pt}
\setlength{\fboxsep}{0pt}
\setlength{\baselineskip}{0pt}
\setlength{\tabcolsep}{0pt}

\begin{document}

\includegraphics{img}\\*
\includegraphics{img}

\end{document}

Changing the class to "minimal" turns the vertical space into an almost unnoticeable paler line, which is a bit better, but of course I cannot use "minimal" for my real documents…
This might actually have something to do with the depth of the box created by includegraphics (I already noticed that rotations, with angle = 90orsomething, sometimes do weird things with the depth; even the documentation says so), but this command does not appear to have a "depth =" key.
Actually, the ultimate goal is to append four images:
AB
CD

with absolutely no space between them, and keeping them on the same page. I thought it would be a piece of pie, but it seems I'm even more a noob than I thought.
You're my last hope of not resorting to Bash and stuff (I like Bash, but it would be better to handle this with LaTeX alone); I might end up using:
$ convert \( IMG_1 IMG_2 +append \) \( IMG_3 IMG_4 +append \) -append OUTPUT

(At least this issue allowed me to learn cool stuff about convert…)
Thanks.

A: The space you see is produced by \lineskip, which by default is 1pt (but in the minimal class is 0pt). Since most likely your images are higher than the baseline skip, the parameter will be used by the line breaking and boxing mechanism.
See https://tex.stackexchange.com/a/96944/4427 for more information about \lineskip and when it comes into action.
You can set it to zero for the particular environment; I used figure, you can also use center, if you like.
\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htp]
\setlength{\lineskip}{0pt}
\centering

\includegraphics[width=4cm]{example-image}%
\includegraphics[width=4cm]{example-image-a}\\
\includegraphics[width=4cm]{example-image-b}%
\includegraphics[width=4cm]{example-image-c}

\caption{Some caption}

\end{figure}

\end{document}

A "safer" solution, as the setting to \lineskip may have adverse effects on the caption if it has unusually big objects:
\documentclass{article}
\usepackage{graphicx}

\newenvironment{noverticalspace}
 {%
  \par % ensure we're in vertical mode
  \offinterlineskip % don't do the baselineskip calculations
 }
 {\par}% be sure to finish up

\begin{document}

\begin{figure}[htp]
\centering

\begin{noverticalspace}
\includegraphics[width=4cm]{example-image}%
\includegraphics[width=4cm]{example-image-a}\\
\includegraphics[width=4cm]{example-image-b}%
\includegraphics[width=4cm]{example-image-c}
\end{noverticalspace}

\caption{Some caption}

\end{figure}

\end{document}


text:
Q: Swift - Issue with using webviews when launch screen images are used instead of launch screen file I'm working on a iOS project and this one issue is bugging me for days. I have a simple webview wrapper in my application and the issue that I'm having is that if I use launch screen images and not the launch screen file the webview content gets badly scaled. I cannot relate why the launch screen images should have any impact on the webview that is being presented later. My goal IS to use the launch screen images.
This is mostly noticeable on iPhone 6 and iPhone 6 plus.
Example with launch screen images:

Example with launch screen storyboard:

Any advice is appreciated. Thank you.

A: This issue is because of the missing launch image for iPhone 6 and iPhone 6 plus. Make sure that you have added all the launch screen images.


text:
Q: .htaccess RewriteCond where URI does not contain domain I have looked around on Google and StackOverflow for the answer to this question, but the fact that I don't know much about .htaccess doesn't help me decide what the correct answers for my situation are, so I am asking here.
My situation is that I have several sites that are using the same physical directory as their root on the server.
This is all working fine but I wanted to make sure that each site can't access each others images etc from the browser unless they are on the correct domain.
Currently I have a file structure like this:
/resources/{resource}/{full_domain_name}

So for example www.domain.co.uk would have a structure like this:
http://www.domain.co.uk/resources/images/www.domain.co.uk/some_image.jpg

But if www.domain_2.co.uk exists using the same physical directory for the site root then they can look at other domain's resources from their own domain, like this:
http://www.domain_2.co.uk/resources/images/www.domain.co.uk/some_image.jpg

This isn't really a major problem since there is absolutely no sensitive information stored in these directories, but it's more of an annoyance and I would rather users were not able to do it (not that anyone actually has so far).
I tried putting a .htaccess file into the /resources directory but I'm stuck with the regular expressions etc.
I basically want to make sure that the URI contains the current domain name otherwise redirect to a 403 error page.
This is what I came up with:
RewriteCond %{REQUEST_URI} !^(/resources/[^/]*/%{HTTP_HOST})(.*)$
RewriteRule ^(.*)$ /error/403.php

The reason I put in the [^/] bit is because there are several folders, for example:
/resources/images/{full_domain_name}
/resources/scripts/{full_domain_name}
/resources/stylesheets/{full_domain_name}

Could anybody help me with these conditions?
Any help would be appreciated.

A: This condition is insufficient:
RewriteCond %{REQUEUST_URI} !^(/resources/[^/]*/%{HTTP_HOST})(.*)$

Because if I request anything that doesn't start with /resources/, I'll get the 403.php error page. What you really want is something like this:
RewriteCond %{REQUEST_URI} ^/resources/[^/]+/([^/]+)/
RewriteCond %{HTTP_HOST} !%1

Or
RewriteCond %{REQUEST_URI} ^/resources/[^/]+/([^/]+)/
RewriteCond %{REQUEST_URI} !^/resources/[^/]+/%{HTTP_HOST}/

Where the first condition is checking that the request is for a resource, then the second checking the host. HOWEVER, neither of these will work because mod_rewrite's RewriteCond directive doesn't allow % variables or backreferences in the right hand side of the condition, only the left. Likewise, you cannot do this either:
RewriteCond %{REQUEST_URI} ^/resources/[^/]+/([^/]+)/
RewriteRule !^/resources/[^/]+/%{HTTP_HOST}/ /error/403.php

Because the RewriteRule's expression cannot have variables in it, since it's a regex, and it literally expects a %{HTTP_HOST} instead of replacing it with the Host given in the request. So to conclude, no, you can't do this with mod_rewrite's conditions this way.
Something that you can try if you have access to either server config or vhost config is to create a RewriteMap and pass in both the %{REQUEST_URI} and %{HTTP_HOST}. So if your map is called check_host then your rule may look something like this:
RewriteRule ^resources/[^/]+/([^/]+)/ ${check_host:%{HTTP_HOST}_%{REQUEST_URI}}

And your script will just need to parse the input, split it from the first _, parse the request URI and make sure the host is the same as the HTTP_HOST. If it's the same, output the same request URI, otherwise output the error URI. If you don't have access to server or vhost config, I think you're out of luck. RewriteMap cannot be defined in the htaccess file.

A: This is terrific question and if I could I would have upvoted 10+ times. I am posting my answer even though you have an accepted answer here as I really had to dig through all my Apache resources to come up with the answer. Here is the rule you will need for this problem:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST}:%{REQUEST_URI} !^([^:]+):/resources/[^/]+/\1/.+ [NC]
RewriteRule ^resources/[^/]+/[^/]+/.+ - [F,NC,NE]

PS: Since we cannot use % variables on RHS as back-reference, I am using special regex back-reference variable \1 in the RewriteCond here.


text:
Q: java.lang.NoSuchMethodError on using org.json.JSONTokener for schema validation failing when running junit test case I have added the code new JSONObject(new JSONTokener(EsimActivationProcessor.class.getResourceAsStream)) to validate the input json request against the json schema. The validation on server and normal running. On testing the same class using junit I'm getting  java.lang.NoSuchMethodError: org.json.JSONTokener.<init>(Ljava/io/InputStream;)V error.
I have added the following jar:
<dependency>
    <groupId>org.everit.json</groupId>
    <artifactId>org.everit.json.schema</artifactId>
    <version>1.3.0</version>
</dependency>

I have tried removing conflicting methods in the jar springboot-test jar:
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
        <exclusion>
            <groupId>com.vaadin.external.google</groupId>
            <artifactId>android-json</artifactId>
        </exclusion>
    </exclusions>
</dependency>

A: EDIT 1:
I have used github-fge json-schema-validator which is working in both application run as well as using the test case as well.
The dependency:
<dependency>
    <groupId>com.github.fge</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>2.2.6</version>
</dependency>

Code snippet:
JsonNode node = JsonLoader.fromString(builder.toString());
JsonNode data = JsonLoader.fromString(serviceCreateJson.trim());
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
JsonSchema sch = factory.getJsonSchema(node);
ProcessingReport report = sch.validate(data);
boolean isSuccess = report.isSuccess();


text:
Q: checking if a method is defined on the class How do I check if a method is defined on some class directly, not by inheritance or by inclusion/extension? I want something like 'foo?' in the following:
class A
   def a; end
end

module B
   def b; end
end

class C < A
   include B
   def c; end
end

C.foo?(:a) #=> false
C.foo?(:b) #=> false
C.foo?(:c) #=> true

A: Use this:
C.instance_methods(false).include?(:a)
C.instance_methods(false).include?(:b)
C.instance_methods(false).include?(:c)

The method instance_methods return an Array of methods that an instance of this class would have. Passing false as first parameter returns only methods of this class, not methods of super classes.
So C.instance_methods(false) returns the list of methods defined by C.
Then you just have to check if that method is in the returned Array (this is what the include? calls do).
See docs

A: For objects you can use Object.respond_to?.

Returns true if obj responds to the given method.

For classes take a look at Module.instance_methods

Returns an array containing the names of the public and protected instance methods in the receiver.

A: Not exactly an answer to the question, but if you're reading this question, you might be interested in this, which uses .instance_methods(false)
class Object
  # This is more or less how Ruby does method lookup internally
  def who_responds_to?(method, klass_ancestors = nil)
    if klass_ancestors.nil?
      return who_responds_to?(method, self.class.ancestors)
    end

    if klass_ancestors.empty?
      return nil
    end

    if klass_ancestors[0].instance_methods(false).include?(method)
      return klass_ancestors[0]
    end

    klass_ancestors.shift

    who_responds_to?(method, klass_ancestors)
  end
end

For example
class Person
end

module Drummer
  def drum
  end
end

module Snowboarder
  def jump
  end
end

module Engineer
  def code
  end
end

class Bob < Person
  include Drummer
  include Snowboarder
  include Engineer

  def name
  end
end

puts "who responds to name"
puts bob.who_responds_to?(:name)
puts "\n"

puts "who responds to code"
puts bob.who_responds_to?(:code)
puts "\n"

puts "who responds to jump"
puts bob.who_responds_to?(:jump)
puts "\n"

puts "who responds to drum"
puts bob.who_responds_to?(:drum)
puts "\n"

puts "who responds to dance"
puts bob.who_responds_to?(:dance)

yields
who responds to name
Bob

who responds to code
Engineer

who responds to jump
Snowboarder

who responds to drum
Drummer

who responds to dance
[this line intentionally blank because return value is nil]


text:
Q: How can I change an image source on hover in CSS?

Walnut MagSafe Stand

$120

Walnut Laptop Riser

$150

Walnut iPad Stand

$80

Walnut Monitor Stand

$100

CSS
    .row {
  width: 100%;
  margin: 50px 0 50px 0;
}
.column {
  float: left;
  width: 25%;
  height: 434px;
}

.column p {
  font-family: "Roboto", sans-serif;
  font-family: "Roboto Condensed", sans-serif;
  font-family: "Source Sans Pro", sans-serif;
  font-weight: 400;
  line-height: 21px;
  font-size: 14px;
  letter-spacing: 0.7px;
  text-align: center;
  color: #a0a0a0;
}

.column1:hover {
  background: url(products/walnut-magsafe-stand-hover.jpg);
}

Hello everyone on the Internet or on the stackoverflow.
I'm new in web development and  I'm cloning some websites on the internet.
Now I need to create an image than when I hover on this image should be changed.
I tried something like this(
.column1:hover {
  background: url(products/walnut-magsafe-stand-hover.jpg);
}

) but it doesn't work.
So guys what do I need to do now? Can you solve this problem???

A: A simple static implementation.

  a {
      background: url("https://i.stack.imgur.com/gROnM.jpg");
      background-repeat: no-repeat;
      background-size: contain;
      width: 200px;
      display: flex;
      height: 200px;;
    }

    a:hover {
      background: url("https://i.stack.imgur.com/hMQdU.jpg");
      background-repeat: no-repeat;
      background-size: contain;
    }
<!DOCTYPE html>

  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" />

A: As provided by Authentic Science, img src and background are not the same. When you are trying to do

.column1:hover { background: url(products/walnut-magsafe-stand-hover.jpg); }

You are only changing the background of the img not the img src tag.
If you do not want to initially set the background of the column to the first image you wish to use and then use a hover effect, you will need to use JavaScript. This can be done by changing your classes for each "column#" into ids and inserting this JavaScript code by creating a script.js in your source folder
If you wish to use this solution you will need to duplicate the code for each column and rename them accordingly. This can all be done in one file.
// Define your variables for column1 img
let col1 = document.getElementById('column1');
let col1OriginalSource = 'phone.png';
let col1NewSource = 'phone2.png';

// Event fires when mouse enters
// Changes the value to your stored change src reference above
col1.addEventListener('mouseenter', function (event) {
  event.target.src = col1NewSource;
});

// Event fires when mouse leaves
// Resets the value back to the stored src reference above
col1.addEventListener('mouseleave', function (event) {
  event.target.src = col1OriginalSource;
});

The reason for storing the source references as a variable is to allow for easy modification in the future. This will put each of your src references in one spot and you will only need to change that one string to update your src. You can also initially set the value of the img src using JavaScript and completely remove the inline HTML tag to make it a complete dynamic reference.
Your HTML5 / index.html file should look like this

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="main.css" />

    <title>Document</title>

Walnut MagSafe Stand

$120

Walnut Laptop Riser

$150

Walnut iPad Stand

$80

Walnut Monitor Stand

$100

You can read the documentation for both event listeners here:
For mouseenter click here
For mouseleave click here


text:
Q: Column name in SELECTCOLUMNS () I'm new into DAX and with trial/error and this formum came to the query below.
It works fine
I would like to do one optimization, adjust the column headers presented
I tried many options and keep running into errors
Can someone please advise what needs to be adjusted in order to adjust the name of the first column into EXAMPLE
DEFINE VAR __DS0Core =
  SELECTCOLUMNS(
    KEEPFILTERS(
      FILTER(
        KEEPFILTERS(
          SUMMARIZECOLUMNS(
            'Vessel Historic'[Vessel Historic Commercial Manager],
            'Vessel Grouping'[Vessel Grouping Name],
            'Operations Contract'[TC Code],
            'Operations Contract Fact'[From GMT Date Time],
            'Operations Contract Fact'[To GMT Date Time],
            'Operations Contract'[Charterer],
            'Operations Contract'[Currency],
            'Operations Contract'[Proj Act Redel GMT Date],
            'Operations Contract'[Redelivery Date],
            'Operations Contract'[Hire Rate],
            "CountRowsOperations_Contract_Fact", CALCULATE(COUNTROWS('Operations Contract Fact'))
          )
        ),
        AND(
                'Vessel Historic'[Vessel Historic Commercial Manager]="V06 Iver Ships B.V.",
        'Operations Contract Fact'[To GMT Date Time]>TODAY()-30)
      )
    ),
    "'Vessel Historic'[Vessel Historic Commercial Manager]", 'Vessel Historic'[Vessel Historic Commercial Manager],
    "'Vessel Grouping'[Vessel Grouping Name]", 'Vessel Grouping'[Vessel Grouping Name],
    "'Operations Contract'[TC Code]", 'Operations Contract'[TC Code],
    "'Operations Contract Fact'[From GMT Date Time]", 'Operations Contract Fact'[From GMT Date Time],
    "'Operations Contract Fact'[To GMT Date Time]", 'Operations Contract Fact'[To GMT Date Time],
    "'Operations Contract'[Charterer]", 'Operations Contract'[Charterer],
    "'Operations Contract'[Currency]", 'Operations Contract'[Currency],
    "'Operations Contract'[Proj Act Redel GMT Date]", 'Operations Contract'[Proj Act Redel GMT Date],
    "'Operations Contract'[Redelivery Date]", 'Operations Contract'[Redelivery Date],
    "'Operations Contract'[Hire Rate]", 'Operations Contract'[Hire Rate]
  )

EVALUATE
  __DS0Core

ORDER BY
  'Vessel Historic'[Vessel Historic Commercial Manager],
  'Vessel Grouping'[Vessel Grouping Name],
  'Operations Contract'[TC Code],
  'Operations Contract Fact'[From GMT Date Time],
  'Operations Contract Fact'[To GMT Date Time],
  'Operations Contract'[Charterer],
  'Operations Contract'[Currency],
  'Operations Contract'[Proj Act Redel GMT Date],
  'Operations Contract'[Redelivery Date],
  'Operations Contract'[Hire Rate]

I would like the first column to show EXAMPLE
I tried adjusting the first line after SUMMARIZECOLUMNS
I tried adjusting the first line after the AND statement


text:
Q: Start Fragment from another -> might have started the wrong way my app? I have started building an application but I think I'm might be doing something wrong in the main structure.  My application is 3 fragments, communicating with each other.  The first fragment is about settings, the second one is an exandable array list.  The third is a Gmap.
Clicking on a specific setting in the first fragment (that is a location)  would make the gmap opens at the good spot... Same thing for child item in the second fragment.
I also would like to have a thread that update the current location of all fragments.
The this is, I don't know how I should structure my app.  Is it good to have 3 fragments, should I use 3 activities?  And how the communication should be made within fragments?  I read that fragments should not communicate directly together, but in my case I don't see how the child of an exandable array list can not directly open the fragment containing GMap...
Here is a picture, just to figure out what my app would look like:
http://s14.postimg.org/ywj7yu8qp/Untitled.png
Here's the code so far:
MainActivity:
package com.stylingandroid.basicactionbar;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity
{
    private class MyTabListener implements ActionBar.TabListener
    {
        private Fragment mFragment;
        private final Activity mActivity;
        private final String mFragName;

        public MyTabListener( Activity activity, String fragName )
        {
            mActivity = activity;
            mFragName = fragName;
        }

        @Override
        public void onTabReselected( Tab tab, FragmentTransaction ft )
        {
            // TODO Auto-generated method stub

        }

        @Override
        public void onTabSelected( Tab tab, FragmentTransaction ft )
        {
            mFragment = Fragment.instantiate( mActivity, mFragName );
            ft.add( android.R.id.content, mFragment );
        }

        @Override
        public void onTabUnselected( Tab tab, FragmentTransaction ft )
        {
            ft.remove( mFragment );
            mFragment = null;
        }
    }

    @Override
    public void onCreate( Bundle savedInstanceState )
    {
        super.onCreate( savedInstanceState );
//      Intent intent;

        ActionBar ab = getActionBar();
        ab.setNavigationMode( ActionBar.NAVIGATION_MODE_TABS );

        Tab tab = ab.newTab()
                .setText( R.string.title_param )
                .setTabListener(
                        new MyTabListener( this,
                                Param.class.getName() ) );
        ab.addTab( tab );

//      intent = new Intent().setClass(this, Friends.class);
        tab = ab.newTab()
                .setText( R.string.title_friends )

                .setTabListener(
                        new MyTabListener( this,
                                Friends.class.getName() ) );
        ab.addTab( tab );

        tab = ab.newTab()
                .setText( R.string.title_maps )
                .setTabListener(
                        new MyTabListener( this,
                                Maps.class.getName() ) );
        ab.addTab( tab );
    }

    @Override
    public boolean onCreateOptionsMenu( Menu menu )
    {
        getMenuInflater().inflate( R.menu.main, menu );
        return true;
    }

    @Override
    public boolean onOptionsItemSelected( MenuItem item )
    {
        boolean ret;
        if (item.getItemId() == R.id.menu_settings)
        {
            // Handle Settings
            ret = true;
        } else
        {
            ret = super.onOptionsItemSelected( item );
        }
        return ret;
    }
}

Tab1:
package com.stylingandroid.basicactionbar;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import android.app.Fragment;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class Param extends Fragment
{

    Button btnShowLocation;
    private View V;
    TextView text;
    public static double latitude;
    public static double longitude;

    // GPSTracker class
    GPSTracker gps;
    @Override
    public View onCreateView( LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState )
    {
        V = inflater.inflate( R.layout.param, container, false );

        gps = new GPSTracker(getActivity());
        if(gps.canGetLocation()){
            text = (TextView) V.findViewById(R.id.widget35);

                latitude = gps.getLatitude();
                longitude = gps.getLongitude();
                    String cityName=null;
                    Geocoder gcd = new Geocoder(getActivity(), Locale.getDefault());
                    List<Address>  addresses;
                try {
                     addresses = gcd.getFromLocation(latitude, longitude, 1);
                     if (addresses.size() > 0)
                      System.out.println(addresses.get(0).getLocality());
                     cityName=addresses.get(0).getLocality();

                    } catch (IOException e) {
                     e.printStackTrace();
                    }
                // create class object

                // check if GPS enabled
                    text.setText(cityName);

                }else{
                    // can't get location
                    // GPS or Network is not enabled
                    // Ask user to enable GPS/network in settings
                    gps.showSettingsAlert();
                }

        return V;
    }
}

Tab2:
package com.stylingandroid.basicactionbar;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.Toast;

public class Friends extends Fragment implements OnChildClickListener
{
    private static List<Country> Countries;
    private ExpandableListView expandableListView;
    private CountryAdapter adapter;
    private View V;

    @Override
    public View onCreateView( LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState )
    {
       V = inflater.inflate( R.layout.frag2, container, false );
        expandableListView = (ExpandableListView) V.findViewById(R.id.expandableListView);
        expandableListView.setOnChildClickListener(this);
        LoadCountries();

        return V;
    }

    private void LoadCountries() {
        Countries = new ArrayList<Country>();

        ArrayList<String> citiesAustralia = new ArrayList<String>(
                Arrays.asList("Brisbanea", "Hobart", "Melbourne", "Sydney"));
        Countries.add(new Country("Australia", citiesAustralia));

        ArrayList<String> citiesChina = new ArrayList<String>(
                Arrays.asList("Beijing", "Chuzhou", "Dongguan", "Shangzhou"));
        Countries.add(new Country("China", citiesChina));
        adapter = new CountryAdapter(getActivity(), Countries);
        expandableListView.setAdapter(adapter);

       }

    @Override
    public boolean onChildClick(ExpandableListView arg0, View arg1, int arg2,
            int arg3, long arg4) {

/*      Fragment param = new Param();
        android.app.FragmentTransaction ft  = getFragmentManager().beginTransaction();
        ft.replace(R.id.frag2, param);
        ft.addToBackStack(null);
        ft.commit();

        */
        Toast.makeText(getActivity(), "Clicked on Detail " , Toast.LENGTH_LONG).show();
        return true;
    }

}

Tab3:
package com.stylingandroid.basicactionbar;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class Maps extends Fragment
{
    static final LatLng HAMBURG = new LatLng(Param.latitude, Param.longitude);
    static final LatLng KIEL = new LatLng(53.551, 9.993);
    private GoogleMap map;
    View V;
    @Override
    public View onCreateView( LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState )
    {
        V = inflater.inflate( R.layout.frag1, container, false );

        map = ((MapFragment) getActivity().getFragmentManager().findFragmentById(R.id.map))
                .getMap();

            Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
                    .title("Hamburg"));

            // Move the camera instantly to hamburg with a zoom of 15.
            map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));

            // Zoom in, animating the camera.
            map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);

            GoogleMap gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

            gMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            gMap.setMyLocationEnabled(true);
            gMap.getUiSettings().setCompassEnabled(true);
            Log.e("Maps", "------EOC-------");

            return V;

          }

    }

param.xml (tab1):
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
    android:id="@+id/widget0"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
<ToggleButton
    android:id="@+id/widget33"
    android:layout_width="125dp"
    android:layout_height="59dp"
    android:textOn="I'm free!"
    android:textOff="I'm free!"
    android:layout_x="78dp"
    android:layout_y="29dp" />
<TextView
    android:id="@+id/widget34"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Lieu actuel"
    android:layout_x="87dp"
    android:layout_y="196dp" />
<TextView
    android:id="@+id/widget35"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Indisponible"
    android:layout_x="101dp"
    android:layout_y="247dp" />
<TextView
    android:id="@+id/widget36"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="GPS"
    android:layout_x="89dp"
    android:layout_y="108dp" />
<ToggleButton
    android:id="@+id/widget37"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textOn="On"
    android:textOff="Off"
    android:layout_x="158dp"
    android:layout_y="99dp" />

</AbsoluteLayout>

frag2.xml (tab2):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">
    <ExpandableListView
            android:id="@+id/expandableListView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
</LinearLayout>

frag1.xml (tab3):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.MapFragment" />

</RelativeLayout>

Here are only the principal fragments, I can also provide the full code of all classes if needed...
Questions:
Is it okay of what I began to do about how fragments work?  Should I instead use activities? Is it okay how I proceeded to create fragment? Do I respect programming standard?
How to communicate from fragments to another?  I use global variables so when something is updated, gmap (tab3) is also updated, but I don't see how to open the gmap fragment on a click.
The gmap is making the app crashing when I click two times on the gmap tab...?
Thanks a lot guys.

A: You can use all the fragments you want :)
I think the best way i to make an abstract Class to save and handle all you data and events.
In an abstract Class declare the method Static so you can call them directly on the Class.


text:
Q: error: expected expression before ')' token in function } else(){ I've look everywhere online, I'm completely lost and starting to really get pissed off. Nothing I see anywhere has anything to do with the error I'm seeing, it's as if the whole world has this problem, but a completely different solution. It's frustrating to hell and back because none of the fixes I've seen anywhere seem to even be related to my problem. Here is my code, I pray someone may help me...
#include<stdio.h>
#include<stdlib.h>

int count = 0;
int state = 1;
int copy = getchar();

int main() {
     if (state != 0){

        while (copy != EOF)
           count++;

        state = 0;
    } else(){
         printf("The function has finished, your name has %d characters", count);
         count = 0;
         state = 1;
     }
 }

Ignore the placement of brackets in terms of depth, I must be a damn fool because no matter what I did (```, or ''', or ctrl k, etc) I couldn't get the freaking code to indent more than one line, so I literally went through and added 5 spaces to each. I hope I did it decently, I hope someone can explain to me what it is I'm not seeing...

A: There's a lot that's gone sideways in this code, but it's easily fixed:
#include <stdio.h>
#include <stdlib.h>

// Avoid using global variables

int main() {
  int count = 0;

  // Always use { ... } around your blocks to avoid ambiguity, even for
  // simple one-liners like this.
  while (getchar() != EOF) {
    count++;
  }

  // Don't forget \n to add a newline
  printf("The function has finished, your name has %d characters\n", count);

  // Return 0 from main() to be polite
  return 0;
}

That if (state != 0) will only ever fire the first branch, there's never a chance to visit that line again, so your program just finishes without printing. I've removed that here. Remember if is a test that happens in an instant, as the program works through that section, not something that's a persistent test that will trigger if/when the variable changes.
One thing to keep in mind is that in C when you assign to a variable that's an operation that copies a value from the right-hand-side (RHS) to the left-hand-side (LHS). In other words:
int x = 1;
int y = x;

x = x + 1;
printf("x=%d, y=%d\n", x, y);

This prints x=2, y=1. Saying y = x is not like it is in math where you're stating some kind of equivalence. This is purely an assignment. It's an instruction (machine instruction, quite literally) to copy x to y, where x and y are separate "objects"1.

1 C term roughly describing values which can be, but are not always stored in memory. Sometimes they're kept in registers instead. Technical version: "An object is a region of data storage in the execution environment, the contents of which can represent values".


text:
Q: Please explain the ouput #include <stdio.h>

int main() {
    int a[4] = {1, 2, 3, 4};
    int b[4] = {1, 2, 3, 4};
    int n = &b[3] - &a[2];
    printf("%d\n", n);
}

The output of this question is -3, can anyone explain how is this coming?

A: Subtracting "unrelated" pointers, i.e. pointers pointing in different objects is undefined.
C11-6.5.6-9

When two pointers are subtracted, both shall point to elements of the
  same array object, or one past the last element of the array object;

A: &b[3] is a pointer to the 4th element in b, and &a[2] is a pointer to the 3rd element in a. n would then be the space in memory between the memory pointed to by each respective pointer.
I don't know if you can count on the resulting value (-3) being the same for all compilers. The two arrays a and b aren't guaranteed to have any relation to each other in memory.
If you were looking to take the difference between the VALUES of b[3] and a[2], the code would be:
int n = b[3] - a[2];

which should give a result of 1.

A: The output of the code is machine dependent. You are subtracting the addresses of the elements. It may be different each time you execute the program

A: It's normal because you're using the adresses
if you need the result to be 1 than use values like this
int n = b[3] - a[2];


text:
Q: How to assign an array at props of MultiSelect Component in React JS I'm try to assign an array at props "options" of MultiSelect component in React JS, I need a specific format in the array, but the screen is in blank and I get the options.map is not a function as error, the array return success (it's OK), I don´t understand why happen that error.
My code is:
//I get data array

axios({
    method: 'get',
    url: `${URL}/suscripcion`,
    headers: {
        "Authorization": "bearer " + TOKEN
    }
}).then(respuesta => {
    let datos = respuesta.data;

    if (datos.success) {
        this.setState({
            Suscritos: datos.data
        });
        sus = this.state.Suscritos;
    } else {
        console.log("no")
    }
});

//Return array with format

Listarprueba() {
        if (this.state.Suscritos.length > 0) {
            return this.state.Suscritos.map((e, i) =>
            [
                {label: `${e.Email}`, value: `${e.Email}`}
            ]
            );
        }
    }

//Asign array at options

    options = this.Listarprueba();

//This is the MultiSelect Component

Multiselect dropdown

    <Multiselect
        options={this.options}
        onSelectedChanged={this.handleSelectedChanged}
        selected={selected}
        isLoading={isLoading}
        disabled={isLoading}
        disableSearch={false}
        overrideStrings={{
            selectSomeItems: "do me a favor by selecting something",
            allItemsAreSelected: "You have gone nuts... all selected",
            selectAll: "do u wanna select all of them?",
            search: "Fantasy search"
        }}
    />

I get data of the array
and this is the error
I got the example here https://codesandbox.io/s/3k3vjplo5
I think the error is in options props.
options={this.options}

I would like to know how successfully implement the MultiSelect in react js.
Ok, here is all my code of the component:
        import React, { Component, Fragment } from 'react';
        import { injectIntl } from 'react-intl';
        import { Colxx, Separator } from "Components/CustomBootstrap";
        import BreadcrumbContainer from "Components/BreadcrumbContainer";
        import IntlMessages from "Util/IntlMessages";
        import { Row, Card, CardBody, CardTitle, Input, Label, Button, } from "reactstrap";
        import ReactQuill from "react-quill";
        import "react-quill/dist/quill.snow.css";
        import 'react-quill/dist/quill.bubble.css';
        import { Formik, Field, Form } from 'formik';
        import * as Yup from 'yup';
        import axios from 'axios';
        import { URL, TOKEN } from 'Util/Config/Config';
        import SweetAlert from 'sweetalert-react';
        import Multiselect from "@khanacademy/react-multi-select";

        class CrearNotificacion extends Component {

            constructor(props) {
                super(props);
                this.state = {
                    textQuillBubble: "",
                    Suscritos: [],
                    sweetshow: false,
                    sweetTitle: '',
                    sweetText: '',
                    sweetType: '',
                    selected: [],
                    isLoading: true
                };
                this.handleChangeQuillBubble = this.handleChangeQuillBubble.bind(this);
            }

            Notificaciones = {
                Asunto: '',
                Suscripcion: '',
                Notificacion: '',
            }

    handleChangeQuillBubble(textQuillBubble) {
            this.setState({ textQuillBubble });
        }

        componentDidMount() {
            axios({
                method: 'get',
                url: `${URL}/suscripcion`,
                headers: {
                    "Authorization": "bearer " + TOKEN
                }
            }).then(respuesta => {
                let datos = respuesta.data;

                if (datos.success) {
                    this.setState({
                        Suscritos: datos.data
                    });
                    sus = this.state.Suscritos;
                } else {
                    console.log("no")
                }
            });
            setTimeout(() => {
                this.setState({
                    isLoading: false
                });
            }, 5000);
        }

    handleSelectedChanged = selected => {
            this.setState({ selected });
        };

        Guardar(value) {
            axios({
                method: 'post',
                url: `${URL}/notificacion`,
                headers: {
                    "Authorization": "bearer " + TOKEN,
                },
                data: {
                    Asunto: value.Asunto,
                    Suscripcion: value.Email,
                    Notificacion: this.state.textQuillBubble,
                }
            }).then((respuesta) => {
                let datos = respuesta.data;
                if (datos.success) {
                    this.setState({
                        sweetshow: true,
                        sweetText: datos.mensaje,
                        sweetTitle: "Mensaje",
                        sweetType: "success"
                    });
                } else {
                    this.setState({
                        sweetshow: true,
                        sweetText: datos.error,
                        sweetTitle: "Mensaje",
                        sweetType: "error"
                    });
                }
            });
        }

        Cancelar() {
            this.props.history.goBack();
        }

        Listarprueba() {
            if (this.state.Suscritos.length > 0) {
                return this.state.Suscritos.map((e, i) => (
                    { label: `${e.Email}`, value: `${e.Email}` }
                ));
            }
        }

        options = this.Listarprueba();

     render() {
            const { selected, isLoading } = this.state;
            return (
                <Fragment>
                    <Row>
                        <Colxx xxs="12">

{<IntlMessages id="menu.NewNoti" />}

                            <Separator className="mb-5" />
                        </Colxx>
                    </Row>
                    <Row className="mb-4">
                        <Colxx xxs="12">
                            <Card>
                                <CardBody>
                                    <Formik
                                        initialValues={this.Notificaciones}
                                        validationSchema={NotificacionSchema}
                                        onSubmit={value => {
                                            this.Guardar(value);
                                        }}
                                    >
                                        {({ errors, touched, values }) => (

                                                <Form className="av-tooltip tooltip-label-bottom">

                                                        <Field type="text" maxLength="45" name="Asunto" className="form-control" />
                                                        {errors.Asunto && touched.Asunto ? (

{errors.Asunto}

                                                        ) : null}
                                                        <IntlMessages id="forms.asunto" />

                                                    {/* <Field type="hidden" name="Mensaje"/> */}
                                                    <ReactQuill
                                                        theme="bubble"
                                                        value={this.state.textQuillBubble}
                                                        onChange={this.handleChangeQuillBubble}
                                                    />
                                                    {/* {errors.Mensaje && touched.Mensaje ? (

{errors.Mensaje}

                                                    ) : null} */}
                                                    <IntlMessages id="forms.Notificacion" />

Multiselect dropdown

                                                    {console.log(this.state.Suscritos)}
                                                    <Multiselect
                                                        options={this.options}
                                                        onSelectedChanged={this.handleSelectedChanged}
                                                        selected={selected}
                                                        isLoading={isLoading}
                                                        disabled={isLoading}
                                                        disableSearch={false}
                                                        overrideStrings={{
                                                            selectSomeItems: "do me a favor by selecting something",
                                                            allItemsAreSelected: "You have gone nuts... all selected",
                                                            selectAll: "do u wanna select all of them?",
                                                            search: "Fantasy search"
                                                        }}
                                                    />
                                                    {/* {selected.join(", ")} */}

                                                <Button color="primary col-6" type="submit">
                                                    <IntlMessages id="forms.submit" />
                                                </Button>
                                                <Button color="secondary col-6" onClick={() => this.Cancelar()}>
                                                    <IntlMessages id="forms.Cancelar" />
                                                </Button>
                                            </Form>

                                    )}
                                </Formik>
                                <SweetAlert
                                    show={this.state.sweetshow}
                                    title={this.state.sweetTitle}
                                    text={this.state.sweetText}
                                    type={this.state.sweetType}
                                    onConfirm={() => {
                                        this.setState({ sweetshow: false })
                                        this.props.history.push('app/Contacto/Notificaciones/Notificacion')
                                    }}
                                />
                            </CardBody>
                        </Card>
                    </Colxx>
                </Row>
            </Fragment>
        );
    }
}
export default injectIntl(CrearNotificacion);

A: Update this to return an array of objects, not an array of arrays, like so:
Listarprueba = () => {
  if (this.state.Suscritos.length > 0) {
    return this.state.Suscritos.map((e, i) => (
      {label: `${e.Email}`, value: `${e.Email}`}
    ));
  }
}

This returns [{label:'emailstring', value:'emailstring'}, {},{}...];, your original is returning [ [{label:'emailstring', value:'emailstring'}],[{}], [{}], ...].

A: You're doing things async due to the rest call, so it's trying to render before it has data.  Do a check before rendering something that might not have data something like
options={this.options ? this.options : []}

or
if (this.state && this.state.Suscritos && this.state.Suscritos.length > 0) {
...
}


text:
Q: can I sort the order of data being returned from filter function I am using the filter function to filter a subset of data which works perfect.  However, I really need that data to be output in a particular order, in this case based on the value in one of the fields.
if you have the following data set
Name    Qty Flag
Frank   2
Ted     5
Sally   10
Jojo    11
Frank   5
Frank   5435
Frank   124 x

filtered for Frank
=FILTER(A4:B10,A4:A10 ="Frank")

I the desired output and order would look like this  - note that the records with an "x" in flag show up first.
Frank   5435

Frank   5

Frank   2

Frank   124

Any ideas on how to achieve this?

A: try:
=QUERY({
 IFERROR(SORT(FILTER(A:B, A:A="Frank", C:C<>"x"), 2, 0), {"",""});
 IFERROR(SORT(FILTER(A:B, A:A="Frank", C:C ="x"), 2, 0), {"",""})},
 "where Col1 is not null", 0)

A: I think this will also work:
=ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY({A:B,{C1;IF(C2:C="x",9^9,1)}},"select Col1,Col2,Col2/Col3 where Col1='Frank' order by Col2/Col3 desc",1),9^9,2))


text:
Q: Surface Tension - Peculiar behavior of Water Drop and Mercury Drop inside a Conical Tube When a water drop and a mercury drop are taken into two different but same kind of conical tubes, the water drop on its own tends to move towards the narrower end and the mercury drop tends to move towards the wider end, why? Why does this happen? How do we explain this phenomenon?
Following is a question based on the same phenomenon along with the right answer, for the greater understanding of the question.
Kindly help.


text:
Q: Keep Laptop Connected to wifi when closed Is there a way to keep my laptop connected to my home wifi when I close it? I remember being able to do this when I ran Windows, but I can't seem to find a setting for it? It would be helpful for longer downloads.

A: *

*Search for and open Power from the Dash

*Change "When the lid is closed" to "Do nothing"


text:
Q: Display custom field values from posts on frontpage How can I pull a custom field with meta_key "proprty_feature" (and has a value) for all posts and display them on my frontpage? Would like to display the post name as a link above the value..

A: Within your main post loop you would add something like,
get_post_meta($post->ID, 'property_feature', true);

A basic example of what your main loop might look like ( it depends on your theme) to include a title and your custom field.
//start the loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

//add post link and title
<a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

//add your custom meta value
<?php echo get_post_meta($post->ID, 'property_feature', true) ?>

//close loop
<?php endwhile; else: ?>


text:
Q: How do I send a list to Azure Durable Functions I have an architecture with two python functions: listcreator() and activity(). The listcreator() function is triggered by an http trigger and generates a list of strings. I want to pass this list of strings to an orchestrator function and call the activity() function multiple times.
How do I pass this to the orchestrator? Do I also need a starter function as desribed in the microsoft documents? https://learn.microsoft.com/nl-nl/azure/azure-functions/durable/quickstart-python-vscode
An oversimplified version of my code looks like this:
listcreator():
import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse
     mylist=['helo','world']

A: probably the best solution is to use your listcreator() function as Client function (the function you called as starter function). From the listcreator(), you can generate the list and pass it to the orchestrator. Finally from the orchestrator, pass the list to the activity function and run it.
A sketch of code:
# inside the client function call the orchestrato
client = df.DurableOrchestrationClient(starter)
instance_id = await client.start_new("yourorchestrator", None,  [1,2,3,4])

#inside orchestrator
data = context.get_input()
context.call_activity("activity", data)


text:
Q: Animate image sequence on React Native using Animated.timing() Is it possible to animate a sequence of images: image01.png, image02.png, image03.png, etc. using React Native Animated API?
I've tried to use timer for this as it is described here: Animate image sequence on React Native
But on Android animation is too slow and twitchy.
I'm trying to use useNativeDriver property of Animated.timing() method. But seems like it's not a proper way of playing a sequence of images in <Animated.Image/> block.


text:
Q: constant strings in a function - where are they saved? I have :
void func()
{
    char *s;
    strcpy(s,"bla bla");
}

Is "bla bla" stored somewhere? is it considered "const char *" even if I didn't defined it??

A: String literals are nameless array objects, which are stored in static memory, i.e. the same memory that stores global variables. String literals live forever: they exist when the program begins and they persist till the program ends (just like global variables, again).
Note however, that in your code sample it is "blah blah" that's string literal. But your s is just a local variable initialized (by copying data) from string literal. Your s has the same lifetime as any other local variable - it exists as long as the control passes through func.
Note also that string literal in C is not considered const chart *, as you seem to incorrectly believe. The type of "blah blah" in C language is actually char [10]. The array type can decay to pointer type, but even in that case it will be char * and not const char *.

A: "blah blah" is stored on the stack, just like any other automatic variable or array declared inside a function.
The construction
char s[] = "blah blah";

is equivalent to
char s[] = {'b', 'l', 'a', 'h', ' ', 'b', 'l', 'a', 'h', '\0'};

and it initializes the array.
You can treat arrays of chars as char * const, because they behave in nearly the same way as arrays, but technically speaking, an array is an array, and a pointer is a pointer.
This is not, however the same as const char *. char * const means the pointer cannot be modified, const char * means the memory cannot be modified through that pointer.


text:
Q: Spring integration outbound email I want to implement email functionality using spring integration

How to do this ?
I have gone through some links but not useful
sample link
http://java.dzone.com/articles/spring-integration-hands?page=0,3
Please do the needful

A: See the Spring Integration Mail documentation.
Take a look at the test cases for configuration examples.
Also, this sample shows how to do it with the new Java DSL.


text:
Q: How do I position a div directly under a clicked on image? I have a website with social icons listed across the page. When you click on one, I want a window to pop under with more information. Here is a picture of what I want it to look like after the user clicks on an icon.

That entire pop-over is self contained in it's own div.
I'm looking for a more dynamic method then just hard coding in different coordinates for each button.
Thanks in advance.
The Html

            Hello

The CSS
#inset {
margin: 0;
padding: 0;
background: url(grey-fabric.png) repeat; /*#001121;*/
height: auto;
max-width: 100%;
position: relative;
padding: 14px 10px 10px 22px;

border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;

}
#icon-gutter {

    height: auto;
    min-height: 43px;
    position: relative;
    text-align: center;
}

#icons {
    opacity:0;
}
#icons img {

    height: 95px;
    position: relative;
    margin: 0 8px;
    cursor: pointer;

    transition: all .2s;
-moz-transition: all .2s; /* Firefox 4 */
-webkit-transition: all .2s; /* Safari and Chrome */
-o-transition: all .2s; /* Opera */

}
#pop-over-wrap {
    padding: 10px;
    position: absolute;
    width: 200px;
    height: 230px;
    background-color: white;
     border-radius: 5px 5px 5px 5px;
    -moz-border-radius: 5px 5px 5px 5px;
    -webkit-border-radius: 5px 5px 5px 5px;
    margin-top: 20px;
    margin-left: 300px;

    -moz-box-shadow: 3px 3px 4px #000;
    -webkit-box-shadow: 3px 3px 4px #000;
    box-shadow: 3px 3px 4px #000;
    /* For IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";
    /* For IE 5.5 - 7 */
    filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');

}
#arrow {
    position: relative;
    background: url(images/arrowup.png) no-repeat;
    background-position: top center;
    height: 40px;
    margin-top: -30px;

}
#pop-over-body {

}

A: Remove the margins on the #pop-over-wrap css rule, and handle the positioning through jQuery.
$(function(){

    var popup = $('#pop-over-wrap'),
        popupOffset = popup.outerWidth()/2,
        arrowExceed = 30; // how many pixel the arrow exceeds from the containing wrapper.

    $('#icons > img').click(function(){
        var icon = $(this),
            iconPos = icon.position(),
            iconW = this.width,
            iconH = this.height,
            popupTop = iconPos.top + iconH + arrowExceed,
            popupLeft = iconPos.left + iconW/2 - popupOffset;

        popup.css({left:popupLeft, top:popupTop});
        popup.show();
    });

});

Demo at http://jsfiddle.net/ALFfs/1/
demo has hardcoded image widths because i have no access to the images..

A: You can create event on each img like this:
$('#icons').find('IMG').each(function(){
    $(this).click(function(){
       var idBlock = $(this).attr('id');
        //Code of showing popup window idBlock type
          var htmlBasedonIdBlock = GetBlockHtml(idBlock)
         $('#pop-over-wrap').html(htmlBasedonIdBlock)
   })
})

GetBlockHtml function that gets html according on type of block
you use tipsy, so you need only make html for content of body and all work will be done by one
If you don't use tipsy for this, here a lot of other jquery plugins http://www.1stwebdesigner.com/css/stylish-jquery-tooltip-plugins-webdesign/

A: check this jquery plugin to accomplish what you want

A: Have a look here: CSS Tooltips and Speech Bubbles.
You don't exactly have to calculate the coordinates for those boxes. There are a lot of CSS3 tricks to do this one. Hey, you don't even have to use Javascript! However if you consider perhaps compatibility, consider using this jQuery plugin for helping you do tooltips.

A: What if you put each img in a div together with its pop over. Then you position the container div relative and position the pop over absolute?
Like this:

            Hello

And then in css:
.icon{
    position:relative;
}
.popover{
    position:absolute;
    left:-30px;
    top:10px;
}

You get the idea? It would be even nicer to put the icons in an unordered list.

A: You can use a div as a container for an image and a div with information.
For example:

Where
.hideElement { display: none; }
.information-block { position: relative; top: 10px; left: -20px; width: 100px;} //for example

And using jQuery you can show an information block for the first container when you click on the first container:
$("#container-1").click(function() {
   $("#information-1").removeClass("hideElement");
});


text:
Q: Adobe Creative SDK blank page I am trying out Adobe Creative SDK, specifically the image editor, but can't seem to get it to work. I have set up a clientId (API key) and added the code to a page as described in the getting started instructions, but all I see is a blank page and no errors in the console. The page is here: https://test-img-editor.firebaseapp.com/test.html
What am I doing wrong?

A: I figured it out, I needed to move on to the next step to add the image editor UI as explained in the documentation here: https://creativesdk.adobe.com/docs/web/#/articles/imageeditorui/index.html


text:
Q: Access Javascript Array Value Using Outputfield as key VF Have a visualforce page with that is generated from a custom button on the account. On this page, we have some JS that contains an array. I am trying to take the value of the below field from the account:
<apex:outputField value="{!account.lastname}" id="lastname" />

And on a button click, find this value as a key and return the value from the array.
function myfunction(){
window.alert(array["{!account.lastname}"])}

I am receiving "undefined" in the alert. If I just alert the outputfield it will display it, but not access it from the array. Thanks.


text:
Q: MYSQL Selecting Many Columns With Name Like in Subquery i want to achieve something like this:
#Statement for selecting specific Columns
Select (Select column_name from information_schema.COLUMNS where column_name like 'code%' and table_name like 'databasewithmanymanycolumns') from databasewithmanymanycolumns;

(This example isn´t working, it´s just there for explaining what i want to achieve)
I want to Select Columns with the Name Like in a Subquery without explicitely have to name every column, because the table has simply too much to name everyone explicitely.
Is there kind of Statement that could achieve this? Any workaround with other statements?
Thank you very much for your help,
kind regards, SirSandmann

A: The only way to do what I think you're trying to do is with dynamic SQL; return the results of the first query and use it to build up a second query.
By all means do that by hand to write the query in the first place - I do routinely in situations where there's a very wide table I need to return, it's much quicker and less error prone.
But I certainly wouldn't do what I think you're trying to do at runtime in a live application; it'd open up a world of performance and maintenance problems. Write the queries you'll actually need and save them for use, or refactor the database to remove this rather unusual requirement, or rethink what you're actually trying to do.
If I've misunderstood your requirement please feel free to expand your question and we can all try again :-)


text:
Q: Spyder not importing basemap I have trouble to execute netCDF file and get error in spyder.  Here is what I get when I run the test.py script:
runfile('C:/Users/WINDOWS 8/Desktop/Testpython/test1.py', wdir='C:/Users/WINDOWS 8/Desktop/Testpython')
Traceback (most recent call last):

File "<ipython-input-1-c58f888280ee>", line 1, in <module>
runfile('C:/Users/WINDOWS 8/Desktop/Testpython/test1.py', wdir='C:/Users/WINDOWS 8/Desktop/Testpython')

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 93, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/WINDOWS 8/Desktop/Testpython/test1.py", line 3, in <module>
from mpl_toolkits.basemap import Basemap

File "C:\ProgramData\Anaconda2\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 155, in <module>
pyproj_datadir = os.environ['PROJ_LIB']

File "C:\ProgramData\Anaconda2\lib\os.py", line 425, in __getitem__
return self.data[key.upper()]
KeyError: 'PROJ_LIB'

I tried to uninstall an reinstall basemap from source, from apt-get, from conda, but it does not change anything: I can't import basemap.
Thank you for your help

A: The error message looks to me related to the pyproj module. Do you have all basemap dependencies installed and up to date ? You can check it with this command (requires pip)
pip install --upgrade --user matplotlib numpy pyproj pyshp OWSLib Pillow

It is actually a conda-related issue, please see here.


text:
Q: Select boxes in form Ask this question I have searched and read the form_helpers guide.
I'm create a controller like a job board.
In form the user can choose how much he would pay and by what (hour, day, contract).
So my form look like this
# _form.html.erb

    <%= f.label :pay, "Pay" %>

    <%= f.number_field :pay, required: true %>

And show
# show.html.erb

<%= @thecontroller.pay %> / xxx

Instead of "/ xxx" I want show the user choice.
In form, I want a list with 3 entry "Hour", "Day" and "contract"
I tested with something like that but I don't understant
  <select name="city_id" id="city_id">
    <option value="1">Lisbon</option>
    <option value="2">Madrid</option>
    <option value="12">Berlin</option>
  </select>

I need to create an another column ?
I need to create a helper or other code besides form ?
Thank you for you time.

A: Use the select method.  The second argument is an array of arrays, the elements being first the value to display, and second the value to return.
<%= f.select :pay, [['Hour', 1], ['Day' , 2], ['Contract', 3]], required: true %>

Create a helper method for the show page..
class ApplicationController < ActionController::Base

  helper_method :show_pay

  def show_pay(n)
    %w(x Hour Day Contract)[n]
  end
end

And in your view you can do...
<%= show_pay(@thecontroller.pay) %> / xxx


text:
Q: Angular: Call a TS function when clicking a href in the message of a bootbox I'm writing an Angular app and use BootBox to show popups. How can I trigger the function "retrieveTransferTeam" by clicking the href in the BootBox popup in the code below?. I don't want to use button and callback in bootbox.
_ HTML file: when the button is click, it will show the popup
<button (click)="transferLicenses()" class="btn btn">Transfer Licenses</button>

_ TS file:
transferLicenses(){
  let self = this;
  this.xferTeam = {};
  var popup = bootbox.confirm({
    title: "Transfer Licenses",
    message: `
     Retrieve`,
    callback: function (result) {
      if (result) {
        // do something
      }
    }
  });
}

public retrieveTransferTeam(){
  console.log('hello');
}


text:
Q: Request.Cookie - Cookie is not sent or not excepted I'm developing a shopping cart function.
I need product data from the server that used to render the shopping cart page.
Every time the Add-to-cart button is hit, I stringify this array ( using JSON.stringify() ):
  var CART = [{productId: 102, quantity: 3} , {productId: 211, quantity: 6}];

I want to get this data using Request.Cookie["shoppingCart"] in my ASP.NET application,
but when I debug It is always null
This is what the browser return when I call document.cookie
"shoppingCart=[{\"productId\":101617121,\"quantity\":2}]"

But when I try to change the value of the cookie to something like: shoppingCart=testresult ,
the Request.Cookie["shoppingCart"] then has value.
Thank you in advance for helping me!

A: I solved it.
First, I tried to remove some special chars which are:  " and , .
And Request.Cookie then had values. So it seems like ASP.NET just doesn't except these characters in cookie value. ( Tell me if I'm wrong please )
My solution was instead of convert JSON string, I used this formular for each product in the shopping cart : var item = `{productId}:{quantity}`; .
For example:
var sampleCookie = "11231:16:15121:8";

Split the string with : char then use a simple code to get the data.
My code for this:
            string cookie = Request.Cookies["shoppingCart"];

            var cartItems = new List<CartItem>();
            if (cookie != null && cookie.Length > 0)
            {
                string[] values;
                values = cookie.Split(':');

                int i = 0;
                while (i < values.Length)
                {
                    cartItems.Add(new CartItem()
                    {
                        ProductId = values[i],
                        Quantity = Convert.ToInt32(values[i+1])
                    });

                    i += 2;
                }
            }


text:
Q: How to draw a rectangular frame using JS around an image fragment The question is inspired by this topic.
I know how to draw a rectangular frame around the selected image fragment.
I also know how to implement a tooltip when hovering over a red frame.
Below is my code with the result of what I want to get as a result

.container {
width:100vw;
height:100vh;
}
.rect {
fill:transparent;
stroke:red;
stroke-width:2;
}
<div class="container">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink"
        viewBox="0 0 1024 768" preserveAspectRatio="xMinYMin meet"  >
    <!-- Add image -->
<image xlink:href="https://i.stack.imgur.com/uOg10.jpg" width="100%" height="100%" />
    <!-- Add a red rectangles over the image. -->
<g>
     <!-- Tooltip pops up on hover -->
 <title> Young lioness </title>
   <rect class="rect" x="160" y="220" width="170" height="170" rx="15" />
</g>
  <g>
    <title>  Young lion </title>
     <rect class="rect" x="475" y="200" width="200" height="220" rx="15"/>
  </g>

</svg>
</div>

By searching, I found that similar tasks - calculating the size of the container of an object are solved using the JS bbox command
How to implement the dynamic appearance of a bounding box around an image fragment when you click on this fragment?
How to implement the appearance of a tooltip when you hover over this fragment inside the red frame?


text:
Q: Sign error in representation of angular momentum on fields Consider a field $\phi$ that belongs to a representation of the Poincaré algebra. We assume that under translations $\phi\mapsto\phi'$, where $\phi'(x')=\phi(x)$. This fixes the action of the momentum operator to $P_\mu=-i\partial_\mu$. Now, let us further assume that the representation of angular momentum at $x=0$ is given by a matrix $L_{\mu\nu}\phi(0)=S_{\mu\nu}\phi(0)$. Furthermore, we have the formula (see https://arxiv.org/abs/1511.04074 eqn (2.34))
$$e^{ix\cdot P}L_{\mu\nu}e^{-ix\cdot P}=L_{\mu\nu}-x_{\mu}P_\nu+x_{\nu}P_\mu.$$
Then we can apply $\phi(x)$ to both sides. On the one hand, we can use a Taylor series at $x=0$ to see that
$$\phi(x)=e^{x^\mu\partial_\mu}\phi(0)=e^{ix^\mu P_\mu}\phi(0).$$
Thus, the left hand side is $S_{\mu\nu}\phi(x)$. Then, using the representation of momentum found above, we conclude that
$$L_{\mu\nu}=S_{\mu\nu}-i(x_\mu\partial_\nu-x_\nu\partial_\mu).$$
But, according to (2.34) in the reference above (and every other reference I've looked at), the sign of the second term I obtained with this procedure is wrong. I've had this same sign error when computing the other operators of a conformal field theory so I must be missing something conceptually. I would appreciate if someone can help me point out my mistake.

A: You are misreading your reference, complacently ignoring that risk by failing to label his objects suitably, even though he says, in words, he is translating the generator.
By using the 5th commutation relation in (2.27), you see that
$$
L_{\mu\nu}(x)\equiv  e^{ix\cdot P}L_{\mu\nu}(0)e^{-ix\cdot P}=L_{\mu\nu}(0)-x_{\mu}P_\nu+x_{\nu}P_\mu,$$
so that
$$
L_{\mu\nu}(x) \phi(x)=  e^{ix\cdot P} \bigl (L_{\mu\nu}(0) \phi(0)\bigr),
$$
as dictated by the similarity isomorphism of the translation.
It is then evident that
$$L_{\mu\nu}(x) =S_{\mu\nu} - x_{\mu}P_\nu+x_{\nu}P_\mu = S_{\mu\nu}+i(x_\mu\partial_\nu-x_\nu\partial_\mu).\tag{2.34}$$

A: I just realized that Cosmas Zachos wrote an answer as I was writing this. I think we effectively said the same thing in a different notation. Thanks Cosmas!

I believe I've found the source of my confusion. This is all a notation problem. The thing is that $L_{\mu\nu}$ is a differential operator. It acts on a field $\phi$, not on its value at a point $\phi(x)$. Accordingly, the notation $L_{\mu\nu}\phi(x)$ really stands for $(L_{\mu\nu}\phi)(x)$. Using this more explicit notation, we have
$$(L_{\mu\nu}\phi)(a)=(e^{ia\cdot P}L_{\mu\nu}\phi)(0)=((L_{\mu\nu}-a_{\mu}P_\nu+a_\nu P_\mu)e^{ia\cdot P}\phi)(0)$$
Now, we know that $(L_{\mu\nu}\phi)(0)=S_{\mu\nu}\phi(0)$. In particular, we can apply this to the right hand side to get $(L_{\mu\nu}e^{ia\cdot P}\phi)(0)=(S_{\mu\nu}e^{ia\cdot P}\phi)(0)=S_{\mu\nu}\phi(a).$ For the other terms we can just use the fact that momenta commute with one another. Then $(a_{\mu}P_\nu e^{ia\cdot P}\phi)(0)=(e^{ia\cdot P}a_{\mu}P_\nu\phi)(0)=-ia_{\mu}(e^{ia\cdot P}\partial_\nu\phi)(0)=-ia_\mu(\partial_\nu\phi)(a).$ This ends up giving use the correct relation
$$(L_{\mu\nu}\phi)(a)=S_{\mu\nu}\phi(a)+ia_\mu(\partial_\nu\phi)(a)-ia_\nu(\partial_\mu\phi)(a),$$
or
$$L_{\mu\nu}=S_{\mu\nu}+i(a_\mu\partial_\nu-a_\nu\partial_\mu)$$

Ok, the above is just simply wrong. The trick is to note precisely that $L_{\mu\nu}$ is not a differential operator in spacetime, but rather a differential operator on the space of fields, as remarked in my answer here Primary fields in di Francesco's CFT reverses the commutation relations, so that they should actually be
$$e^{ix\cdot P}L_{\mu\nu}e^{-ix\cdot P}=L_{\mu\nu}+x_\mu P_\nu-x_\nu P_\mu.$$ We can then use the procedure I mentioned when asking the question to obtain the correct equation that
$$L_{\mu\nu}=S_{\mu\nu}+x_\nu P_\mu-x_\mu P_\nu$$