text:
Q: Is there a way to ignore end of file characters while reading files in c++? So I am trying to read a file into a program in C++, but there are random end of files thrown in throughout the file. When trying to read the file, ifstream stops reading when it hits an end of file character.
This is the code that I am using to try to read the file
size_t bytesAvailable = 1000;
std::ifstream file(directory, std::ifstream::in);
unsigned char headDataBuffer[1000];
file.read((char*)(&headDataBuffer[0]), bytesAvailable);

the file I am trying to read gets this far into the file but then stops when it reaches a certain character which I later found out to be an end of file, there is plenty of text afterwards but I can't seem to get ifstream to read anything after the end of file character. Is there a way to read the entire file without having to break it up into smaller chunks?
Firsts few lines of the file
˜1È£….ƒÑäÄÕ!õÏ]ÀåM"Ú2jó8ÒQ;Fb#Ãë»Cé' 1³¸)æ¸)¼™Â¢¼mí¾J"ÜT'S·Õ}xÇ\'Ò¬Ëëk|&cõe´"[zÊN4äHH•Æpé€i‹,ɶ‰v%••¡ÁÎ:ïÂOÚåÀ‡É=wí7iÓOQ3Fg,'¹ªGô"(stops right here) I9á¸"æ£/¼™Ù£«|¿¿FI€À^' '2 tÁ[;Åéúî2`9es¹Va°ÝNe-˜1È´'},••°ÛÙuòŸLÚቜÕ/9ñ7,Õ[uv/†í]¼CúŸ

A: Try opening the file in binary mode.  On some platforms, text mode and binary mode behave differently, such as the text mode interpreting end-of-line into LF, or interpreting a control character (possibly Ctrl+D or Ctrl+Z) as an end-of-file.
size_t bytesAvailable = 1000;
std::ifstream file(directory, std::ifstream::in|std::ifstream::binary);
unsigned char headDataBuffer[1000];
file.read((char*)(&headDataBuffer[0]), bytesAvailable);


text:
Q: Request and Session bean life cycles in Spring Will it be safe to use a bean, with request or session scope, asynchronously in a separate thread that is created from the main thread that handles a request?
I was wondering what will happen if a request completes or a session expires and the child thread is still active. Will spring destroy the bean or is it aware that the bean is still in use.
I'm just familiarizing myself with bean scopes and life cycles in spring. Please pardon my noobness.

A: Short answer: it is not safe, copy the information you need to do your asynchronous processing.
Long answer: Spring implements request scoped beans using proxies.  This proxy is what gets injected into your classes.  Whenever you call a method on this proxy, Spring will look up the actual bean that is valid for the current request (using a ThreadLocal mechanism) and then delegate the call to the correct instance.
As soon as the request thread finishes though, the associated request scoped beans are cleared (so as not to interfere with the next time the same thread is used for a different request).  They're not "destroyed", but since you only have an indirect reference to them (through the proxy that gets injected) they're effectively unaccessable and will get garbage collected.
If after the request has finished you try to call one of the methods on the proxy and there is no valid request anymore, Spring will throw you an exception.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Create a list containing specific data R The following are two list nested within a bigger list.
I want to create a new list(I assume this is the best output, but other suggestions are welcome!) that only has the data relating to malaria.
I have no code to share as I have no idea how to do this! Thanks in advance.
list(structure(c("Condition", "Malnutrition", "Anaemia", "Pneumonia",
"Uncomplicated malaria", "Diarrhoea with Blood", "Other diarrhea",
"Total", "2001", "118", "243", "1592", "4969", "134", "423",
"7479", "2002", "9927", "18933", "98068", "302891", "21724",
"48610", "500153", "2003", "7232", "18933", "68418", "227034",
"13369", "35083", "370069", "2004", "6896", "98068", "74769",
"215533", "12198", "46265", "453729", "Total", "334156", "136177",
"242847", "750426", "47425", "130381", "1641412"), .Dim = c(8L,
6L)),
structure(c("Condition", "Uncomplicated malaria", "Diarrhoea with Blood",
"Other diarrhea", "Pneumonia", "Hypertension", "Diabetes", "Cataracts",
"Asthma", "Scabies", "Mental Disorder", "2001", "209182", "7306",
"12800", "27832", "13573", "231", "614", "2857", "15596", "1326",
"2002", "264785", "17662", "27739", "54454", "24759", "1009",
"1092", "7470", "43741", "2298", "2003", "227034", "8225", "2003",
"38233", "18790", "551", "526", "5819", "22077", "1627", "2004",
"215533", "7605", "2004", "41128", "23329", "690", "834", "5583",
"23784", "1954", "Total", "916534", "40798", "44546", "161647",
"80451", "2481", "3066", "21729", "105198", "7205"), .Dim = c(11L,
6L))

A: Edit based on op feedback:
Looking at your example first we need to trasform each list element in a data.frame with the correct colnames:
library(purrr)
library(dplyr)

col_names_list <- lapply(dat, function(x) x[1, ]) # we extract the first row (colnames)

dat <- lapply(dat, function(x) as.data.frame(x[-1, ])) # change to data.frame format

dat <- map2(dat, col_names_list, function(x,y) {colnames(x)[1] <- y[1]
                                                x})
# change the colname in data.frame only for the first column (named "Condition")

With map we can then extract what we need:
dat %>%
  map(function(x) x[grepl("malaria", x[,1]),, drop = FALSE])

# [[1]]
# Condition 2001   2002   2003   2004  Total
# 4 Uncomplicated malaria 4969 302891 227034 215533 750426
#
# [[2]]
# Condition   2001   2002   2003   2004  Total
# 1 Uncomplicated malaria 209182 264785 227034 215533 916534

Data used:
dat <- list(structure(c("Condition", "Malnutrition", "Anaemia", "Pneumonia",
                 "Uncomplicated malaria", "Diarrhoea with Blood", "Other diarrhea",
                 "Total", "2001", "118", "243", "1592", "4969", "134", "423",
                 "7479", "2002", "9927", "18933", "98068", "302891", "21724",
                 "48610", "500153", "2003", "7232", "18933", "68418", "227034",
                 "13369", "35083", "370069", "2004", "6896", "98068", "74769",
                 "215533", "12198", "46265", "453729", "Total", "334156", "136177",
                 "242847", "750426", "47425", "130381", "1641412"), .Dim = c(8L,
                                                                             6L)),
     structure(c("Condition", "Uncomplicated malaria", "Diarrhoea with Blood",
                 "Other diarrhea", "Pneumonia", "Hypertension", "Diabetes", "Cataracts",
                 "Asthma", "Scabies", "Mental Disorder", "2001", "209182", "7306",
                 "12800", "27832", "13573", "231", "614", "2857", "15596", "1326",
                 "2002", "264785", "17662", "27739", "54454", "24759", "1009",
                 "1092", "7470", "43741", "2298", "2003", "227034", "8225", "2003",
                 "38233", "18790", "551", "526", "5819", "22077", "1627", "2004",
                 "215533", "7605", "2004", "41128", "23329", "690", "834", "5583",
                 "23784", "1954", "Total", "916534", "40798", "44546", "161647",
                 "80451", "2481", "3066", "21729", "105198", "7205"), .Dim = c(11L,
                                                                               6L)))


text:
Q: Can different branches each have their own URL for submodules and still easily switch? I have a submodule in git, and I want to be able to have different branches have different URLs for this submodule, specified in .gitmodules. I know that's possible, but whenever I switch between these branches now it's a whole process to get the submodule onto the right hash. I have to deinit the submodule, delete the modules pathway under .git/, and then reinit, which takes a while. Is there an easier way to switch branches and get on the right hash, considering each branch uses a different submodule URL?

A: Branches—by which I mean branch names—are not relevant here.1  What matters are the commits ... and, unfortunately in your own case, the specific patterns with which you check out each commit.
A submodule is nothing more or less than a separate Git repository.  If you don't have the submodule yet, Git has to run git clone to get it, and Git finds the instructions for that git clone command by combining the information in some specific commit in the form of a gitlink—a path like path/to/submodule whose entry is mode 160000, i.e., a gitlink, with some hash ID—plus information in that same commit in a file named .gitmodules.
Let's take an illustration for example.  Suppose the super-repository is named super, and in commit a123456, path/to/sub has mode 160000 and says commit 5555555.  You clone the superproject and check out commit a123456.  The submodule is not yet cloned, but the index for the superproject says "we need commit 5555555 for path/to/sub" at this point.
If you now run git submodule update --init (or have used recursive clone which does this for you), Git now notices that, hey, the repository isn't cloned yet, so it looks in .gitmodules for path/to/sub to find the instructions for cloning it.  It then runs git clone with (in effect) --no-checkout, then enters the submodule and checks out commit 5555555 (by raw hash ID).
But now path/to/sub is associated with a submodule that is cloned.  Let's say you now check out commit b789abc in super and it says "use commit 5678567".  That goes into Git's index (for super: the submodule sub index and working tree are as yet untouched).  If you now run git submodule update, or have turned on recursive checkout (which does this for you), Git notices that the submodule is already cloned, and does not bother to look in the .gitmodules file from b789abc.
Note that, had you not run git submodule update --init while on commit a123456, the submodule would not yet be cloned.  So actions in super would now look at the .gitmodules file as it appears in commit b789abc, which might have a completely different URL.  Git would then clone that URL and look for commit 5678567 there.
This is the problem you're trying to work around.  There isn't a workaround for it, other than the horrible manual process you have been using.
(The usual term for this problem is that you have a "path-dependent outcome".  Git doesn't expect this and just doesn't handle it properly.)

1In particular, multiple branch names can point to the same commit.  If main and develop both point to commit a123456, it won't matter which name you use, as you get commit a123456 either way.  Branch names move over time, so just because main identifies a123456 today does not mean it will identify a123456 tomorrow.

A: One solution would be to use a different submodule name for each of the different source URLs.
For example, assume that I sometimes want to use package pkg from source url_a, and sometimes use pkg acquired from source url_b. I would first create two independent submodules pkg_from_a and pkg_from_b in my repository:
git submodule add <url_a> pkg_from_a
git submodule add <url_b> pkg_from_b

Now I have two independent submodules, but how do I select the one in use? That is done by creating a symbolic link pkg which points to either pkg_from_a or pkg_from_b as required. For instance, if I start from a branch which should use pkg_from_a, I would create and commit the link like this:
ln -s pkg_from_a pkg     # NOTE: Unix syntax for creating a symbolic link
git add pkg
git commit pkg

Modifying the link is all that would be necessary to switch between the two submodules. The link can change on a commit-by-commit basis, so different branches can easily use pkg sourced from different locations.


text:
Q: Hadoop Mapreduce using FileChannel, FileInputStream I want to use FileChannel in Hadoop Reducer for fast retrieval the data from file. With it, I can use MappedByteBuffer to map parts of file to memory. It is faster than other APIs when reading data (At least much faster than DataInputStream). However, I cannot find any solution to get FileChannel object from Hadoop API. Currently, I only find FSDataInputStream to read data from file.
How can I solve that?


text:
Q: Angular2 mouseover or mouseleave causes app's bindings to refresh So I am using angular2 RC4, when I bind these events, all elements bindings on the page is refreshed, This is annoying b/c I have video content that restarts from the beginning. I didnt see this issue anywhere else, so I could be doing something wrong.

//FrontPage
import template from './FrontPage.html';

@Component({
  selector: 'front-page',
  template,
  directives: [VideosDisplay_New, VideosDisplay_Watch, VideosDisplay_Complete, NavBar, StickyPos, SideBarRight, Carousel, ModalDirective]
})
export class FrontPage {

    public clButton : CLButton;

    @ViewChild('episodeModal') episodeModal: ModalDirective;
    public clickedEpisodeModal : OuNeRe;
    @ViewChild('seriesModal') seriesModal: ModalDirective;
    public clickedSeriesModal : ThCoMe_OuSe;

    constructor (){

        this.clButton = CLButton;
    }

    public navBool : boolean = false;
    public sidebarTop : number = 55;
    public navStyle : string = 'relative';

    public navExpand() : void{
        this.sidebarTop = 55;
        this.navBool = false;
        this.navStyle = 'relative';
    };

    public navCollapse() : void {
        this.sidebarTop = 10;
        this.navBool = true;
        this.navStyle = 'absolute';
    };
}

//Carousel
import template from './Carousel.html';

@Component({
  selector: 'carousel',
  template,
  directives: [CollapseDirective, TOOLTIP_DIRECTIVES, CElement, CElementVideos]
})
export class Carousel implements OnInit{

    private currentIndex = 0;
    private skip : number = 0;
    private ouFe : OuFe;
    private results : StdSequence ;
    public ces : any[] = [];

    public constructor (ouFe : OuFe) {
        this.ouFe = ouFe;
    }

    ngOnInit () {

        this.results = this.query(0);

        this.results.observeChanges({
            addedBefore :function(id, fields, before){
                this.results = this.ouFe.fFind({},{limit:6});
            }.bind(this)
        });
    }

    query (skip : number) : StdSequence {
        return this.ouFe.fFind({},{'skip':skip, limit:6});
    }
}

//CElementVideos
import template from './CElementVideos.html';

@Component({
  selector: 'celement-videos',
  template,
  directives: [CollapseDirective, TOOLTIP_DIRECTIVES]
})

export class CElementVideos {

    @Input() src : string = "";
    @Input() caption : string = "NA";

    public constructor (){
    }
}

  <carousel></carousel>

   <celement-videos *ngIf="ce.fDocumentTypes()[1] == 'Videos'" [src]="ce.fGetVideo(0)" [caption]="ce.fTitle()" class="col-sm-2"></celement-videos>

 <video [autoplay]="true" [muted]="true" controls>
  <source [src]="src" type="video/webm">
  <source [src]="src" type="video/mp4">
  <source [src]="src" type="video/ogg">
  Your browser does not support the video tag.
 </video>

So what is up with the mouse events?


text: Q: how to load image path from image gallery? I am using sencha-touch and phonegap in android 2.2, I want to load an image, specified by an image path from the image gallery in android. The loaded image path must be saved in an image folder, the image folder must be saved in sqlite like image/1.jpg. Then I want to load the added image path from sqlite. How can I achieve that?


text:
Q: From where may I download the Flash Builder SDK equivalent to Flash Player 11? I wish to use Stage3D and Context3D in ActionScript. For that I need to download the beta version of Flash Player 11. However, I can't find the equivalent Flash Builder SDK with the mxmlc executable that can compile ActionScript into Flash 11 capable Shockwave Flash files. Any clue as to where I may download it from?

A: You do not need another SDK you need to modify the flex-config.xml file and add additional parameter to your mxmlc command. Look in sdks\4.5.1\frameworks\flex-config.xml and change the target-player node the swf-version to 13 and the node path-element to the correct playerglobal.swc (available on labs.adobe.com).
The compiler parameter is "-target-player=11.0.0" (if your flex-config.xml reflect that version).


text:
Q: Restoring Solr Cloud 4.7 index I have a test environment which is created every morning and then destroyed every night.  Part of the environment is a SolrCloud (version 4.7) instance connected to a remote Zookeeper cluster.
The Solr instance has one shard and around 8 cores. Some of the core indexes are reasonably large in size (~1.2GB) so it takes a while to build the index from scratch each morning.
To avoid the delay, I am trying to backup the index each day and then restore it in a brand new Solr instance the following day.
To backup I am just calling curl localhost/solr/mycore/replication?command=backup&location=/tmp/backup
I then move the backup files to some permanent storage.
This works fine.
In the morning, a new Solr instance starts up with nothing in its index. I then copy the index backup files to this new instance in to the correct location and restart Solr.
However, after the restart, Solr does not show that the num of docs in the index has increased. If i look at the replication statistics in the web console of solr i can see the following for my mainindex version = 0, gen = 1 and size = 1.2GB. This size attribute seems to indicate its 'seeing' the files i've restored but not counting them as part of the index.
Zookeeper is permanently up so if i look at my solr cloud graph i can see the solr instance that was destroyed the previous day as 'Gone'.  I don't know if this is relevant.
I would like to know how I can get Solr to recognize by restored backup files.


text:
Q: Blocking IP address using ufw vs blocking IP address from apache? I have a website, and I want to block specific IP address from accessing my site. I have found two ways to prevent a particular IP address.
Using ufw, I can execute ufw deny from 123.123.123.123 to any port 80 proto tcp.
Or I can add deny from 123.123.123.123 in my apache configuration file. Which one is the best method and to avoid a specific IP address from accessing my website.

A: ufw uses the kernel Netfilter for filtering traffic, that is likely to be higher performance than blocking in an application such as Apache so I would normally recommend blocking at the firewall level.


text:
Q: the .text method from requests-html is returning the text of the entire page instead of just one element I'm trying to practice webs scraping locally using requests-html and an eBay page.
Whenever I try to return the text of an element all I get is a ton of text I didn't want(I think the entire text on the page).
This is the URL I downloaded for use offline: https://www.ebay.com/sch/CPUs-Processors/164/i.html?_geositeid=0&_sop=1&_dmd=1&_ipg=240&_fosrp=1&_oaa=1&_nkw=%22ryzen%22&_dcat=164&rt=nc&LH_ItemCondition=1000%7C1500%7C2500%7C3000&_udlo&_udhi=110&LH_AllListings=1&LH_PrefLoc=3
So far, I've been able to reproduce the output by just importing the library, defining the html to be parsed, and then running the code snippet below.
Below is my code where I use the method on an element that is supposed to return "Pre-Owned".
from requests_html import HTML

doc = '''<The entire HTML directly copied from view source on the website>'''

html = HTML(html=doc)

element = (html.find('#item2b11be4226 > div:nth-child(3)', first=True)) #If I print just the element it will return an object of type element, the right element I believe
print(element.text) #but when I print this it returns all kinds of text that is not associated with the element I'm looking for

But instead the output looks like this:
Brand New
$100.00
or Best Offer
Free shipping
3 Watching
Watch
AMD Ryzen 9 3900X box only
Open Box
$10.00
or Best Offer
+$7.65 shipping
Watch
AMD CPU Ryzen 5 1600 3.2GHz Processor
Pre-Owned
1 product rating
$90.00
or Best Offer
+$20.00 shipping
Watch
AMD RYZEN 5 2600 fan only read description
Open Box
$25.00
or Best Offer
+$10.00 shipping
Watch
New listing AMD YD190XA8AEWOF Ryzen Threadripper 1900X (8-core/16-thr
ead) Desktop Processor
Pre-Owned
6 product ratings
$109.99
Buy It Now
+$13.18 shipping
Watch
5 new & refurbished from $190.00
New listing AMD Ryzen 3 1200 3.1GHz Quad-Core Processor (YD1200BBAEBOX
) With Cooler In Box
New (Other)
58 product ratings
$82.25
or Best Offer
Shipping not specified
Watch
2 new & refurbished from $236.99
From Canada
Tell us what you think
eBay determines this price through a machine learned model of the product's sale prices within the last 90 days.
eBay determines trending price through a machine learned model of the product's sale prices within the last 90 days. "New" refers to a brand-new, unused, unopened, undamaged item, and "Used" refers to an item that has been used previously.
Top Rated Plus

Sellers with highest buyer ratings
Returns, money back
Ships in a business day with tracking
Learn More
Top Rated Plus

Sellers with highest buyer ratings
Returns, money back
Ships in a business day with tracking
Learn More
Search refinements
Categories
All
Computers/Tablets & Networking (1,149)
Computer Components & Parts (1,013)
Fans, Heat Sinks & Cooling (418)
Motherboards (299)
CPUs/Processors (134)
Memory (RAM) (62)
Laptop Replacement Parts (29)
Other Components & Parts (24)
Power Supplies (20)
Motherboard Components & Accs (13)
Motherboard & CPU Combos (7)
Interface/Add-On Cards (6)
Computer Cases & Accessories (1)
Graphics/Video Cards (1)
More
Clothing, Shoes & Accessories (182)
eBay Motors (109)
Home & Garden (31)
Consumer Electronics (25)
Collectibles (5)
Business & Industrial (4)
Crafts (2)
Video Games & Consoles (1)
Sporting Goods (1)
Books & Magazines (1)
Show more
Number of Cores
see allNumber of Cores
12 (2)
4 (21)
6 (41)
8 (26)
Socket Type
see allSocket Type
Socket AM2 (5)
Socket AM2+ (5)
Socket AM3 (4)
Socket AM4 (88)
Processor Type
see allProcessor Type
Ryzen 3 (17)
Ryzen 5 (51)
Ryzen 7 (27)
Ryzen 9 (4)
Ryzen Threadripper (2)
Brand
see allBrand
AMD (110)
Unbranded (21)
Processor Model
see allProcessor Model
AMD A10-5700 (13)
AMD Ryzen 3 2200G (6)
AMD Ryzen 5 1600 (7)
AMD Ryzen 5 2400G (1)
AMD Ryzen 5 2600 (14)
AMD Ryzen 5 2600X (5)
AMD Ryzen 7 1700 (8)
AMD Ryzen 7 2700X (7)
L3 Cache
see allL3 Cache
16 MB (44)
4 MB (8)
3 MB (5)
32 MB (5)
8 MB (5)
L2 Cache
see allL2 Cache
4 MB (23)
3 MB (22)
2 MB (17)
Bus Speed
see allBus Speed
100 MHz (15)
3200 MHz (8)
3400 MHz (3)
4800 MHz (8)
Clock Speed
see allClock Speed
More than 3.5 GHz (53)
Not Specified (51)
Guaranteed Delivery
see allGuaranteed Delivery
No Preference(filter applied)
1 Day Shipping
2 Day Shipping
3 Day Shipping
4 Day Shipping
Condition
see allCondition
New(filter applied)
Open box(filter applied)
Seller refurbished(filter applied)
Used(filter applied)
Price
Please provide a valid price range
Under $110.00 (filter applied)
$ Enter minimum price to $ Enter maximum price

Format
see allFormat
All Listings(filter applied) (134)
Auction (78)
Buy It Now (67)
Item Location
see allItem Location
Default
Within
Within
2 miles
5 miles
10 miles
15 miles
25 miles
50 miles
75 miles
100 miles
150 miles
200 miles
500 miles
750 miles
1000 miles
1500 miles
2000 miles
of Enter your ZIP code  Go
Please enter a valid zipcode
US Only
North America(filter applied)
Worldwide
see allSeller
Seller
Delivery Options
see allDelivery Options
Free shipping
Show only
see allShow only
Free Returns
Returns accepted
Completed listings
Sold listings
Deals & Savings
More refinements...
Additional navigation

and there's more but it's already past the max amount of characters for this post.

A: I had a similar problem.
If your python version is 3.9, you might try downgrading to 3.8.
This solved the problem for me.

A: This was happening to me, it didn't work with Python 3.9.
It drove me crazy for two days.
I've downgraded it to Python 3.6 and now is working fine.
Just on a local Environment will be enough.

A: You should use .text for "element" attribute of the .find() method result
result = html.find('#item2b11be4226 > div:nth-child(3)', first=True)
result_text = result.element.text


text:
Q: Slow sftp.mget when pulling a large number of files (10,000+) We are pulling thousands of files (10,000+) from a remote server by a wildcard.  The files are small, and the performance of the transfer itself fine.  However, the implicit "ls .856" performance is awful.  Supposedly the file listing logic has an implicit sort, so the large number of files has significant overhead. Ideally, mget would start transferring as soon as it finds the first match.
Any suggestions or thoughts on how to do this better?


text:
Q: Call JavaScript from within an ASP.NET MVC Partial View I have created an ASP.NET MVC partial view and I am calling it via the HTML.Action helper method:
@Html.Action("GetMyPartialView", "MyController", new { myParameter})

The partial view contains a control that needs some JavaScript to be called (a JavaScript library in an external JavaScript file).
How can I call this JavaScript code from within my partial view.
I tried using the script element inside the partial view:
<script>
    MyJavaScriptFunction();
</script>

This did not work. Probably the external JavaScript files (e.g. jQuery) have not been loaded at that time.
What is the recommended way to execute JavaScript code when a partial view has been rendered?

A: You cannot use java script sections in partial views. They simply don't work. So keep the @section JavaScript in the main view in order to register scripts and then render the partial view

A: I had almost similar situation. What i did was added javascript in the main view. You try add javascript in the main view from where you are calling
 @Html.Action("GetMyPartialView", "MyController", new { myParameter})

A: You can use ajax call to achieve this.
$(document).ready(

    //Do ajax call
        $.ajax({
        type: 'GET',
        url: "controller action url",
        data : {
                  //Data need to pass as parameter
               },
        dataType: 'html', //dataType - html
        success:function(result)
        {
           //Create a Div around the Partial View and fill the result
           $('#partialViewContainerDiv').html(result);
        }

//Action
       public ActionResult GetMyPartialView(int myParameter)
       {
         //return partial view instead of View
          return PartialView("YourView", resultSet);
        }

A: I just ran into this problem.  You can call a javascript function in the partial view from within the partial view.  I created a hidden field and defined the onclick event to call the function I needed to call to initialize the dialog in the partial view.  Then I triggered the click event for that hidden field.
Code in partial view:
 <input type="hidden" id="initializeDialog" onclick="initializeDialog();" />

<script>
    function initializeDialog(){
        // Do stuff
    }
</script>

Code in containing view:
<script>
    $('#InitializeDialog').trigger('click');
</script>


text:
Q: Does insulating sphere have a capacitance? A conducting sphere with radius $r$ has capacitance $C=4\pi \epsilon_0 r$. This can be derived as follows:
$$
C=\frac{Q}{V}=\frac{Q}{\frac{Q}{4\pi \epsilon_0 r}}.
$$
Now I am wondering if this applies to a plastic sphere as well. It is always tricky to work with insulators since the value of $V$ is different at different positions.
The whole concept of capacitance becomes doubtful: we define $C=Q/V$, but $V$ is different at different positions, so where should we measure $V$? Also: in electronics, we take $V$ to be the potential difference - but here, $V$ is the potential, NOT a potential difference.

A: No, just for the reason you say:  The potential is not the same at every point on an insulator.  A capacitance measures the voltage difference $V$ per unit charge $Q$ between two opposite assemblages of charge, each at a unique voltage.  (In some cases, the second assemblage of charge may be taken to be on a sphere at spatial infinity, where we known $V=0$.)  Without conductors to even out the voltages involved, there is no way to choose which voltage should appear in the definition of $C$.

A: Spherical Styrofoam pellets and balloons can have capacitance (C) and a voltage gradient (V) because they can retain electrostatic energy (W).
W=1/2 CV^2

A: You do not know $V$ at all - it could be anything assuming it is an ideal insulator. In reality nothing is ideal. The equation you give assumes a uniform distribution of charge, and given enough time the charge would redistribute uniformally over the sphere due to the extremely small - but non zero - conductance of the plastic. This means eventually the equation would be a very good description.
Failing that, it's probably an okay order of magnitude approximation depending on what you're using the result for.


text:
Q: 0 index when generating excel xlsx file using pandas df1=pd.read_csv('out.csv')
df2=pd.read_excel('somefile.xls')

#put columns from df1 to df2

df2['eer']=df1['eer']
df2['wer']=df1['wer']
df2['zer']=df1['zer']
df2['qer']=df1['qer']
df2['der']=df1['der']

#make a new file with somefile.xls columns + the ones above

newfile = input("Enter a name for the combined file: ")
writer = pd.ExcelWriter(newfile)
df2.to_excel(writer)
writer.save()

I have this part of the code at the end of my program using python pandas module, so whenever I generate the new file with all the columns i need, column A has some kind of index going from 0 to the end row, instead of 'Name' which is what somefile's column A is. 'Name' is now column B.
like this
0
1
2
3
4
5
6
7
8
9

A: This question is a dupe of many many others, but all you would do is change
df2.to_excel(writer)

to
df2.to_excel(writer, index=False)


text:
Q: Scrolling Javascript I want to have a website scroll between three different positions on the Y-axis.. Problem is that the scroll eventlistener fires multiple events, so the UI behaviour is shaky..
I tried debouncing it, but no matter how high the wait variable, I still get multiple events fired.. I also tried using a count variable, but this still opens up a window large enough to fire multiple events.
Is there a way to control this behaviour so I can just scroll between the three pageYoffset points in a clean and controlled way?
My code is the following..
HTML

CSS
html {
    background: #e6e9e9;
    background-image: linear-gradient(270deg, rgb(230, 233, 233) 0%, rgb(216, 221, 221) 100%);
    -webkit-font-smoothing: antialiased;
}

#first_part_page{
    height: 50vh;
    background: blue;
}

#inbetween_one{
    height: 20vh;
    background: white;
}

#second_part_page{
    height: 50vh;
    background: blue;
}

JAVASCRIPT
var count = 0;
var lastScrollTop = 0;

if (count == 0){

    count = 1;

    window.addEventListener("scroll", debounce(function(){

        var st = window.pageYOffset || document.documentElement.scrollTop;

            // scroll down code
            if (st > lastScrollTop){

                    if (window.pageYOffset < 10){

                        console.log("down first");
                        $("#first_part_page").velocity("scroll", {delay : 200, duration : 1300, offset: 400});
                    }

                    else if (window.pageYOffset > 300){

                        console.log("down second");
                        $("#first_part_page").velocity("scroll", {delay : 200, duration : 1300, offset: 1400});
                    }

            // scroll up code
            } else if (st <= lastScrollTop) {

                    if (window.pageYOffset < 600){

                        console.log("up first");
                        $("#first_part_page").velocity("scroll", {delay : 200, duration : 1300, offset: 0});
                    }

                    else if (window.pageYOffset > 1000){

                        console.log("up second");
                        $("#first_part_page").velocity("scroll", {delay : 200, duration : 1300, offset: 400});
                    }

            }

                lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling

    }, false), 1000);

    // timeout to prevent the function from repeating for x milliseconds
    setTimeout(function(){

        count = 0;

    }, 3000);

}

function debounce(func, wait, immediate) {
    var timeout;
    return function() {
        var context = this, args = arguments;
        var later = function() {
            timeout = null;
            if (!immediate) func.apply(context, args);
        };
        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) func.apply(context, args);
    };
};


text:
Q: load php data into an element with parameter this is my first time using stackoverflow.com, i almost give up with code problem, i do hope someone could help me to solve my code problem.
here is my problem, i have 2 tables, i load data from database to the 1st table (onload), and i want to have an onclick event on the data row to load the 2nd table, and i want to use the clicked value as a parameter to load the 2nd table.
<!DOCTYPE html>

            empid
            empname
            age

<?php
include ("dbconn.php");
$sql = "select * from employee";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
?>

        <?php echo $row["empid"]; ?>
        <?php echo $row["empname"]; ?>
        <?php echo $row["age"]; ?>

<?php
}
mysqli_close($conn);
?>

<! -- additional table -->

            employee name
            position
            salary

<?php

$sql = "select * from employee_salary where empid = $empid";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
?>

                          <?php echo $row["empname"]; ?>
                                                    <?php echo $row["position"]; ?>
                          <?php echo $row["salary"]; ?>

<?php
}
mysqli_close($conn);

?>

anyone help me please... thank you.

A: Go through the following step :
1) Here your initial page code :

            empid
            empname
            age

<?php
include ("dbconn.php");
$sql = "select * from employee";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
?>

    <tr onclick="getDetail('<?php echo $row["empid"]; ?>')">
        <?php echo $row["empid"]; ?>
        <?php echo $row["empname"]; ?>
        <?php echo $row["age"]; ?>

<?php
}
mysqli_close($conn);
?>

<! -- additional table -->

            employee name
            position
            salary

2) Now make one ajax call on click of employee id like :

3) Here your getData.php file:
    <?php
    include ("dbconn.php");
    $emp_id = $_POST['emp_id'];
    $sql = "select * from employee where empid= $emp_id";
    $result = mysqli_query($conn, $sql);
    $data = '';
    while($row = mysqli_fetch_assoc($result)) {

        $data.='

            '.$row["empid"].'
            '. $row["empname"].'
            '. $row["age"].'

';

    }
mysqli_close($conn);
echo $data; exit;
?>

Let me know if any query, Hope this help!


text:
Q: $2\mathrm{d}$ area maximizing short embeddings Think of a beach ball on an pool of water or sand.
Let $\left(\mathcal{M}^2,g\right)$ be a surface homeomorphic to a sphere, endowed with a Riemannian metric $g$, and $\left(\mathcal{N}^2,h\right)$ a surface with or without boundary (in particular, the Euclidean plane with $h=e$, the standard Euclidean metric), and let $f:\mathcal{M}\longrightarrow \mathcal{N}$ be a short embedding. The energy is simply defined as the area of the embedded surface,
$$
\begin{align}
E\left[ f\right]=\text{Area}\left[ f\left(\mathcal{M}\right)\right].
\end{align}
$$
Is there a local/global maximizer for $E[\cdot]$ under the constraint of $f$ being short ?
(A embedding is short if $f^*h \leq g$, in the sense of quadratic forms.)
(This is, in a sense, a lower dimensional analog of the mylar balloon problem.)

A: If you say map instead of embedding and measure area with multiplicity, then the problem becomes more interesting.
The following analog of Nash--Kuiper theorem was proved by Gromov in his "Partial differential relations":

Let $f\colon M\to N$ be a short map between Riemannian manifolds of the same dimenssion. Then there is arbitrarily close length-preserving map $f_\varepsilon\colon M\to N$.

The provided map is evidently a maximizer.
It is not smooth and typically has creases at everywhere dense subset,
but one can smooth it keeping the area nearly the same.

A: If think yes, because the assumption $f^*h \leq g$ gives pointwise bounds on the derivatives of $f$ : in local charts, $|\partial_i f|^2 \leq g_{ii}$.
So up to translation, you can put the image of $f$ into a big ball, with radius depending on $h,g$ and not on $f$.
So you can consider a minimizing sequence, it will converge to something, but I'm not sure you will get a minimal surface in the end.
If you look at the equation, you will have more terms than the one for minimal surfaces because of the constraint.


text:
Q: PlayFramework2: css not loading on heroku I have a play2 application and have tried to deploy it on heroku .After deployment, the application does not have styles at all. I've re-tested the application on my local/dev machine and all is working fine.
So, Could some one told me how to fix play2 issues with css ?

A: Thanks to all, I've found problem and fixed it. So, short description:
After log analysis I've found some issues in urls like next path=/assets//stylesheets/style.css, so, after deleting one / symbol from url all is started working.
So, as conclusion , local version can work and load resources with additional / symbols in path but heroku cant.


text:
Q: how to get flat binary code address on bare metal? I have the source code of an assembly file that I want to disassemble after converting it to binary so I can set breakpoints in correct locations.
I've tried using objdump with the following command (I'm using an ORG statement, that's why I use --adjust-vma)
objdump -Mintel,i386 -b binary --adjust-vma=0x0500 -D foo.o -m i386 | less

which works to some extent, but it confuses the instructions, for example in my source code I have
    pop bx
    inc bx  ; bx is used in the internal copy_sector_byte loop
    cmp cx, 512
    jne .copy_sector_byte
    pop bx

but it's translated to
 5a9:   5b                      pop    ebx
 5aa:   43                      inc    ebx
 5ab:   81 f9 00 02 75 e7       cmp    ecx,0xe7750200
 5b1:   5b                      pop    ebx

note that the 75 e7 is the binary code on the jne instruction.
can I tell objectdump to use the source file I have in some way (or using another program)? What are your suggestions?
I'm new to assembly. Thank you

A: You can get NASM to make a "listing" when it assembles: nasm -l foo.lst foo.asm (with the default flat-binary output mode, and default output filename of foo).  Or have it write the listing to stdout with nasm -l /dev/stdout foo.asm  | less if you just want to look at it on the fly.
But unfortunately the output doesn't respect the org directive, it's still relative to the image base:
     1                                  org 0x7c00
     2
     3 00000000 31C0                    xor ax,ax
     4 00000002 8ED8                    mov ds, ax
     5
     6 00000004 686869                  push "hi"
     7 00000007 C706[0D00]7879          mov word [var], 'xy'
     8
     9 0000000D 68656C6C6F              var: db "hello"

Or as @MichaelPetch suggested in comments:

Personally I would be generating an ELF version of the kernel file and a binary version. The ELF version can contain the debug information while the binary version will be what is executed.
I'd stop using binary as the output type of a linker script. Just have it generate ELF executable and then convert the ELF executable to a binary file with objcopy. The binary file runs on the remote machine, the ELF file is used in the debugger.
The ELF file can be used by the debugger for symbolic information which is the easiest thing to debug with.
I will say that GDB and QEMU are tricky to debug 16-bit real mode code with since GDB has no real understanding of segment:offset addressing in real mode.

BOCHS has a built-in debugger which does understand segmentation, and has built-in commands for parsing the IDT and GDT instead of just dumping raw bytes.
Michael has recommended BOCHS in the past for debugging bootloaders that switch to protected and/or long mode.


text:
Q: can't join a server to a domain using powershell direct i want to automate adding server to lab environment, i had problem when i tryed to join a server to a domain using power-shell direct :
Enter-PSSession -VMName S2D2 -Credential $cred
Add-Computer -DomainName "yp.org" -Credential  yp.org\administrator

give me this error :
Add-Computer : Computer 'WIN-ORGQD2DH4PU' failed to join domain 'yp.org' from its current workgroup 'WORKGROUP' with
following error message: The specified domain either does not exist or could not be contacted.
    + CategoryInfo          : OperationStopped: (WIN-ORGQD2DH4PU:String) [Add-Computer], InvalidOperationException
    + FullyQualifiedErrorId : FailToJoinDomainFromWorkgroup,Microsoft.PowerShell.Commands.AddComputerCommand

ps: dns is working :
    ping -n 2 ADDC

Pinging ADDC [192.168.3.10] with 32 bytes of data:
Reply from 192.168.3.10: bytes=32 time=1ms TTL=128
Reply from 192.168.3.10: bytes=32 time<1ms TTL=128

A: This demo from Ignite 2015 implies that you should wait for DNS.
while (!(Test-Connection -Computername <# DNS IP address #> -BufferSize 16 -Count 1 -Quiet -ea SilentlyContinue)) {sleep -seconds 1}
Add-Computer

Here I try to rewrite that code for generic use.
$VMName = "Old Virtual Machine"
$localCred = new-object -typename System.Management.Automation.PSCredential `
             -argumentlist "Administrator", (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force)
$domainCred = new-object -typename System.Management.Automation.PSCredential `
              -argumentlist "Ignite\Administrator", (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force)
$DnsIpAddress = "10.100.7.1"
$DomainName = "Ignite.demo"

Invoke-Command -VMName $VMName -Credential $localCred -ScriptBlock {
         param($VMName, $domainCred, $DnsIpAddress, $DomainName)
         Write-Output "[$($VMName)]:: Joining domain as `"$($env:computername)`""
         while (!(Test-Connection -Computername $DnsIpAddress -BufferSize 16 -Count 1 -Quiet -ea SilentlyContinue)) {sleep -seconds 1}
         Add-Computer -DomainName $DomainName -Credential $domainCred
         } -ArgumentList $VMName, $domainCred, $DnsIpAddress, $DomainName
}

