text:
Q: Entity Framework Conditional Left Join and Custom Column Select I have a stored procedure which results in lots of data. and also want to convert this to EF
unable to figure out how to join to the relavent tables when an attribute is present for the system. and also the column selection is very dynamic in nature,
I could take this sql and execute this directly and get things sorted that way but would miss but the grid in the front end wont be able to handle 600mb of data thrown from the database.
so need paging thought can do this better with EF.
for reference purpose I have the following sql below.
    Declare @SQL varchar(max);
Declare @SelectColumns VARCHAR(MAX)

SELECT DISTINCT @SelectColumns= STUFF((SELECT  ',''' + [PrimaryDataSource] + ''' Golden'
                     + ISNULL(CASE WHEN System1     IS NOT NULL THEN ', System1.'   + QUOTENAME([System1]) + ' System1'     END, '')
                     + ISNULL(CASE WHEN System2 IS NOT NULL THEN ', System2.'   + QUOTENAME([System2]) + ' System2' END, '')
                     + ISNULL(CASE WHEN [System3]   IS NOT NULL THEN ', System3.'   + QUOTENAME([System3])+ ' System3'      END, '')
                     + ISNULL(CASE WHEN System4 IS NOT NULL THEN ', System4.' + QUOTENAME(System4)+ ' System4'    END, '')
                     + ISNULL(CASE WHEN System5     IS NOT NULL THEN ', System5.'   + QUOTENAME(System5)+ ' System5'        END, '')
                     + ISNULL(CASE WHEN System6     IS NOT NULL THEN ', System6.'   + QUOTENAME(System6)+ ' System6'        END, '')
                     FROM [dbo].[TBL_Mapping]
where Attribute =@attributeName
            FOR XML PATH(''), TYPE
            ).value('.', 'VARCHAR(MAX)')
        ,1,1,'')

SET     @SQL = '
        SELECT distinct
                m.ID MappingID,
                m.KeyValueUniqueKey,
                m.ValueKeyUniqueKey,
        ' + @SelectColumns + '
        FROM [dbo].[TBL_Mapping] M '
IF CHARINDEX('System1.',@SelectColumns) > 0
BEGIN

SET @SQL =  @SQL +
            '
                LEFT OUTER JOIN dbo.VW_System1_ALL System1 ON
                    System1.System1ID=M.System1ID '
END
IF CHARINDEX('System2.',@SelectColumns) > 0
BEGIN
        SET @SQL =  @SQL +
            '
                LEFT OUTER JOIN dbo.TBL_System2 System2 ON
                M.System2ID= System2.System2ID '
END
IF CHARINDEX('System4.',@SelectColumns) > 0
BEGIN
        SET @SQL =  @SQL + '
                LEFT OUTER JOIN DBO.tbl_System4 System4 ON
                    System4.Key1 = M.KeyValueUniqueKey  AND
                    System4.Value1 = ValueKeyUniqueKey '
END
IF CHARINDEX('System5.',@SelectColumns) > 0
BEGIN
        SET @SQL =  @SQL + '
                LEFT OUTER JOIN DBO.tbl_System5 System5 ON
                    System5.System5Id = M.System5Id'
END

IF CHARINDEX('System6.',@SelectColumns) > 0
BEGIN
        SET @SQL =  @SQL + '
                LEFT OUTER JOIN dbo.tbl_system6 System6 ON
                    System6.System6Id = M.System6Id'
END

IF CHARINDEX('System3.',@SelectColumns) > 0
BEGIN
        SET @SQL =  @SQL + '
                LEFT OUTER JOIN [dbo].[TBL_System3] System3 ON
                    System3.System3Id = M.System3Id'
END

    SET @SQL =  @SQL + '
        WHERE m.version=0 and isActive=1
        ORDER by m.ID'

    print @SQL
    exec (@SQL)

I have looked at the Leftjoin2 extn method but that is not helping much.
What is the best possible action to get this on to EF.
or EF itself is a wrong choise for this sort of problems?

A: This is a bad fit for EF. If all you are only trying to add paging -- add your own paging functionality to the stored proc. You can do this by using ROW_NUMBER OVER what every you are sorting by, then use an an outer query to return the page of data you want, for example...
CREATE PROCEDURE [dbo].[PagedSomething]
    @pageSize int,
    @pageNum int  -- assume pages are 0-based
AS

BEGIN
    -- outer query does the paging in its where clause,
    -- returning the selected "pages" from the raw results of the inner query
    SELECT RawResults.SomethingId
    FROM
        -- inner query where you make your basic data
        (SELECT
            s.SomethingId
           , ROW_NUMBER() OVER(ORDER BY s.SomethingId) RowID
            FROM Somethings s) RawResults
     WHERE RowID >= @pageNum * @pageSize + 1
     AND RowID < (@pageNum + 1) * @pageSize + 1

END

A: You can do dynamic query generating and then in the end do Skip().Take().
Your model for custom object may look like this:
class MappingData
{
  //not sure what the data types are.
  int MappingId;
  int KeyValueUniqueKey;
  int ValueKeyUniqueKey;
  string System1;
  string System2;
  ...
  string System6;
}

Then in the get method map data,
IQueryable<MappingData> sql = db.TBL_Mapping
                              .Select(m => new MappingData {
                                                 MappingId = ID,
                                                 KeyValueUniqueKey = KeyValueUniqueKey,
                                                 ValueKeyUniqueKey = ValueKeyUniqueKey,
                                                 //leave other columns out
                                                 //they will be filled in
                                                 //dynamically
                                     })
                              .Distinct();//get distinct
//--------------------
//REPEAT START
bool HasSystem1 = db.TBL_Mapping.Any(m => m.System1 != null);

//left outer join with System1 if it has it in the TBL_Mapping
if (HasSystem1)
{
    sql =
         from m in sql
         join s1 in db.VW_System1_ALL
         on m.System1ID equals s1.System1ID into stemp
         from st in stemp.DefaultIfEmpty()
         select new { MappingId = st.Id,
                      KeyValueUniqueKey = st.KeyValueUniqueKey,
                      ValueKeyUniqueKey = st.ValueKeyUniqueKey,
                      System1 = st.System1 }; //SystemX column.
}
//REPEAT END
//--------------------

// repeat the above for System2 thru System6

//And in the end do paging.
var result = sql
                .Skip(currentPageNumber * numberOfObjectsInPage)
                .Take(numberOfObjectsInPage);


text:
Q: UWP IsNullOrEmptyStateTrigger not working for ListView The XAML below is for a UWP app uses a VisualStateManager with an IsNullOrEmptyStateTrigger from the Microsoft.Toolkit.Uwp.UI package. The trigger is supposed to disable the button when no items are selected from the ListView. However, the button always remains enabled.
The ListView's SelectedItem should be null when nothing in the list is selected (nothing is selected when you first run the app). Any ideas?
My code is loosely based on this example.
<Page
    x:Class="UwpTriggerDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:UwpTriggerDemo"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:triggers="using:Microsoft.Toolkit.Uwp.UI.Triggers"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <StackPanel>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ListViewStates">
                <VisualState x:Name="ListSomethingSelectedState" />
                <VisualState x:Name="ListNothingSelectedState">
                    <VisualState.StateTriggers>
                        <triggers:IsNullOrEmptyStateTrigger Value="{Binding SelectedItem,
                            ElementName=myListView, Mode=OneWay}"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="myButton.IsEnabled" Value="False" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>

        </VisualStateManager.VisualStateGroups>

        <ListView x:Name="myListView">
            <TextBlock Text="Item 1" />
            <TextBlock Text="Item 2" />
            <TextBlock Text="Item 3" />
        </ListView>
        <Button x:Name="myButton" Content="Click Me" />
    </StackPanel>
</Page>

A:
UWP IsNullOrEmptyStateTrigger not working for ListView

We could reproduce your problem, please feel free post this problem in WindowsCommunityToolkit issue box. And currently the is a workaround that control myButton's status manually. Make IsEnable property in code behind and bind it to myButton. And update IsEnable value in the SelectItem set method. For more please refer to the following code.
private bool _isEnable;
public bool IsEnable
{
    get
    {
        return _isEnable;
    }
    set
    {
        _isEnable = value;
        OnPropertyChanged();
    }
}
private string _selectItem;
public string SelectItem
{
    get
    {
        return _selectItem;
    }
    set
    {
        _selectItem = value;
        if(_selectItem == null)
        {
            IsEnable = false;
        }
        else
        {
            IsEnable = true;
        }
        OnPropertyChanged();
    }
}

Xaml
<ListView
    x:Name="myListView"
    IsItemClickEnabled="True"
    SelectedItem="{Binding SelectItem, Mode=TwoWay}">
    <x:String>Hello</x:String>
    <x:String>Hello</x:String>
    <x:String>Hello</x:String>
    <x:String>Hello</x:String>
</ListView>
<Button
    x:Name="myButton"
    Content="Click Me"
    IsEnabled="{Binding IsEnable}" />

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the significance of the Ravager Flames? In Guardians of the Galaxy, Vol. 2, a flame symbolizes the ravagers.   You may recall that.

 Yondu gives a metal flame emblem to Groot and asks Groot to match it to the metal emblem on one of his drawers.

Here is a picture of it:
.

The flame symbol seems to be their emblem. What is its history? And what is its significance?

A: That flame insignia comes from the costume of Star-Lord in the comics, dating back to the character's original appearance.

It later became a more prominent part of his outfit during the Annihilation event, when the character was revitalized.

Presumably, then, when designing the costumes for the movie and creating the backstory for the movie versions of the characters, it was decided to use the insignia as the Ravagers' own.
As for any in-universe history of the insignia... I dunno.

A: It would seem that this badge was created to represent the Marvel Cinematic Universe's (Earth-199999) Ravagers.
As such, we will have no clue of the badge's significance until MCU's directors sheds some light onto it. Before the release of GotG Vol. 2, director James Gunn posts this.
Also, here is an interview with GotG's costume designer:

Q: Yondu has a similarly cool look, which seemed to me like part biker, part bounty hunter. How did you devise his look, as well as his gang's?
A: I wanted the Ravagers to have a distinct look—a coat type silhouette and a through line of color. But within that I also wanted them to be individuals with personalized looks. Yondu is the leader, the top dog, and a collector. Within all the Ravagers there are five generations of the ravager garb/uniform—all personalized, adapted and repaired. When the Guardians dress for the final battle they are wearing the latest Ravager garb.


text:
Q: Jest returns "Network Error" when doing an authenticated request with axios This seems a bit weird to me. I'm trying to test an actual (ie. real network) request with Jest.
These are the tested scenarios:

*

*Test an external API (fixer.io) with no headers   <--- This works

*Test a local API server with headers   <--- This does NOT work

*Test same local API with headers from node terminal  <--- This works
What could be the reason behind this behavior? And what is the solution?
//This WORKS
test('testing no headers', () => {
  return axios.get('http://api.fixer.io/latest')
        .then( res => console.log(res) )
});

//This DOES NOT work
test('testing no headers', () => {
  return axios.get('http://localhost:3000/users/4/profile',
                      {headers:{authorization:`Bearer ${mytoken}`}})
        .then( res => console.log(res) )
});

//...

//Node Terminal
//This WORKS
> axios.get('http://localhost:3000/users/4/profile',
                   {headers:{authorization:`Bearer ${mytoken}`}})
        .then( res => console.log(res) )

A: It can be a Jest configuration issue. I solved forcing "node" as jest environment in package.json:
"jest": {
    "testEnvironment": "node"
  }
see docs: https://facebook.github.io/jest/docs/configuration.html#testenvironment-string

A: That is funny,that the axios used XMLHttpRequest by primary,and ajax request can't access across domain,so your test failed ,so you can let your code pass by set the axios adapter.
The Reason by axios/defaults.js
 function getDefaultAdapter() {
    var adapter;
    if (typeof XMLHttpRequest !== 'undefined') {
        // For browsers use XHR adapter
        adapter = require('./adapters/xhr');
    } else if (typeof process !== 'undefined') {
        // For node use HTTP adapter
        adapter = require('./adapters/http');
    }
    return adapter;
 }

Solution change axios adapter to http
import axios from 'axios';
//This WORKS
test('testing with headers', (done) => {
    var path=require('path');
    var lib=path.join(path.dirname(require.resolve('axios')),'lib/adapters/http');
    var http=require(lib);
    axios.get('http://192.168.1.253', {
        adapter: http,
        headers: {
            Authorization: "Basic YWRtaW46bHVveGlueGlhbjkx"
        }
    }).then((res) => {
        expect(res.status).toBe(200);
        done();
    }).catch(done.fail);
});

Solution change jest testURL in package.json
"jest": {
   "testURL":"http://192.168.1.253"
}

then the test can be access http via ajax
import axios from 'axios';
    //This WORKS
    test('testing with headers', (done) => {
        axios.get('http://192.168.1.253', {
            headers: {
                Authorization: "Basic YWRtaW46bHVveGlueGlhbjkx"
            }
        }).then((res) => {
            expect(res.status).toBe(200);
            done();
        }).catch(done.fail);
    });

A: Jest allows you to set a setup script file.  This file will be required before everything else and gives you a chance to modify the environment in which the tests will run.  This way you can unset XMLHttpRequest before axios is loaded and the adapter type evaluated since imports are hoisted. https://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string
This worked for me:
package.json
{
  ...,
  "jest": {
    ...,
    "setupTestFrameworkScriptFile": "./__tests__/setup.js",
    ...
  },
  ...
}

__tests__/setup.js
global.XMLHttpRequest = undefined;

A: I resolved it by adding
axios.defaults.adapter = require('axios/lib/adapters/http');

for a specific test case file, as setting global.XMLHttpRequest = undefined or env=node was causing my other test cases to fail.

A: I work on Next.js projects where I have both frontend and backend tests and setting testEnvironment to 'node' does not work.
So I configure jest.config.js as
testEnvironment: 'jest-environment-jsdom',

and add
/**
 * @jest-environment node
 */

to all backend tests.


text:
Q: Insert NULL DateTime with SQL Server stored procedure from C# I have written a SQL Server stored procedure that includes a DateTime parameter. This parameter could be null or contain a valid date value.
So the definition of my variable in my procedure is below:
@piPurchase_Date DATETIME = NULL

From C# I add the parameter as follows:
SqlParameter parameter = new SqlParameter("@piPurchase_Date", SqlDbType.DateTime);
parameter.Value=datePurchaseIssueDate.Checked ? datePurchaseIssueDate.Value : SqlDateTime.Null;

So far all seems OK but when I call the Update method on the DataAdaptor I receive the following error:

Failed to convert parameter value from a SqlDateTime to a DateTime.

Any ideas?
I'm using SQL Server 2008 and C#4.0
Thanks in advance

A: Yes - use DBNull.Value in C#:
SqlParameter parameter = new SqlParameter("@piPurchase_Date", SqlDbType.DateTime);
parameter.Value = datePurchaseIssueDate.Checked ? datePurchaseIssueDate.Value : DBNull.Value;

to pass a NULL to a SQL Server stored procedure


text:
Q: getting error on including apex:inputfile in visualforce i am getting error

apex:inputFile can not be used in conjunction with an action
  component, apex:commandButton or apex:commandLink that specifies a
  rerender or oncomplete attribute.

but i cant skip using rerender or oncomplete.
how can i solve this.
<apex:actionRegion >
  <apex:outputPanel id="Panel">
    <apex:repeat value="{!wrapperValues}" var="w">
      <apex:inputfile value="{!w.document}"/>
    </apex:repeat>
  </apex:outputPanel>
  <apex:commandbutton style="width: 170px;" value="Add another" action="{!addAnother}" reRender="Panel" />
</apex:actionRegion>

A: As the error indicates, you simply can't do this.  I'd imagine its a security feature, as the inputFile is allowing uploading of a file from the user's computer.  You could use an iframe to contain the input file component, which means that other frames would be unaffected, but from the technical point of view it has to be a full refresh of the containing page.

A: You can put the inputfile component in a separate page and include the new page in your original page with an  component.


text:
Q: On Android, app jumps back to default Page on orientation change I tested my Xamarin.Forms app on iOS and Android and found this difference when I change the orientation of the mobile device:

*

*On iOS, the app keeps the current page

*On Android, the app seems to restart using the default page (or probably pop all pages except the first one).

Since I've never seen this behavior in another Android app, I'd like to disable it. Moreover, I don't think that this behavior is Android default.
Which property do I need to set the make the Android target behave as the iOS target?

A: Did you checked ActivityAttribute of your MainActivity? it should specify ConfigChanges.Orientation.
something like this
using Android.Content.PM;

[Activity(Label = "%Your app name%", MainLauncher = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]

If ConfigChanges.Orientation is not set OS will recreate Activity on orientation change. And if it set, it indicates that you will manage orientation changing for yourself.


text:
Q: Convert std::vector to std::string_view I have some data of type std::vector<uint8_t>. I would like to interpret it as a string and do some sub-string check on it.
It can be done by converting it to std::string which will cause copying the data. Is it possible to somehow convert it to std::string_view and do search on it to avoid copying it.

A: Provided that char is 8 bits on your system (most systems are), you can simply reinterpret_cast the vector's data to char* and make a view from that, eg:
std::vector<uint8_t> data;
...
std::string_view sv(reinterpret_cast<char*>(data.data()), data.size());


text:
Q: SSL Certificates - OS X Mavericks I am trying to connect to application on localhost which uses SSL. I am using Mac OS X Mavericks. The error I am getting is following:
Error sending cURL get request to https://dev.site.com:5555/version
Error code: 60 Error msg: SSL certificate problem: Invalid certificate chain

I tried to add certificates to the chain:
/usr/bin/security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" /etc/path/ca_key.pem

Still getting the same error.

A: --cacert and --cert are broken in OSX Mavericks.
You can read more about it here: https://groups.google.com/forum/#!topic/munki-dev/oX2xUnoQEi4
The workaround is here: http://curl.haxx.se/mail/archive-2013-10/0036.html which indicates that you need to import the certificate as a trusted system cert:

Import the certificate into the system ("System") or user ("login") keychain using Keychain Access and mark it as always trusted for SSL and X.509 basic policy.

A: There are two things you can do:
(1) Convert the .pem certificate to .p12:
openssl pkcs12 -export -out my_certificate.p12 -inkey my_certificate.pem -in my_certificate.pem`

and use it with curl with the PASSWORD you pick when converting:
curl --cert my_certificate.p12:PASSWORD.

(2) Drag the .pem file into your keychain, open the infopane, set it to 'always trust' for SSL and X.509, and note the COMMON-NAME. (name of certificate)
curl --cert COMMON-NAME

Both work for me on OSX 10.9 with cURL 7.35.0

A: In some cases will be better to use standard curl (eg if you develop on Mac code for Linux or *BSD). In this case you can do like that:

*

*Install Homebrew

*Install curl with standard certificates support (no more Keychain certs).
brew install curl --with-openssl && brew link curl --force

*Install root CA certs from http://curl.haxx.se/ca/cacert.pem into /usr/local/etc/openssl/certs/cacert.pem

*Add into your ~/.bash_profile
export CURL_CA_BUNDLE=/usr/local/etc/openssl/certs/cacert.pem

*After 4 steps you can use curl with certificates from file, not from Keychain.

A: The option --with-openssl no longer works as of
https://github.com/Homebrew/homebrew-core/pull/36263
Just install curl-openssl instead of curl.
$ brew install curl-openssl

$ /usr/local/opt/curl-openssl/bin/curl --version
curl 7.64.1 (x86_64-apple-darwin18.2.0) libcurl/7.64.1 OpenSSL/1.0.2r zlib/1.2.11 brotli/1.0.7 c-ares/1.15.0 libssh2/1.8.2 nghttp2/1.38.0 librtmp/2.3
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets


text:
Q: changing background of internet site with javascript file So, i wanna make button on my site(html). With clicking button u could change the background of the site. I wanna make function of that in *.js file. Any suggestions or ideas how to do it are welcome.

A: HTML
<input type="button" onclick="changeBackground()" value="Change Backgorund" />

JS
function changeBackground(){
$("body").css("background","url('pathtoimage')");
}


text:
Q: how to find if a string contains two dot in regular expression in php I want to know if the string contains two .. for example if the string contains www.example.com, returns true ,because it has 2 ., otherwise has less than 1 . return false.
function containsTwoDot($array,$keyword){
   $matches = array_filter($array, function($var) use ($keyword) { return preg_match("/\b".$keyword."\b/i".$keyword, $var); });
   if($matches)
        return true;
   return FALSE;
}

$true[0]='www.sll.dl';
$false[0]='ldfjls.dlfjdflldl';

A: You can use php function substr_count() -
<?php
$text = 'www.example.com';
echo substr_count($text, '.'); // 2
?>

of course it doesn't return true or false .That you can manage.

A: Use preg_match and escape dots cause it's special chars:
$string = 'www.example.com';

preg_match('/\..*\./',$string);


text:
Q: How to remove some parts of a string? I have to remove some parts of a string like this:
customers/00000000-0000-0000-0000-000000000111/areas/00000000-0000-0000-0000-000000000222/orders/00000000-0000-0000-0000-000000000555/invoices/00000000-0000-0000-0000-000000000777/employees/00000000-0000-0000-0000-000000000213.gz

To get the path without the uuids but with the file extension. It should look like
customers/areas/orders/invoices/employees/.gz
How can I do this? With Matcher or substring? Which is best option? Is there any custom regex that I can use to remove UUIDs from the string?

A: You can replace the string using the following Regex:
(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}

A: Assuming that UUID in your case are only numbers with minus You can use a regular expression like the following
[0-9][-0-9]*[0-9][\/]?

to replace strings like
00000000-0000-0000-0000-000000000111/
00000000-0000-0000-0000-000000000222/
00000000-0000-0000-0000-000000000555/
00000000-0000-0000-0000-000000000213
...

with an empty string as in the following code:
String path = ...;
// Note the additional \ in the following string,
// this is necessary because we are using a string to represent the regexp
System.out.println(path.replaceAll("[0-9][-0-9]*[0-9][\\/]?", ""));

that prints
customers/areas/orders/invoices/employees/.gz

A: You could give a try FilenameUtils.getExtension from Apache Commons IO
(you may specify either full path or just file name):
String ext1 = FilenameUtils.getExtension("customers/00000000-0000-0000-0000-000000000111/areas/00000000-0000-0000-0000-000000000222/orders/00000000-0000-0000-0000-000000000555/invoices/00000000-0000-0000-0000-000000000777/employees/00000000-0000-0000-0000-000000000213.gz"); // returns "gz"
String ext2 = FilenameUtils.getExtension("002345620000000213.txt"); // returns "txt"


text:
Q: Type-checking does not constrain type with generic extends A minimal reproduction:
export declare type ExcludeFunctions<T, K extends keyof T> = T[K] extends Function ? never : (K extends symbol ? never : K);

const myAppId: ExcludeFunctions<{ appId: string }, "appId"> = "appId";

class BaseResource {
    appId: string
    constructor(appId: string) {
        this.appId = appId
    }
}

const myAppId2: ExcludeFunctions<BaseResource, "appId"> = "appId";

class MyBaseResourceThing<U extends BaseResource> {
    method() {
        // errors out
        const myAppId3: ExcludeFunctions<U, "appId"> = "appId";
        console.log(myAppId3)
    }
}

Error:
Type '"appId"' is not assignable to type 'ExcludeFunctions<U, "appId">'.(2322)

Why does myAppId3 not compile? U extends BaseResource so the type should be constrained.

A: Generally speaking, the compiler is unable to say much about a type which depends on an as-yet unspecified generic type parameter.  Inside the implementation of method(), the type parameter U is unspecified (it is constrained to BaseResource, but it could be any subtype of BaseResource).  The type ExcludeFunctions<U, "appId"> is therefore a conditional type that depends on an unspecified generic type parameter.  And the compiler essentially defers evaluation of such types.  Meaning that the compiler cannot verify if any specific type is assignable to it, and so it complains.
There are a bunch of issues in GitHub where this is the underlying situation, see ms/TS#43846 or ms/TS#28884 or ms/TS#33912, etc.
So, even if you could perform some analysis on ExcludeFunctions<U, "appId"> and conclude that "appId" must be assignable to it, the compiler wouldn't be able to see it and you'd need to use something like a type assertion to work around it:
class MyBaseResourceThing<U extends BaseResource> {
    method(): ExcludeFunctions<U, "appId"> {
        const myAppId3 = "appId" as ExcludeFunctions<U, "appId">;
        return myAppId3;
    }
}

In order to do this kind of analysis better, the compiler would either need to waste a lot of time evaluating types that do not turn out to be reducible in any way, or it would have to have some very good heuristics to know when to try... and the compiler is unfortunately not yet as intelligent as a human being.  Note that even human beings aren't necessarily the best at this type of higher order analysis.  Case in point, the type "appId" is actually not guaranteed to be assignable to ExcludeFunctions<U, "appId"> in your example, because U can have a more specific type for the appId property than just string.  It can be, for example, the never type.  Or something like this:
declare class Foo extends BaseResource {
    appId: string & { (): void }; // not really possible at runtime but a valid TS type
}
const a = new MyBaseResourceThing<Foo>().method() // a is of type never,
// but "appId" is not assignable to never

Here U has been specified with Foo, whose appId property is both a string and a function (basically never but not statically reduced to that by the compiler), and so ExcludeFunctions<U, "appId"> is never, and you can't assign "appId" to it safely.
So in this specific case the compiler is technically correct to warn you.  Of course pragmatically speaking you're not going to see string-function-monsters in your code.  That means you should probably just use a type assertion as shown above and move on.
Playground link to code


text:
Q: MySQL store playlist for different timezones I need to create a playlist in database, to know when each video will be played by a player.
I will use something like this:
table playlist with: id, video_id, play_time and for example if play_time is 2012-04-10 14:00:00 the video should be played at 14:00:00 on 2012-04-10 but related to timezone where user is located.
What it's better to use for this datetime or timestamp?

A: From the MySQL manual:

MySQL converts TIMESTAMP values from the current time zone to UTC for
  storage, and back from UTC to the current time zone for retrieval.
  (This does not occur for other types such as DATETIME.) By default,
  the current time zone for each connection is the server's time. The
  time zone can be set on a per-connection basis. As long as the time
  zone setting remains constant, you get back the same value you store.
  If you store a TIMESTAMP value, and then change the time zone and
  retrieve the value, the retrieved value is different from the value
  you stored. This occurs because the same time zone was not used for
  conversion in both directions. The current time zone is available as
  the value of the time_zone system variable. For more information, see
  Section 9.6, "MySQL Server Time Zone Support".

So the answer is: timestamp


text:
Q: Double integral involving incomplete Gamma function I want to solve an integral of the type:
$\int_c^d \frac{1}{x^s} \int_{x}^{\infty} t^{r-1} e^{-t} dt dx = \int_c^d \frac{1}{x^s} \Gamma(r, x) dx$
So, the inner integral is an incomplete Gamma function.
How do I best solve this?
I tried to integrate the inner integral first, but I don't know, what is the integral of the incomplete Gamma function? Is there a closed form solution?
Is it better to use integrations by parts on the whole integral with $v'(x) = \frac{1}{x^s}$ and $u(x) = \int_{x}^{\infty} t^{r-1} e^{-t} dt$ ? In this case I'm a little struggling because I'm not sure about how to apply the fundamental theorem to the integral with the variable lower limit.
My calculus skills are pretty rusty at the moment ;)
Thanks for the help!
Edit:
Solution using integration by parts:
\begin{align}
\int_c^d \frac{1}{x^s} \int_{x}^{\infty} t^{r-1} e^{-t} dt dx &= \int_c^d \frac{1}{x^s} \Gamma(r, x) dx \\
& = \frac{x^{1-s}}{1-s} \Gamma(r,x) \Big|_c^d - \int_c^d \frac{x^{1-s}}{1-s} (-exp(-x)) x^{r-1} dx \\
& = \frac{x^{1-s}}{1-s} \Gamma(r,x) \Big|_c^d + \frac{1}{1-s} \int_c^d x^{r-s} exp(-x)dx \\
& =  \frac{b^{1-s}}{1-s} \Gamma(r,b) -  \frac{a^{1-s}}{1-s} \Gamma(r,a) + \frac{1}{1-s}\left(\Gamma(r-s+1, a) - \Gamma(r-s+1, b)\right) \end{align}

A: Integration by parts just gives:
$$ \int \frac{\Gamma(r,x)}{x^s}\,dx = \frac{x^{1-s}}{1-s}\,\Gamma(r,x)-\frac{1}{1-s}\,\Gamma(r-s+1,x).$$


text:
Q: Why are the coordinates of a MouseDown event different from a MenuDetect event? Background: I am trying to programmatically create a context menu on an SWT Table. I am doing it programmatically because I need to hide/show the menu based on the cell that was clicked, not the row item.
I was planning to use the x,y coordinates from the Event class to find the cell that was clicked on, so I am capturing both the untyped MouseDown event and the untyped MenuDetect event. I put logging messages into the event handlers so I could better see what was going on. Here's my code:
    tree.addListener(SWT.MouseDown, new Listener() {
        @Override
        public void handleEvent(final Event event) {
            System.out.println("Mouse down: (" + event.x + ", " + event.y + ")");
            handleMouseDown(event);

        }
    });
    tree.addListener(SWT.MenuDetect, new Listener() {
        @Override
        public void handleEvent(final Event event) {
            System.out.println("Menu Detect: (" + event.x + ", " + event.y + ")");
            handleMenuDetect(event);

        }

    });

With the same click, I expected to see the same results, however, my output was as follows when I clicked down a column of cells:

Mouse down: (334, 11) Menu Detect: (1270, 255)
Mouse down: (331, 37) Menu Detect: (1267, 281)
Mouse down: (329, 55) Menu Detect: (1265, 299)
Mouse down: (324, 77) Menu Detect: (1260, 321)
Mouse down: (324, 100) Menu Detect: (1260, 344)

What is going on here? Aren't they referring to the same exact point? Are they calculating the x,y from different origins?

A:
Are they calculating the x,y from different origins?

Yes, they do.
The SWT.MenuDetect event position is the mouse position based on the whole screen, whereas the SWT.MouseDown event position is based on its composite.
That means that one tells you where on the screen the event occurred, whereas the other tells you where in the widget it occurred.
To make them use the same coordinate system (the widget's system), call Control#toControl(int, int) to map it.
tree.addListener(SWT.MouseDown, (e) -> {
    System.out.println(new Point(e.x, e.y));
});
tree.addListener(SWT.MenuDetect, (e) -> {
    System.out.println(tree.toControl(e.x, e.y));
});

Control#toDisplay(int, int) will do the opposite.

For reference:
MouseEvent Javadoc:

public int x
the widget-relative, x coordinate of the pointer at the time the mouse button was pressed or released

MenuDetectEvent Javadoc:

public int x
The display-relative x coordinate of the pointer at the time the context menu trigger occurred.


text:
Q: CSS Hover image I have an image which has and inner border with opacity set to .7 and round corners, which works great. The only problem is i need to add a hover state to image. I have tried :hover but nothing seems to work.
The border needs to go blue and with a png overlay.
HTML:

CSS:
.box{
    width:191px;
    background:#FCFBDF;
    margin: 0 auto;
}

img{
     width:191px;
     height:191px;
     display:block;
     border-radius:50%;

}
.imgWrap{
    position:relative;

}
.imgWrap:after{
    content:"";
    position:absolute;
    top:0; bottom:0; left:0; right:0;
    opacity:0.5;
    border: 10px solid rgba(248, 248, 255, 0.7);
    border-radius:50%;
}

JS Fiddle here
http://jsfiddle.net/zangief007/52fFF/3/

A: I am guessing you tried to fire the hover state on the image like this :
img:hover{
    .. your code ...
}

But as there is a pseudo element over it, you can never hover the image.
The workaround is to trigger the hover state on the pseudo element like this :
.imgWrap:hover:after{
    border-color:blue;
    background: url('PATH TO YOUR IMAGE');
}

DEMO

A: Add hover like this.
.imgWrap:hover{
    width:250px;
}

PS : I am just adjusting the width based on hover. But you could do whatever you like in the hover.
Hope this helps.
Cheers!

A: EDIT : Assuming you don't need to modify the image with the cat, web-tiki's solutions seems better.
I think you may have to use some Javascript/Jquery, as long as you can't directly trigger a mouse hover on the image (because there is some element  above).
Here is an example.
$(".imgWrap").hover(function(){
    $('img').toggleClass("imgHover");
    $('.imgWrap').toggleClass("imgHover");
    $('.box').toggleClass("imgHover");
});

.imgHover{
    width:300px;
    height:300px;
}

try this in your JSFiddle. don't forget to add Jquery lib
http://jsfiddle.net/52fFF/11/
As example i just changed the size of the Box, the Circle and the image.


text:
Q: SQL Server: Want to use between clause with dates, but dates in string form (YYYY.MM.DD) Help!  One column in my database is for dates.  All of my dates are unfortunately in the String form (YYYY.MM.DD).  I have a MASSIVE database (300+GB) so ideally would like to avoid transformations.
Is there a way I can select rows for dates in between YYYY.MM.DD and YYYY.MM.DD?  What would the script look like?
Thank you!

A: If the months and days are stored with leading zeroes, the BETWEEN operator will work as expected.  So will ORDER BY.
create table your_table (
  date_value varchar(10) not null
);

insert into your_table values
('2013.01.01'), ('2013.01.13'), ('2013.01.30'), ('2013.01.31'),
('2013.02.01'), ('2013.02.13'), ('2013.02.28'), ('2013.02.31'),
('2013.03.01'), ('2013.03.15'), ('2013.03.30'), ('2013.03.31');

select date_value
from your_table
where date_value between '2013.01.01' and '2013-01-31'
order by date_value;

2013.01.01
2013.01.13
2013.01.30

One of the main problems with your structure is that you lose type safety. Look at this query.
select date_value
from your_table
where date_value between '2013.02.01' and '2013.02.31'
order by date_value;

2013.02.01
2013.02.13
2013.02.28
2013.02.31

If you'd used a column of type date or datetime or timestamp, the dbms would not have allowed inserting the values '2013.02.31', because that's not a value in the domain of date.  It is a value in the domain of varchar. (And so is "Arrrrgh!", unless you've got a CHECK constraint on that column that severely restricts the acceptable values.)

A: Not good solution, but works (cost much performance).
You have formated date in order year, month, day (good order to compare strings, without transformation to datetime), so you can try
SELECT * FROM Table WHERE StringDate > '2013.07.10' AND StringDate < '2013.07.14'

It returns bad results if there are dates before year 1000 without leading zero ('999.07.14').
But I dont know how it works on big database.
SQL Fiddle

A: Between in SQL is inclusive of both bounds.  If that is what you want, you can just use between:
where col between 'YYYY.MM.DD' and 'YYYY.MM.DD'

Where the two constants are whatever values you are looking for.
If you have an index on the column, then between (as well as >, >=, and so on) will use the index.  You do not need to transform the values.  If your constants are dates of one form or another, then you can use date_format() to create a string in the right format.  For instance, to get dates within the past week:
where col >= date_format(adddate(now(), -7), '%Y.%m.%d')


text:
Q: Reference request: Local Euler characteristic I'm learning p-adic Galois representation, here is the background:
Let $K$ be a p-adic field, and $G_K$ is the absolute Galois group of $K$. Let $V$ be a finite-dimensional p-adic representation of $G_K$. I want to learn the local Euler characteristic about representations. That's something like
$$\chi(V)=dim_{\mathbb Q_p}H^0_{cont}(G_K,V)-dim_{\mathbb Q_p} H^1_{cont}(G_K,V)+dim _{\mathbb Q_p}H^2_{cont}(G_K,V)$$
Which may have properties like $\chi(V)$ only depends on the dimension of $V$.
Could you provide some references?


text: Q: Is it possible to get all the information like note and velocity from a manually recorded audio but converted into midi format? As we can obtain all the information conveniently from a midi file, is it possible to obtain these info from recorded audio which was not originally midi but is converted to midi ?


text:
Q: How to stop JavaScript from generating an HTML file with nothing but a JS function call in it When using an EventListener in a javascript file to call a function
document.getElementById("messageSubmit").addEventListener("click", getKey)
however, when running my code, JS throws a ReferenceError saying that getKey() is not defined (it is) and, to show me where the error occurred, points me to index.html, which now only contains one line: getKey(). When looking at the files in Inspect Element, my original index.html is there, and fully intact. What on earth is happening, and how do I go about fixing it?
I have tried changing getKey to getKey() in the EventListener, and I have tried deleting the new file, however my IDE does not recognise that the new file exists, or has ever existed. (my IDE is WebStorm by JetBrains)
I won't post the entire JS file, as it's ~50000 lines, but here's the problematic function and call.
async function startChat(user, userkey, userPubKey, oUID, position) { //Will start an encrypted chat between two users FIXME: Needs rewriting
    targetUID = oUID;
    var localUID = user.uid;
    console.log(position);
    var order = position === "true" ? localUID + " " + targetUID : targetUID + " " + localUID;
    console.log(order);
    var accepted;
    await database.ref("/chats/" + order + "/accepted/" + targetUID + "/").once('value', function(snapshot) {
        if(snapshot.val() != null) {
            accepted = snapshot.val();
        }
    });
    if (accepted === "true") {
        database.ref("/chats/" + order + "/" + localuuid + "/messages/").on("child_added", (data, prevChildKey) => {
            var newpost = data.val();
            console.log(newpost);
            Object.keys(newpost).sort();
            console.log(newpost);
            const ordered = Object.keys(newpost).sort();
            // Object.keys(newpost).map((key, index) => {
            //
            //
            // }).catch( (error) => {
            //     console.log(error.message);
            //     console.log(error.code);
            // });
            console.log(newpost['message']); //{Prints encrypted message(all messages looped)
            console.log(newpost['date']);//Prints date stamp(all messages looped)
            console.log(newpost['time']);//Prints time stamp(all messages looped)
            console.log(newpost['sender']);//Prints sender uid(all messages looped)
            //var decrypt = cryptico.decrypt(newpost['message'], userkey).plaintext;

            // noinspection JSJQueryEfficiency
            $("#chatField").append("" + newpost['sender'] + "");
            // noinspection JSJQueryEfficiency
            $("#chatField").append("" + newpost['time'] + "");
            // noinspection JSJQueryEfficiency
            $("#chatField").append("" + newpost['message'] + "");
        }).catch( (error) => {
            console.log(error.message);
            console.log(error.code);
        });
    } else {
        var myRef = firebase.database().ref("/chats/" + order + "/accepted/" + oUID).set("false");
    }

document.getElementById("listHere").addEventListener("click", startChat);

error:
index.html:1 Uncaught ReferenceError: getKey is not defined
    at HTMLAnchorElement.onclick (index.html:1)

On clicking on the linked index.html file, it shows:
getKey();

and nothing else.
How do I fix this, or, if there is no way, is there a workaround?
EDIT: Someone asked for HTML:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <link rel="stylesheet" href="ChatLayoutStyleSheet.css">
    <title>ChatLayout</title>

Home

Information

Chat

Groupchat

Sign In

Sign Up

Welcome To Your Private Chat Room!

Invite your friends to start chatting

Display Text Here

        Send Message
        <input id="sendmessage" type="text" name="Type" placeholder="Type Here">

        <button type="submit" value="Send" id="messageSubmit">Send</button>

            Search Emails
            <input id="findEmail" type="email" class="findChat">
            <input id="findEmailSubmit" class="findChat" onclick="//parseSearchedEmails()" type="submit">

        <button id="listHere" onclick=""></button>

A: It sounds like a scope problem (but it cannot be confirmed and solved with elements provided). Here's a very basic example with a raw closure that exports to global scope (basic of a web app noawadays) to demonstrate :

// Simulate a bundle with some exports
(function(global) {
  function t1() {
    alert('Success : all is done in the closure scope');
  }

  function t2() {
    alert('Fails : callback not available in event setter scope');
  }

  // Exports to global scope
  global.t3 = function() {
    alert('Success : callback is exported to event setter scope');
  };

  // This will be set up within closure scope. It works
  document.getElementById('test1').addEventListener('click', t1);
})(window)

// This will be set up within window scope and t3 available. It works
document.getElementById('test3').addEventListener('click', t3);

// This will be called within window scope and t2 not available. It fails.
document.getElementById('test2').addEventListener('click', t2);
<button id="test1">test 1 (OK)</button>
<button id="test2">test 2 (KO)</button>
<button id="test3">test 3 (OK)</button>

t2 do exist but is not available in current scope when setting up event callback, therefore the not defined error. The only way to solve this is to check code structure.
I'm not used to Webstorm and the kinda fake index.html might simply be an artifact from the debugger. The JS code you've provided is useless, it's the wrong HTML element id (listHere instead of messageSubmit) and there's no getKey on sight.
By the way, if you use addEventListener('click', myFunc()) instead of addEventListener('click', myFunc), it will run the callback when setting up listener and not when the event occurs.


text:
Q: Is this method overloading? I have created two methods in java;
public int sum(int a, int b){
    return a+b;
}

public double sum(int a, double b){
    return a+b;
}

and from main(), i call ;
System.out.println(sum(1,2));
System.out.println(sum(1,2.5));

and works fine and the output is correct;
3
3.5
So, should we call this overloading or a different method ?
Thanks

A: It is both.
sum(int, double) and sum(int, int) are different methods, even though they have the same name.
Method overloading is the ability to create different methods with the same name and different parameters. Here, you are creating different methods with the same name and different parameters, so you are using method overloading.

A: Yes this is overloading.
There are two ways in java to overload a method:

*

*By changing number of arguments

*By changing the data type

However method overloading is not possible by changing only the return type of the method.

A: Two methods have same name,same return type and different arguments then simply they are overloaded methods
void run(int a)
void run(int a, double b)


text:
Q: Getting indices of capital letters with regex I am trying to get the indices of capital letters (including special ones) in a line. I found here the following solution:
[i for i, c in enumerate(s) if c.isupper()]

However, this does not work for letters like: Ö, Ä and Ü:

I tried therefore:
[re.search(r'^([^A-ZÄÖÜ]*[A-ZÄÖÜ]){i}',s).span()[1] for i in range (1,y)]

where y is the number of capital letters in s.
The second solution works if I define i, but under the loop, it returns:

attributeerror 'nonetype' object has no attribute 'span'.

How can I solve it in an efficient way?

A: The problem is that s is represented in bytes. It needs just to be decoded to unicode:
s=u'ÖÄÜ'       # str to unicode
[i for i, c in enumerate(s) if c.isupper()]

A: Python3: You can do that with isupper() easily, no need for regex. Unfortunately, if you are using Python2.7 this will involve some nasty encoding/decoding, which I am not so familiar with.
x = "HEY thats Some Lower Case ZÄÖÜ"
print([i for i in range(0, len(x)) if x[i].isupper() ])
>[0, 1, 2, 10, 15, 21, 26, 27, 28, 29]


text:
Q: Xml Parsing Defaulting Variable I am refactoring some project and I ended up an xml, and the xml contains line below:
<SchoolLibraryOperations name="UpdateTheLibrary" key="Library/${FLOOR::FIRSTFLOOR}/Book/Update/${updateSessionId}"/>

I do not really know the meaning of FLOOR::FIRSTFLOOR here. When I am told, it is defaulting the variable to FIRSTFLOOR when any variable defined in for FLOOR.
Oracle xml parser is being used. When I checked the documentation for Oracle XML parsing, I didnt see anything about :: . Is there anyone knows how :: work in here?


text:
Q: Is there a way for app actions to generate a url? I am building a custom intent that will return a recipe if given the name of the food. For example if a user were to say "Hey Google, show me the recipe of banana nut bread on exampleApp" it would pull up that page. The issue is that on the back end, the banana nut bread recipe is associated with an number. So the url will be something like "https://exampleapp.com/4". Is there a way for my app action to call a function that returns the correct url?

A: You can support this by adding an intent parameter to your custom intent for the food name.
The key of each food name can be the id/number, and you can add synonyms for real words like 'banana bread'.
When the intent is triggered, you can resolve the intent parameter to use the key (id/number) rather than whatever the user said ('banana bread'), and form the URL from this.


text:
Q: document.queryselectorall not working on multiple classes javascript What I was trying to do  a group of elements having same class I wanted to iterate over them and add some classes or do some task but document.querySelectorAll() is not working even it is returning the node list length 0
so anyone can help me with this I am stuck at this point.
Js Script

even I tried to check the length with if condition and it is showing 0
html divs

hello heloo helllo

hello heloo helllo

hello heloo helllo

hello heloo helllo

 heloo

An animated element

An animated element

An animated element

An animated element

An animated element

An animated element

A: You are using .headings to select elements but your HTML elements has mheading class
To fix it: change your class name to mheading in the selector function or to heading in the HTML code.

A: For using queryselectorall you will need to use the tagName.className.
In your case kindly try -
document.querySelectorAll('p.highlighted')

or
document.querySelectorAll('h1.mheadings')

Also, Kindly refer to the right class names as i do not find the mentioned class by you in the code.


text:
Q: Can I use phonertc to send arbitrary data? I'm trying to use Phonegap/Cordova to send data between mobile and desktop application and between mobile to mobile via local network (just local p2p).
I've seen that in phonertc I can pick video/audio streams between devices, but what if I want to send regular objects through - or maybe using http://peerjs.com/

A: This is an old question, and perhaps you've moved on with your requirements; but I think what you were looking for was socket.io P2P.


text:
Q: Need write # under each tweet C# Apologies in advance, English is not my first language.
I need to write under each tweet: #.....  I am using Regex.IsMatch, but console write all tweets.
var tweet = tweets[i].Text;
var CreatedDate = tweets[i].CreatedDate.ToString("F");
var TweetTime = DateTime.Parse(CreatedDate);
var age = DateTime.Now.Subtract(TweetTime);
Console.WriteLine(tweet);
Console.WriteLine($"с момента создания прошло {age} времени");
Console.WriteLine();

var pattern = @"#\D*";

foreach(var sharp in tweet)
{
    if (Regex.IsMatch(tweet, pattern, RegexOptions.IgnoreCase))
        Console.WriteLine(sharp);
}

A: I don't know what you're trying to implement, but i see why your not getting the hashtag to print.  Regex.IsMatch doesn't change the text it just evaluates it.  Try something like this.
var pattern = @"#\D*";

        foreach (var sharp in tweet)
        {
            var match = Regex.Match(pattern, sharp);
            if (match.Success)
                Console.WriteLine(Regex.Replace(sharp, match.Value, "#" + match.Value, RegexOptions.Singleline));
            else
                Console.WriteLine(sharp);

        }

A: Thank's all
Right anwsers is next:
 string pattern = @"\s*#(\w+)\s*";
            Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);
            MatchCollection matches = rgx.Matches(tweet);
            if (matches.Count > 0)
            {
                foreach (Match match in matches)
                    Console.WriteLine("   " + match.Value);
            }

Thanks for @M. Green


text:
Q: StackOverflow file structure Each stack overflow post has the following structure:
https://stackoverflow.com/questions/id/title
Does that mean that the post title is an actual html page stored on the server? Or is the body of the post kept and then inserted into a default html page with the header information and sidebars etc?
What does the id part represent? Is this unique for each question?

A: I'm nearly certain that the pages are generated dynamically and that the information lives in a database somewhere.  Static pages for posts would be absurd to maintain.  ID is going to be a unique identifier of some kind, yes.
Think of it like this:
<<incoming request - contains ID>>

<?php
  $postBody = $dbconnection.query(POSTS_BY_ID, ID);

  echo '<body>';

  echo $postBody;

  echo '</body>';
?>

Obviously, there's a lot left out here, but the idea is that the post content can be quickly retrieved by ID, then dropped into the page template.

A: You might want to read up on ASP.NET MVC routing schema.
ID is the question ID in the database, the name is ignored.


text:
Q: [antd]: Pagination and Table Not working? I'm on Antd vs.3.1.4.
I'm trying to position pagination on my table, but it's not working as copyable from the api/docs. Here are the props I'm setting:
<Table
   pagination={{ position: 'both' }}
   columns={columns}
   dataSource={appointmentTypes}
   rowKey="id"
/>

Here is the rendered
just wondering what I'm doing wrong here? I took a look at the source code it should be correct. I'm passing in pagination props to their table, which should create the pagination element with all the passed props properties with _.extend.
Thanks a ton!

A: Just try it like that ..
change  the name position to pageSize
 <Table pagination={{ pageSize: 10 }}  columns={columns} />

A: You should set unique rowKey per row, otherwise react will reuse old rows, such
that it looks like pagination is not working. something like this should do the trick
rowKey={record => record.id}


text:
Q: Memory usage during drawing procedure I wrote a small procedure in assembly to draw some text to the screen (first it writes to a buffer, then copy the buffer to the screen with BitBlt)
The function works well, and it draws every 25ms, but i noticed that the memory usage increases over time, and increases a lot.
First, i tried releasing the buffer DC and then delete the bitmap, creating a new one to see if the memory got released but it didnt work, is there any way i can reduce this memory usage?
here is my code
backh dd 0
bmph dd 0
isless db 1
zerod dd 0

initmenu:
          invoke GetDC,0
          invoke CreateCompatibleDC,eax
          mov [backh],eax
          invoke GetDC,0
          invoke CreateCompatibleBitmap,eax,140,250
          mov [bmph],eax
          invoke SelectObject,[backh],[bmph]
          invoke SetBkMode,[backh],TRANSPARENT
          invoke SetTextColor,[backh],33CC00h
          retn

updatescreen:
      invoke GetDC,0
      mov [zerod],eax
      mov cl,[isless]
      test cl,cl
      jnz @f
      invoke BitBlt,[zerod],0,0,140,250,[backh],0,0,SRCCOPY
      jmp _updatescreenend
      @@:
      invoke BitBlt,[zerod],0,0,140,25,[backh],0,0,SRCCOPY
      _updatescreenend:
      invoke ReleaseDC,[zerod]
      retn
menuproc:
          invoke Sleep,25
          call updatemenu
          jmp menuproc

A: You have to release the DC. It's possible that you didn't do it right (in the code you presented, the value of DC is lost by the time BitBlt returns).
Can you estimate how much memory you leak per iteration?

A: Solved the problem, instead of ReleaseDC i should use DeleteDC, the information on MSDN is wrong...


text:
Q: Get rid of scientific notation I need to do some calculations but I'm getting a problem with values which are very low, for example, I need to get the 2.7% of 0.005 and I end up with 1.3500000000000003e-4 which is not what I'm looking for, I just need to know how can I get an accurate percetage of those values, what I'm doing right now is <value> * 2.7 / 100 which works great for integers or floats greater than 0.05.
For example, the one that I need which is 2.7% of 0.005 needs to be shown as 0.000135.

A: First, understand that the language isn't broken, it's just that computers are just really bad at doing floating point math.
So, in a sense 1.3500000000000003e-4 is accurate, but your issue here is that Elixir prints the (very small and very large) floats in exponent notation. There are a few ways you can print it as 0.000135:

*

*Use Erlang's float_to_binary:
:erlang.float_to_binary(0.005 * 2.7 / 100, [:compact, {:decimals, 10}])
#=> "0.000135"

*Use :io.format:
:io.format("~f~n",[0.005 * 2.7 / 100])
#=> "0.000135"

*Or use exprintf which is a nice Elixir wrapper around Erlang's :io module

Notice the result is a string and not a number in the above examples - since you're just formatting / printing it in decimal.


text:
Q: How to include an Alert Component into two different modules in Angular? I have to use the alert component into different modules A and B in Angular. Even if the implementation is the same for both modules, the tag  is recognized as such only in module A. Module B returns in the webbrowser the error:
Uncaught Error: Template parse errors:
'alert' is not a known element:

*

*If 'alert' is an Angular component, then verify that it is part of this module.

*To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.

The project structure is the following:
app
  _directives
    alert.component.html
    alert.component.scss
    alert.component.ts
    index.ts
  app.module.ts
  Module B
    moduleB.module.ts
    .
    .
  Module A
    moduleA.module.ts
    .
    .

The index.ts file exports the component:
export * from './alert.component';

In Module B (the working module) the component is imported as following:
moduleB.module.ts
import { AlertComponent } from 'app/_directives/alert.component';
    .
    .
@NgModule({
  declarations: [
        .
        .
    AlertComponent,
        .
        .

The exactly same logic is used for module A where I get the error.
Do you have any ideas how to solve this? Thank you!

A: If you are going to share components between 2+ other modules, you should have a shared module for that component which would also contain similar/related components.
Since your alert component is used in more than one module, we will place it in its own module. This contains the following:

*

*declarations – this is to declare all components/directives/pipes/etc. that are in this module.

*exports – this is to expose specific components/directives/pipes/etc. to other modules, anything in declarations but not here will not be accessible by other modules.

*imports – this is everything this module needs to operate.

So, here is where we will define the AlertModule to be use in other modules:
@NgModule({
  // These are components that are apart of this module
  declarations: [AlertComponent, AlertHeaderComponent, AlertFooterComponent],
  // These are components that other modules can use/access from this module
  exports: [AlertComponent],
  // These are dependencies that this module needs in order to work
  imports: [CommonModule, ButtonModule]
})
export class AlertModule {}

Next we just need to import the module here:
@NgModule({
  imports: [CommonModule, AlertModule]
})
export class ModuleA {}

And any other module that wants to use the alert:
@NgModule({
  imports: [CommonModule, AlertModule]
})
export class ModuleB {}

A: i will suppose that you know how to create and import modules.
So you need to :

*

*create a new module for the alert ( don't forget to export your component )

*import the alert module into Module_A , Module_B

*import only Module_A and Module_B into AppModule ( No need to import the alert component )

that's it :)


text:
Q: Mybatis update xml return affected rows count What's the problem:
  I hope get a procedure return value which only has a few update sql like below.
<update id="updateSingleW11MeetingKeyTmp" parameterType="com.cisco.wbx11.db.meetingmigration.wbx11.migrationmeeting.vo.MappingVO">

    {call
      declare
        begin
            update mtgconference <set> meetingtoolsid= #{w11mkTmp,jdbcType=NUMERIC} </set>
                where siteid=#{w11SiteId,jdbcType=NUMERIC} and hostid=#{w11Uid,jdbcType=NUMERIC} and meetingtoolsid=#{wbxmk,jdbcType=NUMERIC};

            update wbxcalendar <set> confkey= #{w11mkTmp,jdbcType=NUMERIC} </set>
                where siteid=#{w11SiteId,jdbcType=NUMERIC} and hostid=#{w11Uid,jdbcType=NUMERIC} and confkey=#{wbxmk,jdbcType=NUMERIC};

            update wbxconferencekey <set> confkey= #{w11mkTmp,jdbcType=NUMERIC} </set>
                where siteid=#{w11SiteId,jdbcType=NUMERIC} and confkey=#{wbxmk,jdbcType=NUMERIC};
            update WBXREPEATEREXCEPTION set CONFKEY = #{w11mkTmp,jdbcType=NUMERIC}
                where siteid=#{w11SiteId,jdbcType=NUMERIC} and CONFKEY=#{wbxmk,jdbcType=NUMERIC};
        end
    }
</update>

I called this with mapper in Java code, but the return is not expected
public Integer updateSingleW11MeetingKeyTmp(MappingVO vo) {
    return mapper().updateSingleW11MeetingKeyTmp(vo);
}


text:
Q: LEFT JOIN question - Pervasive SQL - combining multiple records from one table into a single column I am having some trouble with getting data into a column from a combination of two tables.
I'm using pervasive SQL and don't have access to pivot tables.  I did a left join and tried union but am not getting the results I want.
I have a primary table - table A - That for a given contract has 10 summary 'colors'.
I am using a select statement and a case clause to string the 10 unique colors together with commas to properly determine the number of commas I am checking for values in those color fields.
This works well - I get a single row with all of the colors listed (10 fields into 1)
Table B contains records for the same contract and can have almost up to 2000 colors (detail colors).
If table B has colors then Table A doesn't.
Is there a way to select all of the colors in Table B into a single row and column and show all of the other column data in Table A?
What I want :
Contract +---------+  PHONENO +----------+   Color +------+------+
TEST                  555-555-5555           BLUE,RED,GREEN,YELLOW

Instead of what I'm currently getting:
Contract+---------+  PHONENO +----------+   Color +------+------+
TEST                 555-555-5555           BLUE
TEST                 555-555-5555           RED
TEST                 555-555-5555           GREEN
TEST                 555-555-5555           YELLOW

SELECT  TableA.ContractNo AS Contract,
        TableA.PhoneNo,
        CASE
                WHEN TableA.Color10 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5 + ',' + TableA.Color6 + ',' + TableA.Color7 + ',' + TableA.Color8 + ',' + TableA.Color9 + ',' + TableA.Color10)
                WHEN TableA.Color9 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5 + ',' + TableA.Color6 + ',' + TableA.Color7 + ',' + TableA.Color8 + ',' + TableA.Color9)
                WHEN TableA.Color8 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5 + ',' + TableA.Color6 + ',' + TableA.Color7 + ',' + TableA.Color8)
                WHEN TableA.Color7 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5 + ',' + TableA.Color6 + ',' + TableA.Color7)
                WHEN TableA.Color6 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5 + ',' + TableA.Color6)
                WHEN TableA.Color5 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4 + ',' + TableA.Color5)
                WHEN TableA.Color4 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3 + ',' + TableA.Color4)
                WHEN TableA.Color3 <> '' then (TableA.Color1 + ',' + TableA.Color2 + ',' + TableA.Color3)
                WHEN TableA.Color2 <> '' then (TableA.Color1 + ',' + TableA.Color2)
                WHEN TableA.Color1 <> '' then (TableA.Color1)
                WHEN TableB.Color <> '' then TableB.Color
                ELSE 'n/a'
                end as Color
           FROM TableA

           LEFT JOIN TableB ON (TableA.ContractNo = TableB.ContractNo)

           ORDER BY TableA.ContractNo

Can anyone help out with this?


text:
Q: body-component is not a known element using angular quickstart I am trying a simple code but I can't make it work. I know a little about angular but this really frustrates me. ;(
app.component.html

body.component.html

HELLO WORLD

app.module.ts
import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }  from './app.component';
import { BodyComponent } from './body.component';

@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ AppComponent, BodyComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

What is wrong here? I got the error body-component is not a known element. Please help.
EDIT:
body.component.ts
import { Component } from '@angular/core';

@Component({
  moduleId: module.id,
  selector: 'body-component',
  templateUrl: 'body.component.html'
})
export class BodyComponent  { }

app.component.ts
import { Component } from '@angular/core';

@Component({
  moduleId: module.id,
  selector: 'my-app',
  templateUrl: 'app.component.html'
})
export class AppComponent  { name = 'Angular'; }

A: //our root app component
import {Component, NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'body-component',
  template: `

HELLO WORLD

  `,
})
export class BodyComponent {
  name:string;
  constructor() {
    this.name = 'Angular2'
  }
}

@Component({
  selector: 'my-app',
  template: `

  `,
})
export class App {
}

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ App, BodyComponent ],
  bootstrap: [ App ]
})
export class AppModule {}

Plunker example


text:
Q: "Csc.exe" could not be run. Access is denied (MSB6003) I just downloaded and installed Xamarin and selected the ASP.NET MVC template. I haven't touched anything. When I build the solution I get the following error:
Could not add packages.
"The specified task executable "Csc.exe" could not be run. Access is denied (MSB6003)".
This is at the end of messages displayed on the Package Console:
Added file 'packages.config'.
An exception was thrown while dispatching a method call in the UI thread.
I'm running Windows 8.1 and Visual Studio Community 2015.
Any ideas?


text:
Q: How to get past Wilhelm in "A Train to Catch" during Playthrough 2 of Borderlands 2 on the PS3? I've just spent the last few hours trying to complete the boss battle with Wilhelm in Playthrough 2 of Borderlands 2.  No matter what I try, I can't win this battle, and quite frankly it ticks me off so much that I now really dislike this game.  I came in at level 39 and Wilhelm was 42, so I left the map and came back in at halfway through level 41, thinking it might be a closer match.  However, that hasn't helped.  I see loaders that spawn with skull and crossbones indicating that they are leveled above me, even though their numerical level is 39 or 40.  That makes me think something's wrong.
At this point, I've respawned so many times I'm almost out of cash, and the closest I've gotten to whittling down his health is to about one-third.  I've got a nice shotgun that can take care of the energizing surveyors, but they spawn a lot and don't give me a chance to battle Wilhelm much.  I've tried the tactic of keeping a distance and sniping him, but that's no good because the surveyors rebuild his shield.  So I've been trying to stay close and blast his critical spots at the mid-section and face, and that does take good chunks of his health with critical hits, but it's risky because of his melee spin and laser blasts, not to mention his missile launches.  I'm playing as Zero, so the decoy helps, as it can give me time to run behind him and blast critical spots before it disappears.
In any case, I'm wondering how others have finished this level.  It's times like this that I wonder what the developers were thinking when designing the level, or if it truly is a bug somehow, because it just seems way too difficult and takes the fun out of the game.

A: First of all, you might want to reconsider your build. My experience with Zer0 is that his builds are highly situational, and using the wrong one in certain situations can make you feel very under-powered. I used his left (sniping) tree for the majority of playthrough 1, but after getting to the second playthrough it started feeling underwhelming-- I'm now back to it, but the other builds served me better in some situations. So, consider heading to a New-U station and re-speccing. I've found that his kunai (last skill in the center tree) can be devastating against certain enemies.
Second, you might want to grab some new guns. Guns start to decay in usefulness very quickly after playthrough 1, so if you've been using the same gun for a few levels now it's probably time to replace it. Grind a bit, or spend a few of your Golden Keys in Sanctuary. The difference will astound you.
Third, take out his surveyors first, always. They are a massive pain in the butt and trying to kill Wilhelm with them healing him is an uphill battle. But leave the other bots he spawns if they're not a huge nuisance-- you can use them for second winds.
Lastly, use your elements. Shock is THE best element overall, since it has no damage penalty against any kind of enemy and in playthrough 2 deals double damage against shields. I recommend a shock sniper for Zer0-- he'll dominate with it. Apart from that, definitely bring a high DPS corrosive gun, and slag, slag, slag. Zer0's kunai can apply slag, but if you're not using that build I'd recommend getting some slag grenades-- that way, you'll be able to slag him without switching guns.

A: Wilhelm is weak to corrosive weapons - IIRC, when I faced him the second time I knew this and he died to a corrosive SMG in less than a minute.
If you do Tina's "You are Cordially Invited" then you should have a weapon called the Teapot or some such, it works quite well against him.

A: I finally beat Wilhelm in Playthrough 2!  A big thanks and +1 to everyone that provided answers.  I'm answering my own question only because comments don't allow enough space for the following details.  I ended up not re-spec'ing my character, and stayed as Zero just to see if switching my fighting strategy would help.  With the tips people gave me, it did!  In the end, combining slag/corrosive elementals were the key.  Plus, I'm sure, just plain luck!
The strategy I used was to start with a slag pistol, then switch to corrosive SMG to whittle down his health a bit.  Since the slag effect doesn't last long on Wilhelm, you have to repeat this.  And when surveyors would spawn to heal him, I'd switch to my high-power, quick-reload shotgun to take them out in single blasts.  There would usually be at least four that would spawn.
I found I could duck behind the ice stack at the far end of the plateau next to the burning barrel, to shield from his laser blast and missile launches.  Even then, I got into sudden death several times, and luckily had a surveyor nearby to get a second wind.  I would run in a clockwise circle around Wilhelm, throwing out my assassin decoy as often as possible to misdirect his attention to get in close for a quick shotgun blast or more while he was slagged.
Finally, when his health got below a quarter, I used slag grenades instead of the pistol. That let me focus on just two weapons, the shotgun and SMG.  In the end, I used 5 of 8 grenades, being very careful to throw one only when the slag effect had just worn off -- I didn't want to waste any grenades.
Using this strategy, I still died a few times, and it took me 45 minutes of game play to beat Wilhelm.  But I did it, and my frustration with the game has subsided a bit.  The encouragement from everyone helped a lot, and I'm ready to continue PT2, knowing that this isn't even the hardest map!  :-/
Here are some details of my skill level and weapons, in case it helps anyone else.
Character Level 42, Shield 8719, Health 19342

Weapon                      Lvl Damage    Accuracy Fire Rate Reload Mag Size Other
--------------------------  --- --------- -------- --------- ------ -------- ----------------------
Jakobs Handy Coach Gun      40  1566 x 13   42.1     14.5      2.3     2     +11% dmg
  Shotgun (green)                                                            2 ammo per shot
Hyperion Amplified Impact   37  1500        97.6      4.6      1.9    20     SLAG 18% chance
  Pistol (blue)                                                              Firing increases accuracy
Bandit Bulets Go Fasterifed 37  646         90.4      8.6      3.5    50     CORRODE 11.5% chance
  Barfy SMG (green)                                                          846.6 corrosive dmg/sec

Hyperion Rubberized Slag    36  11890       Radius 464, Fuse Time 0.1
  Singularity Grenade (green)

Eridian Relic (white)       35  Corrosive Damage +13%
Bandit Survivor Class Mod   39  Max Health +1767, Health Regen 47.9
  Assassin (green)
Anshin Hippocratic Adaptive 37  Max Health +3011
  Shield (blue)

A: The key to killing Wilhelm is to shoot him in the face when he is creating his Shield Surveyors.  It destroys the surveyors and causes him to stop making them.  Kill all the gun loaders then keep moving in circles.  I did it with 17th level Zero, a shotgun, and a corrosive sniper.

A: There is a kinda glitch to how i got past this boss at only lvl 14. Going off my memory... as you enter- just to the left is a bus that you can jump on... now i don't no if this happens often but it happened to me... while on the bus- the boss was just spinning in front of me but i was just far enough for it not to hit... so i took as much time as i needed and aimed for its head- an easy kill.

A: I used a really powerful corrosive rocket launcher, corrosive shotgun, shield depleting assault rifle and a shield depleting pistol with corrosive fragment grenades and a corrosive shield.
I'm playing as Axton at level 50 and defeated him pretty quick. I just nailed him no stop.

A: I was a level 16 and I found it very easy to kill Wilhelm.  I have a 1,081 x 3 rocket launcher with an explosive bonus.  I used my stealth skill as an assassin to get a bigger bonus on the first shot, knocked most or all of his shield down, then hit him another 4 or 5 times before running to let my stealth skill recharge.  Rinse and repeat.  It only took me one more time to kill him - used a total of 10 rockets and I missed at least once when he was jumping. I didn't even have to worry about surveyors.

A: Took me a lot of tries mostly due to a low level friend keeping a lot of bots at the bottle neck that killed me so often trying to get out the gate. But I did beat him. Train hide, electric sniper then run to him and slag shotgun to death. Played siren level 15 first play through.

A: This boss fight against Wilhelm for me was quite easy. I didn't use any fancy tactics cause I don't know any.
I am just at level 17 but there was one reason I could defeat him so easily: I used a really good shotgun to first destroy the repair surveyors and every time Wilhelm tried to spawn new ones I blasted those with my shotgun. Really, if you just keep shooting Wilhelm with a high damage gun, he doesn't stand a chance. Oh and by the way remember to stock up on ammo.

A: I managed to kill him at level 13.
I used the Torgue "Waka Duuurp!" To get his shields down, then hit him with a corrosive grenade to finish him off while he made his shield surveyors. The key is high damage and area affects.

A: Neel down behind the barrel under the train tracks near the edge of the cliff.  He cant get you there nor can his surveyors. Then just shoot him in the head until hes dead.  The other robots cant get you there either.  Its kind of a glitch, he just spins and spins while you shoot him.


text:
Q: ¿Como hago la sumatoria con PYTHON? estoy realizando una guia con listas y diccionarios de datos, estoy tratando de resolverla lo mejor posible, para que me quede de referencia, pero por la inexperiencia hay un proceso que necesito hacer y no logro realizarlo, el calculo de los descuentos e impuestos salio bien, pero al tratar de hacerlo en el mismo fragmento de codigo no encuentro mi error, muchas gracias por la ayuda
#aca se dec lara el diccionario
Stock={'harina' : 1,
       'azucar' : 1,
       'sal'    : 1,
       'pan frances': 1,
       'jamon'  : 2,
       'queso'  : 3,
       'frijoles':1

       }
inventario = list(Stock)
print(Stock)

descuento =  list(Stock )
print (descuento)

producto= Stock.keys()

precio= Stock.values()

def descuento():
  print(*[f'Precio {k}: {v} --> Descuento {k}: {v*0.1}' for k,v in Stock.items()], sep='\n')

def impuesto():
  print(*[f'Precio {k}: {v}  --> Impuesto {k}: {v*0.13} ' for k,v in Stock.items()], sep='\n')

def total_detalle():
  print((*[f'Precio {k}: {v} --> Descuento{k}: {v*0.1} --> Impuesto {k}: {v*0.13} Total a pagar{k}:{(v*0.1)+(v*0.13)+v} ' for k,v in Stock.items()], sep='\n'))

print (total_detalle())

A: Tu error radica en 2 cosas:

*

*Tienes parentesis de mas en el print de total_detalle:

*Estas sumando el impuesto y el descuento, deberías restar el descuento.

def total_detalle():
    print(*[
        f'Precio {k}: {v} --> Descuento {k}: {v * 0.1} --> Impuesto {k}: {v * 0.13} Total a pagar {k}:{(v - (v * 0.1)) + (v * 0.13)} '
        for k, v in Stock.items()], sep='\n')


text:
Q: Copy Paste VBA Range from one to another worksheet Loop and transpose the data For A model in Excel I would like to copy and paste data from one sheet in a workbook to the other sheet in the workbook and transpose this data with the usage of a for next loop. Data from the workfile CME should be pasted in the workfile of RME. The total lines of data is 2420. However, since the ranges in the copy and paste different workbook are different and step sizes are different, I assume that i should use two different variables i and j. The first two lines of code is the manual way to do it without a loop
When I try to run  this code, it will give me an error. the first to codes are an example how it should be done manually without a loop. Thereafter the loop starts. Already a lot of thanks for the person who can help me with this issue.
Example from the file: In Excel Worksheet CME: copy range J2:J10 to transfer it to worksheet RME to be pasted on B2:J2 so it is important to have a transpose function in it. For the next range I need to copy the range J12:J20 to transfer it to worksheet RME to be pasted on B3:J3 and so on, therefore I need to create a loop right? With two different stepsizes for the copy and paste ranges. Thanks a lot already!
I came up with the following formula:
Dim i As Long
Dim j As Long

Worksheets("CME").Range("J2:J10").Copy
Worksheets("RME").Range("B2").PasteSpecial Transpose:=True

Worksheets("CME").Range("J12:J20").Copy
Worksheets("RME").Range("B3").PasteSpecial Transpose:=True

For i = 11 To 2420 Step 10
    Worksheets("CME").Range (Cells(i + 11, 10)), Cells(i + 19, 10).Copy

    For j = 3 To 2420 Step 1
    Worksheets("RME").Range(Cells(j + 1, 2)).PasteSpecial Transpose:=True
    Next j

Next i

End Sub

A: I'm a little confused with what exactly you want to do but would this do?:
First code: Not using transpose
Sub Test()

Dim X As Long, Y As Long, Z As Long

Z = 2
For X = 2 To 2420 Step 10
    For Y = 2 To 10
        Sheets("RME").Cells(Z, Y).Value = Sheets("CME").Cells(X + (Y - 1), 10).Value
    Next Y
    Z = Z + 1
Next X

End Sub

Second code: Using transpose
Sub Test()

Dim X As Long, Z As Long
Dim RNG1 As Range, RNG2 As Range

Sheets("CME").Activate
Z = 2
For X = 2 To 2420 Step 10
    Set RNG1 = Sheets("CME").Range(Cells(X, 10), Cells(X + 9, 10))
    Set RNG2 = Sheets("RME").Cells(Z, 2)
    RNG1.Copy
    RNG2.PasteSpecial Transpose:=True
    Z = Z + 1
Next X
Sheets("RME").Activate

End Sub

Note: Copy/Pasting and transpose take much longer to execute on a larger database. To compare the two code examples above:

*

*First code: 0,13 seconds

*Second code: 5,5 seconds


text:
Q: Dispatching additional actions conditionally from redux-observable epic In short, I'd like set up an epic that performs a request and dispatches an action based on the request being fulfilled or rejected. Then I'd like the epic to maybe dispatch additional action(s) based on the result and the current state.
First part is straightforward
const fetchFooEpic: Epic<ActionAny, RootState> = (action$, store) =>
  action$.pipe(
    ofType<ActionAny, ReturnType<typeof actions.foo.fetch>>(actions.foo.types.FETCH_ALL),
    switchMap(action =>
      ajax({
        method: 'GET',
        url: `${path}/foo/${action.payload}`,
        headers: { Authorization: store.getState().user.token }
      }).pipe(
        map(({response}) => actions.foo.fetchFulfilled(response)),
        catchError(error => of(actions.foo.fetchRejected(error)))
      )
    )
  )

But I'm running into trouble introducing another action or empty into the mix. I think I want to use mergeMap and empty when nothing should be dispatched, but I'm getting type errors.
const fetchMissingRelations = (response: Foo[], state: RootState) => {
  const unknown: BarId[] = foo
    .map(foo => foo.barId)
    .filter(barId => !state.bar.entities[barId])
  return unknown.length
    ? actions.bar.fetch([...new Set(unknown)])
    : empty<never>()
}

const fetchFooEpic: Epic<ActionAny, RootState> = (action$, store) =>
  action$.pipe(
    ofType<ActionAny, ReturnType<typeof actions.foo.fetch>>(actions.foo.types.FETCH_ALL),
    switchMap(action =>
      ajax({
        method: 'GET',
        url: `${path}/foo/${action.payload}`,
        headers: { Authorization: store.getState().user.token }
      }).pipe(
        mergeMap(({response}) => of(
          actions.foo.fetchFulfilled(response),
          fetchMissingRelations(response, store.getState())
          // err: property 'type' is missing in {}
        )),
        catchError(error => of(actions.foo.fetchRejected(error)))
      )
    )
  )

I end up in https://github.com/redux-observable/redux-observable/issues/339, but providing the explicit never type for empty didn't work for me.
That's the question (feel free to stop here), but here's some additional context why I'm trying to do this and I'll appreciate if someone can suggest an alternative approach:
I've got couple of state slices with relational data that all comes over the network from different API endpoints. In this case it's discussions with internal and external participants.
When I fetch discussions, I'd like to immediately parse them for any references to participants that aren't in the state yet, batching them into requests to fill in the missing data (so I can display names, avatars and such on the UI). In case all the information is already available locally, I don't want to request anything.
My initial plan was to rely on connected React components that use the data to check for missing referenced entities in the lifecycle events (componentDidMount/componentWillReceiveProps) and dispatch actions to fill in the data, so the epics can stick to their own domains and not care about what else needs to be updated.
However, that is getting a little out of hand as that state is being used in many different places that all need to do the checks and dispatch actions when necessary. As much as I like keeping the state domains separate, I think having the epics that handle discussions requests to also dispatch the actions to update other stuff will make a much smaller footprint. The reasoning is that this would free up the connected components to just render or wait for data, instead of dispatching updates to fill in missing references. But I'm all ears for better solutions.

A: empty returns an observable, so depending upon unknown.length your fetchMissingRelations function will return either (what appears to be) an action or an observable.
You should change it so that it always returns an observable:
const fetchMissingRelations = (response: Foo[], state: RootState) => {
  const unknown: BarId[] = foo
    .map(foo => foo.barId)
    .filter(barId => !state.bar.entities[barId])
  return unknown.length
    ? of(actions.bar.fetch([...new Set(unknown)]))
    : empty<never>()
}

And you should change your mergeMap to take that into account:
...
mergeMap(({response}) => concat(
  of(actions.foo.fetchFulfilled(response)),
  fetchMissingRelations(response, store.getState())
)),


text:
Q: How to send PL/SQL SMTP mail with html body including Turkish Characters I am trying to send an email with pl/sql code which has blob attachment and HTML body in it.
Everything is going well but I faced with a problem again.
My HTML Body is looking nice with Turkish Characters but in outlook 2013, these Turkish Characters being '?' in the body of the email.
My mail code is :
PROCEDURE send_email_blob_and_mailing (p_to          IN VARCHAR2,
                                       p_from        IN VARCHAR2,
                                       p_subject     IN VARCHAR2,
                                       p_html_msg    IN VARCHAR2 DEFAULT NULL,
                                       p_attach_name IN VARCHAR2 DEFAULT NULL,
                                       p_attach_mime IN VARCHAR2 DEFAULT NULL,
                                       p_attach_blob IN BLOB DEFAULT NULL,
                                       p_smtp_host   IN VARCHAR2,
                                       p_smtp_port   IN NUMBER DEFAULT 25,
                                       result_key_   IN NUMBER,
                                       PDF_PARAMETER_1 IN VARCHAR2,
                                       PDF_PARAMETER_2 IN VARCHAR2,
                                       PDF_PARAMETER_3 IN VARCHAR2,
                                       PDF_PARAMETER_4 IN VARCHAR2,
                                       PDF_PARAMETER_5 IN VARCHAR2,
                                       PDF_PARAMETER_6 IN VARCHAR2,
                                       PDF_PARAMETER_7 IN VARCHAR2,
                                       PDF_PARAMETER_8 IN VARCHAR2,
                                       PDF_PARAMETER_9 IN VARCHAR2,
                                       PDF_PARAMETER_10 IN VARCHAR2)
AS
  l_mail_conn   UTL_SMTP.connection;
  l_boundary    VARCHAR2(150) := '----=*#abc1234321cba#*=';
  l_step        PLS_INTEGER  := 57;

  --rapor parametreleri

my_blob BLOB;

BEGIN

  l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
  UTL_SMTP.helo(l_mail_conn, p_smtp_host);
  UTL_SMTP.mail(l_mail_conn, p_from);
  UTL_SMTP.rcpt(l_mail_conn, p_to);

  UTL_SMTP.open_data(l_mail_conn);

  UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/mixed; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);

  IF p_html_msg IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);

    UTL_SMTP.write_data(l_mail_conn, p_html_msg);
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  END IF;

  IF p_attach_name IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: ' || p_attach_mime || '; name="' || p_attach_name || '"' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Transfer-Encoding: base64' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Disposition: attachment; filename="' || p_attach_name || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
 -- error_sys.System_General(result_key_);

FOR rec_ IN (SELECT PDF FROM PDF_ARCHIVE P WHERE P.result_key=result_key_)LOOP

    FOR i IN 0 .. TRUNC((DBMS_LOB.getlength(rec_.pdf) - 1 )/l_step) LOOP
      UTL_SMTP.write_data(l_mail_conn, UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(DBMS_LOB.substr(rec_.pdf, l_step, i * l_step + 1))) || UTL_TCP.crlf);
    END LOOP;

END LOOP;
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf);
  END IF;

  UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
  UTL_SMTP.close_data(l_mail_conn);

  UTL_SMTP.quit(l_mail_conn);
END;

I could not find any solution.

A: I find the solution.
the answer is;

your extended characters with tildas and such are 8 bit characters,
  smtp is a 7bit protocol (like US7ASCII, only 7 bits are used). IF your
  smtp server supports it, it MIGHT be able to take the 8bit data with
  the write raw data routine, if not you'll have to base64 encode the
  data (which uses only 7bit characters)

You can find difference of write_data and write_raw_data in this link
you can use simply
utl_raw.cast_to_raw(varchar2);

with the
utl_smtp.write_raw_data

my last code is below:
PROCEDURE send_email_blob_and_mailing (p_to          IN VARCHAR2,
                                       p_from        IN VARCHAR2,
                                       p_subject     IN VARCHAR2,
                                       p_html_msg    IN VARCHAR2 DEFAULT NULL,
                                       p_attach_name IN VARCHAR2 DEFAULT NULL,
                                       p_attach_mime IN VARCHAR2 DEFAULT NULL,
                                       p_attach_blob IN BLOB DEFAULT NULL,
                                       p_smtp_host   IN VARCHAR2,
                                       p_smtp_port   IN NUMBER DEFAULT 25,
                                       result_key_   IN NUMBER,
                                       PDF_PARAMETER_1 IN VARCHAR2,
                                       PDF_PARAMETER_2 IN VARCHAR2,
                                       PDF_PARAMETER_3 IN VARCHAR2,
                                       PDF_PARAMETER_4 IN VARCHAR2,
                                       PDF_PARAMETER_5 IN VARCHAR2,
                                       PDF_PARAMETER_6 IN VARCHAR2,
                                       PDF_PARAMETER_7 IN VARCHAR2,
                                       PDF_PARAMETER_8 IN VARCHAR2,
                                       PDF_PARAMETER_9 IN VARCHAR2,
                                       PDF_PARAMETER_10 IN VARCHAR2)
AS
  l_mail_conn   UTL_SMTP.connection;
  l_boundary    VARCHAR2(150) := '----=*#abc1234321cba#*=';
  l_step        PLS_INTEGER  := 57;

my_blob BLOB;

BEGIN

  l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
  UTL_SMTP.helo(l_mail_conn, p_smtp_host);
  UTL_SMTP.mail(l_mail_conn, p_from);
  UTL_SMTP.rcpt(l_mail_conn, p_to);

  UTL_SMTP.open_data(l_mail_conn);
  UTL_HTTP.SET_BODY_CHARSET('UTF-8');
  UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
  UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/mixed; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);

  IF p_html_msg IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset=UTF-8' || UTL_TCP.crlf || UTL_TCP.crlf);

    UTL_SMTP.write_raw_data(l_mail_conn, utl_raw.cast_to_raw(p_html_msg));
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
  END IF;

  IF p_attach_name IS NOT NULL THEN
    UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Type: ' || p_attach_mime || '; name="' || p_attach_name || '"' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Transfer-Encoding: base64' || UTL_TCP.crlf);
    UTL_SMTP.write_data(l_mail_conn, 'Content-Disposition: attachment; filename="' || p_attach_name || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
 -- error_sys.System_General(result_key_);

FOR rec_ IN (SELECT PDF FROM PDF_ARCHIVE P WHERE P.result_key=result_key_)LOOP

    FOR i IN 0 .. TRUNC((DBMS_LOB.getlength(rec_.pdf) - 1 )/l_step) LOOP
      UTL_SMTP.write_data(l_mail_conn, UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(DBMS_LOB.substr(rec_.pdf, l_step, i * l_step + 1))) || UTL_TCP.crlf);
    END LOOP;

END LOOP;
    UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf);
  END IF;

  UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
  UTL_SMTP.close_data(l_mail_conn);

  UTL_SMTP.quit(l_mail_conn);
END;


text:
Q: How can I write a requirements file to pip install from multiple submodules? I have a master repo with repositories checked out at certain commits. All individual repositories are installable with the command:
pip install -r requirements.txt

from within the master-repository, I want to make it so you can install all the packages at once. The file structure is like:
├── aws_login_handler
│   ├── AWSLoginHandler
│   ├── requirements.txt
│   └── setup.py
├── datamodels
│   ├── BATDataModels
│   ├── requirements.txt
│   └── setup.py
├── gribmanager
│   ├── GribManager
│   ├── requirements.txt
│   └── setup.py
├── mongobase
│   ├── MongoBase
│   ├── requirements.txt
│   ├── setup.py
├── pyrtz
│   ├── PyRTZ
│   ├── requirements.txt
│   └── setup.py
├── routingserver
│   ├── requirements.txt
│   ├── RoutingServer
│   └── setup.py
├── runrouting
│   ├── requirements.txt
│   ├── RunRouting
│   └── setup.py
├── weatherrouting_v3
│   ├── BATWeatherRouting
│   ├── requirements.txt
│   └── setup.py
└── requirements.txt

Where I have added the requirements file:
-r ./datamodels/requirements.txt
-r ./mongobase/requirements.txt
-r ./routingserver/requirements.txt
-r ./runrouting/requirements.txt
-r ./weatherrouting_v3/requirements.txt
-r ./aws_login_handler/requirements.txt
-r ./gribmanager/requirements.txt

However when I run the command:
pip install -r requirements.txt

From the top level strucutre, the error:
ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

Is printed.
How can I create a way to install all the requirements of the sub modules?

A: Since you are using a relative path (./) you must add a setup.py in your main requirements folder.
Have a look at
https://pip.pypa.io/en/stable/cli/pip_install/#argument-handling


text:
Q: Trigger window resize on bootstrap collapse I am having sizing problems with a c3.js chart I have placed in a bootstrap collapse div. Similar to this question. Following the answers, I am trying to trigger a window resize each time the c3 chart is loaded, but does not seem to work. I know it's kind of a basic question (jquery ignorant), but how can I run $(window).trigger('resize'); each time I load the chart or open the panel-collapse div?
html:

                    Title

js:
$(function () {
    var chart = c3.generate({
        bindto: '#chart3',
        data: {
            columns: [
                ['data1', 30],
                ['data2', 50]
            ],
            type: 'donut',
        }
    });
    $(window).trigger('resize');
});

A: Bind to the .click() event:
$(document).ready(function() {
  $(".panel-collapse collapse").click(function() {
    $(window).trigger('resize');
  });
});

For the chart load, it'll depend on how you're calling it to be generated. If c3.generate() is the graph load function, then create another wrapping function, which calls both c3.generate() and $(window).trigger('resize'); then always load the chart with that:
function generateAndResizeWindow(options) {
  options.onrendered = function() { $(window).trigger('resize') }; // or whatever function generates your graph
  c3.generate(options);
}

then call as:
generateAndResizeWindow({
    bindto: '#chart3',
    data: {
        columns: [
            ['data1', 30],
            ['data2', 50]
        ],
        type: 'donut',
    }
});

for your example.

A: Add these lines after your code.
chart.load({
  done: function() {$(window).trigger('resize');}
});


text:
Q: Points property of ShapeNode fails in MS Word The Code below implements the example presented in the Microsoft ShapeNode.Points property (Word) article:
Sub Test()
Dim PointsArray
Dim myDocument As Document
Dim currXvalue As Single
Dim currYvalue As Single

    Set myDocument = ActiveDocument
    With myDocument.Shapes(3).Nodes
        PointsArray = .Item(2).Points
        currXvalue = PointsArray(1, 1)
        currYvalue = PointsArray(1, 2)
        .SetPosition 2, currXvalue + 200, currYvalue + 300
    End With
End Sub

Execution of the line 3 generates the RTE 13 (Type Mismatch).  According to the Watch panel,

*

*the type of the Points property is the array of Single (which is
correct)

*the type of the myDocument.Shapes(3).Nodes.Item(2).Points
expression is Integer

See the screenshot below:

Verified on MS Word 2007.  A problem of this kind exists for Word 2010.  However, it was verified that the problem does not exist for MS PowerPoint 2007 and MS Excel 2007.
Seems to be an error in the Word object model.  Can you please suggest a workaround?