text:
Q: Can't send a message via custom store/dispatch in botframework-webchat for IE11/es5 My customer requires IE11 support for our chatbot. I had to modify the webchat code not to use es6 features like arrow functions, as they are not supported in IE11/es5. For the most part I was successful, but the one thing I wasn't able to get working was sending a message event I am sending. The new code works in Chrome, but I am getting an Expected identifier error message in IE11. Here is the relevant code:
const store = window.WebChat.createStore({}, function({dispatch}) { return function(next) { return function(action) {
    if (action.type === 'WEB_CHAT/SEND_MESSAGE') {
        // Message sent by the user
        PageTitleNotification.Off();
        clearTimeout(interval);
    } else if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY' && action.payload.activity.name !== "inactive") {
        // Message sent by the bot
        clearInterval(interval);
        interval = setTimeout(function() {
            // Change title to flash the page
            PageTitleNotification.On('Are you still there?');

            // Notify bot the user has been inactive
            dispatch({
                type: 'WEB_CHAT/SEND_EVENT',
                payload: {
                    name: 'inactive',
                    value: ''
                }
            });

        }, 3000)
    }
    return next(action);
}}});

Previously the first line looked like
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {

The issue is coming at function({dispatch}). IE console is saying an identifier is expected and the entire webchat fails to load. It works fine in Chrome. If I change function({dispatch}) to just function(dispatch), the bot renders but the dispatch statement sending the inactive message to the bot (below) no longer functions in IE OR Chrome.
// Notify bot the user has been inactive
dispatch({
    type: 'WEB_CHAT/SEND_EVENT',
    payload: {
        name: 'inactive',
        value: ''
    }
});

Why is IE not recognizing {dispatch} as an identifier, and what can I do to get this working?

A: IE11 doesn't support that syntax. ES6 allows to set object properties by variable name, so the ES5 equivalent is:
window.WebChat.createStore({}, { dispatch: dispatch }) {
  // ...
}

Edit:
After some debugging, the final solution was to pass in just the dispatch object to the createStore function directly, and accessing its dispatch method:
dispatch.dispatch({
    type: 'WEB_CHAT/SEND_EVENT',
    payload: {
        name: 'inactive',
        value: ''
    }
});

You could rename the argument to reduce redundancy but it's not needed.

A: The issue with your posted code is you never return next(action). Therefore the flow never advances when it runs thru the store. Add this one line and web chat will work as expected sending every 3 seconds. You can reference the code in the 05.custom-components/b.send-typing-indicator Web Chat sample, if needed.
Please note:

*

*I commented out PageTitleNotification as it's undefined.

*I did had to define interval which you must define elsewhere in your code not provided.

*Be sure you are using the webchat-es5.js CDN which is backed with polyfills for running on IE.

Hope of help!
var interval;
const store = window.WebChat.createStore({}, function(dispatch) {
  return function(next) {
    return function(action) {
      console.log(action)
      if (action.type === 'WEB_CHAT/SEND_MESSAGE') {
          // Message sent by the user
          // PageTitleNotification.Off();
          clearTimeout(interval);
      } else
      if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {
          // Message sent by the bot
          clearInterval(interval);
          interval = setTimeout(function() {
              // Change title to flash the page
              // PageTitleNotification.On('Are you still there?');

              // Notify bot the user has been inactive
              dispatch.dispatch({
                  type: 'WEB_CHAT/SEND_EVENT',
                  payload: {
                      name: 'inactive',
                      value: ''
                  }
              });

          }, 3000)
      }
      return next( action )
    }
  }
} );

Developer console:

Bot logging:


text:
Q: Execution error for task Program type already present Below is  my build.gradle and  error
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '25.0.3'

defaultConfig {
    applicationId "com.abc.android.xyz"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "0.1"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
  'proguard-rules.pro'
    }
}
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.3-RELEASE'
compile 'com.sothree.slidinguppanel:library:3.0.0'
 }

The errors are below

Error:Program type already present: android.support.v4.app.ActionBarDrawerToggle$Delegate

redpajama_set_name: RedPajamaStackExchange


text:
Q: Access image URL in Umbraco 8 I've been trying to utilise Umbraco 8 in a new project. (I've got C# experience but never used Umbraco before)
I've added templates and set it up to accept data, however I've set up a "Home" DocType and added an Image Selector.
After setting and publishing the data, I'm now trying to update the template to display the Image, and keep running into errors, I've tried:
var backgroundImageId = Model.Value("backgroundImage");
var backgroundImage = Umbraco.Media(backgroundImageId);

@Model.Value("backgroundImage").Url

And a bunch of others which haven't panned out. I just can't seem to get it to work.
Any suggestions appreciated.

A: var backgroundImage = Model.Value<IPublishedContent>("backgroundImage").Url;

Fouund the solution to this, converting the type to published content seems to do the trick.

A: There are several ways you can get this.
IPublishedContent contentbackgroundImage = umbracoHelper.TypedContent(backgroundImageId);

var backgroundImage = contentbackgroundImage?.GetPropertyValue<IPublishedContent>("backgroundImage");

you can do like this way on the razor pages
@{
    var backgroundImage = Model.GetValue<IPublishedContent>("backgroundImage")
}

from this you can access properies like url, name ,alies ect.


text:
Q: Intel asm syntax with GCC: undefined reference I am running Ubuntu 64-bit and I have this code:
#include <stdio.h>

int main() {
    int x, y;
    int z = 0;

    printf("Enter two numbers: ");
    scanf("%d %d", &x, &y);

    asm(".intel_syntax noprefix\n"

       "MOV EAX, _x\n"
       "MOV ECX, _y\n"
       "ADD EAX, ECX\n"
       "MOV _z, EAX\n"

       ".att_syntax\n");

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

    return 0;
}

According to lecture at school it should work, but when I try to compile it with GCC I get this error:
/tmp/ccU4vNLr.o: In function `main':
Jung_79913_211.c:(.text+0x4a): undefined reference to `_x'
Jung_79913_211.c:(.text+0x51): undefined reference to `_y'
Jung_79913_211.c:(.text+0x5a): undefined reference to `_z'
collect2: error: ld returned 1 exit status

I know GCC uses AT&T asm syntax by default, but I need Intel systax at university. So question is, how I can get it working?

A: Two things: First, on Linux you don't prefix C symbols with an underscore in assembly, so x, y, z instead of _x, _y, _z. Second, these three variables are automatic variables. You cannot refer to automatic variables like this as no symbols are created for them. Instead, you need to tell the compiler to hand-over these variables into your assembly. You also need to mark the registers eax and ecx as clobbered because your assembly modifies them. Read this documentation for details. Here is how this could work with your code:
asm(
   "MOV EAX, %1\n"
   "MOV ECX, %2\n"
   "ADD EAX, ECX\n"
   "MOV %0, EAX\n"
   : "=r" (z) : "r" (x), "r" (y) : "eax", "ecx");

You also need to compile with -masm=intel for this to work as otherwise gcc will insert references to registers in AT&T syntax, causing a compilation error. Even better, learn AT&T syntax if you plan to write a lot of inline assembly for gcc.


text:
Q: django image upload to path is not displaying I have an application where I upload images and the images are uploaded to a specific directory but after uploading which works fine if I attenp to click on the image url I get an error which says
The current URL, media/gallery/2017/12/28/230-256.png, didn't match any of these and also the image is not displaying in the browser html
below is my model and view despite having my media path defined in the settings
Models.py
class Gallery(models.Model):
    name = models.CharField(max_length=400, db_index=True)
    image = models.ImageField(upload_to='gallery/%Y/%m/%d', blank=True)

    class Meta:
        ordering = ('name',)

    def __str__(self):
        return self.image.url

Views.py
def index(request):
    gallery = Gallery.objects.all()
    context = {
        'gallery': gallery,
        }
    template = 'gallery.html'
    return render(request, template, context)

html
{% if gallery.image %}

           {% endif %}

A: While you are developing, in the project urls.py you must add
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

