cmps 26 Light Poster

Unfortunately it won't work for < IE9, but if border radius is really a problem, then make the corners with photoshop and save them as images.

cmps 26 Light Poster

Hey Squidge thank you, mmm I just googled it, I don't want a website that looks like a shopping website, I mean I want to create my own pages design and then intergrate shopping with it. Example of websites that describe what I want. Deviantart.com, tutsplus.com, etc... The main concept of the website is not the shopping part, it's what the website is about. For example deviantart.com is a gallery of photos, and there's an option to buy a printed version of the photo ... Hope I made my idea clearer

cmps 26 Light Poster

Hey all!! I am thinking of creating a website that may contain some buying/selling items, so I was wondering which framework is the best for shopping online. I have some experience with codeigniter, but I was using it for its MVC structure which organizes and uses files more efficently. Anyway I would like to know if codeigniter is good for online shopping, I mean is it secure ? Is there any other php frameworks that are more secure ? (Zend, yii, etc ...). What about Wordpress ? But I think it's limited for blogs and not very flexible for modifications. So in conclusion, should I go with coding everything from frameworks (if yes, which php framerwork) or use a install and go website ?

cmps 26 Light Poster

hello, if you want something easy and better than movie maker, you can try Sony Vegas which is a software that can be used as drag and drop effects or professional editing. For an advanced use and professional editors, adobe premier pro and adobe after effects are the best. You can find tutorials on how to use any of these software on youtube.

cmps 26 Light Poster

try
.... or die( mysql_error())
it will tell u the problem

cmps 26 Light Poster
<?php
$mysql_host = "***";
$mysql_database = "***";
$mysql_user = "***";
$mysql_password = "***";
mysql_connect($mysql_host,$mysql_user,$mysql_password);
mysql_select_db($mysql_database);
$query = "SELECT * FROM people coming";
$result = mysql_query($query);
while($w=mysql_fetch_array($result)) {
echo $w['Name'];
}

 ?>

okay lets see ...
it's recommended that you don't insert spaces in the table names, but I think you can fix this by adding single quotation like this 'people coming', not sure. If this didn't fix the problem, then add this:
$result = mysql_query($query)** or die(mysql_error())**;
this will explane more what is your error :) good luck

cmps 26 Light Poster

Hello, first of all learning html is very simple and fun, so to learn html tags, for example: <html> <body> <header> <div> <li> etc ... the best website tutorial (chapters with quizes) is www.w3schools.com
Try to learn html and later you can try to group some tags to create a wonderful webpage just using these several tags. Please note that learning html only is not enough to present a good layout for a page, you may be interested later in learning CSS which is the organization and designing part of the page. So breifly, html is a simple language to throw tags in an unorganized way in a in a webpage, and CSS is a tool to organize these tags to create a good looking webpage. Good Luck

cmps 26 Light Poster

Hello, okay I'll fix this to make it exactly match the HTML code, but I am interested in who gave you this code ;) the recursion is smart ...
I will assume that the categoryList() is the function to call to display the navigation menu

function hasChild($parent_id)
  {
    $sql = "SELECT COUNT(*) as count FROM w_category WHERE ParentID = '" . $parent_id . "'";
    $qry = mysql_query($sql);
    $rs = mysql_fetch_array($qry);
    return $rs['count'];
  }

  function CategoryTree($list,$parent,$append)
  {

    // here you should have a url for each link that doesn't have children
    // or if you don't have url as attribute in the table, just keep it index.html for testing
    $list = '<li><a href="$parent['url']" class="active-page">'.$parent['Name'].'</a></li>';

    if (hasChild($parent['ID'])) // check if the id has a child
    {
      $list = '<li><a href="#">'.$parent['Name'].'</a> 
                   <div class="submenu_wrapper column4">
                       <ul class='child child".++$append."'>';

      $sql = "SELECT * FROM w_category WHERE ParentID = '" . $parent['ID'] . "'";
      $qry = mysql_query($sql);
      $child = mysql_fetch_array($qry);
      do{
        $list .= CategoryTree($list,$child,$append);
      }while($child = mysql_fetch_array($qry));
      $list .= "</ul>
              </div>
          </li>";
    }
    return $list;
  }
  function CategoryList()
  {
    $list = "";

    $sql = "SELECT * FROM w_category WHERE (ParentID = 0 OR ParentID IS NULL)";
    $qry = mysql_query($sql);
    $parent = mysql_fetch_array($qry);
    $mainlist = '<ul class="primary-nav">';

    do{
      $mainlist .= CategoryTree($list,$parent,$append = 0);
    }while($parent = mysql_fetch_array($qry));
    $list .= '</ul>
    ';
    return $mainlist;
  }

Hope that this fix the prob :)

cmps 26 Light Poster

Okay this part was solved, now the error is:

SQL> @test.sql
    FOREIGN KEY (TWOID) REFERENCES TWO (ID) ON DELETE CASCADE
                                   *
ERROR at line 6:
ORA-00942: table or view does not exist


    FOREIGN KEY (ONEID) REFERENCES ONE (ID) ON DELETE CASCADE
                                   *
ERROR at line 6:
ORA-00942: table or view does not exist

Logically this is correct .. but how to fix it ?
I think it can be solved with ALTER, but is there any other way ?

cmps 26 Light Poster

Aha, this is weird because I have a sample project where they used oracle as database and the queries has ON UPDATE CASCADE in it :/
Anw, thank you pritaeas

cmps 26 Light Poster

I tried but nothing changed. The reserved word is NAMES according to http://developer.mimer.com/validator/sql-reserved-words.tml

cmps 26 Light Poster

There are many books that can help (For dummies is a good start). Good Luck

cmps 26 Light Poster

the error after I run the query is:

SQL> @test.sql
    FOREIGN KEY (TWOID) REFERENCES TWO (ID) ON DELETE CASCADE ON UPDATE CASCADE
                                                              *
ERROR at line 6:
ORA-00907: missing right parenthesis


    FOREIGN KEY (ONEID) REFERENCES ONE (ID) ON DELETE CASCADE ON UPDATE CASCADE
                                                              *
ERROR at line 6:
ORA-00907: missing right parenthesis
cmps 26 Light Poster

I'm using Oracle, no only this simple example, if it works everything will work.

cmps 26 Light Poster

Hello, I want to create tables in database (using SQL) and add foreign keys to each table refering to the other one. For example:

CREATE TABLE ONE(
    ID          INT             NOT NULL,
    NAME        VARCHAR(20)     NOT NULL,
    TWOID       INT             NOT NULL,
    PRIMARY KEY (ID),
    FOREIGN KEY (TWOID) REFERENCES TWO (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE TWO(
    ID          INT             NOT NULL,
    NAME        VARCHAR(20)     NOT NULL,
    ONEID       INT             NOT NULL,
    PRIMARY KEY (ID),
    FOREIGN KEY (ONEID) REFERENCES ONE (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

When I run this query, it will give me the following error "missing right parenthesis", I tried to add CONSTRAINT fk1 FOREIGN KEY.... but it didn't change anything ...
I also tried to remove the ON DELETE CASCADE ON UPDATE CASCADE, the error message changed to "table or view does not exist", which logically is correct since I am calling the table "TWO" which is not created yet but will be created later.
How to fix both problems: "missing right parenthesis" and "table or view does not exist"
Thank you

cmps 26 Light Poster

PHP & MySQL solve your problem, buy for dummies book and start learning step by step :)

cmps 26 Light Poster

Why I have a feeling that this is your homework ;)
anw heres a semi-answer ...
1 . the diff btw this.dollars and otherMoney.getDollars():
this.variable means refers to the variable in the current class where this.variable appears.
getDollars() is a function for the composite otherMoney which is also of type Money

2 . int newd = dollars + otherMoney.getDollars();
this means that getDollars() returns an Int

3 . this method can be called from the main by creating a new object of type Money

cmps 26 Light Poster

Okay the 2 classes are Node and BST
PSEUDOCODE:

class Node has
value of type integer
left and right node of type Node

class BST has
root of type Node
Insert method using recursion (prefered recursion)
Find method using recursion (remember it's a tree, so recursion should be your friend now)

For any implementation help feel free to ask, but you have to try it by yourself first as the rules of this forum requires :) Good Luck

cmps 26 Light Poster

you need a while loop, check this link:
http://www.w3schools.com/php/func_filesystem_fgets.asp

cmps 26 Light Poster

Are you a begginer in html ? Man I recheck the website, sorry to tell you that the coding is not professional, I suggest to re-code the website using less img tags. You can use div tags for each element/box in your website rather than calling an img which is not pro.

cmps 26 Light Poster

Maybe the way you coded it is not the best way, but anyway you can use the height: #px; overflow:hidden; to cut the unnecessary space.

cmps 26 Light Poster

I think you have to define a variable of type file and pass it as parameter to the fgets():

<?php
    $file = fopen("file/games.csv","r");

    // Dump the games.csv file into an array
    $games = fgets($file);
    // Parse the array
    foreach($games as $game)
    {
    echo "{$game}";
    }

    fclose($file);
    ?>
cmps 26 Light Poster

Sorry but your code is not clear ... why you are echoing at each line ?

cmps 26 Light Poster

Here the full tutorial
https://www.youtube.com/watch?v=FmN4Pj3VWpc

It worked for me I am using Windows 7 and ubuntu 12.04
If you have already installed ubuntu incorrectly, format the part of the hardisk reserved for ubuntu and follow the steps in the video :)

Good Luck

cmps 26 Light Poster

If you want to design your own website you have to know:
PHOTOSHOP HTML CSS

If you want a blog with pro templates:
wordpress (best blog framework)

If you want free hosting: ex: www.yourname.something.com
www.000webhost.com

If you want paid hosting: ex: www.yourname.com
www.bluehost.com
www.godaddy.com

To learn PHOTOSHOP HTML CSS you need to spend LOT of time practicing and learning basics, if you can't wait to learn and design your own website go for wordpress, otherwise enjoy learning :)

cmps 26 Light Poster

You don't need to be familiar with ajax or javascript, read what its written in the blog
"You can also download the completed files as a plugin here (Just upload and activate it)."

cmps 26 Light Poster

As amiyar posted is correct, but here is a better way to write your code ;)

<?php

if(isset($_POST['submit'])){
    $conn=mysql_connect("localhost","root","vamshi") or die(mysql_error());
    mysql_select_db("ninepixel",$conn) or die(mysql_error());
    $sql="INSERT into  empattendence (name,daydate,choice) VALUES('$_POST[name]',now(),'$_POST[choice]')";

    if(mysql_query($sql,$conn)){
        echo("Your Data Has been Submitted");
    }else{
        echo("Please Enter All the Fields");
    }
    mysql_close($conn);
}

?>
cmps 26 Light Poster
cmps 26 Light Poster

Do you want to put the footer at the extrem bottom ?
if yse:
change:
<body> => <body style="position:relative;">
<footer> => <footer style="position:absolute;bottom:0px;"> (maybe you are using DIV for the footer, if so do the same but footer become div)

cmps 26 Light Poster

Okay great, Thank you ^^

cmps 26 Light Poster

I actually forgot to insert the link for the website tuorial in Q5
http://javabrains.koushik.org/p/home.html
Is it good to start with ?

cmps 26 Light Poster

Try this code, it worked for me ;)

<?php
$total=
"AA AA
AA AA
BB BB
BB BB
BB BB
CC CC
BB BB
BB BB
AA AA
CC CC
DD DD
DD DD"
;
$keyarr=explode("\n",$total);
$int=sizeof($keyarr);

$i=0;
$tmp = array();
$cur = 0;
$found = false;
while($i<$int){
    $found = false;
    for($j=0; $j<sizeof($tmp);$j++){
        if(trim(preg_replace('/\s\s+/', ' ', $keyarr[$i])) == trim(preg_replace('/\s\s+/', ' ', $tmp[$j]))){
            $found = true;
        }
    }

    if(!$found){
        $tmp[$cur++] = $keyarr[$i];
    }

    $i++;
}

foreach($tmp as $element){
    echo $element."<br>";
}
?>
cmps 26 Light Poster

Hello all. Currently I develop PHP website, and I do simple java programs. Since I will continue learning more and more java, I decided to learn JSP/Spring MVC (Don't really know how Spring MVC Framework uses JSP, check next paragraph) combination of my web knowledge and the Java programming language.

Q1: What is the difference btw java and jsp in terms of coding, do I use the same functions as in java ex: Arrays.sort(), x.substring(), System.out.println(), etc ... ?

Q2: What is the relationship between Spring MVC and JSP ?
- I know some PHP MVC frameworks like codeigniter, zend etc ... so the relationship between these frameworks and PHP is that they use PHP in MVC architecture
QDoes Spring MVC uses JSP as programming language ? can I relate it to php framework and php ?

Q3: Should I learn JSP to understand Spring MVC ?

Q4: Is there some cool libraries that could attract a programmer in Spring MVC ?

Q5: I found this site for learning JSP & Spring MVC & etc ... Do I start here ?

Thank you,
Best Regards

cmps 26 Light Poster

Okay, things are clearer now, Thanks bguild and JamesCherrill

cmps 26 Light Poster

aha thanks JamesCherrill, so after the garbage collects the object created in the create method, the old value of the original passed object will remain as if no changes were made to the object right?

cmps 26 Light Poster

Dear ggeof, just remove every thing related to positionning. Positionning is like forcing a block (div in this case) to be at a specific position. Try to avoid this option in css for simple website. In addition, positionning could create a problem in the display on different browsers when used with floatinng, specially in IE. Good Luck

cmps 26 Light Poster

Dear bguild, what you wrote make a lot of sense, but let me try to make a conclusion of what I just understood from this post.

Whenever, in the main(), I define a string, then I call a method that has a parameter (String string)

changeString(String string){
    string = "string changed";
    //This is considered as:
    //string = new String("string changed");
}

So when I use the parameter object passed, and re-initialize it, it will be treated as seperate and none pointer to the original object. However, if in the function, we passed an object and in the body of the function we have object.name = "changed", this object will point to the original passed object and will modify its name, exactly like in arrays case where I say array[0] = "created", so I change the first element in the original array.

Lets deal with this code:

public class Student {
    public static void main(String[] args) {
        STD std = new STD();
        std.create(std);
        System.out.println(std.name);
    }
}

class STD{
    String name;

    public void create(STD std){
//      std = new STD();
        std.name = "created";
    }
}

OUTPUT:
created

Here in the function I changed the name of the original object by specifying an attribut = someThing. In case I remove the comment on the std = new STD(), this will create a seperate local variable that will die after exiting the function.

Is this conclusion right ?

cmps 26 Light Poster

Dear bguild, thanks a lot for your reply, I think what you wrote is very clear for a C programmer, I have read some C code and learn some but I didn't started with pointers chapter yet. Anw, can I say that passing an object is like passing an array. In other words, passing an array and changing its content will affect the declared array at the bigining of the file (original array), does objects work the same ? In the other hand, passing a String as this example

changeString(String string)
string = "string changed";

the original string will not be affected even if I called this method and printed the string

Example of object passing
student is the Object of type student

changeObjectContent(Student student){
   student.setName("New Name");
}

this will refer to the original Student object or will create a new object that will not affect the result of the original ?

Thank you
Regards

cmps 26 Light Poster

Hello, well this suddenly surprised me .. dunno why ... i was trying to solve the binary-tree implementation ... where i noticed using root.left = new node bla bla

My question
insert(Node root,int value)
root.left = new node(null null value)
Etc ...

The function doesnt create a copy of the root ... it will use the passed object right ?
Can one tell me what type of parameters a fnctn creates a copy and which doesnt ?
Ex:
String - fnctn will create a copy of it .. so any changes made inside the fnctn to the string passed a parameter will not affect the original string ...
Thank u :)

cmps 26 Light Poster

yes sure ... html cant do this :) you can try php
good luck

cmps 26 Light Poster

Dear Sobias, the remember me check box is to create a cookie in the browser so the user stay logged in until he/she kill the cookie by logging out or if the cookie expires in x Days.
To do this from your website to login to another website:
- You have to check if the other website allows one to sign in from another website (example: facebook will not allow you)
- If it allows you, I suggest you to 'view-source' for the login page of the other website and save the form as it is. Of course you may change the style but make sure that if the form uses javascript, copy them as well.

I'm not sure if you want the php code for how to create a cookie since this topic is in the web design section, anyway I'am wondering why you want to let someone login to another website from your website ... If it's for testing it will be fine else, I recommend you to get a permission, because no one can trust logging to a website from another.

cmps 26 Light Poster

mysql_real_escape_string() is a must, you need to use it almost on every variable, in which value is taken from the user, to prevent SQL Injection.
Even if you have million users, if an action is applicable on one user, it will be applicable for all :)

cmps 26 Light Poster

Hello, it's enough, you are comparing username and password from user to database, the only two input that can identify the user are username and password, but make sure you are making the username unique.

cmps 26 Light Poster

Yes 100%

Having said all that, I'm sure we both agree that this is one of the worst designed and specified exercises ever, and OP deserves all the help he can get.

It could be an idea to retrieve an Item using ID but I don't know why my idea deserved a -1 :o
Let me explain more why I suggested the int index as parameter:
Let's say he added 100 item (Books and Magazins), he can now do a for loop that will iterat on all the items and do whatever task he wants to do.
Example:
for(int i=0; i < 100; i++)
System.out.println(lib.retrieveItem(i).getTitle());

Just by having the index as parameter, he can now do lot of things like for example count how many Books or Magazins are available in the lib, Display only items with ID > 2000 etc ...

Hope you understood my point. Regards

cmps 26 Light Poster

Dear JamesCherrill, I can't see why is retrieveItem is pointless! The items array is private and you cannot access it from other classes (Tester/Driver) so you have to create a retrieveItem() for the items array so you can get the elements.
Is there a way to get a certain element from the private items array ?
I though about it like the arrayList in which there is a function called get(), that will get a specific index from the private Data array.
Logically it makes sense when you use lib.retrieveItem(#); It will return an Item of type Library that will be treated as Book or Magazin depending on what the real type is.

cmps 26 Light Poster

Dear kimmi_baby, I can't see the difference in width btw the navigation/Meny bar and the slider. Please be more specific so we can help you :)

cmps 26 Light Poster

Dear techxaidz, retrieveItem() method:

public Library retrieveItem(int index){
    return items[index];
}

The retrieveItem(int index) method is used is such example:

Library lib = new Library();
lib.addItem(new Book(....));
lib.addItem(new Magazin(....));
lib.addItem(new Book(....));

System.out.print(lib.retrieveItem(0).getTitle());

Good Luck, and yes I think you have to try to start writing some code. Here we can give you Algorithm, Idea, Some Pseudocode and correct your code, but we cannot solve the Execise ;)

cmps 26 Light Poster

Dear 'techxaidz', the problem is not very clear, what I understood is:
you have to make a class Library
then create classes: Book, Magazin etc ... that will inherite attributes and methods from the Library class. But the problem is that the relationship of the inheritence is "is"
For example: we have the following classes:
Circle, Rectangle, Square and Shape
Here we can use the inheritence:
Circle, Rectangle and Square will be subclass (will inherit) SHAPE
Because Circle is a Shape, Rectangle is a Shape etc ...
But Book is not a Library etc ...

Here's what I think you have to do:

Library.java

private Libarry[] items = new item[100]; //Array of size 100 that will contain books magazins etc ...
private int id;
private String title;
private int NumOfCopies;

private int counter = 0;

OTHER ATTRIBUTES
...
...

public void addItem(Library object){
    items[counter] = object;
    counter++;
}

....
....

LibraryHolding.java

main()
Library lib = new Library();
lib.add(new Book("CMPS",12 etc ....));

Book.java extends Library

public Book(String title,NumOfCopies etc...){
    super.setTitle(title);
    super.setNumOfCopies(NumOfCopies);
    etc...
}

Very Long Exercise but hope you got the concept, and hope this is what the prob wants.
I repeat, the problem is not professional and the relationship is not correct.

cmps 26 Light Poster

Dear earlxph8, if you know how to use html this will be very easy for you.

In html file you directly write
<p>Sample test</p>

however in PHP, you have to echo the html:
<?php echo "<p>Sample test</p>";?>

When you echo a string, it will be treated as a html text, so all html tags will work when echoed.
What is even more important is that you can edit the style of the tags exactly like you do in html, taking the same example:

HTML:

<p style="text-decoration:underline;">Sample Test</p>

In PHP:

<?php echo "<p style=\"text-decoration:underline;\">Sample Test</p>";?> *//the \ is to tell PHP that the string is not finished yet, so it will not end it.*

OR

<?php echo '<p style="text-decoration:underline;">Sample Test</p>';?> /*//no need for the \*/

With MYSQL, you can store an HTML block with it's style as it is in the database. When you echo the data using php, it will be treated as HTML.

Good Luck, For any other information feel free to ask :)

cmps 26 Light Poster

Maybe you forgot to include the jquery library
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

write this before closing the head tag .