text:
Q: Cohomological dimension of knit products Let $G$ be a group with complementary subgroups $A$ and $B$ (meaning $A\cap B=1$ and $AB=G$).
If $A$ and $B$ are both normal in $G$, then $G\cong A\times B$ is a direct product. If $A$ is normal, then $G\cong A\rtimes_{\varphi} B$ is a semi-direct product. More generally, $G\cong A\bowtie B$ is a knit product, or Zappa-Szép product, or general product of $A$ and $B$.
My question concerns the cohomological dimension of such knit products. To ask a specific question:

Does anyone know of any examples where $\operatorname{cd}(A\bowtie B)<\operatorname{cd}(A\times B)$?

(Edit: Other than free products $A\ast B$.)
More generally I would be interested in any references concerning the cohomology of knit products. Is there any weaponry akin to the Lyndon-Hochschild-Serre spectral sequence?

A: First of all, there are examples for semi-direct products, but maybe this is not what you want.
1) Let $F_m$ be the free group on $m$ generators. Given a surjection $\varphi: F_m \rightarrow F_n$, we obtain a short exact sequence
$$ 1 \rightarrow N \rightarrow F_m \xrightarrow{\varphi} F_n \rightarrow 1. $$
Here, $N$ is free and $F_m \cong N\rtimes F_n$.
Hence, $\mathrm{cd}(N\rtimes F_n)=1$, but $\mathrm{cd}(N\times F_n)=2$.
2) Stallings example: Let $F_2$ be the free group on two generators and consider the short exact sequence
$$ 1 \rightarrow H \rightarrow F_2 \times F_2 \rightarrow \mathbb{Z} \rightarrow 1 $$
obtained by sending the generators of $F_2$ to 1, in both factors. Then $H$ is not a free group and $ F_2 \times F_2\cong H\rtimes \mathbb{Z}$.
One has $\mathrm{cd}(H\rtimes \mathbb{Z})=2$, but $\mathrm{cd}(H\times \mathbb{Z})=3$.
Secondly, a knit product of two torsion-free groups does not have to be torsion-free.
Hence, one cannot expect the inequality $\mathrm{cd}(A\bowtie B)\leq \mathrm{cd}(A)+\mathrm{cd}(B)$ to hold in general.
It is not difficult (but a little tedious) to construct an example of a group of the form  $\mathbb{Z}\bowtie \mathbb{Z}$, with an element of order two. Keep in mind for this that the   knit products $\mathbb{Z}\bowtie \mathbb{Z}$ have been classified (see this MathStack post for some references https://math.stackexchange.com/questions/107781/has-this-generalized-semidirect-product-been-studied/107788#107788). They always fit in a short exact sequence
$$ 0 \rightarrow \mathbb{Z}^2 \rightarrow \mathbb{Z} \bowtie \mathbb{Z} \rightarrow \mathbb{Z}_2 \oplus \mathbb{Z}_2 \rightarrow 0. $$

A: First of all, the free product of nontrivial groups is never a knit product of these groups.
Secondly, a similar question for short exact sequences of groups was already asked in this MO post, with examples similar to Dieter's.
The third remark is that, in view of the examples, the natural inequality to expect is subadditivity:
$$
cd(A\bowtie B) \le cd(A) + cd(B).
$$
I do not know how to prove this inequality in general (apart from semidirect products). Something might follow from this paper where the related concept of "factorable group" is considered and the author did some homological computations (I did not look at the details though).
Suppose, however, that instead of cohomological dimension $cd(G)$ of groups, one considers the asymptotic dimension $asdim(G)$ (I assume from now on, that both groups $A$ and $B$ are finitely generated). Definitions and basic results can be found, for instance here. It then follows from the "Hurewicz theorem" for asymptotic dimension, using the product map
$$
A\times B \to A\bowtie B
$$
that
$$
asdim(A\bowtie B) \le asdim(A) + asdim(B).
$$


text:
Q: Can one determine the trace map for a nonsingular projective variety explicitly? I've never understood how one would actually go about computing a trace map associated with the canonical sheaf on a smooth projective variety, if it's even possible. Hartshorne proves that the canonical sheaf represents the relevant functor through some very non-explicit homological algebra gymnastics. The name of the map seems to suggest that I ought to be able to be able to write down some kind of matrix, hopefully in terms of homogeneous coordinates, and take its trace. Is this true (if not, why is it called a trace map)? How does one do this?
(I also posted this here: https://math.stackexchange.com/questions/3400374/can-one-determine-the-trace-map-for-a-nonsingular-projective-variety-explicitly)

A: This is a good question. It's one that my  colleague Joe Lipman spent a lot of time thinking about. You can look at some of his papers for a more explicit answer for computing the trace. Probably you should  start with his book "Dualizing sheaves, differentials and residues on algebraic varieties." As for name, the Grothendieck trace really is a classical trace in some cases, e.g. for finite flat maps. I don't know if that's the reason it's called that, however.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Implement a ruby method to find the next largest number with the same digits of the input number in ruby Implement a ruby method to find the next largest number with the same digits of the input number. Ex:  38276 would return 38627.

A: It wouldn't be the fastest one, but does the job!
number = 38276
options = number.to_s.chars.permutation.map{|s| s.join.to_i}.uniq.sort

options[options.index(number) + 1] #=> 38627

A: Another way to get the next number with same digits :
def next_number_with_same_digits(number)
  number.to_s.chars.permutation.map { |e| e.join.to_i }.select { |n| n > number }.min
end

If you want to get the last number with same digits :
def last_number_with_same_digits(number)
  number.to_s.chars.permutation.map { |e| e.join.to_i }.select { |n| n < number }.max
end


text:
Q: how can I open ms document to windows phone 7? I have my msword.doc in the app iso storage. The question how can I open this in the built in ms word in windows phone 7?

A: This is not possible with the current Windows Phone 7 SDK.
A workaround could be to upload your document to a web server then access it via a WebBrowserTask. The OS will then open the document in the built-in Word.


text:
Q: "Negative" vs "Minus" when referring to the temperature below zero? I have read in some dictionaries that, when referring to the weather, the "–" sign is spoken as "minus" — for example "minus 10 degrees".
Is "negative 10 degrees" also common and interchangeable with "minus"?

A: Not common, but yes, interchangeable.
To my ear, "negative X degrees" is normal, and "minus X degrees" is a bit affected. However, Janus Bahs Jacquet is of the opinion that "minus X degrees" is normal worldwide.
I'm inclined to trust him. I have very little experience with sub-0 Farenheit temperatures. Seattle has literally never gone below 0 F. I lived in Vancouver where it hit negative Celsius temperatures maybe once or twice, so I'm by no means an expert.
I'm leaving out Google Ngram below because the question specifically requests "spoken as," which Google Ngram doesn't index at all. The Corpus of Contemporary American English and British National Corpus do have entries (in theory) for transcribed spoken English.
Newspaper Usage
However, my hypothesis of regional variation isn't correct though. The Vancouver Sun and the Seattle Times both prefer "minus."

*

*"Temperatures hit chilly minus 3 degrees C at YVR this morning" (VS)

*"24 outdoors items to put on your holiday gift list" (ST)

Although both do infrequently use "negative X degrees," the Sun once in an AP wire about Iowa and one about Kam Chancellor's hands:

*

*"The Latest: Subzero temps set records; warmer weather ahead"

*"Seahawks safety Kam Chancellor's hands look like snake skin because of the cold in Minneapolis"
I'm forced to conclude "minus" is indeed the standard, and "negative" an acceptable variation.
Corpus of Contemporary American English
The CCAE has tokens from both written and spoken English. It has 140 hits for MINUS * DEGREES, from 2 to 459, in both numbers and words. On the other hand, it has only 13 hits for NEGATIVE * DEGREES. At some point, I'd like to map the hits to see if there are areal tendencies.
I can't link to the search directly, but here's a link to the COCA home page to look it up for yourself: https://www.english-corpora.org/coca/.
British National Corpus
Like the CCAE, the BNC has entries from ``a wide range of genres (e.g. spoken, fiction, magazines, newspapers, and academic).'' It has 15 hits for MINUS * DEGREES and none at all for NEGATIVE * DEGREES indicating "negative" is at least an Americanism.
Conclusion
"Minus" is indeed what most North Americans and all Brits say. That said, "negative" is not wrong, and unlike a word like "inflammable," you're unlikely to be misunderstood if you use. I don't see any reason to recommend against "negative," although if you're unsure, you could prefer "minus."
Maybe someone can weigh in whether it's correct in a technical context to say "negative" over "minus."

A: Thinking about a number line or scale, any number below zero can be referred to as "negative" OR "minus". So mathematically and conceptually either works.
But conventionally, in reference to temperatures, "negative" doesn't get used. I also speak Swedish, and in that language it's the same - "minus" is always used for weather and temperature, never "negative".

A: "Negative 10 degrees" is just as easy to understand as "minus 10 degrees". Temperature is odd though, particularly since there are different systems to relay the same information (Celsius & Fahrenheit). Regardless, when speaking about the weather, you're referring to a number relative to a fixed value (0 degrees).
As such, I'm inclined to say both are equally correct. "Negative" tells the listener the value is positional (in relation to a fixed point on a spectrum) in nature, as does "minus".

A: I often hear "negative" being used to described temperature from American English speakers, whereas "minus" is normally used by English speakers from the UK.

A: I'm a math student. I say that "negative 10 degrees" is more correct because negative is the sign of the number and thus properly a modifier in English, but minus is an arithmetic operator, which strictly speaking takes two operands: "zero minus 10". Of course, even in upper-level math class we'll pronounce the integer -10 as "minus ten" but I consider this informal/slang, and we would not say this in a class on number systems, axioms of arithmetic, etc. where the distinction is important.


text:
Q: How to search through struct data using UISearchBar swift 4.2 I have struct datatype which is use for decoding data
struct OtherCountry : Decodable {
    let name : String
    let dial_code : String
    let code : String

}

struct FrequentCountry:Decodable{
    let name : String
    let dial_code : String
    let code : String
}

I want to search based on name & code  and this is stored in array of type struct
    var OtherDataCountry = [OtherCountry]()
    var FrequentDataCountry = [FrequentCountry]()

I have also implemented search function that looks something like this
func searchBar(searchText: String) {
        searchCountry1 = OtherDataCountry.filter({ (OtherCountry) -> Bool in
            return OtherCountry.name.range(of: searchText , options:[.caseInsensitive]) != nil

        searchActive = !searchCountry1.isEmpty

            self.mTableView.reloadData()
        }

        )}
}

can anyone help me to convert that struct data to String array , that would be helpful because i can search through array and use that result to show entire data .
Thank You for Help !

A: Please try below code
func searchBar(searchText: String) {
            searchCountry1 = OtherDataCountry.filter {
                $0.name.range(of: searchText , options:[.caseInsensitive]) != nil
    }.map {$0.name}

            searchActive = !searchCountry1.isEmpty

                self.mTableView.reloadData()
            }

            )
    }

