NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - bshields

Pages: [1] 2
1
Web Server - Ask For Help / Reorder
« on: August 08, 2020, 09:53:26 PM »
Hi All,

Just thought I share something i have to do from time to time.

Often we have a browse that the customer is allowed to order. In the past (because I'm lazy) I often just give them, up and down arrow buttons and let them slide things around for themselves. I know its crap, my customers know its crap, its all crap.

I've done drag and drop before, so i decided it was time to do it properly... Well not really, a respected customer asked me to do it better.

In the attached screen cap. You can see both methods. On the right you can see the up and down arrows. On the left you can see a hamburger menu (also often used as a gripper).

You can drag the gripper and drop the row into the correct place.

It requires a couple of steps:

1. Create the gripper
2. Add some JS to do the browser side bit
3. Add some Clarion to do the server side bit
4. Write some clarion to reorder your table, given what they dragged where.

1. The Gripper

My gripper is just a column in my table and i create the html for it. I put this in "value:: Start" embed. Usual stuff. Make sure you tick allow XHTML in the column.

Drag# += 1
DragHandle = '<div id="PresentItemDrag_'&PIt:SysID&'" draggable="true" ondragstart="drag(event,'&Drag#&')" ondrop="drop(event,'&Drag#&')" ondragover="allowDrop(event)"> <i class="fas fa-bars"></i> </div>'


2. Some Client Side JS

I added mine into the HTML section before form

<script>
function drop(e,idx) {
  e.preventDefault();
  var data=e.dataTransfer.getData("Text");
  sv('','presentitemtable_presenttablepanel','','_refresh_=current','move='+data+','+idx+','+'<!-- Net:s:PRE:SysID -->','_parentproc_=presenttablepanel');
}

function drag(e,idx) {
  e.dataTransfer.setData("Text",idx);
}

function allowDrop(e) {
  e.preventDefault();
}

function handleDragEnter(e) {
  this.className = 'over';
  return false;
}

function handleDragLeave(e) {
  this.className = '';
  return false;
}
</script>


For your reference my table is PresentItemTable and its contained within a memory form PresentTablePanel. You'll have your own.

I am ordering a child file (a bit like the old invoice and line items example ie 1:MANY). PRE:SysID is my parent record SysID. I know its already in the SessionQueue.

3. Clarion on the Server to catch the reorder

I use the browse table itself to capture when the client tells me to do a reorder. There might be better ways, but works for me. I like to keep this stuff grouped together.

In Embed ProcedureSetup:

  IF p_web.IfExistsValue('move') = True
    ProcessPresentItemActions(p_web)
    RefreshAnyParent(p_web)
  .


4. My Reorder Code

Its done in ProcessPresentItemActions(p_web) and it collects to, from and parent sysid from the values passed by javascript.



Not sure if this is something others are doing in a different way. Just thought I'd share. I haven't explained it all, so there is still some mystery for the adventurous!

It's all part of my new idea of being nice to my users :)

Regards
Bill


2
Hi All (Probably Bruce),

I've got a tricky problem.

We use Mandrill to transport large volumes of emails roughly 200k emails per month.

Mandrill has a webhook where it POSTs back into our system some events in json (but URL encoded).

Nothing weird so far.

If the post data is large, say > 1Mb of json data (URL Encoded) the web server maxes out a CPU (and will continue to do so if more POSTs arrive). This does not happen if the POSTs are small (kilobytes, not megabytes).

I think if we wait long enough (hours) the thread may complete what its doing, but Mandrill has given up waiting for a response.

Important observations are:

1. Happens in NT10.40 & Clarion 10
2. Happens in NT11.30 & Clarion 11
3. Doesn't get to the NetWebPage code that is waiting to process the data (does get there if the payload is small).
4. If Ii simulate the POST via Postman it fails in the same manner as a POST direct from Mandrill.
5. If I decode the URL encoding and simulate the POST via Mandrill everything works as expected.

I suspect the built-in URL decoding system in NetTalk is not happy with the obscene amount of POST data that is requiring decoding > 1Mb.

I've attached a cut down APP that will hopefully compile (C11/NT11.30 - you might have to cut out some missing icons etc). But its just an empty web server with 1 Proc called MandrillHook (which doesn't even execute if the payload is large).