This will make your uploaded file accessible by the application.
When on a production server, it is better if the webserver itself (apache, nginx, ..) can reach the location where the files are uploaded, you can find how to configure that in other answers (here for nginx, and here for apache

A: Your HTML needs to be something like this:
{% if gallery.image %}

{% endif %}

MEDIA_URL should be configured in settings.py. This should be set to the base URL from where you're serving the files stored in MEDIA_ROOT.
The URL attribute of the image field stores only the relative URL of the image.


text:
Q: Using std::make_unique with a custom deleter In using std::unique_ptr with a custom deleter I desire to use std::make_unique rather than a raw new.  I am using VC++2013.  It appears to me that there is no way to use std::unique_ptr if you are using a custom deleter.  Did I miss something or is this really the case?

Additional Information:
I am using a std::unique_ptr<HANDLE, custom_deleter> to hold a Windows HANDLE for an opened COM port.
I could write a custom RAII class for this, and it wouldn't be terribly difficult, but I was seeing how hard/difficult/bad it would be to use std::unique_ptr.

A: The whole point of make_unique is to encapsulate the notion of "use new to create a T from given constructor arguments and use delete to destroy it".
If you wanted a custom deleter, you would also have to specify how to create the object, and then there would be nothing more gained from having the emplacing maker function.
I wrote some examples of custom maker functions for certain unique resource handles in this post.

A: Here is a way to wrap c style memory management into a std::unique_ptr using a custom deleter that calls a custom free function. This has a make function helper similar to std::make_unique LIVE:
#include <iostream>
#include <functional>
#include <memory>

// Some C style code that has some custom free function ptr...
extern "C" {

struct ABC { };

enum free_type_e {
    FREE_ALL,
    FREE_SOME
};

typedef void (free_f)(enum free_type_e free_type, void *ptr);
struct some_c_ops { free_f* free_op; };

void MY_free(enum free_type_e free_type, void *ptr)
{
    printf("%s:%d ptr=%ld\n", __func__, __LINE__, (long)ptr);
    (void)free_type;
    free(ptr);
}

}; // extern "C"

template<typename T>
using c_unique_ptr = std::unique_ptr<T,std::function<void(T*)>>;

template <typename T>
c_unique_ptr<T> make_c_unique(some_c_ops* op, free_type_e free_type)
{
    return c_unique_ptr<T>(static_cast<T*>(calloc(1, sizeof(T))),
                           std::bind(op->free_op, free_type, std::placeholders::_1));
}

void foo(c_unique_ptr<ABC> ptr)
{
    std::cout << __func__ << ":" << __LINE__
        << " ptr=" << reinterpret_cast<size_t>(ptr.get()) <<     std::endl;
}

int main()
{
    some_c_ops ops = { MY_free };
    c_unique_ptr<ABC> ptr = make_c_unique<ABC>(&ops, FREE_ALL);
    std::cout << __func__ << ":" << __LINE__
        << " ptr=" << reinterpret_cast<size_t>(ptr.get()) << std::endl;

    foo(std::move(ptr));

    std::cout << __func__ << ":" << __LINE__
        << " ptr=" << reinterpret_cast<size_t>(ptr.get()) << std::endl;
}

Possible output:

main:48 ptr=50511440
foo:40 ptr=50511440
MY_free:20 ptr=50511440
main:53 ptr=0

A: As far as I know there is no make_unique function in the C++11 standard. See

*

*Why does C++11 have `make_shared` but not `make_unique`

*make_unique and perfect forwarding
So I would assume that the make_unique is an implementation from Microsoft that is at least not included in the standard.
But nevertheless you can use a custom deleter with unique_ptr. When using unique_ptr you have to specify the type of the deleter as a second template argument and then pass an appropriate object to the constructor.


text:
Q: Word similar to patented but not legally patented? What is a word similar to "patented" but without the legal connotation? It is something that only you or your company offers. May be a methodology rather than a product.

A:
Proprietary
  [pruh-prahy-i-ter-ee]
  /adjective

*pertaining to property or ownership.

*belonging or controlled as property.

*(of a brand name, product, service, formula, etc.) protected by a patent, copyright, or trademark:
  proprietary drugs; a proprietary name; a proprietary logo; a proprietary blend of ingredients.

*privately owned and operated for profit.
Source: Dictionary.com

A: A trade secret:

trade se·cret
noun: trade secret; plural noun: trade secrets
a secret device or technique used by a company in manufacturing its
   products.

United States:

The Uniform Trade Secrets Act ("UTSA") defines a trade secret as:
information, including a formula, pattern, compilation, program, device,
  method, technique, or process,
     that derives independent economic value, actual or potential, from not
  being generally known to or readily ascertainable through
  appropriate means by other persons who might obtain economic value
  from its disclosure or use; and
      is the subject of efforts that are reasonable under the circumstances to
   maintain its secrecy.
The UTSA has been enacted, in one form or another, by 40 states and
  the District of Columbia.  Prior the the development of the UTSA,
  improper use or disclosure of a trade secret was traditionally a
  common law tort. Sections 757 and 758 of the Restatement of Torts
  (1939) set forth the basic principles of trade secret law that were
  widely adopted by U.S. courts.  In particular, § 757, comment b,
  listed six factors to be considered in determining whether information
  constitutes a trade secret: . . .

For more information see:
https://www.law.cornell.edu/wex/trade_secret
Example:  The formula for making Coca-Cola is a trade secret.
Although trade secrets (unlike patents) do not originate in law, they are protected (under various circumstances) by law.


text:
Q: Cluster with distance threshold in R I'd like to get clusters with a maximum inner distance threshold.
Now I use hc <- hclust(d) and cutree(hc, numofclasses).
But I would like to use something like in python:
>>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y))
>>> cl.getlevel(10)     # get clusters of items closer than 10

How can I get this in R?

A: You can use the h argument in cutree(). It will split the elements in clusters based on the "height" of the dendrogram. I will sketch the code, because you do not provide data.
hc <- hclust(data)
plot(hc); text(hc)       ## see the output
hc2 <- cutree(hc, h=10)

The height of the dendrogram corresponds to the distance between two nodes, but the relationship may not be 1-to-1 with your python implementation.


text:
Q: How to programatically detect if an app supports Android Wear? Im trying to detect if an app supports Android Wear or is a watch face.
PackageManager pm = getActivity().getPackageManager();

        List<PackageInfo> packs = pm.getInstalledPackages(0);
        for (int i = 0; i < packs.size(); i++)
        {}

Is the code im using. Any feedback or suggestions would be awsome!

A: To check if Android Wear package exists on system:
public void foobar() {
    boolean doesExist = isPackageInstalled("com.google.android.wearable.app");
}

private boolean isPackageInstalled(String packagename) {
    PackageManager pm = getApplicationContext().getPackageManager();
    try {
        pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
        return true;
    } catch (NameNotFoundException e) {
        //swallow exception
        return false;
    }
}


text:
Q: JMeter Getting Parameters From ResponseParameters To Generate New Request I want to use Jmeter to test a website that uses Servlet+Struts+WebSphereCommerce Technology. I would like to be able to generate Request according to previous response.
I use View Results Tree after html request in order to inspect response of the previous call but i do not see the parameters (responseProperties) i set in response. instead i just see piece of .js code, html code or images.
how to gather response properties?
finally i would like to be able to use such properties to create the following request.

A: JMeter provides Beanshell scripting as extension mechanism so you can add a Beanshell Post Processor as a child to your HTTP Request and refer to response properties as follows:
String responseCode = prev.getResponseCode();
String responseHeaders = prev.getResponseHeaders();
String responseMessage = prev.getResponseMessage();
String responseData = prev.getResponseDataAsString();

Where prev is a shor-hand for previous SampleResult
If you want to use a part of response in next request (this is called "correlation") JMeter provides other Post Processors which can extract data from response and store it into JMeter Variables for later re-use such as:

*

*Regular Expressions Extractor

*CSS/JQuery Extractor

*XPath Extractor
etc.
Hope this helps.


text:
Q: How do I set compile options in Visual Studio 2010 C# Express I'm trying to compile my c# application with D3D_DEBUG_INFO in order to enable enhanced debugging with Direct3D. Where do I place the above option in Visual Studio 2010 C# Express?

A: Project | Options
The build section allow you to specify compiler directives.


text:
Q: Font-Weight CSS Transition in Chrome Trying to get font-weight to gracefully transition from '400' to '600' using CSS but it doesn't appear to be working in Chrome.  Is this a known bug or am I doing something wrong?
Check the Fiddle here for an example

