SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39
  1. #26
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You do realise I'm using asyncronous javascript to fire server-side code? My understanding with .NET so far is you use the postback to fire events. Does this require javascript to work live? At the moment I just add ?live=1 or ?live=2 to get the same script to do the same thing but with javascript. If ?live is not there then the output is expected as HTML.

    "I believe you are missing the point wwb_99 is making" I think I must be! And that is what I don't like about .NET
    After programming for 10 or so years, it's confusing the hell out of me! This page didn't help either http://msdn.microsoft.com/en-us/magazine/cc301332.aspx. It is so different from PHP and classic ASP. I want to program in basic. NET is far from basic. I can't even get a simple function to work. I don't care about speed, my PHP is compiled and is lightning fast. Why can't they just add a compiler for classic asp in the same way?

    So with .NET I can call 2 functions simultanously with one connecting to a remote server and the other connecting to a database. How would I program such I thing to run at the same time? They can't take up the same lines of code? Could someone give me a small example of an asyncronous server side script? It may help me understand better. How would I get the results from one and pass it to the other? Or do I wait for both to get processed and do something with the results. I think line by line, both PHP and ASP are coded like that.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  2. #27
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Markdidj View Post
    You do realise I'm using asyncronous javascript to fire server-side code?
    That doesn't matter. The HTTP server handles that aspect of supporting that not ASP. But you are still confusing client-side functionality with server-side functionality. As for why .NET is so hard for you to grasp is because it is a different programming paradigm. You only think in an imperative (procedural) style of programming, which you define a series of linear steps to be accomplished. .NET however, C# in this case is an object-oriented language at its core. It requires a different train of thought with switching between the two paradigms.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #28
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When I researched, object orientated programming is slower than pocedural so I continued with the style I was accustomed to, even though the code was spaghetti like. Is that not the case? I suppose multithreading helps the speed?

    A quick search on .NET postback had this in the first page http://www.evagoras.com/2011/02/10/h...ks-in-asp-net/ so it does require javascript and I don't need this when I use my version of async javascript. The method works with any server side code, so I don't need a different method between PHP, Perl and ASP. I can even use it to talk to different servers running different languages. It helps me to create websites that work with or without javascript without cluttered or repeated code. They all work the same. I wil be using the same method when I move to .NET, if I ever get a decent grasp of it. It fits well with the style of coding for websites that I create. I even noticed that when js is disabled it still loads the files so I start off with a minimal script that calls the main server coded js file onload.

    "But you are still confusing client-side functionality with server-side functionality". I don't think I'm confusing website functionality though. Make it work without javascript and enhance with what I have been calling LiveScript. (server scripted live javascript). If you have the understanding of both javascript and any client-side script you can make some awesome interactive websites with it.

    If I use the postback method I am including server and client code in the same script. I don't see the point of putting client side calls and methods in the server side script when javascript may not be available. For me, only the output needs to change depending on how the script is called.

    The only thing I like about .NET is the OOP, making it easier for me to make my programming simple to follow by others, but OOP isn't neccessary for a good website.

    Check out the execution times using the different methods in my PHP script (www.unitingrhythms.com/home/statistics) The HTML hits are ones requested using a normal link. the manual times are ones that have had ?live=1 added to the URL, and are fired using manual input (onclick etc), The automatic ones are ones that have ?live=2, they require a ?live=1 first, which then gets replaced with live=2 before being called using setInterval or setTimeout. The stats on my livescript website, www.livescript.co.uk/live/statistics/ are really poor, which is the only reason why I want to go with .NET as it compiles my script and would make it faster.

    I don't want to change the way I code, I just want to change language to .NET. Not easy though.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  4. #29
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    *face plus desk* Forget it...its like trying to talk to a brick wall. No offense but it really is.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #30
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When I answer questions here on sitepoint I'll either show an example or post one. You haven't added ANYTHING to my knowledge logic_earth, just put me down!

    I've even asked a few times. Lets see your asyncronous aspx example
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  6. #31
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    The XML part of ajax was just tossed in to complete the acronym.
    Just to let you know, if it doesn't have XML in, then it's not AJAX. I came up with asyncronous javascript here at sitepoint before AJAX was invented, and I called it LiveScript. They applied for copyright of AJAX about 3 months after.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  7. #32
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Markdidj View Post
    When I answer questions here on sitepoint I'll either show an example or post one. You haven't added ANYTHING to my knowledge logic_earth, just put me down!

    I've even asked a few times. Lets see your asyncronous aspx example
    wwb_99 gave you one. Running code in parallel. "...requests something from a remote service and a database. How I'd typically do this in .NET is fire off an asynch request to the remote service and an asynch request to the database, letting the remote calls run in parallel..." But you are stuck thinking Javascript has any bearing on your service side code. You are completely confusing client-side functionality with server-side functionality. Just because Javascript can do things in a async way does not mean Classic ASP can. That is not what you are getting. You are stuck on Javascript.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  8. #33
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That's why I'm not getting it though. I understand asyncronous javascript, they work in parallel independant of each other. I cannot get the results from either script until both are returned, and one asynconous call cannot interact with another.

    I don't get how that is possible in server side language as I have to check the returned data. With asyncronous javascript the requested files trigger the events directly to the current script. I can't control which one fires first. With javascript I also have timing scripts (setTimeout or setInterval) that I can use to check all asyncronous commands have finished. Which is why I'm not getting this asyncronous server-side code. How do I know that all asyncronous commands are finished without a timing script, and if I don't use a timer how can asyncronous server commands interact with the same data when both get returned at unknown times.

    I think the bit "send an async request to a remote server" is part of the confusion
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  9. #34
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    They are called "callback" (or events) Javascript supports these as well...I'm surprised you haven't used those yet in Javascript...
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  10. #35
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks logic_earth. I do, but didn't know the technical terms. This gave me insight http://recurial.com/programming/unde...in-javascript/
    Have been using them for ages in events, and beginning to understand now. As I don't use XML I haven't had to use callbacks when doing similar things to AJAX. I have no XML returned, but javascript, the last line of which fires the next function in the caller script. There are loads of more complicated ways of doing what I do, ajax, xajax, ajazed etc.

    Is the difference between ASP and ASP.NET callbacks in .NET work while the rest of the script executes, creating new threads, and asp will wait for the result of one to execute the next step?
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  11. #36
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Philippines
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb AJAX and COM+ (client-side and server-side simultaneously)

    @Markdidj ;
    "You do realise I'm using asyncronous javascript to fire server-side code?"
    "The only thing I like about .NET is the OOP, making it easier for me to make my programming simple to follow by others, but OOP isn't neccessary for a good website."

    You got a VERY good point here.

    @logic_earth
    ".NET however, C# in this case is an object-oriented language at its core. It requires a different train of thought with switching between the two paradigms."
    "They are called callback (or events) Javascript supports these as well...I'm surprised you haven't used those yet in Javascript..."

    Yes, javascript (eventually AJAX) will switch the client-side to server-side (ASP) eventuality. And it is the main train.

    Let me point out some codes here (javascript/AJAX calling a server-side classic ASP, tied with a COM+ dll)

    accountNameSearch.JS
    Code:
    var a;
    /* Searching Customer Name Records */
    function srchCustName(varName){
    	if(varName.length>0){
    		var b="accountNameSearch.asp?sid="+Math.random()+"&qAction=iNFO&qCustname="+varName; 
    		a=GetXmlHttpObject(nameResult);
    		document.getElementById("nameDiv").style.display='';
    		document.getElementById("nameDiv").innerHTML="<img src='/images/arrow.gif'/>";
    		a.open("GET",b,true);a.send(null);}
    	else{
    		document.getElementById("nameDiv").style.display='none';
    		document.getElementById("nameDiv").innerHTML="";}}
    
    function nameResult(){
    	if(a.readyState==4||a.readyState=="complete"){
    		document.getElementById("nameDiv").innerHTML=a.responseText;}}
    /* Asynchronous Javascript browser picker */
    function GetXmlHttpObject(handler){
    	var d=null;
    	if(navigator.userAgent.indexOf("MSIE")>=0){
    		var e="Msxml2.XMLHTTP";
    		if(navigator.appVersion.indexOf("MSIE 5.5")>=0){
    			e="Microsoft.XMLHTTP";}
    		try{
    			d=new ActiveXObject(e);
    			d.onreadystatechange=handler;
    			return d;}
    		catch(e){
    			alert("Browser Error. Unable to perform AJAX feature");
    			return;}}
    			
    	if(navigator.userAgent.indexOf("Mozilla")>=0 || navigator.userAgent.indexOf("Opera")>=0){
    		d=new XMLHttpRequest();
    		d.onload=handler;
    		d.onerror=handler;
    		return d;}}
    accountNameSearch.ASP
    Code:
    <%
    'Function: to Trim the spaces in the string and convert to Uppercase
    Function UpCase(StringtoBeUppercase) 
    	UpCase = UCase(Trim(StringtoBeUppercase))
    End Function
    Dim action, itemResults, sessID, acctNo, acctName
    action = trim(request.QueryString("qAction"))
    if action = "iNFO" then
      sessID = session("sessionUsrID")
      acctNo = ""
      acctName = UpCase(request.QueryString("qCustname"))
      tmpAcctName = acctName
      itemResults = "<div style='background:#fff; border:1px #ccc solid; margin-left:1px; width:400px;'><table width='100%' cellpadding='2px' cellspacing='2px'>"
      if tmpacctName <> "" then
        '
        'COMponent in DLL form (installed using COM+)
        stat = banksObj.searchAccountName(tmpAcctName, acctNo, sessID)
      end if
    	
      if stat ="00" then
        for ctr = 1 to 15
        '
        'COMponent in DLL form (installed using COM+)
          stat = banksObj.searchAccountName(acctName, acctNo, sessID)
          if stat <> "00" then
            exit for
          else
            if ctr mod 2 then
              itemResults = itemResults + "<tr bgcolor='#eeeeee'>"
            else
              itemResults = itemResults + "<tr bgcolor='white'>"
            end if
            itemResults = itemResults + "<td style='width:270px'><a href='nameSearch.asp?qFunc=jxSelected&qAfid894nxo=" & trim(acctNo) & "&qNm98ns7hsi3=" & trim(server.URLEncode(acctName)) & "' style='font-size:12px; color:#6633ff; font-weight:bold;'>" & trim(server.HTMLEncode(acctName)) & "</a></td><td align='left' style='width:130px;'>&nbsp;" & trim(acctNo) & "</td></tr>"
          end if
        next
      else
        if tmpacctName <> "" then
          itemResults  = "<tr><td><h5 style='color:red; padding-left:5px;'>No customer accounts found....</h5></td><tr>"
        end if
      end if
      itemResults = itemResults + "</table></div>"
      response.write(itemResults)
    end if
    %>
    The code is a very powerful classic ASP that is tied to a COM+ wrapper (created DLLfile - Cobol in my case, it is not even C#). You can create a <form>... </form> that could use the accountNameSearch.JS to invoke the second ASP (in this case accountNameSearch.ASP to get the account name being type in a form using onKeyUp="srchCustName(this.value)" javascript event. With this simple code, a pop-up box may even be used to display the names in your back-end server-side database.

    At this point, I think "Markdidj" has a very good point that you do not need an OOP to create a Google thing autosearch box.

  12. #37
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by infoRene View Post
    ...you do not need an OOP to create a Google thing autosearch box.
    No body said that you did need OOP...No one said anything about that. But you did prove wwb_99's point which he was trying to make: "You just can't do that inside classic ASP without getting into building C++-based COM DLLs." With (ASP).NET you do not have to do that.

    You don't want to use C# and its OOP style programmatic fine, pick from one of the many .NET based languages. VB.NET, C++/CLI (Managed), F#, J#, JScript .NET, Axum, A#, Boo, Cobra, M, Oxygene, IronScheme, IronLisp, IronPython, IronRuby, Nemerle, Phalanger (PHP), P#, Scala, etc. A lot of .NET languages to pick from.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  13. #38
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Please show me an example so I stop puzzling over this. It's doing my head in
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  14. #39
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Philippines
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "But you did prove wwb_99's point which he was trying to make: "You just can't do that inside classic ASP without getting into building C++-based COM DLLs." With (ASP).NET you do not have to do that"

    @logic_earth; Yes I got the point... and this is the power of classic ASP that most are not ready to abandon yet. A powerful "online solutions" (this is more than a website) must be associated with a COMponent wrapper via COM+. The only disadvantage of classic ASP is that you will have an "unmanaged" code outside the ASP/HTML codes which cannot be edited easily... well, in a financial institution this is quite an advantage when it comes to security though. It is a two-fold situation.

    Except by the way if we are talking financial institutions.... Cobol (laguage) COM wrapper is also a great advantage. Sample site below is an example of Cobol COM+/AJAX/classic ASP coding.

    Markdidj; The sample code I previously posted is the main soul of AJAX/classic ASP/COMponent wrapper (DLLs). To make the entire topic/or reader be contented with the codes, below site can be viewed;
    http://180.192.91.94/customersearch.asp

    Sorry though that the site above is available only from 9am to 6pm Hongkong time.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •