问:
How to get time (hour, minute, second) in Swift 3 using NSDate?
How can you determine the hour, minute and second from NSDate class in Swift 3?

In Swift 2:

```<code>let date = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components(.Hour, fromDate: date)
let hour = components.hour
</code>```

Swift 3?

答:
```<code>swift 4

==> Getting iOS device current time:-

print(" ---> ",(Calendar.current.component(.hour, from: Date())),":",
               (Calendar.current.component(.minute, from: Date())),":",
               (Calendar.current.component(.second, from: Date())))

output: ---> 10 : 11: 34
</code>```

Body:
How can you determine the hour, minute and second from NSDate class in Swift 3?

In Swift 2:

let date = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components(.Hour, fromDate: date)
let hour = components.hour

Swift 3?


来源: stackexchange

问:
publish C# Excel Addin with UDF
I work on a Excel Addin in C# and my problem is present when i publish my C# Addin.

I'll explain:

I used this code: http://csharpramblings.blogspot.fr/2011/09/communicating-between-vsto-and-udfs-in.html

Which allow me to use UDF in my Addin. And it's work very well ! ... in Visual Studio 2013.

When i launch my Addin with Visual Studio i see my Addin in "COM Addins" in Excel. And my UDF in "Excel Addins" in Excel.

Then if:
 I publish my Addin with rightclick in the project in visual studio.
 I install the addin with the setup.exe generated by VS.
 I launch Excel
=> my addin works well, but my UDF doesn't work. Values of the cells are "#NAME?".

I checked in the COM Addins, my Addin is present.
I checked in the Excel Addins, i don't see my UDF.

So i used RegAsm to register the Assembly of the published DLL.
Now i see my UDF in the "Excel Addins" but it still doesn't work.

If anybody has an idea to help me that would be great !

I use: Windows 8.1 Pro, Visual Studio Pro 2013, Excel 2016 with Office365

Thank you in advance for your time.

答:
I finnaly found the solution !

My mistake was to use Regasm without any parameters.
Now i use Regasm with the /codebase parameter, and i signed my assembly with a strong name. Because Regasm documentation says that:

Creates a Codebase entry in the registry. The Codebase entry specifies
  the file path for an assembly that is not installed in the global
  assembly cache. You should not specify this option if you will
  subsequently install the assembly that you are registering into the
  global assembly cache. The assemblyFile argument that you specify with
  the /codebase option must be a strong-named assembly.

Source : https://msdn.microsoft.com/fr-fr/library/tzat5yw6(v=vs.110).aspx

Now i see my UDF in Excel and they work.

ContentLicense: CC BY-SA 3.0

Title: publish C# Excel Addin with UDF


问:
HIVE - INSERT OVERWRITE using WITH CLAUSE
I have a generated query starts with the WITH clause which is working fine when i am running it in console, when i try to run the query with INSERT OVERWRITE to load the output into a separate hive table

```<code>INSERT OVERWRITE TABLE $proc_db.$master_table PARTITION(created_dt, country) $master_query
</code>```

it throws the following error

```<code>cannot recognize input near 'WITH' 't' 'as' in statement
</code>```

The query as follows:

```<code>master_query="
WITH t
AS (
SELECT subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt
FROM crm_arrow.birthday
WHERE created_dt = '2016-07-07'
    AND (COUNTRY = 'SG')
GROUP BY subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt

UNION ALL

SELECT subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt
FROM crm_arrow.wishlist
WHERE created_dt = '2016-07-07'
    AND (COUNTRY = 'SG')
GROUP BY subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt

UNION ALL
.....
)
SELECT q.subscription_id
,q.country
,q.email_type
FROM (
SELECT t1.subscription_id
    ,t1.country
    ,DENSE_RANK() OVER (
        PARTITION BY t1.subscription_id
        ,t1.country ORDER BY t1.email_priority
        ) global_rank
    ,CASE
        WHEN t1.email_type = t2.email_type
            THEN t1.email_type
        END email_type
FROM t t1
LEFT JOIN t t2 ON t1.country = t2.country
    AND t1.subscription_id = t2.subscription_id
) q
WHERE q.email_type IS NOT NULL
AND (
    q.global_rank <= 2
    AND country = 'SG'
    )
"
</code>```

How can i make an efficient self join with a huge inner query ? I have also tried to enclose select statement across the master_query but it's still not working.

答:
It's just where you put you INSERT statement the problem. See here for an example of how to combine INSERT with a WITH clause

```<code>CREATE TABLE ramesh_test
(key          BIGINT,
 text_value   STRING,
 roman_value  STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;

WITH v_text
AS
(SELECT 1 AS key, 'One' AS value),
v_roman
AS
(SELECT 1 AS key, 'I' AS value)
INSERT OVERWRITE TABLE ramesh_test
SELECT v_text.key, v_text.value, v_roman.value
  FROM v_text JOIN v_roman
                ON (v_text.key = v_roman.key);
</code>```

Position the INSERT above the main SELECT.

Hope this helps!

Body:
I have a generated query starts with the WITH clause which is working fine when i am running it in console, when i try to run the query with INSERT OVERWRITE to load the output into a separate hive table

INSERT OVERWRITE TABLE $proc_db.$master_table PARTITION(created_dt, country) $master_query

it throws the following error

cannot recognize input near 'WITH' 't' 'as' in statement

The query as follows:

master_query="
WITH t
AS (
SELECT subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt
FROM crm_arrow.birthday
WHERE created_dt = '2016-07-07'
    AND (COUNTRY = 'SG')
GROUP BY subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt

UNION ALL

SELECT subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt
FROM crm_arrow.wishlist
WHERE created_dt = '2016-07-07'
    AND (COUNTRY = 'SG')
GROUP BY subscription_id
    ,country
    ,email_type
    ,email_priority
    ,created_dt

UNION ALL
.....
)
SELECT q.subscription_id
,q.country
,q.email_type
FROM (
SELECT t1.subscription_id
    ,t1.country
    ,DENSE_RANK() OVER (
        PARTITION BY t1.subscription_id
        ,t1.country ORDER BY t1.email_priority
        ) global_rank
    ,CASE
        WHEN t1.email_type = t2.email_type
            THEN t1.email_type
        END email_type
FROM t t1
LEFT JOIN t t2 ON t1.country = t2.country
    AND t1.subscription_id = t2.subscription_id
) q
WHERE q.email_type IS NOT NULL
AND (
    q.global_rank <= 2
    AND country = 'SG'
    )
"

How can i make an efficient self join with a huge inner query ? I have also tried to enclose select statement across the master_query but it's still not working.

Body:
It's just where you put you INSERT statement the problem. See here for an example of how to combine INSERT with a WITH clause

