Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Impotence
Nov 8, 2010
Lipstick Apathy

Nalin posted:

I'm the guy who wrote that branch of GoonAuth. It was designed specifically for the needs of the Goonrathi group. It uses LDAP because we have our forums, mumble, and jabber share the same account information and login. We have no forum integration code because our ipboard forums use LDAP logins. If discourse cannot use LDAP logins, you might want to fork the original repo and build your discourse stuff from there. It won't be easy to remove the LDAP integration from my code.

can you literally get any more absurdly enterprise for video games
(i'm p sure discourse supprots LDAP, but actually using it is going to be fun to figure out)

Adbot
ADBOT LOVES YOU

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
I am trying to learn Zend2 framework, and it has been a nightmare so far. I have been following the official tutorial, and no matter what I do, when I try to go to the site, I see a text dump of Module.php, rather than... anything else.
I know php is really finicky, but I have no idea how to track down what's wrong.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
You say you're following the Zend2 tutorial, but are you using Apache or PHP?

Is this happening with any php file you try to open, or just that one file?
If it's the one file, check you've got "<?php" at the top of it. Any good IDE will show you that you done hosed up if that's the case.

Otherwise, your problem lies somewhere in how you followed this step. Your problem is server-land, not to do with Zend or PHP specifically.
The server hasn't been informed that it needs to handle .php files as executable php scripts. Is apache set up right? Are you on Linux?

You can try listing the apache modules or make a simple phpinfo script and see if that works.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer

v1nce posted:

You say you're following the Zend2 tutorial, but are you using Apache or PHP?

Is this happening with any php file you try to open, or just that one file?
If it's the one file, check you've got "<?php" at the top of it. Any good IDE will show you that you done hosed up if that's the case.

Otherwise, your problem lies somewhere in how you followed this step. Your problem is server-land, not to do with Zend or PHP specifically.
The server hasn't been informed that it needs to handle .php files as executable php scripts. Is apache set up right? Are you on Linux?

You can try listing the apache modules or make a simple phpinfo script and see if that works.

I am trying to use Apache, but I have never worked with webservers before and I'm in way over my head. I don't know how to open other php files. The project is hosted on a local vm through Vagrant and I can access it via port-forwarding to my host machine. That alone has made this entire thing a nightmare. The Zend tutorial has no step where you check to see what's actually be served between "this is the Zend framework page" and "you finished the tutorial, here's what it should look like". So even thought I saw that it wasn't working early on, I just assumed that's because I wasn't done setting things up. Then when I was finally done it said "go there" and it should "look like this" well no, it just looks like

quote:

namespace Request; use Zend\ModuleManager\Feature\AutoloaderProviderInterface; use Zend\ModuleManager\Feature\ConfigProviderInterface; use Request\Model\Request; use Request\Model\RequestTable; use Zend\Db\ResultSet\ResultSet; use Zend\Db\tableGateway\TableGateway; class Module implements AutoloaderProviderInterface, ConfigProviderInterface { public function getAutoloaderConfig() { return array( 'Zend\Loader\ClassMapAutoloader' => array( __DIR__ . '/autoload_classmap.php', ), 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, ) ), ); } public function getConfig() { return include __DIR__ . '/config/module.config.php'; } public function getServiceConfig() { return array( 'factories' => array( 'Request\Model\RequestTable' => function($sm) { $tableGateway = $sm->get('RequestTableGateway'); $table = new RequestTable($tableGateway); return $table; }, 'RequestTableGateway' => function ($sm) { $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new ResultSet(); $resultSetPrototype->setArrayObjectPrototype(new Request()); return new TableGateway('request', $dbAdapter, null, $resultSetPrototype); }, ), ); } }

And this updates in real time when I change the file or things the file references, but it only ever displays as this. No html is ever rendered. edit: "realtime" is misleading. Of course it only updates when I refresh the page.

edit: Oh hey, I did not in fact have <?php at the top of it. Is that a tag that I need to close? None of the php files I created as part of the tutorial had these tags, as they weren't specified in the tutorial. Now that I have added that, the new output of the page is "return array();", so i guess I need to track down all the php files and add those tags?

this explains why syntax highlighting wasn't working in vim.

Snak fucked around with this message at 03:50 on Nov 5, 2015

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
/\/\/\ yes. You need <?php for it to start processing it as PHP. Go forth and add to files.

-- for posterity:

Ok, step one with "this looks fucky" output is right-click and do view-source. Do you see "<?php" at the start? If so, Apache isn't using the PHP interpreter for whatever reason.

Yeah, vagrant is a bit of a lovely entry fee to all this. You can easily lose a day to loving about in Vagrant and doing nothing remotely related to code.
Where did you get the box? The Zend tutorial doesn't tell you to use one. It might not be appropriate to your needs.

It's definitely going to be one of:
- Wrong config on server. Not loading the PHP module in Apache config, for instance
- PHP just straight up isn't installed on the server
- Other issue with box.

So vagrant ssh in to the box and run php -v to make sure PHP is installed. Then run apachectl -M | grep php and see if apache has the module installed.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
Looks like php is installed and working.

when I right-click in browser and view source, it's just raw text.

While I have spent the last 2 weeks learning vagrant and trying to learn apache, I am pretty familiar with linux and I was careful to make sure I had the right packages installed.

it is pretty annoying they don't tell you that you need to add <?php to the beginning of the files they give you the complete text for. I mean yeah, I can see how anyone familiar with PHP would know to do that, but it's a tutorial... I was just copying what they said to do verbatim.

edit: Yay now I just have a server error 500 instead of anything. so progress maybe. I'm gonna go blow my brains out.

Snak fucked around with this message at 04:05 on Nov 5, 2015

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Yeah, that does seem like a bit of a cockup on their part. I guess they figured you knew a bit of PHP already, cause Zend can be quite a complex framework and not really aimed at beginners.

500 is probably a PHP error of some description. Make sure you have error reporting turned on for Zend.
You can always make sure the server is working at least sorta-kinda by doing a crappy little phpinfo script like I mentioned before.

Edit: your server is working so don't bother with this now, but for future reference it's usually easier to use something like PuPHPet to build a quick PHP dev environment.

v1nce fucked around with this message at 04:13 on Nov 5, 2015

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer

v1nce posted:

Yeah, that does seem like a bit of a cockup on their part. I guess they figured you knew a bit of PHP already, cause Zend can be quite a complex framework and not really aimed at beginners.

500 is probably a PHP error of some description. Make sure you have error reporting turned on for Zend.
You can always make sure the server is working at least sorta-kinda by doing a crappy little phpinfo script like I mentioned before.

Edit: your server is working so don't bother with this now, but for future reference it's usually easier to use something like PuPHPet to build a quick PHP dev environment.

Well this is for a software developement class, where we are supposed to learn how to use a MVC framework and deploy to a Platform as a service. This is a group project, but the my group has elected to just ignore using a PaaS, MVC framework, or even a VCS. So basically I'm trying really hard to learn it on my own since otherwise I'm just not going to learn it in this class.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Sounds a bit like you should check out CodeShip. None of your current work is wasted, it should just lay straight over the top as a deployment mechanism to the PaaS on your choice (cough aws) using vcs to manage it.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer

v1nce posted:

Sounds a bit like you should check out CodeShip. None of your current work is wasted, it should just lay straight over the top as a deployment mechanism to the PaaS on your choice (cough aws) using vcs to manage it.

Thanks, that looks cool and I will look into it. But that last thing this group needs is someone trying to introduce a new platform or tool. Right now one of the group members is pushing for us to use something called "codiad" which is a browser based-IDE, so that we can work directly on our deployment VM (sigh) and then copy the working code over to github. There's not a big enough face-palm. I thought it was done when I pointed out that that's the opposite of how we should be doing version control at the last group meeting, but he just send out an update about it, so...
I'm going to talk to the professor and then probably drop out of school to be a homeless wino.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
Just to be very clear about it, Zend Framework is a very bad first exposure to PHP and PHP frameworks. The learning curve is huge, their documentation is sometimes amazingly incomplete, and the way they chose to do their MVC convention can be out of step with reality for a huge number of applications. Symfony2 and it are the highest quality frameworks in terms of design correctness and are great choices for seasoned developers, but they also bring along a huge amount of complexity and things can get very annoying to wrap your head around.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.

Snak posted:

I'm going to talk to the professor and then probably drop out of school to be a homeless wino.
This is a good plan. But yes you are right that you should be able to dev locally, up your changes to GitHub, a project manager can consolidate all the changes and then push them to a staging or production box in the wild. Also I agree you can't dictate what IDEs people use. That shouldn't even be a topic.

McGlockenshire posted:

Zend Framework is a very bad first exposure to PHP and PHP frameworks.
I got distracted, but yes this too. If you want more than a proof-of-concept program and Zend isn't specifically being taught to you, you might be safer going with Laravel.
It's not as "enterprise-y" as Zend or Symfony, but gently caress me if it isn't a billion times more forgiving to work with when you're new.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer

McGlockenshire posted:

Just to be very clear about it, Zend Framework is a very bad first exposure to PHP and PHP frameworks. The learning curve is huge, their documentation is sometimes amazingly incomplete, and the way they chose to do their MVC convention can be out of step with reality for a huge number of applications. Symfony2 and it are the highest quality frameworks in terms of design correctness and are great choices for seasoned developers, but they also bring along a huge amount of complexity and things can get very annoying to wrap your head around.

I believe it. It's very frustraiting that the rest of the group is literally ignoring using VCS and an MVC framework, despite it being the goal of the project. It's like every other group project I've ever been a part of, where people just do whatever they feel like and hack it together at the last minute. I hate it. All I want is to learn how software is made. I can write code just fine.

edit: It's less that he's trying to dictate what IDE we use, and more that his idea is literally bypassing version control. The want to build a working project live and then copy it to github for grading, rather than actually building the project itself as a proper repo, with an MVC framework. The worst part is I was so fed up with this that I blew off the last two meetings and didn't do my tasks for this sprint. Because the tasks involved bypassing the MVC framework. Instead, I desperately tried to figure out the Zend framework so I could have something to show for all my work. Now I have nothing and I'm a bad team player.

I have no hope for graduating of having a career. I just can't keep mooching off studant loans and my parents money if I drop out of school. The guy trying to say that we should use codiad, an IDE with no VCS features to all code on a live dev build, already had a real job developing software for actual clients. I have no desire to enter that industry. I just want to use my big pure math brain to solve problems using well built software, a desire which I have not encountered in a single other student in this god-forsaken CS program.

Snak fucked around with this message at 04:58 on Nov 5, 2015

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Snak posted:

All I want is to learn how software is made. I can write code just fine.

Thankfully this one task isn't one you need to rely on your hapless classmates for.

You might want to check out the "no framework" PHP tutorial, wherein all the components a framework normally provides are found in mostly standalone libraries. I realize it's not much help for you right now, but it might give you a more realistic starting point if you ever come back to PHP. PHP and web applications in general aren't where you're likely to end up if you want to focus more on the mathy side of software development.

revmoo
May 25, 2006

#basta
I agree Zend is way too complex for a beginner. Hell I've been writing PHP for years and it would take me a while to get up to speed.

I'd almost recommend something like CodeIgniter for it's brute simplicity. It's pretty outdated, but it's extremely easy to learn and the docs are good.

Writing your own MVC framework with autoloading, a from-scratch template engine, routing, and a parameterized query engine is what really helped me learn, but that's a pretty big academic exercise that will leave you little to show for it other than raw learning.

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!
I'm trying to get Gearman to work on windows. I don't need the Job Server to run as I already have that on a Linux EC2 instance, but I do need to be able to do new GearmanClient(); or new GearmanWorker(); without it saying "hey those aren't found". I got it working on Linux, but for windows i can't seem to find any php_gearman.dll files to load in.

One tutorial had be trying `pecl install gearman`, but that results in a "gearman.dsp does not exists" error. Another cygwin tutorial I found can't find boost.

Anyone have a php_gearman.dll for php56 or a tutorial on how to get this acutally working?

lord of the files
Sep 4, 2012

JG_Plissken posted:

I'm trying to get Gearman to work on windows. I don't need the Job Server to run as I already have that on a Linux EC2 instance, but I do need to be able to do new GearmanClient(); or new GearmanWorker(); without it saying "hey those aren't found". I got it working on Linux, but for windows i can't seem to find any php_gearman.dll files to load in.

One tutorial had be trying `pecl install gearman`, but that results in a "gearman.dsp does not exists" error. Another cygwin tutorial I found can't find boost.

Anyone have a php_gearman.dll for php56 or a tutorial on how to get this acutally working?

it's been awhile since i've run into this problem myself. the problem is that the compilation process is designed for *nix systems and setting up a c compiler on windows can take awhile. there used to be a site to host these but as of today there is no official location to download pecl dll's.

for future reference you can also attempt to build it yourself here:

https://wiki.php.net/internals/windows/stepbystepbuild

I have compiled the extension and uploaded the dll here: https://drive.google.com/file/d/0B3O44Kpy0N2iLUFQT2std1VfdDg/view?usp=sharing

(let me know if you can't see it in which case I will upload somewhere else)

lord of the files fucked around with this message at 01:20 on Nov 6, 2015

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!

Nitrocat posted:

it's been awhile since i've run into this problem myself. the problem is that the compilation process is designed for *nix systems and setting up a c compiler on windows can take awhile. there used to be a site to host these but as of today there is no official location to download pecl dll's.

for future reference you can also attempt to build it yourself here:

https://wiki.php.net/internals/windows/stepbystepbuild

I have compiled the extension and uploaded the dll here: https://drive.google.com/file/d/0B3O44Kpy0N2iLUFQT2std1VfdDg/view?usp=sharing

(let me know if you can't see it in which case I will upload somewhere else)

Thanks I think I'm going to have to go through the brain trauma of compiling it myself. I had looked into it previously, but I've never done it and it looked tough. The DLL you posted is getting murdered by Microsoft Security Essentials.

lord of the files
Sep 4, 2012

JG_Plissken posted:

Thanks I think I'm going to have to go through the brain trauma of compiling it myself. I had looked into it previously, but I've never done it and it looked tough. The DLL you posted is getting murdered by Microsoft Security Essentials.

no problem :3. compiling php extensions on windows is a huge headache, so if you need anymore of them compiled just let me know! i'm on debian so the process is much less stressful here.

P.S i am not sure how the dll is throwing alerts, but it could be that it somehow mistakenly got detected?

i scanned it here: https://www.virustotal.com/en/file/76ebead0367a6001520fcaf78166222930967c6eab93ae2fd64389d0980327a5/analysis/1446771169/

it appears to be clean so in this case I am guessing it is a false detection. I compiled the version from here:

https://pecl.php.net/package/gearman

lord of the files fucked around with this message at 01:53 on Nov 6, 2015

mooky
Jan 14, 2012
I have an issue with a website that is Greek.
I don't deal much with UTF-8 encoding or foreign language characters.

The site was recently moved from one server to another, the server configs are nearly identical although the old server had MySQL 5.5 and the new one has MariaDB 10.
Everything in the database looks good, the html head has the utf-8 charset defined but on the page, text is rendered as question marks.


Is this a php thing or something else? Any reason this would change from one server to another?

lord of the files
Sep 4, 2012

are you setting the encoding on the connection itself? this looks like a php problem, but due to the fact that you upgraded your db it could also be c charset issue. if you check your mariadb logs for what happens on a connection, any charset issues should show up there if its related to the database.

mooky
Jan 14, 2012

Nitrocat posted:

are you setting the encoding on the connection itself? this looks like a php problem, but due to the fact that you upgraded your db it could also be c charset issue. if you check your mariadb logs for what happens on a connection, any charset issues should show up there if its related to the database.

It's a joomla install, it does not specifically define the charset in the configuration.php file, not sure what joomla uses for defaults.
I'm just working with the guy that runs the site, I just wanted to know what to look for when I dig into this.

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!

Nitrocat posted:

no problem :3. compiling php extensions on windows is a huge headache, so if you need anymore of them compiled just let me know! i'm on debian so the process is much less stressful here.

P.S i am not sure how the dll is throwing alerts, but it could be that it somehow mistakenly got detected?

i scanned it here: https://www.virustotal.com/en/file/76ebead0367a6001520fcaf78166222930967c6eab93ae2fd64389d0980327a5/analysis/1446771169/

it appears to be clean so in this case I am guessing it is a false detection. I compiled the version from here:

https://pecl.php.net/package/gearman

I think I'm all setup to compile after closely following the directions at https://wiki.php.net/internals/windows/stepbystepbuild. I am using php5.5.12 x86 and I have gearman-1.1.2 in my pecl directory and I'm using vc11 from Visual Studio 2012. Following the example would impile that after I do `buildconf` I should run a command like `configure --disable-all --enable-cli --enable-gearman` where i subbed in gearman for apcu in the example. However `--enable-gearman` does not seem to be a recognized option. I don't see any gearman stuff when I do `configure --help`. However If i follow their example exactly to install apcu and I download the apcu stuff I see the options for `--enable-apcu` just fine. Does gearman not work the same way? What options do i need to run to get out the php_gearman.dll once I `nmake`?

Thanks for your help.

lord of the files
Sep 4, 2012

JG_Plissken posted:

I think I'm all setup to compile after closely following the directions at https://wiki.php.net/internals/windows/stepbystepbuild. I am using php5.5.12 x86 and I have gearman-1.1.2 in my pecl directory and I'm using vc11 from Visual Studio 2012. Following the example would impile that after I do `buildconf` I should run a command like `configure --disable-all --enable-cli --enable-gearman` where i subbed in gearman for apcu in the example. However `--enable-gearman` does not seem to be a recognized option. I don't see any gearman stuff when I do `configure --help`. However If i follow their example exactly to install apcu and I download the apcu stuff I see the options for `--enable-apcu` just fine. Does gearman not work the same way? What options do i need to run to get out the php_gearman.dll once I `nmake`?

Thanks for your help.

i had that same problem myself. i did some research and I found a modified config.m4 script that had some changed parameters(which is why the dll has a russian description ha). it appears that gearman uses some older parameters which makes it not compatible with the newest pecl detection in php. i ended up not creating a pecl folder inside of my php src folder, instead I put the gearman folder into the "ext" folder within the php src folder and renamed it to "gearman". I then installed "gearmand", since gearman relies on gearmand header files. i put together a small tutorial for anyone who wants to compile this in the future. make sure you have a gcc or mingw installed beforehand

1. Download gearmand: https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
2. Make sure you have gcc installed, then run place the tarball into your ext php folder and run this this(x.y is your version):
code:
tar xzf gearmand-X.Y.tar.gz
cd gearmand-X.Y
./configure
make
make install
3. Create a folder in your gearman folder(which should be placed in ext), and call it "config.w32". Place this code inside of it:
code:
// $Id$
// vim:ft=javascript
 
ARG_ENABLE("gearman", "gearman", "yes");
if (PHP_COUNTER != "no") {
    EXTENSION("gearman", "php_gearman.c","gearman");
}
4. inside of the config.m4 file, change this:
code:
PHP_ARG_WITH(gearman, whether to enable gearman support,
[[  --with-gearman[=PATH]   Include gearman support]])
to this:

code:
PHP_ARG_ENABLE(gear,am, test gearman,
[  --enable-gearman        Enable gearman support])
5. Run buildconf, then configure --enable-gearman and the new command should be detected. You should now be able to run nmake and get the dll file.

this is just what I did to get it to work, the gearman plugin was last updated in 2008 so depending on your environment you may need play around with it.

lord of the files
Sep 4, 2012

mooky posted:

It's a joomla install, it does not specifically define the charset in the configuration.php file, not sure what joomla uses for defaults.
I'm just working with the guy that runs the site, I just wanted to know what to look for when I dig into this.

i am not sure if this would solve your issue, but I did find this:
https://forums.cpanel.net/threads/upgrade-to-mariadb-10-and-question-marks.485441/

i have used mariadb from previous instances of mysql and have never had this problem. judging from this it appears to be a php problem. what that code does is allow for additional parameters to enable encoding of the connection.

mooky
Jan 14, 2012

Nitrocat posted:

i am not sure if this would solve your issue, but I did find this:
https://forums.cpanel.net/threads/upgrade-to-mariadb-10-and-question-marks.485441/

i have used mariadb from previous instances of mysql and have never had this problem. judging from this it appears to be a php problem. what that code does is allow for additional parameters to enable encoding of the connection.

Thanks boss! I don't know why I didn't think to check cPanel's forum... I think that did the trick.

LargeHadron
May 19, 2009

They say, "you mean it's just sounds?" thinking that for something to just be a sound is to be useless, whereas I love sounds just as they are, and I have no need for them to be anything more than what they are.
Passing a PHP array to a Javascript function is giving me a headache. Here's what I've got:

code:
$row = mysqli_fetch_array($queryResult, MYSQLI_ASSOC);
...
echo "<button onClick=\"OnTitleClicked(" . json_encode($row) . ")\">blah</button>";
And further down I have the java script:
code:
<script>
 	function OnTitleClicked(rowData) {
		alert("function called");
	};
</script>
The problem I'm having is that OnTitleClicked never gets called. The handler doesn't seem to like that particular parameter - if I pass a string instead, I get the alert. The HTML generated by the server looks fine (to me, anyways - I'm new to this stuff):
code:
<button onClick="OnTitleClicked({"Id":"0","Title":"Shattering Monolith","Instrumentation":"Viola","CategoryId":"0",
"Duration":"5","Date":"2014"})">blah</button>
I found someone on stackoverflow doing the same thing, but he/she doesn't seem to be having the issue of the handler not being called: http://stackoverflow.com/questions/20778246/javascript-json-encode-json-parse-array.

edit: fixed broken table

McGlockenshire
Dec 16, 2005

GOLLOCKS!
If you're going to stick the result of json_encode into an HTML attribute, you have to run it through htmlspecialchars first to properly encode those double quotes. The first double quote inside the JSON string is ending the onclick attribute, which is why nothing's happening.

Next time, use your browser's built in inspector instead of just viewing the source. F12 opens it, whether Firefox, Chrome, or IE.

Impotence
Nov 8, 2010
Lipstick Apathy
<button onClick="OnTitleClicked({"Id":"0","Title":"Shattering Monolith","Instrumentation":"Viola","CategoryId":"0",
"Duration":"5","Date":"2014"})">blah</button>

you have a conflict in onClick="{""}"

my joke opinion would be to do something like

echo "<button class='titleclick' data-tc='" . htmlspecialchars(json_encode($row)) . "'>blah</button>";

and
<script>jQuery("button.titleclick").click(function() { console.log(JSON.parse($(this).attr('data-tc'))); }</script>
// use document.querySelector("button.titleclick").addEventListener("click") if you odn't jq i'm lazy and it's late
// this is terrible still

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Biowarfare posted:

<script>jQuery("button.titleclick").click(function() { console.log(JSON.parse($(this).attr('data-tc'))); }</script>
// use document.querySelector("button.titleclick").addEventListener("click") if you odn't jq i'm lazy and it's late
// this is terrible still

If you have jQuery loaded, there's no need for the JSON.parse if you use jQuery.data():

quote:

When the data attribute is an object (starts with '{') or array (starts with '[') then jQuery.parseJSON is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.

e: After all, jQuery is always the answer, even if the question is PHP and you forget what thread you're in.

Impotence
Nov 8, 2010
Lipstick Apathy
i've seen people write angularjs and react with jquery modifying the dom on a setInterval/setTimeout

LargeHadron
May 19, 2009

They say, "you mean it's just sounds?" thinking that for something to just be a sound is to be useless, whereas I love sounds just as they are, and I have no need for them to be anything more than what they are.
Thank you all for the prompt replies. I'll look into jQuery (I have to learn more about that library in general), but I am curious about this:

Biowarfare posted:

my joke opinion would be to do something like

echo "<button class='titleclick' data-tc='" . htmlspecialchars(json_encode($row)) . "'>blah</button>";

That would have been my instinct - it seems like a clean solution. What's bad about it?

e. FWIW it works fine as far as I can tell...

LargeHadron fucked around with this message at 14:59 on Nov 10, 2015

spiritual bypass
Feb 19, 2008

Grimey Drawer
PHP7 comes out on Thursday and I'm loving pumped

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

rt4 posted:

PHP7 comes out on Thursday and I'm loving pumped

I thought it was delayed until the 26th?

revmoo
May 25, 2006

#basta
Any compatibility issues with 7? I'd love to upgrade from 5.4

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

revmoo posted:

Any compatibility issues with 7? I'd love to upgrade from 5.4

This might be the place to start: http://php.net/manual/en/migration70.incompatible.php

I would highly recommend just compiling the latest RC and run it against your test suite. Rasmus also releases a Vagrant box with the latest RC compiled on it if you're not comfortable compiling it.

spiritual bypass
Feb 19, 2008

Grimey Drawer

musclecoder posted:

I thought it was delayed until the 26th?

My information is from the most recent news item on the front page: http://php.net/archive/2015.php#id2015-10-29-1
I have no idea about any internal chatter or planning, though.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
Yes, 7.0 has been delayed. They're doing another RC first, as there were a few significant and crasher bugs. The earliest likely day is indeed Thanksgiving - November 26. The next possible date was, I believe, in the second week of December. I can't find the php-internals thread for some reason Here's the php-internals thread discussing the delay. They're trying to not let it get that far though, as activity and thus eyes for bugs drops off during the holiday season.

revmoo posted:

Any compatibility issues with 7? I'd love to upgrade from 5.4

The documentation has a migration guide, including a section on explicit backwards compat breaks. For the most part, as long as you're clean of all warnings and notices, including E_DEPRECATED and E_STRICT under 5.6, your code will probably work fine under 7 unless you're doing funny things. Almost all of the breaks are done in a way that still allows code to be written for 5.x and 7. I think the list()-can't-have-empty-args thing is the only one that's going to bite my codebase majorly.

Don't forget that PHP7 completely removes the ereg extension, including split(). Most POSIX regexes are identical to their PCRE counterparts, so migration shouldn't be too difficult. Most cases for split() that I've encountered tend to not use it as a regex, but similar to explode().

McGlockenshire fucked around with this message at 19:22 on Nov 10, 2015

revmoo
May 25, 2006

#basta
Awesome thanks. Looks like upgrading won't be too terrible.

As an aside, can anyone think of the best method to have a PHP script communicate with a long running PHP daemon on the same machine? I need to send data to the daemon on a regular basis but I'm not sure the best way to go about it. I figure I can either write something like JSON to a flat file, or use memcache perhaps, mostly just wondering what the best performance would be. I think writing to a RDBMS would probably be the slowest so that's out.

Adbot
ADBOT LOVES YOU

bigmandan
Sep 11, 2001

lol internet
College Slice

revmoo posted:

Awesome thanks. Looks like upgrading won't be too terrible.

As an aside, can anyone think of the best method to have a PHP script communicate with a long running PHP daemon on the same machine? I need to send data to the daemon on a regular basis but I'm not sure the best way to go about it. I figure I can either write something like JSON to a flat file, or use memcache perhaps, mostly just wondering what the best performance would be. I think writing to a RDBMS would probably be the slowest so that's out.

Beanstalkd should do what you want. The script would push onto the queue and the the daemon would read from it. From what I remember I think pheanstalk is one of the better PHP libs to talk to beanstalkd. It might be a little overkill, but you can scale it out in the future if needed.

bigmandan fucked around with this message at 21:02 on Nov 12, 2015

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply