text:
Q: How do you pronounce "103rd"? The number 103 can be pronounced as "One hundred and three" or "One o three".
Can "103rd" be pronounced as "One hundred and third" or "One o third?" (Especially in referring to a name of a street, like 103rd St)
edit: typo. One hundred or third → One hundred and third

A: It would be 'A hundred third' or 'A hundred and third'. replacing the pronunciation of zero with 'o' is a colloquial shortcut. And then what would you say in the case of 100th or 1000th?
you only replace zeros with 'o' when saying the number and keep it with regular zeros when saying the ordinal number(1st, 2nd, third...)
Source of shortcut claim

A: As you've noted, 103, can be pronounced as "one hundred three" or "one hundred and three". Additionally it can be pronounced beginning with an "a" instead of "one". My research into this question has been both confusing and enlightening. I thought that one of the things that distinguished BrE from AmE was that in BrE "and" is spoken before saying numbers 1 through 99 after saying "hundred", "thousand", "million", "billion" etc. Here's a chart from mathisfun.com to illustrate (I have highlighted the extra "and"s in BrE).:

101        US: one hundred one UK: one hundred and one 999
   US: nine hundred ninety-nine UK: nine hundred and
  ninety-nine
1,101 US: one thousand, one hundred one UK: one thousand, one
  hundred and one 15,016  US: fifteen thousand, sixteen
  UK: fifteen thousand, and sixteen 112,621 US: one
  hundred twelve thousand, six hundred twenty-one
UK: one hundred and twelve thousand, six hundred and twenty-one
Millions and More
191,232,891 US: one hundred ninety-one million, two hundred
  thirty-two thousand, eight hundred ninety-one UK: one hundred
  and ninety-one million, two hundred and thirty-two thousand, eight hundred and ninety-one

This phenomenon is also attested in the Wikipedia article on English numerals:

999,000 nine hundred and ninety-nine thousand (inclusively British
  English, Irish English, Australian English, and New Zealand
  English)
nine hundred ninety-nine thousand (American English)
English numerals (Wikipedia)

And if you want another source, check out the text to speech examples for both American and British speakers at this site. I recommend you type the number "111" because the difference is hard to discern with certain numbers, and "111" is clear. You can see that for the speakers of English from Canada, Australia, Britain and India the "and" is clearly audible, whereas in the American version it isn't.
However, this practice of not using "and" when reading out numbers by Americans is not universal:

In American English, many students are taught not to use the word and
  anywhere in the whole part of a number, so it is not used before the
  tens and ones. It is instead used as a verbal delimiter when dealing
  with compound numbers. Thus, instead of "three hundred and
  seventy-three," "three hundred seventy-three" would be said. Despite
  this rule, some Americans use the and in reading numbers containing
  tens and ones as an alternative variant.
English Numerals (Wikipedia)

Illinois Democratic candidate: "I am running for the hundred and seventh district..."
WTHR (Indianapolis-based) anchor says "one hundred and seven"
All this information has made me uncertain, but it's clear many Americans say the "and" in numbers like this. I don't speak for all people, I can only tell you what I hear.
As you are specifically asking about an ordinal number and not a cardinal number, I'll give some information I've found about this topic specifically. See this question and answer on a Word Reference forum thread:

Question: Is this a way to say ordinal numbers for large numbers?
  1,234,295,345 one billion two hundred thirty-four million two
  hundred ninety-five thousand three hundred forty-fifth?

There are only two answers, both American users, and both seem to agree that the OP is correct. Note, no "and" before the "forty-fifth"
Word Reference forum link
You can also go to the text to speech site I linked and type in 103rd or 111th and see that the "and" is not pronounced.
On the other hand, there are plenty of examples of the opposite.
In many other text to speech programs the American speaker says "hundred and third"
American saying the "Hundred and First Airborne"
American saying "There is no organisation in the world that can do what the Hundred and First does"
American saying "Hundred and Seventy Third Airborne
American saying "hundred and tenth anniversary", talking about a Harley Davidson
American saying "hundred and tenth anniversary"
So this question is way outside my knowledge of how people around the world do or should pronounce 103rd. From my experience in BrE you can say it:
A hundred and third
or
One hundred and third
and in AmE I have heard examples of both the above with and without the "and".
There may also be more informal vernacular ways of saying it such as "one oh third".

A: In New Yawk, where these types of numbers are used multiple times daily, there are customary differentiations:
For 1,2,3, - or, first, second and third:
"I live at 301 (302,309...310) 102nd St.  - on the 103rd. floor"
"I live at three oh one (three oh two, three oh nine...three ten) a hundred and second street - on the hundred and third floor."
"I live at 125, 125th St. - on the 125th floor."
"I live at one twenty-five, a hundred and twenty-fifth street - on the hundred (and) twenty-fifth floor." (the "and" in parentheses is optional)
As I stated, these are customs - not rules. They self-perpetuate because nobody wants to look like a non-native.


text:
Q: Magento1.9.1 Spam newsletter subscriptions How to block spam newsletter subscription?
I have added captcha and form key for newsletter subscription but still get spam subscription.
These subscriptions have unsubscribed status.
Please help.

A: Just add a reCaptcha to avoid spam (I recommend invisible reCaptcha v2)

A: 1.Enable the newsletter email confirmation setting from Magento 1 admin as,
  System >> Configuration >> Customer >> Newsletter >> Need to confirm : Yes
2.And as Jake mentioned you need to install the google Invisible recaptcha plugin. you may check below from Amasty,
https://amasty.com/magento-google-invisible-captcha.html

redpajama_set_name: RedPajamaStackExchange


text:
Q: Efficient way for very long intervals in Java I am writing a program for school which will send an E-Mail if something changes on to school time table. Program will have to read updated information every 5 minutes from school's website until 4:00 PM and will have to wait for next 14 hours and repeat the same.
My question is: How do I implement this short ~5 min and the very long ~14h intervals efficiently in Java?
Just use Thread.wait(millis)?
Thanks!
//edit: Thanks for the answers, I think I will use a once executed Timer and will calculate the new delay after every update.

A: Even if the performance doesn't really matter in this case, just check the current date with Calendar.getInstance() or new Date() before you initiate the check of the website. If it's not in your time-frame, do nothing. For scheduling the website-check, just use a java.util.Timer or similar services/frameworks.

A: You could use schedule method of Java Timer. Everytime after executing the task, you should calculate an interval (based on current time) and schedule the task accordingly to new interval.

A: Please take a look at Quartz. It meets most of timing/scheduling needs.


text:
Q: How to remove the default eclipse and setup new eclipse? I have a eclipse. I removed default eclipse from /usr/lib as,
sudo apt-get remove eclipse

Then I copied my eclipse folder to /usr/lib and tried to launch it as,
sudo eclipse

But I am getting the following error,
usr/bin/eclipse: 35: exec: /usr/lib/eclipse/eclipse: not found

My eclipse which I copied is present in /usr/lib. Why am I getting this error? My requirement is I have to remove the default eclipse and launch my own eclipse from /usr/lib.

A: you need to purge it, that way it will remove all the configurations saved in your home folder.
sudo apt-get purge eclipse
and then
sudo apt-get install eclipse


text:
Q: Auto Padding Bottom? I'm trying to somehow fit the loader I'm showing you guys in the container. The problem is that if I do padding-bottom, the loader is just going to override the browser and its going to be displayed as an un-resized loader (which does not look professional at all).
Would love to know if anyone has any cool methods to be able to arrange this problem. (You can find my code at the bottom).

This is my CSS so far:
export const Container = styled.div`
  padding: 250px 50px;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 20px 0px;
  background-color: rgb(255, 255, 255);
  border-radius: 8px;
  margin: 25px;
  bottom: 10px;
`;

Thanks in advance for the help!

A: Just update the container to fill the parent size minus the 25px of margin you are specifying.
export const Container = styled.div`
  padding: 250px 50px;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 20px 0px;
  background-color: rgb(255, 255, 255);
  border-radius: 8px;
  position: absolute;
  top: 25px;
  left: 25px;
  right: 25px;
  bottom: 25px;
`;

or if you are using flex you could do
export const Container = styled.div`
  flex: 1;
  margin: 25px;
  padding: 250px 50px;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 20px 0px;
  background-color: rgb(255, 255, 255);
  border-radius: 8px;
`;


text: Q: How can I perform replace operations in the specific areas of code text in visual studio code? I would like to replace words or characters in my small piece of code and another part won't be affected. But when I go to replace words or characters it always selects all the text of the code to perform the operation. So, how can I solve this issue?


text:
Q: Middleware in laravel does not works properly I am trying to apply middleware on my routes like this:
Route::get('twitterlogin','TwitterController@gettwitterlogin');
Route::post('twitterlogin','TwitterController@posttwitterlogin');
Route::group(['middleware'=>'auth'],function()
{
    Route::get('twitternewsfeed','TwitterController@gettwitternewsfeed');
    Route::post('postimage','TwitterController@postimage');
    Route::post('posttweet','TwitterController@posttweet');
    Route::get('twitterlogout','TwitterController@gettwitterlogout');
    Route::post('editprofilepic','TwitterController@posteditprofilepic');
    Route::post('searchuser','TwitterController@postsearchuser');
    Route::post('edittweet{id}','TwitterController@postedittweet');
    Route::get('deletetweet{id}','TwitterController@getdeletetweet');
    Route::post('editprofile','TwitterController@posteditprofile');
    Route::get('userprofile{email}','TwitterController@getuserprofile');
});

And when i am trying to submit my login form it does not bring me on next page. It again opens the login page....what is the exact problem in this? My authenticate middleware is as follows....
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Contracts\Auth\Guard;

class Authenticate
{
    /**
     * The Guard implementation.
     *
     * @var Guard
     */
    protected $auth;

/**
 * Create a new middleware instance.
 *
 * @param  Guard  $auth
 * @return void
 */
public function __construct(Guard $auth)
{
    $this->auth = $auth;
}

/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Closure  $next
 * @return mixed
 */
public function handle($request, Closure $next)
{
    if ($this->auth->guest()) {
        if ($request->ajax()) {
            return response('Unauthorized.', 401);
        } else {
            return redirect()->guest('twitterlogin');
        }
    }

    return $next($request);
}
}

A: I assume you are using the Route::post('twitterlogin','TwitterController@posttwitterlogin') route to perform your login operation - please ensure that you're logging the user in with Laravel's Auth correctly and redirecting the user to the appropriate route in the posttwitterlogin method
I feel you also may also be using a different table to store user data - in which case, kindly ensure that you have your auth.php config file setup appropriately
In case you're using a custom authentication mechanism for some reason, you'll need to replace $this->auth->guest() in your middleware with the appropriate alternative check for the user not being logged-in
For eg: if you're setting a Session variable called is_authenticated to true with \Session::put('is_authenticated', true) upon successfully logging in, you'll check for it with if(\Session::get('is_authenticated') === true) in your Middleware instead of relying on the Laravel Auth method if ($this->auth->guest())


text:
Q: Java How do you find a complexity class for algorithms? I have a question to find a complexity class estimate of a algorithm. The question gives recorded times for an algorithm. So, do I just average out the times based on how it was computed?
Sorry, I missed a part.
ok, so it recorded time like N = 100, Algorithm = 300, next N = 200, Algorithm = 604, next N = 400 Algorithm = 1196, next N = 800 Algorithm 2395. So, do i calculate like 300/100, and 604/200 and find the average. Is that how I'm supposed to estimate the complexity class for the algorithm?

A: Try plotting running time vs. N and see if you get any insight. (e.g. if running time = f(N), is f(N) about equal to log(N), or sqrt(N), or... ?)

A: Does it give you the inputs to the algorithm as well, which produce the recorded times?  You can deduce the growth order according to the input size vs output running time.
i.e. input = 1, running time = 10
input = 100, running time = 100000
would appear to be O(N^2)
i.e.
with input = 1 and running time = 10, likely O(cn) where C = 10
with n = 1, N^2 and N are the same
with input = 10 and running time = 100000, likely O(cN^2) where C = 10
and N = 100*100 = 10000, * 10 = 100000

A: Hint: Calculate how much time the algorithm spent to process one single item.
How does these calculates time relate to each other?
Does the algorithm alway spent the same time to process one item, regardless how many items, is there a factor? maybe the time raises exponentially?

A: I don't think time will help figure out it's complexity class. Times can be very different even on exactly the same task (depends on the scheduler or other factors.)
Look at how many more steps it takes as your input get's larger. So if you had a sorting algorithm that took 100 steps to sort 10 items and 10000 steps to sort 100 items you'd say sorted in big O ( N^2 ) since
Input  Steps
10    100 (which equals 10*10)
100   10000 (which equals 100*100)
It's not about averaging but looking for a function that maps the input to the number of steps and then finding what part of that function grows the fastest ( N^2 grows faster than N so if your function was N^2 + N you classify it as N^2).
At least that's how I remember it, but it's been ages!! :)
EDIT: Now that there are more details in your question, here is what I'd do, with the above in mind.
Don't think about averaging anything, just think about how f(100) = 300, f(200)=604, and f(400)=1196.
And it doesn't have to be exact, just in the ball park. So a simple linear function (such as f(x)=3*N ) where f(100)=300, f(200)=600, and f(400)=1200 that would describe the complexity of the algorithm you could say the complexity class of the algorithm was linear or big O(N).
Hope that helps!


text:
Q: How can I enumerate a sublevel in a multiindex in pandas simply? I would like to create a new column with the enumeration of Objects column based on membership in Name

Name
Objects

A
phone

B
phone

B
keys

B
chewing gum

C
radio

C
chewing gum

into

Name
Object no.
Objects

A
1
phone

B
1
phone

B
2
keys

B
3
chewing gum

C
1
radio

C
2
chewing gum

I suppose that there should be a really easy way to do it

A: You can try groupy then cumcount
df['Object no.'] = df.groupby('Name').cumcount().add(1)

print(df)

  Name      Objects  Object no.
0    A        phone           1
1    B        phone           1
2    B         keys           2
3    B  chewing gum           3
4    C        radio           1
5    C  chewing gum           2


text:
Q: Pandas replace turns out NaN I've recently started experimenting with pandas for Python. I've loaded a dataframe from excell which results in the following:
Datum   Fotonummer  Werkput Vlak    Spoornummer Oriëntatie  Onderwerp   Fotograaf
2011-05-16  1          1    1.0        1           N     Vlakfoto Spoor 1   DIM
2011-05-16  2          1    1.0        1           N     Vlakfoto Spoor 1   DIM
2011-05-16  3          1    1.0        1           N     Vlakfoto Spoor 1   DIM

At some points the column 'Spoornummer' contains multiple values seperated by a '-'.
2011-05-16  24         1    1.0    12 - 13 - 14 - 15 - 16   N   Vlakfoto Spoor 12 - 13 - 14 - 15 - 16   DIM
2011-05-16  25         1    1.0    17 - 18                  N   Vlakfoto Spoor 17 - 18                  DIM
2011-05-16  26         1    1.0    17 - 18                  N   Vlakfoto Spoor 17 - 18                  DIM

I wanted to replace the '-' by a '|' for easy usage in a Neo4J db, and tried to do so using:
df['Spoornummer'] = df['Spoornummer'].str.replace('-', '|')

and other variations, but to no avail. On executing the command the entire 'Spoornummer' column gets a NaN value.
Thx in advance.

A: You can use sub() from re and apply it to every row in colum Spoornummer:
import re
df['Spoornummer'] = df['Spoornummer'].apply(lambda x: re.sub("-", "|", x))


text:
Q: Redirect using CBV's in Django I believe this is a simple one, just can't spot the solution. I have a view that does a bit of work on the server then passes the user back to another view, typically the original calling view.
The way I'm rendering it now, the url isn't redirected, ie it's the url of the original receiving view. So in the case the user refreshes, they'll run that server code again.
class CountSomethingView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
        # so some counting
        view = MyDetailView.as_view()
        return view(request, *args, **kwargs)

A: I strongly recommend not overriding get or post methods. Instead, override dispatch. So, to expand on Platinum Azure's answer:
class CountSomethingView(LoginRequiredMixin, RedirectView):
    permanent = False

    def get_redirect_url(self, **kwargs):
        url = you_can_define_the_url_however_you_want(**kwargs)
        return url

    def dispatch(self, request, *args, **kwargs):
        # do something
        return super(CountSomethingView, self).dispatch(request, *args, **kwargs)

A: when a user does an action and I need to redirect him to the same page, first of all I use a templateView to display a simple "thanks" (for example) then provide a link to go back to the previous page with a simple {% url %}
for example :
from django.views.generic import CreateView, TemplateView
from django.http import HttpResponseRedirect

class UserServiceCreateView(CreateView):
    form_class = UserServiceForm
    template_name = "services/add_service.html"

    def form_valid(self, form):
    [...]

    return HttpResponseRedirect('/service/add/thanks/')

class UserServiceAddedTemplateView(TemplateView):
     template_name = "services/thanks_service.html"

    def get_context_data(self, **kw):
        context = super(UserServiceAddedTemplateView, self).\
            get_context_data(**kw)
        context['sentance'] = 'Your service has been successfully created'
        return context

in the template thanks_service.html i use {% url %} to go back to the expected page
Hope this can help

A: Performing a redirect in a Django Class Based View is easy.
Simply do a return redirect('your url goes here').
However, I believe this isn't what you want to do.
I see you're using get().
Normally, when speaking about HTTP, a GET request is seldom followed by a redirect.
A POST request is usually followed by a redirect because when the user goes backwards you wouldn't want to submit the same data again.
So what do you want to do?
What I think you want to do is this:
def get(self, request, *args, **kwargs):
   return render_to_response('your template', data)

or even better
def get(self, request, *args, **kwargs):
    return render(request, self.template_name, data)

A: If you're creating or updating a model, consider inheriting from CreateView or UpdateView and specifying a success_url.
If you're really doing a redirect off of an HTTP GET action, you can inherit from RedirectView and override the get method (optionally also specifying permanent = False):
class CountSomethingView(LoginRequiredMixin, RedirectView):
    permanent = False

    def get(self, request, *args, **kwargs):
        # do something
        return super(CountSomethingView, self).get(self, request, *args, **kwargs)

Note that it's really bad practice to have a get action with side-effects (unless it's just populating a cache or modifying non-essential data). In most cases, you should consider using a form-based or model-form-based view, such as CreateView or UpdateView as suggested above.


text:
Q: Fluid responsive navigation with dropdown I have designed a navigation system for my project which is built on flexbox like unsplash
Code

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===========================
       For Main Navigation
   =========================== */

.cm-navigation-area {
  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.6s ease-in-out;
  z-index: 5;
  display: block;
  position: fixed;
  width: 100%;
  left: 0;
  top: 0;
}

.cm-navigation {
  background: #ffffff;
  height: 70px;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .cm-navigation {
    margin: 0 -5%;
  }
}

.cm-burger-nav {
  display: flex;
  justify-content: center;
  align-items: center;
}

#burger-nav {
  fill: #575757;
}

.cm-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.cm-logo a img {
  width: auto;
  height: 50px;
}

@media (max-width: 991px) {
  .cm-logo a img {
    width: 80px;
    height: auto;
  }
}

.cm-nav nav {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cm-nav nav ul {
  margin: 0;
  padding: 0;
  display: flex;
}

.cm-nav nav ul li {
  list-style: none;
  display: flex;
}

.cm-nav nav ul li:not(:last-child) {
  margin-right: 1.8em;
}

@media (max-width: 991px) {
  .cm-nav nav ul li:not(:last-child) {
    margin-right: 10;
  }
}

.cm-nav nav ul li a {
  font-size: 0.9em;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  color: gray;
  font-weight: 300;
}

.cm-nav nav ul li a span {
  padding-right: 0.4em;
}

.cm-nav nav ul li a span img {
  width: 13px;
  height: auto;
}

@media (max-width: 991px) {
  .cm-nav nav ul li a span img {
    width: 18px;
    height: auto;
  }
}

@media (max-width: 768px) {
  .nav-r-text {
    display: none;
  }
}

.cm-currency {
  font-size: 0.8em;
}

.cm-currency .cm-currency-link span {
  margin-right: 0 !important;
}

.cm-currency .cm-currency-link span img {
  width: 10px !important;
}

.cm-dots {
  margin-right: 2.5em !important;
}

.cm-submit-photo {
  margin-right: 48px !important;
}

.cm-submit-photo-link {
  transition: all 0.2s ease-in-out;
  display: flex;
  background: #fff;
  border: 1px solid #dddddd;
  color: gray !important;
  text-decoration: none;
  padding: 0 11px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
  font-weight: 100 !important;
  font-size: 14px;
  text-transform: uppercase;
  height: 32px;
}

.cm-submit-photo-link:hover {
  border: 1px solid #dedede;
  color: #dedede;
}

.cm-join-button {
  position: relative;
}

.cm-join-button:before {
  position: absolute;
  top: 0;
  left: -24px;
  display: inline-block;
  width: 1px;
  height: 32px;
  content: "";
  background-color: gray;
}

.cm-join-button-link {
  transition: all 0.3s ease-in-out;
  display: flex;
  background: green;
  color: #ffffff !important;
  text-decoration: none;
  padding: 0 11px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
  font-weight: 100 !important;
  font-size: 14px;
  text-transform: uppercase;
  height: 32px;
}

.cm-join-button-link:hover {
  background: #004d00;
}

.cm-user-link img {
  height: 30px;
  width: auto;
}

.cm-cart {
  min-height: 30px;
}

#cm-cart-link {
  position: relative;
}

#cm-cart-link .cart-img {
  width: 16px;
  height: auto;
}

