text:
Q: Meaning of the word "setup" in context I was watching Crash Course Astronomy and came across a sentence with the word "setup" that I cannot get.(The sentence is at about the 4th to 5th minute of the video.)

At one perihelion pass, one side of Mercury faces the Sun. Then, 88 days later or so, it approaches perihelion again. But it's spun 1.5 times, and this means the exact opposite side of Mercury faces the Sun at this closest approach. 88 days later, Mercury has spun 1.5 times again and the whole thing repeats. It turns out it is a perfectly legitimate stable configuration, just like the one to one spin/orbit setup.

I have looked up all the meanings of "setup" in various dictionaries, but still I cannot understand what it means there. The first definitions to come up were "arrangement" and "organization", but at that moment it was still unclear to me whether that definition fit.

A: Setup:
1. The way in which something is constituted, arranged, or planned.
It is about the way that a certain planet system is arranged around a star. The "one spin/orbit setup" means that the planet has settled in such a way (arrangement) of orbiting that when it is in a certain position in an orbit (say, perihelion), it has made one full rotation around its axis since the last time that it passed this very same spot.
Apparently, this paragraph is saying that earlier, astronomers thought that only one spin/orbit arrangement is stable; if a planet doesn't make a full rotation, or makes 1.x rotations as it turns one complete orbit around its star, it's not stable and it will gradually move into a different orbit. E. g. if it was making 0.8 rotations in a higher orbit, it would move to a lower orbit which would take 0.8 the time, and the relation will become 1 to 1. Now, they found out that a different arrangement can also be stable.


text:
Q: How to use EnumProcesses in node-ffi I was trying to use EnumProcesses with node-ffi. I got code below:
import ffi from 'ffi'

export const psapi = ffi.Library('psapi', {
  EnumProcesses: ['bool', ['ulong', 'ulong', 'uint16*']]
})

export class Win32ProcessManager {
  public async getProcessList () {

    let lpidProcess = ref.alloc('ulong*')
    const cb = 1024
    const lpcbNeeded = ref.alloc('uint16*')

    const res = psapi.EnumProcesses(lpidProcess, cb, lpcbNeeded)

    const ulongSize = (ref as any).sizeof.ulong
    const totalBytesReturned = lpcbNeeded.readInt16LE()
    const processCount = totalBytesReturned / ulongSize
    console.log(`processCount: ${processCount}`)

    // ??? How to get the value from the lpidProcess?
    return lpidProcess
  }
}

I tried with ref.get but I encountered errors:
    let processId = ref.get(array, 0, ref.types.ulong)
    console.log(processId)
    const pointerSize = (ref as any).sizeof.pointer
    console.log(pointerSize)
    let processId2 = ref.get(array, (ref as any).sizeof.pointer, ref.types.ulong)
    console.log(processId2)

Errors:
RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to write outside buffer bounds

Anyone knows how to use node-ffi read the array data from dll?

A: Thanks @DrakeWu-MSFT, I finally got my code works, here are how they looks finally:
import ffi from 'ffi';
import ref from 'ref';
import ArrayType from "ref-array";

export const psapi = ffi.Library('psapi', {
  EnumProcesses: ['bool', ['ulong*', 'ulong', 'uint16*']],
});

export class Win32ProcessManager {

  public getProcessIdList (): number[] {
    const processIdLength = 1024;
    const ulongSize = (ref as any).sizeof.ulong;
    const cb = processIdLength * ulongSize;
    let processIdArray = ArrayType('ulong', processIdLength);
    let lpidProcess = ref.alloc(processIdArray);
    const lpcbNeeded = ref.alloc('uint16*');

    const res = psapi.EnumProcesses(lpidProcess, cb, lpcbNeeded);

    if (res) {
      const totalBytesReturned = lpcbNeeded.readInt16LE();
      const processCount = totalBytesReturned / ulongSize;

      const processArray = (lpidProcess as any).deref();
      let resultProcessArray: number[] = [];
      for (let i = 0; i < processCount; i++) {
        resultProcessArray.push(processArray[i]);
      }

      return resultProcessArray;
    } else {
      console.error(`Get process list failed with result from EnumProcess: ${res}`);
      return [];
    }
  }
}

I was struggled with getting array data from the pointer, and that was wrong, as @DrakeWu-MSFT said in the comment, because I didn't allocate enough spaces for the buffer, no data can be write into that. With ref-array and a pointer to the array, it works like a charm.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I properly display a specific fieldset when selecting an option from styled select menu? I have a styled select menu and I want to display a specific fieldset according to the option selected. The problem is that, with styled select menus, it changes the way the menu works
This is the code that i'm working with:
To show the specific data:
HTML:
<select id="viewSelector">
   <option value="0">-- Select a View --</option>
   <option value="view1">view1</option>
   <option value="view2">view2</option>
   <option value="view3">view3</option>
</select>

jQuery:
$(document).ready(function() {
  $.viewMap = {
    '0' : $([]),
    'view1' : $('#view1'),
    'view2' : $('#view2a, #view2b'),
    'view3' : $('#view3')
  };

  $('#viewSelector').change(function() {
    // hide all
    $.each($.viewMap, function() { this.hide(); });
    // show current
    $.viewMap[$(this).val()].show();
  });
});

To style the select menu:
JQuery:
$('select').each(function(){
    var $this = $(this), numberOfOptions = $(this).children('option').length;

    $this.addClass('select-hidden');
    $this.wrap('

');
    $this.after('

');

    var $styledSelect = $this.next('div.select-styled');
    $styledSelect.text($this.children('option').eq(0).text());

    var $list = $('
', {
        'class': 'select-options'
    }).insertAfter($styledSelect);

    for (var i = 0; i < numberOfOptions; i++) {
        $('
', {
            text: $this.children('option').eq(i).text(),
            rel: $this.children('option').eq(i).val()
        }).appendTo($list);
    }

    var $listItems = $list.children('li');

    $styledSelect.click(function(e) {
        e.stopPropagation();
        $('div.select-styled.active').not(this).each(function(){
            $(this).removeClass('active').next('ul.select-options').hide();
        });
        $(this).toggleClass('active').next('ul.select-options').toggle();
    });

    $listItems.click(function(e) {
        e.stopPropagation();
        $styledSelect.text($(this).text()).removeClass('active');
        $this.val($(this).attr('rel'));
        $list.hide();
        //console.log($this.val());
    });

    $(document).click(function() {
        $styledSelect.removeClass('active');
        $list.hide();
    });

});

And the css:
.select-hidden {
  display: none;
  visibility: hidden;
  padding-right: 10px;
}

.select {
  cursor: pointer;
  display: inline-block;
  position: relative;
  font-size: 16px;
  color: #fff;
  width: 220px;
  height: 40px;
}

.select-styled {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #c0392b;
  padding: 8px 15px;
  -moz-transition: all 0.2s ease-in;
  -o-transition: all 0.2s ease-in;
  -webkit-transition: all 0.2s ease-in;
  transition: all 0.2s ease-in;
}
.select-styled:after {
  content: "";
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-color: #fff transparent transparent transparent;
  position: absolute;
  top: 16px;
  right: 10px;
}
.select-styled:hover {
  background-color: #b83729;
}
.select-styled:active, .select-styled.active {
  background-color: #ab3326;
}
.select-styled:active:after, .select-styled.active:after {
  top: 9px;
  border-color: transparent transparent #fff transparent;
}

.select-options {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 999;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #ab3326;
}
.select-options li {
  margin: 0;
  padding: 12px 0;
  text-indent: 15px;
  border-top: 1px solid #962d22;
  -moz-transition: all 0.15s ease-in;
  -o-transition: all 0.15s ease-in;
  -webkit-transition: all 0.15s ease-in;
  transition: all 0.15s ease-in;
}
.select-options li:hover {
  color: #c0392b;
  background: #fff;
}
.select-options li[rel="hide"] {
  display: none;
}

And i've tried other different codes that I found on internet but the result is the same, when I select an option, it won't display the data


text:
Q: trouble with Oracle Application Express I am currently using Oracle Application Express to design a demo application cause I am new to it.
The problem that I have is the following
create a work space that works 100%
create an application with pages and data in the application
when I work on a page that I have made in the application I can create it and insert info but when I want to save it then says session has expired but I have not left it alone I am still in the application
can anyone help me with it

A: I have run into this a few times while developing applications that do not require any authentication. If you are on a page that is "public" (does not require authentication) and try to launch a modal window that requires authentication, you will get an error that shows your session has expired (even though it hasn't). You can fix this by setting the page security on the page that is the modal window to "Page is Public". I have created a demo application on apex.oracle.com to demonstrate.


text:
Q: Adding  redirect using Greasemonkey I'm looking to add <meta> element to specific websites using Greasemonkey script. The idea is to redirect the website to another page after X minutes. Something like below:
<META HTTP-EQUIV="Refresh" CONTENT="60; URL=http://example.com">

What is the simplest way to get this done?

A: You can use Greasemonkey (or JavaScript) to add the meta node, but it won't be parsed (at least in FF 4.0).   AFAIK, browsers are only expected to parse meta directives on initial load.
You can use JavaScript to "redirect" the page, after an interval, like so:
setTimeout (function() {
    window.location.href    = "http://example.com";
    },
    60000 //-- 60 seconds
);

If you don't want the original page to remain in the browser's history, use:
setTimeout (function() {
    window.location.replace ("http://example.com");
    },
    60000 //-- 60 seconds
);


text:
Q: The temple is(A)/within a hundred yards(B)/from my house The temple is(A)/within a hundred yards(B)/from my house(C)/No error(D)
Correct Answer: D:- as per my exam.
but I think it should be "within hundred yards".
please explain the concept behind as well.
can you help me out?

A: D is correct because you normally use the article with a number: a/one hundred yards
This is not the case for Within walking distance
Have a look through some of the answers here
Difference between "hundred", "a hundred", and "one hundred"?


text:
Q: The usage of 'get to ~ing' 'get to' means 'have to' or 'have got to'. And I learned that after 'get to', there should be infinitive, but I saw a sentence which is showing 'get to + ~ing' form, so I don't know how to translate it.
Here is the example. (from 'Baker's blue-jay yarn' by Mark Twain)
I've noticed a good deal, and there's no bird, or cow, or anything that uses as good grammar as a blue-jay. You may say a cat uses good grammar. Well, a cat does - but you let a cat get excited once; you let a cat get to pulling fur with another cat on a shed, nights, and you'll hear grammar that will give you the lockjaw.

A: Two different meanings of "get to".
We get to see each other only on the weekends.
Circumstances allow us to see each other only on the weekends.
Cats get to pulling fur....
Cats begin to pull fur (i.e. fight) with each other.
"Got to" (not 'get to') means  must, to have to.
I've got to take my suit to the cleaners.


text:
Q: typescript remove optional property I'm trying to build a dynamic type for a builder
export type Builder<T, K extends keyof T> = {
    [P in K]: (value: T[P]) => Builder<T, K>;
} & {
    build(): Readonly<T>;
};

If I have a class or an interface with optional properties, I get this kind of error:
$ tsc
test/OtherClass.ts:29:1 - error TS2722: Cannot invoke an object which is possibly 'undefined'.

29 OtherClass.builder().patate(Patate.AU_FOUR).build();
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is my class
export class OtherClass {
    constructor(
        public literal: string | undefined,
        public patate?: Patate,
        public hello: Readonly<Hello> = {},
    ) { }

    static builder: () => Builder<OtherClass, keyof OtherClass> = builder.for(OtherClass);
}

I was expecting the type to create a builder with a non-optional method for each properties, but for some reason, the optionality of patate seem inherent to the key and not the type. I don't get this behavior with the property literal
It looks like an issue to me. I'm using typescript 3.1.4. Is there another way to remove the question mark dynamically?
I've tried to use the NonNullable helper to create first a copy of my type with nothing nullable, but patate remains optional.
This is the effective type that vscode gives me
(property) patate?: ((value: Patate | undefined) => Builder<OtherClass, "literal" | "patate" | "hello">) | undefined

A: Does this help?
export type Builder<T, K extends keyof T> = {
    [P in K]-?: (value: T[P]) => Builder<T, K>;
} & {
    build(): Readonly<T>;
};

Note the -? which does what you want - removes optionality.


text:
Q: Most elegant way to .format() formatted string with arbitrary length list in Python 2? Recently I was rewriting code in which a string variable was assigned in following way:
mylist = [1.0, 2.0, 3.0]
somestring = '%6.3f' * len(mylist) % tuple(mylist)

In [7]: somestring

Out[7]: ' 1.000 2.000 3.000'

I would like to figure out how to do same using the .format() method.
I ended up with following:
somestring = ''.join('{:6.3f} ' for i in mylist).format(*mylist)
In [16]: somestring

Out[16]: ' 1.000  2.000  3.000 '

Is there any way to do it "better"? (also in one line?)

A: Just as you can use % on the multiplied string, you can use .format() on the multiplied string.  You need to use parentheses to keep it contained, though:
somestring = ('{:6.3f}' * len(mylist)).format(*mylist)


text:
Q: c# custom installer class .net 4.0 not called I have c# custom installer class that originally targeted .net 2.0.
I have re-targeted it to .net 4.0, and now it does not seen to run.
I've proved this by adding Debugger.Break at relevent locations.
Under .net 2.0 the breakpoints are hit. I even tried targeting 3.5 and that worked.
I realise there a similar questions relating to this but the answers seem to suggest "wrong framework" or "use something else" variety.
Thanks!
Edit -
I have an  installer class
public partial class ScriptRunner : Installer
{...

public override void Install(System.Collections.IDictionary stateSaver)
{
   System.Diagnostics.Debugger.Break();
   ...

This is tested by running the installer (i.e setup.exe). The break statement should cause a dialog to prompt to run the debugger. Under .net 2.0/3.5 this happens, but no under .net 4.0

A: In .Net 4.0 the call to the debugger has been changed, this has thrown me off aswell at some point.
Changing
System.Diagnostics.Debugger.Break();

Into
System.Diagnostics.Debugger.Launch();

Made it work for us, not sure if that also worked for 2.0 and 3.5 since we switched to 4.0 and stuck with it :)


text:
Q: Progress Bar not showing properly - Upload files using ajax for( var i=0; i<=input.length-1; i++ )
{

    // Append all files in the formData.
    formData.append( 'files[]', input[i] );

    // Create progress element.
    var progressElement = jQuery( '
<input type="text" value="0" data-width="32" data-height="32"'+
            ' data-fgColor="#0788a5" data-readOnly="1" data-bgColor="#3e4043" />

' );

    // Append the file name and file size.
    var fileName = fileContentArray[i];

    progressElement.find( 'p' ).text( fileName )
    .append( '' + fileSizeArray[i] + '' );

    // Add the HTML to the UL element.
    progressElement.appendTo( jQuery( '#upload ul' ) );

    // Initialize the knob plugin.
    progressElement.find( 'input' ).knob();

    // Ajax function.
    formData.append( 'action', 'auto_post' );
    jQuery.ajax
    ({
        url: ajaxurl,
        type: "POST",
        data: formData,
        processData: false,
        contentType: false,
        xhr: function()
        {
            var xhr = new window.XMLHttpRequest();
            xhr.upload.addEventListener( 'progress', function( e )
            {
                if( e.lengthComputable )
                {
                    // Append progress percentage.
                    var progressValue = ( e.loaded / e.total ) * 100;
                    console.log( i + ':' + progressValue );
                    progressElement.find( 'input' ).val( progressValue ).change();

                    // Listen for clicks on the cancel icon.
                    progressElement.find( 'span' ).click( function()
                    {
                        if( progressElement.hasClass( 'working' ) )
                        {
                            xhr.abort();
                        }

                        progressElement.fadeOut( function()
                        {
                            progressElement.remove();
                        });
                    });

                    if( progressValue == 100 )
                    {
                        progressElement.removeClass( 'working' );
                    }
                }
            }, false);
            return xhr;
        }
   });
}

Above code is uploading files perfectly. As seeing in the picture, only the last image got progress. When doing a console.log( i + ':' + progressValue ); this also shows that the last image progress is appended only.
More interestingly if i put an alert below:
    xhr: function()
    {
        alert('f');
        var xhr = new window.XMLHttpRequest();
        xhr.upload.addEventListener( 'progress', function( e )

then the output i get is something like this:

Then i used the setTimeout function but that didn't helped me either. what causing this behavior? I hope you people will understand my question. Any help would be appreciated.

A: It's because you're doing it in a loop...
the i variable will always be the last one.
You can do your operations inside a closure to prevent this...
for( var i=0; i<=input.length-1; i++ )
{

(function(i) {

// Append all files in the formData.
formData.append( 'files[]', input[i] );

// Create progress element.
var progressElement = jQuery( '
<input type="text" value="0" data-width="32" data-height="32"'+
        ' data-fgColor="#0788a5" data-readOnly="1" data-bgColor="#3e4043" />

' );

// Append the file name and file size.
var fileName = fileContentArray[i];

progressElement.find( 'p' ).text( fileName )
.append( '' + fileSizeArray[i] + '' );

// Add the HTML to the UL element.
progressElement.appendTo( jQuery( '#upload ul' ) );

// Initialize the knob plugin.
progressElement.find( 'input' ).knob();

// Ajax function.
formData.append( 'action', 'auto_post' );
jQuery.ajax
({
    url: ajaxurl,
    type: "POST",
    data: formData,
    processData: false,
    contentType: false,
    xhr: function()
    {
        var xhr = new window.XMLHttpRequest();
        xhr.upload.addEventListener( 'progress', function( e )
        {
            if( e.lengthComputable )
            {
                // Append progress percentage.
                var progressValue = ( e.loaded / e.total ) * 100;
                console.log( i + ':' + progressValue );
                progressElement.find( 'input' ).val( progressValue ).change();

                // Listen for clicks on the cancel icon.
                progressElement.find( 'span' ).click( function()
                {
                    if( progressElement.hasClass( 'working' ) )
                    {
                        xhr.abort();
                    }

                    progressElement.fadeOut( function()
                    {
                        progressElement.remove();
                    });
                });

                if( progressValue == 100 )
                {
                    progressElement.removeClass( 'working' );
                }
            }
        }, false);
        return xhr;
    }
  });

})(i);

}


text:
Q: swagger-ui.html page not working springboot I am migrating my project which is based on springMVC to spring boot. it is a multi-module project. I am unable to get the swagger-ui.html up. I have added dispatcher servlet as follows:
@Configuration
public class DispatcherServletConfig {

@Bean
public DispatcherServlet dispatcherServlet() {
    return new DispatcherServlet();
}

@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
    ServletRegistrationBean registration = new
  ServletRegistrationBean(dispatcherServlet(), "/prefix1/*");
    registration.addUrlMappings("/admin/*");
    registration.addUrlMappings("/prefix2/*");
     registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
    return registration;
}

}
private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
          new HashSet<String>(Arrays.asList("application/json",
              "application/xml"));

@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {

private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
          new HashSet<String>(Arrays.asList("application/json",
              "application/xml"));

@Bean
public Docket api() {
    ParameterBuilder aParameterBuilder = new ParameterBuilder();
    aParameterBuilder.name("Authorization").modelRef(new ModelRef("string")).parameterType("header")
            .description("Authorization Header").required(true).build();
    List<Parameter> aParameters = new ArrayList<>();
    aParameters.add((Parameter) aParameterBuilder.build());
    return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any()).build().apiInfo(apiInfo()).globalOperationParameters(aParameters).produces(DEFAULT_PRODUCES_AND_CONSUMES);
}

private ApiInfo apiInfo() {
    Contact contact = new Contact("Pvt. Ltd.", "<url>", "support@email.com");
    return new ApiInfo("API", "Information related to api exposed by system.", "1.0",
            "<url>",
            "<url>", new ArrayList<>());
}
}

i have added the following dependencies in my pom.xml:
 <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-excelant</artifactId>
        <version>3.14</version>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.icu</groupId>
        <artifactId>icu4j</artifactId>
        <version>3.4.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>4.3.2.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.4</version>
    </dependency>
    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.0.6</version>
    </dependency>
    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>3.8</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>3.2-FINAL</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.19.1</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.10.19</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.scribe</groupId>
        <artifactId>scribe</artifactId>
        <version>1.3.7</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.retrofit2</groupId>
        <artifactId>retrofit</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>logging-interceptor</artifactId>
        <version>3.10.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.8.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.8.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>4.3.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-xml</artifactId>
        <version>2.9.6</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.0</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.retrofit2</groupId>
        <artifactId>retrofit</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>logging-interceptor</artifactId>
        <version>3.10.0</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.retrofit2</groupId>
        <artifactId>converter-jackson</artifactId>
        <version>2.4.0</version>
    </dependency>
</dependencies>

and also a plugin:
<plugin>
            <groupId>io.github.robwin</groupId>
            <artifactId>swagger2markup-maven-plugin</artifactId>
            <version>0.9.3</version>
            <configuration>
                <inputDirectory>${project.basedir}/apiDoc/json</inputDirectory>
                <swaggerFile>swagger.json</swaggerFile>
                <outputDirectory>${project.basedir}/apiDoc/asciidoc</outputDirectory>
                <markupLanguage>asciidoc</markupLanguage>
            </configuration>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>process-swagger</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I have stored the apiDocs under my project folder.
I am getting a 404 error whenever i call my {project_name}/prefix2/swagger-ui.html#

and whenever i call {project_name}/swagger-ui.html# url, i get this

Also, the swagger-ui.html does not get loaded in the apis.

How can i solve this issue?
Thanks,

A: I believe there was a problem with webMvcConfigurer. In this particular case your SwaggerConfig Bean is annotated only with @Configuration and @EnableSwagger2. Those two annotations are enough to read configuration and run Springfox on url:
http://servert:port /project-name/api/v2/api-docs

But if you want to expose a webPage you need to enable webMvc by adding @EnableWebMvc annotation on your configuration bean, and provide webMvcConfigurer with proper resource handlers.
Without any other configurations code I posted below is enough to expose Swagger UI:
@Configuration
@EnableSwagger2
@EnableWebMvc
public class SwaggerConfig {

    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public WebMvcConfigurer webMvcConfigurer()
    {
        return new WebMvcConfigurer()
        {
            @Override
            public void addResourceHandlers( ResourceHandlerRegistry registry )
            {
                registry.addResourceHandler( "swagger-ui.html" ).addResourceLocations( "classpath:/META-INF/resources/" );
                registry.addResourceHandler( "/webjars/**" ).addResourceLocations( "classpath:/META-INF/resources/webjars/" );
            }
        };
    }
}

A: For those who are using the newer version of swagger, here is the solution for accessing the swagger ui page.
Replace this:
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.8.0</version>
  </dependency>
    <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.8.0</version>
    </dependency>

with this:
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

in your pom.xml file.
Access the page via the following url (avoid that .html extension):  http://localhost:8080/swagger-ui/
Rebuild and restart the server. And your problem is solved!

A: Try adding the following code in your swagger config file:
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
    registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}*

A: (Reputation prevents me from commenting answers)
In my case downgrading swagger also did the trick
From:
<swagger.version>3.0.0</swagger.version>

To
<swagger.version>2.9.2</swagger.version>

A: for Swagger 3.0, you can use
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

then the UI is http://localhost:8080/swagger-ui/ instead of http://localhost:8080/swagger-ui.html

A: Try using
swagger-ui/index.html

instead of
swagger-ui.html

A: In my case downgrading swagger version did the trick.
Couldn't see swagger ui (404)
<swagger.version>3.0.0</swagger.version>

Works fine:
<swagger.version>2.9.2</swagger.version>

Dependencies:
 <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>${swagger.version}</version>
  </dependency>
  <dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>${swagger.version}</version>
  </dependency>

A: Check the jar version of swagger-ui. adding
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2)
      .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any())
      .build(); }

and in pom.xml
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.9.2</version>
</dependency>

with url : http://localhost:8080/swagger-ui.html
This worked fine for me. If you are using some other version of springfox-swagger-ui jar, just open that jar and and check the path for swagger-ui.html and change your URL accordingly.

A: In a spring boot project you have to do :
The configuration of Swagger mainly centers around the Docket bean.
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
      .select()
      .apis(RequestHandlerSelectors.basePackage("org.example.sp.controller"))
      .paths(PathSelectors.ant("/foos/*"))
      .build();
}

Swagger 2 is enabled through the @EnableSwagger2 annotation.
To verify that Springfox is working, you can visit the following URL in your browser:
http://servert:port /project-name/api/v2/api-docs

The result is a JSON response with a large number of key-value pairs, which is not very human-readable. Fortunately, Swagger provides Swagger UI for this purpose.
And to check you swagger-ui, you can do it via url : http://server:8080/toto/swagger-ui.html
And with this aproche we have to annotate our endpoints by some swagger annotations:
There is a simple doc here
Or you can follow an example here

A: I got the same problem too.
1.)first you need to add the following annotations to the config file:
@SpringBootApplication
@EnableSwagger2
public class PostApplication {

   public static void main(String[] args) {
      SpringApplication.run(PostApplication.class, args);
   }

}

2.) second Add 3 dependencies in pom.xml
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>
    <version>2.9.2</version>
</dependency>

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2 </artifactId>
    <version>3.0.0</version>
</dependency>

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.9.2</version>
</dependency>

3.)finally open http://localhost:8081/swagger-ui.html
8081: your server port

A: use the following dependency, it is very straightforward, you will not need to add anything else
     <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.6.9</version>
    </dependency>

Url is
 http://localhost:8090/swagger-ui/index.html

and make sure you are authorized to view all the APIs you want to view in spring security
       .anyRequest().permitAll();

A: Below are the dependencies I have for the spring-boot project -
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0-RC2</version>

<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0-M4</version>

Main class has this annotation -
@ComponentScan(basePackages = {"org.springdoc", "pckage_name_of_your_main_class"})