It looks like $localCred is the local administrator on the virtual machine (who you would log in as).
And $domainCred is someone who can add a computer to the domain.
You might also find this article useful.
Credit belongs to Sarah Cooley for the original code.
DNS Troubleshooting
You can see what DNS servers are being used with this code:
$net = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName localhost -Filter 'IPEnabled=True'

$props = @{
    DNSHostName = $net.DNSHostName
    DNSServerSearchOrder = $net.DNSServerSearchOrder -join ','
    Description = $net.Description
    IPAddress = $net.IPAddress -join ','
}

New-Object PsObject -Property $props | format-list

And you can learn more about the virtual machine's DNS environment with nslookup or dig.
If you want to ask a new question about a DNS issue, you can try Server Fault.

A: my problem is that i have two DNS domain in my environment i type the false ip DNS server. now it's work


text:
Q: How to prevent VC++ 9 linker from linking unnecessary global variables? I'm playing with function-level linking in VC++. I've enabled /OPT:REF and /OPT:ICF and the linker is happy to eliminate all unused functions. Not so with variables.
The following code is to demonstrate the problem only, I fully understand that actually having code structured that way is suboptimal.
//A.cpp
SomeType variable1;

//B.cpp
extern SomeType variable1;
SomeType variable2;
class ClassInB {
 //actually uses variable1
};

//C.cpp
extern SomeType variable2;
class ClassInC {
 //actually uses variable2;
};

All those files are compiled into a static lib. The consumer project only uses ClassInC and links to the static library. Now comes the VC++ 9 linker.
First the linker sees that C.obj references variable2 and includes B.obj. B.obj references variable1, so it includes A.obj. Then the unreferenced stuff elimination phase starts. It removes all functions in A.obj and B.obj, but not the variables. Both variable and variable2 are preserved together with their static initializers and deinitializers. That inflates the image size and introduces a delay for running the initializers and deinitializes.
The code above is oversimplified, in actual code I really can't move variable2 into C.cpp easily. I could put it into a separate .cpp file, but that looks really dumb. Is there any better option to resolve the problem with Visual C++ 9?

A: The MSDN (see the Arguments section, REF | NOREF arguments, 4th paragraph) specifies that You have to explicitly mark data as a COMDAT; use __declspec(selectany). for the linker to remove said unused data when using /OPT:REF.
Have you tried and had any chance with __declspec(selectany) ?


text:
Q: Query on date part of Timestamp I'm trying to return 2 columns for a graph on with date and the other with count of jobs for the date.
Jobdate is a timestamp however. So although the first query is instant, it will give a new row for every time change as well.
 SELECT JOBDATE ,COUNT(JOBNO) AS TOTAL FROM JOB
 where JOBDATE > '2022-09-20'
 GROUP BY JOBDATE
  ORDER BY JOBDATE

