text:
Q: Obtain a language name in different languages I have the following:
if (currentUICulture.Equals(CultureInfo.GetCultureInfo("fr-FR")))
    _EnglishLabel = "Anglais";
else
    _EnglishLabel = "English";

ask myself if this code can be optimized for an arbitrary number of current cultures.
I could try to get that for the current UI culture, like this:
_EnglishLabel = new CultureInfo("en-US").DisplayName;

but what if I should give the English language not by the currentUICulture, but an arbitrary culture passed as parameter...
in other words, how to get the
new CultureInfo("en-US").GetDisplayName(myArbitraryCulture);

PS.
The .NET Framework code
////////////////////////////////////////////////////////////////////////
//
//  DisplayName
//
//  Returns the full name of the CultureInfo in the localized language.
//  For example, if the localized language of the runtime is Spanish and the CultureInfo is
//  US English, "Ingles (Estados Unidos)" will be returned.
//
////////////////////////////////////////////////////////////////////////
public virtual String DisplayName
{
    [System.Security.SecuritySafeCritical]  // auto-generated
    get
    {
        Contract.Ensures(Contract.Result<String>() != null);
        Contract.Assert(m_name != null, "[CultureInfo.DisplayName]Always expect m_name to be set");

        return m_cultureData.SLOCALIZEDDISPLAYNAME;
    }
}

////////////////////////////////////////////////////////////////////////
//
//  GetNativeName
//
//  Returns the full name of the CultureInfo in the native language.
//  For example, if the CultureInfo is US English, "English
//  (United States)" will be returned.
//
////////////////////////////////////////////////////////////////////////
public virtual String NativeName {
    [System.Security.SecuritySafeCritical]  // auto-generated
    get {
        Contract.Ensures(Contract.Result<String>() != null);
        return (this.m_cultureData.SNATIVEDISPLAYNAME);
    }
}

A: It is possible to retrieve translations for installed framework languages. The workings are undocumented but the internal implementations can be seen in the reference source (e.g. for CultureData).
For target cultures other than installed ones, the English fallback will be returned.
Building on top of that we can use the following (again, for installed framework languages only):
public static string GetDisplayName(this CultureInfo culture, CultureInfo locale)
{
    var rm = new ResourceManager("mscorlib", typeof(object).Assembly);
    var resourceKey = $"Globalization.ci_{culture.Name}";
    return rm.GetString(resourceKey, locale);
}

For example with Swedish and English installed:
var culture = CultureInfo.GetCultureInfo("en");
var swedishName = culture.GetDisplayName(CultureInfo.GetCultureInfo("sv")); // Engelska
var englishName = culture.GetDisplayName(CultureInfo.GetCultureInfo("en")); // English
var germanName = culture.GetDisplayName(CultureInfo.GetCultureInfo("de")); // English <- German not installed

To cover all languages (or an arbitrary collection of languages), I would suggest a non-native approach as the built-in way is not really supporting your use case.
Cheers!


text:
Q: Flutter error while using sqflite no such column in table I'm trying to learn flutter by myself so i've decided to make an app.
I admit that i have difficulties to make a database correctly so i've copied the code for the database from an opensource app.
Basically the copied app creates notes object which have a title, description date, id.
Now what i want is to add another attribute to the object (dateexamen) (String)
What I have :
I've a main.dart, a database.dart, model folder within a note.dart, a Screen folder within a page with a listView and a floating button to another page for modifying/add/deleting object.
My object has :

*

*Name

*Description

*Date created

*Priority

*Dateexamen (I make everything to add this one)

When i click on the floatingbutton an object is created and then the form page opens and updates the object just created.
So what i did ?:
I've just went into the note.dart, added my attribute dateexamen everywhere juste like everything was inside it and did this for all the file.
I don't have any crashes, but now it doesn't want to create any object, it works again when a delete my modification to all files..
There is the error in the console :

E/SQLiteLog( 4684): (1) table note_table has no column named
  dateexamen E/flutter ( 4684):
  [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception:
  DatabaseException(table note_table has no column named dateexamen
  (code 1 SQLITE_ERROR): , while compiling: INSERT INTO note_table
  (title, description, priority, date, dateexamen) VALUES (?, ?, ?, ?,
  ?)) sql 'INSERT INTO note_table (title, description, priority, date,
  dateexamen) VALUES (?, ?, ?, ?, ?)' args [a, b, 2, Jul 13, 2019,
  Sunday, July 14, 2019 at 12:00PM]}

There is the link to the app repo: https://github.com/fakman99/flutter_first/
Thank's in advance for your help, i'm very excited about flutter and i need to understand how database and backend works with flutter.
Have a good day, Fatih

A: It is likely that anyone who tries your application will not get the error you get. My guess is that you ran the application once before adding your new columns so indeed the column does not exist yet. In sqlite, once the tables are defined, unless you drop/recreate them, columns must be added manually.
Once solution for this is to bump the version number and modify (or simply drop/create the table) during the onUpgrade callback. We can call this a schema migration process. There is an example here: https://github.com/tekartik/sqflite/blob/master/sqflite/doc/migration_example.md.
One quick test on your side is to simply uninstall your app, or delete the app data before trying you code again => magic, it works!

A: It seems that you just adjust the objects, but not the database itself.
Search for the openDatabase
openDatabase(join(await getDatabasesPath(), 'cache.db'),
    onCreate: (db, version) {
  return db.execute(
      'CREATE TABLE cache(timestamp INTEGER, query TEXT PRIMARY KEY, data TEXT)');
}, version: 1)

and adjust the create table according to your needs. (change version or wipe app data.) retry....

redpajama_set_name: RedPajamaStackExchange


text:
Q: Doctrine entity created in a working zf2 module does not update the database I ve created a new module in zf2 to store some entities and their apis. The module is configured and working since I can access the declared api routes. When I contact the api it is sending me an error because the table does not exist.
But when I run ./vendor/bin/doctrine-module orm:schema-tool:update --dump-sql or ./vendor/bin/doctrine-module orm:schema-tool:update --force I received this output :
Nothing to update - your database is already in sync with the current entity metadata.
Which is not true since my table is not created in the database.
My module config :
namespace Enrollment;

return array(
'router' => array(
    'routes' => array(
        'iaFileSetApi' => array(
            'type'    => 'Segment',
            'options' => array(
                'route'    => '/api/ia-file-sets[/:id]',
                'constraints' => array(
                    'id'     => '[0-9]+',
                ),
                'defaults' => array(
                    'controller' => 'Enrollment\Controller\IAFileSetRest',
                ),
            ),
        ),
    ),
),
'controllers' => array(
    'invokables' => array(
        'Enrollment\Controller\IAFileSetRest' => 'Enrollment\Controller\IAFileSetRestController'
    ),
),
'view_manager' => array(
    'template_path_stack' => array(
        __DIR__ . '/../view'
    ),
),
'doctrine' => array(
    'driver' => array(
        __NAMESPACE__ . '_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
        ),
        'orm_default' => array(
            'drivers' => array(
                __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver')
        )
    )
),);

My Entity :
<?php
namespace Enrollment\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="ia_file_sets")
 */
class IAFileSet{
/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue
 */
protected $id;

/**
 * @ORM\Column(type="string", name="name", length=255, unique=false, nullable=false)
 */
protected $name;

public function toArray()
{
    return [
        "id" => $this->getId(),
        "name" => $this->getName(),
    ];
}

/**
 * @return mixed
 */
public function getId()
{
    return $this->id;
}

/**
 * @param mixed $id
 */
public function setId($id)
{
    $this->id = $id;
}

/**
 * @return mixed
 */
public function getName()
{
    return $this->name;
}

/**
 * @param mixed $name
 */
public function setName($name)
{
    $this->name = $name;
}
}

A: Since it was a new module, I deleted the autoloader cache files and now my entities sync correctly.


text:
Q: search for a string in a list based on a hierarchy I have a predetermined hierarchy of strings and would like to return the string which is ranked higher in the hierarchy, some of the strings are sub-strings of another string. For e.g. "abb" and "abb be"
Hierarchy - abc de, abb be, ccdd, aab, abb, aabb, abc, ccde
I would like to output the string based on the order in the hierarchy
Input - abb, aabb, ccdd
Output - ccdd
For the above example, the output should be ccdd as it is listed before aab and aabb in the hierarchy
Here is one more example -
Input - abc, aabb, ccde
Output - aabb
Here the output should be aabb as it is listed before abc and ccde in the hierarchy
What is the best way to solving such a problem?

A: The most efficient way in C# would be to convert the input to a HashSet, then use either forward loop or LINQ on the predefined list and return the first matching element.
For instance:
var ordered = new List<string> { "abc de", "abb be", "ccdd", "aab", "abb", "aabb", "abc", "ccde" };
var input = new List<string> { "abb", "aabb", "ccdd" };
// LINQ solution
var result = ordered.FirstOrDefault(new HashSet<string>(input).Contains);

A: You could on every input go through the rank list to determine the rank, but i would first convert rank list to a Dictionary. After that you could just order your input on rank and take first one:
var rank = new List<string> { "abc de", "abb be", "ccdd", "aab", "abb", "aabb", "abc" };
var rankDict = rank.Select((i, s) => new { i, s }).ToDictionary(x => x.i, x => x.s);

var input = new List<string> { "abb", "aabb", "ccdd" };

var result = input.OrderBy(s => rankDict[s]).FirstOrDefault();

If not all strings from the input are presented in the rank list, you could rank them with lowest priority:
var result = input.OrderBy(s => rankDict.ContainsKey(s)?rankDict[s]:Int32.MaxValue).FirstOrDefault();

A: Dim arrOrder, arrTest, m

arrOrder = Array("abc de", "abb be", "ccdd", "aab", "abb", "aabb", "abc")

arrTest = Array("abb", "aabb", "ccdd")

m = Application.Evaluate("=MIN(IFERROR(MATCH({""" & Join(arrTest, """,""") & """}," & _
            "{""" & Join(arrOrder, """,""") & """},0),999999))")

Debug.Print arrTest(m - 1)


text:
Q: Widget on the lock screen My application uses a widget which is perfectly displayed on the home screen. I have tried to have the widget displayed on the lock screen but, so far, nothing appears on it.
I have implemented all what is described in the documentation: widget category set to "keyguard|home_screen", initialKeyguardLayout property pointing to a specific xml file, check of the type of screen currently being displayed in the onUpdate function of my appWidgetProvider class by getting the app widget options and loading the layout in the RemoteViews according to the AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY. But the widget is still not displayed on the lock screen.
I can't see what I am missing.
My phone runs with Android 4.3


text:
Q: Hide reCatpcha error message if user has 3 or less failed login attempts in Django I'm a beginner with Django and have a login page and when the user has over 3 failed login attempts the login page will then display reCaptcha which works fine.
However, my login page still displays the error message for invalid captcha on every login attempt regardless of logging in successfully or not (this error message is from recaptcha decorator - 'Invalid reCAPTCHA. Please try again.', although lets me login as I have coded) - I would like to hide this specific error message from my login page unless the user has over 3 failed login attempts as well like how I display the actual captcha on the page.
I am using django axes in checking failed login attempts, and have disabled user lock which was not needed.
I'd greatly apprecaite any help with this.
Urls
from django.urls import path, include

from django.contrib.auth import views as auth_views

from . import views
from .views import RequestPasswordResetEmail, CompletePasswordReset
#from .forms import EmailValidationOnForgotPassword

urlpatterns = [
    path('login/', views.loginpage, name="login"),
    path('logout/', views.logoutuser, name="logout"),
]

recaptcha decorator.py
from functools import wraps

from django.conf import settings
from django.contrib import messages

import requests

def check_recaptcha(view_func):
    @wraps(view_func)
    def _wrapped_view(request, *args, **kwargs):
        request.recaptcha_is_valid = None
        if request.method == 'POST':
            recaptcha_response = request.POST.get('g-recaptcha-response')
            data = {
                'secret': settings.RECAPTCHA_PRIVATE_KEY,
                'response': recaptcha_response
            }
            r = requests.post('https://www.google.com/recaptcha/api/siteverify', data=data)
            result = r.json()
            if result['success']:
                request.recaptcha_is_valid = True
            else:
                request.recaptcha_is_valid = False
                messages.error(request, 'Invalid reCAPTCHA. Please try again.')
        return view_func(request, *args, **kwargs)
    return _wrapped_view

View
from django.conf import settings
from .decorators import check_recaptcha
from django.shortcuts import render, redirect
from django.contrib import messages, auth
from django.contrib.auth import authenticate, login, logout
from django.views import View
from .decorators import check_recaptcha
from axes.decorators import axes_dispatch
from axes.attempts import (
    clean_expired_user_attempts,
    get_user_attempts,
    reset_user_attempts,
)

@axes_dispatch
@check_recaptcha
def loginpage(request, credentials: dict = None):

    attempts_list = get_user_attempts(request, credentials)

    attempt_count = max(
        (
                attempts.aggregate(Sum("failures_since_start"))[
                    "failures_since_start__sum"
                ]
                or 0
        )
        for attempts in attempts_list
    )
    print(attempt_count)

    attempt_count = attempt_count +1

    context = {'attempt_count': attempt_count}

    if request.method == 'POST':
        username = request.POST.get('username')
        password = request.POST.get('password')

        user = authenticate(request, username=username, password=password)

        if user is not None:

            if user.is_active and attempt_count <= 3:
                request.recaptcha_is_valid = True
                login(request, user)
                return redirect('home')

            if user.is_active and attempt_count > 3 and request.recaptcha_is_valid:
                login(request, user)
                return redirect('home')

            if not user.is_active:
                messages.error(request, 'Account for this User has not been Activated.')
        else:
            messages.error(request, 'Username or Password is Incorrect.')

    print(context)
    return render(request, 'login.html', context)

Template login
{% extends 'base.html' %}

{% block title %}User Login{% endblock %}

{% block content %}

Login

        <form method="POST" action="">
            {% csrf_token %}

                <input type="text" name="username" placeholder="Email" class="form-control">

                <input type="password" name="password" placeholder="Password" class="form-control">

 {% include 'recaptcha.html' %}

                <input class="btn login_btn" type="submit" value="Login">

        </form>

    {% for message in messages %}

{{ message }}

    {% endfor %}

            Don't have an account? Sign Up

            Forgot Password? Reset Password

{% endblock content %}

A: I managed to solve this by updating the decorator to only display the error message after 4 login attempt failures as follows:
recaptcha decorator.py
from django.conf import settings
from django.contrib import messages
from django.db.models import Sum
from functools import wraps

from axes.attempts import (
    get_user_attempts,
)

import requests

def check_recaptcha(view_func, credentials: dict = None):
    @wraps(view_func)
    def _wrapped_view(request, *args, **kwargs):

        attempts_list = get_user_attempts(request, credentials)

        attempt_count = max(
            (
                    attempts.aggregate(Sum("failures_since_start"))[
                        "failures_since_start__sum"
                    ]
                    or 0
            )
            for attempts in attempts_list
        )
        print(attempt_count)

        attempt_count = attempt_count + 1

        request.recaptcha_is_valid = None
        if request.method == 'POST':
            recaptcha_response = request.POST.get('g-recaptcha-response')
            data = {
                'secret': settings.RECAPTCHA_PRIVATE_KEY,
                'response': recaptcha_response
            }
            r = requests.post('https://www.google.com/recaptcha/api/siteverify', data=data)
            result = r.json()
            if result['success']:
                request.recaptcha_is_valid = True
            else:
                request.recaptcha_is_valid = False

                if attempt_count > 3+1:
                    messages.error(request, 'Invalid reCAPTCHA. Please try again.')

        return view_func(request, *args, **kwargs)
    return _wrapped_view

All works as I required!


text:
Q: Introductory paragraph only in list of blog posts My blog is displaying the full post of my latest blog post, instead of an introductory paragraph only.
How do I make it show an introductory paragraph only, so readers need to click into the full post?
Here's the blog: http://richardclunan.com/blog/
(I haven't posted on it in a while and I can't remember how to do this.)

A: You need to use the more tag. The documentation is from WordPress.com, but it works the same on self-hosted installs.


text:
Q: PostgreSQL: with clause returning syntax error at end of input I'm trying to create a temporary table with the following code:
with cte_counts as
(select entity_id, entity_name, count(distinct segment_id) as countries
from cte_geography
where cte_geography.metric_id in (2, 20, 35)
group by 1, 2
order by 3 desc)

select *
from cte_counts

but I get the error:
ERROR: syntax error at end of input Position: 529
I've retyped it and I can't spot what's wrong. Without with, the code works fine:
select entity_id, entity_name, count(distinct segment_id)
from cte_geography
where cte_geography.metric_id in (2, 20, 35)
group by 1, 2
order by 3 desc

NOTE: performing this on Metabase.


text:
Q: Static for loop? Performing calculations before I'm feeling lost as to how to do this. I am trying to perform a calculation with a value that needs to be a global variable. but to be global it has to be static. I need the for loop to be static too so it can perform the calculation in the array but I can't remember how to do this.
The very last line of code is where I am stuck currently due to "Cannot find symbol" errors. I am trying to find a way to bring yVal0 in to this method so I can perform the calculation
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class RegressionGUI  extends JFrame
    implements ActionListener {
private JLabel VariableLabel = new JLabel("Select one independent Variable");

A: Again, I doubt that you need to use static anything, and a quick review of your (poorly formatted) code suggests that this is still so. Why not instead make some of your numeric variables class fields and not method-local or constructor-local so you can use them in any non-static method of the class?
e.g.,
public class RegressionGUI extends JFrame implements ActionListener {
   private JLabel VariableLabel = new JLabel("Select one independent Variable");
   private JButton X1btn = new JButton("Number of Bathrooms (X1)");
   private JButton X2btn = new JButton("Area of the site (X2)");
   private JButton X3btn = new JButton("Size of living space (X3)");
   private JButton X4btn = new JButton("Number of Garages (X4)");
   private JButton X5btn = new JButton("Number of Rooms (X5)");
   private JButton X6btn = new JButton("Number of bedrooms (X6)");
   private JButton X7btn = new JButton("Age (X7)");
   private JTextArea textArea = new JTextArea();
   private JScrollPane scrollPane = new JScrollPane(textArea);

   // **** added these guys
   private double[] xValues = new double[4];
   private double[] yValues = new double[4];

A: Since it's horribly formatted your code is hard to follow (and thus I didn't read it), but if you want a static variable to be computed at runtime, your best bet is something like this:
public static final int MY_VAR = computeValue();

private static int computeValue() {
    //for loop here
}

A: You're looking for a static initialization block.  This is a block of code that is executed just before the first time an object of the class is initialized, or just before the first time a static member of the class is executed.


text:
Q: How much will a timer event slow down my code in JavaScript I am currently building a rather large web based application. My job is to build the interface using JavaScript and jQuery. Eventually the application will be using Ajax, C# and SQL. There is thus rather a lot going on at any point of time.
I need to listen for an event. Currently I am using a combination of mouseover and mouseout events to trigger this event, but it does not cover all my basses.
I am thus considering using a JavaScript interval timer to periodically check if the event should fire. I am hesitant to do so for fear of slowing down my code too much.
My question then is how much will this slow down the rest of my code?
I realize that it depends on how much code is run in the corresponding function, so here is a quick list of things that happen:

*

*I obtain the mouse coordinates using e.pageX and e.pageY.

*I check the element that you are currently hover on using document.elementFromPoint.

*I check if the element mentioned above has
a parent of a specific class with a .closest

*If so, the event is fired.

So in conclusion, I want to know if doing the above every few milliseconds will slow down my application noticeably.
Any advice would be much appreciated.

A: More of a comment than an answer, but too much for the comments box.
Surely this should work:
$('.myClass').on('click', '*', function () {
    ...
});

or
$(documnt).on('click', '.myClass *', function () {
    ...
});

depending on whether .myClass elements are created at DOMContentLoaded or created by AJAX.

A: Here is an example of how a Javascript interval timer will slow down an application:
HTML:
Function calls:

<input type="text"/>

Javascript:
$(document).ready(function() {
    window.setInterval(function() {
        foo();
    }, 13);
});
var calls = 0;

function foo() {
    calls++;
    $("#info").html(calls);
    fib(35); // calculate fibonacci numbers
}

function fib(n) {
    return n < 2 ? n : fib(n - 1) + fib(n - 2);
}

Try to enter some text in the textbox and you will see how unresponsive the application gets. Depending on your PC's hardware, you will see your entered text with more or less delay. Changing the parameter of the fib() function will make the application "faster" (lower number as parameter) or "slower" (higher number of parameter). A low number (meaning the function is executed fast) will not decrease the performance of your application.
Therefore, for your current case, I think the interval timer will not slow down your application noticably. But there are a few points to consider:

*

*Is the application only used on desktop browsers with fast hardware?

*Is the application also used by mobile devices/tablets? These often have a worse performance.

*For now, the interval timer does only really simple things. But what about the future? Maybe sometime more and more functionality is added to it because it is the easiest way for developers to do it.

Therefore, I would suggest to avoid the interval timer, if possible.


text:
Q: How to deploy frontend and backend at the same time to App Engine? Currently, I have two different packages - a WAR file with my Java web application (APIs, etc) and an Angular 8 dist zip file. I want to either deploy both to the same app engine instance or to separate app engine instances.
How do I deploy both of them to the same app engine instance and have them still be integrated?
Is it a good practice to deploy both of them to the same instance or should you have it separate?
If I deploy them to separate instances - how would I point one to the other and avoid CORS issues?

A: I don't recommend you to deploy both on the same instance. Why? Because, if you want to update your front, for example, update a CSS or a type issue, you have to redeploy your full app only for this.
By the way I recommend you to deploy 2 different instances. The front on the frontend name instances, and the back on default backend instance.
You have to customize the app.yaml file. For the front end, for serving only static files, I use this file
service: frontend
runtime: python37

handlers:
# Routing for bundles to serve directly
- url: /((?:(?:(?:inline|main|runtime|common|polyfills|styles|vendor)\.[a-z0-9]+\.js)|(?:[0-9]+\.[a-z0-9]+\.js)))
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*

# Routing for a prod styles.bundle.css to serve directly
- url: /(styles\.[a-z0-9]+\.css)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*

# Routing for typedoc, assets and favicon.ico to serve directly
- url: /((?:assets|docs)/.*|favicon\.ico)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*

# Any other requests are routed to index.html for angular to handle so we don't need hash URLs
- url: /.*
  secure: always
  redirect_http_response_code: 301
  static_files: dist/index.html
  upload: dist/index\.html
  expiration: 0s
  http_headers:
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Frame-Options: DENY

Only static resourced are served in the /static directory. No instance spawn, no cost.
Note: It was also an angular App and I use python runtime in the file. No impact, use what you want, it's only static resources served!
The backed is standard and specific to your app. if you set correctly your handlers, you shouldn't have cors issue.
Let me know if it's not the case, we will review your configuration.


text:
Q: Using WWW::Mechanize to navigate forms on Amazon site I am using WWW::Mechanize to automatically add my email address as a preferred one. After a lot of difficulty I could log into the page, but when I try to add an email address as an allowed email address it does not work. Even the link does not show up. What am I doing wrong? The link of the Amazon page is this.
My code:
use WWW::Mechanize;
use HTTP::Cookies;
use HTML::Form;
use WWW::Mechanize::Link;

my $bot = WWW::Mechanize->new();
$bot->agent_alias( 'Linux Mozilla' );

$bot->cookie_jar( HTTP::Cookies->new(file           => "cookies.txt",
                                     autosave       => 1,
                                     ignore_discard => 1, ) );
# Connect to the login page
my $response = $bot->get( 'https://www.amazon.com/gp/css/homepage.html/' );

# Get the login form. You might need to change the number.
$bot->form_number(3);

# Enter the login credentials.
$bot->field( email => 'email' );
$bot->field( password => 'pass' );
$response = $bot->click();

#print $response->decoded_content;
$bot->get( 'https://www.amazon.com/gp/digital/fiona/manage?ie=UTF8&*Version*=1&*entries*=0#pdocSettings' );
my @links = $bot->find_all_links( tag => "a" );

foreach (@links)
{
  print $_->text()."\n" ;
}

My tamper data is this
Referer=https://www.amazon.com/gp/digital/fiona/manage?ie=UTF8&%2AVersion%2A=1&%2Aentries%2A=0

POSTDATA=sid=183-7190983-6755358&newEmail=myid%40mailhost.com

Edit:  After searching I realised that WWW::Mechanize may not be able to achieve this as it lacks JavaScript support. I decided to use WWW::Scripter with the plugin. Would someone please tell me how to do it?

A: You found answer to your question on other post: Calling a link from perl
For future tasks similar to this one, I suggest you to do following work-around:

*

*install Google Chrome (if you don't have it already)

*navigate browser to form page you want to simulate

*on submit button click right-click mouse button and select "Inspect element"

*switch to "Network" tab

*click to submit button on the form

*see information in "Network" table, especially in "Headers" and "Response" sub-tabs.

By this kind of debugging you will find exact communication between server and browser, including cookies, referers, request methods, urls, submit data, etc.


text:
Q: Microsoft graph token refresh azure app service I have used this https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/2-WebApp-graph-user/2-1-Call-MSGraph,
but when I publish it to Azure I get an error after some time (probably 1 hour) with http error 500. It seems the token isn't refreshing automatically? When running the app locally it doesn't happen as often, but it have happened there as well. What can be done to fix this issue?
Redirect URIs are set as shown in the github example (https://websitename.azurewebsites.net/signin-oidc).


text:
Q: How to get the font path in the Assets folder I create a PDF document using itextsharp and I need to connect the fonts from the Assets folder.
At the moment everything works when I throw fonts in the memory of the smartphone.
System.String ttf = Android.OS.Environment.ExternalStorageDirectory +
"/arial.ttf";
var baseFont = BaseFont.CreateFont(tttt, BaseFont.IDENTITY_H,
BaseFont.NOT_EMBEDDED);
var font = new Font(baseFont, Font.DEFAULTSIZE, Font.NORMAL);

doc.Add(new Paragraph(inf1, font));

But probably no one has these fonts in the memory of the smartphone :)
I tried to get the path to the Assets folder using the following code:
public static AssetManager Assets { get; private set; }

string ttf;
using (var asset = Assets.Open("arial.ttf"))
{
    var fontStream = new MemoryStream();
    asset.CopyTo(fontStream);
}

or another option:
string content;
using (StreamReader sr = new StreamReader(Assets.Open("arial.ttf")))
{
    content = sr.ReadToEnd();
}

but in these cases there is a problem:
object reference not set to an instance of an object...
on line
using (var asset = Assets.Open("arial.ttf"))

and
using (StreamReader sr = new StreamReader(Assets.Open("arial.ttf")))

Maybe there is some analog of the folder path, similar to the path to the Font in Windows ?
Environment.GetFolderPath(Environment.SpecialFolder.Fonts);

or maybe I can somehow use the resulting TypeFace
Android.Graphics.Typeface tf = Android.Graphics.Typeface.CreateFromAsset(Application.Context.Assets, "arial.ttf");

Tell me, please, how do I set the necessary fonts in a PDF document or how to find the path to the fonts ttf, that would be inserted into the line BaseFont :)

A: The problem with your above code in my understanding when you say it gives you object reference not set to an instance of an object. error, which means that you are not assigning a value to it and its null what you need to do to overcome that is simple;
After declaring the property
 public AssetManager AppAssets { get; private set; }

In your class constructor assign it a value:
AppAssets= this.ApplicationContext.Assets; // In an activity
AppAssets= this.Activity.ApplicationContext.Assets; // In a fragment

Once you do this the object reference error should go away,
Goodluck revert in case of queries.

A: I guess the problem is that
BaseFont.CreateFont()
Wants to get path to the font file not a stream.
I am also facing this issue. It works for sdcard but how to make it read from assets folder i do not know. As a workaround i copy it to the documents folder.


text:
Q: Prop: Image of $f(X)$ is compact under $f$ Let $(X,d)$ and $(Y,d)$ be metric spaces and $(X,d)$ is compact. Further let $f : X \rightarrow Y$ be a continuous map.
Prop: Image of $f(X)$ is compact under $f$.
Pf:  We wish to show that $f(X)$ is totally bounded and complete. Since $X$ is totally bounded,$\forall r>0, \exists x_1,...,x_n \in X : X \subseteq \bigcup^n_{i=1}B_r(x_i)$. As $f$ is uniformly continuous, $\forall \epsilon>0, \exists \delta >0 : d(x,y)<\delta \implies d(f(x),f(y))<\epsilon$. Using the fact that $f(\bigcup^n_{i=1}B_{\delta}(x_i)) \subseteq  \bigcup^n_{i=1}B_{\epsilon}(f(x_i))$, $f[X] \subseteq \bigcup^n_{i=1}B_{\epsilon}(f(x_i))$. Thus, $f[X]$ is totally bounded.  If $\{x_n\}$ is Cauchy sequence in $f(X)$, $\exists N \in \mathbb{N} : \forall m,n \geq N \implies d(x_n,x_m)<\epsilon$. By continuity, $\forall \epsilon >0, \exists \delta >0 : d(x_n,x_m)<\delta \implies d(f(x_n),f(x_m))<\epsilon$. Then,  $\{f(x_n)\}$ is a Cauchy sequence in $X$. As $\{x_n\} \rightarrow x$ for some $x \in X$, $\{f(x_n)\} \rightarrow f(x)$. Thus, $f(X)$ is complete.

A: It has many errors. For instance:

*

*You claim that $f^{-1}(\bigcup_{i\in I} B_r(f(x_i)))$ is an open cover of $X$. What you meant is that $\left\{f^{-1}\bigl(B_r(f(x_i))\bigr)\,\middle|\,i\in I\right\}$ is an open cover of $X$.

*When you wrote that you were using the fact that $f$ is continuous, you actually used the fact that $f$ is uniformly continuous.

Anyway, it's much easier to prove that $f(X)$ is compact directly.

A: It's easier to use the direct, simple definition of compactness, instead of its characterisation in metric (or uniform) spaces:
Suppose $\mathcal{U}$ is an open cover of $f[X]$ (with open sets of $Y$, WLOG). Then by continuity and basic set theory, $\mathcal{U}'= \{f^{-1}[O]: O \in \mathcal{U}\}$ is an open cover of $X$ and so has a finite subcover $f^{-1}[O_1], \ldots, f^{-1}[O_n]$. But then $\{O_1, \ldots, O_n\}$ is a finite subcover of $\mathcal{U}$. QED

If you look at your attempted proof, you're really using uniform continuity of $f$. In fact, you can reduce the proof to four separate propositions:

*

*If $f(X,d) \to (Y,d')$ is uniformly continuous and $X$ is totally bounded then so is $f[X]$.

*If $f(X,d) \to (Y,d')$ is uniformly continuous and $X$ is complete then so is $f[X]$.

*If $(X,d)$ is compact and $f: (X,d) \to (Y,d')$ is continuous, then $f$ is uniformly continuous.

*$(X,d)$ is compact iff it is totally bounded and complete.
Combining these also gives the theorem. But the 4 facts are also of independent interest.


text: Q: Android View.GONE accessibility talkback bug This is the weirdest bug I have ever came across so far. Suppose you have a view right below the action bar (any view). If I set the view to GONE, for some reason you cannot navigate backwards towards the action bar using swipe navigation (talkback). If I set it to invisible or visible, then backwards navigation works fine, and you can get reach the action bar going backwards. Why would View.GONE ever cause something like this?


text:
Q: Ajax call pulling in random html I'm having an issue that I can't seem to solve. First thing is first. I'm running this on Ubuntu 14.04 with apache and php5. I am using the netbeans IDE which i originally assumed to be the issue but then i ran it directly from the web root /var/www/html. php is working i already tested it. i can run html pages and php pages from the root. I have developed a few applications already using this computer. Some which use very advanced ajax to calls to google apis. I have no idea why all of a sudden I can't make the simplest ajax call. Anyways the problem is that when I make my ajax call to a php file nothing happens. if i inspect the page in browser, it shows that it pulled in a bunch of random iframes. I have never used an iframe before. I am really hoping that I just need a different set of eyes on this and that it isn't something else.
index.html
<!DOCTYPE html>

    <title>Index HTML</title>
    <meta charset="UTF-8">

The Div

getHTML.php
    <?php
       echo "Hello World";
    ?>

After running this in mozilla firefox, no iframes are being pulled in. I can only assume it is some bug with chrome. So now to answer the question: why aren't I getting any response from the ajax call?
So I am now getting a response from my ajax calls. Way worse though. I changes my $.ajax to a $.post() and then to a $.get() and now it is return a duplicate of index.html over and over and over in an infinite loop. From what i understand the default url that $.get/post take is the current url. But I added getHTML.php as the url argument. so I am at a loss. I can't get any work done if I can't solve this issue. Can anyone help?
$(document).ready(function(){

    $.get("getHTML.php", function(data)
        $("body").append(data);
    });
});

A: Its best to use JSON for these requests:
$return_data = array();
if (condition){
   $return_data['status'] = 'success';
} else {
    $return_data['status'] = 'info';
}

echo json_encode($return_data);
exit();

Remember to specify return data type:
function send() {
var data = $('#signup_form').serialize();
    $.ajax({
        type: "POST",
        url: "signup_process.php",
        data: data,
        dataType: 'json',
        success: function (data) {
        alert(data.status);
            if (data.status == 'success') {
                // everything went alright, submit
                $('#signup_form').submit();
            } else if (data.status == 'info')
            {
                console.log(data.status);
                $("label#email_error").show();
                return false;
            }
        }
    });
    return false;
};

A: Ok so the solution to this issue has nothing to do with any programming. For the iframes, this way a strange google chrome issue, luckily it doesn't affect the visuals as nothing displays. As far as the ajax problem, I was doing it right (tested on a different computer) but the Apache2 server was not responding to ajax requests. It is gonna take some time searching through log files to find a proper solution.


text:
Q: How to convert JSONObject to JSONArray in Android? I have request something like this.
{"REQ_DATA":
    {"CLPH_NO":"010123456789","USE_INTT_NO":""}
}

but server accepts only this
{"REQ_DATA":
    [{"CLPH_NO":"010123456789","USE_INTT_NO":""}]
}

What should I do? I quite noob about JSON, please help me.

A: REQ_DATA needs to be a JSONArray. Try implementing something like this
        try {

          JSONObject object = new JSONObject();
          JSONArray requiredDataArray = new JSONArray();
          JSONObject data = new JSONObject();
          data.put("CLPH_NO", "010123456789");
          data.put("USE_INTT_NO", "");
          requiredDataArray.put(data);
          object.put("REQ_DATA", requiredDataArray);
          Log.d("JSON", object.toString());

        } catch (JSONException e) {
          e.printStackTrace();
        }

A: You can try:
JSONObject fromRequest = request.getJSONObject();// given from request
JSONObject toServer = new JSONObject();
JSONArray arr = new JSONArray();
arr.put(fromRequest.get("REQ_DATA"));
toServer.put("REQ_DATA", arr);

A: You don't change a JSONObject to a JSONArray, rather, you create a JSONArray and then add the JSONObject to that array.
try {
    JSONObject reqData = new JSONObject();
    reqData.put("CLPH_NO", "010123456789");
    reqData.put("USE_INTT_NO", "");

    JSONArray array = new JSONArray();
    array.put(reqData);
    JSONObject request = new JSONObject();
    request.put("REQ_DATA", reqData);

    String requestAsJSONString = request.toString();

    // call web service

} catch (JSONException e) {
    // handle exception
}

You need to send requestAsJSONString to the server.
Furthermore, I suggest you put the JSON object keys in final fields, like so:
static final String KEY_REQ_DATA = "REQ_DATA";

and then use KEY_REQ_DATA in your code instead of using the hardcoded String.

A: Jsonarray array = new Jsonarray();
Jsonobject insidearray = new jsonobject;

insidearray.put("CLPH_NO", "010123456789");
insidearray.put("USE_INTT_NO", "");

array.put(insidearray);

Jsonobject object = new Jsonobject();

object.put("REQ_DATA",array);

The variables may need a little editing, doing this from a phone but there you go

A: Just simple solution without using any hard-coded Strings
JSONObject currentJson = new JSONObject(yourJsonString); //Your current jsonObject
JSONObject newJsonObject = new JSONObject(); //new jsonObject you want to send to server
newJsonObject.put(currentJson.keys().next().toString(),
           new JSONArray().put(currentJson.getString(currentJson.keys().next().toString())));

A: This is simple solution for your json string as per server check it
    JSONObject jo = new JSONObject();

    try {
        jo.put("CLPH_NO", "010123456789");
        jo.put("USE_INTT_NO", "");
    } catch (Exception e) {
    }

    JSONArray ja = new JSONArray();
    ja.put(jo);

    JSONObject final_jo = new JSONObject();

    try {
        final_jo.put("REQ_DATA", ja);
    } catch (Exception e) {
    }

    Toast.makeText(getApplicationContext(),final_jo.toString(),Toast.LENGTH_LONG).show();


text:
Q: 2009 Macbook A1278 with only win10 loaded, need mac os x but cant install it? I was sold a Macbook a1278 and it only has some weird version of windows 10 on it (Everything is all red and inverted colors and the os seems to be all messed up). I tried doing many different things and I have a USB with mountain lion ready to install but nothing is working. What can I try? It has no mac os x utilities or anything at all. I tried booting up internet recovery and the computer fan just spins and black screen..

A: Boot into recovery mode and if that doesn't exist wipe the entire disk and then boot using the USB drive.
You can wipe the disk by removing it from the macbook if recovery mode doesn't work.


text:
Q: Extract digital signature in pdf using python I need to get the digitally signed signature content like name of signature and signed date and coordinate of the whole signature part.
I tried using different modules like pypdf2, pdfminer and endesive modules, Out of these endesive modules is giving whether the digital signature is there in that pdf document or not.
This is the code base to get whether signature is there or not by using endesive module.
   fname = 'filename'
   data = open(fname, 'rb').read()
   pdf.verify(data)

   The above code gives the following output.
   cert.issuer: OrderedDict([('common_name', 'Srikanth'), ('organization_name', ''), ('organizational_unit_name', ''), ('email_address', 'srikanth@yahoo.com'), ('country_name', 'India')])
cert.subject: OrderedDict([('common_name', 'Srikanth'), ('organization_name', ''), ('organizational_unit_name', ''), ('email_address', 'srikanth@yahoo.com'), ('country_name', 'India')])
Out[13]: (True, True, False)

Please see the below reference link to get the sample digital signature:
https://www.globalsign.com/en-in/blog/certifying-vs-approval-signatures-in-adobe/
I need to get the digital signature values like:
Person name: Daniel Farrel
Signed Date: 2017.10.05  08.44.11 -04'00'

A: I looked into this a bit, and you seem to be doing everything right. The API to endesive does not return the signers, it uses them internally, but as a caller you do not have access to them [1].
Also, be careful, because it appears that the library does not verify all the signatures, only the first one [2].
[1] https://github.com/m32/endesive/blob/master/endesive/verifier.py#L104
[2] https://github.com/m32/endesive/issues/124


text:
Q: Aggregating Activity history on demand What are some techniques to present an activity feed tailored to a specific user depending on who he/she follows? Here are some examples:

*

*User B liked User A's photo

*Users B and User C commended on User A's picture (aggregation based on who the user follows)

*User B liked 10 photos: [photo1, photo2, etc]

Services like Instagram provide a feed with activity aggregation tailored to specific users. I assume that saving a separate feed for each user on the server will not scale. So the aggregation need to be done on demand but has to be fast.
Are there open source tools for mongodb or redis designed to take care of this?

A: There are multiple approaches that can be taken.
In MongoDB a common pattern would be to do pre-aggregation for certain types of information - that is, update some field or document when an event happens to make it fast to read back only the final information at query time.
The other option is to use queries - regular and Aggregation Framework to get the data "in real time".
The third option may be to run periodic MapReduce jobs to calculate various aggregations and then save them for fast access.  This trades off speed of access for eventual consistency - as you wouldn't see the information updated immediately in real time.


text:
Q: SQL Server 2008 large table performance I have this relatively large table in a separate filegroup (2 GB, well, it's not THAT large but large enough I think to start thinking about performance as it's a heavy duty table).
This is the only table in this filegroup.
Right now the filegroup contains only one datafile.
Assuming the table is well-indexed and that index fragmentation is almost zero, would it increase performance (for select and insert statements) if I split the filegroup into two datafiles, BUT having those two datafiles reside on the same physical disk (as I don't have an array of disks at my disposal) ?
Or is a split into multiple files only an improvement when you can split those files over separate physical disks ?
Thanks for any replies.
ps: must add that we're using standard edition so table partitioning is a no-go
Mathieu

A: You really need to have separate spindles/LUNs if you're going to split index/data
For busting the "one thread per file" myth, read these from Paul Randall.

A: For the situation you have described, I doubt you could measure the difference accurately, since it would be insignificant. You would need a high end database with specific heavy workloads to entertain the thoughts that you are suffering SGAM / GAM contention.
GBN is right in indicating that you need it on seperate spindles to see a suitable difference.


text:
Q: Limitation of law of large numbers The book "Statistical Learning Theory" by Vladimir Vapnik has a part which I cannot understand properly.
"According to the classical law of large numbers, the frequency of any event converges to the probability of this event with an increasing number of observations. However, the classical law of large numbers is not sufficient to assert that for a given set of event the sequence of probabilities of events with the smallest frequency converges to the smallest possible value for this set."
The first line is pretty self-explanatory. The next line describes a limitation of the classical law of large numbers. What I understood is that if there are many events, and some event has the smallest frequency for this set, the law does not assert that this event will also have the smallest probability in the set (with increasing observations). But I don't see why it can't be asserted. Also, why is there a mention of sequence of probabilities? The first line creates a distinction between frequency and probability. How can there be a sequence of probabilities related to an event? Can anyone care to provide further insight on this?


text:
Q: How to get macOS High Sierra file vault encryption to continue/How to cancel encryption and decrypt drive? On my MacBook Pro Mid 2015 running macOS High Sierra I was trying to encrypt it using FileVault.
I can't tell if progress is stuck or just moving very, very, very slowly
What are ways I can get the encryption to continue, or just cancel the encryption and decrypt the drive?

A: You can check the status from the terminal with diskutil cs info /Volumes/<name> and look for Conversion State and LV Conversion Progress. If you want to cancel the encryption with diskutil cs revert /Volumes/<name>
srv:~ onik$ diskutil cs info /Volumes/OSX
Core Storage Properties:
   Role:                       Logical Volume (LV)
   UUID:                       00000000-0000-0000-0000-000000000000
   Parent LVF UUID:            00000000-0000-0000-0000-000000000000
   Parent LVG UUID:            00000000-0000-0000-0000-000000000000
   Device Identifier:          disk1
   LV Status:                  Online
   Conversion State:           NoConversion
   LV Conversion Progress:     100%
   Content Hint:               Apple_HFS
   LV Name:                    OSX
   Volume Name:                OSX
   LV Size:                    126804688896 B

Oh, and if you're using APFS (new in High Sierra), the commands are diskutil apfs list and diskutil apfs decryptVolume /Volumes/<name>
Then you can wait  15 minutes and check again. The conversion should continue and might go faster if you log out or just restart your machine and don't log back in.
There's no need to reinstall the operating system in almost all cases. You may need to leave the machine running for a day or two if for some reason it's not progressing at a good rate. There also is no cancel. It needs to proceed or you could wipe the entire disk and reinstall everything.


text:
Q: Maximum update depth exceeded when I want to remove item from cart I have problem with getting products form localStroage. I use useEffect to fetch all products in my localStorage
useEffect(() => {
  setItemsInCart(getItemFromCart())
}, [itemsInCart])

getItemFromCart is function in my cartHelper component :
export const getItemFromCart = () =>{
    if(typeof window !== 'undefined'){
      if(localStorage.getItem('cart')){
        return JSON.parse(localStorage.getItem('cart'))
      }else{
        return []
      }
    }
}

then I map through all items in cart :
const showCartProducts = (itemsInCart) => {
    return (

          {itemsInCart.map((product,index)=>{
            return(

            <Card
              key={index}
              product={product}
              showAddToCartButton={false}
              showQuantityInput={true}
              removeFromCartButton={true}
                    />

            )
          })}

    );
};

And this work fine everything works , but when I want to run onclick function to remove button in my Card component then I get this error
"Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."
Here is my Card component responsible for removingItem
const removeButton = () =>{
     return (

      removeFromCartButton && (
          <button
              onClick={() => removeItem(product._id)}
              className="btn btn-outline-danger mt-2 mb-2"
          >
              Remove Product
          </button>
      )
    );
};

and removeItem function form my cardHelper :
export const removeItem = productId => {
     let cart = [];
       if (typeof window !== "undefined") {
         if (localStorage.getItem("cart")) {
          cart = JSON.parse(localStorage.getItem("cart"));
      }

      cart.map((product, i) => {
          if (product._id === productId) {
              cart.splice(i, 1);
          }
      });

      localStorage.setItem("cart", JSON.stringify(cart));
     }
     return cart;
};

I don't know how to solve this , please help me :).

A: The issue is with the below code
useEffect(() => {
  setItemsInCart(getItemFromCart())
}, [itemsInCart])

Whenever you change itemsInCart it will be called and inside you are again changing  itemsInCart it's like an infinite loop going on.
You can change it to if you want to fetch from local storage to happen only once.
useEffect(() => {
  setItemsInCart(getItemFromCart())
}, []) // empty dependency array.

For Removing item, you can update itemsInCart at the function by resetting it or by removing the item from itemsInCart as well.
Resetting the new value
export const removeItem = productId => {
     let cart = [];
       if (typeof window !== "undefined") {
         if (localStorage.getItem("cart")) {
          cart = JSON.parse(localStorage.getItem("cart"));
      }

      cart.map((product, i) => {
          if (product._id === productId) {
              cart.splice(i, 1);
          }
      });

      localStorage.setItem("cart", JSON.stringify(cart));
     }
     setItemsInCart(cart);
     return cart;
};

Or update by delete instead of above change.
setItemsInCart([...itemsInCart.filter(it => it._id !== productId)]);


text:
Q: How do I make animation finish and can't be interrupted even when I let go? Basically I want the roll animation to play completely, and not be interrupted like a fighting game special move. So when I press down or, hold down in this case, the animation has to complete one cycle, and then I have to press or hold the down key again for it to start up again.  Any help would be amazing.
    const int STATE_Idle = 0;
    const int STATE_Run = 1;
    const int STATE_Roll = 2;
    const int STATE_Jump = 3;

if (Input.GetKey ("down")
        {

            changeState(STATE_Roll);
            transform.Translate(new Vector3(1f, -.4f, 0f) * rollSpeed * Time.deltaTime);

        }

        if (animator.GetCurrentAnimatorStateInfo(0).IsName("roll"))
            _isPlaying_roll = true;
        else
            _isPlaying_roll = false;

    }

    //--------------------------------------
    // Change the players animation state
    //--------------------------------------
    void changeState(int state){

        if (_currentAnimationState == state)
            return;

        switch (state) {

        case STATE_Run:
            animator.SetInteger ("state", STATE_Run);
            break;

        case STATE_Roll:
            animator.SetInteger ("state", STATE_Roll);
            break;

        case STATE_Jump:
            animator.SetInteger ("state", STATE_Jump);
            break;

        case STATE_Idle:
            animator.SetInteger ("state", STATE_Idle);
            break;

        }

        _currentAnimationState = state;
    }

A: How about you place your animation strip on a list. Every time you want the animation to run, check for any other user input that isn't the one you want. If it's the input you want, iterate through the whole list then continue doing whatever else was next.
Something like this:
foreach(var strip in animationStrips)
{
    //Display current strip
}


text:
Q: Added margin HTML In HTML, I am trying to make a footer but every time I do this it just comes like this with an added margin on the left.

this is my footer code;

 tester

   #footer {
   background-image: url(images/backgroundrpatternfooter.png);
   background-repeat: repeat;
   position : absolute;
   bottom : 0;
   height : 40px;
   width : 1800px;
   margin: 0;
   }

A: Your problem lies not within the footer div, but within the body. The body element has a default margin of 8px (might depend on the browser you're using), so you need to set the body's margin to 0 like this:
body {
    margin: 0;
}

Working example.
I would also like to suggest that you look into using the footer element instead of using a div as a footer, it was added to HTML5 for that very purpose!
I hope this helped and good luck!

A:
 tester

#footer {
    background-image: url(images/backgroundrpatternfooter.png);
    background-repeat: repeat;
    position : absolute;
    bottom : 0;
    height : 40px;
    width : 1800px;
    margin: 0;
    **left:0;**
}

Try adding left:0;, if still not working check your inherit css.

A: Your CSS indicates a fixed with of 1800px but since your element is absolutely positioned, you need to add a margin-left or left property to specify where the element should be positioned from (margin-right and right also work).
Do you want your element centered? Try using
left: 50%

to achieve that.
Also, try adding
left: 0;

and see if that removes the gap you're dealing with.
(The gap is probably caused by your containing element being wider than 1800 px).


text:
Q: Address is invalid on local machine [on windows 8 only] I want to check the status code of request to url but getting code
java.net.ConnectException: connect: Address is invalid on local machine or port is not valid on remote machine

here is my code
public static boolean linkExists(String URLName){
        URLName = "http://www.google.com";
        try {
          HttpURLConnection.setFollowRedirects(false);
          HttpURLConnection con =
             (HttpURLConnection) new URL(URLName).openConnection();
          con.connect();
          System.out.println(con.getResponseCode());
          return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
        }
        catch (Exception e) {
           return false;
        }
  }

stack trace
java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:203)
    at sun.net.www.http.HttpClient.New(HttpClient.java:290)
    at sun.net.www.http.HttpClient.New(HttpClient.java:306)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:995)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:849)
    at com.sls.lms.test.utilities.Utilities.linkExists(Utilities.java:70)
    at com.sls.lms.test.report.ReportTest.checkReportData(ReportTest.java:70)
    at com.sls.lms.test.report.ReportTest.CheckReportForGST(ReportTest.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
    at org.testng.junit.JUnit4TestRunner.start(JUnit4TestRunner.java:81)
    at org.testng.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:69)
    at org.testng.TestRunner$1.run(TestRunner.java:682)
    at org.testng.TestRunner.runWorkers(TestRunner.java:1012)
    at org.testng.TestRunner.privateRunJUnit(TestRunner.java:713)
    at org.testng.TestRunner.run(TestRunner.java:614)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
    at org.testng.TestNG.run(TestNG.java:1031)
    at org.testng.TestNG.privateMain(TestNG.java:1338)
    at org.testng.TestNG.main(TestNG.java:1307)

A: I believe that this issue is caused by Java attempting to use an IPV6 address, when either your OS doesn't support it, or is not set up properly to handle it.
You can force Java to use an IPV4 address with the following property:
-Djava.net.preferIPv4Stack=true

A: One thing I notice is that your URL connection has not been used... you haven't called connect(). I would be disappointed in the error message if that fixed your problem, but you probably can't get a response code until after you have made a request.
http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html

A: Works fine for me with Eclipse. Definitely take Nikolay's advice and check if you have a firewall running. Any forum post I have seen related to this exception have been related somehow to this situation.

A: Close all java programs and open up run (winkey + R) or just search run if you have a start button like me, and write -Djava.net.preferIPv4Stack=true in. :)

A: Encountered this problem but just shutdown my antivirus and phew it is working, this has to do with the antivirus blocking the ports.

A: i faced the same problem.
i have windows8 64 use netbeans7.4.
my antivirus is kaspersky. the solution is to
turn of your antivirus or make the antivirus pause then run the code it will work
import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {

        URL oracle = new URL("http://www.oracle.com/");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(oracle.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}

A: I have faced the same problem.My anitvirus is kaspersky.the solution for this is,open kapsperksy->settings->Anti virus protection->moinitored ports->select

A: I got this message when trying to open Socket with IPv4 address and Port 0. May be you should check the port used when you see this message.

A: I was creating a socket connection to a remote server by providing IP address and port number of the server. Was able to ping the server and was also able to telnet to the port. So no connectivity issues, still got same error posted in the question.
I made a silly mistake of passing in an empty string to creating the socket instance. It is useful to use debug mode to point out such mistakes.


text:
Q: Assigning new value to all array elements Is there a way to do something like this below?  I initialize an int array whose all elements are -1.  Is there a way of assigning a new value to all elements like below?
int[] arr = {-1,-1,-1,-1,-1,-1,-1};
arr = {0,1,2,5,7,18,20};

What i was trying to do is below.  There is a lot of cases (i just ut three here) I was close the first time around... It needs to be  arr = new[]{0,1,2,5,7,18,20}; in the lines below
private int[] getComboArray(int toLocation)
{
    int[] arr = new int[7];
    switch (toLocation)
    {
        case 0:
            arr = {0,1,2,5,7,18,20} ; //<-------
            break;
        case 1:
            arr = {2,3,2,4,4,19,20} ; //<-------
            break;
        case 2:
            arr = {4,3,2,5,4,11,10} ; //<-------
            break;
    }

    return arr;
}

A: //you can overwrite your previous array like this
int[] arr = {-1,-1,-1,-1,-1,-1,-1};
arr = new int[] {0,1,2,5,7,18,20};

A: Try this:
int[] arr = {-1,-1,-1,-1,-1,-1,-1};
new int[] {0,1,2,5,7,18,20}.CopyTo(arr, 0);

The address of the original array arr is preserved.

A: Honestly, there isn't enough information in your question to really identify what you need to accomplish.  Technically, it's pretty easy to assign new values to individual elements in the array, like so:
for(int i = 0; i < arr.Length; i++)
{
    arr[i] = i;
}

If you wanted all of your array elements to follow a specific pattern, like the above... You should just initialize it that way:
int[] arr = new int[] { 0, 1, 2, 5, 7, 18, 20 };

If you don't know what the values are but you have a source array and a destination array, then copying is another method:
int[] sourceArray = null;
// Something happens to fill your source array.
int[] destArray = new int[7];
Array.Copy(sourceArray, destArray, destArray.Length);

A: You can asssign new values using again the new keyword.
int[] arr = {-1,-1,-1,-1,-1,-1,-1};
arr =  new[] {0,1,2,5,7,18,20}; // 0,1,2,5,7,18,20

Using this, your function will look like below.
private int[] getComboArray(int toLocation)
{
    int[] arr = new int[7];
    switch (toLocation)
    {
        case 0:
            arr =  new [] {0,1,2,5,7,18,20} ; //<--
            break;
        case 1:
            arr = new []{2,3,2,4,4,19,20} ; //<--
            break;
        case 2:
            arr =new [] {4,3,2,5,4,11,10} ; //<--
            break;
    }

    return arr;
}

If you want to append new elements to the current array, you can create a List of the new elements and to append the array to it, after that you can convert it back to array.
int[] arr = {-1,-1,-1,-1,-1,-1,-1};
var concat = new List<int> {0, 1, 2, 5, 7, 18, 20};
concat.AddRange(arr);
arr = concat.ToArray(); // -1,-1,-1,-1,-1,-1,-1,0,1,2,5,7,18,20

A: int[] arr = {-1,-1,-1,-1,-1}
int[] arrTT = {0,1,2,5,7,18,20}

for(int i=0; i<arr.Length; i++)
{
   arr[i]=arrTT[i];
}


text:
Q: I can't serialize a list of tabular java tables using GSON I use Tabula (java) to extract tables contained in pdf files. After obtaining a list of tables I use the Gson class to realize this list. However, the following exception is thrown.
Table extraction and serelization
List<Table> tables = new PDFTableExtractor(document).extract(page);
new Gson().toJson(tables);

Exception thrown
java.lang.IllegalArgumentException: jdk.internal.ref.PhantomCleanable<?> declares multiple JSON fields named next
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:172)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
    at com.google.gson.Gson.getAdapter(Gson.java:458)

I'm using the Table class from the Tabula library. The class contains the following attributes:
private final String extractionMethod;
private int rowCount = 0;
private int colCount = 0;
private List<List<RectangularTextContainer>> memoizedRows = null;
/* visible for testing */ final TreeMap<CellPosition, RectangularTextContainer> cells = new TreeMap<>();

A: (maintainer of tabula-java here)
The library already implements serialization with Gson. Take a look at TableSerializer


text:
Q: How can I send the proactive message after 2 min of clicking on GetStarted button in facebook How can I send the proactive message after 2 min of clicking on GetStarted button in facebook
async function getstartedinterval(dialogContext)
{

  timeoutobj= setTimeout(function (dialogContext) {
      console.log('--- inside setTimeout----',dialogContext);// displaying as undefined
      notificationMsgGetStarted(dialogContext);
  },constant.timeinterval);

}

I have tried with SetTimeOut but DialogContext is not accessible in this function. Please suggest .


text:
Q: Restrict published data to a public channel I thought I understood what was going on here. But, apparently not. If I set up permissions like this, NO one receives published data.
{
    "channels": {
        "myChannel": {
            "auths": {
                "51EF3B88-3245-4CF1-B324-979F8E8A9EEF": {
                    "r": 1,
                    "w": 1
                },
                "F4EA7F64-27E3-4877-A86C-371FF7A9ABF2": {
                    "r": 1,
                    "w": 1
                }
            },
            "r": 0, // I thought this would turn OFF published data for the world
            "w": 0, // And the above auths would turn ON published data for the given keys
            "ttl": 1
        }
    },
    "subscribe_key": "my-sub-key",
    "level": "channel"
}

If I set it up like this, EVERYONE gets published data.
{
    "channels": {
        "myChannel": {
            "auths": {
                "51EF3B88-3245-4CF1-B324-979F8E8A9EEF": {
                    "r": 1,
                    "w": 1
                },
                "F4EA7F64-27E3-4877-A86C-371FF7A9ABF2": {
                    "r": 1,
                    "w": 1
                }
            },
            "r": 1, // this is the difference
            "w": 1, // this is the difference
        }
    },
    "subscribe_key": "my-sub-key",
    "level": "channel"
}

My test clients are Java. I have one setting an AuthKey to one of the above keys. The other is not setting an auth key. I can share that code if needed.
What am I not getting here?
Edit
Here are a couple code snippets. I am trying to set up a public channel for all users and then a private channel. What I see is clients that do not set a uuid can still see the published data.
The server permission setting code:
 pubnub = new Pubnub("myPubKey", "mySubKey", "mySecretKey");

 // the public channel
 pubnub.pamGrant("myChannel", true, true, ttl, callback);
 pubnub.pamGrant("myChannel", "F4EA7F64-27E3-4877-A86C-371FF7A9ABF2", true, true, ttl, callback);
 pubnub.pamGrant("myChannel", "51EF3B88-3245-4CF1-B324-979F8E8A9EEF", true, true, ttl, callback);

 // the private channels
 pubnub.pamGrant("F4EA7F64-27E3-4877-A86C-371FF7A9ABF2", "F4EA7F64-27E3-4877-A86C-371FF7A9ABF2", true, true, ttl, callback);
 pubnub.pamGrant("F4EA7F64-27E3-4877-A86C-371FF7A9ABF2", true, true, ttl, callback);

 pubnub.pamGrant("51EF3B88-3245-4CF1-B324-979F8E8A9EEF", "51EF3B88-3245-4CF1-B324-979F8E8A9EEF", true, true, ttl, callback);
 pubnub.pamGrant("51EF3B88-3245-4CF1-B324-979F8E8A9EEF", true, true, ttl, callback);

Edit 2
Here is my new attempt at granting permissions. This works, based on help from Craig.
  pubnub.pamGrant(Common.channelSummaries, Common.AuthKeyApp1, true, true, Common.ttl, callback);

  // grant read and write access to AuthKeyApp1 on the channel AuthKeyApp1
  pubnub.pamGrant(Common.AuthKeyApp1, Common.AuthKeyApp1, true, true, Common.ttl, callback);

  // grant read and write access to serverUUID on the channel AuthKeyApp1
  pubnub.pamGrant(Common.AuthKeyApp1, Common.serverUUID, true, true, Common.ttl, callback);

  pubnub.pamGrant(Common.channelSummaries, Common.AuthKeyApp2, true, true, Common.ttl, callback);

  // grant read and write access to AuthKeyApp1 on the channel AuthKeyApp1
  pubnub.pamGrant(Common.AuthKeyApp2, Common.AuthKeyApp2, true, true, Common.ttl, callback);

  // grant read and write access to serverUUID on the channel AuthKeyApp1
  pubnub.pamGrant(Common.AuthKeyApp2, Common.serverUUID, true, true, Common.ttl, callback);

  // grant read and write access to serverUUID on the channel channelNameGameSummaries
  pubnub.pamGrant(Common.channelSummaries, Common.serverUUID, true, true, Common.ttl, callback);

  // grant read and write access to serverUUID on the channel channelNameGameSummariesPresense
  pubnub.pamGrant(Common.channelSummariesPresense, Common.serverUUID, true, true, Common.ttl, callback);

  pubnub.pamGrant("", false, false, Common.ttl, callback);

  // Set the servers UUID to serverUUID
  pubnub.setUUID(Common.serverUUID);
  pubnub.setAuthKey(Common.serverUUID);

Thanks,
Scott

A: Scott,
I know you answered it already but just to make this official, the issue is that you granted at the channel level then granted at the auth-key level. Access Manager grants are like CSS in reverse: the more general rule overrides the more specific. So the auth-key grant is specific to that auth-key and only users that init PubNub using that auth-key have those access rights.
But a channel level grant (no auth-key specified) opens the channel up to all users. No auth-key required. If true/true is granted on a particular channel, then it is like you turned Access Manager off for that one channel.
If you grant access true/true at the subscriber-key level, it is the same as disabling Access Manager completely. This is typically not useful for anything other than programatically disabling/enabling Access Manager (for whatever reason).
To remove a grant from an auth-key, channel or sub-key (in other words, revoke it), you just grant with false/false. So to revoke at the sub-key level. And in our Java SDK there are revoke methods (many SDKs just rely on grant with false/false access.
See details on our docs site: http://www.pubnub.com/docs/java/javase/api/reference.html#_pubnub_access_manager
That should just about wrap up all your questions above. Let me know if I missed anything.


text:
Q: How to Move Folder in WebDav using Sardine? I am using Sardine client to move folder in WebDav. It is not working. But if it is file type it is working fine.
sardine.move("http://ip/webdav/kamesh/CloudDrive/test123","http://ip/webdav/kamesh/CloudDrive/Media/kmmm");

Please help me, what I need to do move folder?


text:
Q: how use POST instead GET on typehead.js? I'm trying to use POST instead of GET in typeahead plugin, I changed the type to POST using the method "beforeSend", but I don't know how to change the "XHR data" to: {query: "what was typed"}.
my code:
$('#myinput').typeahead({
    name: "myinput",
    remote: {
        url: 'clients.php',
        cache: false,
        beforeSend: function (jqXhr, settings) {
            settings.type = 'POST'
        }
    }
})

thanks for any help!

A: You'll find the solution here: typeahead.js remote beforesend post data issue
Basically you need to change settings.data, but also set settings.hasData to true.


text:
Q: Test `window.location.href` in Angular 4 Unit test I am trying to test a method in Angular4 which depends on window.location.href
My Method is as:
navigatePage(code: string) {
   const codeURL= (<HTMLInputElement>document.getElementsByClassName('urlvalue')[0])
                        .value;
   window.location.href = codeURL;
}

To Test this method, i have written code as follows:
describe('navigate to url', () => {
    it('should call click', () => {
      fixture.whenStable().then(() => {
        component.navigatePage(data.results[0].code);
      });
    });
});

When i check in test-coverage report then i see below line as not covered.
window.location.href = codeURL

Please assist.


text:
Q: C++: Help explaining behaviour of simple program I have the following program:
int a, b;
while (true)
{
    a = 0; b = 0;
    cout << "Enter input..." << endl;
    cin >> a >> b;
    cout << "You entered:" << endl;
    cout << a << endl << b << endl;
}

Now the program works as expected when I provide
the expected numeric input (i.e. "10 20").
However, if I input some bogus input like "a b",
the program goes into an infinite loop w/ the following output:
Enter input...
You Entered:
0
0
Enter input...
You Entered:
0
0
...and so on
Can someone explain why/how this happens?

A: cin would need to be flushed ...
basically you failed to read "a b" as numbers and you come back around in the loop with the same condition.
but best practice should probably be to read into a string then parse from the string

A: See this article:
Basic Input/Output C++

What happens in the example above if the user enters something else that cannot be interpreted as an integer? Well, in this case, the extraction operation fails. And this, by default, lets the program continue without setting a value for variable i

To stop this happening, you should be checking if the input received is in fact, an Integer.
As said above, maybe try something like stringstream instead and then parse the string.


text:
Q: Approximate an integral with Bessel functions Given $r,a,\lambda\in\mathbb{R}$, $r<a$, how can I find an approximate solution for the following definite integral?
$$
\int_0^\infty J_0 (\lambda r)J_1(\lambda a)\frac{1}{\sqrt{n+\lambda^2 }}\,d\lambda
$$
$J_0,J_1$ are Bessel function of first kind, $0$th and $1$st order, respectively. $n$ is an imaginary parameter ($i\omega/\alpha$ where $\omega$ is angular frequency and $\alpha$ is thermal diffusivity) and cannot be considered small. $\lambda$ is the Fourier transform variable, $r$ is the radial coordinate and $a$ is a constant and can be considered small.


text:
Q: Is the TMDS intended for long distance transmission? The TMDS Transition-minimized differential signaling is similar to LVDS but not identical. I have a few questions about it:

*

*Why does it use current mode logic instead of the ubiquitous voltage mode signal?

*Is it intended for use on PCB for IC-IC transmission or across distances between systems via cables?

*What was the limitation of LVDS that prompted creation of TMDS?

A: Short answer is yes, TMDS is intended for long distances, but it depends if you consider roughly 10 meters as long.
Longer answer, the two terms are not exactly comparable.
TMDS is a special kind of 8b/10b line code, a data coding method, which is specified to be sent using CML PHY layer, while LVDS is strictly a PHY layer that can be used to send any data with or without line coding.

*

*Speed. CML (used commonly on TMDS interfaces) allows for faster data rates than LVDS.

*Both. For example links between high speed chips can use CML for speed, and also your displays connected with DVI and HDMI use TMDS with CML over the video cables.

*Same as 1, speed.


text:
Q: Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN I am getting below exception

org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

Configuration: RabbitMQ 3.3.5 on windows
On Config file in %APPDATA%\RabbitMQ\rabbit.config
I have done below change as per https://www.rabbitmq.com/access-control.html
[{rabbit, [{loopback_users, []}]}].

I also tried creating a user/pwd - test/test doesn't seem to make it work.
Tried the Steps from this post.
Other Configuration Details are as below:
Tomcat hosted Spring Application Context:
<!-- Rabbit MQ configuration Start -->
    <!-- Connection Factory -->
    <rabbit:connection-factory id="rabbitConnFactory" virtual-host="/" username="guest" password="guest" port="5672"/>

    <!-- Spring AMQP Template -->
    <rabbit:template id="rabbitTemplate" connection-factory="rabbitConnFactory" routing-key="ecl.down.queue" queue="ecl.down.queue" />

    <!-- Spring AMQP Admin -->
    <rabbit:admin id="admin" connection-factory="rabbitConnFactory"/>

    <rabbit:queue id="ecl.down.queue" name="ecl.down.queue" />

    <rabbit:direct-exchange name="ecl.down.exchange">
        <rabbit:bindings>
            <rabbit:binding key="ecl.down.key" queue="ecl.down.queue"/>
        </rabbit:bindings>
    </rabbit:direct-exchange>

In my Controller Class
@Autowired
RmqMessageSender rmqMessageSender;

//Inside a method
rmqMessageSender.submitToECLDown(orderInSession.getOrderNo());

In My Message sender:
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("messageSender")
public class RmqMessageSender  {

    @Autowired
    AmqpTemplate                rabbitTemplate;

    public void submitToRMQ(String orderId){
        try{
            rabbitTemplate.convertAndSend("Hello World");
        } catch (Exception e){
            LOGGER.error(e.getMessage());
        }
    }
}

Above exception Block gives below Exception

org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

Error Log
  =ERROR REPORT==== 7-Nov-2014::18:04:37 ===
closing AMQP connection <0.489.0> (10.1.XX.2XX:52298 -> 10.1.XX.2XX:5672):
    {handshake_error,starting,0,
                     {amqp_error,access_refused,
                                 "PLAIN login refused: user 'guest' can only connect via localhost",
                                 'connection.start_ok'}}

Pls find below the pom.xml entry
        <dependency>
            <groupId>org.springframework.amqp</groupId>
            <artifactId>spring-rabbit</artifactId>
            <version>1.3.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-amqp</artifactId>
            <version>4.0.4.RELEASE</version>
        </dependency>

Please let me know if you have any thoughts/suggestions

A: To allow guest access remotely, write this
[{rabbit, [{loopback_users, []}]}].

to here
c:\Users\[your user name]\AppData\Roaming\RabbitMQ\rabbitmq.config

then restart the rabbitmq windows service (Source https://www.rabbitmq.com/access-control.html)

A: To complete @cpu-100 answer,
in case you don't want to enable/use web interface, you can create a new credentials using command line like below and use it in your code to connect to RabbitMQ.
$ rabbitmqctl add_user YOUR_USERNAME YOUR_PASSWORD
$ rabbitmqctl set_user_tags YOUR_USERNAME administrator
$ rabbitmqctl set_permissions -p / YOUR_USERNAME ".*" ".*" ".*"

A: On localhost  , By default  use 'amqp://guest:guest@localhost:5672'
So on a remote or hosted RabbitMQ. Let's say you have the following credentials
username: niceboy
password: notnice
host: goxha.com
port : 1597
then the uri you should pass will be
amqp://niceboy:notnice@goxha.com:1597
following the template amqp://user:pass@host:10000
if you have a vhost you can do amqp://user:pass@host:10000/vhost where the trailing vhost will be the name of your vhost

A: New solution:
The node module can't handle : in a password properly. Even url encoded, like it would work normally, it does not work.
Don't use typicalspecial characters from an URL in the password!
Like one of the following: : . ? + %

Original, wrong answer:
The error message clearly complains about using PLAIN, it does not mean the crendentials are wrong, it means you must use encrypted data delivery (TLS) instead of plaintext.
Changing amqp:// in the connection string to amqps:// (note the s) solves this.

A: just add login password to connect to RabbitMq
 CachingConnectionFactory connectionFactory =
         new CachingConnectionFactory("rabbit_host");

 connectionFactory.setUsername("login");
 connectionFactory.setPassword("password");

A:
user 'guest' can only connect via localhost

That's true since RabbitMQ 3.3.x. Hence you should upgrade to the same version the client library, or just upgrade Spring AMQP to the latest version (if you use dependency managent system).
Previous version of client used 127.0.0.1 as default value for the host option of ConnectionFactory.

A: For me the solution was simple: the user name is case sensitive. Failing to use the correct caps will also lead to the error.

A: The error
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
can occur if the credentials that your application is trying to use to connect to RabbitMQ are incorrect or missing.
I had this happen when the RabbitMQ credentials stored in my ASP.NET application's web.config file had a value of "" for the password instead of the actual password string value.

A: if you use the number as your password, maybe you should try to change your password using string.
I can login using deltaqin:000000 on the website, but had this while running the program. then change the password to deltaiqn. and it works.

A: I am sure what Artem Bilan has explained here might be one of the reasons for this error:

Caused by: com.rabbitmq.client.AuthenticationFailureException:
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN.
For details see the

but the solution for me was that I logged in to rabbitMQ admin page (http://localhost:15672/#/users) with the default user name and password which is guest/guest then added a new user and for that new user I enabled the permission to access it from virtual host and then used the new user name and password instead of default guest and that cleared the error.

A: I made exactly what @grepit made.
But I had to made some changes in my Java code:
In Producer and Receiver project I altered:
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("your-host-ip");
factory.setUsername("username-you-created");
factory.setPassword("username-password");

Doing that, you are connecting an specific host as the user you have created.
It works for me!

A: In my case I had this error, cuz of wrongly set password (I tried to use 5672, when the actual one in my system was 5676).
Maybe this will help someone to double check ports...

A: I was facing this issue due to empty space at the end of the password(spring.rabbitmq.password=rabbit ) in spring boot application.properties got resolved on removing the empty space. Hope this checklist helps some one facing this issue.

A: For C# coder, I tried below code and It worked, may be this can help someone so posting here.
scenario- RabbitMQ queue is running on another system in local area network but I was having same error.
by default there is a "guest" user exists. but you can not access remote server's queue (rabbitMq) using "guest" user so you need to create new user, Here I created "tester001" user to access data of remote server's queue.
ConnectionFactory factory = new ConnectionFactory();
factory.UserName = "tester001";
factory.Password = "testing";
factory.VirtualHost = "/";
factory.HostName = "192.168.1.101";
factory.Port = AmqpTcpEndpoint.UseDefaultPort;

A: If you tried all of these answers for your issue but you still got "ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN", maybe you should remove rabbitmq and install it with a newer version.
Newer version worked for me.

A: Add one user and pass and connect to them. You can add 1 user via env variables (e.g., useful when Rabbit initializes in a Docker): RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS. See more details here:
https://stackoverflow.com/a/70676040/1200914

A: set ConnectionFactory or Connection hostname to localhost


text:
Q: Coding a simple parking fee calculator using only C functions I have been given the following assignment:

Write a function (documentation included) that given the entry and the
  exit time of a vehicle in a parking lot, and the hourly rate,
  calculates the amount due.
Assumptions:

*

*no overnight parking

*there is no charge for part of an hour

*the time is given in military style (1:20p.m. is 1320)

  You also have to write a test-driver for your function:  in main()
  declare and initialize as many variables as needed,  then call the
  function and display the amount.

This is the code:
int calcRate (int entry , int exit);

int main (void)
{
    // Local Declarations
    int entry;
    int exit;

    //Statements
    printf("Please Enter Entry and Exit time(In military style. For example : 9.30am as
           0930)\n");
    scanf("%d %d\n",&entry , &exit);

    double fee = calcRate(entry,exit);

    printf("Your Parking Fees are %f\n", fee);

    return 0;
}   //main

/*==============calcRate================
 This function calculates the cost of parking
 */

double calcRate (int entry,int exit,double cost)
{
    int hours;
    double rate = 2.00;
    //Statements
    hours = (exit-entry)/100;
    cost = hours * rate;

    return (cost);
}
//calcRate

I cannot build it and I am facing problems with it. For example, I get the following error:

Undefined symbols for architecture x86_64: "calcRate(int, int)", referenced from: _main in Parking.o (maybe you meant: calcRate(int, int, double)

I'm stuck for almost 2 hours now.
Any kind souls out there?

A: Difference between function declaration and definition
Function Declarations
int calcRate (int entry , int exit);

Definition header
double calcRate (int entry,int exit,double cost)

So either change Declaration  or definition header
for Eg:
Change definition header to
int calcRate(int entry,int exit)

and add declare
double cost

within  function calcRate.
Instead of
  printf("Please Enter Entry and Exit time(In military style. For example : 9.30am as 0930)\n");
  scanf("%d %d\n",&entry , &exit);

Do
 printf("Please Enter Entry (In military style. For example : 9.30am as 0930)\n");
 scanf("%d",&entry);
 printf("\n Please exit Entry (In military style. For example : 9.30am as 0930)\n");
 scanf("%d",&exit);

No "\n" within scan.
EDIT:
In case of overnightparking
Instead of
hours = (exit-entry)/100;

use
if(exit>entry)
    hours = (exit-entry)/100;
else
    {
        int overnightHours;
        overnightHours = (entry-exit)/100;
        hours=2400-overnightHours;
    }

This  will remove negative value.

A: Try this::
#include <stdio.h>

void calcRate (int entry , int exit, double *cost);

int main (void)
{
    int entry;
    int exit;
    double cost=0 ;

    printf("Please Enter Entry time(In military style. For example : 9.30am as 0930)\n");
    scanf("%d", &entry);
    printf("Please Enter Exit time(In military style. For example : 9.30am as 0930)\n");
    scanf("%d", &exit);

    calcRate(entry,exit,&cost);
    printf("Your Parking Fee is %lf\n", cost);
    return 0;
}

void calcRate (int entry , int exit, double *cost)
{
    double hours;
    double rate = 2.00;

    hours = (double)(exit-entry)/100 ; //you need to convert your HRS correctly, ex-     entry=0930, exit=1000. cost should be 1.000 but your code will print 1.4000
    *cost = hours * rate;
}

A: int calcRate (int entry , int exit);

int main (void)
{
// Local Declarations
int entry;
int exit;

//Statements
printf("Please Enter Entry time (In military style :  0930)\n");
scanf("%d",&entry);

printf("Please Enter Exit time (In military style :  0930)\n");
scanf("%d"&exit);

Also no \n is required in scanf()
double fee = calcRate(entry,exit);

printf("Your Parking Fees are %lf\n", fee);

needs %lf because fee is double
return 0;
}

double calcRate (int entry,int exit)
{
double cost;
double hours;
double rate = 2.00;
//Statements
hours = ((double)(exit-entry))/100;

Here you have done integer division which may cause error.
So make hours as double.
cost = hours * rate;

return cost;

}


text:
Q: How to embed newlines in a macro inside a recipe? I have a target like this:
curly:
    curl --header "Content-Type: application/json" --data \
    'data line 1 \
    data line 2' \
    ${URL}

It's important that the two data lines echo separately to make it easier for the user of the Makefile to see what's going on.
This works nicely. But then I wanted to add a second target. I don't want to duplicate the data so hoped to define a macro and use it in both targets:
DATA = data line 1 \
       data line 2

curlier:
    curl --header "Content-Type: application/json" --data \
    '${DATA}' \
    ${URL2}

This doesn't work as well. The command executes correctly, but the data lines are run together when the recipe is echoed.
I tried the trick of defining a newline macro and embedding it in the DATA string, to no avail.
I can get clean output by invoking make recusively, but my reviewer doesn't like that.
Any other suggestions?

A: define newln :=

endef

DATA := data line 1 \$(newln) data line 2

curlier:
        curl --header "Content-Type: application/json" --data \
        '${DATA}' \
        ${URL2}

But to be honest, I would try to explain to your reviewer that fiddling with technically superfluous spaces and newlines in makefiles is lowering the quality of a makefile instead of raising it.

A: This is what I ended up with:
curly_URL    := http://somewhere
curlier_URL  := http://somewhere_else
CURL_URL     ?= ${$@_URL}

# Slightly unusual approach in order to keep the command-line output legible.
curly curlier:
    curl --header "Content-Type: application/json" --data \
    'data line 1 \
    data line 2' \
    ${CURL_URL}

H/T Pauli Nieminen