text:
Q: Is acetone or isopropyl alcohol better for removing rosin flux? For removing rosin flux from my board, should I use Acetone or Isopropyl Alcohol? I need an easily available solvent.

A: For rosin based flux I clean with IPA (93%) and then hot water with a detergent.  Then dry.  That is for one-of's or a small number of pcbs.

A: Just adding to the answers because nobody's mentioned it yet - as well as melting plastic, acetone can strip the insulation off enameled (magnet) wires.  So if you decide to use it be super careful not to spill any on motors or transformers!

A: I can't give you a definitive answer, but see below for a small compilation of DIY flux removers that people have proposed. Additionally, you should consider rinsing the circuit in deionised water and air-drying it. (As a final step, a urethane-based conformal coating ≥2.0 mil thick may be advisable to mitigate against tin whiskers and other contaminants.)
N.B. Observe the safety warnings on the packaging or MSDS of any artificial solvent that you use. Also consider making at least two copies of your circuit: one on which to test your candidate solvent(s) for compatibility, and one for the finished product.
0. Acetone
Reportedly decent at removing some fluxes, probably including rosin-based ones, but may damage plastics.
1. Isopropyl alcohol (IPA)
Perhaps not quite as effective at removing flux as acetone, but close, and less likely to damage plastics. Recommended by Maker.io/DigiKey.
2. Mixture of IPA and acetone
Jeri Ellsworth uses, as a flux remover for rosin flux, a DIY mixture of IPA and acetone "in no exact proportions". At least one other person reports success with this recipe, using a 50/50 mixture (by volume, I guess).
3. Methylated spirits
Burton Lang suggests methylated spirits as a readily available flux cleaner.
4. Mixture of methylated spirits, IPA and ethyl acetate
The Get GUI website suggests a different DIY mixture that they claim is suitable for rosin fluxes and also suitable for non-rosin and no-clean fluxes:

*

*85% by volume ≥95% pure denatured ethanol (ethyl alcohol), aka methylated spirits.

*10% by volume ≥95% pure isopropyl alcohol, AKA isopropanol, 2-propanol, IPA.

*5% by volume ethyl acetate, AKA ethyl ethanoate, EtOAc, EA.

These are apparently the same three chemicals used in a commercial flux cleaner made by MG Chemicals.
5. Poly-Clens
Burton Lang (mentioned above) also suggests, as a flux cleaner, the Poly-Clens product, though this may not be available globally, and can damage some plastics. There is a discussion of the Poly-Clens suggestion at Hackaday.

A: Acetone being used to clean circuit boards can be problematic. The biggest issue that I found was that it leaves a residue in the board that still requires several other cleaning steps to get rid of including IPA and hot water.
Even IPA can leave a residue as it dries.
There is also the problem mentioned in the comments that the acetone can dissolve certain plastics to the great detriment of your electronics assembly. I've seen it eat away the plastic winding wraps on small transformers as an example.

A: You can use certain dish detergents provided that A: they are not overly acidic/corrosive (rosin/flux itself is fairly acidic) and B: they don't leave any residue/salts. I have had good luck with "hand-safe" detergents. Some people "might" object to it, but I have had far better success with detergents over alcohol or anything else. In truth, there is really no reason to not use a detergent, it's really just a gel consisting of hydrocarbon chains with hydrophillic and hydrophobic components, historically manufactured from some kind of fat and lye. As long as it leaves no residue, or as long as you rinse it off well with distilled water, and you allow it to dry/bake at a low temperature (or blast it with compressed air), you shouldn't have any issues with it, I never have had any issues myself. A lot of the solvents used for flux certainly are not safe to handle, alcohol and detergent are really the only things that won't give you cancer or liquefy your brain. Its simple, cheap, and effective. It's also environmentally safe to use alcohol and dish detergents.
I usually scrub my PCBs with a cotton swab doused in alcohol to get rid of the large blobs of flux, unfortunately even 90-99% IPA seems to always leave a sticky, foul residue, (especially with "no-clean" fluxes) even with mechanical brushing. Dish detergent and hot distilled water, on the other hand, almost always get all of the residue off, especially if you leave it to soak for five or ten minutes. I have heard that manufacturers use a similar process that uses detergents, mechanical scrubbers, and water jets to remove flux, then they either bake them in a low temperature oven (say 60C) or they spray it with compressed air to evaporate all of the water off of the board. Alternately, you can use a water soluble flux and just wash it off with distilled water which is far easier than using traditional or no-clean fluxes. The only reason to use no-clean flux is if you are worried about some residue still remaining after the cleaning process, such as under SMD packages.
If you do rinse your board off with water, regardless of how you clean them, don't use tap water. Distilled water won't have anything in it but water, so you don't have to worry about any minerals, metals, etc that may be in tap water. Distilled water won't leave any residue, and as long as you wash your detergent off, your boards will be residue free.

A: If you want real results to clean PCBs after rosin-based fluxes, you should use a specially-formulated solvent. Typically the solvents are based on IPA, but contain Toluene, Heptane, and Difluoroethane. Note - no acetone there.

A: Use methal spirit, it's similar with IPA, the difference is methal spirit dry a bit slow. Sometimes people use it to clean windows

A: Easily available solvent: I have used for years trichloroethane, cheap, effective, and not visible residue.

A: Acid based would be Acetone.
ISO is more than enough for what I'd assume 99.99% of Engineering@Home Apps. to need. However that being said, they both work wonders on hardened, nasty, PCB, with flux everywhere. So if you want to rejuvenate your board, get acetone, less aqueous the better. Flammable, be careful like you would with a grenade.  Use a gritted cloth and rubber gloves to slowly wipe away and immediately let dry your PCB. Circuitry should be ready for Re-Flux within 3-4 hrs if done properly. (Full-ATX Motherboard sized, etc.)


text:
Q: Layout changing(resizing) when switching from mobile to desktop The whole layout resizes when I change from desktop to mobile view. Elements with a width of 500px that should take up the entire screen don't.
I want mobile to look the same as desktop.
I've tried adding <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no/> to every index.php, but nothing changed.
Desktop view
Moblie view

A: I added <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> to another index.php and it worked :D

A: the syntax is missing some chars (commas, quotation marks). You can try if this works:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />

redpajama_set_name: RedPajamaStackExchange


text:
Q: Start to Finish Advanced Project Tutorials Can anyone recommend some start to finish project tutorials that really emphasize good design principles and best practices. I am looking for things that demonstrate and emphasize any or all of these:

*

*Domain Driven Design

*Unit Testing

*Inversion of Control

*Separation of Concerns

*Use of interfaces

*Object Relational Mapping

*Preferably ASP.NET MVC

I am currently watching the Autumn of Agile series, which demonstrates many of these principles. I would like to find more of these tutorials/demos.

A: While not a project tutorial, I would suggest you take a look at JP Boodhoo's Nothing but .NET training. I'm pretty sure it touches on everything you're interested in (plus a lot more).
http://www.jpboodhoo.com/training.oo

A: Jason Dentler's Using the N* stack tutorial is quite comprehensive using a number of technologies (NHibernate, Ninject, jQuery) with ASP MVC.

A: There are loads of nice tutorials + books about good codebase/design quality. But to me the real essence is how the codebase evolves (the history of a codebase). Codebase state A often is achievable and can have a clean design. IMO the real art of software developing is how you get to a codebase state B,C...Z and still keep the design and concepts consistent and clean.
Such tutorials are very rare, because it needs insights to the history of requirements and team behaviour, which adds a lot of complexity to "just" learn inside one tutorial.
But a good practice for improving desing during software evolution I can recommend is Refactoring Workbook.


text:
Q: Union and set notation I was reading my notes and came across this example...
A = {z: z is a number, z is ≤ 20}
B = {y: y is an even number}
Then A U B = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}

To my understanding Union means that the elements in each set are displayed in the outputted set like so
For example, if A = {1, 3, 5, 7} and B = {1, 2, 4, 6} then A ∪ B = {1, 2, 3, 4, 5, 6, 7}

I do not understand why this is not the case in this example, is this just a typo and should the output of A U B end like so 17,18,19,20...n+2} n+2 where n is the last number given or something along those lines? i.e. 22...24...26 and so on until infinity?
So my question is, is the first example given, wrong, or am I missing something to do with unions.
Regards

A: The notes seem to be incorrect.
If $A=\{z:z\in\mathbb{N}\}=\{1,2,3,4,5,\ldots\}$ and $B=\{y:y\text{ is an even number}\}$, then $A\cup B=\{1,2,3,4,5,6,7,\ldots, 22,23,\ldots,345,\ldots\}$,
that is, all elements of $A$ and $B$.
Your example is correct however.


text:
Q: Problem in applying Newton's Second law I do have some problem in applying Newton's Second to systems with variable mass.
This is what I understand:

Mathematically, the law states that:
$$F=\frac{dp}{dt}=m\frac{dv}{dt} + v\frac{dm}{dt}$$
where $F$ is the net external force "on the system" and $\frac{dp}{dt}$ is the
rate of change of momentum "of the system".

If the mass of a system is changing, say is decreasing and the "removed" mass do possess a momentum. Then, in order to change the momentum of the "removed" mass, the system must have applied a force on the "removed" mass and in reaction the removed mass would also apply an equal and opposite force on the system,say $F$.
I am confused whether this force $F$, on the system, would be considered as an external force or an internal force (Since, as soon as the "removed" mass gets detached from system, it can apply an external force on the "main" system and is not the part of the "main" system).
If you say that even after being detached the "removed" mass remains a part of the system,then I would disagree because if this was the case then the mass of the system will not be considered to change at all.
If I am all correct then  see this post.

A: The force $\mathbf F$ which you refer to in the equation
$$\mathbf F=m\frac{\mathrm d \mathbf v}{\mathrm dt}+\frac{\mathrm dm}{\mathrm dt}\mathbf v_{\rm relative}\tag{1}$$
is the net external force on the moving body (excluding the removed masses) and $\mathbf v_{\rm relative}$ is the relative velocity of the body with respect to the removed mass. In the case when the removed mass becomes stationary (in the ground frame) after being removed, the equation $(1)$ simplifies to
$$\mathbf F=m\frac{\mathrm d \mathbf v}{\mathrm dt}+\frac{\mathrm dm}{\mathrm dt}\mathbf v\tag{2}$$
where $\mathbf v$ is the velocity of the moving body. This net external force doesn't include the interaction force between the removed mass and the body. The interaction force between the removed mass and the body is taken care of by the term $\displaystyle \frac{\mathrm d m}{\mathrm dt}\mathbf v$.
This can be easily seen by the fundamental equation of Newton's second law which states that
$$\mathbf F_{\rm net, external}=\frac{\mathrm d\mathbf p}{\mathrm dt}\tag{3}$$
You might also want to look at this Wikipedia page on variable mass systems for more insight. Do note that the equation given in the Wikipedia article
$$\mathbf F_{\rm net,external}+\frac{\mathrm d m}{\mathrm dt}\mathbf v_{\rm relative}=m\frac{\mathrm d\mathbf v}{\mathrm d t}\tag{4}$$
is completely equivalent to the equation $(1)$ mentioned above in the answer (in equation $(4)$, $\mathbf v_{\rm relative}$ is the relative velocity of removed mass with respect to the moving body). Proving the equivalence is left as an exercise to the reader.

