ajoo
Members-
Posts
871 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ajoo
-
Hello Guru Barand ! While the result table is great it does not produce the values I want. I wanted that this table be considered as the complete and only table for which the rolling averages needed to be found. So for your result table the values that I was looking for in the av5 columns should be as below. (I have changed the av5 values that I am looking for) +-------+----------+---------+----------+--------+ | recno | user | v_score | reccount | av5 | +-------+----------+---------+----------+--------+ | 9 | mina1111 | 4 | 5 | 4.0000 | | 10 | mina1111 | 5 | 6 | 4.5000 | | 11 | mina1111 | 0 | 7 | 3.0000 | | 12 | mina1111 | 1 | 8 | 2.5000 | | 13 | mina1111 | 1 | 9 | 2.2000 | +-------+----------+---------+----------+--------+ The following query gives me the table I want but since it is a temp table, I am unable to open it again for creating the averages. create temporary table mina1111_a Select * from ( select a.RecNo , a.User , a.V_Score from ajoo as a where User = 'mina1111' ORDER BY RecNo DESC LIMIT 5)sub Order by RecNo ASC; It gives on my table the following values:- +-------+--------------+------------+ | RecNo | User | V_Score | +-------+--------------+------------+ | 10 | mina1111 | 5 | | 11 | mina1111 | 0 | | 13 | mina1111 | 1 | | 14 | mina1111 | 1 | | 15 | mina1111 | 1 | +-------+--------------+------------+ But I am unable to use the table to get the averages. It gives the can'r reopen table error. Thanks !
-
Hi all ! i have the following table in my DB The averages are the rolling averages for 5 records at a time. If I try and get the same for only the user mina1111 using the query SELECT user.RecNo as RecNo, user.User as User, user.V_Score as V_Score, avg(user_past.V_Score) as Average FROM user JOIN user as user_past on user_past.RecNo between user.RecNo-4 AND user.RecNo WHERE user.User = 'mina1111' GROUP by RecNo, V_Score; I get the following :- The averages go all haywire. It uses the values in the original table to calculate these, hence the funny values. So how can I get the correct values like this was the table with original values. Also how can I get the values of say only the last 5 values, considering those were the only values / rows in the table. i.e. the rolling avgs of Thanks all !
-
In the absence of an expert opinion, even wrong advise looks great to an amateur. Glad that you are there ! Thanks loads for all the clarifications !!
-
Thanks Guru jacques ! I was actually referring to this article here under Method 2: but I may have misunderstood what the author is saying. Maybe what he is saying is correct and my understanding of it is wrong. You did not say anything about the 710 permission on the php scripts and such folder outside the root and so I take it that it is correct. That almost clears it. If you could also say something about the file permissions in these folders, that would be really nice. Thanks again !
-
Hi Guru Jacques , Thanks for the reply. If I read you correct then for the 1st part of my question i.e. 1. php scripts, library or included or required files containing php code. ? you suggest that the folder permissions should be 710. and for the 2nd part, i.e. 2. a folder that only contains uploaded images by the users remotely. ( Like a picture of a user on filling a form ) ? they should be either 770 or 750. ( 770 because the web-server also has to read them to display them ?) Kindly confirm that my deduction is correct. Also please shed some light on what should be the permissions for the files in these folders. Also, Guru Jacques, your answer implies that if I am logged in the machine as user master, and www-data is the web-server user and group, then the owner : group relationship for all the files should be master : www-data. Right ? If this is indeed what you meant, then I would like to ask that for a folder outside the root holding scripts and libs, which are to be accessed only by the php, and that too as read only, would the assignment www-data : www-data be more secure and should it be used? I read that for such a folder, the owner and group should be both assigned to the web-server (php) which is what I guess this (www-data : www-data) assignment is. If so, another question that arises is that, if these files need to be modified at a later time by the user master, then will the permissions have to be re defined to give the ownership back to the user master before they can be edited/modified? Is my understanding of all this correct ? Thanks loads !
-
Hi all ! What are the best permissions, on a VPS, that should be set on files and folders that contains : 1. php scripts, library or included or required files containing php code. ? 2. a folder that only contains uploaded images by the users remotely. ( Like a picture of a user on filling a form ) ? I would be grateful with suggestion and the reasoning for the same as well as who would need to own those permission. I have read quite a bit about the permissions but together with this ownership business it kind of confuses me utterly. Thanks
-
Hi kicken, Thanks for the reply. It's not that I see any point in the extra /magical folder at the end, it's just that I am trying to figure out where to place my project folder so that when I type magical.com as the URL, it should access the index.php of my project folder. . All the examples that I came across just show a index.html inside the public folder. None showed how to handle a project folder that contained the index.html and the rest of the project folders and where to place that project folder. Please show me how best to place my website / project folder in the directory hierarchy so that it may access my project's index.php when I type magical.com in the URL
-
Hi requinix, I am at a stage where I really want to check whether my website is good for a server and therefore try it out in a real development environment or as close to it. So i have to know how to get my website up and running on a server. So it was important for me to know the where and how on a server. I think you mean I don't really need to have these two - /myproject.com/public/ -folders in between. Correct ?! Please affirm. i'll head back to get the site up. Thanks !
-
Hi requinix, Thanks for the reply. You wouldn't be angry if i told you that I did? . I did, But i thought that it was also convention to have the public folder as the last in the document root. i.e. either public or public_html or html, because every search on google showed the document root to end in the public folder. So I thought it was mandatory to have the public folder there and so there was some mechanism for what I wanted. Just one thought then, what's the use of myproject.com in /vagrant/myproject.com/public. I would rather have /vagrant/magical.com/public/magical. Would that not be more logical and nicer? What do you say? Thanks again !
-
Hi kicken, Thanks for the response. Vagrant is just to set up a VM fast everytime. Once it's installed ubuntu and apache and the required software, it's role is almost over if one wants that. So it's just a ubuntu machine on a VM now. The only thing is that I get a shared folder /vagrant which maps to /var/www. i.e any changes I make to the folder /vagrant/myproject.com/public will reflect in var/www/myproject.com/public. Other than that I can configure the VM it as I like. So yes I have a virtual host configured exactly as you have shown. I have made changes to the hosts file on windows so that I can check out / try out the website on my host machine and it's working too. Yes I can create local equivalents of domain names but that's not really the issue. There is no index.html in public folder because my project, as I wrote earlier, is in a folder called Magical. Instead of putting an index.html in the public folder, I need to put my entire project in that folder. So it becomes /vagrant/myproject.com/public/Magical and to access the index.php in this Magical folder the URL becomes - http://myproject.com/magical. - which is what is odd. What I am looking for is to make whatever changes needed and where ever so that when I type http://www.magical and that should access the index.php from the said folder and display the webpage. I hope I am able to clearly enunciate my problem. Thanks for the response and looking for some more help here. Thanks loads !
-
Hi all !! I have finally setup my ubuntu linux VM on Virtual box for web development. My document root is /vagrant/myproject.com/public. which is the same as /var/www/myproject.com/public. This is the directory structure by default if i understand correct. My project folder which contains the index.php and all other files and folders is in say a folder called Magical. Now I am supposed to place my project folder at this location: /vagrant/myproject.com/public/Magical. If I now type, http://myproject/magical in the URL, the index.php inside Magical is invoked correcty and displays the webpage. However this is rather odd and not in accordance with the manner websites are normally invoked. I would like to type, just like everyone else, http://Magical.com to invoke the index.php. That would be like placing Magical in place of myproject in the folder hierarchy so that the document root is /vagrant/Magical.com/public. That seems to go against the convention and the tutorial followed. The root folder should be below the public folder. So what should I do to rectifyy this ? Do I need to change some settings in the conf files or in the placement of my folder so that I just type http://Macical.com to invoke the index.php ? Please help clarify. Thanks all !
-
Hi requininx, In all cases it simply makes an exact copy of the given file. I am using "test.txt" and it creates a "test.txt," file after the command is run but makes no string substitutions. Maybe that's what the -i is there for. Ok I got it after some more tries. This works : sudo sed -i, s,the,abc,g test.txt. It saves the original file as a copy while actually modifying the orignal file with the string substitutions.. Thanks.
-
Hi kicken and requinix, Thanks for the reply. @kicken : Yes it was me clear that it was trying to make a replacement of sorts but the command seems not to do anything. @ requinix : No this - (with "www") - does not work either. Thanks.
-
Hi all ! Can someone please explain what the following command does:- sudo sed -i s,scotchbox.local,$DOMAIN,g /etc/apache2/sites-available/$DOMAIN.conf sudo sed -i s,/var/www/public,/var/www/$DOMAIN/public,g /etc/apache2/sites-available/$DOMAIN.conf I can across these commands in here. I have tried them out in the terminal as a modified example :- sudo sed -i, s,www,the,g test.txt. where test.txt has 2 lines of some text containing the word 'the' a couple of times. The command seems to do nothing. There is no change in test.txt. I cannot get any example of sed -i, s on google. In fact i cannot get a similar example of sed anywhere on google. But then i believe sed is extremely versatile and has tons of usages. Grateful for any help. Thanks all.
-
Thank you Guru Jacques, I'll accept what you say and get back to my original VM, but just out of curiosity and a desire to learn I would be grateful if you or anyone else can shed light on my original questions ! Thanks loads !!
-
Hi Guru Jacques ! No, I don't want to clone a VM for each site. In fact I just want to use one VM for multiple sites hosting. The cloning is to create a VM so as not to disturb anything on the VM where I have hosted one of the projects successfully. I wanted to learn how to host multiple site on a VM. Hence I cloned a VM from my existing VM state so that I could then test / try out stuff on the cloned VM. Ofocurse the cloned VM does not have any vagrant initialized folder on the host machine and hence my question. Thank you !
-
Hi requinix, Thanks for that reply. I will try and understand that and implement it and try it out and revert. Meanwhile I have been thinking about this : When creating a VM using vagrant, a folder is created and vagrant init is used to initialize that folder. The project folders are the created Inside that folder. In case of cloning of VM, the cloned VM does not actually have any folder initialized on the host machine ? Would not that be required first after cloning before creating any project folders? If that is required then how to go about it. Thanks.
-
Hi all ! I recently learnt a bit of vagrant to set up a VM fast and try out things with it and one of the neat things about vagrant is that it lets me keep my project folder / website folder on the host machine and make changes to it there while I can test out the project from the VM Next I wanted to try and host another site on the same VM so instead of trying it out on the same VM, I thought it would be better to create a clone of the current state of my VM and try out things there. So I made the clone but now I don't know how to change the association of the project folder to another folder on my host machine. Earlier I did that using vagrant init in the project/website folder and that was how the machine was initialised and created and the folder association was automatically made. Now here the clone is already there and pointing to the same project/website folder and I want to change this to a new folder and try and host 2 websites from there. This is the folder in the association in the original VM. vagrant ---www---myproject It is also the same in the clone. But I would like to somehow change this to say vagrant1 ----www --- MP1 | ---- MP2 I have searched the net but to no avail. Please looking to the experts for some help here. Thanks loads !!
-
Hi requinix, Yes you are right like I found out once the xDebug worked fine. Thanks for clarifying it yet again.
-
Hi ! I found the issue. No xDebug has no limitation. It was a a configuration issue. I did not set an IDE KEY in the DBGP config. So if I set my IDE KEY to 'ide_key' then the String appended to the end of the URL should be XDEBUG_SESSION_STRING='ide_key'. That seems to fix it. Thanks all.
-
Hi all, I configured my localhost to work with Xdebug and then installed the plugins to work with note++. Everything worked fine and I got the sample two line program to work from the terminal as well as from a browser (chrome) by appending "?XDEBUG_SESSION_START=xyz" after the URL. It worked fine for small programs but for my multi-page application, the appended bit simply disappeared. I guess that's because of jumping to pages on menu clicks where the url is created depending upon the menu button being clicked. Code like : if(isset($_GET['menu_item'])) { $menu_item = fcheckPpage($_GET['menu_item']); switch ($menu_item) { case "menu1": require_once("/some/thing.php"); break; case "menu2": require_once("some/thingelse.php"); break; ... Then I tried the same on firefox by first installing the plugin for it which does not require any strings to be appended to the URL. That too got working but crashed each time at the very same place when it encountered the code shown above in the code box. These are the error messages that I got and It is clear that the the moment the application / program generated it's own url the link to the debugger is lost. Seems like a woeful limitation, I could try and append the XDEBUG... string to the end of each of the generated urls but that would not be a very pretty solution if that did work. If anyone has any suggestions or solutions or an alternative to this I will grateful. Thanks all.
-
Hi all, For other beginners who may be struggling like me to install their own dev boxes on a VM. Here is what I did to finally have a VM up and running with apache2.4.7, PHP5.6 and MYSQL5.5 UBUNTU 14.04 Go to the hashicorp sitehttps://atlas.hashicorp.com I have searched for the 1404 version and 32 bit (i-386) and so the link https://atlas.hashicorp.com/bento/boxes/ubuntu-14.04-i386 from there pick up the initialization commands there : vagrant init bento/ubuntu-14.04-i386; vagrant up Executing the first command in the terminal ( I use gitbash ) : vagrant init bento/ubuntu-14.04-i386; the vagrant box is initialized. Any changes can then be made to the vagrant file and then issue the vagrant up command at the terminal to download and install the selected disk image if not already on the local system. It takes quite some time to download and install the ubuntu image disk. If the machine does not boot successfully and gives locking errors (ERROR ACCESS or sth like that) check out http://stackoverflow.com/questions/27670076/permission-denied-error-for-vagrant. I had this error and . On the windows host machine I went into C:/users/vagrant.d/data/machine-index and deleted all files there and the machine finally booted successfully. vagrant ssh into the VM now and it should work fine. I followed this: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu to install the lamp on the ubuntu machine. INSTALL APACHE: sudo apt-get update sudo apt-get install apache2 The public ip address is given as set in the vagrantfile by the line : config.vm.network "private_network", ip: "192.168.33.10" which I had un-commented before vagrant up. browsing to this address, namely, 192.168.33.10, shows the Apache2 ubuntu default page !!!! ( Happyeeeee !!). Here I exited the VM and saved a snapshot of the machine using the command :vagrant snapshot save ubuntu14_with_apache2.4.7 Now I can safely try and install mysql and if something goes wrong, I will restore my snapshot and get to it again. INSTALL MYSQL ver 5.6 : Install using : sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql and activate using : sudo mysql_install_db The activation ended with this loooong message: To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password'; /usr/bin/mysqladmin -u root -h vagrant password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl; cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ vagrant@vagrant:~$ Continuing installation : sudo /usr/bin/mysql_secure_installation . This gives another looong list of questions the answer to most of which is “y”: Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Going on to INSTALL PHP now. Going to try and install PHP version 5.6 from Followed this: http://stackoverflow.com/questions/40567133/cannot-add-ppa-ppaondrej-php5-5-6 ( GOOD THREAD MUST READ) . The steps are: 1. sudo add-apt-repository ppa:ondrej/php 2. sudo apt-get update 3. sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip AND THE INSTALLATION ENDED WITH THE FOLLOWING : Creating config file /etc/php/5.6/mods-available/dom.ini with new version Creating config file /etc/php/5.6/mods-available/simplexml.ini with new version Creating config file /etc/php/5.6/mods-available/wddx.ini with new version Creating config file /etc/php/5.6/mods-available/xml.ini with new version Creating config file /etc/php/5.6/mods-available/xmlreader.ini with new version Creating config file /etc/php/5.6/mods-available/xmlwriter.ini with new version Creating config file /etc/php/5.6/mods-available/xsl.ini with new version Setting up php5.6-xsl (5.6.30-1+deb.sury.org~trusty+1) ... Setting up php5.6-zip (5.6.30-1+deb.sury.org~trusty+1) ... Creating config file /etc/php/5.6/mods-available/zip.ini with new version Processing triggers for libc-bin (2.19-0ubuntu6.9) ... Processing triggers for libapache2-mod-php5.6 (5.6.30-1+deb.sury.org~trusty+1) ... vagrant@vagrant:~$ GIG !!!!!!! CHANGING THE ROOT DOCUMENT TO YOUR OWN PROJECT I finally changed the default RootDirectory to my own project on the host machine. I had to make changes to the following 2 files : 1. /etc/apache2/sites-available/000-default.conf changes made and lines added: #DocumentRoot /var/www/html --------------- (commented this out) DocumentRoot /vagrant/www/myProject ------------ (used this one) and added these : <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /vagrant/www/myProject> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> 2. /etc/apache2/apache2.conf. changed to <Directory /vagrant/www/> FROM <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> Now I can make changes to my project in its's folder (/vagrant/www/myProject) on the host windows machine and that's linked to the Document Root of the VM !!!!!!!!!!!!!!!!!!!!!!!! Thanks all !
-
Hi Benanamen and Guru Jacques, Thanks again for the reply. Ok so I have finally made my own box, just like both of you suggested and after two long hours finally managed to get it working. The php version is still not 7.0 or 7.1 but it's 5.6.30 and i'll change that to 7 next as I am too tired to try it out now. I have apache 2.4.7 and mysql 5.5 i think. Will port the project next and get it working on the VM. Will also spin up a box with php 7 ( as Guru Jacques suggested) since I have a better hang of this now I think ! Vagrant allows me to work on my project from the host and that's a good thing as I have configured it to achieve that as well !! I have recorder all the steps in setting up the stack and will put all the details here, after some editing, tomorrow so that it may benefit someone else ! Thanks Benanaman and Guru Jacques !
-
hmmm can I use a 64 bit linux on my 32 bit windows machine or do i need a 64 bit windows machine minimum ? I don't know about building our own image but yes we can build our own system using vagrant but the commands for different versions of apache and php and other software are confusing. For e.g. after a searching I finally found and installed a hashicorp/precise32 machine after some hit n trial. And then it gave that error of array re-direction since it did not support. I then tried installing the box boxcutter/ubuntu1604 (32-bit) but that gave error each time i tried. Then i just gave up and tried a few more to no avail. Hence I am here !! Any and all help/suggestions appreciated. Thanks all.