#cm-cart-link .cm-cart-badge:after {
  position: absolute;
  right: -6px;
  top: 0;
  content: attr(data-count);
  font-size: 60%;
  width: 16px;
  height: 16px;
  padding: 0.3em;
  border-radius: 50%;
  line-height: 1em;
  color: white;
  background: green;
  text-align: center;
  min-width: 1.2em;
}

/* ===================================
       Navbar Search Integrations
   =================================== */

.cm-nav-searchbar {
  display: flex;
  flex: 1;
  align-items: center;
  height: 100%;
  padding: 0 1em;
}

@media (max-width: 1200px) {
  .cm-nav-searchbar {
    display: none;
  }
}

.cm-nav-searchbar .field-container {
  position: relative;
  padding: 0;
  margin: 0;
  border: 0;
  width: 100%;
  height: 50px;
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.cm-nav-searchbar .icons-container {
  position: absolute;
  top: 12px;
  right: 4px;
  width: 35px;
  height: 35px;
  overflow: hidden;
}

.cm-nav-searchbar .icon-search {
  position: relative;
  top: 5px;
  left: 8px;
  width: 40%;
  height: 40%;
  opacity: 1;
  border-radius: 50%;
  border: 2px solid #bebebe;
  transition: opacity 0.25s ease, transform 0.43s cubic-bezier(0.694, 0.048, 0.335, 1);
}

.cm-nav-searchbar .icon-search:after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: -2px;
  width: 2px;
  border-radius: 3px;
  transform: rotate(-45deg);
  height: 8px;
  background-color: #bebebe;
}

.cm-nav-searchbar .search-field {
  border: 0;
  width: 100%;
  height: 100%;
  padding: 10px 20px;
  background: #f7f7f7;
  border-radius: 3px;
  transition: all 0.4s ease;
}

.cm-nav-searchbar .search-field:focus {
  outline: none;
}

.cm-nav-searchbar .search-field:focus+.icons-container .icon-close {
  opacity: 1;
  transform: translateX(0);
}

.cm-nav-searchbar .search-field:focus+.icons-container .icon-search {
  opacity: 0;
  transform: translateX(200%);
}

/* ========================
    Mobile Searchbar
   ======================== */

.cm-nav-searchbars {
  display: flex;
  flex: 1;
  align-items: center;
  height: 100%;
  margin-top: 70px;
}

@media (min-width: 1200px) {
  .cm-nav-searchbars {
    display: none;
  }
}

.cm-nav-searchbars .field-containers {
  position: relative;
  padding: 0;
  margin: 0;
  border: 0;
  width: 100%;
  height: 50px;
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.cm-nav-searchbars .icons-containers {
  position: absolute;
  top: 12px;
  right: 4px;
  width: 35px;
  height: 35px;
  overflow: hidden;
}

.cm-nav-searchbars .icon-searchs {
  position: relative;
  top: 5px;
  left: 8px;
  width: 40%;
  height: 40%;
  opacity: 1;
  border-radius: 50%;
  border: 2px solid #bebebe;
  transition: opacity 0.25s ease, transform 0.43s cubic-bezier(0.694, 0.048, 0.335, 1);
}

.cm-nav-searchbars .icon-searchs:after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: -2px;
  width: 2px;
  border-radius: 3px;
  transform: rotate(-45deg);
  height: 8px;
  background-color: #bebebe;
}

.cm-nav-searchbars .search-fields {
  border: 0;
  width: 100%;
  height: 100%;
  padding: 10px 20px;
  background: #f7f7f7;
  border-radius: 3px;
  transition: all 0.4s ease;
}

.cm-nav-searchbars .search-fields:focus {
  outline: none;
}

.cm-nav-searchbars .search-fields:focus+.icons-containers .icon-closes {
  opacity: 1;
  transform: translateX(0);
}

.cm-nav-searchbars .search-fields:focus+.icons-containers .icon-searchs {
  opacity: 0;
  transform: translateX(200%);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />

                <svg xmlns:xlink="http://www.w3.org/1999/xlink" height="32px" id="burger-nav" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="50px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2  s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2  S29.104,22,28,22z"/>
                </svg>

      <fieldset class="field-container">
        <input type="text" placeholder="Search Photos Here" class="search-field" />

      </fieldset>

              BDT

              Explore

              Collection

              Login

               Submit a photo

            Login | Signup

  <fieldset class="field-containers">
    <input type="text" placeholder="Search Photos Here" class="search-fields" />

  </fieldset>

Its look responsive but some how its not align and looks not beautiful on responsive, also I have to need a drop down like unsplash on dot hover or click event.
Thanks in advance


text:
Q: Microsoft LUIS Multi-language support Can we have multi-language support in Microsoft LUIS?
If yes, how can we implement it? If single agent works fine for it or do we need to create different data-sets for different languages?

A: You can use Multilanguage chat application with separate LUIS apps for each culture.
In order to have single LUIS application, you could use the Translator Text API to translate all incoming messages before they're sent to LUIS. In this case you'll want to use middleware to handle the translation before your LUIS Recognizer is called. You can also use middleware to translate your bot's response so you don't have to use additional localization inside of your bot
Tokenizing in LUIS is different for each language in LUIS.
Here is one more sample where you can select a language from the bot and continue the consversation as required.


text:
Q: Can any trigonometric polynomial be written in euler's form? A trigonometric polynomial can be written as:
$$\frac{a_0}{2} + \sum_{k=1}^{n}(a_k \cos(kx) + b_k \sin(kx))$$
My math books says, that ANY trigonometric polynomial can be written in euler's form:
$$\sum_{k=1}^{n}a_k e^{ikx} = \frac{a_0}{2} + \sum_{k=1}^{n}(a_k \cos(kx) + i b_k  \sin(kx))$$
Using this form, however, the coefficients must be complex.
My question is now, given the fact that $a_k $ must be complex and sin is imaginary using the euler's form, is it really possible to rewrite ANY (real-valued) trigonometric polynomial from the cos-sin form in the euler form for simplicity? If yes, how is it possible? In the second definition the coefficients are complex and sin is imaginary.


text:
Q: How to use the disabled attribute for a  tag in HTML How to use the disabled attribute for a  tag in HTML
I have tried this

    My Link

A: There is no disabled attribute like this() for "a" tag. you can try disabling using css so just add class in your "a" tag & then disable using css.

    My Link

.disable {
   pointer-events: none;
   cursor: default;
}

A: There is no disabled attribute for  tag. Look here

A:

a.disabled {
    pointer-events: none;
    color: #ccc;
}
Click me

Please check the above code. It may help you out.

A: You can try the code below:-

LINK


text:
Q: Authentication against remote active directory in java on Linux My scenario is similar to what's described in this question How to authenticate users with a customer's (remote) active directory server, except that our web application is Java based and runs under CentOS Linux.
I have been searching and reading a lot, but don't seem to be able to find useful information for my scenario because of the following:

*

*Although there are different solutions for Java based application to authenticate against AD (Kerberos, NTLM, LDAP from Authenticating against Active Directory with Java on Linux), but I don't think they are for remote AD authentication from what I read.

*Kerberos is said to be the "new" mechanism for AD authentication recommended by Microsoft. However, it seems that either conf files or system properties are required for it to work. Our web application is SaaS based so the same code base will server multiple customers, and I don't see a good way to make Kerberos work nicely (even if it support remote authentication, which I don't see).

*Product Jespa uses NTLMv2 based authentication (again, I am not seeing it supports remote authentication), which is "old" and not recommended by Microsoft anymore. Plus it requires the creation of a "computer account".

*Okta has a solution that will work for the remote scenario I am facing. However, it requires the installation of an "AD agent" on customers AD server to handle all SAML communications between the "AD agent" and a Java library sitting with our web application. It's definitely a concern for our customers to install a software in their infrastructure that they are not a customer of.

Now based on my recent reading, best security practices are for organizations to hide Active Directory server behind firewall and do not expose it to the Internet. I wonder whether that means there will not be "direct" path of remote Active Directory authentication integration regardless of tools and libraries, and some kind of trusted agent or proxy residing within the customer infrastructure will be required to facilitate the remote authentication.
Any comments and suggestions are welcome!

A: We can access remote AD via LDAP protocol. In my scenario, I have LDAP configured on remote server. I have installed Apache Active DS to create an instance of remote directory at my end. So I can have a configuration details at my end. To do this we require domain name & bind credentials. You can download Apache Directory for Linux from this link & create new connection. See LDAP Connections to Active Directory Using Apache Directory Studio
LDAP Configuration for Tomcat :
Sample JNDIRealm configuration for Tomcat 7 - Apache.org
Add your desired Realm configuration between Host opening and Host closing tag in server.xml file located at conf directory of Tomcat. e.g.,
<Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">
    <Realm   className="org.apache.catalina.realm.JNDIRealm"
        connectionName="cn=Manager,dc=mycompany,dc=com"
        connectionPassword="secret"
        connectionURL="ldap://localhost:389"
        userPassword="userPassword"
        userPattern="uid={0},ou=people,dc=mycompany,dc=com"
        roleBase="ou=groups,dc=mycompany,dc=com"
        roleName="cn"
        roleSearch="(uniqueMember={0})"
    />
    <!-- other stuffs -->
</Host>

Don't forget to comment out the below entry in server.xml file.
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>

