text:
Q: Tail-recursive function in XSLT 2.0 is not working I am trying to write a tail-recursive function in XSLT 2.0, which iterates through a multivalued variable of dates and returns the earliest one. For some reason my function is not recognized by SaxonHE9.4 as tail-recursive and I get the following error, when the input file has more than 150-200 entries or so:

Error on line 73 of tail_rec_test.xsl:   Too many nested function
  calls. May be due to infinite recursion.   in built-in template rule

Here's my xml-input:
<?xml version="1.0"?>
<Events>
  <Event>
    <Date>2004-01-01</Date>
  </Event>
  <Event>
    <Date>2003-01-01</Date>
  </Event>
  <Event>
    <Date>2002-01-01</Date>
  </Event>
  <Event>
    <Date>2001-01-01</Date>
  </Event>
  <Event>
    <Date>2005-01-01</Date>
  </Event>
  <Event>
    <Date>2006-01-01</Date>
  </Event>
  <Event>
    <Date>2007-01-01</Date>
  </Event>
  <Event>
    <Date>2008-01-01</Date>
  </Event>
</Events>

This is what my xsl-file looks like:
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"
    xmlns:own="http://ownfunctions">
    <xsl:output method="xml" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:function name="own:findEarliestDate">
        <xsl:param name="dates" as="xs:date*"/>

        <xsl:variable name="size"><xsl:value-of select="count($dates)" /></xsl:variable>
        <xsl:choose>
            <xsl:when test="$size > 0">
                <xsl:value-of select="own:findEarliestDate-helper($dates, $size, xs:date('2050-01-01'))" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="''"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>

    <xsl:function name="own:findEarliestDate-helper" as="xs:date">
        <xsl:param name="items" as="xs:date*"/>
        <xsl:param name="i" as="xs:integer"/>
        <xsl:param name="curMin" as="xs:date"/>

        <xsl:choose>
            <xsl:when
                test="$i = 0">
                <xsl:value-of select="xs:date($curMin)"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="item" as="xs:date">
                    <xsl:value-of select="xs:date($items[$i])"/>
                </xsl:variable>

                <xsl:variable name="next" as="xs:date">
                    <xsl:choose>
                        <xsl:when test="$item < $curMin">
                            <xsl:value-of select="$item"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="$curMin"/>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>

                <xsl:value-of select="own:findEarliestDate-helper($items, $i - 1, $next)"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>

    <xsl:template match="Events">
        <xsl:variable name="items" as="xs:date*">
            <xsl:for-each select="Event">
                <xsl:value-of select="xs:date(Date)"/>
            </xsl:for-each>
        </xsl:variable>

        <Test>
            <EarliestDate>
                <xsl:value-of select="own:findEarliestDate($items)"/>
            </EarliestDate>
        </Test>
    </xsl:template>

</xsl:stylesheet>

How can I transform it into a correct tail-recursive function?
I have tested this example, but I cannot apply it to my own code:
http://www.nesterovsky-bros.com/weblog/2008/02/20/EfficientXslt20RecursionInSaxon9.aspx

A: I can't repro this.
Using Saxon 9.4.06EE (evaluation copy) the result is:
<Test xmlns:fo="http://www.w3.org/1999/XSL/Format"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:fn="http://www.w3.org/2005/xpath-functions"
      xmlns:own="http://ownfunctions">
   <EarliestDate>2001-01-01</EarliestDate>
</Test>

Saxon-EE 9.4.0.6J from Saxonica
Java version 1.6.0_31
Using license serial number XXXXXXXX
Generating byte code...
Stylesheet compilation time: 2168 milliseconds
Processing file:/C:/Program%20Files/Java/jre6/bin/marrowtr.xml
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/C:/Program%20Files/Java/jre6/bin/marrowtr.xml using class net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 10 milliseconds
Tree size: 27 nodes, 80 characters, 0 attributes
Execution time: 122ms
Memory used: 52169472
NamePool contents: 8 entries in 8 chains. 6 URIs

BTW, one can use just this to produce the same result:
<xsl:value-of select="min(/*/*/Date/xs:date(.))"/>

Update:
The problem is in this line:
            <xsl:value-of select="own:findEarliestDate-helper($items, $i - 1, $next)"/>

Because the return type of the function is xs:date, the above line isn't the last line in the execution sequence of the function. It produces a string (more precisely, a text node), and the XSLT processor needs to get this string and to convert it to an xs:date -- that means that the memory ocupied by the function isn't discarded and the call-stack continues to grow, until it overflows.
The solution is simple:
Replace the above with:
            <xsl:sequence select="own:findEarliestDate-helper($items, $i - 1, $next)"/>

This produces an xs:date and the XSLT processor now recognizes the function as tail recursive.
I tested the corrected code with 1000 events (on which the original code crashes) and the result is produced normally (and faster).
Saxon-EE 9.4.0.6J from Saxonica
Java version 1.6.0_31
Using license serial number XXXXXXXXXX
Generating byte code...
Stylesheet compilation time: 2002 milliseconds
Processing file:/C:/Program%20Files/Java/jre6/bin/marrowtr.xml
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/C:/Program%20Files/Java/jre6/bin/marrowtr.xml using class net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 124 milliseconds
Tree size: 3032 nodes, 9800 characters, 0 attributes
Execution time: 364ms
Memory used: 55089048
NamePool contents: 8 entries in 8 chains. 6 URIs


text:
Q: How to reach outside of a div in an HTMLDivElement object with Javascript I have several HTML elements that represent tiles to be flipped on click. Each element has a container div, which holds two divs, one for the front and back of the tile.

I have the animation worked out in CSS so the tiles "flip" on hover. So far so good. Now I am trying to change the classList of the "flip-container" on click, so that a different className will be called from my style sheet.
My problem is that my handleClick function is targeting only the inner-div "back-blue", and not the "flip-container" that is holding both divs.
const tileData = document.querySelectorAll('[data-tile]')
const flipContainers = Array.from(
  document.getElementsByClassName('flip-container')
)

flipContainers.forEach((container) => {
  container.addEventListener('click', handleClick, { once: true })
})

function handleClick(e) {
  console.log('clicked')
  const container = e.target
  const currentClassColor = 'blue'
  fixColor(container, currentClassColor)
}

function fixColor(container, currentClassColor) {
  container.classList.add(currentClass)
}

I have tried querying the "flip-container" both by selecting the data tag and also by grabbing an array from the specific className. In both cases, the entire element is still grabbed, and the target of the click applies only to the inner div. I guess it makes sense why this happening, but is there a way I can access the container even if the click target is one of the inner divs?

A: What you want is probably e.currentTarget.

The currentTarget read-only property of the Event interface identifies
the current target for the event, as the event traverses the DOM. It
always refers to the element to which the event handler has been
attached, as opposed to Event.target, which identifies the element on
which the event occurred and which may be its descendant.

https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
If that doesn't work for your case, you will want to try e.currentTarget.parentNode

A: e.target is the div that was clicked, if you want the div that the event handler is attached to you can use the this keyword or e.currentTarget.
function handleClick(e) {
  console.log('clicked')
  // const container = this
  const container = e.currentTarget
  const currentClassColor = 'blue'
  fixColor(container, currentClassColor)
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: launch bbm programmatically How can we launch a blackberry messenger programmatically. Any help would be greatly appreciated.  As far as I know the following would get the BlackberryMessenger instance but what can be done to launch the BBM:
BlackBerryMessenger bbm= BlackBerryMessenger.getInstance();

A: I still urge you to consider my comments above, but you should be able to cause BBM to come to the foreground with:
int modHandle = CodeModuleManager.getModuleHandle( <bbm module name> );
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors( modHandle );
ApplicationManager.getApplicationManager().runApplication(apDes [ 0 ] );

You will have to find out what the appropriate module name is and put that string in the call to getModuleHandle(). BBM has a bunch of modules and I don't know off hand which one is the main one.


text:
Q: Discord js guildMember getting from user id i don't know how to get the guildMember from user id in discord.js
i cuoldn't find a solution so i'm asking you
code:
const { Client, GatewayIntentBits, Partials } = require('discord.js');

const prefix = '!';

const client = new Client
(
    {
        allowedMentions:
        {
            parse: [`users`, `roles`],
            replieduser: true,
        },
        intents:
        [
            GatewayIntentBits.Guilds,
            GatewayIntentBits.GuildMessages,
            GatewayIntentBits.GuildPresences,
            GatewayIntentBits.GuildMembers,
            GatewayIntentBits.MessageContent,
            GatewayIntentBits.GuildMessageReactions,
        ],
        'partials': [Partials.Channel]
    }
);

client.on("ready", () => {
    console.log("Bot is online!");
});

client.on("messageCreate", async (message) => {
    if(message.content === "ping")
    {
        message.reply({content: "pong"});
    }
    if (message.content.includes(prefix + 'changeNick'))
    {
        //message.reply({content: "triggered"});
        var str = message.content;
        const result = str.trim().split(/\s+/);
        if(!result[1])
        {
            console.log("Error in the command");
            message.reply({content: "please include arguments"});
        }
        else
        {
            var member = result[1];
        }
        if(!result[2])
        {
            console.log("Error in the command");
            message.reply({content: "please include arguments"});
        }
        else
        {
            var nickPrefix = result[2];
        }
        if(!result[1] && !result[2])
        {
            console.log("Fatal error in the command");
        }
        else
        {
            console.log(result);
            console.log(message.member);
            //message.member.setNickname("Nick");
            let user = client.users.fetch(result[1].replace(/[^a-zA-Z0-9 ]/g, ''));
            //let user = message.mentions.users.first();
            user.then(function(memberResult)
            {
                console.log(memberResult.username + "#" + memberResult.discriminator);
                console.log(memberResult);
                console.log(message.member);
            });
        }
    }
});

client.login("MTAzMzI3NDM2NzY1NzkxMDMzMw.GNlpcD.-QrUbUL48L7e-fFHdcExs1R_JjcdCD0F1nAvqg");

i've got user but i can't edit the server nickname from this object i need guildMember for this
i'm trying to be able to change nicks of the users with command : !changeNick @User Nick

A: The user ID is the same as the member ID so use <Guild>.members.cache.get('ID'), now I don't know on what version of discord.js you are, this will work on v13 and v14, I don't really know about older versions.
P.S. to get the guild inside the messageCreate event you can use <Message>.guild, outside an event <Client>.guilds.cache.get('guild_id')


text:
Q: Get first match in series, R I have vector contain 1 and 0
a <- c(0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0)

I need get trigger, when i getting first 1, when after 0 i get 1 again, need get trigger again.
That is, when I come across group 1, I need to mark the first 1 in this group with some kind of trigger. Group is always detached 0.
The final result should look like this:
NA, NA, 1, NA, NA, NA, NA, NA, NA, NA, NA, 1, NA, NA, 1, NA, NA, NA

A: A base R solution with indexing based on differences can be:
#Data
a <- c(0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0)
index <- c(0,diff(a))
a[which(index!=1)] <- NA

Output:
a
 [1] NA NA  1 NA NA NA NA NA NA NA NA  1 NA NA  1 NA NA NA

A: You can do this with rleid from data.table and duplicated.
b <- +(!duplicated(data.table::rleid(a)) & a == 1)
b
#[1] 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0

b[b == 0] <- NA
b
#[1] NA NA  1 NA NA NA NA NA NA NA NA  1 NA NA  1 NA NA NA

rleid(a) creates a group number for every change in a, !duplicated would return TRUE for every first match and by using a == 1 we restrict it to only for values = 1.

A: This code should work
c(NA, ifelse(a[-1] == 1 & a[-length(a)] == 0, 1, NA))
# [1] NA NA  1 NA NA NA NA NA NA NA NA  1 NA NA  1 NA NA NA

A: Another base R approach:
> a <- c(0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0)
> a[which(a > lag(a))] <- 1
> a[-which(a > lag(a))] <- NA
> a
 [1] NA NA  1 NA NA NA NA NA NA NA NA  1 NA NA  1 NA NA NA
>

A: We can use
library(data.table)
+(NA^duplicated(rleid(a)) & NA^!a)
#[1] NA NA  1 NA NA NA NA NA NA NA NA  1 NA NA  1 NA NA NA


text: Q: "Serious Sam" achievement (Serious Sam Bogus Detour) I'm trying to get the achievement for actually beating the game (The "Serious Sam" achievement), but I'm not sure about the actual requirements. Do I have to beat the game completely unmodified (game switches, not mods), or do I have to beat every level in a save file? I played on a save file onto the last level, but I screwed up and ran out of time, and had to restart the level. I quit the game for a while, and when I came back my save file had corrupted. I was not willing to restart the entire game, so I restarted the final level. I beat it, but I got no achievement. My problem is that I'm not sure if this is because I had game switches turned on, or if It's because I hadn't beaten every level on that save file I actually beat the game on. I've been looking all over the wiki, and I can't find the actual info I need.


text:
Q: AJAX request to get results from Google I want to modify the code in this AJAX example to get results from Google.
I take it out the line with the Random() method call, but how do I work with the query string in the JavaScript? How can I best do this using XMLHttpRequest to manually build the request (this is for testing so has to be manually done, as opposed to using a framework).
Thanks

A: You cannot use XMLHttpRequest with an absolute URL like http://www.google.com/....
The browser will prevent cross-site scripting. You have to use a relative path, otherwise most browsers will simply return an empty responseText.
As one possible workaround, you could set up a very simple reverse proxy (using mod_proxy if you are on Apache). This would allow you to use relative paths in your AJAX request, while the HTTP server would be acting as a proxy to any "remote" location.
The fundamental configuration directive to set up a reverse proxy in mod_proxy is the ProxyPass. You would typically use it as follows:
ProxyPass     /ajax/     http://www.google.com/search

In this case, the browser would be requesting /ajax/?hl=en&source=hp&q=test but in fact the server would serve this by acting as a proxy to http://www.google.com/search?hl=en&source=hp&q=test.
If you are using IIS, you may want to use the Managed Fusion URL Rewriter and Reverse Proxy to set up a reverse proxy.


text:
Q: "Off by one error" while using istringstream in C++ I get an off by one error while executing the following code
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main (int argc, char* argv[]){
    string tokens,input;
    input = "how are you";
    istringstream iss (input , istringstream::in);
    while(iss){
        iss >> tokens;
        cout << tokens << endl;
    }
    return 0;

}

It prints out the last token "you" twice, However if I make the following changes everything works fine.
 while(iss >> tokens){
    cout << tokens << endl;
}

Can anyone explain me how is the while loop operating. Thanks

A: That is correct. The condition while(iss) fails only after you read past the end of the stream. So, after you have extracted "you" from your stream, it will still be true.
while(iss) { // true, because the last extraction was successful

So you try to extract more. This extraction fails, but does not affect the value stored in tokens, so it is printed again.
iss >> tokens; // end of stream, so this fails, but tokens sill contains
               // the value from the previous iteration of the loop
cout << tokens << endl; // previous value is printed again

For this very reason, you should always use the second approach you show. In that approach, the loop will not be entered, if the read was unsuccessful.


text:
Q: How to configure Xamarin.Android.Tasks.NdkUtil.GetNdkClangBin for Visual Studio on MacOs Can anyone help me with this Embeddinator-4000 exception?
Unhandled Exception:
System.InvalidOperationException: Sequence contains no elements
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00010] in <80f7dc36b4e24f4b86610a67568d2e19>:0
  at Xamarin.Android.Tasks.NdkUtil.GetNdkClangBin (System.String toolchainsPath, Xamarin.Android.Tools.AndroidTargetArch arch) [0x00007] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileNDK (System.Collections.Generic.IEnumerable`1[T] files) [0x00111] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileNativeCode (System.Collections.Generic.IEnumerable`1[T] files) [0x000ba] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileCode () [0x000c6] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.Run () [0x000a5] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.CLI.Main (System.String[] args) [0x00092] in <27f4a5e1850e4beb9b867456b4a97cab>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Sequence contains no elements
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00010] in <80f7dc36b4e24f4b86610a67568d2e19>:0
  at Xamarin.Android.Tasks.NdkUtil.GetNdkClangBin (System.String toolchainsPath, Xamarin.Android.Tools.AndroidTargetArch arch) [0x00007] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileNDK (System.Collections.Generic.IEnumerable`1[T] files) [0x00111] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileNativeCode (System.Collections.Generic.IEnumerable`1[T] files) [0x000ba] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.CompileCode () [0x000c6] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.Driver.Run () [0x000a5] in <27f4a5e1850e4beb9b867456b4a97cab>:0
  at Embeddinator.CLI.Main (System.String[] args) [0x00092] in <27f4a5e1850e4beb9b867456b4a97cab>:0

Im new to Visual Studio and Xamarin development, however this looks like the ndk tool chain is not configured correctly.
How do I fix this on MacOs?
My Mac does have clang installed
$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


text:
Q: customer redirect multi store magento I have set up a multi store in magento, so I have example.com and example.com/wholesaler what I need to do is have everyone who is in customer group wholesale redirected to example.com/wholesaler from the example.com store.
I originally tried this http://www.magentocommerce.com/magento-connect/custom-login-redirect-extension.html works perfectly for redirecting on the example.com site, but because when you login the url changes to example.com/index.php it creates example.com/index.php/wholesaler which is a 404.
Does anyone have a solution to get my customers in the wholesale group across to my other store?

A: You could look at turning SEO friendly URL's on to remove the index.php from the url.
Navigate to  System > Configuration > General > Web > Search Engine Optimisation and underneath Use Webserver Rewrites option and select Yes
In your .htaccess make sure RewriteBase is as follows RewriteBase /.
You should now be able to get to example.com/wholesaler without the index.php


text:
Q: Can I store more than 5 MB in HTML5 local(offline) storage? Can I store more than 5 MB in HTML5 local(offline) storage?
I referred  the following sources,

*

*http://diveintohtml5.info/storage.html

*http://htmlui.com/blog/2011-08-23-5-obscure-facts-about-html5-localstorage.html
and they say no.But they are over an year old  and newer versions of Chrome and safari has been released since then.
I am concerned only about  chrome and safari.My web app is expected to run on tablets and laptops.
A clear answer is highly appreciated!


text:
Q: TypeError: Cannot read properties of undefined (reading 'destroy') when using Svelte and egjs-grid I'm attempting to run a toy example of egjs-grid for Svelte, and I get the titular error when I attempt to run it. My code is very simple:

  <JustifiedGrid
    class="container"
    {defaultDirection}
    {gap}
    {rowRange}
    {columnRange}
    {sizeRange}
    {isCroppedSize}
    {displayedRow}
  >

1

2

3

4

5

6

7

8

9

10

  </JustifiedGrid>

A: That's an SSR issue. The component gets rendered in the server first and it can't find the destroy property of something which only exists in the browser.
This can be solved by adding a browser guard, like so:

{#if browser}
    <JustifiedGrid
        class="container"
        {defaultDirection}
        {gap}
        {rowRange}
        {columnRange}
        {sizeRange}
        {isCroppedSize}
        {displayedRow}
    >

1

2

3

4

5

6

7

8

9

10

    </JustifiedGrid>
{/if}

However, this solution is ugly and not idiomatic. The library author should probably strive to make it work with SSR (maybe you can consider contributing to said library!).


text:
Q: Find dimension and a basis of a subspaces $U+V$, $U \cap V$ in terms of the parameter $\alpha$ Let $U=span((1,1,1,2),(1,2,2,\alpha))$ and $V=span((1,3,4,\alpha+2),(1,4,\alpha,\alpha+1))$ are the subspaces of $\mathbb{R^4}$. ($\alpha\in\mathbb{R}$).
Find dimension and one basis of $U+V$, $U \cap V$ in terms of $\alpha$.
For values $\alpha$, which satisfies that $\dim(U+V)$ is the smallest, check if $v=(1,2,3,4)$ is an element of $U+V$.
Attempt:
From the definition of vector space span $\Rightarrow$
$U=\{(x+y,x+2y,x+2y,2x+\alpha y):x,y\in\mathbb{R}\}$
$V=\{(t+p,3t+4p,4t+\alpha p,(\alpha+2)t+(\alpha+1)p):t,p\in\mathbb{R}\}$
$U\cap V\Rightarrow$
$$x+y=t+p$$
$$x+2y=3t+4p$$
$$x+2y=4t+\alpha p$$
$$2x+\alpha y=(\alpha+2)t+(\alpha+1)p$$
We can use Kronecker-Capelli's theorem to find for which $\alpha$ the system has a unique solution.
When will $\dim(U+V)$ be the smallest?
$\dim(U+V)=\dim(U)+\dim(V)-\dim(U\cap V)$

A: First, note that $\DeclareMathOperator{rref}{rref}$
\begin{align*}
\rref
\begin{bmatrix}
1&1&1&2\\
1&2&2&\alpha
\end{bmatrix}
&=
\begin{bmatrix}
1&0&0&4-\alpha\\
0&1&1&\alpha-2
\end{bmatrix}
&
\rref
\begin{bmatrix}
1&3&4&2+\alpha\\
1&4&\alpha&1+\alpha
\end{bmatrix}
&=
\begin{bmatrix}
1&0&16-3\,\alpha&\alpha+5\\
0&1&\alpha-4&-1
\end{bmatrix}
\end{align*}
This proves that $\dim(U)=2$ and that $\dim(V)=2$.
Next, note that
$$
\det
\begin{bmatrix}
1&1&1&2\\
1&2&2&\alpha\\
1&3&4&\alpha+2\\
1&4&\alpha&\alpha+1
\end{bmatrix}
=(\alpha-7)(\alpha-3)
$$
This proves that $\dim(U+V)=4$ provided that $\alpha\neq7$ and $\alpha\neq 3$. Consequently
$$
\dim(U\cap V)=\dim(U)+\dim(V)-\dim(U+V)=2+2-4=0
$$
provided that $\alpha\neq7$ and $\alpha\neq 3$.
Now, note that
\begin{align*}
\rref
\begin{bmatrix}
1&1&1&2\\
1&2&2&7\\
1&3&4&7+2\\
1&4&7&7+1
\end{bmatrix}
&=
\begin{bmatrix}
1&0&0&-3\\
0&1&0&8\\
0&0&1&-3\\
0&0&0&0
\end{bmatrix}
&
\rref
\begin{bmatrix}
1&1&1&2 \\
1&2&2&3 \\
1&3&4&3+2\\
1&4&3&3+1
\end{bmatrix}
&=
\begin{bmatrix}
1&0&0&1\\
0&1&0&0\\
0&0&1&1\\
0&0&0&0
\end{bmatrix}
\end{align*}
This proves that $\dim(U+V)=3$ provided that $\alpha=7$ or $\alpha=3$. Consequently
$$
\dim(U\cap V)=\dim(U)+\dim(V)-\dim(U+V)=2+2-3=1
$$
provided that $\alpha=7$ or $\alpha=3$.
This covers the questions about dimension. Can you use the above to answer the question about bases?


text:
Q: Hive Partitions - How to delete null or hive_default_partition I am facing a problem with hive default partition (null partition) in hive.
I will explain the situation briefly here.. I have a hive main table and data ingestion is happening to that table everyday. but somehow when data is ingested into the hive table something went wrong and partition is showing _hive_default_partition_ or in my understanding it is null partition.
i need to delete the partition from hive tables. (it is external table)...
I am using hive version 1.1 and CDH version 5.4.8 ..
I tried the below syntax and its not working for me..
alter table "tablename" drop partition(partn='_hive_default_partition_);

alter table "tablename" drop partition(partn<'1');

alter table "tablename" drop partition(partn = 1);

alter table "tablename" drop partition(partn='0');

i tried all the above steps and nothing worked..
Hope someone can help me with this.
Thanks in advance ,

A: The way that worked for me was altering the datatype of the partition column, deleting the partition and changing it back.
Considering that you are comparing the partition to an int in the question, I assume that is the column datatype to start with, however this should work regardless of the datatype you start with.
-- Change the column type to string
ALTER TABLE tablename PARTITION COLUMN (partn STRING);

-- Drop the offending partitions
ALTER TABLE tablename DROP PARTITION (partn='__HIVE_DEFAULT_PARTITION__');

-- Change the column type back to int
ALTER TABLE tablename PARTITION COLUMN (partn INT);

A: Just delete the directory from hdfs and run msck repair table.
From shell: hadoop fs -rm -r ..../partn=__HIVE_DEFAULT_PARTITION__
From hive shell: msck repair table table_name;

A: I achieved this in 3-steps

*

*Remove partition data from the HDFS using
hadoop fs -rm -r -skipTrash  eg.

hadoop fs -rm -r -skipTrash /apps/hive/warehouse/<db-name>/<table-name>/<partition-name>=__HIVE_DEFAULT_PARTITION__

*Open hive client and run
set hive.msck.path.validation=ignore;

*Run this in hive client
MSCK REPAIR TABLE <db-name>.<table-name>;

A: try this:
alter table `tablename` drop if exists partition (partn<>'');


text:
Q: Libgdx how to calculate elapsed time I was trying to calculate elapsed time in libgdx by adding in the render method the value of delta to my float value which is the time i measure since play state starts. The bug or problem, how you want to call it, is that by my calculations, the time displayed doing this is two times the real time. I tried to divide by 2 and I was pretty close to the real time, which means that by adding delta every render call I don't get real time in seconds. Why is this happening?
private float time=0;
public void render () {
    time +=Gdx.graphics.getDeltaTime();
}

the above doesn't get the real time and my question is why?
EDIT: i am using a screen but it doesn't matter i tried both Gdx.graphics.getDeltaTime() and delta argument from render method.

A: Why not just take a system time stamp from standard java libraries. Do that when you start the application and when you want to calculate the elapsed time reduce that initial value from the current time.
long startTime = System.currentTimeMillis();

and then whenever you want to get the elapsed time do:
long elapsed time = System.currentTimeMillis() - startTime;

I don't think adding the delta is very accurate since probably some of the time is lost between when libgdx stops measuring the delta and when it starts again in which case it's going to drift over time.
Not sure why you get about twice as fast though... I know the render call is called 60 times a second. maybe the delta is somehow considering 30 frames per second...
BTW, there's also getRawDeltaTime()
This should give you something more accurate.
Update: As Christian commented - you need to divide by 1000 to get to seconds resolution rather than milliseconds.

A: TimeUtils is required for portability. Avoid using system classes if you are planning on deploying on multiple platforms. LibGdx features its own array class for this reason as well.
Example:
public long time;
time = TimeUtils.nanoTime();

From the wiki:

Class TimeUtils "Wrapper around System.nanoTime() and
  System.currentTimeMillis(). Use this if you want to be compatible
  across all platforms!"

A: You can use wrapper TimeUtils.
Get current time:
long startTime = TimeUtils.millis();

Get time elapsed since startTime:
long elapsedTime = TimeUtils.timeSinceMillis(startTime);

A: LibGDX is still Java at heart, just use the standard methods for getting the time. At the start of the application use
startTime = System.currentTimeMillis();

then in the render you can do
System.out.println("Time elapsed in seconds = " + ((System.currentTimeMillis() - startTime) / 1000));

Make sure startTime is declared as a long.
As to why it's not working with the method you posted, I'm not sure.
EDIT: If your LibGDX project isn't set to run at a fixed rate, then the frame-rate change will cause a change in Gdx.graphics.getDeltaTime(), because the delta time is returned for the last frame updated.


text:
Q: Redirect to new page using Lightning Quick Action I am having a quick action with lightning component . The component checks for some condition and redirect to the new page of case object.
So now when the user click on quick action a modal window is opened which is the default behaviour of quick action lightning component and then the page is redirected to the case new pagge based on certain conditions .
My question here is , is there any possibility to hide this modal pop up from displaying to the user ??  Coz now the user See an empty modal
Pop up and then gets redirected to the new case page .

A: Refer below Link for redirecting:
How to open in lightning experience a custom visualforce page that requires parameters?
Hope this helps you.
Diksha

A: It is not possible to close that model but you can do work around on this. You can show spinner on model pop up .


text:
Q: Undefined reference error while compiling a simple mutlifile class program This is my main file:
#include<iostream>
using namespace std;

#include "practice.h"

int main()
{
    practice obj(2);
    obj.whatever();
}

This is my .h file:
#include "practice.h"
#include<iostream>
using namespace std;

practice::practice(int num)
{
    h=num;
}
void practice::whatever()
{
    cout<<h;
}

This is my cpp file:
class practice
{
public:
    practice(int);
    void whatever();

private:
    int h;
};

I  cant seem to figure this out. Whenever i try to combine, it shows an error saying undefined refernce to practice::practice(int), undefined reference to practice::whatever() and ld returned to 1 exit status

A: It looks like you have your cpp and header files backwards... You should be creating the class, and defining the layout in your header, and then in your cpp file you should have the details.


text:
Q: Code first one to one select query I try using Code First but I have some troubles, I think I forget or miss something ...
I have two pretty simple models : (a car have one FuelType, it's a one to one relation)
public class Car
{
    public int CarID { get; set; }
    public string CarName { get; set; }
    public Fuel FuelType { get; set; }
    ...
}
public class Fuel
{
    public int FuelID { get; set; }
    public string Name{ get; set; }
    ...
}

My contextClass :
public class CarDbContext : DbContext
{
    public DbSet<Car> Cars { get; set; }
    public DbSet<Fuel> Fuels { get; set; }

    public CarDbContext()
        : base("CarDbConnectionString")
    {
        Database.SetInitializer<CarDbContext>(new CreateDatabaseIfNotExists<CarDbContext>());
    }

And my main program :
class Program
{
    static void Main(string[] args)
    {
        IList<Car> maListe;

        using (var ctx = new CarDbContext())
        {
            var car = from c in ctx.Cars
                          select c;

            maListe = car.ToList<Car>();
        }

        foreach (Car c in maListe)
            Console.WriteLine("Car: {0} {1}", c.CarName, c.FuelType.Name);

        Console.ReadLine();
    }
}

In my console, I can see CarName but not the FuelType.Name of the car.
I tried few things like changing my query to this :
  var car = from c in ctx.Cars.Include("Fuels")
            select c;

But I get an exception :

A specified Include path is not valid. The Entity Type 'Car' does not declare a navigation property with the name 'Fuels'

Does someone can explain to me what I did wrong or what I forget ?

A: You have navigation property named FuelType:
var cars = ctx.Cars.Include("FuelType"); // not `Fuels`

A: If you want to 'eager-load' FuelType, try:
var car = from c in ctx.Cars.Include("FuelType")

Alternatively, you can mark it as virtual and have FuelType 'lazy-loaded' for you:
public class Car
{
    public int CarID { get; set; }
    public string CarName { get; set; }
    public virtual Fuel FuelType { get; set; }
    ...
}

A: Are you sure that it's a one-to-one relation ? a FuelType is only associated with one car ?
Anyway, in order to make a one-to-one relation you have to include a navigation property for the Principal entity in your Dependent entity, as follow:
public class CarDbContext : DbContext
{
    public CarDbContext()
        : base("CarDbConnectionString")
    {
        Database.SetInitializer<CarDbContext>(new CreateDatabaseIfNotExists<CarDbContext>());
    }

    public DbSet<Car> Cars { get; set; }
    public DbSet<Fuel> Fuels { get; set; }
}

public class Car
{
    [Key]
    public int CarID { get; set; }
    public string CarName { get; set; }
    public virtual Fuel FuelType { get; set; }    // set as virtual
}

public class Fuel
{
    [Key, ForeignKey("Car")]                      // primary and foreign key
    public int FuelID { get; set; }
    public string Name { get; set; }
    public virtual Car Car { get; set; }          // must include a navigation property for the Principal entity
}

But if it's a one-to-many relationship, you can handle it as follow:
public class Car
{
    [Key]
    public int CarID { get; set; }
    public string CarName { get; set; }
    public int FuelTypeID { get; set; }
    [ForeignKey("FuelTypeID")]
    public virtual Fuel FuelType { get; set; }
}

public class Fuel
{
    public int FuelID { get; set; }
    public string Name { get; set; }
}

public class CarDbContext : DbContext
{
    public CarDbContext()
        : base("CarDbConnectionString")
    {
        Database.SetInitializer<CarDbContext>(new CreateDatabaseIfNotExists<CarDbContext>());
    }

    public DbSet<Car> Cars { get; set; }
    public DbSet<Fuel> Fuels { get; set; }
}

A: Thanks to all for answering me.
Your answers really make me progress in EF understanding.
By the way I was really stuck with the "System.Reflection.TargetInvocationException" Exception.
I changed so many things in my code than now it works but unfortunately I cannot understand why :(


text:
Q: Show local image file:///tmp/someimage.jpg Scenario
I'm contributing for a OSS project that is build on BlazorServerSide and ElectronNET.API Version 9.31.1.
In an Electron window we would like to show images from local storage UI via <img> tag.
What I have tried:
I have tried with:
<img src="file:///home/dani/pictures/someimage.jpg" />

But doesn't work. Image doesn't appear. I have then tried to create electron window with WebSecurity = false, but also doesn't help (images appears as broken on UI):
var browserWindowOptions = new BrowserWindowOptions
{
    WebPreferences = new WebPreferences
    {
        WebSecurity = false,
    },
};

Task.Run(async () => await Electron.WindowManager.CreateWindowAsync(
    browserWindowOptions,
    $"http://localhost:{BridgeSettings.WebPort}/Language/SetCultureByConfig"
));

Finally, as workaround, I'm sending the images as data base64 in img src's attribute, but it looks like a dirty approach.
My Question:
My question is, how can I show on electron window picture files from local storage.
Some irrelevant info:
The open source line where I need assistance.

A: There are several ways to go about this, so I will try to cover the most relevant use cases. Some of this depends on the context of your project.
Access to local files behave as cross origin requests by default. You could try using the crossorigin=anonymous attribute on your image tag, but doesn't work because your local file system will not be responding with cross origin headers.
Disabling the webSecurity option is a workaround, but is not recommended for security reasons, and will not usually work correctly anyway if your html is not also loaded from the local file system.

Disabling webSecurity will disable the same-origin policy and set allowRunningInsecureContent property to true. In other words, it allows the execution of insecure code from different domains.
https://www.electronjs.org/docs/tutorial/security#5-do-not-disable-websecurity

Here are some methods of working around this issue:
1 - Use the HTML5 File API to load local file resources and provide the ArrayBuffer to ImageData to write the image to a <canvas> .
function loadAsUrl(theFile) {
    var reader = new FileReader();

    var putCanvas = function(canvas_id) {
      return function(loadedEvent) {
        var buffer = new Uint8ClampedArray(loadedEvent.target.result);
        document.getElementById(canvas_id)
                .getContext('2d')
                .putImageData(new ImageData(buffer, width, height), 0, 0);
      }
    }

    reader.onload = putCanvas("canvas_id");

    reader.readAsArrayBuffer(theFile);
}

1.b - It is also possible to load a file as a data URL. A data URL can be set as source (src) on img elements with JavaScript. Here is a JavaScript function named loadAsUrl() that shows how to load a file as a data URL using the HTML5 file API:
function loadAsUrl(theFile) {
    var reader = new FileReader();

    reader.onload = function(loadedEvent) {
        var image = document.getElementById("theImage");
        image.setAttribute("src", loadedEvent.target.result);
    }

    reader.readAsDataURL(theFile);
}

2 - Use the Node API fs to read the file, and convert it into a base64 encoded data url to embed in the image tag.
Hack - Alternatively you can try loading the image in a BrowserView or <webview>. The former overlays the content of your BrowserWindow while the latter is embedded into the content.
// In the main process.
const { BrowserView, BrowserWindow } = require('electron')

const win = new BrowserWindow({ width: 800, height: 600 })

const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('file:///home/dani/pictures/someimage.jpg')


text:
Q: UNEXPECTED TOP-LEVEL EXCEPTION Error when building with Android and Libgdx I am trying to build the most recent version of my libgdx app, but haven't had any success in figuring out what is going wrong here. I looked up other errors like it, and tried to see if any of them fixed my problem, but no dice (basically tried changing up the Java versions and uninstalling/reinstalling eclipse and reinstalling all the updates). This problem only started after an update with the android SDK in the last few days from what i can figure (haven't exported the app since Thursday and this is the only thing that I can think of that has changed). Do any of you have any ideas that could help me out? Here is the full stack trace.
[2014-05-10 20:04:02 - ***********] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (2f2a2a2a) or version    (2a2a.2a2a)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at  com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:733)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:328)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:403)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
...while parsing com/badlogic/gdx/graphics/g2d/Batch.class

[2014-05-10 20:04:02 - ***********] Dx 1 error; aborting
[2014-05-10 20:04:02 - ***********] Conversion to Dalvik format failed with error 1

EDIT: I also changed the Proguard file in the Android SDK as described here: Dx bad class file magic (cafebabe) or version (0033.0000) with ADK14. That didnt seem to do anything.

A: Alright. I figured this out by looking at the file that was being parsed "com/badlogic/gdx/graphics/g2d/Batch.class" and assuming that the problem had something to do with a library attached to my libgdx project. I made a new libgdx project and moved over all of the files from my old project to the new one. Things are working fine now and the project builds correctly. Hopefully this helps somebody out in the future.


text:
Q: How to save supervisord log files from docker container to machine using docker-compose? My project runs with supervisor on docker container. All the stdout_logfile files are stored in "logs" folder (inside docker container) and I need them to be saved in the same directory on my local machine. I added volumes, but got socket error. docker-compose.yml:
  version: '3'
  services:
    web:
      build: ./
      command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --noinput --i rest_framework && cd supervisor && supervisord -c supervisord.conf && tail -f /dev/null"
      ports:
        - "${webport}:8080"
      env_file:
        - ./.env
      links:
        - redis
      volumes:
       - ./logs:/orion-amr/logs
    redis:
      image: 'bitnami/redis:latest'
      container_name: $redishostname
      environment:
        - REDIS_PASSWORD=$redispassword
  volumes:
    logs:

But I got following error:
    Error: Cannot open an HTTP server: socket.error reported errno.EIO (5)

However, new supervisord.log file appeared in logs folder(on the computer) and there is:
2020-07-30 11:15:07,528 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-07-30 11:15:07,529 INFO Included extra file "/orion-amr/supervisor/conf.d/amr.conf" during parsing

What happened, who can help?

A: As Adiii hinted in the comment, this is not the problem of the docker configuration. The answer to the question Adiii is refering to states:

Supervisord switches to UNIX user account before any processing.
You need to specify what kind of user account it should use, run the daemon as root but specify user in the config file

Therefore you have three different options as your solution:
1. Change the supervisor configuration to run as some other user:
[program:myprogram]
...
user=user1

You will have to map the config file from outside the container to the inside the container through volumes in your service in docker-compose.yaml or COPY it during the build.
2. Specify the user directive in your docker-compose.yaml. Take a look here.
version: '3'

services:
web:
...
user: user1
3. Specify the USER directive in your Dockerfile. As per docs it states:

The USER instruction sets the user name (or UID) and optionally the user group (or GID) to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.

Since you do not share the intent of the web container, you alone have to decide the best course of action. I would go with option one though, it's more maintainable.


text:
Q: Framework/software for dynamic WPS creation We have some specific EO data processing facility and are about to provide an access to one using WPS-based interface. The are plenty of solutions for the task. However, it is hard to find one that meets our requirements:

*

*Ability to deploy services (or processes) automatically (without UI)

*Ability to deploy service without rebuilding from sources or restarting the container. I.e. deployment of one service/process shouldn't affect others.

*Open/free license

There also some Java frameworks that allow to implement WPS service right in the app, but they are poorly documented.
Could anyone recommend something that suits our needs?

A: Deegree WPS could be used as a container, where custom WPS workspace could be deployed via REST API: Deploy new WPS at deegree without UI


text:
Q: Mysql select query special conditions I have 3 tables in db: file, category and file_to_category.
I have category id and need to select only files that belongs only to this category.
file_to_category table structure is:
id
file_id
category_id

is it possible to do using only 1 query ?

A: select f.*
from file f
join file_to_category fc on fc.file_id = f.id
group by f.id
having count(distinct fc.category_id) = 1
and sum(fc.category_id = $your_category_id) > 0

A: select file.file_id, FileName,category.category_id,Category from file join file_to_category
on File.file_id=file_to_category.file_id join
category on category.category_id=file_to_category.category_id group by file.file_id
having count(file.file_id)=1

DEMO


text:
Q: How to delete a portlet in Liferay 6.1 programmatically from code I'm working on Liferay 6.1
I want to delete a portlet in Liferay 6.1 from my code.
What I have done so far is:
Remove

Above code is working fine. But it is working on the current page only i.e. it can delete the portlet(s) which is there on the current page only.
But I want to delete the portlet(s) which could be some where on the menu of my portal using its layout id.
Please suggest a way out.
Thanks in advance.
Regards,
Varun Jain

A: public void removePortlets(ActionRequest request, ActionResponse response)
            throws PortletException {
        ThemeDisplay themeDisplay = (ThemeDisplay) request
                .getAttribute(WebKeys.THEME_DISPLAY);
        long groupId = themeDisplay.getScopeGroupId();
        String friendlyURL = "/demochildpage";
        boolean privateLayout = false;
        long userId = themeDisplay.getUserId();
        try {
            Layout layout = LayoutLocalServiceUtil.getFriendlyURLLayout(
                    groupId, privateLayout, friendlyURL);
            LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout
                    .getLayoutType();
            layoutTypePortlet.removePortletId(userId, "28");
            LayoutLocalServiceUtil.updateLayout(layout.getGroupId(),
                    layout.getPrivateLayout(), layout.getLayoutId(),
                    layout.getTypeSettings());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

A: Way to go would be:
query the database for all Layouts on which the portlet is on, than iterate and delete.
You would need to implement a custom query or a dynamic query if I am not overseeing something. Maybe there already is a service function to get the desired Layout Id's, but I doubt that.

A: Never tried, but I think, you can achieve what you want using Liferay's service.
The process seems to be simple enough as following:
1. Get list of all pages / layouts using com.liferay.portal.service.LayoutLocalServiceUtil.getLayouts(long groupId, boolean privateLayout)
2. Iterate layout list and extract list of portletIds from layout object casted to com.liferay.portal.model.LayoutTypePortlet
3. Iterate portletIds and compare each porteltId with your portletId string.
4. If matched call com.liferay.portal.model.layoutTypePortlet.removePortletId(long userId, String portletId) and update layout using LayoutLocalServiceUtil.updateLayout(Layout layout)
So, the sample code would look like:
String portletId = "#p_p_id_28_";
long userId = user.getUserId();
ArrayList<Layout> layouts = LayoutLocalServiceUtil.getLayouts(10180, true);

for(Layout layout : layouts){
    if(!layout.isHidden()){
        LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();
        ArrayList<String> layoutPortletIds = layoutTypePortlet.getPortletIds();

        for(String layoutPortletId : layoutPortletIds){
            if(layoutPortletId.equalsIgnoreCase(portletId)){
                layoutTypePortlet.removePortletId(userId, portletId);
                LayoutLocalServiceUtil.updateLayout(layout);
            }
        }
    }
}


text:
Q: DetailView not showing data I am trying to display a ListView of items that when clicked opens the respective DetailView for that item.  This is a pretty straightforward thing to do in Django, but I'm running into some trouble with it.
I have successfully created a ListView, but I can't get the DetailView to display the information for each item.
I am building a password safe. The ListView lists all the passwords saved, and the DetailView is the view/edit page for each password. And yes, I realize actually putting a password safe on the internet is a terrible idea, it's just a test project :)
My PasswordSafe class:
class PasswordSafe(models.Model):
    user = models.OneToOneField(User)

    pwWebsite = models.CharField(max_length=30)
    pwUsername = models.CharField(max_length=30)
    pwEmail = models.CharField(max_length=30)
    pwPassword = models.CharField(max_length=30)

    def __unicode__(self):              # __unicode__ on Python 2, __str__ on Python 3
        return self.pwWebsite

User.passwordSafe = property(lambda u: PasswordSafe.objects.get_or_create(user=u)[0])

My urls.py:
from django.conf.urls import patterns, include, url
from django.views.generic import ListView, DetailView
from models import PasswordSafe

urlpatterns = [
    url(r'^passwordSafe/$', ListView.as_view(queryset=PasswordSafe.objects.all().order_by('-pwWebsite')[:10], template_name = 'userprofile/passwordSafe_list.html')),
    url(r'^passwordSafe/(?P<pk>\d+)/$', DetailView.as_view(model=PasswordSafe, template_name='userprofile/passwordSafe.html')),
    ]

I use the following code successfully in my ListView template (passwordSafe_list.html):
{% for passwordSafe in object_list %}

{{ passwordSafe.pwWebsite }}

{% endfor %}

However, when I try to use the passwordSafe data in my Detailview (the passwordSafe.html template), nothing shows up.  I use the following code to try and change the title:
<title>{% block title %} | Edit {{ passwordSafe.pwWebsite }} Password{% endblock %}</title>

This should show a title something like "Password Safe | Edit Google Password", but passwordSafe.pwWebsite returns with nothing.  Am I doing something wrong in trying to reference passwordSafe from this template?  I know I haven't passed a query set like I did with the ListView, but I'm not sure if that's part of the problem or not.

A: In the DetailView, Django uses the model name in lowercase, by default, if you haven't set context_object_name.
{{ passwordsafe.pwWebsite }}


text:
Q: Angular material datatable paginator returns undefined when using Akita Entity Store plugin I have been stuck with this for two days and I hope someone can point me to a solution. I have an Angular application using Akita for state management and one of the components is tasked with loading a list of customers. I have placed the important bits of my code below.
// customers.component.ts
export class IndexComponent implements OnInit, AfterViewInit, OnDestroy {

    // Constructor and other definitions are here

    customers$: Observable<Customer[]>;
    @ViewChild(MatPaginator) private _paginator: MatPaginator;
    @ViewChild(MatSort) private _sort: MatSort;

    ngOnInit(): void {
        this.customerService.get().subscribe();

        this.customers$ = this._customersQuery.customers$;
    }

    ngAfterViewInit(): void {
        if (this._sort && this._paginator) {
            // Code here is never executed
        }
    }
}

// customer.service.ts
export class CustomerService extends NgEntityService<CustomerState> {

    // Constructor is here

    get() {
        return this.http.get<Customer[]>('/api/customers').pipe(
            tap(entities => {
                this.CustomerStore.set(entities);
            })
        );
    }
}

// customer.query.ts
export class CustomerQuery extends QueryEntity<CustomerState> {

    public customers$: Observable<Customer[]> = this.selectAll();

    constructor(protected store: CustomerStore) {
        super(store);
    }

}

// customer.component.html
<ng-container *ngIf="(customers$ | async) as customers">
    <ng-container *ngIf="customers.length > 0; else noCustomers">
        // The table goes here
        <mat-paginator>
            // Paginator options go here
        </mat-paginator>
    </ng-container>
</ng-container>

<ng-template #noCustomers>
No Customers
</ng-template>

No matter what I do, I always get an undefined Paginator instance. I am not sure what I am doing wrong. I would appreciate any assistance. Thank you.

A: The problem is that the element that you are using ViewChild on is in an ngIf:
      @ViewChild(MatPaginator) private _paginator: MatPaginator;

The paginator you are trying to bind to isn't in the DOM when the component is initialized, because it's hidden by the ngIf, therefore the binding doesn't occur.
This is a long discussion on how to get around this issue.
The TLDR solution is to use bind to the native HTML hidden property and flip your ngIf logic. That's not so simple with your code because of the nesting of ngIfs and using ng-containers, not divs.


text:
Q: Setting adMob ad at the bottom of a layout I can't seem to get my adview to appear at the very bottom. It appears right after the last button in my xml layout. I've tried everything from new layouts to weight's and it won't work for me. If you could help, that'd be great!
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <Button
            android:id="@+id/reason_1"
            android:layout_width="fill_parent"
            android:layout_height="75dp"
            android:background="@drawable/button"
            android:text="@string/reason_1" />

        <Button
            android:id="@+id/reason_2"
            android:layout_width="fill_parent"
            android:layout_height="75dp"
            android:background="@drawable/button"
            android:text="@string/reason_2" />

        <Button
            android:id="@+id/reason_3"
            android:layout_width="fill_parent"
            android:layout_height="75dp"
            android:background="@drawable/button"
            android:text="@string/reason_3" />

        <Button
            android:id="@+id/reason_button"
            android:layout_width="fill_parent"
            android:layout_height="75dp"
            android:background="@drawable/button_layout"
            android:drawableLeft="@drawable/ic_credit_cards"
            android:drawableRight="@drawable/ic_credit_cards"
            android:text="@string/reason_button_string" />

        <com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            ads:adSize="BANNER"
            ads:adUnitId="xxxxxx"
            ads:loadAdOnCreate="true" >
        </com.google.ads.AdView>
    </LinearLayout>

</ScrollView>

A: The idea is to use RelativeLayout and place the ad at the bottom. Then place the Scrollview above it, so the ad always is at the bottom of the screen. Don't use fill_parent, it's deprecated.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginTop="5dp"
    ads:adSize="BANNER"
    ads:adUnitId="xxxxxx"
    ads:loadAdOnCreate="true" >
</com.google.ads.AdView>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/adView" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <Button
        android:id="@+id/reason_1"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_1" />

    <Button
        android:id="@+id/reason_2"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_2" />

    <Button
        android:id="@+id/reason_3"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_3" />

    <Button
        android:id="@+id/reason_button"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button_layout"
        android:drawableLeft="@drawable/ic_credit_cards"
        android:drawableRight="@drawable/ic_credit_cards"
        android:text="@string/reason_button_string" />
    </LinearLayout>
</ScrollView>

</RelativeLayout>

A: @svenoaks solved my answer 3/4ths of the way. Just had to fine tune it. Here's the restuls.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginTop="5dp"
    ads:adSize="BANNER"
    ads:adUnitId="xxxxxx"
    ads:loadAdOnCreate="true" >
</com.google.ads.AdView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <Button
        android:id="@+id/reason_1"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_1" />

    <Button
        android:id="@+id/reason_2"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_2" />

    <Button
        android:id="@+id/reason_3"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button"
        android:text="@string/reason_3" />

    <Button
        android:id="@+id/reason_button"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:background="@drawable/button_layout"
        android:drawableLeft="@drawable/ic_credit_cards"
        android:drawableRight="@drawable/ic_credit_cards"
        android:text="@string/reason_button_text" />
    </LinearLayout>

</RelativeLayout>


text:
Q: Column layout in EXTJS I am new to ExtJs. I need to create an entry form in 2 columns using column layout.
My code is as follows:
Ext.onReady(function(){

                var patientForm = new Ext.FormPanel({
                    renderTo: "patientCreation",
                    frame: true,
                    title: 'Search Criteria',
                    labelAlign: 'left',
                    labelStyle: 'font-weight:bold;',
                    labelWidth: 85,
                    width: 900,
                    items: [
                    {
                        layout:'column',
                        items:[
                        {   // column #1
                            columnWidth: .33,
                            layout: 'form',
                            items: [
                                {   xtype: 'textfield',
                                    fieldLabel: 'FirstName',
                                    name: 'firstName',
                                    vtype : 'alpha',
                                    allowBlank:false
                                },{
                                    xtype: 'textfield',
                                    fieldLabel: 'MiddleName',
                                    name: 'middleName',
                                    vtype : 'alpha'
                                }
                            ] // close items for first column
                        }]
                    }]

                        });
                        var win = new Ext.Window({
                            layout:'form',
                            closable: false,
                            resizable: false,
                            plain: true,
                            border: false,
                            items: [patientForm]
                        });
            win.show();
            });

But when I run the code, I got h is undefined error. How to design a form in column layout? Is there any procedure, steps or links which give a clear idea?

A: I have run the same code with ExtJs 3.2.2 and got a similar error. But when I removed renderTo: "patientCreation"
code worked:

That part is not necessary 'cause you are placing the form in a the window.

A: I do not know anything about ExtJS 3. If you are using ExtJS 4, then you have specified layout config at wrong place. You have specified it inside items config, it should not be inside items config.
Layout can be specified as follows in ExtJS 4:
Ext.define('your_domain_name.viewName', {
    extend : 'Ext.panel.Panel',
    alias : 'widget.any_name_you_want',
    layout : 'column',

    initComponent : function() {
        this.items = [
            // all items inside form/panel will go here
        ];
    this.callParent(arguments);
    }
});

You can get sample code about all the panels here

A: try applying renderTo config to window instead of form
check example


text:
Q: Google Chart not taking up 100% of space Firstly, a big shout out to this example:
https://www.c-sharpcorner.com/UploadFile/ca9151/google-charts-api-using-database-in-Asp-Net/
If you want a simple walk-through of building a Google Chart, then that is perfect.
In saying that ... both in that example, and on the one in my project ... I can't get the chart to start at the left of the designated section. it keeps indenting. It's worse when I hide the axis labels as the space just becomes larger due to the lack of words.

Does anyone know how to make them take up 100% of the width? (in the image, i want the chart to start at the red line and go all the way to the other side of the div)
Thanks in advance.

A: by default, the chart will not fill the width and height of the container.
use chartArea options to stretch the chart to the edges of the container,
use top, left, bottom, right to leave room for the axis labels, title, etc.
chartArea: {
  height: '100%',
  width: '100%',
  top: 48,
  left: 48,
  right: 16,
  bottom: 48
},
height: '100%',
width: '100%',

redraw the chart on 'resize' to make it responsive,
see following working snippet...

google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = google.visualization.arrayToDataTable([
    ['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Average'],
    ['2019/01', 1, 2, 7, 3],
    ['2019/02', 5, 1, 3, 3.5],
    ['2019/03', 4, 3, 9, 6],
    ['2019/04', 1, 3, 8, 5],
    ['2019/05', 2, 6, 8, 4],
    ['2019/06', 3, 1, 9, 3],
  ]);

  var options = {
    chartArea: {
      height: '100%',
      width: '100%',
      top: 48,
      left: 48,
      right: 16,
      bottom: 48
    },
    height: '100%',
    width: '100%',

    title : 'Monthly Coffee Production by Country',
    vAxis: {title: 'Cups'},
    hAxis: {title: 'Month'},
    seriesType: 'bars',
    series: {3: {type: 'area'}}
  };

  var chart = new google.visualization.ComboChart(document.getElementById('chart'));

  drawChart();
  window.addEventListener('resize', drawChart, false);
  function drawChart() {
    chart.draw(data, options);
  }
});
html, body {
  height: 100%;
  margin: 0px 0px 0px 0px;
  overflow: hidden;
  padding: 0px 0px 0px 0px;
}

#chart {
  height: 100%;
}


text:
Q: Currency with 5 decimal digits? I need to translate following C# code into Delphi:
decimal XYZ = decimal.Round(dataset123.XYZ, 5, MidpointRounding.AwayFromZero);

The result will be saved into a float field in a MSSQL Database.
When I work with double in Delphi, there are several problems since it is no fixed decimal. Also, when saved into the ADO database, the database viewer often shows a extremely long number because it has too many digits. Additionally, there seems to be a rounding method issue, where the rounding is not always done "away from zero".
I want to fix the most severe problem for now. I need a 5-digit currency, but Delphi only has the data type currency which has 4-digits. Having a 5 digit value is an important requirement for this kind of project / business process.
At some internet sources, I read that people talk about such a code:
var
  x: Decimal[5,3]

But this syntax isn't valid for me. I work with Delphi 2007.
Is there anything I can do to get a 5-digit fixed decimal?

A: Here is some code using David Heffernan's suggestion to show you how to get started:
unit UnitMyCurrency;

interface

uses
  System.SysUtils;

type
  TMyCurrency = record
    Value : int64;

    class operator implicit( pValue : integer ) : TMyCurrency;
    class operator implicit( pValue : single ) : TMyCurrency;
    class operator implicit( pValue : TMyCurrency ) : single;

    class operator Add( p1 : TMyCurrency; p2 : TMyCurrency ) : TMyCurrency;
    class operator Subtract( p1 : TMyCurrency; p2 : TMyCurrency ) : TMyCurrency;

    class operator NotEqual( p1 : TMyCurrency; p2 : single ) : boolean;
  const
    cFactor = 100000;
  end;

implementation

{ TMyCurrency }

class operator TMyCurrency.implicit(pValue: integer): TMyCurrency;
begin
  Result := pValue * cFactor;
end;

class operator TMyCurrency.implicit(pValue: single): TMyCurrency;
begin
  Result := round( pValue * cFactor);
end;

class operator TMyCurrency.Add(p1, p2: TMyCurrency): TMyCurrency;
begin
  Result := TMyCurrency( p1.Value + p2.Value );
end;

class operator TMyCurrency.implicit(pValue: TMyCurrency): single;
begin
  Result := pValue.Value / cFactor;
end;

class operator TMyCurrency.NotEqual(p1: TMyCurrency; p2: single): boolean;
begin
  Result := TMyCurrency( p2 ).Value <> p1.Value;
end;

class operator TMyCurrency.Subtract(p1, p2: TMyCurrency): TMyCurrency;
begin
  Result.Value := p1.Value - p2.Value;
end;

procedure Test;
var
  v1, v2, v3 : TMyCurrency;
begin
  v1 := 5.12345;
  v2 := 6.00000;
  if (v1 + v2 ) <> 11.12345  then
  begin
    raise Exception.Create('Error Message');
  end;
end;

end.

Obviously it is not complete, but when finished you would have a new type that does what you need and that you have complete control over.
The following shows how to use overloaded operators. It is for Seattle, but nothing has changed since 2007.
http://docwiki.embarcadero.com/RADStudio/en/Operator_Overloading_(Delphi)

A: The easy way is to use the variable CurrencyDecimals.
Something like that:
var
  price: Double;

begin
  price:= 1234.56789;
  CurrencyDecimals := 5;
  ShowMessage('Price = '+Format('%m', [price]));
end;


text:
Q: Objective C Preserve Changes Made by A Block To A Property For some reason this code does not work:
[request setCompletionBlock:^{
    NSString *response = [request responseString];
    NSDictionary *data = [response JSONValue];
    NSArray *events = (NSArray *)[data objectForKey:@"objects"];

    for (NSMutableDictionary *event in events){

        /* experimental code*/
        NSString *urlString = [NSString
                               stringWithFormat:
                               @"http://localhost:8000%@?format=json",
                               [event objectForKey:@"tournament"]];

        NSURL *url2 = [NSURL URLWithString:urlString];
        ASIHTTPRequest *request2 = [ASIHTTPRequest requestWithURL:url2];
        [request2 setCompletionBlock:^{
            NSString *responseString = [request2 responseString];
            NSDictionary *tournamentDict = [responseString JSONValue];
            self.tournamentString = [tournamentDict objectForKey:@"tournament"];
        }];
        [request2 startAsynchronous];

        /* end experimental code */
        NSLog(@"%@", self.tournamentString);
        [mutableArray addObject:event];
    }
    self.eventsArray = mutableArray;
    [MBProgressHUD hideHUDForView:self.view animated:YES];

    [self.tableView reloadData];
}];

so here are 2 asynchronous requests, in which I fire one after another. I want to change the value of the property tournamentText after the second request executes.
Inside the completion block for the second request, when I NSLog self.tournamentText, it displays the text I want to retrieve.
Outside the block, an NSLog produces a nil.
What can I do to preserve the changes to self.tournamentText? Thanks in advanced! Please do tell me if I missed an Apple documentation on this.

