text:
Q: Mysql crashed and not starting in xampp Here my log files in mysql
2019-12-10 15:10:18 1428 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
    2019-12-10 15:10:18 5160 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
2019-12-10 15:10:18 5160 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-12-10 15:10:18 5160 [Note] InnoDB: The InnoDB memory heap is disabled
2019-12-10 15:10:18 5160 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-12-10 15:10:18 5160 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2019-12-10 15:10:18 5160 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-12-10 15:10:18 5160 [Note] InnoDB: Using generic crc32 instructions
2019-12-10 15:10:18 5160 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2019-12-10 15:10:18 5160 [Note] InnoDB: Completed initialization of buffer pool
2019-12-10 15:10:18 5160 [Note] InnoDB: Highest supported file format is Barracuda.
2019-12-10 15:10:18 5160 [Note] InnoDB: Starting crash recovery from checkpoint LSN=7472761787
2019-12-10 15:10:19 5160 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 2850 row operations to undo
InnoDB: Trx id counter is 1963520
2019-12-10 15:10:19 5160 [Note] InnoDB: Starting final batch to recover 307 pages from redo log

A: After deleting ibdata1 file , ib_logfile1, ib_logfile1 from c:xampp\mysql\data directory , it started working

A: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
According to
https://blogs.oracle.com/supportingmysql/entry/remove_on_sight_thread_concurrency
, MySQL 5.6 will deprecated three parameters in the configuration file:
thread_concurrency
innodb_additional_mem_pool_size
innodb_use_sys_malloc
Solution:
If you are currently using version 5.1 or 5.5, it is recommended to set the parameter value to 1
innodb_use_sys_malloc = 1
If version 5.6.3 or later, comment the parameter:
innodb_additional_mem_pool_size


text:
Q: Linear system with non-square matrix I have a matrix $A$ $m \times n$, and $\forall \ b$ the linear system $Ax = b$ has a $\mathbf{unique}$ solution. I need to prove that $\forall \ c$ linear system $A^Tx = c$ has also a unique solution.
$\mathbf{My \ proof\  is}$: Since $Ax$ ($x = (x_1 x_2 \dots x_n)^T$) is the linear combination of columns of the matrix $A$ with coefficients $x_1, x_2, \dots \ $and $\forall \ b \in \mathbb{R^m}$ we only have a unique set of coefficients $x_1, x_2, \dots \ $of the linear combination hence columns of $A$ form a basis in $\mathbb{R^m}$, consequently $A$ is the square matrix $\rightarrow \ A^T$ is the square too. Also $rankA = m \rightarrow det(A) \neq 0 \rightarrow det(A^T) \neq 0 \rightarrow \forall \ c$ system $A^Tx = c$ has a unique solution.
Could you please tell me whether this is a correct proof? Thank in advance!

A: Your proof ultimately amounts to the following:

*

*Because $Ax = b$ has a unique solution for all $b$, $A$ is square with full rank.

*Because $A$ is square with full rank, $A^T$ is square with full rank.

*Because $A^T$ is square with full rank, $A^Tx = c$ has a unique solution for all $c$

This is a valid line of reasoning.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to make a left side curve as if it were a U without absolute position? I want to make the curve that appears in the image, the one that has the gray color brackground that makes like a U. Without an absolute position for me, then I can use a button above that same background

A: What you do to get that red curve with no imports is to make a circle within the view and then do overflow:'hidden' in the parent view. So the circle doesn't overflow out of it. Next you make use of transform and translate to move it in the x and y direction to the left corner.
Full example here (https://snack.expo.dev/@heytony01/anxious-kiwi)
export default function App() {
  return (
    <View style={{flex:1,justifyContent:"center",alignItems:"center"}}>
        <View style={{width:"90%",height:"15%",backgroundColor:"gray",borderRadius:"3%",flexDirection:"row",
        // Need this so the child view doesn't overflow it
        overflow:"hidden",}}>
            <View style={{
              // Makes a giant circle
              width:"100%",
              height:"200%",
              borderRadius:"100%",
              backgroundColor:"red",
              // Adds a border with a color white
              borderColor:"white",
              borderWidth:2,
              // Move the cirlce to the left side
              transform:[
                {
                  translateX:-150
                },
                {
                  translateY:-50
                }
              ]
            }}>
            </View>
        </View>
    </View>
  );
}


text:
Q: Ability to use GNUPG's Webkey as a Web Services authentication mechanism Is there a way to use GNUPG's new Webkey capability to create a federated passwordless public key authentication mechanism for web services login?
Something like the following architecture:
    .--------------------.
    |      DomainA       |
    |  Webkey Directory  |<---.
    |  User Public Keys  |    |  (2)
    '--------------------'    |  Web service requests current
                              |  known public key
                              |
                    .------------------.
                    |   Web Service    |
              .---->|  Requires Login  |---.
              |     '------------------'   |
              |                            |
 (1)                             (3)
 User Requests Account           Web service encrypts a nonce
 Uses DomainA                    using domain supplied public key.
 email address                   And sends the encrypted message to user.
              |                            |
              |                            |
 (4)                                       |
 User enters unencrypted         (5)
 nonce in web browser.           Once account has been created
              |                  web browser plugin asks for
              |                  GPG passphrase when logging
              |                  in to the webservice.
              |                  Auth with signed nonce, verified
    .-------------------.        by public key DB.
    |    Web Client     |                  |
    | has email address |<-----------------'
    |    at DomainA     |
    '-------------------'

*

*GNUTLS ?
I noticed once upon a time that GNUTLS had the compatibility of using PGP keys as a client authentication mechanism.  Perhaps, I was reading the documentation incorrectly.  Perhaps GNUTLS was simply allowing PGP keys to be used as a trust root for TLS connections.  However, I believe the capability was removed due to lack of interest and/or use.

*Passwords are broken
Passwords are the bane of the Internet, and while 2 Factor works for most purposes, there may be some cases where use of a smart phone is impractical.

*CA client certs are an option
CA client certs work fairly well.  And it's possible to setup a domain level CA to authenticate users.  However, the domain level CA would not be trusted by users' browsers.  So, each user would need to install the domain root certificate.

*GNUPG now has Webkey
Are there any projects that are currently being worked on to enable PGP Auth for web services leveraging GNUPG Webkey?


text:
Q: Failing to configure spring beans in grails 4.0.1 I have a project tat I haven't touched for a while now, and we decided to recurrent it. This project is and API written in Grails 4.
The last time (several months ago) it was working and building fine. Right now if I run pretty much any grails command I am getting the following error:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-09 22:34:20.225 ERROR --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    okio.Segment.writeTo(Segment.kt:169)

The following method did not exist:

    kotlin.collections.ArraysKt.copyInto([B[BIII)[B

The method's class, kotlin.collections.ArraysKt, is available from the following locations:

    jar:file:/Users/shurikag/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.71/d9717625bb3c731561251f8dd2c67a1011d6764c/kotlin-stdlib-1.2.71.jar!/kotlin/collections/ArraysKt.class

It was loaded from the following location:

    file:/Users/shurikag/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.71/d9717625bb3c731561251f8dd2c67a1011d6764c/kotlin-stdlib-1.2.71.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of kotlin.collections.ArraysKt

> Task :dbmUpdate FAILED
5 actionable tasks: 5 executed
<-------------> 0% WAITING
> IDLE
Context failed to load: Error creating bean with name 'restTokenValidationFilter': Cannot resolve reference to bean 'restAuthenticationProvider' while setting bean property 'restAuthenticationProvider'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restAuthenticationProvider': Cannot resolve reference to bean 'tokenStorageService' while setting bean property 'tokenStorageService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStorageService': Cannot resolve reference to bean 'auth0APIService' while setting bean property 'auth0APIService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auth0APIService': Cannot resolve reference to bean 'authApi' while setting bean property 'authAPI'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authApi': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.auth0.client.auth.AuthAPI]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dbmUpdate'.
> Process 'command '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'' finished with non-zero exit value 1

I assumption was that it has something to do with dependencies versions. Checked everything - even copied from another project that works... Does not help.
This is my resources.groovy:
import com.auth0.client.auth.AuthAPI
import edvengo.auth0.Auth0APIService
import edvengo.auth0.Auth0TokenStorageService
import edvengo.auth0.Auth0TokenVerificationService
import edvengo.auth0.Auth0UserResolverService
import edvengo.security.UserPasswordEncoderListener
import grails.plugin.springsecurity.rest.RestAuthenticationProvider

// Place your Spring DSL code here
beans = {

    userPasswordEncoderListener(UserPasswordEncoderListener)

    authApi(AuthAPI) { beanDefinition ->
        beanDefinition.constructorArgs = [
                '${edvengo.auth0.api.domain}',
                '${edvengo.auth0.api.clientId}',
                '${edvengo.auth0.api.clientSecret}'
        ]
    }

    auth0APIService(Auth0APIService) {
        authAPI = ref('authApi')
    }

    auth0TokenVerificationService(Auth0TokenVerificationService)

    auth0UserResolverService(Auth0UserResolverService)

    tokenStorageService(Auth0TokenStorageService) {
        jwtService = ref('jwtService')
        userDetailsService = ref('userDetailsService')
        auth0TokenVerificationService = ref('auth0TokenVerificationService')
        auth0APIService = ref('auth0APIService')
        auth0UserResolverService = ref('auth0UserResolverService')
    }

    /* restAuthenticationProvider */
    restAuthenticationProvider(RestAuthenticationProvider) {
        tokenStorageService = ref('tokenStorageService')
        useJwt = false
        jwtService = ref('jwtService')
    }

}

At this point, my assumption is that the problem only with authApi bean. Possibly with constructor arguments. Checked that the environment variables are defined properly.
What else can be a reason?
Just as a reference. my build.gradle
buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://repo.grails.org/grails/core" }
        jcenter()
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "org.grails.plugins:views-gradle:2.0.2"
        classpath "org.grails.plugins:hibernate5:7.0.4"
        classpath 'org.grails.plugins:database-migration:3.1.0.RC1'
    }
}

version "0.2"
group "edvengo.api"

// apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"

repositories {
    maven { url "https://repo.grails.org/grails/core" }
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

dependencyManagement {
    imports {
        mavenBom 'com.amazonaws:aws-java-sdk-bom:1.12.1'
    }
}

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-codecs"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-datasource"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:async"
    compile "org.grails.plugins:spring-security-rest:3.0.1"
    compile "org.grails.plugins:views-json"
    compile "org.grails.plugins:views-json-templates"
    compile "org.grails.plugins:events"
    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.4.18.Final"
    compileOnly "io.micronaut:micronaut-inject-groovy"
    console "org.grails:grails-console"
    profile "org.grails.profiles:rest-api"
    runtime "org.glassfish.web:el-impl:2.1.2-b03"
    runtime "com.h2database:h2"
    runtime "org.apache.tomcat:tomcat-jdbc"
    runtime "javax.xml.bind:jaxb-api:2.3.1"
    testCompile "io.micronaut:micronaut-inject-groovy"
    testCompile "org.grails:grails-gorm-testing-support"
    testCompile "org.mockito:mockito-core"
    testCompile "io.micronaut:micronaut-http-client"
    testCompile "org.grails:grails-web-testing-support"
    testCompile "org.grails:views-json-testing-support"
    testCompile "org.hibernate.validator:hibernate-validator:6.0.20.Final"

    compile "com.amazonaws:aws-java-sdk-s3"

    compile "org.grails.plugins:postgresql-extensions:7.0.0"
    compile "org.postgresql:postgresql:42.2.20"
    compile 'org.grails.plugins:database-migration:3.1.0.RC1'
    compile 'org.liquibase:liquibase-core:3.6.1'

    compile "com.auth0:auth0:1.31.0"
    compile "com.auth0:jwks-rsa:0.18.0"

    compile 'com.papertrailapp:logback-syslog4j:1.0.0'
    compile "com.stripe:stripe-java:20.56.0"

    compile "com.sendinblue:sib-api-v3-sdk:5.2.0"

    runtime "org.grails.plugins:async:4.0.0"
    compile "org.grails:grails-datastore-gorm-async"

    implementation "com.squareup.okhttp3:okhttp:4.9.0"
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'

}

bootRun {
    ignoreExitValue true
    jvmArgs(
            '-Dspring.output.ansi.enabled=always',
            '-noverify',
            '-XX:TieredStopAtLevel=1',
            '-Xmx1024m')
    sourceResources sourceSets.main
    String springProfilesActive = 'spring.profiles.active'
    systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

tasks.withType(GroovyCompile) {
    configure(groovyOptions) {
        forkOptions.jvmArgs = ['-Xmx1024m']
    }
}

sourceSets {
    main {
        resources {
            srcDir 'grails-app/migrations'
        }
    }
}

A: I had similar issue (NoSuchMethodError kotlin.collections.ArraysKt.copyInto) after adding okhttp dependency to my Grails 4.0.10 project. I found here an explanation:

The issue is caused by the old version of the Kotlin libraries on the
classpath. Grails 4.x framework is still using Spring Dependency
Management Plugin under the hood with a couple of Maven BOMs secretly
added under the hood. One of them is an older version of Spring Boot
Dependencies BOM which specifies the version of Kotlin libraries to
1.2.71 whereas OkHttp depends on 1.4.10 at the time of writing causing the binary incompatibility in the runtime.

and the solution:

Luckily, there is an easy solution to fix this. The Kotlin version is
specified as kotlin.version property in the BOM and Spring Dependency
Management Plugin supports overriding the properties in
gradle.properties file so the only required change is to add the
following line at the end of the file.

kotlin.version = 1.4.10


text:
Q: sql Join query in laravel 5.3 I want to join two tables in laravel 5.3 and fetched the value in template page .now i caught error.I have two table names as users and department.$queries = DB::getQueryLog(); return the query what I want exactly as select users.*, department.name as dept_name from users inner join department on users.department_id = department.id for the following query.this will return the error
ErrorException in Macroable.php line 74:
Method links does not exist. (View: C:\wamp64\www\testLaravel\TestTravel\resources\views\approval_view.blade.php)
BadMethodCallException in Macroable.php line 74:
Method links does not exist.
controller
class travelApprovalController extends Controller {
public function index(){
//$users = DB::table('passenger')->paginate(2);
$users = DB::table('users')
        ->join('department', 'users.department_id', '=', 'department.id')

        ->select('users.*', 'department.name as dept_name')
        ->get();   //->paginate(2)
  return view('approval_view',['users'=>$users]);
}

approval.blade.php
@foreach ($users as $user)

        {{ $user->id }}
        id }}" data-toggle="modal" data-target="#myModal">{{ $user->dept_name }}
        {{ $user->dept_name }}
        {{ $user->name }}

     @endforeach

{{$users->links()}}

A: try this
$users = DB::table('users')
                ->join('department', 'users.department_id', '=', 'department.id')
                ->select('users.*', 'department.name as dept_name')
                ->paginate(2);

A: Use like this
@foreach ($users as $user)

    {{ $user->id }}
    id }}" data-toggle="modal" data-target="#myModal">{{ $user->dept_name }}
    {{ $user->dept_name }}
    {{ $user->name }}
    {{ $user->links }}

@endforeach

OR
{{$users[0]->links()}}


text:
Q: Wireshark Dissector in Lua First of all, I'm new to Lua altogether, and this is my first attempt at writing a wireshark dissector.
My protocol is straightforward - a 2 byte length field, followed by a string of that length.
When I run the code through the Lua console, everything works as expected.
When the code is added to the Wireshark plugins directory, I get the error

Lua Error: [string "C:\Users...\AppData\Roaming\Wireshark..."]:15: calling 'add' on bad self (number expected, got string)

Line 15 corresponds is the t:add(f_text... line.
Can anyone explain the discrepancy between the execution methods?
do
    local p_multi = Proto("aggregator","Aggregator");

    local f_len = ProtoField.int16("aggregator.length","Length",base.DEC)
    local f_text = ProtoField.string("aggregator.text","Text")

    p_multi.fields = { f_len, f_text }

    local data_dis = Dissector.get("data")

    function p_multi.dissector(buf,pkt,root)
            pkt.cols.protocol = "Aggregator"
            local len = buf(0,2):int()
            local t = root:add(p_multi,buf(0,len+2))
            t:add(f_len,buf(0,2),"Length: " .. buf(0,2):int())
            t:add(f_text,buf(2,len),"Text: " .. buf(2,len):string())
    end

    local tcp_encap_table = DissectorTable.get("tcp.port")
    tcp_encap_table:add(4321,p_multi)
end

A: Your dissector code is very close to correct, but you're doing extra work that the interface won't accept. If you change your dissector function like so,
function p_multi.dissector(buf,pkt,root)
        pkt.cols.protocol = "Aggregator"
        local len = buf(0,2):int()
        local t = root:add(p_multi,buf(0,len+2))
        t:add(f_len,buf(0,2)) --let Wireshark do the hard work
        t:add(f_text,buf(2,len)) --you've already defined their labels etc.
end

you'll get the desired behavior. The labels "Text" and "Length" are already defined for your fields, so there is no need to provide them again on lines 15 and 16.


text:
Q: Anaconda Navigator won't launch, download_api error (Windows 10) Last night I ran a Windows update and this morning Anaconda Navigator hangs when I try to launch it.  After googling I ran some updates in Anaconda prompt:
conda update
conda update anaconda-navigator

And then when I try to launch anaconda navigator from the prompt I get this error:
2019-03-01 09:23:00,212 - ERROR download_api._get_url:416
Expecting value: line 1 column 1 (char 0)

Traceback (most recent call last):
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 539, in setup
self.post_setup(conda_data=conda_data)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 576, in post_setup
self.tab_home.setup(conda_data)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\tabs\home.py", line 169, in setup
self.set_applications(applications, packages)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\tabs\home.py", line 204, in set_applications
apps = self.api.process_apps(applications, prefix=self.current_prefix)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 888, in process_apps
versions=[vsdata.get('productVersion')],
AttributeError: 'str' object has no attribute 'get'

I use Jupyter Notebook and Spyder and this is causing me a major headache. Thanks in advance!

A: There's another solution (not the best, but it works). Anaconda can't retrieve vscode version for any reason.
You need to replace line 888 in file "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py"
from versions=[vsdata.get('productVersion')], to versions=["1b8e8302e405050205e69b59abb3559592bb9e60"],

A: After lots of restarts and lots of googling I found a simple fix:
conda update navigator-updater

It works...for now

A: For me it worked only when I'm connected to the internet. Offline, it fails to start.


text:
Q: Express.JS installed globally isn't found on Windows I have tried installing express-generator via global but it's not found.
I have tried opening a new CMD / Powershell and same thing happens.
PS C:\Users\testuser\testme> npm install -g express-generator
npm http GET https://registry.npmjs.org/express-generator
npm http 304 https://registry.npmjs.org/express-generator
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/minimist
C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\express -> C:\ProgramData\chocolatey\
lib\nodejs.commandline.0.10.31\tools\node_modules\express-generator\bin\express
express-generator@4.9.0 C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.31\tools\node_modules\
express-generator
├── commander@1.3.2 (keypress@0.1.0)
└── mkdirp@0.5.0 (minimist@0.0.8)
PS C:\Users\testuser\testme> express
express : The term 'express' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ express
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (express:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\testuser\testme>

This has been installed globally.
Any ideas?

A: Check your PATH to be sure it includes the location for globally installed modules.
At a command prompt:

*

*type npm ls -g --depth=0 and note the directory printed on the first line of output

*type PATH to see if the directory found in step #1 is in the path...

If (when) the npm global install directory is missing from your PATH, adding it should fix the problem.
See this other StackOverflow question as a reference: Grunt on Windows 8: 'grunt' is not recognized


text:
Q: Dagger2 Runtime Polymorphism How to implement runtime polymorphism by using Dagger2 ?
Say, I have an app which has a RemoteDataRepo with a real webservice as well as a MockDataRepo with some fake data.

*

*When the user clicks "signIn" button, the RemoteDataRepo should be loaded and used through out the app.

*When the user clicks "demo" button, the MockDataRepo should be loaded and used through out the app, which tells the user how the app will look like.

Every one talks about the compile time dependency injection. I really need a runtime solution to polymorphically swap dependencies.
Can any one suggest how to implement this ?


text:
Q: Printing out numbers that are greater then 9 in NASM Assembly So I am currently following along with this tutorial https://www.tutorialspoint.com/assembly_programming/assembly_arithmetic_instructions.htm and what Im getting from it is that in order to convert a number in ascii to a decimal. I have to subtract it with '0', then perform the math and convert it back to its ascii equivalent by adding it with '0'. However the problem for me arrises when the numbers go beyond 9.
I have a task at hand that requires me to loop through all the contents of a file character by character and keep track of the "count". Im not sure what the best way of going about doing this is but I will show what I have done so far, it definetly does not work and I suspect its because when i convert the "counter" to its ascii value it does exist but it matches some other character that happens to have that decimal value.
section .data
    counter: dd '0' ;holds the num of chars read
section .bss
    Buff resb 1     ;hold the value of one char
    fd_in resb 4
    fd_out resb 4
section .data
global _start
_start:
...
...
...
;increment the counter by 1 each time a char is wrote to file
Add_counter:
    mov eax, [counter]
    sub eax, '0'
    inc eax
    add eax, '0'
    mov [counter], eax
...
...
...
;print out number of characters wrote
Show_num_char:
    mov eax, 4
    mov ebx, 1
    mov ecx, counter
    mov edx, 4
    int 80h
....
...
..

A: In your case, because you're going for character count, it would be more practical to use the processors natural number system which is binary. Then afterward, convert it to decimal. In this example, let's say you counted 301,927 characters. That would be 0x49b67 in binary. This snippet will do the conversion and then finish with RDI pointing to ASCII converted string.
I don't have a 32 bit machine, so all you have to do is take out the REX qualifiers change registers that start with "r" to "e" and then the same will work for you.
        section .text
        global  _start

 _start     push    byte 0              ; So ASCII string will be terminated
                                        ; with NULL
            mov     rdi, rsp
            mov     eax, 0x49b67        ; = 301927
            mov     ecx, 10

         Div:
            xor     edx, edx
            div     ecx                 ; DL = digit 0 - 9
            or       dl, '0'
            mov     [rdi], dl
            dec     rdi
            or      eax, eax
            jnz     Div

            inc     rdi                 ; RDI now points to ASCII string

I've left the bit out at the end for exiting the program as in 64 bit I use SYSCALL and you'd use INT 0x80, but follow this through in GDB and you'll see how it works.


text:
Q: Non-Abelian gauge theory action with external currents: gauge invariance? I am currently trying to work out the gauge invariance of the Yang-Mills action coupled to an external source and I noticed something weird.
The Yang-Mills action in presence of an external source $J^a_\mu$ reads
$S =  \intop_x - \frac{1}{4} F^{a\mu\nu}F^a_{\mu\nu} + J^{a\mu} A^a_\mu = S_{YM} + S_{J}$.
The pure Yang-Mills part $S_{YM}$ is invariant under gauge transformations $V(x) \in \text{SU(N)}$ via
$\mathcal{A}_\mu = A^a_\mu t^a \rightarrow V \mathcal{A}_\mu V^\dagger - i V \partial_\mu V^\dagger$.
However, $S_J$, the part where we coupling to the external source happens, is not gauge-invariant. I know that the source should transform gauge covariantly via
$\mathcal{J_\mu} = J^a_\mu t^a \rightarrow V \mathcal{J}_\mu V^\dagger$,
but this does not render $S_J$ gauge-invariant. In fact I obtain
$S_J \rightarrow S_J - 2i\intop_x tr(V \mathcal{J_\mu} \partial^\mu V^\dagger)$,
which does not vanish. What's exactly happening here?
Note: if we look at the Abelian case and repeat the same steps we could actually make the action invariant by requiring charge conservation $\partial_\mu J^\mu=0$.
I know that the QCD action is gauge-invariant and in that case I obtain an extra term from the matter fields which cancels against terms from $S_J$. Does this mean that Yang-Mills with external sources is meaningless? Does Yang-Mills only make sense if the current $J^a_\mu$ comes from "dynamical" fields like quarks?

A: It is not possible to couple a conventional $c$-number source to a quantized  non-abelian gauge field and maintain gauge invariance. For a current $J^\mu=\lambda^a J^\mu_a$, gauge invariance requires covariant current conservation
$$
0= \nabla_\mu J^\mu\equiv \partial_\mu J^\mu  + [A_\mu,J^\mu]=0
$$
and this requires a $c$-number(the first term)   to equal a term containing an the  operator $A_\mu$. It is because of this problem that external sources are introduced into a gauge theory as Wilson Loops
$$
W= P\exp\{ i\int A_\mu dx^\mu\}
$$
where $P$ denoters a path-ordered integral of the matrix valued ($A_\mu = A_\mu^a \lambda^a$) gauge field.
It is possible to add a kind of classical source to a classical gauge action by using the "Wong equations" in which the internal gauge degrees of freedom in the source are  replaced by classical dynamics in a "co-adjoint orbit"


text:
Q: Memory leak in Python-C++ interface? I have a piece of C++ code with python-C++ interface that need to be called repeatedly with a python list as its input. I found even the dummy process as following leads to memory leak:
In python:
a = [1.0]*1000
for c in range(1000):
    dummy(a, 1)

In C++:
static PyObject* dummy(PyObject* self, PyObject* args) {
    Py_RETURN_NONE;
}

Am I miss anything here so it introduces memory leak?

A: No that's fine, objects you get passed to your c method are only borrowed, i.e. you don't have to decrease the refcount of the objects before returning (as a matter of fact that would be a bad, bad bug).
See for example this part of the documentation:

Note that any Python object references which are provided to the
  caller are borrowed references; do not decrement their reference
  count!

How are you even determining that you have a memory leak? It's more than likely that that's your problem.


text:
Q: Magento 2 issue on header minicart Im having problem on integrating header mini cart into my custom theme. The mini cart is not showing the recently added items. Below are the screenshots of the issue. Any help is much appreciated.
Parent theme: Magento/Blank
Screenshots:

By the way I'm newbie for Magento 2.


text:
Q: Javascript: enable all submit buttons on the page after 3 second I have multiple forms & submit buttons on a page.
I want to disable the user from being able to submit any of the forms until 3 seconds after the page loads.
For this purpose I have put disabled="disabled" into the html of each submit button.
Now how can I get it to automatically enable all of these submit buttons after 3 seconds, without having to specify the ID of each one individually?

A: JS :
window.onload = function(){
  var buttons = document.getElementsByTagName('button');
  setTimeout(function(){
    for(var i=0;i<buttons.length;i++){
    buttons[i].disabled=false;
    }
  },3000);
}

JQuery :
$(document).ready(function(){
  setTimeout(function(){
    $('button').attr('disabled','false');
  },3000);
});

A: To achieve this you have to put a common class to all the elements, and access them at once for disable / enables
Try this - make the class as Formelement

Now use this
setTimeOut(function(){
    $('.Formelement').attr('disabled','false');
},3000);


text:
Q: Unable to cast object of type 'OfficeOpenXml.ExcelRange' to type 'Microsoft.Office.Interop.Excel.Range' I am trying to add drop down list to the excel. I am doing this for first time.
Can any body tell why i am getting the error?
Error:

Unable to cast object of type 'OfficeOpenXml.ExcelRange' to type 'Microsoft.Office.Interop.Excel.Range'

Following is code:
            var cell1 = (Range)workSheet.Cells[4,4];

            cell1.Validation.Delete();
            cell1.Validation.Add(
               XlDVType.xlValidateList,
               XlDVAlertStyle.xlValidAlertInformation,
               XlFormatConditionOperator.xlBetween,
               List,
               Type.Missing);

            cell1.Validation.IgnoreBlank = true;
            cell1.Validation.InCellDropdown = true;


text:
Q: Rename files, moving date part of name from beginning to end I have filenames that come with the date at the beginning of their names, e.g. 20171015….txt.
I currently use a batch file to strip off the first 8 characters and this has worked well. However I'd like to now keep the date but move it to the end of the file name.

A: With the file name without extension set as a variable, %Variable%:
Ren "%Variable%.ext" "%Variable:~8%%Variable:~,8%.ext"

Or if performed within some sort of loop and delayed expansion enabled, i.e.SetLocal EnableDelayedExpansion:
Ren "!Variable!.ext" "!Variable:~8!!Variable:~,8!.ext"


text:
Q: Cannot use import statement outside a module when trying to import tensorflow.js into browser app I am following this basic tutorial for TensorFlow.js. In the tutorial they use script tags but I wanted to use npm to install tensorflow and import it:

*

*I ran npm install @tensorflow/tfjs like explained here which worked

*I tried to import it like so: import * as tf from '@tensorflow/tfjs';
Getting the following mistake (as in the title): Uncaught SyntaxError: Cannot use import statement outside a module
I am new to using npm so might just be a stupid beginner mistake.
Tried this:

*

*When searching for this problem something that came up quite often was that I had to add "type": "module" in the package.json so I ran npm init to create a package.json and then did as told:

{
  "name": "tensorflow",
  "version": "1.0.0",
  "description": "Testing out tensorflow (following a tutorial)",
  "main": "index.js",
  "type": "module",
  ...
}

*

*still getting the same mistake.

*I am using the script in which im trying to import tensorflow in an html file so I even tried this which didn't even make any sense to me:
  <script type="module" src="index.js"></script>

now getting this mistake: Access to script at 'file:///***/tensorflow/index.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. index.js:1 Failed to load resource: net::ERR_FAILED
Some additional info (don't know if relevant, probably not):

*

*I am using Visual Studio Code running/debugging the html page with the default Chrome-Debugging config.

*Node Version: v12.16.3

Help much appreciated.
Edit:
Running the script with Node works though:

*

*I installed tensorflow for node: npm install @tensorflow/tfjs-node

*"Import" it:
  const tf = require("@tensorflow/tfjs");
  require("@tensorflow/tfjs-node");

*No error there


text:
Q: create and query a n-gram index with lucene I would like to build an index containing n-grams of each line from my input file, which looks like this:
Segeln bei den Olympischen Sommerspielen
Erdmond
Olympische Spiele
Turnen bei den Olympischen Sommerspielen
Tennis bei den Olympischen Sommerspielen
Geschichte der Astronomie

I need the n-grams because I would like to search in the index but I have to assume that there are many  typing errors in the search-term. For example I would like to find "Geschichte der Astronomie" if I search with the term "schichte astrologie". It would be even better if it could give me a list of the best possible matches, lets say the best 10 matches, no matter how bad they maybe are.
I hope you can point me in the right direction if there would be a better way to achieve this, than with n-grams, or that you have a hint how to create the index and how to query it. I would be very happy to have an example that helps me to understand how to do it.
I currently use lucene 4.3.1. I would prefer to implement it in java and not built the index on the command line.

A: There are a lot of different ways to approach to this problem, and Lucene has a lot of tools to help with them.  N-Grams are probably not the best approach in this situation, to my mind.

*

*Stemmers to reduce terms to their root, based on linguistic rules (ex. matching "fishing" "fished" and "fish) (I don't claim to know how GermanStemmer handles the "ge" prefix, but that would be a good example of something that a stemmer might deal with)

*Synonym Filter can handle specific known synonyms you want to recognize (ex. "astrology" = "astronomy")

*Fuzzy queries can be used to obtain matches with low edit distances.

Among other possibilities.
As far as implementing on NGrams, NGramTokenizer would be the correct tokenizer for that.


text:
Q: Passing JSON data to HTML after Successful Authentication - Spring security and Spring MVC I am using Spring MVC, Spring security for our web application. After successful login the request gets redirected to a HTML page (login.html). We have about 4 AJAX calls that are executed then after using Ext-JS.
I have a requirement to send JSON data after successful login. What this means is the JSON data has to be passed on to the client along with the login page. And on the login page we need to access this JSON data and render it. Frankly this is the same data which requested by the Ext-JS code on the login.html page. The goal is to avoid additional requests by AJAX call.
I tried out various examples on stackoverflow and other websites (just avoiding mention, to prevent cluttering) and created a custom authentication handler, and made changes appropriately. Everything works fine but not a way to send JSON/any data to client.
The below are the configurations of application-context.xml
    <http auto-config="false" use-expressions="true">
        <form-login login-page="/login"
                    login-processing-url="/static/j_spring_security_check"
                    authentication-failure-url="/login?login_error=t"
                    authentication-success-handler-ref="customAuthHandler"
                    authentication-failure-handler-ref="customAuthHandler"
                    default-target-url="/html/index.html"
                    always-use-default-target="true"/>

    <beans:bean id="customAuthHandler"
           class="com.mycompany.security.CustomAuthenticationHandler"/>

On the onAuthenticationSuccess method in CustomAuthenticationHandler I have the following code to see if I could get this value, but I could not. What I understand is since its a HTML/static content I can't pass session value to client and that needs to be a JSP. (Please correct me if wrong!) I can't change the HTML to JSP for bureaucratic reasons:
Test 1:
   request.getSession(true).setAttribute("ssntest", "hello:how:are:you");

Test 2:
    HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(response);

    Writer out = responseWrapper.getWriter();

    String targetUrl = "/login";
    out.write("{success:true, targetUrl : \'" + targetUrl + "\'}");
    out.close();

What would be a way to pass JSON value on successful authentication along with HTML.

A: Keeping this kind of data in session isnt a good approach, but you can try the @SessionAttributes annotation, provided by SpringMVC. See another answer
The point is to save your JSON value into session in the login page, and then return it back in another AJAX request after successful authentication.


text:
Q: Excel AddIn using Name Manager at work we have some add-ins. Someone got the idea to rename a Sheet, whereupon the Script no longer work. To prevent this from happening in the future, I put the following formula in the worksheet and gave the cell a name using the Name Manager
=TEIL(ZELLE("dateiname";A1);SUCHEN("]";ZELLE("dateiname";A1))+1;31)

In VBA I use the following script:
fileName = "Filename.xlam"
Test = Workbooks (fileName) .Application.Names ("Test")

If I set temporarily the isAddIn value to False, everything works without any problems. As an add-in, however, I get error 1004. Can someone help me?
It should be great, if the possibility to get the file name of the xlam add-in via a function, in case someone else comes up with the brilliant idea of renaming this file.
Many thanks for your help
Sam

A: I use this method to lock my sheet names: Add this to the worksheet code that you want to lock and then save the sheet. If a user tries to edit the name it will simply revert back to its original name.
    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If ActiveSheet.Name <> "test" Then
    ActiveSheet.Name = "test"
    End If
    End Sub

source


text:
Q: REGEX Pattern for Username inside a longer string MAC OSX, PowerShell 6.1 Core
I'm struggling with creating the correct REGEX pattern to find a username string in the middle of a url. In short, I'm working in Powershell Core 6.1 and pulling down a webpage and scraping out the "li" elements. I write this to a file so I have a bunch of lines like this:

Smith, Jimmy

The string I need is the "jimmysmith" part, and every line will have a different username, no longer than eight alpha characters. My current pattern is this:
(<(.|\n)+?>)|( )

and I can use a "-replace $pattern" in my code to grab the "Smith, Jimmy" part. I have no idea what I'm doing, and any success in getting what I did get was face-roll-luck.
After using several online regex helpers I'm still stuck on how to just get the "string after the third "/" and up-to but not including the last quote.
Thank you for any assistance you can give me.

A: You could go super-simple,
expand-user/([^"]+)

Find expand-user, then capture until a quotation.

A: (?:\/.*){2}\/(?<username>.*)"

(?:\/.*) Matches a literal / followed by any number of characters
{2} do the previous match two times
\/ match another /
(?<username>.*)" match everything up until the next " and put it in the
username group.
https://regex101.com/r/0gj7yG/1
Although, since each line is presumably identical up until the username:
$line = ("
Smith, Jimmy ")
$line = $line.Substring(36,$line.LastIndexOf("\""))

A: the answer is what was posted by Dave. I saved my scraped details to a file (the lines with "li") by doing:
get-content .\list.txt -ReadCount 1000| foreach-object { $_ -match "
"} |out-file .\transform.txt

I then used the method proposed by Dave as follows:
$a = get-content .\transform.txt |select-string -pattern '(?:\/.*){2}\/(?<username>.*)"' | % {"$($_.matches.groups[1])"} |out-file .\final.txt

I had to look up how to pull the group name out, and i used this reference to figure that out: How to get the captured groups from Select-String?


text:
Q: What is the out put of this code any why? I have a function in C++, I know what the would be but why?
int c[5];
int* pc = c;

for (int i = 0; i < 5; i++)
{
    c[i] = i*2;
}
*pc++;
printf("%d\n", pc-c );

A: There's a lot of garbage code going on. This is the only thing important for the print:
int c[5];              // c is a pointer
int* pc = c;           // pc points to the same thing as c.
pc++;                  // pc now points to one-past-where-c-points-to
printf("%d\n", pc-c ); // will print the pointer differences. 1.

Note that
*pc++;

actually means
*(pc++);

which is different from
(*pc)++;

When in doubt, always use brackets.

A: Distance of addresses
It seems the code is trying to show distance of pointer pc to c in memory addressing space.

*

*int* pc = c; :  pc points to where c is pointing to. (Here pc = c)

**pc++; : pc increased one (Here pc = c + 1 )

*pc - c :  pc - c = 1 : the distance (number of integers between them)

 +------+------+------+------+------+
 |      |      |      |      |      |
 +------+------+------+------+------+
 ^      ^
 c      pc

You can read about well-defined pointer arithmetic [expr.add] in §5.7 of C++ standard.

A: Output is 1 as it subtracts the addresses and returns the difference


text:
Q: How to find element in nested span using Selenium WebDriver? I am trying to click on 'New Trade' link which is in span n6 which is a child element of span n2. I am able to reach till n2 but its not identifying 'n6'.
Please help I am new to Selenium WebDriver
Here I am posting the html and my code.

Trading
New
  Trade
Trade
  Explorer

I want to click on New Trade
HTML source code
My code which went till span 'n2':
driver.switchTo().frame(driver.findElement(By.name("treeFrame")));

WebElement allFormChildElements = driver.findElement(By.name("the_form"));
allFormChildElements.findElement(By.linkText("Trading")).click();

WebElement modalDialog = allFormChildElements.findElement(By.className("border"));
WebElement newmodalDialog = modalDialog.findElement(By.className("formScrollableMenuContent"));
System.out.println(newmodalDialog.findElements(By.tagName("a")).size()); // ans 5

WebElement newDialog= newmodalDialog.findElement(By.id("n2"));
System.out.println(newDialog.findElements(By.id("n3")).size()); // ans 0

A: With the image I can't test but, if you are able to reach the element <span id="n2">, from there you could use the following xpath in order to click the element with the text "New Trade":
newDialog.findElement(By.xpath(".//span[@id='n6']/a[@name='A6' and text()='New Trade']")).click();

EDIT
If the id value change, try in this way:
newDialog.findElement(By.xpath(".//span/a[@name='A6' and text()='New Trade']")).click();

A: Could you please try below  xpath
//a[contains(text(),"New Trade")]


text:
Q: Show equality of sets Let $A,B,C$ sets. Show that $(A \cup B ) \cup C=A \cup (B \cup C)$.
That's what I have tried:
$$x \in (A \cup B) \cup C \leftrightarrow  x \in A \cup B \vee x \in C \leftrightarrow x \in A \vee x \in B \vee x \in C \leftrightarrow x \in A \vee x \in B \cup C \leftrightarrow x \in A \cup(B \cup C)$$
Could you tell me if it is right?

A: It's perfect,I'm also a a few months into set theory,and this is how I had to prove it in my  homework.


text:
Q: Group by, count and multiply I'm trying to make a rather simple SQL request but I can't quite wrap my head around how this is supposed to work. So... I have this
SELECT
    VILLAGE.ID_VILLAGE,
    VILLAGE.NOM_VILLAGE,
    VILLAGE.PAYS,
    COUNT(SEJOUR.DATE_SEJOUR)*SEJOUR.NB_PERSONNES as NB_TOTAL_NUITS
FROM
    SEJOUR
        INNER JOIN
            RESERVATION ON RESERVATION.ID_RESERVATION = SEJOUR.ID_RESERVATION
        INNER JOIN
            VILLAGE ON VILLAGE.ID_VILLAGE = RESERVATION.ID_VILLAGE
GROUP BY
VILLAGE.ID_VILLAGE,
VILLAGE.NOM_VILLAGE,
VILLAGE.PAYS,
SEJOUR.NB_PERSONNES

Which returns this answer:
ID_VILLAGE                              NOM_VILLAGE     PAYS       NB_TOTAL_NUITS
--------------------------------------- --------------- ---------- --------------
4                                       Kouros          Grèce      7
1                                       Casa-Dali       Espagne    188
2                                       Porto-Nuevo     Espagne    126
1                                       Casa-Dali       Espagne    12
2                                       Porto-Nuevo     Espagne    3
1                                       Casa-Dali       Espagne    148
4                                       Kouros          Grèce      12
1                                       Casa-Dali       Espagne    65
1                                       Casa-Dali       Espagne    36

But I need it to only return me 4 answers, which would be the total of those grouped by, like say 1 would have to give me 400+ on the NB_TOTAL_NUITS field, I can't seem to get those grouped up further and still get the required multiplication to get the correct values, can someone please enlighten me as to how this is properly done? Thank you in advance.

A: Sorry, just realised the obvious awnser myself... use SUM()...


text:
Q: Use Google Cloud Storage from PHP application (not hosted on App Engine) I'm using Google Cloud Storage for media. My website is stored elsewhere. I want to serve medias for client users (through web browser), but I don't want to use public images (I want "keys"). I think it's possible on app engine (building URL), but my question is:
Is it possible to build URL to Google Cloud Storage stored medias from another server with PHP ? Or is there an API for calling Google Cloud Storage if my site is not on App Engine ?
Hope it's clear enough. Sorry, I did not found answer (I'm a new user).

A: Yes, the google-api-php-client library can be used outside of AppEngine. There is a PHP Example Tutorial to help you get started.


text:
Q: How to display long NSString in 1 row of a section in UITableView? This is my second project in iOS development and I am trying to display an itinerary for a hackathon in a UITableView object. I'm storing the the list of activities and their associated times in one NSString variable named 'events' and then trying to display it with 'cell.textLabel.text = schedule.events' and it only displayed the first activity in the events variable. I then tried increasing the the height of the row but that didn't solve my problem either. Am I approaching this wrong?
I starting thinking thinking that events should be an NSArray holding string literals of each activity but then couldn't figure out how to display each string literal in that array as an individual row of the three sections: Friday, Saturday, and Sunday. Could anyone point me in the right direction of how to do this?
Screenshot of iOS Simulator
Here is my code for the ViewController with UITableView
#import <UIKit/UIKit.h>
#include "Weekend.h"

@interface ScheduleViewController : UIViewController <UITableViewDataSource,
    UITableViewDelegate>

@property (strong, nonatomic) IBOutlet UITableView *tablesView;

@end

#import "ScheduleViewController.h"

@interface ScheduleViewController ()

@end

@implementation ScheduleViewController {

    NSArray *allWeekendDays;
    NSArray *allEvents;
}

@synthesize tablesView;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //Set up schedule for friday
    Weekend *friday = [[Weekend alloc] init];
    friday.day = @"Friday, March 20th\n";
    friday.events = @"9:00 PM       Check-In\n"
                     "11:00 PM      Opening Ceremony\n"
                     "11:59 PM      Begin Hacks";

    //Set up schedule for saturday
    Weekend *saturday = [[Weekend alloc] init];
    saturday.day = @"Saturday, March 21st";
    saturday.events = @"2:00 AM     Snack Time\n"
                       "8:00 AM     Breakast\n"
                       "1:00 PM     Lunch\n"
                       "7:30 PM     Dinner\n"
                       "10:00 PM    Nerf-Gun Wars";

    //Set up schedule for sunday
    Weekend *sunday = [[Weekend alloc] init];
    sunday.day = @"Sunday, March 22nd";
    sunday.events = @"2:00 AM       Snack Time\n"
                     "6:30 AM       Breaskfast\n"
                     "7:30 AM       End Hacks\n"
                     "8:00 AM       Expo 1\n"
                     "9:00 AM       Expo 2\n"
                     "10:00 AM      Closing Ceremony";

    allWeekendDays = [NSArray arrayWithObjects:friday, saturday, sunday, nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark Table View Data Source Method
/*Ask about how to set style of table to grouped programmatically
- (id)initWithFrame:(CGRect)aRect style:(UITableViewStyle)style {

    return self.tablesView = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
}
*/

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    //Defines how many sections in my table
    return [allWeekendDays count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    //Defines how many rows will be in each section
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //Defines how each individual cell will loook like

    static NSString *simpleTableIdentifier = @"WeekendCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];
    }

    //Changed indexPath.row to indexPath.section
    Weekend *schedule = [allWeekendDays objectAtIndex:indexPath.section];
    cell.textLabel.text = schedule.events;

    return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    //Define the header of each section to be the week day
    Weekend *schedule = [allWeekendDays objectAtIndex:section];

    return schedule.day;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 100.0;
}

@end

A: The simplest solution is to set cell.textLabel.numberOfLines to 0;
This way you get an auto-growing UILabel.

But in my opinion I would use one one cell per event, not day. You already grouped the individual days, so that will work nicely!
To do that, use events as an array that contains multiple strings.
Here are some small code changes:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    //Defines how many rows will be in each section
    return [[allWeekendDays[section] events] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //Defines how each individual cell will loook like

    static NSString *simpleTableIdentifier = @"WeekendCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];
    }

    //Changed indexPath.row to indexPath.section
    Weekend *schedule = [allWeekendDays objectAtIndex:indexPath.section];
    cell.textLabel.text = schedule.events[indexPath.row];

    return cell;
}

...
//Set up schedule for sunday
Weekend *sunday = [[Weekend alloc] init];
sunday.day = @"Sunday, March 22nd";
sunday.events = @["2:00 AM       Snack Time\n",
                 "6:30 AM       Breaskfast\n",
                 "7:30 AM       End Hacks\n",
                 "8:00 AM       Expo 1\n",
                 "9:00 AM       Expo 2\n",
                 "10:00 AM      Closing Ceremony"];


text:
Q: Counterexample of converse of "if $f: A\to B$ and $g: B\to C$ are surjective, then $g\circ f$ is surjective" I managed to prove the statement:

If $f: A\to B$ and $g: B\to C$ are surjective, then $g\circ f$ is surjective.

But now I require a counterexample to the converse of this statement. I am not sure how to formulate the counterexample. Similarly I need a counterexample of the statement being "injective" instead of "surjective".

A: Converse : "If $g\circ f$ is surjective, then $f$ and $g$ are surjective".
Saying this statement is false means $g\circ f$ is surjective, but either $g$ or $f$ is not. But if $g$ is not surjective, $g\circ f$ can't be either (check it). So your counterexample has to be composed of $f:A\to B$ non surjective, and $g:B\to C$ surjective such that $g\circ f$ is surjective.
For example : $A=\left\{0,1\right\}$, $B=\left\{a,b,c\right\}$, $C=\left\{\alpha,\beta\right\}$. $f(0)=a$, $f(1)=b$, $g(a)=\alpha$, $g(b)=\beta=g(c)$.
You can check $g\circ f$ is surjective, but $f$ is not.
For "injective" instead of "surjective", do the same analysis, and consider the fact that if $f$ is not injective, $g\circ f$ can't be either.

A: Hint: A function $h: A \to \{0\}$ is surjective for any nonempty set $A$.

A: Hints: You may find it useful to use the characterizations
$$f:A\to B \textrm{ surjective }\iff f\circ f^{-1}=\operatorname{Id}_B$$
and
$$f:A\to B \textrm{ injective }\iff f^{-1}\circ f=\operatorname{Id}_A$$


text:
Q: How to return to AJAX error function from application_error? My code below ends up in the AJAX success function. Why? It should execute the error function. What am I doing wrong?
$.ajax({
    url: url,
    type: "POST",
    data: data,
    contentType: "application/json; charset=utf-8",
    success: function(data) {
        if (callback)
            callback(data);

        $.LoadingOverlay("hide");
    },
    error: function (event, jqxhr, settings, thrownError) {
        var t = "";

    }
});

protected void Application_Error(object sender, EventArgs e)
{
    var ctx = HttpContext.Current;

    var exception = ctx.Server.GetLastError();

    bool isAjaxCall = string.Equals("XMLHttpRequest", Context.Request.Headers["x-requested-with"], StringComparison.OrdinalIgnoreCase);
    Context.ClearError();
    if (isAjaxCall)
    {
        //Context.Response.ContentType = "application/json";
        Context.Response.StatusCode = 200;
        Context.Response.Write(
            new JavaScriptSerializer().Serialize(
                new { error = exception.Message }
            )
        );
    }
}

The controller simply throws an exception:
throw new Exception("faulty");

A: The error handler of $.ajax is executed when a HttpStatusCode of anything other than 2xx is received. With that in mind, you could return a 500 Internal Server Error, like this:
protected void Application_Error(object sender, EventArgs e)
{
    var ctx = HttpContext.Current;
    var exception = ctx.Server.GetLastError();
    bool isAjaxCall = string.Equals("XMLHttpRequest", Context.Request.Headers["x-requested-with"], StringComparison.OrdinalIgnoreCase);
    Context.ClearError();

    if (isAjaxCall)
    {
        Context.Response.StatusCode = 500; // note the change here
        Context.Response.Write(new JavaScriptSerializer().Serialize(new { error = exception.Message }));
    }
}


text:
Q: Facebook API to do sentimental analysis I am developing an android native application for sentimental analysis. The context is I need to get the information from the social media like Twitter and Facebook. I have done it for Twitter by using the API to get the 100 latest tweets about the particular organisation. That is fine.
Now I am trying to do the same for Facebook. Is there any free API available for this sentimental analysis.

A: I'm assuming to get the Twitter analysis working you used their 'firehose.'
If that is the case, and you're looking for a Facebook equivalent: it doesn't exist. Perhaps it's because the dynamics of these two social networks are not exactly identical and so what each is trying to achieve is different.
While some Facebook users' activities can be completely public (as per their choosing), most of the content is behind walls, so to speak. So unless you scrape the public info and do some analysis on it, as of right now there is no API support for what you're looking for.

A: If you're doing it for a particular organization they probably have a facebook page.  Since almost all pages are public you can use the Facebook API to to query that page and get all the comments from that page. Once you have those comments you can perform sentiment analysis on them.  The query might look something like:
$facebook->api("pageName/posts?fields=created_time,id,message,story,type,picture,shares,likes,comments.limit(5000)");

The above example is in php but you can find an equivalent Java example.
Since there is no stream like functionality for Facebook you would have to set, maybe a cron job, to run it every hour to get the latest comments.


text:
Q: list of imageIcon it is possible using a list like
    private LinkedList<Object> deckOfCards = new LinkedList<Object>();
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            deckOfCards.add(new Card(Rank.values()[j].toString(), Suit.values()[i].toString(), number[j], Image[j]));
        }
    }
}

and when i do
public Object pickRandomCard() {
        Random randomNumbers = new Random();
        rand = randomNumbers.nextInt(deckOfCards.size());
        System.out.println(deckOfCards.get(rand).toString());
        return deckOfCards.get(rand).toString();
    }

    //***********************

    public void setImage(ImageIcon Image) {
        this.cardImage = Image;
    }

    public ImageIcon getImage() {
        return deckOfCards.get(rand).getImage();
    }

i receive
The method getImage() is undefined for the type LinkedList
At the moment i can return the name of card, but not the image, how i can do that?
contructor
package game;
import javax.swing.ImageIcon;
public class Card {
    private String  face;
    private String suit;
    private int number;
    private ImageIcon Image;
Card(String faceCard, String faceSuit, int value, ImageIcon ImageO) {
    face = faceCard;
    suit = faceSuit;
    number = value;
    Image = ImageO;
}

public String toString() {
    return face + " of " + suit;
}

public ImageIcon getImage() {
    return Image;
}

public int toInt() {
    return number;
}

public String suit(){
    return suit;
}

}

A: Use Card instead of Object:
private LinkedList<Card> deckOfCards = new LinkedList<Card>();
...
public Card pickRandomCard() {
...

A: I believe you want:
private LinkedList<Card> deckOfCards = new LinkedList<Card>();


text:
Q: split container will not updating I have a split container in one form. In the left panel, job information is displayed and in the right panel, a calendar is drawn in which the order periods are displayed graphically. That works pretty well as well.
But now you can place stickers in every order. With a double-click on a calendar day, the respective sticker is displayed or created. With a single click the respective order number is stored in the registry for another program.
My problem is that the calendar is not always updated after a sticker creation or deletion. I made a file-log and found that he jumped in the respective methods, but somehow they are not executed anyway. When I go through debug mode, everything works.
Can someone give me a hint what I'm doing wrong?
Here are the respective code fragments:
private void splitPanelV_Panel2_Paint(object sender, PaintEventArgs e)
    {
        try
        {
            Paint_Cal(e.Graphics);
            Paint_AllOrders(e.Graphics);

            btnRefresh.Focus();
        }
        catch (Exception ex) {
            MessageBox.Show(ex.ToString());
        }
    }

private void MyMouseDown(object sender, MouseEventArgs e)
    {
        m_objSender = sender;
        m_meaEventArgs = e;

        //txtDebug.Text += "Begin MouseDown" + Environment.NewLine;
        myLogger.d(TAG, "Begin MouseDown");

        // This is the first mouse click.
        if (m_bolIsFirstClick)
        {
            m_bolIsFirstClick = false;

            // Determine the location and size of the double click
            // rectangle area to draw around the cursor point.
            m_recDoubleClick = new Rectangle(
                e.X - (SystemInformation.DoubleClickSize.Width / 2),
                e.Y - (SystemInformation.DoubleClickSize.Height / 2),
                SystemInformation.DoubleClickSize.Width,
                SystemInformation.DoubleClickSize.Height);
            Invalidate();

            // Start the double click timer.
            m_TimerDoubleClick.Start();
        }

        // This is the second mouse click.
        else
        {
            // Verify that the mouse click is within the double click
            // rectangle and is within the system-defined double
            // click period.
            if (m_recDoubleClick.Contains(e.Location) && m_intMilliseconds < SystemInformation.DoubleClickTime)
            {
                m_bolIsDoubleClick = true;
            }
        }
        //txtDebug.Text += "End MouseDown" + Environment.NewLine;
        myLogger.d(TAG, "End MouseDown");
    }

private void m_TimerDoubleClick_Tick(object sender, EventArgs e)
    {
        m_intMilliseconds += 100;
        if (m_intMilliseconds >= SystemInformation.DoubleClickTime)
        {
            m_TimerDoubleClick.Stop();

            //WENN DoubleClick DANN DoubleClick-Methode
            if (m_bolIsDoubleClick)
            {
                //MyMouseDoubleClick(m_objSender, m_meaEventArgs);
                this.Invoke(new MyMouseDoubleClickDelegate(MyMouseDoubleClick), new object[] { m_objSender, m_meaEventArgs });
            }
            else //SONST SingleClick-Methode
            {
                //MyMouseClick(m_objSender, m_meaEventArgs);
                this.Invoke(new MyMouseClickDelegate(MyMouseClick), new object[] { m_objSender, m_meaEventArgs });
            }

            m_bolIsFirstClick = true;
            m_bolIsDoubleClick = false;
            m_intMilliseconds = 0;
        }
    }

private void RefreshForm()
    {
        myLogger.d(TAG, "ShowPanelLeft()");
        ShowPanelLeft();
        myLogger.d(TAG, "this.Refresh()");
        this.Refresh();
        //Point ptPos = this.Location;
        //this.Location = ptPos;
        //splitPanelV.Invalidate();
        Application.DoEvents();

        btnRefresh.Focus();
    }

private void MyMouseDoubleClick(object sender, MouseEventArgs e)
    {
        ....
         frmSticker objStickerform = new frmSticker();

                                //Berechnung des Delta für die x-Achse
                                intDeltaX = M_DELTA_X;
                                if ((e.X + objStickerform.Width + M_DELTA_X) > this.Width)
                                {
                                    intDeltaX = -M_DELTA_X - objStickerform.Width;
                                }

                                //Berechnung des Delta für die y-Achse
                                intDeltaY = M_DELTA_Y;
                                if ((e.Y + objStickerform.Height + M_DELTA_Y) > this.Height)
                                {
                                    intDeltaY = -M_DELTA_Y;
                                }

                                //Sticker an die gewünschte Position verschieben
                                intStickerLeft = this.Left + splitPanelV.Panel2.Left + e.X + intDeltaX;
                                intStickerTop = this.Top + splitPanelV.Panel2.Top + e.Y + intDeltaY;
                                objStickerform.Left = intStickerLeft;
                                objStickerform.Top = intStickerTop;

                                //WENN ein Sticker gefunden wurde DANN zeige ihn an
                                if (bolFound)
                                {
                                    objStickerform.InitSticker(objSticker);
                                }
                                else //SONST öffne einen neuen Sticker
                                {
                                    objNewSticker = new clsSticker();
                                    objNewSticker.Date = Convert.ToDateTime(dtMouseDate.ToShortDateString());
                                    objNewSticker.OrderNumber = m_lstDataFiltered[i].OrderNumber;
                                    objNewSticker.Type = (int)Stickertype.User;
                                    objNewSticker.Username = txtUser.Text;

                                    objStickerform.InitSticker(objNewSticker);
                                }

                                //Sticker anzeigen
                                objStickerform.ShowDialog();
                                switch (objStickerform.m_ButtonType)
                                {
                                    case WhatButtonClicked.New: //Neuen Sticker speichern
                                        //txtDebug.Text += "Sticker save" + Environment.NewLine;
                                        myLogger.d(TAG, "Sticker save");
                                        if (objStickerform.m_objSticker.Text.Trim() != string.Empty)
                                        {
                                            try
                                            {
                                                m_objDB.StickerSave(objStickerform.m_objSticker);
                                                objData = m_lstData.Find(a => a.OrderNumber == m_int_CurrentOrderNo);
                                                objData.Sticker[(int)Stickertype.User].Add(objStickerform.m_objSticker);
                                            }
                                            catch (Exception ex)
                                            {
                                                MessageBox.Show(ex.ToString(), "Fehler beim Sticker erstellen", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            }
                                        }
                                        break;
                                    case WhatButtonClicked.Delete: //Bestehenden Sticker löschen
                                        //txtDebug.Text += "Sticker del" + Environment.NewLine;
                                        myLogger.d(TAG, "Sticker del");
                                        try
                                        {
                                            m_objDB.StickerDelete(objStickerform.m_objSticker);
                                            objData = m_lstData.Find(a => a.OrderNumber == m_int_CurrentOrderNo);
                                            objData.Sticker[(int)Stickertype.User].Remove(objStickerform.m_objSticker);
                                        }
                                        catch (Exception ex)
                                        {
                                            MessageBox.Show(ex.ToString(), "Fehler beim Sticker erstellen", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        }
                                        break;
                                    case WhatButtonClicked.Nothing: //Stickerfenster schließen
                                        objStickerform.Close();
                                        break;
                                }
                                objStickerform.Close();
                                RefreshForm();
                                return;
        ...
    }


text:
Q: Sometimes Receiving shifted data with TCP I'm receiving packages where the content has its start not at the beggining of the buffer but at byte 2 or 3 of the buffer. That just happens sometimes. That means the received data are all shifted then.
I set the buffer size to 4096 bytes. I'm using the recv method from the Python sockets and am receving data from a Siemens PLC (if that's a possible source of issues).
Am I missing something out or has the error to be somewhere else than in my program?


text:
Q: mat-nav-list: routerLinkActive class applied after click I have a mat-nav-list in my application that displays the menu on the left. I have added routerLinkActive="selected-item" to it to highlight the currently selected menu item.
Whenever a menu item is clicked, the class is not applied. It gets applied only after I click somewhere else in the page.
Below is the snippet of my code:
<mat-nav-list (click)="menuItemClicked()" class="menu-list">

        <mat-icon [svgIcon]="menuItem.icon" matListIcon></mat-icon>
        {{ menuItem.label }}

</mat-nav-list>

.selected-item {
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
    background-color: #f47431;
}

Here's a Stackblitz which reproduces the issue: https://stackblitz.com/edit/angular-wuabhz?file=src/app/list-single-selection-example.html
Select one of the boot items and click somewhere else and you'll see the class selected-item gets applied.
Is there a way to overcome this issue or am I missing something?

A: @prerak-sola
I noticed the same.
The reason for this is that the item still have ':focus' until you click somewhere else.
You could
1. use the same color on the 'item-active' as mat-list-item:focus
(if you don't have a need for a darker shade or different color)
.active-link {
  background-color: rgba(0,0,0,0.1);
}

.mat-nav-list .mat-list-item:focus{
  /* default bg color */
  background-color: rgba(0,0,0,0.87);
  /* ovrride bg color to match your item-active*/
  background-color: rgba(0,0,0,0.1);

}

'a mat-list-item'

    <mat-nav-list>
         {{ link.name }}
    </mat-nav-list>

2. Or probably better wrap your list-item in a <mat-list-item>

*

*note that the 'routerLinkActive' is placed in the <mat-list-item>

*this will override the 'background-color' from .mat-list-item:focus

      'a mat-list-item'
      <mat-nav-list>
      <mat-list-item  *ngFor="let link of links" routerLinkActive="active-link">
         {{ link.name }}
         <button mat-icon-button>
            <mat-icon>info</mat-icon>
         </button>
      </mat-list-item>
    </mat-nav-list>

.active-link {
  background-color: rgba(0,0,0,0.1);
}

// .mat-nav-list .mat-list-item:focus{
//    background-color: rgba(0,0,0,0.1);
// }


text:
Q: Code First to Oracle Database I am trying to create some tables on an Oracle Database by executing migrations on Visual Studio, but im getting the following error in Package Manager Console:

Type is not resolved for member 'Oracle.ManagedDataAccess.Client.OracleException,Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.

This is my connection string:
 <connectionStrings>
    <add name="APSDashboardv2.Properties.Settings.Setting" connectionString="DATA SOURCE=xxxxxxxx;PASSWORD=xxxxxx;USER ID=xxxxxx"
      providerName="Oracle.ManagedDataAccess.Client" />
  </connectionStrings>

Strangely, tables were created but I cannot make a Select to see data, and whenever it try to make this select I get the following message:

SQL Error: ORA-00942: table or view does not exist
  00942. 00000 -  "table or view does not exist"

Anyone could help me with this?

A: You need to register Oracle.ManagedDataAccess.dll to GAC. Firstly, make a folder on your drive and copy the Oracle.ManagedDataAccess.dll to the folder, open command prompt there(Shift+Right Click>>Open Command Prompt Here). And Then copy and paste the following command and press enter. If you found "Assembly successfully added to the cache" message and your problem solved :). Restart Visual Studio and update-database again.
Command is here:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe" /i Oracle.ManagedDataAccess.dll

Code Snippet Here


text:
Q: Uninstalling the Featured Products modules doesn't remove the field in Catalog I've been trying several modules that provide "Featured Product" feature on for my store.
I've tried:

*

*Inchoo

*Daffodil

and a couple of others.  When I uninstall them the field "Featured Product" or similar one in the Catalog doesn't seem to go away.
Is there a way to get rid of this field?

A: Any time you see a field like this showing up in Product Maintenance, it is because it is an attribute. If it is not a system installed attribute, it was created when you installed the module.
Removing the module, unless there is a specific uninstall routine, does not remove attributes once created.
!!Using a test install on your DEV server!!, remove the attribute through Attribute Maintenance and then test heavily to make sure it is not referenced in any templates or module code. Typical errors for a missing attribute will throw Call to member function getXXX() on a non-object in xxxxx.phtml or similar.
If your test system passes with flying colors and doesn't throw any exception errors, congratulations, you should be rid of an unwanted attribute.

A: I think the best is to find the upgrade scripts in sql folder of these module and see what all changes they are doing to the database. As these modules are for featured products, my rough guess would be that they must be creating attributes around catalog and nowhere else.
If they are catalog attributes then you can simply delete those from admin panel under catalog -> attribute -> manage attributes.
Hope it helps!


text:
Q: ¿Cómo obtener los valores de columnas dinamicas en C# .net para realizar un listado? Estoy haciendo un método Listar en C# .net y en el momento de obtener cada valor
dentro del objeto son demasiados campos de fecha y ademas de ello el nombre de la columnas son dinámicos así que cambian de acuerdo al mes.
Lo que quiero saber es como manejar los valores dinámicos en este caso las fechas.
public List<Sigeri> ExportarResumenHoras()
        {

            List<Sigeri> lista = new List<Sigeri>();
            DatabaseHelper helper = null;
            SqlDataReader dr = null;
            try
            {

                helper = new DatabaseHelper(Conexion.Instancia.CadenaConexionDS());
                helper.AddParameter("@MesAño", "082019");
                dr = (DatabaseHelper)helper.ExecuteReader("PA_Control_Horas", System.Data.CommandType.StoredProcedure);
                while (dr.Read())
                {
                    var obj = new Sigeri()
                    {
                        Colaborador = new Colaborador()
                        {
                            IdColaborador = dr["Id_Colaborador"].ToString(),
                            NombreColaborador = dr["Nombre_Colaborador"].ToString()
                        },
                        Proyecto = new Proyecto()
                        {
                            IdUnidadOrganizativa=dr["Id_Unidad_Organizativa"].ToString()
                        },
//Fechas son dinámicas así que no le puedo asignar un nombre de atributo ya que el nombre de las columnas van a variar a menos que cree 30 atributos a mi objeto `SIGERI`
                    };
                    lista.Add(obj);
                }

            }
            catch (Exception ex)
            {
                throw ex;

            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
            return lista;

        }

A: Se me ocurre un par de alternativas, pero esta claro que antes un numero dinamico de columnas las solucion va a necesitar tambien ser dinamica, crear propiedades no es posible porque no sabes cuantas columnas tendras, salvo que definas un rango fijo de fechas y crees columnas de nombre secuencial como fecha1, ...fechaN y vayas poniendo cada fecha en estas propiedades sin hacer referencia a la fecha real
Podria usar un DataTable, al realizar el Fill() tendras un objeto que creara las columnas dinamicamente con los nombre del select
Podrias definir propieades que conoces y mapean con los campos y lo dinamico generas un Dictionary<>
public class Sigeri{
   //otras propiedades

   public Dictionary<string, decimal> Fechas {get;set;}
}

asi podrias usar el Add para agregar la fecha y su valor dinamicamente
El tema aqui va as er como conocer la metadata en base al reader para tomar el nombre de la columnas dinamicas
Cómo recuperar esquema de columna mediante el método GetSchemaTable del objeto DataReader y Visual C# .NET
pero se puede usar el GetSchemaTable() para obtener el nombre de las columnas y poder conocer los nombres que usar como key a medida que se itera el reader
Igualmente creo que si esos datos al final se van a exportar, usa un DataTable


text:
Q: vue component doesn't show data Axios loads data without any problem,   doesn't show any data, Laravel Mix builds without error.
I have following code:
index.html (body)

    <posts></posts>

In app.js I use this:
import Vue from 'vue';

// global declare axios
window.axios = require('axios');

import Posts from './components/Posts';
Vue.component('posts', Posts);

new Vue({
    el: '#app',

    props: {
        posts:[{
            userId: [Number],
            id: [Number],
            title: [String, Number]
        }]
    }
});

In the Posts.vue component I create a template and a script loading the data when mounted:
<template>

</template>

So the data should be shown as a ul list:

     title

     title

     title

A: Try the code below, I've made comments on the bits that need changing.
data() {
    return {
        posts: [] // this should be an array not null
    };
},

// you can do this on created instead of mounted
created() {
    axios.get('https://jsonplaceholder.typicode.com/posts')
        .then(response => {
            this.posts = response.data; // add data to the response
        });

A: ` Here "this.post" not take it has instance in axios call.So you have follow like this. `

var vm=this;
axios.get('https://jsonplaceholder.typicode.com/posts')
                .then(response => vm.posts = response.posts)
                .catch(error => vm.posts = [{title: 'No posts found.'}])
                .finally(console.log('Posts loading complete'));


text:
Q: How to read double integrator equations? From what I understand, double integrator is a model where some entity can move according to some speed, which depends on the acceleration force exerted on the entity.
If someone would ask me to represent such a model, with $x$ the position of the entity, $v$ its velocity, and $a$ its acceleration, I would write it down as simply :
$$ \dot{x} = v $$
$$ \ddot{x} = a $$
However these do not seem to be the same relations as given by the Wikipedia page (see https://en.wikipedia.org/wiki/Double_integrator). Maybe I'm having trouble with the notation. What do the following equations, meant to represent a double integrator system in a single dimension, mean exactly?
$$ \ddot{q} = u(t) $$
$$ y = q(t) $$
$u$ is described as the control input, which I assume is the acceleration, and $q$ the output, which is the entity's position? So, what is $y$? It seems to be equal to $q$, so what is its use here?

A: The wikipedia article is inconsistent in notation and in form.
Also, the article contains constraint equations between the degrees of freedom which further complicates the notation. You don't have such considerations for a 1 DOF problem.
So take your example, with $n=1$ DOF and consider the following quantities

*

*The generalized coordinates are vector of $n$ values
$$\boldsymbol{q} = \pmatrix{x} \tag{1}$$

*The differential equation is given in terms of the degrees of freedom as a system of $n$ equations
$$ \ddot{\boldsymbol{q}} = \boldsymbol{\rm f}(t, \boldsymbol{q}, \dot{\boldsymbol{q}}) \tag{2}$$
$$ \ddot{x} = {\rm f}(t,x,\dot{x}) $$

*As an ODE the above is of second order and it is setup as the integration of two variables (double integrator) in order to be solved. As a system of two first order ODEs the above is expressed with $2n$ equations.
$$ \tfrac{\rm d}{{\rm d}t}  \pmatrix{ \boldsymbol{q} \\ \boldsymbol{\dot{q}} } = \pmatrix{ \boldsymbol{\dot q} \\ \boldsymbol{\rm f}(t,\boldsymbol{q},\boldsymbol{\dot{q}})  } \tag{3}$$
$$ \tfrac{\rm d}{{\rm d}t} \pmatrix{x \\ v} = \pmatrix{v \\ {\rm f}(t,x,v)} $$

*More formally with a state vector $\boldsymbol{x} = \pmatrix{ \boldsymbol{q} \\ \boldsymbol{\dot q}}$ the above system of equations is brought into a more canonical form which is what the article should have shown
$$ \tfrac{\rm d}{{\rm d}t} \boldsymbol{x} = \boldsymbol{\rm u}(t, \boldsymbol{x}) \tag{4}$$
$$ \begin{aligned} \dot{x} & = v \\
    \dot{v} & = {\rm f}(t,x,v) \end{aligned}$$
Note that the state vector isn't a real vector in terms of physics, but rather a mathematical construct.

*The system can also describe constraints which tie together different degrees of freedom and their derivatives
$$ \boldsymbol{y} = \boldsymbol{\rm g}(t, \boldsymbol{x}) \tag{5} $$
but this does not apply in your case.

*All of the above become a little more formal when expressed in terms of linear algebra as a DAE system (differential and algebraic equations)
$$ \tfrac{\rm d}{{\rm d}t} \boldsymbol{x} = \mathbf{A} \boldsymbol{x} + \boldsymbol{b} \tag{6} $$
$$ \boldsymbol{0} = \mathbf{G} \boldsymbol{x} + \boldsymbol{c} \tag{7} $$


text:
Q: Mirrored traffic not reaching iptables logging I want to log traffic details for every packet using IPTABLES on mirrored traffic coming from a switch on my interface em4 with -j LOG option. I saw a similar scenario here.
em4 is in promisc mode.
I'm using the following commands but the rule is not getting hit and I cannot see logs in /var/log/messages
tunctl -u root
brctl addbr br0
brctl addif br0 em4
brctl addif br0 tap0
brctl setfd br0 0
brctl stp br0 off
ifconfig br0 up
ifconfig eth0 up 0.0.0.0
ifconfig tap0 up 0.0.0.0
echo 0 > /sys/class/net/br0/bridge/ageing_time
echo 1 > /sys/devices/virtual/net/br0/bridge/nf_call_iptables
iptables -F
iptables -A PREROUTING -t raw -j LOG


text:
Q: Why the CPU usage is higher when using OpenCV on C++ than on Python I am using Ubuntu 20.04.4, and I compiled OpenCV as release mode. Whenever I read frames, it consumes quite a lot of my CPU. I tested this in other machines as well. However, using a very similar script on python, it uses much less CPU. I found this question that seems to have a similar problem as mine. Although I am using the Release version.
Also, my python seems to be using the same OpenCV version as the one I compiled: 4.5.5.
Here is the C++ test code:
#include "opencv2/opencv.hpp"

int main(){
    cv::VideoCapture vo = cv::VideoCapture(2);
    //Set fourc for better performance.
    vo.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M','J','P','G'));
    vo.set(cv::CAP_PROP_FPS,30);
    //Setting buffersize to one will make vi.read() blocking until next frame is available.
    vo.set(cv::CAP_PROP_BUFFERSIZE,1);
    vo.set(cv::CAP_PROP_FRAME_WIDTH,1920);
    vo.set(cv::CAP_PROP_FRAME_HEIGHT,1080);
    cv::Mat frame;
    while (vo.isOpened())
    {
        vo.read(frame);
    }

}

And the python code:
import cv2

vo = cv2.VideoCapture(2)
vo.set(cv2.CAP_PROP_FPS,30)
vo.set(cv2.CAP_PROP_BUFFERSIZE,1)
vo.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
vo.set(cv2.CAP_PROP_FRAME_HEIGHT,1080)

while(vo.isOpened()):
    ret, frame = vo.read()

The python script consumes around 10% of my CPU while the C++ consumes around 30%. I work in an environment where CPU resource is critical. I'd like to know if there is any way to decrease this usage. Am I missing something?

A: Thanks for @ChristophRackwitz. Apparently, it was the fourcc configuration that was causing the high CPU usage. Using a resolution of 1920x1080 will cramp FPS to 5 using the default YUYV encoding. This is likely why I got lower CPU usage using python.

If I set the fourcc on python to MJPG the CPU usage spikes.


text:
Q: ArrowDB not returning correct session id in usersLogin API callback JIRA ticket AC-3349 opened. I'm posting the question here in order to help others who might be encountering the issue. Please follow the ticket if you have the same issue.
Details:
This issue has just started happening today (starting at 1.30PM EST or so) - things were working just fine before that.
If you use the ArrowDB Node SDK usersLogin to sign in as a non-admin user, the session id returned in the meta object is the session id of the admin user instead! One can confirm that by using the ArrowDB Node SDK usersShowMe and passing the session id, which returns the user object for the admin instead of the originally logged in user.
Something has clearly changed in the last hour or two because these APIs were working correctly prior to that. I have tried this with two different ArrowDB instances and the issue is the same on both. Hence the issue isn't with the specific ArrowDB instance but elsewhere in ArrowDB session management on the Appcelerator platform.

A: Apparently this happens only in the following scenario:
First, sign in as User A (say) and store the session id somewhere.
Next, in the Node.js code, create a new instance of ArrowDB and then set the sessionCookieString property using the previously stored session id.
Next, in the same code block, sign in as User B (say, which in my case was an admin account) using the usersLogin method. Once signed in, apparently the previously stored session id now "belongs to" User B, which I think is a bug. I'd assume that the usersLogin method would issue a new session id for the User B and leave the previously generated session id for User A alone. But that's not what happens. The previous session id for User A is reassigned to User B, which I believe is a bug in ArrowDB SDK.
As a workaround, one needs to create a new instance of ArrowDB if one wishes to sign in as a different user (typically admin account) AFTER one has already set the sessionCookieString for an existing instance otherwise the previous session id gets reassigned.


text:
Q: python win32api for Mac I have been trying to perform some advanced word document manipulation with python-docx, but I was advised to use Microsoft office API.
The problem is that I can't install win32api from pywin32 home page because I get the following error:
(IntellibookVenv) MacBook-Pro-de-Hugo:Intellibook hugovillalobos$ pip install pywin32
Collecting pywin32
  Could not find a version that satisfies the requirement pywin32 (from versions: )
No matching distribution found for pywin32

I don't know wether I get the error because there is not win32api version for Mac, or wether I am doing something wrongly.

A: pywin32 is:

Python extensions for Microsoft Windows Provides access to much of the
  Win32 API, the ability to create and use COM objects, and the
  Pythonwin environment.

which essentially means an interface for Python to access the native Windows API. Obviously this means to use it on Windows exclusively (I tried, doesn't event work under cygwin, so don't even think about Mac)


text:
Q: Window Size for RemoteWebDriver Chrome I'm trying to change window size for selenium RemoteWebDriver.
I execute:
driver.manage().window().maximize();

but it doesn't work when working with RemoteWebDriver and CHROME.
Does anybody know how to solve that?

A: Try this:
this.driver.findElement(By.tagName("body")).sendKeys(Keys.F11);


text:
Q: how to handle this array in ruby? There is an array like this:
    arr = [
        {id: 1, status: 3},
        {id: 2, status: 5},
        {id: 3, status: 5},
        {id: 4, status: 5},
        {id: 5, status: 5},
    ]

In this array, if status of any hash is 3, it will be change to be 2, and others will change to be 1. if each hash status is not 3, the array does not change.
I hope the output should be:
    arr = [
        {id: 1, status: 2},
        {id: 2, status: 1},
        {id: 3, status: 1},
        {id: 4, status: 1},
        {id: 5, status: 1},
    ]

if the array like this:
    arr = [
        {id: 1, status: 2},
        {id: 2, status: 5},
        {id: 3, status: 5},
        {id: 4, status: 5},
        {id: 5, status: 5},
    ]

each hash status is not 3, so the array doesn't change.
I can make it like this:
    tmp = false
    arr.each do |e|
        if e[:status].to_i == 3
           e[:status] = 2
           tmp = true
           break
        end
    end
    // note: if tmp == false, the array does not change
    if tmp == true
        arr.each do |e|
            e[:status] = 1  if e[:status].to_i == 5
        end
    end

But I think it is a bad idea, it will loop two times. Anyone has the better solution? Thanks in advance!

A: Most of the answers submitted only work correctly if the first array element is the status: 3.
You could do it in a single loop, if you construct a copy of the array as you go, and swap that for the original if you found a match
arr = [
        {id: 1, status: 3},
        {id: 2, status: 5},
        {id: 3, status: 5},
        {id: 4, status: 5},
        {id: 5, status: 5},
];

switch = false
new_arr = Array(arr.length)

arr.each_with_index do |e,i|
  if e[:status] == 3
    new_elem = { id: e[:id], status: 3 }
    switch = true
  else
    new_elem = { id: e[:id], status: 1 }
  end
  new_arr[i] = new_elem
end

arr = new_arr if switch

So you don't have to iterate the full array twice, but you construct an unused copy array if there is no status: 3.
I think you might want to consider using a different data structure - maybe a specific class that models the state changes you're using. Maybe look at some of the state machine gems.

A: arr.map do |e|
  new_status = if e[:status] == 3
                 2
               else
                 1
               end
  {id: e[:id], status: new_status}
end

A: I guess you can use a ternary:
arr.each{|element| element[:status] == 3 ? element[:status] = 2 : element[:status] = 1}

A: arr.map do |e|
   {id: e[:id], status: (e[:status]==3) ? 2 : 1}
end

A: Using find_all, twice again but bit cleaner.
arr.find_all {|e| e[:status] = 2 if e[:status] == 3  }
arr.find_all {|e| e[:status] = 1 if e[:status] == 5  }

A: There's no way to avoid two loops, since you must determine if arr[i][:status] => 3 for any index i before you know whether you need to change the values of arr[j][:status] (to 2 or 1) for all j. This is one way you could do that:
ndx = arr.index { |h| h[:status] == 3 } #=> 0
if ndx
  arr.each { |h| h[:status] = 1 }
  arr[ndx][:status] = 2
end
arr


text:
Q: PHP - Add form input into database I'm trying to add revived form input into database.
<form action="index.php" method="post">
<input type="text" name="firstname" id="firstname">

<input type="text" name="lastname" id="lastname">

<input type="submit" name="submit" value="Submit">

if(isset($_POST['submit'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];

$query = "INSERT INTO users (firstname, lastname) VALUES ($firstname, $lastname)";
if($conn->query($query) === true) {
    echo "added";
}else {
    echo $con->error;
}

Example : Firstname = Jason / Lastname = Haw
After clicking on submit button, i see error message : Unknown column 'Jason' in 'field list'
Where is the wrong thing to do?

A: $query = "INSERT INTO users (firstname, lastname) VALUES ('$firstname', '$lastname')";
put single quote for $firstname.
but this is not a proper approach, you should use prepared statement.
your query is risk of sql injection, because no escaping the input.


text:
Q: pandas: MultiIndex not showing when plotting DataFrame I am plotting the following pandas MultiIndex DataFrame:
print(log_returns_weekly.head())

           AAPL      MSFT      TSLA        FB     GOOGL
Date Date
2016 1    -0.079078  0.005278 -0.155689  0.093245  0.002512
     2    -0.001288 -0.072344  0.003811 -0.048291 -0.059711
     3     0.119746  0.082036  0.179948  0.064994  0.061744
     4    -0.150731 -0.102087  0.046722  0.030044 -0.074852
     5     0.069314  0.067842 -0.075598  0.010407  0.056264

with the first sub-index representing the year, and the second one the week from that specific year.
This is simply achieved via the pandas plot() method; however, as seen below, the x-axis will not be in a (year, week) format i.e. (2016, 1), (2016, 2) etc. Instead, it simply shows 'Date,Date' - does anyone therefore know how I can overcome this issue?
log_returns_weekly.plot(figsize(8,8))

A: You need to convert your multiindex to single one and add a day, so it would be like this: 2016-01-01.
log1 = log_returns_weekly.set_index(log_returns_weekly.index.map(lambda x: pd.datetime(*x,1)))
log1.plot()


text:
Q: DI and $app error in phalcon I use micro app Phalcon, I created a DI to my class named utility. When I get the shared utility through $app->utility an error occurred.
$di->setShared('utility',function(){
    return new utility();
});
$app->get("213",function(){});
$app->utility;

error:
Access to undefined property utility in ($app)
But if I change the code to
$di->setShared('utility',function(){
    return new utility();
});
$app->utility;
$app->get("213",function(){});

It works fine.
WHY?
PHP = 5.6.17
Phalcon = 2.7 or 2.8 or 2.9
windows 10 + nginx
THANKS!

A: $app is an instance of Macro.
    $app = Macro($di);
post $di as a param to Macro and it's work fine.