text:
Q: Listview Images gets shuffled when scrolled from top to bottom I have a custom list view adapter, and when I scroll down/up the list, images get shuffled and I don't know what to do. How to solve this problem?
public View getView(int position, View convertView, ViewGroup parent) {
    DataModel dataModel = getItem(position);
    ViewHolder viewHolder;
    if (convertView == null) {

      convertView=LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false);

        viewHolder = new ViewHolder();
        viewHolder.letter = convertView.findViewById(R.id.tvFirstt);
        viewHolder.name = convertView.findViewById(R.id.nameview);
        viewHolder.contact =convertView.findViewById(R.id.contactview);
        viewHolder.profileimg=convertView.findViewById(R.id.profileimg);
        viewHolder.chkSelect = convertView.findViewById(R.id.checkbox);
        viewHolder.detail = convertView.findViewById(R.id.detail);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();

    }

        viewHolder.name.setText(dataModel.fname + " " + dataModel.lname);
        viewHolder.contact.setText(dataModel.landline);
        viewHolder.detail.setImageResource(R.drawable.right);
        viewHolder.chkSelect.setTag(position);
        viewHolder.chkSelect.setChecked(dataModel.isChecked);

        viewHolder.chkSelect.setOnCheckedChangeListener(this);
        if (dataModel.image == null) {
            viewHolder.letter.setVisibility(View.VISIBLE);
            viewHolder.letter.setText(dataModel.fname.substring(0, 1));
        } else {
            viewHolder.profileimg.setVisibility(View.VISIBLE);
            viewHolder.profileimg.setImageBitmap(convertToBitmap(dataModel.image));
        }

    } else {
        Log.e("Error", "Please see again");
    }

    convertView.setTag(viewHolder);
    return convertView;
}

A: you were not resetting the image
public View getView(int position, View convertView, ViewGroup parent) {
    DataModel dataModel = getItem(position);
    ViewHolder viewHolder;
    if (convertView == null) {

      convertView=LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false);

        viewHolder = new ViewHolder();
        viewHolder.letter = convertView.findViewById(R.id.tvFirstt);
        viewHolder.name = convertView.findViewById(R.id.nameview);
        viewHolder.contact =convertView.findViewById(R.id.contactview);
        viewHolder.profileimg=convertView.findViewById(R.id.profileimg);
        viewHolder.chkSelect = convertView.findViewById(R.id.checkbox);
        viewHolder.detail = convertView.findViewById(R.id.detail);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();

    }

        viewHolder.name.setText(dataModel.fname + " " + dataModel.lname);
        viewHolder.contact.setText(dataModel.landline);
        viewHolder.detail.setImageResource(R.drawable.right);
        viewHolder.chkSelect.setTag(position);
        viewHolder.chkSelect.setChecked(dataModel.isChecked);

        viewHolder.chkSelect.setOnCheckedChangeListener(this);
        if (dataModel.image == null) {
            viewHolder.letter.setVisibility(View.VISIBLE);
            viewHolder.letter.setText(dataModel.fname.substring(0, 1));
            //I have added this
            viewHolder.profileimg.setImageBitmap(null);
        } else {
            viewHolder.profileimg.setVisibility(View.VISIBLE);
            viewHolder.profileimg.setImageBitmap(convertToBitmap(dataModel.image));
        }

    } else {
        Log.e("Error", "Please see again");
    }

    convertView.setTag(viewHolder);
    return convertView;
}


text:
Q: Services_Twilio_TinyHttpException in TinyHttp.php line error in Laravel I am trying to send an sms using Twilio driver in Laravel. For that I did all the steps from http://learninglaravel.net/how-to-sendreceive-text-messages-in-laravel/link but still I am getting the error page as

Services_Twilio_TinyHttpException in TinyHttp.php line 119: SSL
  certificate problem: self signed certificate in certificate chain
