« first day (2834 days earlier)      last day (2105 days later) » 

12:00 AM
and you should change MyNamespace to somethig that makes sense for you app, the point is to create a global object that holds your app-specific data without cluttering the global scope with potential naming collisions
 
also could i just put the php echo line in side the <body></body> tag as well seeing that am already echoing my table in there and a bunch of other things?
 
@BobbyAxe extra credit: the two main reasons you shouldn't do that are 1) there are some weird edge cases where valid JSON is not valid as a javascript literal value and 2) by adding this dynamic transient value to the page source you are making caching very hard
I doubt either of those things are a problem for you, but they are things that are worth finding out about and understanding
 
@DaveRandom okay i will change it
@DaveRandom no actually i want to learn to do stuff the right way
 
@BobbyAxe yes, but you should use the approach of declaring the values at the top and using <?= ?> in the HTML, it makes for much more readable code
@BobbyAxe those two problems are things you don't need to care about right now, I'm very much in favour of people learning "the right way" but you need to find a balance, if you try to learn everything before doing stuff, you'll never do anything. Doing stuff and making mistakes is by far the most effective teaching tool.
It's worth reading up on those things, but they are not going to be problems for you right now, so don't get too distracted by it, is all I'm saying
caching in particular is an insanely complex topic, and not something you should worry about until you actually need to
google "2 hard problems"
 
@DaveRandom okay thanks a lot i understand, back to work for me. it took me a day of messing with css to figure out the problem wasn't with styling kept narrowing it down till i found
 
12:09 AM
@BobbyAxe do you use PHP storm?
if not, start using it
 
no what does it do/
 
it's an IDE
it will tell you about things that are wrong with your code
it will make it much easier for you to write better code
 
wow okay am searching for it
 
there's a 30 day free trial
it's not cheap, but it's not that expensive and IMO it's worth the price
but at the very least you can use your 30 day trial
 
i will use it if it helps i will buy it
it could save me a lot of time
 
12:12 AM
yeh well that's the thing, you get 30 days to figure out if its worth the money :-)
@BobbyAxe what do you use now?
as a text editor I mean
 
just sublime
then atom when styling
 
they are decent editors
 
atom has more inbuilt style tags
 
I don't do front end so I can't really comment
I know PHP storm has a bunch of CSS stuff in it but I never use it
if I find myself writing CSS, something has gone very wrong with my day :-P
 
lol
seriously UI is what makes the back end worth it
 
12:16 AM
don't let me put you off, I need people like you to make sure I don't have to write CSS :-P
 
@DaveRandom thanks a lot for the help. deeply appreciated
 
no worries
Does anyone dual-boot in uefi? I haven't done a dual boot since bios, any gotchas I should be aware of? (w10/fedora if relevant)
 
12:40 AM
Uefi?
 
@DaveRandom I do and it was painless as far as I recall
 
Oh, interesting
Wouldn't it be easier to dual boot with uefi than BIOS?
Considering it's supposed to be "new and improved"
 
in theory yes, but windows isn't generally a good neighbor in that area
 
True
Apparently a tornado in my area o.o
But it's like 30 miles north of me
 
Yeh I know that Windows basically just nukes stuff on install through the standard ui, but that doesn't matter for me as it's preinstalled
I prob won't use Windows much, but would be nice to keep it there for those occasions when it's useful
Will need to shrink the partition actually, can Windows do that sensibly by itself yet? That's always been high on my list of gripes with it
@Tiffany seriously, I don't understand why people live outside Europe :-P
nature clearly is not happy with people being in most other places on earth
australia in particular, basically everything that isn't a person or a rock is lethal in some way
 
12:54 AM
@DaveRandom it was mostly sunny when I sent that message earlier, all of a sudden is windy and dark now
I live in tornado country, but the town I live in is on top of a bluff, so the likelihood of a tornado going through is pretty rare. The surrounding small towns aren't so lucky though :/
 
The west coast of the US is a gigantic geological bomb, California is basically constantly on fire, the east coast is frequently under water with 100mph+ winds, the middle bit throws a tantrums in the form of wind, the north is regularly cold enough to die of exposure, the south is regularly hot enough to die of thirst
 
Lol
 
nature is really dull here so we have to have a war every so often just to keep things interesting
 
Pacific northwest is pretty nice though
 
yeh what I see of new england looks nice as well
(that's significantly derived from cheers and murder she wrote)
went to seattle once, that was nice enough, very wet though
so I felt right at home :-P
 
12:58 AM
hey i'm looking for php developer
 
areas of CA I lived in weren't too bad. Palmdale is in a desert so drought is common. El Segundo was on the LA coast, so it had ocean weather (~20C all year)
 
@EduardoHerrera hey, I'm looking for love, or ice cream
 
@DaveRandom yeah, been to Seattle too... lovely area... I either want to live there or some place in CA
 
Vancouver is the only city I have ever been that I would consider living in other than Manchester
 
12:59 AM
it's a little creepy how quickly it got dark here though... not the gradual sundown that usually happens... just suddenly light...then dark...and windy...
I've a friend who lives in Vancouver... so jealous of him
but Vancouver is expensive as fuck and I'd probably be refused immigration to Canada, lol
 
it doesn't happen every year, but sometimes in late apr/early may there are a couple of weeks where you can ski to the beach
 
lol... makes me think of a comic... I'll see if I can find it
 
@EduardoHerrera seriously though, do you have a question?
> Don't ask to ask, just ask
@pmmaga on hold anyway as I can't find a big enough flash drive :-P
 
my samesite cookie implementation is leaking :|
 
I have some plumbers tape?
 
1:03 AM
 
i need to go to bed
 
@DaveRandom I've tried applying it all around it :x
 
did you try looking at it with disdain and calling it names?
that's what I would do
 
@DaveRandom still in France?
 
no in UK
 
1:04 AM
from the start! (I'm not a fan of the winning API)
 
did you enjoy France?
 
...where it is 2am, so I assume it is 3am where @pmmaga is, and he also should go to bed rather than fruitless bug hunting) :-P
/me sleeps
nn all
 
does anyone else flip off their monitor when the code doesn't compile/work as intended, or is that just me?
 
@Tiffany yeh was good :-)
/me actually sleeps
 
@DaveRandom nope, gmt bros! nn o/
 
1:05 AM
goodnight
 
 
2 hours later…
3:33 AM
good morning :)
Why does this code results in an infinite loop?
https://pastebin.com/iU9P1gxZ
I mean it works perfectly fine if I do not extract the number from the input box using the $_GET['number'] variable and initialze the `$numberWanted` to any value between 1 and 6.
Can anyone help me to fix this code. I will really be grateful.
 
Night all
 
4:25 AM
mornin god's
 
5:08 AM
posted on July 20, 2018

New Cyanide and Happiness Comic

 
 
1 hour later…
user9059272
6:14 AM
Hi
 
user9059272
I'm using xampp on my windows 10 machine
 
user9059272
I want to know the difference between httpd.conf and httpd-xampp.conf files
 
user9059272
Someone please explain me the differences and similarities between these two files along with their need
 
7:03 AM
morns
@Tiffany that's probably just you
:p
 
The new Skeletonwitch album is out AND they are on tour with Mantar. Guess who's gonna see them live?
 
hello
 
@Gordon you know, you have a very weird taste in music :P
 
@mega6382 that makes no sense. My taste is perfectly good.
 
you may very well think that, ...
 
7:16 AM
this my ajax success function
success: function(data)
{
var html = '';
$.each(data,function(k,v){
html += "<b>menu code: </b>"+v.menu_code+"<b> menu name: </b>"+v.menu_name
});
$('#output').html(html);
}
how to store success function values into php variable or array in ajax?
 
7:33 AM
Is there any way to store success data into php variable?
 
I uploaded images and inserted them into mysql successfully via php but I don't want to store them as binary (as jpg,png,..etc) is there any way?
o/
 
8:00 AM
tummler any lively, prankish, or mischievous man.
 
yormin phomies
 
yo
 
544
Q: How to pass variables and data from PHP to JavaScript?

Madara UchihaI have a variable in PHP, and I need its value in my JavaScript code. How can I get my variable from PHP to JavaScript? I have code that looks like this: <?php ... $val = $myService->getValue(); // makes an api and db call ?> I have JavaScript code that needs val and looks along the...

go through this please
 
8:18 AM
0
Q: Integrate PHP and WebSocket authentication securely

JonySo I have a PHP server that runs a website, and the website has features such as live notifications, which are basically notifications that get sent to you once a user likes or comments on one of your posts, live. I decided to use WebSocket for this, just for practice. So to use WebSocket, I nee...

 
TLDR: Generate new token for every single page refresh (you're basically re-creating PHP's session handling). Pass your token + user id, both from the db, to JS vars. Verify they're the same on initial web socket connection, if they are not deny, if they are, accept connection then change token so that a second connection will not work. That's it.
 
How is that different from saving session ID linked to user ID in db?
 
Session id stays the same for the duration of the session no?
 
Ah, so that makes it not secure?
 
also don't forget to use httpS and wsS
 
8:25 AM
And about stage two, is that relevant to post using ajax and then update the WS server?
or just do the same logic on the WS server and request to post/comment
 
Happy Friday!
 
Happy Rebecca day!!
 
@Jimbo is there harm in only passing the token & keeping the association between user and token on the server side?
I guess it just saves a request for the client to ask for the user id as part of the setup
 
@Sean If you have access to the user id server-side hmm I don't see why not (like taking it from the session you mean) - I hadn't considered that
@Jony Nope, once you have a web socket connection, might as well make everything over that... that's the point right?
You're trying to avoid the overhead of a brand new HTTP request and response every time you want to talk from client to server or vice-versa
 
Wes
9:01 AM
le morning
 
user9059272
I'm using xampp on my Windows 10 machine.
I want to know the difference between httpd.conf and httpd-xampp.conf files
Someone please explain me the differences and similarities between these two files along with their need
 
yo @Wes
 
@SerialKisser I'm going to guess httpd.conf is the main config file, which includes httpd-xampp.conf into it to override settings specifically for xampp support
By the looks of it it also contains the default virtualhost for your xampp install (htdocs)
 
user9059272
9:16 AM
@Sean : Yes, you are right. The httpd-xampp.conf has been included in the file httpd.conf
 
user9059272
@Sean : Thanks for your help :)
 
No probs!
 
9:41 AM
how to pass a ajax success function data value into php variable?
 
Has anyone used WSL? Does it provide any particular benefit for everyday use?
 
3
Q: how to get values from database in codeigniter based on select box value without refreshing page?

sunshineUnable to get value from database in codeigniter. I tried to fetch data based on select box value(menu_code) without refreshing page using ajax but I got result undefined. This my controller's code : login.php public function get_menu_rights() { if (isset($_POST['name'])) { ...

First answer of this question success function contains data but they stored into html to display but i need to store that value into php variable.
 
@hearthacker check the link @HamZa shared
 
yes i checked already
i have a success function like this
success: function(data)
{
var html = '';
$.each(data,function(k,v){
alert(v);
html += "<b>menu_code: </b>"+v.menu_code+"<b> menu_name: </b>"+v.menu_name
});
$('#output').html(html);
}
i want to store the json values into php instead of storing into html.
 
9:49 AM
Try this link instead
 
@hearthacker first of all you cannot store a value from frontend into as a variable in the backend in php. To store that variable in php you will have to send another request to php using ajax
@DaveRandom I am seeing that tld for the first time, its amazing how well it fits here.
 
@mega6382 Ok, i'll make another request to php
 
can someone remind me the official irc server for php internals?
oftc.net or something?
 
10:10 AM
There's no official one, who do you want to talk to?
 
Why does this code results in an infinite loop?
pastebin.com/iU9P1gxZ
please anyone explain it to me?
@mega6382 @Danack please :'(
 
!!debugging
 
@Sanu_012 please don't ping random people. If someone wants to help you then they will, pinging people will not make them help you more
 
@mega6382 Sorry, that was my mistake. :(
 
@Danack thanks, that's what I meant
@DaveRandom you're the one who asked me
 
10:38 AM
Morn uh ngs
 
10:52 AM
@FlorianMargaine ...wut? :-P
 
5 messages moved to Trash
 
MYSQL : how to select in second table if not found in first table?
 
yo @PeeHaa
 
@VintageBeef can you be more specific about what the tables are?
It is possible to do that but it's rare you'd want it to be exclusive like that
i.e. generally you'd just do a UNION
 
Good lord trying to read kubernetes documentation is driving me insane. e.g:
> The API is defined in k8s.io/metrics repository. You can find more information about the API there.
No, I can find a Go file there....
 
10:59 AM
i have two table and i want to check that if my data not found in the first table, go check in second table
 
@VintageBeef yes, but why do you not want to always check the second table?
 
@VintageBeef just write some php code to do that?
 
i.e. can't you just do SELECT whatever FROM table1 WHERE foo = 'bar' UNION SELECT whatever FROM table2 WHERE foo = 'bar'
 
it is possible to with single query?
 
It's possible to do in pure SQL, you'd need multiple queries with an SQL conditional, but PHP + MySQL makes that harder than it needs to be and it's probably simpler to just do the conditional in PHP
but...
6 mins ago, by DaveRandom
It is possible to do that but it's rare you'd want it to be exclusive like that
do you have a good reason to not just use a union? i.e. always check both tables?
 
11:02 AM
morning
 
you may have a good reason, good reasons do exist, but it's hard to give you advice without all the information...
If you can use a union and this is something you need to do a lot, you might also consider making a view
 
yo @Tiff
 
although yet another crappy non-feature of MySQL is that you can't create indexes over views so I'm not sure what use they have in MySQL, other than pointlessly hiding logic
srsly, why do people use MySQL
 
didn't it used to be not-shit?
or was it always shit?
 
it's not shit as such, it's just insanely limited when compared to other things
I'm not old enough to know whether it's always been lagging behind like this, or just hasn't moved as fast as other things
 
11:09 AM
PGSQL is better, right?
 
PGSQL is the worst
 
@mega6382 that's the first I've heard of someone complaining about it
 
pgsql is certainly more feature-rich
it's quite a lot more technical though, in some ways
 
@DaveRandom Because people don't know better, mostly
 
one thing that mysql has going for it (much like PHP) is a low barrier to entry
 
11:10 AM
@Tiffany it's getting better slowly. To some extent it's more that there weren't good alternatives for a while, and so many people have gotten used to it, that going from 'not great' to 'only slightly better' now is a bad tradeoff as an alternative has to be massively better to deserve making the transition.
 
like 99% of php build your first X tutorials will use mysql because everyone else has and it's convenient
Fisher price build your own blog with LAMP
 
@DaveRandom yeah, its ridiculously feature-rich, which makes even the simplest of things very hard to do
 
I'm just wondering what the better alternative is
I thought PGSQL would be it
 
And admittedly I'm in that boat too. I've only really used mysql or maria for RDBs, so I don't really know why/how others could be more beneficial
 
Oracle 11g was my first database...
only cause our website back then wasn't propped up on a database, and I was the primary dev for our ERP web shit
 
11:13 AM
I will say for simple and small systems, there is no beating mysql/mariadb, but for complex and big projects, going for more flexible rdbms might be a good idea. Or a non rdbms solution might work too such as dynamodb/mongodb
 
@Tiffany it's about the use case really. If you want to hack something together for a toy project, MySQL is fine. If you want something that's provides a feature-rich scalable robust solution for an enterprise-y application, use SQL Server. If you want the same, but you want FOSS or you have a Windows-free stack, use pgsql.
 
MySql is to databases what PHP is to programming languages. And that makes it a match in heaven… or hell… depending on your viewpoint.
6
 
If you don't want to design your database because you don't understand databases, use NoSQL and wish you had bothered to learn about databases.
3
 
@DaveRandom how's it compare to like sqlite or mongodb?
 
3 messages moved to Trash
 
11:15 AM
@Gordon yes, the difference being that PHP can be made suitable for massive applications by throwing tin at the problem. MySQL otoh can cause real damage to your universe when it goes seriously wrong
 
@Tiffany sqlite is for single user applications. mongodb is good when you want digital obsolescence as a feature… because well, it will forget your data eventually.
 
@Tiffany They are sort of apples and oranges really
sqlite is roughly analogous to the PHP built-in web server
I don't really get the point of mongo tbh, it seems to be aiming somewhere between LDAP and lucene, and I'm not sure what the use case for that is
schemaless object stores are useful for doing black-magic search things, which I don't actually understand but I understand well enough to trust that other people know what they are doing
 
@DaveRandom I think its mostly just storing your data as json and calling it a db
 
mornings
 
@DaveRandom it's got a use-case where you have semi-structured data but the rules about that structure would be annoying to express as relations. My understanding is that it's a good match for things like insurance deals or sales. e.g.
 
11:22 AM
yeh OK I guess I can see that
not sure why hyperspeed would matter for that, but I guess people get carried away
 
For insurance it would be standard to have most contracts have a specific flood terms and conditions in it, and then you want to be able to search by "How much exposure do we have to insurance deals that don't have flood conditions attached to them."
 
Happy birthday @Ekin! :-)
14
 
