text:
Q: Making this function infinitely nesting based off a table I finally solved my problem to make a dropdown menu in world of warcraft off of a table.
Now I need it to be able to nest as far down as the user supplies. How would I do this?
Here is the function I currently use:
    local info = UIDropDownMenu_CreateInfo()

    if level == 1 then
        for a,b in pairs(menuList) do
            info.text = b[1]
            info.hasArrow = b[2]

            UIDropDownMenu_AddButton(info, level)
        end
    elseif level == 2 then

        for a,b in pairs(menuList[UIDROPDOWNMENU_MENU_VALUE][3]) do
            info.text = b
            info.func = OnClick

            UIDropDownMenu_AddButton(info, level)
        end
    end

Here is the table example used:
testMenuList = {Greetings = {"Greetings", true, {"hi", "hello", "good day"}}, Farewells = {"Farewells", true, {"bye", "goodbye", "later"}}}

It can setup currently up to 2 levels down. The first and submenus.
Can anyone help me out?

A: Here is the solution:
function IOLib_CreateDropDown(parent, name, title, width, anchor, posX, posY, menuList, OnClick)
    local dropDown = CreateFrame("Button", name, parent, "UIDropDownMenuTemplate")
    --_G[name].list = menuList
    dropDown.list = menuList
    -- dropDown.Func = OnClick
    dropDown:ClearAllPoints()
    dropDown:SetPoint(anchor, posY, posX)

    local function initialize(self, level)
        local info = UIDropDownMenu_CreateInfo()

        if level ~= nil then
            info = UIDropDownMenu_CreateInfo()
            info.text = title
            info.isTitle = true
            UIDropDownMenu_AddButton(info, level)

            if level == 1 then

                for a,b in pairs(menuList) do
                    info = UIDropDownMenu_CreateInfo()
                    info.text = b[1]
                    info.hasArrow = b[2]
                    info.func = OnClick
                    if info.hasArrow then _menuLists[b[1]] = b[3] end
                    UIDropDownMenu_AddButton(info, level)
                end

            elseif level > 1 then
                --print(#_menuLists[UIDROPDOWNMENU_MENU_VALUE][2])
                --for x=1, #_menuLists[UIDROPDOWNMENU_MENU_VALUE] do
                for a,b in pairs(_menuLists[UIDROPDOWNMENU_MENU_VALUE]) do
                    info = UIDropDownMenu_CreateInfo()
                    info.text = b[1]
                    info.hasArrow = b[2]
                    if info.hasArrow then _menuLists[b[1]] = b[3] end
                    info.func = OnClick
                    UIDropDownMenu_AddButton(info, level)
                end
            end

        end
    end

    UIDropDownMenu_Initialize(dropDown, initialize)
    UIDropDownMenu_SetWidth(dropDown, width) -- Use in place of dropDown:SetWidth
    UIDropDownMenu_SetButtonWidth(dropDown, width + 24)
    UIDropDownMenu_SetSelectedID(dropDown, 1)
    UIDropDownMenu_JustifyText(dropDown, "LEFT")

    return dropDown
end

Here is an example of the table used with this function:
testMenuList = {{"Greetings", true, {{"Hi", true, {{"H", true, {{"Amazing", false, nil}}},{"i", false, nil}}},
                                     {"Hello", false, nil}}},
                {"Farewells", true, {{"Bye", false, nil},
                                     {"Goodbye", false, nil}}},
                {"Test", false, nil}}


text:
Q: Too many open files in Android.Xamarin I'm have no idea why this is happening ???
when i make scan for less than 300 TCP PORTS i not happen ?
When i need to scan much ports it crash the app ?  ANyone have any idea to solve this error ? it took me some days :)
    public void start(int threadCounter)
    {
        for (int i = 0; i < threadCounter; i++)
        {
            Thread thread1 = new Thread(new ThreadStart(RunScanTcp));
            thread1.Name = "Thread : " + i.ToString();
            thread1.IsBackground = true;
            thread1.Start();
        }
    }
    public void RunScanTcp()
    {
        int port;
        var reset3 = new TaskCompletionSource<bool>();
        //while there are more ports to scan
        while ((port = portList.NextPort()) != -1)
        {
            var reset2 = new TaskCompletionSource<bool>();

            Activity.RunOnUiThread(() =>
            {
                tcp_count = tcp_count + 1;
            });

            Thread.Sleep(100);
            count = port;

            Console.WriteLine("Current Port Count : " + count.ToString());

            try
            {

                Connect(host, port, tcpTimeout);

            }
            catch
            {
                continue;
            }

            Activity.RunOnUiThread(() =>
            {
                received_tcp = received_tcp + 1;
                mdata.Add(new data() { titulli = "Port : " + port, sekuenca = "Sequence : ", ttl = "Connection Sucessfull !", madhesia = "", koha = "Time : " });
                mAdapter.NotifyItemInserted(mdata.Count() - 1);
                if (ndaluar == false)
                {
                    mRecyclerView.ScrollToPosition(mdata.Count() - 1);
                }

                reset2.TrySetResult(true);
            });

            reset2.Task.Wait();
            Console.WriteLine("TCP Port {0} is open ", port);

        }

        if (turnOff == true)
        {
            turnOff = false;
            Activity.RunOnUiThread(() =>
            {
                mdata.Add(new data() { titulli = "General Information", sekuenca = "Transmited : " + tcp_count + ",", ttl = "Open Ports : " + received_tcp + ",", madhesia = "Closed Ports : " + (tcp_count - received_tcp), koha = "" });
                mAdapter.NotifyItemInserted(mdata.Count());
                if (ndaluar == false)
                {
                    mRecyclerView.ScrollToPosition(mdata.Count() - 1);
                }

                ping_progress.Visibility = ViewStates.Invisible;
                dergo_ping.Text = "Scan";
                reset3.TrySetResult(true);
            });
            reset3.Task.Wait();
            Console.WriteLine("Scan Complete !!!");
        }
    }
    public TcpClient Connect(string hostName, int port, int timeout)
    {
        var newClient = new TcpClient();

        var state = new isTcpPortOpen
        {
            MainClient = newClient,
            tcpOpen = true
        };

        IAsyncResult ar = newClient.BeginConnect(hostName, port, AsyncCallback, state);
        state.tcpOpen = ar.AsyncWaitHandle.WaitOne(timeout, false);

        if (state.tcpOpen == false || newClient.Connected == false)
        {
            throw new Exception();

        }
        return newClient;
    }
    public void AsyncCallback(IAsyncResult asyncResult)
    {
        var state = (isTcpPortOpen)asyncResult.AsyncState;
        TcpClient client = state.MainClient;

        try
        {
            client.EndConnect(asyncResult);
        }
        catch
        {
            return;
        }

        if (client.Connected && state.tcpOpen)
        {
            return;
        }

        client.Close();
    }

THIS IS THE DEBUG OUTPUT

rt Count : 961
05-17 23:08:29.430 I/mono-stdout(13704): Current Port Count : 961
Current Port Count : 962
05-17 23:08:29.449 I/mono-stdout(13704): Current Port Count : 962
Current Port Count : 963
05-17 23:08:29.451 I/mono-stdout(13704): Current Port Count : 963
Current Port Count : 964
05-17 23:08:29.462 I/mono-stdout(13704): Current Port Count : 964
05-17 23:08:29.464 E/Parcel  (13704): dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 1, error: Too many open files
Current Port Count : 965
05-17 23:08:29.481 I/mono-stdout(13704): Current Port Count : 965
05-17 23:08:29.483 E/Parcel  (13704): dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 1, error: Too many open files
05-17 23:08:29.488 E/Parcel  (13704): writeDupFileDescriptor: error 24 dup fd 1017
05-17 23:08:29.489 E/Surface (13704): queueBuffer: error queuing buffer to SurfaceTexture, -22
05-17 23:08:29.489 E/EGL-ERROR: void __egl_platform_queue_buffer_android(mali_base_ctx_handle, egl_buffer*):1374: unable to queue buffer (0x0xb8ed1380)
05-17 23:08:29.500 E/Parcel  (13704): dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 1, error: Too many open files
Current Port Count : 966
05-17 23:08:29.500 I/mono-stdout(13704): Current Port Count : 966
Current Port Count : 967
Current Port Count : 968
05-17 23:08:29.515 I/mono-stdout(13704): Current Port Count : 967
05-17 23:08:29.516 I/mono-stdout(13704): Current Port Count : 968
05-17 23:08:29.519 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.520 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.520 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 969
05-17 23:08:29.524 I/mono-stdout(13704): Current Port Count : 969
Current Port Count : 969
05-17 23:08:29.524 I/mono-stdout(13704): Current Port Count : 969
Current Port Count : 970
05-17 23:08:29.534 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.535 I/mono-stdout(13704): Current Port Count : 970
05-17 23:08:29.535 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.536 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:29.552 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.553 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.553 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 972
05-17 23:08:29.556 I/mono-stdout(13704): Current Port Count : 972
Current Port Count : 971
05-17 23:08:29.556 I/mono-stdout(13704): Current Port Count : 971
Current Port Count : 973
05-17 23:08:29.568 I/mono-stdout(13704): Current Port Count : 973
05-17 23:08:29.571 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.571 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.572 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 974
05-17 23:08:29.586 I/mono-stdout(13704): Current Port Count : 974
Current Port Count : 975
Current Port Count : 976
Current Port Count : 977
Current Port Count : 979
Current Port Count : 978
Current Port Count : 980
05-17 23:08:29.589 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.589 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.590 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:29.605 I/mono-stdout(13704): Current Port Count : 975
05-17 23:08:29.605 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.606 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.607 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:29.622 I/mono-stdout(13704): Current Port Count : 976
05-17 23:08:29.622 I/mono-stdout(13704): Current Port Count : 977
05-17 23:08:29.624 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.625 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.625 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:29.626 I/mono-stdout(13704): Current Port Count : 979
05-17 23:08:29.626 I/mono-stdout(13704): Current Port Count : 978
05-17 23:08:29.637 I/mono-stdout(13704): Current Port Count : 980
05-17 23:08:29.642 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.643 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.643 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 981
05-17 23:08:29.658 I/mono-stdout(13704): Current Port Count : 981
05-17 23:08:29.659 I/mono-stdout(13704): Current Port Count : 982
05-17 23:08:29.661 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.662 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.662 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 982
Current Port Count : 983
05-17 23:08:29.670 I/mono-stdout(13704): Current Port Count : 983
05-17 23:08:29.677 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.678 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.679 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 984
05-17 23:08:29.688 I/mono-stdout(13704): Current Port Count : 984
05-17 23:08:29.696 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.696 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.697 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 985
05-17 23:08:29.707 I/mono-stdout(13704): Current Port Count : 985
05-17 23:08:29.714 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.715 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.715 I/System  (13704): FinalizerDaemon: finalize objects = 615
05-17 23:08:29.715 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 986
Current Port Count : 987
05-17 23:08:29.723 I/mono-stdout(13704): Current Port Count : 986
05-17 23:08:29.724 I/mono-stdout(13704): Current Port Count : 987
Current Port Count : 988
Current Port Count : 989
05-17 23:08:29.728 I/mono-stdout(13704): Current Port Count : 988
05-17 23:08:29.728 I/mono-stdout(13704): Current Port Count : 989
05-17 23:08:29.731 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.732 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.732 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
Current Port Count : 990
05-17 23:08:29.739 I/mono-stdout(13704): Current Port Count : 990
Thread finished: Thread : 4 #11
Current Port Count : 991
Current Port Count : 992
05-17 23:08:29.747 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.748 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:29.748 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:29.760 I/mono-stdout(13704): Current Port Count : 991
05-17 23:08:29.764 I/mono-stdout(13704): Current Port Count : 992
Current Port Count : 1000
Current Port Count : 1000
05-17 23:08:29.970 I/mono-stdout(13704): Current Port Count : 1000
05-17 23:08:29.970 I/mono-stdout(13704): Current Port Count : 1000
05-17 23:08:29.971 I/mono-stdout(13704): Current Port Count : 1000
Thread finished: Thread : 5 #12
Current Port Count : 1000
Current Port Count : 1000
05-17 23:08:29.985 I/mono-stdout(13704): Current Port Count : 1000
05-17 23:08:29.985 I/mono-stdout(13704): Current Port Count : 1000
Thread finished: Thread : 8 #15
Thread finished: Thread : 1 #8
Current Port Count : 1000
05-17 23:08:30.015 I/mono-stdout(13704): Current Port Count : 1000
Thread finished: Thread : 3 #10
Current Port Count : 1000
Thread finished: Thread : 2 #9
Current Port Count : 1000
05-17 23:08:30.041 I/mono-stdout(13704): Current Port Count : 1000
Thread finished: Thread : 0 #7
Current Port Count : 1000
05-17 23:08:30.073 I/mono-stdout(13704): Current Port Count : 1000
Thread finished: Thread : 7 #14
Thread finished: Thread : 6 #13
Scan Complete !!!
05-17 23:08:30.099 I/mono-stdout(13704): Scan Complete !!!
Thread finished: Thread : 9 #16
The thread 'Unknown' (0xb) has exited with code 0 (0x0).
The thread 'Unknown' (0xc) has exited with code 0 (0x0).
The thread 'Thread : 8' (0xf) has exited with code 0 (0x0).
The thread 'Thread : 1' (0x8) has exited with code 0 (0x0).
The thread 'Thread : 3' (0xa) has exited with code 0 (0x0).
The thread 'Unknown' (0x9) has exited with code 0 (0x0).
The thread 'Unknown' (0x7) has exited with code 0 (0x0).
The thread 'Unknown' (0xe) has exited with code 0 (0x0).
The thread 'Unknown' (0xd) has exited with code 0 (0x0).
The thread 'Unknown' (0x10) has exited with code 0 (0x0).
05-17 23:08:30.159 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.160 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.161 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.166 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.167 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.167 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.176 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.176 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.177 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.193 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.194 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.194 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.211 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.211 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.212 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.228 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.229 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.230 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.246 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.247 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.247 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.264 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.264 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3
05-17 23:08:30.265 E/OpenGLRenderer(13704): GL error:  GL_INVALID_VALUE
05-17 23:08:30.282 E/EGL-ERROR: void __egl_platform_dequeue_buffer(egl_surface*):1737: failed to dequeue buffer from native window 0xb8f95410; err = -38, buf = 0x0,max_allowed_dequeued_buffers 3

A: You need Dispose a TcpClient after use.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Show that if $\lim_{x \to 0} x^2 = 0$, then $\lim_{x \to 0} x^n = 0$ (proof confirmation) Let $n \in \mathbb{N}$ be such that $n \geq 3$. Derive the inequality $-x^2 \leq x^n \leq x^2$ for $-1 < x < 1$. Then, use the fact that $\lim_{x \to 0} x^2 = 0$ to show that $\lim_{x \to 0} x^n = 0$.
I suppose there are two questions here. Firstly, I did not see how to prove that $-x^2 \leq x^n \leq x^2$ for $-1 < x < 1$. This is one of those things I find to be extremely "obvious" that it ends up being difficult to see how to prove it! A hint to get started on this would be helpful!
I decided to attempt to prove the final statement without using the previous, and I did come up with something. I would like to confirm this since ignoring part of a question is usually a bad idea!
I want to show $\forall \epsilon > 0$, $\exists \delta > 0$ s.t. whenever $|x| < \delta$, $|x^n|< \epsilon$.
Since $x \in (-1,1)$, I only need to consider $(0,1)$ since we are taking the absolute value. Write $x = \frac{1}{1 + y}$ for some $y > 0$.
Choose $\delta = min(1,(1-n)\epsilon)$. Then,
$|x^n| = |\frac{x}{(1 + y)^{n-1}}| < |\frac{\delta}{1 - n + ny}| < |\frac{\delta}{1-n}| = \epsilon$
where the middle step followed by Bernoulli's inequality. As I said, I weary having skipped an entire portion of the problem, but I am curious if this works!


text:
Q: Linking Many to Many associations in CakePHP I have a website for asking questions and getting answers. When a question is asked, I want to be able to tag the new question with multiple topics. Using a multiselect, I've sent back an array of topic_ids to the controller. I've been following Cake's documentation but I've been getting lots of errors.
Is this the proper way to link associated entities with a many to many relationship? I can provide more information or code if it's needed.
$question = $this->Questions->newEntity();

if ($this->request->is('post')) {
    $topics = array_map(
        function($id) {
            $topic = $this->Questions->Topics->get($id);
            $topic->_joinData = $this->Questions->TopicsQuestions->newEntity();
            // user_id is metadata in the topics_questions table
            $topic->_joinData->user_id = $this->Auth->User()->id;

            return $topic;
        },
        // this is passed back as an array of topic_id
        $this->request->data['topics'];
    );

    $this->Questions->Topics->link($question, $topics);

    $question = $this->Questions->patchEntity($question, $this->request->data, ['associated' => ['Topics']]);

    if ($this->Questions->save($question)) {
        return $this->redirect(['action' => 'view', $question->id]);
    } else {
        $this->Flash->error(__('The question could not be saved. Please, try again.'));
    }
}

A: From the CakePHP API Docs:

Both the source entity and each of the target entities are assumed to
  be already persisted, if they are marked as new or their status is
  unknown then an exception will be thrown.

So the call to link needed to be made after the question was saved.


text:
Q: get Last value of a column in sql server I want to get the last value of a column(it is not an identity column) and increment it to the value of corresponding row number generated.
Select isnull(LAST_VALUE(ColumnA) over(order by ColumnA), 0) +
       ROW_NUMBER() OVER (ORDER BY ColumnA)
from myTable

I am calling my sp recursively hence why I thought of this logic.
But it is not working.
I basically wanted, for first time 1-9 for second run (if recursively being called 2 times) 10-19 and so on.

A: Total stab in the dark, but I suspect "not working" means "returning the current row's value." Don't forget that an OVER clause defaults to the window RANGE BETWEEN PRECEDING AND CURRENT ROW when one isn't explicitly specified and there is an ORDER BY (see SELECT - OVER Clause (Transact-SQL) - ORDER BY).

ORDER BY
ORDER BY *order_by_expression* [COLLATE *collation_name*] [ASC|DESC]

Defines the logical order of the rows within each partition of the result set. That is, it specifies the logical order in which the window function calculation is performed.

*

*If it is not specified, the default order is ASC and window function will use all rows in partition.

*If it is specified, and a ROWS/RANGE is not specified, then default RANGE UNBOUNDED PRECEDING AND CURRENT ROW is used as default for window frame by the functions that can accept optional ROWS/RANGE specification (for example min or max).

As you haven't defined the window, that's what your LAST_VALUE function is using. Define that you want the whole lot for the partition:
SELECT ISNULL(LAST_VALUE(ColumnA) OVER (ORDER BY ColumnA ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), 0) +
       ROW_NUMBER() OVER (ORDER BY ColumnA)
FROM dbo.myTable;

Though what Gordon says in their comment is the real solution:

You should be using an identity column or sequence.

This type of solution can (and will) end up suffering race conditions, as well as end up reusing "identities" when it shouldn't be.


text:
Q: What are the advantages/disadvantages of using Maven? I would like to know the reasons people use or not use Maven. We are about to switch all our builds to Maven 2 and don't have to much experience with it.
What are the advantages/disadvantages of using Maven 2, stuff like:

*

*Why did you switch to maven?

*Why did you throw maven away and used
something else?

*What problem did it
solve for you?

*What problem did it
cause for you?

Thank you!

A: Maven is fantastic!
I don't have as much time to wax lyrical as I would like, but here are my top few benefits of Maven, in no particular order:

*

*Repeatable builds: if you can build the project, your colleagues will always be able to on their machines.  It'll also be repeatable on the build server.

*Standardisation of the build system: new developers who understad Maven will instantly know how to build, release, test etc, removing a lot of learning overhead.

*Focus on automation: Maven puts you in a mindset of automating processes around your software development.

*Convention over configuration: no setup or minimal configuration required to build artifacts.

*Dependency management: Maven will resolve and manage your dependencies for you.

*Testing: the ability to run tests and integration tests as part of your project lifecycle.

*Plugins: there are thousands of plugins to carry out various tasks.  These are simply configured in just by adding a reference into the POM.

In terms of downsides, it is often said that you are better off accepting the Maven defaults and conventions, and ideally starting to use it at the outset of a greenfield project.  I would agree with this to a degree if you want to save time configuring XML in your POM.
I'm not really a tool zealot, but having used Make and Ant before Maven, I really can't see a single downside to adopting Maven.  It's a quality tool and a real time saver.

A: The great advantage of using Maven is its repository infrastructure. This promotes standard protocols for the sharing of 3rd party libraries and enables teams to collaborate more effectively without being forced to check everything into the same source code repository (Modular builds).
Repository managers are freely available and I'd recommend installing one of the following:

*

*Nexus

*Artifactory

*Archiva

The good news is that you're not forced to build your code using Maven in order to utllize the benefits of having a Maven infrastructure.
I recommend Maven for "Green field" projects without a legacy to defend. The start of a project is generally the best time to introduce a new technology and the benefits of using Maven are well documented. The high-lights being a standardised build process and a wealth of 3rd party plugins.
ANT projects can be re-engineered to inter-operate with teams using Maven. The ivy plugin, applied properly, can actually simplify the ANT build process. Ivy is able to manage the project's classpath by downloading dependencies from the Maven repository and afterwards publishing the build artifacts (Just like a Maven "deploy").
Finally ivy is been embedded into other build tools. Examples are new build tools like Gradle, simple-build-tool and development systems like Grails. So embrace the use of an Enterprise Maven repository and choose the build tool that is appropriate for the project team.

A: So far I dis-like it.
When I use maven the build time for a project goes up dramatically. From several ms to a second on just eclipse, to over 30 seconds for even the simplest maven project.
Given that so many people like it, I must be doing something wrong, but so far I cannot seem to figure out why it takes ages to build a maven based project.

A: I have used maven in every project I have encountered over the last 4 years or so, ranging from private mini-projects to huge enterprise dozens-of-modules projects and I have never once regretted using maven.
I have built anything from standard java JAR / WAR / EAR projects to flex / AIR apps and Linux RPMs using maven, delegating to either Antrun or GMaven when no maven plugin was available for a given situation.
The power and comfort of the standard maven lifecycle combined with the abundance of available plugins for code generation, documentation, code metrics etc that are usually all easy to use makes maven the only real choice for java build systems.
Go ahead and bash it, but until you invent something better, I'll keep using it.

A: I started with maven and I stay with it. When I build a project with maven I never have problems with missing libraries, wrong libraries versions, ... It compiles, it runs.
Libraries upgrade is simple (not like Ant).
Maven provides many useful plugins. I use maven to run functionality testing on hudson - it downloads newest version of my project, starts embedded database, injects dbunit dataset, deploys application on jetty, runs test, renders test results.
One thing I don't like is to have everything in one file. Then I would like to specify configuration not only using XML.

A: I agree with Mark that it's great for greenfield projects.  There is a bit of an overhead to get it up and running in your development environment, but it is well worth it.
I might add that a potential danger to using Maven is that if you are working on a large project, it may become difficult to maintain the jars in the repository.  You can potentially end up using several different versions of jars in your POM.xml's.
As with any project, make sure that you have good policies and procedures in place for bringing in different Jars into your code base.  These jars can have different licenses that may expose your code base to the open source world.  Make sure these licenses are reviewed by your.


text:
Q: Spring without xml configuration is not scanning packages I can't figure out how to setup Spring without XML to scan packages and inject components.
I have the following code.
@Configuration
@ComponentScan("com.mypackage")
public class WebServer {

    public static void main(String[] args) throws Exception {
    }
}

@Service
public class Foo {
    public void print() {
        System.out.println("FOO");
    }
}

@Controller
public class FooController {

    private Foo foo;

    @Autowired
    public void setFoo(Foo foo) {
        this.foo = foo;
    }

}

And the following pom.xml
   <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org-springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org-springframework.version}</version>
    </dependency>

Foo class and FooController are under the com.mypackage package but the code never hits setFoo.
Am I missing something?
Thank you

A: You have to create the ApplicationContext first. If you are using Spring Boot, it takes care of it. It's useful especially for starting points.
Please refer to the docs.


text:
Q: How to use the javascript function to enable/disable the checkbox in rowwise from gridview? I want to check the checkbox in rowwise with the some conditions.

*

*The first condition is when three Checkboxes are selected continuously in same row,it should display the alert popup.("You can't select continuous three hours").

*Next condition is,it shouldn't select more than three checkbox in each row.
I used the below java script,in this code its checking in column wise but I want to check in row wise.
How can I accomplish this condition ?
    function CheckCheck() {
        var chkBox = document.getElementById('<%=Gv1.ClientID %>');
        var chkBoxCount = chkBox.getElementsByTagName("input");

        var btn = document.getElementById('<%=btnsubmit.ClientID %>');
        var i = 0;
        var tot = 0;
        for (i = 0; i < chkBoxCount.length; i++) {
            if (chkBoxCount[i].checked) {
                tot = tot + 1;

                if (tot > 2) {
                    alert('Cannot check more than 2 check boxes');
                    chkBoxCount[i].checked = false;
                    return;
                }
            }
        }
    }

HTML:
   <asp:GridView ID="Gv1" runat="server" AutoGenerateColumns="False" OnRowDataBound="Gv1_RowDataBound">
        <Columns>
            <asp:BoundField DataField="datedif" HeaderText="Day/Hour" SortExpression="datedif" />
            <asp:TemplateField HeaderText="Hour1">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" Enabled='<%# Eval("hour1").ToString().Equals("False") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hour2">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" Enabled='<%# Eval("hour2").ToString().Equals("False") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hour3">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox3" runat="server" Enabled='<%# Eval("hour3").ToString().Equals("False") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hour4">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox4" runat="server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox4" runat="server" Enabled='<%# Eval("hour4").ToString().Equals("False") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hour5">
                <EditItemTemplate>
                    <asp:CheckBox ID="CheckBox5" runat="server" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox5" runat="server" Enabled='<%# Eval("hour5").ToString().Equals("False") %>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

A: You can get the collection of <tr> (rows) in the gridview and loop through them, looking for check boxes in each row. I would rename your variable chkBox to something like grid, because you are getting the gridView not a checkbox:
var grid = document.getElementById('<%=Gv1.ClientID %>');
var gridRows = grid.getElementsByTagName("tr");
for (rowIndex = 0; rowIndex < gridRows.length; rowIndex++) {
    var row = gridRows(rowIndex);
    var chkBoxCount = row.getElementsByTagName("input");

    for (i = 0; i < chkBoxCount.length; i++) {
        if (chkBoxCount[i].checked) {
            tot = tot + 1;

            if (tot > 2) {
                alert('Cannot check more than 2 check boxes');
                chkBoxCount[i].checked = false;
                return;
            }
        }
    }
}


text:
Q: copy column from other dataframe based on matching values I have two dataFrames, one with iso codes and country names
and the other one with only country names.
I would like to add a new column to df2 with the country names from df1 if the values df1.iso == df2.id match.
df1
Country      iso
Afghanistan  AFG
Afghanistan  AFG
Afghanistan  AFG
...

and df2
id
AFG
AFG
AFG
AFG
...

I tried this:
post['country'] = pre['Country'].where(pre['iso'] == post['id'])
But I got an error
ValueError: Can only compare identically-labeled Series objects

A: You can use DataFrame.merge to left merge df2 with df1 after dropping duplicate values from df1:
df2 = df2.merge(df1.drop_duplicates(), left_on='id',
                right_on='iso', how='left').drop('iso', 1)

Or, you can use Series.map to map the Country from df1 to df2 based on iso code:
df2['Country'] = df2['id'].map(df1.drop_duplicates().set_index('iso')['Country'])

Result:
print(df2)
    id      Country
0  AFG  Afghanistan
1  AFG  Afghanistan
2  AFG  Afghanistan
3  AFG  Afghanistan


text:
Q: Small program to automate a task? Here is a thing. I am from Poland but I'd like to use google.com instead of google.pl. But every time I go to google.com it redirects me to polish version of the site. I've already tried adding /ncr at the end of the address but it doesn't work. To be able to use the english version of google I have to type something into the search bar, click on the wheel on the right site --> search setting --> languages and change it to wanted language, english in this case. I thought I could write a program to make it simpler. What I would like to ask you guys is to give me some suggestions ideas about programming language, tools to use, anything really would be appreciated.

A: https://www.google.de/setprefdomain?prefdom=US&sig=0_Ft2f2VNGqB3slvET2JlWtBPSfco%3D
Add the far right bottom of google.pl, there should be a link to google.com, refering the above one


text:
Q: Entity relationship I have started develping database for machineries performance mgt system
Facts:
1.A machine(platNo,model,name) can work on several cane fields(fieldNo,fieldNo)
  - machine vs field
2.Many machineries can work on a cane field
3.A machine can do tasks for many userDept(deptId,deptName)
4.A userDept demands several machines for its activity{A task can be done on several     cane fields; plowing,land shaping,etc can be done on field 1, 2, 3...- task vs field,
Many tasks can be done on a field; on field 1 , plowing ,harrowing,... can be done
- task vs field?/?}
5.A machine can do for many userDept; lpcd(using its machine) can do the same type of work (e.g.: plowing) for plantation, rehabilitation and expansion projects.
  - task vs userDept
6.Much type of tasks can be done for a userDept; plowing, harrowing,... can be done for plantation-  task vs user
7.A machine works in three shifts(1 -to- 3)
Problem : please help me in designing the ER!!
Thanks,
Dejene

A: I'll assume platNo can be used as a unique identifier for a machine. There are quite a few possibilities depending on rules that you have left ambiguous - e.g. some of the following relations may not be required or may need to be modified:
MACHINE (platNo, model, name) - represents each machine
FIELD (fieldNo) - represents each cane field
TASK (taskId, taskName) - represents the various tasks (e.g. plowing, harrowing) that can be done by any machine
USERDEPT (deptId, deptName) - represents each department
PROJECT (projId, projName, deptId) - represents each project for each department (e.g. plantation, rehabilitation, expansion)
SHIFT (shiftNo) - represents the shifts that any machine might be assigned to
MACHINE_FIELD (platNo, fieldNo) - represents the fact that a particular machine can work on a particular cane field
MACHINE_TASK (platNo, taskId) - represents the fact that a particular machine can perform a particular task
PROJECT_REQUIREMENT (projId, taskId) - represents the fact that a particular project (for a particular department) requires a particular task
MACHINE_ASSIGNMENT (projId, taskId, shiftNo, platNo) - represents the fact that a particular machine has been assigned to perform a particular task on a given shift


text:
Q: Update system from live session I have a faulty system that refuses to show anything on the screen (the Kubuntu logo appears ok but no sddm for login).
I was hopping to update the system (since it is a fresh install) with any updates that could be available (or even enabling the proposed repos or reinstalling packages or installing propietary GPU drivers).
So the question is, how to boot from a live [usb], change to the installed file system and run apt-get or similar so the installed system gets updated (even if the update affects the kernel)?
The running version is Kubuntu 15.04.

A: Step one: boot whatever live media you use, usb or cd.
Step two: access to tty1 once you get to the "Try Ubuntu" vs "Install Ubuntu" screen and press Ctrl-Alt-F1; alternatively , click "Try Ubuntu" and access gnome-terminal once you get to live desktop
Step three: run the commands bellow
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
Step four: run whatever updates you need, sudo apt-get upgrade or sudo apt-get update.
This method is used for failed updates mostly or password recovery, or in my case - installing the coreutils package which I deleted when I got grep into apg-get --remove by accident (and that was not fun!)


text:
Q: How is timestampable used? I was taking a test and saw this function:
Class Object{
    use Timestampable;
}
$object= new Object();
$object->setCreatedAt(new DateTime());

I believe it was a trick question, because I don't find "timestampable" in the php manual.
I have seen references to it on stackoverflow, which got me confused to if it actually can be used.  I know of timestamp in the MySQL database, but does this actually exist or have a use in PHP?

A: Timestampable is a so-called trait and is meant to help reuse code.
Let's say you have a bunch of entities and all of them have some common functionality, e.g. they all need $createdAt and $updatedAt fields. You could achieve this functionality by creating a common base class for all entities, but that wouldn't be great from architecture standpoint.
Instead you could create a trait:
trait Timestampable
{
    protected DateTime $createdAt;
    protected DateTime $updatedAt;
    ...
}

And then use it like so:
class User
{
    use Timestampable;
}

Now User objects will have $createdAt field and any other fields or methods that are defined in the trait, just like they would be defined inside the User class. This way you don't need to repeat the same code in all of your classes.
Timestampable is one of more common traits, but obviously traits aren't limited to that. Here's an example of a more complete Timestapable trait.
I know this is a 4 year old question, but it was the top result on google, so thought it may be helpful for others.

A: The question on the test is not about a Timestampable function, that is just the example. The question is designed to your knowledge of abstract classes, interfaces and traits.


text:
Q: Event handling in datalist I am having a datalist showing posts and I added textbox and button for adding a comment, but when I test the website and add a comment I find that the comment is added for the post correctly but a blank comment added to the rest of the posts...?
Anyone know how i can handle this? Here is my code:
protected void Button9_Click1(object sender, EventArgs e)
{
    foreach (DataListItem item in DataList2.Items)
    {
        TextBox TextBox1 = (TextBox)item.FindControl("TextBox1");
        string text = TextBox1.Text;
        Label post_IDLabel = (Label)item.FindControl("post_IDLabel");
        string connStr = ConfigurationManager.ConnectionStrings["MyDbConn"].ToString();
        SqlConnection conn = new SqlConnection(connStr);
        SqlCommand cmd = new SqlCommand("comment", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        int post_ID = Convert.ToInt32(post_IDLabel.Text);
        string comment = text;
        string email = Session["email"].ToString();
        int course_ID = Convert.ToInt32(Request.QueryString["courseID"]);
        cmd.Parameters.Add(new SqlParameter("@course_ID", course_ID));
        cmd.Parameters.Add(new SqlParameter("@comment", comment));
        cmd.Parameters.Add(new SqlParameter("@myemail", email));
        cmd.Parameters.Add(new SqlParameter("@postID", post_ID));
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();
    }
}

and this is the comment procedure
CREATE PROC comment
@comment VARCHAR (100),
 @myemail VARCHAR (30),
 @postID INT,
 @course_ID INT
 AS
 IF @myemail IN (SELECT student_email FROM Students_Subscribes_Course_pages WHERE subscribed = 1)
 OR @myemail IN (SELECT added_email FROM Lecturers_Adds_Academics_Course_page WHERE course_ID = @course_ID)
 AND @postID IN (SELECT post_ID FROM Posts WHERE @postID = @postID) OR @myemail =
 (SELECT page_creator FROM Course_pages WHERE course_ID = @course_ID) AND @postID IN
 (SELECT post_ID FROM Posts)
 INSERT INTO Members_Comments_Posts (commenter,post_ID, comment_content)
 VALUES (@myemail, @postID, @comment)
 ELSE
PRINT 'sorry, you are not subscribed or post not found'

A: The problem is that you execute the same code for every item in the list rather than those items that had comments left for them or the currently selected item.
One solution to this is to see if the text is set before executing the database code.
Here is how I would rewrite the loop:
foreach (DataListItem item in DataList2.Items)
{
    TextBox TextBox1 = (TextBox)item.FindControl("TextBox1");
    string text = TextBox1.Text;
    if (!string.IsNullOrEmpty(text)) {
      Label post_IDLabel = (Label)item.FindControl("post_IDLabel");
      string connStr = ConfigurationManager.ConnectionStrings["MyDbConn"].ToString();
      SqlConnection conn = new SqlConnection(connStr);
      SqlCommand cmd = new SqlCommand("comment", conn);
      cmd.CommandType = CommandType.StoredProcedure;
      int post_ID = Convert.ToInt32(post_IDLabel.Text);
      string comment = text;
      string email = Session["email"].ToString();
      int course_ID = Convert.ToInt32(Request.QueryString["courseID"]);
      cmd.Parameters.Add(new SqlParameter("@course_ID", course_ID));
      cmd.Parameters.Add(new SqlParameter("@comment", comment));
      cmd.Parameters.Add(new SqlParameter("@myemail", email));
      cmd.Parameters.Add(new SqlParameter("@postID", post_ID));
      conn.Open();
      cmd.ExecuteNonQuery();
      conn.Close();
   }
}

This will ensure that any comments on any posts will be updated, but you may need to update the logic to ensure that only the selected post is updated.
Also, you should move your connection open/close and command creation out of the loop in order to be more efficient.


text:
Q: Is there a way to do unit tests using private variables without increasing their visibility? I have a MyClass I want to test.
I have a TestMyClass class I'm going to use for this.
In MyClass I have several private variables.
I want to run tests using these private variables in TestMyClass.
I can just go and change all these private variables to public and then use them as objects in TestMyClass, but is there a way to do the testing without increasing the visibility of these variables? That is without manually going in to TestMyClass, deleting the private visibility marker and entering a "public" visibility market.
Thanks!

A: its not adviced to test private memebers directly. The code should be designed in such a way that these private members will be indirectly called by public (interface) methods (example in your case: You can have setters and getters for member variables).
But you can use the Java Reflection API if you absolutely want to test private members.

A: Why not provide setter / getter and use them instead of exposing variables?

A: use public setter and getters for that private Properties in a class

A: As explained in other answers, it is not necessary/advised to test private methods and/or access private fields. If you really want/have to do this, then PowerMock is the way to go.
If you have to access private attributes to set them, then Spring's ReflectionUtils can be very helpful. If you are using mockito, you can also use the @InjectMocks annotation, which will inject any @Mock-annotated attribute in your test class in the tested object.
Otherwise, there is still the possibility to change a public access to a protected or package private access, which will be much more restrictive than public.

A: What's wrong with interacting with your private variables using getters/setters? You can use a setUp()/@Before method in your test class to set up the state you wish to test. For example:
public class MyClass {
    private int myInt;
    public void setMyInt( int i ) { this.myInt = i; }
    public int getMyInt() { return this.myInt; }

    public void addsTo( int add ) { return myInt + add; }
    ...
}

public class TestMyClass {
    MyClass my = new MyClass();
    @Before public void setup() { my.setMyInt( 42 ); }
    @Test public void testIs42() { assertEqual( "MyInt is 42" , my.getMyInt() , 42 ); }
    @Test public void testAddsTo() { assertEqual( "addsTo() works" , my.addsTo( 10 ) , 52 ); }
}

Makes sense? In this manner you only interact with the private variables through public methods. The addsTo() example is to illustrate that you would normally test the public methods the class exposes, not the getters/setters.
On a similar note, I often find myself changing method visibility from private to protected to allow testing class methods.
Cheers,

A: One solution is to mark them as protected, then have a MyClassTestSupport that exposes them using getters/setters. However, this pattern doesn't work very well if your class is a base class for others...


text:
Q: Gridstack Remove specific Elements I have the following:

                    Announcements

Tickets

Alerts

Emails

The grid displays perfectly fine but I would like to have certain elements that the users will not be able to remove. What I tried is to check if the element has a data attribute and add it back to the grid but I lose the html id of the element. Is there a better way of doing this?
let grids = GridStack.initAll({
    cellHeight: 100,
    acceptWidgets: true,

    dragInOptions: { revert: 'invalid', scroll: false, appendTo: 'body', helper: 'clone' },
    removable: '.trash'
});

grids[0].on('added removed change', function(e, items) {
    let str = '';
    items.forEach(function(item) {
        if (e.type=='removed' && $('#'+item.el.id).data('default')==1) {
            let is_default = item.el.dataset.isdefault;
            let is_removable = item.el.dataset.isremovable;
            alertify.error('Cannot remove a default widget');
            let wdtg = {
                x: item.x,
                y: item.y,
                w: item.w,
                h: item.h,
                id: item.id,
                content: item.el.firstElementChild.innerHTML

            };
        }
        //maybe there is a way to select the newly created element to add the data- attributes back? and the ID
        str += ' (x,y)=' + item.x + ',' + item.y + ' ' + item.el.id + ' '+item.w +' Extras: '+item.default+' '+item.removable;

    });
});

There is another grid below but it is irrelevant to this question, that is why I am using initAll
I would like the users to be able to move the elements around but some of them should not be removable.
Thank you

A: So I figured out a solution that works but I am not very confident in it.
grids[0].on('added removed change', function(e, items) {
    let str = '';
    var wdgt;
    items.forEach(function(item) {
        if (e.type=='removed' && $('#'+item.el.id).data('isdefault')==1) {
            let is_default = item.el.dataset.isdefault;
            let is_removable = item.el.dataset.isremovable;
            alertify.error('Cannot remove a default widget');
            wdtg = {
                x: item.x,
                y: item.y,
                w: item.w,
                h: item.h,
                id: item.id,
                content: item.el.firstElementChild.innerHTML

            };
            grids[0].addWidget(wdtg);
            //get all items
            let all_items = grids[0].getGridItems();
            //get length of array
            let numberOfElems = all_items.length;
            //add back all attributes to the last element in the array
            //as it seems that gridstack pushes the new element when using
            //addWidget to its array
            all_items[numberOfElems-1].setAttribute('data-isdefault', $('#'+item.el.id).data('isdefault'));
            all_items[numberOfElems-1].setAttribute('data-isremovable', $('#'+item.el.id).data('isremovable'));
            all_items[numberOfElems-1].setAttribute('id', item.el.id);
        }
        str += ' (x,y)=' + item.x + ',' + item.y + ' ' + item.el.id + ' '+item.w +' Extras: '+item.default+' '+item.removable;
    });
    console.log(e.type + ' ' + items.length + ' items:' + str);
});


text:
Q: texture corruption on Galaxy Note3 updated with KitKat 4.4.2 when back button pressed I add some textures to GL Surface, GL displays it, and I press back button,
which means the GL thread stops, the activity destroys, and my application goes onto background. After that, somehow all the texts on the menus that the next activity displays goes corrupted looking images like rectangle and never recovered.
I have searched to solve this problem in stackoverflow and found this might be related with h/w acceleration. But, it doesn't seem to work on my circumstances and I really need a essential solution to this.
Are there anyone that can help me, or experience the same problem with mine?
The release date of my app is upcoming, and any information that you have would be very appreciated.

A: Do you call GLSurface.onPause () at the appropriate time? Among other things, this will release the OGL Display appropriately (http://developer.android.com/reference/android/opengl/GLSurfaceView.html look at the Activity Life-cycle section).
If this doesn't fix your problem then please provide code snippets.


text:
Q: C++ How to determine and report offset for current position in binary file using pubseekoff? I have only been working with C++ for about 6 months so my apologies for any stupid mistakes I make in my code.
I am working on a project that will read in a binary file to a streambuf and then search the streambuf for specific sequences and report the sequences starting offset in the binary file as well as an identifier for which specific sequence was found in the binary file.
The sequences to search for are stored in a vector> called snortRules where each index of the snortRules vector is the a single sequence stored as vector of ints.
Ultimately i need to create a text file that will show the offset and specific sequence found for comparison against another file that should match, but for now I am just printing the results to a console window.
My code seems to be working as it reports finding all the sequences except for a single issue. For some reason I sometimes get a repeat of the offset for where a sequence is found. for example output would be:
101521 #655
101816 #656    <--This output is correct
101816 #657    <--This output is wrong and should have offset 101865
101893 #658    <--This output is correct
101893 #659    <--This output is wrong and should have offset 102084
102105 #660
102325 #661
102378 #662

I think my issues is that I am not getting the offset correctly using streambuf's pubseekoff.
my code is:
fstream binFS(binName, ios::in | ios::binary); //create stream
streambuf* binBuff = binFS.rdbuf(); //create streambuf from filestream
int currentChar; //ascii code of current character from binary file
streamsize offset; //location of first character of rule in binary file
do
{ //until the end of binary file
    for(unsigned i=0; i<snortRules.size(); ++i)
    {//start by finding the begining of current rule
        do
        { //check binBuff until first char of first rule is found.
            currentChar = binBuff->sgetc();
            if( snortRules[i][0] == currentChar )//binBuff->sgetc() ) //compare short rule 1st char to curtent position
            { //match save offset and compare rest of rule
                offset = binBuff->pubseekoff(0,ios::cur); //set the offset to current postion
                bool checkNext = true; //bool to break loop when checking rules if not matching
                for(unsigned srIdx=0; srIdx < snortRules[i].size() && checkNext == true; ++srIdx)
                { //loop through current rule comparing characters
                    if(snortRules[i][srIdx] == currentChar)
                    { //match check if end of rule or advance character to compare to next in rule
                        if( srIdx == snortRules[i].size()-1)
                        { //match write the offset of fist character of rule and which was matched
                            std::cout<<offset<<" #"<<i+1<<endl; //write to console for debugging purposes will write to text file when working
                            ++i; //increment rule to next when exact match found
                        }
                        else
                        { //not at the end of the rule so continue to compare next characters
                            currentChar = binBuff->snextc(); //set currentChar to next char to be checked by for loop
                        }
                    }
                    else
                    { //no match break out and continue
                        checkNext == false; //set flag to break for loop because characters didnt match
                    }
                }
            }
            else
            { //no match check next character in binBuff
                //offset = binBuff->pubseekoff (0,binFS.cur, binFS.in); //set the offset to current postion
                currentChar = binBuff->snextc(); //get next char in binBuff
                //offset = binBuff->pubseekoff (0,binFS.cur, binFS.in); //set the offset to current postion
            }
        }while( currentChar != streambuf::traits_type::eof() ); //stop checking if end of file reached
    }
}while( binBuff->snextc() != streambuf::traits_type::eof() ); //stop checking if end of file reached

I have tried to find documentation and examples for pubseekoff on stackoverflow.com and cplusplus.com but what I can find is not making much sense to me and honestly I am not 100% sure it is my problem...
Any help or suggestions is greatly appreciated!

A: The entire problem was the line:
checkNext == false;

The "==" has no effect and cause the error because it needed to be:
checkNext = false;

So that it would assign the bool value and terminate loops at appropriate times.
I overlooked the warning issued by the compiler in Visual Studio and chased my tail for a couple of hours and now I feel like a fool.
So if you need an involved example of streambuf this may be helpful. And if you are having some random runtime error that is not making any sense, check for warnings.


text:
Q: JEditorPane doesn't want to show a button done in html (it shows in a browser) I created a buttton in html and linked it to another html file, when i open the file with the button in a browser (tried IE and FFox) the button shows and works properly, however when i   JEditorPane.setPage(the html file with the button) the only thing that shows is the name of the button with no actual clickable area or anything! Any ideas on how i can get the button to appear inside the pane?
Here's a pic of the button in the java frame(button is circled in red)
http://tinypic.com/r/fopswo/6
Here's a pic of the button in a browser(it's a button)
http://tinypic.com/r/2zjj71z/6
The code for the button
 Creating An Account

<button onclick="window.location.href ='file:///F:/java 12/Isp/help file try/doc 2/test.html'">Back</button>

Thanks in Advance

A: Swing's HTML support is patchy - I think you have fallen in one of its holes. More info here:
Which HTML tags are supported in Swing components?


text:
Q: How do GPUs handle random access? I read some tutorials on how to implement a raytracer in opengl 4.3 compute shaders, and it made me think about something that had been bugging me for a while. How exactly do GPUs handle the massive amount of random access reads necessary for implementing something like that? Does every stream processor get its own copy of the data? It seems that the system would become very congested with memory accesses, but that's just my own, probably incorrect intuition.

A: The Stream Multiprocessors (SM) have caches, but they are relatively small and won't help with truly random access.
Instead, GPUs are trying to mask the memory access latency: that is each SM is assigned more threads to execute than it has cores. On every free clock cycle it schedules some of the threads that aren't blocked on memory access. When the data needed for a thread isn't in the SM cache, the thread stalls until that data arrives, letting other threads to be executed instead.
Note that this masking only works if the amount of computation exceeds the time spent on waiting for the data (e.g. per-pixel lighting calculations).  If it's not the case (e.g. just summing lots of randomly scattered 32-bit floats), then you are likely to bottleneck at the memory bus bandwidth: most of the time your threads will be stalled waiting for their bits to arrive.
A related thing that can help with SM utilization is data-locality. When multiple threads access nearby memory locations then one cache-line fetch will bring the data needed by multiple threads. For example, when texturing a perspectively warped triangle, even though each fragment's texture coordinates can be arbitrary, nearby fragments are still likely to read nearby texels from the texture. Consequently there's a lot of common data shared between the threads, and one cache-line fetch would unblock multiple of them.
Ray-tracing, on the other hand, is horrible at data-locality. Secondary rays tend to diverge a lot, and hit different surfaces at practically random locations thru-out the entire scene. This makes it very hard to utilize the SM architecture for either ray-scene intersection or shading purposes.


text:
Q: Add Review option with Trunk based approach in GitLab Our project is decided to use trunk based strategy for our GIT repository management. Due to some reason we decided to deviate slightly from the trunk based way. Instead of using original 'master' branch we created another branch (say 'develop' branch) and consider it as trunk/master on which all developers commits on daily basis. Now I want to implement review facility for each commit being done by developer to our single branch(That is 'develop'), same as when we merge to master. Is there a way to achieve this ? Any idea will be highly appreciated. BTW we are using GitLab

A: Have you tried setting your trunk/master branch as a protected branch? https://docs.gitlab.com/ee/user/project/protected_branches.html#configuring-protected-branches


text:
Q: How to add WinForms TextBox Features (Numbers, Currencies, IPv4 & a Maximum Character Limiter) I need a better TextBox to suit my needs (several purposes).
For instance:

*

*Ability to filter characters as numbers;

*Ability to work with currencies (add decimals and currency designators);

*Ability to limit the number of characters allowed in the TextBox;

*Automatically add decimal places;

*More logical (missing) features useful for the Control.

I believe everyone (at some point) shares the same opinion:
WinForms TextBox features are somehow limited, specially when using a TextBox in order to work with Numbers, Currencies or IP Addresses (IPv4 in this Situation).
Thanks in advance.

A: Answering my own question while providing my humble code:
Info (Last Update: 2022.04.02)

About

*

*This is the Default TextBox with Extra Features.

Remarks

*

*I've been working on this control recently and I'm adding more features on the go. The control should be working fine, even though it may require some further development.

*I'll try to keep it updated as soon as possible until perfection is achieved.
See "Known Bugs" bellow.

Features:

*

*Filter / Format / Validate the Text Input (Text, Numeric, Currency or IP Address).

*Set Currency Designator Symbol.

*Set Currency Designator as a Symbol or Abbreviated Designator Name (i.e: EUR).

*Set the Currency Designator Symbol Location.
i.e:
Left: Before the Value.
Right: After the Value.

*Set Values as Decimal.

*Set Decimal Zeros Automatically when Entering a Whole Number.

*Limit Maximum Character Input

Bug Fixes

*

*Prevented Clipboard Data to be Set to the Control.

*Default TextBox Initial (Default) Value was Impossible to be Set (for Numeric and Currency Text Inputs).

*Character Limiter Function was Missing.

Known Bugs

*

*There is an issue with Text (number of chars) Limiter while using Decimals. TextBox Prevents user Text Input Proper Behaviour.

*Sometimes not Accepting Paste.
SHIFT + INSERT, on the other hand is allowed.

Code

using System;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace RG_Custom_Controls.Controls
{
    public class RGTextBoxI : TextBox
    {
        #region <Constructor>
        public RGTextBoxI()
        {
            // -> Set Default Configuration.
            ForeColor = Color.Gainsboro;
            BackColor = Color.FromArgb(255, 36, 36, 52);
            BorderStyle = BorderStyle.FixedSingle;
        }
        #endregion

        #region <Fields>
        private const int WM_PASTE = 0x0302;            // Used to Validate Clipboar Data.
        private string numbers = "0123456789.";
        private string allowedChars => numbers;
        private string decimalFormat = string.Empty;
        #endregion

        #region <Custom Properties> : (Char Limiter)
        private bool charsLimited = false;
        [Category("1. Custom Properties"), DisplayName("1. Chars Limited")]
        [Description("Toggle Character Input Limit.")]
        [Browsable(true)]
        public bool CharsLimited
        {
            get { return charsLimited; }
            set { charsLimited = value; }
        }

        private int maximumChars = 32;
        [Category("1. Custom Properties"), DisplayName("2. Maximum Chars")]
        [Description("Limit the Maximum Number of Chars Allowed.")]
        [Browsable(true)]
        public int MaximumChars
        {
            get { return maximumChars; }
            set { maximumChars = value; }
        }
        #endregion

        #region <Custom Properties> : (Input Mode)
        /// <summary> TextBox Text Iput Mode (Normal, Numeric, Currency). </summary>
        public enum TextBoxInputType { Default, Numeric, Currency, IPV4 }
        private TextBoxInputType inputType = TextBoxInputType.Default;
        [Category("1. Custom Properties"), DisplayName("1. Input Mode")]
        [Description("Select Control Mode (Normal, Numeric or Currency).")]
        [Bindable(true)] /* Required for Enum Types */
        [Browsable(true)]
        public TextBoxInputType TextBoxType
        {
            get { return inputType; }
            set
            {
                inputType = value;

                Text_SetDefaultValue();
                Text_Align();

                Invalidate();
            }
        }
        #endregion

        #region <Custom Properties> : (Decimals)
        private bool useDecimals;
        [Category("1. Custom Properties"), DisplayName("2. Use Decimals")]
        [Description("Select wether to use Whole Number or a Decimal Number.")]
        [Browsable(true)]
        public bool UseDecimals
        {
            get { return useDecimals; }
            set { useDecimals = value; }
        }

        private int decimalPlaces = 2;
        [Category("1. Custom Properties"), DisplayName("3. Decimal Places")]
        [Description("Select wether to use Whole Number or a Decimal Number.")]
        [Browsable(true)]
        public int DecimalPlaces
        {
            get { return decimalPlaces; }
            set
            {
                if (value > 0 & value < 3)
                {
                    decimalPlaces = value;

                    // Aet Decimal Format
                    switch (decimalPlaces)
                    {
                        case 1: decimalFormat = "0.0"; break;
                        case 2: decimalFormat = "0.00"; break;
                    }
                }
            }
        }
        #endregion

        #region <Custom Properties> : (Curency Designator)
        private string currencyDesignator = "€";
        [Category("1. Custom Properties"), DisplayName("4. Currency Designator")]
        [Description("Set Currency Symbol or Designator.\n\n i.e: €, Eur, Euros")]
        [Browsable(true)]
        public string CurrencyDesignator
        {
            get { return currencyDesignator; }
            set { currencyDesignator = value; }
        }

        public enum DesignatorAlignment { Left, Right }
        private DesignatorAlignment designatorAlignment = DesignatorAlignment.Right;
        [Category("1. Custom Properties"), DisplayName("5. Designator Location")]
        [Description("Select Currency Designator Location")]
        [Bindable(true)] /* Required for Enum Types */
        [Browsable(true)]
        public DesignatorAlignment DesignatorLocation
        {
            get { return designatorAlignment; }
            set { designatorAlignment = value; }
        }
        #endregion

        private bool IsLimitingChars(int textLength)
        {
            bool val = false;

            if (charsLimited)
            {
                switch (inputType)
                {
                    case TextBoxInputType.Default: val = Text.Length.Equals(maximumChars); break;
                    case TextBoxInputType.Numeric:
                    case TextBoxInputType.Currency:

                        if (useDecimals)
                        {
                            // Note: '+1' Refers the '.' that Separates the Decimals
                            val = Text.Length.Equals(maximumChars + decimalPlaces + 1);
                        }

                        else { val = Text.Length.Equals(maximumChars); }
                        break;
                }
                // case TextBoxInputType.IPV4: break;
            }

            return val;
        }

        private void SetDecimalValue()
        {
            Text_RemoveWhiteSpaces();
            Text_SetDecimalValue();
            Text_AddCurrencyDesignator();
        }

        #region <Overriden Events>
        /// <summary> Occurs Before the Control Stops Being the Active Control. </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnValidating(CancelEventArgs e)
        {
            base.OnValidating(e);

            switch (inputType)
            {
                // ...

                case TextBoxInputType.IPV4:
                    // Validate the IPv4 Address
                    if (!HasValidIPAddress(Text)) { Text_SetDefaultValue(); }
                    break;
            }
        }

        /// <summary> Occurs when a Keyboard Key is Pressed. </summary>
        /// <param name="e"></param>
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (!e.KeyChar.Equals((char)Keys.Back))
            {
                // Limit Number of Characters
                switch (inputType)
                {
                    // case TextBoxInputType.Default: e.Handled = IsLimitingChars(Text.Length); break;
                    case TextBoxInputType.Numeric:
                    case TextBoxInputType.Currency:
                        e.Handled = !HasValidNumericChar(e.KeyChar) ^ IsLimitingChars(Text.Length);
                        if (e.KeyChar.Equals('.') & NrCharOccurrences('.') >= 1) { e.Handled = true; }
                        break;
                        // ...
                }
            }
        }

        /// <summary> Occurs when the Control Becomes the Active Control. </summary>
        /// <param name="e"></param>
        protected override void OnEnter(EventArgs e)
        {
            base.OnEnter(e);

            switch (inputType)
            {
                // ...

                case TextBoxInputType.Currency:
                    Text_RemoveWhiteSpaces();
                    Text_RemoveCurrencyDesignator();
                    break;

                // ...
            }

            // Select the Text
            SelectAll();
        }

        /// <summary> Occurs when the Control Stops Being the Active Control. </summary>
        /// <param name="e"></param>
        protected override void OnLeave(EventArgs e)
        {
            base.OnLeave(e);

            switch (inputType)
            {
                // ...

                case TextBoxInputType.Currency:
                    SetDecimalValue();
                    break;

                // ...
            }
        }

        #endregion

        #region <Methods> : (Validate Clipboard Data : On Paste)
        protected override void WndProc(ref Message m)
        {
            /*
             * Remarks: Handling Clipboard Data (Validate Data on Paste).
             * Adapted Code from: 'Thorarin'.
             * Source: https://stackoverflow.com/questions/15987712/handle-a-paste-event-in-c-sharp
             */

            // 1. Handle All Other Messages Normally.
            if (m.Msg != WM_PASTE) { base.WndProc(ref m); }

            // 2. Handle Clipboard Data (On Paste).
            else
            {
                if (Clipboard.ContainsText())
                {
                    string val = Clipboard.GetText();

                    if (HasValidClipboardContent(val)) { Text = val; }

                    // Note(s):
                    // Text Validation for Each Input Type, Occurs under Control Leave Event.

                    // Clipboard.Clear(); --> You can use this if you Wish to Clear the Clipboard after Pasting the Value
                }
            }
        }
        #endregion
        // 65666
        #region <Methods>
        /// <summary> Determines if the Clipboard Content Value is Valid. </summary>
        /// <param name="val"></param>
        /// <returns> True if Clipboard Content Matches the TextBox Input Requirements. </returns>
        private bool HasValidClipboardContent(string val)
        {
            bool isValid = false;

            switch (inputType)
            {
                case TextBoxInputType.Default: isValid = !IsLimitingChars(val.Length); break;
                case TextBoxInputType.Numeric:
                case TextBoxInputType.Currency:

                    isValid = !IsLimitingChars(val.Length) && IsNumericString(val);
                    break;

                case TextBoxInputType.IPV4:
                    isValid = HasValidIPAddress(val);
                    break;
            }

            return isValid;
        }

        /// <summary> Determines if Specified Char Paramter is a Valid Numeric Character. </summary>
        /// <param name="char"></param>
        /// <returns> true if Received Char is a Number. </returns>
        private bool HasValidNumericChar(char @char)
        {
            return allowedChars.Contains(@char) | @char.Equals((char)Keys.Back);
        }

        /// <summary> Determines if Received String Parameter is a Number. </summary>
        /// <param name="value"></param>
        /// <returns> True if Received String Parameter is a Number. </returns>
        private bool IsNumericString(string value)
        {
            bool isNumeric = true;

            for (int i = 0; i < value.Length; i++)
            {
                char c = value[i];

                if (!HasValidNumericChar(c))
                {
                    isNumeric = false;
                    break;
                }
            }

            return isNumeric;
        }

        /// <summary> Determines if Specified Parameter String Contains a Valid IPv4 Address. </summary>
        /// <returns> True if the IPv4 Address is Valid. </returns>
        private bool HasValidIPAddress(string value)
        {
            // Remarks:
            // Code based on Yiannis Leoussis Approach.
            // Using a 'for' Loop instead of 'foreach'.
            // Link: https://stackoverflow.com/questions/11412956/what-is-the-best-way-of-validating-an-ip-address

            bool isValid = true;

            if (string.IsNullOrWhiteSpace(Text)) { isValid = false; }

            //  Split string by ".", check that array length is 4
            string[] arrOctets = Text.Split('.');

            if (arrOctets.Length != 4) { isValid = false; }

            // Check Each Sub-String (Ensure that it Parses to byte)
            byte obyte = 0;

            for (int i = 0; i < arrOctets.Length; i++)
            {
                string strOctet = arrOctets[i];

                if (!byte.TryParse(strOctet, out obyte)) { isValid = false; }
            }

            // Set Default TextBox Text if IP is Invalid:
            if (!isValid) { Text_SetDefaultValue(); }

            return isValid;
        }

        /// <summary> Calculates the Nr. of Occurrences for the Specified Char Parameter. </summary>
        /// <param name="char"></param>
        /// <returns> The Number of the Received Char Parameter Occurrences Found in the TextBox Text. </returns>
        private int NrCharOccurrences(char @char)
        {
            return Text.Split(@char).Length - 1;
        }

        /// <summary> Adds the Currency Symbol to the End of the TextBox Text. </summary>
        private void Text_AddCurrencyDesignator()
        {
            // Add this to Control Event: Control_Leave

            if (inputType.Equals(TextBoxInputType.Currency))
            {
                if (!string.IsNullOrEmpty(Text) & !string.IsNullOrWhiteSpace(Text))
                {
                    TextAlign = HorizontalAlignment.Right;

                    switch (designatorAlignment)
                    {
                        case DesignatorAlignment.Left:
                            if (!Text.StartsWith(currencyDesignator))
                            {
                                Text = $"{currencyDesignator} {Text}";
                            }
                            break;

                        case DesignatorAlignment.Right:
                            if (!Text.EndsWith(currencyDesignator))
                            {
                                Text = $"{Text} {currencyDesignator}";
                            }
                            break;
                    }
                }
            }

            Text_Align();
        }

        /// <summary> Remove the Currency Symbol to the End of the TextBox Text. </summary>
        private void Text_RemoveCurrencyDesignator()
        {
            if (inputType.Equals(TextBoxInputType.Currency))
            {
                Text = Text.Replace(currencyDesignator, string.Empty);
            }
        }

        /// <summary> Remove White Spaces from TextBox Text. </summary>
        private void Text_RemoveWhiteSpaces()
        {
            if (inputType.Equals(TextBoxInputType.Currency) ^ inputType.Equals(TextBoxInputType.Numeric))
            {
                Text = Text.Replace(" ", string.Empty);
            }
        }

        /// <summary> Align TextBox Text. </summary>
        private void Text_Align()
        {
            switch (inputType)
            {
                case TextBoxInputType.Default: TextAlign = HorizontalAlignment.Left; break;
                case TextBoxInputType.Numeric:
                case TextBoxInputType.Currency: TextAlign = HorizontalAlignment.Right; break;
                case TextBoxInputType.IPV4: TextAlign = HorizontalAlignment.Center; break;
            }
        }

        /// <summary> Sets the Text Value as a Decimal Value by Inserting Missing Zeros. </summary>
        private void Text_SetDecimalValue()
        {
            if (useDecimals)
            {
                decimal decVal = -1;
                string val = string.Empty;

                // Success:
                // [Reference]: if (decimal.TryParse(Text, out decVal)) { val = decVal.ToString("0.00"); }
                if (decimal.TryParse(Text, out decVal)) { val = decVal.ToString(decimalFormat); }

                // else { /* FAIL */ }

                // Set the Decimal Value as Text
                Text = val;
            }
        }

        /// <summary> Sets the Default Text Value to Each Input Type. </summary>
        private void Text_SetDefaultValue()
        {
            switch (inputType)
            {
                case TextBoxInputType.Default: Text = string.Empty; break;
                case TextBoxInputType.Numeric:
                    if (string.IsNullOrEmpty(Text)) { Text = "0"; }
                    else
                    {
                        if (IsNumericString(Text)) { Text = Text; }
                    }
                    break;

                case TextBoxInputType.Currency:
                    if (string.IsNullOrEmpty(Text)) { Text = "0"; }
                    else
                    {
                        if (IsNumericString(Text))
                        {
                            Text_SetDecimalValue();
                            Text_AddCurrencyDesignator();
                            Text = Text;
                        }
                    }

                    break;
                case TextBoxInputType.IPV4: Text = "0.0.0.0"; break;
            }
        }
        #endregion
    }
}

Further References:

*

*Three dots in Textbox

*What is the best way of validating an IP Address?

*Handle a paste event in C#


text:
Q: Am I using "back up" and "back over" correctly? Can I use "back up" and "back over" in those ways?

*

*Does get "back over the line" mean "get back in line"?

*Could "back over here" mean "come over here"?

*Can "backup" mean "standup"?

Suppose a person just sat down in a classroom. When a Teacher tells the student "Get back up" it means "Stand back up", true? Or maybe they use up only when you are not done standing?
I saw a person in a movie one time saying:

I bring backups in case we need any.
  or
  I'll put some backups in case you need them.

Is backup used in that sentence the same way you say "backup your files" or is it informal?
Can I say: I'm always running out of water when I travel, get a backup bottle so we don't run out.
Are the sentences above, correct?

A: Get back over the line! means that  you should step across the line to the other side.  The line marks a boundary of some kind. The speaker is telling you that you are on the wrong side of the boundary.
Get back over here! is said when the speaker wants you to return to where the speaker is. You have gone to another location and the speaker is telling you to return.
You can use those phrases in the declarative voice too:

I am going to get back over the line.
I am going to get back over there.

Notice that you would say there when someone has said "Get back over here!"

I want you to get back over here!
  --OK, I will be there in a moment.

The words here and there are deictic, expressing a particular point-of-view.


text:
Q: Installing hebrew (culmus) on Mac using TexLive I am trying to follow the instructions below in order to install hebrew to work with Latex on a mac (Lion) running TexLive. The script seems to be outdated in so many ways... Could someone help me to get the font installation process right?
Thank you in advance
#!/bin/bash

mkdir tmp_latex_install
cd tmp_latex_install
# download culmus (fonts) and ivritex (latex support)
wget http://switch.dl.sourceforge.net/sourceforge/culmus/culmus-0.100-iso8859-8.tar.gz
wget http://heanet.dl.sourceforge.net/sourceforge/ivritex/culmus-latex-0.6.tar.gz

# unzip
tar zxvf culmus-0.100-iso8859-8.tar.gz
tar zxvf culmus-latex-0.6.tar.gz

# install culmus fonts
mv ISO-8859-8 ~/Library/culmus-fonts/
#xset +fp $HOME/Library/culmus-fonts
#xset fp rehash

# install ivritex
#mkdir -p $HOME/Library/texmf/
cd culmus-latex-0.6
#make TEXMFDIR=$HOME/Library/texmf/ CULMUSDIR=$HOME/Library/culmus-fonts
#sudo make TEXMFDIR=$HOME/Library/texmf/ CULMUSDIR=$HOME/Library/culmus-fonts install

cd ../..
rm -rf tmp_latex_install

A: First, you might get around this whole issue by using xelatex, which supports system-wide fonts. If you use babel with Hebrew you're probably out of luck, though - you will have to install the Hebrew fonts, including jerus10, deads10, etc.
The ivritex project is dead, and the files from SourceForge do not contain the fonts (or at least, not a readily-used version of them). So let's get them from Debian.
A quick search found the ivritex Debian package. At the bottom, you can download the .deb file, and see the list of files included in the package.
TL;DR
EDIT: The instructions are mostly for most Unix-like systems. But, the cp -r texmf ~/Library/ command is for OS X.
Fire up a terminal and hit
mkdir hebrew-fonts
cd hebrew-fonts
wget http://ftp.us.debian.org/debian/pool/main/i/ivritex/ivritex_1.1.1-6_all.deb
ar -x ivritex_1.1.1-6_all.deb data.tar.gz
tar xfz data.tar.gz
cd usr/share
cp -r texmf ~/Library/
cd ../../..
rm -rf hebrew-fonts