searchCountry1 will be an array after map containing the name value


text:
Q: Gulp Fingerprinting + Production Deploys I'm using gulp for common tasks on a front-end project.  My goal is to fingerprint my JS+CSS assets and update my rev-manifest on deploy without interrupting anything.  My tasks look something like this:
gulp.task("clean-js", function() {
   return del(["./public/shop-assets/javascripts/production/*.js", "./rev-manifest.json"], function(){
     console.log("Production JS folder and rev-manifest JSON cleared");
  });
});

gulp.task("clean-css", function() {
  return del(["./public/shop-assets/stylesheets/production/*.css", "./rev-manifest-css.json"], function(){
    console.log("Production CSS folder and rev-manifest-css JSON cleared");
  });
});

gulp.task('js:prod',['clean-js'], function() {
  return gulp.src("./public/shop-assets/javascripts/*.js/")
    .pipe(uglify())
    .pipe(rev())
    .pipe(gulp.dest("./public/shop-assets/javascripts/production/"))
    .pipe(rev.manifest())
    .pipe(gulp.dest("."));
});

gulp.task('css:minify',["clean-css"], function() {
  return gulp.src("./public/shop-assets/stylesheets/*.css")
    .pipe(minifyCss())
    .pipe(rev())
    .pipe(gulp.dest("./public/shop-assets/stylesheets/production/"))
    .pipe(rev.manifest())
    .pipe(rename("rev-manifest-css.json"))
    .pipe(gulp.dest("."));
});

This does what I expect-it clears the manifest files each time, then rewrites them.  What I would like to do is merely replace the contents of each manifest after I bundled + minified my JS +CSS files without blocking the user experience.
Also, in my express routes file, I am sending the manifest on down so I can then include the scripts/stylesheets like so:
script(src="/shop-assets/javascripts/production/#{assetPathJS}")

But when I delete and rewrite the manifest files, users will see an intermittent failure.
Does anyone have any tips on this matter?  Most examples I have seen have only one entrypoint for the gulpfile.  Thanks!

A: I wound up doing something like this in my routes files:
var jsPaths = ServerConfig.assetPaths(["cleanout.js", "hiw.js", "do_good.js"], revManifestJS, "javascripts/");
where that function assetPaths resolves the pathname based on the environment.  Simple than I thought.


text:
Q: Add "rgb" legend to R leaflet heatmap I made some interactive heatmaps using leaflet (particularly the addHeatmap() command from the leaflet.extras package) and shiny. Having created a desired map, I would like to add a legend to it.
What I am interested in is a "rgb" legend, based on density values deduced by addHeatmap() from pure long/lat coords.
What I need is something like this map - https://www.patrick-wied.at/static/heatmapjs/example-legend-tooltip.html - unfortunately I have no knowledge of JS and can't rewrite this code in terms of R/include the right fragment of JS code for my problem.
What I tried so far is the addLegend() command, which does not give the desired result, as in this case I would need to specify a variable for which the legend would be prepared. I also tried to extract the color range and assigned values from created leaflet object, however with no success.
Here's link to full data to run the reproducible example on:
https://drive.google.com/file/d/1h3jL_PU6DGTtdIWBK02Tt37R7IB2ArH9/view
And here's top 20 records:
structure(list(latitude = c(30.309522, 30.24429616, 30.30038194,
                            30.27752338, 30.23294081, 30.23038507,
                            30.34285933, 30.24962237, 30.26594744,
                            30.20515821, 30.22363485, 30.2759184,
                            30.28283226, 30.33816909, 30.26611565,
                            30.18835401, 30.26704789, 30.27456699,
                            30.19237135, 30.1925213),
              longitude = c(-97.73171047, -97.77446858, -97.77885789,
                            -97.71919076, -97.58937812, -97.76581095,
                            -97.73598704, -97.72215443, -97.74144275,
                            -97.8782895, -97.78329845, -97.71321066,
                            -97.70820152, -97.82413058, -97.7327258,
                            -97.81606795, -97.68989589, -97.7580592,
                            -97.7816127, -97.73138523)),
                .Names =  c("latitude", "longitude"), row.names =
                                c(NA, 20L), class = "data.frame")

Here's an example code, which I'd like to extend by the mentioned functionality:
library(magrittr)
library(leaflet)
library(leaflet.extras)

data <- read.csv('DATA.csv')
leaflet(data) %>%
  addTiles(group="OSM") %>%
  addHeatmap(group="heat", lng = ~longitude, lat = ~latitude, max=.5, blur = 60)

And here is the result of that code (on whole dataset):
https://i.stack.imgur.com/6VFNC.jpg
So to sum up what I would like to do: based on such picture I would like to extract the range of the drawn colors along with values assigned to them, and draw legend using that information.
Is there something I am missing? It looks like a pretty simple issue, but I've been struggling to find a solution for past few hours.
Thanks in advance for any help!
EDIT: extended the reproducible example.

A: Your sample data does not have any values to it to actually map a density overlay.
You can specify the number of bins with colorBin() and then specify those bins with your pal function. You can set the bins differently depending on your needs at the data_values distributions. The help section of colorBin() is helpful in identifying the correct parameters for your needs.
bins <- c(0,1,2,3,4)
pal <- colorBin("Spectral", domain = data_value, bins = bins, na.color = "transparent")

m <-leaflet() %>%
      addTiles() %>%
      addHeatmap(lng= long_cords, lat = lat_cords, intensity = data_value,
                 blur = 20, max = 400, radius = 15, cellSize = 3) %>%
      addLegend(pal = pal, values = data_value,
                title="Heat map legend")

You'll have to play around with the addHeatmap arguments to get an the right transparency and density settings.


text:
Q: UISegue positioning UIView halfway I'm trying to use a custom transition to position a UIView so that it slides up from the bottom, but with the top stopping half way up the screen.  I have that working, but after briefly stopping at the halfway point, the UIView opens the rest of the way and takes up the entire screen.  This is the code I have that's doing it.
override func perform() {
    //Coming in here, we already have this information.  The segue knows the source
    //and destination view controllers.
    var firstView = self.sourceViewController.view as UIView!
    var secondView = self.destinationViewController.view as UIView!

    //Get the screen width and height, for calculations.
    let screenWidth = UIScreen.mainScreen().bounds.size.width
    let screenHeight = UIScreen.mainScreen().bounds.size.height

    //Specify the initial position of the second view.  We're sliding from
    //bottom to top, so put it off the bottom of the screen.
    secondView.frame = CGRectMake(0.0, screenHeight, screenWidth, screenHeight)

    //Insert the second view above the first view. The windows are all in a stack.  Doing
    //this inserts the second view at the top of the statck.  It is not yet visible.
    let window = UIApplication.sharedApplication().keyWindow
    window?.insertSubview(secondView, aboveSubview: firstView)

    //Animate the transition.
    UIView.animateWithDuration(0.5, animations: { () -> Void in
        secondView.frame = CGRectOffset(secondView.frame, 0.0, -screenHeight/2)

        }) { (Finished) -> Void in
            self.sourceViewController.presentViewController(self.destinationViewController as! UIViewController,
                animated: false,
                completion: nil)
    }
}

I set a breakpoint in Finished, and that's the code that is causing the second view to take up the entire screen.  What can I do to make the second view take up only the bottom half of the screen.

A: The 'perform' method is used to animate the transition from your source to your destination controllers, but this final step:
self.sourceViewController.presentViewController(self.destinationViewController as! UIViewController,
            animated: false,
            completion: nil)

presents the destination controller, which as far as iOS knows is a full screen controller, which is why you see the jump at the end.
You've got a couple of options:
1. Faking it (option A):

*

*In the storyboard select your segue and change the presentation option from 'Default' (default value is 'Fullscreen') to 'Current Context'.

*In your destination controller set the root view backgroundColor to clear.

*Add a new view that takes up half the height of the view and transfer everyone into that view.

This will only work with really simple layouts and might be a headache in the future if you
2. Faking it (option B)
Don't use a view controller - just present use a view that animates from the bottom of the screen.
If you're using Xcode 7 you can drop a UIView into the bar at the top of the scene and when you tap on it Xcode will expand it out so you can add subviews etc. If you destination view is a simple transient view (like a menu), and you're ready to use Xcode 7 this could be a good option.
3. Use UIPresentationController (recommended)
Instead of using a custom segue, switch to using a UIPresentationController. This potentially involves a lot of boiler plate, but it's really pretty simple.
Here's a bare-bones example project with a presentation controller which is as simple as this:
class HalfScreenPresentation: UIPresentationController {

    override func frameOfPresentedViewInContainerView() -> CGRect {

        let containerFrame = self.containerView!.frame

        return CGRect(x: 0, y: containerFrame.height/2, width: containerFrame.width, height: containerFrame.height/2)

    }
}

This works because your animation has the controller being presented/dismissed from the bottom of the screen (which is the default transition!) if you wanted to change this animation (e.g. slide from the top, or the side, or some other transition) you'd also need to provide an object that meets UIViewControllerAnimatedTransitioning requirements (which for the most part would be as simple as copy-and-paste of code in your perform method).
I'm really enjoying the UIPresentationController APIs, and hope you do too!

A: For those who want the presentation to come in from the left or perhaps want a varied y position I found this simple solution:
class HalfScreenPresentation: UIPresentationController {

override var frameOfPresentedViewInContainerView : CGRect {

    let containerFrame = self.containerView!.frame

    return CGRect(x: 0, y: 0, width: containerFrame.width/1.5, height: containerFrame.height) //From the left
    return CGRect(x: containerFrame.width/3, y: 0, width: containerFrame.width/1.5, height: containerFrame.height)/from the right
}


text:
Q: Any documentation on angular google maps clustering options? Hi I am using the Angular Google Maps library available here https://github.com/nlaplante/angular-google-maps. it seems pretty powerful but it lacks exhaustive documentation... I am trying to cluster my  markers but I can't find a working example of how to do it. Did anyone manage to do it ?

A: The question is a bit old, but maybe this can be useful for someone with the same issue.
Here is a simple example from the code I used:
On my controller, I generate a markers array with this structure:
 var markers = new Array();

    for(var i = 0; i < someData.length; i++ ){

        var newMarker = {
            id: parseInt(i),
            latitude: parseFloat(someData[i].latitude),
            longitude: parseFloat(someData[i].longitude),
            showWindow: false,
            title: "Marker"+i,
        }

        newMarker.onClicked = function () {
            alert(newMarker.id);
        }

        markers.push(newMarker);
    }

    $scope.markers = markers;

Then on the view:
<google-map center="map.center" draggable="true" options=map.options zoom="map.zoom">

        <markers models="markers" coords="'self'" doCluster=true click="'onClicked'">
        </markers>

    </google-map>

A: It is built into the default example.
Here view, https://github.com/nlaplante/angular-google-maps/blob/master/example/example.html#L75-L76
controller,
https://github.com/angular-ui/angular-google-maps/blob/master/example/assets/scripts/controllers/example.js#L28-563


text:
Q: What is the bootstrap folder inside laravel for? I recently learning laravel and as I go along I decided to include bootstrap for my styling and js. I found a bootstrap folder inside my laravel folder and I am confused if bootstrap is already included in laravel. If that is so, where are the bootstrap css and js files? What kind of call am I going place inside my html? Hope someone could clarify this to me. Thanks

A: The bootstrap folder is for when Laravel starts up. Which is commonly called bootstrapping.  It has nothing to do with the Bootstrap CSS library.

A: Laravel's bootstrap folder has nothing to do with the Bootstrap CSS framework, it's used to initialize (setting up path & environments) the framework.

A: The bootstrap directory contains the app.php file which bootstraps the framework. This directory also houses a cache directory which contains framework generated files for performance optimization such as the route and services cache files and like the others says there is no relation between this folder and the css framework .

A: Actually, if you do npm install and then go to the node_modules folder, you'll find the bootstrap folder there. And inside it there will be scss and js folders.

A: The bootstrap folder has nothing to do with CSS, it comes from bootstraping (the self-start process) and it contains files that automatically load the classes to boot up the start of the project, and this process starts automatically without any external intervention.

A: The bootstrap directory holds the files that are required to bootstrap the Laravel application and to configure auto-loading. The bootstrap folder contains a sub-folder cache used for caching a web application. It also contains the file app.


text:
Q: Why doesn't Many-Worlds interpretation talk about many worlds? I was reading this interpretation from this site, where these lines are noteworthy enough to talk for the fact that this interpretation doesn't actually talk about many-worlds:

These are the "many worlds" in question, although it should be clear that the label is somewhat misleading. People sometimes raise the objection to the many-worlds interpretation that it's simply too extravagant to be taken seriously--all those different "parallel realities," infinite in number, just so that we don't have to believe in wave function collapse. That's silly. Before we made an observation, the universe was described by a single wave function, which assigned a particular amplitude to every possible observational outcome; after the observation, the universe is described by a single wave function, which assigns a particular amplitude to every possible observational outcome. Before and after, the wave function of the universe is just a particular point in the space of states describing the universe, and that space of states didn't get any bigger or smaller. No new "worlds" have really been created; the wave function still contains the same amount of information (after all, in this interpretation its evolution is reversible). It has simply evolved in such a way that there are now a greater number of distinct subsets of the wave function describing individual conscious beings such as ourselves. The many-worlds interpretation of quantum mechanics may or may not be right; but to object to it on the grounds that "Gee, that's a lot of worlds," is wrong-headed.

I'm not really understanding the reason "It has simply evolved in such a way that there are now a greater number of distinct subsets of the wave function describing individual conscious beings such as ourselves." What is it saying? Can anyone explain me?

A: The assumption behind the statement you ask about is that one's consciousness of the world corresponds to a single classical state and not a quantum superposition:  that is, if you looked at schrodinger's cat, you would "see" it in either a "dead" state or an "alive" state and not a mixture of both.  (You may want to look up schrodinger's cat if you don't understand the reference.)
The idea is that before you look at the cat, there is only a single conscious "you", and you only see the outside of the box containing the cat.  After you look at the cat, there are two conscious "you"s, one of which sees the cat alive, and one of which sees the cat dead.  There are now two "subsets of the wave function describing [your] individual conscious being" - more than there were before, and thus a "greater number".
The situation is not quite so simple, however.  If the gun now misfires and kills the "live" cat, and neither "you" remembers exactly when the cat was killed, do your two subsets of the wave function now merge back into one?  We don't really know, because we don't know how consciousness is related to the physical world, irrespective of what quantum interpretation one subscribes to.  Maybe there were two "you"s all along, one destined to see the cat alive and one destined to see the cat dead, so the number didn't change - or rather an infinity of "you"s, half destined to see the cat in each state.  Maybe your consciousness stays singular, and when the cat is held in a superposed state, you're not sure whether it's dead or alive.  No one has managed to keep a cat in a macroscopically superposed state, so we don't know yet.
However, the many worlds hypothesis does remain the only quantum mechanical interpretation that is consistent with every experimental result so far.  Experiment after experiment has cast doubt on the Copenhagen interpretation of observer driven "quantum collapse" as experimenters manage to maintain superposed states of larger and larger - albeit granted, still small - systems and show that only maintenance of the single wave function of the many worlds hypothesis explains the interference effects when they decohere.

A: What it means is straightforward: if there's a particle and experimenter in $$(|up\rangle + |down\rangle) \otimes experimenter_?$$ And the experimenter sees it and becomes entangled with it: $$|up\rangle|experimenter_{up}\rangle + |down\rangle|experimenter_{down}\rangle$$
Then we now have two conscious beings (both versions of the experimenter) instead of one.
The more interesting question is why he mentions it. He mentions it because a big reason people don't like MWI is that we expect there to be only one of me. Being split in two is particularly hard to make sense of.

A: A simpler example than putting humans inside your equations might be more clear. Imagine a single electron with some spin.
It is going to enter a Stern-Gerlach device as a beam going in the positive y direction and the Stern-Gerlach device will deflect a spin up beam entirely left. And the Stern-Gerlach device will deflect a spin down beam entirely right. These directions, y , left, and right were all details that were determined by the initial setup of the beam and the device.
But the device does this not because the Stern-Gerlach device is magical, it does so because the Stern-Gerlach device has an inhomogeneous magnetic field and there is a particular Hamiltonian for magnetic fields and spin and the Hamiltonian dictates how things evolve. So anyone that agrees about how the Schrödinger equation evolves states agrees this happens. Copenhagen, Many-Worlds Interpretation (which was not called Many Worlds by its creator and I think its creator did not mention the words many worlds), Decoherence, Ithaca, dBB, etcetera.
So the Schrödinger equation has a wave that is a beam spread in the x and z direction and with an initial probability current pointing in the y direction for an initial condition of the wave function. And it evolves according to the Schrödinger equation. Now, what if the spin of the particle is a superposition of spin up and spin down? Again, we can just mathematically change the initial wavefunction and then mathematically evolve it according to the Schrödinger equation for the particular Hamiltonian that accurately describes the actual inhomogeneous magnetic field in the exact actual Stern-Gerlach device and then again every theory that agrees with the Schrödinger equation can evolve it and they all predict the same thing. They see two beams coming out, one with spin polarized as spin up, one with spin polarized as spin down.
And again, any theory that uses the Schrödinger equation can track the so-called probability current and see streamlines in the initial beam, some of which end up in that left deflected beam, some which end up in that right deflected beam. And they can see the beam, as a whole, mathematically split into two like a stream that forks when there is a hill in the way. They see that there is more beam deflected left or right (in the L2 norm sense) depending on how big a superposition you had of spin up versus spin down in the initial wave.
And the Schrödinger equation when used for the actual experimental setup also predicts that the spin of the particle continuously evolves over time so that eventually the left beam has a spin that is up and the spin of the right beam has a spin that is down.
Nobody disagrees that this is exactly what the Schrödinger equation predicts for the actual experimental setup. So the equation that makes the actual predictions predicts that one beam with spin not aligned purely in the up or down direction becomes (continuously over time) two beams each of which has a spin that is aligned in the up or down direction.
Effectively the Stern-Gerlach device has co-evolved the spin and the position so the two are now entangled you have (wave on the left and spin up) added to (wave on the right and spin down) and they are orthogonal, orthogonal for two reasons now, whereas when it was incoming beam with spin of (superposition of up and down) they were orthogonal for only one reason, the spin, which could have been written as a super position of many different orthogonal states. Now that the interaction has separated the beam into two spatially separate beams, future things that interact based on where the beam is can by surrogacy be correlated with the spin.
Great. And everyone that uses the Schrödinger equation and is also willing to bother to use it on the actual experimental setup (a rarely utilized option) agrees this is what happens.
Now it might help to reveal a big fact that isn't mentioned much, and again it is just about the Schrödinger equation. If you have two particles or more, then the wave function is not a wave like the electric field or the magnetic field, it is not defined in actual space. It is defined on configuration space, a space that has a different x for every particle a different y for every particle and a different z for every particle. So for two particles your function is $\Psi=\Psi(x_1,y_1,z_1,x_2,y_2,z_2,t)$ so for every point in the 6d configuration space you are specifying a full configuration, you are saying where each and every particle is.
So this space is huge. If two beams go off in slightly different directions and bounce off separate things and go into different directions and possibly different and changing speeds when you have $10^{26}$ or more particles the chance that two beams ever cross each other once they get pretty far away is vanishingly small.  This is key.
Because the Schrödinger equation says that if two beams don't overlap and beam one by itself evolves its own way and beam two by itself evolves its own way and those evolved versions never overlapped then the evolution of the sum evolves as the sum of those two separately evolved beams, including the probability current at each point being the probability current in the separate beams.
So the Schrödinger equation predicts that in absolutely every way the two beams evolve as if they were the only beam when they get to a point in time where they will never overlap again. And this happens when devices like Stern-Gerlach devices separate them and then further interactions with lots of particles have the lots of other particles evolve differently with the two different beams.  So far there is no mention of Many Worlds. And any theory that uses the Schrödinger equation for the actual setup will predict this.
So now let's talk about Many Worlds. These beams that never again overlap act like they are the only beam, they act like they are a world unto their own. The math says so. The math everyone uses that uses the Schrödinger equation. So why not just let them them be a World unto their own? Your personal experience is generated by the state of your neurons and such, so the wave function of every particle includes the configurations of your neurons and such. So there is a beam with your neurons in some configurations (the wave is nonzero there) and there is a completely separate non overlapping beam (the beam is defined in configuration space so if just one particle has the beam separated to be non overlapping in the direction for that particle it is like separating a beam in the x direction the whole beam is separated). A separate non overlapping beam for your neurons is a possibly different collection of configurations (or possibly the same, maybe the beam has separated in other places but the dynamics of your neurons haven't changed yet, but the beams as a whole are separate so the math that every single person that uses the Schrödinger equation trusts says the beams won't affect the so called probability-current or the evolution of the other if they never overlap again).
OK, so in the future devices make beams become non overlapping. And if they interact later with large numbers of particles the huge number of particles make it incredibly unlikely they will ever overlap again, so each can and does evolve as if it were the only beam. In Many Worlds you call those worlds (and the creator didn't but the first major popularizer did). But that is just because they then evolve as if they were the only beam in the world. The key is their separateness, a separateness that is already and solely predicted by the Schrödinger equation. That same Schrödinger equation predicts that each of those beams exists and each acts as if it were the only one.
So there is one configuration space, and one wavefunction, the one predicted by the one Schrödinger equation. It's just that it naturally evolves into separated beams that then act independently as if they were the only beam in the world.  In Many Worlds you realize that each acts on its own after it separates and realize that any subjective experience is based on your body's configuration so each separately acting beam has a separately acting arrangement of your body, so the different beams include possibly differently arranged yous and each are just as important and valid because we predict them all and each acts like it is the only one that survived the beam splitting and interaction with a large number of particles.
Instead of calling it the Copenhagen interpretation you could call it the Solipsism interpretation (after all Many Worlds wasn't called Many Worlds by its creator) because with a Solipsist's Interpretation, only one of those beams can be real the one with "you" in it.
And a die hard solipsists will sometimes go so far as to throw the baby of science out the window with the bathwater of non-solipsism.
Why? Because the Schrödinger equation predicted all these separate beams. So how can you end up with just one? You'd have to do something other than the Schrödinger equation. And so you'd have to draw a line somewhere and say that some magic happens somewhere and the Schrödinger equation doesn't hold there or then. But if we do an experiment to test that, you are always wrong.
Why? Because by carefully arranging beam reflectors we can get those beams to bounce back and overlap and show that every beam was still there all along, every single one, for any length of time, so was there all along. Always, every single time. So you can just find out how many beam reflectors we can make and how precisely we can arrange them (find out our current technical expertise) and then postulate that raw unobservable (because you specifically designed it to happen where we can't test it) magic happens and that the Schrödinger equation doesn't hold there because it interferes with your self centered egotistical solipsism. Which is really just a kind of sexism and racism and hating of other people and things that is so profound that you just refuse to believe that anything other than you exists (even a body just like yours that was entirely the same up until one day it dynamically evolved the way you would if you interacted with a world where a Stern-Gerlach device deflected a beam differently than the one you personally subjectively experienced) to the point were you make unscience to defend your solipsism.
Why unscience? Because drawing the lines in different places means when our technical expertise advances we get an infinite number of different predictions. So Copenhagen can't even make predictions. It, Copenhagen, isn't even science when it wants to have magical collapses to defend solipsism. And there is no reason to hold one of the splittings of the beam as special just because you experienced it.
Let's get this straight, there is nothing wrong about treating those other worlds as if they don't exist because they don't affect your world. But to claim that something happened to them just because you want to feel special and to destroy science itself and the ability to make predictions just because you want to have your individual and personal subjective experience be the center of the universe is misguided.
Ignore the other worlds because you can. And be aware of when you can and don't do it too early or in situations where it doesn't apply. Pretending they aren't there is a bit dishonest and can lead to wrongness.

A: The statement about the number of worlds not increasing is both right and wrong.
It is right because the "size" of the universal wavefunction (which is everything that exists) does not change with time.  "Size" here has a precise, technical definition, and, if you want to look it up, is called the "norm" of the wavefunction.
It is wrong because the size (norm) of the wavefunction does not constrain the content of the wavefunction, which can be infinite.  So the universal wavefunction can divide into an infinite number of smaller pieces, each of which constitutes a world or timeline of the universe we know.  Each timeline is a history which has taken a particular course.  The totality of existence encompasses all these histories, where each set of different historical choices is realized in different timelines (or worlds, or subsets - choose your own jargon, it makes no difference to the science).

A: One difficulty connected with arguments about the pros and cons of the various interpretations of quantum mechanics is that they are largely based on opinions. If and when we reach a point at which the interpretations can be rigorously tested experimentally the arguments will be settled. In the meantime it is open to any one of us to decide whether we prefer to believe in an infinite number of parallel universes or an instantaneous change in wave functions, or any other interpretation that takes our fancy.
We are also free to assume that none of the interpretations of QM is right, that they are just models that work well-enough in certain situations but not in others, in the same way that Newtonian physics works well at macroscopic scales in situations in which speeds are sufficiently small compared with c and gravitational effects are sufficiently weak. We might well find a new theory emerges that sweeps all of the current interpretations aside
My own view is that the hard MWI interpretation, in which each of the components in a superposition represents a separate physical world in which there are, among other things, every possible variation of oneself, is outlandish. In my view it is akin to saying that a string whose state of vibration can be decomposed into a set of normal mode components is in reality made up of an infinite number of vibrating strings all super-imposed.

A: Why doesn't Many-Worlds interpretation talk about many worlds?
Because it's popscience pseudoscience that even after sixty years has no evidential support whatsoever. I'm afraid it's one of those things that has gained some acceptance because people have grown up with it, rather than for any scientific reason.
I'm not really understanding the reason "It has simply evolved in such a way that there are now a greater number of distinct subsets of the wave function describing individual conscious beings such as ourselves." What is it saying? Can anyone explain me?
Not to your satisfaction. If you're really unlucky somebody will write some smoke-and-mirrors handwaving article that will generate a whole pile of Emperor's New Clothes adulation from anonymous parties, and you'll slink away feeling like you must be stupid because you're the only one who doesn't understand it. Don't. Stick to your guns, demand a sensible explanation, and when you don't get it, you will have learned something useful about quantum mysticism.
By the way, Schrodinger proposed his cat to demonstrate a problem with the Copenhagen Interpretation, but it has been hijacked by the hacks and quacks who peddle quantum weirdness and multiverse woo. And who then have the gall to say we should abandon the scientific method in favour of fantasy physics.


text:
Q: Is there a theorem that disproves this or is this just some made up meaningless thing? I find this slightly funny. I saw this on a meme:$$\begin{align}a=x\\ a+a=a+x\\ 2a=a+x\\ 2a-2x=a+x-2x\\ 2(a-x)=a+x-2x\\ 2(a-x)=a-x\\ 2=1\end{align}$$ How can these strange algebraic manipulations not be true? I feel that this is a stupid question but it's just weird how people come up with these things. Is there some kind of theorem or something that would make this untrue?

A: you can't devide two side by $(a-x)$, beacuse $a-x=0$.

A: As soon as you get to the fourth step, your equations are all equivalent to $0 = 0$, and you need to be careful about dividing.

A: You first assumed $a=x$ so the line before the last one is $2(a-a)=a-a$.
Indeed $2\cdot 0 = 0$ but you can not deduce $2=1$ from it since you divided by $a-a=0$.

A: Yes there is:
Theorem: If you divide by $0$ you can prove anything ;)


text:
Q: How to display all users on the server/computer with a Windows batch script? I am new to batch scripting and learning as I go along. I am basically trying to display all the users that may be on that specific server or computer by doing:
echo %USERNAME%

Is this enough to display all the local users or will it just display one local user?

A: Do you have the Home version of Windows?  If so, then your options are more limited - see here.  You should still be able to use PowerShell, or download another option.  But in other versions of Windows you can use QUSER.
To check a remote computer with QUSER:
QUERY USER /SERVER:ComputerName

Return something such as this:
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
 RemoteUserID          console             1  Active      none   4/29/2022 6:14 AM

To see options, type:
QUSER /?

A: wmic useraccount get name

If you want to delete the first line
wmic useraccount get name | findstr /l /v Name


text:
Q: Unable to display the simulation with EDAPlayground compiler I have tried the following code from myHDL manual on EDAPlayground.com, but it didn't print anything out for me. Can anyone show me why ? and how to solve this ?
My configuration on the site is outlined here.
Testbench+Design : Python only
Methodology : MyHDL 0.8

from random import randrange
from myhdl import *
ACTIVE_LOW, INACTIVE_HIGH = 0, 1

def Inc(count, enable, clock, reset, n):

""" Incrementer with enable.

count -- output
enable -- control input, increment when 1
clock -- clock input
reset -- asynchronous reset input
n -- counter max value

"""

@always_seq(clock.posedge, reset=reset)
def incLogic():
    if enable:
        count.next = (count + 1) % n

return incLogic

def testbench():

count, enable, clock = [Signal(intbv(0)) for i in range(3)]

# Configure your reset signal here (active type, async/sync)
reset = ResetSignal(0,active=ACTIVE_LOW,async=True)

## DUT to be instantiated
inc_1 = Inc(count, enable, clock, reset, n=4)

HALF_PERIOD = delay(10)

## forever loop : clock generator

@always(HALF_PERIOD)
def clockGen():
    clock.next = not clock

## Stimulus generator
@instance
def stimulus():
    reset.next = ACTIVE_LOW
    yield clock.negedge
    reset.next = INACTIVE_HIGH
    for i in range(12):
        enable.next = min(1, randrange(3))
        yield clock.negedge
    raise StopSimulation

@instance
def monitor():
    print "enable  count"
    yield reset.posedge
    while 1:
        yield clock.posedge
        yield delay(1)
        print "   %s      %s" % (enable, count)

return clockGen, stimulus, inc_1, monitor

tb = testbench()

def main():
    Simulation(tb).run()

A: You need to call the main() function at the end.
E.g., add a line
main()

at the end, or better, use Python's idiom of
if __name__=="__main__":
     main()


text:
Q: WordPress redirect full site to HTTPS and then add redirect rule for one page to HTTP After a long R&D process, I am here with an unresolved issue of WordPress redirection. None of the available resources helped me really.
What I need is -
I have successfully redirected my entire WP site and admin to HTTPS.
Now, I need one specific page to redirect to HTTP only. Because I will be using iframe on that page to load external sites for preview.
My requested url should be like this -
http://example.com/live-preview/?product_id=(number like 1,2,3 etc)
I want the above url(s) to load without HTTPS.
My present htaccess file is this -
# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R=301,L]

RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

# END WordPress

So anything with (/live-preview/) should be on HTTP only. Please help me how I will be able to do this.
Thank you so much.
-Amit

A: After a long investment of time and many researches, I manage to fix this issue with my code. I am sharing this for public interest.
This is the working htaccess code -
RewriteCond %{HTTPS} !on
RewriteCond %{QUERY_STRING} !^product_id=(.*)$
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} ^product_id=(.*)$
RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [R=301,L]

So I have to use {QUERY_STRING} and use 2 conditions with 301 permanent redirection.


text:
Q: twitter bootstrap datepicker internationalization I am using this twitter bootstrap style datepicker from Stefan Petre
However, I don' t know how to set the format of the datepicker to french, apart from changing it directly from the sources, is there a better way to do it ?
Thanks all

A: dtjmsy, you can use this as well:
$('.datepicker').datepicker({
   language: "pt-BR"
});

And here a link with a good sandbox where you can try some configurations:
http://eternicode.github.io/bootstrap-datepicker/?#sandbox

A: I've been using a modified version of Stefan Petre's datepicker, and at the bottom of the docs there it says to include your locale file after you included the main datpicker file.

A: Just add bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js in your code.
and

$('.datepicker').datepicker({    language: "fr-FR" });

That's it

A: In version 3.x, you have to internationalizate the moment.js
Check the source here
As follow...
// moment.js language configuration
// language : brazilian portuguese (pt-br)
// author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        define(['moment'], factory); // AMD
    } else if (typeof exports === 'object') {
        module.exports = factory(require('../moment')); // Node
    } else {
        factory(window.moment); // Browser global
    }
}(function (moment) {
    return moment.locale('pt-br', {
        months : "janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),
        monthsShort : "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),
        weekdays : "domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),
        weekdaysShort : "dom_seg_ter_qua_qui_sex_sáb".split("_"),
        weekdaysMin : "dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),
        longDateFormat : {
            LT : "HH:mm",
            L : "DD/MM/YYYY",
            LL : "D [de] MMMM [de] YYYY",
            LLL : "D [de] MMMM [de] YYYY [às] LT",
            LLLL : "dddd, D [de] MMMM [de] YYYY [às] LT"
        },
        calendar : {
            sameDay: '[Hoje às] LT',
            nextDay: '[Amanhã às] LT',
            nextWeek: 'dddd [às] LT',
            lastDay: '[Ontem às] LT',
            lastWeek: function () {
                return (this.day() === 0 || this.day() === 6) ?
                    '[Último] dddd [às] LT' : // Saturday + Sunday
                    '[Última] dddd [às] LT'; // Monday - Friday
            },
            sameElse: 'L'
        },
        relativeTime : {
            future : "em %s",
            past : "%s atrás",
            s : "segundos",
            m : "um minuto",
            mm : "%d minutos",
            h : "uma hora",
            hh : "%d horas",
            d : "um dia",
            dd : "%d dias",
            M : "um mês",
            MM : "%d meses",
            y : "um ano",
            yy : "%d anos"
        },
        ordinal : '%dº'
    });
}));

