text:
Q: Let $H\subset \mathbb{C}$ a closed set and $(z_n)\subset H$. Prove if $z=\lim_{n\rightarrow\infty}z_n$ then $z\in H$ Let $H\subset \mathbb{C}$ a closed set and $(z_n)\subset H$. Prove if $z=\lim_{n\rightarrow\infty}z_n$ then $z\in H$
My attempt
Let $r>0$
Let $(z_n)\subset H$ a convergent sequence. As $H$ is a closed set, then $H$ contains all limits point.
By hypothesis we have exists $N\in \mathbb{N}$ such that $|z_n-z|<r$
This implies
$B(z,r)\cap H\not =\emptyset$
Here, i'm stuck because i need $B(z,r)\cap H-\{z\}\not =\emptyset$ for say $z$ is a limit point. Can someone help me?

A: Take $r>0$. Take, take $N\in\mathbb N$ such that $n\geqslant N\implies\lvert z-z_n\rvert<r$. Then either all $x_n$'s (with $n\geqslant N$) are equal to $z$, in which case $z\in H$, or there is at least one $z_n$ (with $n\geqslant N$) such that $z_n\neq z$. But then $z_n\in B(z,r)\setminus\{z\}$.

A: If $z\notin H$ then $z\in \mathbb{C} \setminus H=G$ where $G$ is open. And therefore there is a neighborhood of $z$ of type $B(z, r) \subseteq G$ and thus no point of $H$ lies in $B(z, r) $. But this contradicts the fact that $z_n\to z$ and $(z_n) \subseteq H$.