Look at LaTeX, now look back at me. You now can compile Hebrew LaTeX.

A: You should follow the instructions in: http://www.guyrutenberg.com/culmus-latex/
(I'm the author of culmus-latex)

A: Based on previous answers (I don't claim this information is totally right, only it is right enough to get you started):
preparation:complete this tut to always shoe Library on your home folder from the  OS finder application.
There are two local directories for mac-OS fonts:

*

*~/Library/texmf/ - this is the same as the last one only for extensions which are meant to be user based

*/usr/share/texmf/ - ...
seems to be deprecated (in other words it didn't work)

So you should stick to the first option.
Open Terminal application Download and extract the file like described (you might have to install wget I recommend you to use home-brew so you won't have to compile it):
mkdir hebrew-fonts
cd hebrew-fonts
wget http://ftp.us.debian.org/debian/pool/main/i/ivritex/ivritex_1.1.1-6_all.deb
ar -x ivritex_1.1.1-6_all.deb data.tar.gz
tar xfz data.tar.gz

This version is important, as other files don't include jerusalem font which is the the default for the basic hebrew latex implementation.
So just manually open the hebrew-fonts folder you have just downloaded. open it sub folders usr and share click on texmf and press edit -> copy.
After that go to the home icon select it and look for library. Select the Library which you should see after completing the preparation phase.
Now paste the texmf in the user's library folder edit -> paste
That's it!! you should have a basic hebrew LATEX functioning on your local OS X machine.
====== notes ===============

*

*You can add more fonts to the same directory.

*To check you have the fonts and also another option that makes the
local arrangement unnecessary:
https://www.overleaf.com/latex/examples/hebrew-document-in-overleaf-writelatex-msmk-bbryt/vpfygfqnfjxs#.VizYbdYrelJ

*I hope this answer is
clear enough. Personally I do not understand why the Latex don't have
hebrew support out of the box but that's another issue. Especially because this is a general purpose software and not only for computer science I can imagine that the CS dept in Israel can invest a little more effort in integration of LaTex.

A: Adding my process. I'll start by saying that I'm already using XeLaTeX, so the following example displays Hebrew text characters:
\documentclass[]{article}

\usepackage{polyglossia} % the multilingual support package
\newfontfamily\hadasim{Hadasim CLM Regular}
\DeclareTextFontCommand{\texthebrew}{\hadasim}

\begin{document}

\texthebrew{תירבעב םיטפשמ המכ םע}

\end{document}

As long as the font specified in the \newfontfamily line is installed on the system you're running XeLaTex on. In this case it's Hadasim CLM Regular, which is available from the Open Siddur Project, among other places.
You click on the font file and open it in FontBook to install in native OSX system.
I was also able to display Hebrew with the following example, using beamer and bidi, neight of which I know anything about, as from having read that at least one of them conflicts with the polyglasia package.
\documentclass[xetex]{beamer}

\usepackage{fontspec,bidi}
\setmainfont{Times New Roman}
\setsansfont{Times New Roman}

\useoutertheme[right]{}

\newenvironment{hframe}[0]{\begin{frame}\setRL}{\end{frame}}
\newcommand{\hframetitle}[1]{\frametitle{\hfill\RL{#1}}}
\newcommand{\hframesubtitle}[1]{\framesubtitle{\hfill\RL{#1}}}
\newcommand{\hsection}[1]{\section{\RL{#1}}}
\newcommand{\hsubsection}[1]{\subsection{\RL{#1}}}
\newcommand{\hsubsubsection}[1]{\subsubsection{\RL{#1}}}
\newtheorem{hclaim}[theorem]{\RL{טענה}}

\title{\RL{מצגת דוגמא בעברית שנוצרה באמצעות beamer}}
\author{\RL{רונן אברבנאל}}
\date{\today}

\begin{document}
I can write english here.
\begin{frame}
        \titlepage
\end{frame}

\hsection{הקדמה}
\hsubsection{מבט על beamer}

\begin{hframe}
    \hframetitle{תכונות של המחלקה בימר}
    \begin{itemize}
    \item<1->  מחלקת LaTeX רגילה.
    \item<2-> מעברים קצת בעייתיים.
    \item<3-> לא דרושה תוכנה חיצונית.
    \end{itemize}
\end{hframe}

\begin{hframe}
\begin{hclaim}[עברית ב-Beamer]
העברית ב-\LaTeX-Beamer סבירה למדי.
\end{hclaim}
ואפשר גם לכתוב טקסט מחוץ לבלוק.
\end{hframe}

\end{document}

Finally I was able to install Culmus-LaTeX by Guy Rutenburg on the Mac.
You can download it from SourceForge. I chose the "latest version" (culmus-latex-0.7-r1.tar.gz (2.1 MB)).
Then made an empty directory to work in and entered it:
mkdir hebrew-fonts
cd hebrew-fonts

Put the new downloaded file into it:
mv ~/Downloads/culmus-latex-0.7-r1/ . # the dot means "put it right here, yo"

Then you need the actual fonts (one of which ends up being the Hadisim CLM referenced above) which you can download from SourceForge as well.
I put them in a subdirectory of my Fonts folder because there's a bnch of stuff in there, including documents, postscript fonts and the ttf files I'm more used to).
mv ~/Downloads/culmus-0.130 ~/Library/Fonts/hebrew

The next parts in the Culmus docs confounded me a bit for sure:

The second command must be done as root. The installation process
  assumes that the texmf dir resides in /usr/share/texmf and that the
  culmus fonts reside in /usr/share/fonts/hebrew . To override this
  settings append to the above command "CULMUSDIR=/path/to/culmus/"
  and/or  "TEXMFDIR=/path/to/texmf" (both without the quotes).
sudo apt-get install texlive-font-utils

The last line first: apt-get is a package manager for Linux. Mac has MacPorts, Fink and the ubiquitious Homebrew, which is what I use. MacPorts has a package for texlive-font-utils, but I didn't want to install a whole new package manager just for this. I'm literally adding a handful of Hebrew characters to a document at this point.
Searched my system for texlive-font-utils. The Tex interface I'm using is the TexShop GUI for OSX. I say I'm using it, but actually it's just the means by which I installed Tex. In actuality I'm doing everything via the command line and TextWrangler text editor.
In my travels I somehow came across http://tug.org/texlive/ and an installer for the basic GUI-less TexLive package: http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz. When you download and run that package by double-clicking the install-tl package, first you may get a Warning from Apple and need to go to your System Preferences > Security to "Allow installation of packages from non-Apple or Apple certified developers", then it runs a combination of Perl and Python scripts to download the 2Gigs of content that make-up TexLive. I went to bed during this process.
At the end of the process you'll see some output in the terminal:

See    /usr/local/texlive/2016/index.html  for links to documentation.
  The TeX Live web site  contains updates and corrections:
  http://tug.org/texlive.
TeX Live is a joint project of the TeX user groups around the world;
  please consider supporting it by joining the group best for you. The
  list of user groups is on the web at http://tug.org/usergroups.html.
Add /usr/local/texlive/2016/texmf-dist/doc/info to INFOPATH.  Add
  /usr/local/texlive/2016/texmf-dist/doc/man to MANPATH    (if not
  dynamically found).
Most importantly, add /usr/local/texlive/2016/bin/x86_64-darwin  to
  your PATH for current and future sessions.
Welcome to TeX Live! Logfile: /usr/local/texlive/2016/install-tl.log

So right now there are two version of TeX installed on the machine. The one referenced in the log above, located at /usr/local/texlive/2016/bin/x86_64-darwin, and the one from the GUI I had downloaded. Since I haven't added the new one to my PATH yet, I can find out the location of the binary for the GUI:
which tex
/Library/TeX/texbin/tex

As referenced above, the texmf file for that is located at ~/Library/texmf/. But I still don't know what texmf is.
I looked at my PATH:
echo $PATH
# a long string of directory paths one of which is /Library/TeX/texbin/tex

So if I precede that TeX on my PATH with /usr/local/texlive/2016/bin/x86_64-darwin, the system will find the new one first.
Backing up to the output of the new TexLive install script:
Towards the top of the output was this:

directories:
  TEXDIR (the main TeX directory):  /usr/local/texlive/2016
TEXMFLOCAL (directory for site-wide local files):
  /usr/local/texlive/texmf-local
TEXMFSYSVAR (directory for variable and automatically generated data):
   /usr/local/texlive/2016/texmf-var
TEXMFSYSCONFIG (directory for local config):
  /usr/local/texlive/2016/texmf-config
TEXMFVAR (personal directory for variable and automatically generated data):
   ~/.texlive2016/texmf-var
TEXMFCONFIG (personal directory for local config):
  ~/.texlive2016/texmf-config
TEXMFHOME (directory for user-specific files):
    ~/texmf

Hey! That's what texmf is: directory for user-specific files.
So going back to the Culmus-Latex docs, the installation configurations would either be:
make CULMUSDIR=~/Library/Fonts/hebrew/ TEXMFDIR=~/texmf
sudo make install CULMUSDIR=~/Library/Fonts/hebrew/ TEXMFDIR=~/texmf

For the new installation or for the GUI version:
make CULMUSDIR=~/Library/Fonts/hebrew/ TEXMFDIR=~/Library/texmf
sudo make install CULMUSDIR=~/Library/Fonts/hebrew/ TEXMFDIR=~/Library/texmf

Now on the following tex file I can produce a PDF with Hebrew:
pdflatex test-hebrew.tex

\documentclass{article}
\usepackage{culmus}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[english,hebrew]{babel}
\begin{document}
שלום \L{World}!
\end{document}


text:
Q: View: Display all folder having at least one child which property has selected value I have folders, each folder have children (document sets, but that doesn't really matter).
How, if possible, can I create a new view that will list all the folders for which at least one child has the property PROP_A having the value ABC?

A: OOTB you can create a custom view. Set the filter to look against if its content type column is a folder or Prop_A = ABC. this will filter the underlying item but will show all folders.
unfortunately to get the folders only showing that actually contain any items within them would require a coded method.