« first day (336 days earlier)      last day (4836 days later) » 

22:00
get the messages from moment of join and now()
hmm
look
1. I go to my chat
2. I post messaeg
3. Message is posted in one minute and after server responses, my message is appended
4. Before next poll I've got something like $(".panel_messages").last().data('postid');
5. I poll my request will last id
6. When submitted message isn't appended yet, older postid gets taken in ajax request
ic so the screen isnt refreshed
if reload browser window it shows up?
if i reload browser it shows fine
22:03
that is a javascript question infact
right
yes
+ PHP
yes yes
it highly rely on PHP, too
that doesnt mather
you need to refresh the element where the whole chat is
second
I think I got it
22:05
is the chat window builded as a form?
not exactly
i not now how to refresh by a specific element
oh .. genesis and his "chat"
sooo easy to fix it
@tereško yes :p
but i'm 100% sure it is a simple code to do
22:07
if ($('.chat-message').last().attr('data-postid') != $(data).find('div').attr('data-postid')){
    $(".panel-left").append(data);
}
done :)
hey everyone :) hope everyone is having a good evening... I've got a question that no one seems to have the answer to, but I think Ill wait for whitehat and genesis to finish to ask :)
2
Q: How to add/update an attribute to an HTML element using javascript?

dev.e.loperI'm trying to find a way that will add / update attribute using javascript. I know I can do it with SetAttribute function but that doesn't work in IE.

@Nathan just ask
ok your solution i think is better
thanks, I am trying to understand how using dynamic urls could be used to populate a jquery carousel using a database
22:11
no iyt isnt
you want to load content from another site to the carousel?
Basically, it is a photo carousel with 6 slots in it, that are populated from a 6 part list. What I don't understand is how to make a dynamic url, and also how to make it so that each "slot" in the carousel is displaying different images, but in order.
no, I have my images in a folder, but the information for the images (including their ids) is in a database
@Nathan , how any of this is related to php ?
@tereško i assume the databse only.
well to create dynamic urls I need to use php to connect to the database and create the urls right?
hold on I have a code similar to what I want to do, can I post code in here?
some pastebin would be preferred ( with syntax highlighting )
22:16
or actually copy the code it shows and paste it in here?
normaly a carousel uses id's
yes this isn't for a carousel
it is the same
I think this will go in tereško's ignore list
this is on developphp, its for a ecommerce site, but it does something similar to what I am trying to do
I am trying to create dynamic urls like this code does, and insert them into the list of the carousel, the issue is to show more than 1 image at a time from the same database without it repeating images or showing the same images at the same time :/
so would I have to do that in the php or the jquery... the carousel is a plugin so it is prebuilt, and I am the farthest thing from a php guru
22:21
you query the products and use the jquery carousel assuming it uses ul li <ul><li id="<?php echo $id ?><img src="<?php echo $product_image ?>"</li>
awesome, and yes thats the structure it uses, it's that simple?
Fire
0
Q: Can't print_r domDocument

AndaI only see: DOMNodeList Object ( ) is this a php bug or something? How am I supposed to see the html elements from the object?

yes it is that simple
you can simply embed the javascript into your php document and visa versa
@tereško , hows the spaghetti lol
ok awesome, so to make sure I understand, am I going to keep any of the code from that list, or all of it... or just put this in the list? I am pretty lost when it comes to php :/
> He's bound to the bar by a family geas, and hates every minute of it. As a result, wise people avoid the bar snacks.
22:28
lol
> Above and behind the bar, inside a sturdy glass case fixed firmly to the wall, was a large leather-bound Bible with a raised silver cross on the cover. A sign below the glass case read "In case of Apocalypse, break glass". Alex believed in being prepared.
from the book i am reading now
sorry, i meant the php i posted before
your database query here
your results from database here
use the results from the database in the jquerycarousel here
close the query result here
ok thanks for making it elementary ;) appreciate all the help
@Nathan , there were so many thing wrong with that piece of code , there wasnt even point in trying to fix it
if it was a dog , i would put it to sleep , just to end the suffering
22:33
yeah... I got it from developphp.com... unfortunately that is the only way for me to learn to code (that I've found) in extensive tutorials until I move from design classes to development classes :/ apparently I've been learning everything wrong from that site but that was literally copy and pasted from the source file... aside from a typo in the notes that i editted
to even begin with , in this day and age you should not write new code with mysql_* functions in it
they are in the process of being deprecated
so mysql_close was a no-go
but what about mysql_query? what would be a more modern way to do that?
<ul>
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 6");

while($row = mysql_fetch_array($sql)){
$id = $row["id"];
<li id="<?php echo $id; ?>"<img src="<?php echo $products_image; ?>" /></li>
}
</ul>
oh okay
i see how it works now :)
lol i missed the echo
22:37
but wouldn't that be for just 1 image at a time... I mean if they are all coming from the same database how do you keep them from repeating images, or all showing the same image at the same time.
nope it count ALL
all id;s
I get that
@Nathan you should be using either MySQLi or PDO
i understand that it will show 6 of them at 1 time from the whole database in a descending format
@tereško -.-" brb while i get coffee
it's going to be a long night, i have no idea what either of those are...
@wHiTeHaT the issue is that there are 6 slots to the list, one for each of the 6 "frames" in the jquery carousel
then you must categories them
categorie 1 contain image 1 to 6
categorie 2 image 7 to 13
etc
22:40
hmm
maybe if i tell you what the site is for you will understand better
essentially it is a graphic sharing site
where people can upload and download graphics
and the code is for the home page "newest images" list
and it should slide from the newest to the oldest images :/
you can define that all in your sql query
s
i dont now how your database is builded
well all images are in the same database
separated into categories within the same table, so if they are labeled cat 1 they are jpg, cat 2 is gifs, cat 3 pngs, etc...
as long as that table has a reference to a specific categorie you want to show then that is good... you then have to count the images for each categorie on a given date
and then let it populate the images from the categorie result
would that populate randomly?
or would it be organized
wait nvm
stupid question :p
ok so how would I define this, i mean I understand the SELECT * FROM products ORDER BY date_added DESC LIMIT 6 but I don't know how to select specifics
ok here is the organization of the tables id product_name price details category subcategory date_added
and please , stop using id for column name
22:48
so what should I name the column then?
yes you can get in trouble
or where should the id go perhaps i should say
products_id
at a guess ? product_id
really... ok, ill change it... just out of mischievous curiosity what kind of trouble?
22:49
it is related mostly to thing known as FOREIGN KEYs
would it just create a lot of errors?
ah
if you want to use a reference by id... things can get mixed up in your variables
im gonna learn loads here :)
if use a specific id you avoid that
right, makes perfect since
before I was just parrotting what was done on developphp tuts
like i said ive been yelled at for things i was taught to do wrong a lot lately
22:51
yes but that code is not for production... it is just an example
but it makes perfect sense
besides , if you use good names for columns , you can write queries like :
SELECT
Products.name,
Category.name

FROM Products

LEFT JOIN Categories USING (category_id)
LEFT JOIN ProductTags USING ( product_id )

WHERE ProductTags.name = "limited"
oh yeah i can definitely see where it gets confusing if i just use id
if table you are selecting , and table you are joining to it has a column with same name , you can join on it
and it makes the code much more readable
he has all in the same database
sorry same table
22:55
lol
yeah same table
then even easyer
but still for future reference and if you all end up telling me i have to redo my tables lol
it depand on your needs if must ... and nothing is a must...just what you want
there is this thing know as database normalization
lets say you have table with Users
and there is a column country
you will end up with multiple people from same country , repeating that name in the table again and again and again
making it all larger and harder to search ( strings take more time to search then numbers )
22:59
that makes sense
instead you should have separate table for Countries , and Users table in that case would contain only a column with country_id
so in that case you would take the string and make it represented by a number
oh
which is a reference to the countries table ( foreign key )
that actually confused me :/
so basically
you take one large table, in reference it to smaller tables, which would minimize data flow which would speed the query up?
and* not in
23:02
@Nathan , that is one of the reasons , yes
in this tutorial country=Position
oh that tutorial helped a lot, im a very visual learner :/
i get it now
another example , lets say you have Users , and each user can be in multiple Groups
what would you do ?
dont over feed him lol
how much spaghetti you made lol
lol
well
i would make a user table, and then a table for each group
23:04
yes ?
wrong
ok guess i dont get it lol
what you do is you have a table for Users and table for Groups
thought i did >.<
a table with all groups
and then you ad a third table UserGroups which has only two columns: user_id and group_id
23:05
ohhhhh
products
products_to_categories
categories
that makes more sense in the speeding things up bit lol
yeah , same thing
and to get all users from a single group you write :
in products_to_categories you require only to colum products_id and categories_id
SELECT
   Users.name
