Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want such a script or logic so that if somebody has a copy of my code, they can only access/run it if they have my unique key, otherwise they get an error. Is there any way to do like this?
Thanks
If somebody has a copy of your PHP code they can run it. As PHP is not compiled, the possessor can read and edit the code as well; so even if you put in something that checks against a secret key, they could simply remove it. If you encrypt the code into an unreadable state, it’s also in an un-runnable state.
So, in brief, there really isn’t a way to give working PHP to another person in a way that they can’t simply run it. If you’re looking to sell a product of some sort, your best bet is probably to run it as a service so the end user never actually sees the code.
The closest you might hope for would be to make it difficult to read, i.e. with meaningless variable and function names and zero white space; but that won’t stop somebody who really wants it, (and who knows how to work some basic refactoring utilities), and only adds significant complication to your own work
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
From what I know about stacks, it seems like this method goes against the whole point of a stack- if you need to know where in your stack a specific element is then why are you using a stack at all?
Edit: I'm not trying to waste anyone's time or ask dumb questions, I'm a student who's honestly just trying to figure out the rationale behind this function so that I can become a better programmer
I would put it like that:
Java has its inconsistencies and this is one of them.
If you take a deeper look you will find that Stack is a subclass of Vector and inherits its mehtods which also seem to make not that much of a sense.
Programming languages are living and growing things made by people and I think you can always find things that don't make sense or things that you wish would have been made in a better way (whatever 'better' means).
In some you will find more in some you will find less flaws.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
first of all I want to make it clear that's what I am asking is for an assignment.
The idea was to make a program in c++ or java where the user enter a simple c code (A=B, a while loop, a for loop and array functions) and the output is the mips code (lw addi etc) we are free to use whatever registers doing so.
Surely I am not asking for the whole code. The problem is in my head I can only think of hardcoding the whole things inputting a string then cutting it into part and then run a hideous amount of if condition and or switch cases I think there must be a simpler way but I can't get my mind on it.
Damn, whenever you get to studying compilers this will be crazy to look back to.
Anyway you are probably not in the level of building a C compiler from scratch.
So think of it this way, you need to have a set of instructions and yes you will have to go through the program string and transform the string into MIPS instructions.
The most naive way to do it and it might be what your teacher expects unless it is a compiler course, would be to parse the program text line by line as it is expected to be a simple program and as you said have a lot of conditions for each type of expression that you will evaluate.
A tip: Save for / while loops as a label as soon as you read them and from there you need to check where is the endpoint of it for the jump when necessary (completed for/while conditions etc)
Now if it is a compiler project. I'd strongly recommend you read into this book:
Compilers: Principles, Techniques, and Tools
Because to build a real compiler you need to understand all the stages of a compiler and how does it work together... You would also need to know some Language Theory.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Hello stackoverflow i have a doubt, which is the proper way to solve this?
I have this sql sentence:
SELECT *
FROM task
, subject
WHERE task.id_subject = task.id
AND task.id_tasktype = 1
AND subject.id_evaluation = {ALL the ids of table evaluation}
If i want to execute this sentence for every evaluation what is more efficient? a loop/cursor or whatever in SQL (i have basic knowledge of sql) or a regular for each in Java?
It depends on your situation. Basically, if your database server and application server are actually two different computers, then you might decide to run the loop at the server which can handle more pressure. You need to look at some statistics to be able to determine this.
Also, you can implement both solutions and measure the time needed at db server + time needed at application server. If one of your loops is consistently quicker than the other, then it is practically more efficient in the scenario you are running it according to your experiments. Off course, the scenario might change over time.
Generally speaking, people tend to run this loop on the application server (Java), since you might need to execute some things available only there in the future, but if you have a very good reason to run this on the database server, like the case when a trigger should trigger this functionality, then you might decide to run it there.
Basically, you are trying to optimize a loop where you do not necessarily have a problem. If you encounter performance issues, then you might decide to experiment with a few things, including, but not limited to the suggestions shown in your question.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Please explain me the differences over time and space complexities in java for user defined and predefined functions in java. examples like, linked list, list, stack class. please explain this with valid example.
thank you.
There is nothing special in predefined function over user defined. The only thing is predefined has been written by somebody else for you. It depends on algorithm.
Crap code/implementation runs in a crap way. Doesn't matter if its user created or system/API provided. example at a high level is EJBs vs Spring.
Good written code runs pretty and sleek. Again doesn't matter who the hell wrote it.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
(This might be the wrong place to ask the question, please let me know).
Should I name my method isStaticallyImported or isStaticlyImported?
(They'd be pronounced pretty much the same way, I believe)
Of course they should be in good english. Even if the human brain will likely have no problems reading garbled up words, compilers do not enjoy the same luxury.
How many times have you miswritten a variable name, then later on used the correct spelling, only to find out that the program crashed at run/compile time?
This problem is only amplified when working on code that was not written by you, because we think of things as, well, things, and having to specially remember that the thing had to be spelled in a special way is just an unneeded break to your workflow.
Yes, your variables should be clear to the developer. You can name it whatever you want and it will work because the compiler doesn't care. When you name the variable in a human readable manner then developers after you will be able to read and understand your code much easier. You should name it "isStaticallyImported".
They should be in the most easily understandable language for those using and maintaining it in my opinion.
I'm also pretty sure the compiler doesn't care about the quality of spelling.