A: You should probably apply the __block storage type modifier to the variable (outside of the block).
__block NSDictionary *tournamentDict;
See Apple's documentation on interaction between blocks and variables (in Blocks Programming Topics) for more info.
By the way, you do realize that you have a block within a block, rather than two separate blocks after another? To preserve the changes to the variable outside the second block, try this:
[request setCompletionBlock:^{
    NSString *response = [request responseString];
    NSDictionary *data = [response JSONValue];
    NSArray *events = (NSArray *)[data objectForKey:@"objects"];

    for (NSMutableDictionary *event in events){

        /* experimental code*/
        NSString *urlString = [NSString
                               stringWithFormat:
                               @"http://localhost:8000%@?format=json",
                               [event objectForKey:@"tournament"]];

        NSURL *url2 = [NSURL URLWithString:urlString];
        ASIHTTPRequest *request2 = [ASIHTTPRequest requestWithURL:url2];
        __block NSDictionary *tournamentDict;
        [request2 setCompletionBlock:^{
            NSString *responseString = [request2 responseString];
            tournamentDict = [responseString JSONValue];
            self.tournamentString = [tournamentDict objectForKey:@"tournament"];
        }];
        [request2 startAsynchronous];

        /* end experimental code */
        NSLog(@"%@", self.tournamentString);
        [mutableArray addObject:event];
    }
    self.eventsArray = mutableArray;
    [MBProgressHUD hideHUDForView:self.view animated:YES];

    [self.tableView reloadData];
}];


text:
Q: How can I use MimeMessageHelper to send HTML template emails? How do I alter below code to send emails with body as HTML templates? What I tried was changing mimeMessageHelper.setText() method to mimeMessageHelper.setContent() and apparently that doesn't work. I'd like to know if anyone can share some insight on how to do this.
private void sendEmailAndUpdateCount(EmailContent emailContent, JavaMailSender mailSender) {
    System.out.println(emailContent.toString());
    MimeMessage mimeMessage = mailSender.createMimeMessage();

    try {
        MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);

        mimeMessageHelper.setSubject(emailContent.getSubject());
        mimeMessageHelper.setFrom(new InternetAddress(fromEmail, fromEmailName));
        mimeMessageHelper.setTo(emailContent.getToRecipients().get(0));
        mimeMessageHelper.setText(emailContent.getBody());
        mimeMessageHelper.addAttachment("Invoice - " + emailContent.getAttachmentName(), new File(emailContent.getAttachment()));

        mailSender.send(mimeMessageHelper.getMimeMessage());

    } catch (MessagingException | UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    progressCount.getAndIncrement();
}

A: setText recieves 2nd argument, boolean html.
Also, call mimeMessage.saveChanges() before the send, it might help.


text:
Q: Delphi: звук TrayIcon В Delphi имеется компонент TrayIcon для создания иконки в трее задач Windows. Также данный компонент позволяет создавать "Уведомления". Можно указать текст сообщения, время до сокрытия и другие параметры. Когда появляется такое "Уведомление" проигрывается соответствующий системный звук.
Мой вопрос состоит в том, можно ли изменить этот системный звук на свой пользовательский или хотя бы убрать его при наступлении "Уведомления"?
procedure ShowBallon(aText: string);
begin
  Form1.TrayIcon1.Visible := True;
  Form1.TrayIcon1.Animate := True;
  Form1.TrayIcon1.BalloonHint := aText;
  Form1.TrayIcon1.ShowBalloonHint;
end;

A: Компонент TTrayIcon является оберткой WinApi-функции Shell_NotifyIcon (это можно выяснить, если заглянуть в реализацию метода ShowBalloonHint).
Идем в msdn, ищем описание: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shell_notifyiconw
Функция принимает на вход структуру NOTIFYICONDATA, в описании которой https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa сказано, что если в поле dwInfoFlags установить флаг NIIF_NOSOUND, то звук воспроизводиться не будет.
Далее по исходникам видим, что поле структуры dwInfoFlags заполняется данными из свойства класса BalloonFlags.
Но в типе TBalloonFlags нет флага, соответствующего NIIF_NOSOUND
Можно попробовать перед вызовом сделать следующий фокус:
Form1.TrayIcon1.BalloonFlags = TBalloonFlags(Cardianl(Form1.TrayIcon1.BalloonFlags) OR NIIF_NOSOUND);

перед вызовом ShowBalloonHint.
Возможно потребуется отключить какие-нибудь проверки компилятора.
Если не сработает, придется писать свой класс-наследник от TTrayIcon и перегружать метод ShowBalloonHint, благо он виртуальный.
PS
Изменить звук не получится, т.к. он устанавливается в свойствах оболочки (Shell)


text:
Q: iOS string localization command genstring fails genstring command produces following error:

find: MyViewController.m: unknown primary or operator

Full command:
$ find . -name *.m | xargs genstrings -o en.lproj

How can I fix this?


text:
Q: Building a C# Project through SVN using Jenkins - Build succeeds, but where is the output? What i want is to create installable setup file of a C# project, using SVN as Source Code Manager, and Jenkins as CI tool. I have configured jenkins by entering the SVN repository URL. When i build the project, though the build succeeds, but what i get as output are 2 xml files.
How would i be able to create the installable setup file for this project.

A: Look at the console output for the job.  I suspect your job has built the output you expect but Jenkins is just not presenting it to you.  You'll need to alter the Jenkins job to tell it what you are expecting is the output.
Jobs can archive and/or fingerprint the output files.  If you alter your Jenkins job, within the configure page, you can choose which files to archive.  You need to tell Jenkins where your build output is, e.g. MyProject\bin\Release\*.  Once Jenkins know this it will store the files you've identified and present them as the jobs output artifacts.
You can then use those output files to create the installable setup - either manually, or more preferably as another Jenkin job.
You can have another Jenkins job that copys to artifacts from an upstream job (see the CopyArtifact plugin) and then create the installable setup using those and whatever method is approiate for your project and deployment needs.
Alteratively, you could alter the original job, adding a build step to take the built output and create the installer - but again you'd need to tell Jenkins that the *.msi or *.zip etc that it creates is the output artifact.
N.B. Fingerprinting is a method Jenkins uses to store the hash of key files from jobs and track which versions of which files were used where.  E.g. if JobA builds a MyProject.dll file, fingerprinting it means you can tell that JobB build123 used the dll from JobA build5.
Generally I archive all the build output (*.dll, *.exe, *.msi, etc) and tell Jenkins to fingerprint all archive artifact.
EDIT:
I only have easy access to a Hudson v1.386 server at the moment (i.e. the version beofre the Hudson/Jenkins split) so this might be subtly different than the Jenkins version.
First, go to relavent job page within Jenkins and click on the Workspace link on the left.  This should allow you to see all the files in the workspace, i.e. anything checked out and built after the last build finished.  Check that the output files you are expecting are there.  If not, you've got a problem with your build steps not generating the output you expected.  Fix that first.
Once the output you expect is there, you can tell Jenkins to archive those output files after every build.  On the job configuration page, there is a section entitled Post-build Actions.  The second option here is "Archive the artifacts", check that box.  Then in the "Files to archive" field, put the list of files you deem your output.  For example, I've put **/Release/*.msi, **/bin/Release/*, Database/Scripts/*.sql.
I've also checked the "Record fingerprints of files to track usage" option and then "Fingerprint all archived artifacts"
Having done this, hit Save at the bottom and then run a build.  Once the build has completed, you should see at the bottom of the console output something like:

Archiving artifacts
  Recording fingerprints

The project page should then have a Last Successful Artifacts link, and builds (from this point on) will have a Build Artifacts link.
These links will show a list of the files archived and allow you to download them.  I believe that is what you are after.
I'd also suggest lookng at this pother questio for more info: Archive-the-artifacts-in-hudson-jenkins


text:
Q: UIAlertView message too long I have an alertView that pops up when reachability has detected wifi.  I have both english and french translations of this.  The problem is the french version's text is a bit longer, and I do have some line breaks in there.
When the text is too long, the alertView changes to a white background with a scrollable text view.  Is there any way around this?  The strange thing is that this only happens on retina devices (or non-retina when in landscape, but that makes more sense).  Non-retina devices show the whole message normally.  It seems like retina devices having more landscape shouldn't make this happen.
Help?
Thanks in advance.

A: First of all retina devices would produce the same results seeing as they have the same amount of screen real-estate. The difference is in pixel density, which means that an object on retina will be the same physical size but will actually be using 4 times the pixels which produces a much clearer and sharper image.
Secondly, there is no way you can avoid this. UIAlertView is a class that Apple allows VERY little customization of, so you may be better off making a custom view and presenting it yourself. This is probably only happening in landscape mode because the alert gets less screen area under these circumstances.
So overall, I would recommend that you either create your own custom pop-up or you trim down the amount of text you're displaying in the alert.