FROM Users
LEFT JOIN UserGroups USING ( user_id )
LEFT JOIN Groups USING (group_id)
WHERE Groups.name = 'foobar'
23:07
ok, so what is left join?
it "attaches" the data
and is my situation so hopeless that im fubar :(
4 Spaghetti :)
23:10
why are you repeating that all the time ?
@tereško now THAT is visual :) makes perfect sense now
@tereško look
ok in your example above the left join of UserGroups confuses me
@tereško i understand
23:14
is UserGroups a separate table, ie 1) Users 2) Groups and 3) UserGroups < so you have 3 tables?
@Nathan somehow we are in the same boat
yes , 3 tables
ah okay
SELECT Users.name FROM Users gets all the user names
SELECT
Users.name
FROM Users
LEFT JOIN UserGroups USING ( user_id )
LEFT JOIN Groups USING (group_id)
WHERE Groups.name = 'foobar'
so in this example
you are taking all data from users
taking only the data from usergroups that is also in users
and the same from groups?
23:16
LEFT JOIN UserGroups USING ( user_id ) adds to each user all the group_id's which it has
oh wait, you right a WHERE Groups.name = 'foobar' so
LEFT JOIN Groups USING (group_id) finds all the groups which are tied to the group_id's
oh so its not taking all user data, it is taking a specific user data and matching it to data that has the same user_id in the groups?
WHERE Groups.name = 'foobar' takes only the users , which have tied to them groups where group name is "foobar"
oh okay i get it now
23:17
it looks in UserGroups for the users what are in the foobar group
well , the order in which the database walks the tables my differ
so for my issue, i could separate it into 2 groups, products and categories
and then take products that are all in the same category
23:19
;)
there are two language which web developers think that they don't need to learn : SQL and Javascript
and they are wrong on both accounts
so in top of your carousel you could also create a list as let's say buttons for categories... and once clicked... it loads the last 6 images of that categorie
into your carousel
so i could say SELECT product_id FROM Products Left Join Categories USING (category_id) WHERE Product.Category = jpg?
WHERE Categories.name = 'jpg'
that was my only mistake?
23:22
yes
and that would create a list of products that are all in the same category, ie jpgs?
depends on what exactly is you db structure
but that select above already would create a list of product IDs in that category
you just ask for product names instead of id's
so i could say SELECT p.product_id FROM Products p, c.categoires_id FROM categories c .........
fml
i had this awesome successful "there is hope for me yet" feeling going too...
@wHiTeHaT , you can , but it wont be actually the same query
23:25
it is shorter no
?
oh yay, i get to ignore that then? The p.products, c.categories and categories c thing just messedd with my head
it was my last question to you
@wHiTeHaT it is harder to read , and it is slower
ok so how did i ask for just product names when i said SELECT product_id?
23:26
wow... i thought it was the other way around lol... but maby it is couse of i was used to do so
it all depends on your DB structure
i suspect that in your current structure you cannot do it this way
well right now until i fix it
i have id
which are unique
and auto increment
you can reference your product_id As myproductID and use it elsewhere in your query as myproductID
so every time a user uploads a file, it should theoretically create an id for their upload
@Nathan , i would recommend for you to read some book on MySQL , to understand this all better
23:29
any title suggestions?
just get one in torrents or something
or picture books :P
hmm .. i can see what i have , but i tend to avoid mysql
you ever heard of fullsail university?
I am going to school online with them, but we are in the design aspect of web design and development right now and im still a good 6 months from the developing stage
i have no idea what it is
lol
23:33
i recommend when user uploads... use a temp table before pass it to the actal database
huh ? why ?
for verification
well for now i havent even got to user uploads, its only setup so i can upload from the admin table
to verify if it is a valid upload or not
because my friend and i are well into design and i just want to have something up there where we can throw our graphics up while i work on building the user side
but if i cant show the graphics, then nobody can see them :/ very frustrating
23:35
if you are verifying manually , @wHiTeHaT , then it is easier to just tag the new uploads as "unapproved" , and if you do the checking programatically , then i would use transactions and rollbacks
my biggest issue is i go to med school in europe, and i cant legally work here so i am trying to find ways to make $ online, and before i freelanced for graphics and logos
but only getting 40% of the $ for what you make is exhausting and frustrating so then i started building this site
well.. there also exist script what just require a folder and images in that folder... and the script reads out the folders
@tereško yeah that would be via a boolean right?
@Nathan
23:38
@Nathan maybe , but that is only if you ever gonna use a single type of tag
if there are more then one variant ,then i wold create a table Tags , and keep them there
right, approved or not approved
okay, makes sense
i dont want to discurrage your commercial idea, but did you made a strategy for it?
so like for approved, pending approval, and not approved you would make the new table
well
my strategy is im in eastern europe, i can easily survive off $10 a day, so even if i sell 2-5 graphics a day im good lol
you can also need tags like "important" or "flagged" or something
and what if you contribute to lets say... some stock images site
23:40
you see , there are many reasons why an existing upload might require admins attention later
ive done that for last year of med school
extremely exhausting and frustrating
@tereško very true
the problem is everyone and their mother knows how to use photoshop and illustrator now, so it is extremely competitive
if you stick to "approved" and "not" , then single boolean field is fine
so I figured if it is so competitive, plenty of people would be willing to submit images
can you create website templates?
in combination with good seo to reach buyers, it could make life bearable while i finish all 3 degrees im doing
23:42
@Nathan , in that case , i'm sorry to destroy your fragile dreams , but : deviantart.com
right, thats what i did for emails on a test site, email activated or email not activated via boolean
oh, im not swayed by competition @tereško I have a few... unique ideas.
and at the very least it will be good practice for developing
which could then like whitehat said help me build templates.
ive been there done that... in my mind i invented aloth of things such as narrowcasting... what didnt even excisted... and even there i failed... and still have a unique idea what isnt done yet abouth it... but i cant succeed.i can only wish you goodluck
thanks, it doesnt have to be the "next big thing" just decently successful, selling a few images here and there
its only meant to make life easier so i can spend more time studying molecular biology and orthopedics (-.-") instead of wasting hours freelancing online.
especialy in the east of europe, you can earn aloth of money when going to the companies directly... and propose your work
i'm dutch
ah okay
im american but im in moldova for uni
23:48
they admire "work" from west...
they see it as something unique
right
not everyone in these countrys have the change to study
here they seem only to admire western money lol
theres aloth of ... how say.... poor people there where you go
true, here being able to study anything besides business and law is considered winning the lottery since thats pretty much all they teach domestic aside from medicine lol
23:50
at one time you see a big house... and next to it... theres a getto
well there is lots of russian mafia here that are well off but the rest are pretty poor :/
it is humbling
yup
this is my second year here so im real familiar with it now
ha ok your already there...
i thought you had to go
yeah ive been here
no, second year
im in first year again because i had to go the US at the end of the second semester last year for a family emergency :/
but anyways
here in the netherlands yes... sometimes i get students at the door and try to sell there drawings
with my issue what I still fail to understand is how a query would populate the slideshow
23:52
hand drawed
door to door sales
if there are 6 images at a time in the carousel, how could 1 query populate it
yeah similar here
maby an option for you in a "secure city"
they collect walnuts and fruit from the trees on the street and then sit on a milk crate and sell them
ok, so imagine this
this is the carousel I am using
it uses a list like this:
never forget that they pick the fruit or nutss to sell them... the realy worked for it to be able to sell it
1. <div class="JMyCarousel">
2. <ul>
3. <li><img src="/path_to_the_pictures/1.jpg" width="200" height="150"></li>
4. <li><img src="/path_to_the_pictures/2.jpg" width="200" height="150"></li>
5. <li><img src="/path_to_the_pictures/3.jpg" width="200" height="150"></li>
6. <li><img src="/path_to_the_pictures/4.jpg" width="200" height="150"></li>
7. <li><img src="/path_to_the_pictures/5.jpg" width="200" height="150"></li>
8. <li><img src="/path_to_the_pictures/6.jpg" width="200" height="150"></li>
yeah they do
23:55
you only need 1 li
ok
and 1 li will create all 6 images in a row?
and then when the 5 seconds or what ever comes along, the 1st image will be bumped off and the next image will be added?
yes your query... and the one i putted above for you do that
it do for each <li id="" ></li>
ok
awesome, i havent got a chance to try that, let me do that real quick :)
if i was in your shoes i simply would take some shoppincart script
i would have all in 1
a carousel module probaly already written for you
maby need to tweak it a little to your desire
NEO is on tv ;)

« first day (336 days earlier)      last day (4836 days later) »