A: If you want to specify the localized text from the server you could add this (calling it (eg) "somename"):
jQuery.fn.datepicker.dates.somename = {
    days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"],
    daysShort: ["Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб"],
    daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
    months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
    monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"],
    today: "Сегодня",
    clear: "Очистить",
    format: "dd.mm.yyyy",
    weekStart: 1
};

above the calling function (giving the language parameter the value "somename"):
jQuery('#datepicker-container input').datepicker({
    language: "somename"
});

You can then specify whatever values and language you like from, say, a resx file.


text:
Q: Failed to Import Bridging Header Error I accidentally messed up my projects' settings while installing and then uninstalling cocoapods. I'm now getting the error "failed to import bridging header". I checked my build settings and the path to the file under build settings > code generation > objective-c bridging header is correct. I messed around with my Framework Search Paths (they are empty now) in build settings while trying to get cocoapods to work. Would really appreciate some help on fixing this bridging header issue.

A: Sounds like the empty Header Search Paths might be what's causing your problems.
Try to add $(inherited) to the Header Search Paths list in Build Settings. It will make sure that the header search paths set in the pods xcconfig files are being used.

A: Do a search in XCODE for header,  see if the bridge header is still "there",  if so click on it so it will show in the frame....then look to see if the facebook sdk  #import statement is stil there, if not   add it .
if you dont find the header file after the search...click file and "Add files to    and see if you can find the -Header.h  there, if so add it back to your project, if not   go to the Build settings again and "clear out " the paths to the header, save your project , close it , reopen it,  then try to add a C file and see if the file will regenerate and then you can re add the call to #import
facebookSDK
Another thing is you could check to make sure the FBSDKcoreKit.framework is put back into the Build Phases of your target  under link binary with libraries
EDIT from your reply :
inside your search paths you should also have the following $(PROJECT_DIR)/yourprojectname just below $(inherited) if you DO NOT have $(PROJECT_DIR)/yourprojectname it WILL give you that error you mentioned as I have duplicated it by removing that from Frameworks search paths
I cant post an image yet or I would for reference

A: If you add a pod written in Swift and you dont include "use_frameworks!" in your Podfile, your pods wont install and you will receive this error. Include "use_frameworks!" in the Podfile and pod install again.

A: I hope you have managed to find a solution on your own. I came across this issue today trying to implement a framework into a project without having to use cocoapods. The framework just wouldn't get recognized by xcode. The way I solved this is:

*

*I created a blank project in xCode 6.4 and followed on the steps to add the framework in a swift project normally. As expected the framework worked perfectly in conjunction with the Objective C Bridging Header, as this framework is in Objective-C.

*I then did the same with xCode 7 beta 3. Which it didnt work because of this bug.

*I then went into the xCode 6.4 project and looked at Target -> Build Settings -> Search Paths and looked at what was written there for the Framework Path and Header path.

*Then I went to the same place and xCode 7 and found that it was completely empty there.

*Then I just had to copy the path written on xCode 6.4 and adapt it to the xCode-beta path. You can look for the path on finder by typing Command + Shift + G when finder is open to search for a path. And then Test it out for your path for xCode beta and for xCode 6.4 and see if you are on the right path.

*Clean and Build your project and check if the Bridging Header is working.


text:
Q: How to quickly find a sharepoint document library by id? Given the SPList.ID and a site collection (or an SPWeb with subwebs), how do I quickly find the document library with the given ID?
I can recursively enumerate through all webs and perform a web.Lists[guid] on each one of them, but there might be thousands of subwebs in my case, and I'm looking for a realtime solution.
If there is no way to do this quickly, any other suggestions on how to uniquely identify a document library? I could store the full path (url), but the identification will be publicly visible and I don't feel very comfortable giving away our exact SharePoint document structure like that. Should I resort to maintaining a manual ID <-> library mapping in a separate list?

A: I vote for the manual ID -> URL pair matching in a top-level, well-known list that's visible only to the elevated privileges account.

A: MS does not support this :)...
But take a look at this for giggles: http://weblogs.sqlteam.com/jhermiz/archive/2007/08/15/60288.aspx

A: If you have MOSS Search available, then it might help, depending on the lag you have between these lists getting created and needing to search for them. You could probably map list id as a managed property and do a quick search for list objects with the id in question.
For lots of classes of problems it seems like search is the fastest way to rip through huge sets of data.  In fact if this approach worked for you, you really wouldn't even need to know the site collection up front.  Don't have access to any of my MOSS environments at the moment, so can't verify this will work though.

A: Since you are storing the ListID somewhere, you may also store the WebId. Lists are opened by the context SPWeb always, so if you go to:
http://toplevel/_layouts/ListGeneralSettings.aspx?ID={GUID1} // OK
http://toplevel/sub1/_layouts/ListGeneralSettings.aspx?ID={GUID1} // Wont Work (same Guid)
Having the WebId and ListId you can simply:
using(SPWeb subweb = (new SPSite("http://url")).OpenWeb(new Guid("{000...}")))
{
    SPList list = subweb.Lists.GetList(new Guid("{111...}"), true);
    // list logic
}


text:
Q: Using Group By and Roll Up for Specific Strings in SQL and Chartio I'm applying a filter in Chartio and it allows you to use SQL to create the filters query. Right now it's grouping each email provider separately. What I'd like it to do is have Gmail and AOL as separate but to rollup AcmeCo and RandCo into an "Other". What is the best way to do this?
My current default query to create the filter labels.
SELECT `Email Stats`.`provider` AS `Provider`
FROM `EmailStats` AS `Email Stats`
GROUP BY `Email Stats`.`provider`

Here is an example of my EmailStats table:
+------------+--------+----------------+
| Date       | Clicks | Provider       |
+------------+--------+----------------+
| 2015-12-13 |   10   |  Gmail         |
| 2015-12-13 |   2    |  AOL           |
| 2015-12-13 |   7    |  AcmeCo        |
| 2015-12-13 |   10   |  RandCo        |
| 2015-12-14 |   5    |  Gmail         |
| 2015-12-14 |   8    |  AOL           |
| 2015-12-14 |   12   |  AcmeCo        |
| 2015-12-14 |   18   |  RandCo        |
+------------+--------+----------------+

I'm new to SQL so I don't know what else would be helpful to finding an answer for this. Let me know if you need more details.

A: try this:
SELECT `Email Stats`.`provider`
FROM `EmailStats` AS `Email Stats`
GROUP BY `Email Stats`.`provider`
CASE `Email Stats`.`provider`
 WHEN 'Gmail' THEN 'Gmail'
 WHEN 'AOL' THEN 'AOL'
 ELSE 'Other'
END as `Provider`


text:
Q: Memory pool algorithms I am looking for smarter algorithms in handling VBOs in OpenGL.
As it stands, I currently store each of my models in 4MB VBO's.
If the model is larger than 4MB, it is stored separately.
The objects are stored such that the models are pooled together to decrease the number of binds.
The problem I am experiencing has been how to clean up unused VBO's, which are using only sparsely being used.
Any resources on how I could better manage these memory pools is appreciated.

A: VBOs are not like regular memory, there is no need for any kind of sophisticated "memory management". You allocate a own, apropriately sized VBO for each distinct mesh and be done with. Any attempt to outsmart the driver will just result in inferior performance.
Also there is no benefit in attempting to make your VBOs as large as possible. In fact modest sized VBOs of about 0.5k to 5k vertices in my experience work best.

A: I originally had something like you do.  I implemented a simple freelist in about 100 lines of code so that freed VBO segments could be reused.  It significantly reduced VBO reallocations which were giving me frame hitches.  I used a best-fit algorithm for allocations because I have many meshes which happen to have the same number of vertexes and faces.


text:
Q: SQL Server 2005: How to split a stacked column with unknown number of splits I am having more issues with splitting stacked columns, and would love some help to complete this last part. I was trying to apply another solution I had, but with no luck.
DB Table:
ID INT,
SN varchar(100),
Types varchar(1000)

Sample:
ID     SN    Types
1      123   ABC,XYZ,TEST
2      234   RJK,CDF,TTT,UMB,UVX
3      345   OID,XYZ

Desired output:
ID     SN    Types
1      123   ABC
1      123   XYZ
1      123   TEST
....

A: here's a cte i have to break up a delimited string
declare @table table (ID int identity(1,1), String varchar(max))
declare @delim varchar(max)

insert into @table values ('abc,def')
insert into @table values ('ghij,klmn,opqrst')

set @delim=','

;with c as
(
    select
        ID,
        --String,
        CHARINDEX(@delim,String,1) as Pos,
        case when CHARINDEX(@delim,String,1)>0 then SUBSTRING(String,1,CHARINDEX(@delim,String,1)-1) else String end as value,
        case when CHARINDEX(@delim,String,1)>0 then SUBSTRING(String,CHARINDEX(@delim,String,1)+1,LEN(String)-CHARINDEX(@delim,String,1)) else '' end as String
    from @table

    union all
    select
        ID,
        CHARINDEX(@delim,String,1) as Pos,
        case when CHARINDEX(@delim,String,1)>0 then SUBSTRING(String,1,CHARINDEX(@delim,String,1)-1) else String end as Value,
        case when CHARINDEX(@delim,String,1)>0 then SUBSTRING(String,CHARINDEX(@delim,String,1)+1,LEN(String)-CHARINDEX(@delim,String,1)) else '' end as String
    from c
    where LEN(String)>0
)

select ID, Value from c

A: declare @T table(ID int, SN varchar(100), Types varchar(1000))

insert into @T
select 1, 123, 'ABC,XYZ,TEST' union all
select 2, 234, 'RJK,CDF,TTT,UMB,UVX' union all
select 4, 234, 'XXX' union all
select 3, 345, 'OID,XYZ'

;with cte(ID, SN, Types, Rest) as
(
  select ID,
         SN,
         cast(substring(Types+',', 1, charindex(',', Types+',')-1) as varchar(100)),
         stuff(Types, 1, charindex(',', Types), '')+','
  from @T
  where len(Types) > 0
  union all
  select ID,
         SN,
         cast(substring(Rest, 1, charindex(',', Rest)-1) as varchar(100)),
         stuff(Rest, 1, charindex(',', Rest), '')
  from cte
  where len(Rest) > 0
)
select ID, SN, Types
from cte
order by ID

I use a recursive CTE to split the string. The third column Types is populated with the first word in the Types column of @T. Stuff will then remove the first word and populate the Rest column that then will contain everything but the first word. After UNION ALL is the recursive part that basically do the exact same thing but it uses the CTE as a source and it uses the rest column to pick the first word. The first word of the rest column is removed with stuff and then ..... well it is recursive so I think I will stop here with the explanation. The recursive part will end when there are no more words left
where len(Rest) > 0.

A: You will need to use a cursor and a while statement as far as I can tell... Some of these indexes may be off by one, but I think this should get you there...
DECLARE MY_CURSOR Cursor
FOR
SELECT ID, SN, Types
FROM Tbl1
Open My_Cursor
DECLARE @ID int, @SN varchar(100), @types varchar(1000)
Fetch NEXT FROM MY_Cursor INTO @ID, @SN, @types
While (@@FETCH_STATUS <> -1)
BEGIN
  DECLARE @Pos int
  WHILE @Pos < LEN(@types)
  BEGIN
    DECLARE @type varchar(25)
    DECLARE @nextpos int
    set @nextpos = CHARINDEX(@types, ',', @pos)
    SET @type = SUBSTRING(@types, @pos, @nextpos-@pos)
    INSERT INTO tbl2 (ID, SN, type) VALUES (@ID, @SN, @Type)
    SET @Pos = @nextpos+1
  END

FETCH NEXT FROMMY_CURSOR INTO @VAR1Number, @VAR2DateTime ,@VarLongText
END
CLOSE MY_CURSOR
DEALLOCATE MY_CURSOR


text:
Q: How to generate data URI in Symfony 2.3 Is there a bundle, or a friendly way to generate or convert a file to its data URI representation in Symfony 2.3 or above and include it in a JSON response?
How can I do that?

A: While I'm not personally too familiar with Symfony, it's fairly easy to generate a base64 encoded data URI:
function base64_uri_file($file, $type = null)
{
    return base64_uri_data(file_get_contents($file), $type);
}

function base64_uri_data($data, $type = null)
{
    $type = $type ? : 'application/octet-stream';
    return sprintf('data:%s;base64,%s', $type, base64_encode($data));
}

This doesn't take into account errors or anything; you can handle that as you see fit. Anyway, then you can:
echo base64_uri_file('/windows/twain.dll', 'application/x-msdownload');
// data:application/x-msdownload;base64,TVqOAQEAAAAEAAAA//8AALgAAAAAAAAAQAAAAA...

Incorporate these calls into the response generation pipeline and you should be good.


text:
Q: Does a continuous function map a bounded sequence to a bounded sequence? Let $f: \mathbb R \to \mathbb R$ be continuous function. Does $f$ map every bounded sequence to a bounded sequence?
Since we are talking about bounded sequence, so maybe we can take $\{1/n\}$ in $(0,1)$. It is bounded here. If we take continuous function $x\mapsto \dfrac 1x$, it would map the sequence to $\{n\}$, which is unbounded.
So I guess the answer to the given question should be No. But answer key says Yes.

A: Indeed, the answer is yes. The map $x \mapsto \frac{1}{x}$ is not continuous on $\mathbb{R}$, it is only continuous over $\mathbb{R}_{-}^* $ or $\mathbb{R}_{+}^*$, this is why close to $0$ a problem arises.
Suppose $(x_n)_{n \in \mathbb{N}}$ is a real bounded sequence and that $f$ is a continuous function over all $\mathbb{R}$. Then, if $M$ is a positive real number such that $ \forall n \in \mathbb{N}, x_n \in [-M,M]$, then, for all positive integers $n$, you must have $f(x_n) \in f\left( [-M,M] \right)$ which is a compact subset of $\mathbb{R}$ since $f$ is continuous. Therefore $\left(f(x_n)\right)$ is bounded.

A: Let $(a_n)$ be a bounded sequence. Then there exists a closed interval $[p,q]$ such that $a_n\in[p,q]$, for all $n$.
Since $f$ is continuous, the image of the compact set $[p,q]$ is a closed and bounded set (and also an interval, actually).

Why does this fail for the sequence $(1/n)$ and $f(x)=1/x$, over $\mathbb{R}_{>0}$? There is no closed and bounded interval $[p,q]$ cointained in $\mathbb{R}_{>0}$ such that $1/n\in[p,q]$, for all $n$.


text:
Q: Overriding Hashcode in a class with one field v verriding Hashcode in a class with many fields? Please see this question, which I asked recently: https://codereview.stackexchange.com/questions/186379/equality-comparison-for-a-surname-value-object-class
Under the question Zack advises that my Hashcode adds unnecessary complexity.
1) Say I have an object with more than three fields (field1, field2 and field3).  I believe this is the proposed HashCode:
public override int GetHashCode()
{
    unchecked // Overflow is fine, just wrap
    {
        int hash = 17;
        // Suitable nullity checks etc, of course :)
        hash = hash * 23 + field1.GetHashCode();
        hash = hash * 23 + field2.GetHashCode();
        hash = hash * 23 + field3.GetHashCode();
        return hash;
    }
}

2) Say I have an object with more than one fields (field1).  I believe this is the proposed HashCode:
public override int GetHashCode()
{
    return field1.GetHashCode();
}

Have I understood this correctly? What is the point of unchecked in the first sample?

A:
What is the point of unchecked in the first sample?

By multiplying and adding all the single hashcodes together you very likely will hit the Int32.MaxValue limit wich can cause an OverflowException.
As it is fine to just "wrap" (=continue at Int32.MinValue) in that case you mark that block as unchecked and no exception will be thrown.


text:
Q: MySQLi prepare with fetch_assoc, or is mysql_real_escape_string ok to use? I inherited a moderately large sized code base that makes extensive use of mysql_fetch_assoc and mysql_fetch_object, and doesn't have any security precautions preventing SQL injection. I decided that this was a Very Bad ThingTM that needed fixing.
Initially, I intended on moving to mysqli prepare/bind_param/execute statements to handle DB queries. However, the following does not work:
$stmt = $GLOBALS['db']->prepare('SELECT * FROM Users WHERE Username=?');
$stmt->bind_param('s', $username);
$stmt->execute();

// Somehow retrieve the fetched row as an object (Doesn't work!)
return $stmt->fetch_assoc();

Question 1: Is there a way to use fetch_assoc or fetch_object using prepare/bind? I can refactor all the code, but it would be messy and take a very long time.
Question 2: If it is not possible to do this, is it just as effective from a security standpoint to use mysqli_query(), provided all inputs are properly escaped via mysql_real_escape_string()? Do you have any other suggestions?

A: *

*$row = $stmt->fetch(PDO::FETCH_ASSOC)  Ref: http://php.net/manual/en/pdostatement.fetch.php

*You can use mysqli if you want. As long as you use the real_escape_string functions on ALL user data (including your own) that's going into SQL statements, then it's no less secure than using prepared statements - it's just much easier to miss a post and leave a hole open.

A: Replacing raw mysql with raw mysli makes very little sense.
in fact, all those doleful repetitive prepare/bind/execute/fetch being as ugly as mysql_query/fetch.
If you going to refactor your code anyway,  you have to develop some library function, which will take a query and it's prameters as arguments and return an array of data, doing all the fetching inside.
as for the escaping all inputs via mysql_real_escape_string(), it is going to be an equivalent of magic quotes, which, at last, been acknowledged as a bad practice.
in fact, mysql_real_escape_string() doesnt make any data safe. it has nothing to do with safety at all. it's merely a formatting routine, and works only for strings. But there are other types to insert into query. For the detailed explanations refer to my prefious answer, How to include a PHP variable inside a MySQL insert statement


text:
Q: How to update velocity when changing direction in Box2D? I am writing a sprite with a body that moves at constant speed. So it goes like this in the time step:
const v = body.getLinearVelocity();
v.normalize();

body.setLinearVelocity(v * speed);

Then I want to listen to mouseclicked event and the sprite will move to the new direction accordingly.
This is what I am doing in the mouseclicked event handler:
const point = /* new Point on screen */
const rotation = Math.atan2(point.y - player.y, point.x - player.x);
body.setTransform(body.getPosition(), rotation);

But when I click the mouse my sprite will not turn to the new direction, it goes to the old direction at the same constant speed. I can see the body's angle is changed at every time step. It just won't go to the new direction.
How can I turn my sprite and move it towards a new direction in Box2D?

A: It is better to use applyForce() and/or applyImpulse(), because that makes the body actually move. setTransform(), well, will "beam" it to the new transform, without any movement.
B2D will calculate all the velocities, including angular ones, when you use those apply* methods, what results in realistic simulation. Things like setTransform or setLinearVelocity should be used if non realistic things should occur.
If your body should behave like a real one in terms of colision and forth, you need to calculate the force needed to  to make it move to the desired new place, regularly

A: Velocity can be instantaneously updated by calling the b2Body::SetLinearVelocity method. This can potentially change the magnitude and/or the direction of a body's velocity.
To change only the direction of travel of a body:

*

*Get the current linear velocity of the body (call b2Body::GetLinearVelocity).

*Rotate a local copy of the returned b2Vec2 to the new heading.

*Set the new linear velocity to the rotated b2Vec2 (call b2Body::SetLinearVelocity).

Note however that in the physical world things with mass basically can't instantaneously change their velocities. So changing the velocity of your sprite this way is less realistic from a physics perspective if your sprite will have mass. If it will have mass, then as phillip explained, applyForce or applyImpulse are methods that are meant to be called to provide changes to the velocity that are more realistic (from a physics perspective).


text:
Q: Clearing plotted points in R I am trying to use the animation package to generate an "evolving" plot of points on a map. The map is generated from shapefiles (from the readShapeSpatial/readShapeLines functions).
The problem is when it's plotted in a for loop, the result is additive, whereas the ideal result is to have it evolve.
Are there ways of using par() that I am missing?
My question is: is there a way to clear just the points ploted from the points function
and not clearing the entire figure thus not having to regraph the shapefiles?
in case someone wants to see code:
# plotting underlying map
newyork <- readShapeSpatial('nycpolygon.shp')
routes <- readShapeLines('nyc.shp')
par(bg="grey25")
plot(newyork, lwd=2, col ="lightgray")
plot(routes,add=TRUE,lwd=0.1,col="lightslategrey")

# plotting points and save to GIF
ani.options(interval=.05)
saveGIF({
  par(bg="grey25")
  # Begin loop
  for (i in 13:44){
    infile <-paste("Week",i,".csv",sep='')
    mydata <-read.csv(file = infile, header = TRUE, sep=",")
    plotvar <- Var$Para
    nclr <- 4
    plotclr <-brewer.pal(nclr,"RdPu")
    class<- classIntervals(plotvar,nclr,style = "pretty")
    colcode <- findColours(class,plotclr)
    points(Var$Lon,Var$Lat,col=colcode)
  }
})

A: If you can accept a residual shadow or halo of ink, you can over-plot with color ="white" or == to your background choices. We cannot access your shape file but you can try it out by adding this line:
points(Var$Lon, Var$Lat, col="grey25")

It may leave gaps in other previously plotted figures or boundaries, because it's definitely not object-oriented. The lattice and ggplot2 graphics models are more object oriented, so if you want to post a reproducible example, that might be an alternate path to "moving" forward. I seem to remember that the rgl package has animation options in its repetoire.


text:
Q: The product is not calculated correctly
I wrote code to evaluate the expression above. It executes, but I suspect that the expression is not evaluated correctly.
#include <iostream>
#include <math.h>

using namespace std;

int main(){
    setlocale(0, "");

    // Задание 1
    cout << "Задание 1" << endl;
    cout << "" << endl;

    double m, x, k, k1, k2;
    int n = 18;

    cout << "Определите m: ";
    cin >> m;

    cout << "Определите x: "; // вероятно, в задании ошибка. Если не положу ничего в x - там будет
                              //единица, ответы будут примерно одинаковые.
    cin >> x;

    do // начало цикла do while
    {
        k2 = pow(x, 3*x+1);
        k1 = k2 * (8*x);
        k = k1 - 785;
    }
    while (n < m); // конец цикла do while

    cout << "Результат вычисления, k = " << k << endl;

    system("pause");
}

A: If you want to use a loop instead of calling std::pow, you have to fix its condition and iteration expression. The calculations inside the body are also different from the posted formula. Note the following changes:
double k = 1.0;
for (int i = n; i <= m; ++i)
{ //        ^^^^^^^^^^^^^^^
    k *= pow(x, 3.0 * x + 1.0) + 8.0 * x;
  //  ^^                      ^^^
}
k -= 785.0;     // <- This should be outside

Note that the body of the for loop doesn't depend on i, so that there are plenty of ways to refactor this code in more efficient ways.


text:
Q: Computing $\pi_1(\Bbb R^n\setminus(\Bbb S^1\cup\{\text{axis}\}))$ and a certain normal subgroup $N$ to use Seifert-Van Kampen I need to compute the fundamental group of $X = \Bbb R^n\setminus\Bbb S^1$, for $n\ge 3$. My teacher has provided me with a previous step, which is by using S-VK theorem on these two open sets:
\begin{equation}
A = X\setminus\{(x_1,...,x_n) \in R^n : x_1=...=x_{n-1}=0\},
\end{equation}
which is just $\Bbb R^n\setminus(\Bbb S^1\cup\{\text{axis}\})$, and
\begin{equation}
B = \{(x_1,...,x_n) \in X : x_1^2+...+x_{n-1}^2 < 1\},
\end{equation}
which is contractible, since it is the interior of a "(n-1)-dimensional cylinder".
If I rewrite the first subspace like $A = T\times \Bbb S^1$, for
\begin{equation}
T = \{(x_1,...,x_{n}) \in X : x_1>0, x_2=0\},
\end{equation}
I get that the fundamental group of $A$ is
\begin{equation}
\pi_1(A) = \begin{cases}
\Bbb Z^2 & \quad\text{for $n\in\{3,4\}$} \\
\Bbb Z & \quad \text{for $n>4$}
\end{cases}
\end{equation}
since for $n\ge 4$, $T$ is homeomorphic to $\Bbb R^{n-1}\setminus\text{\{straight line\}}$, and for $n=3$, $T\simeq \Bbb S^1$, so
\begin{equation}
\pi_1(T) = \begin{cases}
\Bbb Z & \quad\text{for $n\in\{3,4\}$} \\
\Bbb \{0\} & \quad \text{for $n>4$}
\end{cases}
\end{equation}
It is also clear that $A\cap B\simeq \Bbb S^1$, then $\pi_1(A\cap B)=\Bbb Z$.
I want to use a result (taken from the S-VK theorem for 2 open sets) which states that if $B$ is 1-connected, then $\pi_1(X) = \pi_1(A)/N$, where $N$ is the least normal subgroup that contains $Im(i_1)_*$, and $(i_1)_*:\pi_1(A\cap B)\to\pi_1(A)$.
So, I have two questions:

*

*Did I do the fundamental group of $T$ correctly? It seems odd, but from this post I know that the case for $n=3$ is at least correct. Is it, though, for $n\ge 4$?

*How do I compute $N$? I'm a bit green in algebraic topology, and I cannot find many examples on how to compute this subgroup $N$ out of data from the subspaces.
I already know the answer of $\pi_1(\Bbb R^n\setminus\Bbb S^1)$, which is answered in this other post, but I need to reach the answer through this previous step. Could anyone please help me? Thanks in advance!


text:
Q: How to import github project to stackoverflow profile? I am new here in stackoverflow, and I saw this advert about importing our github project to stackoverflow profile:

But really, I cannot find a way to do this. Any helps? thanks!

A: As the banner clearly states, this is for StackOverflow Careers, which is invite-only.


text:
Q: Remove values from existing XML Consider XMLsample with having values in and I want to remove the values and display or store the XMLfile with only tags and attributes if any, not with any values in elements
example:
<hello> hi how </hello> convert this to <hello></hello> and my XML is having 2 or 3 depth child elements also

A: $xml = simplexml_load_string($string);
ClearRecurse($xml);
echo $xml->asXML();

function ClearRecurse(&$xml)
{
   $children = $xml->children();
   if (empty($children)) {
     $xml[0] = "";                   // No child - clear value
   }
   else {
     foreach($xml->children() as $key=>$value) {
        ClearRecurse($value);        // Repeat for all descendants
      }
   }
}

demo on eval.in


text:
Q: BB 10 Cascades Internet Check I need to check the Internet Connection If I get Socket Error. I am proceeding like this,
void Client::socketError(QAbstractSocket::SocketError socketError) {
   HttpPost("https://www.google.co.in/");
}

void Client::HttpPost(QString URL ) {

    QNetworkRequest request = QNetworkRequest();
    request.setUrl(QUrl(URL));

    QNetworkAccessManager *mNetworkAccessManager = new QNetworkAccessManager(this);
    bool result = connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)),
                          this, SLOT(HttpResponse(QNetworkReply *)));

    mNetworkAccessManager->get(request);
    qDebug() << "::: Client.cpp  Request made to Service :::";
}

void Client::HttpResponse(QNetworkReply* reply) {

    if (reply->error() == QNetworkReply::NoError) {
        qDebug() << "\n  Internet Ok **********";
    } else {
        qDebug() << "\n No Internet **********" << reply->errorString();
        showDialog("No Inernet");
    }
}

and I am connecting to Signals and Slots like
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
        this, SLOT(socketError(QAbstractSocket::SocketError)));

But some times I am getting "No Internet Dialog " Even If wi-fi Is Available. Why ?

Method 2:
// this method will return true If Net is available false other wise
// but even this is return false some times even Wi fi signal is Available

bool Client::isNetworkAvailable() {
    bool isFound = false;
    QNetworkConfigurationManager netMgr;
    QList<QNetworkConfiguration> mNetList = netMgr.allConfigurations(QNetworkConfiguration::Active);

    if (mNetList.count() > 0) {
            if (netMgr.isOnline()) {
                isFound = true;
            }
    }
    qDebug() << "\n ************** isNetworkAvailable:::" << isFound;
    return isFound;
}

Is there a problem in my code?

A: Your network check snippet seems a bit too complicated. You could simply just call the following method:

bool QNetworkConfigurationManager::isOnline () const
Returns true if the system is considered to be connected to another device via an active network interface; otherwise returns false.

If this does not work for someone, it very likely means that the internet connection is unreliably, especially if it does not work randomly.

A: What about
NetworkAccessibility QNetworkAccessManager::networkAccessible ()

networkAccessible : NetworkAccessibility
This property holds whether the network is currently accessible via
  this network access manager.
If the network is not accessible the network access manager will not
  process any new network requests, all such requests will fail with an
  error. Requests with URLs with the file:// scheme will still be
  processed.


text:
Q: how to centering "align-vertical" facebook like button? I want to center the facebook like button vertically. how to do that?
heres my website:
http://feednews.id/
see the like button on the top right of the page?
why it gets aligned to the top? i already use
style="display: inline-block; vertical-align: middle;"

Please, please, please help me. as I already try to figuring it out for all day long. I'm now got headache :(
I prefer not to change any css file. can i still do that?
Heres the facebook button code that i use: fiddle

A: use margin property:
._2tga._3e2a {
    border-radius: 4px;
    font-size: 13px;
    height: 28px;
    padding: 0 4px 0 6px;
    margin-top: 10px;
}

A: You should seperate your inline-styles using ; not "and"
Remove:
and vertical-align: middle;

and update it: vertical-align:middle
Do not use "and" in between styles.