Once you are done with this then it's time to configure your web application which will give a call to LDAP server via Tomcat server.
Web Application Configuration :
Add below entries in your web.xml file placed inside WebContent -> WEB-INF directory.
<security-constraint>
    <web-resource-collection>
          <web-resource-name>Logging Area</web-resource-name>
          <description>
              Authentication Required.
          </description>
          <url-pattern>/*</url-pattern>
          <http-method>GET</http-method>
          <http-method>POST</http-method>
    </web-resource-collection>
        <auth-constraint>
            <role-name>*</role-name>
        </auth-constraint>
    </security-constraint>
   <security-role>
      <role-name>*</role-name>
   </security-role>
    <login-config>
          <auth-method>BASIC</auth-method>
        <realm-name>Authentication Required.</realm-name>
</login-config>

This is the basic configuration. But, you can map specific user or group with LDAP. Have a look at Mapping Roles to Users and Groups - J2EE Tutorial. You can also add security to specific folder only, by adding url pattern for it under web-resource-collection tags.
<url-pattern>/Admin/*</url-pattern> // Restrict access to Admin folder
<url-pattern>/Employee/*</url-pattern>  // Restrict access to Employee folder

All configuration are done. Now, when your run you application it will ask for Login Credentials. Once you enter & hit submit it will search for that user in LDAP server.

At server, to get access to user name use below code snippet :-
Principal principal = request.getUserPrincipal();
String userName = principal.getName();

Example LDAP User Manager (JBOSS):
public LdapContext getLdapContext() {
    // Set up environment for creating initial context
    Hashtable<String, Object> env = new Hashtable<String, Object>(11);

    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    // e.g., ldap://IP address of remote m/c:10389/dc=sevenseas,dc=com
    env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL + Constant.FORWARD_SLASH + LDAP_DOMAIN);

    // Authenticate as User and password
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    // e.g., "uid=admin,ou=system"
    env.put(Context.SECURITY_PRINCIPAL, LDAP_ADMIN);
    env.put(Context.SECURITY_CREDENTIALS, LDAP_DEFAULT_PASSWORD);

    try {
        // Create initial context
        ldapContext = new InitialLdapContext(env, null);
        if (ldapContext == null) {
            LogManager.fatal("Invalid LDAP system properties. Please contact your administrator.",
                    LDAPUserManager.class.getName());
        }
        System.out.println("Organization : " + ldapContext.getNameInNamespace());
    } catch (Exception e) {
        StringWriter stack = new StringWriter();
        e.printStackTrace(new PrintWriter(stack));
        LogManager.fatal(stack.toString(), LDAPUserManager.class.getName());
    }
    return ldapContext;
}

This will Construct initial context with environment parameters to connect with LDAP server.
Now, to fetch user data from AD use the below code :
try {
        SearchControls constraints = new SearchControls();
        constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
        String[] attrIDs = { "cn", "sn", "givenName", "uid", "mail", "userPassword" };

        constraints.setReturningAttributes(attrIDs);

        // Search for user in LDAP server by emailId
        NamingEnumeration<SearchResult> answer = ldapContext.search(LDAP_GROUP, "mail=" + emailId, constraints);
        if (answer.hasMore()) {
            LogManager.info("User with email id '" + emailId + "' found.", LDAPUserManager.class.getName());

            Attributes attrs = answer.next().getAttributes();

            userDTO = new UserDTO();

            // Store user details temporarily
            Attribute firstNameAttr = attrs.get("givenName");
            String firstName = "";
            if (firstNameAttr == null) {
                userDTO.setFirstName(firstName);
            } else {
                firstName = firstNameAttr.get().toString();
                if (firstName == null) {
                    userDTO.setFirstName("");
                }
                userDTO.setFirstName(firstName);
            }

            Attribute lastNameAttr = attrs.get("sn");
            String lastName = "";
            if (lastNameAttr == null) {
                userDTO.setLastName(lastName);
            } else {
                lastName = lastNameAttr.get().toString();
                if (lastName == null) {
                    userDTO.setLastName("");
                }
                userDTO.setLastName(lastName);
            }

            return userDTO;
        } else {
            LogManager.fatal("Invalid User.", LDAPUserManager.class.getName());
            return userDTO;
        }
    } catch (Exception e) {
        StringWriter stack = new StringWriter();
        e.printStackTrace(new PrintWriter(stack));
        LogManager.fatal(stack.toString(), LDAPUserManager.class.getName());
    }

I hope this helps you.


text:
Q: geom_jitter and stat_compare_means not working - is there a connection? I am trying to make a simple boxplot + jitter with different groups that are facet wrapped. This worked perfectly fine yesterday and now it doesn't anymore. I have been digging through the forums but nothing seemed similar to my problem. I am at a complete loss what has changed for this to not work anymore.
This is the plot I am currently getting:

*

*the warning message:
1: Computation failed in stat_signif():
missing value where TRUE/FALSE needed

What I want is p values for each comparison and obviously the jitter points not clustered but for each bar. I assume there is a connection between the failure of stat_signif() and the jitter issue.
My data is as follows:
> dput(test[sample(1:nrow(test), 30, replace=FALSE), ])
structure(list(Station_neat = c("003_DCM", "009_SA", "009_SA",
"035_SA", "013_SA", "015_SA", "098_DCM", "027_DCM", "035_SA",
"069_DCM", "073_SA", "045_DCM", "007_DCM", "009_DCM", "019_DCM",
"049_DCM", "103_DCM", "009_SA", "065_SA", "047_DCM", "021_SA",
"063_DCM", "049_SA", "051_DCM", "027_DCM", "007_DCM", "001_SA",
"071_SA", "067_SA", "067_SA"), Trophy = c("Phototrophic", "Photo_Heterotrophic",
"Unknown", "Phototrophic", "Heterotrophic", "Unknown", "Unknown",
"Unknown", "Unknown", "Photo_Heterotrophic", "Phototrophic",
"Heterotrophic", "Phototrophic", "Phototrophic", "Phototrophic",
"Photo_Heterotrophic", "Unknown", "Heterotrophic", "Photo_Heterotrophic",
"Unknown", "Phototrophic", "Heterotrophic", "Photo_Heterotrophic",
"Unknown", "Phototrophic", "Unknown", "Heterotrophic", "Heterotrophic",
"Photo_Heterotrophic", "Heterotrophic"), Zone = c("Oligotrophic",
"Oligotrophic", "Oligotrophic", "Temperate", "Oligotrophic",
"Oligotrophic", "Temperate", "Temperate", "Temperate", "Polar",
"Polar", "Temperate", "Oligotrophic", "Oligotrophic", "Oligotrophic",
"Temperate", "Temperate", "Oligotrophic", "Polar", "Temperate",
"Oligotrophic", "Polar", "Temperate", "Temperate", "Temperate",
"Oligotrophic", "Oligotrophic", "Polar", "Polar", "Polar"), Lat = c(-30.9975,
-34.00016667, -34.00016667, -46.998, -36.00083333, -36.9985,
-44.865, -42.99633333, -46.998, -58.00066667, -56.67116667, -53.00033333,
-32.99816667, -34.00016667, -38.99833333, -51.67116667, -43.18316667,
-34.00016667, -59.33383333, -52.335, -39.999, -59.99833333, -51.67116667,
-51.00016667, -42.99633333, -32.99816667, -29.997, -57.33483333,
-58.66866667, -58.66866667), x = c(0.203081382864505, 0.565058479532164,
0.151969836872884, 0.403331082601846, 0.256978619577354, 0.384393951024795,
0.0752896823196762, 0.0462908011869436, 0.0582039162727887, 0.237218270061831,
0.424948270765593, 0.282785885109083, 0.238459319099827, 0.193018092493741,
0.114429357167411, 0.281383721453989, 0.202223251505327, 0.217643890427824,
0.412883700821444, 0.0529888650126978, 0.0987085906793936, 0.159411260805233,
0.30349843140983, 0.0514790242929117, 0.0766002543450615, 0.128534333525678,
0.231287858835923, 0.125564198597906, 0.408113870800438, 0.0713421310436236
)), row.names = c(261L, 236L, 240L, 102L, 218L, 216L, 127L, 167L,
104L, 27L, 46L, 49L, 245L, 237L, 197L, 67L, 159L, 234L, 12L,
63L, 190L, 1L, 68L, 79L, 165L, 247L, 266L, 34L, 20L, 18L), class = "data.frame")

My code to produce the figure (simplified) is:
library(ggplot2)
library(ggpubr)

my_comparisons_Zone <- list( c("Oligotrophic", "Temperate"), c("Oligotrophic", "Polar"),c("Polar", "Temperate") )

ggplot(test, aes(x = Trophy, y = x, fill=Zone)) +
  geom_boxplot(outlier.shape  = NA, alpha=0.95) +
  geom_jitter(colour = "grey40", alpha=0.4, height = 0, width = .1) +
  facet_wrap(~ Trophy, scales = "free", nrow =2)+
  stat_compare_means(comparisons = my_comparisons_Zone, label="p.signif", hide.ns=FALSE, col="blue", size=3, angle=90, method="wilcox.test")

A: The comparisons in stat_compare_means should be across x axis categories, not the groupings within each x value. Since you are already faceting according to Trophy, all you need to do is switch your x aesthetic to Zone:
ggplot(test, aes(x = Zone, y = x, fill = Zone)) +
  geom_boxplot(outlier.shape  = NA, alpha = 0.95) +
  geom_jitter(colour = "grey40", alpha = 0.4, height = 0, width = .1) +
  facet_wrap(~ Trophy, scales = "free", nrow = 2)+
  stat_compare_means(comparisons = my_comparisons_Zone,
                     label = "p.signif", hide.ns = FALSE, col = "blue",
                     size = 3, angle = 90, method = "wilcox.test") +
  scale_fill_manual(values = c('#efb82d', '#31406e', '#8f70d0')) +
  theme_bw() +
  theme(axis.text.x  = element_blank(),
        axis.ticks.x = element_blank(),
        axis.title.x = element_blank(),
        panel.grid = element_blank())


text:
Q: Two identical cubes are stacked inside a cone of height $34$ and radius $3$. What is the volume not taken up by the cubes?
Two identical cubes are stacked and they are placed inside a cone. The height of the cone is $34$ and the radius is $3$. The cubes have the same height. What is the volume of the space not taken up by the cubes?

I have made a bit of progress at this problem by trying to take cross section, but I haven't been able to reach a solution.

A: Start by drawing the cross section, an isosceles triangle of height $34$ and base $6$ (twice the radius). Now let's say the base is $AB$ and the vertex (tip of the cone) is $C$. The middle of the base is $O$. So we have $OA=OB=3$ and $OC=34$.
Now say that the side of a cube is $x$, so the height of two cubes is going to be $2x$. Let's draw the line parallel to $AB$ at height $2x$. It will intersect the sides at $A'$ and $B'$ and the $OC$ line at $O'$. Now here is the subtle thing: the length of $A'B'$ is not $x$ but $x\sqrt2$. Why is that? Because if the $A'$ and $B'$ are corners of a cube, and $O'$ is on the center of the face, then $A'B'$ is a diagonal of the face of the cube. Then $O'A'=x\frac{\sqrt 2}2$. Then noticing that $\triangle OCA$ is similar to $\triangle O'CA'$ we can write:
$$\frac{O'A'}{OA}=\frac{O'C}{OC}$$
or:$$\frac{x\frac{\sqrt 2}2}{3}=\frac{34-2x}{34}$$
You can now calculate $x$. The volume of the two cubes is $2x^3$, which you need to subtract from the volume of the cone.


text:
Q: !== Comparison Operator Should Be True but Isn't

function nonUniqueElements(data) {
  var duplicates = [];
  var compArr = data;

  for (var i = 0; i < data.length; i++) {
    for (var j = 0; j < compArr.length; j++) {
      console.log('Comparing ' + data[i] + ' to ' + compArr[j]);
      if (data[i] === compArr[j]) {
        console.log('Found match first pass');
        console.log(data.indexOf(i), compArr.indexOf(j));
        if (data.indexOf(i) !== compArr.indexOf(j)) {
          console.log('Also passes second pass')
          console.log('Pushing ' + data[i] + ' to new array')
          duplicates.push(data[i]);
          console.log(duplicates);
        }
      }
    }
    console.log('End of run through');
  }

  return (duplicates);
}

console.log(nonUniqueElements([5, 5, 5, 5]));

I'm trying to return all non-unique values in an array. I've duplicated the array and am running a nested loop to compare the copy against the original.
When it finds a match (in this case every time), there's a second check to ensure that only values at a different index are pushed to a new array.
I've put some console.log()s to help me step through the program. Even when console.log(data.indexOf(i), compArr.indexOf(j)) is printing different values, the block of code in the if (data.indexOf(i) !== compArr.indexOf(j)) statement isn't running.
Any ideas?

A: In JS, the indexOf() method returns the position of the first occurrence of a specified value in a string/array. You can tell it's wrong since in the console.log you always get the value -1.
What you need to compare is data[i] and compArr[j].

A: It might be simpler to use Array.reduce...

var array = [1,2,3,4,5,6,4,5,66,44,66]

var result = array.reduce((prev,value) => {
                if ( prev.exists[value] ) { prev.dupes[value] = true; }
                prev.exists[value] = true;
                return prev;
              },{ exists: {}, dupes: {} })

var duplicates = Object.keys(result.dupes);

console.log('duplicates',duplicates);

var filterDupes = array.filter(value => result.dupes[value])

console.log('fitlerDupes',filterDupes);

var mapDupes = array.map(value => result.dupes[value] ? value : null)

console.log('mapDupes',mapDupes);

for ( var i = 0; i < array.length; i ++ ) {
  if ( !result.dupes[array[i]] ) { array.splice(i,1); i--; }
}

console.log('Original Array',array);

A: if (data.indexOf(i) !== compArr.indexOf(j)) {

Why are you comparing indexes of i and j ?
i and j are indexes themselves, not elements.
Don't you mean
if (data[i] !== compArr[j]) {

A: You are trying to compare two true values.
Take a look at the definition of indexOf is:

*

*Array.indexOf: method returns the first index at which a given element can be found in the array, or -1 if it is not present.

*String.indexOf: method returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex. Returns -1 if the value is not found.
So, in your condition if (data.indexOf(i) !== compArr.indexOf(j)) you're comparing the index of i and j that holds the numbers of 0 to 3 (data.length). In your Array, all the values have been set to 5 witch is the reason that you get -1 in return of indexOf, [5,5,5,5].indexOf(0) === -1.
If you're trying to compare the values in data Array you have to compare the values not index of values. Like this: if (data[i] !== compArr[j]).
At the end I recommend you to read this document Truthy and Falsy: When All is Not Equal in JavaScript


text:
Q: Remove duplicates from NSMutableArray based on an object's property I have this NSMutableArray, containing a Message object. Message has several properties, one of them is TheID.
So, consider the following objects in my array:
Message1.TheID = 1
Message1.title = @"whatever"

Message2.TheID = 2
Message2.title = @"doesn't matter"

Message3.TheID = 1
Message3.title = @"I don't care"

I want to get rid of duplicate TheIDs.
What would be the best way to filter my array in such a way, that I end up with an array containing Message1 and Message2 (or Message2 and Message3)
I've seen many similar questions, but none of the solutions seem to be applicable to my situation.
thanks

A: You could use an NSSet to keep track of the used ids as you iterate through your message array. Only add a message to the new array of its id isn't in the set.
NSMutableSet *ids = [NSMutableSet set];
NSMutableArray *newMessages = [NSMutableArray array];
for (Message *message in messagesArray) {
    if (![ids containsObject:message.theID]) {
        [ids addObject:message.TheID];
        [newMessages addObject:message];
    }
}


text:
Q: setinitial text showing null for twitter I am implementing Twitter integration in my app. But setintialtext showing empty dialog box.
My code is:
TWTweetComposeViewController *tweetSheet =
        [[TWTweetComposeViewController alloc] init];
        if ([TWTweetComposeViewController canSendTweet])
        {

NSString *tw=[[NSString stringWithFormat:@"AT %@ %@ \n on %@\n %@ %@ %@ vs %@",lbl_vanueName.text,lbl_address.text,[arr_eventDate objectAtIndex:0],[arr_eventName objectAtIndex:0],[arr_EventType objectAtIndex:0],[arr_Contestant1 objectAtIndex:0],[arr_Contestant2 objectAtIndex:0]] retain];
            NSLog(@" tw is:%@",tw); // work fine & got all values

           [tweetSheet setInitialText:tw];
             }

A: What is the return value of the setInitialText method. If you check the docs for TWTweetComposeViewController, there is a comment:
Return Value
YES if successful. NO if text does not fit in the currently available character space or the view was presented to the user.
Maybe the text doesn't fit?


text:
Q: How to make an Ecommerce app in flutter with Backend? I'm trying to make an E-commerce app in flutter but I'm facing some difficulty in that app. I want to make two different apps example Admin & User. Admin Will Update Product Information like img, name, price etc & user will just Buy the product or Give Feedback for the Product. Anybody Know Any Resource Or tutorial, THanks in advance

A: just read the dart lang and GitHub has many projects which you can show and follow
 here
for the model, you have to use build_value here
fetching data, you can use Dio library here
Good Luck!!


text:
Q: how can i create a traffic app using html5 for android platform I am creating a mobile app using Phonegap, HTML5. This will target the Android devices.
this app should be able to feed traffic updates to users with the aide of notifications too
is there anyone who has done such project and can guide me in doin such an app, ny recommendations would be highly appreciated.

A: There is a push notification plugin
https://github.com/phonegap-build/PushPlugin
here is an article on doing that
http://www.adobe.com/devnet/phonegap/articles/android-push-notifications-with-phonegap.html
You could also do the opposite pull using ajax from where ever. Here is an example using jquery ajax call.
function sendToServer(request, onSuccess) {
    LOG("sendToServer - " + request);

    $.ajax({
        type: "GET",
        url:  ServiceHandlerURL + request,
        dataType: "xml",
        success: onSuccess,
        error: function (xhr, status, error) {
                LOG("Request URL Error: " + xhr.responseText + " | " + status + " | " + error);
           if (error != ""){
               navigator.notification.alert("An Error occurred. May be due to loss of internet connection. Error: " + xhr.responseText + " | " + error);}
                // navigator.app.exitApp(); // ?? what to do ??
           }
    });
}


text:
Q: Partial Background images repeat in IE? In my site, there are divs with repeated bg images. It renders smoothly in FF. But gets jagged in IE while scrolling the page.
This is the image shot of the site:
alt text http://img44.imageshack.us/img44/2851/beforescroll.png
As you can see the image is self descriptive, the bg is not repeated smoothly.
Now, when I scroll the page, the bg image is not shown at all. This is the shot of the site after scrolling.
alt text http://img196.imageshack.us/img196/7184/afterscroll.png
What might be the problem with this ie thing?

A: If you have floating content inside the divs the parent div is not properly cleared. Add overflow:hidden; clear:both; to the div with the bg


text:
Q: how to scale the video to be played on screen to mobile device my problem is my desktop website is working fine. but I have made a video which is not able to view properly on the mobile device. I want it to view to full screen while it comes to mobile device

A: Do something like this.
CSS:
.video-size video
{
  width: 100%;
  height: 500px;
}

and in HTML:
<div class="video-size">
<video  autoplay loop controls muted>
  <source src="video.mp4" type="video/mp4">
</video>
</div>


text:
Q: Bash script works when called by run-parts, fails as cron job with exit code 1 The following script sits in cron.daily and succeeds when called with run-parts but exits with code 1 when called with anacron -f on Ubuntu 20.04 LTS. I have had many problems with various versions of this script over the years, it seems to stop working every few months. The script is
#!/bin/sh
#
# MAKE SURE HAVE CORRECT REMOTE/AT-HOME LOGIN SETUP AND THAT TARGET IS TOTEMDOC and source is Documents
#
rsync -azvv -e "ssh -o CheckHostIP=no  -i /home/stefan/.ssh/id_rsa" /home/stefan/Documents/ totem@MouseHouse:/totembackup/totemdoc

I used to have problems with path, but I thought the quote marks fixed that. I am at a loss for why it doesn't work anymore.

A: I managed to work out what was wrong. Upon running run-parts cron.daily as root, I got one of those "The authenticity of host ***** can't be established" messages from ssh. What must have been happening is that this prompt was coming up, timing out, and then the whole script was failing. After saying "yes" manually to the prompt, the script now runs automatically correctly.


text:
Q: How to have a different hostname to the fqdn? I have a server with fqdn git.mydomain.com (this is in DNS) but I don't really want the machine to have git as its hostname.
It might not be clear exactly what I want. Or maybe I don't really understand how all this is supposed to work, but my understanding is that
hostname -f

Should return the fqdn of the server, which in this case is git.mydomain.com
And plain old hostname should return the UNqualified hostname of the server. Every resource I can find says the the unqualified name should be the start of the fqdn but this seems annoying and inconvenient.
I would like
hostname -f

To return git.mydomain.com since that really is the fqdn of the server
But I would like hostname to just return mycustomhostname.
At the moment I have /etc/hostname set as 'mycustomhostname', and in /etc/hosts I have
127.0.0.1 mycustomhostname
1.2.3.4 git.mydomain.com

Where 1.2.3.4 is my public IP. However, this results in the hostname command returning mycustomhostname (which is fine), but hostname -f returns mycustomhostname as well, which is not correct, since the fqdn is git.mydomain.com.
The main reason for this is that when I am ssh'ing in to the server I would like the bash shell to say
myusername@mycustomhostname

Instead of
myusername@git (Which is what ever guide everywhere seems to indicate it should be).

Simply because it will make it easier for me to know what server I am working with. If I have another server for git repositories (say, git.mydomain2.com) and follow the conventions I see everywhere, then if I ssh'd in to that server bash would also say
myusername@git

Which is confusing for me.
How do I properly have a different hostname to the server's fqdn?
This is on Debian Linux btw.

A: You can give your server the host name mycustomhostname.example.org, and add an alias (CNAME) in DNS for git.example.org to that host.
This way, it can be reached using git.example.org, but it'll identify using its actual host name.

A: You can use as simple command:
# hostname -s

And see the result.


text:
Q: Big IP orphaned connections Let me state up-front that I know just enough about networking at this level to be dangerous, so if I say something stupid, please be kind.
I am using a Big IP load balancer in front of 3 Apache servers.  The 3 Apache servers are all on the same physical machine (running Linux), bound to port 80 on 3 different virtual IP addresses, but I don't think that's playing a part in this problem.  We have the LB configured so that the same client gets the same WEB server each time, controlled via a cookie provided by the LB.
If I go through the LB to access our application, I will occasionally (5-15% of the time) get a page where the browser just spins, never returning.  If I hit each of the WEB servers directly, I never get that.  Using WireShark I looked at what was happening on my PC, the LB and the WEB server I was hitting through the LB, and I saw the following:
1) Most times, the port that the PC used to hit the LB was the port the LB used to hit the WEB server, which I thought was "normal"; all 3 times I've replicate my issue, the ports were different (e.g. 1234 between PC/LB and 2345 between LB/WEB).  But not all of the times that they were different did I see an issue.  This may be a red herring....
2) The PC <-> LB communications are with packets that are 1260 bytes long; the LB -> WEB packets are 1260 bytes, but the LB <- WEB packets are some multiple of 1260.  When the WEB sends 2520 bytes to the LB, the LB receives it in 2x1260 byte packets, and only sends one ACK.  It then sends back to the PC 2x1260 byte packets, and receives one ACK from the PC.  I don't understand why the 2520 is broken into 2x1260, nor do I understand why the PC knows to only send one ACK.  This may also be a red herring....
3) At some point the WEB server sends data to the LB for which it receives no ACK, then resends the packet that started this data sequence.  I don't know why the re-transmission happens, though, as only 0.6 seconds have passed, so it can't be that it's timed out (well, I suppose it can be, but it does seem unlikely). Further, the original WEB -> LB packet was 5040 bytes (4x1260), but the re-transmission is only 1260. The LB received all 4 packets from the original 5040 sending, but never sent an ACK for whatever reason. I see other times when the LB has been able to handle the 5040 bytes being sent to it, that it acknowledged just fine, so it doesn't seem as if the length of the sent packet is an issue.  None of these packets were sent from the LB back to the PC, though.
4) Only the first 1260 chunk of data is resent from the WEB to the LB, though.  There is a small delay (0.4 seconds) and then there is a second re-transmission of data, starting with the first 1260 chunk, bu this time all 4x1260 packets are resent.  The ACK sent back by the LB, however, is for all 5 of the resent packets, even though one of them was clearly resent twice (I base this on the relative seq number shown by WireShark; the ACK sent back is equal to the seq number of the first resent packet + 5x1260, even though the seq number of the second resent packet is the same as the first resent packet). This seems really bad.
5) Worst of all, I think, is that the ports get all messed up.  The original conversation ports are as follows:
PC <-> LB == 2723
LB <-> WEB == 2722

Co-mingled among that conversation is one looking like this:
PC <-> LB == 2722
LB <-> WEB == 2723

It was enough to make me cross-eyed, but I did verify that the conversations were happening on the ports I thought they were, based on content of the packets (ugh).  The second conversation completes successfully (in fact, there are two conversation on this set of ports, both of which complete successfully).  After the first (aborted?) re-transmission packet is sent, but before the second set of 4x1260 re-transmissions are sent, there is a conversation:
PC <-> LB == 2722
LB <-> WEB == 2722

So, the original LB <-> WEB conversation on port 2722 is interrupted. I didn't think this was allowed under the protocol.  There is no FIN or SYN sent in either direction on this port.  The sequence number sent from LB -> WEB for this newly initiated conversation is what I expect it to be.  The ACK from the WEB to the LB has the right sequence number, but the ACK is off (by exactly 1260).
This second conversation never seems to take place, as after the 4x1260 are re-transmitted, the WEB sends another, new, 1260 chunk of data, and all of it is the response from the original request (determined by examining the data in the packets).  The LB then sends an ACK back, and it is what I would expect from the original conversation (last ACK + 4x1260 + 1260).
So, I have clues as to what's happening, but no idea why it would happen, and certainly no clues as to how to fix it.  Where do I go from here?
EDIT: I just remembered something; during the middle of the 4x1260 resend from the WEB to the LB, the LB sends back an ACK that is exactly 100 bytes more than I would expect.  After the first 1260 packet of new data is sent, though, the LB sends back an ACK that is exactly what it should be (i.e. it corrected itself).  I have no clue how that could happen or what that means, or even if it's meaningful.

A: One thing that sticks out at me is that your web servers are on the same machine using different IP addresses. You're not really gaining anything with load balancing if you go and put all the servers on one box.
Some of what you describe with the packets seems normal; have you used the 'Expert Info' and 'Follow TCP Stream' features of Wireshark? Those will show higher-level views of the TCP connections. Also keep in mind that Wireshark might not be capturing all packets (especially if you're on gigabit ethernet).
As for the problem, it's possible you're seeing a bug in the LB, exposed by the fact that all your web services are on the same box, which means that your three IP addresses all have the same MAC address. If the LB tracks connections using the MAC address, it could be confusing your three server IP addresses and directing packets to the wrong place.

A: *

*The tcp port will change as necessary on the client, and on the server side of the BIG-IP, which is now the client to the web server. This is expected behavior as the BIG-IP handles a completely separate TCP connection to the client and to the server.

*Because the proxy handles separate connections between the client and the server, the normal TCP behaviors will act differently on the clientside and serverside of the connection. What TCP profile you apply and to which side of the proxy (you can apply different profiles to client and server side of the connection or the same to both, up to you depending on your use cases and network environments) will alter what data is actually on the wire at what time and how many and how frequently acknowledgements are sent.

*retransmits are common, and how the tcp stack handles network congestion depends on the stack in place, both on client and server side of the connection. Again, you have two clients and two servers for any client->BIG-IP->server scenario.

*would need to see the entire capture to diagnose the behavior you saw.

*don't think the tcp port is a concern here.
Without details, my guess is that you had stock tcp profile enabled instead of a custom profile and it behaved badly with your application. I highly recommend utilizing custom profiles and engaging someone with knowledge of how TCP flow and congestion control algorithms work, and what settings in the TCP profile act poorly with certain applications. We wrote a 10-part series on the BIG-IP TCP profile several years ago (could use a refresh with all the changes since but it's still a good source of information) that I think will help: https://devcentral.f5.com/articles/investigating-the-ltm-tcp-profile-nagles-algorithm


text:
Q: Alamofire Use of undeclared type 'Serializer' I have updated to XCode 7 beta 6 and Alamofire needed to be updated to beta 3. In doing so, I'm having to update areas of the code that use Alamofire. One area in particular that I'm having difficulty updating is the code which is used to retrieve an image from a specified URL and load it into a UIImageView.
Previously, the extension for Alamofire that handled that was:
extension Alamofire.Request {
    class func imageResponseSerializer() -> Serializer {
        return { request, response, data in
            if data == nil {
                return (nil, nil)
            }

            let image = UIImage(data: data!, scale: UIScreen.mainScreen().scale)

            return (image, nil)
        }
    }

    func responseImage(completionHandler: (NSURLRequest, NSHTTPURLResponse?, UIImage?, NSError?) -> Void) -> Self {
        return response(serializer: Request.imageResponseSerializer(), completionHandler: { (request, response, image, error) in
            completionHandler(request!, response, image as? UIImage, error)
        })
    }
}

But not that is throwing the error
Use of undeclared type 'Serializer'

I do realize that Alamofire doesn't use Serializer anymore, but does anyone know where I can find some documentation or examples what to do now when retrieving images?

A: As you can find in the readme the serialization was rewritten.
You shoudl be able to use the method below:
public protocol ResponseObjectSerializable {
    init?(response: NSHTTPURLResponse, representation: AnyObject)
}

extension Request {
    public func responseObject<T: ResponseObjectSerializable>(completionHandler: Response<T, NSError> -> Void) -> Self {
        let responseSerializer = ResponseSerializer<T, NSError> { request, response, data, error in
            guard error == nil else { return .Failure(error!) }

            let JSONResponseSerializer = Request.JSONResponseSerializer(options: .AllowFragments)
            let result = JSONResponseSerializer.serializeResponse(request, response, data, error)

            switch result {
            case .Success(let value):
                if let
                    response = response,
                    responseObject = T(response: response, representation: value)
                {
                    return .Success(responseObject)
                } else {
                    let failureReason = "JSON could not be serialized into response object: \(value)"
                    let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason)
                    return .Failure(error)
                }
            case .Failure(let error):
                return .Failure(error)
            }
        }

        return response(responseSerializer: responseSerializer, completionHandler: completionHandler)
    }
}

A: UIImage serializer for Alamofire, updated for Alamofire 2.0 and Swift 2
Alamofire 2.0 and Swift 2.0


text:
Q: Headset mic too low only on Macbook I have a Macbook Pro (2017, 15-inch) running macOS 10.13.6. I am trying to use a new headset in it but the mic's volume is too low.  This problem does not appear when using the headset with my phone (an Android) not does it appear with other microphones (I have tried both cheap and expensive headsets and not had this issue).
I can confirm that the mic is being picked up by the machine and that the system settings has the external input set to the highest volume.
Is there a way to increase the input volume for the microphone beyond just the system settings?

A: Connect and disconnect the headset, until the microphone volume is fine. My best guess is that the Macbook "decides" what's the microphone's sensitivity when you connect it, and then it stays constant at the hardware level.


text:
Q: Finding valid capture size for Android adb screenrecord I am using the Android 4.4 screenrecord command to record the screen of some different devices, but if I use the --size parameter then the capture video is corrupted.
How can I get the list of valid screenrecord sizes for a given device's encoder?

A: There is no such list.  At least, not one that includes all valid resolutions.
Any size that is listed in the AVC profile list will work if the encoder supports that profile level, and you can get that by querying MediaCodec.  From code written in the Java programming language, you just need to get a MediaCodecInfo for AVC, then use getCapabilitiesForType() to get a CodecCapabilities object, from which you can get an array of CodecProfileLevel.  The CodecProfileLevel class includes the AVC profile level constants.  (I'm not sure offhand what the private native equivalents of this is.)
Many resolutions that are not explicitly supported will happen to work.  The probability of an arbitrary MxN resolution working is much higher if both M and N are multiples of 16 (with an additional allowance for 1080).  However, some devices are more limited (see e.g. this post).


text:
Q: Компиляция Kivy под Винду (проблема с *.spec Написал сдельную программку на kivy.
И хотел её перевести в виндовый формат *.exe.
Но, как не искал, сдельного *.spec не нашёл под python 3.7.6, было только под 2.7.
Кучу времени уже калебаюсь с PyInstaller, может, кто-то опытный и знакомый с kivy, подсказать дельный  *.spec .
Помогите мне научится грамотно компелировать хотяб 1 файл.


text:
Q: What makes lengthOf inefficient in lens? I noticed this remark in lens claiming that lengthOf can be "rather inefficient":
-- /Note:/ This can be rather inefficient for large containers [...]
lengthOf :: Getting (Endo (Endo Int)) s a -> s -> Int
lengthOf l = foldlOf' l (\a _ -> a + 1) 0

Can it be asymptocically inefficient? Can it leak space despite being strict left fold or does GHC generate too much "busywork" code?

A: Update:  See below -- the poor performance of lengthOf seems to be just lack of specialization to the list case when benchmarking.
As @WillemVanOnsem indicates, I think the comment is mostly referring to the fact that this particular approach -- of running through the elements of the container with a counter -- will be inefficient for containers that have some other method of returning a length.  For example, for a very large vector v, you could technically use lengthOf traverse v, but Data.Vector.length v will be much faster.
On the other hand, lengthOf can be quite inefficient for, say, counting the elements in a list.  The following benchmark:
import Criterion.Main
import Control.Lens

l :: [Int]
l = replicate 1000000 123

main = defaultMain
  [ bench "Prelude.length"        $ whnf length l
  , bench "Control.Lens.lengthOf" $ whnf (lengthOf traverse) l
  ]

shows that length is about 15 times faster than lengthOf.  (I used GHC 8.4.3 with -O2 for all my tests.)
Note that this difference isn't a result of list fusion (since there's no fusion in the Prelude.length case when the whnf call is used).
It's actually a result of specialization of the code to lists.  Even though Prelude.length is applicable to any Foldable, the instance for lists uses a list-specific implementation that's essentially equivalent to:
myLength :: [a] -> Int
myLength xs = lenAcc xs 0
  where lenAcc [] n = n
        lenAcc (_:ys) n = lenAcc ys (n+1)

(I didn't check for sure that this was the implementation being used, but myLength had nearly equivalent performance to Data.List.)
The Core for myLength uses unboxed integers in a loop that directly pattern matches the list constructors, more or less like:
lenAcc
  = \xs n ->
      case xs of
        [] -> n
        (:) _ xs' -> lenAcc xs' (+# n 1#)

It turned out that if I used lengthOf in a more realistic program with ample room to specialize to a list in the same way:
import Control.Lens

l :: [Int]
{-# NOINLINE l #-}
l = replicate 1000000 123

myLength :: [a] -> Int
myLength = lengthOf traverse

main = print (myLength l)

it generated Core like the following.  The same as above with an extra parameter which was essentially a casting identity function:
lenAcc'
lenAcc'
  = \n id' xs ->
      case xs of {
        [] -> id' (I# n);
        (:) _ xs' -> lenAcc' (+# n 1#) id' xs'
      }

I wasn't able to benchmark it, but it would probably be plenty fast.
So, lengthOf traverse is capable of being optimized to be almost as fast as Prelude.length, but depending on how it's used, it might end up using a really inefficient implementation.


text:
Q: Python - from . import I'm taking my first stab at a library, and I've noticed the easiest way to solve the issue of intra-library imports is by using constructions like the following:
from . import x
from ..some_module import y

Something about this strikes me as 'bad.'  Maybe it's just the fact that I can't remember seeing it very often, although in fairness I haven't poked around the guts of a ton of libraries.
Just wanted to see if this is considered good practice and, if not, what's the better way to do this?

A: There is a PEP for everything.
Quote from PEP8: Imports

Explicit relative imports are an acceptable alternative to absolute imports, especially when dealing with complex package layouts where using absolute imports would be unnecessarily verbose:

Guido's decision in PEP328 Imports: Multi-Line and Absolute/Relative
Copy Pasta from PEP328
Here's a sample package layout:
package/
    __init__.py
    subpackage1/
        __init__.py
        moduleX.py
        moduleY.py
    subpackage2/
        __init__.py
        moduleZ.py
    moduleA.py

Assuming that the current file is either moduleX.py or subpackage1/__init__.py , the following are all correct usages of the new syntax:
from .moduleY import spam
from .moduleY import spam as ham
from . import moduleY
from ..subpackage1 import moduleY
from ..subpackage2.moduleZ import eggs
from ..moduleA import foo
from ...package import bar
from ...sys import path

A: Explicit is better than implicit. At least according to the zen of python.
I find using . based imports to be confusing especially if you build or work in lots of libraries. If I don't know the package structure by heart its going to be less obvious where something comes from this way.
If someone wants to do something similar to (but not the same as) what I'm doing inside one of my library's modules, if the full package structure is specified in the import, people can copy and paste the import line.
Refactoring and restructuring are more difficult with dots because they will mean something different if you move a module around in a package structure or if you move a module to a different package.
If you want convenient access to something in your package, its likely other people do to, so you might as well solve that problem by building a good library rather than leaning on the language to keep your import lines under 80 characters. In these cases, if you have a package mypackage with sub package stuff with module things and class Whatever needs to be imported frequently in your code and users code, you can put an import in to the __init__.py for mypackage:
__all__ = ['Whatever']
from mypackage.stuff.things import Whatever

and then you and anyone else who wants to use Whatever can just do:
from mypackage import Whatever

But getting less verbose or less explicit than that will more than likely cause you or someone else difficulty down the line.


text:
Q: Regex pattern equality In ScalaTest, I have the following check:
"abc".r shouldBe "abc".r

But it is not equal. I don't understand.
abc was not equal to abc
ScalaTestFailureLocation: com.ing.cybrct.flink.clickstream.ConfigsTest$$anonfun$6 at (ConfigsTest.scala:97)
Expected :abc
Actual   :abc

A: The method shouldBe in Scalatest 3.0.5 delegates the equality check to the areEqualComparingArraysStructurally method:
def shouldBe(right: Any): Assertion = {
  if (!areEqualComparingArraysStructurally(leftSideValue, right)) {
    val (leftee, rightee) = Suite.getObjectsForFailureMessage(leftSideValue, right)
    val localPrettifier = prettifier // Grabbing a local copy so we don't attempt to serialize AnyShouldWrapper (since first param to indicateFailure is a by-name)
    indicateFailure(FailureMessages.wasNotEqualTo(localPrettifier, leftee, rightee), None, pos)
  }
  else indicateSuccess(FailureMessages.wasEqualTo(prettifier, leftSideValue, right))
}

which in turn simply delegates the equality check (as you can expect) to the == operator:
private[scalatest] def areEqualComparingArraysStructurally(left: Any, right: Any): Boolean = {
  // Prior to 2.0 this only called .deep if both sides were arrays. Loosened it
  // when nearing 2.0.M6 to call .deep if either left or right side is an array.
  // TODO: this is the same algo as in scalactic.DefaultEquality. Put that one in
  // a singleton and use it in both places.
  left match {
    case leftArray: Array[_] =>
      right match {
        case rightArray: Array[_] => leftArray.deep == rightArray.deep
        case _ => leftArray.deep == right
      }
    case _ => {
      right match {
        case rightArray: Array[_] => left == rightArray.deep
        case _ => left == right
      }
    }
  }
}

In Scala, at least on the JVM, == simply calls equals, which, if not overridden, checks whether the compared variables point to the same object. case classes are peculiar in that the compiler overrides equals for you to compare the constructor arguments.
You can test it very easily with the following (but as you can imagine, the same applies to simply using == on your own):
package org.example

import org.scalatest.{FlatSpec, Matchers}

final class MyClass(val a: Int)

final case class MyCaseClass(a: Int)

final class TestSpec extends FlatSpec with Matchers {

  "equality on case classes" should "succeed" in {

    new MyCaseClass(1) shouldBe new MyCaseClass(1)

  }

  "equality on non-case classes" should "fail" in {

    new MyClass(1) shouldNot be(new MyClass(1))

  }

  "equality between Regex objects" should "fail" in {

    "abc".r shouldNot be("abc".r)

  }

}

What the r method does is instantiating a new Regex object, which is not a case class and does not override the equality definition, thus yielding the result you see.

A: While it's possible to decide whether two regular expressions accept the same language, it seems to be rather complicated and not all that terribly useful for everyday regex usage. Therefore, equality on compiled regex patterns is just referential equality:
val x = "abc".r
val y = "abc".r
x == y
// res0: Boolean = false

A: Yes, they are not equal. Both "abc".r  are  different references to two different memory locations. shouldbe is to  check equality  but not identity.


text:
Q: Fast API, test endpoints by Postman I want to test some endpoints, in particular sign-in endpoint by using Postman. But every time I send request I get en error whether 422 or 401 (the login and password are correct).
Is it pissible to test sign-in with Postman?

router = APIRouter(
    prefix='/auth'
)
@router.post('/sign-in', response_model=Token)
def sign_in(form_data: OAuth2PasswordRequestForm = Depends(), service: AuthService = Depends()):
    return service.authenticate_user(form_data.username, form_data.password)


text:
Q: How do I enforce a specific custom post type on the loop I am developing a blog where the main posts are of a custom post type.
Let's assume it is a Book custom post type.
I want the /author/admin page to list the books of the author admin, but instead, it goes and searches for Posts of admin, which is the built-in basic post type.
How do I make my custom post type Book to be used in all such index queries? (main page, author, search, etc).

A: You can modify all main queries before they happen via the pre_get_posts action and a check if is_main_query:
function wpa75492_post_type_query( $query ) {
    if ( $query->is_main_query() ) {
        $query->set( 'post_type', array( 'book' ) );
    }
}
add_action( 'pre_get_posts', 'wpa75492_post_type_query' );

A: use the parameter post_type=your-custom-post-type-slug-here
for example if your post type slug is "product" then use the code like:
query_post("post_type=product");

A: You need to query the posts from that specific post type before the loop.  So, on your author archive page, or any page template, add this before the loop:
query_posts(array(
    'post_type'   => 'book_posttype',
    'author_name' => 'mark'
));

Query_posts can take other parameters as well.
http://codex.wordpress.org/Function_Reference/query_posts
It can use the same parameters as WP_query.  One of which is author_name.
http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
You can also add an author page template which you will place this query in and the loop.  It would be a page in your theme directory called, author-mark.php or whatever the name is.


text:
Q: Video-Streaming (hosting) for e-learning website I'm trying to figure out what would be the best way to fulfill following requirements for an e-learning platform.

*

*Backend in which I edit the videos, so that I can link them among themselves (like the youtube-comment function)

*The user can watch the videos only when accessing the platform (no downloading allowed!)

*videos are only accessable through user validation
My thoughts and research so far: I already found some buzzwords like Adobe Flash Media Server and names of common video-platforms. But I did'n find any service that fulfill all requirements defined, so I have to came up with my own idea(s).
I was thinking about building up a platform which uses youtube as video hoster. I can easily embed the youtube videos on my website, but I can't encrypt the "video-link", because the youtube Iframe itself contains it. I need to hide the source, so that the user can not easily figure it out.
The only solution I have at the moment: developling a custom media server (with adobe media server).
How would you "solve the problem"?

A: I think Vimp will be perfect for your solution. It is a youtube like content management system. Check it out. You'll be surprised at what you'll find that's already out there instead of reinventing the wheel.


text:
Q: Find the equation of a plane normal to the curve (e^t, t, t^2) Problem:
Find the equation of a plane normal to the curve $(e^t, t, t^2)$ at the point $t=1$.
Set the curve to $P(t)=(e^t, t, t^2)$,
then taking the derivative twice we get $P''(t)=(e^t, 0, 2)$.
Using $(X-P) \cdot N=0$
If $P''(1) = N$ and $P(1)=P$,
then I get   $ex+2z=e^2+2$.
I'm pretty sure $P\cdot N=0$ should be met, but I'm not exactly sure where I went wrong.
Is this the correct approach? I have realized with a few counterexamples that this derivation may not yield the correct normal. Any insights?

A: Compute $p'(t)=(e^t,1,2t)\implies p'(1)=(e,1,2)$. This is the normal vector to your plane, which passes through $p(1)=(e,1,1)$. This is enough to determine the equation of our plane,
$$
(e,1,2)\cdot(x-e,y-1,z-1)=0
$$

A:
It is asking for the plane normal to the curve, not tangent. The thinking is the first derivative is tangent.

Yes, the first derivative is the tangent. And that's what you want! A plane is normal to the curve if it's normal to the curve's tangent vector. In other words, the normal vector to the plane, $N$, is the same thing as the tangent vector to the curve, $p'(1)$.


text:
Q: generate all combintations for list with repeated items Related to this question, I am wondering the algorithms (and actual code in java/c/c++/python/etc., if you have!) to generate all combinations of r elements for a list with m elements in total. Some of these m elements may be repeated.
Thanks!

A: recurse for each element type
int recurseMe(list<list<item>> items, int r, list<item> container)
{
  if (r == container.length)
  {
    //print out your collection;
    return 1;
  }
  else if (container.length > score)
  {
    return 0;
  }
  list<item> firstType = items[0];
  int score = 0;
  for(int i = 0; i < firstType.length; i++)
  {
    score += recurseMe(items without items[0], r, container + i items from firstType);
  }
  return score;
}

This takes as input a list containing lists of items, assuming each inner list represents a unique type of item. You may have to build a sorting function to feed as input to this.
//start with a list<item> original;
list<list<item>> grouped = new list<list<item>>();
list<item> sorted = original.sort();//use whichever method for this
list<item> temp = null;
item current = null;
for(int x = 0; x < original.length; x++)
  if (sorted[x] == current)
  {
    temp.add(current);
  }
  else
  {
    if (temp != null && temp.isNotEmpty)
      grouped.add(temp);
    temp = new list<item>();
    temp.add(sorted[x]);
  }
}
if (temp != null && temp.isNotEmpty)
  grouped.add(temp);
//grouped is the result

This sorts the list, then creates sublists containing elements that are the same, inserting them into the list of lists grouped

A: I'm going to make this an answer rather than a bunch of comments.
My original comment was:

The CombinationGenerator Java class systematically generates all
  combinations of n elements, taken r at a time. The algorithm is
  described by Kenneth H. Rosen, Discrete Mathematics and Its
  Applications, 2nd edition (NY: McGraw-Hill, 1991), pp. 284-286." See
  merriampark.com/comb.htm. It has a link to source code.

As you pointed out in your comment, you want unique combinations. So, given the array ["a", "a", "b", "b"], you want it to generate aab, abb. The code I linked generates aab, aab, baa, baa.
With that array, removing duplicates is very easy. Depending on how you implement it, you either let it generate the duplicates and then filter them after the fact (i.e. selecting unique elements from an array), or you modify the code to include a hash table so that when it generates a combination, it checks the hash table before putting the item into the output array.
Looking something up in a hash table is an O(1) operation, so either of those is going to be efficient. Doing it after the fact will be a little bit more expensive, because you'll have to copy items. Still, you're talking O(n), where n is the number of combinations generated.
There is one complication: order is irrelevant. That is, given the array ["a", "b", "a", "b"], the code will generate aba, abb, aab, bab. In this case, aba and aab are duplicate combinations, as are abb and bab, and using a hash table isn't going to remove those duplicates for you. You could, though, create a bit mask for each combination, and use the hash table idea with the bit masks. This would be slightly more complicated, but not terribly so.
If you sort the initial array first, so that duplicate items are adjacent, then the problem goes away and you can use the hash table idea.
There's undoubtedly a way to modify the code to prevent it from generating duplicates. I can see a possible approach, but it would be messy and expensive. It would probably make the algorithm slower than if you just used the hash table idea. The approach I would take:
Sort the input array
Use the linked code to generate the combinations
Use a hash table or some other code to select unique items.

Although ... a thought that occurred to me.
Is it true that if you sort the input array, then any generated duplicates will be adjacent? That is, given the input array ["a", "a", "b", "b"], then the generated output will be aab, aab, abb, abb, in that order. This will be implementation dependent, of course. But if it's true in your implementation, then modifying the algorithm to remove duplicates is a simple matter of checking to see if the current combination is equal to the previous one.

A: Here is a recursion that I believe is closely related to Jean-Bernard Pellerin's algorithm, in Mathematica.
This takes input as the number of each type of element.  The output is in similar form.  For example:
{a,a,b,b,c,d,d,d,d} -> {2,2,1,4}

Function:
f[k_, {}, c__] := If[+c == k, {{c}}, {}]

f[k_, {x_, r___}, c___] := Join @@ (f[k, {r}, c, #] & /@ 0~Range~Min[x, k - +c])

Use:
f[4, {2, 2, 1, 4}]

{{0, 0, 0, 4}, {0, 0, 1, 3}, {0, 1, 0, 3}, {0, 1, 1, 2}, {0, 2, 0, 2},
 {0, 2, 1, 1}, {1, 0, 0, 3}, {1, 0, 1, 2}, {1, 1, 0, 2}, {1, 1, 1, 1},
 {1, 2, 0, 1}, {1, 2, 1, 0}, {2, 0, 0, 2}, {2, 0, 1, 1}, {2, 1, 0, 1},
 {2, 1, 1, 0}, {2, 2, 0, 0}}

An explanation of this code was requested.  It is a recursive function that takes a variable number of arguments.  The first argument is k, length of subset.  The second is a list of counts of each type to select from.  The third argument and beyond is used internally by the function to hold the subset (combination) as it is constructed.
This definition therefore is used when there are no more items in the selection set:
f[k_, {}, c__] := If[+c == k, {{c}}, {}]

If the total of the values of the combination (its length) is equal to k, then return that combination, otherwise return an empty set.  (+c is shorthand for Plus[c])
Otherwise:
f[k_, {x_, r___}, c___] := Join @@ (f[k, {r}, c, #] & /@ 0~Range~Min[x, k - +c])

Reading left to right:

*

*Join is used to flatten out a level of nested lists, so that the result is not an increasingly deep tensor.

*f[k, {r}, c, #] & calls the function, dropping the first position of the selection set (x), and adding a new element to the combination (#).

*/@ 0 ~Range~ Min[x, k - +c]) for each integer between zero and the lesser of the first element of the selection set, and k less total of combination, which is the maximum that can be selected without exceeding combination size k.


text:
Q: Language Agnostic API I am planning on putting up a web service, or some other service exposed over the internet.  I would like to create an API for applications to interact with this service.  I would like the API to be usable in different languages, such as Java, C++, C#, or PHP.  How can I maintain one code base for my API, but distribute nice packaged binaries for all these languages? Also, I may want to consider this could be cross platform as well.
Update 1

I'm early days on Web Services, but I
  think one of the key points is that
  lots of tooling supports the
  implementation of clients based on the
  description of the service like WDSL.
  I've not delivered any client-side
  software with anything I've done, I
  expect any user to be able to build
  their own clients suited to their
  needs. --Brabster's Answer

I am not opposed to making it a straight web service then giving out a WSDL file.  But what if I want the client API to do some logic, encryption, error checking or so on?
Update 2

As far as expecting the client that is
  using your API to do anything, you
  can't! There is nothing you will be
  able to do to ensure that the consumer
  of the API will do anything right.
  That's why robust error handling is so
  important. You must check and double
  check any and everything that comes
  from the client. You must always be
  suspicious of it, and even assume that
  it is malicious. There really is no
  good way around that fact. --Ryan Guill's Answer

My original idea was to create a DLL or Assembly in .NET, then the client is making calls into this code that is running client side. This code may talk via any communications protocol back to the server, but my API would be running on their box.  I guess REST does not really accomplish this. It seems like in REST everything is still an HTTP post. It is almost web services with out soap.
Update 3
I have accepted Ryan Guill's answer. I think the general idea is that I need to expose a network service of some sort, with the lowest barrier to the client. That way anyone can connect. Then just have all my code run on the server. That seems to be accepted as the only want to really achieve the platform and language independence I am after.
Thanks for all the input.

