« first day (570 days earlier)      last day (4393 days later) » 

3:03 PM
@RepWhoringPeeHaa what does your folder structure look like? I've got the following:
Frame folder(Not working in root)
-- MicroFTW
-- Tests
-- www.example.com
 
@Mittchel from the index.php file everything is bootstrapped
 
ah
Yep, but you mean the index.php in PUBLIC folder right?
So the rewrite has to redirect to that index .php
 
hi everyone,i'm writing blog,can anyone tell me how to let original code setence post on my blog ,but the code setence won't lose its style?is their have some special tools?
 
@EventHorizon if (!isset($_SESSION['userid'])) // is all you need to determine if it is set.
 
3:04 PM
And you need to setup the init.environment.php in the project root folder to your own settings / locations
 
@Event_Horizon isset is enough.
 
Yea will do :P hehe, but not sure if I'm setting paths right
But where do I place the .htaccess btw?
all the way back in the htdocs (root) or in public?
 
@RayCheng <code>Your code here</code> or <pre>Your code here</pre>
 
Thats what I thought but its not redirecting when the variable isn't set
There must be something else going on
 
<code> is inline <pre> is a block
 
3:06 PM
@RayCheng Use <code>Inline Code</code> or <pre><code>Block of Code</code></pre>
@CharlesSprayberry Also <pre> doesn't make it a code (semantically speaking).
 
@CharlesSprayberry,you mean just put my code between <pre></pre>?so simple?
 
@Truth Fair enough
 
@RayCheng See my response.
1 min ago, by Truth
@RayCheng Use <code>Inline Code</code> or <pre><code>Block of Code</code></pre>
 
@RayCheng Well, <pre> makes your text formatted as you input it. Like @Truth said it doesn't semantically make your text code
 
ok,thanks bros,i'll try,
 
3:13 PM
@RepWhoringPeeHaa wooh almost there:P getting these errors now: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /Applications/XAMPP/xamppfiles/htdocs/frame/www.example.com/init-environment.php on line 18
 
user895378
How not to write PHP code ...
 
user895378
    <?php foreach (Mage::getModel('catalog/category')->load($cat->getId())->getChildrenCategories() as $childCategory): ?>
    <li><a href="<?php echo $childCategory->getUrl(); ?>">
<?php echo $childCategory->getName()?></a></li>
<?php endforeach; ?>
</ul>
 
user895378
err ... I mean ... Magento looks totally legit.
 
Of course. Some people like static thingies. Nothing bad in it.
 
Inline php, eww. :p
 
3:15 PM
@rdlowrey Maybe it's bad code, but easy to write.
imho
 
user895378
static, method-chained, business logic in display code and the : loop delimiter with endforeach ... totally unreadable
 
@Mittchel have you setup thye correct path to the fw?
 
@rdlowrey Magento have models but no views? phew
 
define('MFW_LIB_PATH', 'http://localhost/frame/MicroFW');
 
@Mittchel huh? neh. You have to use full local path :p
 
3:17 PM
it's absolute path so should be correct
oh l0l
 
user895378
It's no wonder people have a bad opinion of PHP ... when the major applications in a language look like that and WordPress ... it makes me sad.
 
Really newb when it comes to mod_rewrite stuff
 
hi,@CharlesSprayberry,if i want my code with color,just like that shown in my Neatbeans,can i do that ?
 
wordpress is the best framework
 
PHP is best plugin for WordPress.
 
user895378
3:22 PM
@Donut lol
 
@webarto Screams of developers heard round the world
 
The Dunning–Kruger effect is a cognitive bias in which unskilled individuals suffer from illusory superiority, mistakenly rating their ability much higher than average. This bias is attributed to a metacognitive inability of the unskilled to recognize their mistakes. Actual competence may weaken self-confidence, as competent individuals may falsely assume that others have an equivalent understanding. As Kruger and Dunning conclude, "the miscalibration of the incompetent stems from an error about the self, whereas the miscalibration of the highly competent stems from an error about others...
 
@RayCheng Sure, but I would probably try to search for an existing library that does this for you as doing it from scratch would probably be difficult
 