CREATE TABLE ramesh_test
(key          BIGINT,
 text_value   STRING,
 roman_value  STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;

WITH v_text
AS
(SELECT 1 AS key, 'One' AS value),
v_roman
AS
(SELECT 1 AS key, 'I' AS value)
INSERT OVERWRITE TABLE ramesh_test
SELECT v_text.key, v_text.value, v_roman.value
  FROM v_text JOIN v_roman
                ON (v_text.key = v_roman.key);

Position the INSERT above the main SELECT.

Hope this helps!


问:
Why is my Entity Framework Many to Many Table not saving automatically?
I have to classes, VisitModel and VisitorModel, A visitModel can have many VisitorModel and vice versa. After adding both relationship to the modelBuilder, its still not saving to the third auto-generated table. It created the table, but when I try to save, it does not save both Ids. Here is my code:

```<code>public class VisitorModel
{
    public int VisitorModelId { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public bool IsDeleted { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string FullName { get; set; }
    public string Phone { get; set; }
    public string Email { get; set; }
    public string PhotoUrl { get; set; }
    public string Address { get; set; }
    public int BranchId { get; set; }
    public int UserId { get; set; }
    public virtual User User { get; set; }
    public virtual ICollection<VisitModel> VisitModels { get; set; }
}
</code>```

and here is the VisitModel class:

```<code>public class VisitModel
{
    public VisitModel()
    {
        VisitorModels = new List<VisitorModel>();
    }
    public int VisitModelId { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public bool IsDeleted { get; set; }
    public string UserToVisit { get; set; }
    public virtual User User { get; set; }
    public string HostEmail { get; set; }
    public int UserId { get; set; }
    public int VisitorTypeId { get; set; }
    public int PurposeOfVisitId { get; set; }
    public string OtherPurposeOfVisit { get; set; }
    public DateTime ArrivalDate { get; set; }
    public DateTime ArrivalTime { get; set; }
    public DateTime DepartureTime { get; set; }
    public DateTime DepartureDate { get; set; }
    public bool IsCheckedIn { get; set; }
    public bool IsCheckedOut { get; set; }
    public string BookedBy { get; set; }
    public bool IamHost { get; set; }
    public virtual ICollection<VisitorModel> VisitorModels { get; set; }
}
</code>```

And this is the modelBuilder:

```<code>modelBuilder.Entity<VisitModel>()
    .HasMany(up => up.VisitorModels)
    .WithMany(course => course.VisitModels)
    .Map(mc =>
    {
        mc.ToTable("VisitVisitorModel");
        mc.MapLeftKey("VisitModelId");
        mc.MapRightKey("VisitorModelId");
    });
</code>```

When I try to save, it does not save both Ids to the VisitVisitorModel table. The table is always empty. Please what am I doing wrong?

答:
Because you followed the entity framework many-to-many conventions, you don't need a fluent API part to design a junction table.

Entity framework knows, just by looking at your class definitions, that you designed a many-to many relation. Entity Framework will design a proper junction table for you. You should not even mention this junction table in your dbContext:

```<code>class MyDbContext : DbContext
{
    public DbSet<VisitModel> VisitModels {get; set;}
    public DbSet<VistitorModel> VistiroModels {get; set}
}
</code>```

But if I have no DbSet for my junction table, how can I do my joins on VisitModel and VisitorModel?

The answer is: don't use joins, use the ICollections;

Give me Names and Address of all VisitorModels that are not deleted togeter with all the arrival times and departure times of their VisitModels that have checked in Today

Normally you would join VisitorModel with the junction table VisitVisitorModel on VisitModelId and join again on VisitModel on VisitorModelId.

But you could also use the ICollectioins:

```<code>var result = myDbContext.VisitorModels
    .Where(visitorModel => !visitorModel.IsDeleted)
    .Select(visitorModel => new
    {
        // select only the properties of visitorModel you will be using:
        FullName = visitorModel.FullName,
        Address = visitorModel.Address,
        Phone = visitorModel.Phone,
        ... // other properties

        // get ArrivalTime and DepartureTime of all VisitModels that are checked in
        VisitModels = visitorModel.VisitModels
            .Where(visitModel => visitModel.IsCheckedInd)
            .Select(visitModel => new
            {   // again: select only the properties you will be using:
                ArrivalTime = visitModel.ArrivalTime,
                DepartureTime = visitModel.DepartureTime,
                ... // other properties
            })
            .ToList(),
    }
}
</code>```

Because of the proper many-to-many configuration you won't need the junction table, and you won't need to do joins with primary keys and foreign keys. Entity framework will know which joins to do.

Body:
I have to classes, VisitModel and VisitorModel, A visitModel can have many VisitorModel and vice versa. After adding both relationship to the modelBuilder, its still not saving to the third auto-generated table. It created the table, but when I try to save, it does not save both Ids. Here is my code:

public class VisitorModel
{
    public int VisitorModelId { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public bool IsDeleted { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string FullName { get; set; }
    public string Phone { get; set; }
    public string Email { get; set; }
    public string PhotoUrl { get; set; }
    public string Address { get; set; }
    public int BranchId { get; set; }
    public int UserId { get; set; }
    public virtual User User { get; set; }
    public virtual ICollection<VisitModel> VisitModels { get; set; }
}

and here is the VisitModel class:

public class VisitModel
{
    public VisitModel()
    {
        VisitorModels = new List<VisitorModel>();
    }
    public int VisitModelId { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public bool IsDeleted { get; set; }
    public string UserToVisit { get; set; }
    public virtual User User { get; set; }
    public string HostEmail { get; set; }
    public int UserId { get; set; }
    public int VisitorTypeId { get; set; }
    public int PurposeOfVisitId { get; set; }
    public string OtherPurposeOfVisit { get; set; }
    public DateTime ArrivalDate { get; set; }
    public DateTime ArrivalTime { get; set; }
    public DateTime DepartureTime { get; set; }
    public DateTime DepartureDate { get; set; }
    public bool IsCheckedIn { get; set; }
    public bool IsCheckedOut { get; set; }
    public string BookedBy { get; set; }
    public bool IamHost { get; set; }
    public virtual ICollection<VisitorModel> VisitorModels { get; set; }
}

And this is the modelBuilder:

modelBuilder.Entity<VisitModel>()
    .HasMany(up => up.VisitorModels)
    .WithMany(course => course.VisitModels)
    .Map(mc =>
    {
        mc.ToTable("VisitVisitorModel");
        mc.MapLeftKey("VisitModelId");
        mc.MapRightKey("VisitorModelId");
    });

When I try to save, it does not save both Ids to the VisitVisitorModel table. The table is always empty. Please what am I doing wrong?

Body:
Because you followed the entity framework many-to-many conventions, you don't need a fluent API part to design a junction table.

Entity framework knows, just by looking at your class definitions, that you designed a many-to many relation. Entity Framework will design a proper junction table for you. You should not even mention this junction table in your dbContext:

class MyDbContext : DbContext
{
    public DbSet<VisitModel> VisitModels {get; set;}
    public DbSet<VistitorModel> VistiroModels {get; set}
}

But if I have no DbSet for my junction table, how can I do my joins on VisitModel and VisitorModel?

The answer is: don't use joins, use the ICollections;

Give me Names and Address of all VisitorModels that are not deleted togeter with all the arrival times and departure times of their VisitModels that have checked in Today

Normally you would join VisitorModel with the junction table VisitVisitorModel on VisitModelId and join again on VisitModel on VisitorModelId.

But you could also use the ICollectioins:

var result = myDbContext.VisitorModels
    .Where(visitorModel => !visitorModel.IsDeleted)
    .Select(visitorModel => new
    {
        // select only the properties of visitorModel you will be using:
        FullName = visitorModel.FullName,
        Address = visitorModel.Address,
        Phone = visitorModel.Phone,
        ... // other properties

        // get ArrivalTime and DepartureTime of all VisitModels that are checked in
        VisitModels = visitorModel.VisitModels
            .Where(visitModel => visitModel.IsCheckedInd)
            .Select(visitModel => new
            {   // again: select only the properties you will be using:
                ArrivalTime = visitModel.ArrivalTime,
                DepartureTime = visitModel.DepartureTime,
                ... // other properties
            })
            .ToList(),
    }
}

Because of the proper many-to-many configuration you won't need the junction table, and you won't need to do joins with primary keys and foreign keys. Entity framework will know which joins to do.


问:
Display view below RecyclerView (without overlaping)
There are a lot of solutions where the last view is bottom aligned, but I need it to be flexible. Imagine a dialog with a list and positive/negative buttons below. If there are only few elements I'd like it to look like this:

And when there are a lot of items this dialog should expand itself to the bottom, like so:

Layout structure inside LinearLayout is:

```<code>title layout
RecyclerView
buttons layout
</code>```

I tried to wrap RecyclerView inside LinearLayout without succes it just overlap my buttons

答:
The best method is to use the NestedScrollView. Use like this :

```<code><NestedScrollView>
  <LinearLayout>
   <YourTitleLayout>
   <RecyclerView>
   <YourLayoutBelowRecyclerView>
 </LinearLayout>
</NestedScrollView>
</code>```

This nested scrollView ensures that the the items are scrolled one after other as the name suggests. Hope this helps.

Body:
There are a lot of solutions where the last view is bottom aligned, but I need it to be flexible. Imagine a dialog with a list and positive/negative buttons below. If there are only few elements I'd like it to look like this:

And when there are a lot of items this dialog should expand itself to the bottom, like so:

Layout structure inside LinearLayout is:

title layout
RecyclerView
buttons layout

I tried to wrap RecyclerView inside LinearLayout without succes it just overlap my buttons

Body:
The best method is to use the NestedScrollView. Use like this :

<NestedScrollView>
  <LinearLayout>
   <YourTitleLayout>
   <RecyclerView>
   <YourLayoutBelowRecyclerView>
 </LinearLayout>
</NestedScrollView>

This nested scrollView ensures that the the items are scrolled one after other as the name suggests. Hope this helps.


问:
mark duplicate lines and exclude characters from the results
I am using this one-liner to find duplicate lines in a text file:

```<code>:syn clear Repeat | g/^\(.*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch
</code>```

When I execute it on C source files, it correctly returns so many { and break; and empty lines. However, they are not the most interesting lines. Howe I can exclude one or multiple characters from the result of this one-liner?

答:
Wow that was hard.
But i think i got it:

```<code>:syn clear Repeat | g/^\(^\(\(\s*break\;\|\s*{\|\s*}\)\@!.\).*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch
</code>```

It ignores the following 3 patterns:

```<code>\s*break;
\s*}
\s*{
</code>```

You can ad more in the list separated by \|.

As you can easily spot, it isn't really a nice readable solution. You could improve it with the very magic mode see :h \v. But why do you even need the test for 2 same lines? maybe there is a better solution for your whole usecase

Body:
I am using this one-liner to find duplicate lines in a text file:

:syn clear Repeat | g/^\(.*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch

When I execute it on C source files, it correctly returns so many { and break; and empty lines. However, they are not the most interesting lines. Howe I can exclude one or multiple characters from the result of this one-liner?

Body:
Wow that was hard.
But i think i got it:

:syn clear Repeat | g/^\(^\(\(\s*break\;\|\s*{\|\s*}\)\@!.\).*\)\n\ze\%(.*\n\)*\1$/exe 'syn match Repeat "^' . escape(getline('.'), '".\^$*[]') . '$"' | nohlsearch

It ignores the following 3 patterns:

\s*break;
\s*}
\s*{

You can ad more in the list separated by \|.

As you can easily spot, it isn't really a nice readable solution. You could improve it with the very magic mode see :h \v. But why do you even need the test for 2 same lines? maybe there is a better solution for your whole usecase


问:
Equivalent function for DATEADD() in Oracle
I have to get a date that is 6 months from the system date in Oracle.
 And I have to get it by running an open-query from SQL. DATEADD(MONTH,-6, GETDATE())  function serves the purpose in SQL.

Does the function DATEADD(MONTH,-6, GETDATE()) in SQL have an equivalent function in Oracle?

答:
Not my answer :

I wasn't too happy with the answers above and some additional searching yielded this :

```<code>SELECT SYSDATE AS current_date,

       SYSDATE + 1 AS plus_1_day,

       SYSDATE + 1/24 AS plus_1_hours,

       SYSDATE + 1/24/60 AS plus_1_minutes,

       SYSDATE + 1/24/60/60 AS plus_1_seconds

FROM   dual;
</code>```

which I found very helpful. From http://sqlbisam.blogspot.com/2014/01/add-date-interval-to-date-or-dateadd.html

Body:
Not my answer :

I wasn't too happy with the answers above and some additional searching yielded this :

SELECT SYSDATE AS current_date,

       SYSDATE + 1 AS plus_1_day,

       SYSDATE + 1/24 AS plus_1_hours,

       SYSDATE + 1/24/60 AS plus_1_minutes,

       SYSDATE + 1/24/60/60 AS plus_1_seconds

FROM   dual;

which I found very helpful. From http://sqlbisam.blogspot.com/2014/01/add-date-interval-to-date-or-dateadd.html


问:
Displaying a User Email using keycloak Admin Client not working(UnrecognizedPropertyException)
I'm trying to display a userEmail() or to display all the information about a user in our realm in general.

I'm trying to invoke this method :-

```<code>@Test
    public void displayUser(){

        UsersResource users=kc.realm("SpringBoot").users();
        UserResource user=users.get("b3479699-430b-4cd3-be96-d26db584d207"); //Succeeds, we have the user
        UserRepresentation ur=user.toRepresentation();
        System.out.println(ur.getEmail());

    }
</code>```

But it fails, giving me this error:-|

```<code>javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "notBefore" (class org.keycloak.representations.idm.UserRepresentation), not marked as ignorable (25 known properties: "disableableCredentialTypes", "enabled", "emailVerified", "origin", "self", "applicationRoles", "createdTimestamp", "clientRoles", "groups", "username", "totp", "id", "email", "federationLink", "serviceAccountClientId", "lastName", "clientConsents", "socialLinks", "realmRoles", "attributes", "firstName", "credentials", "requiredActions", "federatedIdentities", "access"])
 at [Source: org.apache.http.conn.EofSensorInputStream@4ee203eb; line: 1, column: 248] (through reference chain: org.keycloak.representations.idm.UserRepresentation["notBefore"])
        at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
        at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1093)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1489)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1467)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
        at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1583)
        at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:964)
        at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:127)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:61)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
        at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:55)
        at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:251)
        at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:181)
        at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:213)
        at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:105)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:60)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
        at com.sun.proxy.$Proxy31.toRepresentation(Unknown Source)
        at com.example.keycloakaccess2.KeycloakAccess2ApplicationTests.displayUser(KeycloakAccess2ApplicationTests.java:134)
</code>```

I wonder if there is a proper way to display the information about the user or even to display the users we have in our realm !

I appreciate your help.

答:
Just to make it more visible, I do repeat Sébastien's Blanc answer found in the comments.

The keycloak adapter and client dependencies are not the same version, so Jackson got some fields that cannot be mapped to a class (in this case the field notBefore was not available in the UserRepresentation class).

So in your pom.xml, make sure depencies are the same. For example:

```<code><dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-spring-security-adapter</artifactId>
    <version>3.4.0.Final</version>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>3.4.0.Final</version>
</dependency>
</code>```

Body:
I'm trying to display a userEmail() or to display all the information about a user in our realm in general.

I'm trying to invoke this method :-

@Test
    public void displayUser(){

        UsersResource users=kc.realm("SpringBoot").users();
        UserResource user=users.get("b3479699-430b-4cd3-be96-d26db584d207"); //Succeeds, we have the user
        UserRepresentation ur=user.toRepresentation();
        System.out.println(ur.getEmail());

    }

But it fails, giving me this error:-|

javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "notBefore" (class org.keycloak.representations.idm.UserRepresentation), not marked as ignorable (25 known properties: "disableableCredentialTypes", "enabled", "emailVerified", "origin", "self", "applicationRoles", "createdTimestamp", "clientRoles", "groups", "username", "totp", "id", "email", "federationLink", "serviceAccountClientId", "lastName", "clientConsents", "socialLinks", "realmRoles", "attributes", "firstName", "credentials", "requiredActions", "federatedIdentities", "access"])
 at [Source: org.apache.http.conn.EofSensorInputStream@4ee203eb; line: 1, column: 248] (through reference chain: org.keycloak.representations.idm.UserRepresentation["notBefore"])
        at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
        at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1093)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1489)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1467)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
        at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1583)
        at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:964)
        at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:127)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:61)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
        at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:55)
        at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:251)
        at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:181)
        at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:213)
        at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:105)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:60)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
        at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
        at com.sun.proxy.$Proxy31.toRepresentation(Unknown Source)
        at com.example.keycloakaccess2.KeycloakAccess2ApplicationTests.displayUser(KeycloakAccess2ApplicationTests.java:134)

I wonder if there is a proper way to display the information about the user or even to display the users we have in our realm !

I appreciate your help.

Body:
Just to make it more visible, I do repeat Sébastien's Blanc answer found in the comments.

The keycloak adapter and client dependencies are not the same version, so Jackson got some fields that cannot be mapped to a class (in this case the field notBefore was not available in the UserRepresentation class).

So in your pom.xml, make sure depencies are the same. For example:

<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-spring-security-adapter</artifactId>
    <version>3.4.0.Final</version>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>3.4.0.Final</version>
</dependency>


问:
Python - programmatically import a Python package by name
I have several different repositories from which I need to programmatically import a package with a common name, say my_package, e..g /foo/bar/my_package and /foo/baz/my_package. I need to be able to retrieve my_package from these different repositories and keep them in separate variables.

I've tried to do this with importlib.import_module but it just does not work - I end up with the same package variable.

```<code>os.chdir('/foo/bar')
foobar_my_package = importlib.import_module('my_package')

os.chdir('/foo/baz')
foobaz_my_package = importlib.import_module('my_package')

> foobar_my_package == foobaz_my_package
> True
</code>```

I don't understand why this is happening.

答:
You could try something like this:

```<code>import imp

def myImporter(num, p):
    tup = imp.find_module('__init__', [p])
    module = imp.load_module('package%s' % i, *tup)
    tup[0].close()
    return module

if __name__ == '__main__':
    packages =  {}
    for i, p in enumerate(['/tmp/bar/my_package', '/tmp/foo/my_package']):
        _name = 'package%d' % i
        _module = myImporter(i, p)
        packages[_name] = _module

    for k,v in packages.items():
        print (v.__name__, v.main())
</code>```

For the following directory structure:

```<code>.
├── bar
│   └── my_package
│       └── __init__.py
├── foo
│   └── my_package
│       └── __init__.py
</code>```

Each __init__.py has a main() function:

```<code>def main():
        return "<name>/my_package/main"
</code>```

It returns:

```<code>('package0', 'bar/my_package/main')
('package1', 'foo/my_package/main')
</code>```

Body:
I have several different repositories from which I need to programmatically import a package with a common name, say my_package, e..g /foo/bar/my_package and /foo/baz/my_package. I need to be able to retrieve my_package from these different repositories and keep them in separate variables.

I've tried to do this with importlib.import_module but it just does not work - I end up with the same package variable.

os.chdir('/foo/bar')
foobar_my_package = importlib.import_module('my_package')

os.chdir('/foo/baz')
foobaz_my_package = importlib.import_module('my_package')

> foobar_my_package == foobaz_my_package
> True

I don't understand why this is happening.

Body:
You could try something like this:

import imp

def myImporter(num, p):
    tup = imp.find_module('__init__', [p])
    module = imp.load_module('package%s' % i, *tup)
    tup[0].close()
    return module

if __name__ == '__main__':
    packages =  {}
    for i, p in enumerate(['/tmp/bar/my_package', '/tmp/foo/my_package']):
        _name = 'package%d' % i
        _module = myImporter(i, p)
        packages[_name] = _module

    for k,v in packages.items():
        print (v.__name__, v.main())

For the following directory structure:

.
├── bar
│   └── my_package
│       └── __init__.py
├── foo
│   └── my_package
│       └── __init__.py

Each __init__.py has a main() function:

def main():
        return "<name>/my_package/main"

It returns:

('package0', 'bar/my_package/main')
('package1', 'foo/my_package/main')


问:
Best Fit Rectangle From Set of Coplanar Points in Three.js
First off, I apologize if there is a solution for this somewhere, but I've done a great deal of digging through Three.js and A-Frame docs as well as Stack Overflow and haven't found what I'm looking for.

What I want to do is create a best-fit A-Frame plane from a set of Vector3s that I already know are coplanar. This can be easily done if the angle of the plane is a multiple of 90, but anything else and the .setFromPoints() algorithm for Box3s doesn't work the way I need it to.

The conversion from Three.js to A-Frame I can most likely handle myself, but if anyone wants to tackle that they're more than welcome to. I just need to create a rectangular plane that actually makes sense.

Basically, I want to create an algorithm that does this:

Create the bolded plane, rather than the lighter box/plane with too much wasted space.

I don't want to create custom geometry that perfectly fits the points, which I've already done. I actually do just want an A-Frame plane with nothing but height, width, position, and rotation attributes. I understand this is less precise, but it's far more ideal for what I'm working on.

答: OK, maybe my previous answer is to difficult to implement. Here is another idea: calculate the convex hull of your points (https://en.wikipedia.org/wiki/Graham_scan provides a simple and efficient algorithm with pseudo code). the inner points are not relevant. The optimum rectangle must coincide with at least one of the sides of the convex hull. With all angles of the sides of the convex hull calculate the dimensions of the rectangle with that angle. Then take the minimum.</p>


问:
how to calculate total bytes in cache?
I have the question does anyone know how calculate the total amount of bytes in cache if the byte main memory is 2 MB and the block size is 32 Bytes. Using direct mapping with 32 lines?

Really hard to understand what and how it is done.

Thanks.

答:
The purpose here is to cache some of the data the processor needs in memory. Similarly, there may be a cache between the data in the memory and the disk.

In this case, if a data is needed from the disk, the faster memory can be loaded into the memory by booting. There are of course two possibilities: Hit: hit, cache of the processor's request Miss: lost, access to the memory of the processor's request can not be made from the cache.

The ratios of these numbers also have the following values: hit ratio = hit / hit + miss) Miss ratio = miss / total demand (or hit + loss) For example, suppose that 45 memory access requests and 21 of them are in cache.

In this case, miss = 45 - 21 = 24 hit ratio = 21/45 = 47% loss ratio = 24/45 = 53%

#can you put a plus?

Title: how to calculate total bytes in cache?


问:
PHPUnit bootstrap in PhpStorm
I am working with Zend Framework 2 and I want to run tests for all of my modules in PhpStorm 5.0.4. I have PhpStorm set up to check for tests in myproject/module and it successfully finds my tests. The problem is that it doesn't read my configuration file within each module, which is needed (it points to a bootstrap file).

Here is the directory structure for a module (source):

```<code>/module
    /User
        /tests
            /UserTest
                /Model
                    /UserTest.php
            Bootstrap.php
            phpunit.xml.dist
            TestConfig.php.dist
</code>```

When I run the test, it gives me an error because Bootstrap.php is not run prior to running UserTest.php. All of the files are correct, because if I cd to /myproject/module/User/tests/ and run phpunit within the Terminal, it works fine.

I would like it to use the configuration (and thereby bootstrap) within each module. I tried to use the --configuration option with a relative path, but I couldn't get it to work.

Here is my current configuration:

Any pointers on how I can run the configuration file (and bootstrap) when a module is being tested? That is, a module has its own configuration file and bootstrap.

Thanks in advance.

答:
I make use of the environment variables option in the run configuration to to define a value I can use within a global bootstrap.php to pull in requirements specific to a given module or section of the application.

```<code>class GlobalBootstrap
{

private static $applicationSections = [
    'section_a',
    'section_b',
    'section_c'
];

public static function init()
{
    $localMethod = self::fetchLocalMethod();
    if (!is_null($localMethod)) {
        self::$localMethod();
    } else {
       throw new Exception(
            __CLASS__
            . '::'
            . __FUNCTION__
            . 'Says: No local method has been defined for this test section'
        );
    }
}

private static function fetchLocalMethod()
{
    $section = getenv('APPLICATION_SECTION');
    if (is_null($section) || !in_array($section, self::$applicationSections)) {
        return null;
    }
    $section = preg_replace("/[^a-zA-Z]+/", "", $section);
    $method = 'bootstrap' . ucfirst(strtolower($section));

    return $method;
}

/**
 * Section specific methods
 */

protected static function bootstrapSectiona()
{
    require __DIR__ . '/../../{section_a}/module/Test/Bootstrap.php';
}
}

GlobalBootstrap::init();
</code>```

Any arbitrary variable and value can be created and then referenced in your  bootstrap.php using: getevn(VARIABLE_NAME); This saves a lot of long-winded configuration in PHPStorm, but culd potentially get equally as complex if you're relying on a lot of differing bootstrap functionality.

Title: PHPUnit bootstrap in PhpStorm

Body:
I am working with Zend Framework 2 and I want to run tests for all of my modules in PhpStorm 5.0.4. I have PhpStorm set up to check for tests in myproject/module and it successfully finds my tests. The problem is that it doesn't read my configuration file within each module, which is needed (it points to a bootstrap file).

Here is the directory structure for a module (source):

/module
    /User
        /tests
            /UserTest
                /Model
                    /UserTest.php
            Bootstrap.php
            phpunit.xml.dist
            TestConfig.php.dist