A: I'm early days on Web Services, but I think one of the key points is that lots of tooling supports the implementation of clients based on the description of the service like WDSL.
I've not delivered any client-side software with anything I've done, I expect any user to be able to build their own clients suited to their needs.
If you check out the flickr API as suggested by one of your other answers, I don't think they supply client side code, other people have built and contributed client side stuff.

A: I would use a REST API, similar to the way Flickr's API works: http://flickr.com/services/api/
It is fairly simple to create and maintain, the biggest downsides are that it takes a lot of documentation (but pretty much any way you do an API will have this issue) and that robust error handling is a must.
But in my opinion, it's the best way to create an API that is the closest to cross platform/cross language.
More information here: http://www.xfront.com/REST-Web-Services.html
Update: The submitter added the following to the post:

I am not opposed to making it a straight web service then giving out a WSDL file. But what if I want the client API to do some logic, encryption, error checking or so on?

I personally do not like using SOAP (using a WSDL).  There is a lot of inherent overhead to using SOAP, both on the server and the client.  I think that is why you see more and more public API's being written using REST.  It really lowers the barrier to entry to the lowest common denominator, allowing anything that can use basic HTTP (GET and POST (also PUT and DELETE for the "proper" way of doing it)) to use the API.
Some more examples of public API's written using REST: twitter, vimeo, Google
As far as expecting the client that is using your API to do anything, you can't! There is nothing you will be able to do to ensure that the consumer of the API will do anything right.  That's why robust error handling is so important.  You must check and double check any and everything that comes from the client.  You must always be suspicious of it, and even assume that it is malicious.  There really is no good way around that fact.
Update 2: the submitter added the following to the post:

My original idea was to create a DLL or Assembly in .NET, then the client is making calls into this code that is running client side. This code may talk via any communications protocol back to the server, but my API would be running on their box. I guess REST does not really accomplish this. It seems like in REST everything is still an HTTP post. It is almost web services with out soap.

You can certainly do this, but that is only going to work for .NET languages, meaning that your cross-platform and cross-language benefits are out the window.  And still, in the end, are you really preventing anything? The developer is going to either use your remote API, or your local DLL or Assembly. Either way, he is going to have to know how to use it and use it right, otherwise you are going to throw an error.  All you are really doing is changing where the errors get thrown from.  Which may be important to you (if so, mention why) but really isn't changing anything in the equation.
But you are somewhat correct in saying REST is kind of like web-services without the SOAP.  Technically REST is web-services too, its just that web-services have come to generally mean SOAP.  It really is a different way of achieving the same thing.  The biggest differences are though that it takes more programming and thought on your side (and potentially more programming on the client side) but you trade that for robustness, less overhead in both the consumer and the server, and the widest possible audience for the API.  It really is the lowest common denominator.

A: I suggest writing the API in the Haxe programming language so that the source code can be directly translated to all the programming languages you mentioned. The Haxe programming language can be translated (or "trans-compiled") to all of the programming languages that you mentioned in the original post, as well as a few others.

A: Simple answer, no.
Complex answer: create an API and compile it to a COM dll.  Then, just build the wrapper code for the languages that can't handle that.
Simple answer #2, make the original service so trivial, or so universally acceptable, as to not require an API (I usually implemented this through server-side database polling.  Ugly but any language that can access a database can utilize the program).