A: Fonts are not simple vector image collections (that's why svg fonts never took off). Opentype fonts include all kinds of magic to clamp fonts to the pixel grid, which makes it unrealistic to expect a font family to ever include every possible weight value.
Because fonts are not simple vector image collections they will also never resize linearly – there will be bumps to take the pixel grid into account.
This Google whitepaper explains why linear resizing does not work for text on current screens
https://docs.google.com/document/d/1wpzgGMqXgit6FBVaO76epnnFC_rQPdVKswrDQWyqO1M/edit
which is why no browser will attempt it and they will all rely on pre-computed font weights.
That may change in a decade when retina displays are the lowest common denominator but current font tech targets current screens.
This Microsoft whitepaper documents some standard font weight values
http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-components-postattachments/00-02-24-90-36/WPF-Font-Selection-Model.pdf
(but just because they are documented does not mean the number of fonts that actually include all of them is not quite small)
You can probably achieve the effect you want with an svg font and some javascript. The svg font will be crap for text use though.

A: The problem is that font weights, when represented numerically, must be a multiple of 100. To animate between 400 and 600, the font would change from 400 to 500 to 600 (3 'frames', if you like) and wouldn't look very smooth. An animation wouldn't increment the weight by 1 each time (400, 401, 402...) it would increment the weight by 100 (400, 500, 600). If your animation lasted 2 seconds, after 1 second the weight would suddenly become 500, and after 2 seconds the weight would suddenly become 600; there are no in-between variations.
A further problem with what you're attempting here is that the font you're using (or JSFiddle's default, at least) doesn't have anything different for font-weight:500, meaning it defaults to 400:

a - 400, normal

a - 500 (no support, defaults to 400)

a - 600 (bold)

a - 650 (not valid, defaults to 400)

http://jsfiddle.net/r4gDh/6/

Numeric font weights for fonts that provide more than just normal and bold. If the exact weight given is unavailable, then 600-900 use the closest available darker weight (or, if there is none, the closest available lighter weight), and 100-500 use the closest available lighter weight (or, if there is none, the closest available darker weight). This means that for fonts that provide only normal and bold, 100-500 are normal, and 600-900 are bold.

https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
This basically means that you can't smoothly animate font-weight. Even if you had support for all weights between 100 and 900 the change wouldn't be pleasant and there would be a dramatic change between 500 and 600 (where lighter weight meets darker weight).

A: I seem to have obtained a "font-weight" transition effect accidentally, by doing a quick color transition (light gray to dark blue) at the same time.

A: I came here to find out the answer myself for how to transition font weight, and was disappointed when I read the approved answer above saying that it can't be done (or at least not very well).
With font-weight animation unavailable, I decided to try another effect, which actually gives you a font-weight effect... which I didn't even think would work for this type of transition.
Here is how to make the weight grow:
.weightGrow:hover {
    text-shadow:
    -1px -1px 0 #2DD785,
    1px -1px 0 #2DD785,
    -1px 1px 0 #2DD785,
    1px 1px 0 #2DD785;
    -webkit-transition: all .5s;
    -moz-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;
}

Perfectly smooth and exactly what I was looking for when I first arrived on this page. Hope it helps someone.

A: Font-weight animation is currently not supported in Chrome and IE-10 based on numerous tests.  This may change in the future.

A: Although there is no direct way to get the font-weight to smoothly transition, I have found a way to do this indirectly (although with some limitations).
In essence you can simply use one of the pseudo elements in order to make a mirror copy of the element whom font you want to transition to bold, where the font-weight on the pseudo element is bold and the opacity is 0. And on hover simply transition the pseudo element's opacity and that does the trick with a very smooth transition.
You can see a demo here:
http://jsfiddle.net/r4gDh/45/
HTML:

  text will turn to bold on hover

In the HTML you can already see one of the limitations, because we are using pseudo elements we need to pass the contents of the element as an attribute as well, so the content is duplicated.
CSS:
.element,
.element::before {
    background: red;
    font-weight:normal;
    font-size:40px;

    text-align:center;

    display: inline-block;

    padding: 0px 30px 0px 30px;

    position: relative;
    top: 0;
    left: 0;
}
.element::before {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    padding: 0;

    content: attr(data-text);
    opacity: 0;

    font-weight: bold;

    transition: all 1s linear;
}
.element:hover::before {
    opacity: 1;
}

The second limitation comes from the nature of the technique, namely because you are simply overlaying the pseudo element over the original, then the element needs to have a solid background or this will not work, because the original element will remain visible in the background.
One thing you should really keep an eye on is that the pseudo element and the original element have the same dimensions, to this end, in the demo, I've removed the padding on the pseudo element, so you may need to do something similar.
As you can see, this way of getting the font-weight transition is not without it's problems and far from ideal, but this is the best I can currently think of and in limited cases like for buttons and what not this is quite useful and if done correctly will look decent even in legacy browsers.

A: Smooth font-weight transitions and animations are possible using variable fonts which are not limited to increments of 100. More info on variable fonts here: https://web.dev/variable-fonts/
Try this snippet with eg. https://fonts.google.com/specimen/Raleway

@font-face {
  font-family: 'Raleway Flex';
  src: url('Raleway-VariableFont_wght.ttf');
  font-weight: 100 900;
}

h1 {
  font-family: 'Raleway Flex', sans-serif;
  animation: example 1s linear 0s infinite alternate both;
}

@keyframes example {
  from {
    font-weight: 100;
  }
  to {
    font-weight: 900;
  }
}

HELLO

I look way smoother if you use a variable font.

A: I've tweaked @Idra's fiddle to make the normal to bold transition a bit smoother. Here's the fiddle: http://jsfiddle.net/y7rLwx95/
Changes... Since the text width will get wider when going to bold, I've added an initial "stretch" transition by increasing the letter spacing:
.element:hover {
   letter-spacing: 0.9px;
   transition: all .3s linear;
}

Then delayed the fading in of the bold ::before element:
.element:hover::before {
   opacity: 1;
   transition-delay: .2s
}

Also some additional tweaks here:
.element::before {
   transition: all .3s linear;  /* replace */
   letter-spacing: 0;           /* additional */
}

The transition timing is just whatever feels right to me. The original idea @Idra posted is significant to me. I accept that fact that the widths should be different between normal and bold, as that's the intent of different font weights. So really the challenge, IMHO, is to figure out how to go between the 2 looks in a smooth, no jarring way. This seems to be the best solution so far I've found.


text:
Q: ValueError: Input 0 of layer sequential_3 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 23) model = Sequential()
model.add(LSTM(22, input_shape=(360,1)))
model.add(Dense(22, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
print(model.summary())
model.fit(X_res, y_res, epochs=2, batch_size=500)

I can not figure out what am I doing wrong. I am working on some one else's code where it is perfectly functioning.


text:
Q: In a group, when does $|ab| = \mathrm{lcm}(|a|, |b|)$ In a finite abelian group $G$ where $a$ has order $m$ and $b$ has order $n$, I was able to prove that $\mathrm{lcm}(m,n) \mid |ab|$ by proving that $(ab)^{\mathrm{lcm}(m,n)} = e$. I know that it is not true in general that $|ab| \mid \mathrm{lcm}(m,n)$, but I'm trying to motivate a counterexample.
My thought was that the following formula relating the lcm and gcd is useful:
$$
\mathrm{lcm}(m,n) = \frac{mn}{\mathrm{gcd}(m,n)}.
$$
If $m$ and $n$ are relatively prime, then $\mathrm{lcm}(m,n) = mn$. That doesn't tell me anything necessarily about the order of $ab$, however, unless it is true in general that if $\gcd(a,b) = 1$, then $|ab| = |a||b|$. In that case, we have $\mathrm{lcm}(m,n) = |ab| = mn$ if and only if $m$ and $n$ are relatively prime, and I should look for a counterexample where two elements have relatively prime order.
I'd appreciate if someone could comment a bit more on this. I'm especially interested in how to motivate counterexamples. Though I'm able to follow those I read, I have trouble coming up with them on my own.

A: I know I've written some of this before, but I cannot locate it right now; perhaps someone with better se-search-foo than I can find them...
Here are some results; throughout $G$ is a group, $a$ and $b$ are elements of finite order that commute, and $o(x)$ denotes the order of the element $x$.
Lemma 1. Let $G$ be a group, $p$ a prime, let $a,b\in G$ be commuting elements of finite order, and let $o(a)=p^r$, $o(b)=p^s$, with  $r\leq s$. If $o(ab)\lt p^s$, then $r=s$.
Proof. If $o(ab)=p^t$ with $t\lt s$, then $a^{p^t}b^{p^t}=e$, and so $e\neq b^{p^t}=a^{-p^t}$. Now, $b^{p^t}$ has order $p^{s-t}\gt 1$, and $a^{-p^t}$ has order $p^{\max(0,r-t)}$. But since $0\lt s-t$, it follows that $r-t=s-t$, and hence that $r=s$, as claimed. $\Box$
Lemma 2. Let $p$ be a prime, and let $n\gt 0$. For every $r$, $0\leq r\leq n$, there exists a group $G$ and commuting elements $a$ and $b$ in $G$ such that $o(a)=o(b)=p^n$, and $o(ab)=p^r$.
Proof. Let $C_k(x)$ denote the multiplicative cyclic group of order $k$ generated by $x$. Fix $r$ and $n$, $0\leq r\leq n$, and let $G=C_{p^r}(x)\times C_{p_n}(y)$. Let $a=(x,y^{-1})$ and $b=(e,y)$. Then $o(a)=o(b)=p^n$, and $ab=(x,e)$ has order $p^r$, as desired. $\Box$
So we want to focus on those primes which occur to the same positive power in $n$ and $m$: those are the only ones that are "in play". To that end, let $d=\gcd(n,m)$, and let $f$ be the largest divisor of $d$ with the property that
$$\gcd(f,n/d) = \gcd(f,m/d) = 1.$$
If $p$ is a prime that divides both $n$ and $m$, then $p$ divides $f$ if and only if the largest power of $p$ that divides $n$ is equal to the largest power of $p$ that divides $m$; that is, the primes that are "in play." Then we have the following result, which appears as Theorem 3 in this paper of Dieter Jungnickel mentioned in the comments (from which I'm borrowing the notation and the definition of $f$, as I was having trouble articulating it and then I looked through the paper to see if he had it succintly, which he does):

Theorem. Let $G$ be a group, and let $a$ and $b$ be commuting elements with $o(a)=n$ and $o(b)=m$. Let $d=\gcd(n,m)$ and $f$ be defined as in the previous paragraph. Then
$$\frac{nm}{df} \,\Bigm|\, o(ab)\,\Bigm|\, \frac{nm}{d}.$$
Moreover, if $k$ is any integer multiple of $\frac{nm}{df}$ that divides $\frac{nm}{d}=\mathrm{lcm}(n,m)$, then there is a group $G$ and commuting elements $a$ and $b$ of orders $n$ and $m$ such that $o(ab)=k$.

Note that this is slightly better than saying the order is a multiple of $\mathrm{lcm}(n,m)/\gcd(n,m)$, since that is equal to $\frac{nm}{d^2}$ and $f$ is a (possibly proper) divisor of $d$.


text:
Q: How to start selecting results starting from last row in Database table using Criteria Query JPA? The problem is same as: Search mysql table starting from last row
╔════╦════════════╦════════════╦═════════════╦════════════╗
║ id ║  field_1   ║   field_2  ║   field_n   ║    time    ║
╠════╬════════════╬════════════╬═════════════╬════════════╣
║  1 ║ data_field ║ data_field ║ data_field  ║ 1369748934 ║
║  2 ║ data_field ║ data_field ║ data_field  ║ 1369748935 ║
║  3 ║ data_field ║ data_field ║ data_field  ║ 1369748936 ║
║  4 ║ data_field ║ data_field ║ data_field  ║ 1369748936 ║
║  5 ║ data_field ║ data_field ║ data_field  ║ 1369748938 ║
║  6 ║ data_field ║ data_field ║ data_field  ║ 1369748939 ║
╚════╩════════════╩════════════╩═════════════╩════════════╝

I want to retrieve first 'n' results starting at row index 'i' meeting certain criteria:
Case 1) Search should start from index 'i' and then move downwards
Case 2) Search should start from index 'i' and then move upwards
Case 1) is pretty straight. How can case 2) be achieved ?

A: Case 1- Use OFF SET to get data from particular position.
Case 2- While for this you can start from 0 index till the ith index with LIMIT OR you can also use off set to start from particular index till the limit index.
Here are some links which may help you on LIMIT and OFF SET :
http://www.petefreitag.com/item/451.cfm
http://www.w3schools.com/php/php_mysql_select_limit.asp

A: To change direction - try orderBy(...)
In your case, you would need to order by 'id' with Asc or Desc values


text:
Q: install bs4 in pythonanywhere server I tried to install requests and beautiful soup module (bs4) in pythonanywhere server by this command:
pip3 install requests

but it got and error said: requirement already satisfied... and got an address to dist-package directory. I found requests package there but when I run my app and open my django website It gives an error said: no module named requests. on the other hand when I try to install bs4 using this command:
pip3 install bs4

It gives permission denied error. what should I do? how can I install a python package in pythonanywhere server.

I solved the error for bs4 by this article. but still when open the website it gives the error 'No module named requests'. when I try to install it on pythonanywhere server it gives a message that requests is installed. so what should I do for this? I found this answer that our problem is the same, but doesn't work for me.

A: You can use the --user flag, or use a virtualenv. See the PythonAnywhere help pages.
To check what packages are already installed on PythonAnywhere go here.
If you are having trouble with stuff being installed but not being able to import them, make sure you have pip installed them to the right python version (eg: pip3.5 install for python3.5), or if you have installed into a virtualenv, that you have activated/you are using that virtualenv when running the code.

A: PythonAnyWhere does not allow sudo access to the users so you can't install anything directly on the system. If you want to install something then you have to use a virtual environment then you can install anything in it. More information about creating a virtual env can be found here


text:
Q: Libreoffice 6.1 w/ ubuntu 18.04 - menu bar "file" "tools" "edit" etc. has disappeared I Upgraded from ubuntu 16.04 to 18.04 recently, and when I did the menubar for libreoffice disappeared.  I also noticed that the menubar for Google-chrome also disappeared. I know that the update from 16.04 --> 18.04 changed from unity to gnome so perhaps this is an issue where I am just unfamiliar with where to locate the menubar in gnome windows.  Any help is appreciated as I've had major loss of productivity since my upgrade.
EDIT: I just checked and it appears that while google-chrome and libreoffice are missing the menu, other applications like pinta have a menu within the application window.  See screenshots.
Here is the Pinta screengrab. notice the menu in window.

Here is the libreoffice screengrab.  Notice the lack of menu in window.

A: The themes were messed in my case.
I installed the package gnome-tweak-tool to get a handle into the "tweaks" application. Further I changed the appearance theme to one that restores sanity.
Further I installed the package gnome-themes-ubuntu.
$ sudo apt-get install gnome-tweak-tool
$ sudo apt-get install gnome-themes-ubuntu
$ tweaks


text:
Q: Pascal-Exitcode 201 I am new to coding and was trying to create a program that count and report back the amount of squares that the user input in Pascal, but it keeps resulting in an error called 'exitcode 201', and I can't find the source of the problem.
Here's my code:
Program Square_counter;
uses crt;
var Input: array[1..100] of Integer;
    Square: array[1..100] of Integer;
    a,i,n,z,c: integer;
    x: real;
begin
clrscr;
writeln('Hello. How many numbers would you like to input? : ');readln(n);
writeln('Input your numbers here: ');
for i:=1 to n do
 begin
  write('Input[',i,']= ');readln(Input[i]);
 end;
for i:=1 to n do
 begin
  x:=sqrt(Input[i]);
  if frac(x)=0 then
   begin
    Input[i]:=Square[z];
    z:=z+1;
   end;
 end;
writeln('Co ',z,' so chinh phuong. Do la: ');
   for c:=1 to z do
   begin
    writeln(Square[c]);
   end;
readln
end.

Ignore the write line.


text:
Q: Transmit compressed file as xml to an iPhone application
*

*How do I pass a zip file in xml format to an iPhone?

*How do I retrieve to the compressed file using objective C and xcode?

A: *

*Encode the zip's binary data (e.g. via Base64) and add to the XML data

*Transmit the XML to the iOS device (e.g. via ASIHTTPRequest)

*Parse the XML to retreive the encoded zip data (e.g. via NSXMLParser, or libxml2 etc.)

*Decode the encoded zip data (again, with the same encoding method, e.g. Base64)

*Use Apple's pre-built zip library to decompress the decoded data

A: What do you want to do.. Pass an zipped xml file or want to pass zipped data to an xml file?
Here is the library for packing/unpacking the zip files


text:
Q: recover filesystem from nuked hard drive OK, I'll admit it, it was a dumb thing to do.  I was using dd to copy a disk image onto an SD card for a Raspberry PI, but managed to copy the image onto /dev/sda instead of /dev/sdc.  Problem now is, of course, that I've nuked the entire MBR and directory structure of the hard drive. I've reconfigured with a new drive, and this time I've dual booted the thing and taken a copy of the MBR so that if the same thing happens again, it will only clobber windows.
What I want to know is, is there any way at all to recover the file system once the first few GB of the hard drive have been overwtitten? I can use photorec to recover the files, but I think what I have is more a large collection of file fragments.  I'd really like to recover the directory structure if I can.

A: In this case I'd simply retrieve all your files from your backups.  ;)
Overwriting the first few GB of a partition will have wiped out enough of the filesystem's structure that it is unlikely you will be able to retrieve file metadata in a meaningful way.
Now, since you did it to the entire drive (/dev/sda) it is possible that you have intact partitions that start after the part that you wiped, that could be 100% restored.  In this case you can run testdisk to search for the lost partitions and restore them to the partition table, then you should be able to read and write them as normal.
Most likely, however, you will have overwritten the start of a partition you really wanted, and you will be stuck using photorec which searches through what's left and finds non-fragmented files by their file signature.
One tip about how I use photorec: set it only to identify the file types you most want, and don't be afraid to run it multiple times with different/more file types selected each time.  This may decrease the chances that something will be mis-identified (some files may identify as more than one type).  I don't know how effective that actually is, but I do it.  My most frequent reason for using photorec is when someone I know has a corrupted, or accidentally formatted, memory card for their camera, or something, so I narrow down the file types it's looking for to just JPEG/M2TS/MOV or whatever types of files the camera takes.


text:
Q: Not able to parse JSON into a recyclerview enter image description here This is what I am getting with the help Sultan Mahmud help(he has posted below in the comment) . But from the code posted here I just get blank layout
This is what I want
enter image description here
I am trying to read the data from the JSON and parse them in android layout. The basic idea of this overall is I am trying to group the items by date. This means all the events occurred during that particular date is listed below it and that date is listed as a header.
I also added the print statement inside JSON method to see whether the objects are added to it or not. And it turns out the object is added to the list. There might be some issue of setting the adapter or the way to call the adapter in JSON. Not sure though
For this, I got the help from this post
Divide elements on groups in RecyclerView or Grouping Recyclerview items ,say by date
I tried it with dummy data and it works fine. But when I read it from JSON file and trying to adopt in android I might have done some mistake.
What I am doing is parseJSOn method is creating the object and adding into the ArrayList. And that ArrayList is passed into the hashmap? Is this the way to do? I have seen lots of tutorials posted about JSON parsing, but haven't really got the idea how to do when there are multiple view types in my case header and events
Also, Can anyone help me how to implement onclick listener recycler view in my case? (In most of the case model is passed as reference for getting the position. so what would be in mine case?
I have posted the code with an explanation. Any help is appreciated
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.widget.Adapter;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;

import static java.util.stream.Collectors.toMap;

public class MainActivity extends AppCompatActivity {

    @NonNull
    private List<StreamItem> myOptions = new ArrayList<>();

    /*
     In this we have collection of list of header and Event it means for each date
     list of events are added. I have two layout of them one of header and one for event.

     */
    List<ListItem> consolidatedList = new ArrayList<>();

    private RecyclerView mRecyclerView;
    private StreamArrayAdapter adapter;

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

        mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        mRecyclerView.setHasFixedSize(true);

        /*
        what I am doing is I am calling the parsJSON method what it does is it create the object for my model and add them in list
         */

        parseJSON();

        /*
        This the dummy data I tried it word as fine and group the datas by date
         */

       /* myOptions.add(new StreamItem("name 1", "2016-06-21"));
        myOptions.add(new StreamItem("name 2", "2016-06-05"));
        myOptions.add(new StreamItem("name 2", "2016-06-05"));
        myOptions.add(new StreamItem("name 3", "2016-05-17"));
        myOptions.add(new StreamItem("name 3", "2016-05-17"));
        myOptions.add(new StreamItem("name 3", "2016-05-17"));
        myOptions.add(new StreamItem("name 3", "2016-05-17"));
        myOptions.add(new StreamItem("name 2", "2016-06-05"));
        myOptions.add(new StreamItem("name 3", "2016-05-17"));*/

        HashMap<String, List<StreamItem>> groupedHashMap = groupDataIntoHashMap(myOptions);

        for (String date : groupedHashMap.keySet()) {
            HeaderItem dateItem = new HeaderItem();
            dateItem.setDate(date);
            consolidatedList.add(dateItem);

            for (StreamItem pojoOfJsonArray : groupedHashMap.get(date)) {
                EventItem generalItem = new EventItem();
                generalItem.setStreamItem(pojoOfJsonArray);//setBookingDataTabs(bookingDataTabs);
                consolidatedList.add(generalItem);
            }
        }

        adapter = new StreamArrayAdapter(this, consolidatedList);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(layoutManager);
        mRecyclerView.setAdapter(adapter);

    }

    private HashMap<String, List<StreamItem>> groupDataIntoHashMap(List<StreamItem> listOfPojosOfJsonArray) {

        HashMap<String, List<StreamItem>> groupedHashMap = new HashMap<>();

        for (StreamItem pojoOfJsonArray : listOfPojosOfJsonArray) {

            String hashMapKey = pojoOfJsonArray.getDate();

            if (groupedHashMap.containsKey(hashMapKey)) {
                // The key is already in the HashMap; add the pojo object
                // against the existing key.
                groupedHashMap.get(hashMapKey).add(pojoOfJsonArray);
            } else {
                // The key is not there in the HashMap; create a new key-value pair
                List<StreamItem> list = new ArrayList<>();
                list.add(pojoOfJsonArray);
                groupedHashMap.put(hashMapKey, list);
            }
        }

        return groupedHashMap;
    }

        private void parseJSON() {
            final List<StreamItem> events = new ArrayList<>();

            String url = "https://netsync.unl.edu/feeds/apps/capitol_live/";

            JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(url, new Response.Listener<JSONArray>() {

                @Override
                public void onResponse(JSONArray response) {

                    for (int i = 0; i < response.length(); i++) {

                        try {
                            JSONObject e = response.getJSONObject(i);
                            String date = e.getString("streamStart");

                            String des = e.getString("desc");

                            String image = e.getString("imgName");
                            String title = e.getString("category");

                            StreamItem str = new StreamItem(date, title, des, image);

                            myOptions.add(str);

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

                    }

                    adapter.notifyDataSetChanged();

                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {

                    Log.e("Volley", error.toString());

                }
            });

            RequestQueue requestQueue = Volley.newRequestQueue(this);
            requestQueue.add(jsonArrayRequest);

    }
}

enter code here

This is my data model POJO
public class StreamItem {

    public String date;
    public String title;
    public String desc;
    public String image;
    public String url;

 public StreamItem(String date , String title , String desc , String image , String url) {
        this.date = date;
        this.title = title;
        this.desc = desc;
        this.image = image;
        this.url = url;
    }

  public String getUrl(){
      return url;

    }

    public void setUrl(String url){
      this.url = url;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

}

A: You are getting data in an asynchronous way but you are setting data in recyclerview as a synchronous way that's why the list is empty. Follow the given strategy:
Replace adapter.notifyDataSetChanged() to update() method and remove all code after parseJSON(); method.
private void update(){

    HashMap<String, List<StreamItem>> groupedHashMap = groupDataIntoHashMap(myOptions);

            for (String date : groupedHashMap.keySet()) {
                HeaderItem dateItem = new HeaderItem();
                dateItem.setDate(date);
                consolidatedList.add(dateItem);

                for (StreamItem pojoOfJsonArray : groupedHashMap.get(date)) {
                    EventItem generalItem = new EventItem();
                    generalItem.setStreamItem(pojoOfJsonArray);//setBookingDataTabs(bookingDataTabs);
                    consolidatedList.add(generalItem);
                }
            }

            adapter = new StreamArrayAdapter(this, consolidatedList);
            LinearLayoutManager layoutManager = new LinearLayoutManager(this);
            layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            mRecyclerView.setLayoutManager(layoutManager);
            mRecyclerView.setAdapter(adapter);}


text:
Q: TimeoutException: Message: import os
from selenium import webdriver
import time
from linkedin_scraper import actions
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--headless")

driver = webdriver.Chrome("driver/chromedriver", options=chrome_options)
email = os.getenv("LINKEDIN_USER")
password = os.getenv("LINKEDIN_PASSWORD")

actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
driver.get('https://www.linkedin.com/company/biorasi-llc/about/')

_ = WebDriverWait(driver, 3).until(EC.presence_of_all_elements_located((By.TAG_NAME, 'section')))

time.sleep(3)
grid = driver.find_elements_by_tag_name("section")[3]
about_us = grid.find_elements_by_tag_name("p")[0].text.strip()

print(about_us)

This is my code for scraping about_us data of a company and it works but sometimes I get an error like:
TimeoutException                          Traceback (most recent call last)
 in
 17 email = os.getenv("LINKEDIN_USER")
 18 password = os.getenv("LINKEDIN_PASSWORD")

---> 19 actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
 20 driver.get('https://www.linkedin.com/company/biorasi-llc/about/')
 21 _ = WebDriverWait(driver, 3).until(EC.presence_of_all_elements_located((By.TAG_NAME, 'section')))

~\Anaconda3\lib\site-packages\linkedin_scraper\actions.py in login(driver, email, password)
 28   password_elem.submit()
 29

---> 30   element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "profile-nav-item")))
~\Anaconda3\lib\site-packages\selenium\webdriver\support\wait.py in until(self, method, message)
 78             if time.time() > end_time:
 79                 break

