Walking Trip …

Walking Trip

Walking Trip

Offenbach's Suite ... Warts 'n All

Offenbach's Suite ... Warts 'n All

 📅  

If this was interesting you may be interested in this too.

Posted in Photography, Trips | Tagged , , | 34 Comments

Text to Speech Ajax MAMP Tutorial

Text to Speech Ajax MAMP Tutorial

Text to Speech Ajax MAMP Tutorial

The Voiceover Ideas web application talked about at PHP macOS say Supervising Google Translate Sharing Tutorial was an interesting project, but regarding the basis to it …

Harness talents of macOS say command Text to Speech

… we organized it so that it’s functionality was a bit different depending on the Environment … as per …

  • if the PHP code had been downloaded to a local MAMP Environment any “say” using option was actually harnessing PHP exec calls of the macOS “say” command … whereas …
  • if on the RJM Programming public domain any “say” using anything would have to get there via a “stab in the dark” window.open popup window call of a macOS MAMP incarnation at http://localhost:8888/macos_say_record.php or a Windows MAMP incarnation at http://localhost/macos_say_record.php

And so, today, we start a few steps pared down, with a rethink on how that previous PHP worked it. We think we can have a better arrangement just using Ajax Javascript rather than so much HTML iframe and/or popup window usage.

This start is represented by “first draft” local_say_help.php Text to Speech MAMP Ajax web application that if also downloaded into an Apache MAMP local web server Apache web server’s Document Root folder will be referenced up at the public RJM Programming domain incarnation not needing to open any popup windows nor HTML iframe elements, an improvement “in awkwardness” we welcome.


Previous relevant PHP macOS say Supervising Google Translate Sharing Tutorial is shown below.

PHP macOS say Supervising Google Translate Sharing Tutorial

PHP macOS say Supervising Google Translate Sharing Tutorial

Today’s integration of the Javascript clientside window.postMessage into …

… but this time the RJM Programming‘s domain window called by the Google Translate “child” window is a modified PHP index.php Landing Page …

<?php echo ”

if (window.opener) {
if (document.URL.indexOf('translate.goog') == -1 && document.URL.indexOf('text=') != -1 && document.URL.indexOf('_x_tr_sl=') != -1 && document.URL.indexOf('_x_tr_hl=') != -1) {
valvalue='//www-rjmprogramming-com-au.translate.goog/index.php?' + document.URL.split('?')[1];
location.href=valvalue; //wwoo=window.open(valvalue, '_top');
} else if (document.URL.indexOf('translate.goog') != -1 && document.URL.indexOf('text=') != -1 && document.URL.indexOf('_x_tr_sl=') != -1 && document.URL.indexOf('_x_tr_hl=') != -1) {
//document.getElementById('mywords').style.display='block';
setTimeout(function(){
if (document.getElementById('mywords').innerText.trim() != '' && document.getElementById('mywords').innerText != decodeURIComponent(document.URL.split('text=')[1].split('&')[0].split('#')[0])) {
if (document.URL.indexOf('&iam=') != -1) {
window.opener.postMessage(encodeURIComponent(document.getElementById('mywords').innerText), decodeURIComponent(document.URL.split('&iam=')[1].split('&')[0].split('#')[0]));
} else {
window.opener.postMessage(encodeURIComponent(document.getElementById('mywords').innerText), 'https://rjmprogramming.com.au');
}
window.localStorage.setItem('last_gt_trans', encodeURIComponent(document.getElementById('mywords').innerText)); // alert('1:' + document.getElementById('mywords').innerText);
} else {
setTimeout(anotherlook, 1000);
}
}, 1000);
} else if (('' + parent.document.URL).indexOf('translate.goog') != -1 && ('' + parent.document.URL).indexOf('text=') != -1 && ('' + parent.document.URL).indexOf('_x_tr_sl=') != -1 && ('' + parent.document.URL).indexOf('_x_tr_hl=') != -1) {
//document.getElementById('mywords').style.display='block';
setTimeout(function(){
if (document.getElementById('mywords').innerText.trim() != '' && document.getElementById('mywords').innerText != decodeURIComponent(('' + parent.document.URL).split('text=')[1].split('&')[0].split('#')[0])) {
if (('' + parent.document.URL).indexOf('&iam=') != -1) {
window.opener.postMessage(encodeURIComponent(document.getElementById('mywords').innerText), decodeURIComponent(('' + parent.document.URL).split('&iam=')[1].split('&')[0].split('#')[0]));
} else {
window.opener.postMessage(encodeURIComponent(document.getElementById('mywords').innerText), 'https://rjmprogramming.com.au');
}
window.localStorage.setItem('last_gt_trans', encodeURIComponent(document.getElementById('mywords').innerText)); // alert('2:' + document.getElementById('mywords').innerText);
} else {
setTimeout(anotherlook, 1000);
}
}, 1000);
}
}


“; ?>

… “broadcasting of window.postMessage” to marry with today’s changed PHP macos_say_record.php‘s listening …

<?php echo ”

window.addEventListener(\"message\", (event) => { // thanks to https://www.google.com/search?q=Undef+what+conditions+can+window.opener.parentfunc()+type+of+call+work+when+the+domains+are+different%3F&rlz=1C5OZZY_en&oq=Undef+what+conditions+can+window.opener.parentfunc()+type+of+call+work+when+the+domains+are+different%3F&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI2NzQwajBqN6gCALACAA&sourceid=chrome&source=chrome.ob&ie=UTF-8
// Always verify the origin of the sender for security
if (event.origin !== \"https://www-rjmprogramming-com-au.translate.goog\") return;
lasttrans=decodeURIComponent(decodeURIComponent(event.data));
document.getElementById('thewords').title=document.getElementById('thewords').value;
document.getElementById('thewords').value=decodeURIComponent(decodeURIComponent(event.data));
});

“; ?>

… for a usage scenario like …

  1. in a web browser link to our inhouse Voiceover Ideas as the “parent” window
  2. if not already selected select Google Translate in top “mode of use” dropdown
  3. in the Language Code dropdown select a language such as Hindi
  4. this populates the Words textarea with some phrasing macOS say command associates with a Voice speaking that selected language
  5. now here, perhaps you would not think to do this, but we’re saying a user might override those Hindi default words with some English words the user enters
  6. click/tap Hear These Words button
  7. as of today, in this type of scenario, as well as one Google Translate popup window appearing, under it, in this scenario another Google Translate of RJM Programming Landing Page with Tailored Arguments “child” window is created, and which …
  8. is able to communicate back to the “parent” window via window.postMessage …
  9. so as to make it that the displayed content of the Words textarea can become the Hindi translation of the English while the on hover title attribute can become the originating English … and …
  10. in this scenario a Words textarea ondblclick (for a double click/tap) toggles the roles above

Stop Press

Reading back to ourselves that list above, what irked as a programmer, was the non-generic feel of the use of the word “English”. After all, Google Translate can detect the language, but for us to use this “auto” coding idea we needed to, in a changed PHP index.php Landing Page detect the call and isolate the content to just be the wording up for translation, and then in today’s changed PHP macos_say_record.php Voiceover Ideas ensure the Google Translate “auto” coding “detect language” can be harnessed. All this means some natively English speaking user could still pick a language like Hindi in that dropdown and then type in a French word such as “Bonjour” into the Words textarea element then click/tap the Hear These Words button to start involving the language French into the mix of language translation information that follows.


Previous relevant PHP macOS say Supervising a Retrained Siri Nuance Tutorial is shown below.

PHP macOS say Supervisor Modes of Use Tutorial

PHP macOS say Supervising a Retrained Siri Nuance Tutorial

It’s Nuance Day!!!!

Complacency alert!!! Sometimes nuances take longer to resolve than the 90%ers.

We found the Siri retraining procedures we tried to help out with, on a first day’s worth of effort, regarding PHP macOS say Supervising a Retrained Siri Tutorial, were lacking …

  • order, when starting half way though the list
  • confusing … in the way first one we’re asking you not to click the button but others we do
  • you may want to replay the audio from a previous Siri command
  • first say invocation a bit slow (on the uptake)

That third one is the most interesting. You see, macOS say likes to output any audio output asked of it to an audio/aiff format, which browsers like Google Chrome will not play. To overcome this, we start with …


<div style=display:inline-block; id=spaudio>
<audio title='Repeat hearing of previous Siri speech.' onclick='if (oopsa) { trywav(this); }' controls id=mysiriaudio style=display:none;>
<source onerror='oopsa=true; ' id=mysirisource type=audio/aiff src=/lastaudiosiri.aiff></source>
<source onerror='oopsb=true; ' id=mysirisourcetwo type=audio/wav src=/lastaudiosiri.wav></source>
</audio>
</div>

… and then form method=POSTing to thyself to invoke …

<?php

// ffmpeg work via PHP exec conduit to command line ...
$ffmpegcommand="";
$ffmpegselect="";
$ffmpegform="";
if (file_exists("/usr/local/bin/ffmpeg")) {
$ffmpegcommand="/usr/local/bin/ffmpeg ";
} else if (file_exists("/usr/bin/ffmpeg")) {
$ffmpegcommand="/usr/bin/ffmpeg ";
} else {
shell_exec("ffmpeg -codecs > " . dirname(__FILE__) . DIRECTORY_SEPARATOR . "ffmhuhpeg.huh");
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ffmhuhpeg.huh")) {
$retblurb=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ffmhuhpeg.huh");
unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ffmhuhpeg.huh");
if (strpos($retblurb, "odecs") !== false) {
$ffmpegcommand="ffmpeg ";
}
} else if (file_exists("/usr/local/bin/ffmpeg")) {
$ffmpegcommand="/usr/local/bin/ffmpeg ";
} else if (file_exists("/usr/bin/ffmpeg")) {
$ffmpegcommand="/usr/bin/ffmpeg ";
}
}

if (isset($_POST['sirisay'])) {
passthru("say" . $sayprefix . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.wav")) {
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.wav");
}
exec("say" . $sayprefix . " -o " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.aiff" . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err ; " . $ffmpegcommand . " -i " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.aiff" . " " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.wav");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.wav")) {
unlink($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "lastaudiosiri.aiff");
echo "<html><body onload=\"if (parent.document.getElementById('mysirisourcetwo')) { parent.document.getElementById('mysirisourcetwo').type='audio/wav'; parent.document.getElementById('mysirisourcetwo').src=parent.document.getElementById('mysirisourcetwo').src.replace('.aiff','.wav'); }\"></body></html>";
}
} else {
passthru("say" . $sayprefix . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err");
}

?>

Yes, ideally we’d like you, on your macOS system, to have installed the amazing, the stupendous, the good ol’ ffmpeg command line tool, as an “optional” here.

And then, back at the “client side ranch” …


function getthenextone() {
if (retridx > 0) {
if (document.getElementById('mysiriaudio')) {
document.getElementById('mysiriaudio').style.display='inline-block';
if (document.getElementById('mysirisource').src.indexOf('?') == -1) {
document.getElementById('mysirisource').src+='?rand=' + Math.floor(Math.random() * 167564);
} else {
document.getElementById('mysirisource').src+=('' + Math.floor(Math.random() * 9))
}
if (document.getElementById('mysirisourcetwo').src.indexOf('?') == -1) {
document.getElementById('mysirisourcetwo').src+='?rand=' + Math.floor(Math.random() * 167564);
} else {
document.getElementById('mysirisourcetwo').src+=('' + Math.floor(Math.random() * 9))
}
if (document.getElementById('spaudio')) {
document.getElementById('spaudio').innerHTML=document.getElementById('spaudio').innerHTML;
}
}
if (retridx < eval('' + retrainings.length)) {
document.getElementById('saysub').disabled=false;
document.getElementById('saysub').style.cursor='pointer';
document.getElementById('saysub').value='Hear These Words ... ' + retrainings[retridx] + ' (when you click/tap)';
document.getElementById('thewords').value=retrainings[retridx];
retridx++;
}
}
}

Nuance is just so nuancey!!


Previous relevant PHP macOS say Supervising a Retrained Siri Tutorial is shown below.

PHP macOS say Supervisor Modes of Use Tutorial

PHP macOS say Supervising a Retrained Siri Tutorial

Here Siri, it’s time for a retraining session.

Hey Bud, I only respond to Hey.

Sorry, Bud … but as the provider of your treats … smirk …
Hey Siri, it’s time for a retraining session.

Why retrain Siri? Well, let me ask (not you Siri) …

Do you cringe at the sound of your own voice? Even in a cupboard? Especially in a cupboard?!

… and then …

And yet, you can see the advantages of Siri if it did not involve the sound of your own voice? Even in a cupboard? Especially in a cupboard?!

Yes? Well …

  1. if you have an iOS device to be the Siri conduit …
  2. if you have a macOS device (and so access to the great say Text to Speech command via PHP exec command), such as the MacBook Air, here, today … installed with …
  3. MAMP … Apache/PHP/MySql local web server … and have downloaded the latest (at time of writing) …
  4. http://localhost:8888/macos_say_record.php into that MAMP‘s macOS (default port) Document Root folder
  5. http://localhost:8888/HTMLCSS/client_browsing.htm into that MAMP’s macOS (default port) Document Root folder’s HTMLCSS subfolder

… phew!!! Have we got news for you?!!!

Yes, it might be worthwhile for people still reading to force a retraining of Siri in favour of a macOS Voice of Choice.

Assuming you’re ready for Siri retraining class (further to PHP macOS say Supervisor Modes of Use Tutorial below), and you have cancelled your own voice settings and being asked by the Siri setup, below are what we as that ever so fluid a concept were asked to “Say” “Hey” …

  1. Siri, how’s the weather?
  2. Hey Siri, send a message.
  3. Siri, set a timer for three minutes.
  4. Hey Siri, get directions home.
  5. Siri, play some music.

… and then all being well, what can then be the case is …

… but please be aware …

  • Siri may forget your voice as a result … versus …
  • Siri can recognize up to 2 voices and one of these could be your “out and about” voice

… regarding our changed inhouse macos_say_record.php (we recommend you download to macOS MAMP local web server and startup via HTTP://localhost:8888/macos_say_record.php web address URL) MacOS Text to Audio online PHP supervisor.


Previous relevant PHP macOS say Supervisor Modes of Use Tutorial is shown below.

PHP macOS say Supervisor Modes of Use Tutorial

PHP macOS say Supervisor Modes of Use Tutorial

After yesterday’s Making of Siri on iPhone Plays Spotify Song via macOS say Tutorial, today we turn back to the PHP code that started our foray into “Siri meets say” thought patterns.

It seems a bit strange to be talking about macOS and command line “say” commands, and not, on top of its …

  • usual “surfing the net” via the web browser address bar mode of use … to, today, add …
  • a “command line” mode of use … and …
  • the manufactured feeling “curl” mode of use

… to its talents so that “say” on the macOS command line can have equivalencies with …

<?php

if (isset($argv)) { // command line
$commandsofar="say ";
$numargs = sizeof($argv);
if ($numargs > 1) {
if (PHP_OS == "Darwin") {
for ($ii=1; $ii<$numargs; $ii++) {
if ($ii == 1 && strtolower($argv[$ii]) == 'say') {
$commandsofar="say ";
} else {
$commandsofar.=' ' . $argv[$ii];
}
}
passthru($commandsofar);
exit;
}
} else {
if (PHP_OS == "Darwin") {
passthru("info say");
exit;
}
}
} else if (isset($_GET['curlit'])) { // curl
$commandsofar="say ";
if (PHP_OS == "Darwin") {
passthru(str_replace("say say ","say ","say " . str_replace('+',' ',urldecode($_GET['curlit']))));
exit;
}
}

?>

  • a “command line” mode of use … where “say blah-blah-blah” on a command line can be equivalent to, say, “php ./macos_say_record.php blah-blah-blah” …
  • the manufactured feeling “curl” mode of use asks of the user a way to use a command like “curl ‘HTTP://localhost:8888/macos_say_record.php?curlit=blah-blah-blah‘” (where blah-blah-blah = encodeURIComponent(blah-blah-blah))

We also increased “say” functionality by not forcing …

  • the default output, for “say” use, of creating an audio file … and, as of today, adding that, as an alternative …
  • if the audio file is set to blank by the user the “say” operating system command is performed behind the scenes …
    <?php

    if (str_replace("+"," ",urldecode($_GET['audioname'])) == "") {
    passthru("say" . $sayprefix . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err");
    exit;
    } else {

    exec("say" . $sayprefix . " -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err");
    }

    ?>
    … getting us to moderate that “audiofile” textbox functionality this way …
    <?php

    $audioft="";
    if (PHP_OS == "Darwin") {
    $audioft=' title="This made to be blank and the topmost say dropdown choice will cause the text to audio to play through your speakers." onblur="if (this.value.trim().length == 0 && document.getElementById(' . "'" . 'saymode' . "'" . ').value.length == 0) { document.getElementById(' . "'" . 'saysub' . "'" . ').value=document.getElementById(' . "'" . 'saysub' . "'" . ').value.replace(' . "'" . 'Record ' . "'" . ',' . "'" . 'Say ' . "'" . '); } else if (this.value.trim().length != 0 && document.getElementById(' . "'" . 'saymode' . "'" . ').value.length == 0) { document.getElementById(' . "'" . 'saysub' . "'" . ').value=document.getElementById(' . "'" . 'saysub' . "'" . ').value.replace(' . "'" . 'Say ' . "'" . ',' . "'" . 'Record ' . "'" . '); }"';
    }


    ?>
    … working with …
    <?php echo ”

    <input type=text name=audioname id=audioname value='audiocapture." . $bestext . "'" . $audioft . "></input>

    “; ?>

… to improve the user experience for those curious macOS (perhaps MAMP) local web server users of our changed inhouse macos_say_record.php (we recommend you download to macOS MAMP local web server and startup via HTTP://localhost:8888/macos_say_record.php web address URL) MacOS Text to Audio online PHP supervisor.


Previous relevant Making of Siri on iPhone Plays Spotify Song via macOS say Tutorial is shown below.

Making of Siri on iPhone Plays Spotify Song via macOS say Tutorial

Making of Siri on iPhone Plays Spotify Song via macOS say Tutorial

Making yesterday’s Siri on iPhone Plays Spotify Song via macOS say Tutorial‘s video involved three devices …

  1. this MacBook Air (using “say” commands) … and …
  2. an iPhone with Siri and Spotify … but, also …
  3. a Windows 10 laptop helped contextualize … via …

… use of …

  • Windows 10 Camera app … photographing the slide contents of yesterday’s video presentation
  • Windows 10 Photos app … turning the slides above into yesterday’s video presentation … along with its Share option Mail to email off and sftp into place

… some steps of which you can see with today’s animated GIF tutorial picture.


Previous relevant Siri on iPhone Plays Spotify Song via macOS say Tutorial is shown below.

Siri on iPhone Plays Spotify Song via macOS say Tutorial

Siri on iPhone Plays Spotify Song via macOS say Tutorial

Yesterday’s Siri on iPad Plays Apple Music Song Tutorial represented to us, regarding the …

Don’t be concerned, it will not harm you
It’s only me pursuing somethin’ I’m not sure of
Across my dreams with nets of wonder
I chase the bright elusive butterfly of love

… ilk of things, a creeping up on our interest in a programmable link between …

iOS music playing (Apple Music or Spotify etcetera) … and Siri … … along with … macOS say (via crontab or at (macOS command scheduling functionality), eventually) control

And our verdict, after today’s iPhone Siri setup (which gets you to “say”, modelling …

say “Hey Siri”
say “Hey Siri, send a message”
say “Hey Siri, how’s the weather today”
say “Hey Siri, set a timer for three minutes”
say “Hey Siri, play some music”

… sentences above to configure the relevant voice) along with a macOS command line “say” arrangement, is … da, da da da da da, da, da da we could go on with the whole lion bit, but we’ll spare you … yes, we can get “say” command on macOS work a …

Hey Siri, Play U2

say “Hey Siri, Play U2”

… type of Siri dictation command onto (our) iPhone’s (default Spotify) music app to play a song. It’s just that … first wooooorrrrlllldddd problem alert … the “say” command was not that flash at …

Hey Siri, Stop

say “Hey Siri, Stop”

… to stop the music, as well as our own … yoo hoo … voice is. And so, our recommendation is to setup Siri for multiple voices. How? Hard to believe, but it seems, in iPhone’s Settings -> Siri & Search screen, turning the top green (Listen for “Hey Siri”) switch in the settings to off and then back on is the go?! The resultant procedure is where you can “train” Siri to recognize a macOS “say” voice, as well as your own voice, or a bunch of other “Siri Voice” (menu) choices offered “out of the box” with the iPhone iOS installed. It may be that you should explore macOS “say” -v [VoiceName] choices, as well, here.

How does this work sit with macOS crontab “say” command thinking that goes with our changed inhouse macos_say_record.php (we recommend you download to macOS MAMP local web server and startup via HTTP://localhost:8888/macos_say_record.php web address URL) MacOS Text to Audio online PHP supervisor talked about with MacOS Text to Audio Scheduling Tutorial? Well, without reliable “stop” … first wooooorrrrlllldddd problem or not … we are going to continue research, but we’re not sure that you will be totally spared from your own voice interventions for stopping (of music) purposes … or perhaps get yourselves an Apple HomePod mini …

… as a hardware style of thinking solution. Anyway, take a look at today’s iPhone Siri meets macOS “say” control of iPhone Spotify learning curve hereabouts …


Previous relevant Siri on iPad Plays Apple Music Song Tutorial is shown below.

Siri on iPad Plays Apple Music Song Tutorial

Siri on iPad Plays Apple Music Song Tutorial

We’re resetting the iOS Siri app mentioned in Siri on iPad Mail Dictate Tutorial on another iPad today. We wanted to set it up (via Settings -> Siri & Search) to play songs on Apple Music with spoken words (directed to Siri) such as …

Hey Siri, Play Brahms

… but as you can see from today’s tutorial animated GIF picture (also showing Siri’s setup) we had no Brahms in our Apple Music collection, and so tried …

Hey Siri, Play U2

… with more success!


Previous relevant Siri on iPad Mail Dictate Tutorial is shown below.

Siri on iPad Mail Dictate Tutorial

Siri on iPad Mail Dictate Tutorial

Hope you are not like me and feel like going into a cupboard to use a microphone on a mobile device. If this is not you, and you have a half recent version of iOS on an iPad or iPhone, and you have Siri available as an app, then today’s tutorial may be of interest.

Siri can be like a personal assistant, and the way we best think of it as such, is as a tool to help dictate an email, using the Mail app on our iPad. To get to that, though, if you’ve never used Siri before, you should consult this Apple webpage, or our previous Apple iOS Siri Audio Commentary Tutorial to get started. Once you’re setup for Siri in this way it is very easy to start using Siri when composing emails.

  • Open the Mail app
  • Fill in the To field via the keyboard … Siri can’t do this very well … but while you are at the keyboard, what’s the third button from the left on the bottom row? Yes, the “microphone” button gets you to Siri functionality … cute, huh?!
  • Guess we don’t need to say, but will, that this microphone button becomes useful as soon as you tap in a “keyboard” anything … Siri can be there to assist … personally!

But a word of caution here, is to check about homonyms like today’s “in all innocence” …


The rain in Spain falls mainly on the plane

… Siri faux pas. This is a small concern compared to how much it can do that is correct. Hands free dictation can be very useful for those users on the go, or those kinaesthetic thinkers, perhaps.

On the iPad latest iOS, which we’ll have to talk about soon, there are other good suggestions for Siri use to add to …

  • Mail (app) … those being …
  • Safari
  • Photos
  • Camera
  • Settings … and
  • Numerous Third Party and homegrown apps that access the keyboard, and so, Siri “microphone”

Hope this is food for thought, and we’ll leave you with today’s PDF presentation of a Mail app session using Siri to help build up the body section email content, here.


Previous relevant Apple iOS Siri Audio Commentary Tutorial is shown below.

Apple iOS Siri Audio Commentary Tutorial

Apple iOS Siri Audio Commentary Tutorial (click/touch to open and then hover, click/touch will have audio commentary)

Today we wanted to show you an idea inspired by our own previous Apple iOS Siri Primer Tutorial that combines …

… especially as Siri so much relates to audio and “voice recognition”.

Now that idea’s first, second and everything aside from ‘HTML audio elements that allow for an audio commentary of the 9 “subimages”‘ of the third parts we’ve been consistent on, but the idea to do this in the first place was secondly inspired by reading this interesting link referring to the CSS selectors :before and :after use of the content property, especially where it says …

url(url) Sets the content to be some kind of media (an image, a sound, a video, etc.)

… not quite believing it could be true … yes, an image, but “a sound, a video“? No way! Well, alas, as of this date, yes … no way … yet. Then seeing this CSS approach wasn’t working … lo and behold … this link explains more … thanks.

But this setback is not the end of the world, and the other backup plan of …

  • HTML area elements of the HTML map element will be given onmouseover and onclick event logic added to it while using the Mobilefish online map creator … and we’ll massage the resultant HTML to put this logic in as well as the HTML audio element “shells” as well as …
  • Define audio file comma separated lists in the HTML area elements’ alt attributes

… involves this Javascript DOM code to make the audio commentary be controlled by a hover (but not on mobile devices) and/or click/touch of a “subimage” of interest from the main image …


<script type='text/javascript'>

var lastomo='';
var lastoc='';
var e, prebits, bits, i;

function omo(ois) {
if (lastomo != ("" + ois.title)) {
if (ois.alt.indexOf('.') != -1) {
prebits=ois.alt.split(',');
for (i=1; i<=prebits.length; i++) {
bits=prebits[i - 1].split('.');
document.getElementById('iaudio' + i).type="audio/" + bits[1].replace('mp3','mpeg');
document.getElementById('iaudio' + i).src=prebits[i - 1];
try {
document.getElementById('iaudio' + i).play();
} catch (e) {
document.title=('problem');
}
}
}
}
lastomo="" + ois.title;
}

function oc(ois) {
if (lastoc != ("" + ois.title)) {
if (ois.alt.indexOf('.') != -1) {
prebits=ois.alt.split(',');
for (i=1; i<=prebits.length; i++) {
bits=prebits[i - 1].split('.');
document.getElementById('iaudio' + i).type="audio/" + bits[1].replace('mp3','mpeg');
document.getElementById('iaudio' + i).src=prebits[i - 1];
try {
document.getElementById('iaudio' + i).play();
} catch (e) {
document.title=('problem');
}
}
}
}
lastoc="" + ois.title;
}

</script>

You’ll see a reminder of the first CSS plan where we have …


<style>
.screenshot_1::before {
content: url('slide1.m4a');
}
</style>

… because you never know what the future holds?!

Please try our live run and/or peruse or download the HTML and Javascript and “not now” CSS you could call siri_setup_with_audio.html


Previous relevant Apple iOS Siri Primer Tutorial is shown below.

Apple iOS Siri Primer Tutorial

Apple iOS Siri Primer Tutorial

After the tutorial two days back, with Windows 10 and its Cortana voice recognition “personal assistant” (that we tested out with Windows 10 Cortana Primer Tutorial below) you’d be wondering if Apple has an equivalent, and yes, for iOS, which we are going to show today on an iPad, and there are “kind of” ways for Mac OS X El Capitan you can read about here.

Let’s see how Apple describes Siri this way …

Siri lets you use your voice to send messages, schedule meetings, place phone calls and more. Ask Siri to do things just by talking the way you talk. Siri understands what you say, knows what you mean and even talks back. Siri is so easy to use and does so much, you’ll keep finding more and more ways to use it.

This being an iPad, and this being iOS, we had no issues with microphones setting up Siri. The microphone is well integrated into iPad normal usage, and the main job for today’s iPad Siri setup that you get to via …


Settings -> General -> Siri

… relates to “voice recognition” … and which we feature some of the steps involved, with today’s tutorial picture.


Previous relevant Windows 10 Cortana Primer Tutorial is shown below.

Windows 10 Cortana Primer Tutorial

Windows 10 Cortana Primer Tutorial

In the area of robotics and artificial intelligence, perhaps the best known concept to we “mere mortals” is “voice recognition”. Perhaps because research into it goes back to 1932, before the Second World War … and 66 years before the “Worm Farm Incident of Simmons Street Disaster” … but we digress … and no … “I’m not ready to open up about this at this delicate stage of my life, yet, Brad.”.

Voice recognition has come a long way from those earliest endeavours when the speech recognition relied on training software for an individual voice. This became apparent to me trying out Cortana in Windows 10. Once working, it didn’t seem to matter who in our house asked the same question of Cortana, the speech recognition software recognized and translated the speech into the same text for all of us. Actually, Microsoft describes Cortana this way …

Cortana is your clever new personal assistant.

Cortana will help you find things on your PC, manage your calendar, track packages, find files, chat with you, and tell jokes. The more you use Cortana, the more personalized your experience will be.

To get started, type a question in the search box on the taskbar. Or select the microphone icon and talk to Cortana. (Typing works for all types of PCs, but you need a mic to talk.)

… and I see what they mean by this, because you can work Cortana without the voice recognition part, if you like, or if you have the urge to run for the nearest cupboard before being caught talking into a computer (microphone). Perhaps Cortana should have a special “Darkroom Edition” for people who …

  1. have the urge to run for the nearest cupboard before being caught talking into a computer (microphone) … and who …
  2. have a hobby developing and printing photographs

Anyway, we agree with Microsoft that Cortana is clever, and it’s nice for us to find another use for the microphone (brand called MXL Tempo) we used with WebEx work we talked about with WebEx Presentation with Microphone Tutorial below.

There is not much to setting up Cortana, except, perhaps, for the microphone bit, which we’ll talk more about later. Cortana’s “personal assistant” and interface down next to the Windows icon at the bottom left of the screen guides you well through what you have to do.

We got stuck a bit, regarding setting up the microphone, with a cycle of it presenting this voice recognition test always resulting in a message wondering whether we had the microphone set to “mute on”, which wasn’t the case. But what was the case, and remedied this problem was to use a USB 2 port rather than a USB 3 port … in case this happens to you.

Other than that, Cortana is pretty cute, and could be a good enough reason on its own to upgrade to Windows 10 from Windows 7, Windows 8.1, Windows Phone 8.1 or Windows 9 operating systems before Friday, 29th July 2016 which is the cut off day for free upgrades. Our experience of the upgrade was talked about at Windows 10 Upgrade Primer Tutorial (and backups were discussed at Windows File History Backup Primer Tutorial).

Did you know?

Sadly, some days ago saw the passing of Frank Dickens, the creator of the Bristow cartoon series, forever etched on my brain regarding The Great Tea Trolley Disaster of ’67. R.I.P.


Previous relevant WebEx Presentation with Microphone Tutorial is shown below.

WebEx Presentation with Microphone Tutorial

WebEx Presentation with Microphone Tutorial

We’ve been doing some more WebEx (by Cisco) lately, and realised, at least with using a MacBook Pro laptop, we needed to invest in a microphone, to be heard, as the inbuilt microphone systems were not up to it.

We opted for a USB connected microphone brand called MXL Tempo, sold here in Australia, and have found it to be good, especially mounted on the stand provided … well, no complaints, anyway?! Where it has a 1/8″ (3.5mm) Headphone Jack we plugged in our own speakers, though you could use headphones here as well.

Of course we’ll also be constructing a garage, and buying a guitar, and calling on “tree fellers” karaoke backing track of Peter, Paul and Mary to complete the picture of this week’s project … getting the new microphone to make breakfast in the morning before you even knew you needed breakfast get me on The Voices.

In the WebEx “Audio Connection” menu via “Call Using Computer” option have both input and output audio be handled by “USB audio CODEC” (if they are options … if not, there is a hardware (perhaps configuration) problem with your audio and microphone connection) as you can see at today’s tutorial picture. So long as you succeed and have the USB connected, the audio connection will default to this arrangement for the next time. Cute, huh?!

To make it permanent that the MXL Tempo microphone arrangement is the default device for recordings …

  1. click on System Preferences off the Apple menu
  2. click the Sound option
  3. click the Output tab
  4. pick USB audio CODEC
  5. if you intend using speakers or headphones connected off this microphone from its 1/8″ (3.5mm) Headphone Jack, click the Input tab
  6. pick USB audio CODEC

Being heard never seemed so easy!


Previous relevant WebEx Prerecording Primer Tutorial is shown below.

WebEx Prerecording Primer Tutorial

WebEx Prerecording Primer Tutorial

We’ve been trying out WebEx (by Cisco) prerecording as a video conferencing idea as an alternative to …

… regarding video conferencing products we’ve tried at this blog.

Have to say, WebEx is great, even with respect to the “wide eyed and bushy tailed” reaction “this little black duck” has to all these networky communicaty ideas on the net (at least we spelt “net” correctly).

Have to thank my wife, Maree, for her expertise and the facilities her company, Thomson Reuters, supplies for the serving of WebEx recordings … thanks everyone. Have been assured they are periodically deleted, and my lame impersonations of the old “ducks on the wall” can rest in peace shortly.

And so, we have a slideshow starting with a WebEx email link to join a meeting, and we pan down the email to show you other WebEx functionalities, such as adding a Calendar reference to the meeting time, and though we haven’t shown you detail here, rest assured it handles timezone scenarios very well, unless you lie about living in Antarctica, that is … sorry, scientists in Antarctica reading this blog posting … all 237 of you.

During this “earlier than today exploration of WebEx” session the necessary software installs just happened for this MacBook Pro Mac OS X laptop as if we were shelling peas … it’s always good to have some handy when installing any software. So we won’t show you this unless we deem it essential at a later date. You can perhaps do as I did, and ask a real WebEx user invite you to a meeting, to set yourself up. In fact, today’s session meeting creation time you may notice is well in the past from that earlier introductory learning session Maree and I had, and you can bring back up that old email, and resurrect that meeting again and again, if you like … am not sure if there is an expiry date on this too, like with server stored WebEx prerecordings.

So also rest assured, WebEx handles …

  • video via webcam on your device
  • audio via microphone on your device (“Use Computer”) or via a phone line
  • the synchronization of the two above
  • mobile devices

Did you know?

A .ics extension file, as you can see being used as an email attachment file extension in is, as explained in this link‘s sublink …

ICS is a global format for calendar files widely being utilized by various calendar and email programs including Google Calendar, Apple iCal, and Microsoft Outlook. These files enable users to share and publish information directly from their calendars over email or via uploading it to the world wide web.

… as helping interface meetings to online calendar appointments. Cute, huh?!

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , | Leave a comment

What Three Words Interfacing Primer Tutorial

What Three Words Interfacing Primer Tutorial

What Three Words Interfacing Primer Tutorial

Did you ever see the spy thriller called The Undeclared War? There’s this really brilliant female developer/programmer/coder who at one point deciphers a message embedded within “to your everyday person” meaningless looking data they’re analyzing for rogue activity, and she ends up with …


Three Words

… that do not really fit in with the rest of the decrypted text. And those three words end up representing a place on Earth where she should meet her contact with important information to stop the rogue activity?! Huh?! Welcome to the wooooooorrrrrllllldddd of …


What 3 Words

… where, as defined yet, three words can define to a 3 meter by 3 meter square on Earth a position! Go figure! Get the mobile app and the reference …


///input.fines.bonus

… can help you navigate to the Queen Victoria Building in Sydney, Australia. Cute, huh?!

So we wrote a simple interfacing web application to soak up the “map interest” …

Ahhhhhhhhhmazing!

If this was interesting you may be interested in this too.

Posted in Android, Coding, eLearning, Event-Driven Programming, Software, Tutorials | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Local Tutorial

Xcode Executable Finding and Executing Local Tutorial

Xcode Executable Finding and Executing Local Tutorial

Moving on from yesterday’s Xcode Executable Finding and Executing Animation Tutorial not in a cab, today, we have a “to do list” for you to make the most out of the “presentation possibilities” for the recent web application we’ve been working on, presupposing you …

  • work on macOS ( in particular, cough, cough … and for the great Text to Speech brilliance of the say command, perhaps ending up at the web browser address bar using http://localhost:8888/find_xcode_executable.php ) or Windows ( perhaps ending up at the web browser address bar using http://localhost/find_xcode_executable.php )
  • have a local Apache/PHP web server going, such as MAMP
  • are willing to take time to set things up

… that “to do list” needed to make the most of the additional …

  1. Canvas
  2. Audio
  3. Selfie

… added “for creatives” functionality today (where ? links to blog search) …

Phew! We’re also asking this regarding your sanity, and whether you wouldn’t get greater performance with all this work, working off an Apache/PHP local web server (“he says with the poor ol’ RJM Programming web server in mind”). These are optional for use, but the three (and am not sure about “Media” either) new ideas above will not even appear as usable functionality when using the (what we’ll now start calling) Xcode executable and/or Online URL and/or Media and/or Canvas and/or Audio and/or Selfie “presentation” or “procedure” assisting web application from your local web server Environment if you don’t have software arranged, as outlined above.

What is the common “conduit” for all three new modes of input above? They all “create media data” that ends up being accessible (if you have things set up okay) as data URI data, which, as we said with Xcode Executable Finding and Executing Browsing Tutorial

… we convert the data URIs of the File API browsing into an Online URL by temporarily converting it into a “several hours existant” web server media file existing in …

… we do more of this, arranging interventions when data URI creation is discovered and usually displayed with a textarea element, and we transfer that media data back to the Xcode executable and/or Online URL and/or Media and/or Canvas and/or Audio and/or Selfie “presentation” or “procedure” assisting web application, as a new record (or table row) there, ready to contribute, as a component to a presentation or procedure perhaps.

So, feel free to try the changed find_xcode_executable.php tenth draft Xcode executable and/or Online URL and/or Media and/or Canvas and/or Audio and/or Selfie “presentation” or “procedure” assisting web application.


Previous relevant Xcode Executable Finding and Executing Animation Tutorial is shown below.

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Animation Tutorial

Today we have a sixth cab joining with the fourth cab (in a convoy, like) to follow the fifth cab (on the superhighway now) to follow the third cab (in the pitstop) to follow the second cab (on a fare to Oodnadatta) after that first cab (still liaising with cab four (… how could you forget?!)) off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Sharing Tutorial concerns …

the Browsing of Local Media Files the PHP can set up after user has defined non-zero delay value(s) can be Animated within the presentation

… allowing the user to see either/both modes of Media display, out of …

  1. within new web browser window(s) … and/or …
  2. as (perhaps Javascript img or iframe element animated) image presentation(s) back at the originating window for launching those new web browser window(s)

… and the users can pick or choose between these given we discovered via if an a element onclick event function returns false does the href navigation proceed? that we could start using an “a” element “onclick” event function return to control whether or not to apply “a” element “href” attribute URL navigation action(s), via the manipulation of the PHP variables shown in the intialization code for them, below …

<?php

$allimgs=true;
$dactor="Terminal";
$dverb="do script";
$undis="";
$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
$ifendbit="<iframe id=myifid style=display:none;overflow-x:visible;width:900px;height:900px; src=/About_Us.html></iframe>";
if ($allimgs) {
$ifendbit="<img id=myifid style=object-fit:contain;display:none;overflow-x:visible;width:900px;height:900px; src=/About_Us.html></img>";
}
$bodystyle="";
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}
if (($sleepabys + $seqdelay) == 0) {
$ifendbit="<div id=myifid style=display:none;overflow-x:visible;width:900px;height:900px;></div>";
}
$hscr="<head><title>Xcode++ project to find executable path - RJM Programming - November, 2026</title><scr" . "ipt tyle=text/javascript> var showinhouse=[true,true]; function verify(oa) { if (" . ($sleepabys + $seqdelay) . " != 0 && ('' + oa.href).indexOf('/tmp/diffident_') != -1) { document.getElementById('bsiw').style.display='inline-block'; document.getElementById('bssb').style.display='inline-block'; if (showinhouse[1]) { document.getElementById('myifid').style.display='inline-block'; document.getElementById('myifid').src=oa.href; } if (!showinhouse[0]) { return false; } } if (!showinhouse[0]) { return false; } return true; } setTimeout(function(){ if (document.getElementById('myifid')) { document.getElementById('myifid').style.width='' + screen.width + 'px'; document.getElementById('myifid').style.height='' + eval(0.805 * eval('' + screen.height)) + 'px'; } }, 8000)</scr" . "ipt></head>";
$hatend="<br><br><button onclick=\"showinhouse[0]=false; this.style.visibility='hidden';\" style=display:none;background-color:lightgreen;color:blue; id=bsiw>Stop Showing Media in New Windows</button>  <button onclick=\"showinhouse[1]=false; this.style.visibility='hidden';\" style=display:none;background-color:lightblue;color:blue; id=bssb>Stop Showing Media Below</button><br><br>" . $ifendbit;

?>

… in the changed find_xcode_executable.php ninth draft live run link.

Did You Know?

Some readers may know that we have a “fall back” logic set for the vast majority of “design pickles” you get into with webpage design, they being …

  1. overlay … and/or …
  2. reveal

… which we hope are self-evident words for what we mean here. With the latter reveal concept it became, a “lay-down misère” to use the …

  • details … and …
  • summary

… “dynamic duo” of HTML element and subelement when they were introduced.

But as you code anything within the summary subelement innards for “out of usual scope intelligence”, it quickly becomes apparent that, practically speaking, what extra you might want to do there, may get compromised if it involves the event …


onclick

… because unless you involve the cute idea below, you will have, by clicking anything on the summary subelement, also changed the “reveal” status of the overseeing details element. You may mean to do that, but more likely not?! But in your event logic, and we do it today to allow for iframe height user driven height management purposes in an onmouseover event, you can separate out the summary goings on from the hierarchical details element involvement by using …


event.stopPropagation();

The other tip for oncontextmenu event tailored coding that avoids rubbing up against the native event workings is to use …


event.preventDefault();


Previous relevant Xcode Executable Finding and Executing Sharing Tutorial is shown below.

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Sharing Tutorial

Today we have a fifth cab hot on the heels of the fourth cab (in a convoy, like) to follow the third cab (in the pitstop) to follow the second cab (on a fare to Oodnadatta) after that first cab (still liaising with cab four (… how could you forget?!)) off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Browsing Tutorial concerns …

the Sharing via email or SMS of the PHP and webpage conditions the originator is seeing (within reason)

… allowing the user to share what they see, the “within reason” being the potential issue that any Xcode executable defined within the deployment set may not exist in the same path, or at all, at the recipient’s device …

<?php echo ”

function emailit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var inpsare=document.getElementsByTagName('input');
var mih=document.getElementById('mytbody').innerHTML;
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
//alert('1:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)]);
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
//alert('11:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0]);
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
var anchor = document.createElement('a');
anchor.href = 'mailto:?subject=' + encodeURIComponent('Xcode Executable(s) and/or Online URL(s) and/or Media presentation ...') + '&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='Email';
anchor.target='_top';
anchor.click();
}

function smsit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var anchor = document.createElement('a');
var mih=document.getElementById('mytbody').innerHTML;
var inpsare=document.getElementsByTagName('input');
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
anchor.href = 'sms:&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='SMS';
anchor.target='_top';
anchor.click();
}

“; ?>

… in the changed find_xcode_executable.php eighth draft live run link.

Did You Know?

We asked, of Google, can a recipient window navigated to via a target=_blank form reference back to the window that opened it? … and the …

Yes, a newly opened window from a <form target=”_blank”> can reference the opening window via window.opener, subject to browser security policies and rel attributes.

… (short) answer was both …

  1. pleasing news … and …
  2. ouch! … why hadn’t we asked this before

… because we are fond of both …

  1. a target=_blank … and less virilently (ie. to read online, both are frowned upon) …
  2. form target=_blank

… scenarios, but we’d always imagined, somehow, that only a window.open call could yield a window.opener “look back” window object reference.

The form attribute …


rel="opener"

… was interesting to us, here, too.

And the purpose of the interest? Well, once a user clicks/taps the “Execute” submit button, using the Xcode executables and/or Online URLs and/or Local Media presentations web application, both the …

  1. calling window (with it’s Email and SMS smarts) … and the …
  2. recipient window (able to reference the calling window via window.opener)

… now remain existant because we moved our HTML form logic from (the implied) target=_self (ie. clobber) to becoming target=_blank, allowing, at the recipient window, the events …

  • ondblclick (double click) can send an email off to someone so that they can see what you can (depending on Xcode business)
  • oncontextmenu (non-mobile right click) or ontouchmove (mobile touch move) can send an SMS off to someone so that they can see what you can (depending on Xcode business)

… via particularly new PHP code …

<?php

$hscr="<head><title>Xcode++ project to find executable path - RJM Programming - November, 2026</title><scr" . "ipt tyle=text/javascript> var showinhouse=[true,true]; function verify(oa) { if (" . ($sleepabys + $seqdelay) . " != 0 && ('' + oa.href.toLowerCase()).replace('.jp','/tmp/diffident_').replace('.png','/tmp/diffident_').replace('.bmg','/tmp/diffident_').replace('.gif','/tmp/diffident_').replace('.heic','/tmp/diffident_').indexOf('/tmp/diffident_') != -1) { document.getElementById('bsiw').style.display='inline-block'; document.getElementById('bssb').style.display='inline-block'; if (showinhouse[1]) { document.getElementById('myifid').style.display='inline-block'; document.getElementById('myifid').src=oa.href; } if (!showinhouse[0]) { return false; } } if (!showinhouse[0]) { return false; } return true; } setTimeout(function(){ if (document.getElementById('myifid')) { document.getElementById('myifid').style.width='' + screen.width + 'px'; document.getElementById('myifid').style.height='' + eval(0.805 * eval('' + screen.height)) + 'px'; } }, 8000); if (window.opener) { setTimeout(function(){ document.body.title='Double click to send email or right click or touch move to send SMS.'; document.body.ondblclick=function(){ window.opener.document.getElementById('bshareemail').click(); window.opener.focus(); }; document.body.oncontextmenu=function(event){ event.preventDefault(); window.opener.document.getElementById('bsharesms').click(); window.opener.focus(); }; document.body.ontouchmove=function(){ if (window.opener.document.getElementById('bsharesms').title.indexOf(' ') == -1) { window.opener.document.getElementById('bsharesms').click(); window.opener.document.getElementById('bsharesms').title+=' '; window.opener.focus(); } }; }, 7000); } </scr" . "ipt></head>";

?>

… application, can be brought into play to improve sharing functionality Javascript (via PHP) logic.


Previous relevant Xcode Executable Finding and Executing Browsing Tutorial is shown below.

Xcode Executable Finding and Executing Browsing Tutorial

Xcode Executable Finding and Executing Browsing Tutorial

Today we have a fourth cab sent out by the first cab to follow the third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Browsing of Local Media Files the PHP sets up as a third prong to the Environment’s existant Xcode Executable(s) and Online URL(s) modes of input

… having us start thinking about data URI processing (and “in the bigger picture” for all of this, is starting to resemble a web application able to assemble the components needed for a presentation, as well), and in order to have a “meeting of minds” between …

  1. Browsing of Local Media Files … and …
  2. Online URL(s)

… we convert the data URIs of the File API browsing into an Online URL by temporarily converting it into a “several hours existant” web server media file existing in …


https://www.rjmprogramming.com.au/tmp/

… via PHP writes HTML like …

<?php echo ”

<br><br><span style=font-weight:bold;> ... and/or Media ...</span><br><span id=spagspan><iframe class=\"spag\" scrolling=\"no\" onload=\"checkit(this);\" id=\"cbi\" frameborder=\"0\" style=\"width:173px;height:218px;margin-top:-194px;\" src=\"/HTMLCSS/client_browsing.htm?d=312160562686&wording=Allimages%20images%2E%20\"></iframe></span><br><br>

“; ?>

… where, today, we also write new PHP writes Ajax using Javascript …

<?php echo ”

function ajaxit(gn, gc) {
zhr = new XMLHttpRequest();
zhrtwo = new XMLHttpRequest();
zform = new FormData();
zformtwo = new FormData();
var thename='';
if (gn.indexOf('.') != -1) {
thename=gn; //'/tmp/diffident_media_' + Math.floor(Math.random() * 198976543) + '.' + gn.split('.')[eval(-1 + gn.split('.').length)];
document.getElementById(execid).value=thename;
} else {
thename=gn;
document.getElementById(execid).value='/tmp/diffident_media_' + thename + '.' + gc.split(';base64,')[0].split('/')[eval(-1 + gc.split(';base64,')[0].split('/').length)];
}
zform.append('execname', thename);
zform.append('execcont', '' + gc);
zhr.open('post', document.URL.split('?')[0].split('#')[0], true);
zhr.send(zform);
document.getElementById('ssdp').style.display='inline-block';
document.getElementById('ssou').style.display='inline-block';
document.getElementById('dmurl').innerHTML='<input type=hidden name=isurl id=isurl value=y></input>';
maybeurl(document.getElementById(execid));
if (document.URL.indexOf('rjmprogramming.com.au') == -1) {
zformtwo.append('execname', thename);
zformtwo.append('execcont', '' + gc);
zhrtwo.open('post', '//www.rjmprogramming.com.au/local_tmp_uploader.php', true);
zhrtwo.send(zformtwo);
} else {
zhrtwo=null;
zformtwo=null;
}
}

function checkres() {
resis='';
gresis='';
if (document.getElementById('result').innerHTML.indexOf('data:') != -1 && document.getElementById('result').innerHTML != lastduri) {
gresis=document.getElementById('result').innerHTML;
if (document.getElementById('execexec').value != '') {
execid=assess(document.getElementById(execid),true); //?
//document.getElementById(execid).value=gresis; //?
}
resis='';
document.getElementById('result').innerHTML='';
if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; }
if (document.getElementById('audioname').value.trim() != '') {
gifnameis='/tmp/diffident_media_' + Math.floor(Math.random() * 1989786) + '.' + document.getElementById('audioname').value.split('.')[eval(-1 + document.getElementById('audioname').value.split('.').length)];
} else {
gifnameis='' + Math.floor(Math.random() * 1989786);
}
lastduri=gresis;
ajaxit(gifnameis, gresis);
document.getElementById('spagspan').innerHTML=ssis;
}
document.getElementById('audioname').value='';
}

“; ?>

… helping out this new functionality concept in the changed find_xcode_executable.php sixth draft live run link.


Previous relevant Xcode Executable Finding and Executing Scheduling Tutorial is shown below.

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Today’s third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Timing the PHP sets up for each of the Records the PHP sets up the deployments via

… where, up until today, the record deployments were all executed one after the other as soon as was possible and only the once. This, what we’d categorize as scheduling functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative and scheduled way, and in the case of a macOS MAMP Environment a scheduled combination of Xcode executable execution(s) and/or web browser URL webpage opening(s) are possible now.

We allow users to define two types of delay between record deployments, those being the optional …

  1. the delay in seconds between sets of deployments
  2. the delay in seconds between execution timing of components of any single deployment set

Within the “phase two” after form submit calling oneself actions the PHP …

<?php

$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}

?>

… establishes whether any non-zero such delays affect the subsequent changed from yesterday …

<?php

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
$maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
//$maxwithin+=$sleepabys;
}
if ($seqdelay > 0) {

if ($ebo != "" && $hbo == "") { // && $cbo == "") {
$hbo=$ehbo;
$ebo='';
$oktoexit=true;
$dothisecho="";
}
if ($hbo != "" && $ebo == "") { // && $cbo == "") {
$onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
if ($cbo != "") {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
}

if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); ";
}

if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
$hbo=str_replace(" onload=\"", $onl, $hbo);
}

$hbo=str_replace("</body>", "  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);

$cbo="";
} else {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
}
$dothisecho="";
$x='';
}
//file_put_contents('x.x','');
if ($hbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
echo $hbo;
}
if ($ebo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($ebo);
}
}
if ($cbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
//passthru($cbo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($cbo);
}
}
if ($dothisecho != '') {
//file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
//echo $dothisecho;
if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); \"";
}
//file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
echo "<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
$dothisecho="";
$x='';
$oktoexit=true;
}

?>

… in the changed find_xcode_executable.php fifth draft live run link.


Previous relevant Xcode Executable Finding and Executing Records Tutorial is shown below.

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, eLearning, Event-Driven Programming, Operating System, Software, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Animation Tutorial

Today we have a sixth cab joining with the fourth cab (in a convoy, like) to follow the fifth cab (on the superhighway now) to follow the third cab (in the pitstop) to follow the second cab (on a fare to Oodnadatta) after that first cab (still liaising with cab four (… how could you forget?!)) off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Sharing Tutorial concerns …

the Browsing of Local Media Files the PHP can set up after user has defined non-zero delay value(s) can be Animated within the presentation

… allowing the user to see either/both modes of Media display, out of …

  1. within new web browser window(s) … and/or …
  2. as (perhaps Javascript img or iframe element animated) image presentation(s) back at the originating window for launching those new web browser window(s)

… and the users can pick or choose between these given we discovered via if an a element onclick event function returns false does the href navigation proceed? that we could start using an “a” element “onclick” event function return to control whether or not to apply “a” element “href” attribute URL navigation action(s), via the manipulation of the PHP variables shown in the intialization code for them, below …

<?php

$allimgs=true;
$dactor="Terminal";
$dverb="do script";
$undis="";
$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
$ifendbit="<iframe id=myifid style=display:none;overflow-x:visible;width:900px;height:900px; src=/About_Us.html></iframe>";
if ($allimgs) {
$ifendbit="<img id=myifid style=object-fit:contain;display:none;overflow-x:visible;width:900px;height:900px; src=/About_Us.html></img>";
}
$bodystyle="";
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}
if (($sleepabys + $seqdelay) == 0) {
$ifendbit="<div id=myifid style=display:none;overflow-x:visible;width:900px;height:900px;></div>";
}
$hscr="<head><title>Xcode++ project to find executable path - RJM Programming - November, 2026</title><scr" . "ipt tyle=text/javascript> var showinhouse=[true,true]; function verify(oa) { if (" . ($sleepabys + $seqdelay) . " != 0 && ('' + oa.href).indexOf('/tmp/diffident_') != -1) { document.getElementById('bsiw').style.display='inline-block'; document.getElementById('bssb').style.display='inline-block'; if (showinhouse[1]) { document.getElementById('myifid').style.display='inline-block'; document.getElementById('myifid').src=oa.href; } if (!showinhouse[0]) { return false; } } if (!showinhouse[0]) { return false; } return true; } setTimeout(function(){ if (document.getElementById('myifid')) { document.getElementById('myifid').style.width='' + screen.width + 'px'; document.getElementById('myifid').style.height='' + eval(0.805 * eval('' + screen.height)) + 'px'; } }, 8000)</scr" . "ipt></head>";
$hatend="<br><br><button onclick=\"showinhouse[0]=false; this.style.visibility='hidden';\" style=display:none;background-color:lightgreen;color:blue; id=bsiw>Stop Showing Media in New Windows</button>  <button onclick=\"showinhouse[1]=false; this.style.visibility='hidden';\" style=display:none;background-color:lightblue;color:blue; id=bssb>Stop Showing Media Below</button><br><br>" . $ifendbit;

?>

… in the changed find_xcode_executable.php ninth draft live run link.

Did You Know?

Some readers may know that we have a “fall back” logic set for the vast majority of “design pickles” you get into with webpage design, they being …

  1. overlay … and/or …
  2. reveal

… which we hope are self-evident words for what we mean here. With the latter reveal concept it became, a “lay-down misère” to use the …

  • details … and …
  • summary

… “dynamic duo” of HTML element and subelement when they were introduced.

But as you code anything within the summary subelement innards for “out of usual scope intelligence”, it quickly becomes apparent that, practically speaking, what extra you might want to do there, may get compromised if it involves the event …


onclick

… because unless you involve the cute idea below, you will have, by clicking anything on the summary subelement, also changed the “reveal” status of the overseeing details element. You may mean to do that, but more likely not?! But in your event logic, and we do it today to allow for iframe height user driven height management purposes in an onmouseover event, you can separate out the summary goings on from the hierarchical details element involvement by using …


event.stopPropagation();

The other tip for oncontextmenu event tailored coding that avoids rubbing up against the native event workings is to use …


event.preventDefault();


Previous relevant Xcode Executable Finding and Executing Sharing Tutorial is shown below.

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Sharing Tutorial

Today we have a fifth cab hot on the heels of the fourth cab (in a convoy, like) to follow the third cab (in the pitstop) to follow the second cab (on a fare to Oodnadatta) after that first cab (still liaising with cab four (… how could you forget?!)) off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Browsing Tutorial concerns …

the Sharing via email or SMS of the PHP and webpage conditions the originator is seeing (within reason)

… allowing the user to share what they see, the “within reason” being the potential issue that any Xcode executable defined within the deployment set may not exist in the same path, or at all, at the recipient’s device …

<?php echo ”

function emailit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var inpsare=document.getElementsByTagName('input');
var mih=document.getElementById('mytbody').innerHTML;
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
//alert('1:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)]);
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
//alert('11:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0]);
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
var anchor = document.createElement('a');
anchor.href = 'mailto:?subject=' + encodeURIComponent('Xcode Executable(s) and/or Online URL(s) and/or Media presentation ...') + '&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='Email';
anchor.target='_top';
anchor.click();
}

function smsit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var anchor = document.createElement('a');
var mih=document.getElementById('mytbody').innerHTML;
var inpsare=document.getElementsByTagName('input');
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
anchor.href = 'sms:&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='SMS';
anchor.target='_top';
anchor.click();
}

“; ?>

… in the changed find_xcode_executable.php eighth draft live run link.

Did You Know?

We asked, of Google, can a recipient window navigated to via a target=_blank form reference back to the window that opened it? … and the …

Yes, a newly opened window from a <form target=”_blank”> can reference the opening window via window.opener, subject to browser security policies and rel attributes.

… (short) answer was both …

  1. pleasing news … and …
  2. ouch! … why hadn’t we asked this before

… because we are fond of both …

  1. a target=_blank … and less virilently (ie. to read online, both are frowned upon) …
  2. form target=_blank

… scenarios, but we’d always imagined, somehow, that only a window.open call could yield a window.opener “look back” window object reference.

The form attribute …


rel="opener"

… was interesting to us, here, too.

And the purpose of the interest? Well, once a user clicks/taps the “Execute” submit button, using the Xcode executables and/or Online URLs and/or Local Media presentations web application, both the …

  1. calling window (with it’s Email and SMS smarts) … and the …
  2. recipient window (able to reference the calling window via window.opener)

… now remain existant because we moved our HTML form logic from (the implied) target=_self (ie. clobber) to becoming target=_blank, allowing, at the recipient window, the events …

  • ondblclick (double click) can send an email off to someone so that they can see what you can (depending on Xcode business)
  • oncontextmenu (non-mobile right click) or ontouchmove (mobile touch move) can send an SMS off to someone so that they can see what you can (depending on Xcode business)

… via particularly new PHP code …

<?php

$hscr="<head><title>Xcode++ project to find executable path - RJM Programming - November, 2026</title><scr" . "ipt tyle=text/javascript> var showinhouse=[true,true]; function verify(oa) { if (" . ($sleepabys + $seqdelay) . " != 0 && ('' + oa.href.toLowerCase()).replace('.jp','/tmp/diffident_').replace('.png','/tmp/diffident_').replace('.bmg','/tmp/diffident_').replace('.gif','/tmp/diffident_').replace('.heic','/tmp/diffident_').indexOf('/tmp/diffident_') != -1) { document.getElementById('bsiw').style.display='inline-block'; document.getElementById('bssb').style.display='inline-block'; if (showinhouse[1]) { document.getElementById('myifid').style.display='inline-block'; document.getElementById('myifid').src=oa.href; } if (!showinhouse[0]) { return false; } } if (!showinhouse[0]) { return false; } return true; } setTimeout(function(){ if (document.getElementById('myifid')) { document.getElementById('myifid').style.width='' + screen.width + 'px'; document.getElementById('myifid').style.height='' + eval(0.805 * eval('' + screen.height)) + 'px'; } }, 8000); if (window.opener) { setTimeout(function(){ document.body.title='Double click to send email or right click or touch move to send SMS.'; document.body.ondblclick=function(){ window.opener.document.getElementById('bshareemail').click(); window.opener.focus(); }; document.body.oncontextmenu=function(event){ event.preventDefault(); window.opener.document.getElementById('bsharesms').click(); window.opener.focus(); }; document.body.ontouchmove=function(){ if (window.opener.document.getElementById('bsharesms').title.indexOf(' ') == -1) { window.opener.document.getElementById('bsharesms').click(); window.opener.document.getElementById('bsharesms').title+=' '; window.opener.focus(); } }; }, 7000); } </scr" . "ipt></head>";

?>

… application, can be brought into play to improve sharing functionality Javascript (via PHP) logic.


Previous relevant Xcode Executable Finding and Executing Browsing Tutorial is shown below.

Xcode Executable Finding and Executing Browsing Tutorial

Xcode Executable Finding and Executing Browsing Tutorial

Today we have a fourth cab sent out by the first cab to follow the third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Browsing of Local Media Files the PHP sets up as a third prong to the Environment’s existant Xcode Executable(s) and Online URL(s) modes of input

… having us start thinking about data URI processing (and “in the bigger picture” for all of this, is starting to resemble a web application able to assemble the components needed for a presentation, as well), and in order to have a “meeting of minds” between …

  1. Browsing of Local Media Files … and …
  2. Online URL(s)

… we convert the data URIs of the File API browsing into an Online URL by temporarily converting it into a “several hours existant” web server media file existing in …


https://www.rjmprogramming.com.au/tmp/

… via PHP writes HTML like …

<?php echo ”

<br><br><span style=font-weight:bold;> ... and/or Media ...</span><br><span id=spagspan><iframe class=\"spag\" scrolling=\"no\" onload=\"checkit(this);\" id=\"cbi\" frameborder=\"0\" style=\"width:173px;height:218px;margin-top:-194px;\" src=\"/HTMLCSS/client_browsing.htm?d=312160562686&wording=Allimages%20images%2E%20\"></iframe></span><br><br>

“; ?>

… where, today, we also write new PHP writes Ajax using Javascript …

<?php echo ”

function ajaxit(gn, gc) {
zhr = new XMLHttpRequest();
zhrtwo = new XMLHttpRequest();
zform = new FormData();
zformtwo = new FormData();
var thename='';
if (gn.indexOf('.') != -1) {
thename=gn; //'/tmp/diffident_media_' + Math.floor(Math.random() * 198976543) + '.' + gn.split('.')[eval(-1 + gn.split('.').length)];
document.getElementById(execid).value=thename;
} else {
thename=gn;
document.getElementById(execid).value='/tmp/diffident_media_' + thename + '.' + gc.split(';base64,')[0].split('/')[eval(-1 + gc.split(';base64,')[0].split('/').length)];
}
zform.append('execname', thename);
zform.append('execcont', '' + gc);
zhr.open('post', document.URL.split('?')[0].split('#')[0], true);
zhr.send(zform);
document.getElementById('ssdp').style.display='inline-block';
document.getElementById('ssou').style.display='inline-block';
document.getElementById('dmurl').innerHTML='<input type=hidden name=isurl id=isurl value=y></input>';
maybeurl(document.getElementById(execid));
if (document.URL.indexOf('rjmprogramming.com.au') == -1) {
zformtwo.append('execname', thename);
zformtwo.append('execcont', '' + gc);
zhrtwo.open('post', '//www.rjmprogramming.com.au/local_tmp_uploader.php', true);
zhrtwo.send(zformtwo);
} else {
zhrtwo=null;
zformtwo=null;
}
}

function checkres() {
resis='';
gresis='';
if (document.getElementById('result').innerHTML.indexOf('data:') != -1 && document.getElementById('result').innerHTML != lastduri) {
gresis=document.getElementById('result').innerHTML;
if (document.getElementById('execexec').value != '') {
execid=assess(document.getElementById(execid),true); //?
//document.getElementById(execid).value=gresis; //?
}
resis='';
document.getElementById('result').innerHTML='';
if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; }
if (document.getElementById('audioname').value.trim() != '') {
gifnameis='/tmp/diffident_media_' + Math.floor(Math.random() * 1989786) + '.' + document.getElementById('audioname').value.split('.')[eval(-1 + document.getElementById('audioname').value.split('.').length)];
} else {
gifnameis='' + Math.floor(Math.random() * 1989786);
}
lastduri=gresis;
ajaxit(gifnameis, gresis);
document.getElementById('spagspan').innerHTML=ssis;
}
document.getElementById('audioname').value='';
}

“; ?>

… helping out this new functionality concept in the changed find_xcode_executable.php sixth draft live run link.


Previous relevant Xcode Executable Finding and Executing Scheduling Tutorial is shown below.

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Today’s third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Timing the PHP sets up for each of the Records the PHP sets up the deployments via

… where, up until today, the record deployments were all executed one after the other as soon as was possible and only the once. This, what we’d categorize as scheduling functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative and scheduled way, and in the case of a macOS MAMP Environment a scheduled combination of Xcode executable execution(s) and/or web browser URL webpage opening(s) are possible now.

We allow users to define two types of delay between record deployments, those being the optional …

  1. the delay in seconds between sets of deployments
  2. the delay in seconds between execution timing of components of any single deployment set

Within the “phase two” after form submit calling oneself actions the PHP …

<?php

$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}

?>

… establishes whether any non-zero such delays affect the subsequent changed from yesterday …

<?php

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
$maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
//$maxwithin+=$sleepabys;
}
if ($seqdelay > 0) {

if ($ebo != "" && $hbo == "") { // && $cbo == "") {
$hbo=$ehbo;
$ebo='';
$oktoexit=true;
$dothisecho="";
}
if ($hbo != "" && $ebo == "") { // && $cbo == "") {
$onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
if ($cbo != "") {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
}

if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); ";
}

if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
$hbo=str_replace(" onload=\"", $onl, $hbo);
}

$hbo=str_replace("</body>", "  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);

$cbo="";
} else {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
}
$dothisecho="";
$x='';
}
//file_put_contents('x.x','');
if ($hbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
echo $hbo;
}
if ($ebo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($ebo);
}
}
if ($cbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
//passthru($cbo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($cbo);
}
}
if ($dothisecho != '') {
//file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
//echo $dothisecho;
if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); \"";
}
//file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
echo "<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
$dothisecho="";
$x='';
$oktoexit=true;
}

?>

… in the changed find_xcode_executable.php fifth draft live run link.


Previous relevant Xcode Executable Finding and Executing Records Tutorial is shown below.

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, Animation, eLearning, Event-Driven Programming, Operating System, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Sharing Tutorial

Xcode Executable Finding and Executing Animation Tutorial

Xcode Executable Finding and Executing Sharing Tutorial

Today we have a fifth cab hot on the heels of the fourth cab (in a convoy, like) to follow the third cab (in the pitstop) to follow the second cab (on a fare to Oodnadatta) after that first cab (still liaising with cab four (… how could you forget?!)) off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Browsing Tutorial concerns …

the Sharing via email or SMS of the PHP and webpage conditions the originator is seeing (within reason)

… allowing the user to share what they see, the “within reason” being the potential issue that any Xcode executable defined within the deployment set may not exist in the same path, or at all, at the recipient’s device …

<?php echo ”

function emailit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var inpsare=document.getElementsByTagName('input');
var mih=document.getElementById('mytbody').innerHTML;
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
//alert('1:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)]);
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
//alert('11:' + mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0]);
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
var anchor = document.createElement('a');
anchor.href = 'mailto:?subject=' + encodeURIComponent('Xcode Executable(s) and/or Online URL(s) and/or Media presentation ...') + '&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='Email';
anchor.target='_top';
anchor.click();
}

function smsit() {
var domainbit=document.URL.split('?')[0].split('#')[0].split('//')[0] + '//' + document.URL.split('?')[0].split('#')[0].split('//')[1].split('/')[0] + '/';
var snamebit='find_xcode_executable.php', argsbit='';
var anchor = document.createElement('a');
var mih=document.getElementById('mytbody').innerHTML;
var inpsare=document.getElementsByTagName('input');
for (var ii=0; ii<inpsare.length; ii++) {
if (inpsare[ii].outerHTML.split('>')[0].indexOf(' type=\"text\"') != -1 && inpsare[ii].outerHTML.split('>')[0].indexOf(' name=') != -1) {
if (inpsare[ii].value != inpsare[ii].value.replace(/^\/tmp\/diffident/g,'') && domainbit.indexOf('rjmprogramming.com.au') == -1) {
domainbit='https://rjmprogramming.com.au/';
}
if (argsbit == '') {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit='?' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
} else {
if (mih.indexOf(' name=\"' + inpsare[ii].name + '\"') != -1 && inpsare[ii].value != '') {
if (mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0], mih.split(' name=\"' + inpsare[ii].name + '\"')[1].split('>')[0].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
} else if (mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].indexOf(' value=\"\"') != -1) {
mih=mih.replace(mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)], mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ')[eval(-1 + mih.split(' name=\"' + inpsare[ii].name + '\"')[0].split('<input ').length)].replace(' value=\"\"',' value=\"' + inpsare[ii].value.replace(/\"/g,(String.fromCharCode(96) + String.fromCharCode(92) + String.fromCharCode(92) + String.fromCharCode(34)).substring(0,1)) + '\"'))
}
}
argsbit+='&' + inpsare[ii].name + '=' + encodeURIComponent(inpsare[ii].value);
}
}
}
if (argsbit != '') {
argsbit='?mytbodyih=' + encodeURIComponent(mih);
}
anchor.href = 'sms:&body=' + encodeURIComponent(domainbit + snamebit + argsbit);
anchor.style.display='none';
anchor.innerHTML='SMS';
anchor.target='_top';
anchor.click();
}

“; ?>

… in the changed find_xcode_executable.php eighth draft live run link.

Did You Know?

We asked, of Google, can a recipient window navigated to via a target=_blank form reference back to the window that opened it? … and the …

Yes, a newly opened window from a <form target=”_blank”> can reference the opening window via window.opener, subject to browser security policies and rel attributes.

… (short) answer was both …

  1. pleasing news … and …
  2. ouch! … why hadn’t we asked this before

… because we are fond of both …

  1. a target=_blank … and less virilently (ie. to read online, both are frowned upon) …
  2. form target=_blank

… scenarios, but we’d always imagined, somehow, that only a window.open call could yield a window.opener “look back” window object reference.

The form attribute …


rel="opener"

… was interesting to us, here, too.

And the purpose of the interest? Well, once a user clicks/taps the “Execute” submit button, using the Xcode executables and/or Online URLs and/or Local Media presentations web application, both the …

  1. calling window (with it’s Email and SMS smarts) … and the …
  2. recipient window (able to reference the calling window via window.opener)

… now remain existant because we moved our HTML form logic from (the implied) target=_self (ie. clobber) to becoming target=_blank, allowing, at the recipient window, the events …

  • ondblclick (double click) can send an email off to someone so that they can see what you can (depending on Xcode business)
  • oncontextmenu (non-mobile right click) or ontouchmove (mobile touch move) can send an SMS off to someone so that they can see what you can (depending on Xcode business)

… via particularly new PHP code …

<?php

$hscr="<head><title>Xcode++ project to find executable path - RJM Programming - November, 2026</title><scr" . "ipt tyle=text/javascript> var showinhouse=[true,true]; function verify(oa) { if (" . ($sleepabys + $seqdelay) . " != 0 && ('' + oa.href.toLowerCase()).replace('.jp','/tmp/diffident_').replace('.png','/tmp/diffident_').replace('.bmg','/tmp/diffident_').replace('.gif','/tmp/diffident_').replace('.heic','/tmp/diffident_').indexOf('/tmp/diffident_') != -1) { document.getElementById('bsiw').style.display='inline-block'; document.getElementById('bssb').style.display='inline-block'; if (showinhouse[1]) { document.getElementById('myifid').style.display='inline-block'; document.getElementById('myifid').src=oa.href; } if (!showinhouse[0]) { return false; } } if (!showinhouse[0]) { return false; } return true; } setTimeout(function(){ if (document.getElementById('myifid')) { document.getElementById('myifid').style.width='' + screen.width + 'px'; document.getElementById('myifid').style.height='' + eval(0.805 * eval('' + screen.height)) + 'px'; } }, 8000); if (window.opener) { setTimeout(function(){ document.body.title='Double click to send email or right click or touch move to send SMS.'; document.body.ondblclick=function(){ window.opener.document.getElementById('bshareemail').click(); window.opener.focus(); }; document.body.oncontextmenu=function(event){ event.preventDefault(); window.opener.document.getElementById('bsharesms').click(); window.opener.focus(); }; document.body.ontouchmove=function(){ if (window.opener.document.getElementById('bsharesms').title.indexOf(' ') == -1) { window.opener.document.getElementById('bsharesms').click(); window.opener.document.getElementById('bsharesms').title+=' '; window.opener.focus(); } }; }, 7000); } </scr" . "ipt></head>";

?>

… application, can be brought into play to improve sharing functionality Javascript (via PHP) logic.


Previous relevant Xcode Executable Finding and Executing Browsing Tutorial is shown below.

Xcode Executable Finding and Executing Browsing Tutorial

Xcode Executable Finding and Executing Browsing Tutorial

Today we have a fourth cab sent out by the first cab to follow the third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Browsing of Local Media Files the PHP sets up as a third prong to the Environment’s existant Xcode Executable(s) and Online URL(s) modes of input

… having us start thinking about data URI processing (and “in the bigger picture” for all of this, is starting to resemble a web application able to assemble the components needed for a presentation, as well), and in order to have a “meeting of minds” between …

  1. Browsing of Local Media Files … and …
  2. Online URL(s)

… we convert the data URIs of the File API browsing into an Online URL by temporarily converting it into a “several hours existant” web server media file existing in …


https://www.rjmprogramming.com.au/tmp/

… via PHP writes HTML like …

<?php echo ”

<br><br><span style=font-weight:bold;> ... and/or Media ...</span><br><span id=spagspan><iframe class=\"spag\" scrolling=\"no\" onload=\"checkit(this);\" id=\"cbi\" frameborder=\"0\" style=\"width:173px;height:218px;margin-top:-194px;\" src=\"/HTMLCSS/client_browsing.htm?d=312160562686&wording=Allimages%20images%2E%20\"></iframe></span><br><br>

“; ?>

… where, today, we also write new PHP writes Ajax using Javascript …

<?php echo ”

function ajaxit(gn, gc) {
zhr = new XMLHttpRequest();
zhrtwo = new XMLHttpRequest();
zform = new FormData();
zformtwo = new FormData();
var thename='';
if (gn.indexOf('.') != -1) {
thename=gn; //'/tmp/diffident_media_' + Math.floor(Math.random() * 198976543) + '.' + gn.split('.')[eval(-1 + gn.split('.').length)];
document.getElementById(execid).value=thename;
} else {
thename=gn;
document.getElementById(execid).value='/tmp/diffident_media_' + thename + '.' + gc.split(';base64,')[0].split('/')[eval(-1 + gc.split(';base64,')[0].split('/').length)];
}
zform.append('execname', thename);
zform.append('execcont', '' + gc);
zhr.open('post', document.URL.split('?')[0].split('#')[0], true);
zhr.send(zform);
document.getElementById('ssdp').style.display='inline-block';
document.getElementById('ssou').style.display='inline-block';
document.getElementById('dmurl').innerHTML='<input type=hidden name=isurl id=isurl value=y></input>';
maybeurl(document.getElementById(execid));
if (document.URL.indexOf('rjmprogramming.com.au') == -1) {
zformtwo.append('execname', thename);
zformtwo.append('execcont', '' + gc);
zhrtwo.open('post', '//www.rjmprogramming.com.au/local_tmp_uploader.php', true);
zhrtwo.send(zformtwo);
} else {
zhrtwo=null;
zformtwo=null;
}
}

function checkres() {
resis='';
gresis='';
if (document.getElementById('result').innerHTML.indexOf('data:') != -1 && document.getElementById('result').innerHTML != lastduri) {
gresis=document.getElementById('result').innerHTML;
if (document.getElementById('execexec').value != '') {
execid=assess(document.getElementById(execid),true); //?
//document.getElementById(execid).value=gresis; //?
}
resis='';
document.getElementById('result').innerHTML='';
if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; }
if (document.getElementById('audioname').value.trim() != '') {
gifnameis='/tmp/diffident_media_' + Math.floor(Math.random() * 1989786) + '.' + document.getElementById('audioname').value.split('.')[eval(-1 + document.getElementById('audioname').value.split('.').length)];
} else {
gifnameis='' + Math.floor(Math.random() * 1989786);
}
lastduri=gresis;
ajaxit(gifnameis, gresis);
document.getElementById('spagspan').innerHTML=ssis;
}
document.getElementById('audioname').value='';
}

“; ?>

… helping out this new functionality concept in the changed find_xcode_executable.php sixth draft live run link.


Previous relevant Xcode Executable Finding and Executing Scheduling Tutorial is shown below.

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Today’s third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Timing the PHP sets up for each of the Records the PHP sets up the deployments via

… where, up until today, the record deployments were all executed one after the other as soon as was possible and only the once. This, what we’d categorize as scheduling functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative and scheduled way, and in the case of a macOS MAMP Environment a scheduled combination of Xcode executable execution(s) and/or web browser URL webpage opening(s) are possible now.

We allow users to define two types of delay between record deployments, those being the optional …

  1. the delay in seconds between sets of deployments
  2. the delay in seconds between execution timing of components of any single deployment set

Within the “phase two” after form submit calling oneself actions the PHP …

<?php

$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}

?>

… establishes whether any non-zero such delays affect the subsequent changed from yesterday …

<?php

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
$maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
//$maxwithin+=$sleepabys;
}
if ($seqdelay > 0) {

if ($ebo != "" && $hbo == "") { // && $cbo == "") {
$hbo=$ehbo;
$ebo='';
$oktoexit=true;
$dothisecho="";
}
if ($hbo != "" && $ebo == "") { // && $cbo == "") {
$onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
if ($cbo != "") {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
}

if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); ";
}

if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
$hbo=str_replace(" onload=\"", $onl, $hbo);
}

$hbo=str_replace("</body>", "  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);

$cbo="";
} else {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
}
$dothisecho="";
$x='';
}
//file_put_contents('x.x','');
if ($hbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
echo $hbo;
}
if ($ebo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($ebo);
}
}
if ($cbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
//passthru($cbo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($cbo);
}
}
if ($dothisecho != '') {
//file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
//echo $dothisecho;
if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); \"";
}
//file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
echo "<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
$dothisecho="";
$x='';
$oktoexit=true;
}

?>

… in the changed find_xcode_executable.php fifth draft live run link.


Previous relevant Xcode Executable Finding and Executing Records Tutorial is shown below.

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, eLearning, Event-Driven Programming, Operating System, Software, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Browsing Tutorial

Xcode Executable Finding and Executing Browsing Tutorial

Xcode Executable Finding and Executing Browsing Tutorial

Today we have a fourth cab sent out by the first cab to follow the third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Browsing of Local Media Files the PHP sets up as a third prong to the Environment’s existant Xcode Executable(s) and Online URL(s) modes of input

… having us start thinking about data URI processing (and “in the bigger picture” for all of this, is starting to resemble a web application able to assemble the components needed for a presentation, as well), and in order to have a “meeting of minds” between …

  1. Browsing of Local Media Files … and …
  2. Online URL(s)

… we convert the data URIs of the File API browsing into an Online URL by temporarily converting it into a “several hours existant” web server media file existing in …


https://www.rjmprogramming.com.au/tmp/

… via PHP writes HTML like …

<?php echo ”

<br><br><span style=font-weight:bold;> ... and/or Media ...</span><br><span id=spagspan><iframe class=\"spag\" scrolling=\"no\" onload=\"checkit(this);\" id=\"cbi\" frameborder=\"0\" style=\"width:173px;height:218px;margin-top:-194px;\" src=\"/HTMLCSS/client_browsing.htm?d=312160562686&wording=Allimages%20images%2E%20\"></iframe></span><br><br>

“; ?>

… where, today, we also write new PHP writes Ajax using Javascript …

<?php echo ”

function ajaxit(gn, gc) {
zhr = new XMLHttpRequest();
zhrtwo = new XMLHttpRequest();
zform = new FormData();
zformtwo = new FormData();
var thename='';
if (gn.indexOf('.') != -1) {
thename=gn; //'/tmp/diffident_media_' + Math.floor(Math.random() * 198976543) + '.' + gn.split('.')[eval(-1 + gn.split('.').length)];
document.getElementById(execid).value=thename;
} else {
thename=gn;
document.getElementById(execid).value='/tmp/diffident_media_' + thename + '.' + gc.split(';base64,')[0].split('/')[eval(-1 + gc.split(';base64,')[0].split('/').length)];
}
zform.append('execname', thename);
zform.append('execcont', '' + gc);
zhr.open('post', document.URL.split('?')[0].split('#')[0], true);
zhr.send(zform);
document.getElementById('ssdp').style.display='inline-block';
document.getElementById('ssou').style.display='inline-block';
document.getElementById('dmurl').innerHTML='<input type=hidden name=isurl id=isurl value=y></input>';
maybeurl(document.getElementById(execid));
if (document.URL.indexOf('rjmprogramming.com.au') == -1) {
zformtwo.append('execname', thename);
zformtwo.append('execcont', '' + gc);
zhrtwo.open('post', '//www.rjmprogramming.com.au/local_tmp_uploader.php', true);
zhrtwo.send(zformtwo);
} else {
zhrtwo=null;
zformtwo=null;
}
}

function checkres() {
resis='';
gresis='';
if (document.getElementById('result').innerHTML.indexOf('data:') != -1 && document.getElementById('result').innerHTML != lastduri) {
gresis=document.getElementById('result').innerHTML;
if (document.getElementById('execexec').value != '') {
execid=assess(document.getElementById(execid),true); //?
//document.getElementById(execid).value=gresis; //?
}
resis='';
document.getElementById('result').innerHTML='';
if (ssis != '') { document.getElementById('spagspan').innerHTML=ssis; }
if (document.getElementById('audioname').value.trim() != '') {
gifnameis='/tmp/diffident_media_' + Math.floor(Math.random() * 1989786) + '.' + document.getElementById('audioname').value.split('.')[eval(-1 + document.getElementById('audioname').value.split('.').length)];
} else {
gifnameis='' + Math.floor(Math.random() * 1989786);
}
lastduri=gresis;
ajaxit(gifnameis, gresis);
document.getElementById('spagspan').innerHTML=ssis;
}
document.getElementById('audioname').value='';
}

“; ?>

… helping out this new functionality concept in the changed find_xcode_executable.php sixth draft live run link.


Previous relevant Xcode Executable Finding and Executing Scheduling Tutorial is shown below.

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Today’s third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Timing the PHP sets up for each of the Records the PHP sets up the deployments via

… where, up until today, the record deployments were all executed one after the other as soon as was possible and only the once. This, what we’d categorize as scheduling functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative and scheduled way, and in the case of a macOS MAMP Environment a scheduled combination of Xcode executable execution(s) and/or web browser URL webpage opening(s) are possible now.

We allow users to define two types of delay between record deployments, those being the optional …

  1. the delay in seconds between sets of deployments
  2. the delay in seconds between execution timing of components of any single deployment set

Within the “phase two” after form submit calling oneself actions the PHP …

<?php

$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}

?>

… establishes whether any non-zero such delays affect the subsequent changed from yesterday …

<?php

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
$maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
//$maxwithin+=$sleepabys;
}
if ($seqdelay > 0) {

if ($ebo != "" && $hbo == "") { // && $cbo == "") {
$hbo=$ehbo;
$ebo='';
$oktoexit=true;
$dothisecho="";
}
if ($hbo != "" && $ebo == "") { // && $cbo == "") {
$onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
if ($cbo != "") {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
}

if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); ";
}

if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
$hbo=str_replace(" onload=\"", $onl, $hbo);
}

$hbo=str_replace("</body>", "  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);

$cbo="";
} else {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
}
$dothisecho="";
$x='';
}
//file_put_contents('x.x','');
if ($hbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
echo $hbo;
}
if ($ebo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($ebo);
}
}
if ($cbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
//passthru($cbo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($cbo);
}
}
if ($dothisecho != '') {
//file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
//echo $dothisecho;
if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); \"";
}
//file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
echo "<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
$dothisecho="";
$x='';
$oktoexit=true;
}

?>

… in the changed find_xcode_executable.php fifth draft live run link.


Previous relevant Xcode Executable Finding and Executing Records Tutorial is shown below.

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Ajax, eLearning, Event-Driven Programming, Operating System, Software, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Xcode Executable Finding and Executing Scheduling Tutorial

Today’s third cab to follow the second cab after that first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Records Tutorial concerns …

the Timing the PHP sets up for each of the Records the PHP sets up the deployments via

… where, up until today, the record deployments were all executed one after the other as soon as was possible and only the once. This, what we’d categorize as scheduling functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative and scheduled way, and in the case of a macOS MAMP Environment a scheduled combination of Xcode executable execution(s) and/or web browser URL webpage opening(s) are possible now.

We allow users to define two types of delay between record deployments, those being the optional …

  1. the delay in seconds between sets of deployments
  2. the delay in seconds between execution timing of components of any single deployment set

Within the “phase two” after form submit calling oneself actions the PHP …

<?php

$sleepabys=0; // between components in seconds
$seqdelay=0; // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
$delstuff='';
if (isset($_GET['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
} else if (isset($_POST['idelay'])) {
$delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
}
if (strpos($delstuff,'.') !== false) {
$deltwo=explode('.', $delstuff)[1];
if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
$sleepabys=intval(trim($deltwo));
}
}
$delone=explode('.', $delstuff)[0];
if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
$seqdelay=intval(trim($delone));
}
}

?>

… establishes whether any non-zero such delays affect the subsequent changed from yesterday …

<?php

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
$maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
//$maxwithin+=$sleepabys;
}
if ($seqdelay > 0) {

if ($ebo != "" && $hbo == "") { // && $cbo == "") {
$hbo=$ehbo;
$ebo='';
$oktoexit=true;
$dothisecho="";
}
if ($hbo != "" && $ebo == "") { // && $cbo == "") {
$onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
if ($cbo != "") {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
}

if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); ";
}

if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
$hbo=str_replace(" onload=\"", $onl, $hbo);
}

$hbo=str_replace("</body>", "  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);

$cbo="";
} else {
$hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
}
$dothisecho="";
$x='';
}
//file_put_contents('x.x','');
if ($hbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
echo $hbo;
}
if ($ebo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
$ebo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($ebo);
}
}
if ($cbo != "") {
//file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
//passthru($cbo);
if (strpos($ifexecsrc,'?') === false) {
$ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else if (strpos($ifexecsrc,'?') !== false) {
$ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
$cbo="";
if ($dothisecho == '') {
$dothisecho.=' ';
}
} else {
exec($cbo);
}
}
if ($dothisecho != '') {
//file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
//echo $dothisecho;
if (strpos($ifexecsrc,'?') !== false) {
$onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . "); \"";
}
//file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
echo "<html><body" . $onl . "><span>tab 1 of window</span>  <button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>  <iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
$dothisecho="";
$x='';
$oktoexit=true;
}

?>

… in the changed find_xcode_executable.php fifth draft live run link.


Previous relevant Xcode Executable Finding and Executing Records Tutorial is shown below.

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Operating System, Software, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Xcode Executable Finding and Executing Records Tutorial

Today’s second cab to follow the first cab off the rank regarding “layers of expansion” to the PHP web application of yesterday’s Xcode Executable Finding and Executing Environment Tutorial concerns …

the Records the PHP sets up the deployments via

… where, up until today, only one record could be defined. This functionality improvement enhances the RJM Programming domain Environment usage, meaning it can “value add” better than what a web browser address bar single URL can do anyway, because in any one session, as of today, multiple URLs may be able to be brought into play, perhaps in a collaborative way. Why we think allowing more than one deployment per PHP web application session, is that among a mix of …

… a user may be able to establish some interesting synchronous procedures involving various software componentry. In practice a user just defines more than one URL and/or Xcode executable path to allow for this “multiple record” paradigm to come into play. As such, the PHP “wrapper” functionality started yesterday becomes …

<?php

$seqdelay=0;
$sleepabys=0;
$hbo="";
$hboi=1;
$cbo="";
$cboi=1;
$ebo="";
$eboi=1;
$dothisecho="";

function ourpassthru($passwhat) {
global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay;
//sleep($sleepabys);
if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
if (strtoupper(PHP_OS) == 'DARWIN') {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
$dothisecho="tab 1 of window ";
$upref="";
if (strpos($passwhat, "\\\"//") !== false) {
$upref="https:";
}
if ($ebo == "") {
$ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
} else {
$ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
}
//if (strpos($rest, '&') !== false) {
//return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
//} else {
//return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
//}
return '';
} else {
$rest=explode('"',explode("\\\"", $passwhat)[2])[0];
if ($hbo == "") {
if ($sleepabys > 0) {
$hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
} else {
$hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a></body></html>";
}
$hboi++;
} else {
$hbo=str_replace('</body>', " <a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;> </body>", $hbo);
if ($sleepabys > 0) {
$hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
} else {
$hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
}
$hboi++;
}
return "";
//exit;
}
}
if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
if ($ebo == "") {
$dothisecho="tab 1 of window ";
$ebo=$passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
} else {
$ebo.=" ; " . $passwhat;
if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; }
$eboi++;
return "";
}
return exec($passwhat);
}
}
if ($cbo == "") {
$cbo=$passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
} else {
$cbo.=" ; " . $passwhat;
if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' '; }
$cboi++;
return "";
}
return passthru($passwhat);
}

?>

… gathering “the records” into global PHP variables so that …

<?php

if (isset($_POST['execexec'])) {
if ($ebo != "") {
exec($ebo);
}
if ($cbo != "") {
passthru($cbo);
}
if ($dothisecho != '') {
echo $dothisecho;
}
if ($hbo != "") {
echo $hbo;
}
exit;
}

?>

… can sequence and deploy the executions those records represent into separated web browser windows and/or macOS Terminal windows regarding the changed find_xcode_executable.php fourth draft live run link.


Previous relevant Xcode Executable Finding and Executing Environment Tutorial is shown below.

Xcode Executable Finding and Executing Environment Tutorial

Xcode Executable Finding and Executing Environment Tutorial

If a project is generic enough in concepts, it is bound to favour, not necessarily at it’s genesis, thoughts regarding “layers of expansion”, and with the project of yesterday’s Xcode Executable Finding and Executing Arguments Tutorial we can think of a couple, or maybe even a few, such layers, the “first cab off the rank” considering …

the Environment the PHP runs in

Today, we give meaning to a public domain Environment means of running the find_xcode_executable.php PHP within, that involving new considerations to the workings of the web application URL …


https://www.rjmprogramming.com.au/find_xcode_executable.php

… is pointing at having some practical usage and meaning, that, today, is happening because we allow, for find_xcode_executable.php PHP usage up at the public RJM Programming domain …

  1. user can enter a URL of interest (with or without arguments) … in a new input type=url element … possible by feeding previous PHP passthru calls through a PHP wrapper function as per …
    <?php

    function ourpassthru($passwhat) {
    if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "tab 1 of window ";
    $upref="";
    if (strpos($passwhat, "\\\"//") !== false) {
    $upref="https:";
    }
    if (strpos($rest, '&') !== false) {
    return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
    } else {
    return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
    }
    } else {
    $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
    echo "<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>";
    exit;
    }
    }
    if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
    return exec($passwhat);
    }
    }
    return passthru($passwhat);
    }

    ?>
  2. should a user enter into the existant Executable path textbox, using find_xcode_executable.php PHP up at the public RJM Programming domain way, an Xcode project executable path the web application there will try to open a macOS or Windows local web server URL window (just in cases)

… in the changed find_xcode_executable.php third draft now with more meaning as a live run link.


Previous relevant Xcode Executable Finding and Executing Arguments Tutorial is shown below.

Xcode Executable Finding and Executing Arguments Tutorial

Xcode Executable Finding and Executing Arguments Tutorial

Yesterday’s Xcode Executable Finding and Executing Tutorial set up a “first draft” PHP (via a macOS web browser address bar MAMP local web server based URL) web application means to select an Xcode project, glean it’s executable and from an HTML form have the web application execute that Xcode executable within the Terminal desktop application.

It allowed for arguments to be entered within that form, but this first draft needed more thinking regarding that part, as per …

  • our double quote encompassing of the arguments, in the code (as we did for the executable path), is rarely the right approach, and we’ve fixed this in a second draft …
  • to just term these “Argument(s)” is too simplistic … as of second draft we term it …

    Arguments and/or pipes and/or redirects and/or switches

  • and after an execution run using a piped command part | tee -a x.x and finding output was sent to x.x but, weirdly, the prompts for interactive entries disappeared, and so, we asked use of pipe to tee in macos caused prompting to disappear so is there an alternative command to log a program but leave the prompts showing to receive the good macOS advice below …

    Run script followed by your log file name and the command you want to run:
    bash
    script output.log your_command –flags

    … and so coded to help users achieve this via a Logging checkbox

  • we added more functionality to the Xcode *.xcodeproj finding arrangements …

    URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.

  • we style the webpage better as per …

    <style>
    select { background-color: #f0f0f0; }
    #execexec { background-color: #fadadd; }
    #argsare { background-color: #d6fffe; }
    </style>

… in the changed find_xcode_executable.php second draft.


Previous relevant Xcode Executable Finding and Executing Tutorial is shown below.

Xcode Executable Finding and Executing Tutorial

Xcode Executable Finding and Executing Tutorial

The Xcode IDE on macOS, as a desktop application, for …


Xcode -> New -> Project... -> macOS / Command Line Tool -> Product Name: [up to you] Language: C

… represents, perhaps, the simplest and immediately approachable Xcode Project combination to try. But even here, you will find it as easy as falling off a log to create an executable that “runs” within the Xcode IDE environment (where, behind the scenes, Xcode has compiled your code into an executable program or application). But Xcode does a great job at making it hard for you to track down where, on your hard disk, it created the executable. And because we are very much “old school” from the command line days where paths to executables were known and a part of the mix for programmers to be totally au fait around, we’re going to write …

  • using PHP server language
  • under a macOS MAMP Apache/PHP local web server environment …
  • following great advice of can a command line xcode command determine the executable path for an xcode project name? we base the logic around setting up command like …

    xcodebuild -project YourProject.xcodeproj -scheme YourScheme -showBuildSettings | grep -E “^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) =”

    … exemplified by, for us …

    xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="

    … resulting in …

    2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
    — xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
    { platform:macOS, name:Any Mac }
    EXECUTABLE_PATH = My Next File C Program
    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug

… as a means forward to help “unlock the secrets of the Xcode“!

From there, as many programmers will know, as soon as keyboard interactive entry gets to be involved with the execution of a compiled language (in our case C) program, starting with a web browser address bar, it’s really difficult to arrange up at the public RJM Programming, but here on macOS MAMP within an
http://localhost:8888/find_xcode_executable.php
web browser address bar call we are allowed to code for PHP …


passthru

… (deemed a security threat up at the public RJM Programming web server) but which was our macOS MAMP pass through to …

  • macOS Terminal desktop application …
  • called to run our newly found Xcode C executable, like (with the C code used in C 2D Array via File Tutorial) via command like …

    "/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project"

    … via passthru command calls like …

    osascript -e 'tell application "Terminal" to do script "\"/Users/user/Library/Developer/Xcode/DerivedData/My_C_Command_Line_Project-dzaieipcrytesxglwgctjnfynayq/Build/Products/Debug/My C Command Line Project\""'

… allowing for interactive entry within that, perhaps new, Terminal window (not necessarily the top window) being a possibility.

And so, day one here, got us to our find_xcode_executable.php proof of concept first draft for this Xcode innards understanding helper web application we run around here up at the address bar of a web browser, and on from there, depending on where the user takes it.


Previous relevant C 2D Array via File Tutorial is shown below.

C 2D Array via File Tutorial

C 2D Array via File Tutorial

You don’t have to use an IDE to do C programming. There is Digital Mars C as an example of that. We have talked about the Xcode command line tools before, that frees the gcc compiler to (also) be a command line tool to write C programs from the command line separate to any IDE usage.

So it is today with this tutorial reading a file of numbers that define the workings of a 2D int array the program requires, inspired by this (old) Yahoo Answers question.

We use stdlib.h’s memory management function calloc to handle the memory management here. The use of calloc, malloc and realloc can aid with dynamically changeable arrangements with your C program’s memory management, and you may be interested in the related previous Xcode Debug C Strings Program Tutorial as shown below.

So feel free to download the C programming source code here and rename it to file_2d_array.c

Hope you enjoy this tutorial showing you some command line C gcc compilation work.

Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.c
// file_2d_array.c ... read input file's data into a 2d array
#include "stdio.h"
#include "stdlib.h"
int main (int argc, char* argv[]) {
FILE* spIn;
int rownum;
int colnum;
int** table;
int row;
int column;
int value;
spIn = fopen (argv[1], "r");
if (spIn == NULL)
{
printf (" Did not open haha an");
exit (1);
}
fscanf(spIn,"%d", &rownum);
fscanf(spIn,"%d", &colnum);
table = (int**)calloc ((rownum * colnum), sizeof(int*));
for (row = 0; row < rownum; row++)
{
table[row] = (int*)calloc ((rownum * 1), sizeof(int));
for (column = 0; column < colnum; column++)
{
fscanf(spIn, "%d", &value);
table[row][column] = value;
printf(" table[%d][%d] = %d n", row, column, table[row][column]);
}
}
fclose(spIn);
return 0;
}
Roberts-MacBook-Pro:tools robertmetcalfe$ cat file_2d_array.txt
2 3 1 2 3 12 12
Roberts-MacBook-Pro:tools robertmetcalfe$ gcc file_2d_array.c -o file_2d_array
Roberts-MacBook-Pro:tools robertmetcalfe$ ls -l file_2d_array*
-rwxr-xr-x 1 robertmetcalfe staff 8728 9 Mar 09:00 file_2d_array
-rw-r--r-- 1 robertmetcalfe staff 729 9 Mar 08:59 file_2d_array.c
-rw-r--r-- 1 robertmetcalfe staff 17 9 Mar 08:37 file_2d_array.txt
Roberts-MacBook-Pro:tools robertmetcalfe$ ./file_2d_array file_2d_array.txt
table[0][0] = 1
table[0][1] = 2
table[0][2] = 3
table[1][0] = 12
table[1][1] = 12
table[1][2] = 12
Roberts-MacBook-Pro:tools robertmetcalfe$

A really helpful tutorial for code above is shown here … thanks.


Previous Xcode Debug C Strings Program Tutorial is shown below.

Xcode Debug C Strings Program Tutorial

Xcode Debug C Strings Program Tutorial

Have a bit of an esoteric C programming scenario today, and because it is esoteric, and some or all of you may fall asleep, am also going to show you how to debug in Xcode … and only now just realized with the podcast of this tutorial that we went, on a Mac, control-command-Y a lot and should have, instead, shown you this in menu manipulation terms as Product->Debug->Continue … anyway, if you get into this, you’ll know what is going on.

Okay, so the C scenario in Xcode is a bit esoteric, as sometimes happens when you are answering “a brief” (a Yahoo Answers brief). The brief was not to use strcat in the making of a single string buffer from an array of zero-byte terminated char* strings in an array, with an added stipulation of a maximum string buffer length. Sounds simple, and it is if you use strcat and/or global strings, but my understanding of the brief would be that global variables will be frowned upon, as a lot of programmers will tell you. Mind you, personally, global strings are not a problem for me. Not using global strings and not using strcat, and making this work in a self-sufficient single function is quite interesting, and basically that is what we do here with this tutorial, via memory management using malloc & realloc.

So feel free to download the Xcode C programming source code here and rename it to main.cpp (or main.c … is pretty conservative in its construction … probably would work with Digital Mars C).

Hope you enjoy this tutorial showing you some cute Xcode debugging functionality.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Operating System, Software, Tutorials, Xcode | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment