« first day (1928 days earlier)      last day (3030 days later) » 

12:48 AM
I have a huge string, $content
I want to find the string stored in $thisCustom url, within the string in $content
$content = "this is stufff wooooooo here we are www.google.com is a website... wooooooo"
not knowing what the url is
I want to do a substr_replace
substr_replace($content, $detected_url,
....so here is the question
how can I find replace text within $content?
 
Wes
1:04 AM
> the string stored in $thisCustom url
not knowing what the url is
you sound undecided
 
 
1 hour later…
2:11 AM
so ... I found this video and I will inflict it upon you all
you can thank me later
 
2:22 AM
@tereško I think that's enough internet for one week.
 
2:34 AM
Hey guys
need help with pagination
im showing 5 rows per page
but if I go to next page, it updates only 1 row instead of showing 5 new items
0
Q: Pagination in PHP only updates 1 row per page

Cisco1991Need help fixing my pagination. I have limit of showing 5 rows per page, and everytime I go to next page, it only updates 1 row at the bottom instead of showing 5 new items per page. Here's what I currently have. Sorry for the long post of code. For now, the workaround I did was to set $listcoun...

 
first of all, @Cisco1991: your code is shit
but the problem is cause by the fact that you are using wrong offset
 
haha! I know. But to be honest, this wasn't really my work. I'm just continuing another dev's work
 
page one is 0..4
page two is 5..9
etc
what you do with "two" is change the offset to 1..5
 
where is it? sorry
 
in your code
where you use "LIMIT a , b" construction
 
2:41 AM
you mean this
if ($totalpages > '1') {
$curpageoffset = 0;
if (isset($_REQUEST['offset'])) {
if ($_REQUEST['offset'] >= $totalpages)
$curpageoffset = $totalpages - 1;
else if ($_REQUEST['offset']>0)
$curpageoffset = $_REQUEST['offset'];
}
$limitstr = " limit $curpageoffset,$listcount";
?
 
read Zeev's latest mail (only internals mail I've read in past 48 hours), and confirmed my decision to stay away. Yay to lunacy
 
3:24 AM
"lunacy" - you should definitely avoid any of the session threads then....."oh we have a bug that no-one can figure out what the cause was or how to fix it? A perfect time to make the session management more complex by an order of magnitude!!ONE!".
 
@Danack oh, is that what's going on with the sessions?
I didn't bother to read that thread.
 
yes, two separate things - shit is broken, and he wants to add shitty new stuff on top of it.
 
uh. That's dumb. A bugfix release should not be adding substantial new features.
 
 // Check if session ID should be regenerated
  if (ini_get('session.regenerate_id')
      && isset($_SESSION['__PHP_SESSION__']['CREATED'])
      && $_SESSION['__PHP_SESSION__']['CREATED'] + ini_get('session.regenerate_id') < time()) {
      session_regenerate_id();
  }
  // Check obsolete session and destroy.
  if (isset($_SESSION['__PHP_SESSION__']['NEW_SID'])) {
    // Must not update obsolete session TTL.
    if ($_SESSION['__PHP_SESSION__']['UPDATED'] - time() < -60
        && !isset($_SESSION['__PHP_SESSION__']['NEW_SID_SENT']) {
That is from the RFC......
 
this is the precise session management rfc?
 
3:31 AM
yes.
 
"Session ID management requires more precise management. Otherwise Outstanding session ID is lost randomly; Session ID cookie becomes empty randomly"
wtf, seriously? Why is there not a fix to just that one issue?
 
full disclaimer - I have a toy session manager library - which I intend to make be not a toy at some point. But if people want more advanced session stuff we should either do it in userland, or as a new extension that uses actual functions, as opposed to magic array crap.
 
/me reads some more, then decides dealing with people who expect to get dug out two days after a 3 ft snowfall sounds more appealing.
 
4:18 AM
anybody uses symfony's form component? am I actually going to save developping time if I learn it from scratches for the new project, or will I just use time differently to adapt to the component? (eg I see they use HttpFoundation for the Request class, whereas I use another one)
 
4:31 AM
@FélixGagnon-Grenier For most forms, I really like Symfony's form component.
Especially when combined with the validator component.
Generating and processing forms has always been a pain in the ass, and is one of the things I've always least liked doing,
That said, really complicated forms are still complicated, even with the form component.
 
I guess there's no escaping it. Thanks for the props.
 
5:07 AM
can anyone ans this question stackoverflow.com/questions/35007265/…
 
@abhishekverma that's a lot of code to read through, let alone test. At the least, you need to explain what specifically "doesn't work", and what you have tried in order to make it work.
Also, fixing the formatting on your JavaScript code so it's readable would be a plus.
 
i answered it abhishek verma
 
@Illuminati That's the sort of answer that could be very easily flagged as "should be a comment, does not answer the question"
 
in many ways, yes
jbafford where would be a good place to ask a question about how i architecturally designed something for a website?
to see if im being stupid when there is a better way?
@jbafford
nothing is necessarily wrong with my code but i feel im doing something wrong
 
5:28 AM
I'm a little fuzzy on that. Maybe codereview.stackexchange.com?
 
kind of, last I did that I forgot to encode something and then my code worked
thanks @jbafford exactly what I wanted.
im almost off for bed, sorry mate
 
@CoderDudeTwodee You can ask. If someone knows, you might get a helpful response.
If you don't ask ... no one will say anything helpful whatsoever.
 
Wes
5:45 AM
@LeviMorrison would solve the pain of having mutable and immutable interfaces. or stuff like "withFoo()" which is trendy now
 
6:05 AM
ec2 instance up, nginx running, mariadb operational, git project cloned, subdomain shows website.
\o/
 
Wes
congrats!
also mornings all
 
6:25 AM
moin
 
6:38 AM
Good morning!
 
mornin
 
@bwoebi Really wondering why I've never used ::class there.
 
@kelunik … because otherwise you'd have to first use them all for a single usage?
 
Doesn't matter.
 
At least I'm slightly bothered when I see 30 use statements in one file <.<
 
6:45 AM
That way refactorings work like they should and it makes the actual code more readable when you just skip the import statements.
 
well, then use full paths + class without import.
One hurdle for newcomers to code is matching all the identifiers to their use statement first
If you reuse a certain identifier, by all means, import it. But for having it once, it provides no benefit
use statements are not just "necessary clutter for the compiler no human should ever look at"
 
I would not even import when reusing, only inside classes that all use the same namespace
 
@SergeyTelshevsky to some extent yes, but sometimes you need to use a certain class 5 times as typehint…
 
@kelunik if I had to guess: you bought an expensive keyboard and want to get out a maximum value out of that purchase
 
Also, the ability to alias namespaces is strongly undervalued
@tereško lol
 
6:53 AM
Depends much on the context, in packages it's great, as it's basically scoped down to one namespace.
I've seen some fan of use statements while his classes had a coupling of over 9000
 
@tereško ~ 60€, not that expensive. And I think I only bought it after I wrote that code. :P
 
there were custom aliases for each factory.. because the all were called \somenamespace1\Factory ........
 
Wes
i even do use function strlen; :B i dislike exceptions to rules. and magic. use's are useful to have a first look at types the file uses.
 
@kelunik that's like 3x cheaper than mine
 
@kelunik yeah, your laptop keyboard was too valuable :-P
 
6:55 AM
... which I cannot even use ATM, because it has some bug on linux (and yes, I am stuck on linux for now)
 
@tereško Yup, one of the cheapest mechanical ones.
 
/me goes back to observing the "Battles of CoC"
 
@Wes agree, but there's @uses
 
I think soon there'll be more litterature on CoC than in the manual
 
@bwoebi Nope, working on a 14" notebook the entire time is just not that comfortable. ;-)
 
6:57 AM
At least I have 15" ^^
 
Wes
@SergeyTelshevsky maintaining that would be crazy :P
 
@bwoebi And your iMac ;-)
 
Wes
phpdoc has everything except useful stuff
 
@kelunik Which I'm using for everything but coding ^^
 
6:58 AM
@FélixGagnon-Grenier I honestly hope the whole initiative just dies. We can revisit when people are not traumatized by the current "moral outrage".
 
@Wes don't agree, in this case I'd say it does exactly what you call "useful" :)
 
Wes
@SergeyTelshevsky actual use statements are enough. why writing them twice?
 
@tereško Well, I hope it'll be either fully reasonable or just disappear out of the peoples minds. The worst which could happen IMO is the topic crashing down.
 
@Wes Not if you don't have ever changing APIs. You can use tools to check for conflicts / missing entries.
 
@Wes if you don't need use statements :)
 
7:00 AM
@tereško that's surprisingly optimistic. in like forty years?
 
@FélixGagnon-Grenier I would go with "2-4 years" actually". Previous outbreak was in early 2000s
 
@tereško the discussion already was there once?
 
mornings
 
work time =)
 
7:03 AM
@bwoebi no, last time it came from "political right wing". It was about violence in music, games and movies. (do you remember Merlin Manson being blamed for school shootings)
 
this time it comes from "political left wing" .. the CoC discussion did not come out of nowhere
 
Wes
idk. i rarely needed more than 20 imports per file, so i can't tell what would be convenient. but actually, i think if a file requires more than 20-30 imports then could be that it's not the best design. but depends ofc
 
> 20 imports per file
wat
 
Wes
more than 20 use's
 
7:04 AM
I throw away if there's more than 7
 
Wes
yeah. me too :B
 
@tereško no, I don't know anyone of that name…
 
only case is some configuration file like mentioned above
 
marylin manson
 
How do I update image in one by one? please check out my question, sorry for my bad english.
0
Q: Update image in one by one

Butter ToastI want to update image in one by one. Example : img1 : img_id = 1, img_name = demo1.jpg img2 : img_id = 2, img_name = demo2.jpg When I click update on img1 img_name = demo1.jpg will be change to img_name = demo3.jpg But img2 will change too. I want to update with only img1 or img2 not both...

 
7:06 AM
@FélixGagnon-Grenier I am not a fan. I tried to type the name from memory.
 
I remember because it's a mix of marylin monroe and charles manson. the guy apparently found that poetic
 
^ cv pls
 
bottom line, @bwoebi. the whole clusterfuck has been escalating for some time: github.com/django/django/pull/2692
4
 
you seem beer'd
 
@FélixGagnon-Grenier I remember that part too ... the guy did really good interviews
 
7:08 AM
@tereško ........... merged!?!?
 
@tereško lol that's the best read since the clusterfuck about smack-up-my-bitch.sh
 
@bwoebi I don't believe you've missed that one :)
 