A: When we say "internal force", we mean forces that each part of our whole system exert on each other. If the ejected mass was not part of our system in the first place, then why would the mass of the system change at all? The mass that was initially part of the system was removed. So, it's obvious the total mass of the system changed. The equation $F=\,{d(mv)\over dt}$ is applied to our system whose mass is changing over time. I repeat, the jettisoned mass was part of the system and that's exactly why the mass of our system is changing. Now, when we consider the mutual internal force between our changing system and the removed mass, we freeze our clock to the time before the mass completely leaves the system. While the mass is pushed backwards, the mass simultaneously thrusts the system forward in the time it is been ejected until it is removed completely. Once completely ejected, it doesn't contribute to the thrust on the system anymore. External forces in general refer to forces other than this mutual interactive force between the individual masses of our system. It could be gravity, air drag or friction.


text:
Q: How to get my MapContainer bounding box in Codename One My Codename One app features a MapContainer. I need to show points of interest (POIs) on it which coordinates reside on the server. There can be hundreds (maybe thousands in the future) of such POIs on the server. That's why I would like to only download from the server the POIs that can be shown on the map. Consequently I need to get the map boundaries to pass them to the server.
I read this for Android and this other SO question for iOS and the key seems to get the map Projection and the map bounding box. However the getProjection() method or the getBoundingBox() seem not to be exposed.
A solution could be to mix the coordinates from getCameraLocation() which is the map center and getZoom() to infer those boundaries. But it may vary depending on the device (see the shown area can be larger).
How can get the map boundaries in Codename one ?
Any help appreciated,
Cheers,

A: The problem is in the javadocs for getCoordAtPosition().   This will be corrected.  getCoordAtPosition() expects absolute coordinates, not relative.
E.g
Coord NE = currentMap.getCoordAtPosition(currentMap.getWidth(), 0);
Coord SW = currentMap.getCoordAtPosition(0, currentMap.getHeight());

Should be
Coord NE = currentMap.getCoordAtPosition(currentMap.getAbsoluteX() + currentMap.getWidth(), currentMap.getAbsoluteY());
Coord SW = currentMap.getCoordAtPosition(currentMap.getAbsoluteX(), currentMap.getAbsoluteY() + currentMap.getHeight());

I tried this out on the coordinates that you provided and it returns valid results.
EDIT March 21, 2017 :  It turns out that some of the platforms expected relative coordinates, and others expected absolute coordinates.  I have had to standardize it, and I have chosen to use relative coordinates across all platforms to be consistent with the Javadocs.  So your first attempt:
Coord NE = currentMap.getCoordAtPosition(currentMap.getWidth(), 0);
Coord SW = currentMap.getCoordAtPosition(0, currentMap.getHeight());

Will now work in the latest version of the library.
I have also added another method : getBoundingBox() that will get the bounding box for you without worrying about relative/absolute coordinates.

A: This is probably something that can be exposed easily by forking the project and providing a pull request. We're currently working on updating the map component so this is a good time to make changes and add features.


text:
Q: Are there random matrix results like Marcenko-Pastur, but for CCA? The Marcenko-Pastur law is about asymptotic distributions of eigenvalues. It starts from a simple null model (iid zero-mean Gaussian entries) and derives a distribution for the spectrum. In PCA, this allows a data analyst to select the number of principal components using a p-value cutoff.
Is there a similar law that governs the distribution of correlations in CCA? I want to select the dimension of the latent space(s) using the same strategy as above.
This question is very similar to mine, but it's not answered and it's a little less general. (Asking for a test about any relationship at all is like asking "Is the latent space is zero dimensional" whereas I want to select the dimension). It's also about kernel CCA, and I am content with just plain CCA.

A: Perhaps check this paper https://arxiv.org/pdf/1407.7194.pdf, which contains some random matrix results on the CCA matrix mentioned in your post.


text:
Q: How does v8 scoping work? This question can be narrowed down to:

*

*What's the difference between Handle, Persistent and Local?

*How to properly dispose of each?

*When dealing with Locals, how exactly to work with HandleScope in cases where, for instance, I don't have any return values? (I've only seen examples where scope.Close(value) is returned).

A: Think of HandleScopes as a stack -- each time you create one, it's the newest scope.  As they go out of scope, any Local<> created after that HandleScope can be deleted/GC'd.
Persistent<> is untouched by HandleScope and should only be removed with Dispose.
If you are returning a value from a function, you create that as a Local and then, call scope.Close(myLocalObject) which passes ownership of that object from the created scope to the parent scope.  Functions not returning anything still must return an undefined e.g. scope.Close(Undefined());
edit
Handle is just the base class for Local and Persistent.  There's good information on scoping and handles on the v8 developer site: https://developers.google.com/v8/embed
Re: returning args.this, that's used in a constructor function (e.g. new MyObject) if you look in the comments in the example code on that page.


text:
Q: Skype API Fetching Host information I am developing an application in c# that requires the hostname or IP address of a specific Skype user, so that my server infrastructure can establish itself appropriately to the specific customer that one of my employees will be speaking to, over their Skype messaging sessions.
I have done some research over the internet to find these "Skype resolver" services, that can be used for malicious purposes, I assure you that this is not my intention, however, due to the fact that I do not support malicious activity, I would rather build my own method of fetching an IP address by utilising a Skype username, rather than support these malicious organization by using their tools.
So what do I need to do, in order to get these IP addresses from Skype usernames?


text:
Q: Is it an anti-pattern to use a class based react component in a functional component? I am want to use a certain component in react native but all the third party components were written as class based components. Is it an anti-pattern to use a class based react component in a functional component? For example:
import * as React from 'react';
import { Text, View, Image, StyleSheet } from 'react-native';

import ClassComponent from 'SomeOldClassBasedCompont';

export default function TabOneScreen() {
  return (
    <View>
        <ClassComponent />
     </View>

  );
}

A: The class based/function base components are a React Component at all.
Let's take an example:
Assume you have 2 different components, FirstComponent & SecondComponent and you want to use them inside an App component, what do you do?
export default function App() {

  const firstTitle = "just an example";
  const secondTitle = "another example";

  return (
    <View>
        <FirstComponent title={firstTitle}/>
        <SecondComponent  title={secondTitle}/>
     </View>
  );
}

Is it matter for App component to render a functional or class-based component? is there any difference between rendering FirstComponnet or SecondComponent? what about passing props?

Since the component returns a valid JSX form, it will be rendered.

So, what are the differences between functional and class-based components?

The differences are in syntax, the ways to manage the life cycles, using hooks, constructors, and the special value of this. in other words, the differences are in the component definition and not related or affected on the parent or child components.
Summary
components are components, no matter is written in a class-based or functional-based structure.


text:
Q: How to change Index in TFIDF in Python I have dataframe df_reps
RepID    RepText
================
1328        Hello, this is me, ..
5744        This is a test reoprt, ..
8417        The UK has begun sending ventilators and oxygen ..

I am tryingto extract TFIDF values from RepText
and Here is my code
def TFIDF2(df, use_idf, smooth_idf, ngram_range, stop_words):
    tf_idf_vec = TfidfVectorizer(use_idf=use_idf,
                        smooth_idf=smooth_idf,
                        ngram_range=ngram_range,stop_words=stop_words) # to use only  bigrams ngram_range=(2,2)
    tf_idf_data = tf_idf_vec.fit_transform(df)
    tf_idf_dataframe = pd.DataFrame(tf_idf_data.toarray(),columns=tf_idf_vec.get_feature_names())
    return tf_idf_dataframe

df_tfidf = TFIDF2(df_reps["RepText"], True, False, (1,1), "english")

But df_tfidf looks like this
df_tfidf
Out[25]:
      UK  reoort  test  ...  begun  sending  Hello
0          0.0       0.0       0.0  ...       0.0       0.0       0.0
1          0.0       0.0       0.0  ...       0.0       0.0       0.0
2          0.0       0.0       0.0  ...       0.0       0.0       0.0
3          0.0       0.0       0.0  ...       0.0       0.0       0.0
4          0.0       0.0       0.0  ...       0.0       0.0       0.0

The problem is the index in df_tfidf is not related to RepID in df_report
I want to get the index of df_tfidf to be the RepID so it lools like this
RepID      UK  reoort  test  ...  begun  sending  Hello
1328          0.0       0.0       0.0  ...       0.0       0.0       0.0
5744          0.0       0.0       0.0  ...       0.0       0.0       0.0
8417          0.0       0.0       0.0  ...       0.0       0.0       0.0
8823          0.0       0.0       0.0  ...       0.0       0.0       0.0
9938          0.0       0.0       0.0  ...       0.0       0.0       0.0


text:
Q: Why postfixed has higher precedence than prefixed? Case 1:
int i = 10;
int j = i++;

Here, first the value of i is assigned to j and than i is increased by 1.
Case 2:
int i = 10;
int j = ++i;

Here, first i is increased by 1 and than it is assigned to j.
So, If the operation of increment is done first in the prefixed form, then why postfixed has higher precedence than prefixed?

A: This has nothing to do with precedence.(here) In pre-increment the value that is assigned is the value before the side effect takes place.
For pre increment it will be the value after the side effect.
int i = 10;
int j = i++;

Before incrementing value of i is 10. So j=10 after these 2 statements are executed.
int i = 10;
int j = ++i;

Here the value will be 11. because incremenet is done first and then it is assigned.

A: Linux manual page of operator define as same priority for both pre/post increment.
! ~ ++ -- + - (type) * & sizeof      right to left

post increment rule is first assigned and then increment
int j = i++;// here first whatever i value is there that will be assigned to j

Pre increment rule is first increment and then assign
int j = ++i;//++i itself will change i value & then modfied value will assign to j.

for e.g consider below example
#include<stdio.h>
int main()
{
        int x = 10;
        int *p = &x;// assume p holds 0x100
        printf("x = %d *p = %d p = %p\n",x,*p,p);
        ++*p++;
        /** in above statement ++ and * having same precedence,then you should check assocaitivity which is R to L
          So start solving from Right to Left, whichever operator came first , solve that one first
          first *p++ came , again solve p++ first, which is post increment,so address will be same
         *0x100  means = 10
         now ++10 means = 11
         **/
        printf("x = %d *p = %d p = %p\n",x,*p,p);
}


text:
Q: Adding A Word to All Post Titles With the_title Filter Hook I want to add a "word" to the beginning of all post titles on my WordPress website..
I am using the following code and it's working fine except that it also adds the word to menu titles. Can you guys please help in modifying the code so it won't add the word to menu titles?
add_filter( 'the_title', function( $title, $id ) {
    return 'My World' . $title ;
}, 10, 2 );

A: So in order to only add that word to post titles (and not pages, for example), change your code to this:
add_filter( 'the_title', function( $title, $id ) {
    if ( 'post' == get_post_type($id) )
        return 'My World' . $title ;

    return $title;
}, 10, 2 );

Basically, we're using the get_post_type() function to check that the title belongs to a post and if so then we add the 'My World' text to it, otherwise the function will return the original title.
Personally I would also check that this code only runs on the front-end by using the is_admin() function so post titles are displayed normally on the admin section (WP Dashboard > Posts > All Posts):
add_filter( 'the_title', function( $title, $id ) {
    if ( ! is_admin() && 'post' == get_post_type($id) )
        return 'My World' . $title ;

    return $title;
}, 10, 2 );


text:
Q: Don't understand notation of morphisms in Monoid definition I'm trying to understand what Monoid is from a category theory perspective, but I'm a bit confused with the notation used to describe it. Here is Wikipedia:

In category theory, a monoid (or monoid object) (M, μ, η) in a monoidal category (C, ⊗, I) is an object M together with two morphisms
μ: M ⊗ M → M called multiplication,
η: I → M called unit

My confusion is about the morphism notation. Why is the binary operation ⊗ a part of the morphism notation? My understanding of a morphism is that it's a kind of function that can map from one type to another (domain to codomain), like M → M. Why is the operation ⊗ a part of the domain in the definition? The second confusion is about I. Why is I a domain? There is no I object in a Monoid at all. It's just a neutral element of the object M.
I understand that Monoid is a category with one object, an identity morphism, and a binary operation defined on this object, but the notation makes me think that I don't understand something.
Is M ⊗ M somehow related to the cartesian product, so that the domain of the morphism is defined as M x M?
Edit: I got a really helpful answer for my question on the Mathematics Stack Exchange.

A:
Is M ⊗ M some how related to cartesian product, so domain of the morphism is defined as M x M ?

Exactly. More specifically, we get those monoids that are expressed by the Monoid class from base by picking Hask (the category with all Haskell types as objects and all Haskell functions as morphisms) as C, (,) (the pair type constructor) as ⊗, and () (the unit type) as I. The signatures of μ and η, translated to Haskell, then become:
μ :: (M, M) -> M
η :: () -> M

By currying μ, and making use of how () -> M functions are in one-to-one correspondence to M values (all of them look like \() -> m for some m), we get the familiar Monoid methods:
mappend :: M -> M -> M
mempty :: M

Note that the categorical definition is far more general than just Monoid. For instance, we might keep working in Hask while replacing (,) and () with their duals, Either and Void, thus getting:
μ :: Either A A -> A
η :: Void -> A

Every Haskell type is a monoid in this particular manner (μ is either id id, and η is absurd).

Another example is taking C to be the category of Haskell Functors (with natural transformations between them -- which I will write as type f ~> g = forall a. f a -> g a -- as morphisms), Compose as ⊗, and Identity as I:
-- Note the arrows here are ~>, and not ->
μ :: Compose M M ~> M
η :: Identity ~> M

These two are commonly written as:
-- "Inlining" the definitions of Compose, Identity, and ~>
join :: M (M a) -> M a
return :: a -> M a

In other words, a Monad is a monoid in the category of Functors (which is the Hask-specific version of "a monad is a monoid in the category of endofucntors"). It is worth mentioning that, as in the other example, this is not the only way to get monoids out of that category (see the final paragraph of this answer for pointers -- the rest of it, in fact, might be relevant reading, as it discusses the notion of monoidal category).


text:
Q: How to fix SSLHandshakeException We are getting the below error when i try to parse the wsdl in Enterprise manager. How do i fix this.
The WSDL document could not be parsed.The following error occured while parsing the WSDL location - WSDLException: faultCode=PARSER_ERROR: Failed to read wsdl file at: "https:/xxx?WSDL", caused by: javax.net.ssl.SSLHandshakeException.    : javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

A: Make sure the required CA certificates are added into the required CERT db files like if the App/Web server using JDK's one then file should be ${JAVA_home}/jre/lib/security/cacerts.
You can cross check that your certificate is added or not.
keytool -list -keystore${JAVA_home}/jre/lib/security/cacerts
The keystore file path may vary based on your server configuration.


text:
Q: Retraining model starts with higher loss than it finished with last session I am training a model for a denoising task.
Every time i train it the first loss in the new training session is much higher than the loss i finished with before. for example after first training:

Then when i wanted to train it for 100 more epochs:

20x higher loss.
Why does it happen?
Edit:
Here is the loss graphed. You can clearly see that after epoch 2500 there is a massive increase in the loss:

Added the training loop here:
num_epochs = 500

criterion = torch.nn.MSELoss()

sgd_params = {
    "lr": 0.30,
    "momentum": 0.9
}

lin_optimizer = torch.optim.SGD(lin_model.parameters(), lr=0.30, momentum=0.9)
sta_optimizer = torch.optim.SGD(sta_model.parameters(), lr=0.30, momentum=0.9)
ref_optimizer = torch.optim.SGD(ref_model.parameters(), lr=0.30, momentum=0.9)

_, val_clean, val_noisy = util.lincomb_generate_data(batch_size*10, B, K, functions, sample_offset=sample_offset, noise_type="gaussian", noise_mean=noise_mean, noise_std=noise_std)

print("STARTED TRAINING")

for epoch in range(num_epochs):
    print("Current epoch {}\r".format(epoch), end="")
    # generate data returns the x-axis used for plotting as well as the clean and noisy data
    _, t_clean, t_noisy = util.lincomb_generate_data(batch_size, B, K, functions, sample_offset=sample_offset, noise_type="gaussian", noise_mean=noise_mean, noise_std=noise_std)

    # ===================forward=====================
    lin_output = lin_model(t_noisy.float())
    sta_output = sta_model(t_noisy.float())
    ref_output = ref_model(t_noisy.float())

    lin_loss = criterion(lin_output.float(), t_clean.float())
    sta_loss = criterion(sta_output.float(), t_clean.float())
    ref_loss = criterion(ref_output.float(), t_clean.float())

    lin_loss_list.append(lin_loss.data)
    sta_loss_list.append(sta_loss.data)
    ref_loss_list.append(ref_loss.data)
    # ===================backward====================
    lin_optimizer.zero_grad()
    sta_optimizer.zero_grad()
    ref_optimizer.zero_grad()

    lin_loss.backward()
    sta_loss.backward()
    ref_loss.backward()

    lin_optimizer.step()
    sta_optimizer.step()
    ref_optimizer.step()

    val_lin_loss = F.mse_loss(lin_model(val_noisy.float()), val_clean.float())
    val_sta_loss = F.mse_loss(sta_model(val_noisy.float()), val_clean.float())
    val_ref_loss = F.mse_loss(ref_model(val_noisy.float()), val_clean.float())

print("DONE TRAINING")

edit 2: bump


text:
Q: Windows keeps restoring DigitCert root certificates I issued a SSL certificate trought DigiCert which we know is globally recognized and its Trusted Roots should be by default in Windows installations.
However on one of my client's machine there was no intermediate root CA which led to several problems. Hence I decided to include DigiCert certificates (taken from their website) into the installation package we are sending to our clients.
Of course I wanted to test it first on my local win server 2008 but I can't remove DigiCert roots from the machine! I keep removing them as Current User and Local Computer from both Trusted Root CAs and Intermediate CAs but as soon as I open (not install, just open!) the issued certificate file (to see it's details), instantly the removed CAs appear in the stores again (as current user).


text:
Q: Error when add image to project I created a project and then added an image in the project root directory.
In my index.android.js I added:
When run react-native run android, the error is displayed:
error: bundling failed: "Unable to resolve module ./my-icon.png from C:\\Users\\Ayala\\Documents\\Developer\\React\\BrunoDantas\\index.android.js: could not resolve `C:\Users\Ayala\Documents\Developer\React\BrunoDantas\my-icon.png' as a folder: it did not contain a package, nor an index file"

A: The problem is your path I think your code example is missing.  But the problem is that the image is not able to be found.
Currently your code is I believe?
<Image source={require('./my-icon.png')} />

This means the image should be in the same folder as your index.android.js which I'm guessing it's not...  We would need more information in order to tell you what the real problem is.


text:
Q: How save business objects into Django Models I have two similar classes one is a business object and the second is a Django model. And this is the code:
class Vehicle():
    def __init__(self, make, model, year, miles, sold_on, sale_price, purchase_price):
        self.make = make
        self.model = model
        self.year = year
        self.miles = miles
        self.sold_on = sold_on
        self.sale_price = sale_price
        self.purchase_price = purchase_price

    def __str__(self):
        return 'Vehicle: %s %s %s %s' % (self.make, self.model, self.year, self.miles)

    def calculate_sale_price(self):
        if self.miles > 0 and self.miles <= 20000:
            return 15500
        elif self.miles > 20000 and self.miles <= 50000:
            return 11200
        elif self.miles > 50000 and self.miles <= 100000:
            return 8550
        elif self.miles > 100000 and self.miles <= 200000:
            return 4645
        else:
            return 2300

    def is_vehicle_luxury(self):
        if self.make in ['Cadilac', 'Lexus', 'BMW']:
            return True
        if self.year in [2000, 2015, 1945, 1973]:
            return True

models.py
class Vehicle(models.Model):
    make = models.CharField(max_length=300)
    model = models.CharField(max_length=300)
    year = models.IntegerField()
    miles = models.IntegerField()
    sold_on = models.DateTimeField(null=True, blank=True)
    sale_price = models.FloatField(null=True, blank=True)
    purchase_price = models.FloatField(null=True, blank=True)

So the question is: should these two classes be merged into one? or create another piece of code to create the business object and then populate the model from the business object. So what would be the best approach to handle this?

A: I can't comment because I don't have enough rep.   Basically coming from a Model View Controller ViewModel type of environment some will say that you should have domain model which is your django model class and then have a model that is used for the view.
In Django I find this setup to be stupid and not save anytime at all.  If your viewmodel and domain model differ that much I would simply have the Django app return json data and let a client side framework like React or something similar build your UI.
No need to have two of the exact same or very similar object floating around since the Django ORM object is going to be identical to your ViewModel Object.

A: If you keep your business objects separate from the persistence logic you get the awesome benefit of being able to run tests hundreds of times faster than if you couple the BO and the persistence layer.
Usually in order to test the logic that django suggests should be placed in the models, one always has to access the database. Doing so slows your tests down considerably. Unfortunately, django just isn't built to allow a very easy separation of the logic from the models (because lots of objects, like the admin and form classes have dependencies on Models, not any higher level entity)... Lots of people have this problem. We have it! I mean we've got 1 non-django project dealing with some xml processing (lots of number crunching) where the 100+ tests run in 2 seconds... and then we have the django project also with 100+ tests that runs in about a minute.
You might try the middle way: Putting as little logic in the models as humanly possible, and as much logic into a services layer... how you implement this is up to you though, I'm not aware of anyone doing this.
Here's a guy explaining why it's not ideal to put your business logic inside the models:
http://nando.oui.com.br/2014/04/01/large_apps_with_sqlalchemy__architecture.html


text:
Q: setting Transparency to the UITableView I have a view that contains a scroll view and again that contains a view and then a table view.(this table view has custom cells).
I have a background image for the top most view but the inner most table view background is blocking the image. Tableview  shows a white background .
I have to make the background of tableview as transparent so that the image on the view should be visible.
how to do that. Pls help.

A: Try:
tableView.backgroundView = nil;

A: tablecell.contentview.backgroundcolor = [UIColor clearColor];
Hope it should help..

A: You have to set the backgroundview nil before making background as transparent
tableView.backgroundView = nil;
tableView.backgroundColor=[UIColor clearColor];


text:
Q: How to fix this multiple images per slide slider?? (React) I am trying to create a multiple images per slide slider that show three images per slid, when click the right arrow a 3 new images should be shown, and when the left one clicked the previous 3 images returns back to be shown.
I can not manage to make that work so this is my code:
Slider Component (parent)
class Slider extends Component {
   state = {
     left: 0
   }

    moveToRight = () =>{
        this.setState(prevState => ({
            left: prevState.left + 500
        }))

        console.log(this.state.left)
    }

    moveToLeft = () => {
        this.setState(prevState => ({
            left: prevState.left - 500
        }))
    }
    render() {

        return (

                <Slider_content categories={this.state.categories} style={{marginLeft: `${this.state.left}px`}}/>

        );

    }
}

export default Slider;

Slider_content Component:
import React, {Component} from 'react';

class Slider_content extends Component {

    render () {
        const { categories, left } = this.props;

        return (

                    {categories.map((category, i) => (

                                {category.name}
                                View Products

                    ))}

        );
    }
}

export default Slider_content;

CSS:
.slider {
  margin-top: 3em;
  height: 100%;
  position: relative;
}

.slider__content {
  height: 100%;
  width: 100%;
  position: relative;

}

.slider__wrapper {
  height: 100%;
  flex-wrap: wrap;
  overflow: hidden;
  justify-content: space-between
}

.slider__item {
  height: 100%;
  margin : 9px;
  position: relative;
  overflow: hidden;
}

What i am doing wrong in this code, how can i manage to make the slider_content slider slides to left when click the right arrow and to right when click the left arrow??
I don't want the slider slides by 500px per click, it is just for experimenting
i need it to slide accurately to show the next 3 images in right position, i could not do that too!!


text:
Q: change package.json script from mac to windows I have a project built on MAC and the package.json script is as follows:
  "scripts": {
    "copyindex": "cp src/index.html build",
    "copycss": "cp src/cds.css build",
    "copyimages": "cp src/assets/images/** build/assets/images",
    "copyfonts": "cp src/fonts/** build/fonts",
    "copywc": "cp -r node_modules/@webcomponents/webcomponentsjs/bundles build && cp node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js build",
    "build": "rm -rf build && mkdir build && npm run copyindex && npm run copycss && mkdir build/assets && mkdir build/assets/images && npm run copyimages && mkdir build/fonts && npm run copyfonts && npm run copywc && rollup -c",
    "start": "serve build"
  },

Its running fine on MAC when run npm start. I am using windows and it doesn't run my PC. I changed most of the commands to windows commands as below. But, it still doesn't work. Is there anything else I need to do?
I am getting the errors as command is not recognized.
Error: 'rm' is not recognized as an internal or external command,
operable program or batch file.

  "scripts": {
    "copyindex": "copy src/index.html build",
    "copycss": "copy src/cds.css build",
    "copyfonts": "copy src/fonts/** build/fonts",
    "copywc": "copy -r node_modules/@webcomponents/webcomponentsjs/bundles build && copy node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js build",
    "build": "rm -rf || rmdir /s build && mkdir build && npm run copyindex && npm run copycss && mkdir build/fonts && npm run copyfonts && npm run copywc && rollup -c",
    "start": "serve build"
  },

I don't want to remove the MAC commands. I want the npm script to work in both windows and MAC

A: The challenge is that the script needs to be able to work on either Mac or Windows but doesn't know which one it is up front. Since scripting in cmd.exe, the default shell used by npm run under windows, seems very limited and the intersection of the language understood by cmd.exe and /bin/sh (default under Mac) seems virtually empty, I think your best bet is go straight into node for scripting. This is an example of how this could work:
{
 ...
 "build_win32": "rmdir /s && build && ...",
 "build_darwin": "rm -rf && build && ...",
 "build": "node -e \"child_process.exec(`npm run build_${os.platform()}`)\""
}

A: The simplest way to achieve that is probably by using shx, which can run Unix commands on any platform.
"scripts": {
  "copyindex": "shx cp src/index.html build"
  // ...
},
"devDependencies": {
  "shx": "latest"
}

Alternatively, you can also install individual packages that provide a single command, such as copyfiles for cp, rimraf for rm -rf, etc. There are many of them.
Another approach would be to write these scripts in Javascript directly and run them with Node. This can be an arguably better solution when your scripts get very long. It also doesn't require you to depend on any additional package to run your scripts.
Example for copyindex:
#!/usr/bin/env node

const fs = require("fs")
fs.copyFileSync("src/index.html", "build/index.html")

In your package.json:
"scripts": {
  "copyindex": "node scripts/copyindex.js",
  // ...
}


text:
Q: VBA - Number generator with find in substring and range I am doing number generator. I need a function to find the column match of key1 then check if key1 and key2 exist in that column, if not then Box2 will be 001. If it does exist, then Box2 will be the next free number. (See attached image for better understanding)
Box2 will be filled with right number after click to GENERATE button.
After that whole generated number is saved to next free row in right column.

This is what I currently have:
    Private Sub CommandButton1_Click()

        Dim FindRng As Range
        Dim col As Long
        Dim wb As Workbook

        Set wb = Workbooks.Open("U:\DB_DATA\DB_NUMBERS.xlsx")
        With wb.Sheets("List1")
            Set FindRng = .Range("A1:ZZ1").Find(What:=Box1.Text, LookIn:=xlValues, LookAt:=xlWhole, _
                           MatchCase:=False, SearchFormat:=False)

            If Not FindRng Is Nothing Then
               col = FindRng.Column
            Else
            End If
        End With

        BoxMain.Value = Box1.Value & "_" & Box2.Value & "_" & Box3.Value & "_" & Box4.Value & "_" & Box5.Value

    End Sub

A: I tried to write the code with some guesses since I cannot see the name of the controls or how you want to really generate the numbers and how to control the format etc. Also, I did not have the source code so that i can debug and see if there is any other problem, so this is the best I could do. If you can get it working, great, if not then send me the whole thing and I try to fit it
Private Sub CommandButton1_Click()
    Dim chk As Boolean
    Dim FindRng As Range
    Dim col As Long
    Dim wb As Workbook
    Dim ws As Worksheet

    Set wb = Workbooks.Open("U:\DB_DATA\DB_NUMBERS.xlsx")
    Set ws = wb.Sheets("List1")

    With ws
        Set FindRng = .Range("A1:ZZ1").Find(What:=Box1.Text, LookIn:=xlValues, LookAt:=xlWhole, _
                       MatchCase:=False, SearchFormat:=False)

        If Not FindRng Is Nothing Then
           chk = True
           col = FindRng.Column 'column with key1 value found, now find key2 in cells

           'Check if there is any number in the column
           Dim i As Integer
           Dim lRow As Integer
           Dim key2 As String
           Dim strSequence As String
           Dim rng As Range

           key2 = Box3.Text
           strSequence = "001" 'start with this unless we find a higher number in cells

           'find the last row with data in the column
           lRow = LastRowInColumn(ws, col)

           'numbers are written starting from row 2, so if lRow is 2 there is no number and sequence starts from 001
           If lRow <= 2 Then
                strSequence = "001"
                'Box2.Text="001" ??? I don't know the name of the textbox for sequence
           Else 'get the sequence from last row
                 Dim str As String
                 Dim arr() As String
                 For i = 2 To lRow
                    arr = Split(, "_") 'split the values of cells
                    str = Replace(arr(2), Box4.Text, "")
                    If str = key2 Then 'this is a match, check for the sequence
                        If str > strSequence Then
                        strSequence = str
                    End If
                 Next i

                 'At this point, strSequence should be the last sequence assigned, so we add one
                 strSequence = Format(CInt(strSequence) + 1, "000")
                 Box2.Text = "001"
           End If

        Else
            chk = False
            MsgBox "key 1 does not exist."
        End If
    End With

    BoxMain.Value = Box1.Value & "_" & Box2.Value & "_" & Box3.Value & "_" & Box4.Value & "_" & Box5.Value

End Sub

Function LastRowInColumn(Optional sh As Worksheet, Optional colNumber As Long = 1) As Long
    'Finds the last row in a particular column which has a value in it
    If sh Is Nothing Then
        Set sh = ActiveSheet
    End If
    LastRowInColumn = sh.Cells(sh.Rows.Count, colNumber).End(xlUp).Row
End Function

A: Hope this can solve you question, please find this link for the excel file number generator.xlsm


text:
Q: How to call/open a URL within Go method? I have a Gorilla Mux router set up in Go. I have routes set up within that router, as well as function handlers associated with those routes. The router works perfectly, if you open a browser window and enter specific URLs. However, the problem I'm running into is what to do if the URL is entered on the command line. I know how to store the URL from the command line arguments, but I don't know how to forward the URL, stored as a URL variable in Go, to the router. Like, how do you call a route's function handler if the URL is given on the command line INSTEAD of entered via browser window?
Code:
u, err := url.Parse(os.Args[1])
if err != nil {
    fmt.Println(err.Error())
}

host, port, _ := net.SplitHostPort(u.Host)

s := []string{":", port};

router := ANewRouter()

log.Fatal(http.ListenAndServe(strings.Join(s, ""), router))

//Route URL to router, somehow

A: If you're trying to make an HTTP request in Go there are easy to use methods for that purpose in the standard library at; https://golang.org/pkg/net/http/
As JimB pointed out in comment you could use something like curl and just forgo using Go altogether. Launching curl from Go doesn't make a whole lot of sense to me when you can just do resp, err := http.Get(urlArg) and get the same result. There are also methods for other HTTP verbs and if you need more fine tuned control of the request you can use the Do method and create Request object to do things like set headers.


text:
Q: MySQL transaction query help This problem is baffling me:
BEGIN;
INSERT INTO sub_users(user_id, email)
SELECT user_id FROM users WHERE email='someemail@email.com', '$email';
COMMIT;

Normally, I have multiple statements in that transactions, but I've removed those for clarity.
I get this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ' 'test@email.com'' at line 1

I'm using MySQL version 5.1.36

A: Two problems with your statement:

*

*You're not selecting email to insert (only id)

*You're using '=' instead of IN clause.

Should be something like:
INSERT INTO sub_users(user_id, email)
 SELECT user_id, email FROM users
  WHERE email IN ('someemail@email.com', 'test@email.com');

instead.
Update (based on comment)
INSERT INTO sub_users(user_id, email)
 SELECT user_id, 'test@email.com' FROM users
  WHERE email = 'someemail@email.com';

A: You have at least two errors that I can see:

*

*You are trying to insert two columns worth of data (user_id and email) but only selecting one column (user_id) from the second half of INSERT INTO ... SELECT. You must select the same number of columns as you are trying to insert, and order matters.

*You have a syntax error in the predicate of your SELECT. I think you want to use:
WHERE email IN ('email1@foo.com', 'email2@bar.com')
or its equivalent:
WHERE email = 'email1@foo.com'
   OR email = 'email2@bar.com'


text:
Q: A group of order 2p (p prime) and other conditions - prove abelian. I have G where $|G|=2p$ ; p is prime. $\exists a\in Z\left(G\right);\:a^2=e$.
I need to prove that G is abelian.
Now, let's translate it into math. To prove that G is abelian, is in other words ti prove that $Z\left(G\right)=G$, but $Z\left(G\right)\in G$, so if I prove that \left|Z\left(G\right)\right|=\left|G\right|, I've done.
Now, by lagrange's theorem, $\left|Z\left(G\right)\right|$ can be 2, p or 2p (which I want to prove).
It cant be p, because there is $a\in Z\left(G\right)$, which means $a\in G$ so $a^{2}=e$, therefore $2 : |Z(G)|$.
So I'm left with 2 and 2p. But as I see, theoretical the center can be only 2 elements: $\left\{e,a\right\}$, because all the data I have that there is there some $a$, but $a^{-1}=a$ because $a^{2}=e$, so I have for sure 2 elements.
I dont see how can i prove that there is at least one another abelian element in Z(G), because the existence of two fits perfect eather, as I can see.
Can somebody give me a hint ? Can this exercize be solved like that or Am I in the wrong direction from the first place ?
Can somebody give me a hint?

A: By hypothesis there is a central element of order two. This means that $Z(G)$ has order at least $2$. Then $[G:Z(G)]$ is either $p$ or $1$. It cannot be $p$ for it would then be cyclic, and this would force $Z(G)=G$. So it is $1$, and $Z(G)=G$.


text:
Q: PHP thread can't unlink files? When creating a new PHP child thread it becomes unable to delete files using unlink(). is there a good reason for that limitation or I'm forgetting something?
I get a worning:

Warning: unlink(downloads/1e6f6fa1c0552a1af9058f10216b40e8): No such
  file or directory

although the file is created in the destination folder, and when I run the same command outside the thread function it deletes the file as it should.
//multithreading class
<?php
class download extends Thread {
public $i;
    public $res;
public function __construct($s){
    $this->i = $s;
}
public function run() {
try{
    $url = "http://my.link.com/{$this->i}";
    set_time_limit(0);
    $id = md5(uniqid());
    $tempName = md5($id.time());
    $tmp = "downloads/{$tempName}";
    $fp = fopen (dirname(__FILE__) . '/'.$tmp, 'w+');
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 50);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    require('scanner.php');
    $results = scanfiles($tmp);
    unlink($tmp);
    $this->res = $results;
}catch(Exception $e){
    $this->res = '0';
}}} ?>

A: Into fopen you're passing absolute path (dirname(__FILE__) . "/{$tmp}") while into unlink relative path, just use abslute everywhere and it should work. Btw you can use just __DIR__ instead dirname(__FILE__) since PHP 5.3.


text:
Q: The field closure of a countable union of countable fields is countable? If $ K_1 \subset K_2\cdots \subset K_n \subset \cdots$ is a tower of countable fields then their union  $  \bigcup_n  K_n$ is a countable field.
If $\{K_a\}$ is a countable family, but not a tower, of countable subfields of a field $F$, the field closure $\langle \bigcup_a K_a\rangle$ in $F$ is  countable?
Note that here the  field closure is not an algebraic extension of fields.
This question came from  The exponential extension of $\mathbb{Q}$ is a proper subset of $\mathbb{C}$?.

A: This is really the sort of Löwenheim-Skolem type argument.
Take the union of the fields $K$, it is a countable set. Now define by induction a sequence of sets, whose union is a field containing $K$. At each step you gather all the products and sums and inverses of elements from the previous step.
Now since $K$ is countable the first step of the induction is countable, and by induction all the sets generated are countable. Finally, the union of these is countable and it is not hard to see it is a subfield of $F$.

A: Hint: look for a tower of subfields of $F$ whose union is the field you're looking for.


text:
Q: Why am I getting a "Cannot read property 'length' of undefined" error when I try to install React-Bootstrap using "npm i react-bootstrap"? I'm following a full-stack MERN tutorial, and after using the "npx create-react-app" command to create the react application smoothly, everything is compiling & running properly, but as SOON AS I try to install the React-Bootstrap library using the regular "npm i react-bootstrap" in the command line of Visual Studio Code OR Windows CMD, I'm getting the "Cannot read property 'length' of undefined". Could somebody PLEASE explain how to get rid of that error so that I can install React-Bootstrap? I'm unable to proceed further, and I would really appreciate if someone could help me out!

A: So one of the users in the comments suggested installing the "LTS" version of Node.js, instead of the one that's shown with "latest features" on their website. And indeed, installing the LTS version of Node.js fixed the problem! I don't understand though, how literally, an updated version of Node.js with "latest features" could throw errors/get stuck on installing libraries via npm. Regardless, this particular issue has now been resolved.

A: Updating Node using nvm install --lts solved it for me and I was able to install the package.


text:
Q: how to bind a hotkey with preserving its default behaviour language = de
~Alt & Shift::
~Shift & Alt::
    if (language == "de") {
        language = en
    }
    else {
        language = de
    }
    msgbox % language
Return

This is the code Im working on, binding a work to Alt+Shift. But I wanna preserve the default behavior of Alt+Shift which seems to be disabled after this code runs.
Any Ideas?

A: Use ~Alt & ~Shift:: instead of ~Alt & Shift::.
The tilde ~ prefix makes a hotkey keep its original function. As far as I understand,
~Alt & Shift::msgbox

could be translated into the following:
~Alt::    ; Alt enables the detection of a shift press
hotkey, Shift, shift, ON    ; OVERRIDES the normal shift behavior, not keeping it (~Shift)
hotkey, Shift up, shiftUp, ON
return

shift:
msgBox
return

shiftUp:
hotkey, Shift, shift, OFF
hotkey, Shift up, shiftUp, OFF
return

. Alt is a hotkey and Shift also is one, being activated on Alt pressure. But that very Shift hotkey overwrites any normal shift behaviour.
So, alt & shift is actually two different hotkeys combined to one. Each of them needs to be prefixed with its own options.

My solution works with another concurring AutoHotkey script. But it seems not with the windows built-in hotkey shift+alt aka alt+shift. Even if the ahk hotkey trigger looks like that
~Alt & ~Shift::

, this will STILL override the usual behavior which is Window's language switching mechanism. I do not know the reason behind it, maybe someone else does? I can only think of a (fairly simple) workaround:
~Alt & ~Shift::
send {alt down}{shift}{alt up}
; (your other actions)
return

In this case, you might even want to remove the ~'s in order to prevent confusion.


text:
Q: Yii 2 Separate User Instance in Module I have two different user table(editors and users) in database. User table as you know and the Editor table is just using in module.
I use this way to separating user instances from between module and main application in Yii 1.1.
But I can't find a way in yii 2. I try extend yii\web\User and I change user class in module but same results. If I login in module, same User instance is accessible from out of module and anywhere.
My module init like this:
public function init()
{
    parent::init();

    \Yii::$app->set('user', [
        'class' => 'app\modules\yonetim\components\yonetimUser',
        'identityClass' => 'app\models\Editor',
        'enableAutoLogin' => true,
        'loginUrl' => ['yonetim/default/login'],
    ]);
}

Also I try this way; in config.php
'components' => [
    'user' => [
        'identityClass' => 'app\models\User',
        'enableAutoLogin' => true,
    ],
    'editor' => [
        'class' => 'yii\web\User',
        'identityClass' => 'app\models\Editor',
        'enableAutoLogin' => true,
    ],
],

But this time I don't use authorization roles(like @)
How can I use different User instance in my module ?

A: I found another way for different login instance. Yii2 uses session id param for authentication. So we need to change it.
Change your modules\module_name\module_name.php file to looks like this:
public function init()
{
    parent::init();

    Yii::$app->set('user', [
        'class' => 'yii\web\User',
        'identityClass' => 'app\models\Editor',
        'enableAutoLogin' => false,
        'loginUrl' => ['yonetim/default/login'],
        'identityCookie' => ['name' => 'editor', 'httpOnly' => true],
        'idParam' => 'editor_id', //this is important !
    ]);
}

idParam value defined in yii\web\User as default:  $idParam = '__id';
So if we change this value, app and module use different user instances.

A: I've not tested this, but you may find something like switchIdentity() works, so in your module use this;
public function init()
{
    parent::init();
    $editor = new app\models\Editor
    $user = Yii::$app->user;
    $user->switchIdentity($editor);

}

A: You can set different session names for your application:
'components' => [
    'session' => [
        'name' => 'application-session-name',
    ],
],

And for the module:
'components' => [
    'session' => [
        'name' => 'module-session-name',
    ],
],


text:
Q: PyQt5 show fullscreen dialog I would like my dialog be fullscreen. I use that code:
import sys
from PyQt5.QtWidgets import QApplication, QDialog

app = QApplication(sys.argv)
dialog = QDialog()
dialog.showFullScreen()
app.exec()

But dialog keeps its normal state. My platform is Ubuntu 16.04.

A: Thanks to @ekhumoro hint, it is strange Ubuntu bug. The solution is:
import sys
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtCore import Qt

