text:
Q: Why is it better to accelerate electrons in a linear collider? An accelerated charge (say an electron for simplicity) emits photons. Changing direction of movement is an acceleration. Electron-positron collisions are preferably done in linear colliders. But why is this the case? Also in a linear collider the charges are accelerated and should therefore emit photons (which means that they lose energy, something you don't want).
An answer including

*

*Feynman graph

*cross section (why should it be more likely to emit a photon on a bent track than on a straight one?)

*QED

would be highly appreciated.

A: I heard in my particle physics lectures that the reason against circular $e^{\pm}$ accelerators were the huge synchrotron radiation energy losses.
For a particle rotating around a magnetic field line with intensity $B$, one can derive from the Larmor formula
\begin{equation}
\frac{d E}{d t} =
\frac{16 \pi}{3} \left(\frac{Q^2}{m c^2} \right)^2 c \left(\frac{B^2}{8 \pi} \right) \gamma^2 \beta^2 \sin^2\theta
\end{equation}
where Q is the charge, $m$ the mass of the particle, $\gamma$ and $\beta$ its Lorentz factor and velocity, respectively, $\theta$ is the pitch angle with respect to the direction of the magnetic field lines ($\sin\theta=1$ if the motion is in the plane orthogonal to the magnetic field lines).

Following the suggestion of @Mark H, let us simplify the formula further. Recalling $E = \gamma m c^2$:
\begin{equation}
\left( \frac{d \gamma}{d t} \right)_{\rm syn} =
\frac{16 \pi}{3} \frac{Q^4}{m^3 c^5} \, U_B \gamma^2 \beta^2 \sin^2\theta
\end{equation}
where I have introduced the magnetic field energy density as $U_B = B^2 / 8\pi$.

As you can see $d\gamma/ dt \propto 1/m^3$, therefore the ratio of energy losses by synchrotron radiations for electrons will be $\approx 6\times10^{9}$ higher than for protons and this poses a severe limit to the circular acceleration of electrons, while the effect is negligible for protons.
My answer does not contain all the specifics you required, but it shows you can derive an explanation from simple electrodynamics (Larmor formula).


text:
Q: Catch specific submitted form I have the following code:
$('#my-modal').modal('show');
...

$('form').submit(function(){
    ...
}

How can I adjust my code in order to catch only submitted #my-modal form? And not all kind of forms?
Thanks.

A: $('#my-modal').find('form').submit(function() {

});

The jQuery find command looks only within the element so this would return only the form in your modal.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Linq2SQL+Repository pattern: how to implement type related mapping I have the Repository pattern implemented to access DB data through the Linq2Sql ORM:
public abstract class RepositoryBase<T, TDb> : IRepository<T>
    where T : IEntity
    where TDb : class, IDbEntity, new()
{
    protected RepositoryBase(IUnityContainer container)
    {
        _container = container;

        _context = _container.Resolve<CMCoreDataClassesDataContext>();
    }

    public IQueryable<T> GetAll()
    {
        return GetTable().Select(GetConverter());
    }

    protected abstract Table<TDb> GetTable();
    protected abstract Expression<Func<TDb, T>> GetConverter();

    protected CMCoreDataClassesDataContext Context { get { return _context; } }

    private readonly IUnityContainer _container;
    private readonly CMCoreDataClassesDataContext _context;
}

Here is an example of particular Repository implementation:
public class CustomerProductRepository
    : RepositoryBase<ICommonCustomerProduct, CMCoreDAL.DbData.CustomerProduct>
{
    protected override Table<CMCoreDAL.DbData.CustomerProduct> GetTable()
    {
        return Context.CustomerProducts;
    }

    protected override Expression<Func<CMCoreDAL.DbData.CustomerProduct, ICommonCustomerProduct>> GetConverter()
    {
        return dbEntity => dbEntity.ProdId == (int)ProductType.ProductTypeEnum.CommonProduct
                    ? new CommonCustomerProduct
                    {
                        UnityContainer = UnityContainer,
                        InstanceId = dbEntity.InstanceId,
                        CustomerId = dbEntity.CustomerID,
                        StatusCode = dbEntity.StatusCode,

                        DeviceLicenses = dbEntity.DeviceLicenses,
                        ServerLicenses = dbEntity.ServerLicenses,
                    }
                    : new SpecificCustomerProduct()
                    {
                        UnityContainer = UnityContainer,
                        InstanceId = dbEntity.InstanceId,
                        CustomerId = dbEntity.CustomerID,
                        StatusCode = dbEntity.StatusCode,

                        UserLicenses = dbEntity.DeviceLicenses,
                    }
         ;
    }

Here SpecificCustomerProduct is inherited from CommonCustomerProduct.
Presented source code shows how records from DB are mapped to different instances according to instance type. There are a lot of common fields for these classes and only few of them are different.
I have 2 concerns for this code:

*

*Some duplications of assignment operations;

*Low readability: in order to add few more concrete classes I need to make unreadable chain:
return dbEntity => dbEntity.ProdId == iType1
                ? new Type1
                {
                    ... assignments
                }
                :
                {
                    dbEntity.ProdId == iType2
                    ? new Type2
                    {
                        ... assignments
                    }
                    : new Type3
                    {
                        ... assignments
                    }
                }

Is there any better way to implement 'type-related' mapping with such pattern?

A: Have you looked at LINQ to SQL's Inheritance mapping?  It allows you to map different classes to a common table, using a database column (type discriminator) to determine which type of object to generate.


text:
Q: Delayed Jobs: handle_asynchronously with variable execution time I want to run a delayed function after X seconds.
X is determinated by an object's field.
I tried this:
# after_create this function is triggered
def save_distance
    update_attribute :distance, 5
end

# function gets delayed by X seconds (X = field named "timespan" of my object)
handle_asynchronously :save_distance, :run_at => Proc.new { timespan.seconds.from_now }

But it doesn't work, returns:
undefined local variable or method `timespan' for #<Class:0x007f9b9d4f4c88>

How can it be done?

A: You need to pass in a parameter to the proc
handle_asynchronously :save_distance, :run_at => Proc.new {|object| object.timespan.seconds.from_now }


text:
Q: Cannot send cross domain ajax request with post method I wrote rest service with spring mvc:
@RequestMapping(value = "/login", headers="Accept=*/*", method = RequestMethod.POST,
        produces="application/json")
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public UserLoginedVO findUsByPass(HttpServletResponse response,
        @RequestBody UserLoginCO userco) throws Exception{

    response.setHeader("Access-Control-Allow-Origin","*");

    UserLoginedVO usVO = userService.findUsByPass(userco.getUsername(), userco.getPassword());
    return usVO;
}

test with postman, it returns right result
I call this service by jquery like below:
var json = {"username":"giau", "password":"1234"};

$.ajax({
            data: JSON.stringify(json),
            url: 'http://192.168.1.119:8080/mos/api/users/login',
            type: 'POST',
            dataType: 'json',
            contentType:"application/json",
            crossDomain:true,
            async:false,
            success:function(data)
            {
               alert("Data from Server"+JSON.stringify(data));
            },
            error:function(jqXHR,textStatus,errorThrown)
            {
               alert("You can not send Cross Domain AJAX requests: "+errorThrown);
            }
        }).done(function(data){
            alert("aaaaaa");
        });

I get an error:

XMLHttpRequest cannot load.
   No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource This can be fixed by moving the resource to the same domain or enabling CORS.

This disallows post json data to rest service with cross domain, although I use crossDomail:true
How can I fix this?


text:
Q: Is there a way to use H.264 with custom color repersentation? I'm currently developing new file format, it's a video with custom color representation. Every color is a single byte; there's a constant RGBA colors array, every byte of the frame is the index of color in this array. Therefore every pixel in a single byte.
So I'm looking for a way to compress videos with such format. My first idea was is create this video format myself (which unfortunately failed), second idea is H.264, but I don't know if there's any way to use H.264 this way. So is there? Or maybe there's another way to compress such video data? (except gzip, lzma, bzip2, 7zip and so on)
Please, don't close this question. I'll add all asked details if needed.

A: The best I can suggest for such idea would be to encode it in 4:0:0 (mono) colorspace in lossless mode in H.264. For x264 this would mean options: --input-csp i400 --output-csp i400 --qp 0. But I doubt motion compensation would be good in such palette colorspace.


text:
Q: Selenium Add EventListener to RemoteWebDriver I'd like to add an EventListener to an instance of RemoteWebDriver. Is this in any way possible or is there an alternative way to achieve the same thing in selenium (except mayby to implement an Observer pattern and code everything from ground up).
I have tried to use the EventFiringDecorator and the WebDriverListener, but the decorate(WebDriver driver) method returns an instance of ByteBuddy that is then casted to (WebDriver) and returned, so the returning instance of WebDriver can not be casted to RemoteWebDriver.
I would like to add the listener optionally, like in the following code snippet, when creating an instance of RemoteWebDriver.
class Foo {

 private RemoteWebDriver driver = null;

 public RemoteWebDriver initializeDriver() {

     //setup of remoteWebDriver
     //...

     if(eventListenerIsActivated) {
         MyEventListener myEventListener = new EventListener(driver);
         EventFiringDecorator eventFireDec = new EventFirirngDec(myEventListener);

         //not possible, throws ClassCastException!
         driver = (RemoteWebDriver) eventFireDec.decorate(driver);
     }
     return driver;
 }
}

class MyEventListener implements WebDriverListener { //... }

A: You can try something like:
EventFiringDecorator eventFireDec = new EventFirirngDec(myEventListener).decorate(driver);

WrapsDriver wrapperAccess = (WrapsDriver) eventFireDec;

driver = (RemoteWebDriver) wrapperAccess.getWrappedDriver();


text:
Q: How to add custom styling to Angular material forms What is the proper way to theme an angular material form, local to a component?
I have a few form elements in my component template like this:
<mat-form-field class="signin-input">
    <mat-label>Email</mat-label>
    <input matInput type="email" formControlName="email">
</mat-form-field>

I want the placeholder text and the label to be #FFF, it's #000 initially.
I am adding these styles to the component scss, but they are not taking effect:
.mat-form-field-label,
.mat-focused .mat-form-field-label {
    color: #FFF !important;
}

I see that the styles in theming.scss is always being applied, irrespective of my stylesheet:
@mixin mat-form-field-theme($theme) {
    ....
    ....
    .mat-focused .mat-form-field-label {
        color: #000;

        &.mat-accent {
            color: #000;
        }

        &.mat-warn {
            color: #000;
        }
    }

I want the color to be #FFF, but they are always #000. I found this link, but its too much of a hassle for a simple change like this.
How do I go about this?
PART - B
I see that the styles that I write, are appended with [_ngcontent-c16]. I have found that removing this tag on the fly from the dev console makes my styles take effect. What is this [_ngcontent-c16] ?
The project was set-up from angular-cli, and I am new to SCSS and Angular5 (I have worked extensively on Angular 1)

A: Writing simple CSS styles wont override it, we need to use a special selector called host. More about it here.
Here is what worked for me:
:host {
    .mat-form-field-label,
    .mat-focused .mat-form-field-label {
        color: #FFF !important;
    }
}


text:
Q: Interaction in Survival analysis I am a physician and clearly not a statistician (I try to understand why and how to perform the right analysis, but I don't understand the formulas). I am using SPSS v.19 in analyzing my data.
I try to analyze if a biomarker is associated with an increased mortality risk in a subpopulation from my study and I don't know if my analysis is correctly performed.
This the result (part of it) for the entire population:

This is for the one of the subgroups:

This is for the other subgroup:

In this situation, I wanted to see if the association with the mortality risk in the second group was truly significant and I performed a Cox survival analysis with an interaction term: Biomarker value*LOT_1:

Is this analysis correct? And if it is, from this output I should understand that there is no statistically significant association with mortality for the studied biomarker in the second subgroup (no difference for this association in between the two subgroups)?
Thank you.
LE: This is the output including also the main effect of LOT_1.

A: You should almost never include an interaction without both main effects.
In your final table, the interaction and the LOT variable are highly significant and Biomarker is not sig and is also small.
In summary, this means that Biomarker has little effect when LOT1 = 0 (which would be that it is the other lot) but has more of an effect when LOT1 = 1.
(The above assumes that LOT1 is coded 0-1)


text:
Q: Basic concept of centripetal force - part 2 Let us imagine a body is moving in a circular path. There is a centripetal force working on that object. A common (mis)intuition would be since the body is rotating in a circle, the centripetal force must be equal in all cases or else it won't be in a perfect circle. But it however isn't true since $v$ can be different in $\frac{mv^2}{r}$. Why isn't it necessary for equal centripetal force to be present for a complete circle? I beg pardon beforehand if this question is silly and absurd.

A: It seems you are answering your own question: since the centripetal force depends on tangential velocity, the (reaction) force will change for a mass that moves at varying tangential velocity on the same geometric circle.
A typical scenario is where the mass is driven by some kind of engine, e.g. when you are driving in a car and decelerating while you are already in the (assumed perfect circle) curve. You decelerate because your intuition tells you that this will decrease the centripetal force and keep you from crashing into the fields.
What may be causing your confusion is the fact, that an otherwise (i.e. except for the circular constraint) free mass, i.e. one that has no engine and no friction and no gravity tangential to the circle, will keep its tangential velocity and hence, experience constant centripetal force.

A: Like you point out yourself the centripetal force changes because the velocity does. It may seem counterintuitive since most examples of uniform circular motion $v$ remains constant. One way to understand it intuitively is to look at vertical circular motion under constant gravitational force. In this case |$v$| keeps increasing as the particle goes down and now if the centripetal force were to remain constant the particle would tend to fly away from circular trajectory. Hence, circular motion requires that the centripetal force changes with velocity.

A: It is important to realize that velocity and forces are vectors; they have a direction. For a centripetal force, by definition the direction of the force is towards the center.
Now, let's assume that the velocity is orthogonal to the force. That means the acceleration will also be orthogonal to the velocity - and remember that acceleration is the (vector) derivative of velocity. Hence, the change of the velocity is orthogonal to the direction of that velocity.
So why can't the magnitude of the velocity change in a circular path? Because there's zero force and zero acceleration along the path.
For elliptical orbits, we see that the velocity changes during most of its path, just not in the apoapsis and periapsis (closest and furthest points). And that is because at those points, and only at those points, the centripetal force is orthogonal to the orbit. Comets typically follow such an elliptical path around the sun.


text:
Q: Uncaught TypeError: Cannot read property 'then' of undefined SweetAlert & jquery Was working around 5 days ago, just went onto the website and it no longer works, checked Chrome console & found this error.
Rest of the code works just fine, everything pops up as expected. the .then has just broken itself. not sure if due to an update.
Can anyone see what's going wrong? I'm new to JS, Jquery etc.

Uncaught TypeError: Cannot read property 'then' of undefined
      at Object.success ((index):204)
      at c (jquery-3.4.1.min.js:2)
      at Object.fireWith [as resolveWith] (jquery-3.4.1.min.js:2)
      at l (jquery-3.4.1.min.js:2)
      at XMLHttpRequest. (jquery-3.4.1.min.js:2)

Here is the code that is running
<link href="https://cdn.rawgit.com/t4t5/sweetalert/32bd141c/dist/sweetalert.css" rel="stylesheet">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/t4t5/sweetalert/32bd141c/dist/sweetalert.min.js"></script>

<script type="text/javascript" language="javascript">
$(document).ready(function() {
addListItem();

     });
function addListItem(){
        $.get("https://www.cloudflare.com/cdn-cgi/trace",     function(data) {
            arrayOfLines = data.match(/[^\r\n]+/g);
            var arrayLength = arrayOfLines.length;
            for (var i = 0; i < arrayLength; i++) {
                if(arrayOfLines[i].startsWith("loc")){
                    var countCode = arrayOfLines[i].split("=")[1]
                    var countName = getCountryName(countCode);
                    if(countCode != "US"){
                    swal({

                        title: "Looks like you're from " + countName + ". ",
                        text: "Go to our International Store? ",
                        imageUrl: 'https://www.countryflags.io/' + countCode + '/flat/64.png',
                        imageWidth: 128,
                        imageHeight: 128,
                        showCancelButton: true,
                        showConfirmButton: true,
                        confirmButtonText: 'Yes take me there',
                        cancelButtonText: 'Stay on U.S.A Site',
                        imageAlt: 'Custom image',
                        dangerMode: false,
                    })
                    .then((willDelete) => {
                        if (willDelete) {
                            window.open('https://thebrainary.com/cart.php?action=buy&sku=SKU8474-82&source=HRGW','_blank');
                        }
                    });
                    }
                }
            }
        });
    }
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',
'AG' : 'Antigua And Barbuda',
'AR' : 'Argentina',
'AM' : 'Armenia',
'AW' : 'Aruba',
'AU' : 'Australia',
'AT' : 'Austria',
'AZ' : 'Azerbaijan',
'BS' : 'Bahamas',
'BH' : 'Bahrain',
'BD' : 'Bangladesh',
'BB' : 'Barbados',
'BY' : 'Belarus',
'BE' : 'Belgium',
'BZ' : 'Belize',
'BJ' : 'Benin',
'BM' : 'Bermuda',
'BT' : 'Bhutan',
'BO' : 'Bolivia',
'BA' : 'Bosnia And Herzegovina',
'BW' : 'Botswana',
'BV' : 'Bouvet Island',
'BR' : 'Brazil',
'IO' : 'British Indian Ocean Territory',
'BN' : 'Brunei Darussalam',
'BG' : 'Bulgaria',
'BF' : 'Burkina Faso',
'BI' : 'Burundi',
'KH' : 'Cambodia',
'CM' : 'Cameroon',
'CA' : 'Canada',
'CV' : 'Cape Verde',
'KY' : 'Cayman Islands',
'CF' : 'Central African Republic',
'TD' : 'Chad',
'CL' : 'Chile',
'CN' : 'China',
'CX' : 'Christmas Island',
'CC' : 'Cocos (Keeling) Islands',
'CO' : 'Colombia',
'KM' : 'Comoros',
'CG' : 'Congo',
'CD' : 'Congo, Democratic Republic',
'CK' : 'Cook Islands',
'CR' : 'Costa Rica',
'CI' : 'Cote D\'Ivoire',
'HR' : 'Croatia',
'CU' : 'Cuba',
'CY' : 'Cyprus',
'CZ' : 'Czech Republic',
'DK' : 'Denmark',
'DJ' : 'Djibouti',
'DM' : 'Dominica',
'DO' : 'Dominican Republic',
'EC' : 'Ecuador',
'EG' : 'Egypt',
'SV' : 'El Salvador',
'GQ' : 'Equatorial Guinea',
'ER' : 'Eritrea',
'EE' : 'Estonia',
'ET' : 'Ethiopia',
'FK' : 'Falkland Islands (Malvinas)',
'FO' : 'Faroe Islands',
'FJ' : 'Fiji',
'FI' : 'Finland',
'FR' : 'France',
'GF' : 'French Guiana',
'PF' : 'French Polynesia',
'TF' : 'French Southern Territories',
'GA' : 'Gabon',
'GM' : 'Gambia',
'GE' : 'Georgia',
'DE' : 'Germany',
'GH' : 'Ghana',
'GI' : 'Gibraltar',
'GR' : 'Greece',
'GL' : 'Greenland',
'GD' : 'Grenada',
'GP' : 'Guadeloupe',
'GU' : 'Guam',
'GT' : 'Guatemala',
'GG' : 'Guernsey',
'GN' : 'Guinea',
'GW' : 'Guinea-Bissau',
'GY' : 'Guyana',
'HT' : 'Haiti',
'HM' : 'Heard Island & Mcdonald Islands',
'VA' : 'Holy See (Vatican City State)',
'HN' : 'Honduras',
'HK' : 'Hong Kong',
'HU' : 'Hungary',
'IS' : 'Iceland',
'IN' : 'India',
'ID' : 'Indonesia',
'IR' : 'Iran, Islamic Republic Of',
'IQ' : 'Iraq',
'IE' : 'Ireland',
'IM' : 'Isle Of Man',
'IL' : 'Israel',
'IT' : 'Italy',
'JM' : 'Jamaica',
'JP' : 'Japan',
'JE' : 'Jersey',
'JO' : 'Jordan',
'KZ' : 'Kazakhstan',
'KE' : 'Kenya',
'KI' : 'Kiribati',
'KR' : 'Korea',
'KW' : 'Kuwait',
'KG' : 'Kyrgyzstan',
'LA' : 'Lao People\'s Democratic Republic',
'LV' : 'Latvia',
'LB' : 'Lebanon',
'LS' : 'Lesotho',
'LR' : 'Liberia',
'LY' : 'Libyan Arab Jamahiriya',
'LI' : 'Liechtenstein',
'LT' : 'Lithuania',
'LU' : 'Luxembourg',
'MO' : 'Macao',
'MK' : 'Macedonia',
'MG' : 'Madagascar',
'MW' : 'Malawi',
'MY' : 'Malaysia',
'MV' : 'Maldives',
'ML' : 'Mali',
'MT' : 'Malta',
'MH' : 'Marshall Islands',
'MQ' : 'Martinique',
'MR' : 'Mauritania',
'MU' : 'Mauritius',
'YT' : 'Mayotte',
'MX' : 'Mexico',
'FM' : 'Micronesia, Federated States Of',
'MD' : 'Moldova',
'MC' : 'Monaco',
'MN' : 'Mongolia',
'ME' : 'Montenegro',
'MS' : 'Montserrat',
'MA' : 'Morocco',
'MZ' : 'Mozambique',
'MM' : 'Myanmar',
'NA' : 'Namibia',
'NR' : 'Nauru',
'NP' : 'Nepal',
'NL' : 'Netherlands',
'AN' : 'Netherlands Antilles',
'NC' : 'New Caledonia',
'NZ' : 'New Zealand',
'NI' : 'Nicaragua',
'NE' : 'Niger',
'NG' : 'Nigeria',
'NU' : 'Niue',
'NF' : 'Norfolk Island',
'MP' : 'Northern Mariana Islands',
'NO' : 'Norway',
'OM' : 'Oman',
'PK' : 'Pakistan',
'PW' : 'Palau',
'PS' : 'Palestinian Territory, Occupied',
'PA' : 'Panama',
'PG' : 'Papua New Guinea',
'PY' : 'Paraguay',
'PE' : 'Peru',
'PH' : 'Philippines',
'PN' : 'Pitcairn',
'PL' : 'Poland',
'PT' : 'Portugal',
'PR' : 'Puerto Rico',
'QA' : 'Qatar',
'RE' : 'Reunion',
'RO' : 'Romania',
'RU' : 'Russian Federation',
'RW' : 'Rwanda',
'BL' : 'Saint Barthelemy',
'SH' : 'Saint Helena',
'KN' : 'Saint Kitts And Nevis',
'LC' : 'Saint Lucia',
'MF' : 'Saint Martin',
'PM' : 'Saint Pierre And Miquelon',
'VC' : 'Saint Vincent And Grenadines',
'WS' : 'Samoa',
'SM' : 'San Marino',
'ST' : 'Sao Tome And Principe',
'SA' : 'Saudi Arabia',
'SN' : 'Senegal',
'RS' : 'Serbia',
'SC' : 'Seychelles',
'SL' : 'Sierra Leone',
'SG' : 'Singapore',
'SK' : 'Slovakia',
'SI' : 'Slovenia',
'SB' : 'Solomon Islands',
'SO' : 'Somalia',
'ZA' : 'South Africa',
'GS' : 'South Georgia And Sandwich Isl.',
'ES' : 'Spain',
'LK' : 'Sri Lanka',
'SD' : 'Sudan',
'SR' : 'Suriname',
'SJ' : 'Svalbard And Jan Mayen',
'SZ' : 'Swaziland',
'SE' : 'Sweden',
'CH' : 'Switzerland',
'SY' : 'Syrian Arab Republic',
'TW' : 'Taiwan',
'TJ' : 'Tajikistan',
'TZ' : 'Tanzania',
'TH' : 'Thailand',
'TL' : 'Timor-Leste',
'TG' : 'Togo',
'TK' : 'Tokelau',
'TO' : 'Tonga',
'TT' : 'Trinidad And Tobago',
'TN' : 'Tunisia',
'TR' : 'Turkey',
'TM' : 'Turkmenistan',
'TC' : 'Turks And Caicos Islands',
'TV' : 'Tuvalu',
'UG' : 'Uganda',
'UA' : 'Ukraine',
'AE' : 'United Arab Emirates',
'GB' : 'United Kingdom',
'US' : 'United States',
'UM' : 'United States Outlying Islands',
'UY' : 'Uruguay',
'UZ' : 'Uzbekistan',
'VU' : 'Vanuatu',
'VE' : 'Venezuela',
'VN' : 'Viet Nam',
'VG' : 'Virgin Islands, British',
'VI' : 'Virgin Islands, U.S.',
'WF' : 'Wallis And Futuna',
'EH' : 'Western Sahara',
'YE' : 'Yemen',
'ZM' : 'Zambia',
'ZW' : 'Zimbabwe'
};

function getCountryName (countryCode) {
    if (isoCountries.hasOwnProperty(countryCode)) {
        return isoCountries[countryCode];
    } else {
        return countryCode;
    }
}
 </script>

A: It seems like you are using swal version v1.0.0.
Use below syntax instead of swal({}).then().
swal({
  title: "Looks like you're from " + countName + ". ",
  text: "Go to our International Store? ",
  imageUrl: 'https://www.countryflags.io/' + countCode + '/flat/64.png',
  imageWidth: 128,
  imageHeight: 128,
  showCancelButton: true,
  showConfirmButton: true,
  confirmButtonText: 'Yes take me there',
  cancelButtonText: 'Stay on U.S.A Site',
  imageAlt: 'Custom image',
  dangerMode: false,
}, function () {
  // Your code
});

Reference Link
OR
replace your cdn link of sweetalert with latest version - https://cdnjs.com/libraries/sweetalert.

$(document).ready(function () {
    addListItem();

});
function addListItem() {
    $.get("https://www.cloudflare.com/cdn-cgi/trace", function (data) {
        arrayOfLines = data.match(/[^\r\n]+/g);
        var arrayLength = arrayOfLines.length;
        for (var i = 0; i < arrayLength; i++) {
            if (arrayOfLines[i].startsWith("loc")) {
                var countCode = arrayOfLines[i].split("=")[1];
                var countName = getCountryName(countCode);

                if (countCode != "US") {
                  swal({
                    title: "Looks like you're from " + countName + ". ",
                    text: "Go to our International Store? ",
                    imageUrl: 'https://www.countryflags.io/' + countCode + '/flat/64.png',
                    imageWidth: 128,
                    imageHeight: 128,
                    showCancelButton: true,
                    showConfirmButton: true,
                    confirmButtonText: 'Yes take me there',
                    cancelButtonText: 'Stay on U.S.A Site',
                    imageAlt: 'Custom image',
                    dangerMode: false,
                  }).then(function() {

                  });
                }
            }
        }
    });
}
var isoCountries = {
    'AF': 'Afghanistan',
    'AX': 'Aland Islands',
    'AL': 'Albania',
    'DZ': 'Algeria',
    'AS': 'American Samoa',
    'AD': 'Andorra',
    'AO': 'Angola',
    'AI': 'Anguilla',
    'AQ': 'Antarctica',
    'AG': 'Antigua And Barbuda',
    'AR': 'Argentina',
    'AM': 'Armenia',
    'AW': 'Aruba',
    'AU': 'Australia',
    'AT': 'Austria',
    'AZ': 'Azerbaijan',
    'BS': 'Bahamas',
    'BH': 'Bahrain',
    'BD': 'Bangladesh',
    'BB': 'Barbados',
    'BY': 'Belarus',
    'BE': 'Belgium',
    'BZ': 'Belize',
    'BJ': 'Benin',
    'BM': 'Bermuda',
    'BT': 'Bhutan',
    'BO': 'Bolivia',
    'BA': 'Bosnia And Herzegovina',
    'BW': 'Botswana',
    'BV': 'Bouvet Island',
    'BR': 'Brazil',
    'IO': 'British Indian Ocean Territory',
    'BN': 'Brunei Darussalam',
    'BG': 'Bulgaria',
    'BF': 'Burkina Faso',
    'BI': 'Burundi',
    'KH': 'Cambodia',
    'CM': 'Cameroon',
    'CA': 'Canada',
    'CV': 'Cape Verde',
    'KY': 'Cayman Islands',
    'CF': 'Central African Republic',
    'TD': 'Chad',
    'CL': 'Chile',
    'CN': 'China',
    'CX': 'Christmas Island',
    'CC': 'Cocos (Keeling) Islands',
    'CO': 'Colombia',
    'KM': 'Comoros',
    'CG': 'Congo',
    'CD': 'Congo, Democratic Republic',
    'CK': 'Cook Islands',
    'CR': 'Costa Rica',
    'CI': 'Cote D\'Ivoire',
    'HR': 'Croatia',
    'CU': 'Cuba',
    'CY': 'Cyprus',
    'CZ': 'Czech Republic',
    'DK': 'Denmark',
    'DJ': 'Djibouti',
    'DM': 'Dominica',
    'DO': 'Dominican Republic',
    'EC': 'Ecuador',
    'EG': 'Egypt',
    'SV': 'El Salvador',
    'GQ': 'Equatorial Guinea',
    'ER': 'Eritrea',
    'EE': 'Estonia',
    'ET': 'Ethiopia',
    'FK': 'Falkland Islands (Malvinas)',
    'FO': 'Faroe Islands',
    'FJ': 'Fiji',
    'FI': 'Finland',
    'FR': 'France',
    'GF': 'French Guiana',
    'PF': 'French Polynesia',
    'TF': 'French Southern Territories',
    'GA': 'Gabon',
    'GM': 'Gambia',
    'GE': 'Georgia',
    'DE': 'Germany',
    'GH': 'Ghana',
    'GI': 'Gibraltar',
    'GR': 'Greece',
    'GL': 'Greenland',
    'GD': 'Grenada',
    'GP': 'Guadeloupe',
    'GU': 'Guam',
    'GT': 'Guatemala',
    'GG': 'Guernsey',
    'GN': 'Guinea',
    'GW': 'Guinea-Bissau',
    'GY': 'Guyana',
    'HT': 'Haiti',
    'HM': 'Heard Island & Mcdonald Islands',
    'VA': 'Holy See (Vatican City State)',
    'HN': 'Honduras',
    'HK': 'Hong Kong',
    'HU': 'Hungary',
    'IS': 'Iceland',
    'IN': 'India',
    'ID': 'Indonesia',
    'IR': 'Iran, Islamic Republic Of',
    'IQ': 'Iraq',
    'IE': 'Ireland',
    'IM': 'Isle Of Man',
    'IL': 'Israel',
    'IT': 'Italy',
    'JM': 'Jamaica',
    'JP': 'Japan',
    'JE': 'Jersey',
    'JO': 'Jordan',
    'KZ': 'Kazakhstan',
    'KE': 'Kenya',
    'KI': 'Kiribati',
    'KR': 'Korea',
    'KW': 'Kuwait',
    'KG': 'Kyrgyzstan',
    'LA': 'Lao People\'s Democratic Republic',
    'LV': 'Latvia',
    'LB': 'Lebanon',
    'LS': 'Lesotho',
    'LR': 'Liberia',
    'LY': 'Libyan Arab Jamahiriya',
    'LI': 'Liechtenstein',
    'LT': 'Lithuania',
    'LU': 'Luxembourg',
    'MO': 'Macao',
    'MK': 'Macedonia',
    'MG': 'Madagascar',
    'MW': 'Malawi',
    'MY': 'Malaysia',
    'MV': 'Maldives',
    'ML': 'Mali',
    'MT': 'Malta',
    'MH': 'Marshall Islands',
    'MQ': 'Martinique',
    'MR': 'Mauritania',
    'MU': 'Mauritius',
    'YT': 'Mayotte',
    'MX': 'Mexico',
    'FM': 'Micronesia, Federated States Of',
    'MD': 'Moldova',
    'MC': 'Monaco',
    'MN': 'Mongolia',
    'ME': 'Montenegro',
    'MS': 'Montserrat',
    'MA': 'Morocco',
    'MZ': 'Mozambique',
    'MM': 'Myanmar',
    'NA': 'Namibia',
    'NR': 'Nauru',
    'NP': 'Nepal',
    'NL': 'Netherlands',
    'AN': 'Netherlands Antilles',
    'NC': 'New Caledonia',
    'NZ': 'New Zealand',
    'NI': 'Nicaragua',
    'NE': 'Niger',
    'NG': 'Nigeria',
    'NU': 'Niue',
    'NF': 'Norfolk Island',
    'MP': 'Northern Mariana Islands',
    'NO': 'Norway',
    'OM': 'Oman',
    'PK': 'Pakistan',
    'PW': 'Palau',
    'PS': 'Palestinian Territory, Occupied',
    'PA': 'Panama',
    'PG': 'Papua New Guinea',
    'PY': 'Paraguay',
    'PE': 'Peru',
    'PH': 'Philippines',
    'PN': 'Pitcairn',
    'PL': 'Poland',
    'PT': 'Portugal',
    'PR': 'Puerto Rico',
    'QA': 'Qatar',
    'RE': 'Reunion',
    'RO': 'Romania',
    'RU': 'Russian Federation',
    'RW': 'Rwanda',
    'BL': 'Saint Barthelemy',
    'SH': 'Saint Helena',
    'KN': 'Saint Kitts And Nevis',
    'LC': 'Saint Lucia',
    'MF': 'Saint Martin',
    'PM': 'Saint Pierre And Miquelon',
    'VC': 'Saint Vincent And Grenadines',
    'WS': 'Samoa',
    'SM': 'San Marino',
    'ST': 'Sao Tome And Principe',
    'SA': 'Saudi Arabia',
    'SN': 'Senegal',
    'RS': 'Serbia',
    'SC': 'Seychelles',
    'SL': 'Sierra Leone',
    'SG': 'Singapore',
    'SK': 'Slovakia',
    'SI': 'Slovenia',
    'SB': 'Solomon Islands',
    'SO': 'Somalia',
    'ZA': 'South Africa',
    'GS': 'South Georgia And Sandwich Isl.',
    'ES': 'Spain',
    'LK': 'Sri Lanka',
    'SD': 'Sudan',
    'SR': 'Suriname',
    'SJ': 'Svalbard And Jan Mayen',
    'SZ': 'Swaziland',
    'SE': 'Sweden',
    'CH': 'Switzerland',
    'SY': 'Syrian Arab Republic',
    'TW': 'Taiwan',
    'TJ': 'Tajikistan',
    'TZ': 'Tanzania',
    'TH': 'Thailand',
    'TL': 'Timor-Leste',
    'TG': 'Togo',
    'TK': 'Tokelau',
    'TO': 'Tonga',
    'TT': 'Trinidad And Tobago',
    'TN': 'Tunisia',
    'TR': 'Turkey',
    'TM': 'Turkmenistan',
    'TC': 'Turks And Caicos Islands',
    'TV': 'Tuvalu',
    'UG': 'Uganda',
    'UA': 'Ukraine',
    'AE': 'United Arab Emirates',
    'GB': 'United Kingdom',
    'US': 'United States',
    'UM': 'United States Outlying Islands',
    'UY': 'Uruguay',
    'UZ': 'Uzbekistan',
    'VU': 'Vanuatu',
    'VE': 'Venezuela',
    'VN': 'Viet Nam',
    'VG': 'Virgin Islands, British',
    'VI': 'Virgin Islands, U.S.',
    'WF': 'Wallis And Futuna',
    'EH': 'Western Sahara',
    'YE': 'Yemen',
    'ZM': 'Zambia',
    'ZW': 'Zimbabwe'
};

function getCountryName(countryCode) {
    if (isoCountries.hasOwnProperty(countryCode)) {
        return isoCountries[countryCode];
    } else {
        return countryCode;
    }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>


text:
Q: Cut option in select I have:
<select>
  <option value=1>1</option>
  <option value=1>2</option>
  <option value=1>3</option>
  ...
  <option value=97>97</option>
  <option value=98>98</option>
  <option value=99>99</option>
</select>

How can i with jQuery cut with this all option from value 20 to 40?

A: var select = $('#mySelect');

for (var i = 20; i <= 40; i++)
{
    select.find('option[value="' + i + '"]').remove();
}

The simpliest way...
Another is filter(), here:
$('#mySelect option').filter(function() {
    return $(this).val() >= 20 && $(this).val() <= 40;
}).remove();


text:
Q: how to change the clock widget to 24 hour time from command line we need the default Gnome clock widget to show the time in the 24 hour format, but need to do it entirely from the command line (via script, no GUI).
anyone know how to do this?  is there a config file somewhere?
thanks
edit: should say that this is for rhel5

A: I don't have a RHEL5 or even GNOME 2 system available to test this on, but this (or something similar) should work:
gconftool-2 -s -t string /apps/clock_applet/prefs/format 24-hour


text:
Q: Python Loop Through Dict I've got some Python code and I'd like to apply different actions based on a column in a dict.
try:
    columns = get_table_columns(table, cursor)
    print(columns)

In this columns dict, I've got
{'EFF_DT': 'DATE', 'TERM_DT': 'DATE', 'PACKAGE_LABEL': 'TEXT'}

What I'd like to do is loop through that and go if it's date, apply one piece of logic (placing to_date around the field in SQL), and otherwise, just work normally.
This is my full code for this piece of the script
for key in primary_keys:
        sql += '{table}."{key}" = {temp_table}."{key}"'.format(
            table=table, temp_table=temp_table, key=key
        )
        if key == primary_keys[-1]:
            continue
        sql += " and "

    sql += " WHEN MATCHED THEN  update set "

    for column in columns:
        if columns[column]=="DATE":
            sql+="{table}.\"{column}\" = TO_DATE({temp_table}.\"{column}\", 'DD/MM/YYYY'), ".format(table=table, temp_table=temp_table, column=column)
            continue
        sql+= "{table}.\"{column}\" = {temp_table}.\"{column}\", ".format(table=table, temp_table=temp_table, column=column)
    sql = sql[:-2]
    sql+= " when not matched then insert values ( "

    for column in columns:
        if columns[column]=="DATE":
            sql+="TO_DATE("+table+"_TEMP.\""+column+"\", 'DD/MM/YYYY')"
        else:
            sql+= table+"_TEMP.\""+column+"\""
        if column ==list(columns.keys())[-1]:
            sql += " );"
            continue
        sql+=", "

What I'm trying to do is add in a part into the for key in primary keys part where I check if the column is date and do the similar to the columns part but if I put in two for loops, it loops too much and it throws the sql code.
Anyone any ideas?
Thanks,

A: Just incase anyone else sees this in future,
this is what got it to work for me. Just asked a colleague and they saw the issue immediately.
All I needed to do was add in if columns[key] == "DATE": part to the for key in primary_keys section.
As the dict was already defined, I could query that
for key in primary_keys:
            if columns[key] == "DATE":
                sql += "{table}.\"{key}\" = TO_DATE({temp_table}.\"{key}\", 'DD/MM/YYYY') ".format(
                    table=table, temp_table=temp_table, key=key
                )
            else:
                sql += '{table}."{key}" = {temp_table}."{key}"'.format(
                table=table, temp_table=temp_table, key=key
                )
            if key == primary_keys[-1]:
                continue
            sql += " and "
        sql += " WHEN MATCHED THEN  update set "


text:
Q: Import Apache Commons Math Library (Beginner) I want to be able to use the Apache Commons Math Library in Java but I cannot get it to work correctly and the main site is frustratingly unhelpful (at least for a novice like me) and I haven't been able to find a solution on here yet.
I went to http://commons.apache.org/proper/commons-math/download_math.cgi
downloaded the first option commons-math3-3.6.1-bin.tar.gz
unzipped it and put it into the folder with the java class that I am trying to build.
I then did the command import org.apache.commons.math3;
But I get Error: package org.apache.commons does not exist
Could someone explain (preferably in detail that not even a novice would misunderstand) why this isn't working and what I should do?
Thanks!

A: First you need to download jar from repository
https://mvnrepository.com/artifact/org.apache.commons/commons-math3/3.6.1
put it to folder test, in same folder create file Test.java with class Test something like this
import org.apache.commons.math3.analysis.function.Abs;

class Test {

    public static void main (String ... args) {
        Abs abs = new Abs();
        System.out.println(abs.value(-10.0d));
    }

}

after that compile it with command javac -cp "commons-math3-3.6.1.jar" Test.java
and run it java -cp ".;commons-math3-3.6.1.jar" Test
output will be 10.0


text:
Q: How to get traefik to redirect to specific non-docker port from inside docker First of all I'm sorry if I'm not using the right terms to ask this question, but I'm not up to the terminology in place.
I have traefik running in a docker container and serving some services with the PathPrefix option, for instance, www.myserver.com/wordpress redirects to a docker container running wordpress.
But how do I get it to redirect to outside a docker container? Specifically, how do I get www.myserver.com to redirect to port 8080 in my machine to serve a service I have running there in the host OS (not in a docker container)?
This is my traefik.toml:
logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]

[entryPoints]
    [entryPoints.http]
        address = ":80"
        compress = false
        [entryPoints.http.redirect]
            entryPoint = "https"
    [entryPoints.https]
        address = ":443"
        [entryPoints.https.tls]

[acme]
email = "mymail@mail.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
#onDemand = true
[[acme.domains]]
    main = "www.myserver.com"

[web]
address = ":8888"

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "www.myserver.com"
watch = true
exposedbydefault = false

And my docker-compose.yml for the traefik container:
version: "2"

services:
  traefik:
    image: traefik
    network_mode: "host"
    ports:
      - "80:80"
      - "443:443"
      - "8888:8888"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${SERVER_DIR}/AppData/traefik:/etc/traefik/
      - ${PWD}/acme.json:/acme.json
      - ${PWD}/traefik.toml:/etc/traefik/traefik.toml
      - ${PWD}/servers.toml:/etc/traefik/servers.toml
    restart: never

A: With the new Traefik (v.2) you need to use a combination of labels and an external file, you can find below my working example.
In your docker compose you need to add the comands to define the external file and enable the provider
  - "--providers.file=true"
  - "--providers.file.filename=/etc/traefik/rules.toml"

Into your file (rules.toml) the routing to foward to your external service (be aware of the syntax, use the char to define the host ( ` )  )
example :
Docker-compose:
  traefik:
    image: "traefik:v2.0.0"
    container_name: "traefik"
    restart: always
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myhttpchallenge.acme.email=xx@xx.com"
      - "--providers.file=true"
      - "--providers.file.filename=/etc/traefik/rules.toml"
      - "--providers.docker=true"
      - "--providers.file.watch=true"
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    networks:
      - proxy
    environment:
      - CF_API_EMAIL="xx"
      - CF_API_KEY="xx"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik/rules.toml:/etc/traefik/rules.toml"

Rules.toml
  [http.routers]
   # Define a connection between requests and services
     [http.routers.nasweb]
        rule = "Host(`nas.xxxx.com`)"
        entrypoints = ["websecure"]
        service = "nas"
     [http.routers.nasweb.tls]
        certResolver = "myhttpchallenge"

 [http.services]
        # Define how to reach an existing service on our infrastructure
        [http.services.nas.loadBalancer]
           [[http.services.nas.loadBalancer.servers]]
             url = "http://192.168.0.165:80"

A: I've fiddled around and found the answer.
In traefik.toml add:
################################################################
# File configuration backend
################################################################
# Enable file configuration backend
# Optional
[file]
        filename = "servers.toml"

# Enable watch file changes
        watch = true

In docker-compose.yml change the volumes: to:
volumes:
  - /var/run/docker.sock:/var/run/docker.sock
  - ${SERVER_DIR}/AppData/traefik:/etc/traefik/
  - ${PWD}/acme.json:/acme.json
  - ${PWD}/traefik.toml:/etc/traefik/traefik.toml
  - ${PWD}/servers.toml:/servers.toml

Add file servers.toml:
loglevel = "ERROR"

[backends]
[backends.nasweb]
        [backends.nasweb.servers.nasweb]
            url = "http://192.168.1.11:8080"

[frontends]
        [frontends.domain]
                backend = "nasweb"
        [frontends.domain.routes.domain]
                rule = "Host:www.myserver.com"


text:
Q: How to prevent changes in a cell based on another value and show an alert box about the attempt? I have column (col 3) which has a dropdown. One of the option is PENDING. In the next cell (col 4) is another drop-down, NOTSUBMITTED being one of the options.
Now what I want is that if Col 3 has PENDING, I should not be able to change the next cell in Col 4. In short, NOTSUBMITTED cannot be changed if Col 3 has PENDING.
Then show a POPUP message stating some information about this. I tried the following but it shows the message but I cannot stop the Col 4 being changed. I can easily change or deleted the Col 4.
How to stop this.
function onEdit(event){

      var actvCell = event.range.getSheet().getActiveCell();

     if(actvCell.getColumn() == 3 && event.value=="PENDING"){
        Browser.msgBox('You cannot make changes if payment is pending');
     }
   }

A: Problem
You want to stop another cell from being edited depending on the value from active cell.
Solution
You need to take a look on how Protection class works for Spreadsheet Service. Algorithm is as follows:

*

*If active cell value is "pending" -> protect target cell and remove users from protection editors;

*If active cell value is other -> get protections and filter to leave one on target cell;

*Remove protection from target cell.

Please, remember that there are a lot of considerations to take into account regarding editing permissions, most important ones are:

*

*Owner of the spreadsheet can always edit everything regardless of protections;

*Domain-wide permissions will still be in effect;

*Current user (the one making the edit) can't be removed from editors;

Useful links

*

*Protection class reference;

*getProtections() method reference;

*protect() method reference;

*remove() method reference;

*removeEditors() method reference;


text:
Q: How to keep file names when using diff with regex I am using this diff to show whether two files differ, but I need the regex to ignore the lines that are different that I don't care about. But the way it is set up it changes the names of the files when it reports a difference.
diff -q --suppress-common-lines -B <(grep -vE '\s(name|timestamp|root)=' goldcopy.xml)  <(grep -vE '(\sname|timestamp|root)=' QJ03425234.xml)

It reports something like "Files /dev/fd/63 and /dev/fd/62 differ", but I need it to be the file names so if someone does not know what files it ran with they can still know what files are different.

A: What diff actually compares in your oneliner, are not the files but the output of grep. For each of those two file descriptors dynamically are created by shell (bash), /dev/fd/63 /dev/fd/62 are they usual names. <( command ) idiom is known as process substituion,
So there's no direct way for diff to know the original file names, unless you tell it that explicitly. Consider using --label or -L option
F1=goldcopy.xml; F2=QJ03425234.xml;  diff  -L $F1  -q --suppress-common-lines -B <(grep -vE '\s(name|timestamp|root)=' $F1)  -L $F2 <(grep -vE '(\sname|timestamp|root)=' $F2)


text:
Q: AWS SDK C++ issue in Linux while in Windows it works fine In windows, I am using VS2017 and through NuGet manager I added AWS Kinesis C++ SDK in my project.
The build works perfectly fine in windows.
I commit the same code in SVN and while trying to build in Linux which is having GCC 4.9.2,
the build fails with below mentioned error.
libwebql.so is part of my already existing project in which I added AWS code which works/build fine in windows but not in linux.
Anything different has to be done related to build or inclusion of aws code?
Any help would be appreciated.
webql/control/cl: Linking release binary webql
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::InitAPI(Aws::SDKOptions const &)'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Http::CONTENT_TYPE_HEADER'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Malloc(char const *, unsigned long)'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Kinesis::KinesisClient::PutRecord(Aws::Kinesis::Model::PutRecordRequest const &) const'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to `Aws::Free(void *)'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::AmazonSerializableWebServiceRequest::GetBody() const'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::ShutdownAPI(Aws::SDKOptions const &)'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `typeinfo for Aws::AmazonSerializableWebServiceRequest'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `vtable for Aws::Kinesis::Model::PutRecordRequest'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Client::ClientConfiguration::ClientConfiguration()'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Kinesis::KinesisClient::~KinesisClient()'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Kinesis::KinesisClient::KinesisClient(Aws::Client::ClientConfiguration const &)'
/archive/webql/build/al/current/base/dist/alr/bin/libwebql.so: undefined reference to
   `Aws::Kinesis::Model::PutRecordRequest::PutRecordRequest()'
collect2: error: ld returned 1 exit status

Command for compilation and build This is only for reference.
My solution have 24 projects where 2 projects uses this AWS C++ SDK, which works fine in windows but not in linux.
general: @/archive/webql/build/al/current/base/dev/general/gfilt -pthread -fPIC -DHAS_SETRESUID_PROTO=1 -DHAS_SETRESGID_PROTO=1 -DU_HAVE_NAMESPACE=1
-D_FILE_OFFSET_BITS=64 -D_unix -D_BSD -fexceptions -fmessage-length=0 -DQL2_PLATFORM="al" -DJAVA_ARCH="amd64" -fvisibility=hidden -D_XOPEN_SOURCE=500
-DGENERAL_EXPORTS -I/archive/webql/build/al/current/base/dev/general -I/archive/webql/build/al/current/base/dev/general/include -I.
-I/archive/webql/build/al/current/base/dev -I/archive/webql/build/al/current/base/dev/xml -I/archive/webql/build/al/current/base/dev/xml/libxml
-I/archive/webql/build/al/current/base/dev/xml/libxslt -I/archive/webql/build/al/current/base/packages/al/inst/include
-I/archive/webql/build/al/current/base/dev/zlib -I/archive/webql/build/al/current/base/packages/al/inst/jdk/include
-I/archive/webql/build/al/current/base/packages/al/inst/jdk/include/linux -I/usr/java/include -I/usr/java/include/linux
-I/mnt/usr/include -I/archive/webql/build/al/current/base/packages/al/mozilla/include/nspr -I/archive/webql/build/al/current/base/packages/al/mozilla/include/js
-I/archive/webql/build/al/current/base/packages/al/mozilla/js/src -ggdb3 -O3 -DNDEBUG -c -o /archive/webql/build/al/current/base/dist/alr/obj/general/Constructs.o Constructs.cxx


text:
Q: Are collisions between expressions and namespaces expected when invoking ADL? Given the following example, I would expect the parser to recognize std as a function:
#include <algorithm>

namespace test
{
    class foo{};

    void std(foo f);
}

int main()
{
    std(test::foo());
    return 0;
}

However, with GCC 4.8.4 this results in an error - "error: unexpected namespace name 'std': expected expression."
With clang 5.0, I get "error: unexpected namespace name 'std': expected expression"
Is this expected? I can't imagine that the parser doesn't have enough context here to distinguish between expression and namespace?
EDIT: Example uses more complex type that should invoke ADL. In my actual use case, the code is generic and I require ADL.

A: There's no ADL for int.
There's also no ADL if normal unqualified lookup finds, among other things, "a declaration that is neither a function nor a function template", such as a declaration of a namespace.

A: Your example does not work for couple of reasons.

*

*It does not use ADL.  ADL will be used if the argument to a function is a type that is defined in the namespace. E.g.
namespace test
{
   struct bar {};

   void foo(bar b) {}
}

// uses ADL to resolve to test::foo.
foo(test::bar());

*std is a namespace. When used without any other scope qualifier, it is the name of the namespace. Hence ADL won't be used even if you used a type that is defined in the namespace. Hence, the following is not correct either.
namespace test
{
   struct bar {};

   void std(bar b) {}
}

std(test::bar());

Please note that you may use:
namespace test
{
   struct bar {};

   void std(bar b) {}
}

test::std(test::bar());


text:
Q: The complier cannot call 'pivothighs' with argument I've been trying to make a pivot point high low multitimeframe indicator but still a new learner and have no idea how to fix.
I tried to put 'tf' function in multiple places of code but it's not working.
//@version=4

study("Pivot Prices", overlay=true)
tf=input('120')
leftbars = input(10, minval=1, title='Bars to the left')
rightbars = input(2, minval=1, title='Bars to the right')

phigh = pivothigh(high, tf, leftbars,rightbars)
plow = pivotlow(low, tf, leftbars, rightbars)

if phigh
label1 = label.new(bar_index[rightbars], high[rightbars], text=tostring(high[rightbars]), style=label.style_labeldown, color=color.orange)

if plow
label2 = label.new(bar_index[rightbars], low[rightbars], text=tostring(low[rightbars]), s``tyle=label.style_labelup, color=color.green)

I want it to be showing multitimeframe perspective but couldn't figure what is wrong in the code.

A: Read the documentation. pivothigh() and pivotlow() can take two or three arguments.
pivothigh(source, leftbars, rightbars) → series[float]
pivothigh(leftbars, rightbars) → series[float]

You are passing four arguments.


text:
Q: Changing value of variable onclick I am trying to change variable value on click, so that i can send the value via ajax to load data in ascending or descending format.
Here is Javascript part on top of page.
var ascending = '0';

Here is HTML Part.
<input type="checkbox" id="ascending" name="ascending"> Ascending

<input type="checkbox" id="descending" name="ascending"> Descending

<input type="button" name="sort" onclick="sorting()">

Here is my CSS :
input { display:none; }
input:checked ~ label { color:red; }

Here is my Javascript just before ajax function and after html, css part:
function knowFormat(ascending) {
    if (ascending) { ascending = '0'; } else { ascending = '1'; }
}

And in my Ajax, Data is always getting sent '0', even after click.
function sorting() {
alert(ascending);
    jQuery.ajax({
        url : 'ajax/file.php',
        type : 'POST',
        data : 'ascending='+ascending,
        success : function(s) {
            alert(s);
        }
    });
}

Even after clicking sorting, The alert button is always 0.

A: You are changing the parameter due to scope. The same parameter name hides the global variable. To change global variable change the name of parameter or global variable.
function knowFormat(ascending1) {
    if (ascending1) { ascending = '0'; } else { ascending = '1'; }
}


text:
Q: how to make entry box detect letters and give warning saying "numbers only" I am making a GUI tkinter program for a school assignment, which requires the user to enter name, and age, and then do a quiz, my problem is when they enter their age as a string it should say please enter a number but i get this error
_tkinter.TclError: expected floating-point number but got

this is the part which concerns the age input
def show_frame2(self):

   try:

        if self.name.get() == "":
            self.warning.configure(text = "Please enter your name")
            self.NameEntry.focus()
        elif self.name.get().isalpha() == False:
            self.warning.configure(text = "Please enter text")
            self.NameEntry.delete(0, END)
            self.NameEntry.focus()

        elif self.AgeEntry.get() == "":
            self.warning.configure(text = "Please enter a number")
            self.AgeEntry.delete(0, END)
        elif self.age.get() > 14:
            self.warning.configure(text = "You are to old")
            self.AgeEntry.delete(0, END)
        elif self.age.get() <= 0:
            self.warning.configure(text = "Please enter a number number other than 0")
            self.age_entry.delete(0, END)
        elif self.age.get() <= 7:
            self.warning.configure(text = "Sorry, You are to young")
        else:
            self.frame1.grid_remove()
            self.frame2.grid(row = 1, columnspan = 4)
            self.next_problem()

    except ValueError:
        self.warning.configure(text = "Please enter a number")
        self.AgeEntry.delete(0,END)
        self.AgeEntry.focus()

A: You should change the except ValueError into except _tkinter.TclError.
This would fix your problem.

A: self.age should probably be changed to be a StrVar; then do the float conversion yourself:
try:
    age = float(self.age.get())
except (ValueError, TypeError):
    # ... appropriate warning


text:
Q: How to configure Mac OS X Snow Leopard to automatically connect to my Bluetooth Speakers for sound output? I have a bluetooth speaker that I use for audio output on Snow Leopard (the Sony SRS-BT100).  Generally I like it, except for one thing:
When my laptop wakes from sleep it does not automatically connect to the speaker.  I have to manually go to the bluetooth menu and select SRS-BT100 -> Use as Audio Device (Stereo).
Is there a way to configure Snow Leopard to automatically connect to my bluetooth speaker if it's available?


text:
Q: Question regarding convergent series If the series with general term $a_n^2$ converges, why does the series with general term $a_n/n$ converge as well??? A peer of mine showed me this, but I really don't find it obvious and I really don't know how to prove it..

A: Cauchy-Schwarz says
$$
\sum_{n=1}^\infty\frac{|a_n|}{n}\le\left(\sum_{n=1}^\infty a_n^2\right)^{1/2}\left(\sum_{n=1}^\infty\frac1{n^2}\right)^{1/2}
$$
so the series is absolutely convergent.

A: If $a_{n} \geq 0$, (as in the Rudin exercise $\sum a_{n}$ converges $\Rightarrow$ $\sum \sqrt{a_{n}}/n$ converges), we have the following:
If $\sum a_{n}^{2}$ converges, then $\sum \left(a_{n}^{2} + \frac{1}{n^{2}}\right)$ also converges.  But
$$0 \leq \left(a_{n} - \frac{1}{n}\right)^{2} = a_{n}^{2} + \frac{1}{n^{2}} - 2\frac{a_{n}}{n},$$
so
$$\frac{a_{n}}{n} \leq \frac{1}{2}\left(a_{n}^{2} + \frac{1}{n^{2}}\right).$$
Thus, $\sum \frac{a_{n}}{n}$ converges.


text:
Q: ChannelHandlerContext setAttachment Method So in the Netty 3.x libraries, the class ChannelHandlerContext has a method named setAttachment. Unfortunately, it doesn't seem to exist in the new 4.0 libraries. I was wondering if there is a way to put attachment like on the older libraries.

A: After doing a little research I found the following:
The javadocs for the interface org.jboss.netty.channel.ChannelHandlerContext in the version 3.2 states

Storing stateful information
setAttachment(Object) and getAttachment() allow you to store and access stateful information that is related with a handler and its context. Please refer to ChannelHandler to learn various recommended ways to manage stateful information.

And the javadocs for io.netty.channel.ChannelHandlerContext in the version 4.0 which apparently replaces version 3.x's org.jboss.netty.channel.ChannelHandlerContext states the following for Storing stateful information

Storing stateful information
AttributeMap.attr(AttributeKey) allow you to store and access stateful information that is related with a handler and its context. Please refer to ChannelHandler to learn various recommended ways to manage stateful information.

It seems that Attachments of version 3.x are now handled using Attribute<T> (generics instead of Object!) in version 4.0
So you need to do look at AttributeMap.attr(AttributeKey) and the example which states

// This handler will receive a sequence of increasing integers starting from 1.

given there in the javadocs for ChannelHandlerContext in both versions.
I hope this will help you find a way for coding your requirements using the new API.


text:
Q: If $\lim_{x\to 6} f(x) = -216$, find $\lim_{x \to 6} [f(x)]^{1/3}$
If $\lim_{x\to 6}  f(x) = -216$, find $\lim_{x \to 6}  [f(x)]^{1/3}$.

It says to use the fractional limit law, I have no idea what this means.
The textbook example is:

If $\lim_{ x \to 6} f(x) = -8$, find $\lim _{x\to 2}  [f(x)]^{4/3}$.
  Use the fractional power limit law shown below to determine your answer.

Assuming $m > 0$ and $n > 0$ are integers, $\lim_{x \to a}  [f(x)]^{n/m} = [\lim_{x \to a}  f(x)] ^ {n/m}$, provided $f(x) \ge 0$ for $x$ near $a$ if $m$ is even and $(n/m)$ are reduced to lowest terms.
I don't know what that means! My professor hardly glossed over limit laws - I can do rationalization just fine, but have no clue how to do this.

A: The way to apply that limit law is by ensuring the hypothesis is satisfied and then use the conclusion.
Restating this law we have:

Given $m, n \in \mathbb{N}$ with $\gcd(m,n) = 1$ and $\lim_{x \to a} f(x)$ exists then we have
  $$
\lim_{x \to a} (f(x))^{n/m} = \left( \lim_{x \to a} f(x) \right)^{n/m}
$$
  given $m$ is odd or $m$ is even and $f(x) \ge 0$ for $x \in (a - \epsilon, a + \epsilon)$ for some small $\epsilon > 0$

To break this down, given any positive integers $m,n$ such that $n/m$ is in lowest terms (e.g. $4/8$ is not in lowest terms but $1 / 2$ is) and given that $\lim_{x \to a} f(x)$ exists (for example $\lim_{x \to 0} \frac{1}{x}$ doesn't exist but $\lim_{x \to 2} \frac{1}{x}$ does) we have
$$
\lim_{x \to a} (f(x))^{n/m} = \left( \lim_{x \to a} f(x) \right)^{n/m}
$$
as long as $m$ is odd (e.g. $3$) or if $m$ is even then we need to have $f(x)$ be non-negative close to $x=a$. The reason for this last statement is because if we put $f(x) = x$ and $n = 1, m = 2$ and $a \in \mathbb{R}$ we need to have that $x$ is positive close to $a$ otherwise we would be trying to approach a square root of a negative number (e.g. if $a = -2$ then we would be trying to approach $\sqrt{-2}$ which doesn't exist in $\mathbb{R}$).
I hope the above helps, if you have any questions comment below.

I use italics on the law part because this is really the definition of continuity. Since you are talking about limit laws I'm guessing you haven't talked about continuity yet, so I won't go too in depth here except to say that a function $g$ is continuous at $a$ if
$$
\lim_{x \to a} g(x) = g\left( \lim_{x \to a} x \right) = g(a)
$$
so in our case the function $g$ would be given by $g(x) = x^{n/m}$ for natural numbers $m,n$. This function is only continuous everywhere when $m$ is odd or continuous for at $a > 0$ if $m$ is even.

I just realized the above explanation might be much so just ignore it if it went over your head, otherwise I'm going to leave it there in case it does help you!


text:
Q: Please specify value for '' explicitly Here I am again, struggling with kotlin.
Background: I am trying at the moment to upgrade an existing API to Java 17 and Kotlin 1.6.10.
But after building the project now, I got following error:
Caused by: java.lang.IllegalStateException: Usage of default value argument for this annotation is not yet possible.
Please specify value for 'DelimitedEnumSet.delimiter' explicitly

I am pretty sure the error must be somewhere here:
@JsonQualifier
@Retention(AnnotationRetention.RUNTIME)
internal annotation class DelimitedEnumSet(val delimiter: String = " ")

The Stacktrace is not really helpful, so I am not 100% sure


text:
Q: Why doesn't my nested paragraph respect font-size styles? If I have this

.outer {
   font-size: 2em;
 }

    Some Outer Div Text

       Some Inner Div Text

Both texts are 32px (16px *2)
However with this HTML:

    Some Outer Div Text

       Some Inner Div Text

The outer text is 32px, while the inner text is 16px.
How come the paragraph tag doesn't respect the parent's font-size like the div tag? I thought they would both work the same since they are both block elements?
Here's a JSFiddle in case I'm not clear: https://jsfiddle.net/scottfwalter/2Lrd6tzm/

A: Simple answer is you can't nest p tags, if you open the console and inspect you will see the 2 p tags are siblings instead of parent/child, therefore there is no inheritance.
See this answer for more details Nesting
 won't work while nesting
 will?

A: That's because browsers have their's own predefined styles for basic typography. So for example chrome sets font-size: 16px for
 but says nothing about
.
That's why we use normilize.css or reset.css to avoid such missmatching.
Try setting * {font-size: 16px;} - this should do the trick


text:
Q: For each loop takes more time to complete I have a foreach on a list. List length will be huge always like 200K or so.
When i iterate through the list in foreach, the logic within the foreach will be dealing with another collection which is also will be around 1 million items in the list. For each iteration, the collection will be filtered and it needs to update on property and return the collection as it is. But by doing this, the process never gets completed.
foreach(var list in iterationlist)
{
  var filteredCollections = collection.where(a=>a.name==list.name);
   filteredCollections.foreach(x=>{x.city="xxxx";});
}

What are the ways to make this logic faster ? Currently this implementation takes more than 3 hours but not completing yet

A: You can use a Lookup (it's similar to Dictionary<key, List<value>>):
var lookup = collection.ToLookup(a => a.name);

foreach (var list in iterationlist)
    foreach (var x in lookup[list.name])
        x.city="xxxx";

Another option is to hash the names:
var names = new HashSet<string>(iterationlist.Select(x => x.name));

foreach (var x in collection)
    if (names.Contains(x.name))
        x.city="xxxx";


text:
Q: Nearest Square Function with Python I have this sample quiz question but not to sure how to approach it with while loops.
Implement the nearest_square function. The function takes an integer argument limit, and returns the largest square number that is less than limit.
A square number is the product of an integer multiplied by itself, for example 36 is a square number because it equals 6*6.
There's more than one way to write this code, but I suggest you use a while loop!
Here is a test case you can copy to test your code. Feel free to write additional tests too!
test1 = nearest_square(40)
print("expected result: 36, actual result: {}".format(test1))

I have managed to solve it. Thank you.
def nearest_square(limit):
    limit = limit ** (0.5)
    y = int (limit)
    while y < limit :
         y = y*y
    return y

test1 = nearest_square(40)
print("expected result: 36,actual result:{}".format(test1))

A: Try using the following method to return the nearest square given the limit parameter:
def nearest_square(limit):
    answer = 0
    while (answer+1)**2 < limit:
        answer += 1
    return answer**2

A: Normally, it's more efficient to approach this kind of questions mathematically (maybe not for low inputs but certainly yes for pretty big numbers). That said, we have a good tool at hand: the square root.
If computing the square root of any number, n, yields a double value whose decimal part is fully composed by zeroes then your number is a perfect square (square of an integer).
Interestingly (and this is more related to your question), if you choose another number (that is not a perfect square) and apply a rounding operation (floor or ceil) you'll get the closest square (lower or bigger).
An example:
n = 24
sqrt = math.sqrt(n) # sqrt(24) = 4.898979485566356...
closest = [math.floor(sqrt)**2, math.ceil(sqrt)**2] # closest = [16, 25]

A: this is how i did it with while loop:
def nearest_square(value):
    i = 2
    while i < value:
        square = i*i
        if square == value:
            return square
        i+=1
        value-=1

print (nearest_square(40))

A: This is what i did.
import math
def nearest_square(limit):
    a = math.sqrt(limit)
    while type(a) != type(int()):
        limit -=1
    return limit

A: def nearest_square(value):

  i = 1
  result = 1
  while (result < value):

   if (result == value):
      return result
   i+=1
   result = i*i

  return (i-1)*(i-1)

print (nearest_square(82))

A: Here is my code:
`
def nearest_square(limit):
    while limit > 3:
        i = 2
        while i <= limit//2:
            square = i*i
            if square == limit:
                return square
            else:
                i += 1
        limit -= 1
    return 1

`

A: Here's what i did.
def nearest_square(limit):
    y = 0
    while y**2 < limit:
        y+=1
    if y**2 == limit:
        return(y)
    return(y-1)

print(nearest_square(40))

A: Here is my implementation of it.
this one is with while loop
def near1(limit):
    i = 1
    square = 1
    while (i*i) < limit:
        square = i*i
        i = i+1
    return square

but the easiest one is below.
Simple math and modulo
import math
def near(limit):
    i = int(math.pow(limit, .5))
    return i*i


text:
Q: How does this op-amp photodiode circuit behave? I am trying to understand the inner workings of a photoelectric object sensor I have in my hands. (modulated with 24 kHz) Here is the very beginning of the receiver part:

simulate this circuit – Schematic created using CircuitLab
This doesn't look like other photodiode detection circuits I have seen around. This actually doesn't look like anything I saw before. It seems like there is a band pass filter in the non inverting input. Then, the filtered signal is amplified by -10, and sent to the output.

*

*Am I correct?

*What are the pros/cons of this configuration against other classical photodiode configurations?

*How can I calculate the corner frequencies for such a band pass filter? (If it is one)

A: Although you can call it a "photodiode circuit", the underlying type of circuit is more commonly called a transimpedance amplifier (TIA). It converts a current - in this case the photocurrent - into a voltage.
The circuit you have outlined is simply put a combination of such a TIA and a non-inverting amplifier. Ignoring C2 for reasons mentioned in the comments, the TIA is basically D1 + R1 + R2.

simulate this circuit – Schematic created using CircuitLab
The bandwidth of this circuit is typically limited by the photodiode capacitance \$C_{PD}\$. The maximum bandwidth will be
$$BW (Hz) = \frac{1}{2\pi\cdot R_{tia}\cdot C_{PD}}$$
and the transimpedance gain will obviously be \$R_{tia}\$.
The voltage output is then high-pass-filtered by C1 + R3 (which unfortunately also worsens the transimpedance gain and bandwidth a bit), and finally amplified by OA1 + R4 + R5 by a factor of \$1+\frac{R_4}{R_5} = 11\$.
I can't really find any performance benefits for the circuit in the question. However, I would grant that it is easier to make and use without much worry about stability and noise. Given that it has to work at only 24kHz you can probably consider it a good enough circuit. The following more traditional circuit would probably allow you to get higher speeds (assuming you still want to cancel any low-frequency background light like in your circuit).

simulate this circuit
C2 is only there in case the circuit is unstable (which is usually the case) and is usually a fraction of \$C_{PD}\$. The circuit will still work pretty well without L1. The bandwidth is then given by
$$BW(Hz) \approx \frac{1}{2\pi\cdot R_{tia}\cdot C_2}$$


text:
Q: Stability index proof in Feller Feller proves in his second volume that the norming constant for a stable distribution is of the form: $a_n=n^{1/\alpha}$ with $\alpha\in(0,2]$ where $\alpha$ is the stability index.
The proof uses the trick of writing copies of sums of independent variables  in different ways. However, there's an induction proof which I struggle to understand. How can he conclude the following?
[...] whence $c_{rk}=c_rc_k$ for all r and k. For subscripts of the $n=r^v$ we conclude by induction that
$\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad if\quad  n=r^v \quad then \quad  c_n=c_r^v$


text:
Q: Is it possible to handle all instances of a running Loggers during particular time period Is it possible to handle all running Logger classes and copy their output to some another hub during some timeperiod?
For example:
package com.ubs.testing;

import org.apache.log4j.Logger;

public class ClassA {

    private static final Logger LOG = Logger.getLogger(ClassA.class);

    public void classAMethod() {
        LOG.info("Class A starts logging");
    }

}

package com.ubs.testing;

import org.apache.log4j.Logger;

public class ClassB {
    private static final Logger LOG = Logger.getLogger(ClassB.class);

    public void classBMethod() {
        LOG.info("Class B starts logging");
    }
}

package com.ubs.testing;

import org.apache.log4j.Logger;
import org.testng.annotations.Test;

public class ClassABTest {
    private static final Logger LOG = Logger.getLogger(ClassABTest.class);

    @Test
    public void testClassAB() throws Exception {
        LOG.info("Test class AB starts");

        /*Some logic*/

        /* >>>HERE I WANT TO START HANDLING OF THE LOGGING OUTPUT AND STORE IT IN SOME OTHER OBJECT<<<*/

        ClassA a = new ClassA();
        ClassB b = new ClassB();
        a.classAMethod(); // I want to get "Class A starts logging" message from ClassA Logger here
        b.classBMethod(); // I want to get "Class B starts logging" message from ClassA Logger here

        /* >>>HERE I WANT TO FINISH HANDLING OF THE LOGGING OUTPUT IN SOME OTHER OBJECT<<<*/

        LOG.info("Test class AB ends");

    }

}

Sorry if similar questions were posted before.
Thanks in advance for suggestions.

A: Forgot to left respone erlier.
Just switching from log4j to logback gave me a possibility to left markers, which can be handled by custom appender.
Another solution can be realized using Spring aop. Unfortunatelly mentioned issue cannot be resolved in this way, due to absence of the Spring framework within a project.


text:
Q: Scrapy на нескольких уровнях Есть сайт с новостями на главной. Хочу получить список новостей и их авторов. Но авторы указаны только на страницах самих новостей. Для этого мне придётся объединять результаты, но как это сделать с Scrapy? Я нуб в этом. Не видел пока ни одного варианта чтобы можно было получить результат, а не вернуть его в Scrapy.

A: Советую почитать документацию
pipeline.py - в этом файле описывается куда и как сохранять Items.
Если по простому - то всю информацию представляете в виде Items, а в pipelines описываете как и куда сохранять items.


text:
Q: Loading Script globally on a website I have a website that features some sort of plugin that requires a 30-line script.
Such plugin is present throughout the site pages (well, by now there are just two), because it is part of the header, which is also identical.
I'd like to know if there's a way to avoid executing that 30-line-long script every time I change from a page to the next, since the header is identical, thus improving loading time. (If you say 30 lines of code is nothing for a browser, then my question will be answered)

A: Don't worry, the script will be cached by the browser and won't be downloaded again. About 30 lines of code being a lot or not: depends on what those lines do! It's possible to write extremely expensive code with only a few lines, or even a one-liner.


text:
Q: Sphinx - MySTParser - markdown : How to let some content appear on several pages? We are writing a Sphinx doc with my team from markdown pages using myst-parser (https://myst-parser.readthedocs.io/en/latest/index.html), which is working quite well.
To avoid reduplication and improve maintenance, we would like to share content between several sections of our documentation, in 2 ways :

*

*List the same unique page under in 2 different sections

*Make some content of a page appear in another page

Here are some more details:

*

*When I reference a same page in the index of 2 different sections:

    └── open_pages
        ├── common
        │   └── common_page.md
        ├── section_1
        |   └── index.rst
        └── section_2
            └── index.rst

where both indexes include something like:
Subsection
-----------------

.. toctree::

  /open_pages/common/common_page.md

The page correctly appears twice in the menu on the left side:
SECTION 1
    Common page
SECTION 2
    Common page

But if I click on the "Common page" link under "SECTION 1" of this menu, it finds the correct page but actually brings me to the "Common page" link under "SECTION 2" of the menu, which is a bit disturbing for navigation.
Any idea why this happens or how to do that differently?

*I have no clue of how to do that but here is a description of what I would like:

Let's say I have page1.md where I have this section and table
## Interesting section
| Interesting | Table |
|------|------|
| ... | ... |

How can I include in page2.md the content of this section without copying it?
Thanks in advance for your advice!
Config:
extensions = [
    'sphinx.ext.autosectionlabel',
    'myst_parser',
    'sphinx_markdown_tables'
]
autosectionlabel_prefix_document = True

*

*Sphinx Version: 3.1.2

*myst-parser Version: 0.15.2

A: Use the include directive.
Create a stub file common_page.md in each section. This should correctly resolve the navigation issue.
Also change the common directory and its file to be content to be included.
    └── open_pages
        ├── includes
        │   └── common_snippet.md
        ├── section_1
        │   ├── common_page.md
        |   └── index.rst
        └── section_2
            ├── common_page.md
            └── index.rst

And in each common_page.md, include the content wherever you want it to appear:
Subsection
----------

.. include::

    /open_pages/common/common_snippet.md

And finally in each index.rst, where the reference page is relative to the index.rst:
.. toctree::

    common_page


text:
Q: If the composition of 2 maps is open and one of 2 maps is open, then so is the other map. From "Functional analysis" by Walter Rudin, page 39, exercise 9 (and replace "TVS" with "normed vector space").
Suppose
(a) $X$ and $Y$ are normed vector spaces,
(b) $\Lambda \colon X \to Y$ is linear,
(c) $N$ is a closed subspace of X,
(d) $\pi \colon X \to X/N$ is the quotient map, and
(e) $\Lambda x = 0$ for every $x \in N$
Prove that there is a unique $f \colon X/N \to Y$ which satisfies $\Lambda = f \circ \pi$. Prove that this $f$ is linear and that $\Lambda$ is continuous if and only if $f$ is continuous. Also, $\Lambda$ is open if and only if $f$ is open.
Everything is done, only this remains: Prove that $\Lambda$ is open if $f$ is open. My two attempts are:

*

*For each open subset $U$ of $X/N$, there exists open subset $U'$ of $X$ such that $U = \pi (U')$. Since $\Lambda$ is open, $\Lambda (U')$ is open in $Y$, which implies that $f(\pi (U')) = f(U)$ is open in Y. Hence $f$ is open.
What I'm not sure here is the existence of $U'$ above.

*Suppose that $U$ is an open subset of $X/N$, we have to prove that $f(U)$ is open in $Y$. For each $y_0 \in f(U)$, there exists $\bar{x_0} \in U$ such that $y_0 = f(\bar{x_0})$. Since $U$ is open, there exists $r>0$ such that $B(\bar{x_0},r) \subset U$. The next step is to prove that there is an open ball centered at $y_0$ and is contained in $f(U)$, then $f$ is open. And I got stuck at this step.
What am I supposed to do to complete the proof?

A: This is for part 1 of your method: The quotient topology, by definition, is: a set $U$ in $X/N$ is open if and only if $\pi^{-1}(U)$ is open in $X$.
However, you can arrive at this same result from the topology generated by quotient norm as well. It suffices to show that $\pi^{-1}(B_r(0))$ is open. But note this set is just $\{ x : \inf_{y \in N} \|x-y\| < r \}$, which can be seem to be open, as it is just the "thickening" of $N$ by $r$ amount.


text:
Q: How to determine if a string can be used as a MongoDB ObjectID? I am using Micronaut framework with JAVA and trying to validate the objectId with the below string.
60236833af6a1d49478d2bef   // Valid mongo ObjectId

60236833a46a1d49478d2bef  // Invalid mongo ObjectId

How can I perform either the string has valid objectId or not in Java with MongoDb?

A: This work for me
import org.bson.types.ObjectId;

if(ObjectId.isValid(value)){
}

A: You can refer to the ObjectId specification for how they are generated.
Any 24-character hexadecimal string should be convertable to an ObjectId.


text:
Q: Limit of a two variable function $\frac{x^2\sin^2{y}}{2x^2+y^2}$ I am trying to find the limit as $(x,y) \rightarrow (0,0)$ of $\frac{x^2\sin^2{y}}{2x^2+y^2}$
I tried this:
$\frac{x^2}{2x^2+y^2}<1/2$ so using the squeeze theorem $\frac{x^2}{2x^2+y^2}<1/2 \sin^2{y}$
and the limit of the right handside is 0, so the limit of the function must be 0. But wolfram alpha says the limit doesnt exist. Where am I going wrong?

A: Since $$2x^2+y^2 \geq 2\sqrt{2}\,|xy|$$
it follows that:
$$\left|\frac{x^2\sin^2 y}{2x^2+y^2}\right|\leq\left|xy\cdot\frac{xy}{2x^2+y^2}\right|\leq\frac{|xy|}{2\sqrt{2}}$$
so the limit is zero.


text:
Q: Concept polymorphism in C++ The short question is: how to make templated function behave differently, based
on parameter concept support.
I mean, if type T implements some concept, then my function should process it specially, than other types, that doesn't.
The question extension is: how this function should be declared, so end-user can see  what types it supports in its declaration (user, shouldn't check the defintion in order to obtain this knowledge).
So that's my concrete example, I use the "concepts" idea as it's presented in "The C++ Programming Language" by B. Stroustrup, namely a constexpr predicates, instead of c++20's concepts, since my compiler doesn't support it, yet:
template<typename T>
bool constexpr is_matrix() { ... }

template<size_t N, size_t M, typename T>
class Matrix {
    ...
    template<typename U>
    Matrix& operator+=(const U& v) {
        if constexpr (is_matrix<U>()) {
            // handle matrix case
        } else {
            // handle scalar case
        }
    }
    ...
}

This example is taken from my simple Matrix/Vector lib, that I use to study software rendering. My idea here is to require type U to satisfy my concept (support all necessary operations, provide necessary type aliases) instead of requiring it being my Matrix type, when it fails that check it is supposed to be handled as scalar.
So what techniques, can be applied here in order to make this code clearer for end-user, and are there better ways to provide concept-based parametric polymorphism, than constexpr if?
My only solution to this problem, that I was able to come up with was usage of enable_if, like this:
    ...
template<typename U, typename =
    enable_if_t<is_convertible_v<U, T> ||
        (is_matrix<U>() && is_convertible_v<matrix_value_type_t<U>, T>)>>
Matrix& operator+=(const U& v) {
    ...

Which is quite verbose and can't be called pretty, btw I would prefer to static assert that type should be either convertible or being matrix of convertible values instead of hiding this operator.
EDIT: On second thought about my solution, I actually could static_assert in the definition, but still providing assertion criteria in declaration
template<typename U, bool check = is_convertible_v<U, T> || (is_matrix<U>() && is_convertible_v<matrix_value_type_t<U>, T>)>
... {
    static_assert(check, "Type U should be either convertible to T, or being a matrix of convertible values");
}

EDIT2: Which further can be improved into more readable variant:
...
template <typename U, bool check = std::disjunction_v<
    compatible_type<This, U>,
    compatible_matrix<This, U>,
    compatible_vector<This, U>>>
Matrix& operator+=(const U& v) {
    assert_compatible<check>();
...

A: Simply overload the operator for all types you want to support. You may also add another version that generates a comprehensible compile-time error
 Matrix& operator+=(Matrix const&);

 template<typename matrix, typename=enable_if_t<is_matrix<matrix>::value>>
 Matrix& operator+=(matrix const&);

 template<typename scalar, typename=enable_if_t<is_scalar<scalar>::value>>
 Matrix& operator+=(scalar);

 template<typename arg>
 Matrix& operator+=(arg&&)        // catch attempts to add wrong argument type
 {
     static_assert(is_matrix<arg>::value || is_scalar<arg>::value,
         "Matrix::operator+=(arg) requires matrix or scalar argument");
     assert(false);
     return*this;
 }

You may also declare the last operator [[noreturn]].


text:
Q: How to animate UITableView without resetting table position, similar to Apple Mail app? I have a tableView which has a button to put it into a pseudoEditing mode. In this mode this cells "shift right/left" to display a checkbox on the left hand side. The process is not unlike how the Mail app "Edit" button works.
The way i am doing this now is by setting a pseudoEditing flag and then reloading the table and if the flag is set then the cell is drawn differently. I have also put this inside an animation block which gives me the shifting effect:
[UIView beginAnimations:@"cell shift" context:nil];
[UIView setAnimationDuration:kEventActionViewAnimationDuration];

cell.eventName.frame = (self.pseudoEditing) ? kPseudoEditingFirstIndentedRect :     kFirstLabelRect;
cell.eventLocationName.frame = (self.pseudoEditing) ? kPseudoEditingSecondIndentedRect : kSecondaryLabelRect;
cell.eventStartDate.frame = (self.pseudoEditing) ? kPseudoEditingThirdIndentedRect : kThirdLabelRect;
cell.eventStartEndTime.frame = (self.pseudoEditing) ? kPseudoEditingFourthIndentedRect : kFourthLabelRect;
cell.imageView.frame = (self.pseudoEditing) ? kImageViewIndentedRect : kImageViewRect;
cell.rsvpImageView.hidden = !self.pseudoEditing;

[UIView commitAnimations];

return cell;

My problem though is that i need to reload the table in order for the cellForRowAtIndexPath: method to be called to update the cells which in turn resets the table position to the top of the tableView. I could then set the table position to the position it was before hitting the edit button using something like scrollToIndexPath:... This however wouldnt work because the table would scroll to the top and then back to the previous cell which i dont want.
So is there a way to reload the tableCells in a tableView without having the tableView change scroll position, similar to how the Mail app does it?
Thx

A: I wouldn't reload the table view for this at all. Make your cells have a property like multiEditing. When you begin editing, iterate over the visibleCells array of the table view and set the property in an animation block (the cell itself could perform the animation, similar to the existing setEditing:animated: method). For new cells, simply set it without animation after dequeueing/creating them.

A: You could subclass UITableViewCell and override -layoutSubviews. In that method, you'll check UITableViewCells editing property and determine the frames of the content views accordingly. Any changes made in -layoutSubviews will automatically animate when the cells editing mode is changed. Simply setting editing on the table view will automatically perform that change to all cells.


text:
Q: Android RecyclerView Provide Vertical and Horizontal I have one Vertical RecyclerView. I have added items in it. It is working fine. Now my issue is when any single item will have so many data, i want my whole RecyclerView to scroll horizontally not that single item.
Here is the UI i have made.
For Inner cell, I am adding view dynamically in Linearlayout.
for (int i = 0; i <subItem ; i++) {

        View Cv= Li.inflate(R.layout.custom_cell, holder.ViewLayout, false);
        TextView  textBedInfo = (TextView) Cv.findViewById(R.id.textBedInfo);
        TextView  textRowInfo = (TextView) Cv.findViewById(R.id.textRowInfo);

        textBedInfo.setTypeface(fontBold);
        textRowInfo.setTypeface(fontRegular);

        if(i==0 || i==subItem-1){
            textBedInfo.setVisibility(View.GONE);
            textRowInfo.setText((position+1)+" Row");
        }
        else{
            textRowInfo.setVisibility(View.GONE);
            ConstantMethod.setBorder(textBedInfo, Color.WHITE,R.drawable.circle);
            textBedInfo.setText(String.valueOf(i));
        }
        holder.ViewLayout.addView(Cv);
    }

As you can see in image , last row has too many data so i want my recycler view to scroll horizontally but it's not working.
I have tried by setting HorizontalScrollView as parent of recyclerView but it also not works. It shows blank view.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="center_horizontal"
          tools:context="com.sunbed.reservation.ReservationMapFragment">

<android.support.v7.widget.RecyclerView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:id="@+id/recyclerMaps"
    app:layoutManager="LinearLayoutManager">

</android.support.v7.widget.RecyclerView>

This is my main layout. Anyone could help me out for same?
Thanks.

A: Finally I have managed to implement it. I have removed resyclerview. And used Scrollview. I have added all views dynamically in my scrollview. This is my parent layout in which i have added views.
<ScrollView
    android:id="@+id/scrollViewMap"
    android:clipToPadding="false"
    android:layout_width="wrap_content"
    android:scrollbars="none"
    android:layout_height="wrap_content">
    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:scrollbars="none"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/layoutMaps"
            android:layout_width="wrap_content"
            android:gravity="center"
            android:layout_height="wrap_content"
            android:orientation="vertical">

        </LinearLayout>
    </HorizontalScrollView>
</ScrollView>

I know, that it will take time to load views when all views are loaded dynamically. But for now i have used this solution. Better answers are always accepted.
Thanks.


text:
Q: Summation of values in the same column in sql I want to sum the values in the same column. I have tried with cross join and it does work for me but I dont want the result should be repeated values
What I have:-
table:-
|key|year|value|
----------------
|sam|2013| 30   |
-----------------
|sam|2014| 50   |
-----------------
|sam|2015| 70   |
-----------------
|sam|2016| 90   |
-----------------
|Jam|2013| 0   |
-----------------
|Jam|2014| 10   |
-----------------
|Jam|2015| 0   |
-----------------
|Jam|2016| 20   |
-----------------

Query:-
SELECT (t1.value + t2.value) AS total
FROM table t1 CROSS JOIN table t2
WHERE t1.year = t2.year AND t1.key  <> t2.key;

Output for this Query:-
|total|
-----
|30|
-----
|60|
-----
|70|
-----
|110|
-----
|30|
-----
|60|
-----
|70|
-----
|110|
-----

But what I want is:-
|total|
-----
|30|
-----
|60|
-----
|70|
-----
|110|
-----

Can someone tell me what modification should I do to get this result?

A: I think you want aggregation:
SELECT sum(value) as total
FROM table t1
GROUP BY year
ORDER BY year;


text:
Q: Выпуклый многоугольник Многоугольник – замкнутая ломаная.
Простым называется многоугольник без самопересечений, самокасаний.
Выпуклым называется многоугольник, ограничивающий выпуклую область.
Выпуклой называется область A, обладающая свойством P, Q∈A⇒[P,Q]⊆A.
Формат ввода
В первой строке одно число
N (3≤N≤100000). Далее в N строках по паре целых чисел — координаты очередной вершины простого многоугольника в порядке обхода по или против часовой стрелки.
Формат вывода
Одна строка «YES», если приведённый многоугольник является выпуклым, и «NO» в противном случае.
Пример
Ввод:
3
0 0
0 1
1 0

Вывод:
YES

Подскажите пожалуйста, как это делать?
#include <bits/stdc++.h>

using namespace std;

struct Point {
    int x, y;
    Point() {}
    Point(int x, int y) :x(x), y(y) {}
};

Point operator -(const Point& a, const Point& b) {
    return Point(a.x - b.x, a.y - b.y);
}

//dotProduct
int dP(const Point& a, const Point& b) {
    return a.x * b.x + a.y * b.y;
}

//crossProduct
int cP(const Point& a, const Point& b) {
    return a.x * b.y - a.y * b.x;
}

bool operator ==(const Point& a, const Point& b) {
    return a.x == b.x && a.y == b.y;
}

double len(const Point& a) {
    return hypot(a.x, a.y);
}

double angle(const Point& a, const Point& b) {
    return atan2(cP(a, b), dP(a, b));
}

bool PointOnSegment(const Point& a, const Point& b, const Point& p) {
    if (p == a || p == b) return true;
    return cP(a - p, b - p) == 0 && dP(a - p, b - p) < 0;
}

istream& operator >>(istream& in, Point& p) {
    in >> p.x >> p.y;
    return in;
}

bool ccw(Point a, Point b, Point c) {
    float s = cP(c - a, c - b) / 2.0;
    if (s < 0)
        return false;
    return true;
}

bool is_convex(vector<Point>& p) {
    int l, i, r;
    int n = p.size();
    bool isccw = ccw(p[n - 1], p[0], p[1]);
    for (i = 1; i < n; ++i)
    {
        l = (i - 1 + n) % n;
        r = (i + 1) % n;
        if (ccw(p[l], p[i], p[r]) != isccw)
            return false;
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    vector<Point> points;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        points.push_back(Point(x, y));
    }

    cout << (is_convex(points) ? "YES" : "NO");

    return 0;
}

В тестирующей системе выдает ошибку WA на 28 тесте. (неправильный ответ на 28-ом тесте). Подскажите пожалуйста, как исправить.

A: Не нужно строить выпуклую оболочку чтобы проверить что простой многоугольник является выпуклым. Вы упустили один-единственный случай: три точки могут оказаться на одной прямой. В этом случае вы не можете полагаться на
bool isccw = ccw(p[n - 1], p[0], p[1]);

Исправить можно просто: отыщите самую нижнюю вершину, если их несколько, то из них выберите самую левую. isccw нужно считать на этой тройке.
И в цикле тоже надо учитывать что три или более точек могут лежать на одной прямой. Функцию ccw надо будет переделать так чтобы она могла возвращать три состояния.
Альтернативное решение - посчитать ccw на всех тройках вершин и убедится что она не возвращает и "лево" и "право". Так, наверно, проще:
// g++ -std=c++11 -pedantic -Wall -Wextra is_convex.cpp

#include <bits/stdc++.h>

struct Point {
    int x;
    int y;
};

int read_int() {
    int i;
    std::cin >> i;
    return i;
}

Point read_point() {
    int x = read_int();
    int y = read_int();
    return {x, y};
}

Point operator -(const Point& a, const Point& b) {
    return {a.x - b.x, a.y - b.y};
}

int cross(const Point& a, const Point& b) {
    return a.x * b.y - a.y * b.x;
}

int area2(const Point& a, const Point& b, const Point& c) {
    return cross(c - a, c - b);
}

class Clock {
public:
    Clock(const Point& p1, const Point& p2) : p1(p1), p2(p2), has_ccw(false), has_cw(false) {}
    bool update(const Point& p3) {
        int a = area2(p1, p2, p3);
        has_ccw = has_ccw || a < 0;
        has_cw = has_cw || a > 0;
        p1 = p2;
        p2 = p3;
        return has_ccw && has_cw;
    }
private:
    Point p1;
    Point p2;
    bool has_ccw;
    bool has_cw;
};

bool is_convex() {
    const int n = read_int();
    const Point first = read_point();
    const Point second = read_point();

    Clock c(first, second);

    for (int i = 2; i < n; ++i) {
        if (c.update(read_point())) {
            return false;
        }
    }
    if (c.update(first)) {
        return false;
    }
    if (c.update(second)) {
        return false;
    }
    return true;
}

int main() {
    std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
    std::cout << (is_convex() ? "YES" : "NO");
    return 0;
}

A: выпуклую оболочку можно найти с помощью алгоритма Грэхема. В вашем случае если после построения выпуклой оболочки останутся лишние точки то из ваших точек нельзя построить выпуклую оболочку.

Алгоритм. Найдём самую левую и самую правую точки A и B (если таких
точек несколько, то возьмём самую нижнюю среди левых, и самую верхнюю
среди правых). Понятно, что и A, и B обязательно попадут в выпуклую
оболочку. Далее, проведём через них прямую AB, разделив множество всех
точек на верхнее и нижнее подмножества S1 и S2 (точки, лежащие на
прямой, можно отнести к любому множеству - они всё равно не войдут в
оболочку). Точки A и B отнесём к обоим множествам. Теперь построим для
S1 верхнюю оболочку, а для S2 - нижнюю оболочку, и объединим их,
получив ответ. Чтобы получить, скажем, верхнюю оболочку, нужно
отсортировать все точки по абсциссе, затем пройтись по всем точкам,
рассматривая на каждом шаге кроме самой точки две предыдущие точки,
вошедшие в оболочку. Если текущая тройка точек образует не правый
поворот (что легко проверить с помощью Ориентированной площади), то
ближайшего соседа нужно удалить из оболочки. В конце концов, останутся
только точки, входящие в выпуклую оболочку.
Итак, алгоритм заключается в сортировке всех точек по абсциссе и двух
(в худшем случае) обходах всех точек, т.е. требуемая асимптотика O (N
log N) достигнута.

#include <vector>
#include <algorithm>

struct Point
{
  double x, y;
};

bool cmp(Point a, Point b)
{
  return a.x < b.x || a.x == b.x && a.y < b.y;
}

bool cw(Point a, Point b, Point c)
{
  return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < 0;
}

bool ccw(Point a, Point b, Point c) {
  return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) > 0;
}

void convex_hull(std::vector<Point>& a)
{
  if (a.size() == 1) {
    return;
  }

  std::sort(a.begin(), a.end(), &cmp);
  Point p1 = a[0], p2 = a.back();
  std::vector<Point> up, down;
  up.push_back(p1);
  down.push_back(p1);

  for (size_t i = 1; i < a.size(); ++i) {
    if (i == a.size() - 1 || cw(p1, a[i], p2)) {
      while (up.size() >= 2 && !cw(up[up.size() - 2], up[up.size() - 1], a[i])) {
        up.pop_back();
      }
      up.push_back(a[i]);
    }
    if (i == a.size() - 1 || ccw(p1, a[i], p2)) {
      while (down.size() >= 2 && !ccw(down[down.size() - 2], down[down.size() - 1], a[i])) {
        down.pop_back();
      }
      down.push_back(a[i]);
    }
  }

  a.clear();
  for (size_t i = 0; i < up.size(); ++i) {
    a.push_back(up[i]);
  }
  for (size_t i = down.size() - 2; i > 0; --i) {
    a.push_back(down[i]);
  }
}

материал взят с сайта e-maxx.ru


text:
Q: How to setup a guest network? i've a some Cisco WAP2000 access point.
These are used to allow our employee and our warehouse to connect to out network.
I would like to allow guest's to connect but for using only internet, with no limitations, and hide our disks, printers etc..
I know this access point allow multiple SSID but  i don't know how to use this feature to create a guest network.
Thanks

A: I am not fammiliar with Cisco WAP access points, but a you should be able to configure two SSIDs, each in its own VLAN. So you just create a 'guest' VLAN for them.
After that, you just need to set up access policies on the router/firewall, to only allow connections from the guest subnet to the internet, and dissalow connections to other parts of the network. Also it would be smart to enable logging in case of abuse (depends on your local laws what you have to log, and what not).