text:
Q: Javascript inside javascript I'm using a js gallery (photoswipe) and one of the slides isn't an image but has some html.
In that slide is event tracking on a form submit with onmousedown, which I can't get to work.
So I have:
some vars
items.push({ html: '<div and form start etc>
    <input type="submit" onmousedown="javascript:_paq.push(["trackEvent" etc ]);_paq.push(["etc"]);_paq.push(["etc"]);">
'});

I've learn by fiddling and trial and error, sorry for the newbie question.
Any ideas anyone?

A: Injecting JS in this way is not the cleanest thing to do. Instead, you could consider an more global approach with event delegation:
Somewhere in your page, include a click listener:
document.addEventListener('click', function (event) {
  if(event.target.classList.contains('js-track-subscribe-blog-location')) {
    _paq.push(["trackEvent","Blog","Subscribe",location.pathname.substring(1)])
  }
})

From the moment this script has run, anything on your page with the class js-track-subscribe-blog-location will trigger your tracking code when clicked.
Simply include the class on your <input type="submit" and it should work.


text:
Q: Android SDK - aapt: error while loading shared libraries: libc++.so I downloaded the sdk-tools linux-3859397.zip and extract it to /opt/android (which is my ANDROID_HOME)
So, when I launch aapt it fail to load the libc++ shared library
$ /opt/android/build-tools/27.0.3/aapt
/opt/android/build-tools/27.0.3/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

But the libc++ exists, as example the ldd tools has found it !
$ ldd /opt/android/build-tools/27.0.3/aapt
    linux-vdso.so.1 (0x00007ffdd66b3000)
    libc++.so => /opt/android/build-tools/27.0.3/lib64/libc++.so (0x00007fc511580000)
    librt.so.1 => /usr/lib64/librt.so.1 (0x00007fc511378000)
    libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fc511170000)
    libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fc510f50000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x00007fc510d38000)
    libm.so.6 => /usr/lib64/libm.so.6 (0x00007fc5109e0000)
    libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fc5107c8000)
    libc.so.6 => /usr/lib64/libc.so.6 (0x00007fc5103e0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fc511698000)

$ file /opt/android/build-tools/27.0.3/lib64/libc++.so
/opt/android/build-tools/27.0.3/lib64/libc++.so: setgid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

I tried to install libstdc++-devel both in 32bit and 64 bits but that do not solve this issue
Thanks for your help
Note: same problem with aapt2

A: [Solved]
After copying  libc++.so file to /lib/. Issue resolved.
sravan@host3933:/lib$ ls -al |grep libc++
-rwxr-xr-x  1 root root 5584312 Aug 20 17:41 libc++.so
sravan@host3933:/lib$ aapt -help
ERROR: Unknown command '-help'
Android Asset Packaging Tool
Usage:
 aapt l[ist] [-v] [-a] file.{zip,jar,apk}
   List contents of Zip-compatible archive.

redpajama_set_name: RedPajamaStackExchange


text:
Q: \varmathbb and package txfonts restricted to math mode This question is related to this one: What are all the font styles I can use in math mode?
I would like to know if it is possible to use the command \varmathbb{}, that according to the accepted answer needs either the package txfonts or the package pxfonts (I am using the former), without extending the usage of the font to the entire document (thus leaving computer modern as the standard font).
Thanks a lot in advance for any feedback.

A: Use the font defined by newtxmath, with some help (the characters are not in the standard font position).
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

% from newtxmath
\DeclareFontFamily{U}{ntxmia}{}
\DeclareFontShape{U}{ntxmia}{m}{it}{<-> ntxmia }{}
\DeclareFontShape{U}{ntxmia}{b}{it}{<-> ntxbmia }{}
\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}

\AtBeginDocument{\let\mathbb\varmathbb}

\ExplSyntaxOn
\NewDocumentCommand{\varmathbb}{m}
 {
  \tl_map_inline:nn { #1 }
   {
    \use:c { varbb##1 }
   }
 }
\cs_new_protected:Nn \__mathbb_define:Nn
 {
  \DeclareMathSymbol{#1}{\mathord}{lettersA}{#2}
 }
\cs_generate_variant:Nn \__mathbb_define:Nn {ce}
\tl_map_inline:nn { ABCDEFGHIJKLMNOPQRSTUVWXYZ }
 {
  \__mathbb_define:ce { varbb#1 } { \int_eval:n { `#1+67 } }
 }
\tl_map_inline:nn { abcdefghijklmnopqrstuvwxyz }
 {
  \__mathbb_define:ce { varbb#1 } { \int_eval:n { `#1+61 } }
 }
\DeclareMathSymbol{\varbbimath}{\mathord}{lettersA}{'270}
\DeclareMathSymbol{\varbbjmath}{\mathord}{lettersA}{'271}
\ExplSyntaxOff

\begin{document}

$\mathbb{A}\mathbb{B}\mathbb{C}\mathbb{R}\mathbb{Z}\mathbb{k}\mathbb{l}\mathbb{m}$

$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZklmn}$

$\varbbimath\varbbjmath$

\end{document}

Old answer (kept for those who still run TeX Live 2018)
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

% from newtxmath
\DeclareFontFamily{U}{ntxmia}{}
\DeclareFontShape{U}{ntxmia}{m}{it}{<-> ntxmia }{}
\DeclareFontShape{U}{ntxmia}{b}{it}{<-> ntxbmia }{}
\DeclareSymbolFont{lettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{ntxmia}{b}{it}

\AtBeginDocument{\let\mathbb\varmathbb}

\ExplSyntaxOn
\NewDocumentCommand{\varmathbb}{m}
 {
  \tl_map_inline:nn { #1 }
   {
    \use:c { varbb##1 }
   }
 }
\tl_map_inline:nn { ABCDEFGHIJKLMNOPQRSTUVWXYZ }
 {
  \exp_args:Nc \DeclareMathSymbol{varbb#1}{\mathord}{lettersA}{\int_eval:n { `#1+64 }}
 }
\exp_args:Nc \DeclareMathSymbol{varbbk}{\mathord}{lettersA}{169}
\ExplSyntaxOff

\begin{document}

$\mathbb{A}\mathbb{B}\mathbb{C}\mathbb{R}\mathbb{Z}\mathbb{k}$

$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZk}$

\end{document}


text:
Q: How to show JSON data in tableView I have been working some time with a recipe app where you can search for recipes using spoonacular API. I have succesfully stored the JSON data in an array but now I don't know how to get the data to the tableview when a user searches for something? Here is my code so far.
How I fetch JSON file and read the data:
Class APIRequest() {

static let instance = APIRequest()

var query:String = ""
var url: String = ""
var testString: String = ""

func setQuery(_ query: String) -> Void {
    self.query = query
}

func getReturn(completed: @escaping (Result<Response, Error>) -> Void) {
    // TODO MAJOR!
    // Expressions are not allowed at top level will occur otherwise
    //

    let headers = [
        "x-rapidapi-host": "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com",
        "x-rapidapi-key": "e44daac5e0mshc682df24497a89fp1c4513jsn7067934f0b9b"
    ]

    var request = URLRequest(url: URL(string: "https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/search?number=2&query=\(query)")!,
                             cachePolicy: .useProtocolCachePolicy,
                             timeoutInterval: 10.0)
    request.httpMethod = "GET"
    request.allHTTPHeaderFields = headers

    let session = URLSession.shared
    let dataTask = session.dataTask(with: request) { (data, response, error) -> Void in
        if let error = error { completed(.failure(error));  return }
        do {
            let result = try JSONDecoder().decode(Response.self, from: data!)
            completed(.success(result))

        } catch {
            completed(.failure(error))
        }
    }
    dataTask.resume()
}

My recipe class:
class Recipe: Codable {
let id: Int
let image: String
let title: String
let readyInMinutes: Int

init(id: Int, image: String = "Default", title: String = "Title", readyInMinutes: Int) {
    self.id = id
    self.image = image
    self.title = title
    self.readyInMinutes = readyInMinutes
}
}

recipeHandler:
class RecipeHandler {

static let instance = RecipeHandler()

var allRecipeResults: [Recipe] = []
}

Then I have this response struct which I am unsure about:
struct Response: Codable {
   struct Result: Codable {
       let id: Int
       let title: String
       let image: String
       let readyInMinutes: Int
   }
   let results: [Result]
   }

And my RecipeViewController:
class RecipeViewController: UITableViewController {

@IBOutlet var recipeTable: UITableView!

override func viewDidLoad() {
    super.viewDidLoad()

    recipeTable.delegate = self
    recipeTable.dataSource = self

}

}

//MARK: - Add cell
extension RecipeViewController {

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
    return RecipeHandler.instance.allRecipeResults.count
    }

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if let cell = tableView.dequeueReusableCell(withIdentifier: "RecipeCell") as? RecipeTableViewCell{
        let recipeItem = RecipeHandler.instance.allRecipeResults[indexPath.row]
        cell.recipeImage.image = UIImage(named: recipeItem.image)
        cell.recipeTitle.text = recipeItem.title
        cell.recipeTime.text = "\(recipeItem.readyInMinutes)"
        return cell
    }
    return UITableViewCell()
    }
    }

//MARK: - SearchBarSearchButtinClicked
extension RecipeViewController: UISearchBarDelegate{
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
    guard let searchBarText = searchBar.text else {return}
    let request = APIRequest.instance
    request.query = searchBarText
    request.getReturn { result in
        switch result {
            case .success(let result):
                print(result.results)
                //Don't know what to do here?

            case .failure(let error):
                print(error)
        }
    }

}
}

A: You seem to have the right idea... you're using the RecipeHandler singleton as a simple data model, and trying to get data out of that model in your tableView:cellForRowAtIndexPath:. You just never put any data into the model, so there's nothing to get out.
        case .success(let result):
            print(result.results)
            //Don't know what to do here?

Does your .success handler get called after you make the request? Do results get printed? If no, then you need to look for a problem in your response handling and decoding. Otherwise, convert the Results to recipes and add them to your model.


text:
Q: Dom parser concurrent acces safe? Java I wanted to ask if reading an XML document withthe DOM parser is thread safe? So multiple threads can read an XML at the same time using the DOM parser or could there happen some sort of access problems when one threads reads the xml and another also wants to read the same xml at the same time?
If DOM parser is not thread safe, maybe the SAX parser is thread safe?


text:
Q: Good dynamic dns service and client for mac server in 2012? Apparently DynDNS does not offer free dynamic DNS anymore. My router does ONLY support DynDNS and there is no 3rd-party firmware to change this.
I am searching for an alternative for my requirements,which turns out to be difficult because most google results do not reflect the change and recommend DynDNS.
I would need:

*

*redirect ssh and some other ports to my home server, a Mac mini

*have a client or some sort of automated solution for OS X

*work in background

I tried no-ip.org, which works fine, except that I have to manually confirm subscription monthly. I am not sure what the best way for client-updating on OS X is. But so far, this seems to be the best option.
My question:

*

*Does anyone recommend another dynamic DNS service instead of
no-ip.org?

*Any recommendations for dynamic DNS updating from OS X (Lion Server)?
Thanks for reading and any reply!

A: 2. There is a command line client for MacOS - inadyn. Inadyn is configurable and supports different Dynamic DNS providers. Also with some services you can use simple curl run as a cron job as a client. curl is a command-line tool, and is installed by default on MacOS. For an examples of how to do dynamic DNS with command-line, you can look at instructions provided by zerigo or net-me. The exact details will vary between different providers.
1.
There's a good list of free dynamic DNS providers. I'm too biased to recommend one (see profile ;).


text:
Q: Unity cancel OnMouseDown Event When Input Touch event triggered I am doing levels page that you can slide to the right and left for the orher levels.
There is 6 level per page an 2d box collider every level box. When the level box is clicked, i  load the game scene by using OnMouseDown event.
But when i touch the screen to look other levels, My OnMouseDown function triggers and i couln't browse the levels through.
How can i handle this situtation.
If i touch and move the screen. I dont want to OnMouseDown function is triggered.

A: Input.GetMouseButtonDown(0) returns true only during the first frame when the user *presse*s the left mouse button. However, Input.GetMouseButton(0) returns true while the left mouse button is being held down.
You could check whenever your input is hovering a level and add an animation to let the button feel like 'pressed in', by using Input.GetMouseButton(0). Then detect an Input.GetMouseButtonUp(0) and check if the input is above a level at that point. Insert the code to load your level in the Input.GetMouseButtonUp(0) code.


text:
Q: Define value type of Typescript Mapped Type without using Record<> (which allows for any key to be used) I'm trying to make a Typescript model for Firestore to allow for more type-safe reads and writes. Here was my first attempt:
type PossibleDocValues = number | string | boolean | PossibleDocValues[] | { [key: string]: PossibleDocValues };
type Doc = Record<string, PossibleDocValues | Collection>
type Collection = { [key: string]: Doc }

type ExcludeKeysWithTypeOf<T, V> = {
  [K in keyof T]: T[K] extends V ? never : K
}[keyof T]

type Without<T, V> = Pick<T, ExcludeKeysWithTypeOf<T, V>>;

//PureDoc should return a Doc with all Collection properties stripped
type PureDoc<T extends Doc> = Without<T, Collection>

//TEST STARTS HERE
interface testDoc extends Doc{
  foo: string,
  bar: string[],
  col: testCollection
}

interface testDoc2 extends Doc{
  foo1: string,
  bar1: string[],
}

interface testDoc3 extends Doc{
  foo2: string,
  bar2: string[],
}

interface testCollection extends Collection {
  [key: string]: testDoc2
  test: testDoc3 //Also cant do overrides like this
}

const test: PureDoc<testDoc> = {
  foo: "string",
  bar: [],
  col: {}, //Doesn't error (should error because of PureDoc)
  doesntexist: "hi" //Doesn't error though (should since its not part of testDoc)
}

This works mostly fine, but during testing I noticed two things:

*

*Because of my use of Record<> and { [key: string]: Doc }, extending from Doc makes it impossible for TS to notify me of properties that are not actually part of the doc being implemented (see const test: PureDoc<testDoc> at the bottom)

*I can't have a collection with one main doc type and overrides for another doc type at specific keys (see interface testCollection extends Collection) This is much less of a problem, though.
I can't use this unless problem 1 is solved. So, I'm wondering, is there a way for me to define the allowed types for the values of a mapped type and all its inheritors (which will have finite keys) without using Record<> or {[key: string]: T}, which automatically permits all keys?
PS: I tied another attempt using Generics and making a type that trips values from a map that don't fit the permitted types, but things get very messy. Have a look here.


text:
Q: Modify file opened in Read mode My file is signed using asymetric cryptography. I open the file in read mode using c language, verify its signature and then I work with that file (read its contents). Is there any possibility of an attack where the attacker (another process) can modify the file after I checked its signature while the file is still opened in read mode?
My platform is mainly Windows 10.


text:
Q: Windows 10 not booting, even though data is intact, how to recover I currently have 3 physical disks on my windows home computer. They accumulated over the years. Each time there was an issue with boot, I got a new disk and installed a new windows.
So the situation right now is like this:

*

*Disk 0: WDC (non-SSD) -> drive C(windows 7)

*Disk 1: Sandisk (ssd) -> drive F(windows?) + G(no windows)

*Disk 2: Corsair (ssd) -> drive E(windows7 ultimate + windows 10)

*Disk 3: external HD for backup.

Issue started today, after I made a restart, instead of booting from the windows 10 Corsair disk like it usually does, the computer booted from the WDC disk.
Data is ok in all disks: I can see everything that is inside the Corsair disk when from the windows 7 user of the WDC disk.
When I reboot the computer, I see only the WDC and Sandisk in the splash screen. I dont see the Corsair. But when I get into the BIOS, I can see the Corsair in the list.
I tried switching to the Corsair disk on BIOS, but it tries to load the windows 7 ultimate (and get stuck on windows load, not getting to login screen).
Even if I physically disconnect the other disks and leave only the Corsair, it doesn't see the windows 10 when booting. It only loads the windows 7 ultimate.
Anyway to recover the windows 10 boot on the Corsair, so that to avoid the painful process of reinstalling all the programs from scratch?

A: You have written: Disk 2: Corsair (ssd) -> drive E(windows7 ultimate + windows 10). Are you sure on on this disk are 2 Operating Systems.

*

*There is just one partition.

*The System Reserved partition is just 100 MB. Usualy Windsows 7 creates it with this size, Windows 10 creates a 450 MB.
Connect Disk 1 and Disk 2 (I think Windows 10 is installed on Disk 1), doesn't matter which windows is loading, you can use msconfig to see your installed OS and change the boot order.

Type msconfig in the Start search field and then press Enter to open the System Configuration, in Boot tab select which operating system you want to set as default, click Apply and then OK to close the dialog, Reboot.


text:
Q: Nilpotent Operators Linear Algebra
Let $V$ be an $n$-dimensional vector space over an arbitrary field $K$, and let
  $T_1, \dots , T_n : V \rightarrow V$ be pairwise commuting nilpotent operators on $V$.
(a) Show the composition $T_1 T_2 \cdots T_n = 0$.
(b) Does this still hold if we drop the hypothesis that the $T_i$ are pairwise commuting?

What I have tried:
I know that for any $T_i$, $\ker({T_i}^n) = \ker({T_i}^{n+1}) = \cdots$. This implies that ${T_i}^n = 0$ for any $i$. I also know that raising each $T_i$ to a power of itself lessens the dimension of the kernel of such a composition. Any help?


text:
Q: React Grommet Select - passing in object data as options I am using Grommet v2 components and trying to mirror the display used in the Select 'Seasons' example in Grommet's storybook.
The field appears like this:

The difference is my data needs to separate label and value:
const Options = [
   {
     label: "S01",
     value: "283736"
   },
   {
     label: "S02",
     value: "293774"
   },

instead of using the default:
const Options = [
  "S01",
  "S02",

Here is an example on Codesandbox
The object format was used in Grommet's example of ObjectMultiSelect in their storybook. I found the Select component needs
labelKey="label" and valueKey="value" to load the objects as options, but adding these two props seems to break the component options.
I would like for the data passed in to resemble
const Options = [
   {
     label: "S01",
     value: "283736"
   },
   {
     label: "S02",
     value: "293774"
   },

and still have the options displayed as above.

A:             <Select
              options={[
                {
                  lab: "S01",
                  val: "283736"
                },
                {
                  lab: "S02",
                  value: "293774"
                }
              ]}
              labelKey="lab"
              dropHeight="large"
              name="primaryServer"
              value={this.props.values.primaryServer}
              placeholder="Select Primary Server"
              emptySearchMessage={"No Servers Available"}
              onChange={({ option }) => {
                console.log(option.lab)
                console.log(option.val)
              }}
            />
            // Output // S01 // 283736
            // This worked for me. labelKey="lab" is required.


text:
Q: In LaTeX, is there a way to get long lines along the margins? I'm working on a report, and some elements are outside the margins (but some are just barely outside the margins). I was wondering: Is there a way to make two vertical lines, one on each side, along the margins so that one can easily see if it goes outside them?
(Googling it, I only found information about margin notes.)
A figure is below:

|report text goes here|
|more text goes also h|ere
|and so on and so fort|h

It would certainly make correcting these kinds of mistakes very trivial. :)
Feel free to post answers that would solve/show this problem in a more "LaTeX-correct" way, if that makes any sense at all.

A: If you're using pdflatex, try the microtype package.

A: Use the option draft in your \documentclass statement, e.g.:
\documentclass[12pt,a4paper,draft]{report}

This will produce a litte black box at the end of every overfull line (this is what Johannes Schaub must've been referring to in his comment). This makes it very easy to spot these
inconvenient overlong lines ...
Alternatively, you can say \sloppy in your preamble. The typesetter will then be less strict on the grey value of your paragraphs and avoid "overfull \hbox"es more often (more frequent linebreaking).


text:
Q: wxPython ListCtrl Help I'm using a ListCtrl and it is populated with items on the fly, when an item is "Activated"(Double Click/Enter) it calls a function.
    def onClick(self, event):

How do I find out which item was clicked in the List since they don't have pre-set IDs? Is the String passed to the function as part of self or event?
Thanks.

A: Try event.GetText() or event.GetItem().<manipulate your item here>; here is wx.ListEvent documentation.

A: Since you are probably binding the ListCtrl with the event, the ListCtrl item gets passed inside the event;
list = event.GetEventObject()
selected_string = list.GetStringSelection()

So now you have all ListCtrl methods available inside the event handler.
http://www.wxpython.org/docs/api/wx.Event-class.html
http://www.wxpython.org/docs/api/wx.TextCtrl-class.html


text:
Q: Custom keyboard layout is reset to default after standby or reboot I designed a keyboard layout for myself, after I run xmodmap it works OK, but after standby or reboot, the layout turn back to qwerty.
How can I set it as default? My OS is Debian Wheezy with XFCE4.

A: Check out this archlinux forum thread Xmodmap Reset after Suspend to RAM. There are several examples in the thread that'll get you started and show you how to setup a hook which will get triggered via the power management subsystem that will run your xmodmap setup each time you come out of suspend.
Something like the following script, saved as /etc/pm/sleep.d/11suspend (change the me in  /bin/su - me to your actual username):
#!/bin/bash
case $1 in
    hibernate)
        echo "Hey guy, we are going to suspend to disk!"
        ;;
    suspend)
        echo "Oh, this time we're doing a suspend to RAM. Cool!"
        ;;
    thaw|resume)
        echo "oh, suspend is over, we are in $1 phase..."
            # Set Display #
    DISPLAY=:0.0 ; export DISPLAY
    /bin/su - me -c "sleep 3; /usr/bin/xmodmap /home/me/.xmodmaprc" &
        ;;
    *)  echo "somebody is calling me totally wrong."
        ;;
esac

A: Premilinary note: you shouldn't use the obsolete xmodmap command, but XKB (xkbcomp).
Then you can change the settings from your ~/.xsession script. Personally I have:
setxkbmap -types local -print | \
  sed -e '/xkb_symbols/s/"[[:space:]]/+local&/' > $HOME/.xkb/keymap/custom
xkbcomp -w0 -I$HOME/.xkb -R$HOME/.xkb keymap/custom $DISPLAY

in my ~/.xsession file, and my XKB settings are put in ~/.xkb/symbols/local and ~/.xkb/types/local files. This will change the settings after each X login.
Unfortunately these settings are lost after suspend/resume. There's a workaround: save them and restore them via pm-utils with a script in the /etc/pm/sleep.d directory; you may need
xhost +si:localuser:root

in your ~/.xsession script since root doesn't have your xauth information. I have given an example (for XKB): https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633849#92


text: Q: Software Plotting Tropical Curves I'm an undergrad student and currently working on my paper focusing on Tropical Math. Can anyone suggest for any software that could plot tropical curves easily? Help please!


text:
Q: Average column value changing on pagination I was having some trouble finding why jqGrid was changing the average value for a column whenever I went to a different page and came back.
I'm currently using jqGrid 5.4.0 and I have tried to update it to a newer version (5.8) thinking it could possibly be a minor bug but the problem is still there.
It took me a while to find out what was the origin of the problem, but still no success on finding a solution since I need to use datatype: jsonstring. The way I'm populating my grid is what makes the bug happen. (Check examples below)
Working code using 'datatype: "local"'
As you will see, the JSON I'm using is the same for both codes, the only thing changing being the data becoming datastr and the datatype changing from local to jsonstring.
Bugged version of the code using 'datatype: "jsonstring"
You can make the bug happen by going to the next page and back to the previous one and keeping an eye on the Average value. It will start to divide the value by the number of rows.
Another bug I just noticed is that jqGrid doesn't sum all values and divide by the number of rows, just gets the first value and divides by the rows everytime. Including the first time the grid initializes, the average value is supposed to be 100 because 100*4/4 = 100 (presuming the number of rows is 4).


text:
Q: Extracting Mesh lines from a GraphicsComplex
I was working on some geometric manipulation and hoping to further process this graphic's isolines however I was stumped as how best to do that when I looked at the object's GraphicsComplex. I was expecting to see something similar to a question I asked last year about Mesh lines.
c = RevolutionPlot3D[{ x-0.2,-2 x},{x,0.7,1},
  Boxed->False,
  Axes->False,
  Mesh->{8,4}
]
c[[1,1,1,2]]

I'm using Mathematica 12.1 and tired the older function in the other thread too and it returns a similarly confusing GraphicComplex. 5 Dimensional polygons? Lines with one list for it's coordinates? I don't remember how I extracted the isolines.
Can someone describe to me how to extract the Mesh lines from a GraphicsComplex?

A: If you just need lines, you can take Normal and extract lines from it:
lines = Cases[Normal[c], _Line, Infinity];

Graphics3D[lines]

A: To add to halmir's answer: if you don't need the surface, just use PlotStyle -> None:
RevolutionPlot3D[{x - 0.2, -2 x}, {x, 0.7, 1}, Axes -> None, Boxed -> False,
                 Mesh -> {8, 4}, PlotStyle -> None]

which should give the same picture.
Note that this also includes the setting of BoundaryStyle; if you set it to None, you get this instead:

A: Another way:
plot /. GraphicsComplex[p_, g_, o___] :>
  GraphicsComplex[p, Cases[g, _Line, Infinity]]


text:
Q: AR9287 Wifi authentification required You are my last hope. I wanted to change my os to Ubuntu 15.04. Everything seemed ok, but my wifi module Artheros ar9287 thinks, that my wifi password is wrong and I get stuck on "authentification required" window.
But the password is good, it is encrypted by wpa2 personal and it is Wireless-G. Windows 8 connects without problems. Anybody help(

A: First, check the settings in the router. WPA2-AES is preferred; not any WPA and WPA2 mixed mode and certainly not TKIP. Second, if your router is capable of N speeds, you may have better connectivity with a channel width of 20 MHz in the 2.4 GHz band instead of automatic 20/40 MHz, although it is likely to affect N speeds. I also have better luck with a fixed channel, either 1, 6 or 11, rather than automatic channel selection. Also, be certain the router is not set to use N speeds only; auto B, G and N is preferred. After making these changes, reboot the router.
Next, I recommend that your regulatory domain be set explicitly. Check yours:
sudo iw reg get

If you get 00, that is a one-size-maybe-fits-all setting. Find yours here: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Then set it temporarily:
sudo iw reg set IS

Of course, substitute your country code if not Iceland. Set it permanently:
gksudo gedit /etc/default/crda

Use nano or kate or leafpad if you don't have the text editor gedit.
Change the last line to read:
REGDOMAIN=IS

Proofread carefully, save and close the text editor.
Next, I'd set IPv6 to Ignore in Network Manager: http://docs.fedoraproject.org/en-US/Fedora/18/html/Installation_Guide/images/netconfig/network-connections-ipv6-ignore.png  This example is for ethernet, but you want wireless.
If these changes do not help, please try:
sudo -i
echo "options ath9k nohwcrypt=1"  >  /etc/modprobe.d/ath9k.conf
exit

Reboot and let us know how it's working.


text:
Q: How to find IP address from netbios host name? What network tool can I use under DOS/windows to find the ip address of a netbios host as easily as is done in Linux?
For example under Linux (ubuntu) I can find the ip address like so:
# nmblookup imac
querying imac on 192.168.1.255
192.168.1.75 imac<00>

Now, this is the IP of the macbook when connected wirelessly
But under windows I can't ping it:
C:\>ping imac

Pinging imac.gateway.2wire.net [192.168.1.68] with 32 bytes of data:
Request timed out.

And the closest tool I could find returns TWO IPs
(it returns the hardwired IP even though it got a different IP by connecting wirelessly
C:\>nslookup imac
Address:  192.168.1.254
Name:    imac.gateway.2wire.net
Addresses:  192.168.1.68, 192.168.1.75

Isnt there a windows command to return only the active IP address for the host?

A: On Windows, you can try

*

*ping -a IP_address (lookup for both DNS name and NetBIOS name)

*nslookup IP_address (this command requires you to have an internal DNS server configured)

I like to use ping -a personally.

A: http://technet.microsoft.com/en-us/library/bb490938.aspx :
Nbtstat.exe -a NETBIOSNAME
Nbtstat.exe -A IP

Come with Windows XP and upward.

A: nbtstat -a [hostname] -c

This gives IP address of NetBIOS name on Windows


text:
Q: How would I stop multiple emails OR username? I have the following code in my registration form to prevent against multiple usernames being created:
connect_db();
    $check = mysql_query("SELECT username FROM school_users WHERE username = '$username'") or die(mysql_error());
    $check2 = mysql_num_rows($check);

if ($check2 != 0) {
    respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}

However, I also want to check for email, in the same statement:
    connect_db();
        $check = mysql_query("SELECT username, email FROM school_users WHERE username = '$username' or email = '$email'") or die(mysql_error());
        $check2 = mysql_num_rows($check);

    if ($check2 != 0) {
if (???username???){
        respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}}
else if (???email???) {
    respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}}

A: You could try doing:
connect_db();
$check = mysql_query("SELECT 'User' validation
                        FROM school_users
                       WHERE username = '$username'
                       UNION ALL
                      SELECT 'Email'
                        FROM school_users
                       WHERE email = '$email'") or die(mysql_error());
$row = mysql_fetch_assoc($check);

if($row)
{
    if ($row["validation"] == 'User') {
            respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}}
    else if ($row["validation"] == 'Email') {
        respond("error", "Sorry, the email ".$_POST['email']." is already in use. Please choose a different email.");}}
}

OR you could just do it separately...
//Validate UserName
connect_db();
$check = mysql_query("SELECT username FROM school_users WHERE username = '$username'") or die(mysql_error());
$check2 = mysql_num_rows($check);

if ($check2 != 0) {
    respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}

//Validate Email
connect_db();
$checkEmail = mysql_query("SELECT email FROM school_users WHERE email = '$email'") or die(mysql_error());
$checkEmail2 = mysql_num_rows($check);

if ($checkEmail2 != 0) {
    respond("error", "Sorry, the email ".$_POST['email']." is already in use. Please choose a different email.");}

Additionally, your code is vulnerable to SQL Injection attacks and you are using deprecated MySQL php functions. If you do want to make your code better an less vulnerable, take a look at the following links:
Why shouldn't I use mysql_* functions in PHP?
What could i use instead of mysql_ functions?
Prepated Statements
Prepared Statements with MySQLi

A: You can also do this in one statement:
SELECT username
FROM school_users
WHERE username = '$username' or  email = '$email'

If you do this, you'll need to change the message to the user . . . "Your user name or email (or both) are already in use".
To customize the message in one statement, you can use aggregation:
select (case when max(username = '$username') = 1 and max(email = '$email' = 1
             then 'both'
             when max(username = '$username') = 1
             then 'username'
             when max(email = $email) = 1
             then 'email'
        end) as WherePresent
from school_users
WHERE username = '$username' or  email = '$email'

This returns 0 rows if everything is ok.  Otherwise, it returns one row with one of "both", "username", "email", indicating which is duplicated.

A: The original code isn't that far from the solution as you might think.
$check = mysql_query("SELECT username, email FROM school_users WHERE username = '$username' or email = '$email' LIMIT 1") or die(mysql_error()); //Limit one reduces the time mysql searches the db since it stops on the first occurence
        $check2 = mysql_fetch_assoc($check); //we do not only want to know the count of matching rows, but the values return in email and username field

//trimming makes sure we do not have any spaces at the beginning or end
//strtolower makes sure we set UserName == usERnaME == username etc.pp.
if (strtolower(trim($row['username'])) == strtolower(trim($_POST['username']))){ // check the result
        respond("error", "Sorry, the username ".$_POST['username']." is already in use. Please choose a different username.");}
}
else if (strtolower(trim($row['email'])) == strtolower(trim($_POST['email']))) { // and again for email adress
    respond("error", "Sorry, the email ".$_POST['email']." is already in use. Please choose a different email.");}
}


text:
Q: Vertically center text with icon inside div-button I am making some buttons for a project and am having an issue getting the text in the buttons to be vertically centered. I imagine i would just set a negative margin to the
 element but its not working like I thought it would.

JS FIDDLE
HTML

Tasks

Completed Tasks

Deleted Tasks

CSS
.tabscontainer1{
    padding:0px;
    float:left;
    left:0px;
    padding-bottom:10px;
}

.tabscontainer1:before{
    padding:0px;
    float:left;
    left:0px;
    padding-bottom:10px;
}

.taskTabs{
    width:auto;
    height:66px;
    border-radius:8px;
    display:inline-block;
    left:0px;
    margin-right:15px;
    margin-top:17px;
    }

.taskTabs p{
    font-family: 'Roboto Condensed', sans-serif;
    font-size:17pt;
    padding-left:10px;
    padding-right:16px;
    display:inline-block;
    }

.taskTab1{
     border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
    }

.taskTab2{
     border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
    }

.taskTab3{
     border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
    }

.taskIcons{
    background:url(images/TaskIconMap.png) no-repeat;
    width:40px;
    height:39px;
    display:inline-block;
    margin-left:16px;
    margin-top:12px;
    }
#taskIcon1{
    background-position: 0px 0px;
    }
#taskIcon2{
    background-position: -42px 0px;
    }

#taskIcon3{
    background-position: -84px 0px;
    }

JS FIDDLE
Thanks!

A: Try this for vertical align:

.tabscontainer1{
 padding:0px;
 float:left;
 left:0px;
 padding-bottom:10px;
}

.tabscontainer1:before{
 padding:0px;
 float:left;
 left:0px;
 padding-bottom:10px;
}

.taskTabs{
 width:auto;
 height:66px;
 border-radius:8px;
 display:inline-block;
 left:0px;
 margin-right:15px;
 margin-top:17px;
 }

.taskTabs p {
  display: inline-block;
  font-family: "Roboto Condensed",sans-serif;
  font-size: 17pt;
  margin: 0 !important;
  padding-left: 10px;
  padding-right: 16px;
  padding-top: 18px;
  vertical-align: top;
}

.taskTab1{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskTab2{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskTab3{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskIcons{
 background:url(http://s32.postimg.org/9jx6xtvk5/Task_Icon_Map.png) no-repeat;
 width:40px;
 height:39px;
 display:inline-block;
 margin-left:16px;
 margin-top:12px;
 }
#taskIcon1{
 background-position: 0px 0px;
 }
#taskIcon2{
 background-position: -42px 0px;
 }

#taskIcon3{
 background-position: -84px 0px;
 }

Tasks

Completed Tasks

Deleted Tasks

A: Add  vertical-align: middle; For 'P'tag and icon tag:

.tabscontainer1{
 padding:0px;
 float:left;
 left:0px;
 padding-bottom:10px;
}

.tabscontainer1:before{
 padding:0px;
 float:left;
 left:0px;
 padding-bottom:10px;
}

.taskTabs{
 width:auto;
 height:66px;
 border-radius:8px;
 display:inline-block;
 left:0px;
 margin-right:15px;
 margin-top:17px;
 }

.taskTabs p {
  display: inline-block;
  font-family: "Roboto Condensed",sans-serif;
  font-size: 17pt;
  margin: 0 !important;
  padding-left: 10px;
  padding-right: 16px;
  padding-top: 18px;
  vertical-align: middle;
}

.taskTab1{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskTab2{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskTab3{
  border: 1px solid #4c9cfd;
  -webkit-box-shadow:0 0 0 5px #01101f;
  -moz-box-shadow:0 0 0 5px #01101f;
  -o-box-shadow:0 0 0 5px #01101f;
  box-shadow:0 0 0 5px #01101f;
 }

.taskIcons{
 background:url(http://s32.postimg.org/9jx6xtvk5/Task_Icon_Map.png) no-repeat;
 width:40px;
 height:39px;
 display:inline-block;
 margin-left:16px;
 margin-top:12px;
 vertical-align: middle;
 }
#taskIcon1{
 background-position: 0px 0px;
 }
#taskIcon2{
 background-position: -42px 0px;
 }

#taskIcon3{
 background-position: -84px 0px;
 }

Tasks

Completed Tasks

Deleted Tasks

A: I just added the following to .taskTabs p{}
margin: 0; /* for good measure */
vertical-align: 9pt; /* roughly half the font-size */

https://jsfiddle.net/k9q0qhdj/3/


text:
Q: Decorated function returns None I have a decorator that checks a function's argument for int type.
def check_type_int(old_function):
    def new_function(arg):
        if not isinstance(arg, int):
            print 'Bad Type'    # raise TypeError('Bad Type')
        else:
            old_function(arg)
    return new_function

When I run a decorated function, it returns None instead of an int value.
@check_type_int
def times2(num):
    return num*2

times2('Not A Number')  # prints "Bad Type"
print times2(2)         # prints "None"

The last line should print 4. Can someone please spot my mistake? Thanks.

A: You don't return any value from new_function inside the decorator, therefore it returns None by default. Just change this line:
old_function(arg)

to
return old_function(arg)

A: Adding to the answer by @eugeney: it would be easier if you used return for both cases in if:
if not isinstance(arg, int):
    return 'Bad Type'          # return
else:
    return old_function(arg)   # return

And this:
print times2('2')                # prints Bad Type
print times2(2)                  # prints 4

A: You need to use *args and **kwargs
def dec(function):
    def new_f(*args, **kwargs):
        return function(*args, **kwargs)
    return new_f


text:
Q: SQL Foreign key abrevation Are these T-SQL declarations equals?
CREATE TABLE Person
(
ID INT PRIMARY KEY,
NAME VARCHAR(60)
)

CREATE TABLE Dog
(
CHIP_ID INT PRIMARY KEY,
OWNER_ID INT REFERENCES Person(ID)
)

and
CREATE TABLE Person
(
ID INT PRIMARY KEY,
NAME VARCHAR(60)
)

CREATE TABLE Dog
(
CHIP_ID INT PRIMARY KEY,
OWNER_ID INT,
FOREIGN KEY(OWNER_ID) REFERENCES Person(ID)
)

I'm talking of course about the foreign key, I'm not sure if I have to specify it is a foreign key or not.
Thank you.

A: Both T-SQL will create the foreign key you need. However, I believe the second approach where the code explicitely states "FOREIGN KEY..." is a good contribution to keep easy-maintenance and clean code for future software engineer understanding.

A: Yes, the DBMS see both as the same. But humans can many times miss important details when the code is cryptic. In fact, my preference is this:
CREATE TABLE Person(
    ID     INT not null,
    Name   VARCHAR(60) not null,
    constraint PK_Person primary key( ID )
);

CREATE TABLE Dog(
    ID       INT not null,
    OwnerID  INT,
    constraint PK_Dog primary key( CHIP_ID ),
    constraint FK_Dog_Owner foreign key( OWNER_ID ) REFERENCES Person( ID )
);

Using the constraint clause not only defines the primary and foreign keys, but allow us to give them a meaningful name. And the surrogate key of each table should be named "ID". Any foreign keys in other tables will expand that name according to its context (RoleID). As you have in the Dog table with OwnerID. Another table with a FK to the same Person table may name it GroomerID or whatever else shows the role that person plays in the context of the table.
Also, as you can see, I prefer CamelCase with SQL Server, leaving OWNER_ID for Oracle.
Some even go so far as to place either NULL or NOT NULL after each column definition. But I find that adds clutter and doesn't really supply information even a beginning SQL developer doesn't already know. So I only supply NOT NULL when appropriate and let the default carry. Actually, in the later versions of Oracle and SQL Server, the NOT NULL for the primary key field is optional as the primary key is going to be defined as NOT NULL no matter what.
Long ago there seemed to be an informal contest to see who could cram the most operations into the fewest words or even characters. Just stay far away from that kind of thinking. But do make everything you write meaningful.
In general, use every opportunity to add meaningful information to the code. The computer doesn't care. Write to the other developers who will follow you.


text:
Q: How can I access Python instance variable of type set in the right way Can anyone tell why, why the length of my instance variable( with type set) do not work the way as I though.
When I called a.addToSet("xx"), I thought the value of len(b.aSet) and len(ExampleClass.aSet) should return zero, so as a.aInt be 100 and rest be 0, while the console print the 1 for all the three instance.
Many thanks
==========================
Let's say, we have a class called ExampleClass with two variable: aSet and aInt.
class ExampleClass():
    aSet = set()
    aInt = 0
    def addToSet(self,aValue):
        self.aSet.add(aValue)

a=ExampleClass()
b=ExampleClass()
a.addToSet("xx")
a.aInt=100

print len(a.aSet)
print len(b.aSet)
print len(ExampleClass.aSet)
print a.aInt
print b.aInt
print ExampleClass.aInt

OUTPUT
1
1
1
100
0
0


text:
Q: right database/approach to do keyphrase queries with many possible "keys words" matching each record my rails 3 application is hosted at Heroku using postgres for the ordinary database stuff like keeping track of messages and users. 100% of my experience is with normal relational dbases and SQL.
however now I'm adding a single new method "lookup_product_by_keyword" that accesses a dataset unrelated to the rest of the app and therefore could be implemented in another framework or database. And I'm wondering if MongoDB or some other type of database might be the way to implement this one capability.
Our goal is to find one of 5000 product type ("screwdriver" "bottle opener" etc etc) that best matches a list of perhaps 50,0000 keywords and phrases. For example, there might be 10-20 words or phrases that would match and return "screwdriver" ("philips screwdriver" "flathead screwdriver" etc).
I suspect there is some type of clever design, perhaps built around a specialized database very different form MySQL, Postgres, etc. that is optimized for thsi sort of "assocative" rather than relational information structure.
Any pointers would be appreciated...

A: What you are looking at is a database that could handle text indexing efficiently? I am not sure how a no-sql database could help you with this problem. Oracle introduced oracle text from oracle 9. (I think) and I have used it to problem similar to yours and it performs admirably.
If you are looking at database vendor agnostic solution then I suggest you check our hibernate search. It uses the powerful lucene indexing underneath and provides a very workable abstraction layer.


text:
Q: Came across a 'params.store' line -- is there any difference/benefit over params[:key] Coworker came across a line of code that referenced params.store 'keyname', value, which appears to do the same thing as params[:keyname] = value.
Neither of us have seen the first syntax. Is there any difference with how this is evaluated? Google is unhelpfully not honoring my searches using "params.store" (returning bolded results referencing params[:store]), so I haven't been able to find anything on using :store over the hash syntax.

A: The store equal to []=. Just check description of these methods and source code here.
UPDATE:
Here is place is Ruby sources which show that the store equal to []=.


text:
Q: .net HttpClient with custom JsonConverter I'm using .NET's HttpClient to make requests to a WebAPI that returns some JSON data that requires a little bit of custom deserialization on the client's side.  For this I've made my own JsonConverter, but I can't figure out how to have the ReadAsAsync<T> method pick up the existence of the converter.
I've solved my problem for now by using ReadAsStringAsync to read the response, then passing that string in to JsonConvert.DeserializeObject, but it seems like there should be a more elegant solution.
Here's my code:
public PrefsResponse GetAllPrefs(string sid) {
    HttpClient client = CreateHttpClient(null, sid);
    var response = client.GetAsync("api/sites/" + sid).Result;

    // TODO : find a way to hook custom converters to this...
    // return response.Content.ReadAsAsync<PrefsResponse>().Result;

    var stringResult = response.Content.ReadAsStringAsync().Result;

    return JsonConvert.DeserializeObject<PrefsResponse>(stringResult, new PrefClassJsonConverter());
}

Is this the best I can do, or is there some more elegant way?
Here's where I'm creating the HttpClient also, if that's where I need to hook it up:
        private HttpClient CreateHttpClient(CommandContext ctx, string sid) {
        var cookies = new CookieContainer();

        var handler = new HttpClientHandler {
            CookieContainer = cookies,
            UseCookies = true,
            UseDefaultCredentials = false
        };

        // Add identity cookies:
        if (ctx != null && !ctx.UserExecuting.IsAnonymous) {
            string userName = String.Format("{0} ({1})", ctx.RequestingUser.UserName, ctx.UserExecuting.Key);
            cookies.Add(new Cookie(__userIdCookieName, userName));
            cookies.Add(new Cookie(__sidCookieName, sid));
            cookies.Add(new Cookie(__hashCookieName,
                                   GenerateHash(userName, Prefs.Instance.UrlPrefs.SharedSecret)));
        }

        var client = new HttpClient(handler) {
            BaseAddress = _prefServerBaseUrl
        };

        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        return client;
    }

A: May be you would like to use HttpClient.GetStringAsync Method (String)
var response = client.GetStringAsync("api/sites/" + sid);
return JsonConvert.DeserializeObject<PrefsResponse>(response.Result, new  PrefClassJsonConverter());

Or what exactly you want to be more elegant?

A: You can pass the JsonSerializerSettings with the list of your converters to the JsonMediaTypeFormatter which will be used by ReadAsAsync<T>:
i.e.
var obj = await result.Content.ReadAsAsync<refsResponse>(
    new[] {new JsonMediaTypeFormatter {
          SerializerSettings = new JsonSerializerSettings {
              Converters = new List<JsonConverter> {
                //list of your converters
               }
             }
          }
    });

A: I was able to add a custom JsonConverter to the default formatters for HttpClient with the following:
MediaTypeFormatterCollection formatters = new MediaTypeFormatterCollection();
formatters.JsonFormatter.SerializerSettings.Converters.Add(new MyCustomConverter());

var result = response.Content.ReadAsAsync<T>(formatters).Result;

This seemed to allow you to just add your custom converter to the default converters.


text:
Q: AWS object single attribute update I updating an dynamo db table item from android application and it is updating complete item.But I am not getting how should I update single attribute instead of complete object.Please let me know if there is any way to do so.
I am using save() method of DynamoMapper for updating item.


text:
Q: Trace map from finite surjective morphism of normal irreducible varieties I am trying to understand why if $f: Y \rightarrow X$ is a finite surjective morphism of normal (irreducible) complex varieties, there is a trace-map $f_{\ast} \mathcal{O}_Y \rightarrow \mathcal{O}_X$ splitting the natural inclusion in the other direction.
What I understand so far is (1) that the finiteness condition ensures that $f_{\ast} \mathcal{O}_Y$ is integral over $\mathcal{O}_X$, so $K(Y)$ is algebraic over $K(X)$ and (2) that there is a trace map from the algebraic closure $K(Y)$ to $K(X)$, which restricts since the extension is integral.
However these steps feel a little shakey to me, and also I haven't used normality. Is it just required for the extension of fields to be Galois (I guess it guarantees it will be a normal extension?) I don't quite understand this part.
For reference, I am trying to understand the proof of the Injectivity Lemma 4.1.14 in Lazarsfeld.
Thanks for your help.

A: As $Y\to X$ is finite, $K(X)\hookrightarrow K(Y)$ is finite extension and therefore there is a trace map $Tr:K(Y)\to K(X)$ which comes from the trace of multiplication by an element $a\in K(Y)$ acting as a $K(X)$-linear endomorphism of $K(Y)$ viewed as a finite-dimensional $K(X)$-vector space. The goal is to show that this gives to a morphism of sheaves $f_*\mathcal{O}_Y\to \mathcal{O}_X$, which we can do by showing that this is true on each affine open subset $\operatorname{Spec} A = U\subset X$.
Since normal + irreducible implies integral, we can take $A$ to be a normal integral domain, and then $f^{-1}(U)=\operatorname{Spec} B$ for $B$ a normal integral domain which is a finite (thus intergal) $A$-module. As the characteristic polynomial of $b$ as an endomorphism of $K(Y)$ over $K(X)$ is also a power of it's minimal polynomial (think about $K(X)\subset K(X)(b)\subset K(Y)$) and has the trace as a coefficient, all we need to do is to show that this minimal polynomial lives in $A[t] \subset K(X)[t]$. The following lemma proves this:
Lemma: Let $R$ be an integrally closed domain and $F=Frac(R)$. Let $F\subset K$ be a finite field extension. Then for any $\alpha\in K$ integral over $R$, the minimal polynomial $m(x)$ of $\alpha$ is actually in $R[x]$.
Proof: As $\alpha$ is integral, there's a monic polynomial $f\in R[x]$ with $f(\alpha)=0$. But by the inclusion $R[x]\subset F[x]$, $f$ is also a polynomial in $F$ which vanishes on $\alpha$. So it's divisible by $m(x)$, and we may write $f=gm$. As all roots of $m$ are roots of $f$, all roots of $m$ are integral over $R$. As the coefficients of $m$ are the elementary symmetric polynomials in these roots, the coefficients of $m$ are again integral over $R$. As $R$ is integrally closed, these coefficients are actually in $R$, and thus we've shown that $m(x)\in R[x]$. $\blacksquare$
As a result of this lemma, we get that the trace of any element $b\in B$ actually lands in $A$ and therefore gives us a morphism $f_*\mathcal{O}_Y\to \mathcal{O}_X$. After averaging by dividing by $\deg K(Y)/K(X)$, we get that the composite $\mathcal{O}_X\to f_*\mathcal{O}_Y \to \mathcal{O}_X$ is the identity, demonstrating a splitting as required in the question.


text:
Q: Find generated table of contents in doc/docx I want to find all the pages in doc/docx documents containing generated indices such as: table of contents, bibliography, index of tables/pictures.
Is it possible to accomplish this in Java? Are there any facilities for this task in docx4j/Apache POI?

A: docx4j contains code for generating and updating a ToC; see https://github.com/plutext/docx4j/tree/master/src/main/java/org/docx4j/toc and corresponding samples.  Updating assumes the ToC is in a content control (which is how Word does it).
As to finding the ToC, there is https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/toc/TocFinder.java
Please note you'll need some other solution for binary .doc files.
There is nothing specific for "bibliography, index of tables/pictures", but you can traverse the docx to find these.


text:
Q: How to Change PopupMenu Text Color in Android? How to Change PopupMenu Text Color in Android?
I googled and got the below code but its not worked in my case.
    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
         <item name="android:popupMenuStyle">@style/popupMenuStyle</item>
        <item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
    </style>

   <style name="myPopupMenuTextAppearanceSmall" parent="@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small">
       <item name="android:textColor">#FFFFFF</item>
   </style>

     <style name="popupMenuStyle" parent="@android:style/Widget.PopupMenu">
        <item name="android:popupBackground">@drawable/bg_trans_popup</item>
        <item name="android:textColor">#FFFFFF</item>
    </style>

and Programatically,
 //Creating the instance of PopupMenu
                PopupMenu popup = new PopupMenu(Registration.this, v);

                //Inflating the Popup using xml file
                popup.getMenuInflater().inflate(R.menu.main, popup.getMenu());

                //registering popup with OnMenuItemClickListener
                popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                 public boolean onMenuItemClick(MenuItem item) {
//                Toast.makeText(MainActivity.this,"You Clicked : " + item.getTitle(),Toast.LENGTH_SHORT).show();
                  return true;
                 }
                });

                popup.show();

and menu file : main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_roomservices"
        android:icon="@drawable/ic_launcher"
        android:title="Room Services"/>

</menu>

So, Please suggest me on this?

A: You can do it dynamically when you get the textView or the exact view where is your text and to set its color (or their color, when you want to change it to the whole popup menu). You can use for example: textView.setTextColor(Color.parseColor("#FFFFFF"));


text:
Q: Lesser-known fake proofs I believe I have seen almost every elementary bogus proof of $0=1$ or $1=2.$ I am wondering if there are any lesser-known "proofs" where the error is harder to spot.

A: There's the classic example of the proof that all horses are the same color.
We prove by induction on $ n $ that for any set of $ n $ horses, all horses in that set have the same color.
Base case: If $ n = 1$ then certainly that horse has the same color as itself.
Inductive step: Suppose that for all sets of $ n $ horses that the result holds. Consider a set of $ n + 1 $ horses, say $ A  = \{h_1, \ldots, h_{n+1}\} $. Then every horse in the set $ \{ h_1, \ldots, h_n \} $ has the same color by the inductive hypothesis. Thus, $ h_1 $ has the same color as all horses in $ \{h_2, \ldots, h_n \} $, as does $ h_{n+1} $. Thus, all the horses in $ A $ are the same color.
EDIT: To show that $ h_{n+1} $ has the same color as all  horses in $ \{h_2, \ldots, h_n \} $, use the inductive hypothesis on $ A - \{h_1\} $.
Hence, by induction, all horses have the same color, as there are only finitely many horses.

A: Let $$x=1+1+1+1+.....$$ Then $$x=1+(1+1+1+.....)=1+x$$
Now subtract $x$ from bout sides of the $$x = 1+x$$ to get $0=1$ and add $1$ to this new equality to get $1=2$

A: What's the sum of $1-1+1-1+\cdots$?
Let $x=1-1+1-1+\cdots.$
1.
$$x=1-1+1-1+\cdots=1-(1+1-1+\cdots)=1-x.$$Thus, $x=\dfrac{1}{2}.$
2.
$$x=1-1+1-1+\cdots=(1-1)+(1-1)+\cdots=0+0+\cdots=0.$$Thus, $x=0.$
3.
$$x=1-1+1-1+\cdots=1+(-1+1)+(-1+1)+\cdots=1+0+0+\cdots=1.$$Thus, $x=1.$
Therefore,$$\dfrac{1}{2}=0=1?$$


text:
Q: "Enter parameter value" on access query issue I'm trying to run an access SELECT query through a button on a subform. I need to use one of the fields in the subform as criteria for the query. I currently have this:
SELECT id, issue, complaint, action, reviewer, ticket
FROM tblEscalations
WHERE asin = Forms![form_name]![subform_name].[id];

Every time I run the query, I get the pop up asking for a parameter value for WHERE asin = Forms![form_name]![subform_name].[id];. Can you please tell me what's wrong with this?
I've only been doing Access for like a month and a half so the the answer might be very simple.

A: When you refer to a control which is contained on a subform, you must reference it via the name of the subform control rather than the name of the form which is contained in the subform control.
And the subform control name can be different than the name of the form which it contains.
Since Forms![form_name]![subform_name].[id] isn't working, subform_name may be the name of the form.  You need to substitute the name of the subform control:
Forms!form_name!YourSubformControl!id

When you have that name correct, running this statement in the Immediate window will tell you "SubForm":
? TypeName(Forms!form_name!YourSubformControl!id)

Here is an Immediate window session on my system with a form named frmParent which includes a subform control named Child2.  And that control contains a form named fsubColortable which in turn contains a text box named ID:
? TypeName(Forms!frmParent!Child2)
SubForm
? Forms!frmParent!Child2.Form.Name
fsubColortable
? Forms!frmParent!Child2!ID
 1

If you're not familiar with the Immediate window, press Ctrl+g.  Then type this in the window and press Enter
? Forms.Count

That should be enough to get you started.  :-)