Happy Birthday @Ekin!
 
@DaveRandom possibly it's the same as kubernetes.....the people promoting it had really strong incentives to get people using it.
 
@Ekin happy birthday!
 
11:27 AM
@Danack can it actually index that shit as well as lucene though?
 
Thanks :-) cheers
 
If I still need to run a separate search layer then where's the benefit over rdbms with blobs, basically
 
@DaveRandom Slightly unsure (never used mongo), but my guess is yes and also writing queries for that kind of subdocument search would be easier in mongo than lucene.
 
I'd actually never touched mongo ever until about 3 days ago, I don't really know how it works, I just know that I've never had a use case for it
 
@DaveRandom Are you sure you have a case now?
 
11:31 AM
I don't, the only reason I touched it was because I needed to compile it to update the version that we provide at work
and because debian is weird the build process was a bit broken, so I ended having to dig into it a bit
@Danack oh yeh using lucene directly is nuts, but solr reigns that in and makes it usable by mere mortals
(a bit)
 
@DaveRandom cough ES cough
Which still is barely usable
 
@Fabor PuPHPet doesn't have anything for debian :<
 
@DaveRandom you totally misspelled elasticsearch.
 
user9059272
What does it mean by 'on every invocation' in the below statement from the PHP Manual?
 
@PeeHaa turns out searching unstructured data is hard. Who knew?
 
user9059272
11:39 AM
The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every invocation.
 
user9059272
Does it mean whenever the PHP tag is detected in a document during the parsing the configuration file (php.ini) is read?
 
Wes
\o
 
O/
 
Wes
happy birthday @Ekin \o/
 
@Danack I've actually never used it, I haven't had the use case for a long time and when I did ES was barely a thing (and the choice of solr predated my involvement)
 
11:41 AM
> (transitive, computing) To cause (a program or subroutine) to execute.
Interactive programs let the users enter choices and invoke the corresponding routines.
In this case, hitting enter after doing php whatever.php
 
all those things are too close to people for my comfort anyway, smells like front end
 
@DaveRandom I should learn you some ReactJS.....
 
I should show you the back of my hand
 
Wes
!!urban show back of hand
 
[ back show ] A [woman] who exposes a large [amount] of her back [in public]
 
Wes
11:44 AM
yeah no
 
@Wes I think he meant to say, "smack you senseless" :P
 
It's a very old expression meaning basically that ^
 
Wes
!!urban smack you senseless
 
[ Senseless ] Used to describe when someone is not getting [a joke] or doesn't understand [the point] trying to be made. Can be used as a [defensive] comment.
 
there are lots of weird old expressions for that in english, "I'll make you smile on the other side of your face" is one of my favourites
 
11:46 AM
@Jeeves but considering its @DaveRandom, it could very well mean this :P
 
haha
 
It won't be my back you'll be looking at
 
@DaveRandom we know that. we've seen enough pictures of you to know that. lord knows, we did.
 
lol
 
Wes
:B
 
12:10 PM
@Gordon s/enough//
 
THERE'S MORE?!
 
feel free to peruse my fb, and note also that I do commissions
 
@DaveRandom Are you on SnapChat?
 
@DaveRandom I guess now that you are a frenchmen, we can expect a little bit lace
 
I don't suit things that require delicacy
 
12:13 PM
@jjok don't aim low. ask for his chaturbate… or tinder
 
seriously, I'm something of a luddite with social media, I basically do twatter and that's it
I only keep my fb account alive purely in order to find out about irl social events
 
@DaveRandom That's probably safest for the rest of us.
 
as I understand it, snapchat is transient anyway, I prefer to create the deeper scars that come from the knowledge that things are still out there, lurking
 
@daveRandom's pic, taken from platform.sh's team page :P i.stack.imgur.com/NIXAb.png
 
lol
 
12:18 PM
ugh
 
the dude to the left of him vaguely resembles Elon Musk
 
Cloud Engineer. That sounds like a made-up job title.
 
is cloud engineer like a meteorologist?
 
I'm in charge of the dry ice machine
@Tiffany it's random every time you reload
 
so you're an overpaid intern?
@DaveRandom oh... his first name was like Csaba?
 
user9059272
12:20 PM
Does the sentence "There are several Apache directives that allow you to change the PHP configuration from within the Apache configuration files. " need to be re-formed as "There are several PHP directives that allow you to change the PHP configuration from within the Apache configuration files. " ?
 
Oh I haven't met him yet
 
user9059272
Source of this sentence : secure.php.net/manual/en/…
 
@Tiffany Maybe it's his fault we're having this drought in the UK?
 
@jjok I could see him doing that... maybe siphoning it all to Manchester (sorry for all the edit-pings)
 
@SerialKisser no it's right, the things it's referring to are handled by Apache, but I agree the sentence reads oddly
 
12:22 PM
@SerialKisser Why are you so obsessed with configuration files? Why don't spend more time actually programming?
 
@SerialKisser no, they are Apache directives. You specify them in Apache.
 
user9059272
@jjok : Because in my last interview the interviewer asked me so many questions regarding the PHP configuration. So, I want to make my PHP configuration concepts crystal clear
 
@jjok (I don't think he's a ten5 clone)
 
@jjok eh, devops is a thing, some people like it, I like it to a degree, a well built nginx config can be as satisfying as a well designed bit of code
 
@Tiffany No, he is not, he's been coming here from before the @ten5 account
 
12:24 PM
apache configuration is kind of masochistic though
 
user9059272
@Gordon : How can Apache directives allow to change PHP configuration as PHP configuration is entirely based on PHP directives only?
 
or I dunno, has that got any better?
 
@mega6382 mmm, around the same time, I think, but mind you, he has multiple accounts
 
yes, that's true
 
@SerialKisser There are some apache directives that can be used to define values for php.ini options
 
user9059272
12:25 PM
@DaveRandom : Can you name any?
 
so e.g. you can define different values for certain value on a per-vhost basis, but still use a shared php.ini
@SerialKisser php_flag, php_admin_flag, php_value, php_admin_value
 
@SerialKisser what Dâvíd says
 
@mega6382 more to the point: he's asking practical questions, not obsessing over minor, random things about programming, without actually having begun working on a project. ten5 has been too caught up on perfecting the planning part, instead of just trying it out for himself
 
Hi
 
@SerialKisser an example use case might be, imagine you have a staging site and the production site on the same box, you can define display_errors=1 on the staging site and display_errors=0 on the production site, if you do that at the web server level then you can run the exact same code on both sites with no need for ini_set() calls in the code
 
12:29 PM
@Tiffany Yes, and usually with ten5 the conversation almost always trails off into him talking to himself :P
 
You might also define per-host session storage directories
 
user9059272
@DaveRandom : Ok, now I got the concept clear.
 
user9059272
Are you saying that php_value, php_flag, php_admin_value, php_admin_flag are all Apache directives?
 
yes, and the same ones exist in fpm
 
user9059272
@DaveRandom : Ok. Thank you so much for helping me out.
 
12:31 PM
they are documented in the php manual, but they are handled my mod_php (i.e. the apache module) rather than by php itself
The PHP manual doesn't seem to have anything that explains what a SAPI is and where the separation is
@SerialKisser this is a not-terrible explanation stackoverflow.com/a/38669983/889949
 
@DaveRandom sorry, you said a "might"
@Gordon @DaveRandom unfortunately, if you want open source-based multi-master synchronous replication, mysql+galera is the only player in the town
 
@FlorianMargaine I feel like we had some conversation I don't remember :-P
 
@DaveRandom see the last message you sent me on slack
well, before-last, the last one being "kk, catch you later"
 