app = QApplication(sys.argv)
dialog = QDialog()
dialog.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowType_Mask)
dialog.showFullScreen()
app.exec()


text:
Q: Issue with grunt file when going to production I developed my web project using Yeoman Angular Generator 0.15.1
It correctly works in test (with grunt serve), but I am having troubles with distributing it.
In particular:

*

*I don't see any views folder in my dist, in fact I get a 404 error
when loading the home page: it should include main.html as first
content, but it cannot find it:

*style files (main.d41d8cd9.css and style.d41d8cd9.css) are empty

*images are not copied to dist

*languages are not copied to dist

*font awesome is not working

Notice that translate filters correctly work.
If I manually copy images and languages folders and copy my css content into the existing files, everything works correctly (but font awesome).
This is my index.html file:
<!doctype html>

  <meta charset="utf-8">
  <title>My title</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="styles/main.css"/>
  <link rel="stylesheet" href="styles/style.css"/>

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                data-target="#js-navbar-collapse">
          Navigation

        </button>

Home

This is my app structure:

This is the dist folder structure:

This is my Gruntfile.js (I dropped what I considered not useful):
// Generated on 2016-06-24 using generator-angular 0.15.1
'use strict';

module.exports = function (grunt) {

require('time-grunt')(grunt);

require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
cdnify: 'grunt-google-cdn'
});

var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'dist'
};

// Define the configuration for all the tasks
grunt.initConfig({

// Project settings
yeoman: appConfig,

// The actual grunt server settings
connect: {
  // more code for test and connect
  dist: {
    options: {
      open: true,
      base: '<%= yeoman.dist %>'
    }
  }
},

// Empties folders to start fresh
clean: {
  dist: {
    files: [{
      dot: true,
      src: [
        '.tmp',
        '<%= yeoman.dist %>/{,*/}*',
        '!<%= yeoman.dist %>/.git{,*/}*'
      ]
    }]
  },
  server: '.tmp'
},

// Add vendor prefixed styles
postcss: {
  options: {
    processors: [
      require('autoprefixer-core')({browsers: ['last 1 version']})
    ]
  },
  server: {
    options: {
      map: true
    },
    files: [{
      expand: true,
      cwd: '.tmp/styles/',
      src: '{,*/}*.css',
      dest: '.tmp/styles/'
    }]
  },
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/styles/',
      src: '{,*/}*.css',
      dest: '.tmp/styles/'
    }]
  }
},

// Automatically inject Bower components into the app
wiredep: {
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    ignorePath: /\.\.\//
  },
  test: {
    devDependencies: true,
    src: '<%= karma.unit.configFile %>',
    ignorePath: /\.\.\//,
    fileTypes: {
      js: {
        block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
        detect: {
          js: /'(.*\.js)'/gi
        },
        replace: {
          js: '\'{{filePath}}\','
        }
      }
    }
  },
  sass: {
    src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
    ignorePath: /(\.\.\/){1,2}bower_components\//
  }
},

// Compiles Sass to CSS and generates necessary files if requested
compass: {
  options: {
    sassDir: '<%= yeoman.app %>/styles',
    cssDir: '.tmp/styles',
    generatedImagesDir: '.tmp/images/generated',
    imagesDir: '<%= yeoman.app %>/images',
    javascriptsDir: '<%= yeoman.app %>/scripts',
    fontsDir: '<%= yeoman.app %>/styles/fonts',
    importPath: './bower_components',
    httpImagesPath: '/images',
    httpGeneratedImagesPath: '/images/generated',
    httpFontsPath: '/styles/fonts',
    relativeAssets: false,
    assetCacheBuster: false,
    raw: 'Sass::Script::Number.precision = 10\n'
  },
  dist: {
    options: {
      generatedImagesDir: '<%= yeoman.dist %>/images/generated',
    }
  },
  server: {
    options: {
      sourcemap: true
    }
  }
},

// Renames files for browser caching purposes
filerev: {
  dist: {
    src: [
      '<%= yeoman.dist %>/scripts/{,*/}*.js',
      '<%= yeoman.dist %>/styles/{,*/}*.css',
      '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
      '<%= yeoman.dist %>/styles/fonts/*'
    ]
  }
},

// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>',
    flow: {
      html: {
        steps: {
          js: ['concat', 'uglifyjs'],
          css: ['cssmin']
        },
        post: {}
      }
    }
  }
},

// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
  options: {
    assetsDirs: [
      '<%= yeoman.dist %>',
      '<%= yeoman.dist %>/images',
      '<%= yeoman.dist %>/styles'
    ],
    patterns: {
      js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
    }
  }
},

// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s  will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
//  cssmin: {
//    dist: {
//     files: {
//       '<%= yeoman.dist %>/styles/main.css': [
//          '.tmp/styles/*.css'
//        ]
//     }
//   }
//  },
//  uglify: {
//    dist: {
//      files: {
//        '<%= yeoman.dist %>/scripts/scripts.js': [
//          '<%= yeoman.dist %>/scripts/scripts.js'
//        ]
//      }
//    }
// },
// concat: {
//   dist: {}
// },
//
// imagemin: {
//   dist: {
//     files: [{
//       expand: true,
//       cwd: '<%= yeoman.app %>/images',
//       src: '{,*/}*.{png,jpg,jpeg,gif}',
//       dest: '<%= yeoman.dist %>/images'
//     }]
//   }
// },
//
// svgmin: {
//   dist: {
//     files: [{
//       expand: true,
//       cwd: '<%= yeoman.app %>/images',
//       src: '{,*!/}*.svg',
//       dest: '<%= yeoman.dist %>/images'
//     }]
//   }
// },

htmlmin: {
  dist: {
    options: {
      collapseWhitespace: true,
      conservativeCollapse: true,
      collapseBooleanAttributes: true,
      removeCommentsFromCDATA: true
    },
    files: [{
      expand: true,
      cwd: '<%= yeoman.dist %>',
      src: ['*.html'],
      dest: '<%= yeoman.dist %>'
    }]
  }
},

// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/concat/scripts',
      src: '*.js',
      dest: '.tmp/concat/scripts'
    }]
  }
},

// Replace Google CDN references
cdnify: {
  dist: {
    html: ['<%= yeoman.dist %>/*.html']
  }
},

// Copies remaining files to places other tasks can use
copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= yeoman.app %>',
      dest: '<%= yeoman.dist %>',
      src: [
        '*.{ico,png,txt}',
        '*.html',
        'images/{,*/}*.{webp}',
        'styles/fonts/{,*/}*.*'
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: ['generated/*']
    }, {
      expand: true,
      cwd: '.',
      src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
      dest: '<%= yeoman.dist %>'
    }]
  },
  styles: {
    expand: true,
    cwd: '<%= yeoman.app %>/styles',
    dest: '.tmp/styles/',
    src: '{,*/}*.css'
  }
},

// Run some tasks in parallel to speed up the build process
concurrent: {
  server: [
    'compass:server'
  ],
  test: [
    'compass'
  ],
  dist: [
    'compass:dist',
    //'imagemin',
    //'svgmin'
  ]
},

// Test settings
karma: {
  unit: {
    configFile: 'test/karma.conf.js',
    singleRun: true
  }
}
});

grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
  return grunt.task.run(['build', 'connect:dist:keepalive']);
}

grunt.task.run([
  'clean:server',
  'wiredep',
  'concurrent:server',
  'postcss:server',
  'connect:livereload',
  'watch'
]);
});

grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'postcss',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);

grunt.loadNpmTasks('grunt-contrib-cssmin');

};


text:
Q: How to modify this query to show the total number of employees and percent completion in each division? I have the following database design:
Employee Table: Username, Name, DivisionCode
Division Table: SapCode, DivisionShortcut
Courses Table: CourseID, CourseName, GroupID
Groups Table: GroupID, GroupName
Employee_Courses Table: EmployeeID, CourseID

I came up with the following query that shows the divisions, courses and the total number of participants in each division:
SELECT     dbo.Divisions.DivisionShortcut, dbo.courses.CourseName, COUNT(dbo.employee_courses.courseId) AS [Total Number of Participants]
FROM         dbo.courses INNER JOIN
                      dbo.employee_courses ON dbo.courses.CourseID = dbo.employee_courses.courseId INNER JOIN
                      dbo.groups ON dbo.courses.GroupID = dbo.groups.ID RIGHT OUTER JOIN
                      dbo.employee AS employee_1 INNER JOIN
                      dbo.Divisions ON employee_1.DivisionCode = dbo.Divisions.SapCode ON dbo.employee_courses.employeeId = employee_1.Username
WHERE     (dbo.courses.GroupID = 1)
GROUP BY dbo.courses.CourseID, dbo.courses.CourseName, dbo.Divisions.DivisionShortcut

In addition to be shown above, I want to display the total number of employees in each division and the percent completion in each division, too. By the way, the percent completion is equal to (total number of participants in each course / total number of employees in each division)
So how to do that?

A: You could use a subquery to add the total employee count to the join on Divisions.  For example:
SELECT  d.DivisionShortcut
,       c.CourseName
,       d.EmployeeCount as DivisionEmployees
,       count(c.courseId) as CompletedCourses
,       100.0 * count(c.courseId) / d.EmployeeCount as PercentageCompleted
FROM    dbo.courses c
JOIN    dbo.employee_courses ec
ON      c.CourseID = ec.courseId
JOIN    dbo.employee e
ON      ec.employeeId = e.Username
JOIN    (
        select  d2.SapCode
        ,       d2.DivisionShortcut
        ,       count(e2.DivisionCode) as EmployeeCount
        from    dbo.Divisions d2
        JOIN    dbo.employee e2
        ON      d2.SapCode = e2.DivisionCode
        group by
                d2.SapCode
        ,       d2.DivisionShortcut
        ) d
ON      d.SapCode = e.DivisionCode
WHERE   c.GroupID = 1
GROUP BY
        d.DivisionShortcut
,       d.EmployeeCount
,       c.CourseName


text:
Q: How do I stop my sql query from displaying the results twice? How do I stop the results from getting displayed twice on the web page? What have I done wrong? Yes this is for a game but it helps me learn SQL and PHP. Please be genital it's my first time.
There is one database with two tables. The database is game_tittle the two tables are player_data and the second is character_data.
<?php
include('db_conn.php');
#for connecting to SQL
$sqlget = "SELECT player_data.PlayerName, Character_data.Duration, character_data.KillsZ, character_data.KillsB, character_data.KillsH, character_data.HeadshotsZ, character_data.Humanity, character_data.Generation, character_data.InstanceID FROM player_data, character_data";
$sqldata = mysqli_query($dbcon, $sqlget) or die('error getting data');
echo "
";
echo "
 Player Name	play time	Total Kills	Bandit kills	Hero Kills	Head shots	Humanity	Alive count	Instance ID
";
  while ($row = mysqli_fetch_array($sqldata)) {

    echo "
";
    echo $row['PlayerName'];
    echo "	";
    echo $row['Duration'];
    echo "	";
    echo $row['KillsZ'];
    echo "	";
    echo $row['KillsB'];
    echo "	";
    echo $row['KillsH'];
    echo "	";
    echo $row['HeadshotsZ'];
    echo "	";
    echo $row['Humanity'];
    echo "	";
    echo $row['Generation'];
    echo "	";
    echo $row['InstanceID'];
    echo "
";
    echo "";
    }

    echo "
";
    #end of table

?>

Got it to work this way.
<?php
include('db_conn.php');
$sqlget = "SELECT player_data.PlayerUID, character_data.PlayerUID, player_data.PlayerName, character_data.HeadshotsZ, character_data.KillsZ, character_data.KillsH, character_data.KillsB, character_data.Alive, character_data.Generation, character_data.Humanity, character_data.InstanceID FROM player_data INNER JOIN character_data ON player_data.PlayerUID = character_data.PlayerUID";
$sqldata = mysqli_query($dbcon, $sqlget) or die('error getting data');
echo "
";
echo "
 Player Name	Head shots	Total Kills	Hero kills	Bandit Kills	Live or dead	Lifes	Humanity	Instance ID
";
  while ($row = mysqli_fetch_assoc($sqldata)) {

    echo "
";
    echo $row['PlayerName'];
    echo "	";
    echo $row['HeadshotsZ'];
    echo "	";
    echo $row['KillsZ'];
    echo "	";
    echo $row['KillsH'];
    echo "	";
    echo $row['KillsB'];
    echo "	";
    echo $row['Alive'];
    echo "	";
    echo $row['Generation'];
    echo "	";
    echo $row['Humanity'];
    echo "	";
    echo $row['InstanceID'];
    echo "
";
    echo "";
    }

    echo "
";
    #end of table

?>

A: Bug in your SQL-query: You forgot to join the tables with a "where"-clause.


text:
Q: Spyder ignores .pycodestyle I am using Spyder v.3.2.8 and I'm trying to modify the Real-time code style analysis. For example, I'd like to set the max-line-length to 99.
I exactly followed what was suggested here, i.e. I created a file .pycodestyle in the directory resulting from import os; os.path.expanduser('~'). The file looks as follows
[pycodestyle]
ignore = E226,E302,E41,E501,W503
max-line-length = 99

I am aware that ignoring E501 renders max-line-length virtually ineffective. However, I still get warnings if the code exceeds the default 79 columns. Am I missing something?
EDIT:
The issue is solved now. All of a sudden, the settings are recognized. A reboot might have helped (OS: Windows 10).

A: I had the same problem and I have resolved it by creating a file ~/.config/pycodestyle (without a dot and inside ~/.config) instead of ~/.pycodestyle, according to the official website:

*

*https://pep8.readthedocs.io/en/latest/intro.html#configuration


text:
Q: Formulario de login/registro con Laravel 5 Tengo un formulario de login y uno de registro y el problema esta con el email. Si yo en las reglas de validación no agrego el tipo email:
'email' => 'required|unique:users,email',

y sin querer registro un email con espacios al principio o al final lo registra: por ej: "  miemail@laravel.com  ", dando error después al momento de loguearse.
Ahora, si le agrego el tipo email:
'email' => 'required|unique:users,email',

y quiero registrar y sin querer agrego un espacio, me dice que el email ingresado no es válido.
En mi opinión, no tendría que permitirse agregar con espacios al principio o final, y luego quitarse al momento del registro?

A: Ese problema lo solucionó Laravel en su versión 5.4 con el middleware TrimStrings, simplemente basta con agregarlo a App/Kernel.php para que elimine los espacios antes y después de las "strings" de los request, como el correo en este caso.
Agrega la siguiente línea al archivo en mención:
\Illuminate\Foundation\Http\Middleware\TrimStrings::class,

El código de este middleware es el siguiente:
<?php

namespace Illuminate\Foundation\Http\Middleware;

class TrimStrings extends TransformsRequest
{
    /**
     * The attributes that should not be trimmed.
     *
     * @var array
     */
    protected $except = [
        //
    ];

    /**
     * Transform the given value.
     *
     * @param  string  $key
     * @param  mixed  $value
     * @return mixed
     */
    protected function transform($key, $value)
    {
        if (in_array($key, $this->except, true)) {
            return $value;
        }
        return is_string($value) ? trim($value) : $value;
    }
}


text:
Q: How often do netbook parts break? I need to know a list of how many percentage of all components break within a year.
For example I would need to know how many percent of all netbook RAM is calculated to break within a year?
This is a lot to ask, I know. But I really do need to know some facts on what to except to break when you have a lot of netbooks. Would be glad if someone had hard facts that could be backed up with resources.
Only netbooks are considered.

A: Netbooks are identical to laptops in this sense: their manufacturers consider failure information to be proprietary, and won't release it. So actual, industry-wide, figures are effectively unobtainable.
In a general sense, however, you're more likely to have a hard drive or a fan fail than to have a solid-state component like RAM fail. Netbooks, like laptops, are subject to a wide variety of vibration damage due to their mobile nature. Screens will be cracked, machines will be dropped.
If you're thinking of deploying netbooks en masse I'd suggest getting the maximum warranty on each one and sending them back whenever they have an error, and making it the manufacturers problem. When the warranty expires, throw the dead ones away. Where I work, we've been doing that with laptops for years, and it's really streamlined the whole process...Maintaining mobile computers is such a huge p.i.t.a, that it's far more economical just to have a few dozen spares lying around, than to have a bunch of guys whose sole job is to try and fix broken ones.


text:
Q: Convert string in Class name (from appengine datastore to class)
Possible Duplicate:
Does python have an equivalent to Java Class.forName()?

I'm using appengine to develop an application. Ideally I would like to define a new kind (called Recipe) like this:
class Recipe(db.Model):
    ingredients = db.ListProperty(type)
    quantities = db.ListProperty(int)

However it seems that you cannot use "type" as the class value in ListProperty. I was thinking of instead of using ListProperty, using ListStringProperty and save the class names as strings. However, how do I convert a string to a class name, so I can write like this:
str = "A"
# convert str to class name in var class_str
class_str().call_some_method()

Thanks in advance,
Jose

A: I suggest you make ingredient a list of strings, populate it with the pickle.dumps of the types you're saving, and, upon retrieval, use pickle.loads to get a type object back.
pickle serializes types "by name", so there are some constraints (essentially, the types must live at the top level of some module), but that's way handier than doing your own serialization (and, especially, deserializaton) of the type names, which would essentially entail you repeating a bit of the work that pickle can already do on your behalf!-)

A: Maybe you can use eval, like this?
class Juice(object):
    def amount(self):
        print "glass of juice"

juice = "Juice"
eval(juice)().amount()
# prints "glass of juice"


text:
Q: Word/Phrase similar to "Take to the Extreme" I am looking for a word (verb preferable, other constructions welcome) or short phrase that's similar to "Take to the Extreme", with a connotation of a logical conclusion, but avoiding stating that the conclusion has been rigorously inferred.
For example, consider the following passage: "Many patrons of our restaurant enjoy the southwest chicken sandwich, but we'd like to improve upon it. Without exception, they say that the chicken in the salad is what makes it tasty. Therefore, I propose we _________ this feedback and serve the chicken as its own dish!"
In this scenario, assume that replacing the sandwich menu item with its chicken component is the most drastic action that can be taken that has some root in the feedback given by the patrons. Serving chicken on its own could be good or bad, i.e it is a conclusion that is not unassailable (maybe the feedback is from a bad sample of patrons, etc). Therefore "take this feedback to its logical conclusion" doesn't quite work. "Take this feedback to the extreme" works to an extent, but I am wondering if there are alternatives. I'd like to make sure I'm conveying that the action is a reasonable thing to try.

A: incorporate
https://www.merriam-webster.com/dictionary/incorporate
It doesn't have the connotation of being extreme, and indicates that the feedback might be reasonable.
test
https://www.merriam-webster.com/dictionary/test
If you really want to get across that you're uncertain about the outcome of following the feedback, you would want to test it. Maybe it passes, maybe it fails, but you won't know unless you test it.
A single word that indicates that following the feedback is extreme eludes me at the moment (though serving chicken alone doesn't seem extreme in the slightest!), so hopefully someone else can chime in there.

A: An obvious choice is build on, two orthographic words but considered a single lexeme ('phrasal verb' in their terms) by Cambridge Dictionary:

build on something — phrasal verb with build  as [the related simplex] verb ...
to use a success or achievement as a base from which to achieve
  more success:
We must build on our reputation to expand the business.

Though I can't really envisage Chicken Extreme.
And go the whole hog doesn't really work here.
'Respond to' would work in the context you give, but is too general.


text:
Q: How to set Property value using Reflection? I try to build a Generic Method which take class and set value using reflection and return a class type.
protected static T GetSecureModel<T>(T model)
        {
            T secureModel = default(T);

            foreach (var property in model.GetType().GetProperties())
            {

                    if (string.CompareOrdinal(property.PropertyType.FullName, "System.String") == 0)
                    {
                        property.SetValue(property.Name, property.GetValue(model, null).ToString(), null);
                    }
             }

              return secureModel;
}

How to return a Class after set value ?

A: OK. I solve it. Check below code, It may be helpful for someone.
   protected static T GetSecureModel<T>(T model)
        {
            bool secureData = false;

            T secureModel = default(T);

            foreach (var property in model.GetType().GetProperties())
            {
                if (property.GetValue(model, null) != null && property.GetValue(model, null).ToString() != _blankGuid && property.GetValue(model, null).ToString() != _zero)
                {
                    if (string.CompareOrdinal(property.PropertyType.FullName, _uniqueIdentifier) == 0)
                    {
                        model.GetType().GetProperty(property.Name).SetValue(model, new Guid(Sanitizer.GetSafeHtmlFragment(property.GetValue(model, null).ToString())), null);
                    }
                    else if (string.CompareOrdinal(property.PropertyType.FullName, _numeric) == 0)
                    {
                        model.GetType().GetProperty(property.Name).SetValue(model, int.Parse(Sanitizer.GetSafeHtmlFragment(property.GetValue(model, null).ToString())), null);
                    }
                    else if (string.CompareOrdinal(property.PropertyType.FullName, _string) == 0)
                    {
                        model.GetType().GetProperty(property.Name).SetValue(model, Sanitizer.GetSafeHtmlFragment(property.GetValue(model, null).ToString()), null);
                    }

                    secureData = true;
                }

            }

            if (secureData)
            {
                secureModel = model;
            }

            return secureModel;
        }


text:
Q: Nestjs Jest Unit Test: Basic test failure - Jest configuration I have a simple Jest test for my Nest JS project.
The Jest looks like:
import { Test, TestingModule } from '@nestjs/testing';
import { IbmVpcController } from './ibm.vpc.controller';
import { IbmVpcServiceMock } from './ibm.vpc.service.mock';
import { ModuleMocker, MockFunctionMetadata } from 'jest-mock';
import { MOCKED_VPC } from '../../repository/ibm/mock.vpc.data';

const moduleMocker = new ModuleMocker(global);

describe('IbmVpcController', () => {
  let controller: IbmVpcController;

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      controllers: [IbmVpcController],
      providers: [IbmVpcServiceMock]
    })
      .useMocker((token) => {
        if (token === IbmVpcServiceMock) {
          return {
            list: jest.fn().mockResolvedValue(MOCKED_VPC.VPCs),
            get: jest.fn().mockResolvedValue(MOCKED_VPC.VPCs[0]),
            create: jest.fn().mockResolvedValue(MOCKED_VPC.VPCs[0]),
            update: jest.fn().mockResolvedValue(MOCKED_VPC.VPCs[0]),
          };
        }
        if (typeof token === 'function') {
          const mockMetadata = moduleMocker.getMetadata(token) as MockFunctionMetadata<any, any>;
          const Mock = moduleMocker.generateFromMetadata(mockMetadata);
          return new Mock();
        }
      })
      .compile();

    controller = module.get<IbmVpcController>(IbmVpcController);
  });

  it('should be defined', () => {
    expect(controller).toBeDefined();
  });
});