text:
Q: Declaration and Definition issue I know this question has been asked many times,but I don't find any relevant answer.
According to C
int x;       //definition

extern int x; //declaration

int  func(void); //declaration
int func(void)  //definition
{

}

My first question is if int x is definition,then why compiler shows an redeclaration error
header files
int main()
{
     int x,x;      //for this it shows redeclaration error
}

And my second question is if I am defining the var x,twice it doesn't show any error
header files
int x;
int x;
int main()
{

}

I am using window 7 and DevCpp 5.6.2
Edited :
header files
int y;
int main()
{
  int x;
}

x and y are definition here?

A: A declaration of a variable of at file scope without an initializer (and without storage class specifier) is a tentative definition:
int i;

It is valid to have multiple tentative definitions of the same variable in the same source file:
int i;
int i;

the behavior specified by C is as if there is a declaration at the top of the source file and at the end of the source file there is a int i = 0;.
At block scope there is no tentative definition and declaring the same variable multiple times in the same block is invalid.

A: Regarding the first question:
int x is both declaration and definition, whereas extern int x is only declaration.
This is why you get a redeclaration error.

A: Your first code, gets redeclaration error, because, in your case, x is having no linkage (local variable) and  as per C11, chapter 6.7,

If an identifier has no linkage, there shall be no more than one declaration of the identifier (in a declarator or type specifier) with the same scope and in the same name space,....