text:
Q: How to find where a library is being used in my project to fix a Veracode security vulnerability Currently my application is failing Veracode Scan because of one third party component:
"netty-handler.4.1.48.FINAL.jar", which has no safe versions available at the moment.
I have reviewed the Veracode Report but i cannot find any specific info about where this component is being used.
I have also gone through all files in my project and cannot find where "netty-handler" is being imported or used.
Is there any easy way to find out where "netty-handler" is being used in my application so that i can use something else
Here is my pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <version>1.2.2-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target
        <maven.surefire.version>3.0.0-M3</maven.surefire.version>
        <sonar.exclusions>etc/**,pipelines/**,templates/**,pom.xml,newpom.xml</sonar.exclusions>
        <junit-jupiter.version>5.1.0</junit-jupiter.version>
        <assertj-core.version>3.8.0</assertj-core.version>
        <groovy.version>2.5.5</groovy.version>
        <spring-boot.version>2.1.13.RELEASE</spring-boot.version>
        <local.repository.folder>${project.basedir}/lib/</local.repository.folder>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj-core.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${spring-boot.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.validator</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.yaml</groupId>
                    <artifactId>snakeyaml</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.26</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${spring-boot.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.ibm.ctg</groupId>
            <artifactId>ctgclient</artifactId>
            <version>9.0.1.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <version>${spring-boot.version}</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.projectreactor.netty</groupId>
                    <artifactId>reactor-netty</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.validator</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.projectreactor.netty</groupId>
            <artifactId>reactor-netty</artifactId>
            <version>0.8.17.RELEASE</version>
        </dependency>
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>${spring-boot.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>2.5.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-json</artifactId>
            <version>2.5.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring-boot.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.17.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <classifier>indy</classifier>
            <version>${groovy.version}</version>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>3.1.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.1.5.Final</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>6.2</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <artifactId>log</artifactId>
            <version>0.3.5</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </exclusion>
            </exclusions>
        </dependency>
   </dependencies>
    <pluginRepositories>
        <pluginRepository>
            <id>bintray</id>
            <name>Groovy Bintray</name>
            <url>https://dl.bintray.com/groovy/maven</url>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>jks</nonFilteredFileExtension>
                        <nonFilteredFileExtension>yml</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
                <version>2.1.2.RELEASE</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.7.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version><!-- 3.6.2 is the minimum -->
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                    <compilerArguments>
                        <indy/><!-- optional; supported by batch 2.4.12-04+ -->
                        <configScript>config.groovy
                        </configScript><!-- optional; supported by batch 2.4.13-02+ -->
                    </compilerArguments>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>3.3.0-01</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.5.5-01</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.12</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/groovy</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/test/groovy</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.6.0.1398</version>
                </plugin>
            </plugins>

        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>openshift</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <version>3.5.41</version>
                        <executions>
                            <execution>
                                <id>fabric8</id>
                                <goals>
                                    <goal>resource</goal>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

A: If you run mvn dependency:tree you'll get an overview of where and how netty-handler is used.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Passthrough is not supported, GL is disabled, ANGLE is ( Python code ) Error is
Provide your url: https://www.amazon.com/s?me=ASEVS99O6FS73&marketplaceID=ATVPDKIKX0DER
Provide output file name: asd

DevTools listening on ws://127.0.0.1:65126/devtools/browser/7338744e-3e07-4b53-9449-22c7e266b226
[12048:11032:1121/082539.022:ERROR:device_event_log_impl.cc(215)] [08:25:39.023] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[12048:11032:1121/082539.029:ERROR:device_event_log_impl.cc(215)] [08:25:39.029] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Traceback (most recent call last):
  File "Amazon Work.py", line 49, in <module>
IndexError: list index out of range
[3596] Failed to execute script 'Amazon Work' due to unhandled exception!
[12048:1184:1121/082618.612:ERROR:util.cc(129)] Can't create base directory: C:\Program Files\Google\GoogleUpdater
[6556:2384:1121/082718.378:ERROR:gpu_init.cc(537)] Passthrough is not supported, GL is disabled, ANGLE is

The complete code is

search_url=input("Provide your url: ")
output=input("Provide output file name: ")

print('\n')

from selenium.webdriver import ActionChains
from selenium import webdriver      # imports
from time import sleep
import time
from bs4 import BeautifulSoup
import requests
import pandas as pd
from selenium.webdriver.common.keys import Keys
cdriver="chromedriver"
driver=webdriver.Chrome(cdriver)
driver.get("https://www.amazon.com/")
driver.implicitly_wait(30)
driver.maximize_window()
time.sleep(3)

# ## Changing Location ##

driver.find_element_by_id('glow-ingress-line1').click()
time.sleep(1)
# driver.find_element_by_id('GLUXZipUpdateInput').clear()
driver.find_element_by_id('GLUXZipUpdateInput').send_keys("34236")

element=driver.find_element_by_id('GLUXZipUpdate')
ActionChains(driver).click(element).perform()
time.sleep(1)
driver.refresh()

# ## Gathering Products from Search URL

Links=[]
driver.get(search_url)
time.sleep(5)
while 1:
    soup=BeautifulSoup(driver.page_source,"lxml")
    Listings=soup.find_all('div',{"data-component-type":"s-search-result"})
    for link in Listings:
        if link not in Links: ### no duplicates
            Links.append('https://www.amazon.com/dp/'+link('a',{"class":"a-link-normal a-text-normal"})[0]['href'].split('/dp/')[1].split('/')[0])

    checker=soup.find("span",{"class":"s-pagination-item s-pagination-next s-pagination-disabled"})
    try:
        driver.find_element_by_partial_link_text('Next').click()
        time.sleep(2)
    except:
        break

print('\n')
print("Total Product Found: "+str(len(Links)))
print('\n')

# ## All Functions

def Csv_Download(Records,output):
    file=pd.DataFrame(Records,columns=['Product Name','Description','Unique ID','Price','Estimated Delivery','main Image','Additional Image 1','Additional Image 2','Additional Image 3','Additional Image 4','Additional Image 5','Additional Image 6','Additional Image 7','Additional Image 8','Additional Image 9','Additional Image 10'])
    file.to_csv(str(output)+'.csv', index=False, encoding="utf-8-sig")

def All_Product_Info(soup):

    ## title // Price // ASIN

    product_title=soup.find("span",{"id":"productTitle"}).text.strip()
    product_title=product_title.strip()

    try:
        price=soup.find("span",{"id":"price_inside_buybox"}).text.strip()
    except:
        try:
            price=soup.find('span',{"id":"newBuyBoxPrice"}).text
        except:
            price=""

    un_id=driver.current_url.split('/dp/')[-1].split('/')[0]

    ##################### About Section #################################
    ##################### About Section #################################
    ##################### About Section #################################
    about_section=""

    try:
        info1=soup.find("table",{"class":"a-normal a-spacing-micro"})
        about_section="\n"
        about_section=about_section.join(info1.text.strip().split('\n\n\n\n\n'))
        about_section=about_section.replace('\n\n\n',": ")
        about_section=about_section.strip()
        #print(about_section)
    except:
        pass

    try:
        info2=soup.find('ul',{"class":"a-unordered-list a-vertical a-spacing-mini"})('li')
        string=""
        for points in info2:
            string=string+"\n"+points.text.strip().replace('\n'," ")

        info2=string.strip()  ####### Info2 te string er shob input kora holo ekhane.......
        #print(info2)
        about_section=about_section+"\n"+info2
    except:
        pass

    about_section=about_section.strip()

    ##################### Delivery Section #################################
    ##################### Delivery Section #################################

    delivery=""
    try:
        delivery=soup.find("span",{"id":"upsell-message"}).text
        delivery=delivery.split('\n\n\n\n')[0].strip().replace('\n\n',"").replace('Details',"").replace('\n',"")
    except:
        try:
            delivery=soup.find("div",{"id":"mir-layout-DELIVERY_BLOCK-slot-DELIVERY_MESSAGE"}).text.strip().replace('\n\n',"").replace('Details',"").replace('\n',"")
        except:
            #print("Problem in Delivery Section....................")
            pass

    return product_title, about_section, un_id, price, delivery.strip()

################$$$$$$$$$$$$$$$$$$$$#################################################
################$$$$$$$$$$$$$$$$$$$$#################################################

def Getting_Image_Links():
    Images=[]
    try:
        driver.find_element_by_id('imgTagWrapperId').click()
        time.sleep(1)
        soup=BeautifulSoup(driver.page_source,"lxml")

        ## First Image .................

        all_images=driver.find_elements_by_xpath('//div[@class="ivThumb"]')
        img_link=soup.find('div',{"id":"ivLargeImage"})('img')[0]['src']
        if img_link not in Images:
            Images.append(img_link)

        for image in all_images:
            image.click()
            time.sleep(1)
            soup=BeautifulSoup(driver.page_source,"lxml")
            img_link=soup.find('div',{"id":"ivLargeImage"})('img')[0]['src']

            if img_link not in Images:
                Images.append(img_link)

        driver.find_element_by_xpath('//button[@aria-label="Close"]').click()
    except:
        pass
    return Images

################$$$$$$$$$$$$$$$$$$$$#################################################
################$$$$$$$$$$$$$$$$$$$$#################################################

def Image_Ordering(Images):
    main_image=""
    ad_1=""
    ad_2=""
    ad_3=""
    ad_4=""
    ad_5=""
    ad_6=""
    ad_7=""
    ad_8=""
    ad_9=""
    ad_10=""

    if len(Images)>0:
        for i in range(0,len(Images)):
            if i==0:
                main_image=Images[i]
            if i==1:
                ad_1=Images[i]
            if i==2:
                ad_2=Images[i]
            if i==3:
                ad_3=Images[i]
            if i==4:
                ad_4=Images[i]
            if i==5:
                ad_5=Images[i]
            if i==6:
                ad_6=Images[i]
            if i==7:
                ad_7=Images[i]
            if i==8:
                ad_8=Images[i]
            if i==9:
                ad_9=Images[i]
            if i==10:
                ad_10=Images[i]

    return main_image,ad_1,ad_2,ad_3,ad_4,ad_5,ad_6,ad_7,ad_8,ad_9,ad_10

# # Running Portion

# In[ ]:

Records=[]
for i in range(len(Links)):
    link=Links[i]
    for run in range(3):
        try:
            driver.get(link)
            print(str(i)+": "+link+" | Out of "+str(len(Links)))
            time.sleep(3)

            soup=BeautifulSoup(driver.page_source,"lxml")
            product_info=All_Product_Info(soup)  ######## Main Function ########
            if product_info[-2]=="":
                driver.refresh()
                time.sleep(2)
                soup=BeautifulSoup(driver.page_source,"lxml")
                product_info=All_Product_Info(soup)

            ######### Image Section ###########
            ######### Image Section ###########
            Images=Getting_Image_Links()
            All_Images=Image_Ordering(Images)
            print()
            Records.append((product_info[0],product_info[1],product_info[2],product_info[3],product_info[4],All_Images[0],All_Images[1],All_Images[2],All_Images[3],All_Images[4],All_Images[5],All_Images[6],All_Images[7],All_Images[8],All_Images[9],All_Images[10]))
            if len(Records)%15==0:
                time.sleep(2)
                CSV_output=Csv_Download(Records,output)

            break

        except:
            print("\nTrying Again")
            time.sleep(3)

CSV_output=Csv_Download(Records,output)
p=input("Finished Running, Press any key to close... ")

enter image description here
Error is shown in the attached image
Initially this was working fine few months back
This code scrapes Amazon website and outputs a csv file
I used this script after 5 months.
I downloaded and used the chromedriver according to my current chrome version[enter image description here](https://i.stack.imgur.com/2TKJ0.jpg)


text:
Q: Determine the name of a constant based on the value Is there a way of determining the name of a constant from a given value?
For example, given the following:
public const uint ERR_OK = 0x00000000;
How could one obtain "ERR_OK"?
I have been looking at refection but cant seem to find anything that helps me.

A: I may be late.. but i think following could be the answer
public static class Names
    {
        public const string name1 = "Name 01";
        public const string name2 = "Name 02";

        public static string GetName(string code)
        {
            foreach (var field in typeof(Names).GetFields())
            {
                if ((string)field.GetValue(null) == code)
                    return field.Name.ToString();
            }
            return "";
        }
    }

and following will print "name1"
string result = Names.GetName("Name 01");
Console.WriteLine(result )

A: You may be interested in Enums instead, which can be programmatically converted from name to value and vice versa.

A: You won't be able to do this since constants are replaced at compilation time with their literal values.
In other words the compiler takes this:
class Foo
{
    uint someField = ERR_OK;
}

and turns it into this:
class Foo
{
    uint someField = 0;
}

A: In general, you can't. There could be any number of constants with the same value. If you know the class which declared the constant, you could look for all public static fields and see if there are any with the value 0, but that's all. Then again, that might be good enough for you - is it? If so...
public string FindConstantName<T>(Type containingType, T value)
{
    EqualityComparer<T> comparer = EqualityComparer<T>.Default;

    foreach (FieldInfo field in containingType.GetFields
             (BindingFlags.Static | BindingFlags.Public))
    {
        if (field.FieldType == typeof(T) &&
            comparer.Equals(value, (T) field.GetValue(null)))
        {
            return field.Name; // There could be others, of course...
        }
    }
    return null; // Or throw an exception
}

A: I don't think you can do that in a deterministic way.  What if there are multiple constants with the same value?

A: I suggest you use an enum to represent your constant.
Or
string ReturnConstant(uint val)
{
     if(val == 0x00000000)
       return "ERR_OK";
     else
       return null;
}

A: The easiest way would be to switch to using an enum


text:
Q: SAPUI5 - Content is not displayed experts,
I've just started to study sapui5, and right now the thing that bothers me is that I can't get a dropdown menu to be shown, while a button I create together with the drop down menu is displayed.
Here is my view:
createContent : function(oController) {

        var aControls = [];

        var oButton = new sap.ui.commons.Button({
            id : this.createId("MyButton"),
            text : "Get response from servlet"
        });
        oButton.attachPress(oController.getResponse);
        aControls.push(oButton);

        $.ajax({
            url : "GetEmployees",
            type : "post",
            success : function(response) {

                var oEmployeeSelection = new sap.ui.commons.DropdownBox("employee");
                oEmployeeSelection.setTooltip("Employee");
                oEmployeeSelection.setWidth("300px");

                $.each(response, function(index, employee) {
                alert("entered selection creation");
                var oItem = new sap.ui.core.ListItem("Employee"+index);
                oItem.setText(employee);
                oEmployeeSelection.addItem(oItem);
                alert("processed: "+oItem);
                });
                alert(oEmployeeSelection);
                // Attach the DropdownBox to the page
                aControls.push(oEmployeeSelection);

            }, // end success call handler

            error: function(){
                alert("error while building employee select menu");
            }
        });// end Employee selection

        return aControls;

    }// end createContent

I do get data from the server, alerts inside the success function shoot, but I see only the button on screen.
What an I doing wrong?
Thanks.

A: The root cause is that you add the Dropdown box in the service callback method and the aControls is already returned with only oButton inserted before the service callback.
Adjust the code as following will do:
createContent: function(oController) {

        var aControls = [];

        var oButton = new sap.ui.commons.Button({
            id: this.createId("MyButton"),
            text: "Get response from servlet"
        });
        oButton.attachPress(oController.getResponse);
        aControls.push(oButton);

        //Add dropdown box before your service call

        var oEmployeeSelection = new sap.ui.commons.DropdownBox("employee");
        oEmployeeSelection.setTooltip("Employee");
        oEmployeeSelection.setWidth("300px");
        aControls.push(oEmployeeSelection);

        $.ajax({
            url: "GetEmployees",
            type: "post",
            success: function(response) {
                $.each(response, function(index, employee) {
                    alert("entered selection creation");
                    var oItem = new sap.ui.core.ListItem("Employee" + index);
                    oItem.setText(employee);
                    oEmployeeSelection.addItem(oItem);
                    alert("processed: " + oItem);
                });
                alert(oEmployeeSelection);

            }, // end success call handler

            error: function() {
                alert("error while building employee select menu");
            }
        }); // end Employee selection

        return aControls;

    } // end createContent


text:
Q: Endless loading/spinner on the checkout page on WooCommerce site When the cart page proceeds to the checkout page, everything appears on the page, however, the payment section is "grayed" out and that area just "spins".it never allows me to proceed to the actual payment button.
Things I've tried that didn't work:

*

*Disabled all plugins (except woocommerce).

*Changed theme to Default theme.

*Checked Woocommerce>System Status. Then found MySQL version:         5.5.58 - We recommend a minimum MySQL version of 5.6. PHP version:      5.4.45 - We recommend a minimum PHP version of 5.6.

*Checked items on this page: http://docs.woothemes.com/document/endless-
loadingspinner-on-the-checkout-page/

How to solve this problem?

A: This is a Ajax request failure. Check for CORS restrictions. Inspect the network tab for failed xhr requests. Also check the console for any errors, especially CORS ones.


text:
Q: VBA UDF multi-cell reference I am trying to create a UDF that takes the values from 4 selected cells and performs a function with it.  However I don't know how to write the function to recognize the cell values.  The way I have it currently written I need to input a value.  Can anyone help me with this relatively simple problem?  This is what I have so far.
Function solubility(anion As String, cation As String, carbon1 As String, carbon2 As String)

EDIT
So for example I am trying to select cells A, C, E, and G and they contain values of Tf, Mi, Ch, and Ch.  I will then use these cells refer to corresponding values in a range to calculate and display a final value.  THe whole code is provided below.
Function solubility(anion As String, cation As String, carbon1 As String, carbon2 As String)

Dim sum As Double
Dim ncavalue As Long, nanvalue As Long, ncb1value As Long, ncb2value As Long
Dim nca As Long, nan As Long, ncab As Long
Dim coeff As Range, groups As Range

'solubility groups range
groups = Worksheets("Solubility").Range("A2:A33")

'group coefficients range
coeff = Worksheets("Solubility").Range("B2:B33")

'number of groups for each group
ncavalue = Range("AE" & cation.Row)
nanvalue = Range("AC" & anion.Row)
ncb1value = Range("AG" & carbon1.Row)
ncb2value = Range("AI" & carbon2.Row)

j = 0

    For j = 0 To UBound(groups)
        If UCase(anion.Value) = UCase(coeff(j).Value) Then
            'coefficient value
            anvalue = coeff(j).Value
        End If
        If UCase(cation.Value) = UCase(coeff(j).Value) Then
            'coefficient value
            cavalue = coeff(j).Value
        End If
        If cation.Value = "[MIm]" Then
            cavalue = Range("B2")
            ncb1value = ncb1value.Value + 1
        End If
        If UCase(carbon1.Value) = UCase(coeff(j).Value) Then
            'coefficient value
            cb1value = coeff(j).Value
        End If
        If UCase(carbon2.Value) = UCase(coeff(j).Value) Then
            'coefficient value
            cb2value = coeff(j).Value
        End If
    Next j
    sum = anvalue * nanvalue + cavalue * ncavalue + cb1value * ncb1value + cb2value * ncb2value
    solubility = sum + Range("B34").Value
End Function

A: Assuming Row 1, call the Function like this:
=solubility(A1, C1, E1, G1)


text:
Q: IOS Application which can run in background and can connect to Device I have a use case where there are 2 devices. One is a Apple Mobile phone running a IOS application and other is a BLE enabled IOT device.

*

*IOS Application continuously scans for nearby BLE Device and if it finds a BLE Device with a specific UUID service, it will connect to it and send data over GATT Characteristics.

*This IOS Application should run continuously even if it is in background. That is when it is in background, it should scan for BLE Devices with specific service and if it is found, it should connect to it in background and write GATT characteristics.

*Problem here is IOS terminates the application when App is in background.

*The only way is to make the IOT device broadcast IBeacon instead of normal BLE Beacon. But IOS application will get awaken in background if IBeacon is found, but it cannot get the BLE Address of the device which is sending IBeacon and cannot connect to it.

How can I address this problem?

A: While iBeacon is very fast at detecting in the background and works best, it is not absolutely necessary.  You can detect a BLE service on iOS in the background and connect to it when it is discovered.
To do this you must:

*

*In your Info.plist declare:

    <key>UIBackgroundModes</key>
    <array>
        <string>bluetooth-central</string>
    </array>

*In your AppDelegate in didFinishLaunching you must trigger a BLE scan start

centralManager?.scanForPeripherals(withServices: [myServiceUUID], options: nil)

If you do the above, after your app is terminated, iOS will auto-launch your app and you will get a callback to didDiscoverPeripheral when a new peripheral is discovered.
While this really does work, it is very difficult to test correctly because of the way iOS keeps track of duplicates.  If a device has been detected already, and you kill your app you will not get a callback about its discovery -- iOS keeps track that it was already detected.  It will only give you a launch and callback for a new device.
Here is how I would test it:

*

*Modify your app to send a local notification when it detects the BLE device.  VERIFY THIS WORKS.

*Turn off your BLE device

*Launch your app

*Reboot your phone.

*Turn on your BLE device

*Wait for the notification above.  Be patient!  When you reboot your phone, the BLE stack may not be fully started for a few minutes.

The phone reboot step above is critical to clear out the cache of what devices the iPhone has already seen and are therefore ineligible for a callback.
Finally, you can accelerate this process with a BLE device that also advertises iBeacon as background detections are much faster and less temperamental.  But as you note, you cannot use iBeacon to connect to a peripheral using CoreBluetooth.  So you must advertise BOTH from your BLE device.  This is a common approach I use all the time.  Use iBeacon to accelerate the wake-up of your app and CoreBluetooth service advertisement detections to establish a connection.


text:
Q: Ruby post request failed, getaddrinfo error I am trying to do a SOAP POST request to eBay's web service to add an item request:
    require 'uri'
    require 'net/https'

    # Create the http object
    http = Net::HTTP.new('https://api.sandbox.ebay.com', 443)
    http.use_ssl = true
    path = '/wsapi?callname=AddItem&siteid=0&version=733&Routing=new'

    # Create the SOAP Envelope
data = <<-eot
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ebay:apis:eBLBaseComponents">
   <soapenv:Header>
      <urn:RequesterCredentials>
         <urn:eBayAuthToken>TOKEN HERE</urn:eBayAuthToken>
         <urn:Credentials>
            <urn:AppId>APP_ID</urn:AppId>
            <urn:DevId>DEV_ID</urn:DevId>
            <urn:AuthCert>AUTH_CERT</urn:AuthCert>
         </urn:Credentials>
      </urn:RequesterCredentials>
   </soapenv:Header>
   <soapenv:Body>
      <urn:AddItemRequest>
         <urn:DetailLevel>ReturnAll</urn:DetailLevel>
         <urn:ErrorLanguage>en_US</urn:ErrorLanguage>
         <urn:Version>733</urn:Version>
      </urn:AddItemRequest>
   </soapenv:Body>
</soapenv:Envelope>
eot

# Set Headers
header = {
  'Accept-Encoding' => 'gzip,deflate',
  'Content-Type' => 'text/xml;charset=UTF-8',
  'Host' => 'api.sandbox.ebay.com',
  'Connection' => 'Keep-Alive',
  'SOAPAction' => '',
  'Content-Lenth' => '160000',
  "X-EBAY-SOA-MESSAGE-PROTOCOL" => "SOAP12",
  "X-EBAY-SOA-SECURITY-APPNAME" => "APP_ID_HERE"}

# Post the request
resp, data_end = http.post(path, data, header)

# Output the results
puts 'Code = ' + resp.code
puts 'Message = ' + resp.body
resp.each { |key, val| puts key + ' = ' + val }
puts data_end

I had it working for a split second. Now I keep getting a getaddrinfo error whenever I run the code in IRB on Ubuntu's terminal.
I was playing around with creating sockets and I think that is how I got it to work. But when I tried to recreate the socket, I could no longer replicate the results.
Is there a better environment to launch this code in? And should I have to mess with sockets at all?
Doesn't Ruby have that sort of configuration built in with the HTTP request? If sockets are a huge part of this what sort of topics should I be researching? Is there a good resource that would show me how to setup the socket connections?

A: The first argument to Net::HTTP.new is the hostname or IP address. You have provided a URI. Ruby trying to resolve "http://..." as a hostname using DNS and it's failing.
Replace that line with:
http = Net::HTTP.new('api.sandbox.ebay.com', 443)

... and it works. (Or at least it progresses past that error.)


text:
Q: Wilcoxon Rank-Sum: computing the exact $p$-value I have two groups of data: $\{7, 9, 11\}$, $\{3, 8, 4\}$. I am performing Wilcoxon Rank-Sum on these data, based on the first group. Aggregated, we have $\{3, 4, 7, 8, 9, 11\}$. The test statistic is clearly $3 + 5 + 6 = 14$. I'm trying to figure out how to compute the exact two-sided $p$-value, but I don't understand my professor's explanations.
If I want a larger test statistic, the only way that can happen is if I have ranks $4$, $5$, and $6$. I get this. I also have to include the observed ranks $3$, $5$, and $6$. But what I don't understand is why ranks $1$, $2$, $3$ and $1$, $2$, $4$ are the only ones taken into account when calculating the other side of the $p$-value. Why not $1$, $2$, $5$ as well? This gives a rank less than $14$.

A: Here are the possible sets of ranks in sample 1, and their sum, from largest to smallest
4 5 6 = 15  <-- more extreme than your sample
3 5 6 = 14  <-- your sample is here
3 4 6 = 13
2 5 6 = 13
3 4 5 = 12
2 4 6 = 12
1 5 6 = 12
2 4 5 = 11
2 3 6 = 11
1 4 6 = 11 /______ the center is here, expected rank sum under H0 = 10.5
1 4 5 = 10 \
1 3 6 = 10
2 3 5 = 10
2 3 4 =  9
1 3 5 =  9
1 2 6 =  9
1 3 4 =  8
1 2 5 =  8
1 2 4 =  7 <- exactly as far from the center as your sample
1 2 3 =  6 <- more extreme than your sample, but in the other direction

A: The ranks of the two groups are $\lbrace 3,5,6\rbrace$ and $\lbrace 1,2,5\rbrace$, giving a statistic of 14, as you said.  You have to consider every way of taking 3 values from the ranks 1,2,3,4,5,6, as each of these is equally-likely under the null hypothesis of equal distributions.  So, in the worse case, list all ${6\choose 3} = 20$ of them and compute the test statistic for each possible sample.  This will give the null distribution of the statistic.


text:
Q: Sending file to API with Authorization .Net 5 On my system I need to send a file received from a form to an API that will be saved in Azure.
For this sending I need to pass a Bearer Token, the part of the token I was able to make and receive, testing by Postman I can send and receive the access url of the generated file.
In my .Net project I am not able to send the file and receive its url to write to the database. I need to pass this Token and make the uplad to the API URL.
I'll put the code I wrote so far.
[HttpPost]
public async Task<IActionResult> UploadAzure([FromForm] IFormFile file)
{
    var Token = await _tokenAzure.ReturnToken();
    var _urlApi = "https://mysite.dev/api/file/savepdf";
    var _tokenApi = Token.AccessToken;

    if (file == null || file.Length == 0)
        return Content("file not selected");

    HttpClientHandler clientHandler = new HttpClientHandler();
    clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };

    // Pass the handler to httpclient(from you are calling api)
    HttpClient client = new HttpClient(clientHandler);

    byte[] data;
    using (var br = new BinaryReader(file.OpenReadStream()))
        data = br.ReadBytes((int)file.OpenReadStream().Length);
    ByteArrayContent bytes = new(data);
    MultipartFormDataContent multiContent = new()
    {
        { bytes, "file", file.FileName }
    };

    var result = client.PostAsync(_urlApi, multiContent).Result;

    return RedirectToAction("Index");
}

A: You maybe want to add the following line of code.
client.DefaultRequestHeaders.Authorization =new AuthenticationHeaderValue("Bearer", _tokenApi);


text:
Q: xQuery 1.0, element counting I have a problem with writting a XQuery. I have this XML file:
<?xml version="1.0" encoding="UTF-8"?>
<book>
  <title>Data</title>
  <author>Serge Abiteboul</author>
  <author>Peter Buneman</author>
  <author>Dan Suciu</author>

    <title>Chapter1</title>

Text ...

      <title>SubChapter1</title>

Text ...

      <title>SubChapter2</title>

Text ...

        <title>Figure1</title>
        <image source="csarch.gif"/>

Text ...

    <title>Chapter2</title>

Text ...

      <title>Figure2</title>
      <image source="graphs.gif"/>

Text ...

      <title>SubChapter3</title>

Text ...

      <title>SubChapter6</title>

Text ...

        <title>Figure3</title>
        <image source="relations.gif"/>

      <title>SubChapter5</title>

Text ...

</book>

I have to write a Xquery that will count every SubChapter in a Chapter, and every figure in each. I got to this point so far:
    for $x in doc("file.xml")/book
    return (({data($x/title)}),
(<mChapter nrSubChapter="{count($x/section/title)}" nrFigure="{count($x/section/section/figure)}">{***data($x/section/title)***}</mChapter>),
    (<mChapter nrSubChapter="{count($x/section/title}" nrFigures="{count($x//figure)}">{***data($x/section/title)***}</mChapter>))

Also I don't know how to put the title of the chapter on the places marked with ***.

A: There are several things I don't understand in your sample query.  First of all, for $x in doc(...)/* will not loop over several nodes, as there is one root element in an XML document (it's a lie, but let's pretend there is no exception, for simplicity).
Your usage of parenthesis makes the query quite hard to read also.  Why not using a more natural XML structure for the output?
What you want to do is to retrive something from the whole book (the title), then loop over sections, then for each of them, loop over its own (sub-)sections.
let $book := doc('file.xml')/book
return
   <result>
      { xs:string($book/title) }
      {
         for $section in $book/section
         return
            <chapter nrSubChapter="{ count($section/section) }"
                     nrFigure="{ count($section/figure) }">
               <title>{ xs:string($section/title) }</title>
               {
                  for $sub in $section/section
                  return

                        <title>{ xs:string($sub/title) }</title>

               }
            </chapter>
      }
   </result>

If you can have several levels of sections, you will have to use recursion.
Also, as Jens said, you have not told us the exact output format you want, so I just give you an idea how to solve this, you'll have to adapt it to your precise requirements.
PS: Note I did NOT test the code.


text:
Q: How to split a polygon using R I have an irregular polygon which is a spatial object.

I want to divide it into multiple polygons (say, n=25) with equal height. To show how I want to divide it, I've plotted grids on the background using:
grid(NA,25)

If it is not possible, can anyone at least tell me how I'd be able to get the coordinates of the intersection points between the gridlines (which is not a spatial object, however) and the polygon's boundary?

A: Say your polygon is made up of the following points:
HL <- matrix(c(1,1,2,3,3,2,1, 1,2,4,2,1,0,1), ncol=2, byrow=FALSE)

At first, you have to make a spatial line with these points
require(rgdal)
require(sp)
L = Line(HL)
Ls = Lines(list(L), ID = "a")
SL = SpatialLines(list(Ls))
proj4string(SL) = CRS("+proj=utm +zone=46 +datum=WGS84 +units=m +no_defs")
plot(SL)

Know the max and min extent of your data
> max(HL)
[1] 4
> min(HL)
[1] 0

Now create vertical and horizontal sequence from the extent with an interval of say, 1 (depends on how you want your grids to be spaced)
vp<-seq(0, 4, by= 1)
hp<-seq(0, 4, by= 1)

To make horizontal grid like lines, first create points by combining Xmin and Xmax with all Y values
vpXmin<-cbind(rep(min(hp),length(vp)), vp)
vpXmax<-cbind(rep(max(hp),length(vp)), vp)

Now create a loop to combine each row of vpXmin and vpXmax to get the coordinates for each line
l <- lapply(1:nrow(vpXmin),function(i) rbind(vpXmax[i,],vpXmin[i,]))

To make spatial objects from your gridded lines, follow these steps
L1<-lapply(1:length(l),function(i) Line(l[[i]]))
Ls1<-lapply(1:length(L1),function(i) Lines(list(L1[[i]]), ID='a'))
SL1<-lapply(1:length(Ls1),function(i) SpatialLines(list(Ls1[[i]])))
for (i in 1:length(SL1)) {proj4string(SL1[[i]]) = CRS("+proj=utm +zone=46 +datum=WGS84 +units=m +no_defs")}

Now unlist the spatial lines
#  Get the Lines objects which contain multiple 'lines'
ll0 <- lapply( SL1 , function(x) `@`(x , "lines") )
#  Extract the individual 'lines'
ll1 <- lapply( unlist( ll0 ) , function(y) `@`(y,"Lines") )
#  Combine them into a single SpatialLines object and give projection definition
Sll <- SpatialLines( list( Lines( unlist( ll1 ) , ID = "a" ) ),
                    proj4string=CRS("+proj=utm +zone=46 +datum=WGS84 +units=m +no_defs" ))

Once you have both your grids and the polygon as spatial line objects, getting the intersection points between those is easy
require(rgeos)
intrsct <-gIntersection(Sll, SL)
#plot the polygon line
plot(SL, axes=TRUE)
#plot grid lines
plot(Sll, lty=2, add=TRUE)
#plot intersection points
plot(intrsct, add=TRUE, pch=16, col='red')
#the intersection points
View(intrsct)

Here's the final outcome: https://docs.google.com/file/d/0B6GUNg-8d30vX29wQ0gzTU5pZkE/edit?usp=sharing

A: When using sf features, the tool st_make_grid creates polygons of equal size that covers a shapefile. Set the spacing between each grid line with cell size.
Adapting an exemple from the R Documentation:
poly_sf<-st_polygon(list(rbind(c(0,0), c(0.5, 0.2),c(1,0), c(1,1), c(0,0))))
grid<-st_make_grid(poly_sf, cellsize = .1, square = TRUE)
plot(poly_sf, col="red")
plot(grid, add=T)

If working with sp type features, you can convert between sp and sf with:
grid_sp<-as(grid, "Spatial)#converts sf grid polygons into sp features
grid_sf<-st_sf(grid)#convert sp back to sf


text:
Q: Best option for C / Ruby interfacing I've got a Ruby on Rails application, which needs to communicate with a backend C application, and I'm wondering what the consensus is for the best approach is to this.
The two applications will run on separate servers, with the Rails application on a (partially) public web address.  The C application is entirely within a firewall.  For security reasons, I don't want them sharing a database.  My initial approach is that web services is the right way to go.
Firstly, am I missing any potentially better alternatives to my web services assumption?
Secondly, while I've got plenty of experience using SOAP from C with gSOAP (and importantly, so does the person who will be writing the C-side!), Ruby on Rails prefers the REST model.
But what exactly does a RESTful interface from C code entail?  Is there anything like gSOAP that does RESTFUL interfaces from C?
Does anyone have a feeling which is the path of least resistance here?
EDIT: forgot to mention that the C application does already have a web interface using Aapche / CGI.

A: For C calling Rails, libcurl is probably not too bad an option. Making REST calls is pretty simple, since it's mostly url via string concatenation plus form-encoding. Examples are abundant:
http://curl.haxx.se/libcurl/c/example.html
If you need Rails to C via REST ... ugh. Perhaps Apache and straight cgi? Or just wrap it in it's own rails app and do the calls directly from that app? Seriously, If you need Rails to C via REST, I hope you get a good answer.


text:
Q: How do you kill all the entities that enter a certain radius except for villagers and players? I have been trying to make a safezone for a map. I want to make it kill any mobs that come into the safezone except for villagers (for trading) and players within a certain radius.
I have looked at quite a few of the questions on here and haven't found the answer I'm looking for. Some people suggested using scoreboards and I find them extremely complicated. I don't know if they have a range function. I have seen some people say to make multiple kill commands and string them up, but I can't do that because I have the Mo' Creatures mod installed.
I am running Minecraft 1.10.2.
If anyone needs extra info on something comment and ask about it as I don't know what else to say in the question.
Please don't be harsh like some people have been to me in the past.

A: execute @e[type=!player,x=,y=,z=,r=] ~ ~ ~ kill @s[type=!villager]
Just add the coordinates and the radius you need in the first target selector.


text:
Q: Pass method parameter or option in plug-in     (function ( $ ) {
        $.fn.greenify = function( options ) {
            var settings = $.extend({
                color: "#556b2f"
            }, options );

            return this.css({color: settings.color});
        };
              //TODO another function here
       if ( action === "open") {
           alert("Open!");
        }

        if ( action === "close" ) {
           alert("lose!");
        }

    }( jQuery ));

`$( "div" ).greenify({color: "orange"});`//setting of options

I understand the above code sets options for greenify plug in, but I also want to call the display function.
How can I achieve this kind of usage while setting of options still available for the greenify :
`$( "div" ).greenify("open");`

and
$( "div" ).greenify(open,{color: "orange"});

A: You just check if options is an object or string
$.fn.greenify = function(options) {
    if (typeof options === 'string') {
        if (options === 'open') {
            alert('open');
        } else if (options === 'close') {
            alert('close');
        }
    } else {

        var settings = $.extend({
            color: "#556b2f"
        }, options);

        return this.css({
            color: settings.color
        });
    }
}


text:
Q: python 3.4 and Django 1.8.3 PIL import issue I have a Django blog-type app with articles. I'd like to attach images to these articles. When I try to do that, I get the following error and traceback:
Environment:

Request Method: POST
Request URL: http://[site].com/admin/paper/article/1/

Django Version: 1.8.3
Python Version: 3.4.1
Installed Applications:
('sorl.thumbnail',
 'django_mobile',
 'event_ticker',
 'paper',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django_mobile.middleware.MobileDetectionMiddleware',
 'django_mobile.middleware.SetFlavourMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware')

Traceback:
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/contrib/admin/options.py" in wrapper
  616.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/contrib/admin/options.py" in change_view
  1519.         return self.changeform_view(request, object_id, form_url, extra_context)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/utils/decorators.py" in _wrapper
  34.             return bound_func(*args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/utils/decorators.py" in bound_func
  30.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/usr/local/lib/python3.4/contextlib.py" in inner
  30.                 return func(*args, **kwds)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/contrib/admin/options.py" in changeform_view
  1459.             if form.is_valid():
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/forms.py" in is_valid
  184.         return self.is_bound and not self.errors
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/forms.py" in errors
  176.             self.full_clean()
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/forms.py" in full_clean
  392.         self._clean_fields()
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/forms.py" in _clean_fields
  405.                     value = field.clean(value, initial)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/fields.py" in clean
  644.         return super(FileField, self).clean(data)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/fields.py" in clean
  162.         value = self.to_python(value)
File "/home/me/webapps/bs/lib/python3.4/Django-1.8.3-py3.4.egg/django/forms/fields.py" in to_python
  674.         from PIL import Image

Exception Type: ImportError at /admin/paper/article/1/
Exception Value: No module named 'PIL'

I am running a virtualenv, here's the result of a pip freeze
Django==1.8.3
django-mobile==0.5.0
image==1.4.0
pbr==1.1.1
Pillow==2.9.0
Pillow-PIL==0.1.dev0
psycopg2==2.6.1
six==1.9.0
sorl-thumbnail==12.3
stevedore==1.5.0
uWSGI==2.0.11
versiontools==1.9.1
virtualenv==13.0.3
virtualenv-clone==0.2.5
virtualenvwrapper==4.6.0
wheel==0.24.0

I could provide a million other details. I don't have PIL installed and I can't install it because the virtualenv I'm using is running python3.4, which won't even install PIL correctly because it's so old. When I try to install PIL (using the --allow-unverified option I learned from searching on here) I get an error involving the print command.
I'm really confused. I thought Django had dropped PIL entirely? But it's showing up in a Django file as a required module? Do I need to use another version of python to install it or am I missing something extremely obvious?


text:
Q: Convert image to a digital matrix using python I have an image "felix.png" (280x280).
and I'm converting this image to digital matrix:
from PIL import Image
from numpy import array

img = Image.open('felix.png')
arr = array(img)

the shape of this array is (280,280,3) and I wonder why each pixel is represented with 3 dimensional array?
for example arr[0][0] is [255,255,255]...

A: Because it is a color image. The third dimension is color.
thus
r = arr[:,:,0]
g = arr[:,:,1]
b = arr[:,:,2]

if PIL opens the image as RGB.
This means a red pixel at point (x,y) would be [255, 0, 0], and a white pixel [255, 255, 255].


text:
Q: Images and Linear Transformations I was playing around with some of the Image processing commands like ImageRotate.
I thought it would be fun to try and make up some basic linear transformation rules - starting in 2D and then going to 3D.
I wrote up some naive rules as:
iden = {{1, 0}, {0, 1}}; (* identity, leave all points unmoved *)

axisres[a_, b_] := {{a, 0}, {0, b}} (* axis rescaling *)

rot[th_] := {{Cos[th],-Sin[th]},{Sin[th],Cos[th]}} (* rotation *)

reflect = {{-1, 0}, {0, 1}}; (* reflection *)

shearleft[a_] := {{1, a}, {0, 1}} (* shear left direction *)

shearright[b_] := {{1, 0}, {b, 1}} (* shear right direction *)

However, when I do the following - only the identity works properly.
 image1 = {{0.1, 0.2}, {0.4, 0.5}};

 Image[image1]

 Image[image1.iden]

 Image[image1.axisres[1,2]]

 Image[image1.rot[Pi]]

 Image[image1.reflect]

 Image[image1.shearleft[.2]]

 Image[image1.shearright[-.2]]

I suspect it is some silly error, but I still do not see it. Why do these simple transformations not preserve the image and just perform their intended operation?

A: Just for completeness sake: You can use your own transformation functions, with ImageTransformation or ImageForwardTransformation, like this:
img = ExampleData[{"TestImage", "Clock"}];
ImageTransformation[img, rot[π/4].# &, DataRange -> {{-1, 1}, {-1, 1}}]

ImageTransformation[img, reflect.# &, DataRange -> {{-1, 1}, {-1, 1}}]

The second argument to ImageTransformation is a function that gets an xy coordinate pair in the destination image and returns a transformed xy coordinate pair in the source image.

A: What you want here is ImageForwardTransformation[]. For instance, to demonstrate rotation and shearing, we can do this:
lenna = ExampleData[{"TestImage", "Lena"}];

(* rotation *)
ImageForwardTransformation[lenna, RotationTransform[π/4], DataRange -> {{-1, 1}, {-1, 1}}]

(* shearing + translation *)
ImageForwardTransformation[lenna, AffineTransform[{{{1, Sqrt[3]/2}, {0, 1}}, {1/2, 0}}],
                           DataRange -> {{-1, 1}, {-1, 1}}]

Note the use of a TransformationFunction[] (RotationTransform[] in the first case, and the more general AffineTransform[] in the second case) to perform the mapping, as well as the use of the DataRange option to specify the domain in which the image being transformed is embedded in.


text:
Q: Is a finite dimensional vector also a covector? I am reading something where it seems they have defined a covector/linear functional as a map $F: \mathbb{R}^n \to \mathbb{R}$ where $F$ is a vector
For example, $F(x) = \begin{bmatrix} 1 & 2 \end{bmatrix}x$, $x \in \mathbb{R}^2$. Pick $x = [1, 0]^T$, then $F(x) = 1$. The action of the covector is the standard inner product.
I was super confused because the notation $F(x)$ reminded me of a linear map.
Excuse my ignroance as I have never seen a covector defined this way. Is this a legit covector?


text:
Q: Display app version in Blazor Webassembly I a trying to display the version on NavMenu bar of my blazor webassembly app.
Here is what i have tried:
@code {
 protected string AppVersion => Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;

}
When i run my application i get AppVersion as 1.0.0.
Is that correct?
Thank you for the comment.

A: Yes, this is correct. This is the default assembly version.
If you want to change the version number, you can add Version in the .csproj file:
<PropertyGroup>
    <Version>2.0.0.0</Version>
</PropertyGroup>

When you perform a Build operation on the project, you can see that the AssemblyVersionAttribute, AssemblyInformationalVersionAttribute and AssemblyFileVersionAttribute in the ProjectName.AssemblyInfo.cs file(in \obj\Debug\net6.0) changes accordingly (the default is 1.0.0.0):
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.0.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.0.0.0")]


text:
Q: trying to reshape a numpy array to from 4X4 to 2X2 I have a simple numpy array of ('left_lines =', (4, 4)) which is [x1,y1,x2,y2] which is 4x4 and trying to reshape it to 2x2 and take the mean for X's and Y's . I use this code:
mean_left = np.mean(left_lines.reshape(2,2),axis=0)

But I get this error:

total size of new array must be unchanged

print(type(left_lines))

Gives:
<type 'numpy.ndarray'>

Not sure what is wrong with reshape syntax !?


text:
Q: Customize Action Bar Sherlock I am working on an app in which I have implemented Action Bar using Action Bar Sherlock. I have also assigned style to it using Action Bar Style Generator from the following link:-
(http://jgilfelt.github.io/android-actionbarstylegenerator/#name=test_style&compat=sherlock&theme=light&actionbarstyle=solid&texture=0&hairline=0&backColor=9c0%2C100&secondaryColor=D6D6D6%2C100&tabColor=33B5E5%2C100&tertiaryColor=fff%2C100&accentColor=ff0%2C100&cabBackColor=fff%2C100&cabHighlightColor=33B5E5%2C100)
Its perfectly doing what I want but now my problem is that I have no control on the font type/size/color of the title of Action Bar or even on the pop-up menu font. I just want to know how can I change the font size/type/color of my Action Bar from the styles that I have generated from the above link.
Please help me to sort this out, any help would be appreciable
Thanks in Advance.


text:
Q: Get list of dependent Tables, SQL Server 2005 lets say I have table1 = 'foo' and 4 other tables fee1, fee2, fee3, fee4
now say the primary key of foo is a foreign key of fee1 and fee2.
Given the name 'foo' how will I get to know that fee1 and fee2 has foriegn key dependencies on foo.
Please help, a psuedo query would be helpful.
However, I know how to figure out given the name foo how to get the foriegn key dependencies of foo alone. using INFORMATION_SCHEMA.USAGE_KEY_COLUMN.

A: Try this in SQL Server Mgmt Studio:
SELECT
    fk.name,
    OBJECT_NAME(fk.parent_object_id) 'Child table'
FROM
    sys.foreign_keys fk
WHERE
    fk.referenced_object_id = OBJECT_ID('YourTableNameHEre')

This will list all the foreign key constraints and what table they're coming from that are referencing your YourTableNameHere table.

A: Try this
SELECT
    'CONSTRAINT :' + C.Constraint_Name + '
    Goes FROM ' + PK.TABLE_NAME + '.' + PT.COLUMN_NAME + '
    To ' + FK.TABLE_NAME + '.' + CU.COLUMN_NAME + '
    -----------------------------------------------------
    '

FROM
    INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
    INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK
        ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME
    INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK
        ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
    INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU
        ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAME
    INNER JOIN
    (
        SELECT
            i1.TABLE_NAME, i2.COLUMN_NAME
        FROM
            INFORMATION_SCHEMA.TABLE_CONSTRAINTS i1
            INNER JOIN
            INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2
            ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME
            WHERE i1.CONSTRAINT_TYPE = 'PRIMARY KEY'
    ) PT
    ON PT.TABLE_NAME = PK.TABLE_NAME

To get your specific table, add
`WHERE PK.TABLE_Name = "YourTableName"`

A: one way, just add AND TC.TABLE_NAME = 'foo' to the WHERE clause
SELECT TC.CONSTRAINT_SCHEMA + '.'+ TC.TABLE_NAME AS PRIMARYKEYTABLE
,TC.CONSTRAINT_NAME AS PRIMARYKEY
,COALESCE(RC1.CONSTRAINT_NAME,'N/A') AS FOREIGNKEY
,CASE WHEN TC2.TABLE_NAME IS NULL THEN 'N/A'
 ELSE TC.CONSTRAINT_SCHEMA + '.' + TC2.TABLE_NAME  END AS FOREIGNKEYTABLE
 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC
 LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC1
        ON TC.CONSTRAINT_NAME =RC1.UNIQUE_CONSTRAINT_NAME
 LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC2
        ON TC2.CONSTRAINT_NAME =RC1.CONSTRAINT_NAME
 WHERE TC.CONSTRAINT_TYPE ='PRIMARY KEY'
 ORDER BY TC.TABLE_NAME,TC.CONSTRAINT_NAME,RC1.CONSTRAINT_NAME

From Find all Primary and Foreign Keys In A Database

A: I use sp_help for providing a summary level view of the different database objects. When you specify a database table it returns information regarding primary keys, constraints, indexes, foreign keys and what they reference, and which other tables have foreign keys to the one specified. It is quick and easy to remember way of getting this information all at once.

A: The answer is in this URL. A very helpful tutorial..
Great query.
http://www.jasinskionline.com/technicalwiki/Default.aspx?Page=List-Tables-in-Dependency-Order-SQL-Server&NS=&AspxAutoDetectCookieSupport=1


text:
Q: Dividing two simple select statements I have two simple select statements and just want to divide the first one by the second one.
SELECT COUNT (DISTINCT INITIATIVE_ID)
FROM GPD_ERROR_WARNING_NEW

SELECT COUNT (DISTINCT SAVINGS_ID)
FROM GPD_SAVINGS_REGULAR

The first select statement results in 300
The second select statement results in about 1500, so just looking for that magic .2
I know it is simple to do by hand but looking to automate this and make it a view as it needs to be updated every hour.

A: This will work, but it leaves you open to a "divide by zero" error:
SELECT
  (SELECT COUNT (DISTINCT INITIATIVE_ID) FROM GPD_ERROR_WARNING_NEW) /
  (SELECT COUNT (DISTINCT SAVINGS_ID) FROM GPD_SAVINGS_REGULAR)
FROM DUAL;

This will give you a null result instead of an error if the second (denominator) count comes up as zero:
SELECT
  (SELECT COUNT (DISTINCT INITIATIVE_ID) FROM GPD_ERROR_WARNING_NEW) /
  NULLIF((SELECT COUNT (DISTINCT SAVINGS_ID) FROM GPD_SAVINGS_REGULAR), 0)
FROM DUAL;

A: You can write your query like this (in sql):
SELECT
(SELECT DISTINCT COUNT(INITIATIVE_ID) FROM GPD_ERROR_WARNING_NEW) /
ISNULL((SELECT DISTINCT COUNT(SAVINGS_ID) FROM GPD_SAVINGS_REGULAR), 0)
FROM DUAL;


text:
Q: Concatenate rows of two dimensional list elements in a list I want to reorganize two-dimensional list elements in a list (here two elements):
[[['A','B','C'],
  ['G','H','I']],
 [['D','E','F'],
  ['J','K','L']]]

to become:
[['A','B','C','D','E','F'],
 ['G','H','I','J','K','L']]

Is there a better way to write this, than the one expressed by the following function?
def joinTableColumns(tableColumns):
    """
    fun([[['A','B','C'],
          ['G','H','I'] ],
         [['D','E','F'],
          ['J', 'K', 'L']]]) --> [['A', 'B', 'C', 'D', 'E', 'F'],
                                  ['G', 'H', 'I', 'J', 'K', 'L']]
    """
    tableData = []

    for i,tcol in enumerate(tableColumns):

        for j,line in enumerate(tcol):
            if i == 0:
                tableData.append(line)
            else:
                tableData[j]+=line

    return tableData

Considering, that the number of rows to join is equal:
tdim_test = [(len(x), [len(y) for y in x][0] )for x in tableData]

len(list(set([x[0] for x in tdim_test])))==1

How can I increase robustness of that function? Or, is there something from a standard library that I should use instead?

A: Yes, you can use zip() function and itertools.chain() within a list comprehension:
In [17]: lst = [[['A','B','C'],
                 ['G','H','I']],
                [['D','E','F'],
                 ['J','K','L']]]

In [18]: from itertools import chain

In [19]: [list(chain.from_iterable(i)) for i in zip(*lst)]
Out[19]: [['A', 'B', 'C', 'D', 'E', 'F'], ['G', 'H', 'I', 'J', 'K', 'L']]

Or as a pure functional approach you can use itertools.starmap() and operator.add():
In [22]: from itertools import starmap

In [23]: from operator import add

In [24]: list(starmap(add, zip(*lst)))
Out[24]: [['A', 'B', 'C', 'D', 'E', 'F'], ['G', 'H', 'I', 'J', 'K', 'L']]

A: import functools
[ functools.reduce(lambda x,y: x + y, i,[])  for i in zip(*matrix)]

This will give you what you want

A: You could just use the zip function, unpacking the table inside it and add the pairs:
table = [[['A','B','C'], ['G','H','I']],
         [['D','E','F'], ['J','K','L']]]
res = [t1 + t2 for t1, t2 in zip(*table)]

which yields your wanted result:
[['A', 'B', 'C', 'D', 'E', 'F'], ['G', 'H', 'I', 'J', 'K', 'L']]


text:
Q: How to run it ? SQLlite Maybe my question will be so stupid but I'm really beginner in topic of java/ programming
I have a tutorial :
http://hmkcode.com/android-simple-sqlite-database-tutorial/
And my question is how to run from there an edit of record .
I'm trying with this one but without results:
Book book = new Book();
book.setAuthor("NEW name");
book.setTitle("new TITLE ");
db.updateBook(list.get(1));

Thank's for help !

A: here a good article about debugging , and this skill will help you solving and understand most of problem
http://www.vogella.com/tutorials/EclipseDebugging/article.html
the Log issue ,
because you log the object that you send to update not the object with the new data so the order object you log is the old object ,
to get the new order data make query after update statement with the order id and you will see the changed data

A: This is the solution :
// Updating single book
public int updateBook(Book book, String newTitle, String newAuthor) {

// 1. get reference to writable DB
SQLiteDatabase db = this.getWritableDatabase();

// 2. create ContentValues to add key "column"/value
ContentValues values = new ContentValues();
values.put("title", newTitle); // get title
values.put("author", newAuthor()); // get author

// 3. updating row
int i = db.update(TABLE_BOOKS, //table
        values, // column/value
        KEY_ID+" = ?", // selections
        new String[] { String.valueOf(book.getId()) }); //selection args

 // Based on your condition

// 4. close
db.close();

return i;

}


text:
Q: Delete Row / Remove Row I want to delete my rows in gridview, but when I try many code the error are same.
When I try this
Using sqlCon As New SqlConnection(PyrDLL.Koneksi.ConnectionString)
        Using cmd As New SqlCommand()
            cmd.CommandText = "xyz"
            cmd.Connection = sqlCon
            sqlCon.Open()
            Dim da As New SqlDataAdapter(cmd)
            Dim dt As New DataTable()
            da.Fill(dt)
            Gridview1.DataSource = dt
            Gridview1.DataBind()
            sqlCon.Close()
            If Gridview1.Rows.Count = 0 Then
                Dim dtempty As DataTable = Nothing
                dtempty = (DirectCast(Gridview1.DataSource, DataTable)).Clone()
                dtempty.Rows.Add(dtempty.NewRow())
                Gridview1.DataSource = dtempty
                Gridview1.DataBind()
                Gridview1.Rows(0).Visible = False
                'Gridview1.Rows(0).Controls.Clear()
            Else
                For i As Integer = 0 To dt.Rows.Count - 1
                    dt.Rows(i)("rupiah") = PyrDLL.Decrypt(dt.Rows(i)("rupiah"))
                    dt.Rows(i)("rupiah") = Decimal.Parse(dt.Rows(i)("rupiah")).ToString()
                    'i = i + 1
                Next
                Gridview1.DataBind()
                For i As Integer = Gridview1.Rows.Count - 1 To 1 Step -1
                    Dim row As GridViewRow = Gridview1.Rows(i)
                    Dim prevrow As GridViewRow = Gridview1.Rows(i - 1)
                    If (TryCast(Gridview1.Rows(i).Cells(1).FindControl("lblketerangan"), Label).Text.ToString() = TryCast(Gridview1.Rows(i - 1).Cells(1).FindControl("lblketerangan"), Label).Text.ToString()) And (TryCast(Gridview1.Rows(i).Cells(0).FindControl("lblcomp"), Label).Text.ToString() = TryCast(Gridview1.Rows(i - 1).Cells(0).FindControl("lblcomp"), Label).Text.ToString()) Then
                        Dim total As Integer = Convert.ToDecimal(TryCast(Gridview1.Rows(i - 1).Cells(2).FindControl("lblrupiah"), Label).Text)
                        Dim total2 As Integer = Convert.ToDecimal(TryCast(Gridview1.Rows(i).Cells(2).FindControl("lblrupiah"), Label).Text)
                        Dim total3 As Decimal
                        total3 = total + total2
                        DirectCast(Gridview1.Rows(i - 1).Cells(2).FindControl("lblrupiah"), Label).Text = Decimal.Parse(total3).ToString()
                        row.Visible = False
                        'Gridview1.Rows.Remove(Gridview1.Rows(i)) <--- if i comment here its run without problem
                    End If
                Next
            End If
        End Using
    End Using

the error
Remove' is not a member of 'System.Web.UI.WebControls.GridViewRowCollection'
Can you help me?
now, i hide the row after i sum it but i want to auto delete / remove row after i sum it not only hide
Thanks

A: I am not sure what you are trying to do when there are no rows, the gridview would be empty
You should do the following instead:
'Call GetData() every time you want to bind data to the gridview
Private Function GetData()

    Gridview1.DataSource = Nothing
    Gridview1.DataBind()

    Dim strQuery = "SELECT..."
    Dim dt As New DataTable()

    Using sqlCon As New SqlConnection(PyrDLL.Koneksi.ConnectionString)
        Using cmd As New SqlCommand(strQuery, sqlCon)
        'Add cmd parameters as required to prevent SqlInjection
        sqlCon.Open()

            Using ada As New SqlDataAdapter(cmd)
                ada.Fill(dt)
                Gridview1.DataSource = dt
                Gridview1.DataBind()
            End Using

        End Using
    End Using
End Function

When handling the data in the gridview you can use RowDataBound, you could then call a separate function to handle deleting a row after your logic is handled where the criteria is met to delete a row
Protected Sub Gridview1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Gridview1.RowDataBound
    If e.Row.RowType = DataControlRowType.DataRow Then
        'Handle databound logic
    End If
End Sub

You should be able to tailor this to your needs, just called GetData() everytime you need to rebind data to the gridview

A: I solved my problem
i cant remove rows from data gridview but i remove data from data table and bind it after thats
thanks everyone


text:
Q: Use Clusterize.js in Angular project I'm trying to use the Clusterize.js library in my Angular project (https://clusterize.js.org/).
I have never imported an external js library in projects, and I am failing trying what I found on the web (add module, place in assets, load in index.html...). Always errors like module Clusterize not found, undefined, or constructor not defined etc...
How to implement Clusterize.js ? What are the best practices ?
Thank you.

A: Best way to use an external JavaScript library in an Angular project is :
Declare JavaScript file in angular.json
{
  ...
  "scripts": [
    "node_modules/clusterize/clusterize.min.js"
  ]
}

Import it in your TypeScript file as module
import * as Clusterize from 'clusterize';


text:
Q: Colocando um vetor em ordem decresente Preciso criar um vetor de tamanho N mas ele tem que esta ordenado decrescente só que quando eu faço o codigo sempre da 0.
public int[] vetor_dec (int n) {
    int[]vetor = new int[n];
    for(int i=n;i>vetor.length;i--) {
        int aux=0;
        vetor[aux]=i;
        aux++;
    }
    return vetor;
}

Teria como me dizer o que esta errado?

A: Olhei rápidamente aqui seu int aux=0; esta dentro do For, esta alimentando seu vetor sempre na posição 0 !

A: Os problemas no seu código são os seguintes:

*

*Você nunca vai entrar nesse loop:
for(int i=n;i>vetor.length;i--) {

Ao iniciar, i vale n, que é igual a vetor.length; quando a condição for testada, dará false de cara, de modo que ele vai retornar o vetor inalterado.
E como em Java um vetor é sempre iniciado com tudo zero (ou null, se for um vetor de referências) então é isso que você vai obter.
Uma solução é percorrer de n até 1:
for(int i=n;i>0;i--) {

*O aux está sendo definido dentro do corpo do loop
for(int i=n;i>vetor.length;i--) {
    int aux=0;

Isso significa que, mesmo que seu primeiro problema seja resolvido, ele sempre será zero. Isso faria com que você atribuísse a posição zero do seu vetor, várias vezes (uma sobrescrevendo a outra). O resultado seria algo do tipo:
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Para resolver isso, é só mover o aux para fora do loop, de modo que ele preserve seu valor (incrementado por você) entre uma iteração e outra:
int aux=0;
for(int i=n;i>vetor.length;i--) {

Código completo:
int[]vetor = new int[n];
int aux=0;
for(int i=n;i>0;i--) {
    vetor[aux]=i;
    aux++;
}
return vetor;

Nota: estou assumindo que você quer valores de 1 a n. Se quer outro intervalo - por exemplo de 0 a n-1 - ajuste a condição do seu for de acordo.

A: Muda o seu for e tira a variável aux do loop.
Deixa o código assim:
public int[] vetor_dec (int n) {
    int[]vetor = new int[n];
    for(int i=n-1;i>=0;i--) {
        vetor[i]=i+1;
    }
    return vetor;
}


text:
Q: How to transfer user accounts (user ID, password) from Magento 1.3.1 to 1.9.1? I've setup a brand new Magento shopping cart (1.9.1) and imported all products by hand. Now I realized that customers who created accounts on the old shopping cart are upset because they are no longer able to use their existing accounts to login into the new shopping cart...
What would be the best way to import the user accounts from the old 1.3.1 to the newest version of Magento?

A: You will need to export your customers separately from products.
To do this, create a dataflow profile System -> Import/Export -> and select 'Customers' as Entity Type. Export and Import as normal.
I could be wrong, but I'm fairly certain that's all you need to do. The passwords should still hash.


text:
Q: '80-'90s sci-fi movie about a prison spaceship orbiting the Earth Sci-fi movie was made in the '80s-'90s or earlier. It's about a prison spaceship orbiting the Earth, which includes one very large and dangerous alien behind huge metal doors. All kinds of neat tech things for a sci-fi film made 40-50 years ago.
One tidbit was that intimacy between people was now a finger touch. Of course, the giant alien breaks out and we have ship problems, space walks... and eventually perhaps an eEarth landing? You get the drift...
Does anyone remember this title? I remember renting it from a local video rental place just before they completely shut the doors.

A: Sounds like the TV miniseries, Something is Out There, which received a VHS release.

Jack Breslin (Joseph Cortese) is a police officer investigating brutal murders in which organs have been removed from the victims. He learns that the crimes are being committed by a monstrous alien insectoid prisoner known as a xenomorph, possessing shape-shifting and physical possession abilities, who has escaped from an alien prison starship passing by the solar system, and he teams up with a beautiful medical officer from that ship, Ta'Ra (Maryam d'Abo), to track down the villain. Ta'Ra has assorted superhuman abilities, including telepathy and superhuman agility, which come in handy during the mission.

Definitely has a prison ship passing near the Earth, and a dangerous alien locked up behind these doors.

There's also a scene with two of the humanoid aliens joining their fingertips as an apparent form of intimacy.

The whole series/film is up on YouTube.

A: To me that sounds like Fortress 2: Re-Entry. I remember this being on TV several times during the 90s.

John is then knocked out and captured. He wakes up in a room with a disembodied voice telling him that he is in prison again and has been sentenced to death. He has been implanted with a behavior modification device which causes headaches of various intensity when prisoners enter prohibited areas. He also finds one of the men who visited him, a former Men-Tel vice president, who is now brain-damaged because of an improperly planted device. Another of John's visitors, a former soldier, is also in the jail and friends with one of the guards.


text:
Q: How to receive KeyDown event within an ItemsControl I got a pretty complex WPF-Window with a lot of sub controls using strict MVVM. One of them is an ItemsControl.  What I want to accomplish is to propagate a PropertyChanged-Event to Items within the ItemsControl when the Alt-Key is pressed anywhere - not just when the ItemsControl is focused. How can I do that?
An example: when I press the LeftAlt-Key anywhere within the Main Window I want to change the text of a button which is part of an item within an ItemsControl.

A: see similar question here
 answer with more than 100 upvotes
or consider using a Behavior  with command
Edit :
Behavior on the upper control(MainView i guess) to register to the KeyDown Event and excute a command on your ViewModel


text:
Q: Apple's JWT Identity token during the Sign In With Apple transfer period I carefully checked the documentation and searched the net - but I didn't find the definitive answer. :(
After the transfer of the app from old dev team to new dev team is started, the Apple's user's auth response (JWT Identity token), will contain both sub and transfer_sub properties.
But what value will the sub property contain? Is it the old sub which was relevant for the old team, or it will contain new sub relevant for the new team?
I came across this 2 theories:

*

*For the specific user, on the first call right after the migration
started, the sub will contain old sub (related to old team), but on
following calls it will contain the new sub (related to the new
team)  - or -

*From the start of the migration the sub will contain the new
sub (related to new team) - or -

*Something else?

(Of course - it is clear to me - that response will contain transfer_sub so we can match the user with user data in our db, also it is clear how to generate new sub based on transfer_sub.)
Thank you!


text:
Q: 'I can identify myself with' or 'I can identify with'? Which is more correct?

I can identify myself with

or

I can identify with

A: You can identify with someone, where identify means sympathize:
"I can identify with him. I am a single parent as well."
You don't typically identify yourself with someone, just to someone. Here, identify means to establish or indicate who or what you are.
"I had to identify myself to the police, which was a problem, as I didn't have my license with me."

A: It's a bit hard to tell what you're asking, but I'll give it a shot.
Both serve different purposes:

I can identify with this character in the novel.
I can identify myself with this ID badge.


text:
Q: QAction::setAccel(QString) not available from Qt 4? Following this documentation:
http://doc.qt.digia.com/qq/qq14-actioneditor.html
I figured that out there is no QAction::setAccel(QString) method anymore.
How can one modify the QAction accel other than using QtCreator? I need to change them runtime.
The documentation does not even seem to mention this method anymore here:
http://qt-project.org/doc/qt-4.8/qaction.html

A: It seems QAction::setAccel(QString) was renamed to setShortcut.

A: Actually, the documentation does contain this under the qt3support section:

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

You could still use it with some qmake modification as follows:
QT += qt3support

But as the documentation writes:

void QAction::setAccel ( const QKeySequence & shortcut )
Use setShortcut() instead.


text:
Q: Reduce file size of exported PDF from Notability app I use the Notability app for note taking in my iPad. I need to export one of my notes and upload it to a web site with file size restrictions (unfortunately I don't know the maximum size, but I have reason to believe it is 2 MB).
A 12-page-long note, consisting only of written text/mathematics and a single grayscale imported figure in one of the pages is taking up 10+ MB, which is frankly outrageous. Also, I'm pretty sure taking out the figure would make little difference; seems like the developers never paid attention to exported file sizes.
How can I reduce this to fit into my 2 MB budget?
Ideally I'd like to flip a switch inside Notability itself which reduced the export file size, but I don't think anything like that exists.
Otherwise, I'm looking for free tools which would help me reduce the file size. EDIT: online tools are not a possibility, as I can't run the risk of my file being stored and later distributed somehow.
I've already tried exporting a PDF from Preview.app with the "Reduce File Size" filter, which didn't make a difference.
Ghostscript fared a little better: gs -o out.pdf -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET in.pdf reduced the file size to 7 MB, but it's not enough for me.
ImageMagick's convert tool produced output that could be barely classified as readable, even at an alleged 600 DPI.
I also tried exporting JPEGs from Notability and concatenating them with Preview.app, which produced a 4 MB file size, still unsuitable for me (and also, I lose vector rendering, searching, etc. that way, which if possible I'd like to retain).
My best result until now was running this 4 MB file through gs -o out.pdf -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET in.pdf (note ebook instead of printer). It is readable, although visibly compressed, and takes up 1.3 MB. Lacking any other options, this is the file I'm going to submit, but I'm hopeful there's a better solution.
Any other suggestions?

A: Assuming your top priority is to minimize file size. You are going to have to sacrifice and switch over to an image format. Notability uses a vast amount of vectors in order to keep your handing writing sharp and readable at any size, so we will need to discard that information in favor of a simpler , less sharp jpeg file.
If you have photoshop, export all the files from Notability into an image format and bring them into your desktop to work on. Opening all the images inside Photoshop, use the "save for web" feature and select the absolute minimum of colors possible. I suggest 2 colors for the page (background & lines), and and 3-5 colors for pens (black, red, blue, green, is okay with dithering ).
This will allow you to create an image with minimal compression, at a sharper resolution.
If you have GIMP (free and open source <3): You can add an extension that gives you similar functionality to that of Photoshop's "save for web" function. Here is a guide to how to install and use its different options on TemplateToaster.com.
These are both options for bringing 1920x1080 images down to about ~<80 KB each with readable text and minimal compression.
Edit:
I thought I would include an example that I create with my own notes, exported to Jpeg directly from Goodnotes 5 (this works regardless of program). All images are at the native resoultion of 1668x2154
Below are the results you can expect to see.

On the right, are the original, straight from Goodnotes exported jpegs. On the left, are the images compressed down with the "save for web" plugin on Gimp.
Below are the options that I used for most of the pages, with the exception of pages with images, where instead the "use web-optimized pallete" option was selected. Note how there are only 5 colors.(page, page line, 2 pen colors, white text)

Using this option will retain all text sharpness from the original exported text. Below is difference in quality, on the left is the compressed image, and the right uncompressed.

This should answer your question. As previously stated, you cannot expect to maintain the .pdf format and submit your work under such a tight data budget. The size of all the files combined together in the first image is in relative to a normal folder with all the images inside. When .zipped, you can expect an even larger file reduction (depending of course on the level of compression that you select with something like 7zip). As I predicted in my orignal response, the average file size among the 13 pages is 76.38 kb, just 3.62 kb under.

A: I discovered this by trial and error, and it did help.

*

*Tap on the Share icon in Notability

*Tap on Other Apps

*Choose the File format = Image, Image type = PNG, Page Range = All, or whatever you want

*Tap on Share Note

*Choose Print from the options which come up

*You will see a preview. Pinch out to expand that to fill the whole page

*Share again to Files app or wherever you want

I have attached screenshots of the above steps. Hope that helps.

A: You could use PDFsam to split your pdf into smaller parts and see if you can load the separate files. PDFsam stands for PDF split and merge. It's a free package and it runs on a mac. Maybe split your file into multiple files and see which ones will load. This may help you find what is causing the file to be so large. If file split PDF 3, for example, is 10 MB maybe you can track down why your file is so large and fix it at the source. If all the split files are large maybe that will tell you something.

A: You could see if Exporting to PostScript and then re-distilling as PDF improves matters. In Preview, click on Export, and then hold Alt and click on the drop-down list of file Formats. (Alt will provide a bigger list of formats.)
Select PostScript, save the file, and then run the .ps file through GhostScript to create a new PDF.
I'm a bit worried when you say that the text appears visibly compressed -- that would suggest that the text is an image, rather than ... well, text. Ideally, text data should be smaller than pages of images.

A: I had good luck using Adobe Acrobat for this.
Original file is from Notability, created entirely within Notability, all handwritten, etc. The result was  26 pages, 18.4MB.  Acrobat save as ... reduced size gave 11.8 MB.
Acrobat export original as PNG with settings changed to have PNG resolution of 300 dpi (which I found quite readable) produces 26 PNG files.  Then "create ... combine files" to produce one PDF from the 26 PNGs produced 6.9MB.
Then I saved the combined PDF using "reduce size..." and the result came out to 1.6MB.
Note: the combined size of the PNGs as separate files is just 3MB, so the first combined file had a fair amount of overhead in combining them into a single PDF (i.e. 3.9MB "penalty"). The combined and then reduced PDF lost that, but also lost a little bit in readability.  I think if I changed the "optimize" settings I could probably get something that is exactly the same size as the 3MB combined size of the PNGs, and no loss in readability (but even the 1.6MB was still pretty good).

A: If you are able to access the PDF files generated by Notability on a Mac, read on:
I recently started using the following method reducing the size of PDF's exported by several apps (Scanner apps, Notability, etc) is the following:
The Preview app (free on a Mac) comes with a filter called "Reduce file size" that can be applied if you open a pdf and re-export it as pdf. There is a way to tweak the level of compression done by this filter without modifying the original filter.
Open the Colorsync Utility on your Mac, and find the filters through the Filters tab, choose Reduce File Size, and then duplicate it (the icon resembling a double-page on the right). It will create "Reduce File Size Copy" under Custom Filters. Tweak the Constrain Size under sampling and Quality under compression until you meet the desired compromise in the look/file size for the document.
I hope this helps!


text:
Q: How i can i iterate through data on website I want to extract users from a website bu using for loop, but i don't know how can i put correctly "i" instead of number 1
after i put
user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text

Traceback (most recent call last):   File "D:/Code/Python/Instagram
  Unfollow/Instagram Unfollow.py", line 32, in
      user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text
  File
  "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py",
  line 293, in find_element_by_xpath
      return self.find_element(by=By.XPATH, value=xpath)   File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py",
  line 752, in find_element
      'value': value})['value']   File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py",
  line 236, in execute
      self.error_handler.check_response(response)   File "C:\Python33\lib\site-packages\selenium\webdriver\remote\errorhandler.py",
  line 192, in check_response
      raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: Unable to
  locate element:
  {"method":"xpath","selector":"(//div[@class='gzjax'])[0]"}
  Stacktrace:
      at FirefoxDriver.prototype.findElementInternal (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
      at FirefoxDriver.prototype.findElement (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/fxdriver@googlecode.com/components/driver-component.js:10779)
      at DelayedCommand.prototype.executeInternal_/h (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/fxdriver@googlecode.com/components/command-processor.js:12661)
      at DelayedCommand.prototype.executeInternal_ (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/fxdriver@googlecode.com/components/command-processor.js:12666)
      at DelayedCommand.prototype.execute/< (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/fxdriver@googlecode.com/components/command-processor.js:12608)

A: Just concatenate i (first cast it to string) to your desired string:
for i in range (0,100):
    user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text
    print(user_id)

A: Try this.  I think you concatenate variables into string with plus sign in python:
user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+i+"]").text

see how we add ("string" + variable + "string")

A: You would need to explicitly convert i from int to string. How about:
for i in range (0,100):
    user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text
    print(user_id)

A: I don't know how many users there are on the page, but as it stands you're bound to 101.
Could just loop through the elements?
for i in browser.find_element_by_xpath("(//div[@class='_gzjax'])"):
    user_id = i.text
    print(user_id)

Something along those lines where you are iterating over items instead of indices.


text:
Q: Label reviews in file using sentiwordnet I'm very new to Sentiment analysis and need some guides. I have a text file of movie reviews and I want to label each review with pos/neg score using sentiwordnet. What steps I should follow to do that?

A: You should check out NLTK. The package has an interface for sentiwordnet that is simple to use. http://www.nltk.org/howto/sentiwordnet.html
As for the actual sentiment analysis, there are a lot of guides on how to train machine learning models for this task. And sentiwordnet scores can used as features for the classifier.
If you want to use just that alone, the simplest model would be to sum the scores of all the words in the review and make a final judgement.
Check out http://sentiment.christopherpotts.net/ if you want a simple starter to sentiment analysis.
Edit - Some more guides https://marcobonzanini.com/2015/01/19/sentiment-analysis-with-python-and-scikit-learn/
http://mlwave.com/movie-review-sentiment-analysis-with-vowpal-wabbit/