in TinyHttp.php line 119 at Services_Twilio_TinyHttp->__call('post',
  array('/2010-04-01/Accounts/AC6bf1e097ae4405b88d7df82678c29d84/Messages.json',
  array('Content-Type' => 'application/x-www-form-urlencoded'),

I don't know what's going wrong.


text:
Q: What is the difference between render() and render_template() in flask? I'm exploring Flask and have a question about rendering templates. Will the following two statements have any essential difference?
return self.render('type_edit.html')
return render_template('type_edit.html')

A: render_template is one of the template rendering functions within flask itself. self.render is not part of flask by itself, but it's found in some flask packages like Flask-Admin. In those packages, it's used within View classes.
Here's an example of render_template being used:
@app.route('/')
def index():
    return render_template("index.html")

And here's an example of Flask-Admin's self.render:
 class IndexView(BaseView):
    @expose('/')
    def index(self):
        return self.render('admin/index.html')


text:
Q: Using xtable function on candisc::cancor output I want to use xtable function on candisc::cancor output. But could not figure it out.
library(xtable)
library(candisc)
data(Rohwer, package="heplots")
X <- as.matrix(Rohwer[,6:10])  # the PA tests
Y <- as.matrix(Rohwer[,3:5])   # the aptitude/ability variables
(cc <- cancor(X, Y, set.names=c("PA", "Ability")))
Canonical correlation analysis of:
         5   PA  variables:  n, s, ns, na, ss
  with   3   Ability  variables:  SAT, PPVT, Raven

    CanR  CanRSQ   Eigen percent    cum                          scree
1 0.6703 0.44934 0.81599   77.30  77.30 ******************************
2 0.3837 0.14719 0.17260   16.35  93.65 ******
3 0.2506 0.06282 0.06704    6.35 100.00 **

Test of H0: The canonical correlations in the
current row and all that follow are zero

     CanR  WilksL      F df1   df2  p.value
1 0.67033 0.44011 3.8961  15 168.8 0.000006
2 0.38366 0.79923 1.8379   8 124.0 0.076076
3 0.25065 0.93718 1.4078   3  63.0 0.248814
xtable(cc)

Error in UseMethod("xtable") :
  no applicable method for 'xtable' applied to an object of class "cancor"

A: If you look at methods(xtable) there is no method for cancor objects but there is xtable.data.frame which we could hopefully use, as the output of cancor look like data.frames.
However, these values are not returned by cancor - look at str(cc). They are calculated in the print method. Look at candisc:::print.cancor.
So create a quick extraction function to generate the cancor output as data.frames
outfun <- function(X) {
              CanR = X$cancor
              CanRSQ = CanR^2
              Eigen = CanRSQ/(1 - CanRSQ)
              percent = 100 * Eigen/sum(Eigen)
              cum = cumsum(percent)
              list(tab1 = data.frame(CanR, CanRSQ, Eigen, percent, cum) ,
                   tab2 = as.data.frame(candisc:::Wilks.cancor(X)))
        }

Run helper function
(out <- outfun(cc))

# or run it like
out <- outfun(cancor(X, Y, set.names=c("PA", "Ability")))

Can then use xtable.data.frame to generate the xtable output
xtable:::xtable.data.frame(out[[1]])

# % latex table generated in R 3.1.1 by xtable 1.7-3 package
# % Wed Sep 17 18:32:07 2014
# \begin{table}[ht]
# \centering
# \begin{tabular}{rrrrrr}
#   \hline
#  & CanR & CanRSQ & Eigen & percent & cum \\
#   \hline
# 1 & 0.67 & 0.45 & 0.82 & 77.30 & 77.30 \\
#   2 & 0.38 & 0.15 & 0.17 & 16.35 & 93.65 \\
#   3 & 0.25 & 0.06 & 0.07 & 6.35 & 100.00 \\
#    \hline
# \end{tabular}
# \end{table}

xtable:::xtable.data.frame(out[[2]])

You can tweak the helper function to also extract headers and such which can then be passed to xtable.data.frame as arguments.
A quick answer that may get you started


text:
Q: sklearn - overfitting problem I'm looking for recommendations as to the best way forward for my current machine learning problem
The outline of the problem and what I've done is as follows:

*

*I have 900+ trials of EEG data, where each trial is 1 second long. The ground truth is known for each and classifies state 0 and state 1 (40-60% split)

*Each trial goes through preprocessing where I filter and extract power of certain frequency bands, and these make up a set of features (feature matrix: 913x32)

*Then I use sklearn to train the model. cross_validation is used where I use a test size of 0.2. Classifier is set to SVC with rbf kernel, C = 1, gamma = 1 (I've tried a number of different values)

You can find a shortened version of the code here: http://pastebin.com/Xu13ciL4
My issues:

*

*When I use the classifier to predict labels for my test set, every prediction is 0

*train accuracy is 1, while test set accuracy is around 0.56

*my learning curve plot looks like this:

Now, this seems like a classic case of overfitting here. However, overfitting here is unlikely to be caused by a disproportionate number of features to samples (32 features, 900 samples). I've tried a number of things to alleviate this problem:

*

*I've tried using dimensionality reduction (PCA) in case it is because I have too many features for the number of samples, but accuracy scores and learning curve plot looks the same as above. Unless I set the number of components to below 10, at which point train accuracy begins to drop, but is this not somewhat expected given you're beginning to lose information?

*I have tried normalizing and standardizing the data. Standardizing (SD = 1) does nothing to change train or accuracy scores. Normalizing (0-1) drops my training accuracy to 0.6.

*I've tried a variety of C and gamma settings for SVC, but they don't change either score

*Tried using other estimators like GaussianNB, even ensemble methods like adaboost. No change

*Tried explcitly setting a regularization method using linearSVC but didn't improve the situation

*I tried running the same features through a neural net using theano and my train accuracy is around 0.6, test is around 0.5

I'm happy to keep thinking about the problem but at this point I'm looking for a nudge in the right direction. Where might my problem be and what could I do to solve it?
It's entirely possible that my set of features just don't distinguish between the 2 categories, but I'd like to try some other options before jumping to this conclusion. Furthermore, if my features don't distinguish then that would explain the low test set scores, but how do you get a perfect training set score in that case? Is that possible?

A: The problem
The RBF kernel function for two vectors $\mathbf{u}$ and $\mathbf{v}$ looks like this:
$$
\kappa(\mathbf{u},\mathbf{v}) = \exp(-\gamma \|\mathbf{u}-\mathbf{v}\|^2).
$$
Essentially, your results indicate that your values for $\gamma$ are way too high. When that happens, the kernel matrix essentially becomes the unit matrix, because $\|\mathbf{u}-\mathbf{v}\|^2$ is larger than 0 if $\mathbf{u}\neq \mathbf{v}$ and 0 otherwise which leads to kernel values of $\approx 0$ and 1 respectively when $\gamma$ is very large (consider the limit $\gamma=\infty$).
This then leads to an SVM model in which all training instances are support vectors, and this model fits the training data perfectly. Of course, when you predict a test set, all predictions will be identical to the model's bias $\rho$ because the kernel computations are all zero, i.e.:
$$
f(\mathbf{z}) = \underbrace{\sum_{i\in SV} \alpha_i y_i \kappa(\mathbf{x}_i, \mathbf{z})}_{always\ 0} + \rho,
$$
where $\mathbf{x}_i$ is the ith support vector and $\alpha_i$ is its corresponding dual weight.
The solution
Your search space needs to be expanded to far lower values of $\gamma$. Typically we use exponential grids, e.g. $10^{lb} \leq \gamma \leq 10^{ub}$, where the bounds are data dependent (e.g. $[-8, 2]$).
I suspect you're using grid search at the moment, which is a very poor way to optimize hyperparameters because it wastes most of the time investigating hyperparameters that aren't good for your problem.
It's far better to use optimizers that are designed for such problems, which are available in libraries like Optunity and Hyperopt. I'm the main developer of Optunity, you can find an example that does exactly what you need (i.e., tune a sklearn SVC) in our documentation.

A: (Note that your code is doing its min-max scaling if normalize == False, which probably isn't what you meant?)
With an RBF kernel you'll probably want some kind of preprocessing, otherwise it's likely that your kernel is becoming essentially 1 if the inputs are the same, 0 if they're not — which will certainly overfit, as you're seeing.
Depending on what the data ranges look like, the typical approach is to standardize with sklearn.preprocessing.StandardScaler and then tune gamma and C. You said when you did that before, training accuracy dropped to .6 — but that's a good thing in some respects, because it means you're not crazy overfitting anymore. Now you just have to find a scaling that actually, well, fits as well.
One reasonable heuristic is to find the median pairwise squared distance between your scaled features (e.g. np.median(sklearn.metrics.pairwise.euclidean_distances(X, squared=True).ravel())) and then use sklearn.grid_search.GridSearchCV over several exponentially spaced multiples of one over that median squared distance for gamma, and exponentially spaced values for C as well.


text:
Q: Requirement VS Requisite Could anyone please let me know how the following examples differ in meaning?

*

*Money is a requirement for life.

*Money is a requisite for life.

Requirement:
something that you must do, or something you need.
Requisite:
necessary or needed for a particular purpose.
To me, they both mean the same here, however this thread made me think there is a nuance between the two which makes one choice always sound better.
The only thing that crosses my mind is that "requisite" as a rare word sounds more formal.
The same goes in the following sentences as well:

*

*Latin is no longer a requirement for entry to university.

*Latin is no longer a requisite for entry to university.


text:
Q: Undefined method `each ' for an array I'm trying to iterate over an array containing various instances of a class for a test case. An array should have an each function according to the RubyDoc:

Like all classes that include the Enumerable module, Array has an each method, which defines what elements should be iterated over and how.

The following code works:
@array = []
(0..20).to_a.each{ |i|
  @array.push(i)
}
@array.each { |i|
    puts i
}

But this one does not:
@violation_array = []
(0..2).to_a.each{ |i|
  @violation_array.push(Violation.new("violation#{i}"))
}
@violation_array.each { |violation|
  puts violation
}

and produces this error:
NoMethodError: undefined method `each ' for #<Array:0x007f3aa232ece8>

The value of @violation_array.inspect just before the each is:
[#<Violation:0x007f71e4965e30 @key="violation0">, #<Violation:0x007f71e4965bb0 @key="violation1">, #<Violation:0x007f71e49657f0 @key="violation2">]

Any idea on why this array lacks the each function?
Edit : I had this problem in multiple settings (python, ruby, markdown). 2 years later I finally understood : I always type space while still holding AltGr from a previous or following character that needs it. That makes an insecable space, see How to disable non-breaking space with altgr+space for a solution).

A: I think the error message may be illuminating. There's a space in the method name so the method that doesn't exist is "each ". Somehow I think you've got some spurious whitespace appearing in your code. There definitely is an "each" method on arrays but not an "each " method.


text:
Q: Grep Command to Search Only One Column of CSV File I've just started learning Linux and all of the relatively basic commands over the past month, but I am having some trouble using the Grep command.  I'm currently stuck on how to use the Grep command to search only one column of a CSV file for a numeric string that starts with two specified numbers.  I'm specifically trying to list the lines that have a zip code that starts with "48", which zip code in this case is included in the 7th column of the CSV file.  There is also other numeric data on each line, which is why I need to use the Grep command only on the "Provider" column.  Any help to point me in the right direction will be appreciated, as I have been trying to figure this out for some time now and I think I may be slightly over-thinking what I need to do.
Here's an example of the CSV data I'm using:
    Provider  Hospital        Total Discharges  Average Covered Charges
    49444     MI - Muskegon   53                18694.9
    49007     MI - Kalamazoo  40                20494.25
    48075     MI - Royal Oak  14                20386.28
    48124     MI - Dearborn   34                34338.47

A: grep doesn't have a concept of fields or columns, so you'd have to write a pattern that somehow accomplishes that. In the general case, that will get ugly, but if the number you want is at the start of line, as the sample seems to indicate, it's simple enough:
grep -Ee '^[[:space:]]*48[0-9]+[[:space:]]' file

That would look for lines that start with any number of whitespace, a 4, an 8, some other numbers, and any whitespace character.
For looking at particular fields, awk is better. By default, it splits the lines to fields on any whitespace. This would look for lines where the first field contains 48, and some other numbers:
awk '$1 ~ /^48[0-9]+$/' file

Change the $1 to $7 or whatever to use another field.

A: Assuming your file is named test.csv:
grep -E "48[0-9]{3}" test.csv

grep -E search a string using a regexp
48 is the start number you need
[0-9] is a number between 0 and 9 and {3} means 3 times


text:
Q: HTLC implementation manually Is there any way to implement HTLC manually for locking funds in the channels in lightning network and releasing the funds after the time lock expired.

A: It is probably better to ask that question on https://bitcoin.stackexchange.com however if you look at the lightning network specification (aka BOLT) at BOLT 03 transactions you will for example find this script for a commitment transaction
# To remote node with revocation key
OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
OP_IF
    OP_CHECKSIG
OP_ELSE
    <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    OP_NOTIF
        # To local node via HTLC-timeout transaction (timelocked).
        OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    OP_ELSE
        # To remote node with preimage.
        OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
        OP_CHECKSIG
    OP_ENDIF
OP_ENDIF

Also note that there is a standalone BIP 199  which is still a draft but specifies how to work with htlcs.


text:
Q: How to set dateTimePickerValue to null or empty in c# I have a windows form of controls combobox and datetimepicker..
I have given null or empty to combobox  in page load..
so combobox shows empty intially while loading database values to it in windows form..
but the problem is
because of the datetimepicker is not kept to null or empty my form is showing message box as "the day is already existed" before form is desplaying..here my code follows
I want to show that message after combobox value is selected..
    try
       {
           ConnectionStringSettings consettings = ConfigurationManager.ConnectionStrings["attendancemanagement"];
           string connectionString = consettings.ConnectionString;
           SqlConnection cn = new SqlConnection(connectionString);
           cn.Open();
           SqlCommand cmd = new SqlCommand("select employee_id,employee_name from Employee_Details", cn);

           SqlDataReader dtr;
           dtr = cmd.ExecuteReader();
           DataTable dt = new DataTable();

           dt.Columns.Add("employee_id", typeof(string));
           dt.Columns.Add("employee_name", typeof(string));
           dt.Load(dtr);

           comboBox1.DisplayMember = "employee_id";
           comboBox1.DisplayMember = "employee_name";
           comboBox1.DataSource = dt;

           comboBox1.SelectedItem = null;
           if(comboBox1.SelectedItem == null)
           {
               txtemployeeid.Text = "";
               txtemployeename.Text = "";

           }

           cn.Close();
       }

       catch (Exception e1)
       {
           MessageBox.Show(e1.Message);

       }

  private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {

        ConnectionStringSettings consettings = ConfigurationManager.ConnectionStrings["attendancemanagement"];
        string connectionString = consettings.ConnectionString;
        SqlConnection cn = new SqlConnection(connectionString);
        cn.Open();
        try
        {
            SqlCommand cmd = new SqlCommand("select employee_id,Employee_name from Employee_Details where employee_name=('" + comboBox1.Text + "')", cn);
            SqlDataReader dtr;

             dtr = cmd.ExecuteReader();
           if (dtr.Read())
            {

                string employee_id = (string)dtr["employee_id"];
                string employee_name = (string)dtr["employee_name"];
                txtemployeeid.Text = employee_id;
                txtemployeename.Text = employee_name;
                dtr.Close();
            }

        }
        catch (Exception e1)
        {
            MessageBox.Show(e1.Message);
        }
        if (comboBox1.SelectedItem != null)
        {
            try
            {

                string dtp = dateTimePicker1.Value.ToString("dd/MM/yyyy");
                SqlCommand cmd1 = new SqlCommand("select date from dailyattendance where date=('" + dtp + "') and employee_id='" + txtemployeeid.Text + "' and empployee_name='" + txtemployeename.Text + "' ", cn);
                SqlDataReader dtr1;
                dtr1 = cmd1.ExecuteReader();
                if (dtr1.Read())
                {
                    string date = (string)dtr1["date"];
                    if (dtp == date)
                    {
                        MessageBox.Show("this day is already existed");
                    }
                }
                dtr1.Close();
            }

            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }

        cn.Close();
    }

can any one solve it please..Thanx in advance

A: You can simply use dtr.Text="";


text:
Q: How to Show And UnShow DNN module I just got off to this problem in my module development where I needed to ask this to some expert.
My question is, what could be the (best) way of showing and unshowing module in DNN7 depending on the value of custom field I provided in profile properties.
I need something like:
if(customfield == "somevalue")
{
    module1.show;
}

how can this be achieved?
thanks,

A: The easiest thing you can do is wrap a panel around your module view's html content.
<asp:Panel ID="pnlModuleContainer" runat="server">

...

</asp:Panel>

Then in your module view's codebehind, do something like this:
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        pnlModuleContainer.Visible = false;
        if (User.Profile.GetPropertyValue("CustomFieldName") == "somevalue")
        {
            pnlModuleContainer.Visible = true;
        }
        else
        {
            DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "You need 'somevalue' to see this module",
                        DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.BlueInfo);
        }
    }
    catch (Exception exc) //Module failed to load
    {
        Exceptions.ProcessModuleLoadException(this, exc);
    }
}


text:
Q: How to use Support Vector Machines with Mixed data? I have a dataset regarding student records with a mix of continuous, discrete & categorical data - the categorical data takes both nominal and ordinal forms.
Ex: Continuous - GPA
Ex: Discrete - Age when admitted
Ex: Categorical (ordinal) - Admit class (late freshman, early junior, etc).
Ex: Categorical (nominal) - Admit description (transfer, GED, etc).
What is the best way to apply SVMs to this dataset? The options seem to be:
1) Convert discrete & categorical values to continuous, real values before application of SVMs
2) Use appropriate similarity-based kernel for mixed data, but this I cannot find. Does it even exist?

A: You can convert categorical values to binary features.
For eg, if car color was a categorical value,
Car Color = Green, Blue or Red
This value can be converted to three binary features, namely,
feature 1 (Green?), feature 2(Blue?), feature 3 (Red?)
A green car would be represented as [1,0,0] feature
A blue car would be represented as [0,1,0] feature and so on.


text:
Q: What version of the gitlab-runner herm chart matches with GitLab version 10.8.7-ee? I want to install the GitLab runner version 10.8.7 so that it matches the same version as the GitLab installation that I'm using. I tried to figure out the helm chart version with the following command:
helm search repo -l gitlab/gitlab-runner
NAME                    CHART VERSION   APP VERSION DESCRIPTION
gitlab/gitlab-runner    0.15.0          12.9.0      GitLab Runner
...
gitlab/gitlab-runner    0.1.45          11.7.0      GitLab Runner
gitlab/gitlab-runner    0.1.44                      GitLab Runner
gitlab/gitlab-runner    0.1.43                      GitLab Runner
gitlab/gitlab-runner    0.1.42                      GitLab Runner
gitlab/gitlab-runner    0.1.41                      GitLab Runner
...
gitlab/gitlab-runner    0.1.14                      GitLab Runner
gitlab/gitlab-runner    0.1.13                      GitLab Runner

but it seems that only chart versions 0.15 to 0.14.5 specify the actual GitLab version (12.9.0 to 11.7.0).
So what chart version corresponds to app version GitLab 10.8.7?

A: I installed chart version 0.1.34 and that seems to run gitlab runner 11.3.0
 cat gitlab-runner-group-values.yml | helm install  --namespace gitlabrunner -f - --version 0.1.34 gitlab-runner-tdh gitlab/gitlab-runner

The previous chart version 0.1.33 jumps to gitlab runner 10.3.0
So as far as I know there is no Helm Chart version for GitLab runner v10.8.0 2018-05-22
The official changelog only goes back to version v0.1.45 (2019-01-22) which corresponds to GitLab runner 11.7.0


text: Q: Equation in the Gaussian Integers Let $a,b \in \mathbb{N}$. Is there a possibility to characterize the solutions of $a N(\alpha) - b N(\beta)=1$ where $\alpha,\beta \in \mathbb{Z}[i]$? In particular I am interested in the case $a=1$ and $b=p \in \mathbb{P}$ with $p \equiv 3 \mod 4$.


text:
Q: get_post_gallery_images() return an empty array I have a custom wordpress plugin that will register some shortcodes. I want to add a function to display a swiper.js slider using a shortcode, but I'm unable to achieve this scope. If I attach a gallery to a page or to a post, it will not be displayed, the array of get_post_gallery_images() returned inside my function class will be always empty. How I can fix this? How I can remove only the default wordpress gallery shortcode to use my own code with attached images?
My plugin method code
public function imgSlider( $attr, $content )
  {
    global $post;

    $a = shortcode_atts(array(
      'pagination' => null,
      'buttons' => null,
      'scrollbar' => null
    ), $attr);

    $images = get_post_gallery_images( $post );
    var_dump($images);
    $slider = '';

    if( $images ){
      $slider = '
';
      $slider .= '
';
      foreach( $images as $img ){
        $slider .= '';
      }
      $slider .= '
';
      if( $a['pagination'] === true ){
        $slider .= '

';
      }
      if( $a['buttons'] === true ){
        $slider .= '

';
        $slider .= '

';
      }
      $slider .= '
';
    }
    // This will return true
    //var_dump(has_shortcode( $post->post_content, 'gallery' ));
    return $slider;
  }

This is the content of a test page I've created to debug my code and verify if custom shortcodes works
NB: I've noticed that an empty
 tag and a
 tag are added to the html when I use the shortcodes, is possible to remove them?
[bs-container type="container-fluid"]
[bs-col type="6" mobile="display"]Lorem ipsum demo shortcode[/bs-col]
[bs-col type="6" mobile="hide"][/bs-col]
[bs-col type="12" mobile="hide"]
[bs-slider pagination="true" buttons="true" scrollbar="false"][gallery link="none" size="large" ids="37,38,25"][/bs-slider]
[/bs-col]
[/bs-container]
[bs-parallax img="https://images.unsplash.com/photo-1569017436947-e1e377435a13?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=600&ixlib=rb-1.2.1&q=80&w=800" is_section="false" overlay="false"][/bs-parallax]


text:
Q: Is there any news feed (event/activity stream) engine? I'm looking for an open source news feed engine to use in an app I'm developing.
The engine needs to be able to aggregate news (items) from multiple sources a user is following and also optionally group them by news source or news type. A scalable solution in Java or with Java interface would be great.
I have already developed a very simple one, but I would prefer to use a robust and reliable solution instead.
Do you have any suggestion?

A: I created a backend for this in Java builing on neo4j: It is independent on the number of users and news sources one follows but depends just linear on the amount of items you want to display
find an explaination how it works and benchmarks with social networks with up to 2 mio users at http://www.rene-pickhardt.de/graphity-an-efficient-graph-model-for-retrieving-the-top-k-news-feeds-for-users-in-social-networks/
There is also the source code available: https://github.com/renepickhardt/graphity-evaluation

A: Check out Rome
http://rometools.org/
In case you also use .NET, Argotic Syndication Framework is for sure the best
http://argotic.codeplex.com/

A: Yahoo pipes is a very good rss feed which lets you create your own feed aggregator with custom filters.
Note: Python version for Yahoo pipes Pipe2py.
Aonther offering from yahoo is Daper.
There are few more online tools for creating custom feeds which you might want to look at.

A: FeedDistiller is a free service for aggregating new feeds by subject,


text:
Q: How hard do mathematicians have to work to learn? So this is a soft question, but I'm looking for a collection of specific instances or stories that provide a reasonable breadth or representative picture. The target audience for this question is those with PhD-level knowledge of math. That doesn't mean you have to have a PhD to respond, but you should ideally possess the rough equivalent of PhD expertise in some mathematical content area even if self-taught.
How hard did you struggle with learning math? Let's break it down into content categories:

*

*Subject matter up to before calculus, say typical topics before university, arithmetic, algebra, introductory trig, statistics. What is typically taught in secondary/high school or lower.

*For calculus and other typical lower-level undergraduate university/college coursework.

*For typical upper-level undergraduate courses/content.

*Lower-level graduate, e.g. core courses or general electives.

*Upper-level graduate, research level, and beyond.

Question: How common is it for PhD-level mathematicians to have struggled and to what degree of struggle:

*

*in high school or lower?

*in lower-level undergraduate classes?

*in upper-level undergraduate classes?

*in lower-level/core graduate classes?

*in upper-level, research level, and beyond content?

Maybe this could be gotten at by a question like: How many hours do you spend obtaining understanding of a typical research paper that is not within your field of expertise? When you want to learn a new concept, does it always come easy, or does it sometimes come with a lot of struggle, how many hours/days?
I'll argue that this is a useful question to ask as many undergraduates struggle with upper level content, for example, and might get discouraged thinking that it should be easy for them. I discuss this with my students and openly talk about what I struggled with and what I found easier to learn. I imagine my experience is fairly typical for PhD-level mathematicians, like I'm somewhere in the middle in terms of how hard I had to work. But I don't know this for sure.
Maybe the way to answer the question is to give a rough estimate for how many hours outside of class you needed to work (or would have needed to work) to achieve A/B equivalent scores in the content.
As an example: Math was essentially easy for me before college. I mean, there were times in high school where I played with equations trying to figure things out, but I at most rarely struggled to do what was required of an assignment. Calculus and trigonometry in college was a little more difficult, especially towards the later topics, and it took a bit of practice/going to office hours. I truly struggled with some content of upper level math. Sometimes I was lazy about it, but sometimes I worked for many hours to learn it (that generally paid off too). Also some (say roughly half) upper level content came fairly easily. Graduate school was definitely much more difficult where learning definitely required many hours outside of class working. I still find high level research mathematics extremely difficult (~15 years post-PhD). It definitely comes faster/easier now conceptually, but much of it is still just way beyond me, and I have to work very hard. Before college, I would have said I was the best student at my school (having little to no struggle essentially). During university, I was probably somewhere in the upper half (struggling less than most). In graduate school, I was roughly in the middle (struggling similarly to the average student, but about half of them learning with less effort than me). I feel that is a fairly honest assessment (to within a rough degree of accuracy).
What I'm looking for is similar assessments from people roughly at the PhD-level of mathematics knowledge, anyone from professional researchers who don't teach at all and have lots of grant funding, to those in teaching positions who do little to now professional research (I'm in the latter category). And even maybe recreational practitioners who just study on their own but have no formal credentials. The key is being honest with the assessment. I'd like to normalize both struggling and having difficulty, but also excelling and having an easy time at it. I think having a broad sampling of experiences would be very useful information for students in particular.
I know this is a soft question, but I'd like to argue that it isn't opinion-based. It is asking for specific information, and presumably mathematicians are careful enough to give reasonably accurate answers. I didn't know of another place to post such a question because it requires access to the specific audience that happens to be present at this site. It didn't seem appropriate for math-meta either, nor for math educators forum because I don't just want to target those who teach.
Also, if there has already been some academic research into this, please share references/info!


text:
Q: error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\...\some.dll' could not be found I am experiencing this problem very often at my hosting server.
The error starts happening occasionally for random DLL and until I ftp the web.config file again (even the same file), the error goes and the site starts working fine.
I am posting the exception and stack trace below.
Please help...
Exception: error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root...\some.dll' could not be found
Stack Trace: at System.Web.Compilation.BuildManager.PostProcessFoundBuildResult(BuildResult result, Boolean keyFromVPP, VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile) at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath) at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry) at System.Web.UI.MainTagNameToTypeMapper.TryUserControlRegisterDirectives(String tagName)

A: Mostly likely, you're forcing a recompile while the server is under load. This can have unpredictable effects. ASP.NET does dynamic recompilation, but if you're deploying multiple files you can get a geometric expansion of the nummber of dynamic recompiles required to swallow your whole code migration. Redeploying web.config probably kind of resets the compile process.
Recycling your app pool will clear such a problem, but you may lack that access. Deploying off-peak can probably mitigate the problem.

A: The best answer for this please open you web.config file and add below two setting add in the compilation tag
<compilation targetFramework="4.0" debug="false" batch="false">

Keep coidng, Also i tried following things when i get the same error in my application which i tried to host in the server

*

*Click Start, click Run, type iisreset /stop, and then click OK.

*Open the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary
ASP.NET Files directory.

*Delete all files and all folders in the directory that you located
in step

*Click Start, click Run, type iisreset /start, and then click OK.

*Do a build again and then try to access your site.


text:
Q: Manually changing coordinates of anchor point before rotation in ArcGIS Desktop I am working with a fishnet of over 120,000 elements, so any editing or selection operation is inevitably lengthy.
I need to rotate this fishnet by an angle of 17 degrees anti-clockwise, but as soon as I put the fishnet shapefile in editing mode (and after having waited for quite a while), the anchor point is visualized in a location that is not the one I want. If I kept it there, the rotation would give me a wrong result. Every time I try to select the anchor and move it with my cursor, ArcGIS gets stuck (perhaps it is selecting all the squares in the fishnet once again) and I am not able to move the anchor to the desired position.
Is there a way to manually change the coordinates of the anchor point?
I would also be open to a Python/ArcPy solution to this.

A: When you are in Edit mode in ArcMap you can manually change the anchor point.
Select your features to display the anchor point.
Hold Ctrl and move your mouse pointer over the anchor point - you will see the pointer change to a four-way arrow.

You can now select the anchor point and move it to your desired position.  This makes use of snapping also, so if you have your snapping environment set correctly you can have it snap to a vertex or edge as required to get an exact position.

Your anchor point is now where you want it, and you can now rotate your fishnet as required.  Can also be used if you want to move your features to snap to an edge/vertex of another feature (this is the main thing I use this for)


text:
Q: SQL SELECT and SUM from three I have been cracking my head for hours on what I thought to be simple SQL SELECT command. I searched every where and read all questions related to mine. I tried an SQL Command Builder, and even read and applied complete series of SQL tutorials and manuals to try to build it from scratch understanding it (which is very important for me, regarding next commands I'll eventually have to build...).
But now I'm just stuck with the results I want, but on separates SELECT commands which I seem to be unable to get together !
Here is my case : 3 tables, first linked to the second with a common id, second linked to the third with another common id, but no common id from the first to the third. Let's say :
Table A : id, name
Table B : id, idA, amount
Table C : id, idB, amount

Several names in Table A. Several amounts in Table B. Several amounts in Table C. Result wanted : each A.id and A.name, with the corresponding SUM of B.amount, and with the corresponding SUM of C.amount. Let's say :
A.id
A.name
SUM(B.amount) WHERE B.idA = A.id
SUM(C.amount) WHERE C.idB = B.id for each B which B.idA = A.id

It's okay for "the first three columns", and "the first two columns and the fourth", both with a WHERE clause and/or a LEFT JOIN. But I can't achieve cumulating all fourth columns together without messing everything !
One could say "it's easy, just put an idA column in Table C" ! Should be easier, sure. But is it really necessary ? I don't think so, but I could be wrong ! So, I just please anyone (who I will give an eternal "SQL God" decoration) with SQL skills to answer laughing "That's so simple ! Just do that and you are gone ! Stupid little newbies..." ;)
Running VB 2010 and MS SQL Server
Thanks for reading !

A: Try this:
SELECT A.Id, A.Name, ISNULL(SUM(B.amount), 0) as bSum, ISNULL(SUM(C2.Amount), 0) as cSum
FROM A
LEFT OUTER JOIN B ON A.Id = B.idA
LEFT OUTER JOIN (SELECT C.idB, SUM(C.AMOUNT) AS Amount FROM C GROUP BY C.idB) AS C2 ON C2.idB = B.Id
GROUP BY A.Id, A.Name

A: Try this:
SELECT
    a.id,
    a.name,
    sum(x.amount) as amountb,
    sum(x.amountc) as amountc
from a
    left join (
        select
            b.id,
            b.ida,
            b.amount,
            SUM(c.amount) as amountc
        from b
        left join c
            on b.id = c.idb
        group by
            b.id,
            b.amount,
            b.ida
    ) x
        on a.id = x.ida
group by
    a.id,
    a.name

This should give you the result set you're looking for. It sums all C.Amount's for each B.id, then adds it all together into a single result set. I tested it with a bit of sample data in MSSQL, and it works as expected.

A: Select a.id, a.name, sum(b.amount), sum(c.amount)
from a inner join b on a.id = b.idA
inner join c on b.id = c.idB
group by a.id, a.name

A: You need to add them separately:
select a.id, a.name, (coalesce(b.amount, 0.0) + coalesce(c.amount, 0.0))
from a left outer join
     (select b.ida, sum(amount) as amount
      from b
      group by b.ida
     ) b
     on a.id = b.ida left outer join
     (select b.ida, sum(amount) as amount
      from c join
           b
           on c.idb = b.id
      group by b.ida
     ) c
     on a.id = c.ida

The outer joins are to take into account when b and c records don't both exist for a given id.


text:
Q: Fetch data from quick blox custom objects i am using quick-blox for the first time and able to submit data to it's server. i have created custom object fields by using bellow code :-
QBCustomObject qbCustomObject = QBCustomObjectsUtils.createCustomObject(licenseNumber, carModel, carColor, stateName, stateCodeLast[0], "NO");
        Performer<QBCustomObject> performer = QBCustomObjects.createObject(qbCustomObject);
        rx.Observable<QBCustomObject> observable =
                performer.convertTo(RxJavaPerformProcessor.INSTANCE);

        observable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<QBCustomObject>() {
            @Override
            public void onCompleted() {
                AppUtils.dismissProgressDialog();
                Toaster.shortToast("Done");
                ((Activity) mContext).finish();
            }

            @Override
            public void onError(Throwable e) {
                if (QBCustomObjectsUtils.checkQBException(e)) {
                    AppUtils.dismissProgressDialog();
                    Toast.makeText(mContext, "Something went wrong !!!", Toast.LENGTH_SHORT).show();
                } else {
                }
            }

Now i want to retrieve data from Quick blox custom object class but i am not finding any way to achieve that , i do have found one link :-
How to retrieve related records on Quickblox custom objects?
But QBCustomObjectRequestBuilder is not working in my code do i need to add any additional dependency for this ?
Dependecies i am using :-
compile "com.quickblox:quickblox-android-sdk-extensions:3.3.1"
   compile "com.quickblox:quickblox-android-sdk-customobjects:3.3.1"
   compile 'com.quickblox:quickblox-android-sdk-chat:3.3.1'
   compile 'com.quickblox:quickblox-android-sdk-content:3.3.1'

Please suggest me some way to fetch data from Custom objects
Thanks

A: That answer is very old, for getting custom data for current user just use next code:
QBRequestGetBuilder requestGetBuilder = new QBRequestGetBuilder();
requestGetBuilder.setLimit(50);
//set other parameters if need

Performer<ArrayList<QBCustomObject>> performer = QBCustomObjects.getObjects(Consts.CLASS_NAME, requestGetBuilder);
Observable<ArrayList<QBCustomObject>> observable = performer.convertTo(RxJavaPerformProcessor.INSTANCE);

observable.subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(new Observer<ArrayList<QBCustomObject>>() {
            @Override
            public void onCompleted() {
            }

            @Override
            public void onError(Throwable e) {
                Log.e(TAG, "onError " + e.getMessage());
            }

            @Override
            public void onNext(ArrayList<QBCustomObject> qbCustomObjects) {
                //qbCustomObjects - objects, loaded from server
                Log.i(TAG, "data loaded success, got " + qbCustomObjects.size() + " items");
            }
        });


text:
Q: Smalltalk - convert string to lowercase Is there a way to use collect: to help convert a string to lowercase? As in, I'm not allowed to use translateToLowercase or asLowercase. I don't want the answer, just an idea of where I could look to get me started

A: You can use collect as a sort of mapping operation. Here is an example:
(1 to: 10) collect: [ :x | x squared ] "=> [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"

For your purposes you'd want to use something other than squared. This will let you perform the operation one character at a time.
Hope this helps, you said you didn't want the answer.


text:
Q: How to activate task in c#? I'am trying to consume a wcf in windows 8:
My code to consume the method generated by the WCF service:
public System.Threading.Tasks.Task<Maquette_MyAirport_Win8.FlightService.CitiesResponse>
    GetAllCitiesAsync(Maquette_MyAirport_Win8.FlightService.BaseRequest request)
{
    return base.Channel.GetAllCitiesAsync(request);
}

is
public testproxy()
{
    _client = new FlightInfoServiceClient(Maquette_MyAirport_Win8.FlightService.FlightInfoServiceClient.EndpointConfiguration.wsHttpBindingConfiguration);
    BaseRequest req = new BaseRequest();
    System.Threading.Tasks.Task<Maquette_MyAirport_Win8.FlightService.CitiesResponse> CitiesResponse = _client.GetAllCitiesAsync( new BaseRequest());
    CitiesResponse.ContinueWith(task => citiesL = task.Result.Cities.FirstOrDefault(););

}

The status of the task citiesResponse is "WaitingForACtivation" and Result="Not yet Computed"
How can I Activate the task and how can i obtain the result??

A: Don't you have to add async and await to get the result type instead of Task type??
It should be something like this:
var result = await _client.GetAllCitiesAsync( new BaseRequest());

And in the method you should add async


text:
Q: Compare 1 field from sub query against other? I am trying to compare two fields in oracle select query as part of case statement one of which is coming from sub query but I get error.
E.g
select 1 as one,
       (select 2 from dual) as two,
       case when one=two then 'EQUAL'
            else 'NOTEQUAL'
       end match
from dual;

Error ORA-00904: TWO invalid identifier
Thoughts how can rewrite this?
Thanks in advance!

A: You cant use the alias, so you have to rewrite the data source and subquery.
SELECT 1 as one,
       (SELECT 2 FROM dual) as two,
       CASE WHEN 1 = (SELECT 2 FROM dual)
            THEN 'EQUAL'
            ELSE 'NOTEQUAL'
        END match
  FROM dual

Result
one two match
1   2   NOTEQUAL

A: The problem is you cant use the alias on the same level, you need to do a subquery or a cte
WITH step1 as (
    select 1 as one
    from dual
), step2 as (
    select 2 as two
    from dual
)
SELECT case when one=two then 'EQUAL'
            else 'NOTEQUAL'
       end match
FROM step1
CROSS JOIN step2

A: Use a simple subquery
Select t.*,
       case when one=two then 'EQUAL'
            else 'NOTEQUAL'
       end match
From (
    select 1 as one,
           (select 2 from dual) as two
    from dual
) t;


text:
Q: Using server names vs. IP addresses in WCF endpoints I'm stumped by a very strange behavior on my machine.
Trying to port a Remoting application to WCF I wanted to implement a "one proxy per server call" scheme (like proposed here).
I went for a standard net.tcp binding and noticed that the first (and now, only) call for each proxy was incredibly slow: opening the client channel took about 2 seconds!
At first I thought it's because of the default transport security for net.tcp bindings, but switching to Security.None didn't bring any improvement.
After lots of tests I found out that basicHttp binding was about 1000 times faster: opening the channel took about 2 ms!
Then I tried playing around with the service URI. For my tests both server (self hosted) and client were on the same machine (in fact even in the same process).
In the beginning I used "net.tcp://localhost:Port/..." and got 2 seconds for opening the channel.
Just out of curiosity, because I'm working over an RDP connection via VPN, I tried my machine's explicit hostname "net.tcp://myworkmachinehost:Port/..." and now it took 4 seconds to open the channel!
Finally I tried avoiding name resolution and used "net.tcp://127.0.0.1:Port/..." and suddenly everything was blazing fast: Opening the channel took a mere 2 ms!
A colleague of mine got the same 2 second delay with "localhost" on his machine (not working from remote). Using his hostname also gave 2 seconds and using the IP address was fast as well.
With basicHttpBinding there's no performance difference in how we specify the service URL.
Calling "nslookup myworkmachinehost" immediately returns my IPv4 address, so name resolution itself also seems to be fast.
Apart from modifying the server address on client side I also tried all possibilities with the server with very strange results.

*

*Server endpoint address net.tcp://0.0.0.0:Port...

*

*Client URL 127.0.0.1:Port: 6 ms

*Client URL localhost:Port: 2005 ms

*Client URL myworkmachinehost:Port: 4007 ms

*Server endpoint address net.tcp://127.0.0.1:Port...

*

*Client URL 127.0.0.1:Port: 6 ms

*Client URL localhost:Port: 20135 ms

*Client URL myworkmachinehost:Port: TIMEOUT after 10 s

*Server endpoint address net.tcp://localhost:Port...

*

*Client URL 127.0.0.1:Port: 5.5 ms

*Client URL localhost:Port: 1.5 ms

*Client URL myworkmachinehost:Port: 1 ms

*Server endpoint address net.tcp://myworkmachinehost:Port...

*

*Client URL 127.0.0.1:Port: 8 ms

*Client URL localhost:Port: 2 ms

*Client URL myworkmachinehost:Port: 1.5 ms

How can this be and what can I do to further analyze this situation?
Thanks in advance...