Tag Info

New answers tagged

-5

You can check this one http://webdevtoolboxv1.blogspot.fr is License Key Server - Protect Copyright and Track your Sold Web Apps - HTML & PHP Scripts! Try the DEMO before to buy it!


1

Most of your issues with Composer can be mitigated: Host a copy of the dependencies yourself. You can even keep them updated automatically via a scheduled git pull. For a large project and/or a corporate environment this is a good step. Use a build system or continuous integration server which creates a production ready bundle you can upload in one fell ...


0

It seems like your main issue with composer is speed. Since so much code is shared between projects, you could have symlinks for shared vendor subfolders so you only need to update in one of the projects and it will update all of them. You can then deploy to all the servers using rsync. I like to have a file with the build version in each project so I can ...


0

You can't have both without restricting your user: allowing users to create the URLs freely AND having collision-free URLs for each module. If you want to allow users to create URLs, you may check if the entered URL is already in use through doing self-queries but that would still result in having the user restructure the URL catalogue in case there has ...


1

One of the most important things when using a programming language is understanding what it's weaknesses are. As many languages have substantially different weaknesses, it is often a very bad idea to directly port code from one to another. In both examples you have provided, you are presented with a fairly severe typing issue. Even the dictionary has a ...


0

Few people are using HHVM for community and political reasons, mostly involving the fact its created by FaceBook. Now to answer your question, or at least alleviate your concerns by providing an alternative. Try using a VPS. There are cheap VPS hosting services available. For instance I use one which costs roughly £5 per month. They are typically more ...


1

Most CI servers are somewhat language agnostic -- at the end of the day you are really just executing shell scripts with some fancy reporting -- so your general premise is correct. The physical deployment of PHP apps is typically pretty simple -- they are just files on disk so rsync is your friend here. The difficult parts come in with things like user data ...


2

Let me ask a question : what you happen if in your PHP version I would write: // PHP class Sample { public function __construct() { $dispatcher = new EventDispatcher(); $dispatcher->addListener("sample.event", array($this, "onEvent")); $dispatcher->dispatch ("sample.event", new WarnEvent()); // oops? } ...


1

Even though this could work, this might be a little overkill. Will issues in scalability still arise in modern Prolog implementations? Beware of strings. In some implementations, the generated code for querying in_group/2 will result in a lot of branching, as in if "Alice" then ... else if "Bob" .... Replace double-quotes with single-quotes, ...


0

A much better framework for this kind of thing is Drools. It uses a very efficient algorithm to search for rules that apply to a given set of facts. It is a Java-based system, so you won't necessarily want to use it in your program but you should study it to see what you can learn about how the pros do it. All of that being said, I believe you are opening ...


1

There are a couple of ways to approach this, depending on your requirements and scale. First of all though, I don't believe a CDN is appropriate in this case. A CDN is used for caching of static documents to provide faster delivery of those assets to end users. It's not relevant for centralised storage or management of files. At the larger end of solutions ...


1

Basically I have these checks integrated into the class right now - isCouponUsed() calls isCouponValid() in order to check that it's valid first. Is this a good idea, or is it better for me to use isCouponValid() outside of the class and then pass that value to isCouponUsed(), such that isCouponUsed() should just be concerned with validating a ...


1

You should be concerned about classes driving the behaviour of other classes. This means to be wary(not necessarily always avoiding) the dot operator. Suppose you are a pizza delivery guy, and you come to my house looking to deliver me a pizza, are you going to reach into my wallet and take my money? What if my money is on the fridge? This is called high ...


2

I think this comes down to encapsulation. If you have to offer public methods to check Coupons, then you can't guarantee that the user of your API will call isCouponValid before calling isCouponUsed, so you have to add the extra check. But these situations are always questionable, and usually suggests that your design does not follow principles such as ...


3

I use MVC in both. Yes the views server-side are very simple, but that's ok. Still nice to have separation of concerns for all the usual reasons.


1

Everyone has their own wishlist for routing. Which is why so many people have looked over the landscape, decided that everyone else's routing is bad, and written a new one. That said, the top of my wishlist includes hierarchical routing. That is, based on the start of the URL you should be able to route to a component that takes the next component and ...


2

What are the downsides of structuring a website this way? The main problem is dealing with pages that change per user. For example, your website has an user system, so for each user that logs in, would you then generate a new page and cache it? Is this flat out a bad idea? No, it's an excellent idea. As a matter of fact, static content is often ...


1

What are the downsides of structuring a website this way? Obviously, the downside is inability to do typical "dynamic" stuff like CRUD with forms. Of course, you can still use some 3rd party API for contact forms and comments, like Disqus or Muut. Is this flat out a bad idea? No, it is an excellent solution for static sites. It is indeed very ...


2

If you have a ColorModel that can represent all possible colors and that you can convert to without loss of information, then you can designate that ColorModel as the 'canonical' model. The conversion between arbitrary ColorModels then becomes a two-step process: First you convert from the source model to the canonical model and after that you convert from ...


-1

In the specific example given this would work: if ( abs( foo() - 1.5 ) == 0.5 ) This works for two number values, but for the obvious reasons is not very easy to generalise


3

There is nothing like that in PHP, however you can go for something like this -- even tho I'm not really recommending it: if ( in_array(foo(), array(1, 2), true) ) ... Please note that it's not gonna work on && conditions and you're limited only to == and ===.


0

I think what confuses you about EF is the database context. It allows you to query objects like a Repository and save changes in persistence like a Unit of Work. You have a lot of work done with EF database context. All you have to do is segregate the responsibilities by creating specific repositories and a unit of work that share the database context and ...


2

Generally, you use Web frameworks (or languages, in PHP's case) to serve and store persistent data. What do I mean by that? Well, Twitter is the go-to example. When you make a Tweet, that gets stored in a database somewhere. Then, when you look at the tweet again, it's loaded from the Database and sent to you. In your case, there is no need for persistent ...


0

Interactivity. Putting functionality in the browser has the same advantages that putting functionality in any other user interface does, as opposed to just showing static forms: you get to interact with the user in real-time, instead of waiting for the user to fill out the form, submit it to the server, and wait for a full-page response. Some examples of ...


2

I'll attempt if not answer your question, at least give some hints. As a side note, I've contributed to refactoring of several medium-sized projects (although not as big as yours), especially the ones which had data access directly mixed with business code, so the answer is partially based on my personal experience. Identify the problem The first thing I ...


1

In principle each arithmetic pseudo-random number generator (such as PHP's) has a finite period after which the same sequence of numbers will repeat. And most generators will generate a fixed minimum number of bits (often 32) for you internally at each step, no matter how small the range of results you asked for. So generating each digit separately will eat ...


1

I tweeted to http://whatsmybrowser.org and then opened it up using the latest Twitter app on iOS as of 12/1/14. Here is my user agent: http://www.whatsmybrowser.org/b/IQBX258 Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435


0

With a PRNG that has equal probability for "single decimal digits" as well as "16-digit decimal numbers", no, they should be equal. However, the PRNG is unlikely to have perfect probability for base-10 numbers, so "possibly". It would depend on how much this influences the probabiity for any specific digit. Bear in mind that a 16-digit number is up to 54 ...


-1

I think that break into 3 functions like you said is the best alternative, mainly to separate the logic of each user. Here's an example of how this can be made: public function index() { $method = "index" . ucfirst($this->user->role->name); $this->$method(); } private function indexAdmin() { // do stuff } private function ...


2

I still think it makes sense to stick to phpDoc to document PHP code. It is the standard recommended by the php PSR project. It is also generalized into the annotations concept, as it is used for instance in Doctrine. Another argument for phpDoc is that Javascript and many other languages have it's analoguos commenting system. After much time spent to try ...


3

Here are some points you should take in consideration: Readability: long regular expressions are difficult to understand. Use comments (and eventually break one long expression into several small ones, if possible) to make it easier to read. At the same time, the piece of PHP code in your question can (and should) be refactored to make it more readable. ...


2

The abstract Controller class can't create the right <concrete class>Domain classes, because it doesn't know which concrete class it belongs to and which Domain and View classes it should be associated with. What you can do is pass in the Domain and View classes from the derived class's constructor. abstract class Controller { private $domain; ...


0

I would approach this by having a top level UserService that doesn't care what type of user it's dealing with. If it gets a request for a user by email, it can look up on the database which type of user is correct and delegate the request to the correct service. This may sound a little inefficient, but used with an appropriate query caching later it's ...



Top 50 recent answers are included