text:
Q: groovy parse xml into pojo i need to get this url (http://localhost:8983/solr/select/?q=treen&omitHeader=true) and get the response as xml, and for each record, parse it to a class and then create a final map with all the info. Something like this:
 class SolrController {

    def solr= {
        def map_ = [:]

        def json = grails.converters.XML.parse( new URL( 'http://localhost:8983/solr/select/?q=treen&omitHeader=true' ).text)

        json.each{
            Wikidoc aa = new wikiDoc(id: it.id, title: it.title)
            map_.put(aa.id, aa)
        }
    }
}

class wikiDoc{
    String id
    String title
}

The xml is the following:
<response>
<result name="response" numFound="18" start="0">
<doc>
<str name="id">2722092</str>
<arr name="title">
<str>David Treen</str>
</arr>
</doc>
<doc>
<str name="id">3380835</str>
<arr name="title">
<str>Eleição para governador da Luisiana em 1979</str>
</arr>
</doc>
<doc>
<str name="id">3380827</str>
<arr name="title">
<str>Eleição para governador da Luisiana em 1983</str>
</arr>
</doc>
<doc>
<str name="id">2722798</str>
<arr name="title">
<str>Edwin Edwards</str>
</arr>
</doc>
<doc>
<str name="id">1791213</str>
<arr name="title">
<str>Predefinição:Governadores da Luisiana</str>
</arr>
</doc>
<doc>
<str name="id">2941389</str>
<arr name="title">
<str>Career (filme de 1959)</str>
</arr>
</doc>
<doc>
<str name="id">1969582</str>
<arr name="title">
<str>Kitty Foyle</str>
</arr>
</doc>
<doc>
<str name="id">2148082</str>
<arr name="title">
<str>Christmas with the Kranks</str>
</arr>
</doc>
<doc>
<str name="id">2077295</str>
<arr name="title">
<str>The Sad Sack</str>
</arr>
</doc>
<doc>
<str name="id">2765563</str>
<arr name="title">
<str>David Vitter</str>
</arr>
</doc>
</result>
</response>

I would apreciate help with this, i don't see how can it be done, because can't acess, for example, json[1].id
Thanks in adv,
RR

A: You should be able to use something like:
def solr= {
  def json = grails.converters.XML.parse( new URL( 'http://localhost:8983/solr/select/?q=treen&omitHeader=true' ).text )

  // Start with [:] for every doc element e perform the closure
  def map_ = json.result.doc.inject( [:] ) { map, e ->

    // For this doc element, find the str element with name='id', and get its text()
    String id = e.str.find { it.@name == 'id' }.text()

    // then, find the arr element with name='title', and get the text() from the str element within
    String title = e.arr.find { it.@name == 'title' }.str.text()

    // Then, push this new map entry into our current map
    map << [ (id): new WikiDoc( id:id, title:title ) ]
  }
}

Given your example xml, at the end of that function, map_ should be equal to:
[ "2722092":WikiDoc(2722092, David Treen),
  "3380835":WikiDoc(3380835, Eleição para governador da Luisiana em 1979),
  "3380827":WikiDoc(3380827, Eleição para governador da Luisiana em 1983),
  "2722798":WikiDoc(2722798, Edwin Edwards),
  "1791213":WikiDoc(1791213, Predefinição:Governadores da Luisiana),
  "2941389":WikiDoc(2941389, Career (filme de 1959)),
  "1969582":WikiDoc(1969582, Kitty Foyle),
  "2148082":WikiDoc(2148082, Christmas with the Kranks),
  "2077295":WikiDoc(2077295, The Sad Sack),
  "2765563":WikiDoc(2765563, David Vitter) ]


text:
Q: Python: store the function's return value in a variable if called using thread I'm using the threading library in order to perform some parallel data retrieval (then I need to concatenate the results obtained) however I'm not able to store the return of my function
Here's a simple example
def test(i):
    return i + 1

threading.Timer(0, x = test(0))
print(x) #Should Print 1

The problem that its forbidden to put x=test(0) while calling the thread
Is there a way to store the function's return value in a variable?
Thanks

A: import threading

def test(i):
    global x
    x = i + 1

x = 0
threading.Timer(0, test(0))
print(x)

Place a global variable outside of the function which can then be altered by the individual thread.
If you are however doing this to gather data, you will need to have a way of testing if the threads are complete before concatenating the results.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Frame Y not changing? This is a custom navigation bar, made from a UIView. It doesn't take control of it's setter method for setFrame. I feel like maybe i'm missing something simple.
if (self.statusBarHiddenInitially == NO) {
        self.navigationBar.frame = CGRectMake(self.navigationBar.frame.origin.x,
                                              20,
                                              self.navigationBar.frame.size.width,
                                              self.navigationBar.frame.size.height);
        NSLog(@"test frame: %f", self.navigationBar.frame.origin.y);
    }

Test frame returns 0.000000.


text:
Q: Increase Memcached Max Item Size I'm trying to increase the max item size in my memcached installation.
So far, I have tried editing /etc/memcached.conf adding the line -I 3M followed by restarting memcached.
This WAS working for me, but seems to have reverted overnight. The setting is still there but as an item exceeds 1MB the cache is cleared.
You can see my original issue here Django Memcached Cache Disappears
I have also tried entering the command memcached -I 3m which returns:
WARNING: Setting item max size above 1MB is not recommended!
Raising this limit increases the minimum memory requirements and will decrease your memory efficiency.
can't run as root without the -u switch

Subsequently running memcached -Iu 3m returns:
Item max size cannot be less than 1024 bytes.

I have no idea what that means as I am trying to increase the max size, not decrease it and 3MB is certainly more then 1024 bytes. I'm really stumped here, all help is appreciated. Thanks.
UPDATE:
After finding the MySQL documentation on memcached I learned that the -u flag works like so memcached -u root -I 3m. This runs (still with the warning above) but then it just hangs. I've been staring at the terminal for about 10 minutes hoping its going to return my prompt but no such luck. PLEASE HELP.

A: Try using a "big M", and also don't put the u directly after the -I. Try this:
memcached -I 3M -u

A: 1.

This runs (still with the warning above) but then it just hangs.

memcached is supposed to hang.  It's waiting for requests to come in on port 11211 (which is the default if you don't specify otherwise).  Use the -d flag if you want it to run without monopolizing your terminal.
2. Why are you running as root?  That seems unnecessarily privileged for an in-memory cache, unless you need to listen on a port under 1024, which you're not doing with your current command line.


text:
Q: I update my xampp and i face this errors Notice: Undefined variable: session in I update my xampp and i face this errors Notice: Undefined variable: session in
I try to php.ini but no solution i have more than 30 scipts in my localhost and i want to ignore this errors.
How can i do this

A: Put this at the end of your php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

Make that is right php.ini


text:
Q: Using UrlFetchApp in Google Apps Script to fetch a web page and resolve a server error code 500 I want to get some listing data from YellowPages.com using Google Apps Script. Using UrlFetchApp.fetch(url) in GAS (as shown below), the server throws a 500 error. However, I can successfully use IMPORTXML() inside a Google Sheet on the same URL and it works fine.
What explains this difference in behavior? And what can I do differently in Google Apps Script to achieve the same, desired result I'm getting from IMPORTXML()?
Google Sheets
=IMPORTXML("https://www.yellowpages.com/al/accounting-services", "//div[@class='v-card']//a/@href")

The behavior is as expected. The result is an array of links.
Google Apps Script

Code.gs

const ENDPOINT = 'https://www.yellowpages.com/al/accounting-services';
const main = () => {
  const response = UrlFetchApp.fetch( ENDPOINT, );
  const responseContentText = response.getContentText();
  Logger.log('(line 5) responseContentText\n%s', responseContentText,);
  return responseContentText;
}

The behavior not as expected. The result is a 500 error.

Error message:

Exception: Request failed for https://www.yellowpages.com returned code 500. Truncated server response:
 <title>500 Internal Server Error</title>

500 Internal Server Error

openresty</... (use muteHttpExceptions option to examine full response) (line 16, file "Code")

Why is the UrlFetchApp.fetch(url) method throwing an error and what can be done to make it behave like IMPORTXML()?


text:
Q: how to bulk update in Hibernate using HQL I am having a list of elements which needs to be updated and i use the following code.
I am new to hibernate and with the errors i am not sure where I did the mistake.
Thanks for reading
    int result = factory.getCurrentSession().createQuery("update <table_name> TN "
            + "SET TN.COLUM_2= :column2, TN.COLUM_3= :column3,
            + "Where TN.COLUM_10 IN(:column10")")
            .setLong("column2", column2)
            .setString("column3", column3)
            .setParameterList("column10", column10)

            .executeUpdate();

I get exception.
"<table_name> is not mapped"

Any reference or help would be greatly appreciated!!!


text:
Q: client/server socket in c# can't connect to each other on LAN The client/server that I tried works fine with localhost but when I try to do it on another computer - One for the server, One for the client - There's an error saying No connection could be made because the target machine actively refused it 192.168.0.101:8. Can somebody help me about this matter? I already tried to turn off the firewalls on both of the computers.
The code of the program is below:
Server Side - Main Code
namespace Multiple_Connection_Server
{
    public partial class Main : Form
    {
        Listener listener;
        public Main()
        {
            InitializeComponent();
            label3.Text = DateTime.Now.ToShortDateString();
            listener = new Listener(8);
            listener.SocketAccepted += new Listener.SocketAcceptedHandler(listener_SocketAccepted);
            Load += new EventHandler(Main_Load);
        }

    void Main_Load(object sender, EventArgs e)
    {
        listener.Start();
    }

    void listener_SocketAccepted(System.Net.Sockets.Socket e)
    {
        Client client = new Client(e);
        client.Received += new Client.ClientReceivedHandler(client_Received);
        client.Disconnected += new Client.ClientDisconnectedHandler(client_Disconnected);

        Invoke((MethodInvoker)delegate
        {
            listEndpoint.Items.Add(client.Endpoint.ToString());
            ListViewItem i = new ListViewItem();
            i.Text = client.Endpoint.ToString();
            i.SubItems.Add(client.ID);
            i.SubItems.Add("XX");
            i.SubItems.Add("XX");
            i.Tag = client;
            lstClient.Items.Add(i);
        });
    }

    void client_Received(Client sender, byte[] data)
    {
        string input = Encoding.Default.GetString(data);
        try
        {
            Invoke((MethodInvoker)delegate
            {
                for (int i = 0; i < lstClient.Items.Count; i++)
                {
                    Client client = lstClient.Items[i].Tag as Client;

                    if (client.ID == sender.ID)
                    {
                        lstClient.Items[i].SubItems[2].Text = Encoding.Default.GetString(data);
                        lstClient.Items[i].SubItems[3].Text = DateTime.Now.ToString();
                        listChat.Items.Add("Message: " + input);
                        break;
                    }
                }
            });

            using (StreamWriter streamWriter = new StreamWriter(@"C:\Windows\InformationLogs.txt", true))
            {
                streamWriter.WriteLine("[Date]: " + DateTime.Now.ToString() + " --- [Message Log]: " + input);

            }
        }

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

    void client_Disconnected(Client sender)
    {
        Invoke((MethodInvoker)delegate
        {
            for (int i = 0; i < lstClient.Items.Count; i++)
            {
                Client client = lstClient.Items[i].Tag as Client;

                if (client.ID == sender.ID)
                {
                    lstClient.Items.RemoveAt(i);
                    listEndpoint.Items.RemoveAt(i);
                    break;
                }
            }
        });
    }
}

}

Server Side - Listener Class
namespace Multiple_Connection_Server
{
    class Listener
    {
        Socket s;

    public bool Listening
    {
        get;
        private set;
    }

    public int Port
    {
        get;
        private set;
    }

    public Listener(int port)
    {
        Port = port;
        s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    }

    public void Start()
    {
        if (Listening)
            return;

        s.Bind(new IPEndPoint(0, Port));
        s.Listen(0);

        s.BeginAccept(callback, null);
        Listening = true;
    }

    public void Stop()
    {
        if (!Listening)
            return;

        s.Close();
        s.Dispose();
        s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    }

    void callback(IAsyncResult ar)
    {
        try
        {
            Socket s = this.s.EndAccept(ar);

            if (SocketAccepted != null)
            {
                SocketAccepted(s);
            }

            this.s.BeginAccept(callback, null);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
    public delegate void SocketAcceptedHandler(Socket e);
    public event SocketAcceptedHandler SocketAccepted;
}

}

Server Side - Client Code
namespace Multiple_Connection_Server
{
    class Client
    {
        public string ID
        {
            get;
            private set;
        }

    public IPEndPoint Endpoint
    {
        get;
        private set;
    }

    Socket sck;
    public Client(Socket accepted)
    {
        sck = accepted;
        ID = Guid.NewGuid().ToString();
        Endpoint = (IPEndPoint)sck.RemoteEndPoint;
        sck.BeginReceive(new byte[] { 0 }, 0, 0, 0, callback, null);
    }

    void callback(IAsyncResult ar)
    {
        try
        {
            sck.EndReceive(ar);

            byte[] buf = new byte[8192];

            int rec = sck.Receive(buf, buf.Length, 0);

            if (rec < buf.Length)
            {
                Array.Resize<byte>(ref buf, rec);
            }

            if (Received != null)
            {
                Received(this, buf);
            }

            sck.BeginReceive(new byte[] { 0 }, 0, 0, 0, callback, null);
        }

        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Close();

            if (Disconnected != null)
            {
                Disconnected(this);
            }
        }
    }

    public void Close()
    {
        sck.Close();
        sck.Dispose();
    }

    public delegate void ClientReceivedHandler(Client sender, byte[] data);
    public delegate void ClientDisconnectedHandler(Client sender);

    public event ClientReceivedHandler Received;
    public event ClientDisconnectedHandler Disconnected;
}

}

Client Side - Main Code
namespace Multiple_Connection_Client
{
    public partial class Main : Form
    {
        Socket sck;
        public Main()
        {
            InitializeComponent();
            sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        }

    private void btnConnect_Click_1(object sender, EventArgs e)
    {
        try
        {
            sck.Connect(txtBoxIPAdd.Text, 8);
            MessageBox.Show("Connected");
        }

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

    private void btnSend_Click_1(object sender, EventArgs e)
    {
        try
        {
            int s = sck.Send(Encoding.Default.GetBytes(txtMesg.Text));
            listBox1.Items.Add("Message: " + txtMesg.Text);
            txtMesg.Text = "";
            if (s > 0)
            {
                MessageBox.Show("Data Sent");
            }
        }

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

    private void btnClear_Click(object sender, EventArgs e)
    {
        Close();
    }
}

}

A: Port numbers below 1024 are generally reserved and require special security.  Try using a higher port number.


text:
Q: Visual basic WPF load ATL C++ dll program exit when return String type I'm using VB.net WPF with dll made with ATL for this project
but every time I run dll function, program exit with no error
please let me know why is not working and  how to fix it.
c++ function
extern "C" __declspec(dllexport) BSTR __cdecl sprint(LPSTR str1, LPSTR str2) {
    TCHAR test[100];
    sprintf_s(test, 100, "%s %s", str1, str2);

    BSTR test2 = L"helloworld";
    return test2;
}

VB.net code
declaration
    <DllImport("database.dll", CallingConvention:=CallingConvention.Cdecl)>
    Private Shared Function sprint(ByVal str1 As String, ByVal str2 As String) As String
    End Function

usage
    Private Sub On_Submit_Btn_Clk(sender As Object, e As RoutedEventArgs)
        testStr = sprint("hello", "world")
        MessageBox.Show(testStr)
    End Sub

issue:
program exit when function "sprint" called.
no issue:
program not exit when function "sprint" return integer.
only BSTR , LPTSTR, LPSTR type returns make proram exit.

A: In COM programming, a BSTR is a special LPWSTR which is allocated by SysAllocString, freed by SysFreeString. The characters are preceded by the string length, at offset -1. That means you can pass a BSTR to all functions that expect an LPCWSTR
L"helloworld" is a C++ literal, which happens to almost match the LPWSTR type, except for the const part. And VC++ will gloss over that last small problem. The easiest solution in MSVC is to use the _bstr_t wrapper type for BSTR, which does SysAllocString for you. Else you'll need to do it manually.


text:
Q: Does crypt Command Unix/Solaris 10 support 128bit encryption/decryption? I need to know whether the "crypt" Command Unix/Solaris 10 support 128bit encryption/decryption.

A: A Blog Post shows that crypt on Solaris 10 does not use anything like DES, RSA, AES etc (wich are typically involved when speaking of "128 Bit encryption"). It uses a weak function that can be broken by many tools, one mentioned in that very article. Use the openssl library or tools when you need up-to-date cryptography.

A: Use the encrypt and decrypt commands which are always installed on Solaris 10. Openssl provides similar functionalities but might be missing from a standard installation.


text:
Q: Display time left to vote again I got a voting script that allow people to vote for an item in the database every 24 hour and some more code to check if 24 hours have past or not using 'NOW()' and 'DATE_SUB( NOW(), 'INTERVAL 1 DAY'.
I'm currently trying to add the feature to display how much time is left before the user can vote again using the code below.
$time = explode(" ", $voteCheck[1]);
$year = explode("-", $time[0]);
$date = explode(":", $time[1]);

// Set it all to one long string
$time = $year[0].$year[1].$year[2].$date[0].$date[1].$date[2];

// Current time and date
$cTime = date("YmdHis");

// I get lost here

votcheck is an array from a sql string which just returns the first row as 0 or 1.
1 if the user already voted and 0 if the user can vote again.
The second row returns the date and time the user voted.
I just can't seem to figure out what to do to get the x amount of hours left before the user can vote again.
My main problem is that the length of the $time string sometime is 13 and sometime 14 characters long.

A: Ok here it is
$voted = new DateTime($time);
$daylater = date('Y-m-d H:i:s', strtotime('+1 day', $voted->format('U')));
$canvote = new DateTime($daylater);
$now = new DateTime(date("Y-m-d H:i:s"));

$diff = $canvote->format('U') - $now->format('U');

if ( $diff > 0 && $diff < 86400 ) {
    $left = gmdate("H:i:s", $diff);
    echo $left . ' left till you can vote again';
} else {
    echo 'You can vote again' ;
}

Let me know if it works

A: Is it not possible to use strtotime() to convert $voteCheck[1] directly?  You can then check the unix time stamp against the current time stamp.


text:
Q: How much does a resist bonus on armor reduce damage by? Some armors and accessories will have an effect on them which modifies resistance to a certain damage type, followed by a varying number of arrows indicating the bonus. For example, the Adama Armor has Physical Resist +1. Although having resistance to physical damage would be nice, it's difficult to determine how well compares to other armor sets without knowing how much physical damage is reduced by.
How much does a resist bonus on armor reduce damage by?


text:
Q: AttributeError when using cloudscraper object in asynchronous function import cloudscraper
import requests
import asyncio
async def scrape_prices():
    scraper_object = cloudscraper.create_scraper()
    async with scraper_object as session:
        for item_number in prices_to_be_scraped:
            hyperlink = "https://opensea.io/assets/" +
            str(get_contract_address(get_project_name())) + "/" + str(
            item_number)
            async with str(scraper_object.get(hyperlink).text) as response:
                print(await response)

ERROR IM GETTING IN TERMINAL:

async with scraper_object as session:
AttributeError: __aenter __

A: I was having a similar issue, and I found this library https://pypi.org/project/aiocfscrape/ which should be doing the same as cloudscraper does but asynchronous.
The use example that they show in the documents is this one:
    import asyncio
    from aiocfscrape import CloudflareScraper

    async def test_open_page(url):
        async with CloudflareScraper() as session:
            async with session.get(url) as resp:
                return await resp.text()

    if __name__ == '__main__':
        asyncio.run(test_open_page('<your url>'))

I hope you find this library useful.


text:
Q: Getting the last element of an array in CoffeeScript Is there a quick (short, character wise) way to get the last element of an array (assuming the array is non-empty)?
I usually do:
last = array[array.length-1] or last = array[-1..][0]

A: I like dule's suggestion, here is why:
I tested this destructuring method with 'try coffeescript', an online coffee to js compiler at http://coffeescript.org/.
Given the following coffeescript:
arr = [1,2,3,4,5]

[..., last] = arr

It compiles into:
var arr, last;

arr = [1, 2, 3, 4, 5];

last = arr[arr.length - 1];

This is really ideal. The destructuring syntax is quite clear and concise. The compiled javascript is performant. I see no reason to not use this.
(I do not have enough reputation to post this as a comment under dule's answer, so I added it as an answer even though it is a comment.)

A: If you're using a modern version of CoffeeScript, do not use this. Use the answer by dule instead.

If you don't mind modifying the array,
last = array.pop()

If you don't want the array modified,
last = array[..].pop()

That compiles to last = array.slice(0).pop(). I think it's pretty readable to people already exposed to CoffeeScript or Python slices. However, keep in mind that it will be much slower than last = array[array.length-1] for large arrays.
I wouldn't recommend last = array[-1..][0]. It's short, but I don't think its meaning is immediately obvious. It's all subjective, though.

A: It's easy and harmless to modify the Array prototype for this:
Array::last = -> @[@length - 1]

If you're already using the excellent Underscore.js, you can use its _.last(arr).

A: Another alternative is to use coffee's destructuring:
[..., last] = array

A: Or you could do this:
last = array[-1..][0]


text:
Q: Angular2 get active route After update to Angular2 rc2, and Angular2 rc3, I have error
"Property 'urlTree' does not exist on type 'Router'"
My function
isRouteActive(routePath) {
    return this.router.urlTree.contains(this.router.createUrlTree(routePath));
}

How to get active link in angular2 rc3 ?

A: If you are going to style some element according to activeRoute you can use the directive [routerLinkActive]="['your-class-name']" to the element.
routerLinkActive directive source

UPDATE
Old style (with router-deprecated):
html layout

    Dashboard

*.ts component
isActive(instruction: any[]): boolean {
    return this.router.isRouteActive(this.router.generate(instruction));
}

New style (with router version 3.0.0-alpha.7):
only html layout needed

    Dashboard

A: You might want to use ActivatedRoute
import { ActivatedRoute } from '@angular/router';

@Component({
  selector: 'contacts-detail',
  ...
})
export class ContactsDetailComponent {

  constructor(private route: ActivatedRoute) {

  }
}

A: With Angular 2 rc4 using router 3.0.0-beta.2 the Directive comment states:
HOME

However this also works:
HOME

If [routerLinkActiveOptions]="{exact: true}" is omitted the class will not be removed when the route is inactive.
See: https://github.com/angular/angular/blob/master/modules/%40angular/router/src/directives/router_link_active.ts


text:
Q: If $\phi$ and $\psi$ are homomorphisms between groups $G$ and $H$ with $\phi \psi = Id_{H}$, then $G \approx H \oplus \ker \psi$ I recently stumbled across the following statement:
If $G$ and $H$ are groups and $\phi : H \rightarrow G$ and $\psi : G \rightarrow H$ are homomorphisms with $\psi \circ \phi = Id_{H}$, then $G \approx H \oplus \ker \psi$.  I believe I have a proof, but my proof relies on $G$ being Abelian.  In the context I encountered this, every group under consideration was Abelian, but this statement was given without specifying that either group was Abelian.  My question is whether the Abelian condition is necessary.  If not, can someone provide a proof of this more general fact, and if so, can someone provide a counter-example?  If I'm correct that $G$ being Abelian is necessary, then does anyone have a cleaner proof than the nastiness I've provided below?
A quick sketch of my proof is included below.  Note that I'm a little loose with notation using $+$ for both the operations in $G$ and $H$ and I haven't written out all the details.  I hope this is still clear enough to get the idea:
Consider the map $f :  H \oplus \ker \psi \rightarrow G$ defined by $f(\left<h, k\right>) = \phi(h) + k$.  I claim $f$ is an isomorphism.  First, if $\left<h_1, k_1\right>$ and $\left< h_2, k_2 \right>$ are elements of $H \oplus \ker \psi$, then $f(\left<h_1, k_1\right> + \left< h_2, k_2 \right>) = f(\left< h_1 + h_2, k_1 + k_2\right>) = \phi(h_1 + h_2) + k_1 + k_2 = \phi(h_1) + \phi(h_2) + k_1 + k_2$.  If $G$ is Abelian, we can continue: $\phi(h_1) + \phi(h_2) + k_1 + k_2 = \phi(h_1) + k_1 + \phi(h_2) + k_2 = f(\left<h_1, k_1\right>) + f(\left<h_2, k_2\right>)$, so $f$ is a homomorphism.  Further, $f$ is injective since $\phi(h) + k = 0$ implies $\phi(h) = -k$, so $\psi(\phi(h)) = \psi(-k) = 0 = h$ using that $\psi \circ \phi = Id_{h}$ and $k \in \ker \psi$.  Finally, $f$ is surjective by the First Isomorphism Theorem (without writing out the details, the FIT tells us that there is one-to-one correspondence between cosets of $\ker \psi$ and elements of $\psi(G) = H$.  Using this we can show that $\phi(H)$ contains one representative from each coset of $\ker \psi$ in $G$ and the result follows).
Thanks for any help!

A: A result of this nature is called a spliting lemma and you've shown it is true for abelian groups. It is not true in general, and here is an example that can be found on that page spelled out a bit (which is the simplest example): take the map $S_3 \rightarrow \mathbb{Z}/2\mathbb{Z}$ given by the sign of a permutation. Then the kernel is $A_3$ and the image is $\mathbb{Z}/2\mathbb{Z}$. It is not true that $S_3=A_3\times \mathbb{Z}/2\mathbb{Z}$, which can be shown in many ways, but one is to note that $\{e\}\times \mathbb{Z}/2\mathbb{Z}$ is normal in $A_3\times \mathbb{Z}/2\mathbb{Z}$ but $S_3$ has no normal subgroup isomorphic to $\mathbb{Z}/2\mathbb{Z}$.

A: What is true is that $G$ must be the semidirect product of the kernel of $\phi$ and $\psi(H)$. To prove it, we need to show the intersection of these groups is $\{1\}$ and any element of $G$ is a product of something in the kernel of $\phi$ and something in the image of $\psi$.
The first claim follows from $\phi\circ \psi = \text{id}_H$, since if $\phi(\psi(h)) = 1$, then $h = 1$ and thus $\psi(h) = 1$.
For the second, let $g \in G$ and write $h = \phi(g)$. Then $g\psi(h)^{-1}$ is in the kernel of $\phi$ , so $g = (g\psi(h))^{-1}\psi(h)$ is the product of something in the kernel of $\phi$ and something in the image of $\psi$, as desired.
Now a semidirect product need not be a direct product, but it will be if it is abelian.


text:
Q: Tibco Spotfire, Remove text from cells I am using Tibco Spotfire to display a list of checked reports.
I have a column "Validation statuts" with (oui , non ) values
I want color cells :
      If statut is valid I  Red color
      If statut is invalid  Orange color
And remove Text
Thank you

A: You have different options here such as using a graphical table with icons or a cross table but if I undesrtand correctly, if you only want to use a data table like this:

then you can create a calculated column as:
case [status]
when "oui" then " "
when "non" then ""
end as [color status]

and set the color for it


text: Q: Can a JVM be configured so a browser will run only trusted applets? Is there browser and JVM combination that can be configured such that ONLY signed Applets will run? The purpose is to ensure that Applets must be authenticated before they are executed, even if they only access safe APIs.


text:
Q: While getting large amount of data from POST call, it loads in browser but shows failed to load response data in chrome inspect element response body There is a post api call which is called and it renders data on the UI but when i tried to see it in the inspect element response and preview tabs i get this error "failed to load response data". The array returned contains 7000 objects and each object has 80 key-value pairs. if i reduce the data which is returned with that call then it works fine.
What can be the issue with the large amount of data.


text:
Q: How to install and push Netsuite bundle from eclipse , instead of creating a suitebundler We have access to Netsuite production account but not to Sandbox account. I am creating roles,center tabs,workflows directly in Netsuite And for Scripts using the suitecloud plugin in eclipse to push the code into filecabinet.
I am aware that we can create a bundle using Suitebundler and give shared access to other account and install it there . But i dont have access to other accounts, so in this case what is the best way to test what i have created ?
I am looking for some solution like downloading the scripts,xmls(for roles,center tabs,workflows) into eclipse and then delete everything whatever i have created in netsuite to keep it fresh. And then push it from eclipse into netsuite account and test it.
Can someone please advice . Thank you .

A: You should look at SDF (SuiteCloud Development Framework) which does almost exactly that.

SuiteCloud Development Framework (SDF) is a development framework and
  deployment mechanism. It provides a foundation for a structured
  development process and supports familiar development concepts and
  patterns.
You can use SDF to create SDF project components, sometimes referred
  to as customizations, for internal use within your organization or for
  commercial distribution. These file-based projects use XML definitions
  of custom NetSuite objects, such as custom records, custom forms, and
  workflows. SDF projects also support SuiteScript files. You can use
  SDF to deploy SDF projects to your NetSuite account.
SuiteCloud IDE is an Eclipse-based or WebStorm-based integrated
  development environment (IDE) that is packaged for NetSuite platform
  development. SuiteCloud IDE interfaces with SDF and enables you to
  create SDF projects. For more information about SuiteCloud IDE, see
  SuiteCloud IDE for Eclipse Overview and SuiteCloud IDE for WebStorm
  Overview.
SuiteCloud Development Framework Command Line Interface (CLI) is a
  tool that can be used with your IDE to develop SDF projects. You can
  also create batch and shell scripts that use CLI commands to automate
  SDF project validation and deployment processes. For more information
  about CLI, see Command Line Interface Guide.


text:
Q: Converting date from cookie string format to mysql date format I have a string which is like date of the cookie Thursday, 25-Dec-1975 14:15:16 EST. I have a string which is in this format 25-Dec-1975. I want to convert it to mysql date format(2017-04-27). I tried the below way but it didn't work out.
    $get_date = "25-Dec-2016";
    $converted = Carbon::createFromFormat('Y-m-d',$get_date);
    echo $converted;

My input is in string type. Is there any other direct method to convert above in the mysql date format ?

A: Use PHP's date function
date("Y-m-d",strtotime("25-Dec-2016"));


text:
Q: Pushing into an array inside of a mongoose object I am using mongoose to push a player into a players array in mongoose when a player joins the game. I am getting the following error:
    "Can't canonicalize query: BadValue unknown top level operator: $push"
It appears to be a problem with how I'm formatting the $push but
I tried to follow this answer and am not sure how my code differs from their implementation:
pushing object into array schema in Mongoose
I have the following schema:
var GameSchema = new mongoose.Schema({
_id: mongoose.Schema.Types.Mixed,
players: [{
  username: String,
  currentRound: Number
}],
// the number represents the qNumber in the questionData.js
// and also the round number for what the player is currently on
questions: [Number]
});

and the following update call
var Game = mongoose.model('Game', GameSchema);

var updateGame = function(req,res,next){
Game.findByIdAndUpdate(
  req.body.code,
  {$push: {"players": {username: "hardcode", currentRound: 1}}},
  {safe: true, upsert: true, new: true},
  function(err, model){
    if (err){
      console.log("ERROR: ", err);
      res.send(500, err);
    }else{
      res.status(200).send(model);
    }
  }
);
};

A: Argh, I always figure out the solution right after asking.
It turns out that because I override the _id key in my schema the Game.findByIdAndUpdate does not work.
Instead I used the findOneAndUpdate passing in the _id key:
Game.findOneAndUpdate(
{"_id":req.body.code},
{$push: {"players": {username: "hardcode", currentRound: 1}}},
{safe: true, upsert: true, new: true},
function(err, model){
   if (err){
     console.log("ERROR: ", err);
     res.send(500, err);
   }else{
     res.status(200).send(model);
   }
  }
);


text:
Q: Theme edit - only directions or file names needed Ok. At start i must say, this is a few things i need to do but i can't find it. Please, write answers with numbers, this is gonna be really helpful. Ok, lets start.
1)Shopview - right bar
a)I want to remove Last vieved (Ostatnio oglądane produkty) and My orders (Moje zamówienia)-red ring
b)I want to remove Paypal option on homepage = blue ring
2)Footer - I want to remove ad from theme creator (i cant do it from magento admin page)
3)Cart
a)I want to remoove Paypal option from here (Paypal must stay only in checkout options) and this field - red rings
b)I want to move promotion codes to the left side of page -  blue ring
4)Product page - Remove paypal too from here
Thats all, i know, this is a lot of this small stupid things, but i have a vision of my shop - easy and evrything should be visible. I hope i get help here, because this forum is awesome and without it a will be stuck on instaling magento. Thanks a lot from above

A: you need to some work at layout xml file:
Shopview - right bar:
Create local.xml at app/design/frontend/your package/your template/local.xml
<?xml version="1.0"?>
 <layout version="0.1.0">
 <default>
    <remove name="topCart.extra_actions" />
    <remove name="cart_sidebar.extra_actions" />
    </default>
</layout>


text:
Q: Direct X and WPF integration THis might be a very vague questions and apologies if posted in the wrong forum.
But I am starting out on a project involving C# and WPF. This project requires some really serious heavy graphics, want the final result to be as smooth as an iPad graphics. So, now my question is, is WPF upto the task? if not can I do something about it? Hardware boost? or if not is there anyway to leverage on Direct X? or third party libraries?

A: As everything reagarding to 2D graphics in WPF is based on DirectX calls, you will probably not find any faster way except using DirectX directly.
To my understanding everything regarding graphics on an IPad/IPhone seems faster compared to other devices is based on the fact that the rendering on those devices is done in a dedicated thread.
As long as you are not going to use Windows Forms (where everything is rendered using the CPU) you should be fine ;-)


text:
Q: Writing JQuery to change behavior of TB Megamenu for Drupal 7 I'm incredibly new with Javascript and JQuery and I am having problems getting the behavior to work as I would like.  I currently have two dropdown TB MegaMenus on top of my website while it is underneath 980px.  The issue is that since they are separate menus, when you have one open and click to open the second menu, the first one does not close.  I am attempting to have them close the other when they are opened.  They operate by changing their overflow from hidden to visible.  .nav-collapse is the class on both div's that needs to be hidden once the other one is opened.  I understand that we need to change the css to be overflow: hidden, but I'm not doing it properly and am having trouble even after looking up many examples.  Any help would be appreciated.
The DOM looks something like this.

.l-region > #block-tb-megamenu-main-menu > .block__content > .tb-megamenu-main-menu > .nav-collapse (this is the one that needs the CSS modified to overflow: hidden)

$(document).ready(function(){

$("#block-tb-megamenu-main-menu").on('click', '.nav-collapse', function(){
    $('#block-tb-megamenu-menu-connect').find(".nav-collapse").css({"overflow":"hidden"});
});

This is the code that performs the function within TB Mega Menu.  Would it be possible just to modify this code?

attach: function(context) {

  $('.tb-megamenu-button').click(function() {
    if(parseInt($(this).parent().children('.nav-collapse').height())) {
      $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'});
    }
    else {
      $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'});
    }
  });

A: So I figured out what I needed to do.  I had to add the first line to the else statement, this closes everything that has a class of .nav-collapse, and then opens the appropriate one.

attach: function(context) {

  $('.tb-megamenu-button').click(function() {
    if(parseInt($(this).parent().children('.nav-collapse').height())) {
      $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'});
    }
    else {
           /*line that I put in to allow for other menus to close when one is clicked.*/
      $('.nav-collapse').css({height: 0, overflow: 'hidden'});
      $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'});
    }
  });


text:
Q: A phone app on iOS As I understand it is impossible to write a Phone app on iPhone like the built-in one attached to the OS. It's because of the API exposed Apple does not allow us to do that. Someone please confirm. Many thanks!
I asked that because I have a friend who has a problem with his voice after taking a surgery due to the throat cancer. His voice is so weak that listeners could not  catch him. It drives me to an app where somehow it could increase his voice before transmitting.
Highly appreciate if you could give me some hints to come up with better ideas like with Android.

A: As you say it is not possible to write a replacement phone app in iOS. Apple does not allow 3rd party apps to change the core functionality of the device.
There might be an option in the Accessibility APIs. Apple is generally pretty good about providing hooks that let you create adaptive enhancements for the handicapped.
Another option would be a hardware device that plugs into the earphone jack. That jack uses a standard connector. There may be headsets that offer a very sensitive microphone with adjustable volume boost.


text:
Q: Validating phone numbers with yup -- googlelip, yup-phone, regex I have been trying to validate a phone number with yup.
I've tried a few regex examples
const phoneSchema = yup
  .string()
  .matches(phoneRegExp, "Phone number is not valid")
  .required();

fliflop
 /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/

LGenzelis
/^((\+[1-9]{1,4}[ -]?)|(\([0-9]{2,3}\)[ -]?)|([0-9]{2,4})[ -]?)*?[0-9]{3,4}[ -]?[0-9]{3,4}$/

and I've tried two libs yup-phone and google-libphonenumber
but I am unsure on what the matrix would be for valid and invalid phone number formats -- a QA flagged the initial validation in place because it would allow multiple + signs in front of the number +++12345 -- but the libs consider this valid. One of the regex seems to work well but then it will allow another + sign in the middle of the number +234+32432.
Also I am concerned about how to validate the number with google lib - if it could be any type of region -- the expected behaviour being they could enter UK/International or US numbers into the system -- would it be a case of detecting the region of the entered number and solving validation that way?
let region = "US";

  try {
    const number = phoneUtil.parseAndKeepRawInput(value, region);
    res = phoneUtil.isValidNumber(number).toString();
  } catch (e) {
    res = "false";
  }

//google lib phone
https://codesandbox.io/s/google-phone-lib-demo-forked-k29kk8
//yup phone
https://codesandbox.io/s/yup-phone-validation-forked-ixgnjj
//regex by flipflop
https://codesandbox.io/s/regex-flipflop-phone-number-validation-forked-ggvel7
//regex by LGenzelis
https://codesandbox.io/s/regex-lgens-phone-number-validation-forked-szuy6o
this is my number matrix -- but some of these seem to fall through the validation process
//valid numbers
Standard Telephone numbers
+61 1 2345 6789
+61 01 2345 6789 (zero entered is not required but enterd by user anyway)
01 2345 6789
01-2345-6789
(01) 2345 6789
(01) 2345-6789
1234 5678
1234-5678
12345678
Mobile Numbers
0123 456 789
0123456789
International Phone Numbers
US Format - +1 (012) 456 7890
US Virgin Islands (four digit international code) +1-340 123 4567

// invalid numbers
1234+5678
+++12345678

A: If you want to implement this in react front end
You can use a validating function from react-phone-number-input npm package
 import { isValidPhoneNumber } from 'react-phone-number-input'

phone: Yup.string()
      .required("Phone number is required")
      .test("is-valid-phone", "Phone number is invalid", (value) => {
        return isValidPhoneNumber(value || '');
}),


text:
Q: JQuery - Toggle CSS Attribute on Keyboard Press I'm trying to make a css attribute change when pressing the keyboard key "t".
Here is the code I have:
$(document).keypress(function(e) {
    var key = e.which;
    if (key == 116) {
        // if the user pressed 't':
        $("body").css("opacity", "0");
    }
});

The problem is when people click the key "t" it changes the css attribute to invisible; which is perfect. I need it to change again (to the previous state) when they click "t" again.
Apologizes for any mistakes I've made, I'm extremely new to jQuery. If you can help I would appreciate it.
Many thanks,
Toby.

A: You can add a class like this:
.active {
    opacity: 0
}

then toggle this class when your key was pressed using .toggleClass()
$(document).keypress(function(e) {
    var key = e.which;
    if (key == 116) {
        // if the user pressed 't':
        $("body").toggleClass("active");
    }
});

A: Use something like this
$(document).keypress(function(e) {
    var key = e.which;
    if (key == 116) {
        // if the user pressed 't':
        if(!$("body").hasClass('active'))
            $("body").addClass('active').css("opacity", "0");
        else
            $("body").removeClass('active').css("opacity", "1");
    }
});


text:
Q: Infinite metric space with discrete metric is not compact
Consider the metric space $(X, d)$, where $d$ is the discrete metric; let $K$ be an infinite subset of $X$. Show that $K$ is not compact in $(X, d)$.

To show $K$ is not compact, I've done this:
Since $K$ is an infinite subset of $X$, it follows $K$ is an infinite discrete metric space. Consider $G = $ {{$k$} | $k \in K$}, which is an open cover of $K$. Clearly, $G$ has no finite subcover. Thus, $K$ is not compact.
How does my proof look? Do I need to explicitly show why $G$ has no finite subcover? Thank you.

A: Alternatively, you can prove this with sequences too.
Since your metric space is infinite, you can extract a countable set $\{a_{1}, \dots, a_{n}, \dots\}$ (with distinct points), thus
$$
d(a_{i}, a_{j}) = 1
$$
for all $a_{i}, a_{j}$ (with $i \neq j$). This means that this sequence can't have any Cauchy subsequence.
An additional note - to someone who doesn't have much experience with compactness or the discrete metric - try to think of why this proof fails in a finite set. (Hint: can you extract a constant subsequence from every sequence with only finitely many distinct values?)

A: Any $H\subset G$ is equal to $\{\{x\}: x\in S_H\}$ for some $S_H\subset X.$ And $H$ is finite iff $S_H$ is finite. So if $H$ is a finite subset of $G$ then $\cup H=S_H \ne X$ because $S_H$ is finite while $X$ is infinite.


text:
Q: MEF loading plugins from a network shared folder Tearing my hair out trying to work out why Im having this problem so hope someone can help.
I have a program that uses MEF to load plugins. I would like the client and server part of the system to be able to use the same plugin store that will be located on the server.
My problem is that when I set the plugin location to "C:\Users\Administrator\Desktop\ClientPlugins" the plugin is loaded fine. If I change the location to "\\XRP-SERVER\Users\Administrator\Desktop\ClientPlugins" the plugin is not loaded.
When I enter "\\XRP-SERVER\Users\Administrator\Desktop\ClientPlugins" into windows explorer the location is found and the plugin dll is there.
Please could someone help.
Let me know if you require anymore information.
As per a suggestion I have tried editing the config to include the following but this has not fixed the issues....
  <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <runtime>
        <loadFromRemoteSources enabled="true"/>
      </runtime>

Kind Regards
Ash

A: Security policies will typically disable loading remote code (that being, assemblies on an external location).
You can try the following config change:
<runtime>
    <loadFromRemoteSources enabled="true"/>
</runtime>

The other thing to be aware of is when you are copying files back from network locations, they will typically have a Zone specified in their alternate data stream. In explorer, this can be removed by using the "Unblock" command when viewing the properties of a file.
Alternatively, you could programatically remove the Zone from the alternate data stream, as shown here on Mike Hadlow's blog.

A: I ran into this problem yesterday and narrowed the problem down to how MEF loads assemblies.
When you create a DirectoryCatalog, it in turns creates a collection of AssemblyCatalogs.
Each AssemblyCatalog does an:
    AssemblyName assemblyName = AssemblyName.GetAssembly();
    Assembly.Load(assemblyName);

The call to Assembly.Load throws a sandbox Exception (for a reason I can't explain yet) and therefore no parts are found since it silently catches the error.
The funny thing is that calling Assembly.LoadFrom(<pathToYourDll>) to return an Assembly works fine (no exception is thrown). Combine that with the overloaded constructor of AssemblyCatalog that takes an Assembly as its input and you got yourself a workaround!
So instead of using a DirectoryCatalog, I list all the DLLs in the path and iteratively create an AssemblyCatalog and add it to my CompositionContainer.
Note : I am using the loadFromRemoteSources="true" flag in my App.Config and it is required, otherwise it always crashes.
Hope this helps

A: Just to clarify sebd's answer works.
Heres the final code I used.
string[] files = Directory.GetFiles(ClientPluginStore, "*.dll", SearchOption.TopDirectoryOnly);

AggregateCatalog aggCat = new AggregateCatalog();

aggCat.Catalogs.Add(catalog);

foreach ( string file in files )
{
    Assembly ass = Assembly.LoadFrom(file);

    AssemblyCatalog assCat = new AssemblyCatalog(ass);

    aggCat.Catalogs.Add(assCat);
}

_container = new CompositionContainer(aggCat);

A: Try using System.IO.Path.PathSeparator instead of \?
Or may be fetch the file to client location first?
I'm not pretty sure about them, but I would give it a try.


text:
Q: Centripetal force equation doubt
In a centrifuge, $a_c$ should be constant. If $m$ increases, the $r$ will increase in order to maintain a constant $a_c$.

Constant centrieptal acceleration is given by
$a_c={ v^2 \over r}$
and $a_c = \omega^2 * r$
But the conflict between these two equations arises when we increase $r$.
In the first equation - if we increase $r$, $v$ should increase so that $a_c$ remains constant.
But in the second equation - since $\omega$ is constant in a centrifuge, if we increase $r$ then $a_c$ is no longer constant.
I dont understand how this is happening and would appreciate any help.I have also looked at other similar questions on this site but they do not answer to this conflict. This is not a duplicate.
Also, does anyone know how to mathematically show that radius increases when mass increases?

A: Both the equations are equivalent. By definition of angular velocity,
$$\omega=v/r$$
You substitute this in $m \omega^2 r$ to get $m v^2/r$.
NOTE THAT $\omega$ is not constant if you change radius, as you claim!

And for the mass to radius relation, its straight forward. Take,
$$F_c = m v^2 /r$$ and ask what you get if you keep $F_c$ constant while increasing the radius.

A: If $a_c$ really means the magnitude of centripetal acceleration and $m$ means mass then the sentence

If $m$ increases, the $r$ will increase in order to maintain a constant $a_c$.

cannot be correct, since neither expression for $a_c$ involves $m$ at all; $a_c$ is independent of $m$.
If $\omega$ were changing over time then $r$ could also change to maintain a constant $a_c$. But in a centrifuge (in its steady state) the angular speed $\omega$ is constant, so $a_c$ is also constant for a given value of $r$. If $r$ changes then $a_c \propto r$.

A: The misconception lies on for what you define $a_c$. Imagine that you put two balls with mass $M$ and $m$ in the centrifuge ($M\gt m$). When the centrifuge reaches constant angular velocity $\omega$, let's say those balls are respectively $R$ and $r$ distance away from the centre of rotation. From the observation we know that $R\gt r$.* Now let's calculate the centripetal acceleration of two masses. $$M\Rightarrow a_c=R\omega^2$$ $$m\Rightarrow a_c=r\omega^2$$ This yields, centripetal acceleration of $M$ is greater than that of $m$. Which means that the sentence

In a centrifuge, $a_c$ should be constant

makes no sense.

*Physics concepts are based on observations. Not observations are built by physics concepts.

A: I do not see what is the conflict here .
If you increase the radius while also increasing the velocity appropriately, then  acceleration will stay constant.
But if you increase the radius, while keeping the angular velocity constant, then acceleration will increase.
What is the conflict in that ?


text:
Q: How does FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT point to the elements of the collection that threw the exceptions? I have taken this code as an example from this topic:
CREATE OR REPLACE PROCEDURE PROC1 (V_EMP_ID DBMS_SQL.NUMBER_TABLE)
IS
    lv_error_string VARCHAR2(4000);
BEGIN
    FORALL INDX IN V_EMP_ID.FIRST..V_EMP_ID.LAST SAVE EXCEPTIONS
    UPDATE EMPLOYEES
     ---trying to rasie an exception by using a calculation
    SET SALARY=SALARY * 999999999999
    WHERE ID_E= V_EMP_ID(INDX);

EXCEPTION
    WHEN OTHERS
    THEN
    FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT
    LOOP
        ---Am printing the value of the exception array.
        dbms_output.put_line('exception Raised for record' ||V_EMP_ID(i));
    END LOOP;
END;
/

Can someone explain how V_EMP_ID(i) points to the actual elements that caused the exception since i is in 1 .. SQL%BULK_EXCEPTIONS.COUNT. Shouldnt V_EMP_ID(i) always be pointing to the first element of the collection in the first iteration?

PS added the below on 12/17
In my code below I'm trying to emulate the MERGE INTO functionality without using MERGE INTO for some reason.
Using collections, I'm inserting records from a temp table to a main table. If that row exists in the main table, we will get a DUP_VAL_ON_INDEX sort of error and the error details get saved using SAVE EXCEPTIONS.
In the EXCEPTION block, I want to update all the main table rows that have errored out and update them with a set of values from the temp table.
Surprisingly, FORALL i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT and temp_data(i)  updated the correct rows in the main table for me. I tried non-sequential rows too and it worked well. How is this possible?
declare
TYPE data_tbl IS TABLE OF EMPLOYEE_TEMP%rowtype INDEX BY PLS_INTEGER;
    temp_data data_tbl;
begin
        select * bulk collect into temp_data from EMPLOYEE_TEMP
        where EVENT_OID='30047767_1' and USERID='SINISDI2';

   FORALL i IN 1 .. temp_data.COUNT SAVE EXCEPTIONS
       INSERT INTO EMPLOYEE D
        (D.VPD_KEY,
              D.OID,
              D.EVENT_OID,
              D.PID,
              D.AMOUNT,
              D.MIR,
              D.REPORTING,
              D.MODIFIED_BY_USER,
              D.MODIFIED_ON,
              D.VERSION,
              D.TYPE_OID,
              D.F_ELIGIBLE)
       VALUES ( temp_data(i).VPD_KEY,
              temp_data(i).OID,
              temp_data(i).EVENT_OID,
              temp_data(i).PID,
              temp_data(i).AMOUNT,
              temp_data(i).MIR,
              temp_data(i).REPORTING,
              temp_data(i).USERID,
              SYSDATE,
              0,
              temp_data(i).TYPE_OID,
              temp_data(i).F_ELIGIBLE
              );

   EXCEPTION
   WHEN OTHERS
   THEN
      IF SQLCODE = -24381
      THEN
    FORALL i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT
   UPDATE EMPLOYEE D
     SET      D.AMOUNT=temp_data(i).AMOUNT,
              D.REPORTING=temp_data(i).REPORTING,
              D.MIR=temp_data(i).MIR,
              D.MODIFIED_BY_USER=temp_data(i).USERID,
              D.MODIFIED_ON = temp_data(i).MODIFIED_ON,
              D.VERSION = D.VERSION+1,
              D.F_ELIGIBLE = S.F_ELIGIBLE
       where D.PID = temp_data(i).PID AND D.TYPE_OID = temp_data(i).TYPE_OID;
      ELSE
         DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE)) ;
      END IF;
end;
/

A: Quote from the capital 12.4.1.4 Handling FORALL Exceptions After FORALL Statement Completes:

SQL%BULK_EXCEPTIONS(i).ERROR_INDEX is the number of the DML statement that failed.

The number of the DML statement is equivalent to the element index in the collection.
Have a look at following working example:
create table tab (id, val check (val<=3)) as
    select rownum, rownum from dual connect by level<=3
/
declare
    type idtab is table of int;
    ids idtab;
begin
    select id bulk collect into ids
    from tab;

    declare
        forallexcp exception;
        pragma exception_init (forallexcp, -24381);
    begin
        forall i in 1..ids.count save exceptions
            update tab set val = val + 1
            where id = ids(i);
    exception when forallexcp then
        dbms_output.put_line (
            sql%rowcount||' row(s) inserted ('||sql%bulk_exceptions.count||' with error).');
        for i in 1..sql%bulk_exceptions.count loop dbms_output.put_line (
            'id='||ids(sql%bulk_exceptions(i).error_index)||' sqlerrm='||
            sqlerrm (-(sql%bulk_exceptions(i).error_code)));
        end loop;
    end;
end;
/

Result:
2 row(s) inserted (1 with error).
id=3 sqlerrm=ORA-02290: check constraint (.) violated


text:
Q: Is it possible to make a localStorage wrapper with TypeScript typed parameters and mapped return values? I'm trying to construct a TS wrapper for localStorage with a TS schema that defines all the possible values in localStorage. Problem is that I can't figure out how to type the return value so that it's mapped to the approriate type from the schema: for example if I want to call LocalStorage.get("some_number"), I want the return type to be of type number. Is this even possible in TS?
Keys -typed parameter value works really well for the input!
type Values = LocalStorageSchema[Keys] returns the union type of the values which is not what I'm looking for.
Also it seems that it's not possible to use the variable key in the get function for type narrowing...
I have also looked into generic types: LocalStorage.get(...) but I think that kind of defeats the whole point of typing the return value.
Anyone got ideas for this? Thanks!
type LocalStorageSchema = {
  token: string;
  some_string: string;
  some_number: number;
};

type Keys = keyof LocalStorageSchema;
// type Values = LocalStorageSchema[Keys]; ???

export const LocalStorage = {
  get(key: Keys): any {
    const data = window.localStorage.getItem(key);

    //type ReturnType = ???
    if (data !== null) {
      return data;
    }

    console.error(`localStorage missing object with key ${key}`);
    return null;
  },

  set(key: Keys, value: any) {
    window.localStorage.setItem(key, value);
  },

  remove(key: Keys) {
    window.localStorage.removeItem(key);
  },

  clear() {
    window.localStorage.clear();
  },
};

A: You can use generic as in this link. There are still some errors left to fix. Link how to handle null values. It's up to you, so I didn't fix it.

A: Use generics to return the right type for the key !
type LocalStorageSchema = {
    token: string;
    some_string: string;
    some_number: number;
};

type Keys = keyof LocalStorageSchema;

export const LocalStorage = {
    get<T extends Keys>(key: T): LocalStorageSchema[T] | null { // Return type will depend on the key
        const data = window.localStorage.getItem(key);

        //type ReturnType = ???
        if (data !== null) {
            return data as LocalStorageSchema[T];
        }

        console.error(`localStorage missing object with key ${key}`);
        return null;
    },

    set<T extends Keys>(key: T, value: LocalStorageSchema[T]) {
        window.localStorage.setItem(key, value as any);
    },

    remove(key: Keys) {
        window.localStorage.removeItem(key);
    },

    clear() {
        window.localStorage.clear();
    },
};

const a = LocalStorage.get('token'); // string | null

Playground


text:
Q: Publishing is currently not possible for project 'xxxxx'.? - Ubuntu I'm currently on Ubuntu 13.04, I've just finished setting up Qt Creator and had just made a new HTML UI app. It says the target is "Desktop" and I can run the app no problem from within the IDE.

The problem occurs when I try to publish the app or in other words, get it to some form that is distributable. I get the following error:

What can be possibly wrong here? As I said, I can run the app without problems within the IDE.


text:
Q: How to add multiple widgets to widget list I am currently working on my first flutter app and still learning. I thought I kind of figured out how to combine and add multiple widgets. The tap Bar is actually working. When I add the tap bar in a Column it is not working anymore. I would like to add a Bottom Navigation Bar. It is also working without the TapBar. But both combined with the Column and Widget List are not working and I cant figure out why not.
Widget build(BuildContext context) {
 return new Scaffold(
   appBar: new TabBar(
       controller: controller,
       labelColor: Colors.white,
       tabs: <Tab>[
         new Tab(
           icon: new Icon(
           Icons.arrow_back,
           color: Theme.of(context).primaryColor,
         )),
         new Tab(
             icon: new Icon(
           Icons.swap_calls,
           color: Theme.of(context).primaryColor,
         )),
         new Tab(
             icon: new Icon(
           Icons.favorite,
           color: Theme.of(context).primaryColor,
         )),
       ]),

   body: Column(
     children: <Widget>[
       new TabBarView(
         controller: controller,
         children: <Widget>[
           new first.Outfits(),
           new second.Swaps(),
           new third.Favorites()
         ],
       ),

       //BottomNavigationBar
       /*  new BottomNavigationBar(
         items: const <BottomNavigationBarItem>[
           BottomNavigationBarItem(
             icon: Icon(Icons.home),
             title: Text('Home'),
           ),
           BottomNavigationBarItem(
             icon: Icon(Icons.people),
             title: Text('Friends'),
           ),
           BottomNavigationBarItem(
             icon: Icon(Icons.person),
             title: Text('Profile'),
           ),
         ],
         // currentIndex: _selectedIndex,
         // onTap: _onItemTab,
       ),*/
       //  ],
       //),
     ],
   ),
 );
}```

Does anybody know what might be the reason ? Maybe it is the other Widgetlist in my TabBar Widget ?
Thank you!

A: As you already used Scaffold just use it's bottomNavigationBar
Straightforward settle BottomNavigationBar in bottomNavigationBar property

The [bottomNavigationBar] is rendered below the [persistentFooterButtons]
and the [body].

A: It's simple, wrap your TabBarView inside Expanded widget to use it into the Column
     Column(
        children: <Widget>[
          Expanded(
            child: new TabBarView(
              controller: controller,
              children: <Widget>[
                Text('Hi 1'),
                Text('Hi 2'),
                Text('Hi 3'),
              ],
            ),
          ),
        ],
     ),


text:
Q: Can Homotopy Type Theory or algebraic geometry deal with homotopy fibers in terms of families? ((In conclusion)
It was hard to choose which answer to accept. I decided for the one which addressed most of the various aspects of the question.
)
(Later addon)
I now decided to put a bounty on this, and want to put particular accent on one aspect of the question that puzzles me most.
As discussed in greater length below, at the first sight from the point of view of Homotopy Type Theory (HoTT) the situation seems next to trivial: if we view $f:X\to Y$ as a family $X_y:=f^{-1}(y)$ of spaces continuously varying over $Y$ then, if $Y$ is connected, HoTT squeezes water out of it and leaves the plain fact "all $y$ are equal to each other". This then implies that all $X_y$ are equal to each other.
But on the other hand, the above argument completely ignores the fact that the fibration associated to $f$ might be nontrivial, i.e. one might be unable to uniformly pick simultaneous equalities $X_y=X_{y'}$ for all pairs $y$, $y'$. So, on top of having this next to trivial description of homotopy fibers, seemingly HoTT must also possess techniques to detect nontriviality of the fibration, etc. What are they?
End(Later addon)
One of the most basic constructions in homotopy theory assigns to a map $f:X\to Y$ another map $\pi_f:P_f\to Y$ such that $P_f$ is equivalent to $X$ and (under connectedness assumption for $Y$) all $\pi_f^{-1}(y)$ are equivalent to each other. $P_f$ is the space of all pairs $(x,\gamma)$ where $x\in X$ and $\gamma$ is a path in $Y$ with $\gamma(0)=x$.
I would like to view this construction from a familial perspective. Namely, I want to view $f$ as a family $X_y:=f^{-1}(y)$ of spaces continuously varying over $Y$. Then, we are constructing another family $\check X_y$ from it, with$$
\check X_y=\bigcup_{y'}\operatorname{paths}(y,y')\times X_{y'}.
$$That spaces in this family are pairwise equivalent is ensured by the fact that any path between $y_1$ and $y_2$ produces equivalences between $\operatorname{paths}(y_1,y')$ and $\operatorname{paths}(y_2,y')$ for all $y'$.
From this point of view, the equivalence of total spaces is clear from $$\bigcup_{y,y'}\operatorname{paths}(y,y')\times X_{y'}=\bigcup_{y'}\left(\bigcup_y\operatorname{paths}(y,y')\right)\times X_{y'},$$as the spaces in parentheses are contractible.
Now this way of formulating it suggests that there must be many other situations where a similar construction is present.
The most likely area is of course Homotopy Type Theory. I am pretty sure that something like this is used very frequently there. Could I have a specific reference - how is it called there and what does it mean conceptually from the type-theoretic/logical point of view?
It also looks like some sort of generalization for the associated bundle <-> principal bundle business. Is a generalization along these lines known?
I am especially interested in the context of moduli spaces in algebraic geometry. Some moduli spaces (like projective spaces or, more generally, Grassmanians) manifestly consist of equivalent objects but some others do not. Is there a way to modify moduli spaces in a way similar to the above, to arrive at some equivalent moduli spaces consisting of equivalent objects?
I have vague feeling that this construction might be related to switching from coarse moduli spaces to fine moduli stacks, does this make sense and can it be made rigorous?
If this is not too much, one more question.
A dual construction suggests itself,$$
\hat X_y=\prod_{y'}X_{y'}^{\operatorname{paths}(y,y')}.
$$It is as easy to show that all $\hat X_y$ are equivalent to each other. However this time I think total space is not equivalent to the total space of the original family. Instead, the spaces of all global sections are equivalent.
Does this dual thing occur anywhere? This time I don't even know whether it is used in homotopy theory itself.

A: Yes, there is a certain sense in which your statements are true. As Mike Shulman and Qiaochu Yuan said, the strict fiber of a map cannot be defined in HoTT and doesn't make sense, but you can work from the other direction: instead of trying to associate a family of types to a map start with an arbitrary type family $P: X \to Type$. This includes any classical Serre fibrations: you associate to a point a fiber over it and to higher dimensional simplices some choice of their lifting, which is possible to do coherently by the path lifting property of fibrations. In the simplest case of a flat bundle you can make an explicit choice of lifts, which defines an equivalence between flat bundles and representations of the fundamental group of $X$. Homotopy-theoretically "every bundle is flat" in a sense that any two maps between fibers induced by a pair of equivalent paths are themselves (noncanonically) equivalent. The magic of HoTT and its models allows us to assume that all fibrations are given as representations of the path groupoid: path induction allows us to prove that any map of types is functorial in the sense that paths map to paths, composition to composition etc for all higher relations. This shows that a type family $P: X \to Type$ associates to any point $x: X$ a type $P(x): Type$, to any path $s: x=y$ a homotopy equivalence $ P(x) = P(y)$ etc (a map from paths in $Type$ to equivalences is automatic by path induction). In certain cases we can turn a coherent system of equivalences between fibers into a type family over $X$. The simplest case is when $X$ is defined as a higher inductive type, since higher inductive types are defined as representing objects of certain systems of equivalences between types. See chapter 6, in particular [6.12 The flattening lemma] in the HoTT book.
Given a type family $P: X \to Type$ we can construct its total space $Y := \sum_{x:X} P(x)$ with a canonical projection map $Y \xrightarrow{p} X$ defined by induction on $\Sigma$. Then we can consider the type family of homotopy fibers of $p$: $$x:X \vdash \mathrm{fib}_p(x) := \left( \sum_{y:Y} x = p(y) \right) : Type$$
The resulting type family is equal to $P$ in the sense $\prod_{x:X} P(x) = \mathrm{fib}_p(x)$. By univalence we need to provide a homotopy equivalence between fibers. The map from left to right is the obvious inclusion of a strict fiber into a homotopy one. The map from right to left is constructed via induction on $\Sigma$ and paths. In the other direction, to any map $Y \xrightarrow{f} X$ we can associate its fiber type family $\mathrm{fib}_f$ and its total space $\sum_{x:X} \mathrm{fib}_f(x)$. It will be equivalent to $Y$ as objects over $X$. The relevant reference here is [4.8 The object classifier] in the HoTT book.
Essentially the big statement at work here is that from the PoV of higher category theory, the core groupoid for the overcategory $\mathbb{S}_{/X}$ is "representable" by a certain object $Type: \mathbb{S}$ (more formally, we consider a filtration of the overcategory by subcategories of bounded increasing cardinalities and require that each of these functors should be representable, thus getting an increasing sequence of objects $Type_{\kappa}$, see HTT [6.1.6. $\infty$-topoi and classifying objects]). In classical 1-topos theory and set theory this statement is limited to $(-1)$-truncated morphisms and type families and corresponds to the comprehension principle: any subset can be defined by a proposition which is true exactly for the elements of this subset, and vice versa. Type theory extends this principle to arbitrary constructions: any statement $P:X \to Type$ defines a type of "structures" on $X$ (the sigma type), and equivalently any map of types can be defined by some statement in a sense of a type family.
Regarding your "dual" construction: your type is defined as $\prod_{y^\prime} \prod_{y = y^\prime} X_{y^\prime}$. By path induction this type is equivalent to $X_y$, so your type family is equivalent to $X$.
Regarding the moduli spaces: I don't think this construction has really anything to do with them. Not that it's entirely irrelevant, but moduli spaces carry much more structure than homotopy types and you can't get around that unless you're willing to sacrifice most information. One possibility is to consider moduli spaces as stacks of groupoids on the Zariski (étale, flat, ...) site. Sheaves of groupoids naturally form a higher topos and should be a model of HoTT, however the information you get this way is mostly trivial: if your classified objects don't have any automorphisms, then the stack will be just a sheaf of sets, and if you have automorphisms, then you'll get the tautological description of locally isomorphic objects. Another possibility would be to enlarge your notion of equivalence, for example you could state that all fibers of the universal family are equivalent, e.g. by saying that an equivalence of $E$ and $E^\prime$ can be given as any fibration $X$ over $\mathbb{A}^1$ such that $X(0) \simeq E$ and $X(1) \simeq E^\prime$. This feels a lot like $\mathbb{A}^1$-homotopy theory, but I can't state anything more meaningful. In any case it feels like most (all?) of the algebraic information would be lost, even if one is very careful with definitions (I already see some problems in the one above).
Abstractly, the story of the moduli spaces is the story about classifying ringed topoi, while HoTT speak only about objects of a single higher topos (or topoi that arise as their overcategories). Sort of orthogonal beasts.
Regarding your "associated bundle --- principal bundle" comment. Indeed, one can view this construction for connected spaces in a similar way. Assume given a point $x:X$ and $X$ connected, then fibrations $P:X \to Type$ over $X$ are equivalent to homotopy representations of the ($A_\infty$-)group of loops $\Omega_x X$ in the automorphisms $Aut(P(x))$ of the fiber $P(x)$. This is certainly true in classical homotopy theory of spaces, but in HoTT there are complications. First there is a problem with the definition of $A_\infty$-groups and their representations, which we will ignore. The construction itself in one direction is obvious, we already know that each loop induces an automorphism of the fiber. In the other direction $y=x$ is a right torsor over $\Omega_x X$ so we can take the product over the loop group $(y = x) \times_{\Omega_x X} P(x)$. Classically this gives us back $P$, but in HoTT this requires clarification.
We define a $(\infty, 1)$-category $C$ as a type of objects $Ob_C: Type$ and a family of morphism types $a,b:C \vdash C(a,b): Type$, together with units and composition which we suppress in the following discussion. As usual, a groupoid is a category in which all morphisms are invertible, and for any category $C$ we have its core groupoid $C^\sim$ which is the largest subgroupoid in $C$. For any $X: Type$ its path groupoid $\Pi X: Cat$ has $Ob_{\Pi X} = X$ and $a, b:X \vdash \Pi X(a, b) := (a = b) : Type$. A category is called univalent if the natural functor $\Pi Ob_C \to C^\sim$ is an equivalence. Our definition of a category follows the Segal space approach, and univalent categories are precisely complete Segal spaces. The category of types $Type$ has $Ob_{Type} = Type$ and $X,Y : Type \vdash Type(X, Y) := (X \to Y)$. The classical axiom of univalence is precisely the statement that $Type$ is an univalent category. We also define the geometric realization functor $|C|$ as the left adjoint to the path groupoid functor, i.e. $Type(|C|, X) = Cat(C, \Pi X)$. For any ($A_\infty$-)group or monoid $G$ we define the delooping category $\mathbb B G$ as $Ob_{\mathbb B G} = 1$, $\mathbb B G(\ast, \ast) = G$. Presheaves of types on $\mathbb B G$ are the same as representations of $G$.
Now, the correspondence between type families and group representations stated above in these terms says that for any connected $X: Type$ with $x: X$ the categories $\mathbb B \Omega_x X$ and $\Pi X$ are Morita equivalent, i.e. their categories of type presheaves are equivalent. We have an obvious inclusion $\mathbb B \Omega_x X \to \Pi X$, however this is not an equivalence of categories, since an equivalence on object types would restrict to the statement $\forall y: X, x = y$ which means that $X$ is contractible. This is in stark contrast with the 1-categorical situation where any groupoid is equivalent to its full subgroupoid on one object. The classical statement relies on a choice principle to choose an equivalence for each nonempty $C(x, y)$, but constructively we can't have such strong choice. One can argue that this failure is due to non-univalence of $\mathbb B \Omega_x X$ and it's true in a sense, but I have two objections. The first is that the truth of this equivalence for univalent subcategories is itself a nontrivial theorem, essentially it is May's delooping theorem together with its version for path groupoids. Using such strong statements for a basic notion of equivalence doesn't seem like a good idea. The second is that the delooping category is an extremely natural object, and being unable to naturally talk about it would be a problem. I also find it troubling that the simple construction of delooping category for a monoid would suddenly blow up into a much more complex path category if the monoid is a group. Similarly, it is natural to select subcategories on a set of objects, or consider action groupoids for groups, and none of them would be categories under the univalence requirement (e.g. the action groupoid on a torsor would have "too few" morphisms to be univalent and to be equivalent to its geometric realization, which is a point). Even the basic 1-categorical definition of a category wouldn't be a category if we require all categories to be univalent. Sure, we could do the Rezk completion, but that extra step would be unnecessary in half of situations and very nontrivial in the other half.
Non-univalent categories will break the homotopy hypothesis, but I view it as a lesser evil in this case. Groupoids should be at least as complicated as homotopy types, but there is no reason why they couldn't contain more information.
That said, univalence of $Type$ is a very natural requirement. In particular, I don't know how to prove the Morita equivalence above without the univalence axiom, or even if it's true. With univalence it is easy to prove that for any groupoid its category of presheaves is equivalent to the category of type families over its geometric realization:
$$\begin {eqnarray}
C & \to & Type & \simeq\\
C & \to & Type^\sim & \simeq \\
C & \to & \Pi Type & \simeq \\
|C| & \to & Type & \simeq \\
\Pi |C| & \to & Type
\end{eqnarray}
$$
Together with the delooping theorem $|\mathbb B \Omega_x X| = X$, $|\Pi X| = X$ this proves the Morita equivalence above. The part about path groupoids is easy to prove, but I'm not sure that the part about $\mathbb B$ can be proved without univalence.
In summary, assuming univalence, type families over connected inhabited types can be uniquely reconstructed from their fiber over some point together with an action of the loop group on it. At the moment there is no type-theoretic reference for the constructions that I performed above, but something like that should be in books on higher categories and topology.

A: I am answering your "later addon" only, although it seems actually to be a very different question than your original one.
This is perhaps one of the most misunderstood aspects of HoTT and particularly Univalence.

There is no squeezing of water.

Upon hearing that univalence "makes equivalent spaces equal to each other", it's natural to think that somehow this is losing information about the particular equivalence.  But this is not so.  The point is that rather than "squeezing" the notion of equivalence down to coincide with the classically "flat" notion of equality, instead univalence expands the notion of "equality", making it as rich as the classical notion of equivalence.
The difference between a trivial and a nontrivial fibration, and similarly between a connected space and a contractible space, is represented in HoTT by the difference between a "truncated" equality and an untruncated one.  Suppose you try to write naively a statement in HoTT that (based on "equalities mean paths") you might think means "$Y$ is connected", like "for all $y_1,y_2:Y$ we have $y_1=y_2$".  In formal type theoretic syntax this would be $\prod_{y_1,y_2:Y} (y_1=y_2)$.  But it turns out that this statement actually means "$Y$ is contractible (or empty)", because everything in HoTT is "continuous/functorial/natural" unless you force it not to be.  In particular, if "for all $y_1,y_2:Y$ we have $y_1=y_2$" in this sense, then the operation assigning the path from $y_1$ to $y_2$ must depend continuously on $y_1$ and $y_2$, which means that as soon as $Y$ has a point it can be continuously retracted back to that point.
If you want to say instead that $Y$ is connected, then you need some way to break this "continuity".  For this purpose there is an operation called propositional truncation.  If $A$ is a space, then its propositional truncation $\Vert A \Vert$ is a space that is empty if $A$ is empty, and contractible if $A$ is nonempty.  In other words, it encodes the information of whether $A$ is nonempty without any information about what points there are in $A$ or how they are homotopically connected.  Now the modified statement $\prod_{y_1,y_2:Y} \Vert y_1=y_2\Vert $ does mean only that $Y$ is connected (or empty), because it doesn't force the path from $y_1$ to $y_2$ to be specified as a continuous function of $Y$; instead only "the fact that there exists such a path" is specified as a continuous function of $Y$.  Sometimes we pronounce $\Vert y_1=y_2\Vert$ as "$y_1$ is merely equal to $y_2$".
This distinction then carries over to any fibration over $Y$.  If $Y$ is contractible, so that all of its points are equal, then all fibers are also equal, and the fibration is trivial.  But if $Y$ is only connected, so that all of its points are merely equal, then all fibres are merely equal.  In the latter case, we cannot "uniformly pick simultaneous equalities" as you said.

A: Here is an answer to your original question in the context of HoTT.  An arbitrary map $f:X\to Y$ that isn't a fibration can't be viewed literally as a family of spaces varying continuously over $Y$, because the strict fibers don't vary continuously over $Y$; a path from $y_1$ to $y_2$ doesn't induce any sort of map from the fiber over $y_1$ to the fiber over $y_2$.  In (ordinary) HoTT, however, we can't talk about such strict fibers at all; the naive definition of "fiber" $\mathrm{fib}_f(y) = \sum_{x:X} (f(x)=y)$ actually produces the homotopy fiber, and this is exactly the fibrant replacement construction you describe.  It is a family varying over $Y$ (i.e. a type dependent on $Y$), and its total space $\sum_{y:Y} \mathrm{fib}_f(y)$ is indeed equivalent to $X$.
Fibers are defined in the HoTT Book in Definition 4.2.4, and the fact that the total space of the fibers is the original domain is Lemma 4.8.2.


text:
Q: Magento soap api showing invalid api path I have created a web service but it is not running well showing invalid api path even though my identifiers which I have declared are correct.
Following is my code
testapi.php (Main file for hitting url)

<?php
// custom api soap client example
$mageFilename = '../app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
$myhellomsg = "Helloworld Prashant";
try {
$soap = new SoapClient('http://localhost:81/magento/api/?wsdl');
$sessionId = $soap->login('admin', '123456');
//echo "Login ID : $sessionId";
$result = $soap->call($sessionId, 'customapi.hello',array($myhellomsg));
echo $result;
}
catch(Exception $e) {
echo $e->getMessage();
}

Api.php file

<?php
class Prashant_Customapi_Model_Helloworld_Api extends Mage_Api_Model_Resource_Abstract
{
public function hello($msg) {
return "My Custom HelloWorld API In Magento. Here is Your Message ". $msg ;
}
}

api.xml file

<?xml version="1.0"?>
<config>
<api>
<resources>
<customapi translate="title" module="customapi">
<model>customapi/helloworld_api</model>
<title>Custom HelloWorld API </title>
<methods>
<hello translate="title" module="customapi">
<title>Prashant HelloWorld API</title>
<method>hello</method>
</hello>
</methods>
<faults module="customapi">
<data_invalid>
100
<message>Invalid data</message>
</data_invalid>
</faults>
</customapi>
</resources>
</api>
</config>

If anything else needed please let me know.


text:
Q: Verifies the sum of files in a folder for a list of computers instead of the sum of files in a folder on my computer only Please help me.
I Need to change this statement so that it verifies the sum of files on a folder from a list of computers on a text file, rather than verifying the sum of that same folder that resides on my computer only? We have the root of our computers shared as c$ if that helps.
The end result will have incorrectsumoffiles.txt contain a list all computers that returned true from the query.
(gci c$\800patchfolder -recurse).Count -ne 345 | out-file incorrectsumoffiles.txt

I think the correct syntax would look something like this...
get-content computerlist.txt | query | output
But powershell requires a evaluation prior to any piping?
The out-file being incorrectsumoffiles.txt will only contain names of computers that returned "true" from the -ne comparison operator.
Thank You.

A: Use Get-Content to read your list of computers, then iterate through each one to check the count, and if it is not correct append it to your txt file.
Something like this should do what you are asking:
$computers = Get-content C:\listofcomputers.txt

Foreach ($computer in $computers){

If ((gci \\$computer\c$\800patchfolder -recurse).Count -ne 345) {
$computer | out-file c:\incorrectsumoffiles.txt -append
}

}


text:
Q: How to Get Only Matched Result from An Array Field of Document in Mongo Using Spring Data I am using spring boot 1.5.1 and MongoDB version 3.4.6 .
I have a mongo document Hotel which has a list of Review .
The Review class has property userName.
@Document
public class Hotel {

    @Id
    private String id;
    private List<Review> reviews;

I want to search all the hotel by Review userName.
My HotelRepository has public List<Hotel> findByReviewsUserName(String userName);
When I am calling with user 'Salman' -
List<Hotel> list = this.hotelRepository.findByReviewsUserName(user);

this method returns result like below :
[
    {
        "id": "59b23c39c70ff63135f76b14",
        "name": "Signature",
        "reviews": [
            {
                "id": 1,
                "userName": "Salman",
                "rating": 8,
                "approved": true
            },
            {
                "id": 2,
                "userName": "Shahrukh",
                "rating": 5,
                "approved": false
            }
        ]
    }
]

What I want the reviews only of 'Salman' but it's also returning for others also.
What am I missing or how to do it?
What I have noticed is that if a single review user matched it returns the whole list of reviews which I don't want, I want reviews I have searched by name.

A: The named query works as it should be. You are not explicitly saying that you want only a portion of document so query returns whole document. To achieve that you cannot use named queries (see @alexefimov answer for using named queries with help of @Query annotation) but you can use MongoTemplatebeside of MongoRepository. to do that you have to make some changes:
First your repository should be like this:
public interface HotelRepository extends MongoRepository<Hotel, String>, MongoTemplateRepository {
    // You can continue to write your named queries here. Spring will create that.
}

MongoTemplateRepository:
public interface MongoTemplateRepository {
    // You will write your queries which will use mongoTemplate here.
    List<Hotel> findByReviewsUserName(String userName);
}

For implementation of MongoTemplateRepository methods, you will write a new class. The important thing here is that you should named this class your repository class name + Impl. Otherwise spring-data cannot find where your methods implementation those defined in MongoTemplateRepository. So your implementation class's name should be HotelRepositoryImpl
public class HotelRepositoryImpl implements MongoTemplateRepository {

    @Autowired
    private MongoTemplate mongoTemplate; // we will use this to query mongoDb

    @Override
    public List<Hotel> findByReviewsUserName(String userName) {
        Query query = new Query();
        query.addCriteria(Criteria.where("reviews.username").is(userName));
        query.fields().include("reviews.$");
        return mongoTemplate.find(query, Hotel.class);
    }
}

Usage:
hotelRepository.findByReviewsUserName("userName");
As you can see in codes we can .include() or .excludefields for the query. While you want to include just matched part of an array field, we use $operator with array field name.
Conclusion: You can still use spring-data well supported named queries and additionally if you need aggregation or some complex queries for sub documents that a named query cannot be built by spring, you can do it in your newly created mongoTemplate repository class. And you can access all of your repository methods from HotelRepository.

A: Great answer from @barbakini, but that also can be done without creating custom repository implementation with Criteria, just 'describe' which fields you would like to get, where 0 - .exclude, 1 - .include(
@Query(fields = "{ '_id': 0, 'reviews.$': 1 }")
List<Hotel> findByReviewsUserName(String userName);


text:
Q: 'javax.servlet.ServletContext' that could not be found I have a Springboot application as follows:
@SpringBootApplication
@ImportResource("classpath:/config/applicationContext.xml")
public class TaxBatchMain {

    @Autowired
    TaxIdService taxIdService;

    private static final Logger LOGGER = LogManager.getLogger(TaxBatchMain.class);

    public static void main(String[] args) {

        new SpringApplicationBuilder(TaxBatchMain.class).web(false).run(args);
        TaxBatchMain taxBatchMain = new TaxBatchMain();

    }

    public TaxBatchMain() {

        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

    }

    @PostConstruct
    public void checkForTransactions() {

        try {
        ////
            String tab = "someother content";

            String footer  = taxIdService.formatFooter();
            ////
            ////
        }catch(){
        //////////

        }
    }

}

TaxIdServiceImpl class is as follows:
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class TaxIdServiceImpl implements TaxIdService {

    @Autowired
    private ServletContext servletContext;

     private String formatFooter(String footer) {
        String[] searchList = {"<ENVIRONMENT_NAME>", "<MS_ENV_NAME>"};
        String[] replacementList = {(String) servletContext.getAttribute(ServletContextKey.EMAIL_HOST_NAME.name()),
          (String) servletContext.getAttribute(ServletContextKey.MS_EMAIL_HOST_NAME.name())};

        return StringUtils.replaceEach(footer, searchList, replacementList);
    }

}

Application Context looks like:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"....................///

<context:annotation-config />

    <context:property-placeholder location="classpath:/config.properties" />

    <util:properties id="configProperties" location="classpath:/config.properties" />

  <!--   <context:property-placeholder location="classpath:data/application.properties"/> -->

    <context:component-scan base-package="com.tax.main" />
    <context:component-scan base-package="com.tax.service" />
    <context:component-scan base-package="com.tax.model" />
    <context:component-scan base-package="com.tax.mapper" />
    <context:component-scan base-package="com.tax.util" />

    /////

When I run the main class i get foll. error
APPLICATION FAILED TO START

Description:
Field servletContext in com.tax.service.TaxIdServiceImpl required a bean of type 'javax.servlet.ServletContext' that could not be found.
Action:
Consider defining a bean of type 'javax.servlet.ServletContext' in your configuration.

A: Try enabling webEnvironment. It appears your SpringApplicationBuilder is not enabled with web environment.
new SpringApplicationBuilder(TaxBatchMain.class).web(true).run(args);
Since you are using spring-boot you can consider using Annotation based approach rather xml based.


text:
Q: How to get a list of all instances of an object on a page On a Silverlight page there are a number of instances of a custom control. I can easily get an instance of the custom control by its name:
MyCustomControl mcc = (MyCustomControl)this.FindName(namestring);

But how could I get a list of all the instances of this custom control on this page?

A: Add this class to your project:-
public static class VisualTreeEnumeration
{
    public static IEnumerable<DependencyObject> Descendents(this DependencyObject root)
    {
        int count = VisualTreeHelper.GetChildrenCount(root);
        for (int i = 0; i < count; i++)
        {
            var child = VisualTreeHelper.GetChild(root, i);
            yield return child;
            foreach (var descendent in Descendents(child))
                yield return descendent;
        }
    }
}

Now you can use this code:-
 List<MyCustomControl> = this.Descendents().OfType<MyCustomControl>().ToList();

A: Try something like this
Enumerable.Range(0, VisualTreeHelper.GetChildrenCount(this))
    .Select(i => VisualTreeHelper.GetChild(this, i))
    .Where(c => c is MyUserControl);


text:
Q: p:growl not showing when I redirect my page I have been checking out some issues about this problem but it did not work.
There are two situations:
1.I start on /alertas/index.jsf
I log in with my username and password and according to my faces-config.xml I am redirected to /alertas/pages/alertas.jsf and my page is showed correctly with all the functions working but growl messages. (The URL showed at the top when I am in alertas.jsf is index.jsf)

*

*If I am already logged and I access directly to /alertas/pages/alertas.jsf, everything works, even growl messages.

I do not know if this could be a problem of the redirection. I tried the next sentence which I read on another threads, but did not work.
context.getExternalContext().getFlash().setKeepMessages(true);

The content of my file faces-config is:
<?xml version="1.0" encoding="UTF-8"?>

  <faces-config
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
  version="2.0">

      <navigation-rule>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>irAlertas</from-outcome>
        <to-view-id>/pages/alertas.xhtml</to-view-id>
    </navigation-case>
      </navigation-rule>

  </faces-config>

I am searching for a solution but it is being really hard.
Thanks for the time !!

A: It is solved guys, I tried another thing which I found in this post:
Primefaces growl is not working in all the pages
Apparently is a bug of primefaces, just add the property ajax="false" in the commandButtons or tags that update your growl.


text:
Q: UWP WIndows-10 Loading images in app I have a C# app targeting Windows UWP platform. App displays images in list view. Based on the query made, these images can come from either app's

*

*container(/Assets/ folder)

*Online source

*Local source

When the image's source is either in app's container or online source I can bind the Image Source to a valid URI in XAML to fetch the image.
When the image's source is local, the url for the image is proprietary & we use our own imge_fetch api to get the image from our servers.
My problem is how to specify a XAML binding which is capable of taking either a uri(when image is from app's container or online source) or BitmapImage(returned by our image_fetch apis)
 I have checked this post regarding IValueConverter
I want to know, if there are any better/easier way in UWP to do what I am trying to achieve.

A: You may create a view model item class with a source property of type object, so that you can assign a string, Uri or ImageSource:
public class ImageItem
{
    public object ImageSource { get; set; }
}

In XAML, you can directly bind to this property and benefit from built-in automatic type conversion:
<ListBox ItemsSource="{Binding}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Image Source="{Binding ImageSource}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Assigning image items my look like this:
DataContext = new ImageItem[]
{
    new ImageItem { ImageSource = "ms-appx:///Assets/StoreLogo.png" },
    new ImageItem { ImageSource = new Uri("ms-appx:///Assets/Square150x150Logo.scale-200.png") },
    new ImageItem { ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/Square44x44Logo.scale-200.png")) },
};