text:
Q: How to make a live usb persistent [Manual Method] on my job i use a pendrive of 8GB, with partitions
NOTE : Only Manual Method, not with automatized tools
Partition 1 : Format FAT32, label "CASPER-RW", 6,2 GB Free
Partition 2 : Fommat FAT32, label "Xubuntu" (16.04.4) i386 -> 1.26 GB Used
After i do the partitions with GParted i do the follow procedure like root on a terminal :
PreRequisites :
Make the partitions (1.27 for Partition 2 for the LiveUSB) "MS-SYS" (Download, Compile and Install) and "syslinux" (In the repository) , The reason of make the first Partition the persistent, is because i should use the USB with Windows XP or Seven, and that versions of Windows just mount the first partition compatible detected on USB Devices.
01 - Make Temporaly Folder (USB Partition 2, Xubuntu ISO) :
mkdir -p /tmp/usbp2
mkdir -p /tmp/XubuntuISO

02 - Mount USB to Temp Folder)
mount /dev/sdh2 /tmp/usbp2

03 - Mount ISO and change directory to the Temp folder :
mount xubuntu-16.04.2-desktop-i386.iso /tmp/XubuntuISO -o loop ; cd /tmp/XubuntuISO

04 - Copy the follow folders/file to USB Partition 2 :
cp -rf casper dists install pics pool preseed .disk README.diskdefines /tmp/usbp2/

05 - Copy "isolinux" like "syslinux" on USB Partition 2
cp -rf isolinux /tmp/usbp2/syslinux

06 - Rename isolinux config file to syslinux :
cd /tmp/usbp2/syslinux
mv isolinux.cfg syslinux.cfg
mv isolinux.bin syslinux.bin

07 - Modify the file "txt.cfg" via sed & echo for remove "/cdrom" and add persistent label and option
cat txt.cfg | sed 's/\/cdrom//g' >> /tmp/txt.cfg
su -c "rm -rf txt.cfg" root
su -c "cp -f /tmp/txt.cfg /tmp/usbp1/syslinux/txt.cfg" root
su -c "rm -rf /tmp/txt.cfg" root
sed '0,/live/s//persistent/' txt.cfg >> /tmp/txt.cfg
echo 'label persistent' >> /tmp/txt.cfg
echo '  kernel /casper/vmlinuz' >> /tmp/txt.cfg
echo '  append  file=/preseed/xubuntu.seed boot=casper persistent initrd=/casper/initrd.lz quiet splash ---' >> /tmp/txt.cfg
su -c "cp -f /tmp/txt.cfg /tmp/usbp2/syslinux/txt.cfg" root

edit "syslinux.cfg"
# D-I config version 2.0
# search path for the c32 support libraries (libcom32, libutil etc.)
MENU HIDDEN
include menu.cfg
default live
prompt 0
timeout 1

edit "exithelp" file :
label menu
    kernel vesamenu.c32
    config syslinux.cfg

08 - unmount partition :
cd ; umount /tmp/usbp2
syslinux /dev/sdh2

09 - Make booteable:
ms-sys -s /dev/sdh

10 - Test with "kvm" or "qemu-kvm" (distro depend)
kvm -hda /dev/sdh -m 512 -vga std -usbdevice tablet

Dunnos :
1 - What i should do to the USB start directly in "Try Xubuntu" not start in the Live Session Asking for "Try Xubuntu" or "Install Xubuntu"
2 - How i should to to the "casper-rw" be automounted when the live session start ?
3 - (X)Ubuntu have a method like Porteus, for make a Customized ISO for make a Live Distro, which the Application i know i need?
i really want to do this with Slackware, but i don't know how make persistence and live usb with Slackware xD.
Thanks for any answer you can give me.

A: Dunnos
1) For 32bit overwrite syslinux.cfg with:
default live
label live
  say Booting an Ubuntu Persistent session...
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper persistent initrd=/casper/initrd.lz quiet splash noprompt --

For 64bit use:
default live
label live
  say Booting an Ubuntu Persistent session...
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/preseed/ubuntu.seed boot=casper persistent initrd=/casper/initrd.lz quiet splash noprompt --

2) Doing 1) above, should automount casper-rw when booting a Persistent system.
3) Customizing ISO's has been covered elsewhere in Ask Ubuntu.
4) Not sure Slackware is a permissible subject here.

A: Thanks for your answer, i put the follow content on the file
txt.cfg :
default live
label live
  menu label ^Try Xubuntu without installing
  kernel /casper/vmlinuz
  append file=/preseed/xubuntu.seed boot=casper ipv6.disable=1 languagechooser/language-name=Spanish countrychooser/shortlist=ES localechooser/supported-locales=es_ES.UTF-8 initrd=/casper/initrd.lz locale=es_ES bootkbd=es console-setup/layoutcode=es quiet splash ---
label persistent
  menu label ^Try Xubuntu without installing
  kernel /casper/vmlinuz
  append file=/preseed/xubuntu.seed boot=casper persistent ipv6.disable=1 languagechooser/language-name=Spanish countrychooser/shortlist=ES localechooser/supported-locales=es_ES.UTF-8 initrd=/casper/initrd.lz locale=es_ES bootkbd=es console-setup/layoutcode=es quiet splash ---
label live-install
  menu label ^Install Xubuntu
  kernel /casper/vmlinuz
  append file=/preseed/xubuntu.seed boot=casper only-ubiquity ipv6.disable=1 languagechooser/language-name=Spanish countrychooser/shortlist=ES localechooser/supported-locales=es_ES.UTF-8 initrd=/casper/initrd.lz locale=es_ES bootkbd=es console-setup/layoutcode=es quiet splash ---
label check
  menu label ^Check disc for defects
  kernel /casper/vmlinuz
  append boot=casper integrity-check initrd=/casper/initrd.lz quiet splash ---
label memtest
  menu label Test ^memory
  kernel /install/mt86plus
label hd
  menu label ^Boot from first hard disk
  localboot 0x80

on the syslinux.cfg
# D-I config version 2.0
# search path for the c32 support libraries (libcom32, libutil etc.)
MENU HIDDEN
include menu.cfg
default live
prompt 0
timeout 1

exithelp.cfg
label menu
    kernel vesamenu.c32
    config syslinux.cfg

Right now i am trying to remember, how i do some years ago with grub2 on a usbstick for boot 32-Bits or 64-Bits, because i had the two ISOS on a partition of the USB Stick. and i remember i had this files on the second partition of USB Stick, and the first partition with nfts format for the same.
i notice with the persistence mix the installation and if the first partition is FAT32 or NTFS, take a lot of time to boot, sometimes damage the boot of USB Stick, just hang during the boot. well i prefer not put the label "casper-rw" when i use "NTFS" format for the fist partition. i just put the label "Inukaze" (My username) xD


text:
Q: Handling of physical replication slot during switchover I have setup streaming replication between primary and standby using replication slot.
I have created replication slot "slot1" on the primary.
I need advice how to handle the replication slot during switchover.
I know replication slot has to be recreated on the new primary.
When should i create the replication slot on the new primary ?
before calling pg_ctl promote or after ?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Drupal Custom Menu Styling i created a custom menu called "top-navigation". Now I'd like to style it with css.
Any idea how that works?
Thanks in advance!

A: First of all, if you're not using Firebug for Firefox, you need to be.
That said, have you already added the menu to your site somewhere? If not, go to /admin/build/block and put the menu's block in a block region.
Once that's done, just use Firebug (or you can just view source) to figure out the ID or class of the menu, and then use that in your CSS.


text:
Q: Unity minus extra number when I just want minus one What I'm trying to do is when it hits a triggered collider I want it to minus an int, but what unity does is minus it with 3 instead, and I have it attached to the player itself
lifecontroller lves;
public GameObject gm;
CoinScript coins;

// Use this for initialization
void Start () {
    gm = GameObject.FindGameObjectWithTag("GM");
    coins = gm.GetComponent<CoinScript>();
    lves = gm.GetComponent<lifecontroller>();
}

void OnTriggerEnter2D(Collider2D other)
{
    if(other.tag == "Evil")
    {
        lves.lives -= 1;
        Debug.Log("U hit it");
    }
}

// Update is called once per frame
void Update () {
    if(lves.lives == 0)
    {
        Debug.Log("u died");
    }
}

A: Judging from the screenshot, your script is attached to the Player GameObject multiple times. Select your Player GameObject, and remove the duplicate Script.
Make sure there is only one script attached to it. It is probably attached there 3 times.
This problem can also happen if you are instantiating multiple Player GameObjects during run-time as this will duplicate your script too.

EDIT:
With the updated Image in your comment, the problem is that you have 3 Colliders on your Player. It is true that only one of them is made IsTrigger but this is a problem if the GameObject with the Evil tag is marked as IsTrigger too.
You have 2 options to fix this:
1.Select the GameObjects with the Evil tag and make sure that no Collider attached to it is marked as IsTrigger. Unceheck all IsTrigger properties on the Collider of all Evil tagged GameObjects only. This should fix your problem.
2.Only have one Collider on Player GameObject. Remove the other 2. This again should fix your problem.

A: The trigger is definitly happening 3 times, your screenshot shows that (there is a 3 on the right since duplicate logs get collapsed).
This might occur because of the collider shape I think (circle). Try using a bool that us set on trigger enter and clear on trigger exit (or even Update should be ok for clearing).

A: This is what I suggested to debug your problem:
void OnTriggerEnter2D(Collider2D other)
{
    if(other.tag == "Evil")
    {
        lves.lives -= 1;
        Debug.Log("U hit it", other.gameObject);
    }
}

And by looking at your screenshot you are getting 3 log messages.
Always use don't collapse in console window to see whats happening


text:
Q: Tool (filter) to convert HTML5 into Polyglot Markup? Context: my HTML5 documents not need Javascript, animations, forms... They are "only content". So, it can be filtered about these kind of representations, need only some subset/constraints of the "full-HTML5 representation". A good way to express this situation (and other broader ones!) is to say "my documents can be expressed with the Polyglot Markup constraints".
Question: Are there  a tool that transforms (or filters losing spurious information) "any HTML5" into Polyglot XHTML5? Preferably a tool based on extensions for DOM (or XSLT or XQuery).

A: I'm not going to have a complete solution.
In my mind there are two or even three stages in such a conversion:
Stage 1: get the HTML5 well formed
There's sort of black art to this first phase where the lack of well-structured requirement of HTML 5 needs to be accommodated for.
You need this before you have a DOM, before you have any chance of getting tools that expect something that remotely looks like xml to function.
So who's implemented such conversion: (almost?) every browser. Quite a few have source code. You can get this information out of a running browser as well:
inspect the source code and see what it does with tag soup as input and you get well structured source code instead.
Another place to find such source code is in editors that allow you to edit xhtml in a webpage (FCKeditor and the like)
e.g.
para

bullet

para
gets changed into
para

bullet

para

Stage 2: filter out what's not allowed in Polyglot
Once the html tags are well structured, comes the next step where you have to remove what's not allowed in polyglot markup because there are differences with how it'll be interpreted between an html parser and a XML parser.
Those you might have a chance with XSLT, and building a filter, but you cannot validate it all as there is no DTD or anything equivalent for validating polyglot (x)html against. Even those few validators for xhtml5 that existed are being (have been) scrapped, so it'll make your quest a difficult one.
Anyway, trying to locate source of one of those validators that existed is your best option at finding source code that comes near this.
Stage 3: fix the external entities
Say what ? Well you can have beautiful polyglot (x)html and include a single javascript that does a single document.write and it all still fails. So you'll need to hunt down all of that too before it works.

A: I don't know such a tool, but based on regular expressions I think it should be possible to write your own converter using your preferred programming language. I give you an example using Java regex, but it should be transferable to PHP, too. You can test it on regexplanet.com

Given: any self-closing html tag, e.g. <textarea class="placeholder"/>
Target: tag shall be converted to <textarea class="placeholder"></textarea>

This can be achieved using a Java regular match expression like <\s*([^\s>]+)([^>]*)/\s*> on a replacement string like <$1$2></$1>. The expression finds the first word textarea in the tag, assigns it to pattern group no. 1 and all attributes on the tag to pattern group no. 2. This enables you to concat group no. 1 and 2 in the opening tag and reuse group no. 1 in the closing tag again.
Hope this helps.


text: Q: Project high dimensional vectors onto low dimensional plane I'm trying to project a set of 4-dimensional vectors to a 2-dimensional plane for visualization purposes. For example, V=(x0, y0, z0, w0), the plane is defined by (y=ys, w=ws). From the link Projection of high dimensional vectors to lower dimensional space, I find that $$p=A(A^TA)^{−1}A^TV$$ can do the projection. However, how to formulate matrix $A$ for my case since my plane is not the XY-plane?


text:
Q: Are Klingons obligate carnivores? In the Star Trek: The Next Generation episode "A Matter of Honor" Commander Riker participates in a Federation-Klingon officer exchange program.  The evening before his transfer he gorges himself on Klingon delicacies, presumably to prepare his digestive tract for what's to come.  Everything he eats--- heart of targ, pippius claw, gagh, etc. seems to have come from the living flesh of some animal.  Onboard the Klingon vessel Pagh no one seems to eat anything but meat.
All this suggests the question: Are Klingons obligate carnivores?  That is, do they require nutrients found only in animal flesh and therefore must eat meat to survive?

A: I have come to the conclusion that Klingons are not obligate carnivores.  I reached this conclusion by first observing that Klingons and humans are in fact the same species.  From the Wikipedia article on species:

In the study of sexually reproducing organisms, where genetic material is shared through the process of reproduction, the ability of two organisms to interbreed and produce fertile offspring of both sexes is generally accepted as a simple indicator that the organisms share enough genes to be considered members of the same species. Thus a "species" is a group of interbreeding organisms.

In the Star Trek: Deep Space Nine episode "Children of Time" we see the product of several generations of human-Klingon interbreeding with hybrids of both sexes present. According to the definition above, Klingons and humans despite morphological differences are "a group of interbreeding organisms" and thus are a single species.
Since humans aren't obligate carnivores, then neither are Klingons.  If some Klingons have dietary preferences or restrictions due to excessive inbreeding or environmental pressures, then the traits are simple variations within the species rather than innate traits.

A: It's difficult to say, they do eat a lot of meat (at least the warrior class does), though this is not definitive.
On this site I found reference to the fact that Klingons cannot absorb nutrients as easily as humans can, which means more live food (though not necessarily meat) in their diets rather than preserved foods.
This would explain a strong preference for (live) meat as opposed to non-meat foods or preserved meat, but probably not obligate carnivores.

A: Remember Worf survived for a time on star fleet ration packs and had a fondness for prune juice neither of which were animal products.

A: If you're interested in things that only appeared in novels, A Burning House describes a popular Vulcan restaurant in First City on Qo'nos.  (The Vulcans, as you probably know, are vegetarians).  According to the Memory Beta page, it "catered largely to Vulcanoids in the Klingon Empire's capital city, but also had a share of Klingon customers".
This doesn't really answer whether Klingons can survive with no meat, but it does show that they can eat meals that aren't meat, and at least some of them enjoy it.


text:
Q: Downloading images from a link using python code I am downloading images from a link but I am facing some problems. It shows "found 0 links" and then "downloaded 0 files".
Here's the code:
import urllib.request
import re
import os

#the directory to where save the images
DIRECTORY = "book"

#the url to fetch the html page where the images are
URL = "https://www.inaturalist.org/taxa/56061-Alliaria-petiolata/browse_photos"

#the regex to get the url to the images from the html page
REGEX = '(?<=<a href=")http://\d.bp.inaturalist.org/[^"]+'

#the prefix of the image file name
PREFIX = 'page_'

if not os.path.isdir(DIRECTORY):
    os.mkdir(DIRECTORY)

contents = urllib.request.urlopen(URL).read().decode('utf-8')
links = re.findall(REGEX, contents)

print("Found {} lnks".format(len(links)))
print("Starting download...")

page_number = 1
total = len(links)
downloaded = 0
for link in links:
    filename = "{}/{}{}.jpg".format(DIRECTORY, PREFIX, page_number)
    if not os.path.isfile(filename):
        urllib.request.urlretrieve(link, filename)
        downloaded = downloaded + 1
        print("done: {} ({}/{})".format(filename, downloaded, total))
    else:
        downloaded = downloaded + 1
        print("skip: {} ({}/{})".format(filename, downloaded, total))
    page_number = page_number + 1

print("Downloaded {} files".format(total))

How can I do it?

A: I just fixed your regex and changed some logic. This script should work properly:
import urllib.request
import re
import os

#the directory to where save the images
DIRECTORY = "book"

#the url to fetch the html page where the images are
URL = "https://www.inaturalist.org/taxa/56061-Alliaria-petiolata/browse_photos"

#the regex to get the url to the images from the html page
REGEX = re.compile(r'(?:(?:https?)+\:\/\/+[a-zA-Z0-9\/\._-]{1,})+(?:(?:jpe?g|png|gif))')

#the prefix of the image file name
PREFIX = 'page_'

if not os.path.isdir(DIRECTORY):
    os.mkdir(DIRECTORY)

contents = urllib.request.urlopen(URL).read().decode('utf-8')
links = re.findall(REGEX, contents)

print("Found {} lnks".format(len(links)))
print("Starting download...")

page_number = 1
total = len(links)
downloaded = 0
page_number = 1
total = len(links)
downloaded = 0
for link in links:
    ext = link.split('.')[-1]
    filename = "{}/{}{}.{}".format(DIRECTORY, PREFIX, page_number, ext)
    urllib.request.urlretrieve(link, filename)
    downloaded = downloaded + 1
    print("done: {} ({}/{})".format(filename, downloaded, total))
    page_number = page_number + 1

print("Downloaded {} files".format(total))

By the way, I'd suggest you to use some library/framework for this job (e.g. Scrapy, BeautifulSoup etc)


text:
Q: 2 Different items added to ArrayList however the latest item is made twice? I have a TableView of products that have a description, product number and price, when the user selects the product in the table and clicks the button it should then be added to an ArrayList called order which is then added to a cart called shoppingCart. See button method below:
        public void addToCartButtonClicked(){
        //Set the variables of the cart.
        //Set customer to the cart.
        shoppingCart.setShopper(newCustomer);
        //Set Cart ID
        shoppingCart.setCartId(cartID);

        //Get selected product from the table, add to order then add to cart.
        ObservableList<Product> allProducts;
        allProducts = shoppingTable.getItems();
        order.setProduct(shoppingTable.getSelectionModel().getSelectedItem());
        shoppingCart.addOrder(order);
        System.out.println(order);
    }

I have used a System.out to try and understand the problem with no luck as it was previously working. When I add product 'Apple' it will successfully add it to shoppingCart with its attributes, when I then add a 'Melon' it will also sucessfuly add this to the cart but will then replace the product 'Apple' with a 'Melon' and its attributes also with the 'Melon's'
Here is the output of the system print:
Cart:[contents=[Order:[item=Product:[productCode=01, description=Apple, unitPrice =99], quantity=1]]

When the second product is added:
Cart:[contents=[Order:[item=Product:[productCode=03, description=Melon, unitPrice =77], quantity=1], Order:[item=Product:[productCode=03, description=Melon, unitPrice =77], quantity=1]]

Code that might help:
Cart class:
//constructors
public Cart() {
    contents = new ArrayList<Order>();
    shopper = new Customer();
    deliveryDate = new Date();
    cartId = "Not set";
}
    public void addOrder(Order o) {
    contents.add(o);
}

Order class:
    //constructors
public Order() {
    item = new Product();
    quantity = 1;
}

Product class:
    public Product(String productCode, String description, int unitPrice) {
    this.productCode = productCode;
    this.description = description;
    this.unitPrice = unitPrice;
}

A: You created a single Order instance, and in each call to addToCartButtonClicked() you change the product of that Order (by calling order.setProduct(shoppingTable.getSelectionModel().getSelectedItem())) and add that same Order to your List.
Therefore your List contains multiple references to the same Order instance.
You should put
Order order = new Order();

inside your addToCartButtonClicked() method, in order to add a different Order instances to the List.
 public void addToCartButtonClicked(){
    //Set the variables of the cart.
    //Set customer to the cart.
    shoppingCart.setShopper(newCustomer);
    //Set Cart ID
    shoppingCart.setCartId(cartID);

    //Get selected product from the table, add to order then add to cart.
    ObservableList<Product> allProducts = shoppingTable.getItems();
    Order order = new Order();
    order.setProduct(shoppingTable.getSelectionModel().getSelectedItem());
    shoppingCart.addOrder(order);
    System.out.println(order);
}


text:
Q: Laravel Registration System not feeding data I have a login/registration system I am looking to build in Laravel. Currently I am having trouble pulling the information from the form and inputting it into the table. When I submit the form it submits, but the data goes nowhere, I am admittedly new to Laravel.
This is how the form is written:
{{ Form::open() }}
@if (Session::get("error"))
  {{ Session::get("error") }}

@endif
{{ Form::label("first_name", "First Name") }}
{{ Form::text("first_name") }}
{{ $errors->first("first_name") }}

{{ Form::label("email", "Email") }}
{{ Form::text('email', Input::old('email')) }}
{{ $errors->first("email") }}

{{ Form::label("password", "Password") }}
{{ Form::password("password") }}
{{ $errors->first("password") }}

{{ Form::label("password_confirmation", "Confirm") }}
{{ Form::password("password_confirmation") }}
{{ $errors->first("password_confirmation") }}

{{ Form::submit("register") }}
{{ Form::close() }}

The user.register (part of a larger controller) which this POSTs to and GETs from is as follows:
public function register()
{
return View::make("user/register");

     $validation = Validator::make(Input::all(), User::$rules);
     if ($validation->fails())
   {
      return Redirect::to('register')->withErrors($validation)->withInput();
   }
      $users = new User;
      $users->first_name = Input::get('first_name');
      $users->email = Input::get('email');
      $users->password = Hash::make(Input::get('password'));
      if ($users->save())
   {
      Auth::loginUsingId($users->id);
      return Redirect::to('profile');
   }
      return Redirect::to('register')-withInput();
   }
}

Currently when I submit I get no errors simply a blank redirect to the registration page and nothing ends up in my DB. I am wondering if there is something wrong with my paths? The only other page that is similar to this that I have previously worked on (inputting data to a database) is a page to reset passwords (which works great), but that used a slightly different system through the Auth extension of Laravel.
This I am not familiar with. Can someone point me in the right direction? I have been compiling the knowledge I have gained from guides online but keep ending up in the same place!
Thanks a lot in advance,
Anything else you need (models, routes, etc. I just didn't think they were necessary) lemme know!

A: Change
return Redirect::to('register')-withInput();

to
return Redirect::to('register')->withInput();

edit:
oh - here is the problem:
public function register()
{
return View::make("user/register");

     $validation = Validator::make(Input::all(), User::$rules);
     ...

remove the "return" function - it should be
public function register()
{
     $validation = Validator::make(Input::all(), User::$rules);
     ...


text:
Q: How can I determine if Java generic implements a particular interface? How can I determine if a Java generic implements a particular interface?
I have tried a few different approaches, but they all results in a "cannot find symbol ... variable T" error.
First Attempt
public abstract class AbstractClass<T> {
    public void doFoo() {
        if (T instanceof SomeInterface){
            // do stuff
        }
    }
}

Second Attempt
public abstract class AbstractClass<T> {
    public void doFoo() {
        if (SomeInterface.class.isAssignableFrom(T)) {
            // do stuff
        }
    }
}

A: You can't.
Workaround  1
Add a constructor taking the class of the object.
public abstract class AbstractClass<T> {

    private Class<T> clazz;

    public AbstractClass(Class<T> clazz) {
        this.clazz = clazz;
    }

    public void doFoo() {
        if (clazz instanceof SomeInterface){
            // do stuff
        }
    }
}

Workaround 2
Add a constraint to the type T with T extends SomeInterface, thereby restricting the type T to be a subtype of SomeInterface.
public abstract class AbstractClass<T extends SomeInterface> {
    public void doFoo() {
        // do stuff
    }
}

A: Put a bound on it.
public abstract class <T extends SomeInterface> { }

Then you're guaranteed that it will be at least SomeInterface when passed through as an argument to a method.
From your approach, there's no way to do it, since you don't reference an instance of T anywhere in your code.  If you added an argument to it, you'd be able to at least get further.
public void doFoo(T obj) { }


text:
Q: How to model creation of resources using PUT according to the HATEOAS constraint? Suppose I am developing a RESTful API with a container of items:
/items

and individual items would be identified by URIs like:
/items/{id}

What is the best way to describe the fact that new items can be created by PUT request under the HATEOAS constraint, i.e. where the client would specify {id}?
PUT /items/1234

A:
What is the best way to describe the fact that new items can be created by PUT request under the HATEOAS constraint, i.e. where the client would specify {id}?

How would you do that on a web site?
You'd probably have some resource that provides a form; and the form would include the id, and possibly other interesting things.  The client would fill in the form (using semantic hints to interpret which information belonged in each field).  When the form is submitted, the HTML processing rules would encode the form values into an application/x-www-url-formencoded representation, which would become the query part of the target-url.  The server would review the payload, compute the appropriate target URI, and send a redirect response to the client.
The client can then GET/PUT/POST etc to the resource recommended by the server.
If you squint a little bit, you may see that the form is playing a role very similar to a URI Template.
So the basic sketch is pretty straight forward: the client and server have to agree on a media type that describes the template (and its semantic meaning), and the corresponding processing rules.
Here's the bad news: that bit is hard.  In the world-wide-web, HTML is doing a ton of the heavy lifting for us.  If your API is also using html representations of its resources, then you can piggy back on the forms that are already there.  But HTML has kind of fallen out of vogue.
In the API space, JSON has a lot of mind share, and there are a few media types that use it as a starting point.  Sookocheff's 2014 survey is five years old now, but will give you some idea of what is out there.


text:
Q: format output in Perl I've build a perl script that collect data from power system, the information that collect is cpu ent capacity ram ecc ecc
So here the output of my script

Server Server-9119-MHE-xxxxxx Active CPU 48.0 Installed CPU 64.0
------------------------------------------------------------------

HOSTNAME Memory Phisical_CPU Type logical_CPU logical_SMT_CPU OS_Version Mode Weight VirtCPU MaxVirtCpu
xxxx  49152 MB  1.50  Shared-SMT-4  2 8 7100-04-03-1642  Uncapped  128   32
xxxxxxx  32768 MB  0,10  Shared-SMT-4  1 4 7100-04-00-0000  Uncapped  80   32
xxxxxxx-xxxx  32768 MB  0.10  Shared-SMT-4  1 4 7100-05-05-1939  Uncapped  128   4
xxxxxxx-xxxx  32768 MB  0.10  Shared-SMT-4  1 4 7100-05-05-1939  Uncapped  80   4
xxxx 335872 MB  3,00  Shared-SMT-4  8 32 7100-05-05-1939  Uncapped  128   32
xxxxxxxxx  32768 MB  0.30  Shared-SMT-4  1 4 7100-05-05-1939  Uncapped  80   32
xxxxxxxxxx  65536 MB  2.00  Shared-SMT  4 8 5300-12-09-1341  Uncapped  128   8
xxxxxxxxx  184320 MB  2.00  Shared-SMT-8  8 64 7100-05-05-1939  Uncapped  100   8
xxxxxxx  25600 MB  0.50  Shared-SMT  1 2 5300-12-09-1341  Uncapped  80   8
xxxxxxxxxx  65536 MB  1.40  Shared-SMT-4  2 8 7200-00-03-1642  Uncapped  128   20
xxxxxxx  614400 MB  15.50  Shared-SMT-4  20 80 7100-04-03-1642  Uncapped  200   64
xxxxxxx  614400 MB  15.50  Shared-SMT-4  20 80 7100-04-03-1642  Uncapped  200   64
xxxxx  8192 MB  3.00  Shared-SMT-4  5 20 6100-09-06-1543  Uncapped  255   8
xxxxx  8192 MB  3.00  Shared-SMT-4  5 20 6100-09-06-1543  Uncapped  255   8

Server Server-9119-MHE-xxxxxx Active CPU 48.0 Installed CPU 64.0
------------------------------------------------------------------

HOSTNAME Memory Phisical_CPU Type logical_CPU logical_SMT_CPU OS_Version Mode Weight VirtCPU MaxVirtCpu
xxxxx 65536 MB  1,00  Shared-SMT-8  4 32 7100-05-05-1939  Uncapped  220   32
xxxxxx 32768 MB  0.10  Shared-SMT-4  1 4 7200-00-03-1642  Uncapped  100   32
xxxxx_xxxxxx  32768 MB  0.10  Shared-SMT-4  1 4 7200-00-03-1642  Uncapped  80   32
xxxx-xxxxx  32768 MB  0.10  Shared-SMT-4  1 4 7100-05-05-1939  Uncapped  128   4
xxxx-xxxxx  32768 MB  0.10  Shared-SMT-4  1 4 7100-05-05-1939  Uncapped  80   4
xxxxxx  335872 MB  3,00  Shared-SMT-4  8 32 7100-05-05-1939  Uncapped  128   8
xxxxxx  24576 MB  0,20  Shared-SMT-4  1 4 6100-08-02-1316  Uncapped  80   10
xxxxxx  73728 MB  2.00  Shared-SMT  4 8 5300-12-09-1341  Uncapped  128   8
xxxxxxxx  16384 MB  1.00  Shared-SMT  2 4 5300-12-09-1341  Uncapped  100   8
xxxxxxxx  32768 MB  0.50  Shared-SMT  2 4 5300-12-09-1341  Uncapped  100   32
xxxxx  65536 MB  2,20  Shared-SMT-8  8 64 7100-05-05-1939  Uncapped  100   32
xxxxx_xxx  powerd off
xxxxxxxx  32768 MB  0.50  Shared-SMT-4  2 8 7200-00-03-1642  Capped  0   8
xxxxx  614400 MB  15.50  Shared-SMT-4  20 80 7100-04-03-1642  Uncapped  200   64
xxxxx  614400 MB  15.50  Shared-SMT-4  20 80 7100-04-03-1642  Uncapped  200   64
xxxxx  8192 MB  3.00  Shared-SMT-4  5 20 6100-09-06-1543  Uncapped  255   8
xxxxx  8192 MB  3.00  Shared-SMT-4  5 20 6100-09-06-1543  Uncapped  255   8

There is a simple way to use array and format the output in a table?
I' don't know for example multi dimensional array or something like a function in perl that help me to build a formatted table output
here the code
@power_server=`/usr/bin/ssh  hscroot\@xxx.xxx.xxx.xxx 'lssyscfg -r sys -F name'`;
chomp @power_server;
my @arr;
foreach $i (@power_server) {
        ##Collect CPU installed and active
        $cpu=`/usr/bin/ssh  hscroot\@xxx.xxx.xxx.xxx 'lshwres -r proc -m $i --level sys -F configurable_sys_proc_units,installed_sys_proc_units'`;
        @cpu_split=split (/,/, $cpu);
        print "\nServer $i Active CPU @cpu_split[0] Installed CPU @cpu_split[1]";
        print "------------------------------------------------------------------\n";
        printf "%-18s %12s %12s %-12s %11s %15s %-16s %-8s %6s %7s %10s \nHOSTNAME Memory Phisical_CPU Type logical_CPU logical_SMT_CPU OS_Version Mode Weight VirtCPU MaxVirtCpu \n";
        @lpar=`/usr/bin/ssh  hscroot\@xxx.xxx.xxx.xxx lssyscfg -m $i -r lpar -F name`;
        chomp @lpar;
                foreach $z (@lpar) {
                        $ip_addr=`/usr/bin/ssh  hscroot\@xxx.xxx.xxx.xxx 'lssyscfg -m $i -r lpar --filter lpar_names=$z -F rmc_ipaddr'`;
                        chop $ip_addr;
                        ####check ip
                        #print "$ip_addr \n";
                        #print "$z $i\n";
                        if ($ip_addr eq ''){
                                print "\n$z  powerd off \n";
                        }
                        else {

                                $hostname=single_command_ret("/usr/bin/ssh $ip_addr hostname");
                                chop $hostname;
                                $memory=`/usr/bin/ssh $ip_addr lparstat -i |grep "Online Memory" |awk 'FS="\:"{print \$2}'`;
                                chop $memory;
                                $ent=`/usr/bin/ssh $ip_addr lparstat -i |grep "Entitled Capacity"|grep -v Pool| awk 'FS="\:"{print \$2}'`;
                                chop $ent;
                                $type=`/usr/bin/ssh $ip_addr lparstat -i |grep "Type" |awk 'FS="\:"{print \$2}'`;
                                chop $type;
                                $logicacpu=`/usr/bin/ssh $ip_addr lparstat -i |grep "Online Virtual CPUs" |awk 'FS="\:"{print \$2}'`;
                                chop $logicacpu;
                                $virtualcpu=`/usr/bin/ssh $ip_addr vmstat | grep "System configuration" | awk -F'[ =]' '{print \$4}'`;
                                chop $virtualcpu;
                                $oslevel=`/usr/bin/ssh $ip_addr oslevel -s`;
                                chop $oslevel;
                                $mode=`/usr/bin/ssh $ip_addr lparstat -i |grep -E "^Mode" |awk 'FS="\:"{print \$2}`;
                                chop $mode;
                                $weight=`/usr/bin/ssh $ip_addr lparstat -i |grep "Variable Capacity Weight"|grep -v Desired |awk 'FS="\:"{print \$2}'`;
                                chop $weight;
                                $maxvirtcpu=`/usr/bin/ssh $ip_addr lparstat -i |grep "Maximum Virtual CPUs" |awk 'FS="\:"{print \$2}'`;
                                chop $maxvirtcpu;
                                printf "%-18s %12s %12s %-12s %11s %15s %-16s %-8s %6s %7s %10s\n$hostname $memory $ent $type $logicacpu $virtualcpu $oslevel $mode $weight $logicacpu $maxvirtcpu";

                        }

                }

}
sub single_command_ret
{
        local ($command) = $_[0] ;
        local $tmp=`$command`;
        chop ($tmp);
        return ("$tmp");
}


text:
Q: sed (or awk): add a new line "commit;" after every n-th line but only if next line starts with pattern I have a very large SQL file and would like to add a new line "commit;" every e.g. 100000 lines.
This would be easy, BUT the sql contains CLOBs and BLOBs with line breaks.
I need to make sure that the new line is not created in such rows.
In other words: I need to put a "commit;" every n-th line but only if next line starts with "INSERT INTO".
input:
INSERT INTO X ..... );
INSERT INTO X ..... );
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
INSERT INTO X ..... );

expected output (for this example lets say add commit to every 2nd line):
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO xxx ..... );

Suggestions much appreciated :)

A: Here's an example to paste commit after every third INSERT.
sed '0~2{:a;N;/;$/!ba;s/$/\ncommit;/}'

I assume that every insert ends with ; at the end of the line (you might need to add \s* after ; if you have some lines with spaces in the end.
The logic is to grab 3 lines and check whether there is ; at the end and concatenate more lines until it gets the line with ; at the end. And insert commit; afterwards.
Once the line added it will proceed further with next lines.
Feel free to adjust a number of lines to your needs.

A: A solution in awk that takes each group of n lines (n = 3 in the example) and inserts a "commit;" before the last of the lines, provided it starts with "INSERT INTO" would be:
$ awk '{ if (/^INSERT INTO/ && NR%3 == 0) { print "commit;" }; print }' input

A: With any awk in any shell on every UNIX box and assuming you only have semi-colons at the end of lines when they're at the end of every INSERT statement like in your posted sample input:
$ awk '{print} /;$/ && !((++c)%2){print "commit;"}' file
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO X ..... );

Original answer when I was overthinking the problem:
With GNU awk for multi-char RS and assuming you only have semi-colons at the end of lines when they're at the end of every INSERT statement:
$ awk 'BEGIN{RS=ORS=";\n"} {print} !(NR%2){print "commit"}' file
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO X ..... );

Otherwise, with any awk in any shell on every UNIX box:
$ awk '/^INSERT/{ if (c++ == 2) {print "commit;"; c=1} } {print} END{if (c == 2) print "commit;"}' file
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO X ..... );

You need the END section since it's inserting before the N+1th INSERT statement rather than after the Nth INSERT statement and you need to handle the case where there's exactly a multiple of N INSERTs in the input, e.g.:
$ cat file
INSERT INTO X ..... );
INSERT INTO X ..... );
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
INSERT INTO X ..... );
INSERT INTO X ..... );

Without the END statement we fail to add the final commit;:
$ awk '/^INSERT/{ if (c++ == 2) { print "commit;"; c=1 } } {print}' file
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO X ..... );
INSERT INTO X ..... );

while with it we succeed:
$ awk '/^INSERT/{ if (c++ == 2) { print "commit;"; c=1 } } {print}; END{if (c == 2) print "commit;"}' file
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;
INSERT INTO X .....foo bar
foo bar foo
bar foo
bar);
INSERT INTO X ..... );
commit;
INSERT INTO X ..... );
INSERT INTO X .....foo
bar
foo bar);
commit;
INSERT INTO X ..... );
INSERT INTO X ..... );
commit;

and of course if you just want a commit; after the final INSERT no matter how many are present then just remove the if ( c == 2 ) from the END and leave the print.


text:
Q: Implement reference field search feature using GAE/webapp2/Jinja2 I'm writing a web application using GoogleAppEngine (GAE), webapp2, Jinja2 and Twitter Bootstrap.
I do want to manage objects which may have a location through a web interface.
I've got the following location model (models/location.py):
from google.appengine.ext import ndb

class Location(ndb.Model):
    name = ndb.StringProperty(required=True)
    description = ndb.TextProperty(required=False)
    address = ndb.StringProperty(required=False)
    latitude = ndb.FloatProperty(required=False)
    longitude = ndb.FloatProperty(required=False)

I've also got a basic object model (models/object.py):
from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel
from location import Location

class Object(polymodel.PolyModel):
    name = ndb.StringProperty(required=True)
    description = ndb.TextProperty(required=False)
    location = ndb.KeyProperty(kind=Location, required=False)
    position = ndb.StringProperty(required=False)

I did create a html template (templates/object-create.html) to create new objects. So far the input field for "location" looks as following:

    Location

        <input type="text" name="location" id="inputLocation" placeholder="Location">

How would I make the input field searchable? I would like to write the location name or address.
Am I missing a technology here? Is this where WTForms would come in place?
-Luca.


text:
Q: Polar form representation of $aX+bY+cZ$ ($X$, $Y$, and $Z$ are complex Gaussian random variable) I need some help with the following problem:

Let $X$, $Y$, and $Z$ are independent circularly symmetric complex Gaussian random variable with zero mean and unit variance, i.e., $X$, $Y$, and $Z \sim CN(0, 1)$.
These random variables can be represented in polar form as
  \begin{equation}
X=r_1 e^{i \alpha}\\
Y=r_2 e^{i \beta}\\
Z=r_3 e^{i \gamma}
\end{equation}
  where $r_1$, $r_2$ and $r_3$ are the magnitude (Rayleigh distributed) and $\alpha$, $\beta$ and $\gamma$ are the phase of the variables (Uniformly distributed over $[0, 2\pi]$).
How can I represent the  random variable $aX+bY+cZ$ (where a,b, c are constant) in polar form as a function of the variables $a$, $b$, $c$, $r_1$, $r_2$, $r_3$, $\alpha$, $\beta$ and $\gamma$. Particularly I am interested to know the phase of $aX+bY+cZ$ in terms of these variables.

Thank you very much


text:
Q: Extract date part of a dataframe column and convert it to the last business day of its month I have the following df with Date  elements being a string  followed by YYYY.MM :
df =
             Date    Value
0  name   2019.06      1.0
1  string 2018.03      1.6
2  string 2017.12      1.0
3  string 2016.09      1.7
4  name   2018.09      6.0
...

And I would like to convert the Date column to the last business day (Monday to Friday) of its month.
So I could get this output:
df =
             Date    Value
0      2019-06-28      1.0
1      2018-03-30      1.6
2      2017-12-29      1.0
3      2016-09-30      1.7
4      2018-09-28      6.0
...

I tried re.search  to start by searching for the date parts of each element of the column, but I can't figure out the solution for this.

A: Split and add monthend:
d = pd.to_datetime(df['Date'].str.split().str[-1])
print(df.assign(Date=d + pd.offsets.BMonthEnd(1)))

        Date  Value
0 2019-06-28    1.0
1 2018-03-30    1.6
2 2017-12-29    1.0
3 2016-09-30    1.7
4 2018-09-28    6.0


text:
Q: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'deposits.Country' in 'where clause' I am fetching the data accurately in my views. but when i try to search in my datatables it gives me above error.. UNKNOWN COLUMN.. I am not getting this if its working one time then why it gives error on SEARCHING
$deposits2 = DB::connection('mysql')
    ->table('deposits')
    ->join('users','users.id','=','deposits.user_id')
    ->select('deposits.*','users.Country')
    ->where('deposits.status','Approved');

Here is the error
Here is the code from my views file


text:
Q: What does it mean when IE Developer Tools shows CSS property in caps next to other property? Sometimes I have noticed that Internet Explorer 8 Developer Tools shows some CSS properties in capital letters next to another property. But usually there is always one property per row, and you can turn them on and off individually with the checkbox. See my screenshot below. In this case, clicking the checkbox turns both properties on and off (so both properties are being recognised). Why does this happen?

A: Based on this earlier question, it appears to just be a quirk of how IE reacts to certain HTML doctypes, and doesn't really mean anything.


text:
Q: Writing numerical values on the plot with Matplotlib Is it possible, with Matplotlib, to print the values of each point on the graph?
For example, if I have:
x = numpy.range(0,10)
y = numpy.array([5,3,4,2,7,5,4,6,3,2])
pyplot.plot(x,y)

How can I display y values on the plot (e.g. print a 5 near the (0,5) point, print a 3 near the (1,3) point, etc.)?

A: You can use the annotate command to place text annotations at any x and y values you want.  To place them exactly at the data points you could do this
import numpy
from matplotlib import pyplot

x = numpy.arange(10)
y = numpy.array([5,3,4,2,7,5,4,6,3,2])

fig = pyplot.figure()
ax = fig.add_subplot(111)
ax.set_ylim(0,10)
pyplot.plot(x,y)
for i,j in zip(x,y):
    ax.annotate(str(j),xy=(i,j))

pyplot.show()

If you want the annotations offset a little, you could change the annotate line to something like
ax.annotate(str(j),xy=(i,j+0.5))

A: Use pyplot.text() (import matplotlib.pyplot as plt)
import matplotlib.pyplot as plt

x=[1,2,3]
y=[9,8,7]

plt.plot(x,y)
for a,b in zip(x, y):
    plt.text(a, b, str(b))
plt.show()


text:
Q: Compilation error while sending function pointer of member function I am trying to use the boost scope_guard
I need to send the function pointer of a member function to make_guard function
I tried it in the following way:
class A
{
  HRESULT foo(int x);
  HRESULT foo_1(int x);
}

STDMETHODIMP A::foo(int x)
{....};

