Stefano Mtangoo 455 Senior Poster

Cool, case closed

Stefano Mtangoo 455 Senior Poster

Have you tested it? I can mark it if you testify. Otherwise I need to go and test and re-post the problem if any
Hope you understand what I mean

Stefano Mtangoo 455 Senior Poster

What error does it give (whole error)?
I'm not having any server to try so I just user a theoretical. I guess I needed to put \\ instead of \
Try this:

$myfoldername = getcwd()."\\MyBackups";//your folders name 
$handle = fopen("$myfoldername".'db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
Stefano Mtangoo 455 Senior Poster

Thanks, I will implents it once I reach at home.
Thanks

Stefano Mtangoo 455 Senior Poster

try something like this

$myfoldername = "backup";//your folders name 
$handle = fopen(getcwd()./.$myfoldername.'db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
Stefano Mtangoo 455 Senior Poster

try something like this

$myfoldername = "backup";//your folders name 
$handle = fopen(getcwd()./.$myfoldername.'db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
Stefano Mtangoo 455 Senior Poster

Hi Guys,
I want to be generating random quote of the day.
I want it to be so random and not repeating itself the same quote
What is the trick (If code exclude simple db stuffs like mysql_connect et al)

Thanks

Stefano Mtangoo 455 Senior Poster

You should have read the intro as well as comments before copying the code. To help you it says: This program uses the Python win32 extension module

Stefano Mtangoo 455 Senior Poster

If you change your idea and use wxPython, I will be glad to help you from the ground up. Many here are wxPythoners ;)

Stefano Mtangoo 455 Senior Poster

ok ok ... sorry mate .. yeah you have tried to help, but i didn't see it as a 'tkinter' issue ... just an moving of output issue which i couldnt' define with the correct 3 to 4 words.

Its ok, but control your temper. you might end kicking your IDE ;)

Stefano Mtangoo 455 Senior Poster

Thanks alot,
I will check them very soon!

Stefano Mtangoo 455 Senior Poster

How Weird .. it was google that bought me here.

I wasn't happy with that link, i dislike people who do that, i do google, but knowing what to google in this case was the issue, and even with your clever reply, i didn't see the answer to my problem.

:(

Hi Ivan,
didn't I said that I don't know anything about TkInter? What else could I do than searching something that is near to what I thought you need?

If It was wxPython I would help alot, but I don't know anything about TkIntering. Anyway what did specifically choke you you? Didin't I show you what I specifically thought is the best from the links google provided????

Stefano Mtangoo 455 Senior Poster

Netbeans... It may be good for Java but I wouldn't recommend using Netbeans for php unless you find php terribly hard. Instead use a php text editor (Not IDE) and things will be a lot simpler as php has a great debugging system as it is.

Have you checked aptana studio? It is great!
I agree with you on not using IDE, but I will add if you are dealing with small project. For big projects, IDE is unavoidable or it will cause many unnecessary headaches. Be careful in choosing IDE though ;)

Stefano Mtangoo 455 Senior Poster

did you tell NetBeans to create that file for you while creating new project? Yes Check for existence of that file. But adding file and naming it index.php will do the job!

Stefano Mtangoo 455 Senior Poster

check this
and specifically this
Put final result of size to your lablel
Not TkInter expert though

Stefano Mtangoo 455 Senior Poster

Mhh... I forgot TKinter at the time I dicovered wxPython. I haven't even written single GUI program in TkInter. So I guess I can't be of great help here. But In wxPy there is method called SetValue you will have a label and then Call its setvalue to set its display value. I guess TkInter have something simiral

Stefano Mtangoo 455 Senior Poster

Thanks a lot. Your explanation makes sense and it is invaluable help!
I really appreciate. However, I have a question here. How can I bind my frame's menu item to a method?

Stefano Mtangoo 455 Senior Poster

What really annoys me is how some IDEs have really bad color syntax highlighting. I just can't stand it. I also hate the really old and gray look.

Not with the improved Wing IDE. It is best in syntax highlighting and code completion without forgetting debugger. It have many themes If you don't like windows/Linux's default

Don't take me at my word. Just download trial version and test Yourself. I use Personal Ed.

Stefano Mtangoo 455 Senior Poster

Wondering, the answer given is in bytes which is a HUGE number even for a small 160gb drive and hate the see if i run this from my 1.5tb drive ... so what would i need to do to change the output to say rounded megabytes (1601mb),

Use this calculation
1024Bytes = 1Kilobyte
1024x1024Bytes = 1Megabyte
1024x1024x1024Bytes = 1Gigabyte
and so on...

or even gb with a decimal point or two(160.01gb).
Thankyou both.

use

print "The Free Disk Space is %.2f" %(my_decimal_value_of_space, )
Stefano Mtangoo 455 Senior Poster

@Thompson,
May be you need to go back to yur wing and update it. It is being updated and tweaked and now it is better! I have it and is the default IDE for my project. I really recommend it. It is worth a price.

I'm thinking of getting pro version in future ;)

Stefano Mtangoo 455 Senior Poster

Hi Developers
Most of the time I'm free, I off the internet. I would like to learn Ajax and JQuery offline. Can someone point me good offline tutorial/free legal book for download?

I have googled a lot and downloaded many PDF which are confusing to the beginner at best, and useless at most

Thanks

Stefano Mtangoo 455 Senior Poster

Hi all,
please help me connecting exit menu to OnExit event handler
Here is what I have coded so far!

Also a coding question: What is the best method between these two:
1. Creating instance of JFrame and call its methods like set Size
2. create class that extends JFrame and override the methods with mine

Thanks a lot

package learnswing;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.*;

public class MainJava{
    public static void main(String[] args){
        Frame test = new Frame();
        test.MakeFrame();
    }
}

class Frame{
    public void MakeFrame(){
        JFrame frame = new JFrame();
        //make menu
        this.MakeMenu(frame);
        frame.setSize(300, 200);
        frame.setTitle("Iam JFrame");
        frame.setVisible(true);
    }

    private void MakeMenu(JFrame fr){
        //declarations
        JMenuBar menubar;
        JMenu file, help;
        JMenuItem openfile, exit;
        JMenuItem about;
        //create menu
        menubar = new JMenuBar();

        //file menu
        file = new JMenu("File");
        //add components
        openfile = new JMenuItem("Open...Ctrl+O");
        openfile.setMnemonic(KeyEvent.VK_O);
        file.add(openfile);
        exit = new JMenuItem("Exit...Ctrl+Q");
        exit.setMnemonic(KeyEvent.VK_Q);
        //tie to action
        //exit.addActionListener(this.OnExit());
        file.addSeparator();
        file.add(exit);
        //ad them to menubar
        menubar.add(file);

        //help menu
        help = new JMenu("Help");
        //add components
        about = new JMenuItem("Help...Ctrl+H");
        about.setMnemonic(KeyEvent.VK_H);
        help.add(about);
        //ad them to menubar
        menubar.add(help);

        //set menubar
        fr.setJMenuBar(menubar);
    }

    private void OnExit(ActionEvent evt){
        System.exit(0);
    }
}
Stefano Mtangoo 455 Senior Poster

You used an inner join after the where clause..

Thanks :)

Stefano Mtangoo 455 Senior Poster

The first query was for purpose of testing limit
The second one is the actual query

Thanks guys

Stefano Mtangoo 455 Senior Poster

That completed the solving of this headache
Thanks all of you guys!

Stefano Mtangoo 455 Senior Poster

This works :)
What was wrong with mine?

Stefano Mtangoo 455 Senior Poster

You are comparing a Scanner object with a String object.

I thought scanner object returns a string (assumption from printing hello world) :shock:

So what can I do to compare what user enters with string?

Stefano Mtangoo 455 Senior Poster

here it is

package mtangoo;

import java.util.ArrayList;
import java.util.Scanner;

public class MainClass {
    public static void main(String args[]){
    Listed lst = new Listed();
    lst.testArrayList();
}
}//end class

class Listed{
    public void testArrayList(){
        Scanner getValues = new Scanner(System.in);
        ArrayList<String> peopleList = new ArrayList<String>();
        //looping
        while (true){
            System.out.println("Please Enter the Name:");
            String name = getValues.nextLine();
            peopleList.add(name);
            System.out.println("Continue? n to end ");
            if(getValues.equals("n")){
                break;
            }//endif
            else{
                continue;
            }
        }

        //loop finished
        for(int i = 0; i<peopleList.size(); i++){
            System.out.println(peopleList.get(i));
        }

}
}//end class
Stefano Mtangoo 455 Senior Poster

Yes I have done that but problem is still there

Stefano Mtangoo 455 Senior Poster

Any one to help? I fail to compile and it gives above error! I do not know what is wrong, or even decode the message. Google didn't help much. Please bear with me if i'm not expressing well. Just point out and will re explain in any other way

Thank you!

Stefano Mtangoo 455 Senior Poster

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN vitabu ON kiswahili.Book=vitabu.Book LIMIT 31' at line 1

public function getswachapter($book, $chapter){
	//SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;
	//remember to sanitize inputs
	$sql = mysql_query("SELECT * FROM kiswahili WHERE Chapter = '{$chapter}' AND Book = '{$book}'")or die(mysql_error());
	$limit = mysql_num_rows($sql);

	$query = "SELECT  kiswahili.Chapter, kiswahili.Verse, kiswahili.Scripture, vitabu.Name FROM kiswahili  WHERE kiswahili.Chapter = '{$chapter}' AND kiswahili.Book = '{$book}'  INNER JOIN vitabu ON kiswahili.Book=vitabu.Book LIMIT {$limit} ";// INNNER JOIN  vitabu ON kiswahili.id = vitabu.id
	echo $query;
	$res = mysql_query($query) or die(mysql_error());
	return  $res;
}
Stefano Mtangoo 455 Senior Poster

yeah I probably will, thanks for the help though!

glad to help :)

Stefano Mtangoo 455 Senior Poster

I have afunction to retrieve data and it gives error.
Please correct me!

public function getswachapter($book, $chapter){
			//SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;		
			//remember to sanitize inputs
			$sql = mysql_query("SELECT * FROM kiswahili WHERE Chapter = '{$chapter}' AND Book = '{$book}'")or die(mysql_error());
			$limit = mysql_num_rows($sql);
		    
			$query = "SELECT  kiswahili.Chapter, kiswahili.Verse, kiswahili.Scripture, vitabu.Name FROM kiswahili  WHERE kiswahili.Chapter = '{$chapter}' AND kiswahili.Book = '{$book}'  INNER JOIN vitabu ON kiswahili.Book=vitabu.Book LIMIT {$limit} ";// INNNER JOIN  vitabu ON kiswahili.id = vitabu.id 
	        echo $query;
			$res = mysql_query($query) or die(mysql_error());
	        return  $res;
	    }
Stefano Mtangoo 455 Senior Poster

Thanks alot Sir! It helped me fix alot.
The program now runs but it keep asking names and even when I press 'n' it continues. How to break out of the loop when user presses n?

Thanks buddies

Stefano Mtangoo 455 Senior Poster

is there anything wrong with my ArrayList?

Stefano Mtangoo 455 Senior Poster

please help me with this error:
obj\Release\main.o:main.cpp:(.text+0x1c)||undefined reference to `__imp__CreateCWMp3@0'|

what is missing?
I'm trying to compile this

Stefano Mtangoo 455 Senior Poster

moved this to codeblocks

Stefano Mtangoo 455 Senior Poster

line 16

Stefano Mtangoo 455 Senior Poster

But If I write hello world program and run it, all goes well. Also eclipse complains there is ''Syntax error on token ";" , { expected after this token"

So what is that? As far as I can see, all is fine.

Stefano Mtangoo 455 Senior Poster

So what should I do? I use easy eclipse

Stefano Mtangoo 455 Senior Poster

Thanks I will check :)

Stefano Mtangoo 455 Senior Poster

I see,
but I suggest you download it somewhere, check integrity of file and if all is well replacing files with updated. I guess your files will get corrupted if urllib2 fails while updating

Stefano Mtangoo 455 Senior Poster

Have you checked Wing IDE? It does have code completion, but you need some $$$ ;)
I think Pydev does a good Job as does Pyscripter. May be they are not as advanced as you define.

Vega's question is good start

Stefano Mtangoo 455 Senior Poster

I changed the code to match as per sciwizeh but still persists. Here is the error (I use easy eclipse by the way)
Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at mtangoo.MainClass.main(MainClass.java:7)

Stefano Mtangoo 455 Senior Poster

Hi,
I have done this code to learn ArrayList. I keep getting errors. Basically I want to accumulate names in list and when user types 'n' at prompt, it prints out names. What is wrong?

package mtangoo;

import java.util.ArrayList;
import java.util.Scanner;

public class MainClass {
    public static void main(String args[]){
        Listed jobject = new Listed();

    }
    Listed lst = new Listed();
}

class Listed{
    Scanner getValues = new Scanner(System.in);
    ArrayList<String> peopleList = new ArrayList<String>();
    //looping
    while (true){
        System.out.println("Please Enter the Name:");
        String name = getValues.nextLine();
        peopleList.add(name);
        System.out.println("Continue? y/n");
        if(getValues.nextLine()=="n"){
            break;
        }//endif
        else{
            continue;
        }
    }

        //loop finished
        for(int i = 0; i<peopleList.size();i++){
            System.out.println(peopleList.get(i));
        }

}
Stefano Mtangoo 455 Senior Poster

Hi all,
I use codeblocks to compile a simple project (actually an example) from http://www.inet.hr/~zcindori/libwmp3/libwmp3.html#playc++. I have included the .h file and I fail to include .lib/.a

I keep getting error ld.exe||cannot find -libwmp3|

Is there a missing thing?

Stefano Mtangoo 455 Senior Poster

If you feel confidence enough, write Eliza program

Stefano Mtangoo 455 Senior Poster

You can configure the Python path in project settings.
Just click the other radio button than default and will give you a file browser button and point to your python.exe

Stefano Mtangoo 455 Senior Poster

As I see it, it is a bit complex for the task
you could put a text with three lines
let say this is a server text (serv.txt)

version = 0.1
state = stable
files_to_update =

Then use urllib2 to retrieve that data and update your program. You could use dictionary of filename:file url instead of the above list

Just my 2cents

Stefano Mtangoo 455 Senior Poster