Jump to content

ajoo

Members
  • Content Count

    831
  • Joined

  • Last visited

Everything posted by ajoo

  1. Hi requinix, Thanks for the reply. May I please request you to kindly show me how this is done? I have no idea of the coalesce command. I'll just try out the other one. Thanks loads !
  2. Hi all !! I have the following three data tables : mysql> select * from franch; +-----+ | fid | +-----+ | 3 | | 5 | | 7 | +-----+ 3 rows in set (0.00 sec) mysql> select * from master; +-----+-----+ | xid | mid | +-----+-----+ | 5 | 4 | | 7 | 6 | +-----+-----+ 2 rows in set (0.01 sec) mysql> select * from admin; +-----+-----+ | xid | aid | +-----+-----+ | 3 | 2 | | 4 | 2 | +-----+-----+ These are connected on common fields and I was trying to linearize the relationship between them using this query : mysql> SELECT vc.aid, vd.mid as mid, ve.fid as franch FROM franch as ve LEFT JOIN master as vd ON ve.fid = vd.xid LEFT JOIN admin as vc ON vd.mid = vc.xid; which gives the following , almost correct, output. +------------+------------+--------------+ | aid | mid | franch | +------------+------------+--------------+ | NULL | NULL | 3 | | 2 | 4 | 5 | | NULL | 6 | 7 | +------------+------------+--------------+ what I want to achieve as output is this ( difference HIGHLIGHTED in RED ): +---------+---------+---------+ | aid | mid | franch | +---------+---------+---------+ | 2 | NULL | 3 | | 2 | 4 | 5 | | NULL | 6 | 7 | +---------+---------+---------+ In the first since there is no corresponding vale for mid in the master table it produces the null value. Here there has to be a way that when such a null value is produced, the franch should check for a corresponding value in the admin table instead. Thanks all for any help on achieving this !!!
  3. Hi requinix, Thanks. The reason I thought of separating the databases was that the databases worked for different sets of people in 2 different locations. Totally unrelated. So I thought it would be best to separate them. They would also represent 2 separate, though similar, businesses maybe. Maybe with a different web-server for each too. Besides I thought the querying would be all the more complex with another factor -country -(even though completely redundant) to take care of. These are just my ideas and could be completely wrong. My experience in this is probably zero compared to yours. What are the points in favour of having just a single database? Thanks for the rest of the reply that cleared the superuser password related queries. Thanks loads !
  4. Hi requinix, Thanks for the reply. Do you suggest using the same database for all sets of people? Won't there be operational issues with that and won't that make querying the database very difficult ? Let me know your views. I have another, maybe unrelated, question question and that is how to handle the superuser for a database? I have a hierarchical structure of users who can access the database. There is however a superuser that supersedes them all. Initially I created the superuser directly into the database while all other users were created using the forms. Is that how a superuser is normally created ? Also the position of the superuser in the database is obviously 1. I was wondering if it is possible to change that id to something else like say 100 or XXXX for security reasons? However that would also conflict with the normal users when that many number of users are added. So what's the best way to handle this, if any? Thanks.
  5. Hi all ! Is it good practice to a have a separate database for a different group of people, say people in a different country. For e.g. If I run a franchisee business model in different countries, would it be a good thing to have a separate database based on the country? I was thinking of naming the database prepended by country name like USA_mydatabase, Canada_mydatabase and so on. Would that be ok ? What is the best practice in such cases. Thanks all !
  6. Hi Guru Barand !! Thanks, I got it working !! Regards.
  7. Hi Guru Barand ! A very happy new year ! Thanks for the response. Sir I have been trying to use the JOIN but I keep getting and 'ambiguous field' error.Could you please show me how it can be done? You are right about the tmp_admin table which I left out since I thought that would not be required for the answer. I do generate the tmp_admin table before this query is executed and yes the query works just fine. If you think that is relevant, I can post the query that generates the tmp_admin temporary table. Thank you and regards.
  8. Hi all ! The query below works great. However I have moved the table_1.city field into a new table, namely, table_3. $query = "SELECT xid, bb.fname, bb.lname, bb.city, bb.cell, bb.email, bb.fid, bb.cno, bb.total, bb.actic from tmp_table INNER JOIN ( SELECT table_1.fname, table_1.lname, table_1.free_id, table_1.city, table_1.cell, table_1.email, table_2.fid, table_2.cenno, count(fid) total, sum(case when scr = 'R' then 1 else 0 end) actic From table_2, table_1 WHERE table_2.fid = table_1.free_id GROUP by table_2.fid, table_2.cenno ORDER by actic DESC LIMIT ?, ? ) bb ON bb.free_id = tmp_admin.xid"; How can I change the query to incorporate this change ? i.e. I need to draw the value of city from table_3. Thanks & a very happy new year to all !
  9. ajoo

    entangled in GIT

    OK this seems to do it right: clone --depth 1 --branch <branch name> <git URL> Thanks requinix.
  10. ajoo

    entangled in GIT

    hmm it says and not that it's an Could it be that it's considering origin/<branch_name> as a path (as echoed by the message ) which it seems not to allow? Still stuck. Maybe I should just delete the copy of the repo on the server and then try and get the detached head from the repo as you suggested. What do you think ? Thanks.
  11. ajoo

    entangled in GIT

    Hi, The suggested command gives the following error : Thanks
  12. Hi all Below is an image of my git with labels. As you can see there are 3 branches and a master. I created the branch B3 from B2 and B2 from B1 but i guess for git all seem to come from the master ulimately ( I mean the trunk of the tree is common to all). The pen-ultimate commit comes from the production server. I then cloned that into my local machine where I wish to develop and test locally. That is the basic idea - to develop and test locally and then push to the repo. From there pull the changes to the server and run it there. Continue to develop and test locally and then push again to repo. Then pull the changes to the server and continue the cycle. So I made a small test change and pushed it to the repo. All is fine. However when I pull the branch into the server, it wants to merge B2 into B3 which is not what I intend to do. I just want to continue to develop along B3 and leave B2 alone where it is. Is this possible? Is there a better way to achieve what I am trying to? Thanks all.
  13. Hi requinix, I wonder what the $tmp is for ? Wouldn't he need to make changes to the code that takes care of the login as well once he uses the password_hash() ? Thanks.
  14. Hi requinix and Guru Barand ! Thanks for the reply. If you check the #1 of this thread, I had kept the two files invoke.php and Graph.php outside the root and under aboveroot. Unfortunately the graph fails to display. invoke.php uses the following bit of code to display the graph :- <?php echo "<img src='/graphs/Graph.php?caption=MyGRAPH&gd1=$data1&gd2=$data2&gd3=$data3' />"; ?> As you can see there is no way I can use "include" or "require" in this scenario. No jpg file is created or stored anywhere but it directly draws the graph which is actually convenient. However this creates another issue of sessions. I cannot bring this file, Graph.php, under a session because of the manner in which it is used. I tried adding session_start(); at the beginning of Graph.php, (which, in any case, I feel is probably wrong usage ) but that does not work since the graph fails to draw then. This means that, infact, Graph.php can be invoked and used by a user directly by passing GET data to it. Even though I don't see what harm that can cause, yet I feel that such access should be prevented if it can be ! Any comments, clarification and suggestions welcome. Thanks loads to you both !
  15. Yes I have read that ! However my concern is more for security threats that may arise by putting my code under the root than for the other benefits that come with a static host. Thanks loads !
  16. Hi requinix ! Thanks for the reply !! And what could be a security risk, if any, of keeping them on the regular host and under the document root. Thanks !
  17. Hi all ! I am pulling out this old post since there was no answer to the last thread. I really need to know, what should I do to handle some of my scripts that I feel should lie somewhere safe. Namely the script that generates the graph as mentioned in the last thread. Thanks all !
  18. Hi all ! I have been trying to automate some simple tasks using the configuration files. However, while i do not get any errors in my log files and the application is deployed successfully, the configuration files are not executed or so it seems ( else I would get an error if they failed). Here is two files configuration files that I was just trying out. 21_copy_xsendfile_conf.config: files: "/home/ec2-user/21_copy_xsendfile_conf.sh": mode: "000750" owner: root group: root content: | #!bin/bash cp scripts/activate_xsendfile.conf /etc/httpd/conf.d/ another version of the same as above ( since I was not sure which was correct ) :- 21_copy_xsendfile_conf.config: files: "/home/ec2-user/21_copy_xsendfile_conf.sh": mode: "000750" owner: root group: root content: | #!bin/bash cp scripts/activate_xsendfile.conf /etc/httpd/conf.d/ and then the 2nd config file to install the xsendfile module: 22_copy_to_conf.config: container_commands: 21_copy_to_conf: command: "/home/ec2-user/21_copy_xsendfile_conf.sh" All the config files are placed in the .ebextensions folder. Both versions of the 1st file and the 2nd file seem not to work. I do not get any error either. I am assuming that the code in these files is correct since I do not get any error either. Please can someone point what the mistake or how i may go about it. The folder structure is myprojects |-------- .ebextensions |---------- .config files |--------- project |----------index.php |---------scripts | |------ activate_xsendfile.conf Thanks all !!
  19. Hi Requinix and Gizmola, Thanks loads for your inputs. Gizmola you were right about not changing the default ownership. My permissions, as depicted in the mails above worked as is though i could not pin point the reason for their not working initially. There was probably some error on my part. Thank you both for the replies !
  20. Hi Gizmola, . That's correct and I was loth to change it. . I did find the webapp user and group there. So would the webapp user also belong to the apache group ? Else how would webapp be serving pages ! right ?! if so, doesn't that go against what was suggested by Guru Jacques in this old thread of mine in #2? Thanks loads !
  21. Hi requinix and gizmola, Thanks for the responses ! @requinix : That's correct. Actually I try out things locally on a VM ( ubuntu : www-data) and in this case I had tried the permissions on Amazon linux too (ec2-user:apache). Unfortunately I lost the VM and the EC2 instance on AWS as well since I keep trying out different things. However I had retained the permissions snapshots of my VM which I have and which I checked and confirmed that they were indeed the same as I have labelled them in my earlier replies. @Gizmola : That's the dilemma ! whether I should change the ownership and permission here or not. WWW_USER=`ps axo user,group,comm | egrep '(apache|httpd)' | grep -v ^root | uniq | cut -d\ -f 1` gives me the apache user as webapp while WWW_GROUP=`ps axo user,group,comm | egrep '(apache|httpd)' | grep -v ^root | uniq | cut -d\ -f 2` gives me a blank ! Why doesn't this show the group as webapp as does the following command? groups webapp webapp : webapp groups ec2-user wheel shouldn't webapp group too be listed by the groups command ? Why isn't there an apache group as well? So what is the right approach to change the permissions now? Thanks all !
  22. Hi requinix, Sorry for the delay. Unfortunately, I have lost my instances that ran with these permissions. I had actually run this on an ec2 instance on AWS. However I had taken their screen shots and so I can confirm that my project ran with the same ownership and permissions as above and ran great with no issues and user : apache was running as the ubuntu : www-data group. I have hunted the EB console but could not find any user webapp defined anywhere by the EB. Nor could I find any group with that name. I thought if I could find them I would have changed them there but i am quite sure the changes have to be effected via the configuration files. I am also not sure if I would need to define a user before I can make any changes. By default the user is ec2-user when I log in using putty. I wonder what's the right way and sequence to follow to make these changes. Thank you.
  23. hmm ! Are you saying that if everything is owned by ec2-user:apache, then with the values given, apache will not be able to read the scripts and includes ?? ! if so, then how come it works just great on my VM?! no issues at all there. Or am I reading your reply incorrectly? Thanks !
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.