« first day (667 days earlier)      last day (4507 days later) » 

22:00
@Lusitanian That's basically the second option - having the complex methods e.g. getByAuthorAndPublisher() in the service layer do the "heavy lifting" and pass the conditions to the more generic methods in the DM
that would make the most sense probably, but ask @tereško
helo help
$stmt=mysqli_prepare($dbc,"SELECT*FROM comments WHERE user_id=? ORDER BY ptime DESC");
if($stmt)
{

mysqli_stmt_bind_param($stmt,"i",$llive_id);
//$query_post="SELECT*FROM comments WHERE user_id='$live_id' ORDER BY ptime DESC";
//$results=mysqli_query($dbc,$query_post);
//$bgclr=array("#66fa66","#76e0f6","#f6fe7e");
//if($results)
mysqli_stmt_bind_result($stmt,$cmmnt_id,$usrid,$usernname,$mmain_cmmnt,$ttime);
mysqli_stmt_execute($stmt);
$stmt->store_result();
while(mysqli_stmt_fetch($stmt))
(see full text)
The only other issue is that currently I'm passing the DM an instance of the related domain object, and (if applicable) an array of conditions, though this could easily be a string of WHERE conditions as well. Does that change your answer at all @hakra? edit: I didn't fully think that one through... ><
i mean not displaying any comments and posts
suppose I could just comment on the answer itself...
22:05
@blackbee exhale, you need to learn how to ask for help,, this is why people in this chatroom give you a hard time.
oops
no those are commented lines ignore that, look only the mysqli_prrepared statement lines
the mysqli_prepared statements worked fine with the INSERT query, the SELECT query is giving a baad time
@rdlowrey I'm up to 63% files, 95% lines of coverage. Thanks for your help.
y no interfaces in ruby
@Lusitanian Dunno, but Uncle Bob doesn't seem to mind.
uncle bob?
22:13
Robert Cecil Martin, known colloquially as "Uncle Bob", is an American software consultant and author. Martin has been a software professional since 1970 and an international software consultant since 1990. In 2001, he initiated the meeting of the group that created Agile software development from Extreme Programming techniques. He is also a leading member of the Software craftsmanship movement. His video "code casts" on the Clean Coders website can be viewed on [http://www.cleancoders.com www.cleancoders.com]. He founded Object Mentor Inc. , a consulting firm that specializes in traini...
ah
"in ruby, you have mix-ins instead of interfaces" congratulations, that makes absolutely no sense
@Lusitanian you didn't know that? Didn't uncle bob introduce the SOLID principal
didn't recognize the nickname, also SOLID isn't a principle
just an acronym combining 5
it certainly isn't a princi*pal*!
22:17
@Lusitanian lol my bad
unless it's governing a school that we don't know about, which would actually be very cool
the SOLID school of software design
...anyone, anyone
@Lusitanian , if you do not know who Uncle Bob is , you really have not studied OOP
@tereško my lack of remembrance of petty nicknames doesn't relate all that well to my knowledge of oop
and , btw , have you already gone through (and understood some of) the list of lectures at the bottom of this post ?
22:20
alas, programming history is a disappointingly neglected part of computing education
@tereško bookmarked!
@Nick !!
huh ? ^^
@IMSoP , not in my experience , it was covered quite extensively in my CS courses
@Nick no suggestions/helps?
22:24
then again , i was on of the strange people who actually has read few books on programming in assembler too
@tereško damn, I'm jealous then
i just spoke with adobe tech support through their online chat. i asked for a case # so that I could contact them if the issue persists and the tech support told me that once I end the chat, I''ll get a case #. so I ended a chat. nothing happened besides that window closing... no case # in sight.
@blackbee You don't indent your code ?
wait
@blackbee and avoid html styles like this -> <div style="float:right;font-size:1em;">
22:29
    $stmt=mysqli_prepare($dbc,"SELECT*FROM comments WHERE user_id=? ORDER BY ptime DESC");
    if($stmt)
    {

    mysqli_stmt_bind_param($stmt,"i",$llive_id);
    //$query_post="SELECT*FROM comments WHERE user_id='$live_id' ORDER BY ptime DESC";
    //$results=mysqli_query($dbc,$query_post);
    //$bgclr=array("#66fa66","#76e0f6","#f6fe7e");
    //if($results)
    mysqli_stmt_bind_result($stmt,$cmmnt_id,$usrid,$usernname,$mmain_cmmnt,$ttime);
    mysqli_stmt_execute($stmt);
    $stmt->store_result();
(see full text)
@blackbee What is this -> echo '</font>'; ---> pastebin.com
its a very old html <font color=green></font>
................................
i put it inside echo
else inside <?php?> div s dont work
22:31
@blackbee eek use css man
DRY!
you really need to separate your presentation and logic and data access
@blackbee, I think you're missing your closing bracket for your while loop -> pastebin.com/dYpPZTxG
let me check
@blackbee and is your error reporting on ?
@IMSoP i managed to get very strange CS bachelors degree , because, when i started , the program was not yet passed the accreditation, so the attitude was : lets just throw at them anything that might be useful
22:34
no errors, and about the brackets, i think the code is too lengthy to paste, this actually the code to show (in terms of facebook) the status updates and the comments on the update
@blackbee: It's time you learn the OOP interface of mysqli. It will save you typing some lines, you know?
@tereško same here - I had to take 3 engineering physics courses...
yes i am seeing into that
i had lectures which covered from practical building of PC's and programming of 8048 up to basics of chaos theory
@blackbee then use pastebin -> pastebin.com
22:35
hold on
and in middle they managed to teach us 4 different programming languages, linux network administration and project management
@blackbee I can't really haha, I'm going golfing in 10 minutes
golfing
ten minutes is tooo much
^^ what he said
alright I'm out guys, have a swell evening/afternoon.
22:40
wait
its done
@blackbee I stopped reading right around here -> function change2()
@blackbee sorry I have to go, ask someone in here :P
@blackbee you need to clean up your code and use prepared statements and that's from reading the first 30 lines
those are commented lines a javascript to hide the topbar
why are u stopped between commets?? :P
ok
as u wish
also needs moar jquery
start from 43
22:43
use prepared statements
$query = "SELECT user_id, username FROM members WHERE user_id = '" . $_SESSION['user_id'] . "'";
.........
$query = "SELECT user_id,username FROM members WHERE user_id = '" . $_GET['user_id'] . "'";
-____-
i just wanted to test only one part
if it works i wud convert rest of them
    $imgdata="SELECT user_id,username,indenticon,chat_id FROM members WHERE user_id='$live_id'";
-________-
i dont know if that is possible,
your site is completely insecure right now
i know it
so i didnt launch it
22:45
ok, sow hat exactly is your issue
and why isn't your code indented at all -- it makes it unreadable
@Lusitanian :D
and i am trying to leaarn the mysqli_prepare. i did will with the insert query, but the select query, didnot go well.....
why aren't you using pdo anyway
well i don't think there will be hackers messing around my site......... i'll put up an d 'easibly hackable, try other secured sites to prove yourself:dear hackers"
@blackbee , if you do not use prepared statements , then you can just stick with mysql_* functions .. then at least you would not be haunted by baseless sense of security
22:47
can't tell if trolling
then i will never have to think about launching this......
i start pdo then thhere will be something newer, i'll learn that. and the process continues. my website gets upgraded and stays in tthe localhost
pdo and mysqli have both been around since php 5.1
switching to different DB abstraction would take about an hour
How do I split a string into words except when wrapped with double quotes?

eg: 'yellow "cheese cake"' => array('yellow', 'cheese cake')
@blackbee , if your pages is stuck in localhost, then switching to different abstraction is not to blame
22:50
I would have though this would be a common regexp problem...
so when i satrsted learning php about a one-and-half months ago, no one was there to say me this: blackbee if u are using mysqli instead of pdo then u are going to be in a shit, coz in the next few days, u are going to learn mysqli is backdated now"
@blackbee quote please , or you are just trolling ... and off to ignore-list
Of course, it would be easy to accomplish this with a state engine, but I'd have thought regexp would do it as well.
TYRANNY OF FATE
the simplest solution would be to replace the spaces contained within quotes with some other [obscure] character, then split on spaces, then replace back the obscure characters
though, definitely not the shortest/most efficient :P
22:52
or use a tokenizer
@orourkek , no
@orourkek uh-huh? lol
what quote? @tereško i am sorry if i messed up with u......
or actually use regex
@Lusitanian yeah, so how would it look like?
22:53
I assumed the stuff in quotes could be basically anything... good luck parsing that all out in a single, all-encompassing regex
i'm not sure, crappy with regex, hold on a min
:D
/([^"]*)"([^"]*)"/
/me not convinced
Good luck with "strings like" this" :D
well, it kind of works
In that case, first phrase is the first one :D
"I will"see"if I can do it,"but" I'm ""not"very"good"at"Reg"Ex.
22:57
But I still need to make it work "globally" and without any particular order
@Christian hold on onnneee min
If only @ircmaxell was online :D
he'll come back with some obscure, recursive regex that will make 0 sense but will work flawlessly
@Christian
<?php
	$parseable = 'great "cheese cake" bob';
	$pattern = "/([\"'])(?:\\\\?+.)*?\\1/";
	preg_match_all($pattern, $parseable, $matches);
	$matches = $matches[0];
	foreach($matches as $match)
	{
		$parseable = str_replace( $match , '', $parseable );
	}
	array_walk( $matches, function(&$val) { trim($val, '"'); } );
	$matches2 = preg_split('/\s+/', $parseable);
	$matches = array_merge($matches, $matches2);

	print_r($matches);
ugly as hell but works
23:03
@Lusitanian The words are all mixed up after your function...
@tereško the php manual didnot help me about leearning the select query with mysqli prepared statements, can u suggest some source to learn and understand it?
@ShaquinTrifonoff yeah that should be fixable though
i'm sure there's a much better way to do this but i suck at regex
awww....it broke the order :(
@Christian That's what I said before :)
23:04
fixable either hackily or non-hackily
Surely @tereško must have a few ideas?
yes , i have , but i wont help you
i dislike your attitude in regards to SO php community
@Lusitanian @Christian why not just do explode("\"", $str)
@tereško Was it something I did/said?
23:08
no , @Nile , i was talking to him
@Lusitanian using explode will work fine. it will just leave you with an empty value at the end of your array if there are actually quotes in the string
@tereško ah okay
It won't work, I need to keep words inside double-quoted phrases intact.
@Christian because I don't know who @tereško is saying this i'll continue to help you
preg_match_all('/\w+|"[^"]+"/', $string, $matches)
@tereško OK, so what did I do?
23:09
@WTFF no plsss, i never said a word against u people, i mean except once, and moreover i suggested many friend about this SO. this is injustice
there's another option because a while back there was a port of python's optparse
my attitude?? i don't have one
@Lusitanian but what's wrong with a simple explode?
@Nile doesn't work for what he wants
@blackbee lol who's @WTFF ?
23:10
i'll explain in a min
codepad.viper-7.com/oJIdDi @IMSoP good work regex sir.
@teresko A model should not be associated with one database table, right? I'm just reading @Petra's MicroFramework...
@Nile I already said, I need to keep double-quoted words intact as one.
@hookman don't read his microfw or he'll get upset
@Christian , you are a hi-rep user who only participates in chat when you need something , or when you want to rage about how nobody is paying attention to your questions
err, i don't know, just tried that
23:11
@tereško Hi-rep? really?
@Christian so 'hello "hello "hello" bob"' would create the array: array('hello', 'hello "hello" bob')
how would 6k be low rep?
I've been looking for an answer on SO for 30 minutes, to no use. I thought about putting a question with an answer in it.
if you want to accept some kind of escape for quotes-within-quotes, it gets a bit messier
it's medium-rep compared to some, low-rep compared to others, and hi-rep to many others
23:12
its low in terms of k
@orourkek It's medium-small at most. Compare with say, tomalak's 99k.
@Christian you are in top 5% in site with over million users , #4416 to be exact
counts as high
I'm in the top 2% for the month.
23:12
You can't compare yourself to 100k users and call it "low rep"... compare yourself to new users, that's the accurate metric
@Lusitanian Why?)
@Petra himself has called it completely wrong in many a facet
@tereško OK, back to the real question, what's the problem about asking for something quick inside SO PHP chat?
I would say 'low rep' would be a user who has been on the site for 2 years and has 0-200 rep.
I still don't see the problem.
23:13
@Nile no, look at the original question - 'yellow "cheese cake"' => array('yellow', 'cheese cake')
the "cheese cake" is in quotes, so becomes a single token
@Christian , problem is not the asking , but not answering. You are a skilled developer which still acts like help vampire
@IMSoP and using explode would get you: Array ( [0] => yellow [1] => cheese cake [2] => ).
@tereško You mean I should answer more on the main site? I try, really. It's that I'm very busy.
@Nile try 'yellow "cheese cake" "chocolate flavour" brown' - should have 4 tokens
@tereško This week is the first time in two years I took as a vacation.
And it's been so bad I'm wishing I go back to work every other day.
23:16
@IMSoP Array ( [0] => yellow [1] => cheese cake [2] => [3] => chocolate flavour [4] => brown )
Exactly because I'm working 9-10 hours straight, daily.
@IMSoP you'd have to clean for empty values, but it still works...
(whereas it's 8hrs a day at regular work)
$string = 'yellow green "cheese cake" "chocolate flavour" brown'
print_r( explode('"', $string) )

var_export( explode('"', $string) )
array (
0 => 'yellow green ',
1 => 'cheese cake',
2 => ' ',
3 => 'chocolate flavour',
4 => ' brown',
)
not even close
1 min ago, by Nile
@IMSoP you'd have to clean for empty values, but it still works...
23:18
Compare my regex:

preg_match_all('/\w+|"[^"]+"/', $string, $matches); var_export($matches);
array (
0 =>
array (
0 => 'yellow',
1 => 'green',
2 => '"cheese cake"',
3 => '"chocolate flavour"',
4 => 'brown',
),
)
that's completely wrong though
@Nile
@tereško Also, why bother answering when the last 5 answers I did were hidden from view by worse answers (some of which set as the main answer)?
hm, okay.
Perhaps, you've got a point there. I should waste more reputation on downvoting crappy answers.
@Christian yo?
23:20
or maybe , if you see a bad answer , or bad question , you could let the community know
@tereško Like what?
How exactly am I supposed to moderate them?
@ircmaxell Nevermind. I think I'm getting some sleep. Thanks for the attention. Sorry for the ping.
$string = 'version "that supports" "escaped \" marks"'
preg_match_all('/\w+|".*?(?<!\\\\)"/', $string, $matches); var_export($matches);
array (
  0 =>
  array (
    0 => 'version',
    1 => '"that supports"',
    2 => '"escaped \\" marks"',
  ),
)
@IMSoP I hope to one day actually be able to read and write regex like that (:
I'm so awful with regular expressions
23:25
what exactly are you trying to do?
@Lusitanian it's particularly unreadable due to PHP's PCRE library having to accept a PHP string rather than bare syntax, doubling the amount of backslashes I needed
@ircmaxell something akin to command line parsing
a string like this 'hi "this is one token" these are separate tokens'
the magic part is the "zero-width negative look behind assertion" - /(?<!a)b/ means a 'b' not preceded by an 'a'
@IMSoP what about escaped backslashes? "Foo \\" bar... Which should be foo \\ and then bar
@Lusitanian what rules?
should be parsed into (hi, this is one token, these, are, separate, tokens)
23:27
@ircmaxell oh, you had to go there didn't you!
@ircmaxell not sure, it was @Christian's question
$str = 'yellow green "cheese cake" "chocolate flavour" brown';
$regex = '/[ ^"]/';
$result = preg_split($regex, $str);
that was the amount of detail given
That one doesn't really work, but it has some hope.
i still don't think regex is really the right way to do this
23:27
^^
The regex could work, but it would be fragile as hell
well, if you don't allow escaping, the one I posted first works just fine
Hi.
for trivial uses, it's all you need
e.g. a tag input box that works a bit like flickr's
don't forget that "input is" unpredictable" without "validation
@orourkek Garbage In, Garbage Out
2
if the individual tokens need to be validated to pass somewhere else, that's the next step of the processing
god elastic beanstalk sucks for php
@tereško 31 for me
well , you have not reached 4k yet
23:34
@tereško doesn't seem to work
it takes some time to load
@tereško plz
i switched to mysqli_prepare and now the select part doesnot work
Hey guys, I have a question about using PHP variables inside JavaScript. Should I ask here or in the JavaScript room?
@tereško actually, worked for you just fine. for me it shows none which is waay wrong
@Bananaco You should probably ask here.
23:36
@orourkek actually, the output of that example's not too bad - the fourth token comes out as '" without "', but trim for ' ' and '"', and that's a pretty good guess at the user's intention
@Bananaco core Javascript or jQuery?
@Troy what nonsense you are talking there ? jQuery developers don't need to learn other languages !
what is that character, exactly?
thanks a lot @tereško
@tereško I think that you don't understand what I said..
23:38
@orourkek delta rho ?
@orourkek A mathematical symbol of some sort...
Ok, So I am playing around with the with the google maps geocoding. I have a piece of JavaScript code that google provides and I have my php variables declared above this code. I'm wondering why it's not recognizing them? <script type="text/javascript">
var lat = <?php echo $lat;?>
var lng = <?php echo $lng;?>
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(lat, lng),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
captcha is learning math now! run!
@orourkek well .. yes , captchas suck. Lately this is just another things that computers are better at then people
@orourkek Δρs
4
23:39
@tereško True.
http://caca.zoy.org/wiki/PWNtcha
@LeviMorrison I tried that and it rejected it :{
@Bananaco Is it a PHP file?
Like I say, I wouldn't use such a simple regex as the tokenizer for some kind of language parser, but for grabbing a list of tags that may or may not be quote-delimited, it gets the job done with a minimum of fuss.
@Troy yepp
Exact duplicate 178
Not a real question 83
Subjective and argumentative 51
Off topic 30
Too localized 29
(Total) 371
23:40
if only they counted requests...
@Bananaco what does the generated JS look like?
@Bananaco Set the page as Javascript first with header("Content-type: text/javascript");
Right-click -> View Source/View Page Source
maybe $lat and $lng have drifted out of scope? or are coming out as strings, such that they need quoting?
@Troy -1 the code is inside a <script> tag
@tereško hello, got one question, i have this mvc stuffs that works like this
http://somewebsite.com/controller/method

the libraries are autoloaded, using __autoload stuff
then the model is called when the controller is being called

at this moment, is it at the right path of being an mvc? or the model should be independent of the controller?
23:43
@IMSoP He has to remove the script tags because the whole file is PHP
@Troy huh?
@Troy so removing the script tags should fix this?
Exact duplicate 448
Not a real question 429
Subjective and argumentative 165
Too localized 113
Off topic 96
(Total) 1251
@Troy that confuses me a little.
Remove the script tag and set the page as Javascript with <?php header("Content-type: text/javascript");?>
23:44
@Bananaco Is the script inside the HTML or in a separate file?
Exact duplicate 221
Not a real question 219
Too localized 107
Subjective and argumentative 104
Off topic 34
(Total) 685
@ShaquinTrifonoff It's in a PHP file.
I think what @Troy is getting at is that if the whole file is outputting nothing but Javascript, you don't want the HTML <script> tag in there
@Bananaco In a PHP file that you include in your HTML?
if the file is outputting HTML with the Javascript in the middle of it, what you've got looks right
23:46
@ShaquinTrifonoff yeah it's got html in there too.
But if it's Javascript only, do what I told you.
if in your HTML you were using <script src="my_dynamic_javascript.php">, "my_dynamic_javascript.php" would be generating just JS, not HTML
Then, put this code in a .php file, include it like that <script type="text/javascript" src="path/to/file.php"></script> then add <?php header("Content-type: text/javascript");?> at the top and remove the script tag if you added it.
23:48
@Troy Cool. Will give it a try. Thanks for your help.
And remove all HTML and script tags from the PHP file.
@JoeySalacHipolito , as first steps, it's quite normal, though i would recommend to use spl_autoload_register() instead. The thing is : model should not be a class , but a layer. MVC is made up from two layers : presentation layer (mostly: views, controllers, templates) and model layer. You do not see LoginPresentation classes in the presentation layer. Other part is that you currently are implementing something close to what php frameworks do.
anyway, enough saving the day with regexes, i must get to bed!
me falls asleep. wishes good night. must follow yoda. the force, searching for sleep.
@tereško @tereško its working. :D
23:49
night @IMSoP
@JoeySalacHipolito The model layer should not be initialized by controller. It should only change state of model layer and current view. The views instances should be responsible for retrieving information from model layer and deciding what response to generate (it might not always be HTML)
@Nile you there? I got a question
@AlexCastro ok
Everyone is going to bed, but it's 11:49am where I live :-)
23:50
should I include it? how do you usually call it?
@ShaquinTrifonoff Happy new day!
It's 7:49 PM for me.
EST ftw
2012-08-14 11:50
@AlexCastro ok?
23:51
@AlexCastro Doh! WEST FTW!
the the view should be the one who will be including it?
@Nile Do you get what I'm trying to do there?
@JoeySalacHipolito i tend to use services to prevent domain business logic from leaking into the presentation layer. Basically you have a factory ( with ability to cache initialized objects ), which provides controller with services. You inject the service factory and the current view in the constructor of the controller, which them manipulates them
@AlexCastro no
@JoeySalacHipolito , the view too requires access to model layer , therefore it too acquires the service factory as parameter in the constructor. But it only requests data from model layer without changing the state (at least not directly).
23:55
okay, i got it, other terms for services? maybe i read it, but i did not remember the name, so what i need is to create s service(what is this?) ///
it's almost always called the service layer
Somewhat dumbed-down summary: controller delegates to, and modifies services, view reads from services
services are just classes that you create which provide your business logic
@Nile I want to create a "dashboard" type of page that shows a user the latest 10 important notifications from them. This should pull the latest entries from the three tables and put them in one list.
@AlexCastro what's wrong with that query?
@Lusitanian I would say that they are the access point to the business logic
@Nile That query just shows what classes I'm in. I want it to pull the latest assignments from classes enrolled in, latest stuco announcements, and latest principal announcements
@ircmaxell why torture yourself?
Bootstrap 2.1 try it out: rc.getbootstrap.com
@ircmaxell , you should see a specialist about this masochistic streak of yours
@ircmaxell it was a fair comment, even if a bit brash
23:58
@tereško yeah, I know
@AlexCastro so add those conditions onto the query
@AlexCastro does it have moar jquery plugins!?!?!?
@Nile that's the thing I don't know how to do
@AlexCastro sql?
@Lusitanian
$comment = str_replace('moar', 'more', $comment);
23:59
nah
when talking about jquery, the word "moar" must be used
@Nile I don't know how to do it exactly using SQL, lol
what's actually new in 2.1, anyway?

« first day (667 days earlier)      last day (4507 days later) »