Your second code, compiles because the redeclaration is allowed, as both the statements reside in the global scope having external linkage.
Ref:

If the declaration of an identifier for an object has file scope and no storage-class specifier, its linkage is external.


text:
Q: Why the sort method not working in the parent component? This is the first project for me in VueJS.
I have a product list and want to sort it by price. I built two components and tried to pass a sort method to the parent from the child component (dropdown button) by emitting an event. but after a lot of attempts, I can't find the wrong with my code, any help!
This Child Component:
<template>

    <button
      @click="toggleShow(); $emit('sortPrice')"
      class="dropbtn"
    >
      {{ title }}
       {{ icon }}
    </button>

        {{ item }}

</template>

This Parent Component:
<template>
    <dropdown
          :title="sortedBy"
          :items="arrangements"
          :icon="material_icons"
          @sort="sortByPrice"
    ></dropdown>
</template>

A: Suggestions:

*

*emit when an individual item is clicked, not when the button is clicked. You want to emit when the user makes a selection

*So this means calling the sortPrice function from the menu-item div via @click="sortPrice(item)"

*Then in the sortPrice function, pass in the item paramter, function (item) { and pass it as a second parameter to your emit call: this.$emit("sort", item);. The parent must know what was selected

*In the parent component, sortByPrice function, accept the item parameter, sortByPrice: function (item) { and use it to set the sortedBy property: this.sortedBy = item;

*Do the sorting in a computed property that is then displayed, here in my example called sortedProducts.

For example, the parent:
<template>

Main App

  <dropdown
    :title="sortedBy"
    :items="arrangements"
    @sort="sortByPrice"
  ></dropdown>

Products

        {{ product.name }} ${{ product.price }}

</template>

and the child Dropdown.vue component:
<template>

    <button @click="toggleShow()" class="dropbtn">
      {{ title }}
    </button>

        {{ item }}

</template>


text:
Q: django - issue with get_or_create - results in two objects created in DB I have a table in my postgresql db holding a state of an hour record. For each month, project and user I need exactly one state.
I'm using the get_or_create method to either create a "state" or to retrieve it if it already exists.
HourRecordState.objects.get_or_create(user=request.user, project=project, month=month, year=year, defaults={'state': 0, 'modified_by': request.user})
After running this for about two years without problems I stumbled over the problem that I have one HourRecordState twice in my database. Now each time the get_or_create method is called it throws the following error:

MultipleObjectsReturned: get() returned more than one HourRecordState
  -- it returned 2

I'm wondering how it could happen that I have two identical records in my DB. Interestingly they have been created at the same time (seconds, not checked the milliseconds).
I checked my code and I have in the whole project only one get_or_create method to create this object. No other create methods in the code.
Would be great to get a hint..
Update:
The objects have been created at almost the same time:
First object: 2011-10-04 11:04:35.491114+02
Second object: 2011-10-04 11:04:35.540002+02
And the code:
    try:
        project_id_param = int(project_id_param)
        project = get_object_or_404(Project.objects, pk=project_id_param)

        #check activity status of project
        try:
            is_active_param = project.projectclassification.is_active
        except:
            is_active_param = 0
        if is_active_param == True:
            is_active_param = 1
        else:
            is_active_param = 0
        #show the jqgrid table and the hour record state form
        sub_show_hr_flag = True
        if project is not None:
            hour_record_state, created = HourRecordState.objects.get_or_create(user=request.user, project=project, month=month, year=year, defaults={'state': 0, 'modified_by': request.user})
            state = hour_record_state.state
            manage_hour_record_state_form = ManageHourRecordsStateForm(instance=hour_record_state)

            if not project_id_param is False:
                work_place_query= ProjectWorkPlace.objects.filter(project=project_id_param, is_active=True)
            else:
                work_place_query = ProjectWorkPlace.objects.none()
            work_place_dropdown = JQGridDropdownSerializer().get_dropdown_value_list_workplace(work_place_query)
    except Exception, e:
        project_id_param = False
        project = None
        request.user.message_set.create(message='Chosen project could not be found.')
        return HttpResponseRedirect(reverse('my_projects'))

A: Well this is not an exact answer to your question, but I think you should change your database scheme and switch to using UNIQUE constraints that help you to maintain data integrity, as the uniqueness will be enforced on database level.
If you state that for every month, user and project you need exactly one state, your model should look something like this (using the unique_together constraint):
class HourRecordState(models.Model):
    user = models.ForeignKey(User)
    project = models.ForeignKey(Project)
    month = models.IntegerField()
    year = models.IntegerField()
    # other fields...

    class Meta:
        unique_together = ((user, project, month, year),)

Because get_or_create is handled by django as a get and create multiple processes seem to be able under certain condition to create the same object twice, but if you use unique_together an exception will be thrown if the attempt is made....


text:
Q: how to define the root of caffe to digits? I have installed caffe on ubuntu 16.04, python 2.7, cuda 8,  and have tested mnist on that. it worked fine.
Now I want to install digits. I have installed it but when I do ./digits-devserver, it gives me the following error:
@pc2user:~/digits$ ./digits-devserver
   ___ ___ ___ ___ _____ ___
  |   \_ _/ __|_ _|_   _/ __|
  | |) | | (_ || |  | | \__ \
  |___/___\___|___| |_| |___/ 5.1-dev

Did you forget to "make pycaffe"?
"/home/user/caffe-master" from CAFFE_ROOT does not point to a valid   installation of Caffe.
Use the envvar CAFFE_ROOT to indicate a valid installation.
Traceback (most recent call last):
  File "/home/user/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/user/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
  File "/home/user/digits/digits/__main__.py", line 70, in <module>
main()
  File "/home/user/digits/digits/__main__.py", line 53, in main
import digits.config
  File "digits/config/__init__.py", line 7, in <module>
from . import (  # noqa
  File "digits/config/caffe.py", line 226, in <module>
executable, version, flavor = load_from_envvar('CAFFE_ROOT')
  File "digits/config/caffe.py", line 37, in load_from_envvar
import_pycaffe(python_dir)
  File "digits/config/caffe.py", line 126, in import_pycaffe
import caffe
  File "/home/user/caffe-master/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/home/user/caffe-master/python/caffe/pycaffe.py", line 13, in <module>
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/user/anaconda2/lib/python2.7/site-packages/scipy/special/../../../../libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/user/caffe-master/python/caffe/_caffe.so)
user@pc2user:~/digits$

Moreover, thsi is my ~/.profile:

Please help me to find out how to define the root of caffe to digits.


text:
Q: Angular 12 - Bootstrap 5 multiple imported scss theme files load only one I am using Angular 12 and Bootstrap 5.
I'm loading bootstrap from my scss file and I have 3 three theme scss files.
It looks like this:
style.scss:
@import './assets/styles/theme1.scss';
@import './assets/styles/theme2.scss';
@import './assets/styles/theme3.scss';
@import '~node_modules/bootstrap/scss/bootstrap.scss';

The themes scss files look like this:
theme1.scss:
$theme: "darktheme" !default;

$white:    #fff !default;
$gray-100: #f8f9fa !default;
$gray-200: #ebebeb !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #888 !default;
$gray-700: #444 !default;
$gray-800: #303030 !default;
$gray-900: #222 !default;
$black:    #000 !default;

// etc...

From angular I want to be able to select the theme file I want to load.
At the moment it loads the first one and bootstrap.scss
I need it to load the selected theme file and bootstrap.
How can I do this?

A: EDITED ANSWER
Here is an article to make
Theming Angular with CSS Variables
Hope it will help you.


text:
Q: How can I change statusbar color without a toolbar? I'm trying to make the status bar color #a1a1a1 (white_dark) but it's just black when i run it.
This is my Style v21 file:
    <style name="AppBaseTheme" parent="AppTheme">
         <item name="android:windowDrawsSystemBarBackgrounds">true</item>
         <item name="android:statusBarColor">@color/white_dark</item>
    </style>

A: you can try this lib
But my personal suggestion is, switch to AppCompatbecause its very easy to change StatusBar color in it.
Primary Dark color is used for StatusBar:
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">@android:color/black</item>

A: use this theme
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
        parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
        parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@color/atctionbar_color</item>

        <!-- Support library compatibility -->
        <item name="background">@color/atctionbar_color</item>
    </style>
</resources>

and create new file in values>colors.xml and add color from there
<resources>
    <color name="atctionbar_color">#170053</color>
</resources>


text:
Q: How do I combine two lists into one, while changing some of the values? I am working on my very first coding project, which is to make a text encoder. Once complete, I plan to make the decoder that will pair with it. For now, I am having trouble getting two lists to combine/overlap. I apologize if what I am about to show has an actual name that references it, I am new to coding and still learning many things.
list1 = [20.0, 'X', 'X', 46.0, 0.0, 18.0, 'X', 40.0]
list2 = ['Y', 31.0, 45.0, 'Y', 'Y', 'Y', 47.0, 'Y']

I need the output to be:
list3 = [20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]

Both lists have an equal number of values, and I need to combine them into one list, keep the numbers in their current order, and eliminate the "X"s and "Y"s entirely.

A: Use zip with isinstance in a list-comprehension:
list1 = [20.0, 'X', 'X', 46.0, 0.0, 18.0, 'X', 40.0]
list2 = ['Y', 31.0, 45.0, 'Y', 'Y', 'Y', 47.0, 'Y']

list3 = [x if isinstance(x, float) else y for x, y in zip(list1, list2)]
# [20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]

A: list1 = [20.0, 'X', 'X', 46.0, 0.0, 18.0, 'X', 40.0]
list2 = ['Y', 31.0, 45.0, 'Y', 'Y', 'Y', 47.0, 'Y']

list3 = []

for x in range(len(list1)):
    if isinstance(list1[x], float):
        list3.append(list1[x])

    else:
        list3.append(list2[x])

print(list3)

OUTPUT:-
[20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]

A: As @Austin said use zip to combine several lists of the same size.
Here is a version a little easier to understand if your new to development
def get_number(item1, item2):
    if item1 in ['X', 'Y']:
        return item2
    else:
        return item1

[get_number(x, y) for x, y in zip(list1, list2)]

OUTPUT:-
[20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]

A: Why not max with isinstance:
print([max(i, key=lambda x: isinstance(x, float)) for i in zip(list1, list2)])

Output:
[20.0, 31.0, 45.0, 46.0, 0.0, 18.0, 47.0, 40.0]

A: list3 = [x if not str(x).isalpha() else list2[i] for i, x in enumerate(list1)]

verified

A: This is a suggestion if you don't seriously care about the order of comnbined list
list1 = [20.0, 'X', 'X', 46.0, 0.0, 18.0, 'X', 40.0]
list2 = ['Y', 31.0, 45.0, 'Y', 'Y', 'Y', 47.0, 'Y']
a = list1 + list2
a = [x for x in a if not isinstance(x, str)]

>>>a
[20.0, 46.0, 0.0, 18.0, 40.0, 31.0, 45.0, 47.0]


text:
Q: Too many input arguments in imshow for matlab When I call
imshow('test.png')

it returns the following error:
??? Error using ==> newplot
Too many input arguments.

Error in ==> basicImageDisplay at 9
hh = image(xdata,ydata,cdata, ...

Error in ==> imshow at 246
hh = basicImageDisplay(fig_handle,ax_handle,...

I have no idea why, please help me. Thanks a lot!

A: I've solved this problem. It looks like I have another function named newplot in other projects, whose path is ahead of the image function in toolbox. Didn't realize it until re-install the matlab. Sorry for the silly mistake.


text:
Q: "You can't resize the partition on this disk because it uses the Master Boot Record partition scheme I am trying to get rid of one of the volume ("mountain Lion", the second from the top) of the partition of an external hard-drive. In disk utility I get what you can see in the pic, namely it does not allow me to modify the partition saying "You can't resize the partition on this disk because it uses the Master Boot Record partition scheme". Do I have to repartition the whole thing or is there a work around? (I am running Yosemite)
Thanks,

A: You should be able to delete the partition, and you would be able to re-use the space to create a new partition (of the same size).
For some reason (not technical) OS X (lion or later) won't let you resize partitions on MBR disks. You could delete using gparted from a Linux live CD or many partitioning tools.
You don't say what you are proposing to use the partition for, or what is on the "Files" partition. You won't be able to boot from a MBR disk, but you can backup an OS X partition. NOTE I haven't tried this on Yosemite which now creates Core Storage partitions.


text:
Q: JBoss Add New DB Properties Files Without Restarting I am currently working with a Java multi-tenant application running on JBoss.
Currently whenever we add a new customer we:
1- create a new database for them
2- add a new DB properties xml file on our JBoss node (a new file in 'deploy' directory)
3- restart Jboss
However, the restart is quite a drawback and I would like to eliminate this.
Any ideas on how this can be done?
Thanks,
Chris


text:
Q: How can I generate valid Source Maps with Gulp, Uglify & Concat? Has anyone found a working combination of Gulp, Uglify and Concat that generates a valid source map? There appears to be lots of issues in GitHub regarding these sorts of interactions, but equally people appear to have found combinations that work successfully. I've tried numerous variations, but the moment I turn on uglify the symbol mapping does not work and breakpoints don't work correctly in the browser. As an example, the following works fine:
return gulp.src('/scripts/*.js')
            .pipe(sourcemaps.init())
            //.pipe(uglify())
            .pipe(concat(outputName + '.min.js'))
            .pipe(sourcemaps.write('./'))
            .pipe(gulp.dest(outputPath))
            .on('end', function() { gutil.log('Minified ' + outputName); })
            .on('error', handleError);

but uncomment uglify and it doesn't.
I have created a GitHub repo to reproduce the issue: https://github.com/jamescrowley/gulpIssues

A: We've been using it as:
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('app.js'))

And that seems to work fine for me. It outputs the sourcemaps into the file itself though.
Versions:
"browser-sync": "^2.2.4",
    "gulp": "^3.8.6",
    "gulp-concat": "^2.3.4",
    "gulp-ng-annotate": "^0.2.0",
    "gulp-rename": "^1.2.0",
    "gulp-replace": "^0.4.0",
    "gulp-sourcemaps": "^1.1.0",
    "gulp-uglify": "^0.3.1",
    "gulp-util": "^2.2.20"

A: If anybody has this issue and find this answer:
the reason why this is not working is because you can't "sourcemap" more transformations with one sourcemaps.init() call. This combination is working for me
return gulp.src('/scripts/*.js')
            .pipe(sourcemaps.init())
            .pipe(uglify())
            .pipe(sourcemaps.write())
            .pipe(sourcemaps.init())
            .pipe(concat(outputName + '.min.js'))
            .pipe(sourcemaps.write())
            .pipe(gulp.dest(outputPath))
            .on('end', function() { gutil.log('Minified ' + outputName); })
            .on('error', handleError);


text:
Q: parseInt not converting multiple string to int it was a very simple but don't no why i can't solve it.
I am trying to convert string to integer from json, it converts 1st object but from second object it doesn't:
HTML:

      <input type="number" ng-model="vals.id" />

      <input type="number" ng-model="vals.id1" />

      <input type="number" ng-model="vals.id2" />

Controller:
app.controller('myApp', function($scope) {
  $scope.json_arr = [{
    'id': '1',
    'id1': '2',
    'id2': '3'
  }];

  $scope.parseId = function(val) {
    val.id = parseInt(val.id);
  }
});

DEMO PLUNKER

A: Aahhhhh that's my mistake, In parseId function i only parse val.id.
The correct 1 is:
$scope.parseId = function(val) {
  val.id = parseInt(val.id);
  val.id1 = parseInt(val.id1);
  val.id2 = parseInt(val.id2);
}

A: change your code with this one
$scope.parseId = function(val) {
    val.id = parseInt(val.id);
    val.id1 = parseInt(val.id1);
    val.id2 = parseInt(val.id2);
}

or you can change your json_arr variable than you don't need to change string to int
$scope.json_arr = [{
    'id': 1,
    'id1': 2,
    'id2': 3
}];

A: Directives are executed in order from highest priority to lowest priority when defined on the same element. ng-repeat has a directive priority level of 1000, but ng-init has a directive priority of 450. ng-repeat also has a terminal property - meaning it is the last directive to execute, and no other directives can execute after it.  There-in lies the problem.  The ng-repeat executes first, and because it is terminal, it will not allow ng-init to execute after.
To solve this, move the ng-init to the first li below:

      <input type="number" ng-model="vals.id" />

      <input type="number" ng-model="vals.id1" />

      <input type="number" ng-model="vals.id2" />

This works because ng-model has a priority of 0, so it will execute after ng-init.
[EDIT]
I realized there is a logic error in the code you posted. The other two answers have already addressed it, but I'll post it again here for completeness:
$scope.parseId = function(val) {
    val.id = parseInt(val.id);
    val.id1 = parseInt(val.id1);
    val.id2 = parseInt(val.id2);
}


text:
Q: How to Fix ERROR: Command errored out with exit status 1: when installing tensorflow_recommenders using pip I'm trying to install tensorflow-recommenders using pip but I keep getting this error.
I made sure I had Tensorflow 2.x installed and upgraded, but I keep getting the same error after running this command:
pip install tensorflow-recommenders
Error:
     command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wy/j6rljpj50y326hn2s45p1svc0000gn/T/pip-install-94eA0b/tensorflow-recommenders/setup.py'"'"'; __file__='"'"'/private/var/folders/wy/j6rljpj50y326hn2s45p1svc0000gn/T/pip-install-94eA0b/tensorflow-recommenders/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/wy/j6rljpj50y326hn2s45p1svc0000gn/T/pip-pip-egg-info-n6vhs1
         cwd: /private/var/folders/wy/j6rljpj50y326hn2s45p1svc0000gn/T/pip-install-94eA0b/tensorflow-recommenders/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/wy/j6rljpj50y326hn2s45p1svc0000gn/T/pip-install-94eA0b/tensorflow-recommenders/setup.py", line 17, in <module>
        import pathlib
    ImportError: No module named pathlib
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I tried everything I could, so if anyone has any suggestions it'd be super helpful!