Jump to content
Pardon our ads (a necessary update) ×

phppup

Members
  • Posts

    939
  • Joined

  • Last visited

  • Days Won

    1

phppup last won the day on September 13 2022

phppup had the most liked content!

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

7,678 profile views

phppup's Achievements

Prolific Member

Prolific Member (5/5)

3

Reputation

3

Community Answers

  1. I'm trying to understand async, I promise, but it seems like a slick fakeout. [Of course, this has only come up after AI used it bc it couldn't/still hasn't fixed some code.] Nonetheless, I'm wondering how popular and reasonable it actually is. I've done a fair amount of researching, and async seems to be a 'work-around' to avoid writing a few extra lines of code. ie: save this value in a variable and give it to me last (almost like an overwritten value), no matter what. Am I missing something. PS: I've seen numerous examples that say the same thing, so I'm really looking for an honest human opinion.
  2. @gizmola Thanks, I'll have to take some time and watch it. Actually, the AI have me the troubleshooting script WITH console.log and I told it to swap for alerts. LOL It's just the way I know (or discovered... versus learning more properly, but I do see the advantages)
  3. It's an embarrassing situation, but I felt I should post on case someone can be helped in the future. And yes, @maxxd , that possibility came up in my search for resolution and may be a contributing factor. At this point however, AI provided a helpful lil script that offered a clue: document.addEventListener('DOMContentLoaded', () => { const applyBtn = document.getElementById('bulkApplyBtn'); if (applyBtn) { alert('✅ Button found!'); applyBtn.addEventListener('click', onApplyBulk); } else { alert('⚠️ applyBulkBtn not found in DOM.'); } }); and I ultimately discovered that the same AI had jumbled my naming convention (so my ID="orderSubmitBtn" was somehow associated with a listener that was waiting for a click from submitOrderBtn. Got that worked out in the large single file and things seem to be falling into place. I still haven't backtracked to see where this kerfuffle began. And there's no telling whether the code will respond differently if broken into smaller attached files again (which I may not endeavor anyway). One thing for sure @gizmola is that I really do need a crash course in CONSOLE LOG. To be honest, I've never really used it bc throughout my learning I wasn't introduced to it. I generally use alerts to troubleshoot JS, but I can see where console will pick up lots of additional pieces for preventative maintenance. Thanks for helping.
  4. That's what the AI told me. What i don't understand is: Why? If everything (all functions, listeners, etc.) is 'cut and pasted' in the same order within the full script to duplicate what is within the broken pieces assembly, why should ANYTHING change? If it works separated, shouldn't it work identically as a unit, @gizmola ?
  5. I guess my first mistake was using an AI program to help me with some code. Eventually the AI informed me that the file was getting too big for it to produce as a complete file, so I broke it up (around my original code) <script src="myscripts_A.js"></script> <script src="myscripts_B.js"></script> <script> //original JavaScript stuff </script> <script src="myscripts_C.js"></script> The code worked as well as could be expected. Then, I decided to put it back as one file, and after I did, certain features and button triggers stopped working. I haven't fully gotten to troubleshooting this, but is there something about the way JS organizes src files that I need to know?
  6. @gizmola Thanks. A few points that I hadn't considered in the 'bigger picture.' Also, the 'historic' aspect may be an interesting consideration.
  7. @requinix I see your points. Never got interested in Bootstrap primarily bc I didn't understand the reason to use something that was 'secretively' doing something that I could readily do and control. I agree with your points on CSS. I've seen design achievements where the same result was met with CSS as could be with JS (ie: flashing buttons or sliding boxes). Unless there is a compelling reason, I tend to gravitate to the CSS. I think it has something to do with early experiences where JS could be disabled (thereby leaving hours of dedicated design work inoperative) where CSS remains active. It took some research to understand: "I'm betting that Tea was developed through vibe coding..." From a literal perspective, I was conflicted as to whether you were implying that folks abandoned a laborious AI inclusive effort for such a simple task (of making tea) or that it began to take so much time that they required a respite (and made tea). I should have paid more attention to the capitalized T. I suppose it's because I haven't had my morning coffee. *wink*
  8. @gizmola Septate playlists that could be reused. The DJ could have one playlist for Rock and Roll audiences, which would be different from the Rap and HipHop list, or the Oldies. There could be individual songs that appear on multiple playlists, but a single playlist could be defined for a given event based on either the event's or organization's target audience.
  9. I believe @requinix was right in his response to my recent Miscellaneous post regarding AI. So here I am, having (regrettably) relied on AI for help in building a webpage. But let me get to my question. The page was built with a pop-up modal that contains a short list of items which AI decided to create in hardcoded HTML with inline CSS. (This wouldn't have been my choice methodology and I tried to get the darn thing to loop through an array but this was ultimately the best working result provided. Ugggh!) Next came the fun part. *sarcasm* I wanted a second modal similar to the first. (For simplicity, think one for boys and the second for girls.) When I asked/told (I'm not quite sure who was 'in charge'... LOL) AI to make a second modal that resembled the first it took a lot of tweaking to reach my goal. Ultimately, functions and layouts became horribly fragmented and frustration ruled the day. I decided I needed to do this the ole fashion way and write MY code myself. Since I already achieved a partially working script, I decided to maintain uniformity to make progress. Well, as it turns out, the second modal was not hardcoded like the first. Instead, all the inline text and CSS is generated with JavaScript (ie: .. elementById).style.whatever= ) For uniformity, one of these approaches has to be replaced. The question: Is one more efficient? Beneficial? Effective? I've been accused in the past of not being up to date with modern methods, so I thought I'd ask.
  10. @Barand Yes, thanks. That's what I was thinking. And with the drop-down populated with data from a SELECT clause, it will be painless and 100% accurate. @gizmola Thanks for elaborating. I sometimes wonder how granular I need to be (mostly for database speed, right?) when it comes to these things. Nonetheless, thanks to my friends at phpfreaks, I've come a long way from my 84 column table that mimicked a spreadsheet. Although it worked, I imagine the database overlords were cursing my existence. LOL
  11. I'm a bit rusty in the database department and would appreciate a quick review and any pointers. I'm planning to set up a database for a DJ (that colloquially spins records). The DJ does work with multiple organizations. Each organization sponsors several events per year. Each event has a separate 'playlist' depending on the audience. From this skeletal overview, I'm thinking that I should establish a primary key/foreign key relationship (to avoid future complication?). I'm certain that referencing an auto increment ID as the foreign key associated with the 180 character organization name will save valuable disk space, but how do I reference it when I'm adding a new event that the XYZ org is sponsoring? Any other refresher pointers appreciated.
  12. @mac_gyver yes, I had discovered that, but it wasn't the actual fix. The real issue was that my test for is_file was flawed; it didn't drill down to actually test the specified file. if (is_file($subDir)) { //needed to become if (is_file($directory.'/'.$subDir)) { After both adjustments, everything is running better than expected!
  13. I thought this made sense, but it wouldn't work until I removed lines that I thought would provide extra validation: $dir = 'rootFolder'; $directories = scandir($dir); foreach($directories as $directory){ if($directory=='.' or $directory=='..' ){ echo 'dot'; }else{ if(is_dir($directory)) echo '<strong>'.$directory .'</strong> <br>'; $filePath = scandir($directory); foreach($filePath as $subDir){ if($subDir=='.' or $subDir=='..' ){ echo 'dot2 <br>'; }else { // if (is_file($subDir)) { //Only provided PHP files but NO IMAGES echo $subDir . "<br>"; } } // } } } } I'm just feeling down one level of a director to see what I've get. It seemed like a simple exercise until I tried to list the files. Obviously, of it's not a directory it MUST be a file, but why did quantifying it as a file not recognize my files as a file??
  14. @gizmola Yes, I had considered IP tracking for the types of instances that you mentioned. Thankfully, this isn't (as of yet) for users that would be ill-intentioned (but it's good to know the expansion potential). As a side note, recording the time of logout seems reasonable when the user clicks the button. But what is the process of the user simply shuts down the browser?
  15. I'm considering setting up a webpage and tracking logins. For simplicity, let's say an account is required with an email address. So, [email protected] cannot do anything until he created his account. Now I want to know how often he logs in. Is there a recommended or best practice to gathering and storing this data before it becomes cumbersome or unuseful? Or is it as simple as connecting a table that associates a timestamp with every login by a registered user and just letting it run? (I'm wondering if there's something more efficient and less storage reliant)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.