Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. This is great to hear. At the end of the day, while ginerjm and other people here might be a bit terse at times, this site exists to help people, and it's great to hear that the advice was received and ultimately it benefitted you.
  2. It was a widget that is part of the code for the blog I used, which is named serendipity. With that said, doing a calendar widget is quite easy these days given the tremendous number available, particularly those that are related to jquery. See this for example: http://www.learningjquery.com/2015/03/14-top-calendar-and-date-picker-jquery-plugins In particular you might want to look at http://fullcalendar.io/ for your demo app.
  3. That is a good description and even in that circumstance, there is a solution for it with MySQL ... using a transaction along with a LOCK TABLE ... WRITE Of course for most systems the chance that 2 people will try and choose the exact same username at the exact same moment in time is close to nil, so it's much better simply to have the unique index/constraint on username, and handle the constraint violation error that will be thrown.
  4. Sometimes you miss the forest for the trees. See Pika's comment. This will start a php block: <?php This won't <php
  5. Check out vagrant/virtualbox. Really helps with the iterative process, and addresses what Jacques is saying.
  6. Holy crap a Pika sighting. Must be because the Stars evened the series yesterday. I thought they were toast after that tire fire of a first period, but they hung around.
  7. I have written about mysql date, datetime and timestamp types in the past. I thought you might be interested. You can do range queries on any of those types. I'm not sure there is a good reason to use seperate DATE and TIME columns when you can use a DATETIME or a TIMESTAMP. There are some advantages to using TIMESTAMP for a calendar application, when you don't need to be concerned about dates far in the past or far in the future. At any rate, check these out: http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html http://www.gizmola.com/blog/archives/93-Too-much-information-about-the-MySQL-TIMESTAMP.html
  8. I tend to agree with Jacques on this front. You are clearly very interested in web development, and are doing a lot of thinking about your design and looking into how things work. Just to go back to the original question, ultimately apache WILL serialize/queue the requests. They will be processed and there will not be a problem when you're talking about inserts. In your app, what could possibly happen is that person A submits person B submits at same moment. person A sees person B's entry and wonders what happened. But that is the nature of the design of your calendar app, and really, for a proof of concept is not worth worrying about. Rather than fret over design, you should concentrate on building things that work. In the process you will learn many things. When you have a question in regards to how something works,, certainly it's good to ask questions, and even better to create small tests that explore the areas you are interested in. Try to avoid overthinking things, and concentrate on expanding your capabilities, and confront concerns when they crop up directly rather than trying to create what you think is the perfect application.
  9. joesoaper, The problem is that as we keep pointing out, he did not solve your problem, because you are using mysql_ functions, and those are removed from php. You should either be using mysqli_ or PDO/MySQL instead. Best of luck to you in the future.
  10. The first answer is, FIFO. The first person to hit submit will be handled first. Hypothetically, yes there could be simultaneous requests. Could there be an overlap? A properly designed table in a properly designed database already takes care of this. All tables should have a primary key. The primary key is guaranteed unique. If you're not sure, then declare the PK for your table to be an unsigned INT, and use the mysql AUTO_INCREMENT feature when you set up the table, and concurrency will be handled for you by the database. As to how many inserts you can do, there are load testing tools you can find by googling. Just to start, there is a way to do a simple form post using Apache Bench: http://craigwickesser.com/2015/01/post-data-to-load-test-with-apachebench/ If you're good with javascript and familiar with Node/NPM then loadtest is similar and easy to whip up a quick form POST by passing a little json string as an argument. There's jmeter, siege, and really many many tools out there you can explore. There's also quite a lot to performance tuning a LAMP environment. I will say, that for maximum concurrency, Apache is really not considered one of the best options these days, as Nginx combined with php-fpm has become a lot more popular when people are trying to maximize web performance with php/mysql. You also have to understand your available resources and how they are allocated depending on the available hardware and architecture you have to throw at your problem. On a monolithic server, when you have to share memory, IO etc, there are contention issues and all sorts of problems that can popup. Every HTTP connection requires memory, your scripts require memory, the database requires memory, and when persisting to disk, IOPS. Entire books have been devoted to this subject, and there are no simple answers that don't also require an understanding of the application and how and why it was deployed.
  11. Hi Joe, I read your post, ginerjm's reply to you and the subsequent fallout in the thread. While perhaps a bit terse, I think you jumped to some conclusions and decided to take offense to what was basically sound advice on a number of different issues. The mysql_ functions are removed at this point from php. Using modern api's and bound variables you no longer use stripslashes or string escaping as it is irrelevant. Certainly you had an issue with your code in terms of the array key naming you would receive, but that is just the start of your problems should you try and run your code against a relatively modern version of php and find it doesn't work. An update to your host, and existing code that might work at this moment will cease to work from now on. It would be a shame if you decided to ignore an important message, because you felt you were being personally insulted on an internet forum, where everyone is basically anonymous. The reality is that he was simply stating a fact --- there has been a prominent note in the php manual pages for all the mysql_ functions literally for years now. Everyone on this site who does a lot of php visits that site regularly, even those of us who have coded php professionally for many years, but we also know that not everyone is aware of just how valuable a resource it is, when people regularly google and grab code snippets from tutorials and articles. I don't believe that gingerjm attacked you personally, and it would be a mistake in my opinion for you to take it that way.
  12. There's still some stabalization going on with the site servers. Once everything is fixed up and we've done tweaks, we'll send an email out.
  13. The answer really depends on the engine, but the basic idea is that analyze looks at key distribution in the table and updates some statistics in the data dictionary so that the query optimizer can make informed decisions in regards to when it should use an index or ignore it. Optimize is basically analyze+ some table restructuring, but this again is highly dependent on the storage engine. Innodb doesn't typically need analyze, as it has statistical updates baked in. By the same token the way data is stored in innodb vs myisam is completely different, so there's literally nothing common between engines, and that certainly is true of the other engines that have come along in Maria etc.
  14. Yes, we understand this simplistic code. The problem is, that it doesn't seem you do. There is code here that you are apparently using, which you did not write and that needs to work on the form submission that you've also omitted from your code. Jacques went ahead and jumped to the solution that most people use, but again we don't know what this app of yours is supposed to be doing or why. It's reading a temp? file, that has some format of lines, then spitting that out again in the form of a dropdown list, to then be processed, and to what end? How is the temp file created and why is it created? We don't like cryptic mysterious threads like this that waste our time. Just looking at the code you provided, I have little doubt that everyone here will find that there are better ways to do this, but since it seems you are trying to use something someone else wrote (we have a different subforum for that as well --- see 3rd party scripts) you should at least start with listing what you started with and where you got it from.
  15. You are not providing enough information for anyone to help you with this. First off unique() is a function that returns a unique value. How is this of use to you in this scenario? Obviously it would be simple enough to change this line: $print = print "<option id='$up_id' value='$url'>$doesnt_start_with_numbers</option>\n"; To this: $print = print "<option id='$up_id' value='$up_id'>$doesnt_start_with_numbers</option>\n"; However, I don't see how that would allow anyone to select or identify a specific file from the drop down list.
  16. I understand that you have a small time tracking app, but that is not going to jibe with Time trex other than they both offer some level of time tracking. If what you are saying is that you are trying to understand the time tracking app you had built, then we would need to know more about that specific application. There isn't a universal way these things work. If the app was built with a specific framework, then there are frequently tell tale signs of that, but we can't guess. Obviously you want to start with an index.php assuming that exists. What does that include/require and where does it go from there. Are there rewrite rules that come with it? Most well built web apps have some form of MVC pattern, so there's typically a controller, with separate db model classes and views/templates that are loaded as needed by the controller.
  17. The message is telling you that there is no matching categories.id value for the transactions row you are trying to add. A row with whatever id you are trying to specify in your insert must exist in the categories table. This is how foreign keys work.
  18. I don't think ginerjm's advice is wrong, but I can also offer you this which might help. One of the great things about PHP is the way you are able to intermix PHP and HTML blocks as you are doing in your code. It is also one of the things that makes code messy and looking like spaghetti for novices. In your case, you also are not properly closing your spans. It should be: <span> ..... </span> With and if-then-else block there are a few different ways of handling this. Do it all in PHP, echoing out results Simplify within PHP using the ternary operator http://robertsettle.com/2012/07/php-shorthand-if-statements/ Intermix PHP and HTML by dropping in and out of PHP Intermix PHP and HTML by dropping in and out of PHP with the Alternative syntax http://php.net/manual/en/control-structures.alternative-syntax.php If you want to truly learn the answer, then you need to do some reading about these features. Here's something to ponder, which hopefully will cause you to investigate the materials I referenced, not to mention the underlying PHP features. //html mode <span class="updated"><?php the_time('j F Y'); ?></span> <?php $u_date = get_the_time('j F Y'); $u_modified_date = get_the_modified_date('j F Y'); ?> <?php if ($u_modified_date !== $u_date): ?> <span class="updated">and last modified on <?php echo the_modified_date('j F Y'); ?> </span> <?php endif; ?> No matter how you approach this, the important thing is to have clean, easy to read, easy to separate and understand code, using blocks and indentation.
  19. I agree strongly with Barand. Full text indexes are made for this sort of problem, and do a few things for you like ranking of results based on the words in your search, not to mention adding features that allow you to specify the importance of specific words. There are also 3rd party text search specific engines like sphinx or solr that are typically used in the web world, even when the initial data set is in mysql. Sphinx is the easiest to add to the mix given your workstation environment. See http://sphinxsearch.com In either case, as well as I understand your question, I would recommend full text indexing or the additional use of sphinx, unless the entire point of the project is to engineer a solution to these problems yourself, and in that case you should be looking at the text features and strategies those engines provide to figure out what you need to be considering in a solution.
  20. I have to agree with Jacques here. If you are already lost, that's not a good sign. It is also a private project as far as I can see. Sure you can try and pick it apart, but there are scores of projects that are open source, and hosted on github or bitbucket, and which actually encourage you to participate. I'm not saying Time trex is badly constructed -- I haven't looked at it, but I've seen plenty of well known projects that are a complete mess and chock full of really bad ideas that would be harmful to emulate. I'm not saying you should be an alarmist, and can take this with a grain of salt, but just for example: http://www.webmonkey.com/2011/02/gawker-learns-the-hard-way-why-hash-bang-urls-are-evil/ Is Time trex really going to be a great app for you to learn the basics from when it is likely chock full of javascript, which is a challenging language itself. I think you'll learn a lot more trying to build something with one of the modern full stack PHP frameworks like symfony2 or laravel, or there's even the well known CMS Drupal which just released version 8.0 that is the culmination of a multi-year effort to rebuild it on symfony2 components. The modern state of the art for php uses composer and PSR-0 component libraries. If you want to actually learn professional level PHP development you don't want to learn off a project that is 5+ years old. Yes, the web has a lot of moving parts and there's a tremendous amount you need to learn, from the basics of TCP/IP to HTTP to HTML, the DOM, to CSS, javascript, javascript libraries and frameworks, Ajax, Databases/Datastores, basic web security and cryptography and on and on. It's a huge challenge and a lot to take on while simultaneously trying to get down the basics of programming. If you have a project of your own, your desire to build that project will require you to acquire an adequate understanding of whatever things you need to accomplish that tasks, and this will lead to additional study topics.
  21. First of all, are you sure your Web server is actually listening on it's LAN port? Localhost/127.0.0.1 is not the LAN port for your machine. It would be whatever the IP on 192.168.1.x is. I'm not sure what you need to do this for, but I'm going to give a plug to https://ngrok.com It's an alternative to what you're doing, that might be more flexible and convenient than screwing around with your router and opening up a port forward. Last but not least, you will not be able to easily test the port forward from your internal network. Only a machine outside your network can actually hit the router, so you'll need some way to test it other than trying to use a browser on the same machine, or some other machine at your house.
  22. I guess that the Smarty syntax is a selling point for people who already are familiar with Smarty. These days there are many more people using Blade and Twig, so just a thought -- it might be good to consider adding modules that will support those other template systems at some point.
  23. Hey Jiros1, Well assuming you have a master array loaded with the reservations (start with a simple array of the size of the theater, initialized with some known value like '--empty--', array_merge with your reservation array. Make sure that your array is "one based" in that you don't have a zeroth element, but rather, that each element 1-n matches the appropriate seat number. Initialize your $gaps array as empty: $gaps = array(); You then simply need to foreach() through the master array using a boolean and counter variable. Just off the top of my head: $counter = 0; $start = 0; $end = 0; foreach ($master as $index => $seat) { if ($seat !== '--empty--') { // Close out and add a gap if appropriate if ($counter > 0) { $end = $start + $counter -1; $gaps[] = array('start' => $start, 'end' => $end, 'count' => $counter); // reset counters $start = $counter = $end = 0; } } else { // There is an open seat, add to range variables if ($start == 0) { $start = $index; } $counter++; } Assuming you have an array like this, try and write a routine that will traverse it using foreach, and looking for a counter that is If you go through and can't find a spot big enough, then you could try different strategies for going through it again and looking for close matches, and then using your rules to break up the reservation into multiple reservations.
  24. For a lot of mostly static sites, this could be a great solution that removes the need for databases and subsequently caching etc. There are also small footprint embedded systems and kiosks that might make use of this. At the end of the day, if the CMS is well done, other storage engines could be added using plugins I suppose.
  25. Hi Sergey, This looks like an amazing project. Your site is really slick and modern, and I see that you've made it responsive. While it looks great there are a few small concerns I have: Check this 403 I got, not sure why: https://sidecar.gitter.im/dist/sidecar.js.map When you first hit the site, it's not immediately obvious that you can scroll down to see the real meat of the site. While the universe and subtle animation is cool, I'd be worried about the marketing aspect of it more. At the bottom I'd really want to have some visual clue that was less subtle that insured the user will scroll down to see the other sections. I would also suggest a couple of additions: A section that lists features of the CMS that are focused on end-user functionality rather than the nicely done list of design and technology features you already have. A screenshot gallery of administration and basic screens A gallery of sample templates/sites using morfy. Overall, the site is already a great representation of the project and your github integration is nicely done. Just out of curiosity, why did you integrate the fenom templating engine rather than twig or blade?
×
×
  • 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.