How to get the direct link from url that have a session ID by vbscript?

Question: I'm trying to get the direct link from url, so i use this function to provide me the header location and for this example it works fine :
Option Explicit
Const Title = "Get Header Location"
Const WHR_EnableRedirects = 6
Dim URL,Result
URL = "https://downloads.malwarebytes.com/file/mb3/"
Result = InputBox("Copy and Paste your link here to get the response header",Title,URL)
MsgBox GetHeaderLocation(Result),vbInformation,Title
'-------------------------------------------------------------------------------------
Function GetHeaderLocation(URL)
On Error Resume Next
Dim h,GetLocation
Set h = CreateObject("WinHttp.WinHttpRequest.5.1")
    h.Option(WHR_EnableRedirects) = False 'disable redirects
    h.Open "HEAD", URL , False
    h.Send()
GetLocation = h.GetResponseHeader("Location") 'an error occurs if not exist
If Err = 0 Then
    GetHeaderLocation = GetLocation
Else
    GetHeaderLocation = Err.Description
End If
End Function
'-------------------------------------------------------------------------------------

but when i try with this url
https://download.toolslib.net/download/file/1/1388?s=EeATC00Djuzo7gfQUxBBdtqcm3VUFamy
it give me this message :

The requested header was not found

So my question is How to get the direct link from this url ?
What i mean by direct url is how to get with .exe in the end.
I know if i paste into browser it works and let me download as adwcleaner_22.214.171.124.exe but how can manage that with vbscript if i want to download it by the script itself.
So i need a direct link !
For example in my first URL = "https://downloads.malwarebytes.com/file/mb3/"
I got as header location like that in direct link : DirectLink = https://data-cdn.mbamupdates.com/web/mb3-setup-consumer/mb3-setup-consumer-184.108.40.2068-1.0.322-1.0.4420.exe
Answer: I got an answer here thanks to the member Jay that put me in the right direction !
Download_File_From_Dynamic_Link.vbs
Option Explicit
Dim Title,Base_Link,Dynamic_Link,Save2File
Title = "Download a file with a dynamic link by Hackoo 2018"
Base_Link = "https://download.toolslib.net/download/file/1/1388"
Dynamic_Link = Extract_Dynamic_Link(GetDataFromURL(base_link,"Get", ""))

MsgBox "The Dynamic Link is = "& Dynamic_Link & vbcrlf & vbcrlf &_
"Response of The Dynamic Link is : "& vbcrlf & GetHeaderLocation(Dynamic_Link) & vbCrlf & vbCrlf &_
"Extracted FileName is = " & GetFileName(GetHeaderLocation(Dynamic_Link)),vbInformation,Title

Save2File = GetFileName(GetHeaderLocation(Dynamic_Link))
Call Download(Dynamic_Link,Save2File)

MsgBox "The download of the file : "& Save2File & vbCrlf &_
"is Completed !",vbInformation,Title
'***********************************************************************************************
Function GetHeaderLocation(URL)
Const WHR_EnableRedirects = 6
Dim h,GetLocation
On Error Resume Next
Set h = CreateObject("WinHttp.WinHttpRequest.5.1")
    h.Option(WHR_EnableRedirects) = False 'disable redirects
    h.Open "HEAD", URL , False
    h.Send()
GetLocation = h.GetResponseHeader("Content-Disposition") 'an error occurs if not exist
If Err = 0 Then
    GetHeaderLocation = GetLocation
Else
    GetHeaderLocation = Err.Description
End If
End Function
'***********************************************************************************************
Function Extract_Dynamic_Link(Data)
    Dim regEx, Match, Matches,Dynamic_Link
    Set regEx = New RegExp
    regEx.Pattern = Base_Link & "\?s=[^""]*"
    regEx.IgnoreCase = True
    regEx.Global = True
    Set Matches = regEx.Execute(Data)
    For Each Match in Matches
        Dynamic_Link = Match.Value
    Next
    Extract_Dynamic_Link = Dynamic_Link
End Function
'***********************************************************************************************
Function GetDataFromURL(strURL, strMethod, strPostData)
  Dim lngTimeout
  Dim strUserAgentString
  Dim intSslErrorIgnoreFlags
  Dim blnEnableRedirects
  Dim blnEnableHttpsToHttpRedirects
  Dim strHostOverride
  Dim strLogin
  Dim strPassword
  Dim strResponseText
  Dim objWinHttp
  lngTimeout = 59000
  strUserAgentString = "http_requester/0.1"
  intSslErrorIgnoreFlags = 13056 ' 13056: ignore all err, 0: accept no err
  blnEnableRedirects = True
  blnEnableHttpsToHttpRedirects = True
  strHostOverride = ""
  strLogin = ""
  strPassword = ""
  Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
  objWinHttp.SetTimeouts lngTimeout, lngTimeout, lngTimeout, lngTimeout
  objWinHttp.Open strMethod, strURL
  If strMethod = "POST" Then
    objWinHttp.setRequestHeader "Content-type", _
      "application/x-www-form-urlencoded"
  End If
  If strHostOverride <> "" Then
    objWinHttp.SetRequestHeader "Host", strHostOverride
  End If
  objWinHttp.Option(0) = strUserAgentString
  objWinHttp.Option(4) = intSslErrorIgnoreFlags
  objWinHttp.Option(6) = blnEnableRedirects
  objWinHttp.Option(12) = blnEnableHttpsToHttpRedirects
  If (strLogin <> "") And (strPassword <> "") Then
    objWinHttp.SetCredentials strLogin, strPassword, 0
  End If
  On Error Resume Next
  objWinHttp.Send(strPostData)
  If Err.Number = 0 Then
    If objWinHttp.Status = "200" Then
      GetDataFromURL = objWinHttp.ResponseText
    Else
      GetDataFromURL = "HTTP " & objWinHttp.Status & " " & _
        objWinHttp.StatusText
    End If
  Else
    GetDataFromURL = "Error " & Err.Number & " " & Err.Source & " " & _
      Err.Description
  End If
  On Error GoTo 0
  Set objWinHttp = Nothing
End Function
'***********************************************************************************************
Sub Download(URL,Save2File)
    Dim File,Line,BS,ws
    On Error Resume Next
    Set File = CreateObject("WinHttp.WinHttpRequest.5.1")
    File.Open "GET",URL, False
    File.Send()
    If err.number <> 0 then
        Line  = Line &  vbcrlf & "Error Getting File"
        Line  = Line &  vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " &  vbcrlf &_
        err.description
        Line  = Line &  vbcrlf & "Source " & err.source
        MsgBox Line,vbCritical,"Error getting file"
        Err.clear
        wscript.quit
    End If
    If File.Status = 200 Then ' File exists and it is ready to be downloaded
        Set BS = CreateObject("ADODB.Stream")
        Set ws = CreateObject("wscript.Shell")
        BS.type = 1
        BS.open
        BS.Write File.ResponseBody
        BS.SaveToFile Save2File, 2
    ElseIf File.Status = 404 Then
        MsgBox "File Not found : " & File.Status,vbCritical,"Error File Not Found"
    Else
        MsgBox "Unknown Error : " & File.Status,vbCritical,"Error getting file"
    End If
End Sub
'***********************************************************************************************
Function GetFileName(Data)
Dim regEx, Match, Matches,FileName
    Set regEx = New RegExp
    regEx.Pattern = "\x22(\w.*)\x22"
    regEx.IgnoreCase = True
    regEx.Global = True
    Set Matches = regEx.Execute(Data)
    For Each Match in Matches
        FileName = Match.subMatches(0)
    Next
    GetFileName = FileName
End Function
'***********************************************************************************************

New Version : Multi-Downloader.vbs to download from a direct or dynamic link with a progress bar in HTA.

Option Explicit
If AppPrevInstance() Then
    MsgBox "The script is already launching" & vbCrlf &_
    CommandLineLike(WScript.ScriptName),VbExclamation,"The script is already launching"
    WScript.Quit
Else
    Const Copyright = " by Hackoo 2018"
    Dim Title : Title = "Get Header Location and download file" & Copyright
    Const WHR_EnableRedirects = 6
    Dim Default_Link,Base_Link,Dynamic_Link,Flag,Question,DirectLink,Save2File
    Dim fso,ws,Temp,WaitingMsg,oExec
    Default_Link = "https://download.toolslib.net/download/file/1/1388"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ws = CreateObject("WScript.Shell")
    Temp = ws.ExpandEnvironmentStrings("%Temp%")
' "https://downloads.malwarebytes.com/file/mb3/" 'Tested OK ==> Malwarebytes v3.4.4
' "https://download.toolslib.net/download/file/1/1388" 'Tested OK ==> Adwcleaner v188.8.131.52
' "https://www.google.tn/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" Tested OK ==> a direct link example
    Base_Link = InputBox("Copy and paste your link here to get the response header",Title,Default_Link)
    If CheckDirectLink(Base_Link) = True And Instr(Base_Link,"php") = 0 Then 'Check if it is a direct link
        Save2File = GetFileNamefromDirectLink(Base_Link)
        If Save2File = "" Then
            MsgBox "An unknown error has occurred ! Quitting the script !",vbCritical,Title
            Wscript.Quit()
        End If
        WaitingMsg = "Please wait ... The download of : "& DblQuote(Save2File) & " is in progress ..."
        Call CreateProgressBar(Title,WaitingMsg)'Creation of Waiting Bar
        Call LaunchProgressBar() 'Launch of the Waiting Bar
        Call Download(Base_Link,Save2File)
        pause(3)
        Call CloseProgressBar()
        MsgBox "The download of the file : "& Save2File & vbCrlf &_
        "is Completed !",vbInformation,Title
        wscript.Quit()
    End If
    Call GetHeaderLocation(Base_Link)
    If Flag = True And CheckDirectLink(GetHeaderLocation(Base_Link)) = True Then 'Checking for a direct link of Malwarebytes
        Save2File = GetFileNamefromDirectLink(GetHeaderLocation(Base_Link))
        If Save2File = "" Then
            MsgBox "An unknown error has occurred ! Quitting the script !",vbCritical,Title
            Wscript.Quit()
        End If
        DirectLink = GetHeaderLocation(Base_Link)
'wscript.echo DirectLink & vbCrlf & Save2File
        Question = MsgBox("Did you want to download this file ?" & vbCrlf &_
        Save2File,vbQuestion+vbYesNo,Title)
        If Question = vbYes Then
            If Save2File <> "" Then
                WaitingMsg = "Please wait ... The download of : "& DblQuote(Save2File) & " is in progress ..."
                Call CreateProgressBar(Title,WaitingMsg)'Creation of Waiting Bar
                Call LaunchProgressBar() 'Launch of the Waiting Bar
                Call Download(DirectLink,Save2File)
                Call CloseProgressBar()
                MsgBox "The download of the file : "& Save2File & vbCrlf &_
                "is Completed !",vbInformation,Title
                Wscript.Quit()
            End If
        End If
    ElseIf Instr(Base_Link,"toolslib") <> 0 And Flag = True Then 'for Adwcleaner
        Dynamic_Link = Extract_Dynamic_Link(GetDataFromURL(Base_Link,"Get", ""))
        Save2File = GetFileName(GetHeaderLocation(Dynamic_Link))
        If Save2File = "" Then
            MsgBox "An unknown error has occurred ! Quitting the script !",vbCritical,Title
            Wscript.Quit()
        End If
        Question = MsgBox("The Dynamic Link is = "& Dynamic_Link & vbcrlf & vbcrlf &_
        "Response of The Dynamic Link is : "& vbcrlf & GetHeaderLocation(Dynamic_Link) & vbCrlf & vbCrlf &_
        "Extracted FileName is = " & Save2File,vbYesNo+vbQuestion,Title)
        If Question = vbYes Then
            WaitingMsg = "Please wait ... The download of : "& DblQuote(Save2File) & " is in progress ..."
            Call CreateProgressBar(Title,WaitingMsg)'Creation of Waiting Bar
            Call LaunchProgressBar() 'Launch of the Waiting Bar
            Call Download(Dynamic_Link,Save2File)
            Call CloseProgressBar()
            MsgBox "The download of the file : "& Save2File & vbCrlf &_
            "is Completed !",vbInformation,Title
        Else
            Wscript.Quit()
        End If
    ElseIf Instr(Base_Link,"php") > 0 And Flag = False Then
        Save2File = GetFileName(GetHeaderLocation(Base_Link)) ' for site of autoitscript.fr
        If Save2File = "" Then
            MsgBox "An unknown error has occurred ! Quitting the script !",vbCritical,Title
            Wscript.Quit()
        End If
        Question = MsgBox("Did you want to download this file ?" & vbCrlf &_
        Save2File,vbQuestion+vbYesNo,Title)
        If Question = vbYes Then
            WaitingMsg = "Please wait ... The download of : "& DblQuote(Save2File) & " is in progress ..."
            Call CreateProgressBar(Title,WaitingMsg)'Creation of Waiting Bar
            Call LaunchProgressBar() 'Launch of the Waiting Bar
            Call Download(Base_Link,Save2File)
            pause(3)
            Call CloseProgressBar()
            MsgBox "The download of the file : "& Save2File & vbCrlf &_
            "is Completed !",vbInformation,Title
        Else
            Wscript.Quit()
        End If
    End If
End If
'------------------------------------------------
Function GetHeaderLocation(URL)
    On Error Resume Next
    Dim h,GetLocation
    Set h = CreateObject("WinHttp.WinHttpRequest.5.1")
    h.Option(WHR_EnableRedirects) = False
    h.Open "HEAD", URL , False
    h.Send()
    GetLocation = h.GetResponseHeader("Location")
    If Err = 0 Then
        Flag = True
        GetHeaderLocation = GetLocation
    Else
        Flag = False
        GetHeaderLocation = h.GetResponseHeader("Content-Disposition")
    End If
End Function
'---------------------------------------------
Function GetFileName(Data)
    Dim regEx, Match, Matches,FileName
    Set regEx = New RegExp
    regEx.Pattern = "\x27{2}(\w.*)"
    regEx.IgnoreCase = True
    regEx.Global = True
    If regEx.Test(Data) Then
        Set Matches = regEx.Execute(Data)
        For Each Match in Matches
            FileName = Match.subMatches(0)
        Next
    Else
        Set regEx = New RegExp
        regEx.Pattern = "\x22(\w.*)\x22"
        regEx.IgnoreCase = True
        regEx.Global = True
        Set Matches = regEx.Execute(Data)
        For Each Match in Matches
            FileName = Match.subMatches(0)
        Next
    End If
    GetFileName = FileName
End Function
'---------------------------------------------
Function Extract_Dynamic_Link(Data)
    Dim regEx, Match, Matches,Dynamic_Link
    Set regEx = New RegExp
    regEx.Pattern = Base_Link & "\?s=[^""]*"
    regEx.IgnoreCase = True
    regEx.Global = True
    Set Matches = regEx.Execute(Data)
    For Each Match in Matches
        Dynamic_Link = Match.Value
    Next
    Extract_Dynamic_Link = Dynamic_Link
End Function
'------------------------------------------------
Function GetDataFromURL(strURL, strMethod, strPostData)
    Dim lngTimeout
    Dim strUserAgentString
    Dim intSslErrorIgnoreFlags
    Dim blnEnableRedirects
    Dim blnEnableHttpsToHttpRedirects
    Dim strHostOverride
    Dim strLogin
    Dim strPassword
    Dim strResponseText
    Dim objWinHttp
    lngTimeout = 59000
    strUserAgentString = "http_requester/0.1"
    intSslErrorIgnoreFlags = 13056 ' 13056: ignore all err, 0: accept no err
    blnEnableRedirects = True
    blnEnableHttpsToHttpRedirects = True
    strHostOverride = ""
    strLogin = ""
    strPassword = ""
    Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    objWinHttp.SetTimeouts lngTimeout, lngTimeout, lngTimeout, lngTimeout
    objWinHttp.Open strMethod, strURL
    If strMethod = "POST" Then
        objWinHttp.setRequestHeader "Content-type", _
        "application/x-www-form-urlencoded"
    End If
    If strHostOverride <> "" Then
        objWinHttp.SetRequestHeader "Host", strHostOverride
    End If
    objWinHttp.Option(0) = strUserAgentString
    objWinHttp.Option(4) = intSslErrorIgnoreFlags
    objWinHttp.Option(6) = blnEnableRedirects
    objWinHttp.Option(12) = blnEnableHttpsToHttpRedirects
    If (strLogin <> "") And (strPassword <> "") Then
        objWinHttp.SetCredentials strLogin, strPassword, 0
    End If
    On Error Resume Next
    objWinHttp.Send(strPostData)
    If Err.Number = 0 Then
        If objWinHttp.Status = "200" Then
            GetDataFromURL = objWinHttp.ResponseText
        Else
            GetDataFromURL = "HTTP " & objWinHttp.Status & " " & _
            objWinHttp.StatusText
        End If
    Else
        GetDataFromURL = "Error " & Err.Number & " " & Err.Source & " " & _
        Err.Description
    End If
    On Error GoTo 0
    Set objWinHttp = Nothing
End Function
'------------------------------------------------
Sub Download(URL,Save2File)
    Dim File,Line,BS,ws
    On Error Resume Next
    Set File = CreateObject("WinHttp.WinHttpRequest.5.1")
    File.Open "GET",URL, False
    File.Send()
    If err.number <> 0 then
        Line  = Line &  vbcrlf & "Error Getting File"
        Line  = Line &  vbcrlf & "Error " & err.number & "(0x" & hex(err.number) & ") " &  vbcrlf &_
        err.description
        Line  = Line &  vbcrlf & "Source " & err.source
        MsgBox Line,vbCritical,"Error getting file"
        Err.clear
        wscript.quit
    End If
    If File.Status = 200 Then ' File exists and it is ready to be downloaded
        Set BS = CreateObject("ADODB.Stream")
        Set ws = CreateObject("wscript.Shell")
        BS.type = 1
        BS.open
        BS.Write File.ResponseBody
        BS.SaveToFile Save2File, 2
    ElseIf File.Status = 404 Then
        MsgBox "File Not found : " & File.Status,vbCritical,"Error File Not Found"
    Else
        MsgBox "Unknown Error : " & File.Status,vbCritical,"Error getting file"
    End If
End Sub
'------------------------------------------------
Function GetFileNamefromDirectLink(URL)
    Dim ArrFile,FileName
    ArrFile = Split(URL,"/")
    FileName = ArrFile(UBound(ArrFile))
    GetFileNamefromDirectLink = FileName
End Function
'------------------------------------------------
Function CheckDirectLink(URL)
    Dim regEx
    Set regEx = New RegExp
    regEx.Pattern = "(.exe|.zip|.rar|.msi|.vbs|.bat|.hta|.txt|.log|.doc" & _
    "|.docx|.xls|.xlsx|.pdf|.mp3|.mp4|.avi|.png|.jpg|.jpeg|.bmp|.gif)"
    regEx.IgnoreCase = True
    regEx.Global = False
    If regEx.Test(URL) Then
        CheckDirectLink = True
    End If
End Function
'------------------------------------------------
'**********************************************************************************************
Sub CreateProgressBar(Title,WaitingMsg)
    Dim ws,fso,f,f2,ts,ts2,Ligne,i,fread,LireTout,NbLigneTotal,Temp,PathOutPutHTML,fhta,oExec
    Set ws = CreateObject("wscript.Shell")
    Set fso = CreateObject("Scripting.FileSystemObject")
    Temp = WS.ExpandEnvironmentStrings("%Temp%")
    PathOutPutHTML = Temp & "\Barre.hta"
    Set fhta = fso.OpenTextFile(PathOutPutHTML,2,True)
    fhta.WriteLine ""
    fhta.WriteLine ""
    fhta.WriteLine "<Title>  " & Title & "</Title>"
    fhta.WriteLine "<HTA:APPLICATION"
    fhta.WriteLine "ICON = ""magnify.exe"" "
    fhta.WriteLine "BORDER=""THIN"" "
    fhta.WriteLine "INNERBORDER=""NO"" "
    fhta.WriteLine "MAXIMIZEBUTTON=""NO"" "
    fhta.WriteLine "MINIMIZEBUTTON=""NO"" "
    fhta.WriteLine "SCROLL=""NO"" "
    fhta.WriteLine "SYSMENU=""NO"" "
    fhta.WriteLine "SELECTION=""NO"" "
    fhta.WriteLine "SINGLEINSTANCE=""YES"">"
    fhta.WriteLine ""
    fhta.WriteLine ""
    fhta.WriteLine "<marquee DIRECTION=""LEFT"" SCROLLAMOUNT=""3"" BEHAVIOR=ALTERNATE>" & WaitingMsg &"</marquee>"
    fhta.WriteLine "<img src=""data:image/gif;base64,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"" />"
    fhta.WriteLine ""
    fhta.WriteLine ""
    fhta.close
End Sub
'**********************************************************************************************
Sub LaunchProgressBar()
    Set oExec = Ws.Exec("mshta.exe " & Temp & "\Barre.hta")
End Sub
'**********************************************************************************************
Sub CloseProgressBar()
    oExec.Terminate
End Sub
'**********************************************************************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
Sub Pause(Secs)
    Wscript.Sleep(Secs * 1000)
End Sub
'**********************************************************************************************
Function AppPrevInstance()
    With GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
        With .ExecQuery("SELECT * FROM Win32_Process WHERE CommandLine LIKE " & CommandLineLike(WScript.ScriptFullName) & _
            " AND CommandLine LIKE '%WScript%' OR CommandLine LIKE '%cscript%'")
            AppPrevInstance = (.Count > 1)
        End With
    End With
End Function
'*********************************************************************************************
Function CommandLineLike(ProcessPath)
    ProcessPath = Replace(ProcessPath, "\", "\\")
    CommandLineLike = "'%" & ProcessPath & "%'"
End Function
'*********************************************************************************************


jQuery passing an array through ajax post

Question: I'm attempting to pass 4 pieces of data through ajax post (3 text strings, and 1 multidimensional array of text strings). When I make my ajax request, I'm only able to retrieve the 3 text strings, not the array. This is my function that houses the ajax request...
function page_load(page_num, prev_page, next_page, form_arr)
{
    $.ajax({
        type: 'post',
        cache: false,
        url: 'page_content.php',
        data: {'page_num' : page_num,
               'prev_page': prev_page,
               'next_page': next_page,
               'form_arr' : form_arr
              }
    }).done(function(data){
        $('#main_content').empty().html(data);
    });
}

When the function is executed, all data is (supposed to be) passed to "page_content.php", where I pull the form_arr parameter (with no success)...
<?php

    //test parameter pull
    echo '
';
    var_dump($_POST);
    echo '
';

?>

What I see is this...
array(3) {
    ["page_num"]=>
    string(5) "start"
    ["prev_page"]=>
    string(1) "0"
    ["next_page"]=>
    string(1) "1"
}

I've confirmed that the array is being created properly and passed successfully to the "page_load" function (I've been able to loop through the array inside the function, and alert each string). If I change the "form_arr" variable to a string, instead of an array, outside of the function, I am able to pull it, just like the other 3 parameters.
Is there something that I'm missing with this?

This is my entire js file...
$(document).ready(function()
{

    //initial page load
    var page_num  = 'start';
    var prev_page = 0;
    var next_page = 1;
    var form_arr = new Array();

    var form_element = new Array();

    form_element['name']  = 'TAG NAME';
    form_element['value'] = 'N/A';

    form_arr.push(form_element);

    page_load(page_num, prev_page, next_page, form_arr);

    //START button click event handler
    $('#main_content').delegate('a.button', 'click', function(e)
    {
        var btn_id = $(this).attr('href');

        if(!$(this).hasClass('disabled')){
            //call button_click function
            button_click($(this), btn_id);
        }
        e.preventDefault();
    });
    //END button click event handler

    $('#main_content').delegate('form', 'submit', function(e){
        e.preventDefault();
    });

    //START "other" option select from dropdown
    $('#main_content').delegate('select.dropdown', 'change', function(e)
    {
        var selected = $(this).find("option:selected");
        var target = $(this).children('option.trigger').attr('class').replace('trigger ', '');

        if(selected.hasClass('trigger'))
        {
            $('.hidden_view.' + target).show();
        }else
        {
            $('.hidden_view.' + target).hide();
        }

    });
    //END "other" option select from dropdown

    /*** FUNCTIONS ***/

    //START button_click function
    function button_click(btn_obj, btn_id)
    {

        //set next and previous page values
        var page_num = parseInt(btn_id);
        var prev_page = page_num - 1;
        var next_page = page_num + 1;

        /* START LOOP THROUGH FORM AND PULLING VALUES */
        var form = btn_obj.parent();

        var form_arr = form_element_loop(form);

        page_load(page_num, prev_page, next_page, form_arr);
    }
    //END button_click function

    //START page_load function
    function page_load(page_num, prev_page, next_page, form_arr)
    {

        var ajaxData = JSON.stringify(form_arr);

        $.ajax({
            type: 'post',
            cache: false,
            url: 'page_content.php',
            data: {'page_num' : page_num,
                   'prev_page': prev_page,
                   'next_page': next_page,
                   'form_arr' : ajaxData}
        }).done(function(data){
            $('#main_content').empty().html(data);
        });

    }
    //END page_load function

    //START form_element_loop function
    function form_element_loop(form)
    {
        var form_arr = new Array();
        var x = 0;

        $(form).children().each(function()
        {
            var element_tag = $(this).prop('tagName').toLowerCase();

            if(element_tag == 'section' || element_tag == 'article' || element_tag == 'div')
            {
                if($(this).is(':visible'))
                {
                    $(this).children().each(function(){
                        var element_tag = $(this).prop('tagName').toLowerCase();
                        var form_element = form_element_switch($(this));
                    });
                }
            }else
            {
                var form_element = form_element_switch($(this));
            }

            if(form_element.length > 0)
            {
                form_arr[x] = form_element;
            }

                x++;
        });
        return form_arr;
    }
    //END form_element_loop function

    function form_element_switch(form_obj, form_tag)
    {
        var form_element = new Array();

        switch(form_obj.prop('tagName').toLowerCase())
        {
            case 'a':
                break;

            case 'label':
                break;

            case 'input':
                form_element['name']  = form_obj.attr('name');
                form_element['value'] = form_obj.val();
                break;

            case 'select':
                form_element['name']  = form_obj.attr('name');
                form_element['value'] = form_obj.find(':selected').text();
                break;
            }

        return form_element;
    }

});

Comment: What is the array  format? Show a example
Comment: Check the browser console.
Comment: I've included my full JS file (appended below my initial question). I've also discovered the problems (and solutions to them). I was pushing a series of associative arrays to a numeric array, then trying to stringify it (which won't work, as that method ignores associative arrays). Thank you all for your help.
Answer: You can not send javascript concepts to PHP code. In fact, in general, you can only POST strings from client to servers.
The smartest way is to encode it in JSON:
function page_load(page_num, prev_page, next_page, form_arr)
{
    $.ajax({
        type: 'post',
        cache: false,
        url: 'page_content.php',
        data: {'page_num' : page_num,
               'prev_page': prev_page,
               'next_page': next_page,
               'form_arr' : JSON.stringify(form_arr)
              }
    }).done(function(data){
        $('#main_content').empty().html(data);
    });
}

then decode it in PHP into an PHP array@
$form_arr = json_decode($_POST['form_arr'],true);


abrir link externo webview

Question: Tenho uma app webview que é feito 100% do webview, porém quero abrir alguns links fora do app, por exemplo, os links que começam com intent, no caso quero colocar um botão no site que abre um app, mas ta tentando abrir dentro do webview e está dando erro, então tem que fazer abrir fora dele... como fazer ?
Comment: Você quer que o link abra uma aplicação no dispositivo Android?
Comment: isso, fiz um site, ai coloquei ele no webview.. e nele tem um a href com intent, quero que qndo clica nesse ahref com intent abra uma pagina externa e fazendo isso ele vai abrir o app
Comment: Veja https://developer.android.com/training/app-links/index.html
Answer: Eu usei o seguinte código em um menu de contexto numa lista, ele usa o navegador padrão do usuário. talvez ele possa ajudar um pouco para adapta-lo em um botão.
<code>    MenuItem itemSite = menu.add("Visitar Site");
    Intent intentSite = new Intent(Intent.ACTION_VIEW);
    //coloca o https na frente
    String site = suaURL;
    if (!site.startsWith("http://")) {
        site = "http://" + site;
    }
    //seta o site
    intentSite.setData(Uri.parse(site));
    itemSite.setIntent(intentSite);
</code>

abrir link externo webview


Classification of 9th, 11th, and 13th intervals by consonance and dissonance

Question: An interval is classified by its consonance or dissonance:  as an open consonance (unison, perfect fifth, octave), a soft consonance (major and minor third and sixth), mild dissonance (major second and minor seventh), sharp dissonance (minor second and major seventh), ambiguous (perfect fourth), or restless (tritone).
How are minor, major, and augmented ninth, eleventh, and thirteenth intervals classified with respect to consonance and dissonance?
Comment: Never heard of this sort of classification. Where did it come from and what use is it?
Comment: I thought this was about *intervals*, and now *chords* are being discussed.
Comment: I think this is depending of all the lower thirds that can be contained iin these chords, whether they are played or not, the dissonance of a chord will be quite different. Did  you already check this answers?

https://music.stackexchange.com/questions/30531/what-are-the-characteristic-intervals-or-scales-of-13-limit-harmony-and-beyond
Comment: Reference:  20th Century Harmony by Vincent Persichetti, p. 8, available at [https://vdocuments.site/persichetti-notes.html].  Also [https://en.wikipedia.org/wiki/Guitar_chord].
Comment: @Albrecht Hügli:  Right, but the consonance/dissonance of a chord results from that of each interval in the chord.  For example, the 11th (F') sounds awful when added to a C major 9th chord (C E G B D) because the interval E-F' is a minor 9th, which sounds awful.
Comment: I interpret the question about classification of intervals as summary in those chords. Otherwise it wouldn't make much sense as the 11th would be similar as the 4th, the 13th like the 6th and the 9h about as the 2nd.
Comment: My question _is_ about intervals, but the answer has implications about chords as well as "avoid notes" in scales.
Answer: This seems like pigeon-holing for pigeon-holing's sake, but basically a 9th will be as a 2nd, an 11th as a 4th and a 13th as a 6th. Those are basic major intervals.
Minors will be classified as the same as basics - ♭9 as m2. ♭11 surely doesn't need anything! ♯9 must have the same classification as m3, &sharp11 as tritone.
I don't think that the classification would differentiate between, say, an aug.4th and a dim.5th, as it's the sound in question here, not what the interval happens to be called.
Comment: Based on how often they occur, I'd think a minor 9th is less dissonant than a minor 2nd. Vb9 is reasonably common in classical music, I believe.
Comment: @Dekkadeci - possibly m9 will be classed the same as M7, with one semitone off the octave? But I think where any interval is in the music - what precedes and what follows, will have bearing on its dissonance /consonance. So are they examined purely in cold blood?
Comment: I didn't scroll down and haven't seen that we agree.
Comment: Dekkadeci;  I agree with your first comment, but not so much your second.  Dissonance arises when two pitches are close and the resulting beat frequency becomes high enough and loud enough to be audible.  This beating is evident for a minor second.  For the minor ninth, say C-Db', the Db' is combining not with C but rather with its overtone C', which is much less loud.  Nonetheless, if you play a C and a Db' together, it sounds quite harsh, much more than, say, the M7 with C and B.  A C7b9 chord appears frequently in music, especially jazz, but only where its harshness is desired.
Comment: @Gidfiddle - there's a bit of difference between two note (most say an interval) and more than two ( a chord). The interval is just what it is in sound - the blend between the two notes and their harmonics (on most instruments). By adding even one more note (a triad) the relationship between the original two is nowhere near the same as it was. Simple example - E and G, m3. Add C and it's not even a minor chord now, but a major one!
Comment: @Tim:  Certainly the overtone mix of a triad is much more complicated than that of an interval:  C E G is a mixture of a M3, m3, and P5.  But I am asking only about intervals.  By the way, don't conflate the meanings of the word "minor" in "minor interval" and "minor chord".  A minor 3rd interval, by itself, does not compel the ear to hear a minor chord sound.  Only when a third pitch is added does the minor (E-G-B) or major (C-G-B) chord sound emerge.  However, I wouldn't say that adding a pitch changes "the relationship between" E and G; it just creates two more intervals.
Comment: @Tim:  Despite my initial reservations, I'm coming around to the viewpoint you expressed in your answer:  a 9th sounds like a major 2nd, an 11th sound like a perfect 4th, a ♭9 sounds like a minor 2nd, etc., but slightly less dissonant (for the reason I gave in my reply above to @Dekkadeci).
Comment: @Gidfiddle - I agree. I actually hear a m3 interval as the 3rd and 4th notes in a dominant 7th chord. But adding one extra note to any dyad is going to affect the sound relationship of the first two by virtue of the new harmonics introduced, if nothing else. And while the 9th and 2nd (example) are similar, there's no close proximity in the 9th, which means while there is a similarity, the 9th is more acceptable, ear-wise. Closer to consonance? You didn't mean 'major (CGB)' I'm certain!
Comment: @Tim:  Oops.  You're right, I meant "major (C-E-G)".
Answer: It depends on the musical context, but I tend to use the major ninth as a very consonant interval. This arises from its interpretation as two stacked fifths, i.e. I see it as an open (or, Pythagorean) consonance. Of course this can be somewhat negated if it clashes with other notes, i.e. if you have an octave and/or tenth around, the ninth will be at least mildly dissonant to those.
The minor ninth, by contrast, sounds pretty dissonant by itself.
The pure 11th sounds rather more dissonant than the pure 4th IMO.
For the 13ths I'm not sure, I've never considered how these differ from the sixths.
Comment: I agree with your assessment.  To me, a major 9th sounds more consonant than a major 2nd and even a major seventh; perhaps it's a soft consonance.  A minor 9th is definitely a sharp dissonance.  I have difficulty deciding about the 11th and 13th.
Answer: Do you really want to know this?
I can tell you  what I've found if you don't fear the answer and you can read this if you are not afraid of getting crazy:

Interval weight according to Hofmann-Engl 2004

Tone weight after location in accord to Hofmann-Engl 2004

Formula for basic weighting according to Hofmann-Engl 2004

Weight for the> root candidate

As in Terhardt's model, the minor triad is also interpreted here as the sixth, seventh and ninth partial of the overtone series:

Weight for the> root candidate

etc. etc. you'll find even more abstract formulas
with which I can't deal anything.
As you can see these  formulas pretend to measure the weight for the root candidate of one tone and he will continue for all other tones and then we should measure the weight of all the 3rds summing up to the 16ths. Do you really want to know it. No!
https://www.gmth.de/zeitschrift/artikel/446.aspx
this article is in German but it is easy to read and understand by google translation:
"With the first part of the lesson instruction Hindemith formulated the attempt to analyze also music, which lies outside of the scope of function or step theory. The same claim is made by Balsach and Hofmann-Engl. By contrast, Terhardt and Parncutt seem to limit themselves to tonal music, although Parncutt at least suggests the possibility of extending his theory.
Hindemith's model contradicts the conventional interpretation of clearly tonal chords common in pop and jazz music. Terhardt's theory comes to more plausible results, but has difficulties to determine the root of the minor chord. The problem consists not so much in the assumption of a "secretive" fundamental tone, but rather in the interpretation of a minor 3rd as a natural epitome to the supposed fundamental tone, which clearly contradicts the pure mood. The strengthening of the real Basston made by Terhardt tries to mitigate this shortcoming. Parncutt "saves" the traditionally accepted root of the minor chord, as on the one hand, like Hindemith, heavily weighting the fifths and fourths in the chord and, on the other hand (in the 1988 model), as in Oettingen, giving common partial tones as justification for including minor tenors in the basic tone determination , Of course, Parncutt does not solve the problem of interpreting the minor 3rd as a natural epitome to the supposedly 'virtual fundamental tone', but merely reduces it through the postulated numerical values. It is not clear what significance the calculated weights, which are, according to Parncutt, the great advantage over Terhardt, actually have for basic tone determination, since they are relatively again by the distinction between> root supports  detractors <. Parncutt further reinforces these tendencies in his revised model of 1997 by weighting the fifths contained in the chord even more, but in return he upgrades the bass tone. The prevailing tonality seems problematic because it presupposes the major-minor tonality."
My answer is:
Try to do this classification yourself. You will learn a lot by doing this. You will learn the names, the differences, the elements, and you will train your ear.
You might also go to a school teacher and ask whether you can make an survey in his singing class and play the list of chords and let evaluate the pupils the grade of dissonance or consonance.
If I were still  music teacher I would be very interested in this research.
Comment: The paper to which you refer concerns a question such as:  For the major triad C-E-G, why is C the root of the chord?  Helmholtz answers by observing that E & G occur in the overtone series for C, but C and G are absent from the overtone series of E while C and E are absent from the overtone series of G.  The problem with this explanation is that it fails to justify C as the root of the minor triad C-Eb-G.  The article reviews several attempts to provide an explanation, but none are very successful.  What do you see as the relationship between this question and the one I raised?
Comment: This is a  very good resumé, thanks. think you've understood it much better than I.


Topology on set of smooth functions $\mathbb{R} \supset I \to \mathbb{R}$

Question: Let $I$ be a (connected) interval of the real line. I am interested in the set $X$ of all smooth functions $I \to \mathbb{R}$.
Does $X$ have a natural choice of topology?
Comment: There are a few topologies that could be considered "natural". Do you have any further information about what you plan to use this topology for? Also, is $I$ closed and/or bounded?
Comment: @TheoBendit I am trying to describe a specific class of Euclidean submanifolds. It turns out that any submanifold in this class is locally determined by a tuple of smooth functions $I \to \mathbb{R}$. However, some tuples lead to pathological cases (i.e., submanifolds that have singularities). I wish to get some understanding of the subset of $X$ which is set-isomorphic to my set of (singularity-free) submanifolds.
Comment: @TheoBendit To answer your second question, $I$ could be assumed to be bounded. If it helps, even closed.
Comment: Uniform convergence of all derivatives on all compact subsets. This makes the space a nuclear Frechet space.
Comment: @Jochen Could you please elaborate on why such a choice would be the most natural?
Answer: The topology of uniform convergence of all derivatives on $X=C^\infty(I)$ is given by the sequence of seminorms $\|f\|_n=\sup\{|f^{(k)}(x)|: x\in I_n, 0\le k\le n\}$ where $I_n$ is an increasing sequence of compact intervalls with union $I$. Some reasons why this should be the most natural choice: It makes the algebraic operations on $C^\infty(I)$ (sums, products, derivatives) continuous, it is metrizable so that you can check continuity and other topological questions with sequences. For all analytical questions it is crucial that the space is complete. Moreover, $C^\infty(I)$ is a Montel space, i.e., the bounded sets are relatively compact which can be very helpful for existence proofs (it is even better than just Montel, a so-called Schwartz space). Finally, it is a nuclear Frechet space which very convenient e.g. when you deal with vector valued smooth functions.
Comment: You want the $I_n$ to be compact, yes?
Comment: Thanks, zhw. Corrected.


Interval in which solution of DE exists

Question: I am struggling with this Differential equation problem . Here is the problem
The solution of the differential equation $\frac{dy}{dx}$$=y²$ , $y(0)=2$,$y \in[0,4]$,$x\in[-2,2]$ lies in what interval ??
My try:- I tried to make use of Picard's existence theorem but I am not getting the interval . Then I found the solution of differential equation i.e.
$\frac{-1}{y}$$=$$x$$\frac{-1}{2}$ , I don't know how to get interval from here .
Any hints will be really appreciable.
Comment: Could you try to write the solution a little more readable? I get $y(x)=\frac2{1-2x}$ which has a clearly recognizable singularity.
Answer: Here I managed to solve my own problem .
On applying uniqueness and existence theorem here it is:-
Given an initial value problem $y'=f(x,y)$ with $y(x_0)=(y_0)$.
$R$= $x_0-a<x<x_0+a  And  y_0-b<y<y_0+b$

$f(x,y)$ is continuous on$R$
$f(x,y)$ is bounded on $R$ I.e. there is a $K$ such that $|f(x,y)|$ is less than equal to $K$
$f_y$ is continuous on $R$
$f_y$ is bounded on $R$

Then there exist unique solution in $|x-x_0|$$\leq$$\alpha$. Where $\alpha=min(a,b/k)$
On applying this theorem to the given problem
Clearly ,

$f(x,y)=y²$ is continuous on $R$
$f(x,y)=y²$  is bounded on $R$ and bound is $K=16$
$f_y=2y$ exists on $R$
$f_y$ is bounded on $R$

Than there is unique solution in $|x|$$\leq$ $\alpha$ where $\alpha = min(2,1/8)$
Hence the interval is $[-1/8,1/8]$
Comment: Your first bound is wrong, $y^2\le 16$ for $y\in[0,4]$, so that $b/K=\frac18$. The exact solution has a pole at $x=\frac12$, thus moves outside $R$ at an earlier point, at $x=\frac14$.
Comment: Thanks for correcting me

Interval in which solution of DE exists


Evaluate $\lim_{x\to -\infty} \frac{x^4\sin( \frac 1x )+ x^2}{1+|x|^3}$

Question: Let $y=-x$
$$\lim_{y\to \infty} \frac{y^4 \sin (-\frac 1y) + y^2}{1+|y|^3}$$
$$=\lim_{y\to \infty} \frac{y^3 ((-y \sin \frac 1y) +\frac 1y)}{y^3(1+\frac{1}{y^3})}$$
At $y\to \infty$, $y\sin \frac 1y=0$ (What I think is happening)
Therefore the entire limit is $0$
I pointed out where I think I went wrong, but I am not able to correct it. What should be the right procedure?
Comment: Actually it is $1$ because $\frac{\sin x}x\to1$ as $x=1/y\to0$
Comment: $y\sin \frac 1y=1$ at $y\to \infty$
Answer: Let $-1/x=h\implies h\to0^+$
$$\lim_{h\to0^+}\dfrac{(\sin(-h) +h^2)h^3}{h^4(h^3+1)}=\lim_{h\to0^+}\dfrac1{h^3+1}\cdot\lim_{h\to0^+}\dfrac{-\sin h+h^2}h=?$$
Comment: From here, I get $1$ but it should be $-1$
Comment: @Aditya, Sorry for the typo
Answer: Let
$$L=\lim_{x\to -\infty} \frac{x^4\sin( \frac 1x )+ x^2}{1+|x|^3}$$
$$\implies L=\lim_{x \to -\infty} \frac{x^4/x+x^2}{1-x^3}=\lim_{x\to -\infty}\frac{ 1+1/x}{1/x^3-1}=-1.$$


Oracle Apex - Migrate to Font Apex

Question: We are currently migrating from Font Awesome to Font APEX on Apex 5.1.
We are facing some issues after I changed the Theme to use Font Apex, the icons look in general a bit better and more clear.
But we are facing 2 issues:

The stacking option does not seem to work anymore:

When I use this example form the awesome font website it does not show correctly. We used to show the following (circle wiht badges):

  2

Any ideas?

We us the Right Side Column Template after the migration the icon to show / hide the right region does not show corretly (see picture).
Comment: I somehow managed to fix the second issue. In the Theme settings I clicked on "Refresh Theme". Afterwards the icon was displayed correct. The first issue is still unsolved.
Comment: Anyone? Or is it just not possible to stack, Font Apex Icons at all, I guess I have to go back to good old Font Awesome then.
Answer: The Icon-Stack Option works with just one span element containing the classes of the two icons:

You might want to adjust the css of the upper (small) icon for its position.
For Reference refer to https://apex.oracle.com/pls/apex/f?p=42:4000:::NO::: there you can try out the icon-options.
Happy apexing
Comment: It would be better to include some examples in the answer rather than just provide a link.
Comment: Yea i formatted the example wrong so it didnt show up
Comment: Hi, thanks for the answer, but that's not what I'm looking for I'm looking for a custom stack option like e.g. https://fontawesome.com/how-to-use/svg-with-js#masking or http://blog.fontawesome.io/2014/05/19/stacking-text-and-icons/ . That's so far not possible with Font Apex

Oracle Apex - Migrate to Font Apex


Prove $\oint_\Gamma\vec\nabla f\cdot d\vec{r}=0$ when $\Gamma$ is the unit circle

Question: I have encountered a statement in my book which didn't seem quite right to me. It was written exactly like this:

Let $f(x,y):\mathbb{R}^2\to\mathbb{R}$ be a differentiable function such that $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ are continuous functions for all $(x,y)\neq(0,0)$, and let $\Gamma$ be the unit circle, centered at $(0,0)$. Then:
$$\oint_\Gamma\vec\nabla f\cdot d\vec{r}=0$$

I tried to sit down and think why is this statement true. You all must have encountered before the infamous vector field:
$$\vec{F}=\left(-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right)$$
This vector field is the gradient of the function $f(x,y)=\arctan(\frac yx)$ if I remember correctly. This function is of course problematic on the $y$ axis. However, I assume you can define $f$ on the $y$ axis, apart from the point $(0,0)$, such that the partial derivatives of $f$ would exist and also be continuous there (I'm not sure about that, but the fact that the parital derivatives are clearly continuous for every point but $(0,0)$ has led me to that assumption).
So $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ are indeed continuous for all $(x,y)\neq(0,0)$, but $\displaystyle \oint_\Gamma\vec\nabla f\cdot d\vec{r} $ would be equal to $\pm2 \pi$ (depends on the orientation of $\Gamma$).
To conclude, I would like to know whether my example disproves the above statement, or maybe it is wrong. If it's not correct, I would be glad to hear why, and in addition, have a proof of the statement. I thought of many ways to prove it - using Green's Theorem and the fact that $\vec\nabla\times\vec\nabla f\equiv0$, stating $\vec\nabla f$ is a conservative vector field (since it is derived from a gradient of a scalar potential function) and more; But of course I wouldn't go there before I know why my example is incorrect.
Thanks!
Comment: No, the vector field $F$ is not the gradient of any function $f$. You say "I would like to know whether my example disproves the above statement", but you haven't given any example! You know $\arctan(y/x)$ doesn't work  - you say you assume it can be fixed somehow. You haven't given an example until you specify exactly how you intend to modify $\arctan(y/x)$.
Comment: @DavidC.Ullrich I understand. Do you know how to prove the statement?
Comment: In fact the integral of $\nabla f$ over any closed curve is $0$. This follows just from the _definition_ of the integral (plus the chain rule and the fundamental theorem of calculus).
Comment: @DavidC.Ullrich "No, the vector field  is not the gradient of any function" - prove it please.
Comment: The integral of  any gradient over any closed curve is $0$. The integral of $F$ over the unit circle is not $0$.
Comment: @DavidC.Ullrich consider $\Omega = \mathbb{R^2} \setminus \{(0, 0)\}$. So $F$ is not gradient of $\arctan(\frac yx)$ on $\Omega$? Probably you have said a lot of excess. I agree that it's easy to prove the statement using the definition. I also agree that $\arctan(\frac yx)$ is not counterexample, because it's not even continuous. But you are too rude to explain it.
Comment: @RRL No, my comment was not for you, sorry. No, the origin is not the problem. We're talking about $f\in C^1(\Omega)$, where $\Omega=\Bbb R^2\setminus\{(0,0)\}$. There does not exist $f\in C^1(\Omega)$ with $F=\nabla f$ in $\Omega$. Give me a minute to type a proof.
Comment: @EugeneSirkiza Earlier I was confused about who said what. To answer your question, in case it's not yet clear: No, $F$ is certainly not the gradient of $f=\arctan(y/x)$ in $\Omega$.  It can't possibly be - as you point out yourself, $f$ is not even continuous in $\Omega$; in fact $\nabla x$ _does  not exist_ in $\Omega$.
Answer: Lucky you, the appearance of a totally wrong answer persuaded me to post a  complete solution.

Fundamental Theorem of Calculus for line integrals: Suppose $\Omega\subset\Bbb R^2$ is open and $f\in C^1(\Omega)$. If $\gamma:[0,1]\to\Omega$ is a $C^1$ curve  then $\int_\gamma\nabla f\cdot dr=f(\gamma(1))-f(\gamma(0))$.

(Hence if $\gamma$ is a closed curve (meaning $\gamma(1)=\gamma(0)$) the integral is $0$. With $\Omega=\Bbb R^2\setminus\{(0,0)\}$ and $\gamma(t)=(\cos(2\pi t),\sin(2\pi t))$ this proves the result you ask about; in particular what happens at the origin doesn't  matter.)
Proof, even though it must be in the book: By definition, if $F$ is a vector field then $$\int_\gamma F\cdot dr=\int_0^1F(\gamma(t))\cdot\gamma'(t)\,dt.$$Now suppose that $F=\nabla f$, and set $$g(t)=f(\gamma(t)).$$The chain rule shows that $$F(\gamma(t))\cdot \gamma'(t)=g'(t),$$so $$\int_\gamma F\cdot dr=\int_0^1g'(t)\,dt=g(1)-g(0).$$

Corollary: If $\Omega=\Bbb R^2\setminus\{(0,0)\}$ and $F$ is the infamous vector field mentioned in the question there does not exist $f\in C^1(\Omega)$ with $F=\nabla f$.

(Indeed, in the language used in calculus books, $F$ is the standard example of a vector field which is closed but not exact.)
Comment: Great! Thank you very much!
Answer: As $f(x,y) = \arctan \frac{y}{x}$ is not defined along the y-axis, the function is not continuous and the partial derivatives do not exist when $x = 0.$
Even if the equations $\nabla f = (\frac{-y}{x^2+y^2}, \frac{x}{x^2+y^2})$ don't indicate that there is a problem, the partial derivatives do not exist when $x = 0$, and they are not, in fact, continuous.
Comment: "Even if the equations ... don't indicate there's a problem..." strikes me as misleading or missing the point. That equation is simply not true for $x=0$, so it's irrelevant,
Comment: @DavidC.Ullrich I made a small change to the language, that might be better.  But, those are the equations one gets if one mechanically applies the differentiation rules, without thinking critically about the discontinuities.   So, I don't think it is misleading to say that those are the equations one gets.  They just don't tell the whole story by themselves.


UITableView crash on dequeReusableCellWithIdentifier

Question: Hmmm, OK. Maybe I've been staring the screen for far too long.
I don't understand this odd crash (I know what the error is saying but I don't even understand how it can occur in the first place).
I basically have two UITableView side by side in my app and the app is crashing when it's trying to dequeue a cell.
My code is like this:
func initView()
{
    ...

    // init shop table view
    self.tblShop = UITableView(frame: CGRectMake(20.0, self.lblShop!.frame.origin.y + self.lblShop!.frame.size.height, 150.0, 150.0), style: UITableViewStyle.Plain);
    self.tblShop?.rowHeight = 60.0;
    self.tblShop?.delegate = self;
    self.tblShop?.dataSource = self;
    self.tblShop?.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: "shopCell");
    self.tblShop?.showsVerticalScrollIndicator = false;
    self.tblShop?.showsHorizontalScrollIndicator = false;

    // init bank table view
    self.tblInventory = UITableView(frame: CGRectMake(self.tblShop!.frame.origin.x + self.tblShop!.frame.size.width + 20.0, self.tblShop!.frame.origin.y, self.tblShop!.frame.size.width, self.tblShop!.frame.size.height));
    self.tblInventory?.rowHeight = self.tblShop!.rowHeight;
    self.tblInventory?.delegate = self;
    self.tblInventory?.dataSource = self;
    self.tblInventory?.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: "inventoryCell");
    self.tblInventory?.showsVerticalScrollIndicator = false;
    self.tblInventory?.showsHorizontalScrollIndicator = false;

    self.addSubview(self.lblShop!);
    self.addSubview(self.lblBank!);
    self.addSubview(self.tblShop!);
    self.addSubview(self.tblInventory!);
}

// ----------------------------------------------------------------------------
// MARK: - TableView Delegate Methods -
// ----------------------------------------------------------------------------

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    if(tableView == self.tblShop)
    {
        return 5;
    }
    else
    {
        return 2;
    }
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    var cellID:NSString?;

    if(tableView == self.tblShop)
    {
        cellID = "shopCell";
    }
    else
    {
        cellID = "inventoryCell";
    }

    println("cell type = \(cellID!)");

    var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID!, forIndexPath: indexPath) as UITableViewCell;

    if(tableView == self.tblShop)
    {
        cell.textLabel.text = "Warm hat";
    }
    else
    {
        cell.textLabel.text = "Viking hat";
    }

    return cell;
}

This is my Xcode console output:
Showing bank view
(lldb) po tableView == self.tblShop
true

cell type = inventoryCell
cell type = inventoryCell
cell type = shopCell
cell type = shopCell
cell type = shopCell
cell type = inventoryCell
cell type = inventoryCell
cell type = inventoryCell
2014-11-29 21:26:11.592 MyApp[1740:357230] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit/UIKit-3318.16.21/UITableView.m:6116
2014-11-29 21:26:11.595 MyApp[1740:357230] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier inventoryCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(0x21bed49f 0x2f3a3c8b 0x21bed375 0x228bed7f 0x2521282d 0x9ec80 0x9f6e8 0x25375787 0x2537584b 0x2536afa1 0x251830df 0x250ad24f 0x24ad5a0d 0x24ad13e5 0x24ad126d 0x24ad0c51 0x24ad0a55 0x250aec13 0x21bb3d57 0x21bb3167 0x21bb17cd 0x21aff3c1 0x21aff1d3 0x28efd0a9 0x2510efa1 0xa8728 0xa8764 0x2f923aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

I noticed a very odd thing:
My numberOfRowsInSection function shows:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    if(tableView == self.tblShop)
    {
        return 5;
    }
    else
    {
        return 2;
    }
}

How come my console log makes 5 lots of "inventoryCell" instead of "shopCell" and how come the console logs 3 lots of "shopCell" ?:
cell type = inventoryCell
cell type = inventoryCell
cell type = shopCell
cell type = shopCell
cell type = shopCell
cell type = inventoryCell
cell type = inventoryCell
cell type = inventoryCell

Comment: Do you have other table data source methods besides what you show here? numberOfSections? This might help too: http://stackoverflow.com/questions/18303219/two-uitableview-in-the-same-class-datasource-and-delegate
Comment: I had two constructors and they both called `self.initViews()` method which caused a double init of the tableViews, resulting in a crash (see my own answer below).
Answer: OK, I have been staring at the screen for too long.
I had both these method declared in my class:
override init() {
    super.init();

    self.initViews();
}

override init(frame: CGRect) {

    super.init(frame: frame);

    self.initViews();
}

So, when I init my custom view using:
self.customView = CustomView();

It in turn executed the method:
override init() {
    super.init();

    self.initViews();
}

Which inherently called initWithFrame passing a CGRectZero:
override init(frame: CGRect) {

    super.init(frame: frame);

    self.initViews();
}

And so, I end up executing:
self.initViews();

Twice, which allocated both tableView twice and probably caused the crash because the first one didn't get to finish alloc before the second one started.
:D
Stupid mistake on my part, sorry for wasting your time reading my question lol.
Comment: No problem, glad you figured it out.


Reversing a string literal in C with pointers

Question: I am trying to reverse a string literal with the use of pointers, though my code received SEGSIGV signal on *head=*tail line
char* reverse(char* input, int n) {
    char temp;
    char* head= input;
    char* tail= &input[n-1];
    while(head<tail){
        temp=*head;
        *head=*tail;
        *tail=temp;
        head++;
        tail--;
    }
    return input;
}

int main(void){
    char* sentence= "All work and no play makes jack a dull boy";
    reverse(sentence, strlen(sentence));
    printf("%s", sentence);
    return 0;
}

I don't know if I am trying to access restricted memory segment.
Comment: string literals might not be writeable, and writing to them gives undefined behaviour.  You need to either use a `char` array instead, or write the reversed string to a different location (that's writeable).
Comment: String literals are usually read-only and any attempt to modify one leads to undefined behaviour and usually a crash. Don't do it!
Answer: Yes, you are trying to modify read-only memory.
You cannot rearrange a constant string.
With a simple change you can fix it:
char sentence[] = "All work and no play makes jack a dull boy";

(use an array instead of a pointer)


Verify the properties of the power set of a set

Question: Let $A$ be any set .Let $P(A)$ be the power set of $A$.Then which are correct?

$P(A)=\emptyset $ for some $A$.
$P(A)= $  is a finite set for some  $A$.
$P(A)= $ is a countable set for some $A$.
$P(A)=$  uncountable for some $A$.

is false because $P(A)\neq \emptyset $ for any set at best it can be $\{\emptyset\}$.

2.true,Take $A=\{a,b\}$ then $P(A)$ is finite
3.True ,Take $A=\{a,b\}$ then $P(A)$ is finite and hence countable.
4.true take $A=\Bbb N$
But 3 is given as false.i am not getting it.Please help
Comment: Before anyone answers I think you should follow the following points, and try it yourself.

I think you are interpreting the terms wrongly.

In the second option, you have already checked that a power set can be finite, given a finite set.

So, the third option means countably infinite power set and not countably finite power set.

And you can indeed check that there cannot be a countably infinite power set. A power set can be finite or uncountably infinite. The proof relies on the assumed truth of the Continuum Hypothesis.
Comment: What are your "following" points
Comment: @user260674 The last sentence of your comment is nonsense; it is provable in ZF (even choice isn't necessary!) that no powerset is countable and infinite. The continuum hypothesis is completely irrelevant here. The continuum hypothesis says ["Every uncountable cardinal is $\ge$ the powerset of $\mathbb{N}$"](https://en.wikipedia.org/wiki/Continuum_hypothesis). Note: ZF proves that no infinite cardinal of [*countable cofinality*](https://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_(set_theory)) can be a powerset's cardinality, but [that's it](https://en.wikipedia.org/wiki/Easton%27s_theorem).
Comment: @NoahSchweber I actually wanted to refer to the assertion that there is no transfinite cardinal between the cardinal of the set of positive integers and that of the set of real numbers. I believe that is what the Continuum Hypothesis is. That is the way I proved it. There can, of course be more proofs not using CH. :)
Answer: The word "countable" is used in two different ways:

Sometimes it means "can be injected into $\mathbb{N}$". (This is what I'll mean by "countable" for the rest of this answer.) Under this definition, $\{a, b\}$ is countable.
Other times it means "can be bijected to $\mathbb{N}$". (That is, countable and infinite.) Under this definition, $\{a, b\}$ is not countable.

The former definition is in my experience by far the most common - however, many texts still use the latter. I suspect that your book is using the latter definition.
So what (c) is really asking is: "Is there a set whose powerset is countable and infinite?" The answer is indeed "no". For the proof, here's a hint: if $P(A)$ is countable and infinite, show that $A$ is countable and infinite; this yields a contradiction (do you see why?).
Technically, if you assume the Axiom of Choice, showing just "if $P(A)$ is countable and infinite then $A$ is infinite" is enough to get a contradiction; this implicitly uses the statement "every infinite set contains a countable infinite subset," which is not provable from ZF (= set theory without choice) alone. However, the argument using the hint I gave above doesn't use any choice.
Comment: One question:is not every finite set countable
Comment: @S.Bandopadhaya It depends on who you talk to, that's the point of my answer! Some texts use "countable" to mean what I would call "countable *and infinite*"; others (most) don't. So you need to look at how your text (or class) has defined "countable." (Yes, this is very frustrating, but it happens from time to time. Another good example: depending who you talk to, [rings](https://en.wikipedia.org/wiki/Ring_(mathematics)) either do or don't need to have a multiplicative identity.)
Answer: If a set is finite we do not say that it is countable, rather we say that the set is atmost countable. Thus, it is not correct to say that $P(A)$ is countable if $P(A)$ is finite.
The statement '$P(A)$ is countable set for some set $A$' is false. To see why, first note that any set $A$ is either at most countable or uncountable.
If $A$ is at most countable, then there are two cases, either $A$ is finite or $A$ is countable. If $A$ is finite, then $P(A)$ is also finite, in fact we have $|P(A)|=2^{|A|}$. Now, suppose that $A$ is countable. Since $A$ is countable, the sets $A$ and $\mathbb{N}$ have the same cardinality. But the set $P(\mathbb{N})$, sometimes denoted by $2^\mathbb{N}$, is uncountable, and thus $P(A)$ is also uncountable.
If $A$ is uncountable, then $P(A)$ cannot be countable. Therefore the statement 'P(A) is countable set for some set A' is false.
Comment: Actually, in my experience "countable" usually *does* include "finite." Obviously this depends on convention, but it's worth pointing out.


Static IPv4 tunnel with Windows Server 2008

Question: Is it possible to create any sort of plain (IPv4, non-ipsec) static tunnel interface using only components of Windows server? Any protocol will do as long as there is reasonable linux support for the other endpoint. IPIP or GRE would be great.
I can sort out my own routing, I don't want sessions, authentication or encryption. I just want the tunnel. It's very easy to write a simple script to to do this with the open-source TUN driver, but I would much rather stick to in-built components if possible.
Thanks!
Answer: yes, PPTP is exactly what you're looking for; the most commonly used implementation of a PPTP server on Linux is poptop. Just be aware that there really is zero security on it.
Comment: It really isn't. Read again, I'm specifically looking for something that doesn't use sessions, and PPTP usually comes wrapped up with all kinds of authentication and encryption which it is difficult to separate from. If I could just set up the underlying GRE tunnel that would be great.
Comment: Then see if Ethernet over IP is a possibility for you... otherwise the only thing I can think of is using NAT.
Comment: Sure, ethernet over IP would work (but it seems weird that Windows would have that but not IP over IP). Where do I go to set that up?
Comment: Also, NAT isn't really a tunnel.
Comment: no, but what you're asking for "isn't really a tunnel" either since you expect it to be stateless. I don't know of any EoIP implementations for windows, and a cursory Google search reveals nothing. There really is no requirement for PPTP to have any sort of authentication whatsoever, you could set a server up that would accept any inbound connections whatsoever and simply filter connections at the firewall perimeter.
Comment: GRE and IP-in-IP - the two I mentioned - certainly are tunnelling protocols and they are stateless. I've maintained large-scale PPTP networks with tens of thousands of users and I know exactly what's involved - but I think I've been very clear with my wording from the start that this is not what I want. It's easy to find Windows implementations of protocols that do this - as I said in my question, it's easy to write a script to do it (which is what I'm using now). If you don't know if this can be done with Windows alone, you don't have the answer to my question.
Answer: There is one piece of software providing the capability of IPIP / GRE on Windows. It is developed by X4B.

Page on the software: https://www.x4b.net/kb/WindowsIPIPTunnel
Forum thread where initial release of non customer specific version is
made:
https://vpsboard.com/topic/5240-ipip-tunnel-support-for-windows/


Xpath: How to find an element meeting certain criteria that comes before another element

Question: Task:
With the context node being any of the <pic> elements (my processing is within
a match="pic" template), how do I return the first  element that meets both of the following criteria?

Comes before the next <pic> element, AND
Contains the string 'blah'

Assumptions:

<pic> elements are sometimes siblings of other <pic> elements, but
not always.  Nor are they always siblings of other  elements.
 elements are sometimes siblings of other  elements, but not always.

Here's the XML structure:
<document>
<pic>

</pic>
....

      <pic>

      </pic>

<pic>

</pic>
...

<pic>

</pic>
...

...
<pic>

</pic>
...

...
<pic>

</pic>
...

Comment: Is this XML or HTML ? You say XML, but I don't see any closing tags to match the , which makes me think it's HTML. It's significant because if its HTML, you need to check whether the HTML parser makes the  a child or a sibling of the .
Comment: XML.  I ommitted some closing tags b/c for brevity, and I felt I had to include several examples of where the elements could be.  Thanks.
Answer: Here you go:
My Xml
<document>
    <pic title="match none"/>

    <pic title="match one"/>
    blah
    <pic title="match two"/>
    blah
    <pic title="match none"/>
    <pic title="match three"/>

            blah

    blah,
</document>

My XSL
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="pic">

        <xsl:variable name="identity" select="generate-id()"/>
        <xsl:variable name="next-a-element" select="following::a[generate-id(preceding::pic[1]) = $identity][contains(.,'blah')]"/>

        <xsl:if test="$next-a-element">
            <xsl:comment>pic <xsl:value-of select="@title"/></xsl:comment>
            <xsl:comment>a: <xsl:value-of select="@title"/></xsl:comment>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

My Result

Comment: Given the rewritten XML and a confusing question ... this is the answer I would have given
Comment: Wonderful!  Thank you.  My code situation shifted a bit (thus the delay in response) but this did work for me.  The clever use of the generate-id() to match up the elements did the trick.


Proof by induction that $d^nf(x,y,z)=(adx+bdy+cdz)^n\cdot e^{ax+by+cz}$

Question: We have $f:\mathbb{R^3}\rightarrow\mathbb{R},f(x,y,z)=e^{ax+by+cz}$ and we need to proof by induction that $d^nf(x,y,z)=(adx+bdy+cdz)^n\cdot e^{ax+by+cz}$, where $d^nf(x,y,z)$ is n order differential of $f$, $\forall n\in\mathbb{N^*}$

Here is all my steps:

I noted with $\Gamma_{(n)}: d^nf(x,y,z)=(adx+bdy+cdz)^n\cdot e^{ax+by+cz}$.

Verification step: $$n=1\Rightarrow df(x,y,z)=\left[\frac{\partial dx}{\partial x}+\frac{\partial dy}{\partial y}+\frac{\partial dz}{\partial z}\right]\cdot f(x,y,z)=(adx+bdy+cdz)\cdot e^{ax+by+cz}$$
Demonstration step: We suppose that $\Gamma_{(k)}$ is true and we need to proof that it involve $\Gamma_{(k+1)}$ also true. Hence we need to prove that $\Gamma_{(k+1)}: d^{k+1}f(x,y,z)=(adx+bdy+cdz)^{k+1}\cdot e^{ax+by+cz},\forall x\in\mathbb{N^*}$

How can I prove it?
Comment: Is there an analgous formula for 2 or 1 variables? Can it be obtained by just setting z or z and y equal to a constant such as 0
Answer: you showed it for n=1. Now suppose the for n=k the equality holds so:
\begin{equation}
d^kf(x,y,z)=(adx+bdy+cdz)^k\cdot e^{ax+by+cz}
\end{equation}
so for n=k+1 all we need to do is find the differential of the function \begin{equation}
(adx+bdy+cdz)^k\cdot e^{ax+by+cz}
\end{equation}
or calculate
\begin{equation}
d\left \{ (adx+bdy+cdz)^k\cdot e^{ax+by+cz} \right \} = \\
= (adx+bdy+cdz)^{k} \cdot (adx+bdy+cdz) \cdot e^{ax+by+cz} = \\
= (adx+bdy+cdz)^{k+1}\cdot e^{ax+by+cz},
\end{equation}
which concludes the induction proof.
Comment: How did you arrive at $(adx+bdy+cdz)^n\cdot (adx+bdy+cdz)\cdot e^{ax+by+cz}$ ?
Comment: by the commutative property of total differential $d\left \{ (adx+bdy+cdz)^n\cdot e^{ax+by+cz} \right \} = (adx+bdy+cdz)^{n} \cdot d \left \{ e^{ax+by+cz} \right \}$
Comment: What you mean by "find the differential of the function ..." ? the differential of the function isn't $(adx+bdy+cdz)\cdot e^{ax+by+cz}$ ?
Comment: It means that to go from k to k+1 we need to differentiate one more time
Comment: And if we differentiate one more time we consider $(adx+bdy+cdz)^k$ constant?
Comment: A,b,c depend on x?? If that is the case then we will have to take another approach.
Comment: I don't understand why did you put "or calculate" because I think is same if we calculate differentiate one more time with $d\left\{(adx+bdy+cdz)^k\cdot e^{ax+by+cz}\right\}$


Código alfa numerico MYSQL

Question: quero um código INTERNAMENTE no MySQL um código randômico, com 2 letras,1 numero, 1 letra, 2 numeros

AB-1A-21 - DA-2B-35 - CI-3U-23

como proceder ?
Comment: `varchar`.. pelo seu exemplo, `varchar(8)`
Comment: Amigo, @rLinhares, eu editei a pergunta, o que eu quero na verdade é saber se posso gerar esse código direto no mysql sem ajuda do php.
Answer: O default do AUTO INCREMENT em MySQL é sempre int!
Para o seu caso específico, você precisará criar uma function com os critérios que você menciona acima. A coluna para armazenar o resultado é a varchar(8).
Comment: Você cria uma function: https://dev.mysql.com/doc/refman/5.7/en/create-procedure.html
**CREATE FUNCTION f_increment () RETURNS varchar(8)
-- cria a lógica do hash fazendo select na tabela para ver o max id e incrementa 1
---return hash**

Daí é só utilizar da seguinte forma
**insert into tabela (id,txt,dt) values (f_increment (),'texto',CURDATE())**
Comment: Outra dica é fazer com hexadecimal, onde você pode fazer operações de adição. Veja link: https://dev.mysql.com/doc/refman/8.0/en/hexadecimal-literals.html

Bem trabalhoso essa atividade!
Comment: Carlos, obrigado pela resposta, editei minha pergunta filtrando melhor o conteudo. Eu quero é gerar aquele exemplo numa coluna do mysql de forma randomica. COMO SE FOSSE AUTO-INCREMENT.
Comment: carlos, obrigado pelo seu interesse em ajudar. vou veficicar como fica seu código.
Comment: meu interesse consiste em gerar um numero de facil decoração. por isso dois 2 letras, 1numero+1letra+2numeros. o exadecimal até serve. mais não supre minha expectativa em razao da limitação de letras. isso será impresso em um adesivo e colocado a dispor de outras pessoas. Em breve le apresentarei o sistema, contendo sem duvida uma parte de sua contribuição.
Comment: minha tabela está completa. quero apenas acrecentar essa coluna. e quero que ela tenha os valores no modelo que eu indiquei. são 6 digitos ao invés de 8. não armazenarei os traços.

Código alfa numerico MYSQL


java mysql prepared statement

Question: I'm trying to do a simple insert into a database with java and its telling me my sql syntax is off. But when I copyed the string I printed out and put it into the sql command in phpmyadmin it executes the command properly and I can't seem to figure out whats wrong with my string query in java.
java.sql.PreparedStatement statement;

String physicanInsertQuery = "INSERT INTO physician_phi VALUES(?,?,?,?,?,?,?,?)";
statement = ddp.getConnect().prepareStatement(physicanInsertQuery);

statement.setString(1, "id");
statement.setString(2, "first");
statement.setString(3, "last");
statement.setString(4, "middle");
statement.setString(5, "male");
statement.setString(6, "8179999999");
statement.setString(7, "email@example.com");
statement.setString(8, "1991-5-15");
System.out.println(statement.toString());
statement.executeUpdate(physicanInsertQuery);
statement.close();

This is the query that is printed out before I execute it.
INSERT INTO physician_phi VALUES('FML123','FirstName','LastName','MiddleName','Male','8179999999','firstname.lastname@example.com','1991-2-7')

This is the error its displaying in the console
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?,?,?,?,?)' at line 1
    at sun.reflect.GeneratedConstructorAccessor26.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2819)
    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1811)
    at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1725)
    at command.up.DoctorStore.exec(DoctorStore.java:65)

....

This is the table in the db.
Answer: You're calling the base Statement.executeUpdate(String) method, which has nothing to do with PreparedStatement and simply executes a string of raw SQL.
You need to call statement.executeUpdate() without parameters to use the derived method n PreparedStatement.
Comment: I think I just died inside a little . . . man, why didn't I see that.
Thank you very much for the point out.
Answer: Don't you need a terminating ; on your sql statement. Also you should look into JPA, which will do all this database querying itself

java mysql prepared statement


how to parse multiple rows from a csv file using php

Question: i have 2 .csv files which have first column having similar values, the code which is included does the job only for one row, it does only one iteration, kindly help me modify the code...
hostrefined.csv contents...
name1,23423,detail1
name2,12312,detail2
name3,21312,detail3

hbarefined.csv contents...
name1,det1,det2,2323
name1,det3,det4,23434
name1,det5,det6,34343
name2,det9,det7,232322
name3,det10,det28,232

the output file has to be like

name1,23423,detail1,det1,det2,2323
name1,23423,detail1,det3,det4,23434
name1,23423,detail1,det5,det6,34343
name2,12312,detail2,det9,det7,232322
name3,21312,detail3,det10,det28,232

here goes the code
$handle = fopen("hostsrefined.csv", "r");
$handle1 = fopen("hbarefined.csv", "r");

$fp=fopen('test.csv','w');
while($data1 = fgetcsv($handle1, 1000, ","))
{
while($data = fgetcsv($handle, 1000, ","))
{
    if($data1[0]==$data[0])
    {
        for($s=0;$s<9;$s++)  // to write data from first .csv file
        {

            fwrite($fp,$data[$s]);
            fwrite($fp,",");
        }
        for($s=1;$s<6;$s++)     // to write data frm second .csv file
        {

                fwrite($fp,$data1[$s]);
                fwrite($fp,",");

        }

    }

    fwrite($fp,"\n");
}fwrite($fp,"\n");

}

Comment: What's in the CSV file?
Comment: I don't understood. Can you be more specific?
Comment: please be more specific on what you are trying to do. Your code is very hard to read without further information. Also, some testdata from both csv-files would be good. Do I get it right that you want to create a 3rd csv-file with a subset from csv1 and csv2?
Comment: This is nothing to do with the PHPExcel library, so removing that tag
Comment: Copy the while loop and change `$handle1` into `$handle` or even put the loop into function and pass the handle. then execute the written fucntions twice: first with `$handle1` second time with `$handle`.
Comment: i think there are a ton of things to change in this code before it can do something make sense. i'll wait an edit by the author.
Comment: @GuyT : csv file is a comma seperated value file. a type of Excel file
Comment: @Jojo: yes exactly am trying to make a third csv file from 2 csv files. but the second csv file has duplicate entries for the column 1. Ive added some more information to the code check it out...
Comment: @SUDEEPVICTOR I know that. I was asking what data was inside the files, but I see you've edited your question.
Answer: First, lets debug your script. The problem why you get your desired result only for the first row is obvious if you follow your algorithm and take a closer look on php's file-handling.
You are opening both files at the beginning of your script. PHP sets a file-pointer for each file at the beginning of the file. Let's say at the first line for easier understanding.
Your first while-loop goes through your details-file (hbarefined.csv) where you want to join contents based on your first field that is equal in each file. Then, you start a while-loop that reads each line of hostrefined.csv. If you find the line with your desired primary-key, you join the contents of both lines from hbarefined and hostrefined and write it to test.csv. Here we have the first 2 glitches of your script.

You write a new line to test.csv even if you don't match with your primary-key. Looks ugly in the result.
You are creating your csv-format for test.csv yourself. Don't! Have a look at fputcsv()

What you don't know is that your second while-loop moves your file-pointer for hostrefined.csv one line forward for each iteration, but does not reset it when reaching the end of the file. Because you read through the whole hostrefined.csv for each row of hbarefined.csv, you reached the end after the first iteration of your first while-loop. The second and all upcoming iterations of your first while-loop start reading at the end of hostrefined.csv and will therefor never find a matching line. You need to use rewind() at the end of each iteration of your first while-loop.
$handle = fopen("hostsrefined.csv", "r");
$handle1 = fopen("hbarefined.csv", "r");

$fp=fopen('test.csv','w');
while($data1 = fgetcsv($handle1, 1000, ","))
{
while($data = fgetcsv($handle, 1000, ","))
{
    if($data1[0]==$data[0])
    {
        for($s=0;$s<9;$s++)  // to write data from first .csv file
        {

            fwrite($fp,$data[$s]);
            fwrite($fp,",");
        }
        for($s=1;$s<6;$s++)     // to write data frm second .csv file
        {

                fwrite($fp,$data1[$s]);
                fwrite($fp,",");

        }

    }

    fwrite($fp,"\n");
}
fwrite($fp,"\n");
rewind($handle);
}

That will fix your script.
Some general notes:
Your code is very hard to read, that made it hard for me to debug and fix. Use indentation properly, and use new lines for new commands, consider this for example:
while($data = fgetcsv($handle, 1000, ","))
{
    // ...some code
}fwrite($fp,"\n");

Also, try to be clear with your variable-names. using $s as index-variable in a for-loop 2 times in a row confuses a lot. What is $fp? you get me...
I did a rewrite of your code for your reference:
<?php
/**
 * Goal of this script is to read a csv-file with a primary-key (input-primary.csv)
 * in field 0 and join contents from a second csv-file (input-detail.csv).
 * Each row in input-detail.csv has the primary key from input-primary.csv
 * in field 0 as well.
 * This script needs php version 5.4 o higher
 */

/**
 * First, we define some helper functions
 */

/**
 * Read csv-contents from $filename and return it indexed by primary-key.
 * Primary-key is in field 0
 *
 * @param string $filename file to read
 * @return array
 */
function getCsvContentIndexedByPrimaryKey($filename)
{
    $handle = fopen($filename, 'r');
    $indexedContents = [];
    while (false !== $row = fgetcsv($handle)) {
        $primaryKey = $row[0];
        $indexedContents[$primaryKey] = $row;
    }

    return $indexedContents;
}

/**
 * Joins contents from $row and $indexedContents by index taken from
 * field 0 of $row. Primarykey-field of $row will be unset. If no content
 * was found in $indexedContents an exception is thrown with the primary-key.
 *
 * @param array $row row from input-detail.csv
 * @param array $indexContents result from getCsvContentIndexedByPrimaryKey
 * @return array joined content
 * @throws Exception if no content for $row[0] was found in $indexedContents
 */
function joinRowByPrimaryKey($row, $indexedContents)
{
    $primaryKey = $row[0];
    if (isset($indexedContents[$primaryKey])) {
        $contentToJoin = $indexedContents[$primaryKey]; unset($row[0
        ]); return array_merge($contentToJoin, $row);
    }
    throw new \Exception(sprintf(
        'Primary-key %s not found in indexed-contents', $row[0]));
}

/**
 * Now, here we go.
 */

// we create the indexed-content and initialize our output and error-handling
$indexedContents = getCsvContentIndexedByPrimaryKey('input-primary.csv');
$outputContent = [];
$errors = [];

// now we read the second csv-file
$handle = fopen('input-detail.csv', 'r');
while (false !== $row = fgetcsv($handle)) {
    try {
        $outputContent[] = joinRowByPrimaryKey($row, $indexedContents);
    } catch (\Exception $e) { // we catch the exception from joinRowByPrimaryKey here
        $errors[$row[0]] = $e->getMessage();
    }
}

// Finally, we create our result-file and write our output-content to it
// note the usage of fputcsv @see http://php.net/fputcsv
// there is no need to manually write commas, line-endings and the like
$handle = fopen('result.csv', 'w');
foreach ($outputContent as $row) {
    fputcsv($handle, $row);
}

// and print our errors
foreach ($errors as $error) {
    echo $error . PHP_EOL;
}

Code with sample csv-files is on github as well: https://github.com/jbrinksmeier/so-28431197
Enjoy


This element neither has attached source nor attached Javadoc and hence no Javadoc could be found

Question: I am having this problem using Jsoup in Eclipse. I have attached the following jar files:
jsoup 1.7.2.jar
jsoup 1.7.2.javadoc.jar
jsoup 1.7.2.sources.jar
I have added these jar files as external jar files in the configuration path and have linked them to the C:\USERS drive where I stored the files. The program has no errors but when I run it I get the NullPointerException error on this line "Element gameElement = firstLottoRow.child(1);" or any other line of code like this that is using Jsoup to parse HTML from the URL.
I am getting the "element neither has attached source nor attached Javadoc and hence no Javadoc could be found" with the line of code: "Element tbody = table.getElementsByTag("tbody").first();"
Am I doing everything right in terms of my configuration path linking to the jsoup jar files, or could anyone please suggest what I am doing wrong?
Thanks so much for any help!
Here is the Jsoup code:
<code>private LotteryDraw extractLotteryDraw(String html) {

        LotteryDraw lotteryDraw = new LotteryDraw();

        Document doc = Jsoup.parse(html);

        Elements elements = doc.getElementsByClass("drawhistory");
        //System.out.println(elements.toString());
        Element table = elements.first();
        Element tbody = table.getElementsByTag("tbody").first();
        Element firstLottoRow = tbody.getElementsByClass("lottorow").first();

        Element dateElement = firstLottoRow.child(0);
        System.out.println(dateElement.text());

        Element gameElement = firstLottoRow.child(1);
        System.out.println(gameElement.text());

        Element noElement = firstLottoRow.child(2);
        System.out.println(noElement.text());
        String[] split = noElement.text().split(" - ");

        int[] numbers = new int[split.length];

        int i = 0;
        for (String strNo : split) {
            numbers[i] = Integer.valueOf(strNo);
            i++;
        }

        lotteryDraw.setNumbers(numbers);
        Log.v("DEBUG", "the value of numbers is " + numbers);
        Element bonusElement = firstLottoRow.child(3);
        Integer bonusBall = Integer.valueOf(bonusElement.text());

        lotteryDraw.setBonusBall(bonusBall);
        Log.v("DEBUG", "the value of numbers is " + numbers);
        return lotteryDraw;
</code>
Answer: Instead of adding the src and javadoc jar files as external jar attach them to the jar with the classes as source or javadoc attachment.
Right click on the library jar and select "Properties". In the dialog that opens specify the location of the source and/or javadoc jar.
Comment: Sorry so this still isnt working. I went to the jsoup 1.7.2. javadoc.jar file under referenced libs, right clicked it brought me to a screen headed Java Source Attachment asks to select location of (folder/jar/zip) I selected external location as thats where I have it stored, in the C:\ drive. when I chose workspace location I wasnt able to locate it as its not there. what am I doing wrong?
Comment: Click on "External File ..." and select the jar you want to attach.
Comment: i did the jar is in the libs folder but it still not recognised
Comment: Try to restart Elipse
Comment: I tried this. I saved my applications, closed eclipse, went into the C:\ drive copied jar files in question directly into the libs folder under the workspace folder for my application, opened Eclipse again and I have a red exclamation mark on every project folder that I have been developing, apart from the one that I am currently having this problem with. I have no idea why this has happened. The other projects dont have errors in the program but when I try to run it, it says theres errors that need fixed. My problems have really escalated now!
Comment: Thanks for your advice though @Henry I do appreciate it, especially as I am new to the software development field!
Comment: The other projects use these jars as well? Otherwise this seems to be an unrelated problem.


android : Error using Tab Layout

Question: I am trying to implement TabLayout in an Activity, and I keep on getting error for it.
My main_new.xml XML file is :
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/tabHost">

<TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" />

<LinearLayout android:id="@+id/tab1" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="50dp">
     <TextView android:layout_width="fill_parent"
        android:layout_height="100px"
        android:text="This is tab1"
        android:id="@+id/txt1"/>

</LinearLayout>

<LinearLayout android:id="@+id/tab2" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="50dp">
     <TextView android:layout_width="fill_parent"
        android:layout_height="100px"
        android:text="This is tab2"
        android:id="@+id/txt2"/>

</LinearLayout>
</TabHost>

My Activity class is :
public class UltimateActivity extends Activity implements OnClickListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_new);
    TabHost tabHost = (TabHost)findViewById(R.id.tabHost);
    tabHost.setup();

    TabSpec spec1 = tabHost.newTabSpec("Tab 1");
    spec1.setContent(R.id.tab1); // Here iis where the errror points
    spec1.setIndicator("Tab 1");

    TabSpec spec2 = tabHost.newTabSpec("Info");
    spec2.setContent(R.id.tab2);
    spec2.setIndicator("Info");

    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
}

}
Manifest file contains :
        <activity android:icon="@drawable/icon" android:label="Ultimate" android:name="UltimateActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

ERROR I get :
 05-18 22:13:56.072: ERROR/AndroidRuntime(634): Uncaught handler: thread main exiting due to uncaught exception
 05-18 22:13:56.083: ERROR/AndroidRuntime(634): java.lang.RuntimeException: Unable to start activity ComponentInfo{orange.android.vpn/orange.android.vpn.UltimateActivity}: java.lang.RuntimeException: Could not create tab content because could not find view with id 2131296290
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.os.Handler.dispatchMessage(Handler.java:99)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.os.Looper.loop(Looper.java:123)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread.main(ActivityThread.java:4363)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at java.lang.reflect.Method.invokeNative(Native Method)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at java.lang.reflect.Method.invoke(Method.java:521)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at dalvik.system.NativeStart.main(Native Method)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634): Caused by: java.lang.RuntimeException: Could not create tab content because could not find view with id 2131296290
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.widget.TabHost$ViewIdContentStrategy.<init>(TabHost.java:587)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.widget.TabHost$ViewIdContentStrategy.<init>(TabHost.java:578)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.widget.TabHost$TabSpec.setContent(TabHost.java:435)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at orange.android.vpn.UltimateActivity.onCreate(UltimateActivity.java:20)
 05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-18 22:13:56.083: ERROR/AndroidRuntime(634):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
05-18 22:13:56.083: ERROR/AndroidRuntime(634):     ... 11 more

I use SDK 1.6 and in my manist also have android:minSdkVersion="4" . I have used http://www.codeproject.com/KB/android/AndroidTabs.aspx for Tab tutorial.
Can anyone help me know the error. I have spend hours in this error. Any help is highly appreciated. Please try to help soon.
Thanks
Answer: You don't have any component in your layout with id tabhost.
Added the code to change here
Try this
TabHost tabHost = getTabHost();

in your code instead of
(TabHost)findViewById(R.id.tabHost);

Comment: The id of TabHost is android:id="@+id/tabHost" . TabHost component was somehow not coming properly in this editor. I changed the code and replaced <TabHost with (TabHost to show the code.
Comment: My activity extends "Activity" and not "TabActivity". So I don't have access to getTabHost()
Answer: My 1 mistake in xml file :
I had closed Framelayout insteead of closing it after full layout.
That was my mistake. I found it and the problem is solved.
Thanks a lot to everyone for viewing it.
@yogsma, Thanks for taking efforts to help me out.
Thanks
Comment: Can the tab height I mean the part where we provide Image and text as "Tab 1" be of less height. Like just the height of text or I can set the height of it.

android : Error using Tab Layout