rotten69 20 Posting Whiz

Hey everyone,

I'm using sessions in my application which retrieves the questions and answers asked by users. The tricky part here is how I can know how to allow users that they can edit and delete their own posts.

As far as it is concerned, I have got this idea down. If session is registered, then show users the edit and delete control buttons. But this means that they can delete and edit other people posts as well which I'm trying to prevent.

rotten69 20 Posting Whiz

Yeah. However, if I use google source for jquery, it works fine in terms of behaviour. I want to apply jquery to specific things on my website not all elements. Can I do that?

rotten69 20 Posting Whiz

I want to understand how it actually works. Does the outter foreach get executed first so after it is done, the inner gets executed?

rotten69 20 Posting Whiz

Cheers for the answer

rotten69 20 Posting Whiz

Will that display the comments for a particular question in this format?

--> Question1

  • Comment One
  • Comment Two
  • CommentThree
  • Etc..

I will definitely try it. That'd be helpful if you were to explain nested foreach loops. I want to understand how it works. Try to use simple arrays of names or numbers just to avoid confusion.

rotten69 20 Posting Whiz

Hi everybody,

I'm wondering where I went wrong. The idea is I'm trying to get data from the database and display in this format

Question 1:
Answer:
Answer:
Answer:
Answer:

Question 2:
Answer:

Question 3:
No answers
etc..

foreach($posts as $post){
          $id = (int)$post['id'];
          $comments = get_comments($id);
        //getting the answers
        foreach($comments as $comment){
        echo "<h1>" .$post['title'] ."  id:" .$post['id'] ."</h1>";
        echo $post['body'] ."<br/>";
        echo "  <small>Asked at " .$post['date_published'] ."</small>";
        echo "<br/>";
        echo "<br/>";
        echo "<strong> <div>";  
        echo  $comment['body'] ."<br/>";
        echo "Answered by " .$comment['answered_by'] ."</br>";
        echo "<small>" .$comment['date_published'] ."</small>";
        echo "</div> </strong>";

      }
}

Thank you so much in advance. It would be good to give a brief explanation with examples of how Nested foreach loops work.

rotten69 20 Posting Whiz

Hi everyone,

Has anyone had this issue that I'm having ATM? It is about getting the website to function properly using jQuery for mobile for UI. OK. When I added jQuery for mobile in the files, the behaviour of my websites is changing. It basically makes the website not function properly or as expected. Is there anything that I need to configure>?

rotten69 20 Posting Whiz

I had a look at the example you mentioned here. And also, I tried passing the data to series like shown in the example but nothing worked. I'm getting sick of workin out how the highcharts takes data. Please anyone here keen to help?

rotten69 20 Posting Whiz

My first posty wasn't meant to tell you I'm using highstock charts. In facts, I'm using a highcharts pie chart which I couldn't pass the live data to. Here is the actual code. I'm fiddling with the examples given on their website.

function getData(){
            $.ajax({
                   url:'ajax.php',
                   success: function(data){

                                var series = chart.series[0],
                                    shift = series.data.length > 20;

                                     chart.series[0].addPoint(data, true, shift);

                                    // call it again after one second
                                    setTimeout(getData, 1000);    


                   },
                     cache: false  

            });
        }
                var chart;
                $(document).ready(function() {

                    chart = new Highcharts.Chart({
                        chart: {
                            renderTo: 'container',
                            plotBackgroundColor: null,
                            plotBorderWidth: null,
                            plotShadow: false
                        },
                        title: {
                            text: 'Number of users per game'
                        },
                        tooltip: {
                            pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                            percentageDecimals: 1
                        },
                        plotOptions: {
                            pie: {
                                allowPointSelect: true,
                                cursor: 'pointer',
                                dataLabels: {
                                    enabled: true,
                                    color: '#000000',
                                    connectorColor: '#000000',
                                    formatter: function() {
                                        return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                                    }
                                }
                            }
                        },
                        series: [{
                            type: 'pie',
                            name: 'Browser share',
                            data: [
                                ['Firefox',   45.0],
                                ['IE',       26.8],
                                {
                                    name: 'Chrome',
                                    y: 12.8,
                                    sliced: true,
                                    selected: true
                                },
                                ['Safari',    8.5],
                                ['Opera',     6.2],
                                ['Others',   0.7]
                            ]
                        }]
                    });


                }); 

I'd appreciate the help if someone has used them and would be happy to show how to extract the JSON data into jquery and let the graph generator make a graph based on the data passed to it. I feel like I ain't making much use of their API's.

rotten69 20 Posting Whiz

a link will do, man. I'm trying to get the values using ajax or getJSON methods in jquery but nothing works for me or probably not sure how to use them right.

rotten69 20 Posting Whiz

Hi everyone,

I'm sure there are people who are using highCharts framework. I'm having a trouble passing the values to jquery code from PHP json. Your help is so appreciated.

This is my php section

<?php
        header('Cache-Control: no-cache, must-revalidate');
        header('Expires: Mon, 01 Jan 2013 00:00:00 GMT');

        // The JSON standard MIME header.
        header('Content-type: text/json');



        include('mysql_connector.php');
        $port = new MySqlDatabase();
        $port->connect('root','','theants');


        $query = "select * from userss";
        $result = mysql_query($query);


        $array = mysql_fetch_assoc($result);
        $jsonData = json_encode($array);

        echo $jsonData;

?>

This is my jquery section

$.getJSON('ajax.php', function(jsonData){

                                    $.each(jsonData, function(key, value){

                                        chart = new Highcharts.Chart({
                                            chart: {
                                                renderTo: 'container',
                                                type: 'pie'
                                            },
                                            title: {
                                                text: 'User Ages'
                                            },
                                            xAxis: {
                                                categories: ['0-9', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79'],
                                                title: {
                                                    text: 'Age group'
                                                }
                                            },

                                            tooltip: {
                                                formatter: function() {
                                                    return ''+
                                                        this.series.name +': '+ this.y +' user(s)';
                                                }
                                            },
                                            plotOptions: {
                                                bar: {
                                                    dataLabels: {
                                                        enabled: true
                                                    }
                                                }
                                            },
                                            legend: {
                                                layout: 'vertical',
                                                align: 'right',
                                                verticalAlign: 'top',
                                                x: -100,
                                                y: 100,
                                                floating: true,
                                                borderWidth: 1,
                                                backgroundColor: '#FFFFFF',
                                                shadow: true
                                            },

                                            series: [{
                                                name: 'No. of Users',
                                                data: []
                                            }]
                                        });


                                    });
                            }

            );

I just want to get the values from the function "function(key,value)" and I am not concerned about the key. Quick example/examples will do for now.

rotten69 20 Posting Whiz

Yeah, respect to all who contributed in this thread. Although, I think it is so annoying that every time I post something, I get the message alerting me if I want to share my post on other websites. Consider giving your users options if they want to disable the feature or not.

rotten69 20 Posting Whiz

Hey everyone,

I'm learning how to use cakePHP framework. I'm just wondering that how one gets so familiar with a bunch of API's quickly. Do people memorise them at all? I ain't going to because I don't see the point in memorising some things that I even won't need to use ever. What is the best way to go about familairising myself with new API's?

Cheers!

rotten69 20 Posting Whiz

Let us know what we can help you with. are you askin us for an industry project or a fun project to work on during a holiday?

rotten69 20 Posting Whiz

That sounds good. I should be up for it if it will be on in Nov/Dec.

rotten69 20 Posting Whiz

@rubberman, since you're open about your experiences in life, I want to ask you a question. How did you become an engineer without having a tertiary degree? Because there're things that we learn from life but we dont get them taught at uni and vice-versa. I guess Uni is a way of introducing things to us then we do the hard work to build up our knowledge!

rotten69 20 Posting Whiz

Ok. You're asking about two completely different programming languages. A few things to know about them are if you master your java skills, then you can:
1-make computer apps and software that run on any platform like windows, Linux and Mac as long as you have the JRE(java run environment) installed.
2-make android apps.
3-learn java easily and smoothly by practising to code and reading to understand fundamental concepts Java is a lot more easier to understand compared with objective-c which you'd essentially use to develop iOS apps.
4- be able to understand other programming languages such as PHP as Java is an object-oriented language. I'm talking from experience.

Yes, you can run Mac OS on your windows. Download a virtual machine box and install whatever OS you want in there. My suggestion would be to look at other alternatives like using web technologies to develop cross-platform apps!
MoSync is pretty cool. its an sdk that lets you develop cross -platform apps.
it's worth looking at it!

Hmmmm, I don't know why your school uses command line to teach you Java. You should ask them! I think they want you to get familiar with command line and be able to run java classes in there.

Good luck!

rotten69 20 Posting Whiz

I haven't been able to contribute in this forum myself because I'm pretty busy with uni stuff. Although, I will be getting on holidays in about 6 weeks or so. Then, I will have enough time for Java. I only think without offence to anyone here that development in java is kinda slow. By the way, I don't live where you're living so I wouldn't know if it is a holiday season or not.

rotten69 20 Posting Whiz

Never worked out the abbreviation NaN. Thanks for the answer and the thread needs to be closed and solved.

rotten69 20 Posting Whiz

Checking for values if they're Nan. What's nan by the way?

rotten69 20 Posting Whiz

What are the things that you're struggling with? By the way, the title of the thread is NOT relevant to the body!!!!! Why is that?

rotten69 20 Posting Whiz

hahaha. What is worse is if you're a student doing a group project with a bunch of fellow students and one of them sees your posts! In the meeting, you pretend being the smart guy knowing everything!! hahaaha

rotten69 20 Posting Whiz

I un-installed and then re-installed it

rotten69 20 Posting Whiz

Thanks for the answer. I thought it is too ridiculous to lose 50 or 70 GB of the hard drive size.

rotten69 20 Posting Whiz

@sunny .. I watched YouTube videos on phoneGap. Would I be able to integrate a php MVC-based framework? How can I publish my app? and to where?

rotten69 20 Posting Whiz

Keep on going with the good work!!

What is it supposed to mean??

rotten69 20 Posting Whiz

Does that mean every time I format my hard disk, it will lose 9%, according to your figure, of its size?

rotten69 20 Posting Whiz

Hi everyone!

My questions for the day are: Has anyone here used Wakanda studio/server to make a native app for smartphones? if yes or know anything about it, Give us an insight please.

Do you know any free and easy to use studio that lets you develop native apps using web technologies like HTML5, javascript, php?

Thank you.

rotten69 20 Posting Whiz

I think you'd have to also type the port number after the localhost address. E.g http://localhost:8080 after you start tomcat.

rotten69 20 Posting Whiz

Hey everyone,

I'm developing a web app for iPhones and hopefully, it can be rendered using an android device as well. I'm using HTML5, jQuery for mobile and cakePHP. Is there a way that I can convert my code to some other code that will produce a hybrid app?

I'm using a persistent footer which is static and doesn't move. I'm happy with it but the issue is that iPhones have a small screen and it is taking a little of space. So, what I want to be able to do is to remove the browser footer if that is possible? and I want my web app to be redered as a native iOS app.

I'm open to every creative suggestion.

rotten69 20 Posting Whiz

Hi everyone,

When I purchased my hard drive, its size was 1TB. Iformatted it a few times and I don't know why and how it has lost 70GB. Is there a way that I can get it back up to its original size?

if yes, Will I be able to do the remove operation on it while it is plugged in?

rotten69 20 Posting Whiz

No you can't edit PDF files using a text editor like notepad++. Microsoft office word makes pdf files but I think it doesn't read/edit them. My suggestion for you is to download adobe acrobat x pro to edit your pdf files. You don't need to purchase it if you don't want to because there is always a way of getting a software for free. ..

Good luck

rotten69 20 Posting Whiz

Where are our Java gurus? And the people who have promised us some fantastic projects?

rotten69 20 Posting Whiz

I hear you man it sounds like it's a tough assignment for you. Ok. I will give hints but I ain't too sure how fluently you speak the language (java) or even understand it. For the first program, think about the variables that will store the values you need for the program. E.g purchase price/prices, return on investment..etc. Think about their datatype.

for the second, you'd have an array of strings(if you're asking users for a multiple of strings) or a variable for one string and to do the other things. you'll have to use a method in the string class called substr. Look it up in the documention.

Is the assignment just for fun?

rotten69 20 Posting Whiz

I believe it does. The way you defined is inside a
function which means it's a local variable and the only place you can use it is within the function that it's defined in. You need to have a global variable which you can access and change its value anywhere within your program. define the variable outside of your function and use it anywhere.

rotten69 20 Posting Whiz

Hi everyone,

I had Oracle working perfectly fine and was able to connect to 127.0.0.1/apex . After a fresh re-install, I couldn't access the page. I can manage to log into oracle database by using SQL command line. I'm running Oracle 11g express edition.

The message I get when I try accessing the above url is this:

Bad Request
The HTTP client sent a request that this server could not understand.

I'd appreciate your help sooner than later because I have to get my uni assignment done using oracle db.

Thank you.

rotten69 20 Posting Whiz

Hi there,

I've lost my password and username and am trying to log in using sysdba.

It doesn't log me in and I would like to retrieve my username and password without re-installing the software. IS there a way of doing that?>

rotten69 20 Posting Whiz

I solved it. I don't know how case-sensetive oracle is. I'm sure I had the same command this morning but it gave an error message "the line is not properly ended!!"

rotten69 20 Posting Whiz

Lucky you.

rotten69 20 Posting Whiz

Do you have any particular reasons for using Xampp and not Wamp? I think Wamp shouldn't give any errors and it is really handy to install.

In response to your question, Did you change anything in the phpmyadmin at all?

rotten69 20 Posting Whiz

Hi everyone,

It is just a really serious concern about a feature. Everytime I post a thread, I'm asked to share it on social media networks. It is really irritating. My message to the Daniweb management is that if you want to keep this feature then let users "us" to have our choice remembered all time rather than alerting us.

I would love to hear what others think about this.

rotten69 20 Posting Whiz

Hi everyone,

I'm sure the update statement is well-written but for some reason Oracle sql command line is refusing to execute it.

UPDATE myTable SET country = 'Aus' WHERE username = '"martin"';


// I know you can see single quote and double-quote as well. Well, names were inserted into the table with double-quote ==> as "john"
rotten69 20 Posting Whiz

Ubuntu is the solution. I switched my ubuntu OS on and pluggged the HD into my laptop. I could manage it easily hopfully. I will be doing it tonight. Thanks guys for the links as I will use them in the future.

rotten69 20 Posting Whiz

the problem is the body of the if-statement gets executed which I don't want to happen.
I'm only checking if it is not a number then execute the if-statement body. Else, Go to the next condition.

rotten69 20 Posting Whiz

Thanks for the links. I havent tried them though. I will when I get the time.
it is just that the hard drive isnt recognized.

rotten69 20 Posting Whiz

Hi everyone,

I just found something interesting in my code but I ain't sure why JavaScript.

var input= 0;  // But in my case, the input variable is getting the value from a field in a form

if(!Number(input)){

    document.write('it is not a ZERO');
}

This is something similar to my code.

Cheers,

rotten69 20 Posting Whiz

I seriously don't want to lose a one TeraByte hard drive. I don't care if I lose the data.

rotten69 20 Posting Whiz

yes, it did work fine before I made the mistake of partitioning the c drive. To connect it to the laptop, I used a USB connector. I managed to connect the old hard drive but not the faulty one.

rotten69 20 Posting Whiz

Hi there,

Just wondering if there is a way of inserting tuples into a table without specifying the primary key id.

insert into myTable (username, password) values (value1, value2);

Ok. When I use the above mentioned statement, it complains about duplicate keys. Anyone know why? shouldn't the key be generated automatically?

Thank you.

rotten69 20 Posting Whiz

@caperjack.. I connected the hard disk to my other laptop and I couldn't see the partitions at all. More to the point that the hard disk wasn't recognised. What does that tell me? it is faulty and useless?