cmps 26 Light Poster

Hey minitauros, thank you for this regex pattern, it's useful I added the U at the end of the pattern since I'm gonna have more than one in an input. I am thinking of implementing a new one soon since I can't find one that is working 100% with no bugs or probs. Thank you guys you were helpful :)

cmps 26 Light Poster

Thank you for this link, no in contrary that's just great. In fact I have implemented a function based on recursive backtracking to prevent nested tags but it needs more conditions for special cases, so Is wondered if a regex pattern exists to solve this. I haven't checked the code for this application jbbcode but I'll do 2mrw. Have a nice day!

cmps 26 Light Poster

I am coding a bbcode parser system. But I'm stuck with the nested tags.
I would like to know if someone know the regex pattern to find for instance a [url] tag.
Example: [url][url]Hello world .com[/url][/url].
I want the output for this to be <a>[url]Hello world .com[/url]</a> where [url]Hello world.com [url/] becomes clickable.
Please not that "[url][url]Hello world[/url][/url] [url]Hello again .com[/url]" can occure and all other combinations are also possible.
If you have a better idea than doing this with regex, please let me know :)

Here's my normal regex pattern:
"#\[url\](.*)\[\/url\]#isU" //this is making the output <a>[url]Hello world .com</a>[/url], and it's logical but how to fix it ?
Thank you

cmps 26 Light Poster

Hello, I am using mysql as database, innodb as tables engine. Some of my tables have foreign keys referencing to other tables primary keys.
Since the definition of foreign key is to restrict the value of itself, I would like to know if I should check the existence of the primary key in the parent table before inserting in the child table (therefore 2 queries: SELECT then INSERT). Or I should directly insert in the child table and mysql will do this for me (therefore 1 query with other hidden mysql job). Please note that performance is important for me. If any advantage/disadvantage applies let me know. Thank you, best regards

cmps 26 Light Poster

Hey all,
I have a query like this one:
select * from topic order by topic_view_time limit 10

the topic table has a PK topic_id and some other varchar fields. It also has topic_view_time which is int and has the value of time() (in php) updated whenever a user view the topic.
In case of 1 Million rows, I think that this query must be slow.
And I also think the problem is because I am ordering by a non index field.
How can I improve the query to execute faster.
Please note: I can't make topic_view_time unique since multiple users may view different topics at the exact same time.

Thank you :)

cmps 26 Light Poster

Hey all,
I would like to know why when having big data in mysql table, executing a query for the first time takes 0.1.. sec, but if executing again the same query later, it will take only 0.0006 sec ?
Exemple:
SELECT name FROM users where id > 310000 limit 20
takes: 0.1844 sec the first time executed
and it takes: 0.0006 sec when excecuted again

Is there caching or data management ?
The speed will stay permanently ~0.0006 after executing it for the first time ?

Thank you :)

cmps 26 Light Poster

I don't think you can directly show the bold effect in the textarea. As JorgeM mentioned, you should manipulate the content in a seperate div tag or paragraph in order to display the change. So you should have another button called preview textarea.

cmps 26 Light Poster

Okay and where is the problem: Database ? php code ? or what ?

cmps 26 Light Poster

As I know, xml file must open in a readable way. What is the extension of the xml file, aybe it's zipped.

cmps 26 Light Poster

I understand your point. I haven't tried this before, but it's interesting. I don't know if there's an option for this but definetly there must be an option to schedule a reboot for the server.
Here's google's results:
https://www.google.ca/#q=how+to+restart+server+automatically+in+aspx

cmps 26 Light Poster

Hello, just use a normal
<input name="submit" value="Submit" style="border:none; background-image:url(...); width:...px; height:...px; text-align:right; padding-right:2px;">
remove 2px from the width since we added them as padding-right.
I think you got the idea, try it and tell me

cmps 26 Light Poster