this might give you an idea why people are so scared about letting social ideologues in PHP community
 
My code has send last record like 1,2,3 it will send 3 to $_POST['image_id'];. How to fix it to send IDs that I want to update like I want to update img_id 1 when I click update it will send 1 to $_POST['image_id'];
 
@tereško ugh :x
 
7:14 AM
@tereško Merged pretty quickly.
 
> #22667 replaced occurrences of master/slave terminology with leader/follower #2692
alex merged 1 commit into django:master from fcurella:patch-5 8 days ago

Guys, I think you forgot something...
lmao
 
@kelunik IIRC there were about 20 times more comments than currently, 10% of which were gifs
 
the whole thing has been sanitized
the shitstorm on reddit/hackernews was quite epic
 
...
 
... also loading like 100 gifs was quite hard on browsers
 
7:22 AM
what leads everyone to give that a +1 ?
 
well, yes, fuck.
vanilla PHP is crashing when I run a benchmark on it :x
 
Please check out my question. :(
 
why?
@FélixGagnon-Grenier if you had watched this chat.stackoverflow.com/transcript/message/28358098#28358098 you wouldnt be asking me that question
 
nvm it's just in like few posts you apparently had made typos the likes of which I do when I'm drunkish
 
naah, it's the keyboard
I am stuck with this terrible keyboard, because I cannot figure out how to make my DasKeyboard to work with linux in a sane manner
 
7:36 AM
dude fuuuuuuuuuuuu... the video is getting more depressing by the ten seconds
 
:D
 
Wes
@tereško this can't be real
 
I am fairly sure it is
 
that person votes
 
Wes
if it is i would ask darwin how that happened
 
7:40 AM
I stumbled upon this one while browsing stuff from flat-earth'ers
 
Wes
wtf?
 
don't tell me that you are not aware there are quite a lot of people who think that world is flat
 
Wes
@tereško i have too much faith in humanity
 
s/have/had
 
Wes
yeah.
 
7:43 AM
o/
 
also this
(it's a debunking video .. I will not inflict upon you the source "materials")
 
Wes
sky demons hahaha
 
7:47 AM
but hey, I for one have never been in space to confirm it's roundness
(please don't block me for this)
 
... I wonder, how hard would it be for me to force @Wes to sign up for MarsOne by the end of this day
 
link that video about sects first, should be pretty much in the pocket
 
oh .. right
that guy makes new videos really rarely
 
Wes
@tereško why that? it won't bee too hard as i'm a mars fan
 
Hi Guys
 
Wes
7:50 AM
do you know "the case for mars"?
 
Wes
lol
 
iFail
 
why doesn't the form data get displayed in the page
Please help
Thank you
 
@AdminRelative instead of doing an echo, just use var_dump($_POST)
 
8:02 AM
i really need help. :( could you guys please check out my question.
0
Q: Update an image with one by one

Butter ToastI want to update image in one by one. Example : I want to update only IMG1. img1 : img_id = 1, img_name = demo1.jpg img2 : img_id = 2, img_name = demo2.jpg When I press update button with only IMG1 it should send img_id = 1 to $id = $_POST['image_id']; But it send img_id = 2 Then will make ...

 
8:15 AM
So what is the question/problem? — Andrew 3 hours ago
this a QA site
 
@kelunik Sorry intent. Was on mobile yesterday so typing / editing was crap
 
@ButterToast Posting it twice here doesn't help. Your last attempt resulted in two close votes, because it's unclear what you're asking.
@PeeHaa I got that, I just don't understand why there's more intent. :P
 
morning!
 
morning, @Naruto
 
Because it's clear one could stop reading the string because there is not going to be any interpolation in there.
BTW I'm fine with all changes in the refactor, but could you add the EOF line breaks please :-)
First: coffee \o/
Morning all btw :-)
 
8:23 AM
o\
 
Guys, is there any deeper alternative than var_dump in php? I have issue where 2 same float values return true when $float1 < $float2
 
deeper?
 
@PeeHaa Too early in the morning for this kind of talk
 
:P
 
@Patrick Did you get any responses to your star?
 
8:24 AM
Deeper like, I can view the floating points more than 2 digits
 
Lol
 
@Jimbo just one
 
@Patrick seeing that without reading context makes it somewhat...
 
Can be unsticked I think
 
8:27 AM
@Naruto LOL :D
 
@choz I get this nagging feeling that you are comparing the floats wrong
what you should be checking is something lore like if ( abs($float1 - $float2) < 0.000001 ) { ..
 
@Bonakid ^^
 
@Patrick and?
 
@Jimbo nothing so far
 
But you said you got a response! lol
 
8:32 AM
But had a good interview yesterday at a local company and got a few others lined up
 
Ah cool
I got a chat with a guy at the BBC tomorrow :P
 
@Jimbo yeah from florian margaine, but not from his boss :D
 
@Patrick Nah don't bother there, florian likes javascript
 
Shit. I've just managed to kernel panic by running a websocket benchmark on Aerys.
 
8:37 AM
yes.
definitely.
 
that's impressive
 
so, let me see whether I can repro…
yes I can :x
 
\o
 
Nice, reproducible kernel panic…
now… why?
 
@bwoebi push it to production box
 
@tereško well, the best is that the kernel panic doesn't even create a log file with a backtrace etc. o_O
it's like someone just removed power and restarted.
 
@PeeHaa Is PSR-2 without braces on new lines fine? Should I convert quotes back to single quotes or all quotes to double quotes?
 
2 hours ago, by tereško
bottom line, @bwoebi. the whole clusterfuck has been escalating for some time: https://github.com/django/django/pull/2692
@tereško ):
 
seclists.org/isn/2016/Jan/14 "Symantec partner caught running tech support scam"
 
8:58 AM
Morning all.
 
Morning everyone!
I have a question, if I use the following code to explode things everything works fine untill the user inputs a , then $price = array('2,50', '10'); when using explode , will be also split thats not what I want how can I fix this :P?
$arrayTotal = explode(',', $postTotal);
$newTotal = array_sum($arrayTotal);
 
@kelunik I'm not entirely sold, but I am taking the "do whatever the hell you want" approach on this project. Who knows maybe I start to like it
:-)
 
@Tredged Convert commas to dots first: $postTotal = str_replace(',', '.', $postTotal);
That way they will also become floats, so you can do calculations with it too. Win-win.
 
Wes
@tereško not the first time a partner of a big name in the industry is involved in such shits. wonder how many times the big name was involved too.
 
@Oldskool the problem is that str_replace also takes the , of the array. which dont need to be replaced ..
 
9:02 AM
@PeeHaa "Do what thou wilt shall be the whole of the Law" -- Aleister Crowley, "The Book of the Law"
 
@Oldskool If I use str_replace string(10) "5.50.15.50" should be string(10) "5.50,15.50"
 
@Tredged why are you handling an array as a string?
 
        $postAmount     = trim($_POST['amount']);
        $postJob        = trim($_POST['job']);
        $postPrice      = trim($_POST['priceunit']);
        $postTotal      = trim($_POST['total']);

                        # Seperating the total
                        $arrayTotal = explode(',', $postTotal);
                        $newTotal = array_sum($arrayTotal);
                        # Calculating the price including the taxes
                        $btwtTotal = $newTotal + ($newTotal / 100 * $btw);
 
posted on January 26, 2016 by nlecointre

/* by nullset2 */

 
If there is an inser input of , it sees it as a new row thats the only problem
 
9:06 AM
@Tredged Ehm, no str_replace works on arrays as well: 3v4l.org/OghPS
 
@Oldskool Ahh ok
@Oldskool Would that mean if a user inputs a , it wont see it as a row. but it will make a .
 
Morning peeps
 
@Tredged Do you have an example of "problematic input"?
 
Yes, 1 sec
 
@tereško var_dump doesn't work
3
 
9:12 AM
@Oldskool If someone enters a price of 15 & 5 & 3 then there is no issue, the string/array will be (’15’,’5’,’3’) but if a insert inputs 15,50 & 5 & 3 dan the array stays (’15,50’,’5’,’3’) only because its needs to get separated by a , the 50 is also being changed
 
please, elaborate, @AdminRelative
 
@Oldskool Even in het NL: Stel iemand voert als prijs in: 15 5 en 3. Dan is er helemaal geen probleem, de string/array wordt dan ('15','5','3'). Maar stel dat iemand er 15,50 5 en 3 van. Dan blijft array hetzelfde: ('15,50','5','3') alleen omdat het dus gescheiden moet worden door een komma wordt 50 ook apart gepakt.
 
@Tredged But they can input multiple values in 1 input field or something?
 
@Tredged English please
 
9:15 AM
@PeeHaa Sorry.. won't happen again.
 
No worries :)
 
@Tredged why are you handling the array as a string instead of parsing it?
 
@Tredged In that case (and I have created and done this in such a way before, works like a charm) I'd just make the total field a readonly one that's populated with JavaScripts by doing units * price per unit.
Prevents input mistakes as well.
 
Wes
so if a client wants an ecommerce software with very little requirements, should i use prestashop/something else or make it my own?
 
@Wes depends, do you have to maintain it?
 
9:17 AM
Build your own and open source it
There is ahuge market for something that doesn't stink
 
@Tredged Just bind a change event on the units and price/unit fields. Make it update your total.
 
@Wes you probably should use Magento, because "very little requirements" usually means the client still has no idea what he/she wants
 
Wes
i've used magento before. it's my idea of hell, basically
 
in that case I would go with custom-written solution
 
@Oldskool So field, readonly and doing aantal * price with the total field being calculated by JS right?
 
Wes
9:20 AM
the problem is that i know nothing about complex stuff, like taxes, warehouse management, things that could happen to be needed at some point.
 
@Wes taxes are country specific anyways
warehouse management... doesn't sound like the responsibility of the shop
 
@PeeHaa Added the two missing EOF line breaks. :P
 
Wes
@Patrick for now, but could happen knowing my client :P
 
@kelunik \o/ tnx. Will pull and restart it later today
 
Wes
maybe it's less complex than i think it is though
 
9:23 AM
@Oldskool What u'd mean with bind a change event ?
 
@Wes Then build it when the time comes. A reason more for going custom, what if he wants something that is not possible with whatever prebuilt thing you use?
 
Wes
plugins?
 
a basic store is simple. articles, cart, checkout, orders + lines
but when you add things like article variations then it gets a little more complicated
 
Wes
eh that is already a possibility, like the ability to choose product's color
could create different products sure but variations would be better
will have a look at prestashop now
 
@Wes yeah but you need to link them somehow. And then add in things like sizes, user supplied information (engraving) and things can get a little complicated
 
9:29 AM
@Oldskool Thanks for the help appreciate it .
 
@Wes why not something like sylius?
 
Wes
that's a lot of work but doesn't particularly worry me. it's the domain of stuff i don't know that worries me. financial, legal stuff. and functionalities they will surely ask to get implemented but that nobody (and especially me) can guess :P
 
@Wes it probably is not
Doing it good/sane is hard
 
Wes
@Patrick never heard of that. going to try that too
 
@Wes I used Dolibarr (PHP based) for 5 years in a small company. YOu might also want to investigate Odoo (phython based).
 
9:37 AM
cough drupal commerce cough
disclaimer: I work for the editor of drupal commerce...
 
@Tredged I mean that the JS should trigger whenever units/price fields change. So put an onchange (or $('#id').on('change', function(){}); in jQuery) on them to re-calculate the total whenever either value is changed by the user.
 
Wes
wtf smarty. what is this, 2002?
 
@Wes Actually, Smarty is still actively developed. But I don't see much projects using it anymore though.
 
Wes
it's awful :P
 
the alternative was worse ...
 
Wes
9:43 AM
which was the alternative?
 
@Oldskool Helder. Thanks. Bedankt!
 
If you care about your users' privacy you host it yourself
 
@CoderDudeTwodee authentication and session management?
Like if user A goes to user B's private picture.. evne if they know the url, the data should be protected
because the user needs to be verified by the server as the owner of the resource
Making obscure file names or etc wont work
 
> 2. Stream the file through php. (Recommended, extra coding required)
Recommended by who?
 
crazy solutions imo
 
9:54 AM
What are you trying to prevent in specific?
Your question asks about related but separate things
 
@CoderDudeTwodee authentication?
 
@CoderDudeTwodee The questions that spring to mind for me are: Who is allowed to see a users image? Just the user? Other users? Anyone with the link? Is being logged in a requirement to being able to see the images?
 
Also your question sounds like one of those people who come in here thinking there website is going to be huuuuuuuuuge
Not saying that's the case or whether it is true or not. Just noting it :)
Use authetication as @RonniSkansing said
 
Streaming through PHP will give you the most flexibility but the worst performance
 

« first day (1928 days earlier)      last day (3030 days later) »