@FlorianMargaine I only discovered the existence of this last night, but postgres-xl.org
I haven't actually looked at it yet
 
how to insert dynamic checkbox into database?
<form action="">
<tr>
<th>Menu Id</th>
<th>Menu Name</th>
<th>Yes/No</th>
</tr>
<?php foreach($result as $res){ ?>
<tr>
<td><?php echo $res->menu_id; ?></td>
<td><?php echo $res->menu_name; ?></td>
<td><input type="checkbox" name="yes" id="yes"></td>
</tr>
<?php } ?>
</form>
 
12:39 PM
Hey guys! I need to replace ->data[...] with ->getData(...) in a bunch of controllers. What do I google to automate this? I feel this is a relatively common task. Tried search replace files regex but couldn't find a ready answer.
 
@FlorianMargaine ah right, yeh don't worry about it for now
 
@TheSexiestManinJamaica What code editor do you use? Most should be able to search/replace regex really easily
@hearthacker Take a look at some guides on how forms work - developer.mozilla.org/en-US/docs/Learn/HTML/Forms/…
 
@hearthacker <td><input type="checkbox" name="yes" id="yes"></td> You can't put an id or a name in a loop like that. They have to be unique.
 
the above table displays dynamic menu_id 1,2,3..etc and dynamic menu_name car,pen,mobile,..etc and also dynamic check box. but i need to insert yes/no ..Is it checked or not how to insert into db dynamically
 
@Sean I use Coda, but I guess I'll need a Linux command because there's a lot of files and I want it to handle all of them at once. Just like when I do grep -inR "..." src it searches the whole folder
Probably sed is the answer, but I'm not sure how to make it record an array key and put it as a function argument
 
12:45 PM
@jjok i maked unique <input type="checkbox" name="yes" id="yes_<?php echo $res->menu_id; ?>"> but my doubt is how to pass it into controller and insert into db in codeigniter?
 
@hearthacker if $res has an ID you can use form arrays and loop through them. So your checkbox name might be something like "menu_switch[<?php echo $res->id; ?>]" and your php would loop through $_POST['menu_switch']. There's a few different ways you can do it in reality.
 
@hearthacker You'll need to do a similar thing with name too. That's the important bit in this case, as it'll be the key in the PHP $_POST array.
 
@hearthacker 3v4l.org/CSYfU
$_GET['yes'] will be an array where the keys are the ids of the ones that were checked
although actually it might be better to do 3v4l.org/ZU3UO
then you just get an array with the ids as the values
 
@TheSexiestManinJamaica You can capture the input as a group and then use that in your replace part
 
got it @DaveRandom but how can i insert into table?
 
12:49 PM
the same way you would process any other form data
 
okay
 
just loop the IDs and run a sql query for each one, or possible use WHERE ID in (<list>)
 
thank you.
 
@DaveRandom We are talking mysql
 
@Fabor can you gist the EXPLAIN output?
 
12:52 PM
@Danack Full DB is 50GB though :(
@DaveRandom Sure
 
I mean clearly at the root of it is that you have an I/O bottleneck, and sometimes it doesn't do enough I/O to hit it
I'm going to guess that adding the right index(es) will fix it, and further guess that the times that don't hit the bottleneck are because a temporary cacheable index has been created and is reused
but they are almost completely baseless guesses
 
Linked in hangouts
 
kk
that's it?
 
@TheSexiestManinJamaica Example: echo "Hello Dave!" | sed -r 's/Hello (.*)!/Good Day, \1!/g' -> "Good Day, Dave!"
 
can you gist the query as well @fabor?
 
12:56 PM
Sent on hangout
 
@DaveRandom please check here(3v4l.org/QRqRo) Is it will insert dynamically or not?
 
Wes
@bwoebi @NikiC if typed props get accepted, do you think it's possible to optimize this

private Foo $_bar;
public function bar(): Foo{ return $this->_bar; }

so that it doesn't have overhead?
func call overhead
 
On some alternate news. Get your wisdom teeth out ASAP people. -_- Don't wait. Currently had 2 pulled 4 days ago
 
Wes
can't even write 3 lines correctly lol
 
@DaveRandom Is it correct? 3v4l.org/L9var
 

« first day (2834 days earlier)      last day (2105 days later) »