Can u be more specific in what you want the user to do. Moreover, this page is for adding a new user as shown in the submit input. Just a quick information about update page, it's almost the same as the add page in any CMS. However in the update page some input must be deleted or disabled for some unique data that cannot be changed. Finally, in the sql part you have to change the operation from INSERT to UPDATE and add the condition WHERE.

cmps 26 Light Poster

Do u want to restart the server from vb.net ? I dont really understand that. But anyway why dont u stop and start the server again ? Or try to restart the server from administrator tools in control panel.

cmps 26 Light Poster

How do uvwant things to be displayed ? Do u want things to be truncated outside the div or what ?

cmps 26 Light Poster

Because div has a fixed height of 50px ... Theres a conflict where u dont want things to be displayed outside the div but u r forcing it with the p

cmps 26 Light Poster

Do you have Javascript enabled on your browser ?

Try this:
<a href="https://www.facebook.com/sharer/sharer.php?u=[YOUR LINK]" target="_blank">
Share on Facebook
</a>

cmps 26 Light Poster

Hello, you can create a subdomain or a new directory. To give your team access you can create them an ftp account to the particular directory. Do the same thing with database, create a new username just for your team.
But all this is not 100% safe. I mean, there exist some shell files that can be uploaded to servers to gain control of it. Uploading shell to servers allow manipulating data files and directories. (Delete, Update, Create)
Why don't you use a free hosting like 000webhost.com. Or why don't you use localhost Xampp or Wamp ?

cmps 26 Light Poster

Well, thank you for posting this list. I know the Smashing Magazine, it's a very usefull reference for web designers and developers.

cmps 26 Light Poster

!!!!! How would you know what is the index for a random input. I mean if you have $data[1000][100000] = 4566, will you loop 100000 times untill you find a value ?
Please be more specific in you question!

cmps 26 Light Poster

Hello all!!
I am new to SEO, and after searching and reading articles and tutorials about SEO. I found that recently, after the Google Penguin algorithm was updated, many websites dropped because of the low quality backlinks on their websites. As a solution, I read that categorizing backlinks into Low quality and High quality is a good way to filter them. In order to know the quality of the website, we have to check it's Page rank (PR).
Based on this solution, I recently checked an example of a site having many backlinks. So I've downloaded these backlinks. For example:

    http://www.example.com/index.php?page=something
    http://www.example.com/f/
    etc...

To filter the list, I want to check for the quality of its links, which is the Page rank.

My questions are:
1 - Should I check the page rank of the main page of the domain:

http://www.example.com                                         PR:2

Or I should check each page for it's Page rank:

http://www.example.com/index.php?page=something                PR:0
http://www.example.com/f/                                      PR:0

2 - Is page rank the only measure for link quality ?

Thank you

cmps 26 Light Poster

Great, thank you for replying :)

cmps 26 Light Poster

So in all cases, it's not gonna hurts right ?
Thank you

cmps 26 Light Poster

Hello Victoria_1 and welcome to programming in Java :)
The "For loop" has the following form:
for(int i = 0; i < NUMBER; i++)
for(initialize i to a number; compare i with NUMBER; increment i by 1)
i++ is the same as i = i + 1
So if you want to increment i by 10 for example, you would write
i = i + 10 rather than i++

GL

cmps 26 Light Poster

I was looking for a Dictionary for algorithms, and here's a very good one. Rosetta Code is also a very nice website to compare codes in different programming languages.Thank you for posting these links.

cmps 26 Light Poster

Hello dany12 :)
I haven't worked with Python before, but I have worked with PHP and tried different frameworks. For me PHP can do pretty much everything I need from building simple website to creating a dynamic website connecting to Database etc ...
For PHP, codeigniter is my favorite framework for many reason:
Easy to understand, has a large library, easy guide tutorial, has a very big community compared to other frameworks for PHP
As I said, I don't know much about Python, but here's what I know about PHP :)
So hope you can find the best language and framework for you. Good Luck

cmps 26 Light Poster

Hello all :)
Some companies have just one domain name pointing to their website. However, some others have many domain names pointing to a single website. In SEO point of view, is it good to have multiple domain names poiting to the same website or one is enough ? And why ?

In my view, I see that multiple websites increase the possibility of the website appearance while searching. In the other hand, I think maybe this can decrease the website rank since the pointer domain name (when it's new) will be ranked 0/10. So what do you think ?

Thank you ;)

cmps 26 Light Poster

@LastMitch you're totally correct, I just wrote this example to show links in the sitemap pointing to pages not allowed by the robot. And I was wondering what happens in such a conflict. Which one dominates ?

Here's a correction for the sitemap.xml code:

<url>
  <loc>http://www.example.com/index.php?test=test</loc>
  <lastmod>2013-10-12</lastmod>
  <changefreq>weekly</changefreq>
  <priority>1.00</priority>
</url>

 etc...

Thank you, I should have posted a better example of sitemap.xml in the first post

cmps 26 Light Poster

Hello all!!
I've been making websites for many years, and recently I decided to get more into SEO. So here's my question:
I would like to know what happens if I wrote in the robots.txt:

User-agent: *
Disallow: /
Sitemap: http://www.example.com/sitemap.xml

And in the sitemap.xml, there are thousand of links linking to different pages in a directory, for example:

1 => http://www.example.com/site/index.php
2 => http://www.example.com/site/index.php?lang=en
3 => http://www.example.com/site/shopping.php
4 => http://www.example.com/site/picture.php
etc...

In this case, as I understand what robots.txt and sitemap.xml do;
First, robots.txt disallow Search Engine (Let's talk about Google) to index any file or folder in the domain name: example.com. However, google will look at the sitemap.xml and find that it has to index the concerned links.
What happens in this situation ?

Moreover I would like to know, what happens when a page has the meta robots set to noindex, but at the same time it appears on the sitemap.xml. What happens in this situation as well ?

Finally, I would like to know if I updated my path to the sitemap for my website on google webmaster tools, will it be enough for google to go and check it or it should also appear on the robots.txt ?

Thank you

cmps 26 Light Poster

Can you put one of the other files that includes:

<?php session_start();
    // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['username']))
        {
            header('Location:login.html');
        } 
 ?>
cmps 26 Light Poster

Why are you including the login.php page ?

<?php session_start();
    // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['username']))
        {
            header('Location:login.html');
        } 
 ?>

I can't see why you need to include login.php.
At first I suggested you remove the session_start() from this file because it was already written in login.php , but now I realized that login.php has no useful information for this file. Why are you including it ?

cmps 26 Light Poster

ryantroop is absolutly correct. PHP does support writing in HTML inside its pages. So with this combination PHP & HTML, you would load tags and values from the XML file (with PHP), and you can decide how to display the loaded value on the screen (with HTML). Since XML file contains a pattern of tags repeated for every subject (in your case: for every book), you can display the result fetched from the XML using <table> tag in HTML. This tag is pretty easy to use, and you can style it with CSS for a better look.

cmps 26 Light Poster

In your 3rd block of code (Common for all other pages), you have started a session, then you included the login.php where you started the session again. Remove the duplication by deleting session_start in your 3rd block.

cmps 26 Light Poster

Try removing the video card and RAMs than put everything back in its place. It happened to me several time to have my monitor LED going orange (not working), when turning on my computer and failing to connect devices.

cmps 26 Light Poster

Hello,
The concept is:
You have the array (A) with numbers:9,5,5,3
You have to loop through the values in A, and create a variable called max and by default set it to the first value in the array.
Create another array (B) that will hold the index for the max duplicated values, and finally create a counter variable called count.
Now you have to compare each value in the array with the max variable, the three conditions are:
if max > A[i] => do nothing
if max == A[i] => save i in B[count]
if max < A[i] => max = A[i] and count = 0 and B[count] = i

Code:

<?php

    $A = array{9,5,9,5,3};
    $max = $A[0];
    $count = 0;

    for($i=0; $i<count($A);$i++){
        if($A[$i] > $max){
            $max = $A[$i];
            $count = 0;
            $B[$count++] = $i;
        }elseif($A[$i] == $max){
            $B[$count++] = $i;
        }
    }

    for($i=0; $i< $count;$i++){
        echo "Index: ".$B[$i]." => ".$A[$B[i]]."<br/>";
    }
?>

This is just a way to do it, it will print at the end:
index 0 => 9
index 2 => 9

Please note that this code is not tested.
Good Luck

cmps 26 Light Poster

I didn't understand what you want!
Your example is not clear, what do you mean by:

with ALTER i made columns but then when I am inserting values for example one column from one table with 4 rows and second column from other table with also 4 rows, in my new table i get 16 rows instead 4 rows

What are your tables ? what are the attributes of your tables ?
How many rows you want to insert in each table ?
What do you want to do after inserting the data in your tables ?

Please write more details and give us your query to understand your Database or PHP problem.

cmps 26 Light Poster

Hello, there are lot of tutorial on youtube on how to create a website from scratch PSD => HTML CSS. Moreover, a lot of tutorial about this topic are provided by http://net.tutsplus.com
Please note that you have to practice a lot to be familiar with HTML CSS
Good Luck

cmps 26 Light Poster

That's great, thank you :)

cmps 26 Light Poster

Hello,
I would like to know if using Java as Programming language and Swing as GUI is enough to create a point of sale system ? Which programming language and GUI does companies use to create POS systems ?
Thank you :)

cmps 26 Light Poster

What you are getting on the screen is what you actually told the code to do.
Look at:
System.out.printf("\nPortfolio #%s, " + "%s = " + "%.2f, ",....);
As you can see, there are: Two %s (string) and One %.2f (float)
What you want is:
System.out.printf("\nPortfolio #%s, %s = %.2f, %s = %.2f, %s = %.2f, %s = %.2f",....);
Don't forget to add the 6 additional arguments.

cmps 26 Light Poster

What is the error ?
Why don't you use scanf() ?
And you don't need to put &name, because name is already a pointer to the address of the first character of the array

void displayName(){
    char name[30];
    int number, x;

    printf("So..what is your name?\n");
    scanf("%s",name);
    printf("Nice to meet you %s, how many times would you like to be cloned?\n",name);
    scanf("%i", &number);
    for(x=0; x<number; x++){
        printf("%s",name);
    }
 }
cmps 26 Light Poster
    char string[] = "Hello";
    char c = string[0];
    printf("%c",c);

Is this what you want ?

cmps 26 Light Poster

You can use .htaccess for URL rewrite, but it's more used in this case: domain.com/index.php?page=home ==> domain.com/home
If you have created your pages without taking in consideration that you will be using URL rewrite, then you have to go with what 'LastMitch' suggested. Good Luck

cmps 26 Light Poster

Q3: Do you recommend any tutorial about creating a POS in JAVA ?

cmps 26 Light Poster

Thank you all.
mayaestat this is interesting, from where did you get this info ?
Ravi Rajput, Manish02, Austinlanger: I am using a framework, but yes I should make some changes in the source files ...

cmps 26 Light Poster

Displaying a table needs basic HTML knowledge. If you want to learn the basics go to: www.w3schools.com
Here's how you do it:

...

if(isset($_POST['submit']) && !empty($_POST['submit'])){

    $result = ""; //USED LATER
    /*$term = $_POST['term']; THIS WORKS BUT FOR SECURITY ISSUES USE:*/
    $term = mysql_real_escape_string($_POST['term']);//AVOID MYSQL INJECTION

    $sql = mysql_query("SELECT * FROM `Find Your Gid` where Name like '%$term%'");

     if (mysql_num_rows($sql) <= 0) {
        // no results
        //echo 'No results found.'; BETTER ECHO LATER
        $error = "No result found";
    } else if ($term ="") {
        $error = "No name entered!";
    } else {
        $result .= "<table>";
        $result .="<tr><td>Name</td><td>Gid</td><td>Giftable</td></tr>";
        while ($row = mysql_fetch_array($sql)){
            $result .= '<tr>';
            $result .= '<td>'.$row['Name'].'</td>';
            $result .= '<td>'.$row['Gid'].'</td>';
            $result .= '<td>'.$row['Giftable'].'</td>';
            $result .= '</tr>';
        }
        $result .= "</table>"; 
    }
     mysql_close();
}

...
cmps 26 Light Poster
<?php
mysql_connect ("localhost", "","")  or die (mysql_error());
mysql_select_db ("");

if(isset($_POST['submit']) && !empty($_POST['submit'])){

    $result = ""; //USED LATER
    /*$term = $_POST['term']; THIS WORKS BUT FOR SECURITY ISSUES USE:*/
    $term = mysql_real_escape_string($_POST['term']);//AVOID MYSQL INJECTION

    $sql = mysql_query("SELECT * FROM `Find Your Gid` where Name like '%$term%'");

     if (mysql_num_rows($sql) <= 0) {
        // no results
        //echo 'No results found.'; BETTER ECHO LATER
        $error = "No result found";
    } else if ($term ="") {
        $error = "No name entered!";
    } else {
        $result .= "<fieldset>";
        while ($row = mysql_fetch_array($sql)){

            $result .= '<br/> Name: '.$row['Name'];
            $result .=  '<br/> Gid: '.$row['Gid'];
            $result .= '<br/> Giftable: '.$row['Giftable'];
            $reuslt .= '<br/><br/>';
            }
           $result .= "</fieldset>"; 
    }
     mysql_close();
}
?>


<html>
    <head>
        <title>FIND YOUR GID</title>
    </head>

    <body>

    <form action="findyourgid.php" method="post">
     Search: <input type="text" name="term" /><br />
    <input type="submit" name="submit" value="Submit" />
    </form>

    <div name="Results">
    <?php
    if(isset($error)){echo $error;}
    if(isset($result)){echo $result;}
    ?>
    </div>

    </body>
</html>

<script type="text/javascript">
var arrRequiredFields = [ "term" ];
window.onload = function() {
   document.forms[0].onsubmit = function() {
      for (var i = 0; i < arrRequiredFields.length; i++) {
         var field = document.forms[0].elements[arrRequiredFields[i]];
         if (field && field.value.length == 0) {
            alert("Missing Name of Food");
            field.focus();
            return false;
         }
      }
      return true;
   };
};
</script>

I didn't try this code but try to understand it and modify it to work as you want ...
Btw PHP code is almost every time inserted on the top of the page because you will use variable and results of the php process later in the display part which is the HTML …

cmps 26 Light Poster

Hello, I want to build a POS System. I've already created one in PHP, but I want to create a local one that can be installed on machines and not accessed online or using web server (Locahost). Since I have no idea on the requirements of a system installed on a machine, and things may be different from systems created for online access, here are few questions before I start the project:

Q1: Is Java a good programming language to build a POS ? Is there a better one and why ?

Q2: What more stuff should I know to build the POS, please modify or add to the list:
- Good knowledge of a programming language (Java, C, C#, C++ etc...)
- Database to store products data
- Graphical User Interface of the used Language

Thank you :)

cmps 26 Light Poster

Hello!! Recently I started using google webmaster tool for an ecommerce website. The problem is that google is displaying that some pages has duplicate meta descriptions. The pages that google is pointing to are: the product page and the review of this product.
However, the meta description in the product page and its review is not exactly the same. For example:
Procduct page: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Review of the product: Review: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
I've added the word "Review:" before the original meta description in the product review page.
Question: Shouldn't the word "Review:" make the meta description for the page unique so google won't mention is as duplicate ?
Or should the meta description be completely different ? I mean no common words with another page ?
I have 8 similar duplication of this type that google is considering them as duplicate, how to fix this ?
Thank you :)

cmps 26 Light Poster

try to use '!important' near the style you want to take place
example:

input[type="text"], textarea{
width:17em !important;
etc...
}
cmps 26 Light Poster