Worse code, more ads. Better code....
@RayCheng In what language? PHP? If you want syntax highlighting you can use highlight_string, a bit outdated GeSHi or Hyperlight which is not newest.
 
3:26 PM
why is no one ever in the mysql chat?
 
Because they masquerade as PHP developers
lol
 
I know this sound stupid and you may ask why I don't just remove the column but it is for backward compatibility; Is it possible when you make a SQL query (select) to select a column that don't exists and just make the column appear empty so I can export the result as insert queries for the old database? The new database with the table does not have that column
 
MySQL is a plugin for PHP
 
@Dude Just remove the non-existent column from your query?
 
3:28 PM
@webarto I was talking SQL in general
 
The new table does not have serial_numberbut the old one have and there I need it
I just want a empty value so I can insert it into the old one
 
@RepWhoringPeeHaa woohoo almost there I'm getting this error now: Uncaught exception 'RuntimeException' with message 'No route matches url: `/index/index`'

So close:P
 
@Mittchel Maybe no route has been added ?
 
Read the exception message
"No route matches url /index/index"
 
ok so its ok to talk mysql here ?
 
3:33 PM
mysql_* - NO. Mysql - yes
 
unless you use mysql_* functions @Renai
 
er,
 
Supposed to be using PDO now
right?
 
am confused and need to talk about database, not sure if am doing things wrong
 
or mysqli_*
 
3:35 PM
am not sure if its the database setup i have which is wrong, the way am going about accessing the data or the code
 
Whats the issue?
 
i have 3 tables, 1 being a votes table
each user adds mutli votes to a row
so the total is not worked out in the query but using php to calculate with array
so the totals do not exist in the tables, they are created by the php
i want totals to be searchable, as in <form>
 
$routes = array(

'index' => array('/',
'index/index', array()),

);
 
3 table are : shops, services, votes
should i have a: total_votes table aswell ?
 
If you want votes persistent and searchable you are probably going to need to insert them to your database as a column in the VOTES table
 
3:38 PM
votes table is just a relational table between shops and users?
 
It does exist lol
 
it exists
it just has numbers
 
Oh I was talking about something else lol
 
which are then added and divide by number of fields to get total
so the actual totals are not in a database
as in the TOTAL TOAL
 
right, but if you want them searchable and persistent, you would calculate totals in PHP and INSERT into a new column
 
3:40 PM
am wondering is this a good way ?
or am i adding strain
 
@Mittchel what url ar eyou trying to use when requesting?
 
as each time it will have to add up and calculate totals
 
@RepWhoringPeeHaa just this: http://localhost/frame but when I type this : http://localhost/frame/index it tells me: 'De gevraagde URL was niet gevonden op deze server.' So maybe my rewrite is still wrong?

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} \.(js|ico|gif|jpg|png|css|jpeg|doc|xls|doc|pdf|txt|ppt|zip)$
RewriteRule ^(.*)$ $1 [L]

RewriteCond "frame/%{REQUEST_URI}" !-f
RewriteRule ^(.*)$ frame/www.example.com/public/index.php/$1 [L]
 
@Renai You can also use SUM(Field_Name) in your SQL.
 
Should be right.. the frame is a folder inside my root folder(htdocs) and that frame folder has the example like I showed you
 
3:42 PM
just gonna show u wat am doing
 
@Paul <-this as well
 
@Mittchel why do you run it under frame?
And why do you add /index in the url
there is no route for /index
at least by default
 
@Renai There's a ton of ways to do it with mysql tables; You could store the total vote count in with the shops' data, or put it in a separate table with relational columns, e.g. shop_id and vote_count
 
user895378
Every time I take a few minutes to answer questions in the tag I just get annoyed and frustrated.
 
@RepWhoringPeeHaa I've a lot of crap in my root folder so I want it to be in that folder.. that's not possible?:P
 
user895378
3:43 PM
No research effort, no intelligence, no anything ... except ignorance and stupidity.
 
@rdlowrey Like this one?
 
user895378
 
@Mittchel why don't you just setup a new virtual host?
 