My jest.config.js looks like:
module.exports = {
  verbose: true,
  preset: "ts-jest",
  testEnvironment: "node",
  roots: ["./src"],
  transform: { "\\.ts$": ["ts-jest"] },
  testRegex: "(/__test__/.*|(\\.|/)(spec))\\.ts?$",
  moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
  transformIgnorePatterns: [
    '<rootDir>/node_modules/',
  ],
  globals: {
    "ts-jest": {
      tsconfig: {
        // allow js in typescript
        allowJs: true,
      },
    },
  },
};

However it is failing with the following error:
 FAIL  apps/protocols/src/ibm/vpc/ibm.vpc.controller.spec.ts
  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    C:\Users\pradipm\clients\CloudManager\cm_6\occm\client-infra\nest-services\node_modules\axios\index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import axios from './lib/axios.js';
                                                                                ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      at Runtime.createScriptFromCode (../../node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (../../node_modules/retry-axios/src/index.ts:124:1)

Now able to get it what I am missing in my typescript Nest's Jest configuration.
Basically I tried out some more options also:

*

*I tried out specifying the transformIgnorePatterns as only '/node_modules/'.

*Tried out excluding the lodash-es', 'axios'

*Tried out transformIgnorePattens as '/lib/' (where axois is there)

*Added allowJs: true in the tsconfig.app.json compileOptions.

Any help to get trough my first basic test would be helpful.

A: With axios version 1.1.2 there's a bug with jest. You can resolve it by adding moduleNameMapper: { '^axios$': require.resovle('axios') } to your jest configuration


text:
Q: How does photodiode works when use in reverse-biased photoconductive mode? I wanted to know the basic principal behind the working of a photodiode in reverse-biased photoconductive mode. What happens at the atomic level ?

A: Conceptually, it is very simple. Photodiodes are just exposed PN or PIN junctions. Reverse biasing means there is an electric field over the junction. When a photon of sufficient energy hits the junction and is absorbed, this creates a free electron-hole pair which is accelerated towards the anode/cathode by the electric field, thus creating current.
Visible light is coincidentally well-suited to this kind of operation, because the absorptivity of most semiconductors is fairly high in the visible region, while the required energy to excite an electron beyond the bandgap voltage is 0.6-1eV, which is exactly the amount of energy contained in a just-infrared photon (1200-1400nm). Higher energy photons (red, green, blue) get absorbed just as well, but the excess energy is converted into heat.


text:
Q: Modelling soil texture using ArcGIS for Desktop? I am doing a project for automated soil mapping using landsat TM imagery,
I have 3 output rasters: one for sand percentage one for silt percentage and a third for clay percentage.
How can I incorporate these three rasters to get an output raster where pixels are classified on the basis of percent silt sand and clay according to USDA soil textural triangle?
I want my model to symbolize it on the go, for example green represents silty loam in my map etc.
I am using ArcGIS 10.2 and want to do the work in a form of model.

A: If you go to this site (I did nothing more than a simple Google search) there is an online calculator. Right at the top is a link to an Excel file this appears to contain all the logic you require to compute your soil texture type. I would suggest you look there first as all you need to do is transfer that logic to a python/model environment.
As for symbolizing it you could create a pre-built layer file with the appropriate symbology set and you apply that to the final dataset.


text:
Q: How to use the name of the file with sed in a find expression Trying to answer Using Bash/Perl to modify files based on each file's name I ended in a point in which I don't know how to use find and sed all together.
Let's say there is a certain structure of files in which we want to change a line, appending the name of the file.
If it was a normal for loop we would do:
for file in dir/*
do
   sed -i "s/text/text plus $file/g" $file
done

But let's say we want to use find to change files from all subdirectories. In this case, I would use...
find . -type f -exec sed -i "s/text/text plus {}/g" {} \;
                                              ^
                                   it does not like this part

but these {} within sed are not accepted and I get the error

sed: -e expression #1, char 20: unknown option to `s'

I found some similar questions (1) but could not generalize it enough to make it understandable for me in this case.
I am sure you guys will come with a great solution for this. Thanks!

A: I really think the issue is that your files name contains a / that is why sed believes it start the options strings.
Replace / by @ in you sed command would do the job.
I try that on Linux BASH and it work perfectly
find . -type f -exec sed -i -e "s@text@test plus {}@g" {} \;

A: find would return pathnames (relative or absolute) depending upon the path you specify.
This would conflict with the delimiter you've specified, i.e. /.  Change the delimiter for sed and you should be good:
find . -type f -exec sed -i "s|text|text plus {}|g" {} \;

EDIT: For removing the leading ./ from the paths, you can try:
find . -type f -exec sh -c '$f={}; f=${f/.\//}; sed -i "s|text|text plus ${f}|g" {}' \;

I'm certain that better solutions might exist ...


text:
Q: Untransform after OneHotEncoder I'm using sklearn's OneHotEncoder, but want to untransform my data. any idea how to do that?
>>> from sklearn.preprocessing import OneHotEncoder
>>> enc = OneHotEncoder()
>>> enc.fit([[0, 0, 3], [1, 1, 0], [0, 2, 1], [1, 0, 2]])
>>> enc.n_values_
array([2, 3, 4])
>>> enc.feature_indices_
array([0, 2, 5, 9])
>>> enc.transform([[0, 1, 1]]).toarray()
array([[ 1.,  0.,  0.,  1.,  0.,  0.,  1.,  0.,  0.]])

but I want to be able to do the following:
>>> enc.untransform(array([[ 1.,  0.,  0.,  1.,  0.,  0.,  1.,  0.,  0.]]))
[[0, 1, 1]]

How would I go about doing this?
For context, I've built a neural network that learns the one-hot encoding space, and want to now use the nn to make real predictions that need to be in the original data format.

A: For Inverting a single one hot encoded item
  see: https://stackoverflow.com/a/39686443/7671913
from sklearn.preprocessing import OneHotEncoder
import numpy as np

orig = np.array([6, 9, 8, 2, 5, 4, 5, 3, 3, 6])

ohe = OneHotEncoder()
encoded = ohe.fit_transform(orig.reshape(-1, 1)) # input needs to be column-wise

decoded = encoded.dot(ohe.active_features_).astype(int)
assert np.allclose(orig, decoded)

For Inverting an array of one hot coded items see (as stated in the comments)
see:
How to reverse sklearn.OneHotEncoder transform to recover original data?
Given the sklearn.OneHotEncoder instance called ohc, the encoded data (scipy.sparse.csr_matrix) output from ohc.fit_transform or ohc.transform called out, and the shape of the original data (n_samples, n_feature), recover the original data X with:
recovered_X = np.array([ohc.active_features_[col] for col in out.sorted_indices().indices])
            .reshape(n_samples, n_features) - ohc.feature_indices_[:-1]


text:
Q: Import functions in Matlab for every local function I have an m-file with a couple of tests defined as local functions. They are called from the main function:
function tests = main_function_test()
    tests = functiontests(localfunctions);
end

I am doing assertions with some tolerance, so I need to import in each local function:
import matlab.unittest.constraints.IsEqualTo;
import matlab.unittest.constraints.AbsoluteTolerance;

in order to make assertions of the form:
verifyThat(testCase, actual, IsEqualTo(expected, ...
        'Within', AbsoluteTolerance(0.00001)));

Is it possible to import those functions just once so they can be reused in each local function?

A: This is not possible per the documentation:

Scope is the function and the function does not share the import list of the parent function. If the import list is needed in a MATLAB function or script and in any local functions, you must call the import function for each function.

That being said, you could use eval with the output from import (cell array of strings) but it's extremely poor coding practice and I highly recommend against doing it.
function trialcode
import matlab.unittest.constraints.IsEqualTo;
import matlab.unittest.constraints.AbsoluteTolerance;

importlist = import;
sub1(importlist)
end

function sub1(L)
for ii = 1:length(L)
    estr = sprintf('import %s', L{ii});
    eval(estr);
end
disp(import)
end

Again, this is technically possible but please don't do it this way. You have little control over the imports (and controlling logic would likely be longer than implicitly importing them in the first place), it's difficult to debug, impossible for MATLAB's compiler to optimize, and makes the code tremendously unclear.

A: There are two things you can do here.

*

*Use the verifyEqual function (doc) to get most of the functionality you have with verifyThat. Note that there exists the 'RelTol' and 'AbsTol' name value pairs with that function.

*Define special local functions to use like import statements. These will have precedence within the file just like you would expect from a file level import.
This looks like so:
function tests = main_function_test()
tests = functiontests(localfunctions);
end

function firstTest(testCase)
testCase.verifyThat(actual, IsEqualTo(expected, ...
        'Within', AbsoluteTolerance(0.00001)));
end

function testASecondThing(testCase)
testCase.verifyThat(actual, IsEqualTo(expected, ...
        'Within', RelativeTolerance(0.0005)));
end

% "import" functions
function c = IsEqualTo(varargin)
c = matlab.unittest.constraints.IsEqualTo(varargin{:});
end
function t = AbsoluteTolerance(varargin)
t = matlab.unittest.constraints.AbsoluteTolerance(varargin{:});
end
function t = RelativeTolerance(varargin)
t = matlab.unittest.constraints.RelativeTolerance(varargin{:});
end

Hope that helps!