Robert1995 22 Light Poster

Go ahead and try this :

    /**
     * @static
     * @param $filename
     * @param bool $comma
     * @return bool|string
     */
    public static function getFileExtension($filename, $comma = false) {
      if (strrpos($filename, '.')){
        $extension = substr($filename, strrpos($filename, '.'));

        return $comma ? $extension : substr($extension, 1);
      } else
         return false;

   }

Also, make sure you use this only on upload

Robert1995 22 Light Poster

Do this ...

<?php $path= "http://localhost/tiffany/" ?>
<script type="text/javascript" >
var templateUrl = '<?php echo $path; ?>';
</script>
<script type="text/javascript" src="<?php echo $path; ?>js/manuals.js"></script>
Robert1995 22 Light Poster

Your explanation skills are horrible, but, you can try this,

we will consider that $information, if the array you've specified

<?php 
// We consider by default the current page as 1
$current_page = (isset($_GET['page']) ? (int)$_GET['page'] : 1);
// As we are using an unsorted array, and we want to make sure we pick the right container, we will decrecease it by 1, so we can get the stored array element in 0
$current_page -= 1;

$information = array();// You know what
$used_information = array();// these are the entries which we will explain

$used_information = array_slice($information, $current_page, 1);

// Used Information : 
var_dump($used_information);

?>
Robert1995 22 Light Poster

Please Design you table in MySQL Workbench, I bet most of the people here will really appreciate this and will actually be able to help you.
I will personally come back in one hour, if you provide more information I'll help you out with an explication how to do it and code example.

Robert1995 22 Light Poster

You're not a developer right ?
It would normally be a copy - paste job, depends on the code and how messed it is.

Robert1995 22 Light Poster

Try sending files trough SMTP, here's a tip http://rusuandreirobert.com/blog/2012/05/swift-mailer-quick-usage/ .
For basic emails without attachements that should do, but Swift Mailer supports sending emails with files, so just edit my class for your needs

Robert1995 22 Light Poster

name="upload"

remove that from form params.
Not sure if this is the problem, but worth a try

Robert1995 22 Light Poster

Hello everyone.

I want to do this.
I have a website for example www.rusuandreirobert.com .
I want to create via PHP an email address 3rrgtbf@rusuandreirobert.com .

I don't want to use this :

http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass&quota=$equota

Cheers,
Robert

Robert1995 22 Light Poster

Or create an extra table user_roles the user role table will be "extended" with another table role_permissions
Think this is a clean concept. And role_pemissions will have something like ... module, controller or action if your application is MVC
And another field permission_level, for example view/edit .Hope you get the ideea.

Robert1995 22 Light Poster

The best solution to check if everything is filled out is via javascript, but I suggest using jQuery
I have uploaded similar code here : http://codepad.org/nqc9vtOK
Should be enough to figure out how to make your one work

Robert1995 22 Light Poster

Wow, honestly I had not ideea what I posted THE HOVER IS BAD, THIS IS A BUG CLICK THE LINK FOR GODS SAKE, i put this : https://blueimp.net/ajax/ it's a free open source ajax chat.

Robert1995 22 Light Poster

Just get this one {URL SNIPPED} and problem solved, you seem like a bad coder so you should probably take a look how others done it before. Maybe i'll get rep- but who cares..

Robert1995 22 Light Poster

creativity these days...
Not sure if it will do the trick, didn't test

$hack = $match[0];
$cut = "<img";
$image_part = substr($hack,strlen($cut));
$your_image = $cut.'width="100px" height="150px" align="left"'.$image_part;
Robert1995 22 Light Poster

Let's make it the easy way.. Non case-sensitive

$text = "This is a kickass day.Damn...What a Day !";
$needle = "Day";
strtolower($text);
strtolower($needle);
$tokens = explode($needle, $text);
$found = count($tokens);

So $found is what you want to know, if i understood your problem correctly.
Laters :)

iamthwee commented: no -3
scarcella commented: Very simple, and works! +3
Robert1995 22 Light Poster

Hello, I have a problem :), like everybody else here :P.
Ok so I need to update a wordpress plugin from 2.5 to 3.3.Did anybody else had to do something similar ? Any tips are welcome. Also books about wordpress plugin development would help a lot :).Worth to mention that I barelly know extreme basic wordpress plugin concepts.
Thanks for your time.

Robert1995 22 Light Poster

http://www.w3schools.com/sql/sql_where.asp

$sql = 'SELECT * FROM Products
WHERE City = '.$city;

$city is the dropdown thing .

If you want a search by product name or description .

http://www.w3schools.com/sql/sql_like.asp

Robert1995 22 Light Poster

Maybe someone is interested in doing the same thing , or wants to use it so here it is :
Edition 1

#include <iostream>
#include <fstream>
#include <string.h>
#include <windows.h>

using namespace std;

fstream fin("data.txt",ios::in);

char web_adress[10000][100],web_nick[10000][100],searching[200];
char order[100];
int i,run=1,last_web,k,case_detect;

int main(){
    cout<<"Welcome to Robye's fast open page program , please wait while program is loading";
    for(fin>>i,last_web=i;i;i--){fin>>web_nick[i];fin>>web_adress[i];fin.get();}
    cout<<"Loaded "<<last_web<<" fast open task"<<endl;
    do {
    cout<<"Order : ";
    cin>>order;
    if(!stricmp(order,"beta") case_detect = 1;
    if(!stricmp(order,"open") case_detect = 2;
    if(!stricmp(order,"open") case_detect = 3;
    switch (case_detect) {
           case 1 : for (i=1;i<=10;i++){cout<<web_nick[i]<<" "<<web_adress[i]<<endl;}break;
           case 2 : cout<<"Open : ";cin>>searching;
                             for(i=1;i<=last_web && i>0;i++){
                                    if(strcmp(web_nick[i],searching)==0){
                                    k=i;i=-1;
                                        ShellExecute(NULL, "open", web_adress[k] ,NULL, NULL, SW_SHOWNORMAL);
                                        }
                             }
                             if(i==0 || i==1 || i==-1)cout<<"Done"<<endl;
                              else cout<<"Adress / Nickname wrong , use the 'data' section"<<endl;
                             break;
           case 3 : run=0;break;
           default : cout<<"Couldn't Find : " << order <<endl; break ;

            }

    }while(run);
fin.close();
}

Edition 2

#include <iostream>
#include <fstream>
#include <windows.h>
#include <string>
using namespace std;

char cmdtype[3],cmd[1000],ex[1000],order[3];
char alias[1000][100][100];
int she,i,mact,macl,i2;

int alias_ex(char trac[3]){
    int i,ict;
    for(i=1;i<=mact;i++){
        if(stricmp(cmd,alias[i][0])==0){
           for(ict=1;alias[i][ict]!="end";ict++){
               ShellExecute(NULL, "open", alias[i][ict] ,NULL, NULL, SW_SHOWNORMAL);
                        }
        }
    }
  return 0;
}
fstream fin("data.txt",ios::in);

int main(){
    cout<<"Load Macros ? ";
    cin>>order;
    if(stricmp(order,"yes")==0){
        cout<<"Loading ";
        fin>>mact;
        for(i=1;i<=mact;i++){
            cout<<"*";
            fin>>macl;fin>>alias[i][0];
            for(i2=1;i2<=macl;i2++){
                     fin>>alias[i][i2];
            }
            fin.get();
            strcpy(alias[i][i2],"end");

        }
        cout<<endl;
        cout<<"Macro's Loaded ! "<<endl;
    }
    while(cin>>cmdtype>>cmd){
        strcpy(ex,"");
        if(stricmp(cmdtype,"url")==0){
           she=1;
           if(!strstr(cmd,"http://")){
                strcpy(ex,"http://");
                strcat(ex,cmd);
           }
        }
        else if(stricmp(cmdtype,"prg")==0){
            she=1;
                strcpy(ex,cmd);
        }
        else if(stricmp(cmdtype,"sys")==0){
            she=0;
           if(stricmp(cmd,"exit")==0) return 0;
           if(stricmp(cmd,"macro")==0) {cin>>cmd;alias_ex(cmd);}
        }
        cout<<"Executing: "<<cmdtype<<" "<<ex<<endl;
        if(she) ShellExecute(NULL, "open", ex ,NULL, NULL, SW_SHOWNORMAL);
    }
    fin.close();
}
…
Robert1995 22 Light Poster

update the code -,-? i tried it 5 minutes ago and it still has those compile errors

Robert1995 22 Light Poster

I don't get it , make something like :
Data.in | data.out
dsdsd | iamcoded
roflmao22 | iamnotcoded

Robert1995 22 Light Poster

Hello , I'm just amazed how strong php is , but i don't have an idea where to start , I mastered c++ at a command promp level + kinda average at visual c++ . If some1 could give me some sites or tutorials ? And is code igniter a kickass php program?

Robert1995 22 Light Poster

anyway i figured it out

Robert1995 22 Light Poster

Heya , I was thinking of making a site opener application . But I had a lots of problems . The next problem is facing this , it just crashes.
What do I want my program to do ?
I want to assign a nickname for each of my favorite website's .
I will do that using an external file "data" , there the nickname & the website will be found .
What does my current code do?
It just crashes out , I think the problem is the char declaration , I never figured that out , even so i read a lot of websites .

Wasn't this enough ?

Robert1995 22 Light Poster

can any1 give me a tip ..?

Robert1995 22 Light Poster

Let's think it another way :) you do something like this :
Go into a while loop till end of file
{ Read the name
do another loop(till new line) {
array[++i];
}
}
think this should work

Robert1995 22 Light Poster

even wondering why people use - rep .. I even explained this guy how to do it , but why only me .. The other 2 people told him 2..

mrnutty commented: Here have some if it makes you feel better. +5
Robert1995 22 Light Poster

I don't get it .. Your code ... It doesn't make sense , doesn't compile does nothing .. Here's the real problem ..
1.Using SwitchI will be using Switch statement so i can freely act through rounds and so
2.Making more roundsI will be managing round system using the points integer so if you want more rounds add to the switch :

case x : "Welcome to round X"

Think some people will get mad at me doing this for you.

#include <iostream>

using namespace std;

int answer,points,deb=1;

int main(){
    cout<<"Welcome to my program \n";
    while(deb==1){
        switch (points){
        case 0 :
            cout<<"====QUESTION 1====" << endl;
            cout <<"What currency does france use ?"<< endl;
            cout <<"[1]The dollar" << endl;
            cout <<"[2]The great british pound" << endl;
            cout <<"[3]The euro" << endl;
            cout <<"[4]The yen" << endl;
            cin >> answer;
            if(answer==3){points++;
                cout << "Well done you got question 1 correct"<<endl;
            }
                else deb--;
            break;
        case 1 :
            cout<<"====QUESTION 2====" << endl;
            cout <<"What is the capital of France ?"<< endl;
            cout <<"[1]Paris" << endl;
            cout <<"[2]Mexico" << endl;
            cout <<"[3]China" << endl;
            cout <<"[4]Bucharest" << endl;
            cin >> answer;
            if(answer==1){points++;
                cout << "Well done you got question 2 correct"<<endl;
            }
                else deb--;
            break;
        default : "Rounds Over ! \n";points++;deb--;break;
        }
    }
    cout<<"Game Over . You've got "<<points<<" answers right";
}
Robert1995 22 Light Poster

use

Code Tag

+ format the text :( & do you have an int main(){}? . + What do you want you program to do

Robert1995 22 Light Poster

Code please :)

Robert1995 22 Light Poster

Well , you can either copy it or learn it , because i did this for you.
What does this do?
I am going to vector all the answers possible , after that will read a number as a char . Why ? Because i will use the char elements that have an ascii code , that i diminish with 48 to get the number , if you don't get it check out an Ascii Table
After that I'll simply successively show the numbers . Hope this helped

#include <iostream>

using namespace std;

char *number[10],nr[100];
int i;

int main(){
    //Assign the text for the numbers
    number[0]="Zero";
    number[1]="One";number[2]="Two";number[3]="Three";
    number[4]="Four";number[5]="Five";number[6]="Six";
    number[7]="Seven";number[8]="Eight";number[9]="Nine";
    //read the nr as a char
    cin>>nr;
    // I'll just cout the Text_Assigned_for_numbers[the_number_I'll_show[i]-48]
    for(i=0;i<=100;i++){cout<<number[nr[i]-48]<<" ";}

}
Robert1995 22 Light Poster

A square number is , a number that can be wrote x^2.For Ex 4^2=16;
How to check this?
1.Read the number , then do n=sqrt(number);
What does "sqrt" do?It simply returns Square root of x.Click me for more information
! Do not forget to use #include <math.h>
2.Show the Answer . pow (nr+1,2);
What does "pow" do ? Read Me.

Problem Solved :

#include <iostream>
#include <math.h>

using namespace std;

double Next_pow(double num){
     double n=sqrt(num)+1;
     return pow(n,2);
}
double number;

int main(){
    cin>>number;
    cout<<Next_pow(number);
}
mrnutty commented: Did you not see my post? -1
Robert1995 22 Light Poster

/sigh , sorry don't really know how that happened

#include <iostream>
#include <fstream>
#include <string.h>
#include <windows.h>

using namespace std;

fstream fin("data",ios::in);

char *web_adress[10000],*web_nick[10000],*searching;
char order[1];
int i,run=1,last_web;
int main(){
    cout<<"Welcome to Robye's fast open page program , please wait while program is loading"<<endl;
    for(cin>>i;i;i--){fin>>web_nick[i]>>web_adress[i];}
    last_web=i;
    cout<<"Loading Complete"<<endl;
    cout<<"Tipe 'h' if you're using this for the first time"<<endl;
    do {
    cin>>order[1];
    switch (order[1]) {
           case 'h' : cout<<"You have 2 basic commands : 'o' 'e' 'c'\n'open' - Open the Website\n'edit' - Edit the database\n'close' - Closes this application\n";break;
           case 'o' : cout<<"Open site ";cin>>searching;
                             for(i=1;i<=last_web && i>0;i++){
                                    if(web_nick[i]==searching){ShellExecute(NULL, "open", web_adress[i] ,NULL, NULL, SW_SHOWNORMAL);i=0;}
                             }
                             if(i!=0)cout<<"Page / Nickname wrong , use the 'edit' section";
                             if(i==0)cout<<"Page successfully loaded , Have a Nice Day !";
                             break;
           case 'c' : cout<<"Program Closed ";run=0;break;
           default : cout<<"Couldn't Find : " << order ; break ;

            }

    }while(run);

fin.close();
}
//ShellExecute(NULL, "open", "http://dreamincode.net",NULL, NULL, SW_SHOWNORMAL);
Robert1995 22 Light Poster

I dont think, you wud hv seen the thread "Error In Code". There I hv given the solution for your "Board Game" thread . I hope you will be happy when u see that thread.

honestly are you retarded? he just misspelled at the end /] , and that doesn't matter

Robert1995 22 Light Poster

Why don't you make an asking system ... that's basic simple and stupid + it really works

Robert1995 22 Light Poster

Heya , I was thinking of making a site opener application :). But I had a lots of problems . The next problem is facing this , it just crashes.:(
What do I want my program to do ?
I want to assign a nickname for each of my favorite website's .
I will do that using an external file "data" , there the nickname & the website will be found .
What does my current code do?
It just crashes out :@, I think the problem is the char declaration , I never figured that out , even so i read a lot of websites .

Code :

#include <iostream>
#include <fstream>
#include <string.h>
#include <windows.h>

using namespace std;

fstream fin("data",ios::in);

char *web_adress[10000],*web_nick[10000],*searching;
char order[1];
int i,run=1,last_web;
int main(){
cout<<"Welcome to Robye's fast open page program , please wait while program is loading"<<endl;
for(cin>>i;i;i--){fin>>web_nick[i]>>web_adress[i];}
last_web=i;
cout<<"Loading Complete"<<endl;
cout<<"Tipe 'h' if you're using this for the first time"<<endl;
do {
cin>>order[1];
switch (order[1]) {
case 'h' : cout<<"You have 2 basic commands : 'o' 'e' 'c'\n'open' - Open the Website\n'edit' - Edit the database\n'close' - Closes this application\n";break;
case 'o' : cout<<"Open site ";cin>>searching;
for(i=1;i<=last_web && i>0;i++){
if(web_nick[i]==searching){ShellExecute(NULL, "open", web_adress[i] ,NULL, NULL, SW_SHOWNORMAL);i=0;}
}
if(i!=0)cout<<"Page / Nickname wrong , use the 'edit' section";
if(i==0)cout<<"Page successfully loaded , Have a Nice Day !";
break;
case 'c' : cout<<"Program Closed ";run=0;break;
default : cout<<"Couldn't Find : " << order ; break ;

}

}while(run);

fin.close();
}
//ShellExecute(NULL, …
Robert1995 22 Light Poster

i don't get it

Robert1995 22 Light Poster

This should work

#include <iostream>

using namespace std;

int main()
{
	char answ;

	cout << "Yes or No(y/n)" << endl;
	cin >> answ;

	switch(answ)
	{
	case 'y': cout << "Test" << endl;break;
	case 'Y':cout << "Test" << endl;break;
    case 'N':cout << "Ok" << endl;break;
    case 'n':cout << "Ok" << endl;break;
    default : cout<<"Wrong Order"<<endl;break;
	}

	system("PAUSE");
}
Robert1995 22 Light Poster
Robert1995 22 Light Poster

This is not a 'shuffle' function. This is akin to throwing the cards at a fan and picking them up. Grab a deck of cards and study what really happens when you shuffle.

. :) i got the idea but my "shuffle" idea works & it ain't really time consuming

Robert1995 22 Light Poster

Hello,
I created a fully working progress bar for my 2D Game patcher.
I have a question,
Is it possible to have an Image painted on the progress bar?
I know its possible in VB but I wanna try it in C++. I could find any results using Google.

Thanks!

I think it's possible , I made one in visual c++ ;
Tutorial for Visual C++
Progress Bar Tutorial

Robert1995 22 Light Poster

The way I understand the problem, the array does not have to have 10000 elements -- 10000 is just the maximum value that any one element may contain. In otherwords you have to generate an array that contains N elements (allocate with new operator), the value of each element is randomly selected between 0 and 10000.

After you find out the value of N, allocate an array of N integers then populate it with values between 0 and 10000. You can use array[i] = rand() % 10000; in a loop.

After that, you need another loop from 0 to Q. In that loop you need to generate another random number between 0 and 10000 then try to find that number in the array.

Of course, I could be all wrong about the problem too :)

I got it :)! similar to your idea , i got it all wrong in a place thanks :)

Robert1995 22 Light Poster

Erm what you want your program to do ?

Robert1995 22 Light Poster

Hello , I have tried several ideas , times and ways to do this but all fail on the site's test , could any1 give me an idea or something
Problem

#include <iostream>

using namespace std;
long int q,n,i,point,casenr;
long int marbles[10000];
int main (){

    while(1==1){

          cin>>n>>q;casenr++;

          if(n==0 && q==0)break;
          if(casenr!=1)cout<<endl;
          cout<<"CASE# "<<casenr<<":";

          for(i=1;i<=n;i++){
              cin>>point;
              if(marbles[point]==0)
                 marbles[point]=i;

              }
          for(i=1;i<=q;i++){
              cin>>point;

              if(marbles[point]!=0)
                 cout<<endl<<point<<" found at "<<marbles[point]+1;

              if(marbles[point]==0)
                 cout<<endl<<point<<" not found";

          }

              /////While Ended
          }
///////End The Program
system("Pause");
}
Robert1995 22 Light Poster

I just told you .. do you want someone to do it for you?
How to check if digit ?
Just split the number for ex you've got the number 1250405 you're going to split it multiple times like this 1 2 5 0 4 0 5 then check if all digits ; if all of them where digits then the text you've entered is a valid number .
If you check this 12345E6789 you're going to split it in 1 2 3 4 5 E 6 7 8 9 when you're going to check if 'E' is a digit it will return as false ==> you're going to give the answer "no"
I just said that in a previous reply , but i think you just want some1 to make your code + you're idea is bad you're complicating a lot .

Robert1995 22 Light Poster

Read this
I think you've forgot that isdigit checks 1 char at a time . Not several chars

Robert1995 22 Light Poster

First of all put this

fclose(pfile); fclose(pfile2);

at the end ; I think that your program may work but only once , then

Does is crash? Does it melt the monitor?

You've used a good idea , searching the word in the espanol.txt then you showed the same line from quechua.txt . The program has to work .
Obs :
bandera never changes , for ex if it was once 1 , it will be 1 forever ==>

if (bandera==0)
          {
           cout<<"no se encontro la palabra buscada"<<endl;
           }

will not work .
Hope this helped

Robert1995 22 Light Poster

Well , don't think a lot of people would be pleased for me telling you this but , I've done a similar card game , Black Jack

How to make the pack;

#include <iostream>

using namespace std;
// Show the cards
void display(long cards[53]){
  int i;
  for(i=1;i<=cards[0];i++){
      cout<<cards[i]<<" ";
    }
     
}

int pack(long cards[53],int number_of_colors,int min_value,int max_value){
    int i=0,color,cardcounter;
      for(color=1;color<=number_of_colors;color++){
         for(cardcounter=min_value;cardcounter<=max_value;cardcounter++){
                  cards[++i]=cardcounter*10+color;              
              }         
         }          
     cards[0]=i;    
    }
//And a shuffle system 
void switch_with_last(long cards[53],int pos){
  long aux; aux=cards[cards[0]]; cards[cards[0]]=cards[pos]; cards[pos]=aux;   
}
int shuffle(long cards[53]){
    int i,shuffles;
    srand(time(NULL));
    for(shuffles=1;shuffles<=500;shuffles++){
       i=1+rand()%cards[0];
       switch_with_last(cards,i);
      }

}
long card_pack[53];    
int i;
int main(){
// pack(card_pack,how many colors , smallest card , highest card )
        pack(card_pack,4,2,14);
        shuffle(card_pack);
        display(card_pack);
        }

Well i consider making the game will be a lot easier , you just have to make a calculating system for the points , good luck & have fun making the game

Robert1995 22 Light Poster

Well i honestly think that Code Blocks is the most kickass program honestly .

Robert1995 22 Light Poster

really want to see the poster's face when he will get up in the morning and won't see his homework made

Robert1995 22 Light Poster

To be able to do this you have to study 2 simple things :
1.Read this site http://www.cplusplus.com/doc/tutorial/classes/
Okay after you done that try understand what this program does ( it's not your homework , just random program to show classes)

/*
Assigment : using classes make a program to calculate gcd (Greatest_common_divisor)
*/

#include <iostream>

using namespace std;

int a,b;

int Show(int b){
    // showing the answer
    cout<<"Answer : "<<b;
}

int Calculate(int a,int b){
   // I am going to calculate the gcd
    int r;
     for(r=a%b; r; a=b, b=r, r=a%b);
  Show(b);
}

void Read(){
     //reading numbers
     cout<<"Enter Numbers ";
     cin>>a>>b;
     Calculate(a,b);
}

int main(){
    //Making It Happen;
    Read();
}

Part 2 ;
Searching in string ;

What is a string ?

String objects are a special type of container, specifically designed to operate with sequences of characters.
Unlike traditional c-strings, which are mere sequences of characters in a memory array, C++ string objects belong to a class with many built-in features to operate with strings in a more intuitive way and with some additional useful features common to C++ containers.

More Info at http://www.cplusplus.com/reference/string/string/
How to search in a string ?
Read this :
http://www.cplusplus.com/reference/string/string/find/

Hope this helped .. I kinda did your homework .:-/ . Hope didn't do something wrong again

jephthah commented: we don't do slacker's homework -1
Sodabread commented: To help fix Jeph's booboo =) +1
Salem commented: To help fix Jeph's booboo =) +20
Robert1995 22 Light Poster

Don't misunderstand, it's okay to post up code for the OP, but don't make it so complete/accurate that they can simply cut/paste it. It is better to post something similar that properly demonstrates a beneficial concept.

Okay i will remember that