---> 80         raise TimeoutException(message, screen, stacktrace)
81
82     def until_not(self, method, message=''):
TimeoutException: Message:
Someone, please help how to solve this.

A: Probably because your timeout is too short (3 seconds) so before the page is fully loaded, it reaches timeout threshold. Try raising it to 5-10 seconds in line 21.
TIMEOUT = 10
 _ = WebDriverWait(driver, TIMEOUT).until(EC.presence_of_all_elements_located((By.TAG_NAME, 'section')))

Here's some tips to improve your code:

*

*You're already using fluent wait (WebDriverWait), try to minimize using time.sleep if possible. WebDriverWait will stop waiting & return your element, so time will be saved.

*Finding element via tag name & locate it by ordinal (in this case, 4th section tag) is a bad idea. Will break if the site adds more section. Try using better XPATH, here's my code, I have not tested but I think it will work just fine.

import os
from selenium import webdriver
import time
from linkedin_scraper import actions
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--headless")

driver = webdriver.Chrome("driver/chromedriver", options=chrome_options)
email = os.getenv("LINKEDIN_USER")
password = os.getenv("LINKEDIN_PASSWORD")

actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
driver.get('https://www.linkedin.com/company/biorasi-llc/about/')

# directly finds paragraph, removed time.sleep
paragraph_elem = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, '//section//h4/..//p')))
about_us = paragraph_elem.text.strip()

print(about_us)


text:
Q: How to recognized different combination of input speech text for given Grammar in vb.net I have below code to recognize the given input speech.
Public speechRecognitionEngine As SpeechRecognitionEngine
Private Sub SpeechRecog()
        Try
            speechRecognitionEngine = New SpeechRecognitionEngine(SpeechRecognitionEngine.InstalledRecognizers()(0))
            AddHandler speechRecognitionEngine.SpeechRecognized, AddressOf engine_SpeechRecognized
            Dim texts As Choices = New Choices()
            texts.Add("HOW")
            texts.Add("ARE")
            texts.Add("YOU")
            Dim wordsList As Grammar = New Grammar(New GrammarBuilder(texts))
            speechRecognitionEngine.LoadGrammar(wordsList)

            speechRecognitionEngine.SetInputToDefaultAudioDevice()
            speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Voice recognition failed")
        End Try
    End Sub

' Event for speech recognision
Public Sub engine_SpeechRecognized(sender As Object, e As SpeechRecognizedEventArgs)
      usrText.Text = e.Result.Text
End Sub

for above code It is recognising the below Speech texts

*

*HOW

*ARE

*YOU

but how can recognize below combination out of given GRAMMAR

*

*HOW ARE

*HOW ARE YOU

*YOU ARE HOW

*ARE YOU HOW

*ARE HOW YOU

*YOU HOW ARE

*HOW YOU ARE

Is it possible to recognize the above speech input using same grammar?
Thank in Advance


text:
Q: App Crash when reading from Firebase realtime database I want to read all the elements from my Firebase realtime database (which I fill by import a .json file (not filled using my app). So I have tried a lot of other solutions but they didn't work. Here is my real time database:
Real time database structure
Here is how i read the data in main activity:
 public  final  ArrayList<Parking> parkingArrayList=new ArrayList<Parking>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FirebaseDatabase firebaseDatabase=FirebaseDatabase.getInstance();
    firebaseDatabase.setPersistenceEnabled(true);
    DatabaseReference databaseReference=firebaseDatabase.getReference();
    databaseReference.child("Parking").addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
           for(DataSnapshot dataSnapshot1:dataSnapshot.getChildren()){
            Parking p=dataSnapshot1.getValue(Parking.class);
           }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

Here is my Parking class:
public class  Parking implements  Comparable<Parking>,Parcelable {
public  String name;
public  String zone;
public String location;
public int capacity;
public double latitude;
public double longtitude;
int free=0;
int taken=0;
int id;
public  Parking(){
}
public Parking(int capacity,double latitude,String location, double longtitude,String name,String zone){
    this.capacity=capacity;
    this.location=location;
    this.name=name;
    this.zone=zone;
    this.latitude=latitude;
    this.longtitude=longtitude;
    this.taken=getTaken();
    this.free=getFree();
}

protected Parking(Parcel in) {
    name = in.readString();
    zone = in.readString();
    location = in.readString();
    capacity = in.readInt();
    latitude = in.readDouble();
    longtitude = in.readDouble();
    free = in.readInt();
    taken = in.readInt();
}

public static final Creator<Parking> CREATOR = new Creator<Parking>() {
    @Override
    public Parking createFromParcel(Parcel in) {
        return new Parking(in);
    }

    @Override
    public Parking[] newArray(int size) {
        return new Parking[size];
    }
};

public int getCapacity() {
    return capacity;
}

public int getFree() {
    return capacity-getTaken();
}

public int getTaken() {
    Random random=new Random();
    this.taken=random.nextInt(capacity+1);
    return  taken;
}

public  void  setFree(int taken){
    free=capacity-taken;
}
public void setTaken(int taken) {
    Random random=new Random();
    this.taken=random.nextInt(capacity+1);
}
public  double getLatitude(){
    return  latitude;
}
public  double getLongtidue(){
    return  longtitude;
}

@Override
public String toString() {
    return String.format("%s\t\tZone: %s\nlocation: %s\nCapacity: %d\t\tFree: %d",name,zone,location,capacity,getFree());
}

@Override
public int compareTo(@NonNull Parking parking) {
    return Integer.compare(parking.free,this.free);
}

@Override
public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel parcel, int i) {
    parcel.writeInt(capacity);
    parcel.writeDouble(latitude);
    parcel.writeString(location);
    parcel.writeDouble(longtitude);
    parcel.writeString(name);
    parcel.writeString(zone);
   parcel.writeInt(getTaken());
    parcel.writeInt(getFree());
}

}
I have connected it with Firebase, install the google-services.json file (by using the firebase tool) but when i start the app it crashes("Unfortunately,najdiparking (my app name) has stopped) . When i fill the list manually (without reading from database) the application works.
This is the dependencies 'com.google.firebase:firebase-database:10.0.1.
I also check my .json file names with the names in the class.
my logcat (i hope this will help you)

    08-27 15:41:31.884 19384-19384/com.example.simeon.najdiparking E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: com.example.simeon.najdiparking, PID: 19384
                                                                                java.lang.NoSuchMethodError: No virtual method zzTt()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.simeon.najdiparking-1/split_lib_dependencies_apk.apk:classes20.dex)
                                                                                at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
                                                                                at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
                                                                                at com.example.simeon.najdiparking.MainActivity.onCreate(MainActivity.java:48)
                                                                                at android.app.Activity.performCreate(Activity.java:6237)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

A: You have to read from parcel in thesame order  you wrote  to it.


text:
Q: MySQL query: return rows where field is made of characters from the given php string I am looking for a mysql query which will return me all the rows,
where a particular field is made up of characters from a given string.
e.g. I 've this string: $input = 'abcdef';
now, I am looking for mysql to result all those rows, where e.g. 'name' consists of letters from $input.
I hope I have expressed myself clearly.. :)
EDIT: Also, for the query you suggest, will it really improve performance, if we are just searching for strings made of letters a-z instead of some patterns, esp. when we are requesting data every 2 seconds.
The thing is that for now, my requirements are to only search among numeric, alpha or alphanumeric formats.. I will be using the exclusive patterns later on.
Regards
Nikhil Gupta

A: $query = "SELECT * FROM table WHERE `name` REGEXP '[" . mysql_real_escape_string($input) . "]'";

But this query is really weird and will be very slow (depends on how many rows you have).

A: SELECT `name` FROM `table` WHERE `name` REGEXP '^[abcdef]*$'

See MySQL: Regular expressions.


text:
Q: How to build and run in vscode Previously I was using Visual Studio, and now I'm trying to use vscode. Overall I love it, but there are a few functionalities from Visual Studio which I'm missing. Maybe the most important one is a combination of build and run. In Visual Studio when I pressed F5 to run my c++ project, it was performing a build if there were modified files in the project. I can't find that here, I have to manually do a build, then run. Am I missing something?
Thanks in advance


text:
Q: Error with xlsx file in android studio using Apache poi With what that error can be connected: org.apache.poi.ooxml.POIXMLException: error: The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled. ?
I'm just trying to understand to how can I work with Excel file and that error stuck me so much.
In my Excel sheet I have one row and 2 columns, in the first column - some number, in the second - some text.
My MainActivity and implementation's code below.
MainActivity:
public class MainActivity extends AppCompatActivity{
    TextView TextView;
    private static final String TAG = "myLogs";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView = findViewById(R.id.textView3);
        TextView.setText("SomeText");

        try {

            AssetManager am=getAssets();
            InputStream is=am.open("MyTest.xlsx");
            XSSFWorkbook book = new XSSFWorkbook(is);
            XSSFSheet mySheet = book.getSheet("0");
            XSSFRow row = mySheet.getRow(0);

            if(row.getCell(0).getCellType() == CellType.STRING){
                String name = row.getCell(0).getStringCellValue();
                Log.d(TAG,"/////////////////////////////////////////////////////////////////////////////////////name : " + name);
            }
            if(row.getCell(0).getCellType() == CellType.NUMERIC){
                double date = row.getCell(0).getNumericCellValue();
                Log.d(TAG,"/////////////////////////////////////////////////////////////////////////////////////date : : " + date);
            }

            book.close();
            TextView.setText("SomeText after all");

        } catch(Exception ex) {
            Log.d(TAG, "Loooooooooooooooooooooooooooooooooooooooooooooooooooooolg "+String.valueOf(ex));
            return;
        }
    }
}

Implementation's:
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation files('libs\\commons-codec-1.15.jar')
implementation files('libs\\commons-compress-1.21.jar')
implementation files('libs\\commons-logging-1.2.jar')
implementation files('libs\\curvesapi-1.06.jar')
implementation files('libs\\poi-5.1.0.jar')
implementation files('libs\\poi-ooxml-5.1.0.jar')

implementation files('libs\\slf4j-api-1.7.32.jar')
implementation files('libs\\xmlbeans-5.0.2.jar')
implementation files('libs\\log4j-api-2.14.1.jar')
implementation files('libs\\commons-io-2.11.0.jar')
implementation files('libs\\commons-math3-3.6.1.jar')
implementation files('libs\\poi-ooxml-lite-5.1.0.jar')

testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

A: download and integrate into your project
https://github.com/centic9/poi-on-android/releases


text:
Q: Transfer data from arrayfire arrays to armadillo structures I would like to replace some of my calculations formerly written with armadillo with ArrayFire, in order to use some GPU capabilities. I do not want to replace everything, just the time-critical spots. Thus I need to convert armadillo-structures into arrayfire-structures and back. The first step is easy:
arma::colvec A_arma(5, arma::fill::ones);
af::array A_array(5, A_arma.memptr());//Done

Going back is more difficult. How do I get the data from the arrayfire-structure into the armadillo-structure? I can iterate over all elements and write them into the armadillo structure, but that would take a lot of time. Are there easier ways?

A: You can copy the data out of an af::array using the host member function. For example, you can copy the data from an ArrayFire array to a std::vector like this:
af::array gpu_data = af::randu(10, 10);
vector<float> cpu_data(gpu_data.elements());

gpu_data.host<float>(cpu_data.data());

This will copy the data in column major order to the cpu_data vector.
I am not too familiar with armadillo's data structure but I am sure you can pass the pointer returned by the memptr to the host function and the data will be copied into it.

A: You can convert directly to an Armadillo structure with the ArrayFire array's host pointer.
size_t nrows = 10;
size_t ncols = 10;

af::array af = af::constant(0, nrows, ncols); // defaults to dtype=f32
float* host_ptr = af.host<double>();
arma::fmat arma(host_ptr, nrows, ncols);

Notice that the types and sizes need to match. In the above case, single precision floating point type was used. For double precision, you would have to change to the following.
af::array af = af::constant(0, nrows, ncols, f64); // specify dtype=f64
double* host_ptr = af.host<double>();
arma::mat arma(host_ptr, nrows, ncols);

For complex vectors its a bit more complicated. Armadillo uses std::complex while ArrayFire uses a different data structure under the hood. These should be compatible (verify for your system) so using a reinterpret_cast should do the trick.
af::cfloat* host_ptr = img_af.host<af::cfloat>(); // Assuming dtype=c32
arma::cx_fmat arma(reinterpret_cast<std::complex<float>*>(host_ptr), nrows, ncols);

Last but not least, be sure to free the host pointer or you will have a memory leak!
af::freeHost(host_ptr);


text:
Q: Are IP addresses with and without leading zeroes the same? I have a security system and the network setting only allows a three-digit IP address. I can't set it to 192.168.2.100, instead I have to use 192.168.002.100.
Are these two IP addresses different? Do I need to set my router's LAN to be all 192.168.xxx.xxx in order for this to work correctly? I can't find any solid information about this.

A: Assuming all software you are using is using dot-decimal and subnetting correctly, yes they are the same.
192.168.0.1 for example is only the friendly dot-decimal notation of the dot-binary value 11000000.10101000.00000000.00000001.
Whether you type it as 192.168.0.1 or 192.168.000.001 they are both equal to 11000000.10101000.00000000.00000001

A: Some implementations consider octets with leading zeros to be decimal other implementations consider them to be octal. As long as the octet is in the range from 0 to 7, this does not make a difference. So for example would 192.168.002.100 be interpreted as 192.168.2.100 in both implementations.
But if you were to type in an address as 192.168.010.100 it could be interpreted as either 192.168.10.100 or 192.168.8.100 depending on the implementation. It is also not unlikely that implementations do exists, which would consider leading zeros to be a syntax error. Additionally, there are scenarios in which software may insist that you have to use the canonical representation for one reason or another. For all of those reasons, I recommend on avoiding leading zeros when you write an IP address.
If you write software that need to parse an IP address, I would recommend accepting leading zeros, but output a warning to an appropriate location when it happens.
Slightly related there are implementations which allow you to have fewer than four components in the dotted notation. When there are fewer than four components the last component has more than 8 bits and the earlier components have exactly 8 bits. For example 192.168.612 would actually be a valid way to write 192.168.2.100. But again using that notation is not recommended.

A: It depends on the tools or functions any given program uses to parse the address given. Both Microsoft and Linux as well as other OSes use a POSIX compatible inet_addr() routine for parsing addresses.

Many TCP/IP programs such as Ping and FTP use the inet_addr() sockets function to translate IP address strings into 4-byte addresses. This function accepts an IP address in standard decimal, octal, and hexadecimal notation.  Microsoft KB115388 Ping and FTP Resolve IP Address with Leading Zero as Octal

The inet_addr() function converts the Internet host address cp from IPv4 numbers-and-dots notation into binary data in network byte order.
In all of the above forms, components of the dotted address can be specified in decimal, octal (with a leading 0), or hexadecimal, with a leading 0X). Addresses in any of these forms are collectively termed IPv4 numbers-and-dots notation. The form that uses exactly four decimal numbers is referred to as IPv4 dotted-decimal notation (or sometimes: IPv4 dotted-quad notation).inet_addr(3): Internet address change routines - Linux man page

As such, your specific system might require three-digit decimal notation for each octet, but this is not universal, and care should be taken to ensure the proper IP address is entered.
Of course, only valid numbers for each type will work. Out of range Octal, Hex or Decimal numbers will also fail or cause issues. Octal 088, Hex 0xGG, or Decimal 280 are all invalid examples.

A: As Lightness Races in Orbit and others have pointed out,
The INET(3) man page describes inet_addr and inet_aton, the standard functions used for converting the "IPv4 numbers-and-dots notation into binary form". It says

...components of the dotted address can be specified in decimal, octal (with a leading 0), or  hexadecimal,  with  a leading 0X).

So technically, NO, an IP address with leading zeros is not (always) the same as one without leading zeros.  In your case however, 192.168.2.100 and 192.168.002.100 are identical, because 002 == 2.
Any user interface which requires each component to be exactly three characters in length, with incorrectly-required leading zeros is broken.

A: It depends on the tool.
For most purposes the two will be the same, but not always.
For example, if you use a number starting with a zero, then ping will assume the number is octal.
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users>ping 011.012.013.014

Pinging 9.10.11.12 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 9.10.11.12:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

A: Just a little tip:
In some cases it is important to use zero prefixes in the IP addresses. An example, is Apache .htaccess deny rules.
If you use something like
deny from 11.22.33.22

Apache is so stupid that will also block access from the following IPs:
111.22.33.22
11.22.33.221
211.22.33.221
and in general, any IP address which includes 11.22.33.22
So, just to be sure that you will not block any IPs that you didn't mean to block, you should use:
deny from 011.022.033.022

to be sure that Apache will block access only from the 11.22.33.22 IP address.

A: be careful with this. it SHOULD be the same but it is NOT!
i couldn't find an explanation for this but i can definetly tell that on windows and linux ip addresses with and without leading zeroes are NOT the same! maybe this has to do with converting from other formats like hex or binary.
from my experience with windows and linux it is not tool dependend but os dependend it seems because im running in some problem using ips like 10.08.03.100:

*

*note: "10.08.0.1" and 10.09.0.1 could not be found

*note: "10.010.0.1" is resolved to 10.8.0.1

linux/debian7/8: same results with tool "ping" and "snmpget"
user@test:~$ ping 10.7.0.1
PING 10.7.0.1 (10.7.0.1) 56(84) bytes of data.
^C
--- 10.7.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

user@test:~$ ping 10.07.0.1
PING 10.07.0.1 (10.7.0.1) 56(84) bytes of data.
^C
--- 10.07.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

user@test:~$ ping 10.8.0.1
PING 10.8.0.1 (10.8.0.1) 56(84) bytes of data.
^C
--- 10.8.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

user@test:~$ ping 10.08.0.1
**ping: unknown host 10.08.0.1**
user@test:~$ ping 10.9.0.1
PING 10.9.0.1 (10.9.0.1) 56(84) bytes of data.
^C
--- 10.9.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

user@test:~$ ping 10.09.0.1
ping: unknown host 10.09.0.1
user@test:~$ ping 10.10.0.1
PING 10.10.0.1 (10.10.0.1) 56(84) bytes of data.
^C
--- 10.10.0.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

user@test:~$ ping 10.010.0.1
PING 10.010.0.1 (10.8.0.1) 56(84) bytes of data.
^C
--- 10.010.0.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1001ms

windows7/8/10: same results with tool "ping" and "telnet"
(sorry, i dont have an english windows at hand, error tells that host could not be found)
C:\Users\user>ping 10.7.0.1

Ping wird ausgeführt für 10.7.0.1 mit 32 Bytes Daten:
STRG-C
^C
C:\Users\user>ping 10.07.0.1

Ping wird ausgeführt für 10.7.0.1 mit 32 Bytes Daten:
STRG-C
^C
C:\Users\user>ping 10.8.0.1

Ping wird ausgeführt für 10.8.0.1 mit 32 Bytes Daten:
STRG-C
^C
C:\Users\user>ping 10.08.0.1
Ping-Anforderung konnte Host "10.08.0.1" nicht finden. Überprüfen Sie den Namen,

C:\Users\user>ping 10.9.0.1

Ping wird ausgeführt für 10.9.0.1 mit 32 Bytes Daten:
STRG-C
^C
C:\Users\user>ping 10.09.0.1
Ping-Anforderung konnte Host "10.09.0.1" nicht finden. Überprüfen Sie den Namen,

C:\Users\user>ping 10.10.0.1

Ping wird ausgeführt für 10.10.0.1 mit 32 Bytes Daten:
STRG-C
^C
C:\Users\user>ping 10.010.0.1

Ping wird ausgeführt für 10.8.0.1 mit 32 Bytes Daten:
STRG-C
^C

A: It should work either way. You can even ping with three-digit numbers and the computer will understand the IP address.
Edit: windows will read it as octal, this only work for Linux.

A: The two IP addresses are different.
However:

*

*People would generally consider them the same.

*Some software would consider them the same.

*Some software, on some platforms, will consider them different.

If that sounds confusing, it's because there is no standard governing the way IP addresses are supposed to be written, so different programmers at different points in history, and on different platforms, all had different ideas on what should be done.
IP addresses are actually binary, and people tend to use a dotted decimal notation to represent IP addresses.  Software can accept various numerical bases (ie decimal, octal, hex) and interpret things various ways based on how you write it.  How you write it can tell the software what base you are writing in.
I advise you: do not use leading zeros if you mean to use dotted decimal notation.  Some software will consider that a flag to mean that you are entering an octal number.  If you mean to enter in a decimal number, you will not get the results that you expect.
I asked a similar question and got some good responses, so if you want to go read up on RFC's, there's good info to be had there.

A: The leading zero is meaningless. The octets are (base-10) 0-255 numbers, not strings.
Since I'm not exactly sure what you're asking (or that you know what question to ask :)):
That said, the IP # must be in the same subnet as your network. If you pick 11.12.13.14 within a subnetmask of 192.168.0.0, that device will not be able to talk to or use that subnet.


text:
Q: How to bulk insert data in a table using Rails and a single insert statement I have the following ActiveRecord models, Widget, Merchant, Store, StoresWidget (many-to-many association)
class Merchant < ActiveRecord::Base
  has_many :stores
  has_many :widgets
end

class Widget < ActiveRecord::Base
  has_many :stores_widgets
  has_many :stores, :through => :stores_widgets
  belongs_to :merchant
end

class Store < ActiveRecord::Base
  has_many :stores_widgets
  has_many :widgets, :through => :stores_widgets
  belongs_to :merchant
end

class StoresWidget < ActiveRecord::Base
  belongs_to :widget
  belongs_to :store
end

So the corresponding tables are widgets, merchants, stores and stores_widgets, where widgets and stores each has a id column and stores_widgets has two columns store_id and widget_id. A Widget can be available in 1 or more stores and a store can have many widgets available. Some widgets are available in all stores some are only available in a sub-set of stores. If a Widget is restricted to a subset of stores, the column restricted is true
When a new store is added to a merchant I want to update all the unrestricted widgets to be associated with that store. Ideally I would like to have code like this in my StoresController#create
class StoresController < ApplicationController
  def create
    # build new store...
    Store.transaction do
      store.save!
      Widget.update_all_unrestricted_widgets_with_store(store)
    end
    render :show
  end
end

Where update_all_unrestricted_widgets_with_store ends up executing SQL like:
INSERT INTO stores_widgets (store_id, widget_id)
(SELECT #{store.id}, widgets.id
 FROM widgets
 WHERE widgets.merchant_id = #{store.merchant_id}
 AND widgets.restricted = FALSE)

So if a merchant has 100000 widgets that are unrestricted a 100000 new stores_widgets rows are created in one INSERT rather than 100000 distinct INSERTS.
Preferably I would like to get ActiveRecord to build an insert like this. Is that possible? If not would I be able to do this with ARel? I want to avoid executing a SQL string to achieve this if possible, so that I can maintain a level if separation between the code and the database SQL syntax.

A: You can use activerecord-import implements AR#import
activerecord-import is a library for bulk inserting data using ActiveRecord.
see how it works:
books = []
10.times do |i|
  books << Book.new(:name => "book #{i}")
end
Book.import books

Reference - https://github.com/zdennis/activerecord-import


text:
Q: Program doesn't get continue when i take string (yes or no) at the place of character(y or n) Program executed successfully but it doesn't continue. Please help.
It works when I take y or n as character.
#include <stdio.h>
#include <conio.h>
int main()
{
    int a[20], n, i, sum = 0;
    char c[10];
    clrscr();
    do
    {
        printf("How many numbers you want to sum: ");
        scanf("%d", &n);
        for (i = 0; i < n; i++)
        {
            printf("\nwrite the number: ");
            scanf("%d", &a[i]);
            sum = sum + a[i];
        }
        printf("\nSum of numbers are %d", sum);

        printf("\nDo you want to continue. yes or no:  ");
        scanf("%s", c);
    } while (c == "yes");
    if (c == "no")
        printf("\nThanking You");
    else
        printf("\nWrong choice selected. Please select correct one");

    return 0;
    getch();
}

The error is shown below.
How many numbers you want to sum: 3
write the number: 1
write the number: 2
write the number: 3
Sum of numbers are 6
Do you want to continue. yes or no:  yes
Wrong choice selected. Please select correct one
[Program finished]


text:
Q: Float awkward situation I have 3 div elements on a page with the float attribute set to left.
I add another div element without any styles but it's arranged like the ones I told you about above. Why ? I can't understand this.
Thank you
CODE:

   test first

  test second

   test third

  test fourth

A: The last div needs to clear the floats.
HTML

text

text

text

text

CSS
.left { float: left; }
.clear-left { clear: left; }

JSFIDDLE


text:
Q: Python Selenium: hover over 'div' with 'onmouseover' Webpage View

Webpage HTML Snippet

Problem
I'm trying to use Python and Selenium to scrape this web site where the submenu shows after the mouse goes over the "Dossiê" menu.
Attempt
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Chrome()
action = ActionChains(browser)
(...)
action.move_to_element(browser.find_element_by_id('menuItem1')).perform()

When this code is run, a NoSuchElementException is raised. The element is found, but the move_to_element call doesn't show the submenu.


text:
Q: HHVM readfile($url) always writes to buffer - Bug? It seems like that HHVM always wants to buffer the file before sending it to the client.
I use readfile() with an URL, that works fine on servers without HHVM but not with HHVM.
I want to offer the file (from the external URL) as a downoad to the client but without buffering it. I've tried that since hours but can't get it to work, no matter which headers I set. Is this a bug?
And before you ask, there is no code needed to answer such a question in my oppinion.


text:
Q: Ошибка SQL запроса select *
from stack.[Список объектов]so
join stack.[Показания счетчиков]po
  on stack.[Лицевые счета].ROW_ID = so.[Объекты-Счет]
and so.[ДатНач] <= '01.11.11'
and so.[ДатКнц] > '01.11.11'
and po.[Объект-Показания] = so.row_id
order by so.[Объекты-Счет]

выдает ошибку:

Msg 4104, Level 16, State 1, Line 1
  The multi-part identifier "stack.Лицевые счета.ROW_ID" could not be bound.

A: Что у Вас обозначает stack - имя базы данных? (каталога)
1) Если вы задаете имена объектов с указанием имени каталога, то необходимо задавать также и имя схемы. получится что-то вроде
select *
from stack.dbo.[Список объектов] so

и т.д.
2) Вы объединяете stack.dbo.[Список объектов] и stack.[Показания счетчиков] а в условии объединения ссылаетесь на  какие то stack.[Лицевые счета], so.[Объекты-Счет] и т.д.
Дайте структуру таблиц, у Вас явно какая то путаница в понятиях


text:
Q: how can I enable "higher elevation" in windows 7? each time I try to save a file from Open Office or any program like it, I get requires higher elevation. I have tried to search for the file but nothing comes up and I not knowledgeable enough to know how to activate this function. I really need a step by step simple explanation of how to find it and activate it--from what I have read it has something to do with Vista? I am using windows 7 pro 64 bit and IE 11 on an acer laptop. Sure hope someone can help me out or even recommend a reputable alternative to Open office I can download where this feature doesn't come into play.

A: You can start any program in administrator mode.
Right click on it and select run as administrator. That is the higher elevation in windows 7.


text:
Q: How to keep the correct selection in form with dynamically changing options? I have the following problem.  I've made a form which change the form elements dynamically depending on the option it's selected. Here is short example:
<select name="vehicle" id="vehicle" onchange="$('#div').load('data.php?vehicle='+this.value);">
      <option value="1"> motorcycle</option>
      <option value="2">buss</option>
      <option value="3"> truck </option>
      <option value="4">. . .</option>
</select>
<div id="div">
<select name="moto_type" id="moto_type">
      <option value="1">Ducati</option>
      <option value="2">Yamaha</option>
      <option value="3">Kawasaki</option>
      <option value="4">. . . </option>
</select>
</div>

When buss is selected from the dropdown menu the content of #div is substituted with options available for busses, such as:
<select name="bus_type" id="bus_type">
       <option value="1">A-type</option>
       <option value="2">B-type</option>
       <option value="3">C-type</option>
       <option value="4">. . .</option>
</select>
<select name="bus_seats" id="bus_seats">
       <option value="1">10</option>
       <option value="2">20</option>
       <option value="3">50</option>
       <option value="4">. . .</option>
</select>

Identically all other options change depending on what is selected in that first dropdown menu.  After the form is submitted the results are processed and table of results shown. However if the user hits the edit button to go back and edit their choice, the choice in the first dropdown menu is saved (let's say bus) but the dropdown menus for option bus #2 (buss_type and bus_seats) in #div are replaced with the options for motorcycle #1 (moto_type) which is not correct. I understand why that is happening, what I can't find out is how to show the user their correct form selection. How to show the correct sub options for each value in the main dropdown menu when the user comes back to the form to edit it?
Any help is appreciated!
Additional question:
How do you keep the correct selections in the secondary drop down menus, so they don't switch back to the default value="1"?

A: Don't use inline event handlers, they can only cause you headaches... They are not flexible and don't let you separate your semantic markup and behaviour.
Instead, do something like this (you can put this in a script tag just before body, preferably in a separate file with all your other JS):
$(document).ready(function () {

  $('#vehicle').change(function () {
    $('#div').load('data.php?vehicle='+$(this).val());
  }).change();

});

Notice that you attach the change event handler, and immediately after that you also call it. That ensures that it will load on page load and onchange either.

A: Also check when the form is initially loaded, not just onchange of the drop down.
i have something similar in asp with dynamically shown divs. I have a function that does the work and I call the function both for the onchange AND when the form initially loads.


text:
Q: JavaScript change for-loop condition while looping (No JQuery) I have a code that looks kinda like this.
And what i want to achive is to change the for loop codition if the div that is checked has child divs.
var condition = divs.querySelectorAll('div');
for(i = 0; i < condition.length; i++){
    if(condition[i].querySelectorAll('div').length > 0){
         condition = condition[i].querySelectorAll('div');
         i = 0;
    }else{
         // Last div reached.
         break;
    }
}

Does anyone out there know how to achive this effect.
Do i have to use an other type of loop?
EDIT:
Since it seems i was wrong about what code was wrong, i now post my messy piece of code:
var posX = e.clientX;
var posY = e.clientY;
function mouseDown(e){
    var getChildDivs = this.querySelectorAll('div');

    if(getChildDivs.length > 0){
        var offsetDivLeft = 0;
        var offsetDivTop = 0;
        for(i = 0; i < getChildDivs.length; i++){
            if(posX >= getChildDivs[i].offsetLeft && posX <= getChildDivs[i].offsetLeft + Math.floor(getChildDivs[i].style.width.slice(0, -2)) &&
                posY >= getChildDivs[i].offsetTop && posY <= getChildDivs[i].offsetTop + Math.floor(getChildDivs[i].style.height.slice(0, -2))){
                if(getChildDivs[i].querySelectorAll('div').length > 0){
                    offsetDivLeft = offsetDivLeft + getChildDivs[i].offsetLeft;
                    offsetDivTop = offsetDivTop + getChildDivs[i].offsetTop;
                    getChildDivs = getChildDivs[i].querySelectorAll('div');
                    curDiv = getChildDivs[i];
                    i = 0;
                }else{
                    curDiv = getChildDivs[i];
                    break;
                }
            }
        }
}
}

A: i created a fiddle which loops over every child element and children of children as well:
http://jsfiddle.net/czzeaz3x/
var condition = divs.querySelectorAll('div');
for(i = 0; i < condition.length; i++){
if(condition[i].children.length > 0){
     condition = condition[i].querySelectorAll('div');
    alert(condition);
     i = 0;
}else{
     // Last div reached.
     break;
}
}

i hope it helps ;)

A: The correct solution is
function mouseDown(e){
  curdiv = e.target;
}

The target property of the event gives you the actual div which was clicked--normally the frontmost one, which is also normally the most deeply nested one. From MDN:

A reference to the object that dispatched the event.


text:
Q: Silverstripe custom display rules—how to use the value of a select?
I'm trying to have a select field, and when I select an option, I want a second select box to appear.
The problem is that select fields don't have a value like text fields do. So, any comparison SS provides will fail—always thinking the select field is ''.
Is there any way to compare the value of a select field?

A: Use display-logic
Disclaimer: I'm the author

A: Use DependentDropdownFields, I found it easier for dropdowns than Display Logic for this case. (Sorry UncleCheese)


text:
Q: Beginning in Flutter: How do I make 4 buttons fill a SafeArea I've very much a beginner in Dart and Flutter, and my project is to learn while building an app. I've learned the basics with an online class and I have basis in Java.
Now, in my homepage, I'm trying to have 4 buttons take the whole screen. My current layout is to have them all take an equal amount of space and be stacked vertically.
Problem is, I can't find a way to make the RaisedButton fill automatically. I've tried retrieving the height of the screen and dividing that between the buttons but it's not working. Here's how I do it :
First, the homescreen layout:
class Homescreen extends StatelessWidget {
  Widget build(context) {
    double height = MediaQuery.of(context).size.height - 60;
    return Scaffold(
      body: SafeArea(
        child: ListView(
          children: [
            PlanningButton(height),
            Container(margin: EdgeInsets.only(top: 20.0)),
            BookingButton(height),
            Container(margin: EdgeInsets.only(top: 20.0)),
            ModifyButton(height),
            Container(margin: EdgeInsets.only(top: 20.0)),
            CancelButton(height),
          ],
        ),
      ),
    );
  }

As you can see, I pass the height argument to my buttons all built around this model:
  Widget PlanningButton(double pixel_y) {
    return RaisedButton(
      padding: EdgeInsets.all(pixel_y / 8.0),
      onPressed: () {}, //goes to the planning screen
      color: Colors.blue[200],
      child: Text("Planning"),
    );
  }

Yet, it's never quite right. I don't think it's taking into account the notification bar or the navigation bar.
I suspect there is a workaround that involves wrapping the buttons into a container or using a different kind of widget that have button-like properties but I can't find what suits my needs.
Thanks for any help !
edit: I'm basically trying to do this

A: Try removing the variable height logic, and simply wrap your buttons in Expanded widgets. This is pretty much what it was built for.
Check it out here: https://api.flutter.dev/flutter/widgets/Expanded-class.html

A: If 4 buttons are the only widgets, you dont need to use ListView just use a Column with mainAxisAlignment: MainAxisAlignment.spaceEvenly
class Sample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Expanded(
              child: Container(
                color: Colors.red,
                child: Center(
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("button"),
                  ),
                ),
              ),
            ),
            Expanded(
              child: Container(
                color: Colors.blue,
                child: Center(
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("button"),
                  ),
                ),
              ),
            ),
            Expanded(
              child: Container(
                color: Colors.green,
                child: Center(
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("button"),
                  ),
                ),
              ),
            ),
            Expanded(
              child: Container(
                color: Colors.yellow,
                child: Center(
                  child: RaisedButton(
                    onPressed: () {},
                    child: Text("button"),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

A: You could use a Column and Expanded to do the job. If you want to make your Column scrollable, you can wrap it with SingleChildScrollView. I used SizedBox instead of Container to make the spacing because it is way more efficient and is designed for it.
class Homescreen extends StatelessWidget {
  Widget build(context) {
    double height = MediaQuery.of(context).size.height - 60;
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Expanded(
              child: PlanningButton(height)
            ),
            SizedBox(height:20),
            Expanded(
              child: BookingButton(height),
            ),
            SizedBox(height:20),
            Expanded(
              child: ModifyButton(height),
            ),
            SizedBox(height:20),
            Expanded(
              child: CancelButton(height),
            ),
          ],
        ),
      ),
    );
  }

A: Before you read this, it's not the best way to do things but it's one I'm using at least for prototyping. You may find using a container with a list and the argument MainAxisAlignment to work better for you.
A lot of comments here might give a solution that works for you but here's mine. I got it to work like I wanted by using SizedBox.
First, I recovered the width of the screen, then I created the buttons and put them into SizedBox fitting the screen's width, I put them in a Column and I added a few Container for the style points.
Result:

Code :
class Homescreen extends StatelessWidget {
  Widget build(context) {
    double width = MediaQuery.of(context).size.width; //getting screen width
    return Scaffold(
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            Container(margin: EdgeInsets.only(bottom: 20.0)),
            PlanningButton(width),
            Container(margin: EdgeInsets.only(bottom: 20.0)),
            BookingButton(width),
            Container(margin: EdgeInsets.only(bottom: 20.0)),
            ModifyButton(width),
            Container(margin: EdgeInsets.only(bottom: 20.0)),
            CancelButton(width),
            Container(margin: EdgeInsets.only(bottom: 20.0)),
          ],
        ),
      ),
    );
  }

  Widget PlanningButton(double width) {
    return Expanded(
      child: SizedBox(
        width: width - 20,
        child: RaisedButton(
          onPressed: () {},
          color: Colors.blue,
          child: Text(
            "planning",
            textScaleFactor: 4.0,
          ),
        ),
        //fit: BoxFit.cover,
      ),
    );
  }

The user can tap anywhere on the colored buttons and it will register. Now I'll add images and transparency to make it look good!


text:
Q: Proper positioning of inserted HTML elements I need a hint on how to properly place inserted element:
The initial situation is that the target page lists items in a grid of square tiles, where tiles reflow as the viewport width changes.
What I need is to transform the grid layout to something like tile layout providing more space for more details of each item (one item per line), where the original tile is aligned left and my rectangle element fills the remaining space of the viewport.
The tile is DIV wrapped inside enclosing DIV. Now I create a new SPAN and insert it after the inner DIV. However, the SPAN is placed not beside but below the inner DIV and it's width seems to be fixed to an unknown value. I've workaround it by adding position: relative to outer DIV and position: absolute to inner SPAN and setting it fixed width. It works eventually but as I notice the outer DIV doesn't expand if my SPAN overgrows it's area (it overflows) - ie. my SPAN seems to be excluded from the outer DIV though it's hierarchically inside it.
The question is how to organically insert the SPAN so that it's adopted by the ancestor, which then grows/shrinks as my element grows, and also inherit it's style.

    ..the original tile

    ...here comes my content

A: Try the above code.. plz add the float concepts for this..


text:
Q: I want to get the maximum occurred number from the mysql table I got the maximum occurred value from each column. But I need from the entire table. Can someone guide me with this? Here in this table it should be 11.
Table

A: You need to use a combination of count and group by, with a limit:
SELECT columnname, COUNT(columnname) AS count
  FROM table
  GROUP BY columnname
  ORDER BY COUNT(columnname) DESC
LIMIT 0, 1