topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday November 30, 2021, 5:33 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

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.


Messages - OptimalDesigns [ switch to compact view ]

Pages: [1] 2next
1
I have a form with multiple checkboxes.  When at least one is checked or unchecked, need to enable/disable some input elements.  This form is a listing of available classes an individual could sign up for.  If no checked checkbox then show no username, email, nor submit elements;  Otherwise, show these 3 elements.  Here is some code:

<!DOCTYPE html> <html> <head> </head> <body>
  <form name='calculusclassform' method="post" action="">
    <fieldset>
      <legend>Choose your <b>Class</b> interests</legend>
      <input type="checkbox" id="oil" name="interest[]" value="Oil Refinery Optimization" onchange="handleChange();">
      <label for="oil">Oil Refinery Optimization</label>
      <span>Crude oil ...</span>
      <input type="checkbox" id="curvfit" name="interest[]" value="Curve Fitting Data sets" onchange="handleChange();">
      <label for="curvfit">Curve Fitting Data sets</label>
      <span>Have a curve fitting problem? ...</span>
      <input type="checkbox" id="coding" name="interest[]" value="Calculus-level Coding" onchange="handleChange();">
      <label for="coding">Calculus-level Coding</label>
      <span> languages ... </span>
      <h3>Classes are free, but in return, we ask you to share these class offerings with 5+ others.  Thanks.</h3>
      <span>             Name:</span>
      <input type="name" name="username" id="username" disabled><br>
      Email Address:
      <input type="email" name="email" id="email" disabled><br><br>
      <input type="submit" value="Submit" id="submit" disabled>
    </fieldset>
  </form>

  <script>
    function handleChange(cb) {

    var checkboxes = document.getElementByName("interest[]").checked;
    var user = document.getElementById("username");
    var email = document.getElementById("email");
    var submit = document.getElementById("submit");
   
  for (var i = 0; i < checkboxes.length; i++) {
  display("Changed, new value = " + cb.checked);
 //     echo("You did select at least one check box.");
        user.disabled = false;
        email.disabled = false;
        submit.disabled = false;
    else {
 //     echo("You didn't select any check boxes.");
        user.disabled = true;
        email.disabled = true;
        submit.disabled = true; }
}
function display(msg) {
  var p = document.createElement('p');
  p.innerHTML = msg;
  document.body.appendChild(p);
}
  }
  </script>
</body> </html>

2
Developer's Corner / How to tell if any check boxes are checked?
« on: July 16, 2020, 06:54 PM »
I have several check boxes a user can select for various classes. If one or more check boxes are selected, then ooo . Please test it. Here is the html code at present:
</script>
    function myHideShow() {

    var checkboxes = document.getElementById("interest[]");
    var user = document.getElementById("username");
    var email = document.getElementById("email");
    var submit = document.getElementById("submit");

    if ((checkboxes.checked)) {
//      echo("You didn't select any check boxes.");
        user.disabled = true;
        email.disabled = true;
        submit.disabled = true; }
    else {
//      echo("You did select at least one check box.");
        user.disabled = false;
        email.disabled = false;
        submit.disabled = false;
    }
  }
</script>

<!DOCTYPE html> <html> <head> </head> <body>
  <form name='calculusclassform' method="post" action="">
    <fieldset>
      <legend>Choose your <b>Class</b> interests</legend>
      <input type="checkbox" id="oil" name="interest[]" value="Oil Refinery Optimization" onclick="myHideShow()">
      <label for="oil">Oil Refinery Optimization</label>
      <span>Crude oil ...</span>

<p id="text" style="display:none">Checkbox is CHECKED!</p>

      <input type="checkbox" id="curvfit" name="interest[]" value="Curve Fitting Data sets" onclick="myHideShow()">
      <label for="curvfit">Curve Fitting Data sets</label>
      <span>Have a curve fitting problem? ...</span>
      <input type="checkbox" id="coding" name="interest[]" value="Calculus-level Coding" onclick="myHideShow()">
      <label for="coding">Calculus-level Coding</label>
      <span> languages ... </span>
      <h3>Classes are free, but in return, we ask you to share these class offerings with 5+ others.  Thanks.</h3>
      <span>             Name:</span>
      <input type="name" name="username" id="username" disabled><br>
      Email Address:
      <input type="email" name="email" id="email" disabled><br><br>
      <input type="submit" value="Submit" id="submit" disabled>
    </fieldset>
  </form>
</body> </html>

Running this JS script code if ((checkboxes.checked)) is my problem. Ideas? Trying to test if any checkboxes are checked.

3
But, where is the logic to decide which checkboxes are checked?

Here is some php code I'm working on ...
<?php

if(isset($_POST['submit'&#93;) ){
  
if( empty($username) | empty($email) ) {
    print 
"Please go back and make sure that 'Name' and 'Email Address' fields have been filled out.";
    return 
false;
    }

use 
PHPMailer\PHPMailer\PHPMailer;
include_once 
"PHPMailer/PHPMailer.php";
include_once 
"PHPMailer/Exception.php";

// Define email variables
    
$mail->To "Classes <opt-designs&#64;goal-driven.net>";
    
$amail  $_POST['username'&#93;."<".$_POST['email'&#93;.">";
    
$mail->Headers "From&#58;".$amail."\r\n";
//    $mail->Headers .= 'Content-type&#58; text/html; charset=UTF-8';
    
$mail->isHTML(true);
    
$mail->Body " "

  
$classes $_POST['interest'&#93;;
  
if(empty($classes)) {
    echo(
"You didn't select any check boxes.");
    print 
"Please go back and make sure that at least one check box has been checked.";
    return 
false;
  }
  else 
  {
    foreach (
$classes as $value) {
      echo(
$value " ");     // testing!  $value="oil" ?
      
$mail->Subject $value;
      
send1();
     }
   }
  
clearAddresses();
}
<
script>
function 
send1()
   
$mail->send();
// Sending Email 
  
if( send() ) {
    print 
"Thank you, once 10+ sign-up for each topic, I will get back to you with a date and time for each class.<br>";
    return 
true;
    }
    else {
      print 
"An error occurred and your message could not be sent.";
      return 
false;
    }
</
script>

I'm new at PHP so need help here.  Following is one check box
        <input type="checkbox" id="oil" name="interest[]" value="oil">
        <label for="oil">Oil Refinery Optimization</label>

4
If you're going to be doing this often, MachForm might be worth the investment for you.  I got it years ago, and still use it.

https://www.machform.com/

Can one upload/import an html form?  Here is a link to my form ... https://goal-driven....om-math-classes.html .  I sent their support team a question on this import question, not sure when they'll get back to me.

Thanks for the lead!

5
Tried it ... not enough form options.

6
I've created a webpage with a Form that allows a user to select the class subjects they would be interested in a Zoom class.  How to have user do a submit and email me at [email protected] with subjects being 'class1', 'class2', 'class3', etc. for the various classes?

<form method="post" action="subscriberform.php" >
  <fieldset>
  <legend>Choose your <b>Class</b> interests</legend>
    <div class="row">
      <div class="column left">
        <input type="checkbox" id="class1" name="interest" value="class1">
        <label for="class1">Oil Refinery Optimization</label>
      </div>
      <div class="column right">
        <span>Crude oil comes in to an Oil Refinery and ... in processing oil?</span>
      </div>
    </div>

ooo ... 'n' various class subjects; how to email to each subject a user selects via checkbox?

    <div class="row">
      <div class="column left">
        <input type="checkbox" id="class'n'" name="interest" value="class'n'">
        <label for="class'n'">Calculus-level Coding</label>
      </div>
      <div class="column right">
        <span>Calculus-level Coding and ... ?</span>
      </div>
    </div>
    <div class="row">
      <button type="submit">Submit form</button>
    </div>
  </fieldset>
</form>

Emails rec'd could then be sorted by date or subject and sent replies when their class would meet.  Ideas?

7
Thanks for your comments and time.  Found a way around my problem.  Break <br> ... Break ... Break! Problem resolved!

Phil

8
My HTML code gives a strange response.  After the E-mail </script>, it seems to divide the page into 2 columns, ideas why and how to fix problem?
<h4 style="float:left; padding: 0px 15%">1. E-mail us at <script type="text/javascript"><!--
var name = "aaa"; //
var domain = "goal-driven.net"; //
document.write('<a href=\"mailto:' + name + '@' + domain +
  '?subject=Interest%20in%20...' + '\">');
document.write(name + '@' + domain + '<\/a>');
// --></script></h4>

<!-- problem seems to start here. The 'xxx' lines below show in 'column 2', why and how to fix? The 'zzz' line is okay from there on. -->

<h4 style="float:left; padding: 0px 15%">2. Send us a letter.</h4>
<p style="text-align:center"><b>xxx<br>
xxx<br>
xxx</b></p>

<p>yyy</p>

<h2 style="text-align:center;"><i>zzz</i></h2>

9
I see a http link in your <script> ... </script> text. Think you'll need to change that to https.

On the server that runs your website, can you ping (all of) the google domains you use?
My server is inmotionhosting.com but don't know where to ping ANY google domains.

Or take each of the (referral) links you use in your sites, copy-paste each into a separate browser tab and check if your browser shows you the content of these scripts. At least, if you see content, then you'll know that part is still available to you. If there is no response shown in the browser tab, then you'll know which links are failing and you can focus on getting these resolved.
I have no referral links ... these scripts create the links back in the 2008 to 2016 when they worked.

Did you install a browser extension that blocks access to certain domains?
Not to my knowledge.

Or do you have an extension that uses blocklists it automatically downloads from the internet? If so, it is possible that this list contains domains which you need for ads. Maybe you use a DNS server that is too overzealous for your purposes.
no.

*edit*
I forgot: server logs are your friend. Dig through those and you'll likely find your problem. Most of the time log files are text files, but can be rather large. Not all text editors can handle large text files that well. One of the few that can, is the free version of emEditor, but there are a few more.
Tried to find these logs, but support said no luck. :(

10
Much has changed in Google and the web since 2015.  Due to lost passwords (and maybe other things), my Google scripts listed below are NOT working.  Ideas why?

<meta name="google-site-verification" content="k1JtA8__K4x_n9DYmtjzXYy-4rFOOSaQnOkpU7Xlv_8" />
ooo

  <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-42392081-1', 'goal-driven.net');
  ga('send', 'pageview');

</script>
ooo

<script><!--
google_ad_client = "ca-pub-7754447827398000";
/* 160x600 Google AdSense */
google_ad_slot = "4145553146";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script src="http://pagead2.googl...m/pagead/show_ads.js">
</script>
---

No ads show on my webpages (e.g. https://goal-driven....et/apps/curvfit.html), error with scripts being out-of-date OR something else?

I'm a mathematician trying to educate engineers & scientists on how to use Calculus-level Problem-Solving to help them design their next 'black' box; i.e. I know little about computer science. :(

11
My webpage html has several ID tags for various MP4 video files.  My sitemap.xml for one MP4 video is as follows:

  <url>
    <loc>http://goal-driven.net/videos/index.html#FC-Compiler</loc>
       <video:video>
       <video:thumbnail_loc>http://goal-driven.net/image/fc-compiler-icon.png</video:thumbnail_loc>
       <video:title>Shows how to use and code the FC-Compilerâ„¢ App</video:title>
       <video:description>FC-Compilerâ„¢ application is a (free) Calculus-level Compiler that simplifies Tweaking parameters in ones math model.  FC solves Algebraic through Ordinary Differential Equations Equations; Laplace transforms; etc. FC is based on Automatic Differentiation that simplifies computer code to an absolute minimum; i.e., a mathematical model, constraints, and the objective (function) definition.</video:description>
       <video:content_loc>http://goal-driven.net/videos/FC Class.MP4</video:content_loc>
   <video:duration>600</video:duration>
   </video:video>
  </url>
The <loc>http://goal-driven.net/videos/index.html#FC-Compiler</loc> line seems to be the problem.  "#FC-Compiler" refers to an ID tag on my web page ... <h3 id="FC-Compiler">.  Am I doing something wrong here or on my Sitemap.xml file?

12
I see, let me, does the slide show have transitions that move the images during transitions, or is is just a solid image appears and then eventually switches to another one without any transition (fade, slide, etc.).
If this is the case, you should be able to find some mp4 or other video codec that compresses it well.
Solid ... no transitions ... exe shows Page 1 ... waits ... then Page 2 ... etc.

Have searched for a convert from EXE to MP4 formats ... no luck so far.  Ideas?

13
It's slide show create by me using IrfanView s/w.  Either EXE or SCR run fine on my local PC.  How to upload them for web visitors to view them?  I presently have MP4 files that are HUGE but work okay.  The EXE/SCR file are 1/400th the size!  Nice and do the job.

14
I have some HTML code to present a MP4 video file as follows:
Code: HTML5 [Select]
  1. <center><video width="360" height="240" controls>
  2.   <source src="http://goal-driven.net/... Coding.mp4" type="video/mp4">
  3.   <source src="movie.ogg" type="video/ogg">
  4.   Your browser does not support the video tag.
  5. </video></center>

It works fine.  Now, because of filesize getting so large, I'm seeking a way to present a slideshow that is in a EXE or SCR file format.  Have tried the following with no luck!

Code: HTML5 [Select]
  1. <center><video width="360" height="240" controls>
  2.   <source src="http://goal-driven.net/ ... Coding.scr" type="video/mp4">  ! no go!!
  3.   <source src="http://goal-driven.net/ ... Coding.exe" type="video/mp4">  ! no go either!!
  4. </video></center>

I've tried finding a convert program from EXE to MP4 with no luck here too.  Suggestions?

Phil

15
Yes, I forgot the declare stuff...

Private Declare Sub PSDcalc_for Lib "PSDcalc_for.dll" (ByVal fileNam As String, ByRef x_array As Single, _
  ByRef spectrum As Single, nptsZ As Integer, npointsZ As Integer, _
  t_startZ As Single, t_finalZ As Single, zeroFillZ As Single, sig2Z As Single, _
  nPoles As Integer, nZeros As Integer, M_eqs As Integer, M_lags As Integer, _
  Mode As Integer, L_pts As Integer, ByVal str_len As Long)
ooo

Public Sub exitProgram()
  ooo
' no longer have this code ...      Call EndProcess("PSDcalc_for.dll")
      If EndDLL("PSDcalc_for.dll") Then MsgBox "It worked!"

A problem is in the EndDLL("PSDcalc_for.dll") stmt.  EndDLL argument should be EndDLL(DllReturnValue As Long) ... that's a problem for sure.  What should be passed to EndDLL ... DllReturnValue As Long?

16
The following VB code give an error when trying to execute it ... ideas where my problem is?
---
      If EndDLL("PSDcalc_for.dll") Then MsgBox "It worked!"
---
The VB debugger says 'EndDLL' expected variable or procedure, not module.  Hmm, "EndDLL" is a function as described next.
---
Public Function EndDLL(DllReturnValue As Long) As Boolean

'PURPOSE: End a process started with VB's Shell Statement
'INPUT: Task ID returned by Shell
'RETURNS: True if succesful, false otherwise

On Error Resume Next

Dim hInst As Long
Dim hProcess As Long
Dim lExitCode As Long
Dim lRet As Long

hInst = DllReturnValue
If hInst = 0 Then Exit Function

'Get handle to process
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0&, hInst)
If hProcess <> 0 Then
    'get exit code
    GetExitCodeProcess hProcess, lExitCode
        If lExitCode <> 0 Then
                'bye-bye
            lRet = TerminateProcess(hProcess, lExitCode)
            EndDLL = lRet > 0
        End If
End If
End Function
---

KodeZwerg, you are probably right on the problem is in my VB -exit- code ... not the DLL.   On the inet the talk is about 'Close' vs. 'Close All'.  Ideas?

17
Try running the app's demos and see what is going on.  Many runs and all is well.  Then try exiting the app.  It hangs!  Many DLLs show a wx_close() or w?_close() routine that does the job.  But out of my range.


18
Yes it is downloadable from http://fortrancalcul...o/misc/download.html page.  It is the SpectrumSolvers app ... includes all source files.  The DLL is named PSDcalc_for.dll and once downloaded and installed, the DLL is found in the \od-tools\SpectrumSolvers directory.

Thanks your your efforts.
Phil
PS:  The app closes fine -unless- the DLL is executed.  If the DLL is executed, it hangs the app when trying to close the VB app.

19
it worked!!!   oShell.run "cmd /C set win~dir=" & fileTempPath & " && " & tmp3, 3, True
"win~dir" is my environment variable that passed windows present path, fileTempPath, to the 'bat' file.

My problem was due to a shortcut to my FC-base.bat file, called FC-base-launch.lnk.  If the 'bat' file was called directly from my windows app, all was fine.  But, call a shortcut 'launch' link and the users path was lost. :(  These 'launch' links allow users to define their text & background colors, text fonts & sizes, etc. ... very helpful for developers to let the owners decide these things.  A bat file does -not- have such options.

Thanks KodeZwerg & f0dder for your help!
Phil

20
Over my head!!!  Guess I'll just leave it for someone else to work on.

Thanks for your efforts KodeZwerg and wraith808,
Phil

21
Set wshSystemEnv = wshShell.Environment( "SYSTEM" )
Do. Not. Do. This.

If you need to use vbscript instead of a proper language, go for the solution that executes cmd /c "set foo=bar & mainexecutable".

I'm a little lost here ... so we are back to cmd /c "set foo=bar & mainexecutable"?  What is the '"mainexecutable"?  This -must- be "set" before executing my main batch file.  So, will or should my oShell.run "cmd /C Set tmp = "ABC" do the trick?

22
VB, does it provide Stacktrace? If so, what does it tell?
Never heard of "Stacktrace" in VB nor Fortran ... where might I find it -or- try it?  How would you use it ... show me some code.

Thanks, Phil

23
Set wshShell = CreateObject( "WScript.Shell" )
Set wshSystemEnv = wshShell.Environment( "SYSTEM" )
' Display the current value
WScript.Echo "TestSystem=" & wshSystemEnv( "TestSystem" )
Close ... I have the following code that may explain my problem.
        Dim oShell As Variant, intResponse As Integer
        Set oShell = CreateObject("WSCript.shell")
---
Your example shows "Set wshShell = " and mine has "Set oShell = ".  So, I made that change but then "Set wshSystemEnv = " produces an error msg. saying that "wshSystemEnv" is not defined.  So, "Dim wshSystemEnv As Variant" line was added but that caused other problems. 

Next, the line 'WScript.Echo "TestSystem=" & wshSystemEnv("TestSystem")
' causes an error abort msg.  It seems that it doesn't like the "WScript.Echo" portion, but not sure what it is trying to point too.  Ideas?

Thanks for the help!  Close ... so close!
Phil

24
I got this "set -ua ..." off the www as a possible answer to my question.  I write VB code and VBscript when necessary.

Anyone out there knows how to pass an environment variable from Windows?

Phil

25
Hi,

I'm having problems with my VB6 program that merges with a Lahey Fortran DLL.  It has been around for over 20 years!  The DLL was started around 5 or 10 years ago.  My VB6 program may call the DLL 1 or more times with no problems.  Then on closing, the program hangs!!!  If one doesn't call the DLL, no hanging occurs on closing.  Ideas?

1. Phil Brubaker
2. S/N: 001873...
3. Lahey/Fujitsu Fortran 95 Express Release 7.10.02
4. Patch level?
5. OS: Windows 7
6. Example VB6 code:
Private Declare Sub PSDcalc_for Lib "PSDcalc_for.dll" (ByVal fileNam As String, ByRef x_array As Single, _
  ByRef spectrum As Single, nptsZ As Integer, npointsZ As Integer, _
  t_startZ As Single, t_finalZ As Single, zeroFillZ As Single, sig2Z As Single, _
  nPoles As Integer, nZeros As Integer, M_eqs As Integer, M_lags As Integer, _
  Mode As Integer, L_pts As Integer, ByVal str_len As Long)
 
ooo

         ReDim x_array(1 To npointsZ) As Single, spectrum(1 To npointsZ) As Single
            x_array(1) = 1: spectrum(1) = 1
            ChDrive App.path:      ChDir App.path

            Call PSDcalc_for(fileTemp, x_array(1), spectrum(1), nptsZ, npointsZ, _
                t_startZ, t_finalZ, zeroFillZ, sig2Z, _
                nPoles, nZeros, M_eqs, M_lags, Mode, L_pts, _
                Len(fileTemp))

            If nptsZ < 1 Then
              MsgBox "File Error ... read bottom of your '~rainbow.out' file for " & vbCrLf _
                 & "more details. This OUT file is in the same directory " & vbCrLf _
                 & "as your input file; ... " & vbCrLf _
                 & "   " & fileTemp, vbOKOnly, "File name in error ... " _
                 & "read Output file for more"
              Call createFileOut(fileIn)
              Exit Sub
            End If
            Call createFileOut(fileIn)
ooo
-------------------------------------------------------------------------------------

F90 code:
------------
     Subroutine PSDcalc_for( fileNam, x_array, spectrum, nptsZ, &
           npointsZ, t_startZ, t_finalZ, zeroFillZ, sig2Z, &
           npolesZ, nzerosZ, M_eqsZ, M_lagsZ, modeZ, L_ptsZ)

        dll_export :: PSDcalc_for
        character(len=*) :: fileNam

        include 'spec_in.inc'

        complex signal_amp( :)
        real y_array( :), norm_factor
        real, dimension( npointsZ) :: x_array, spectrum
        allocatable :: y_array, signal_amp
--------------------------------------------------------------------------------------

This code works, can call PSDcalc_for several times ... AOK.  Then try closing my VB6 front-end and vb6 seems to hang.  Create an EXE for my project and it too runs fine until closing.  Then it tries closing and gets the same error msg.

This app has been running since 1994 (?) with no problem, what is new that causes such error?  I found a back-up with same DLL, back in 2015, and it too aborted with same error!  The app is not used that often by me, so unclear when this shutdown error msg. started.

Any ideas on how to close down my Fortran DLL, without forcing it just a 'normal' close?

Thanks, Phil

Pages: [1] 2next