When I run the test, it gives me an error because Bootstrap.php is not run prior to running UserTest.php. All of the files are correct, because if I cd to /myproject/module/User/tests/ and run phpunit within the Terminal, it works fine.

I would like it to use the configuration (and thereby bootstrap) within each module. I tried to use the --configuration option with a relative path, but I couldn't get it to work.

Here is my current configuration:

Any pointers on how I can run the configuration file (and bootstrap) when a module is being tested? That is, a module has its own configuration file and bootstrap.

Thanks in advance.

Body:
I make use of the environment variables option in the run configuration to to define a value I can use within a global bootstrap.php to pull in requirements specific to a given module or section of the application.

class GlobalBootstrap
{

private static $applicationSections = [
    'section_a',
    'section_b',
    'section_c'
];

public static function init()
{
    $localMethod = self::fetchLocalMethod();
    if (!is_null($localMethod)) {
        self::$localMethod();
    } else {
       throw new Exception(
            __CLASS__
            . '::'
            . __FUNCTION__
            . 'Says: No local method has been defined for this test section'
        );
    }
}

private static function fetchLocalMethod()
{
    $section = getenv('APPLICATION_SECTION');
    if (is_null($section) || !in_array($section, self::$applicationSections)) {
        return null;
    }
    $section = preg_replace("/[^a-zA-Z]+/", "", $section);
    $method = 'bootstrap' . ucfirst(strtolower($section));

    return $method;
}

/**
 * Section specific methods
 */

protected static function bootstrapSectiona()
{
    require __DIR__ . '/../../{section_a}/module/Test/Bootstrap.php';
}
}

GlobalBootstrap::init();

Any arbitrary variable and value can be created and then referenced in your  bootstrap.php using: getevn(VARIABLE_NAME); This saves a lot of long-winded configuration in PHPStorm, but culd potentially get equally as complex if you're relying on a lot of differing bootstrap functionality.


问:
python importlib, how to invalidate cache of dynamically loaded file
Given this code, how can I tell python to not use cached sources or reload?

```<code>import importlib.util

spec = importlib.util.spec_from_file_location('test', '~/myfile.py')
test = importlib.util.module_from_spec(spec)
spec.loader.exec_module(test)

test.do_stuff()
</code>```

when the content of myfile.py changes its not picked up, I'm assuming because it's cached. calling importlib.invalidate_caches() did not  help and importlib.reload results in an error saying test is not in sys.modules

答:
Using '~/myfile.py' will not work.

You have to use relative path like this:

'myfile.py'

or absolute path like this:

'/home/your_name/python_code/myfile.py'

Body:
Given this code, how can I tell python to not use cached sources or reload?

import importlib.util

spec = importlib.util.spec_from_file_location('test', '~/myfile.py')
test = importlib.util.module_from_spec(spec)
spec.loader.exec_module(test)

test.do_stuff()

when the content of myfile.py changes its not picked up, I'm assuming because it's cached. calling importlib.invalidate_caches() did not  help and importlib.reload results in an error saying test is not in sys.modules


问:
Center scale animation css3
How can I apply center to this scale animation?

As you see in next example the div dissapear to the right, I need to apply center to the scale animation:

$(document).ready(function() {
    $("button").click(function() {
        $(".container:first").addClass("remove")
    });
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
  width: 200px;
  height: 260px;
  position: relative;
  margin: 0 auto 40px;
  -webkit-perspective: 800px;
  -moz-perspective: 800px;
  -o-perspective: 800px;
  perspective: 800px;
  display: inline-block;
}

#main {
  border: 1px solid black;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: right center;
  -moz-transform-origin: right center;
  -o-transform-origin: right center;
  transform-origin: right center;
}

.card.flipped {
  -webkit-transform: translateX( -100%) rotateY( -180deg);
  -moz-transform: translateX( -100%) rotateY( -180deg);
  -o-transform: translateX( -100%) rotateY( -180deg);
  transform: translateX( -100%) rotateY( -180deg);
}

.card div {
  height: 100%;
  width: 100%;
  color: white;
  text-align: center;
  font-weight: bold;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
  cursor: pointer;
}

.card .front {
  background: red;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card .back p {
  margin: auto;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: right center;
    -moz-transform-origin: right center;
    -o-transform-origin: right center;
    transform-origin: right center;
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}
@keyframes otherAnimation {
    0%   {
        transform: scale(1.0);
    }
    25%  {
        transform: scale(0.75);
    }
    50%  {
        transform: scale(0.50);
    }
    75%  {
        transform: scale(0.25);
    }
    100%{
        transform: scale(0);
    }
}</code>```

Test

MyBack

    <button>Remove</button>

```

答:
Remove the following lines from the .remove class in your CSS.

```<code>-webkit-transform-origin: right center;
-moz-transform-origin: right center;
-o-transform-origin: right center;
transform-origin: right center;
</code>```

Title: Center scale animation css3

Body:
How can I apply center to this scale animation?

As you see in next example the div dissapear to the right, I need to apply center to the scale animation:

$(document).ready(function() {
    $("button").click(function() {
        $(".container:first").addClass("remove")
    });
});

.container {
  width: 200px;
  height: 260px;
  position: relative;
  margin: 0 auto 40px;
  -webkit-perspective: 800px;
  -moz-perspective: 800px;
  -o-perspective: 800px;
  perspective: 800px;
  display: inline-block;
}

#main {
  border: 1px solid black;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: right center;
  -moz-transform-origin: right center;
  -o-transform-origin: right center;
  transform-origin: right center;
}

.card.flipped {
  -webkit-transform: translateX( -100%) rotateY( -180deg);
  -moz-transform: translateX( -100%) rotateY( -180deg);
  -o-transform: translateX( -100%) rotateY( -180deg);
  transform: translateX( -100%) rotateY( -180deg);
}

.card div {
  height: 100%;
  width: 100%;
  color: white;
  text-align: center;
  font-weight: bold;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
  cursor: pointer;
}

.card .front {
  background: red;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card .back p {
  margin: auto;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: right center;
    -moz-transform-origin: right center;
    -o-transform-origin: right center;
    transform-origin: right center;
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}
@keyframes otherAnimation {
    0%   {
        transform: scale(1.0);
    }
    25%  {
        transform: scale(0.75);
    }
    50%  {
        transform: scale(0.50);
    }
    75%  {
        transform: scale(0.25);
    }
    100%{
        transform: scale(0);
    }
}

Test

MyBack

    <button>Remove</button>

Body:
Remove the following lines from the .remove class in your CSS.

-webkit-transform-origin: right center;
-moz-transform-origin: right center;
-o-transform-origin: right center;
transform-origin: right center;


答:
You specified the transform-origin: right center inside the .remove class:

```<code>.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: right center;  // Remove this line
    -moz-transform-origin: right center;     // Remove this line
    -o-transform-origin: right center;       // Remove this line
    transform-origin: right center;          // Remove this line
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}
</code>```

You can just remove the lines because center center is the default behavior

Title: Center scale animation css3

Body:
You specified the transform-origin: right center inside the .remove class:

.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: right center;  // Remove this line
    -moz-transform-origin: right center;     // Remove this line
    -o-transform-origin: right center;       // Remove this line
    transform-origin: right center;          // Remove this line
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}

You can just remove the lines because center center is the default behavior


问:
ILE RPG: Using QMHSNDPM, call stack entry not found
I am attempting to wade into the pool of MVC for RPG ILE.  So I have two modules VIEW, and MODEL, that are bound to my main program CNTRL.  I validate information entered in my VIEW module with calls to the MODEL module, and then pass back to the View any errors.  When I try to use the QHNSNDPM api, I see the error in the job log, followed by CALL STACK ENTRY NOT FOUND.  I tried to find theVIEW module on the call stack, and it is not there.  Not being super strong in DDS and the ILE, I am not sure how/what to do about this error.  Any Suggestions would be greatly appreciated!

The DCL-F DISPLAY WORKSTN; is in the VIEW module.

And now for a little code from the VIEW Module....

```<code>   dcl-pr SendMsg Extpgm('QMHSNDPM');
     MsgID char(7) const;
     MsgF  char(20) const;
     MsgData char(30) const;
     MsgDataLen  int(10) const;
     MsgType char(10) const;
     CallStackEnt char(10) const;
     CallStackCtr int(10) const;
     MsgKey char(4) const;
     Error  like(ErrorDS);

   end-pr;
  *******************************************************************

   dcl-proc VIEW_SetError EXPORT;
     dcl-pi *n;
        Msg int(3);
        MSGQ char(10);
     end-pi ;
     // The MSGQ parameter is from the PSDS *PROC
     // I tried having this defined in the view where the DDS file
     // is defined, and I have tried with it defined in the main CNTRL program

     Dcl-s MsgTxt char(30);

     if Msg=1;
        MsgTxt='Invalid Facility';
        AT1FAC=setAttr(*omit:'RI');
     elseif Msg=2;
         MsgTxt='Status must be O, C, or A!';
         AT1STAT=setAttr(*omit:'RI');
     elseif Msg=3;
         MsgTxt='Invalid Order Number';
         AT1ITEM=setAttr(*omit:'RI');
     elseif Msg=4;
         MsgTxt='Invalid Vendor Number';
         AT1VEND=setAttr(*omit:'RI');
     elseif Msg=5;
         MsgTxt='Invalid Pallet Number';
         AT1PLT=setAttr(*omit:'RI');
     endif;

      callp  SendMsg (*blanks: *blanks :
             MsgTxt : %size(MsgTxt):
            '*INFO': '*':
              0: *blanks: ErrorDS);
      // I have tried setting the CallStackEnt to * and C
      // And the CallStackCtr to 0,1,2
     write msgctl;

   end-proc ;
</code>```

and the DDS for DISPLAY....

