-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
Okay... So basically, that stuff you wrote into the code, you want it to appear just like that in the file? Have you tried forgetting complicated logic about splitting arrays into groups of three and simply writing a string to a file? -
Sigh. Keep adding console.log()s in assorted places here and there until you can discover where the underlying problem is. It might be helpful to try logging relevant variables and values instead of just strings so that you don't have to guess at what they are.
-
Well, okay, I would suggest doing some debugging. You know, like verifying that the onclick function has been assigned and that uploadToServer is executing. If you need tips on how to do that, a simple console.log at relevant location(s) to let you know code has been hit is easy to add.
-
How much debugging have you done? Verified that the onclick function has been assigned (which is poor practice, by the way)? Is uploadToServer even executing?
-
You could spend your time looking for a library that "reinvents the wheel", as they say. Or you could install the SOAP extension and get on with the rest of your life. One of those packages should correspond to the particular version of PHP you have installed.
-
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
Dude, you're really not helping me here. Try answering my questions in a way that does not repeat the same thing you've said before, okay? I do not want a description of the inputs. I do not want you to talk about "it's a hex color". I don't care whether it's a hex value or a list of animals I can see at my local zoo or how many cups of vanilla extract I have to bake to fill my house with its delicious smell. What I do want is some literal values. I want you to take that variable you said you have, var_dump() it into a webpage or as console output (I said print_r() before but I've changed my mind), and literally copy-and-paste that into a post. For example, if your real code is $file-> File :: WriteFile ( $filepath . $filename, $test ); and $test had that "TEST" stuff you demonstrated, then I would expect your next post to contain, somewhere inside it, string(61) "TEST!, TEST!, TEST!, TEST!, TEST!, TEST!, TEST!, TEST!, TEST!" For bonus points, you could even tell me literally what you want to see saved into the file - again, literally what you want, not a description of it but the exact content of the file - in case I don't understand correctly what you're trying to say about the grouping by 3 or the weird trailing commas or whatever. But anyway, here's the thing. I don't think you have a variable named $test containing that "TEST" stuff. I assume it's either an array or a string, but maybe it isn't, and I assume the array (if it is one) contains multiple values or the string (if it is one) contains multiple comma-separated things inside it (which may or may not constitute a valid CSV line). My problem is that I don't think it's one thing and I do assume it's something else, and that's all I have to go on. And guessing like that does not help me to help you to put the contents of that variable into the file in the way you want it do be done. -
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
I'll try again but even more explicitly. 1. You need to call WriteFile with certain arguments. The first one is the file path and name, great. Now think about the second one. Is it a variable? 2. Take that variable, put a real "value" into it, and print_r() it. What is the output? 3. Given that particular output, exactly what is it that you want to write to the file? -
php-soap is the correct name for the official package, however CentOS 7 is a very old version and only supports PHP 5.4. Which means you probably installed another source in order to get a more recent version of PHP. Try a yum search for anything soap and see if the package you need goes by a different name.
-
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
If the data is CSV then you need to treat it like CSV data. Because that's what it is. If you try to pretend it is something else then you'll run into problems. It's trivial to take an array with a bunch of things and "group" them into 3s - once you get it into that form. Back to this code: $file-> File :: WriteFile ( $filepath . $filename, "TEST!, TEST!, TEST!, " . "TEST!, TEST!, TEST!, " . "TEST!, TEST!, TEST!" ); I imagine that is not the real code you want to use. What is the real code? The data you're trying to write to the file: what does it actually look like? -
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
This: $file-> File :: WriteFile ( $filepath . $filename, "TEST!, TEST!, TEST!, " . "TEST!, TEST!, TEST!, " . "TEST!, TEST!, TEST!" ); Is that what it has to be? Because you act like you want those three "lines" of TESTs to be three separate strings, but if you concatenate them like that then you only have one string, and splitting them apart into multiple strings again leads to this whole mess about splitting delimiters. You also talk about a multidimensional array, but you don't have that here. You have an array containing one string. And you have code that uses fopen/fclose but does absolutely nothing with them because you actually use file_put_contents. And there's the comment which makes it super obvious that you copy/pasted the code from StackOverflow. So I don't really get the impression that you know what's going on here. And if you don't know then how am I supposed to know? Is the "TEST" string supposed to represent some different string? CSV string, maybe? Is it written in code or pulled from a database or submitted by a user through a form or what? Not asking to be annoying. I'm asking because this whole thing doesn't make any sense, and I can only assume that it's supposed to make sense, so clearly I'm missing something important. -
Split array every 3 commas & return as string?
requinix replied to AquariaXI's topic in PHP Coding Help
The code behind checkDelimiter and SplitFileByDelimiter is probably going to be relevant here, don't you think? -
Composer is a command-line utility, meaning you cannot use it through WHM/cPanel. You need SSH access and a general familiarity with Linux terminals.
-
@sumon4asad44: Please reply to this thread with an email address or other external contact method for someone to reach you about this work.
-
javascript sometime not work when user not in chrome interface
requinix replied to nitiphone2021's topic in Javascript Help
Browsers may throttle background activity when users are not active on the page. Switch to WebSockets instead of AJAX polling. -
You cannot control how the browser gets the video from a capturing <input>. If you need more control of that process then you'll have to get the video another way.
-
All that code in InitializeData should be inside the constructor instead. There is no need for InitializeData to exist. It forces you to call that method every time you create a new instance of MainframeData, and if you forget then you get problems like the one that started this thread. If you need to set up appVer and appTitle when the object is created then you should be literally setting up appVer and appTitle when the object is created.
-
Did you write the code for the MainframeData class? If not, where did it come from?
-
You already know that the appTitle is set by InitializeData. If you don't call InitializeData then there will be no appTitle. All that InitializeData code should exist in the constructor anyways. Move it and you won't have to call any special methods before you can use appTitle.
-
What's the code where you call it? Is it part of the code you posted before or is it written somewhere else?
-
Have you tried calling that get_appTitle() method?
-
If the filename is title + genre + year then you're going to have to identify each piece. The genre will either have to be a single word (so you know the last "word" in the filename was the genre) or one from a specific list, the year is obviously the numbers at the end, and the title would be everything else.
-
No. Just because you found code posted somewhere on the internet does not make it open source. You can make whatever changes you want but I expect you're going to have a very hard time making it work without using cameratag.com's systems and APIs.
-
Are you even sure there was a "Titanic" movie in 1990?