More importantly I've included a postman collection with the original post as it arrives from Mandrill that fails and another post that does the same thing but as i've already URL decoded the payload (and replaced & with + just to make sure it behaves the same as the first post) it succeeds.

Any help would be appreciated!

Regards
Bill





3
Web Server - Ask For Help / SSL Certificates and many domains
« on: November 27, 2018, 03:54:50 PM »
Hi All,

Does anyone know what the limit on number of ssl certificates NT10 supports?

I have a NT10 web server that hosts many websites. They are just normal websites (not NT apps, but normal websites with a type of scripting language built within NT/Clarion) served via NT.

Its time I move them all to SSL. However, from memory NT supports a finite number of certificates. Is it a number or a string length, I just need to know to see if its going to work for me, given the number of websites this server is hosting.

Also, does anyone know a way to force nettalk to support ssl and non-ssl at the same time when multiple domains are used (some ssl some not). As soon as I turn on the SSL server and provide a hostname, if a domain doesn't match any hostnames, NT still tries to redirect to SSL and obviously this doesn't work as this domain doesnt support SSL.

If the limit is low (say less than 100), does NT11 support more? With NT11 do I get more granular control of domains and ssl (the hostname stuff appears to be down within the no-source code part of NT).

Regards
Bill

 

4
Web Server - Ask For Help / Small Bug
« on: July 29, 2018, 06:37:50 PM »
Hi Bruce,

Just a small bug.

I'm on NT10.25.

NetWeb.TPW Line 15340 reads:

loc:RecordExtra.append('data-nt-insert="%nInsertProcedureIs"')

Should read:

loc:RecordExtra.append(' data-nt-insert="%nInsertProcedureIs"')

Its generating invalid XHTML when using different insert procedures based on conditions within the Browse.

Regards
Bill



5
Web Server - Ask For Help / div layouts
« on: March 23, 2018, 07:24:23 PM »
Hi Bruce,

I'm experimenting with the div layout model (and responsiveness) and all is progressing pretty well.

However, I have a small request. I need class access to the top div for a procedure field.

You name its css id %procedure_%FormFieldProcedure_embedded_div, i'd like the %FormFieldClass added as the class for the div.

Obviously, its not urgent as I edited the template myself so i can carry on.

Regards
Bill


6
Web Server - Ask For Help / Load Balancing
« on: March 04, 2018, 12:38:05 AM »
Hi All (Bruce),

I'm setting up our Load Balancer again now we've updated to NT10.

The Load Balanacer passes the Client IP to my NetTalk Worker EXEs via the X-Forwarded-Proto header. I can see you are reading it from the header (but not sure what you do with it after that).

My question is, don't I really want it to become the defacto IP, and therefore the SessionIP?

Since any client changing its IP while on an active session should get an error 403, but behind my Load Balancer all clients come from the Load Balancer IP.

Also, we use the IP in logs and other areas within our actual application, I can of course edit the code to utilise the Forwarded IP (if present).

But I was curious what your thoughts were?

Regards
Bill


7
Web Server - Ask For Help / Thread Pool
« on: February 28, 2018, 04:52:05 AM »
Hey Bruce,

Thanks for the Thread Pool!

I converted our system from NT7 to NT10 during DevCon 2017. Took another 4 months to get it through QA. Finally got it released today.

Just wanted to say its working great. I'll try and measure the "real world effect" of the Thread Pool shortly, but in my testing its noticeable.

Cheers :)

Bill

PS> I owe you a beer (or maybe a whole Brewery)

8
Web Server - Ask For Help / Problem with locators
« on: January 12, 2018, 03:24:27 AM »
Hi,

I'm having a problem with locators in 10.11.

If the locator is a "Position" Type (other locator types work) and the field we are locating on is not in the database, but rather a local variable the filter expression that NetTalk creates includes the local field rather than the "Locate on Field(s)" variable.

This used to work in 7.40!

I have temporarily hacked the template to work around the issue for the time being, but perhaps something has changed and I'm using it wrong (not that I changed anything from 7.40 to 10.11).

I can see Bruce has changed the way the .SetView method works, specifically with regard to "LocateOnField(s)", so  it could just be a bug.

Regards
Bill


9
Web Server - Ask For Help / Drag and Drop Upload
« on: October 26, 2017, 04:06:48 PM »
Hi Bruce,

I noticed a JS error when doing file upload using drag and drop (the button method works ok). I was testing in Chrome, but also appears in other browsers.

I checked Example #26 and the problem exists in it.

The js error in the console is: "Uncaught TypeError: options.form.prop is not a function".

Regards
Bill

10
Web Server - Ask For Help / Wildcard Certificates
« on: October 23, 2017, 06:16:51 PM »
Hi,

In NetTalk 10.08 there have been some changes to certificates. Anyone know how to do wildcard certificates?

They are normally named:

*.domain.com

So my key and crt files would be:

*.domain.com.key and *.domain.com.crt

But thats not going to work as a filename.

Anyone dealt with this in NT10?

Regards
Bill Shields

11
Web Server - Ask For Help / CSS Issue with Browse pages
« on: October 25, 2013, 05:11:01 AM »
Hi Bruce,

Just a small issue with CSS.

When adding a field in a NewWebBrowse that has sorting disabled, it doesn't generate the "Header DIV". Obviously you don't need the DIV as there is no click code required, but as just plan THs have CSS Style limitations, I'd really like to have the DIV generated with the "Header DIV" class so i can style my non-sorting headers.

Column with sorting HTML

<th id="head_3" class="nt-browse-header-not-selected ui-corner-top">
  <div data-do="sh" class="nt-right nt-fakeget">
    <a data-value="3" title="Click here to sort by cost">Cost</a>
  </div>
</th>

Column without sorting HTML

<th id="head_4" class="nt-browse-header-not-selected ui-corner-top">Retail</th>


I'd like to see:

<th id="head_4" class="nt-browse-header-not-selected ui-corner-top">
  <div class="nt-right">Retail</div>
</th>



I know this is really fiddly and I can clumsily style it via the THs ID, but that will break if i reorder columns.

I'm still on NT71.8 so maybe its changed in recent builds.

Regards
Bill Shields


12
Web Server - Ask For Help / Small Bug
« on: August 27, 2013, 05:15:15 PM »
Hi Bruce,

Just a very small bug: When you override the CSS for a table and specify a greenbar effect, this is wiped out by other overridden greenbar effects from any children tables. Since the gb effect is set via jquery at the footer of the table (which happens to be after the children tables are generated).

I am merrily working around it by resetting the gb effect immediately prior to the settings being used, rather than at the beginning of the table.

Regards
Bill



13
Web Server - Ask For Help / Plupload and NT7
« on: August 07, 2013, 05:38:36 AM »
Hi,

In one of my apps I have been using Plupload (http://www.plupload.com/) for fancy multifile uploading.

It has all been working fine, but i've upgraded to NT7.18 and now its not working.

Its all a bit complicated and i'm just after some clues as to where to start diagnosing.

The plupload system is still working and is doing a POST like it used to, at the moment the NT server doesn't save the file.

In NT6.37 I just created a NetWebPage (which is where the plupload POSTs to) and the NT Server would save the file - magically :) - and my code inside the NetWebPage would then resize, move, etc.

Everything still operates as it did before, except the file is no longer "magically" saved anywhere for me.

My question, is with all the changes to the uploading system, is there anything I need to do let the NT Server know that I want the file saved when it is part of a normal POST (that essentially originates outside NT - well via a JS library).

Oh, and I do like the work thats been done, on the upload system, and I now use it for more normal upload stuff, but the plupload system, is sexy and I want to continue to use it so replacing it with the new system is only a very last resort.

Regards
Bill

14
Web Server - Ask For Help / https scripts and styles
« on: August 10, 2012, 10:20:54 PM »
Hi Bruce,

Just a tiny bug, NetWebServer.AddScript and NetWebServer.AddStyle check for http: and don't prefix / but it doesn't do it for https:.

Regards
Bill

15
Web Server - Share Knowledge / Performance & Reliability
« on: November 18, 2010, 11:17:54 PM »
Hi All,

Just thought i'd share something.

I stumbled over one of our NetTalk servers today, one that i don't pay much attention to.

I'd restarted the server just under three weeks ago due to a software upgrade.

Today I just happened to check the console to find that in about 19 days its process 1,328,000+ pages. Now i know thats only 2907 pages an hour, or roughly one a second.

What surprised me was the combination of it being a pretty busy little server plus its reliability, it never fails.

Regards
Bill

Pages: [1] 2