@RepWhoringPeeHaa and when I browse to: localhost/frame it gives me the index/index not found, hows that even possible then
 
with a new document root
 
3:43 PM
@RepWhoringPeeHaa I'm going to upload it to shared host :P
 
@Mittchel what are you trying to do with the ReWrite ?
 
user895378
@orourkek Even the code-based questions are terrible.
 
@RepWhoringPeeHaa and don't have access to SSH.. thats the whole problem lol
 
i was using this to get the total result on a previous page:
$rows = mysql_num_rows($sel);
while($data = mysql_fetch_assoc($sel)){
$total = $total + array_sum($data);
$rows++;
foreach($data as $index=>$value) {
if($value == 0) unset($data[$index]);
}
$full_total = array_sum($data);
$vote_count = $vote_count + count($data);
}
 
Well if I'm right.. every request that comes in at: localhost/frame..... should be redirected to frame/www.example.com/public/index.php
 
user895378
3:45 PM
yesterday, by tereško
Please stop writing new code with the ancient mysql_* functions. They are no longer maintained and community has begun the deprecation process . Instead you should learn about prepared statements and use either PDO or MySQLi. If you care to learn, here is a quite good PDO-related tutorial.
 
So that index.php parses the requests and uses the router
 
@rdlowrey It takes so long just to figure out what they are even trying to do, gets so frustrating
 
I haven't answered on SO for months. Thats not to say that the CodeReview questions are always of a super quality. At least there is code in them though.
 
user895378
Not to mention you realize how many people are putting code into production environments who don't have the slightest idea what they're doing ...
 
@rdlowrey that includes any variations such as SQLSRV_* etc as well are being depreciated right?
 
3:46 PM
@rdlowrey I like that blurb a little better than mine, more shiny links
First of all, the mysql_* functions are outdated and insecure. As such they are not recommended for use in new development. Check out this artice for information on the most up-to-date methods of SQL interaction from PHP, as well as which one will be best for you and your application.
 
@Mittchel

`RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]`
 
either way though, people will probably never read before posting questions on SO
 
@Nick I don't think that's right.. I'm using the rewrite @RepWhoringPeeHaa provided me for his framework
 
user895378
@Event_Horizon Couldn't tell you -- I've never used them.
 
problem is we can keep reading
bad material
w3schools ?
which really aids the confusion
 
3:48 PM
@rdlowrey So PDO isn't for all database connections?
 
@rdlowrey Here you go, best line of the morning: "PHP code(Only the line which is errorneous is mentioned):"
one line he gives
 
@Mittchel it doesn't matter how, but all requests should be handled by index.php in the public folder. I just don't see why you need a /subfolder in your url
just create a new vhost
 
i dont think everyone on here started programming at the age of 12
 
@Mittchel That's what I've used for mine.
but i gotta go
 
brain fuck.
 
user895378
3:49 PM
@Event_Horizon It covers sqlsrv: us3.php.net/manual/en/pdo.drivers.php
 
y do that?
 
user895378
@EventHorizon If I were you I would use PDO if my database vendor was supported
 
@RepWhoringPeeHaa I don't need a subfolder in my url.. that aint the problem.. but I just want the files hosted in my subfolder.. but I'm doing it wrong now?
 
@rdlowrey Yeah I just found that myself
I plan on it
 
@Mittchel you need to setup a new vhost, so you can add /whatever as document root
 
3:50 PM
@RepWhoringPeeHaa but what if I don't have access to that? Only got Directadmin + a ftp:p
 
user895378
@orourkek errorneous ... it almost makes sense when you think about it :)
 
who was helping me again?
 
Didn't even notice that until chrome highlighted it as misspelled :]
 
@RepWhoringPeeHaa thats the whole problem :P otherwise I just copied your virtualhost which worked great for me.
 
@rdlowrey Speaking of typos... stackoverflow.com/questions/10502025/…
 
3:51 PM
1 message moved to bin
 
@Chris this animated JPEG is cool
 
@webarto I know.
 
@Renai You should read up on the PDO documentation and setup your DB connections that way, people will be more likely to help you if you use current code: php.net/manual/en/intro.pdo.php
 
user895378
Is there such a thing as an "animated JPEG"?
 
no
 
3:52 PM
so no mysql_query ? :(
shit
 
user895378
I didn't think so ...
 
my current setup is mysql_query
 
But your brain thinks THAT jpeg was animated.
 
@Chris I moved it because someone flagged it. I don't care, but if they are flagging it, might as well move it
 
@Renai , it shouldn't be
 
3:53 PM
I just said they will be more likely to help if you use current code, if someone knows mysql_* they will help if they can
 
@ircmaxell It was off-topic anyway.
 
why? times have changed?
 
or if they want to I should say
 
If it is a new project and somebody is willing to help you with mysql_* you probably shouldn't listen to them
7
 
user895378
I need to stop complaining about bad questions on SO and write some code.
 
3:54 PM
yeah, you do
 
also screwed then, i need to convert it all over
 
@Renai From mysql_* based code, mysqli_* might be an easier transition that going to PDO
 
@Renai It's getting old and replaced by newer and better solutions.
 
and i havent got it fully working here lol
 
@RepWhoringPeeHaa is it even possible if I want it on a shared host with the files hosted in a subdirectory of the root?:P Sorry for giving you a hard time
 
3:54 PM
anyone ever used the ajax rating script? or seen it? its that famous 5 star example
 
@Mittchel Idunno. Not something I (want to) support
Should be possible though
 
@Renai idk go find out in a javascript chatroom
 
i have modified it for my site, and overplicated it
 
user895378
@ircmaxell How do you feel about value objects? I have a bunch of information I
 
user895378
doh ... continued:
 
3:56 PM
@RepWhoringPeeHaa Hmm to bad.. well been trying for 2 days just to install a framework so I'm going to give up on this :P
 
if i have to final_total, or group total, that means every time a search is done, it will have to calculate the totals, surely this is a killer. Should i be creating an extra table called, total_votes ?
 
user895378
I have a bunch of properties I'm currently shoving into a DTO and it's causing me issues ... I'm tempted to leave it in array form ... any thoughts?
 
if someone ever tells you that he learned proper php from using Zend Framework , you should just leave .. github.com/zendframework/zf2/blob/master/demos/Zend/Gdata/…
 
user895378
There's no functionality whatsoever -- just holding data
 
Does anyone have a suggested framework for PHP?
 
3:57 PM
no
 
ive never used a framework
 
cake @EventHorizon
 
@rdlowrey I like value objects, where they are appropriate
 
thats why am so shit at this
 
@Event_Horizon , i sometimes use Kohana when pressed , but that's only because i know it inside and out and am aware of all the flaws and issues
 
3:58 PM
@tereško ?
 
@RepWhoringPeeHaa Feeling a little devious this morning, are we?
 
:) one framework to rule them all cakephp with icing on top
 
user895378
@ircmaxell Me too ... I think I'm getting frustrated with the lack of low-level OO in PHP and wishing everything were an object. Oh well, program around your language, I guess :)
 
Am I the only one who cringes at Symfony2's naming of the dependency injection components. It's not DI, it's a service locator...
 
What about codeigniter or is that just crap?:p
 
3:59 PM
@RepWhoringPeeHaa typo
 
@rdlowrey Program into it...
 
@Mittchel , yes , it is crap
 
user895378
@ircmaxell No, you're not the only one
 
user895378
Program into it, that's what I was trying to say.
 
@tereško So you suggest raw PHP then?
 
4:00 PM
@ircmaxell , same here .. though i also am fascinated by the RouteDumper class
 
@Event_Horizon we like it raw.
rawh yeah!
 
Thats what she said @RepWhoringPeeHaa
 
user895378
@tereško Is that the one that drops the YAML or XML routes into a PHP file?
 
Be a man, code your own micro framework!
 
I want to use Symfony or Silex for my next project, but I'm really turned off by that, and the overall complexity of the framework
 
4:00 PM
could you help me with partial border problem jsbin.com/ehilik/edit#html,live
 
@orourkek Whats the difference between a Library and a Framework? Or is there no difference?
 
@ircmaxell , you might find this interesting : github.com/symfony/symfony/blob/master/src/Symfony/Component/…
 
I want to remove border adjacent between "partial border div" div and "primary school" div, any advice would be appreciated
 
anyone here created a ratings table before? need some help working this out, cant get head around it
 
I've noticed some people using Library and Framework interchangeably, but I thought they were different concepts
 
4:02 PM
@tereško I have no issue with that. It's generated code
 
each user inputs a row for that shop_id, with 12 votes, not just 1
 
@EventHorizon A library is [traditionally] more functional, and focuses on reusable functionality. A good framework gives a huge set of reusable objects, behaviours, and patterns, rather than just a set of functions
 
@Event_Horizon they are
 
so additional math is required to calculate the totals
 
all frameworks are libraries, not all libraries are frameworks
 
4:03 PM
@EventHorizon They are very different. Generally frameworks cover everything, including directory structure, page flow, etc
Whereas libraries are specific to an area
 
anyone know another site where i can get help ?
 
user895378
Funny/prescient quote from an article about how not to ask questions at conferences from HN the other day:
 
user895378
"If the question you're asking makes you look smart, there's a good chance you're being a douchebag."
 
So developing objects or classes around company based things like employees and jobs, because its focused on functionality of database compatibility that would be more of a Library?
 
@Renai The best thing I can suggest is to read everything. There are tons of tutorials and documentation out there, it's best to start from the ground up so that your understanding is more than just taking someone's word for it
Even if that word is correct, it's never good to not have facts to back your arguments :]
cough @Chris cough
 
4:06 PM
ive gone round in a loop
 
@orourkek I saw that!
 
am starting to doubt what ive read because things start to break
 
user895378
@orourkek lol
 
@Renai Things always break :]
 
i dont know if am even going the right way about my database setup
 
4:07 PM
@tereško I noticed there are different DLL libraries for PDO SQLSRV and SQLSRV_* which is provided by MS, when using a MS SERVER 2008 should I use PDO and the PDO DLL or PDO and the SQLSRV DLL or SQL and the SQLSRV DLL?
 
its the ratings table which is set out strange
 
@Renai If you generalize what you're doing, there might be more relevant content
e.g. "how to track votes in mysql"
 
ive broken tables down to 3 tables
normalization etc
instead of 1 votes per row, its 12 votes, which are 12 criteria's
 
@EventHorizon , why would a server need DLL libraries ?
oh .. wait .. windows
 
for the shop u add the 12 column totals and divide by number of votes > 0
for criteria total u add up the column total and divide by number of votes > 0
 
4:11 PM
@tereško Right
 
I solved ,ignore my questin
 
@Event_Horizon , you should use SQLSRV DLL , because php's PDO_DBLIB is not part of php5.3+
though , you should not use MS stack with PHP
 
should i be using 12 mini tables 1 for each criteria, or is having column's the correct structure?
 
@tereško Is that part of 5.4?
 
which part of "php5.3+" was hard to see
?
 
user895378
4:16 PM
I'm thinking about writing a plugin for chat to throttle the number of messages I can post in a certain time frame during the day. Everybody wins: (1) the quality of my messages increases because of scarcity and (2) I waste less time during the day and accomplish more.
 
.. on which you will waste more time then you will gain before turning that plugin off
 
@tereško the part that said when that functionality is being introduced
 
am not sure if i should do
1) create a extra table called totals
2) add up totals and add to extra column in ratings table
 
user895378
@tereško time spent coding is rarely wasted :)
 
@rdlowrey I dunno, I've worked on some fairly pointless projects :D
 
4:20 PM
@Event_Horizon , please , READ THE DAMNED MANPAGE, php.net/manual/en/ref.pdo-dblib.php
 
u may like my project once its done
 
@Renai Are you trying to optimize the DB schema, or just find one that works?
 
Found what you should be using if you do DB with SQLSRV It depends on which version of PHP you're using, but if you're using PHP5+ you can use Microsoft's SQL Server Driver for PHP. Make sure you use version 2, which gives you the PDO functionality as well as the procedural style.
 
basically i got my site semi working , then on the search page, i found out ratings are not searchable, as when i select ratings.* it returns the number of ratings not shops.
so in otherwords am lost
am not sure what direction to go in
am using php and arrays to find out the total values by math after the query
so i have 2 queries
 
@Renai Spearate, relational tables are probably the most common schema for things like votes and comments
 
4:23 PM
i have 3 tables atm
shops, services, ratings
ratings is the problem
ur name sounds dutch btw
 
mine?
 
instead of typically having, 1 vote per row, i have 12 votes
its the o and kek at the end
so there is no actual total
in the tables, just figures of the total
 
So your ratings table has a row for each vote?
 
to find total you, divide the total by votes > 0
if you voted now, you would enter a row for shop_id 333
and possibly enter 12 votes on 1 row
12 = different column id's
plus shop_id, user_id though
 
that row would have my user id, and the id of the shop that I voted for?
 
4:26 PM
yea
but if u voted on only 6, 6 would have 0 value
so i do not want to divide by 12, only the 6
 
If every vote is sparate in that table, you can use MYSQL's count() function to get the total
 
so i used this after my query:
$rows = mysql_num_rows($sel);
while($data = mysql_fetch_assoc($sel)){
$total = $total + array_sum($data);
$rows++;
foreach($data as $index=>$value) {
if($value == 0) unset($data[$index]);
}
$full_total = array_sum($data);
$vote_count = $vote_count + count($data);
}
count would add up the value , cool
 
can you put the schema into a pastebin or something, it's hard to follow along in text
 
but how do i get the number of votes above 0 with the query, thats why am using php to get the number
ok which code u need exactly
 
do you have command line access to the database?
 
4:28 PM
i got hiedi sql open
i run a query on that to test syntax
not exactly command line but same thing ish ?
 
@Renai The best thing you can give (if its safe to do so) is the DB schema, when asking for DB related questions
 
ok 1min pls
 
@webarto
 
@Renai or at least describe it in a meaningful way :]
 
4:32 PM
i have a picture of 1 of my tables :D
someone gave me a link to a site the other day, 3 windows, u could create the database and fiddle with it easier
 
@tereško no "managers" company is a good company
 
@Renai jsfiddle.net ?
 
ah, sqlfiddle
 
1sec
thats the 1
 
4:35 PM
Sessions question: If I have a field $_SESSION['userid'] which is only ever set on login.php page how do I reject page requests when its not set on my user_dash.php page? What I have for file I include at top so far: pastebin.com/BzfXG8qJ
Which isn't working obviously.
 
@EventHorizon is_numeric(), is_null(), empty() all would work, depending on how the data is set up
Usually in my bootstrap file I initialize the user id to 0. As long as it's >0 the user is logged in. Just have to be consistent in coding
 
or == false
 
trying to get table into sqlfiddle - bloody snytax error
 
right right, I had figured if they visit without hitting the login.php page that if!isset would work
 
i copied n pasted my exported query but syntax problems
 
4:44 PM
@Renai that might solve some issues right there ;]
 
well adding die() at the end seemed to work @orourkek so my header isn't working
 
yeah because the header call is wrong :[
 
there a problem with auto_increment on sqlfiddle?
 
Header("Location: index.php")
(e.g.)
 
oh, plus I'm not even using headers for redirect on my login code, using <meta>, is that better or should I switch it to header?
 
4:46 PM
depends who you ask i suppose
header() is my preference
header("Location: login_denied.php");
 
yeah I just read that PHP headers will work for everything. <meta http-equiv= in HTML will only work in browsers (and maybe not all) and therefore are always inferior when you're able to use HTTP headers. in reference to Caching
 
made the table
just cant insert the bloody data
 
Morning, @MikeS
 
would someone like to recommend a php IDE? netbeans pushed an update today that broke my installation with a known, unresolved bug. hey @orourkek.
 
@MikeS Paid/unpaid? OS? Version control support?
 
4:59 PM
@orourkek free, preferably. i dont have a budget for a paid anything because up until now, i didn't have to think about it.
i'm so pissed i could scream. my work has come to a screeching halt because of this.
 

« first day (570 days earlier)      last day (4393 days later) »