```<code>     A                                      DSPSIZ(24 80 *DS3)
 A                                      CHGINPDFT(UL FE)
 A                                      PRINT
 A                                      HELP
 A                                      ALTHELP(CA01)
 A*                                     ALTPAGEUP(CF07)
 A*                                     ALTPAGEDWN(CF08)
 A                                      CF03(03)
 A                                      CF04(04)
 A                                      CF06(06)
 A                                      CF12(12)
  *------------------------------------------------------------------*
  * Screen 1 - Filter Criteria
  *------------------------------------------------------------------*
 A          R SCREEN1

 A                                      OVERLAY
 A                                      BLINK
 A                                      RTNCSRLOC(&REC1 &FLD1)
 A                                      CSRLOC(XROW1 XCOL1)
 A            XROW1          3S 0H
 A            XCOL1          3S 0H
 A            REC1          10A  H
 A            FLD1          10A  H
 A                                  1  2'SCN200-01'
 A                                      COLOR(BLU)
 A            COMPANY       40A  O  1 20DSPATR(HI)
 A            WSID          10A  O  1 62
 A                                  1 73DATE
 A                                      EDTCDE(Y)
 A                                  2  2SYSNAME
 A                                  2 23'Pallet Maintenance'
 A                                      COLOR(BLU)
 A                                  2 62USER
 A                                  2 73TIME
 A                                  5  4'Enter Facility to Search'
 A                                      COLOR(BLU)
 A                                  7  7'Facility:'
 A            DFAC1          2   B  7 21
 A                                      DSPATR(&AT1FAC)
 A            AT1FAC         1A  P
 A                                  7 24'+'
 A                                  8  2'Pallet Status:'
 A            DSTAT          1   B  8 21
 A                                      DSPATR(&AT1STAT)
 A            AT1STAT        1A  P
 A                                  8 24'(O=Open, C=Closed, or A=All)'
 A                                 10  4'Search by Item and/or Vendor:'
 A                                      COLOR(BLU)
 A                                 11 11'Item:'
 A            DITM1         15A  B 11 21
 A                                      DSPATR(&AT1ITEM)
 A            AT1ITEM        1A  P
 A                                 11 37'+  (Blank=All)'
 A                                 12  9'Vendor:'
 A            DVND1          5S 0B 12 21
 A                                      DSPATR(&AT1VEND)
 A            AT1VEND        1A  P
 A                                 12 28'+           (Blank=All)'
 A                                 15  7'Or By Pallet ID:'
 A                                      COLOR(BLU)
 A                                 16  9'Pallet:'
 A            DPLT1         11A  B 16 21
 A                                      DSPATR(&AT1PLT)
 A            AT1PLT         1A  P
 A                                 18  4'IF ALL SEARCH FIELDS LEFT BLANK, +
 A                                       ALL FACILITY RECORDS'
 A                                      COLOR(BLU)
 A                                 19  6 'DISPLAYED IN PALLET ID ORDER.'
 A                                      COLOR(BLU)
 A                                 23  2'F3=Exit'
 A                                      COLOR(BLU)
  *------------------------------------------------------------------*
  * Message Subfile
  *------------------------------------------------------------------*
 A          R MSGRCD                    TEXT('MSG SFL RECORD')
 A                                      SFL SFLMSGRCD(24)
 A            MSGKEY                    SFLMSGKEY
 A            PGMSGQ                    SFLPGMQ
  *------------------------------------------------------------------*
  * Message Subfile Control
  *------------------------------------------------------------------*
 A          R MSGCTL                    TEXT('MSG SFL CONTROL')
 A                                      OVERLAY SFLCTL(MSGRCD) SFLSIZ(10)
 A                                      SFLPAG(1) SFLDSPCTL SFLDSP SFLINZ
 A N98                                  SFLEND
 A            PGMSGQ                    SFLPGMQ
</code>```

Here is the CL that starts the process....its pretty basic, but we use a lot of overrides in our legacy code, so I thought it would help to start with a CL...

```<code>         PGM

         DCL        VAR(&COMPANY) TYPE(*CHAR) LEN(40) VALUE('BROWNFOX')
         CALL       PGM(CNTRL) PARM(&Company)
         ENDPGM
</code>```

By the way, the company bit is a relic to my testing.  I have added the Company retrieval from the service program.

And the CNTRL RPGLE...

```<code>       ctl-opt dftactgrp(*no) BNDDIR('MVC');
  *------------------------------------------------------------------*
  * Mainline processing
  *------------------------------------------------------------------*
   /define MODEL_PalletMaintenance
   /copy TEMPLATE/QCPYSRC,MODEL
   /undefine MODEL_PalletMaintenance
    /define VIEW_GetParms
   /copy TEMPLATE/QCPYSRC,VIEW
   /undefine VIEW_GetParms

   dcl-ds *N PSDS;
     PGMSGQ           *PROC;
     WSID CHAR(10) Pos(244);
     USER CHAR(10) Pos(254);
   end-ds;

   //dcl-s Exit ind;
   //dcl-s ErrorField char(30);
   dcl-s ErrorText char(30);
   dcl-s ErrorID   int(3);
   //dcl-ds Screen1DS likeDS(Screen1);
   dcl-s CurrentStep int(5);
   dcl-c StepExit 0;
   dcl-c StepPrep 1;
   dcl-c StepShowScreen1 2;
   dcl-c StepValidateScreen1 3;
   //dcl-c StepShowScreen2 0;

   dcl-pr cntrl EXTPGM  ;
   END-PR;
   //dcl-PROC cntrl;
    dcl-pi *n;
    END-PI;

   CurrentStep=StepPrep;

   DoU CurrentStep=StepExit;

     select;
       When CurrentStep=StepPrep;
         VIEW_Prep(Screen1DS);
         MODEL_Prep(Screen1DS);
         CurrentStep=StepShowScreen1;
       When CurrentStep=StepShowScreen1;
         if (VIEW_GetParms(Screen1DS));
           CurrentStep=StepValidateScreen1;
         else;
           CurrentStep=StepExit;
         ENDIF;
       When CurrentStep=StepValidateScreen1;
         ErrorID=MODEL_ValidateScreen1(Screen1DS);
         if (ErrorID<>0);
           VIEW_SetError(ErrorID:PGMSGQ);
           CurrentStep=StepShowScreen1;
         else;
           CurrentStep=StepExit;
         ENDIF;
       ENDSL;
   enddo;
   *INLR=*on;
   Return;
</code>```

And I guess if I've taken it this far, I might as well throw in the copy members

MODEL Copy

```<code>       /if defined(MODEL_PalletMaintenance)

   dcl-ds Screen1DS qualified;
     Company  char(40);
     Facility char(2);
     Status char(1);
     Item char(35);
     Vendor zoned(5:0);
     Pallet char(11);
   END-DS;

   DCL-PR MODEL_Prep;
     *n likeds(Screen1DS);
   END-PR;
   DCL-PR MODEL_ValidateScreen1 int(3);
     *n likeds(Screen1DS);
   END-PR;
   /endif
</code>```

And View....

```<code>  /if defined(VIEW_GetParms)

   dcl-ds VScreen1DS qualified;
     Company  char(40);
     Facility char(2);
     Status char(1);
     Item char(35);
     Vendor zoned(5:0);
     Pallet char(11);
   END-DS;

    DCL-PR VIEW_Prep;
     *n likeds(VScreen1DS);
   END-PR;

   DCL-PR VIEW_GetParms Ind;
     *n likeds(VScreen1DS);
   END-PR;

   DCL-PR screen1ResetIndicators;
   END-PR;

   DCL-PR ClearScreen1;
   END-PR;

   DCL-PR VIEW_SetError;
     *n int(3);
     *n char(10);
   END-PR;

   /endif
</code>```

答:
// The MSGQ parameter is from the PSDS *PROC

  // I tried having this defined in the view where the DDS file

  // is defined, and I have tried with it defined in the main CNTRL program

So on the program stack, each stack entry has a message queue. You are stating that the message queue that you are using to initialize your message subfile is comming from the PSDS *PROC. So you need to send your messages to the same stack entry. The way I do this is to populate StackEntry and PGMMSGQ with the same variable, and make the Stack Counter 0.

This is my procedure for sending a message to the message subfile (I keep it in a service program):

```<code>   // ----------------------------------------
   // SndDspfMsgText - sends an *INFO message to the
   //     message subfile in a display file.
   //
   // Parameters:
   //  StackEntry - The program call stack entry to which the message is sent.
   //               Usually the program name. This must be the same value that
   //               is placed in the SFLPGMQ variable in the message subfile
   //               control format.
   //  MsgText -    Text of the messqage to be sent.
   //  MsgTextLen - The length of the message text provided above.
   // ----------------------------------------
   dcl-proc SndDspfMsgText Export;
     dcl-pi *n;
       StkEnt      Char(10)  Const;
       MsgText     Char(512) Const Options(*VarSize);
       MsgTextLen  Int(10)   Const;
     end-pi;

     dcl-ds MsgFile       LikeDs(QualName_t) Inz(*LikeDs);
     dcl-ds ErrorCd       LikeDs(ErrorCdType1_t) Inz(*LikeDs);

     dcl-s pmMsgId          Char(7)   Inz('CPF9898');
     dcl-s pmMsgText        Char(512) Inz('');
     dcl-s pmMsgTextLen     Int(10)   Inz(0);
     dcl-s pmMsgTyp         Char(10)  Inz('*INFO');
     dcl-s pmStkCnt         Int(10)   Inz(0);
     dcl-s pmMsgKey         Char(4)   Inz('');

     // if Message Data is provided,
     if MsgTextLen > 0;
       pmMsgTextLen = min(%size(MsgText): MsgTextLen);
       pmMsgText = %subst(MsgText: 1: pmMsgTextLen);
     endif;

     MsgFile.Name = 'QCPFMSG';
     qmhsndpm(pmMsgId: MsgFile: pmMsgText: pmMsgTextLen:
              pmMsgTyp: StkEnt: pmStkCnt: pmMsgKey:
              ErrorCd);
   end-proc;
</code>```

Here are a couple templates you are going to need to fully understand the above procedure:

```<code>   // Standard Error Code Format
   dcl-ds ErrorCdType1_t   Qualified Template Inz;
     BytesProv             Int(10)   Inz(%size(ErrorCdType1_t));
     BytesAvail            Int(10);
     MsgId                 Char(7);
     Data                  Char(1024) Pos(17);
   end-ds;

   // Qualified Name
   dcl-s Name_t            Char(10) Template Inz('');
   dcl-ds QualName_t       Qualified Template Inz;
     Name                  Like(Name_t) Inz('');
     Lib                   Like(Name_t) Inz('*LIBL');
   end-ds;

   // Call Stack Qualifier - used by message handling APIs
   dcl-ds CallStackQual_t  Qualified Template Inz;
     Module                Like(Name_t) Inz('*NONE');
     Program               Like(Name_t) Inz('*NONE');
   end-ds;

   // Send Program Message
   dcl-pr qmhsndpm      ExtPgm('QMHSNDPM');
     MessageId              Char(7)    Const;
     MessageFile            LikeDs(QualName_t) Const;
     MessageDta             Char(512)  Const Options(*Varsize);
     MessageLen             Int(10)    Const;
     MessageType            Char(10)   Const;
     StackEntry             Char(4102) Const Options(*Varsize);
     StackCounter           Int(10)    Const;
     MessageKey             Char(4);
     Error                  LikeDs(ErrorCdType1_t);
     StackEntryLen          Int(10)    Const Options(*NoPass);
     StackEntryQual         LikeDs(CallStackQual_t)
                                       Const Options(*NoPass);
     ScreenWaitTime         Int(10)    Const Options(*NoPass);
     StackEntryType         Char(10)   Const Options(*NoPass);
     Ccsid                  Int(10)    Const Options(*NoPass);
   end-pr;
</code>```

Body:
I am attempting to wade into the pool of MVC for RPG ILE.  So I have two modules VIEW, and MODEL, that are bound to my main program CNTRL.  I validate information entered in my VIEW module with calls to the MODEL module, and then pass back to the View any errors.  When I try to use the QHNSNDPM api, I see the error in the job log, followed by CALL STACK ENTRY NOT FOUND.  I tried to find theVIEW module on the call stack, and it is not there.  Not being super strong in DDS and the ILE, I am not sure how/what to do about this error.  Any Suggestions would be greatly appreciated!

The DCL-F DISPLAY WORKSTN; is in the VIEW module.

And now for a little code from the VIEW Module....

   dcl-pr SendMsg Extpgm('QMHSNDPM');
     MsgID char(7) const;
     MsgF  char(20) const;
     MsgData char(30) const;
     MsgDataLen  int(10) const;
     MsgType char(10) const;
     CallStackEnt char(10) const;
     CallStackCtr int(10) const;
     MsgKey char(4) const;
     Error  like(ErrorDS);

   end-pr;
  *******************************************************************

   dcl-proc VIEW_SetError EXPORT;
     dcl-pi *n;
        Msg int(3);
        MSGQ char(10);
     end-pi ;
     // The MSGQ parameter is from the PSDS *PROC
     // I tried having this defined in the view where the DDS file
     // is defined, and I have tried with it defined in the main CNTRL program

     Dcl-s MsgTxt char(30);

     if Msg=1;
        MsgTxt='Invalid Facility';
        AT1FAC=setAttr(*omit:'RI');
     elseif Msg=2;
         MsgTxt='Status must be O, C, or A!';
         AT1STAT=setAttr(*omit:'RI');
     elseif Msg=3;
         MsgTxt='Invalid Order Number';
         AT1ITEM=setAttr(*omit:'RI');
     elseif Msg=4;
         MsgTxt='Invalid Vendor Number';
         AT1VEND=setAttr(*omit:'RI');
     elseif Msg=5;
         MsgTxt='Invalid Pallet Number';
         AT1PLT=setAttr(*omit:'RI');
     endif;

      callp  SendMsg (*blanks: *blanks :
             MsgTxt : %size(MsgTxt):
            '*INFO': '*':
              0: *blanks: ErrorDS);
      // I have tried setting the CallStackEnt to * and C
      // And the CallStackCtr to 0,1,2
     write msgctl;

   end-proc ;

and the DDS for DISPLAY....

     A                                      DSPSIZ(24 80 *DS3)
 A                                      CHGINPDFT(UL FE)
 A                                      PRINT
 A                                      HELP
 A                                      ALTHELP(CA01)
 A*                                     ALTPAGEUP(CF07)
 A*                                     ALTPAGEDWN(CF08)
 A                                      CF03(03)
 A                                      CF04(04)
 A                                      CF06(06)
 A                                      CF12(12)
  *------------------------------------------------------------------*
  * Screen 1 - Filter Criteria
  *------------------------------------------------------------------*
 A          R SCREEN1

 A                                      OVERLAY
 A                                      BLINK
 A                                      RTNCSRLOC(&REC1 &FLD1)
 A                                      CSRLOC(XROW1 XCOL1)
 A            XROW1          3S 0H
 A            XCOL1          3S 0H
 A            REC1          10A  H
 A            FLD1          10A  H
 A                                  1  2'SCN200-01'
 A                                      COLOR(BLU)
 A            COMPANY       40A  O  1 20DSPATR(HI)
 A            WSID          10A  O  1 62
 A                                  1 73DATE
 A                                      EDTCDE(Y)
 A                                  2  2SYSNAME
 A                                  2 23'Pallet Maintenance'
 A                                      COLOR(BLU)
 A                                  2 62USER
 A                                  2 73TIME
 A                                  5  4'Enter Facility to Search'
 A                                      COLOR(BLU)
 A                                  7  7'Facility:'
 A            DFAC1          2   B  7 21
 A                                      DSPATR(&AT1FAC)
 A            AT1FAC         1A  P
 A                                  7 24'+'
 A                                  8  2'Pallet Status:'
 A            DSTAT          1   B  8 21
 A                                      DSPATR(&AT1STAT)
 A            AT1STAT        1A  P
 A                                  8 24'(O=Open, C=Closed, or A=All)'
 A                                 10  4'Search by Item and/or Vendor:'
 A                                      COLOR(BLU)
 A                                 11 11'Item:'
 A            DITM1         15A  B 11 21
 A                                      DSPATR(&AT1ITEM)
 A            AT1ITEM        1A  P
 A                                 11 37'+  (Blank=All)'
 A                                 12  9'Vendor:'
 A            DVND1          5S 0B 12 21
 A                                      DSPATR(&AT1VEND)
 A            AT1VEND        1A  P
 A                                 12 28'+           (Blank=All)'
 A                                 15  7'Or By Pallet ID:'
 A                                      COLOR(BLU)
 A                                 16  9'Pallet:'
 A            DPLT1         11A  B 16 21
 A                                      DSPATR(&AT1PLT)
 A            AT1PLT         1A  P
 A                                 18  4'IF ALL SEARCH FIELDS LEFT BLANK, +
 A                                       ALL FACILITY RECORDS'
 A                                      COLOR(BLU)
 A                                 19  6 'DISPLAYED IN PALLET ID ORDER.'
 A                                      COLOR(BLU)
 A                                 23  2'F3=Exit'
 A                                      COLOR(BLU)
  *------------------------------------------------------------------*
  * Message Subfile
  *------------------------------------------------------------------*
 A          R MSGRCD                    TEXT('MSG SFL RECORD')
 A                                      SFL SFLMSGRCD(24)
 A            MSGKEY                    SFLMSGKEY
 A            PGMSGQ                    SFLPGMQ
  *------------------------------------------------------------------*
  * Message Subfile Control
  *------------------------------------------------------------------*
 A          R MSGCTL                    TEXT('MSG SFL CONTROL')
 A                                      OVERLAY SFLCTL(MSGRCD) SFLSIZ(10)
 A                                      SFLPAG(1) SFLDSPCTL SFLDSP SFLINZ
 A N98                                  SFLEND
 A            PGMSGQ                    SFLPGMQ

Here is the CL that starts the process....its pretty basic, but we use a lot of overrides in our legacy code, so I thought it would help to start with a CL...

         PGM

         DCL        VAR(&COMPANY) TYPE(*CHAR) LEN(40) VALUE('BROWNFOX')
         CALL       PGM(CNTRL) PARM(&Company)
         ENDPGM

By the way, the company bit is a relic to my testing.  I have added the Company retrieval from the service program.

And the CNTRL RPGLE...

       ctl-opt dftactgrp(*no) BNDDIR('MVC');
  *------------------------------------------------------------------*
  * Mainline processing
  *------------------------------------------------------------------*
   /define MODEL_PalletMaintenance
   /copy TEMPLATE/QCPYSRC,MODEL
   /undefine MODEL_PalletMaintenance
    /define VIEW_GetParms
   /copy TEMPLATE/QCPYSRC,VIEW
   /undefine VIEW_GetParms

   dcl-ds *N PSDS;
     PGMSGQ           *PROC;
     WSID CHAR(10) Pos(244);
     USER CHAR(10) Pos(254);
   end-ds;

   //dcl-s Exit ind;
   //dcl-s ErrorField char(30);
   dcl-s ErrorText char(30);
   dcl-s ErrorID   int(3);
   //dcl-ds Screen1DS likeDS(Screen1);
   dcl-s CurrentStep int(5);
   dcl-c StepExit 0;
   dcl-c StepPrep 1;
   dcl-c StepShowScreen1 2;
   dcl-c StepValidateScreen1 3;
   //dcl-c StepShowScreen2 0;

   dcl-pr cntrl EXTPGM  ;
   END-PR;
   //dcl-PROC cntrl;
    dcl-pi *n;
    END-PI;

   CurrentStep=StepPrep;

   DoU CurrentStep=StepExit;

     select;
       When CurrentStep=StepPrep;
         VIEW_Prep(Screen1DS);
         MODEL_Prep(Screen1DS);
         CurrentStep=StepShowScreen1;
       When CurrentStep=StepShowScreen1;
         if (VIEW_GetParms(Screen1DS));
           CurrentStep=StepValidateScreen1;
         else;
           CurrentStep=StepExit;
         ENDIF;
       When CurrentStep=StepValidateScreen1;
         ErrorID=MODEL_ValidateScreen1(Screen1DS);
         if (ErrorID<>0);
           VIEW_SetError(ErrorID:PGMSGQ);
           CurrentStep=StepShowScreen1;
         else;
           CurrentStep=StepExit;
         ENDIF;
       ENDSL;
   enddo;
   *INLR=*on;
   Return;

And I guess if I've taken it this far, I might as well throw in the copy members

MODEL Copy

       /if defined(MODEL_PalletMaintenance)

   dcl-ds Screen1DS qualified;
     Company  char(40);
     Facility char(2);
     Status char(1);
     Item char(35);
     Vendor zoned(5:0);
     Pallet char(11);
   END-DS;

   DCL-PR MODEL_Prep;
     *n likeds(Screen1DS);
   END-PR;
   DCL-PR MODEL_ValidateScreen1 int(3);
     *n likeds(Screen1DS);
   END-PR;
   /endif

And View....

  /if defined(VIEW_GetParms)

   dcl-ds VScreen1DS qualified;
     Company  char(40);
     Facility char(2);
     Status char(1);
     Item char(35);
     Vendor zoned(5:0);
     Pallet char(11);
   END-DS;

    DCL-PR VIEW_Prep;
     *n likeds(VScreen1DS);
   END-PR;

   DCL-PR VIEW_GetParms Ind;
     *n likeds(VScreen1DS);
   END-PR;

   DCL-PR screen1ResetIndicators;
   END-PR;

   DCL-PR ClearScreen1;
   END-PR;

   DCL-PR VIEW_SetError;
     *n int(3);
     *n char(10);
   END-PR;

   /endif

Body:
// The MSGQ parameter is from the PSDS *PROC

  // I tried having this defined in the view where the DDS file

  // is defined, and I have tried with it defined in the main CNTRL program

So on the program stack, each stack entry has a message queue. You are stating that the message queue that you are using to initialize your message subfile is comming from the PSDS *PROC. So you need to send your messages to the same stack entry. The way I do this is to populate StackEntry and PGMMSGQ with the same variable, and make the Stack Counter 0.

This is my procedure for sending a message to the message subfile (I keep it in a service program):

   // ----------------------------------------
   // SndDspfMsgText - sends an *INFO message to the
   //     message subfile in a display file.
   //
   // Parameters:
   //  StackEntry - The program call stack entry to which the message is sent.
   //               Usually the program name. This must be the same value that
   //               is placed in the SFLPGMQ variable in the message subfile
   //               control format.
   //  MsgText -    Text of the messqage to be sent.
   //  MsgTextLen - The length of the message text provided above.
   // ----------------------------------------
   dcl-proc SndDspfMsgText Export;
     dcl-pi *n;
       StkEnt      Char(10)  Const;
       MsgText     Char(512) Const Options(*VarSize);
       MsgTextLen  Int(10)   Const;
     end-pi;

     dcl-ds MsgFile       LikeDs(QualName_t) Inz(*LikeDs);
     dcl-ds ErrorCd       LikeDs(ErrorCdType1_t) Inz(*LikeDs);

     dcl-s pmMsgId          Char(7)   Inz('CPF9898');
     dcl-s pmMsgText        Char(512) Inz('');
     dcl-s pmMsgTextLen     Int(10)   Inz(0);
     dcl-s pmMsgTyp         Char(10)  Inz('*INFO');
     dcl-s pmStkCnt         Int(10)   Inz(0);
     dcl-s pmMsgKey         Char(4)   Inz('');

     // if Message Data is provided,
     if MsgTextLen > 0;
       pmMsgTextLen = min(%size(MsgText): MsgTextLen);
       pmMsgText = %subst(MsgText: 1: pmMsgTextLen);
     endif;

     MsgFile.Name = 'QCPFMSG';
     qmhsndpm(pmMsgId: MsgFile: pmMsgText: pmMsgTextLen:
              pmMsgTyp: StkEnt: pmStkCnt: pmMsgKey:
              ErrorCd);
   end-proc;

Here are a couple templates you are going to need to fully understand the above procedure:

   // Standard Error Code Format
   dcl-ds ErrorCdType1_t   Qualified Template Inz;
     BytesProv             Int(10)   Inz(%size(ErrorCdType1_t));
     BytesAvail            Int(10);
     MsgId                 Char(7);
     Data                  Char(1024) Pos(17);
   end-ds;

   // Qualified Name
   dcl-s Name_t            Char(10) Template Inz('');
   dcl-ds QualName_t       Qualified Template Inz;
     Name                  Like(Name_t) Inz('');
     Lib                   Like(Name_t) Inz('*LIBL');
   end-ds;

   // Call Stack Qualifier - used by message handling APIs
   dcl-ds CallStackQual_t  Qualified Template Inz;
     Module                Like(Name_t) Inz('*NONE');
     Program               Like(Name_t) Inz('*NONE');
   end-ds;

   // Send Program Message
   dcl-pr qmhsndpm      ExtPgm('QMHSNDPM');
     MessageId              Char(7)    Const;
     MessageFile            LikeDs(QualName_t) Const;
     MessageDta             Char(512)  Const Options(*Varsize);
     MessageLen             Int(10)    Const;
     MessageType            Char(10)   Const;
     StackEntry             Char(4102) Const Options(*Varsize);
     StackCounter           Int(10)    Const;
     MessageKey             Char(4);
     Error                  LikeDs(ErrorCdType1_t);
     StackEntryLen          Int(10)    Const Options(*NoPass);
     StackEntryQual         LikeDs(CallStackQual_t)
                                       Const Options(*NoPass);
     ScreenWaitTime         Int(10)    Const Options(*NoPass);
     StackEntryType         Char(10)   Const Options(*NoPass);
     Ccsid                  Int(10)    Const Options(*NoPass);
   end-pr;


答:
Edit your .remove class in your CSS to:

```<code>transform-origin: center;
</code>```

Or just remove all references to transform-origin in this class as the default is center anyway.

$(document).ready(function() {
    $("button").click(function() {
        $(".container:first").addClass("remove")
    });
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
  width: 200px;
  height: 260px;
  position: relative;
  margin: 0 auto 40px;
  -webkit-perspective: 800px;
  -moz-perspective: 800px;
  -o-perspective: 800px;
  perspective: 800px;
  display: inline-block;
}

#main {
  border: 1px solid black;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: right center;
  -moz-transform-origin: right center;
  -o-transform-origin: right center;
  transform-origin: right center;
}

.card.flipped {
  -webkit-transform: translateX( -100%) rotateY( -180deg);
  -moz-transform: translateX( -100%) rotateY( -180deg);
  -o-transform: translateX( -100%) rotateY( -180deg);
  transform: translateX( -100%) rotateY( -180deg);
}

.card div {
  height: 100%;
  width: 100%;
  color: white;
  text-align: center;
  font-weight: bold;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
  cursor: pointer;
}

.card .front {
  background: red;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card .back p {
  margin: auto;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: center;
    -moz-transform-origin: center;
    -o-transform-origin: center;
    transform-origin: center;
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}
@keyframes otherAnimation {
    0%   {
        transform: scale(1.0);
    }
    25%  {
        transform: scale(0.75);
    }
    50%  {
        transform: scale(0.50);
    }
    75%  {
        transform: scale(0.25);
    }
    100%{
        transform: scale(0);
    }
}</code>```

Test

MyBack

    <button>Remove</button>

```

Title: Center scale animation css3

Body:
Edit your .remove class in your CSS to:

transform-origin: center;

Or just remove all references to transform-origin in this class as the default is center anyway.

$(document).ready(function() {
    $("button").click(function() {
        $(".container:first").addClass("remove")
    });
});

.container {
  width: 200px;
  height: 260px;
  position: relative;
  margin: 0 auto 40px;
  -webkit-perspective: 800px;
  -moz-perspective: 800px;
  -o-perspective: 800px;
  perspective: 800px;
  display: inline-block;
}

#main {
  border: 1px solid black;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  -o-transition: -o-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transform-origin: right center;
  -moz-transform-origin: right center;
  -o-transform-origin: right center;
  transform-origin: right center;
}

.card.flipped {
  -webkit-transform: translateX( -100%) rotateY( -180deg);
  -moz-transform: translateX( -100%) rotateY( -180deg);
  -o-transform: translateX( -100%) rotateY( -180deg);
  transform: translateX( -100%) rotateY( -180deg);
}

.card div {
  height: 100%;
  width: 100%;
  color: white;
  text-align: center;
  font-weight: bold;
  position: absolute;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -o-backface-visibility: hidden;
  backface-visibility: hidden;
  cursor: pointer;
}

.card .front {
  background: red;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card .back p {
  margin: auto;
}

.card .back {
  background: blue;
  -webkit-transform: rotateY( 180deg);
  -moz-transform: rotateY( 180deg);
  -o-transform: rotateY( 180deg);
  transform: rotateY( 180deg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.remove{
    -webkit-transition: -webkit-transform 1s;
    -moz-transition: -moz-transform 1s;
    -o-transition: -o-transform 1s;
    transition: transform 1s;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform-origin: center;
    -moz-transform-origin: center;
    -o-transform-origin: center;
    transform-origin: center;
    animation: removeAnim 0.5s ease,
    otherAnimation 0.5s ease;
}
@keyframes otherAnimation {
    0%   {
        transform: scale(1.0);
    }
    25%  {
        transform: scale(0.75);
    }
    50%  {
        transform: scale(0.50);
    }
    75%  {
        transform: scale(0.25);
    }
    100%{
        transform: scale(0);
    }
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container-fluid">
  <div id="main"><br>
    <section class="container">
      <div class="card">
        <div class="front">
          <p>Test</p>
        </div>
        <div class="back">
          <p>MyBack</p>
        </div>
      </div>
    </section>
    <button>Remove</button>
  </div>
</div>


问:
return selected properties with Joined complete entity
i need to return custom response, so i tried below query

```<code> @Query("SELECT g.name as name,g.id as id, city as city, g.listOfEquipment as listOfEquipment,g.listOfSlot as listOfSlot" +
            " FROM Gym g INNER JOIN g.city as city " +
            "WHERE city.id=:cityId")
    List<Map<String, Object>> listing(@Param("cityId") Integer cityId, Pageable pageable);
</code>```

as you can see my intention is to return city and listOfEquipment and listOfSlot also.

i was thinking this will works but unfortunately its not working
i am getting PSQLException: ERROR: syntax error at or near "."

please help me for the right approach

答:
Try to join like below.</p>

```<code>FROM Gym g INNER JOIN  city
</code>```

Body:
i need to return custom response, so i tried below query

 @Query("SELECT g.name as name,g.id as id, city as city, g.listOfEquipment as listOfEquipment,g.listOfSlot as listOfSlot" +
            " FROM Gym g INNER JOIN g.city as city " +
            "WHERE city.id=:cityId")
    List<Map<String, Object>> listing(@Param("cityId") Integer cityId, Pageable pageable);

as you can see my intention is to return city and listOfEquipment and listOfSlot also.

i was thinking this will works but unfortunately its not working
i am getting PSQLException: ERROR: syntax error at or near "."

please help me for the right approach

Body:
Try to join like below.

FROM Gym g INNER JOIN  city


问:
how to create AAR archive file from Android.mk
I am trying to build a custom Android System, and for that I want to use a separate library to contain some custom views. For this I created a Java Library using

```<code>...
LOCAL_MODULE:= com.zzz.ui
include $(BUILD_JAVA_LIBRARY)
...
</code>```

but the downside on this is that I can't use any resources and all of ui customization and layout arrangements have to be done programatically.

Now I want to change it and create a Android Library, to generate a *.aar, in which I could add the resources also and inflate the views directly from layout files along with some drawables. How can I achieve this ?

答:
To build .aar from AOSP build system, you need to create the make file for your library,

Suppose you want to create lib named xyz.aar whose package name is com.xyz.xyz and internally your lib is using some other aar named abc.aar with package name com.abc.abc then the make file may look like below:-

```<code>LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE := xyz

LOCAL_STATIC_JAVA_LIBRARIES :=android-common \
    android-support-v4 \
    android-support-design \
    android-support-v7-appcompat \
    android-support-design-res \
    android-support-v7-cardview

LOCAL_STATIC_JAVA_AAR_LIBRARIES:= abc

LOCAL_SRC_FILES := $(call all-java-files-under, java)

res_dirs := res \

LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) \
    prebuilts/sdk/current/support/v7/cardview/res \
    prebuilts/sdk/current/support/v7/appcompat/res \
    prebuilts/sdk/current/support/design/res \

LOCAL_AAPT_FLAGS := \
    --auto-add-overlay \
    --extra-packages android.support.v7.cardview \
    --extra-packages android.support.v7.appcompat \
    --extra-packages android.support.design \
    --extra-packages com.abc.abc

LOCAL_JACK_ENABLED := disabled
LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_STATIC_JAVA_LIBRARY)

include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := all_static_libs

include $(BUILD_MULTI_PREBUILT)

include $(call all-makefiles-under,$(LOCAL_PATH))
</code>```

In above make file instead of using include $(BUILD_STATIC_AAR_LIBRARY) use include $(BUILD_STATIC_JAVA_LIBRARY) and set the aar lib name in variable LOCAL_MODULE

To compile the make file use below command

> make xyz out/target/common/obj/JAVA_LIBRARIES/xyz_intermediates/xyz.aar

Your xyz.aar will be at location out/target/common/obj/JAVA_LIBRARIES/xyz_intermediates/xyz.aar

Body:
I am trying to build a custom Android System, and for that I want to use a separate library to contain some custom views. For this I created a Java Library using

...
LOCAL_MODULE:= com.zzz.ui
include $(BUILD_JAVA_LIBRARY)
...

but the downside on this is that I can't use any resources and all of ui customization and layout arrangements have to be done programatically.

Now I want to change it and create a Android Library, to generate a *.aar, in which I could add the resources also and inflate the views directly from layout files along with some drawables. How can I achieve this ?

Body:
To build .aar from AOSP build system, you need to create the make file for your library,

Suppose you want to create lib named xyz.aar whose package name is com.xyz.xyz and internally your lib is using some other aar named abc.aar with package name com.abc.abc then the make file may look like below:-

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE := xyz

LOCAL_STATIC_JAVA_LIBRARIES :=android-common \
    android-support-v4 \
    android-support-design \
    android-support-v7-appcompat \
    android-support-design-res \
    android-support-v7-cardview

LOCAL_STATIC_JAVA_AAR_LIBRARIES:= abc

LOCAL_SRC_FILES := $(call all-java-files-under, java)

res_dirs := res \

LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) \
    prebuilts/sdk/current/support/v7/cardview/res \
    prebuilts/sdk/current/support/v7/appcompat/res \
    prebuilts/sdk/current/support/design/res \

LOCAL_AAPT_FLAGS := \
    --auto-add-overlay \
    --extra-packages android.support.v7.cardview \
    --extra-packages android.support.v7.appcompat \
    --extra-packages android.support.design \
    --extra-packages com.abc.abc

LOCAL_JACK_ENABLED := disabled
LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_STATIC_JAVA_LIBRARY)

include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := all_static_libs

include $(BUILD_MULTI_PREBUILT)

include $(call all-makefiles-under,$(LOCAL_PATH))

In above make file instead of using include $(BUILD_STATIC_AAR_LIBRARY) use include $(BUILD_STATIC_JAVA_LIBRARY) and set the aar lib name in variable LOCAL_MODULE

To compile the make file use below command

> make xyz out/target/common/obj/JAVA_LIBRARIES/xyz_intermediates/xyz.aar

Your xyz.aar will be at location out/target/common/obj/JAVA_LIBRARIES/xyz_intermediates/xyz.aar


问:
Java Loop from user input to repeat process?
I am very new to Java Programming, I have been given a task to work out from user input the easter date for a given year and then to ask if the user would like to input another year to calculate another easter date. What I don't understand is how to create a loop from the second input box ("Noch eine Berechnung? (J/N)") that repeats the entire process again. My code is this:

```<code>import javax.swing.JOptionPane;

public class Osterberechnung_ohne_schleife {

 public static void main(String[] args) {

  String sJahrEingabe = JOptionPane.showInputDialog("Bitte Jahr eingeben:");

  int iJahr = Integer.parseInt(sJahrEingabe);

  int iP = iJahr / 100;
  int iQ = iP / 3;
  int iR = iQ / 4;
  int iX = (15 + iP - iQ - iR) % 30;
  int iY = (iP + 4 - iR) % 7;
  int iA = iJahr % 19;
  int iB = iJahr % 4;
  int iC = iJahr % 7;
  int iD = (19 * iA + iX) % 30;
  int iE = (2 * iB + 4 * iC + 6 * iD + iY) % 7;

  if ((iD == 29) && (iE == 6)) {

   System.out.println("Ausgabe: Ostern ist am 19.April");

  } else if ((iD == 28) && (iE == 6)) {

   System.out.println("Ausgabe: Ostern ist am 18.April");

  } else if ((22 + iD + iE) <= 31) {

   System.out.println("Ausgabe: Ostern ist am " + (22 + iD + iE) + ".März");

  } else {

   System.out.println("Ausgabe: Ostern ist am " + (iD + iE - 9) + ".April");

  }

  {

   String sNochJahr = JOptionPane.showInputDialog("Noch eine Berechnung? (J/N)");

  }

 }

}
</code>```

Thanks in advance for your help.

答:
Youre saving the response of the user in String sNochJahr, but not evaluating it. I would suggest something like this:

```<code>String sNochJahr = "J"

while (sNochJahr.equals("J")) {
      String sJahrEingabe = JOptionPane.showInputDialog("Bitte Jahr eingeben:");

    int iJahr = Integer.parseInt(sJahrEingabe);

    int iP = iJahr / 100;
    int iQ = iP / 3;
    int iR = iQ / 4;
    int iX = (15 + iP - iQ - iR)%30;
    int iY = (iP + 4 - iR)%7;
    int iA = iJahr % 19;
    int iB = iJahr % 4;
    int iC = iJahr % 7;
    int iD = (19 * iA + iX)%30;
    int iE = (2 * iB + 4 * iC + 6 * iD + iY)%7;

    if ((iD==29) && (iE==6)) {

        System.out.println("Ausgabe: Ostern ist am 19.April");

    } else if ((iD==28) && (iE==6)) {

        System.out.println("Ausgabe: Ostern ist am 18.April");

    } else if ((22 +iD + iE) <= 31) {

        System.out.println("Ausgabe: Ostern ist am " + (22 + iD + iE) + ".März");

    } else {

        System.out.println("Ausgabe: Ostern ist am " + (iD + iE - 9) + ".April");

    }

    {

    String sNochJahr = JOptionPane.showInputDialog("Noch eine Berechnung? (J/N)");

        }
}
</code>```

If the user inputs "N" then, the code breaks out of the while-loop.

Body:
I am very new to Java Programming, I have been given a task to work out from user input the easter date for a given year and then to ask if the user would like to input another year to calculate another easter date. What I don't understand is how to create a loop from the second input box ("Noch eine Berechnung? (J/N)") that repeats the entire process again. My code is this:

import javax.swing.JOptionPane;

public class Osterberechnung_ohne_schleife {

 public static void main(String[] args) {

  String sJahrEingabe = JOptionPane.showInputDialog("Bitte Jahr eingeben:");

  int iJahr = Integer.parseInt(sJahrEingabe);

  int iP = iJahr / 100;
  int iQ = iP / 3;
  int iR = iQ / 4;
  int iX = (15 + iP - iQ - iR) % 30;
  int iY = (iP + 4 - iR) % 7;
  int iA = iJahr % 19;
  int iB = iJahr % 4;
  int iC = iJahr % 7;
  int iD = (19 * iA + iX) % 30;
  int iE = (2 * iB + 4 * iC + 6 * iD + iY) % 7;

  if ((iD == 29) && (iE == 6)) {

   System.out.println("Ausgabe: Ostern ist am 19.April");

  } else if ((iD == 28) && (iE == 6)) {

   System.out.println("Ausgabe: Ostern ist am 18.April");

  } else if ((22 + iD + iE) <= 31) {

   System.out.println("Ausgabe: Ostern ist am " + (22 + iD + iE) + ".März");

  } else {

   System.out.println("Ausgabe: Ostern ist am " + (iD + iE - 9) + ".April");

  }

  {

   String sNochJahr = JOptionPane.showInputDialog("Noch eine Berechnung? (J/N)");

  }

 }

}

Thanks in advance for your help.

Body:
Youre saving the response of the user in String sNochJahr, but not evaluating it. I would suggest something like this:

String sNochJahr = "J"

while (sNochJahr.equals("J")) {
      String sJahrEingabe = JOptionPane.showInputDialog("Bitte Jahr eingeben:");

    int iJahr = Integer.parseInt(sJahrEingabe);

    int iP = iJahr / 100;
    int iQ = iP / 3;
    int iR = iQ / 4;
    int iX = (15 + iP - iQ - iR)%30;
    int iY = (iP + 4 - iR)%7;
    int iA = iJahr % 19;
    int iB = iJahr % 4;
    int iC = iJahr % 7;
    int iD = (19 * iA + iX)%30;
    int iE = (2 * iB + 4 * iC + 6 * iD + iY)%7;

    if ((iD==29) && (iE==6)) {

        System.out.println("Ausgabe: Ostern ist am 19.April");

    } else if ((iD==28) && (iE==6)) {

        System.out.println("Ausgabe: Ostern ist am 18.April");

    } else if ((22 +iD + iE) <= 31) {

        System.out.println("Ausgabe: Ostern ist am " + (22 + iD + iE) + ".März");

    } else {

        System.out.println("Ausgabe: Ostern ist am " + (iD + iE - 9) + ".April");

    }

    {

    String sNochJahr = JOptionPane.showInputDialog("Noch eine Berechnung? (J/N)");

        }
}

If the user inputs "N" then, the code breaks out of the while-loop.


答:
Surround your code with a do...while loop and keep going as long as sNochJahr is J.

```<code>do {
...
} while (sNochJahr.equals("J"));
</code>```

or while sNochJahr is not N.

```<code>while (!sNochJahr.equals("N"));
</code>```

Title: Java Loop from user input to repeat process?

Body:
Surround your code with a do...while loop and keep going as long as sNochJahr is J.

do {
...
} while (sNochJahr.equals("J"));

or while sNochJahr is not N.

while (!sNochJahr.equals("N"));


问:
Retrieve inserted row ID in SQL
How do I retrieve the ID of an inserted row in SQL?

Users Table:

```<code>Column  | Type
--------|--------------------------------
ID      | * Auto-incrementing primary key
Name    |
Age     |
</code>```

Query Sample:

```<code>insert into users (Name, Age) values ('charuka',12)
</code>```

答:
In SQL Server, you can do (in addition to the other solutions already present):

```<code>INSERT INTO dbo.Users(Name, Age)
OUTPUT INSERTED.ID AS 'New User ID'
VALUES('charuka', 12)
</code>```

The OUTPUT clause is very handy when doing inserts, updates, deletes, and you can return any of the columns - not just the auto-incremented ID column.

Read more about the OUTPUT clause in the SQL Server Books Online.

ContentLicense: CC BY-SA 2.5

Title: Retrieve inserted row ID in SQL

Body:
How do I retrieve the ID of an inserted row in SQL?

Users Table:

Column  | Type
--------|--------------------------------
ID      | * Auto-incrementing primary key
Name    |
Age     |

Query Sample:

insert into users (Name, Age) values ('charuka',12)

Body:
In SQL Server, you can do (in addition to the other solutions already present):

INSERT INTO dbo.Users(Name, Age)
OUTPUT INSERTED.ID AS 'New User ID'
VALUES('charuka', 12)

The OUTPUT clause is very handy when doing inserts, updates, deletes, and you can return any of the columns - not just the auto-incremented ID column.

Read more about the OUTPUT clause in the SQL Server Books Online.