₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,020 members, 8,448,250 topics. Date: Monday, 20 July 2026 at 05:22 AM

Toggle theme

Sinequanon's Posts

Nairaland ForumSinequanon's ProfileSinequanon's Posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 (of 37 pages)

ProgrammingRe: Online Simultaneous Equation Solver by sinequanon:
Cool.

(Note that there is currently an error in your description.)

Can you enhance the program to identify when the equations have no solution, or an infinite number of solutions?

You could also make the input only accept numbers. If you enter anything else, your program turns into a prophet! It solves the unsolvable! cool
ProgrammingTechnical Jargon And Acronyms by sinequanon(op): 1:40pm On Jan 17, 2016
Learning technical jargon is very important. It will save you a lot of time in the long run.

Some people remember jargon only for as long as they are learning a new topic. They treat the jargon as a temporary tool. Once they have understood the topic, they forget the jargon.

But the same jargon terms turn up again and again in various contexts. You may even have forgotten that you have encountered them before, if you didn't pay enough attention at the time. They are not things you want to keep looking up. That would be unnecessarily time consuming, and it could snowball if the definition of one jargon term uses other jargon terms. You need to learn bit by bit and keep the whole thing under control. Beginners, please start early with this attitude. Remember not only the technique, but the language used to describe it.

So, when you learn something new, take your time o, learning the jargon.
ProgrammingRe: How Facebook Manages It Users Database by sinequanon: 1:22pm On Jan 17, 2016
dhtml18:
All these una grammers don big pass me abeg, anyway I don write one small MySQL library like that - for the small boys on the thread to look at - but all these big boys speaking big grammer, na beg i beg o.
They fit come start to dey ask now if my library dey use memcache, dey cache and re-normalize referential integrity - i no sabi the answer of all those ones o.
Hi dhtml, refer.ential integrity basically means that if one record on the database refers to the key of another record, then the other record exists on the database. The database would not let you delete the refer.enced record, for example, while another record refers to it.

For example, imagine you had a table called "PAYMENT", and each PAYMENT referred to a "PAYEE". You wouldn't want to read a PAYMENT record, try to look up the PAYEE, only to find that there is no PAYEE with the given key on the PAYEE table.

But this could easily happen if a program deletes a PAYEE record without checking if there are outstanding PAYMENTS for that PAYEE. It could also happen if a program creates a PAYMENT and a PAYEE record and tries to insert them into the database, but the PAYEE record fails to insert. All manner of poor program design or program bug can mean that the PAYEE is missing. By time you have discovered where the problem is in your program, and fixed the problem, your database may have a lot of missing data. i.e your database lacks "integrity". You can design your database so that it won't let your program make such mistakes. e.g if PAYEE fails to insert, it will throw out PAYMENT, too.

It is very important to learn and know how to use these jargon terms. Programmers remember basic facts and material, but spend a fair amount of time looking up specifications and reference documents only as required. This becomes a key skill, and is only possible if you pay good attention to jargon, because jargon (and acronyms) are used everywhere. Without it, a five minute task of checking some basic fact and behaviour could become a project of a few days.
ProgrammingRe: How Facebook Manages It Users Database by sinequanon: 2:35am On Jan 17, 2016
spikesC:
You realize that not all databases are RDBMS. How do you maintain references with NoSql databases or document based databases?
Facebook in particular uses hive for some backend data warehousing tasks. It's sql like database which is based on hadoop. There's literally no data-based referential integrity. You have to maintain that in your code. Even RDBMS databases are decoupled just to maintain reliability and performance (everyone knows JOINS are very costly).
You were the one arguing that "NoSQL is not the answer". I think you have lost track of the point.

I was saying WHY NoSQL is useful. It is because it is better suited to TEMPORARY inconsistency and loss of referential integrity.

Referential integrity does not require any joins. You are confusing two concepts.

spikesC:
Stored procedures are inefficient, yes, but it has always been used to maintain data integrity right from time when we didn't have foreign keys. Database developers write the codes and give the application developers the api. Super simple stuff.
You are missing the point. Stored procedures were not intended to maintain referential integrity of data distributed across boxes.

That is why I was saying that NoSQL is a better solution.

spikesC:
Ofcourse it wouldn't solve every problem but it's a start in the right way if your system permits. And it can get you a huge increase in performance (this article can help explain: https://msdn.microsoft.com/en-us/library/cc505841.aspx or search 'solving database problems with denormalization')
I don't know why you are arguing. Some systems lend themselves easily to distributive systems. My point is that distributing other systems is intractable. I once worked on a migration project where they discovered that they data could not be decoupled. They nearly decided to can the project, which had already cost 10 million dollars. We really had to jump through hoops to migrate the data, and it was a good job that the data was only temporarily distributed for a few months, while it was being migrated.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 9:31pm On Jan 16, 2016
https://i540.photobucket.com/albums/gg348/4umbra/gridsol.png

This is the output from my HTML/Javascript program.

As well as solve the original problem, you can do a lot of other related things.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 5:17pm On Jan 16, 2016
DonSegmond:
Nah, you are the one being silly. The puzzle asked for the solution, didn't ask for the method. You would be a fool to code up a constraint solver when there is already one. Just like you would be a fool to write your own quicksort function when pretty much all language already provide one.

With that said, a constraint solver doesn't automatically solve any problem. You still have to write the code as I did.

If you care about the time, my solution finds all 4 possible solutions in 0.242 seconds.
% 2,906,715 inferences, 0.238 CPU in 0.238 seconds (100% CPU, 12228088 Lips)
% 5,188 inferences, 0.001 CPU in 0.001 seconds (92% CPU, 9490707 Lips)
% 6,455 inferences, 0.001 CPU in 0.002 seconds (92% CPU, 4314254 Lips)
% 5,189 inferences, 0.001 CPU in 0.001 seconds (92% CPU, 7862050 Lips)

And note, my goal was not to be performant but for a small and concise amount of code, if I care about speed, I would implement it in C++.

My solution comes out to 33 lines of code. Don't be a troll, you should learn you some prolog or eclipse.
You are the one who started trolling by getting personal. Don't add hypocrisy to that.

There is only one solution.

Clearly, GCHQ are not looking for the solution. LOL!! They know the solution.

They want to recruit folk with ingenuity, not folk who can google up a constraint solver and pretend that knowledge of prolog or eclipse has anything to do with anything.

And, in any case, what I am interested in is folk with the ability to solve the problem, not just to call a solver.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 4:35pm On Jan 16, 2016
DonSegmond:
Google answer? You are stupid. Using a constraint solver is a cheat? SMDH. Right, your javascript solution solves in 20 milliseconds? lol, right, well that's a cheat, because you didn't write the javascript interpreter yourself.
Don't be foolish.

The Javascript interpreter does not contain the methodology for solving the problem.

The method you have quoted, easily available with a quick google search, only restates the problem to make amenable to a solver which you didn't write. I hope that you are not too foolish to know the difference between a solver and an interpreter? grin

I note that you kept quiet about how quickly your supposed program solves the problem.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 4:11pm On Jan 16, 2016
DonSegmond:
No, it's a very simple problem to solve. I haven't seen anyone here heading towards the right direction.
But it's the same way you would solve a sudoku, or kenken puzzle. If you look at the puzzle, you can see that you have constraints, and even better yet, there is only one solution. Trying to brute force the puzzle will be foolish, so use a CLP solver. I used prolog's clpfd solver.
http://www.swi-prolog.org/man/clpfd.html
That is the google answer, and it's a bit of a cheat because you don't write the solver yourself.

Don't worry. I have written my own full solution in HTML/Javascript (I used HTML/Javascript for accessibility).

I don't brute force anything, and it solves it in 20 milliseconds.

How long does your program take?
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 3:33pm On Jan 16, 2016
proxy20:
One of the simplest classes in the ADT library is the Stack class, which is used to model a data structure called a stack, which turns out to be particularly useful in a variety of programming applications. A stack provides storage for a collection of data values, subject to the restriction that values must be removed from a stack in the opposite order from which they were added, so that the last item added to a stack is always the first item that gets removed.
I didn't say that a stack is a vague idea. It is a fundamental principle in programming.

I said that your understanding of how to use a stack for this problem appears to be vague.

Again, I ask you:

Which of the many configurations will you be putting on your "stack"? And how will you find them?

A vague answer that you will use some standard class is not enough.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 3:15pm On Jan 16, 2016
proxy20:
using abstract data class like grid or stack class .
You just have to manipulate some variable .
You can't program with vague ideas like that.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 3:05pm On Jan 16, 2016
proxy20:
stack must be subjected that the restricted values must be removed in the configuration .
Which configuration? There are many. And how will you do it?
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 2:31pm On Jan 16, 2016
proxy20:
/* This is a partial abstract program by proxy20 to solve the abstract programming in c++ . You are free to modify the codes */

#include <iostream>
Using namespace std;
int main ( )
{
array [] ={0,1,2,3,4,5,6,7,8,9,10} ;

// put many if statement for each of the elements
CheckLine(Grid<char> & board, char mark,
int row, int col, int dRow, int dCol) // what is the freaking answer !

if (CheckLine(board, mark, 7, 3, 1, 1,7)) return true; if (CheckLine(board, mark, 1, 1, 2, 2,1,1)) return true;
}
So, you intend to generate all unconstrained configurations of the board and "check" for the one that conforms to the constraint criteria?
ProgrammingRe: How Facebook Manages It Users Database by sinequanon: 1:08pm On Jan 16, 2016
spikesC:
I never said it's all simple. Referential integrity can be maintained in the codebase or even with stored procedures. Data normalization is a design choice
Referential integrity cannot be maintained in the code base.

Stored procedures would be very clumsy and inefficient, even if you could access data on another server with your stored procedure.

Data denormalization is a design choice, but it is wouldn't help solve the distribution problem of some systems.
ProgrammingRe: How Do I Create MYSQL Root Password? by sinequanon: 12:21pm On Jan 16, 2016
.
ProgrammingRe: How Do I Create MYSQL Root Password? by sinequanon: 12:20pm On Jan 16, 2016
Karlebolu:
embarassed
Don't you decide this during install?

If I recall correctly, you can tell the install program to use the operating system password, so check if that is what has happened by trying to use that.

Otherwise, I think you have to create a public key encrypted secured password file.

But, don't quote me on any of this.
ProgrammingRe: How Facebook Manages It Users Database by sinequanon: 12:10pm On Jan 16, 2016
spikesC:
Actually, any database can be distributed, you just have to denormalize and separate data concerns (example, using different servers for different kinds of data, which are all still used in a single page call)
It is not that simple. For some systems, referential integrity needs to be maintained, and you cannot denormalize the bulk of the data.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 11:22pm On Jan 15, 2016
DonSegmond:
solved it.
That was quick..

Where's the answer? Did you google it? grin
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 9:28pm On Jan 15, 2016
proxy20:
// Don't mind me

bool CheckLine(Grid<char> & board, char mark, int row, int col, int dRow, int dCol) { for (int i = 0; i < 3; i++) { if (board[row][col] != mark) return false; row += dRow; col += dCol; } return true;
Can you program at all?
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 9:16pm On Jan 15, 2016
proxy20:
I can't solve abstract cryptography .
Was your earlier post tongue in cheek?
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 9:01pm On Jan 15, 2016
^^

How far have you got?
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 7:24pm On Jan 15, 2016
Fulaman198:
What is object.equals() referencing? It's parsing and checking for a value. It's quite different from ==
If the runtime type of the object is Object, then .equals will behave the same as ==.
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 7:18pm On Jan 15, 2016
Fulaman198:
In the case of "test"=="" test" being true, these values are interned strings. == tests for reference equality and the Object.equals() method tests for value or in this case string text equality.
Object.equals() tests for "reference equality" (whether the same object is being referenced, just like == )

This is overridden in class String, to test for "value equality".
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 6:45pm On Jan 15, 2016
ChinenyeN:
Judging by the output, I would say best practice would be to use the string method .equals(), unless you know ahead of time that both strings will be literals. If you do not have that foresight, then always stick with .equals().
Correct!

It you know that they will be string literal constants (or, Integers in some cases), it is safe.
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 6:31pm On Jan 15, 2016
Fulaman198:
You are not getting it. So I'll explain it. They are pointing to (I should say referencing to since this is Java) to the same object.

== never and I repeat never checks for the actual value of a string. If you don't believe me, you are more than welcome to check Java forums like coderanch.com or many other popular Java related forums they will tell you the same exact thing.
You are not getting it.

"== never checks" is meaningless. == is a syntax.

The compiler is doing the work, and it is not doing it exactly the way you have described. You are fudging your use of the word "object".

The reason it works is because the string is interned, which means that it gets only one copy at runtime.
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 5:39pm On Jan 15, 2016
Fulaman198:
The '==' operator tests for object references whereas .equals() tests the string values. E.g.


String myString1 = new String("Nigeria rules!" );
String myString2 = new String("Nigeria rules!" );

// Evaluates to false
myString1 == myString2;

// Evaluates to true
myString1.equals(myString2);

// Evaluates to true, because Java uses the same object
"Football" == "Football";


So that particular example you gave would work however, if you tried this:


String myString1 = "Lagos";
String myString2 = new String ("Lagos" );

(myString1==myString2) //returns false


myString1 is referencing to string in string pool and myString2 is referencing to string in the heap. That's why in regards to Strings, though your example works, if I'm checking for the content in the string, I'll use .equals(). If I'm checking for object equality, I'll use ==
I said it works in some situations. You queried this. You were wrong.

Your explanation is not quite right, either. In my example, string1 and string2 are two separate objects.
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 5:04pm On Jan 15, 2016
Fulaman198:
Kindly give an example. In Java, String is an object and not a primitive. If I'm wrong, prove it with some sample code. Thanks!
Fair enough.

What I am saying is that the following will output, "Strings ARE equal!"

It is useful to do it this way in SOME cases. If you don't know which cases, and why it works in this case, stick to .equals()

class KindExample{

public static void main(String [] args){

String string1 = "Nice job Sam!";
String string2 = "Nice job Sam!";

if(string1 == string2){
System.out.println("Strings ARE equal!" );
} else {
System.out.println("Strings are NOT equal!" );
}
}
}
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 4:25pm On Jan 15, 2016
Fulaman198:
It does not work that way
Sorry dude, you are wrong.

Pay careful attention. I am saying that it depends on the details. In the scenario given, it depends where myString comes from.
ProgrammingRe: How Facebook Manages It Users Database by sinequanon:
Don't confuse "database connection" and "user".

When you log in, the server gives you a connection from a connection pool. The user associated with this connection has nothing to do with your Facebook user. It is possible that everyone uses the same user, who connects multiple times.

The pool will have a connection limit. Only thousands, possibly. That is how speed (performance) is managed. If this runs out, a server busy message will propagate back to the user.

A slightly different question concerns database consistency and concurrency. That is where NoSQL comes in. It allows for the database to be distributed on different domains, at the expense of temporary inconsistency. This means that users can log in independently on different domains, and your connection limit scales by the number of such domains.

That is my understanding.
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 1:10pm On Jan 15, 2016
I think that it would take at least a couple of years for a natural programmer to become proficient at Java.

I don't think that it is achievable just through book learning and courses. Many of the concepts relate to working in a team. For example, concepts like "visibility" in OOP (Object Oriented Programming) are more clearly demonstrated when working in a team. This is also the case for error handling (exception handling) and so forth. Once you have experience the problems that arise from poor coding technique, either by yourself, or by having to fix somebody else's code, the real meaning and importance of these concepts become apparent, and they stick in your memory!
ProgrammingRe: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 12:59pm On Jan 15, 2016
Fulaman198:
One thing you have to remember my friend Dekatron is that unlike other primitives (int, long, short, byte, double, etc.) String is not a primitive but an object. Thus, with objects if you want to verify if something is equal you have to use the equal() method.

e.g.

if myString.equals( "Nice job Sam!" ) {
System.out.Println("Your String is " + myString);
} else {
// code goes here
System.out.Println("Your string is interesting" );
}
Not always true. In the code above, I think that it could be OK to use a simple ==.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 6:52pm On Jan 14, 2016
proxy20:
turn the numbers as if you are covering a carton .

blah! bah!
ok.. do it, and post your program..
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by sinequanon(op): 6:43pm On Jan 14, 2016
It is a very good programming exercise for anyone who already knows a programming language.

The first skill, here, involves the ability to convert a task which has been presented for easy interpretation by humans, into a process of functional steps that can be made easy for a computer.

This ability to create a technical specification is key to programming in the real world.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 (of 37 pages)