text:
Q: How to apply RGBA_8888 and dither correctly? I have splash.png with gradient. But on screen this image looks not so good ...
My simple .apk for this question consists of:
public class TestditherActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

  @Override
  public void onAttachedToWindow() {
    super.onAttachedToWindow();
    getWindow().setFormat(PixelFormat.RGBA_8888);
  }
}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center" >

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitXY"
    android:src="@drawable/test"/>

</LinearLayout>

and test.xml:
<?xml version="1.0" encoding="utf-8"?>

<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:antialias="true"
android:dither="true" />

splash.png

result

How to apply RGBA_8888 and dither correctly? Where is my mistake?
The next code gives me perfect result in emulator, but not on the real device:
public class TestditherActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    getWindow().setFormat(PixelFormat.RGBA_8888);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inPreferredConfig = Bitmap.Config.ARGB_8888;
    Bitmap gradient = BitmapFactory.decodeResource(getResources(), R.drawable.splash, options);

    findViewById(R.id.linear).setBackgroundDrawable(new BitmapDrawable(gradient));
}
}

main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

A: Take a look at this:
Awful background image quality in Android
Or this blog post about dithering in Android: http://android.amberfog.com/?p=247
In your case the problem is in the bitmap xml. I remember reading somewhere that the dither only works if the bitmap has a tileMode set.


text:
Q: Redirect to App Store from iOS Application when name contains spaces? I am having problems redireting from my iOS app to the App Store. I am using the URL:
itms-apps://itunes.com/apps/app_name

but with no success. My app name has spaces in which cannot be used in the above example. Is there a way around this. Is it not possible to use the bundle identifier to redirect to the app store?

A: You can build a link like that:
http://www.itunes.com/app/AppName

*

*Upper-/lowercase doesn't matter

*Remove any spaces and punctuation

Example:
Doodle Jump - BE WARNED: Insanely Addictive!
will be:
http://www.itunes.com/app/DoodleJumpBEWARNEDInsanelyAddictive


text:
Q: Non conservative vector field A question asked to show that $\vec{F}=\frac{-yi+xj}{x^2+y^2}$ is not conservative. My intuition was that $\vec{F}$ could be rewritten as $\frac{1}{x^2+y^2}(-yi+xj)$ and $-yi+xj$ is not a gradient nor conservative.
I know that you can choose a curve (unit circle) and show that is in fact not conservative, my question is whether my intuition is correct, ie. if a vector field can be rewritten as a scalar function (not identically 0) times a non conservative field would it always result in a non-conservative field.


text:
Q: Can I customize the intellisense value shown when hovering while debugging in visual studio? When I hover over a variable in visual studio, it brings up a small control which shows the variable name, type, and a + box for viewing members, etc. But for some types the variable type is replaced by more helpful information such as "{X = 0.0 Y = 0.0 Width = 0.0 Height = 0.0}" for a RectangleF.
Is there a way to specify what should be displayed? Is there an IDE setting? Is there a function attribute?
I am using visual studio 2008, language is visual basic.

A: The DebuggerDisplay attribute would be what you are looking for:
[DebuggerDisplay("x={xvar} Y={yvar} Width = {widthvar} Height = {heightvar}")]

More info can be found here

A: You're looking for DebuggerDisplayAttribute. I wrote more info about using it and the capabilities it has here.


text:
Q: jQuery only firing once I got one problem: My jQuery ist only firing once:

I can delete only the first "item". After that it needs a refresh and than I can delete the next first "item" again. Very confusing.
This is how the "items" are displayed:
<?  foreach($stmt as $row) { ?>
<div class="col-lg-3 col-xs-6 did<?php echo $row[0]; ?>" id="row1">

        <div class="inner did2<?php echo $row[0]; ?>">

Name

<? echo $row[1]; ?>

        <a href="#" id ="delcat" class="small-box-footer" data-catid="<?php echo $row[0]; ?>" >Delete

<? } ?>

A: You can have one unique id on a single page; since you're looping through $stmt, you can't be using id multiple times. Replace the id with a class and bind that
PHP -- Loop
<a href="#" class="delcat small-box-footer" data-catid="<?php echo $row[0]; ?>" >Delete

And JS changes.
$('.delcat').click(function(){
     ....
});

A: Use class to do that things:
$('.delcat').click(function(){

instead of
$('#delcat').click(function(){

In your html:
Delete

Your solution get the first element with that id. You never have to use multiple equal id.


text:
Q: How To Clear A Single Line of Text in a Console I'm Trying To Clear a Line In a Console Like This:
Confirm? yes

Placing Order...

Then:
Confirm? yes

Order is at the location that you've provided!

i don't want it to be:
Confirm? yes

Placing Order...
Order is at the location that you've provided!

This is like when you install module with pip, the progress bar just stays in the same line and not onto another line.
I'm using Python 3.10

A: You can use the python's os module to use the console's clear command. For example,
confirm = input("confirm? ")
if confirm.lower() in ["yes", "y"]:
    print("Placing Order...")
os.system("clear")
addressConfirm = input("confirm? ")
if addressConfirm.lower() in ["yes", "y"]:
    print("Order is at the location that you've provided!")


text:
Q: hBaseRDD.collect() giving an error I am wotking with spark and hbase. I used HBaseTest.scala.
rdd.count() is giving accurate result. But when I try to do rdd.collect() following error came:
java.io.NotSerializableException: org.apache.hadoop.hbase.io.ImmutableBytesWritable
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
    at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1377)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
    at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:42)
    at org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:73)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:210)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Not able to figure out the issue. I want to print some rows of hbase table.

A: I had the same problem and found the solution here.
Here is a code snippet
type HBaseRow = java.util.NavigableMap[Array[Byte], java.util.NavigableMap[Array[Byte], java.util.NavigableMap[java.lang.Long, Array[Byte]]]]
type CFTimeseriesRow = Map[Array[Byte], Map[Array[Byte], Map[Long, Array[Byte]]]]
type CFTimeseriesRowStr = scala.collection.immutable.Map[String, scala.collection.immutable.Map[String, scala.collection.immutable.Map[Long, String]]]
import scala.collection.JavaConverters._
def rowToStrMap(navMap: CFTimeseriesRow): CFTimeseriesRowStr = navMap.map(cf =>
  (Bytes.toString(cf._1), cf._2.map(col =>
    (Bytes.toString(col._1), col._2.map(elem => (elem._1, Bytes.toString(elem._2)))))))
def navMapToMap(navMap: HBaseRow): CFTimeseriesRow =
  navMap.asScala.toMap.map(cf =>
    (cf._1, cf._2.asScala.toMap.map(col =>
      (col._1, col._2.asScala.toMap.map(elem => (elem._1.toLong, elem._2))))))
@transient val conf = HBaseConfiguration.create()
conf.set(TableInputFormat.INPUT_TABLE, tableName)
val hBaseRDD = sc.newAPIHadoopRDD(conf, classOf[TableInputFormat],
  classOf[org.apache.hadoop.hbase.io.ImmutableBytesWritable],
  classOf[org.apache.hadoop.hbase.client.Result])
  .map(kv => (kv._1.get(), navMapToMap(kv._2.getMap)))
  .map(kv => (Bytes.toString(kv._1), rowToStrMap(kv._2))).take(10).foreach(println)


text:
Q: NestJs TypeORM async configuration I am trying to use the @nestjs/typeorm module and using the async configuration. In my app.module.ts I have the following:
@Module({
  controllers: [
    AppController,
  ],
  exports: [ConfigModule],
  imports: [
    ConfigModule,
    TypeOrmModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: async (config: ConfigService) => {
        console.log("config.getPostgresConfig(): ", config.getPostgresConfig());
        return {
          ...config.getPostgresConfig(),
          entities,
          synchronize: true,
          type: "postgres",
        } as PostgresConnectionOptions;
      },
    }),
  ],
  providers: [AppService],
})
export class AppModule {}

The console.log prints the correct stuff, but I constantly get this error:
2019-06-17T14:41:35.569358700Z [Nest] 45   - 06/17/2019, 2:41 PM   [NestFactory] Starting Nest application...
2019-06-17T14:39:31.277686600Z     at Object.next (/root/node_modules/tslib/tslib.js:114:57)
2019-06-17T14:41:35.740192700Z [Nest] 45   - 06/17/2019, 2:41 PM   [TypeOrmModule] Unable to connect to the database. Retrying (1)... +170ms
2019-06-17T14:41:35.740666500Z Error: No connection options were found in any of configurations file.
2019-06-17T14:41:35.740704100Z     at ConnectionOptionsReader.<anonymous> (/root/src/connection/ConnectionOptionsReader.ts:41:19)

The config should be done all dynamically through the config service, I don't understand why it is asking for a config file, and why it can't connect to the database.

A: This was my bad, I was importing TypeOrmModule.forRoot() in another module also, which caused lots of issues.


text:
Q: Dynamically resize a div using jQuery I have a div (id="mainDiv") which I need to dynamically resize if the user changes the size of their browser window. I have written the following code to try and get this to work however this doesn't seem to be setting the height of my div:

I don't know much jQuery, am I making an obvious mistake?

A: There are a few things going wrong here:

*

*Your code will execute straight away before your document has finished loading.

*Your code will execute only on load of the the script, not on resize

*You're not setting the height of your mainDiv - you're setting the height of another element with the id: accordianMain (but I'm guessing you know that).

You need to handle the browser resize event to wait for the browser to resize then get the dimensions of the window and apply accordingly. You'd do this by handling the window.resize event liks this:
var $win = $(window);

$win.on('resize',function(){
    $("#mainDiv").height($win.height());
});

What you probably want to do is wait for for a resize to finish to by adding a timeout so that it doesn't fire too often as well:
var timer,
    $win = $(window);

$win.on('resize',function(){
    clearTimeout(timer);
    timer = setTimeout(function(){
        $("#mainDiv").height($win.height());
    }, 500);

});

A: You need to wrap it in a resize function:
$(window).on('resize',function(){
    var height = $(window).height();
    $("#mainDiv").height(height);
});

Although I should point out what your doing could easily be attained through CSS:
body,#mainDiv {
    height:100%;
}

This is more to point out the "it needs to be in a resize event wrapper" larger point, in case you wanted to do some logic that actually needed the event.

A: Yes, the mistake is use jquery hehehe
You do this with CSS

A: Use an event listener for the window resize (and you should wait for page load before accessing elements with JQuery):
$(function() {
  $(window).on('resize', function() {
    var height = $(window).height();
    $("#mainDiv").height(height);
  });
});

A: I used div content and div footer in my page, i will set this code in my js to set dynamic height for div content.
 footer = $("div[data-role='footer']");
    content = $("div[data-role='content']");
    viewHeight = $(window).height();
    contentHeight = viewHeight - footer.outerHeight();
    contentHeight -= (content.outerHeight() - content.height());
    content.height(contentHeight);