STDMETHODIMP A::foo_1(int x)
{

    boost::scope_guard xyz=
    boost::make_guard(&A::foo, x);
}

But it gives compilation error:
E:\ThirdPartyCore\Boost\1_43_0\winx64\include\boost/multi_index/detail/scope_guard.hpp(103) : error C2064: term does not evaluate to a function taking 1 arguments
        E:\ThirdPartyCore\Boost\1_43_0\winx64\include\boost/multi_index/detail/scope_guard.hpp(103) : while compiling class template member function 'void boost::multi_index::detail::scope_guard_impl1<F,P1>::execute(void)'
        with
        [
            F=HRESULT (__cdecl A::* )(int),
            P1=int
        ]
        see reference to class template instantiation 'boost::multi_index::detail::scope_guard_impl1<F,P1>' being compiled
        with
        [
            F=HRESULT (__cdecl A::* )(int),
            P1=int
        ]

AGPSEngine - 1 error(s), 0 warning(s)

Can any body please help me fixing it.

A: Like the error message says, A::foo is not a function taking one parameter; it is a member function.  I believe you want to use obj_scope_guard and make_obj_scope_guard, passing this.


text:
Q: Implementing oauth in SugarCRM using .NET I have a web application developed in .net framework. I am trying to implement Oauth in sugarCRM  in order to integrate it with my applications.
The Oauth mechanism given by sugarCRM is using PHP     Click Here...
where as, my application is designed in ASP.
I am trying to figure out solution (like converting php code to asp or implementing the same mechanism in my application) for same but got no solution.any help would be appreciated.

A: after much pain, I've got my .Net Code working on SugarCRM.....
This is what I did....all in a Console app for me.  This a proof of concept and so everthing is hard coded for now!
Use Nuget to Install OAuth by Daniel Crenna
Step 1: Establish Consumer Key
Go into Admin -> OAuth Keys section on SugarCRM and create a new record, I used Key & Secret.
Step 2: Creating a Request Token
private static void CreateRequestToken()
{
    // Creating a new instance directly
    OAuthRequest client = new OAuthRequest
    {
        Method = "GET",
        Type = OAuthRequestType.RequestToken,
        SignatureMethod = OAuthSignatureMethod.HmacSha1,
        ConsumerKey = "Key",
        ConsumerSecret = "Secret",
        RequestUrl = "http://localhost/service/v4/rest.php",
        Version = "1.0",
        SignatureTreatment = OAuthSignatureTreatment.Escaped
    };

    // Using URL query authorization
    string auth = client.GetAuthorizationQuery(new Dictionary<string, string>() { { "method", "oauth_request_token" } });

    var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_request_token&" + auth);
    var response = (HttpWebResponse)request.GetResponse();

    NameValueCollection query;
    using (StreamReader sr = new StreamReader(response.GetResponseStream()))
    {
        string result = sr.ReadToEnd();

        query = HttpUtility.ParseQueryString(result);
    }

    Console.WriteLine(query["authorize_url"]);
    Console.WriteLine(query["oauth_token"]);
    Console.WriteLine(query["oauth_token_secret"]);
}

This is the tricky part that took me ages to figure out, notice the requesturl is without the query part in the client, and you have add it to the GetAuthorizationQuery call AND to the actual WebRequest url.
Note down the 3 items ready for Step 4.
Step 3 Approve Request Token
Visit the url "authorize_url" above and also add &token= "oauth_token".  For this was:
http://localhost/index.php?module=OAuthTokens&action=authorize&token=adae15a306b5

Authorise the token and record the Token Authorisation Code.
Step 4 Request Access Token
private static void RequestAccessToken()
{
    OAuthRequest client = new OAuthRequest
    {
        Method = "GET",
        Type = OAuthRequestType.AccessToken,
        SignatureMethod = OAuthSignatureMethod.HmacSha1,
        ConsumerKey = "Key",
        ConsumerSecret = "Secret",
        RequestUrl = "http://localhost/service/v4/rest.php",
        Version = "1.0",
        SignatureTreatment = OAuthSignatureTreatment.Escaped,
        Token = "adae15a306b5",
        TokenSecret = "e1f47d2a9e72",
        Verifier = "33e2e437b2b3"
    };

    // Using URL query authorization
   string auth = client.GetAuthorizationQuery(new Dictionary<string, string>() { { "method", "oauth_access_token" } });

   var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_access_token&" + auth);
   var response = (HttpWebResponse)request.GetResponse();

   NameValueCollection query;
   using (StreamReader sr = new StreamReader(response.GetResponseStream()))
   {
       string result = sr.ReadToEnd();
       query = HttpUtility.ParseQueryString(result);
   }

   Console.WriteLine(query["oauth_token"]);
   Console.WriteLine(query["oauth_token_secret"]);
}

Token and TokenSecret are from Step 2, Verifier is the Auth Code from Step 3.
Step 5 Use the Access Token
I'm just using the session id as Recommended by the Documentation, so to get the sessionId
private static void GetSessionId()
{
    OAuthRequest client = new OAuthRequest
    {
        Method = "GET",
        Type = OAuthRequestType.ProtectedResource,
        SignatureMethod = OAuthSignatureMethod.HmacSha1,
        ConsumerKey = "Key",
        ConsumerSecret = "Secret",
        RequestUrl = "http://localhost/service/v4/rest.php",
        Version = "1.0",
        SignatureTreatment = OAuthSignatureTreatment.Escaped,
        Token = "adae15a306b5",
        TokenSecret = "2d68ecf5152f"
     };

     string auth = client.GetAuthorizationQuery(new Dictionary<string, string>()
     {
        { "method", "oauth_access" },
        { "input_type", "JSON" },
        { "request_type", "JSON" },
        { "response_type", "JSON" }
     });

     var request = (HttpWebRequest)WebRequest.Create("http://localhost/service/v4/rest.php?method=oauth_access&input_type=JSON&request_type=JSON&response_type=JSON&" + auth);
     var response = (HttpWebResponse)request.GetResponse();

     dynamic o;
     using (StreamReader sr = new StreamReader(response.GetResponseStream()))
     {
         string result = sr.ReadToEnd();
         o = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
     }

     Console.WriteLine("SessionId: {0}", o.id);
}

Here I'm using JSON.Net to parse the Json into a dynamic object for easy access to the id.
Step 6 Make it do something....
Over to you!
Pretty painful experience, but at least its working for me.....
Tim

A: I didn't get what you meant by implementing in SugarCRM way. But if you can't use dotnetopenauth, you can spin your own OAuth using RestSharp or Hammock


text:
Q: How install python3-poppler-qt5 on my mac I am looking to install this software (https://github.com/alexisflesch/texamator) on my mac.
For that, I install Python, but I also need to install python3-pyqt5 and python3-poppler-qt5.  But I get an error message.
For the first I have:
    $ pip install PyQt5
Collecting PyQt5
  Downloading https://files.pythonhosted.org/packages/1e/8f/dd8312af6ed44c15419fb14c38b6532eeb765c428f0642e30dc3ef26b6d4/PyQt5-5.14.0-5.14.0-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl (43.0MB)
     |████████████████████████████████| 43.0MB 172kB/s
Collecting PyQt5-sip<13,>=12.7 (from PyQt5)
  Downloading https://files.pythonhosted.org/packages/ca/77/ac0e8908be37523f0d93b8002641d11cfbc231c3e9dbaa4835f8073b397d/PyQt5_sip-12.7.0-cp37-cp37m-macosx_10_9_x86_64.whl (62kB)
     |████████████████████████████████| 71kB 843kB/s
ERROR: spyder 3.3.6 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: spyder 3.3.6 has requirement pyqt5<5.13; python_version >= "3", but you'll have pyqt5 5.14.0 which is incompatible.
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.14.0 PyQt5-sip-12.7.0

It's seem to be ok, and for the second I get:
$ pip install python-poppler-qt5
Collecting python-poppler-qt5
  Downloading https://files.pythonhosted.org/packages/6a/7d/65a14ece5dd6a1564b576c1ca30b0f5639be64cc55b62b4d2b497159ed43/python-poppler-qt5-0.75.0.tar.gz
Building wheels for collected packages: python-poppler-qt5
  Building wheel for python-poppler-qt5 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"'; __file__='"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-wheel-5y95ji3s --python-tag cp37
       cwd: /private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/
  Complete output (15 lines):
  Package poppler-qt5 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `poppler-qt5.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'poppler-qt5' found
  running bdist_wheel
  running build
  running build_ext
  building 'popplerqt5' extension
  Package poppler-qt5 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `poppler-qt5.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'poppler-qt5' found
  /opt/anaconda3/bin/sip -I /opt/anaconda3/share/sip -t POPPLER_V0_20_0 -c build/temp.macosx-10.9-x86_64-3.7 -b build/temp.macosx-10.9-x86_64-3.7/poppler-qt5.sbf -I /opt/anaconda3/share/sip/PyQt5 -n PyQt5.sip -t Qt_5_14_0 -t WS_MACX poppler-qt5.sip
  sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]
  error: command '/opt/anaconda3/bin/sip' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-poppler-qt5
  Running setup.py clean for python-poppler-qt5
Failed to build python-poppler-qt5
Installing collected packages: python-poppler-qt5
  Running setup.py install for python-poppler-qt5 ... error
    ERROR: Command errored out with exit status 1:
     command: /opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"'; __file__='"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-record-1jvxu2r8/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/
    Complete output (15 lines):
    Package poppler-qt5 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `poppler-qt5.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'poppler-qt5' found
    running install
    running build
    running build_ext
    building 'popplerqt5' extension
    Package poppler-qt5 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `poppler-qt5.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'poppler-qt5' found
    /opt/anaconda3/bin/sip -I /opt/anaconda3/share/sip -t POPPLER_V0_20_0 -c build/temp.macosx-10.9-x86_64-3.7 -b build/temp.macosx-10.9-x86_64-3.7/poppler-qt5.sbf -I /opt/anaconda3/share/sip/PyQt5 -n PyQt5.sip -t Qt_5_14_0 -t WS_MACX poppler-qt5.sip
    sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]
    error: command '/opt/anaconda3/bin/sip' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"'; __file__='"'"'/private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-install-mfn34q87/python-poppler-qt5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sf/8b0lljnn487_0hth46wr7j8w0000gn/T/pip-record-1jvxu2r8/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

I do not understand why and how to correct.
I also did:
$ pip search poppler
python-poppler-qt4 (0.24.0)  - A Python binding to Poppler-Qt4
python-poppler-qt5 (0.75.0)  - A Python binding to Poppler-Qt5
pdfparser-si (0.2.6)         - python bindings for poppler
pdfparser-rossum (1.3.3)     - python bindings for poppler
pdflib (0.2.1)               - python bindings for poppler
pypoppler (0.12.2)           - Python bindings for poppler-glib, unofficial
                               branch including bug fixes, and removal of gtk
                               dependencies

Usually I use Homebrew to install the different packages.

A: Finally, my advice would be to use the Macports package manager to install Python3, pyqt5, and poppler-pyqt5.
sudo port install pyqt5
sudo port install python-poppler-qt5

I tried with PIP but PIP does not install SIP completely. And with the Homebrew package manager I get other errors that I couldn't fix.


text:
Q: Optimizing MySQL GROUP BY/ORDER BY for calculating set intersection This scenario is simplified somewhat to make the problem clearer.
My situation involves a set of data records in MySQL.
CREATE TABLE `records` (
  `id` bigint(20) NOT NULL,
  `property1` bigint(20) NOT NULL,
  `property2` bigint(20) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `property1` (`property1`),
  KEY `property2` (`property2`)
);

From each record, we generate and store a variable number of keys (hashes) based on the record data.
CREATE TABLE `rkeys` (
  `rKey` bigint(20) NOT NULL,
  `rId` bigint(20) NOT NULL,
  KEY `rKey` (`rKey`),
  KEY `rId` (`rId`),
  FOREIGN KEY (`rId`) REFERENCES `records` (`id`)
);

(The key values are hashes to distribute them over the keyspace more evenly.)
There may be, for example, 5 million records and 50 million keys.
What I'm attempting to do is a fuzzy search on the key set -- match a record against the records in the database with the most keys in common.  The results also need to be filtered against the properties in the records table.
The query I've been working from looks like this:
SELECT rkeys.rId, records.property1, SUM(1) as score
FROM rkeys, records
WHERE
   (rKey = 10 OR rKey = 11 OR rKey = 13 OR rKey = 14) AND
    rkeys.rId = records.id AND
    records.property1 = 1 AND
    records.property2 = 2
GROUP BY rId ORDER BY score DESC;

The performance is ok if the number of records with any given key is fairly small; the problem is if I hit a key that appears in several thousand records (say 5000).  All of a sudden, the GROUP BY/ORDER BY performance falls off a cliff (15-20s per query).  Note that smoothing out the key distribution is not really an option -- the record data itself is unevenly distributed.
The join against the records problem doesn't seem to be the core of the problem -- I'm just including it for context.  I still see the same problem if all I want to do is this:
SELECT rId, SUM(1) as score
FROM rkeys
WHERE rKey = 10 OR rKey = 11 OR rKey = 13 OR rKey = 14
GROUP BY rId ORDER BY score DESC;

EXPLAIN output:
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: rkeys
         type: index
possible_keys: rKey
          key: rKey
      key_len: 8
          ref: NULL
         rows: 1
        Extra: Using where; Using temporary; Using filesort

Is there a way I can restructure this table or query in order to speed this operation up?

A: Have you tried adding nonclustered indices (indexes) to those fields?  I haven't seen Keys do this automatically in the past, aside from some implicit clustered index creation that primary key declaration does in some SQL engines.

A: I'm a noob, but try a compound index on (rKey, rId) or (rId, rKey)

A: try something like this
SELECT rId, Count(*) as score
FROM rkeys
WHERE rKey = 10 OR rKey = 11 OR rKey = 13 OR rKey = 14
GROUP BY rId ORDER BY score DESC

and add an index to the table
(rKey,rId)

Though replacing Sum with count, shouldn't make to much difference. (in MSSQL anyway)

A: "The key values are hashes to distribute them over the keyspace more evenly" is actually a bad idea for performance.  Once the data gets too large to be cached, you will be slowed down by the randomness.
The table Keys smells a lot like a many:many mapping table.  Here are several tips on improving the performance of such a table.  And it is likely to speed up your SELECT.
Your SELECT should improve significantly with this 'composite' and 'covering' index:
INDEX(property1, property2, id)

(More tips in creating optimal indexes.)


text:
Q: ValueError : The given username should be set How to use User.objects.create_user() I am trying to create an authentication for users. Here is the code below
Views.py
def signup(request):
if request.method == "POST":
    username = request.POST.get('username')
    fname = request.POST.get('fname')
    lname = request.POST.get('lname')
    email = request.POST.get('email')
    pass1 = request.POST.get('pass1')
    pass2 = request.POST.get('pass2')

    myuser = User.objects.create_user(username=username, email=email, password=pass1)
    myuser.first_name = fname
    myuser.last_name = lname

    myuser.save()

html template
{% csrf_token %}

        Username
        <input type="text" id="username" name="username" placeholder="Create a username (only letters & numbers)" required>

Can someone please let me know what i need to do right? Especially on how to use the User object.
I have tried to check previous solutions but their codes include the models.py or forms.py which my does not have.


text:
Q: Editing Orchard CMS themes in Visual Studio I have installed a new theme for my Orchard CMS site, but the new theme doesn't want to appear in the "Solution Explorer" window in Visual Studio 2010. The theme works fine on the site and the folder appears when looking in "Windows Explorer". Does anyone know why this might be?
The default theme, "TheThemeMachine" shows up fine why not installed themes from the gallery.

A: Try including the new theme into your solution.
Select the Themes project (where TheThemeMachine is), click on the Show All Files at the top of the Solution Explorer, right-click your new theme folder under the Themes project and select Include In Project. Click on Show All Files again to deselect the option.


text:
Q: how to show category post and title separate loop i am making one slider tab, i know have tons of plugins for that but i don't want to use plugins. so i want to show my category post title and post like bellow html formate but i can't. i tried my but my way only content loop not title. if can able to make html like bellow then tabs will work. guys how can i do that.

Tabs 1

Tabs 2

Tabs 3

Tabs 4

Tabs 5

so here under li (tabs) put post title

Tab #1

Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.

Horizontal Tab #1

Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.

Horizontal Tab #1

Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.

Horizontal Tab #1

Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.

Horizontal Tab #1

Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.

see closely href="#content_1" rel="tab_1" this #content_  (1,2,3,4,5)should auto. similar
 array('post'),
'orderby' => 'post_date',
'category_name'=>'my category name' ,
'showposts' => 5 );
$array= get_posts($args); ?>

 for ($i = 0; $i < count($array); $i++) { ?>

<a href="#content_<?php echo $i+1; ?>" rel="tab_<?php echo $i+1; ?>" class="tab">Tabs

<?php echo $i+1; ?>

<?php
$divs.='

'.$array[$i]->post_title.'

'.$array[$i]->post_content.'

';
 } ?>

<?php $divs; ?>


text:
Q: Slick update optional field I am facing a very annoying problem with slick 3.0.x:
Let's consider :
case class DbUser(id: Int, username: String, phoneNumber: Option[String], email: Option[String])

val user = DbUser(1, "User", None)

if I run :
users.filter(_.id === user.id).update(user)
Then, the field phonenumber will be set to null even though the data I send is None, which I can understand, however, how can I not update a field when this one is not defined ? Any ideas >

A: To update only select fields, do the following
Only update username:
users.filter(_.id === user.id)
  .map(_.username)
  .update(user.username)

A: You can filter on _.phoneNumber.isDefined,
 import driver.api._

 users.filter(_.phoneNumber.isDefined)
   .map(_.phoneNumber)
   .update(Some("3543453545"))


text:
Q: Prevent the closing of modal popup(bootstrap) window on postback of ASP.Net button click I have modal popup in asp.net page which get some values from db on submit button click and show that db value on same modal popup.
But issue is that once i click the asp.net button then it fetch the value but modal where i need to show the db value it already close because of postback.
So i need that on button click first server side side run ,retrieve db val and then run client side script to display this value in already opened modal.
Please help me to resolve this problem
My client side code is  on button click.
    $("#btnSubmit").click(function () {

        $('#PreviewModal').hide();
        $('#SubmitModal').ready();
        $('#SubmitModal').show();

    });

and server side script is
protected void btnSubmit_click(object sender, EventArgs e)
{
    Tsn objTsn = new Tsn();
    string Result=objTsn.OrderRecieptSeq("D");
    lblRef.InnerText = Result;
    btnSubmit.Attributes.Add("onClick", "clntclick();");

}

A: I don't think this process would work, you may need to consider using register start-up script option to show your popups/modal
ClientScriptManager.RegisterClientScriptBlock
protected void Button1_Click(object sender, EventArgs e)
{
    string script = "window.onload = function() { showpopup() };";
    ClientScript.RegisterStartupScript(this.GetType(), "showpopup", script, true);

}


text:
Q: CreateJS EventDispatcher and inheritance I'm trying to create a base class that has createjs EventDispatcher functionality and then create sub classes from this base class but if I then try to use addEventListener on the subclass instance I get the error:
TypeError: _subClass.addEventListener is not a function

The constructors of my classes look like this:
var BaseClass = function(id)
{
    _instance = this;
    _id = id;
    createjs.EventDispatcher.initialize(BaseClass.prototype);
};

var SubClass = function(id)
{
    BaseClass.call(this, id);
    SubClass.prototype = Object.create(BaseClass.prototype);
    _instance = this;
};

How can I make it work so that SubClass inherits the applied CreateJS event dispatcher functionality from BaseClass? So far it only works if I also apply the event dispatcher in the sub class constructor but that somehow defies the whole purpose of inheritance:
createjs.EventDispatcher.initialize(SubClass.prototype);

A: You should initialize your prototypes during initialization, not in the constructor. Here is an updated fiddle: http://jsfiddle.net/lannymcnie/qTHb4/
var BaseClass = function(id)
{
    _instance = this;
    _id = id;
};
createjs.EventDispatcher.initialize(BaseClass.prototype);

var SubClass = function(id)
{
    BaseClass.call(this, id);
    _instance = this;
};
SubClass.prototype = BaseClass.prototype;


text:
Q: How to find language changes that were not included in the official change log A change log is issued when Mathematica has an update, such as:

*

*10.4

*10.3

*10.2
But for instance the PlotLabels option mentioned in this post is not in the log. And as far as I know, the ImageMarker or some other [[EXPERIMENTAL]] functions are missing too.
How do we find these newer functions?

We can find some using this method:
CanonicalName@
 EntityList[EntityClass["WolframLanguageSymbol", "UnderDevelopment"]]

{Autocomplete, AutocompletionFunction, CachePersistence, ContentObject, DeleteSearchIndex, DimensionReduce, DimensionReducerFunction, DimensionReduction, FindFormula, FoldPair, FoldPairList, LocalObject, SearchIndexObject, SearchIndices, Snippet, TextCases, TextPosition, TextSearch, TextSearchReport, UpdateSearchIndex, WordTranslation}

But it seems incomplete: for instance, DistanceMatrix is not in this list.

A: New functions conveniently carry the "NEW in 10.4" header in their documentation page. Since the docs are blessedly written as Mathematica notebooks, and notebook are text files, we can just use grep or a similar tool to hunt for those help files that contain that header.
New in 10.4
Inspection of one such file with a text editor reveals that the raw cell code generating the header contains the fragment:
StyleBox["\<\"NEW IN 10.4\"\>",

Using a grep clone (AstroGrep on Win7-64) only on the Symbols folder of the documentation, which is located in $InstallationDirectory <> "\\Documentation\\English\\System\\ReferencePages\\Symbols" on my system, returns the following list:
$CloudExpressionBase             GreenFunction
    $SourceLink                  Highlighted
ArrayMesh                        ImageMarker
Ask                              KeyValuePattern
AskAppend                        LocalObjects
AskConfirm                       MersennePrimeExponent
AskDisplay                       MersennePrimeExponentQ
AskedQ                           MixedMagnitude
AskedValue                       MixedUnit
AskFunction                      MomentOfInertia
AskTemplateDisplay               PartProtection
BiquadraticFilterModel           PerfectNumber
BoundingRegion                   PerfectNumberQ
CloudExpression                  PlanarGraph
CloudExpressions                 PlotLabels
ClusterClassify                  PolygonalNumber
ClusterDissimilarityFunction     QuantityDistribution
ClusteringTree                   RegionMoment
ConnectedGraphComponents         SourceLink
CreateCloudExpression            SpellingCorrectionList
CreateFile                       Subsequences
CriterionFunction                TravelDistanceList
DeleteCloudExpression            UnequalTo
Dendrogram                       UniverseModelData
DictionaryWordQ                  URLDispatcher
DifferenceQuotient               WeaklyConnectedGraphComponents
DynamicGeoGraphics               WeatherForecastData
DynamicImage                     WordFrequency
FindTransientRepeat              WordFrequencyData
GeoDistanceList                  ZoomCenter
GeoLength                        ZoomFactor

Notice that this includes the PlotLabels option that you mentioned as well.
Updated in 10.4
Similarly, the documentation carries a footer containing information on a function's date of introduction and latest update. For instance, the following fragment can be found in the documentation for ListPlot:
Cell[TextData[{
 "Introduced in 2007",
 Cell[" (6.0)", "HistoryVersion"],
 " | ",
 "Updated in 2016",
 Cell[" (10.4)", "HistoryVersion"]
}], "History"],

Looking for files that contain "Updated in 2016" and also "Cell[" (10.4)", "HistoryVersion"]" returns the following sizable list:
ArcLength                      HypoexponentialDistribution      PalindromeQ
ArcSinDistribution             Image3DSlices                    ParameterMixtureDistribution
Area                           ImageDistance                    ParetoDistribution
Association                    ImageEffect                      PascalDistribution
BatesDistribution              InverseChiSquareDistribution     PearsonDistribution
BeckmannDistribution           InverseGammaDistribution         PERTDistribution
BeniniDistribution             InverseGaussianDistribution      PlaneCurveData
BenktanderGibratDistribution   JohnsonDistribution              Plot
BenktanderWeibullDistribution  KDistribution                    PoissonConsulDistribution
BernoulliDistribution          KernelMixtureDistribution        PolyaAeppliDistribution
BetaDistribution               KumaraswamyDistribution          PowerDistribution
BetaPrimeDistribution          LaminaData                       Probability
BinomialDistribution           LandauDistribution               ProductDistribution
BinormalDistribution           LaplaceDistribution              RayleighDistribution
BirnbaumSaundersDistribution   LevyDistribution                 RegionMeasure
CauchyDistribution             LindleyDistribution              RiceDistribution
CensoredDistribution           ListLinePlot                     SechDistribution
ChiDistribution                ListLogLinearPlot                ShiftedGompertzDistribution
ChiSquareDistribution          ListLogLogPlot                   SinghMaddalaDistribution
CopulaDistribution             ListLogPlot                      SkewNormalDistribution
CoxianDistribution             ListPlot                         SmoothKernelDistribution
DagumDistribution              ListStepPlot                     SolidData
DataDistribution               LocalAdaptiveBinarize            SpaceCurveData
DateListLogPlot                LogGammaDistribution             SplicedDistribution
DateListPlot                   LogisticDistribution             StableDistribution
DateListStepPlot               LogLinearPlot                    StringFreeQ
DavisDistribution              LogLogisticDistribution          StringMatchQ
DirichletDistribution          LogLogPlot                       StringPartition
Downsample                     LogNormalDistribution            StringPosition
EmpiricalDistribution          LogPlot                          StringReplace
ErlangDistribution             MarchenkoPasturDistribution      StringReplacePart
Expectation                    MarginalDistribution             StudentTDistribution
ExpGammaDistribution           MaxStableDistribution            SurfaceData
ExponentialDistribution        MaxwellDistribution              SuzukiDistribution
ExponentialPowerDistribution   MeixnerDistribution              TransformedDistribution
ExtremeValueDistribution       MinStableDistribution            TriangularDistribution
FareySequence                  MixtureDistribution              TruncatedDistribution
FisherZDistribution            MortalityData                    TsallisQExponentialDistribution
FRatioDistribution             MoyalDistribution                TsallisQGaussianDistribution
FrechetDistribution            MultinomialDistribution          TukeyLambdaDistribution
GammaDistribution              MultinormalDistribution          UniformDistribution
GeometricDistribution          MultivariateTDistribution        UniformSumDistribution
GompertzMakehamDistribution    NakagamiDistribution             Upsample
Graph                          NegativeBinomialDistribution     VarianceGammaDistribution
GumbelDistribution             NegativeMultinomialDistribution  VoigtDistribution
HalfNormalDistribution         NoncentralBetaDistribution       Volume
HighlightImage                 NoncentralChiSquareDistribution  VonMisesDistribution
HistogramDistribution          NoncentralFRatioDistribution     WakebyDistribution
HotellingTSquareDistribution   NoncentralStudentTDistribution   WeibullDistribution
HoytDistribution               NormalDistribution               WignerSemicircleDistribution
HyperbolicDistribution         Nothing
HyperexponentialDistribution   OrderDistribution

Experimental in 10.4
Similarly, one can go hunt for functions marked "experimental" since these carry the "[[EXPERIMENTAL]]" indication in the header of their help file. This is slighlty more complicated because it turns out that the [[EXPERIMENTAL]] header is actually a graphics expression, rather than formatted text. Again, inspection of the notebook help file for one such function hinted at the following code snippet as a pretty reliable indicator of the presence of this header in a text search:
{Thickness[0.006944444444444444], FaceForm[{RGBColor[0.5, 0.5, 0.5],

Again using grep allowed me to identify the following list of currently experimental functions:
$SourceLink                    DimensionReduction
Ask                            DynamicGeoGraphics
AskAppend                      DynamicImage
AskConfirm                     FindFormula
AskDisplay                     FoldPair
AskedQ                         FoldPairList
AskedValue                     LocalObject
AskFunction                    LocalObjects
AskTemplateDisplay             PartProtection
Autocomplete                   SearchIndexObject
AutocompletionFunction         SearchIndices
CachePersistence               SourceLink
CloudExpression                TextCases
CloudExpressions               TextElement
ClusterClassify                TextPosition
Containing                     TextSearch
ContentObject                  TextSearchReport
CreateCloudExpression          TextStructure
CreateSearchIndex              UpdateSearchIndex
DeleteCloudExpression          WordTranslation
DeleteSearchIndex              ZoomCenter
DimensionReduce                ZoomFactor
DimensionReducerFunction

To address the suggestion to use the experimental TextSearch, here is my understanding of the best method to do so. I first attempted to run a text search for "\"NEW in 10.4\"" on all files in the "Symbols" directory mentioned above:
TextSearch[FileNames[All, {pathToSymbolsDir}], "\"NEW in 10.4\""];

This ran for close to 10 min before returning a result. Pretty much a non-starter.
Then again, this is probably not the way TextSearch was intended to be used; it should really be used with a pre-generated SearchIndexObject. So I generated a search index from those files once and for all, then ran TextSearch using the index. Once the index is generated, which was still quite time consuming, the search itself worked a lot better:
index = CreateSearchIndex[pathToSymbolsDir]; // AbsoluteTiming
(*Out: {1084.54, Null} *)

It took 18 minutes to generate the index on a reasonably powerful SSD-equipped laptop. Each search after that was quite quick and led to the same result as grep:
#["FileName"] & /@ TextSearch[index, "\"NEW in 10.4\""]

{"$SourceLink.nb", "MixedMagnitude.nb", "ZoomCenter.nb", "DynamicGeoGraphics.nb",
 "AskedQ.nb", "PerfectNumberQ.nb", [...], "DifferenceQuotient.nb", "ClusterClassify.nb",
 "GreenFunction.nb", "PlanarGraph.nb"}

A: Remember that WolframLanguageSymbol entities always return the state of latest version of the Wolfram Language; not the version of the language you currently have installed.
The Entity function calls appear to be returning the correct information when you take this into consideration.
New in 10.4
EntityList[Entity["WolframLanguageSymbol", {"FullVersionIntroduced" -> "10.4"}]]

New in 10.3
EntityList[Entity["WolframLanguageSymbol", {"FullVersionIntroduced" -> "10.3"}]]

Updated in 10.4
EntityList[Entity["WolframLanguageSymbol", {"FullVersionLastModified" -> "10.4"}]]

Experimental in latest version of the language.
EntityList[EntityClass["WolframLanguageSymbol", "Experimental"]]

Update for 11.0.1 "UnderDevelopment" class has been changed to "Experimental" class. In  11.0.1 this class does not appear in EntityClassList["WolframLanguageSymbol"] but it is available.
Hope this helps.


text:
Q: Is C++.Net used extensively? I am a C++ coder by tradition. Over the last 12 months or so I have been doing a lot of C#  coding, and have been pleasantly surprised by C#'s pragmatic approach (once I stopped trying to code it as if it was "C++ with garbage collection").
We have recently had some graduates in and when helping one of them I realised she was using .Net within C++. After asking her why, she said she had been "told to use C++ by her manager". Obvious communication problem aside, I assume she was using .Net because that's the only framework she's been exposed to.
I then came across an old project by a senior developer who also used C++ to drive a Forms front end. Now this would have been written around the time .Net first appeared, so I assume it was a learning exercise on his part to play around with .Net. It was only a small utility app.
Having had to do some minor modification in this app, it seemed to me that using C++ to drive .Net gives you the worst of both worlds. No garbage collection or memory safety, but no similarly no real speed/optimisation opportunities since you're dealing with a managed framework.
So my question is whether people do use C++ .Net for any large stand alone (ie non-plumbing) production code, and if so what are your reasons for doing so? I freely admit I have never delved deeply into the C++ .Net extensions so I may be doing it a disservice.

A: C++.NET (or, precisely, C++/CLI) does have garbage collection, just like everything else that runs atop .NET. To achieve this while remaining compatible with C++ proper, it uses ^ syntax and gcnew for garbage-collected ('safe') pointers.
C++/CLI is considered an abomination by many, it's significantly more unpleasant to work with than either C# or C++ proper, and also more complicated than either (simply because it brings the complexity of C++ itself to the table and adds what it takes to work with .NET to the mix). Learning C# usually pays off even within the scope of a single medium-sized project. However, there is one thing it can do that neither C# nor native C++ can do: compile existing C++ against .NET and have it talk to other .NET components.
Consequently, it doesn't make much sense to use C++/CLI for a from-scratch project - anything .NET related that can be done with it can also be done in C#, with much nicer syntax and the added safety of not exposing raw pointers by default. Its most prominent raison-d'etre is porting existing codebases to .NET. A company that decides to start using .NET, but unwilling (or unable due to resource and time constraints) to rewrite every piece of software they have produced so far, can use C++/CLI to keep using their existing codebase with only minimal changes, and then rewrite components of their system in C# one by one. At least that's the theory; I have never seen it done in practice myself, so I can't tell how well it works.
Also note that C# itself can interface with native libraries, so even if you have to use existing C++ codebases, you don't necessarily have to recompile them against .NET: often, interfacing with them through COM or P/Invoke is the better solution.


text:
Q: Get page IDs from nav items I am trying to get all the IDs in my navigation and convert it to a string so that I can use it with wp_query to get the pages that are only listed in the nav. The code to get the IDs:
$menu_name = 'primary';

if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] )) {
    $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
    $menu_items = wp_get_nav_menu_items($menu->term_id);
}

foreach ( $menu_items as $menu_item ) {
    $numbers[] = $menu_item->ID;
}

$number = implode(',',$numbers);

But it is returning the wrong numbers. When I go to the admin area and hover my mouse over the pages, the number that shows up in the address bar on the bottom of the screen doesn't match. What am I doing wrong?

A: Menu items are stored in the posts table with a post_type of nav_menu_item. So, what you are returning is the ID of the menu item itself, not what it points to.
The page/post ID that the menu item refers to is stored in the postmeta table, with a post_id that matches the menu item ID and meta_key = _menu_item_object_id. The easiest way to get the meta_value (ie the page being pointed to by the menu item) is to use something like this:
$numbers[] = get_post_meta( $menu_item->ID, '_menu_item_object_id', true );

A: I wouldn't be able to tell you when this change happened but as of WordPress version 5.2.4 you can use object and object_id to retrieve the page ID. Here's how I would do this:
/**
 * The `0` is added as a default case.
 * In case our menu does not contain any pages this
 * will prevent our query from returning all pages
 */
$page_ids           = array( 0 );
$registered_menu    = 'my_registered_menu';
$locations          = get_nav_menu_locations();

if( ! empty( $locations ) && isset( $locations[ $registered_menu ] ) ) {

    $menu = wp_get_nav_menu_object( $locations[ $registered_menu ] );
    $menu_items = wp_get_nav_menu_items( $menu->term_id );

    if( ! empty( $menu_items ) ) {

        foreach( $menu_items as $item ) {

            // Only grab page IDs
            if( 'page' !== $item->object ) {
                continue;
            }

            $page_ids[] = $item->object_id;

        }

    }

}

$page_query = new WP_Query( array(
    'post_type'     => 'page',
    'post_status'   => 'publish',
    'no_found_rows' => true,
    'post__in'      => $page_ids,
    'posts_per_page'=> 100, // Large upper limit
) );


text:
Q: How best to horizontally align ruby on rails form text_fields? I have the following form in one of my view files, however the date of birth fields, day, month and year are staggered when it is actually rendered. That is each successive field is shown down and to the right of the preceding field. I want them to appear horizontally next to one another. It works if I do not have any form labels.
  <div class="date-input form-group" id="dob">
    <%= form.label :dob_day, :class =>"date-input-label" %>
    <%= form.text_field :dob_day, id: 'dob_day', :class =>"date-input-item" %>
    <%= form.label :dob_month, :class =>"date-input-label" %>
    <%= form.text_field :dob_month, id: 'dob_month', :class =>"date-input__item" %>
    <%= form.label :dob_year, :class =>"date-input-label" %>
    <%= form.text_field :dob_year, id: 'dob_year', :class =>"date-input-item" %>
  </div>

I have tried to put the labels and text_fields into their own tables and using CSS cell padding to try and space them appropriately but they need individual spacing to do that and not something I can just apply equally to each cell.
Am I missing something in rails that will do this for me? Or do I need to apply inline css styling to each cell to achieve this effect?

A: You could use Simple Form
Then:
rails generate simple_form:install --bootstrap
and in your view:
<%= simple_form_for @someting, wrapper: :inline_form, html: { class: 'form-inline' } do |form|%>
 <%= form.input :dob_day, id: 'dob_day', :class =>"date-input-item" %>
 <%= form.input :dob_month, id: 'dob_month', :class =>"date-input__item" %>
 <%= form.input :dob_year, id: 'dob_year', :class =>"date-input-item" %>
<% end %>


text:
Q: GroovyScriptExecutionException Whenn Trying to use lat_lon: true inside geo_points mapping in Elasticsearch? I was using geo_point type in elasticsearch and i defined its mapping as this
location          : {"type":"geo_point"},

now when i was trying to use script_ields like this
script_fields : {
      distance : {
        script : "doc['location'].arcDistanceInKm(12.34,23.12)"
      }
    }

Everything was working fine but now when i changed my mapping type to this for indexing lats and longs also (because i want to use bounded box now)
location          : {"type":"geo_point", "lat_lon":true},

now when i am trying to use above script i am facing below error
GroovyScriptExecutionException[ElasticsearchIllegalArgumentException[No field found for [location] in mapping with types [restaurant]]]

Where restaurant is the type of my index.
Now can anyone please tell me why i am getting this Error and how can i solve this It will be really really helpful if you guys just put just a little light on this problem.
Thank You In Advance.

A: In your mapping you have shop_type: { properties:{ location : {"type":"geo_point"} } }. Why does the exception refer to restaurant type but your mapping shows shop_type as the type?
You may want to check the correctness of your query and make sure the right type is being queried.


text:
Q: Conditionally Displaying Blocks In Product Page Tabs I'm changing the front-end layout of a Magento 1.5 site, and I'm trying to move my products' reviews from being a separate page to being one of the 'more information' tabs on the lower part of the product page in the catalog. As a result, I want to make this tab's contents conditional - I want the tab to display existing reviews when they exist, but to display the review-creating form when the product has no reviews yet.
Here's what I've tried so far, the pieces I'm trying to put together.
/app/design/frontend/our-site/default/review.xml:
<catalog_product_view translate="label">
    Catalog Product View
    <reference name="product.info.tabs">
        <action method="addTab" translate="title" module="review">
            <alias>product.reviews</alias>
            <title>Reviews</title>
            <block>review/form</block>
            <template>review/form.phtml</template>
        </action>
    </reference>
</catalog_product_view>

This XML results in the 'leave your review' form being displayed under a tab called "Reviews" on the product page.
I tracked down the 'addTab function in /app/code/core/Mage/Catalog/Block/Product/View/Tabs.php and I can kinda-sorta see how that works.  However, I don't think I've seen a way to use the XML to be conditional about what should be displayed on a page.
I noticed that the summary.phtml file does something like what I want: it has:
if ($this->getReviewsCount()): ?>

        <?php if ($this->getRatingSummary()):?>

                <div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%">

    <?php endif;?>

             <a href="<?php echo $this->getReviewsUrl() ?>"><?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?>
             |
             <a href="<?php echo $this->getReviewsUrl() ?>#review-form">
                 <?php echo $this->__('Add Your Review') ?>

<?php elseif ($this->getDisplayIfEmpty()): ?>

        <a href="<?php echo $this->getReviewsUrl() ?>#review-form">
            <?php echo $this->__('Be the first to review this product') ?>

<?php endif; ?>

That looks like it has conditional functions for 'do this if there are reviews, do otherwise if there are no reviews.  How can I invoke that earlier in the rendering chain to decide what the contexts of the block that gets rendered into the page will be?  Is this a task that needs to be done in the phtml part of in the XML part?

A: You will probably need to create your own phtml file, copy that summary one as a starting point, but in the else, instead of rendering a link render the Block that is included on that other page. You can then adjust the xml file for that block to tell it you use your new template file by replacing the template attribute. You could add the review form block as a child using the xml layout and then use echo $this->getChildHtml('as_field_of_block');, or alternatively just hard code this into the template. The former option is probably more flexible, but will require a little extra tweaking of the xml.


text:
Q: Creating dynamic frames in JSP Hi
 I am new to front end development using JSPs. I have a question. In my project, I have to a form with a drop down box and 4 submit buttons for different actions. When a choose a value in the drop down box and click 1 of the submit buttons, another drop down box with a submit button should appear.When I choose an option in the second drop down box and click submit, data from the database should be queried and displayed in the same page. It is the same with the 3 other submit buttons too. How best to implement this? I am not using any frameworks- only jsp and servlets. My idea is to use 2 iframes in the jsp which display the dynamic data.

A: You can create one big form containing data for all possible fields no matter which option is selected. Submit the form with necessary fragment filled for any selected option. Then on server just check what is selected and process the data accordingly.


text:
Q: Browser stops working for a while after synchronous ajax call in a for loop This is my code:
for (var i = 0; i < 2; i++) {
    $.ajax({
        type: "GET",
        async: false,
        url: "/MyController/MyMethod",
        success: function (data) {
            if (i == 0) {
                $('#result_progress').hide();
                $('#result_msg').hide();
                $('#details').show();
            } else if (i == 1) {
                $.ajax({
                type: "GET",
                async: true,
                url: "/Import/Finish",
                success: function (data) {
                        ....
                });
            }
            if (i < 2) {
                $('#details').html($('#details').html() + 'someText'));
            }
        }
    });
}

In this example the iteration is small, but I made the method simpler here. I know that I can use switch, but that's not the point. In reality it is with much bigger number of loops. Nevermind that, the error happens for this code too.
Here's what happens:
if I put breakpoint in the success part of the first ajax call and when I debug in Chrome, eveything works fine.
Here's what I mean by working fine: after the method goes in the first success, I want some divs to be hidden and  the message I get as a result from the ajax call to be shown. The second time the first success is entered, another string will be ADDED to the previous.
In the end, when the second success part is entered, that message is hidden and I'm showing some data.
And this is what happens:
everything is fine until MyMethod is called. When it gets called, the browser stops working. If I press my left mouse key, nothing happens. When MyMethod is called for the last time, the browser works fine, I get quick glimpse of the message and then it shows the data from the second ajax call. And the message that I see shortly is the whole message, from all the calls to MyMethod, which shouldn't happen.
I want it to be shown for the entire for loop and before the Finish method. And it shouldn't be the same message. It should get bigger with every ajax call to MyMethod.

A: You can use a "recursive" function to help you control flow with asynchronous calls. Instead of running them synchronously, you can run them all asynchronously and then call the function again when it is time for the next one.
Something like:
function doCall(i) {
    if(i > howManyToRun) return;

    $.ajax({
        //...
        succcess: function(data) {
            //...
            //time to start the next one
            doCall(++i);
        },
        error: function() {
            //call the next one on error?
            doCallI(++i);
        }
    })
}

This way they run async, don't block everything while they are calling; but still run in series.