The query below works fine except that it takes 30 seconds to run over a small dataset.
 SELECT CAST(JOBDATE AS DATE)  AS THEDATE,COUNT(JOBNO) AS TOTAL FROM JOB
 where CAST(JOBDATE AS DATE) > '2022-09-20'
 GROUP BY THEDATE
  ORDER BY THEDATE

On option is to have a second JOBDATE date only field. Has anyone got a better idea?

A: Sorted. For anyone one else who needs to know -
SELECT date(JOBDATE) ,COUNT(JOBNO) AS TOTAL
FROM JOB
where JOBDATE > '2022-09-20'
GROUP BY date(JOBDATE)

A: I can only assume the casts are causing the slowdown. They are replaced with date() and is much better


text:
Q: Excel Chart, How to only show monthly/weekly/biweekly data I currently combine weekly data with daily data for an excel chart.

How can I select my data so it is consistenly weekly? Or is there a chart feature to only include the weekly data? I don't want to manually pick dates either using the date picker chart feature.

A: Assuming the first column of data is in column A, make a helper column with the following formula in it:
=WEEKDAY(A1)

and populate down
Autofilter on the day of the week you want to use for your data.
The chart should skip hidden rows


text:
Q: Thingsboard provisioning example not working For some reason https://github.com/thingsboard/thingsboard-arduino-sdk/blob/master/examples/0008-esp8266_provision_device/0008-esp8266_provision_device.ino is not compiling on Windows Arduino IDE 1.8.19 for FireBeetle ESP32.  Error as follows:
Arduino: 1.8.19 (Windows 10), Board: "FireBeetle ESP32-E, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None"
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:7: warning: "WIFI_AP" redefined
#define WIFI_AP "Lemmiku IoT"

In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:4:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
#define WIFI_AP WIFI_MODE_AP
Provision_test:86:46: error: conversion from 'void(Provision_Data&)' {aka 'void(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
const Provision_Callback provisionCallback = processProvisionResponse;
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:75:76: required from here
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
return Converter::fromJson(*this);
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
class InvalidConversion; // Error here? See https://arduinojson.org/v6/invalid-conversion/
^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
conversion from 'void(Provision_Data&)' {aka 'void(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Can anyone help out why it's not working?
@devaskim I tried, but nothing:
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:6: warning: "WIFI_AP" redefined
 #define WIFI_AP             "Lemmiku IoT"

In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:3:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
 #define WIFI_AP      WIFI_MODE_AP

Provision_test:85:46: error: conversion from 'void (*)(Provision_Data&)' {aka 'void (*)(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested
 const Provision_Callback provisionCallback = &processProvisionResponse;
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:74:76:   required from here
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
     return Converter<T>::fromJson(*this);
            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from C:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
C:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
 class InvalidConversion;  // Error here? See https://arduinojson.org/v6/invalid-conversion/
       ^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
 Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
 Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
exit status 1
conversion from 'void (*)(Provision_Data&)' {aka 'void (*)(const ArduinoJson6194_F1::ObjectConstRef&)'} to non-scalar type 'const Provision_Callback' requested

Hmm, I got something different this time:
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:6: warning: "WIFI_AP" redefined
 #define WIFI_AP             "Lemmiku IoT"

In file included from C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFi.h:31,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:3:
C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi\src/WiFiType.h:32: note: this is the location of the previous definition
 #define WIFI_AP      WIFI_MODE_AP

In file included from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from c:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp: In instantiation of 'typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type ArduinoJson6194_F1::VariantConstRef::as() const [with T = ArduinoJson6194_F1::ObjectRef; typename ArduinoJson6194_F1::enable_if<((! ArduinoJson6194_F1::is_same<T, char*>::value) && (! ArduinoJson6194_F1::is_same<T, char>::value)), T>::type = ArduinoJson6194_F1::ObjectRef]':
C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:74:76:   required from here
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:253:34: error: invalid use of incomplete type 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
     return Converter<T>::fromJson(*this);
            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/VariantRef.hpp:14,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayIterator.hpp:8,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Array/ArrayRef.hpp:8,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:24,
                 from c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from c:\Users\Timo\Documents\Arduino\libraries\ThingsBoard\src/ThingsBoard.h:16,
                 from C:\Users\Timo\Documents\Arduino\Provision_test\Provision_test.ino:2:
c:\Users\Timo\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/Converter.hpp:14:7: note: declaration of 'class ArduinoJson6194_F1::InvalidConversion<ArduinoJson6194_F1::VariantConstRef, ArduinoJson6194_F1::ObjectRef>'
 class InvalidConversion;  // Error here? See https://arduinojson.org/v6/invalid-conversion/
       ^~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
  Used: C:\Users\Timo\AppData\Local\Arduino15\packages\DFRobot\hardware\esp32\0.2.1\libraries\WiFi
  Not used: C:\Users\Timo\Documents\Arduino\libraries\WiFiEspAT
exit status 1

Compilation error: exit status 1

A: As you've already noticed, there are two issues to fix, which I've highlighted in the code sample below.
There is also an open issue about this here: https://github.com/thingsboard/thingsboard-arduino-sdk/issues/89
Note that while this fixes the compilation issues, at least my self-hosted ThingsBoard server fails to register the provisioning request, so there's likely more that's broken with it.
// ...

// FIX #1
//
// We're dealing with const data
//
//JsonObject credentials_value = data["credentialsValue"].as<JsonObject>();
JsonObjectConst credentials_value = data["credentialsValue"].as<JsonObjectConst>();

// ...

// FIX #2
//
// Provision_Callback is a class that takes the callback as a constructor parameter
//
//const Provision_Callback provisionCallback = processProvisionResponse;
const Provision_Callback provisionCallback(processProvisionResponse);

// ...


text:
Q: I want to avoid extension of file to appear in drop-down menu in Rshiny. I have a list of csv files that are in my subdirectory data of shiny app, that appear in drop-down menu. I want to avoid .csv extension to appear in the drop-down with the file name. Say one file with name HG-U133_Plus_2.csv should appear as HG-U133_Plus_2 in drop-down. I use the below code for drop-down option. Thanks
On ui.r :
filenames <- list.files(path = "data",pattern="\\.csv$")
selectInput('dataset',"choose platform annotation file", c("Choose file" ='',filenames)),

server.r:
dataInput <- reactive({

        if (grepl("[/\\\\]", input$dataset)) {
          stop("Invalid dataset")
        }

        read.csv(file.path("data", input$dataset))
      })

A: Just set the names of the choices vector:
names(filenames) <- gsub(pattern = "\\.csv$", "", filenames)


text:
Q: Setting Cookie in javascript and reading it in PHP So I have a cookie set through js when the user accepts a popup, it is set through the following function.
function setCookie(cname, cvalue, exdays) {
  var d = new Date();
  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  var expires = "expires="+d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
setCookie("accepted_popup", 'accepted_value', 1);

When checking the Cookie in chrome dev tools it is set indeed.
Name           |Value          |Domain       |Path  |Expires                    |Size   |HttpOnly   |Secure |SameSite   |Priority
accepted_popup |accepted_value |example.com  |/     |2020-07-09T15:07:43.000Z   |11     |           |       |        |Medium

I realize that for the cookie to take effect on the server it would need a page load. So I don't want the popup to show next time the page loads, so I'm checking the Cookie on the server like this.
<?php
    if(isset($_COOKIE['accepted_popup'])){
        doSomething();    //not showing popup
    }else{
        showPopup();      //showing popup
    }
?>

What's new in this question that hasn't been asked before is that the above code was perfectly working on the old server, it stopped working when moving to AWS(if that might be a reason).
When I do var_dump($_COOKIE); on the server the cookie accepted_popup doesn't show in it.
Also I'm setting the cookie and retrieving it on the same domain(in production), say "example.com" no subdomain or www.
On my development site subdomain.example.com the above code is working fine, and behaving as expected.

A: So the problem turned out to be not in setting the cookie in PHP but in AWS CloudFront.
If anyone is facing the same problem and have AWS hosting, check
CloudFront Distributions -> Behaviors -> Default(*) either change the "Forward Cookies" option or set add the cookie names to the "Whitelist Cookies" as shown in the image.


text:
Q: How to echo raw code in html_document rendered by r-markdown My question is simple, though I cannot really find a satisfying answer anywhere.
I'm trying to write an r code chunk that, when rendered as html_document, gives exactly the following in the html source of the rendered document :

graph LR

box1[1. do 1] ==> box2[2. do 2] ==> box3[3. do 3]

I'm ending doing this in a {r, echo = FALSE, results = 'asis'} r chunk:
diag1_char <- 'graph LR

box1[1. do 1] ==> box2[2. do 2] ==> box3[3. do 3]'

cat(paste0('
\n', diag1_char,'\n
\n'))

However I cannot get rid of the

 html formatting that appears during the md -> html pandoc conversion:

graph LR

box1[1. do 1] ==> box2[2. do 2] ==> box3[3. do 3]

I'm trying to do this so as to have the content of

 to be interpreted by the mermaid library included in the html_document via includes:in_header.

A: Try to insert a new chunk with htmltools::includeHTML("my_html.html") and in the filye "my_html.html" write your html code


text:
Q: How to determine dielectric constant and loss tanget of a PCB board at a specific frequency? I need to know dielectric constant (relative permittivity) and Tan loss of a FR4 board at 2.45 GHz.
The specification of the manufacturer is as it is below:
Dielectric Constant:

*

*Test method (IPC-TM-650): 2.5.5.2

*Test condition: Etched/@1 MHz

*Specification(IPC-4101C) <5.4

*Typical value: 4.58

Loss Tanget:
 - Test method (IPC-TM-650): 2.5.5.2
 - Test condition: Etched/@1 MHz
 - Specification(IPC-4101C) < 0.035
 - Typical value: 0.022
I read on the Net that those values should be lower at higher frequencies. Is it possible to calculate/determine/predict those two values for 2.45 GHz?

A: There are equations to calculate them. Look here: http://www.sigcon.com/Pubs/news/4_5.htm.


text:
Q: How to get the css selector of only a part of the element I want to click only the first part of a element which has both a hyperlink(containing a checkbox)  and non hyperlink part.In other word I want to check the checkbox.But I cannot separate only the checkbox part of the element.The selector when clicked always clicks the hyperlink part and takes me to a different page. I want to click only the part of the element which contains text I agree to the.I am using css selector like '.Grid>div:nth-child(9)>button:nth-child(1)' which chooses the entire selector or if I give [class="terms-conditions-input"]>label>:nth-child(1) it gives me the hyperlink part only.But I just want the css selector for the 1st part without the hyperlink. The HTML for the element is given below:

<input id="question-terms-conditions" class="pull-left parsley-validated" type="checkbox" data-validate-error-message="Please agree to the Terms & Conditions to continue" data-validate-mincheck="1" data-validate-required="true" name="terms-conditions"/>

 I agree to the
 Terms & Conditions

Is there any way to create a css selector for only  the I agree to the part of the element.

A: As @Sujata Chanda suggested, wrap your I agree to the statement in a separate span or div, add required id or class to it and access it using that combination of selectors. like:
HTML:

    I agree to the

        Terms & Conditions

CSS:
div.terms-conditions-input label .part1 {
  color: red;
}

DEMO
Also, be more specific in writing CSS selectors using prominent id(s) or class(es), rather than using .Grid>div:nth-child(9)>button:nth-child(1) or [class="terms-conditions-input"]>label>:nth-child(1).


text:
Q: possible null reference argument for parameter 's' parse in 'double double.Parse(string s)' possible null reference argument for parameter 's' parse in 'double double.Parse(string s)'
dr = cm.ExecuteReader();
while (dr.Read())
{
    i += 1;

    _total += double.Parse(s: dr["total"].ToString()); // warning message
    dataGridView1.Rows.Add(i, dr["id"].ToString(), dr["transno"].ToString(), dr["pcode"].ToString(), dr["pdesc"].ToString(), dr["price"].ToString(), dr["qty"].ToString(), dr["disc"].ToString(), dr["total"].ToString());
}

A: C# does not know value of your column. That's why you are getting this warning. When the value of your column is null, calling .ToString() on null results in a NullReferenceException at runtime.
When you know that this column exists 100%, you can do it like this to get rid off the warning:
dr["total"]!.ToString()

Or even better: use an object-mapping framework like Dapper. It will save you tons of hours.

A: The reason of the warning is that dr["total"] can return null (in case there's no field "total" in the cursor) and .ToString() will throw exception.
If you are sure that the field does exist rain or shine you can switch this warning off with the null forgiving operator !:
  // using: do not forget to Dispose IDisposable (dr)
  using var dr = cm.ExecuteReader();

  while (dr.Read()) {
    i += 1;
    _total += Convert.ToDouble(dr["total"]!);

    dataGridView1.Rows.Add(i,
      dr["id"]!.ToString(),
      dr["transno"]!.ToString(),
      dr["pcode"]!.ToString(),
      dr["pdesc"]!.ToString(),
      dr["price"]!.ToString(),
      dr["qty"]!.ToString(),
      dr["disc"]!.ToString(),
      dr["total"]!.ToString());
  }

Note, that we can get rid of to and from string conversion and let .net convert the value with Convert


text:
Q: Excel mapping with string comparison I am new to Excel VBA.
I am having following excels.
I have the following pieces of data.
Following is the master table
Master
item 1  |   k1,k2,k3
------------------------
item 2  |    k1,k2
------------------------
item 3  |      k3
------------------------

following is the items table
item
    1   item 1
----------------
    2   item 2
----------------
    3   item 3
----------------

following is the keywords table
keywords
10  k1
-------
11  k2
-------
12  k3
-------

i would like to obtain following excel as mapping of item and keyword based on master table.
1   10
-------
1   11
-------
1   12
-------
2   10
-------
2   11
-------
3   12
-------

Can anyone plz help me
Thanks in advance.
I am new to excel vba and macros

A: I don't feel like your question is very clear, but if I understand your question correctly, you should be able to accomplish this just using vLookup, no need for VBA/macros. If you can't figure it out from there, please clarify your question.
Vlookup Tutorial


text:
Q: Calling on a specific text field with multiple common classes I have been trying to use tampermonkey to automate a script for filling in a certain text box. This text box has many common classnames as a couple other text boxes and I don't really have the knowledge with js and jquery to find out how to call this specific field. The source for this field is
<input class="text ng-pristine ng-untouched ng-valid ng-not-empty" min="1"
ng-model="crash.autoOut" ng-blur="crash.onBlur();" type="text">

I'm in this ride to learn and I have a very basic understanding of how this all works. I appreciate all the help!

A: If you know the classes attached to the input will not change, you can call it like this.
$(document).on('change', 'input.text.ng-pristine.ng-untouched.ng-valid.ng-not-empty', function(){
    // Do something
});

or
$('input.text.ng-pristine.ng-untouched.ng-valid.ng-not-empty').val();

Another (better) option is to find a parent with an ID or at least a unique class and call it from there:
$('#parent input.text').val();


text:
Q: Error en el rango dhcp server debian9 Al ejecutar el comando journalctl -xe me sale este error

La dirección que estoy usando es
address 192.168.1.2
Máscara
netmask 255.255.255.255
Subnet

¿Cómo puedo solucionar los errores que me salen?

A: Hola veo que estas usando una IP de categoria C (https://es.wikipedia.org/wiki/M%C3%A1scara_de_red)
En teoria la mascara mas tipica para esa ip es 255.255.255.0 basicamente CIDR de 24 (https://es.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
Si quiers una mascara de categoria D pues tienes que asigunar una subred que le pertenezca como 224.0.0.0
Configuracion tipica /etc/dhcp/dhcpd.conf :
default-lease-time 600;
max-lease-time 7200;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.100 192.168.1.200;
 option routers 192.168.1.254;
 option domain-name-servers 192.168.1.1, 192.168.1.2, 8.8.8.8;
#option domain-name "mydomain.example";
}

Tambien te paso un calculadora que va bien https://jodies.de/ipcalc
Espero que te sea de ayuda.


text:
Q: JRun working... how can i use servlet in jrun server JSP pages are correctly working in Jrun, but when I used servlet it cannot find .class file of that servlet and gives 404 error while execution.
Can any one help me how jrun works with servlet? Am I missing out any point?
here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>myProject</display-name>

      <servlet>
        <description></description>
        <display-name>myClass</display-name>
        <servlet-name>myClass</servlet-name>
        <servlet-class>myPackage.myClass</servlet-class>

      </servlet>
      <servlet-mapping>
        <servlet-name>myClass</servlet-name>
        <url-pattern>/myClass</url-pattern>
      </servlet-mapping>
    </web-app>

and my simple servlet
package myPackage;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

public class myClass extends HttpServlet {
    private static final long serialVersionUID = 1L;

        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        PrintWriter pw = response.getWriter();
        pw.println("my page");
    }

}

and jsp page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<form action="myClass" method="post">
<input type="submit" value="submit">
</form>

A: I admit, I've never worked with JRun... I think you should take a look on your WAR (you're supposed to compile your code into war or directory. Search there whether you have your binary  compiled servlet file (it should be myClass.class)

A: I got the solution.
It gave error due to DOcTYPE declaration..
I just replace my web.xml with
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

<servlet>
<servlet-name>myClass</servlet-name>
<servlet-class>myPackage.myClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myClass</servlet-name>
<url-pattern>/myClass</url-pattern>
</servlet-mapping>

</web-app>


text:
Q: How to return both null and not-null values in one query I have an integer field person_id with the default value of NULL. I am using a stored procedure and pulling people names and address. if a user does not pass a value all records are pulled both, null and not nulls. How do I do it. May be Case statement or otherwise?
my_procedure(          <--- this is pseudo code
@person_id int null
begin
select name, address from PERSON
WHERE person_id like case NULL then NULL else '%'
end

Null requires -> IS NULL
number requires = 123
EDIT
I need a condition too, if nothing is passed, all values are pulled. If something is passed, that value is searched

A: WHERE (@personID is NULL OR personid IS NULL OR personid = @personid)
Just put both your cases in a parenthetical WHERE clause.
EDIT
Added another OR clause to cover what I THINK you are asking for.

A: The correct code in this case is
IsNULL(mycolum,'') LIKE CASE when person_id is null then '%' else '%' + person_id + '%'

IsNULL coverts null values into empty string and then you can worry about only strings, not null values.


text:
Q: ¿Cómo usar un bucle for para cambiar el nombre de diferentes variables de dataframe? Tengo un dataframe que quiero filtrar y guardar esos elementos filtrados en diferentes variables, para eso quiero ponerle el nombre a las variables de una columna (GPI) del mismo dataframe. Para eso quiero utilizar un bucle for.
print(data_3.shape)
GPI=data_3.GP.unique()
print(GPI)

for i in GPI:
    data_i=data_3[data_3.GP=='i']
    print (data_i)

Que me faltará?

A: A la vista de tu ejemplo, deduzco que lo que pretendes hacer es lo siguiente:

*

*Determinar los diferentes valores que aparecen en la columna "GP" de tu dataframe (eso ya lo has logrado correctamente usando data_3.GP.unique())

*Separar el dataframe en "sub-dataframes", según cada uno de esos posibles valores.

*Asignar cada "sub-dataframe" a una variable separada, haciendo que el nombre de la variable dependa automáticamente del valor de GP que se esté procesando.

El punto 3 es el que tienes que re-pensar un poco. Aunque es posible crear variables cuyo nombre sea computado por el programa, en general casi nunca es buena idea hacer eso. Suele ser mucho más útil crear un diccionario, que actúa a muchos efectos como las variables que buscas, haciendo que las claves del diccionario sean los nombres y los valores del diccionario sean los sub-dataframes que buscabas.
El tener un diccionario en vez de un montón de variables separadas hace más fácil procesamientos posteriores mediante bucles que iteren por el diccionario. Así puedes por ejemplo obtener estadísticas de cada uno de los sub-dataframes, o guardar en disco cada uno de ellos, etc.
Así que una implementación bastante directa de lo que buscas, pero con diccionarios, sería algo así:
nombres = df.GP.unique()
data = {}

for nombre in nombres:
  data[nombre] = data_3[data_3.GP==nombre]

Al finalizar este bucle tendrás en resultado un diccionario cuyas claves son los "nombres de variable" a que te referías en la pregunta. Puedes por ejemplo acceder a cada una de ellas así:
print(data["AG1"])

pero como mencionaba antes, el hecho de tenerlas en un diccionario, te permite iterar por las claves y valores para otros tipos de procesamiento. Por ejemplo, contar cuántas entradas tiene cada sub-dataframe:
for clave, valor in data:
  elementos = len(valor)
  print(f"data[{clave}] tiene {elementos} elementos")

Otro ejemplo, crear un archivo csv separado para guardar cada sub-dataframe:
for clave, valor in data:
  nombre_fichero = f"data_{clave}.csv"
  valor.to_csv(nombre_fichero)
  print(f"Generado el fichero {nombre_fichero}")

Este tipo de bucles no podrías hacerlos si tuvieras las diferentes variables data_* por las que preguntabas en la pregunta. De todas formas, si insistes en crear variables separadas, déjame un comentario y te mostraría cómo podría hacerse manipulando el diccionario globals() (aunque no es práctica común y sería menos útil).


text:
Q: How do I access an array from one file in another file? I am really new to Xcode. I don't quite understand exactly what it means when you initialize variables in certain places, but my code works so this isn't the issue... for now. Anyway, here is a my .h file. Everywhere there is a "----" it just means there is code there.
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

NSInteger charactersLocked[3] = {0,0,1};
int charSel = 0;

@interface Tutorial : UIViewController
{
    -------
}
------
@end

So I need to access the array charactersLocked in a different .m file, lets call it File2 and this one File1. When I try to #import "File1.h" in File2.m, the program crashes and gives me this error for both charactersLocked and charSel:
 duplicate symbol _charactersLocked in:
    /Users/me/Library/Developer/Xcode/DerivedData/SpaceRace-
    apawbkpiogvbvddranqfltyybuqr/Build/Intermediates/SpaceRace.build/Debug-
    iphoneos/SpaceRace.build/Objects-normal/arm64/Tutorial.o
    /Users/me/Library/Developer/Xcode/DerivedData/SpaceRace
    apawbkpiogvbvddranqfltyybuqr/Build/Intermediates/SpaceRace.build/Debug-
    iphoneos/SpaceRace.build/Objects-normal/arm64/Space.o

I have no idea what this is. I've tried looking for solutions online, but none of them seem to work. I am not importing the .m file by accident. If there is an easier way to just get access to that specific array, please let me know. Sorry if this post was formatted horribly, it is my first time so bear with me. Thank you.

A: The short answer to your question is located in this answer; you need to declare your variables as extern for the compiler to know that you want to use it in multiple files.

This is very rarely done in Objective-C though, because its heritage as an object-oriented programming language means that global state in programs is most often handled in class methods or singleton classes. Without knowing too much about your program, I am going to guess that you want a singleton class, something like CharacterLocker, which would look like this:
CharacterLocker.h
@interface CharacterLocker : NSObject
{
    NSInteger charactersLocked[3];
}

+ (id) sharedObject;

@property NSInteger* charactersLocked;

@end

CharacterLocker.m
@implementation CharacterLocker

@synthesize charactersLocked;

+ (void) sharedObject
{
    static CharacterLocker *singleton = nil;

    // Required so that multiple calls to sharedObject don't create two
    static dispatch_once_t pred;
    dispatch_once(&pred, ^{ singleton = [[CharacterLocker alloc] init]; });
    return singleton;
}

- (id) init
{
    if ( self = [super init] )
    {
        charactersLocked[0] = 0;
        charactersLocked[1] = 0;
        charactersLocked[2] = 1;
    }
    return self;
}

@end

Then, in your code, you call [CharacterLocker sharedObject].charactersLocked to access the array.


text:
Q: Delete large amount of records in chunk from a Table using SQL query I have a table which contains more than 5 million records
I need to delete 300000 of records but I can not use composite key of the table.
Have to use column Price_VERSION_SEQ for deleting. I was thinking to delete data in chunks using fetch first 50000 rows only in inner query. But I am not sure what to use in Where clause of main query.
Please help.what should be used to replace ****.
DELETE FROM Price_TBL where **** in
(Select * from Price_TBL where Price_VERSION_SEQ=1 fetch first 50000 rows only);

Columns present in Tables are :
Price_GRP_VAR_COD
Price_VERSION_SEQ
Price_MP_OPER_COD
Price_FROM_MPM_RT
Price_FROM_MPM_RT1

Composite key :
Price_GRP_VAR_COD
Price_VERSION_SEQ
Price_MP_OPER_COD

A: You could replace **** with all columns in order. I simpler way would be to just select the key:
DELETE FROM Price_TBL where (Price_GRP_VAR_COD, Price_VERSION_SEQ, Price_MP_OPER_COD) in
(Select Price_GRP_VAR_COD, Price_VERSION_SEQ, Price_MP_OPER_COD from Price_TBL where Price_VERSION_SEQ=1 fetch first 50000 rows only);

A: I would suggest using the relevant column Price_VERSION_SEQ.
DELETE FROM Price_TBL
WHERE Price_VERSION_SEQ IN
(
    SELECT Price_VERSION_SEQ
    FROM Price_TBL
    WHERE Price_VERSION_SEQ=1
    FETCH FIRST 50000 ROWS ONLY
);

A: Use a sub-select to find the 50000:th Price_VERSION_SEQ value. Use that value in the DELETE's WHERE clause.
DELETE FROM Price_TBL
   where Price_VERSION_SEQ <= (Select Price_VERSION_SEQ from Price_TBL
                               order by Price_VERSION_SEQ
                               offset 50000 fetch first 1 rows only);

Untested, don't know if it works with MySQL and/or SQL Server, but at least it's ANSI SQL.
BTW, I think MySQL has LIMIT 50000,1, and SQL Server has SELECT TOP something, if the OFFSET/FETCH FIRST syntax doesn't work.


text:
Q: Prevent web brower cache file from being downloaded My website has some of its files temporarly saved in the web browser cache.
Concerning CSS and images files, no problem but for some files it's a real security issue.
Is there a way to prevent some files from :
- being downloaded from the cache ?
- being visible in the cache ?
or crypt them maybe
Thanks.
David

A: Well you can configure your webserver so it sends certain http headers for certain file types such as javascript. For example for Apache web server we can use mod_expires module.
Another option is to add a random string to the end of each file that should not be cached by the web browser. for example the file script_name.js can be server as script_name.js?somerandomstring


text:
Q: Using the MSDN docs, is it possible to hide or filter inherited members? One of the coolest features I've seen in help viewers is the ability to hide inherited members so you can focus on only what that particular subclass offers.  A good example of this is here...
http://james.newtonking.com/projects/json/help/html/T_Newtonsoft_Json_JsonConvert.htm
Actually, that page has various options for how to show the help, not just hiding inherited members.
Now online MSDN has a habit of just throwing everything under the sun at you meaning trying to figure out what a subclass has added, let alone getting to it requires tons of scanning and even more scrolling.
That said, is there any way, local or online, to enable those or similar features?  Has anyone made an external or third-party help viewer that does this or something similar?
(Note: I'm not really sure if this is for SO since it's not a programming thing, but it is sort of an IDE-related thing so I figured I'd gamble and put it here.)
Mark

A: Hiding inherited items is one thing I used to miss in the Lightweight style online MSDN docs.
Fortunately, it can be easily solved by using a litte bit of in browser javascript. See How to hide inherited members on MSDN pages  for details.
You should be able to expand the used principle to hide any information you need (eg. you could use the icons to tell apart the static members, methods, properties and so on...).

A: Updated answer for 2016:
Create a bookmark in a modern browser with the following javascript snippet as the URL:
javascript:var trs=document.getElementsByTagName('tr');var l=trs.length;for (var i=0; i<l; i++) {  var tr=trs[i];  if (tr.innerHTML.indexOf('(Inherited from ')>-1)  tr.style.display=tr.style.display=='none'?'':'none'; }; void(0);

Clicking this bookmark while on an MSDN class documentation page will toggle all the inherited members on and off.
The javascript is just looking through all of the table rows ('tr') on the page, finding any which contain the string '(Inherited from ', and setting their display style (visibility) to 'none'.  That search string seems to cover every instance of a member being inherited.


text:
Q: What is best way to using Elastic search for searching (Via Server vs Direct Java Client)? I am new to Elasticsearch. I want to store documents of products details. Now I am using Mongodb as my database and nodejs server. But Mongodb does not have good search functionalities like Elasticsearch.
So I am thinking of shifting to ES. But I have few doubts as stated below please suggest me what should I do. Any suggestion will be appreciated.

*

*Should I use MongoDb as my primary database for storing documents and ES as secondary database just for doing efficient search. Or Should I make ES as my only database for storing documents and searching.

*Does using both will be good for future or it will make thing difficult to manage. I have also read that ES in not a good choice for main database as it sometimes loses write operation.

*Should I make a server in nodejs to perform ES operations for doing any complex search or GET, PUT using rest api or should I do it directly implement it in java .
(Note I am making a android app so should I use TransportClient and Interact with Elasticsearch directly or I should first send a GET request from android side to my server and my nodejs server will interact with ES and send response to my android app).

*Other than search part is ES performs as good as MondoDb in terms of Database.
Thanks in advance.

A: I am risking an opinionated answer here. However I'll try to help you out:

*

*I am using elasticsearch as a primary data store in cases the data is not that important or just to big to have it duplicated. If you have things like logs you could also keep the original logs files around. By default I would say, use a different database as primary store, that way you can always rebuild elastic if you want to make changes to your search index.

*Adding components to your infrastructure makes it more work to manage. So adding MongoDB as well as Elastic does mean more moving parts. However, it also gives you more flexibility. I would not be to much afraid unless what you are searching for is very basic and can be done with MongoDB as well.

*I advice to always have an application in front of your search engine. Treat it like a database, you would not expose that to the world.

*I would not use a Transport Client in your Android app. That would mean a security risk. You want to make a connection to your backend as mentioned in 3 and let that application connect to your search cluster.

Hope that helps


text:
Q: Setting UILabel with attributed string as titleView nav controller results in weird behaviour I'm trying to set the titleView of a UINavigationController with multiple lines in a UILabel.
I need the two lines to be different font sizes but perfectly aligned so I figured I'd use a attributed string to do so. Here's my code:
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 480, 44)];
label.backgroundColor = [UIColor clearColor];
label.numberOfLines = 2;
label.font = [UIFont boldSystemFontOfSize: 14.0f];
label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];

UIFont *fontSmall = [UIFont fontWithName:@"HelveticaNeue" size:11.0];
NSDictionary *attrsDictionarySmall =
[NSDictionary dictionaryWithObject:fontSmall
                            forKey:NSFontAttributeName];

NSAttributedString *attrSmallString =
[[NSAttributedString alloc] initWithString:@"small text"
                                attributes:attrsDictionarySmall];

UIFont *font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:14.0];
NSDictionary *attrsDictionary =
[NSDictionary dictionaryWithObject:font
                            forKey:NSFontAttributeName];
NSAttributedString *attrString =
[[NSAttributedString alloc] initWithString:@"$200"
                                attributes:attrsDictionary];

label.text = [NSString stringWithFormat:@"%@\n%@",attrString,attrBTCString];

self.navigationItem.titleView = label;

However, this results in the following:

How do I fix that?

A: NSAttributedString has a NSString property which can be used here.
label.text = [NSString stringWithFormat:@"%@\n%@",attrString.string,attrSmallString.string];


text:
Q: Click on WPF Element with lower ZOrder and without using IsHitTestVisible To simplify the problem, I have the following XAML Windows :
<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:WpfApplication1"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525"
    DataContext="{StaticResource MainViewModel}">
<Grid>
    <Button Click="Button_Click">Click Me</Button>
    <ListBox ItemsSource="{Binding Items}" Background="{x:Null}">
    </ListBox>
</Grid>
</Window>

When it runs it look like this :

What I would expect is:

*

*I'm able to select Items ( WpfApplication1.BusinessObject )

*AND also able click on the button ( as I marked Background as {x:Null} )

But I can't click on the button, only select items in the listbox.
Note: If I use IsHitTestVisible, I can click on the button, but no more on the items, which makes sense. I also absolutely need to have both listbox and button taking the whole windows. Having on top the listbox and on bottom the button is not a solution.
Is there a good way to have this working ?
Thanks for your help !

A: you can try putting your listbox and button inside a StackPanel
also, it does not seem like your button is bound to any actions, could that be the reason : )?

A: Another option if you want the listbox sitting on top of and partially covering your button is to set `VerticalAlignment="Top" on your listbox. This will allow the listbox to grow vertically and only the height of the listbox will cover the button. However, if the listbox has a lot of items then it will completely cover the button and you will not be able to click the button.
You could always add PreviewMouseDown handler on the listbox and trigger the button click or command. That way if the listbox fills the entire window, you'll still be able to trigger the button handler.

A: Have a look at this thread: Canvas in ScrollViewer (Preview)MouseButtonDown event order
The problem is the ScrollViewer that handles mouse events. You could implement your custom ListBox template and use a custom ScrollViewer derived class with the code changes shown in the mentioned thread.

A: Thanks dotsven, setting handle=false didn't work for me, but I found this question that helped me: Click through ListBox to underlying Control. Taking inspiration from this I removed the ScrollViewer by setting a new style to my listbox and it worked :
<Style x:Key="{x:Type ListBox}" TargetType="ListBox">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ListBox}">
                <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

I also had to keep the background to {x:Null} :
<ListBox ItemsSource="{Binding Items}" Background="{x:Null}" Height="65" Width="242"/>

Thanks all for your help !