₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,567 members, 8,446,075 topics. Date: Thursday, 16 July 2026 at 04:13 AM

Toggle theme

DonSegmond's Posts

Nairaland ForumDonSegmond's ProfileDonSegmond's Posts

1 2 3 4 5 6 7 8 9 (of 9 pages)

ProgrammingRe: Using Finger Print Scanner On PHP by DonSegmond(m): 12:12am On Jan 17, 2016
You are not going to be able to interface PHP to a finger print scanner since it's a high level language, and there's probably no device driver written for that. If you actual have to connect to a physical device, you should use something like C/C++ or Java.

However, if you are not going to be connecting to a physical device and will already be getting a scanned image, then you might be able to do it. You never described what your goal is. Do you just wish to read a finger print and store it? Or store, then be able to search and map to existing database? What is your goal? Without a clear goal, your project is going no where. Anyways, I personally wouldn't use php for such a project, if I was doing this, my languages of choice will be in this order, python, java, c++
ProgrammingRe: How To Generate Bulk Fake Names For Testing Apps by DonSegmond(m): 11:47pm On Jan 16, 2016
Even better, use Faker. not an API, a local library with no limit.
ProgrammingRe: Help Needed With The Following Questions In C++ Or Any Language Please!!! by DonSegmond(m): 6:03pm On Jan 16, 2016
I decided to implement a few of these using clojure.
I like clojure, because it's a lisp that runs on java. by being a lisp, you can develop functional programs that are very small, easy to test and fast. the code below took about 5 minutes to write.



(defn q1 [args]
(let [max_arg (apply max args)
next_max_arg (apply max (remove #(= % max_arg) args))
]
(* next_max_arg max_arg)))

(defn q2 [arg]
(inc arg))

(defn q3 [arr]
(/ (reduce #(+ %1 %2) arr) (count arr)))

(defn q4 [arr]
(let [avg (/ (reduce #(+ %1 %2) arr) (count arr))]
(map #(- %1 avg) arr)))


(println (q1 [2 3 1 10 5 7]))
(println (q2 7.0))
(println (q3 [1 2 3 4 5 6 7 8 9 10]))
(println (q4 [1 2 3 4 5 6 7 8 9 10]))



Results

70
8.0
11/2
(-9/2 -7/2 -5/2 -3/2 -1/2 1/2 3/2 5/2 7/2 9/2)
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by DonSegmond(m): 4:57pm On Jan 16, 2016
sinequanon:
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.
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.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by DonSegmond(m): 4:18pm On Jan 16, 2016
sinequanon:
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?
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.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by DonSegmond(m): 4:02pm On Jan 16, 2016
sinequanon:
That was quick..

Where's the answer? Did you google it? grin
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

P/S, i didn't bother solving that actual puzzle. I just did a test for a 5x5 puzzle and know I can extend it to the big puzzle.
BusinessRe: DIYLaw.ng - A Female Tech Startup - Wins $40K Prize In The Netherlands by DonSegmond(m): 11:06pm On Jan 15, 2016
seunoni34:
Watch as they use the money to buy shoes, Brazilian hair and expensive phones.
$40,000 = 12,000,000
You are an idiot. Those ladies are so smart to devote themselves to building a start-up, going out to compete and winning and yet you wish to belittle pre-emptively with an unfounded assumption. Get the Bleep out of here. They are going to take that money, invest it, grow it while you while away your time on Nairaland wishing you made something out of your sad pathetic life.
ProgrammingRe: Your Help Is Needed In My Final Year Project by DonSegmond(m): 10:57pm On Jan 15, 2016
why would they give you a project on something you haven't been taught?
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by DonSegmond(m): 10:56pm On Jan 15, 2016
solved it.
ProgrammingRe: Can You Solve GCHQ Xmas Puzzle? by DonSegmond(m): 10:32pm On Jan 15, 2016
what do they mean by a "run of 2"
ProgrammingRe: Help...my If Statement In Php Is Not Echoing by DonSegmond(m): 4:16pm On Jan 15, 2016
cr80vity:
pls help, I dnt understand wats wrong...ds s d code:

if ($query_num_rows==0) {
echo "invalid username/password";
} else {
echo "ok.";
}

pls s dere any reason why it's nt echoing
how are you running your program? through the browser or on command line?
ProgrammingRe: How Facebook Manages It Users Database by DonSegmond(m): 4:15pm On Jan 15, 2016
rushman003:
I'm still a leaner when it's comes to programming, I uses php and mysql, and a perpetual face booker *lol*. But I could help myself whenever I remembered the quantity of users that use Facebook everyday. My little knowledge about database is that the more you have users the slower your site becomes. Even I doubt Oracle could manage 100million users and think of the number of users we have on Facebook. So this challenge is up for pro programmers in the house. What database can you use to manage site like Facebook that has up to 400million users or how do you use mysql to manage it. Do you place this database on different server and users request is sent to a server that has not been saturated?
You normalize your data, that's the first step. Avoid data duplication. For very large sites like facebook,they use some NOSQL and distributed databases, ie, Hadoop, Cassandra, etc. Google has there own custom DB, like BigTable. To use a generic database like PostgresSQL,one will shard the data, meaning divide it across multiple servers. 100million records is not really a lot of records. The problem is that most developers are pretty much one dimensional. Scaling is not a programming skill, it's a knowledge skill, so when you have such problems, you will hire a tuning expert with solid experience in system, db and scaling administration.
ProgrammingRe: 6 Programming Exercises by DonSegmond(m): 12:44pm On Jan 14, 2016
php

// problem 3
function countvowels($string) {
return count(array_filter(str_split($string), function($k) { return in_array($k, str_split("aeiou" )); }));
}

// problem 6
function strreplace($str, $search, $replace) {
return preg_replace("/$search/", $replace, $str);
}
EducationRe: Nigerian Students In China by DonSegmond(m): 2:10pm On Jan 08, 2016
dste:
a lot of universities do offer Biz Management, depending on if its for post graduate or undergrad level, for undergrad the number of universities that offer this in english would be low, they offer it mainly in Chinese language. but however for post grad you can have a hanful that offer in english..
P.S Note China is a big Country, i dont know up to a third of their universities.
Have you learned to speak, read,and understand chinese? If so, how long did it took you and what's the process?
ProgrammingRe: Building An Ai(artificial Intelligence) by DonSegmond(m): 2:42pm On Jan 06, 2016
It depends on what you mean by AI. That's a very broad definition. If you are just trying to solve some problems, then I will urge you to focus on python, Java or C++ in that order arranged from their ease of understanding. Those 3 libraries have plenty of libraries that can help you solve some AI problems. If on the other hand, you are really interested AI from a general view and will like to solve any problem you face, then I do urge you start with a data structures and algorithms book and have you are done. You can pick an AI textbook (Artificial Intelligence a Modern Approach) is a good intro into the field.
ProgrammingRe: I want to learn programming but hate mathematics by DonSegmond(m): 2:40pm On Jan 06, 2016
No, you don't need to be good at mathematics to be a good programmer, but I can assure you. It helps to know your maths and have a mathematical mind to be a great programmer. I tell you this, because I don't wish to discourage you from learning programming. You can write a lot of programs without much mathematics, websites, mobile apps, etc. However, to develop software that truly makes an impact, some maths starts creeping in. You should not hate mathematics, see software development is a slight branch of applied mathematics, so by write code, you are doing some maths. Mathematics is all about problem solving in a logical manner, and that's exactly what software development is. If you wish to do anything in the following fields, such as analysing audio, 3D graphics, artificial intelligence, you will have to pick up some maths. So best of luck, start programming, and keep an open mind to learning the necessary math in the future if you find out that you need it.
ProgrammingRe: Github by DonSegmond(m): 4:22am On Dec 30, 2015
Fulaman198:
How many of you use it? How do you use it personally?
I use it, to store code I wish to share with the world.
Science/TechnologyRe: Locally Made Vehicle In Aba by DonSegmond(m): 3:26pm On Dec 28, 2015
jasper7:
this looks like a car of the 18th-19th century. Let's not celebrate mediocrity. This invention is 200 years behind. Let's invest in our guys, train them and fund them, so that they can produce stuff that can compete globally
This was not built by a well funded corporation, but by an individual with very little means, so let's celebrity creativity amongst us, and realize that we have the brains and with the right support, we can excel.
Science/TechnologyRe: Construction Of 8 Storey Building That Does Not Need Electricity Elevators by DonSegmond(m): 3:25pm On Dec 28, 2015
ademusiwa1e:
You have the remove local government. To save land. Everyway, so that people. Can move.

You have to build 8 storey building which does not need electricity.



The way to do that is.. I will show you.
Yeah, it's call stairs.
ProgrammingRe: Functional Programming. The Future? by DonSegmond(m): 3:23pm On Dec 28, 2015
omohayek:
It's worth adding that among the practical benefits of immutability, referential transparency, etc. is that it makes reasoning about concurrency a lot easier. This is especially important now that all machines are multicore, and applications must often be scaled to clusters of hundreds of nodes.
Well said, In addition outside of concurrency, it allows one to trust a function. Once you have a function that has been tested, you can be certain that it will behave exactly as designed since it doesn't keep state. State is the beast that brings forth exponential growth in complexity as the software grows. By being immutable, we have a clear separation of data and code which goes against everything OOP stands for.
ProgrammingRe: Lisp Language by DonSegmond(m): 2:26pm On Dec 24, 2015
Arian11:
Sir how do you implement the ID3 Algorithm in Lisp
Can you implement it in any language? If not, then lisp is not the problem, and you just have a poor understanding of the algorithm or programming.
If you can implement it in another language, then do so first. It's a tree traversal algorithm. So figure out how you can represent your trees as a list, then figure out how to visit the nodes. I would represent a tree as (root left right) then you can use first to get the value of the current node, second to get the left node, and third to get the right node.
ProgrammingRe: Functional Programming. The Future? by DonSegmond(m): 2:12pm On Dec 24, 2015
No they are not. Python, Scala and C# are not functional. They are OOP, and you can do some functional programming with them.
F#, Haskell, Lisp, ML, Clojure, these are functionally. Of those, Haskell and Clojure seem to be thriving and the market share for them is very small. They will not take over, but smart individuals and companies will tap them to gain an edge.
ProgrammingRe: Programmers Come To My Aid Please. by DonSegmond(m): 2:09pm On Dec 24, 2015
For android learn Java, for ios learn swift.
ProgrammingRe: Nigerians Should Create A 3D Action PC Game Based On African Heroes And Old Gods by DonSegmond(m): 2:08pm On Dec 24, 2015
It can be done, but it will require massive efforts to be successful. You will need talented artists, 3d modellers, musician, script writer, programmers, not just someone who has great command of working with a 3d engine, but also a physics engine, and AI programming, and possibly network programming if you want multiplayer support. It can be done, but the road there is not easy.
ProgrammingRe: Lisp Language by DonSegmond(m): 5:37pm On Dec 23, 2015
Yes, I'm familiar with lisp. What would you like to know?
ProgrammingRe: Can Anyone Tell Me How To Get Php Ide Suitable For Practice Purposes by DonSegmond(m): 5:36pm On Dec 23, 2015
netbeans, eclipse are free. the only issue is that they consume so much resources, so you better have a top notch computer. i just use a basic editor. you can try phpstorm. it's also not free, but it's very light and nice.
ProgrammingRe: How Do I Access Restricted Sites? by DonSegmond(m): 1:50pm On Dec 18, 2015
Don't.
ProgrammingRe: Programming Difficulties by DonSegmond(m): 12:07am On Dec 17, 2015
You need to stop generalizing. There are brilliant Nigerians all around, both in Naija and outside doing amazing things with software.

To design a website is easy. To scale a website is difficult. Programming is not that difficult, to make it work for very large amount of data requires a different skill set. To have a solid grasp of this, you need to be well rounded and have knowledge that goes beyond programming. Core computer science knowledge is mandatory, business and marketing skills are also important. All of these are free online. All you have to do is search. Coursera has lots of programming classes for free, so does EDX. Mit, Harvard and Stanford also have some videos online. So long as you are willing to learn and willing to spend the time, you can build such complex site. Cost of production outside of human capital/time is also very cheap. You don't even need a fancy computer.

So stop making such sweeping negative and self defeating statements, start learning and start building.
ProgrammingRe: I Need The Help Of Java Gurus In The House. Please Enter.... by DonSegmond(m): 12:02am On Dec 17, 2015
lekropasky:
GoodDay Programmers.

I am trying to implement a stand-alone CBT application using Java. I have been able to do more of the task. But, my problem is, i want to create a Database(OR Maybe an Array) that will hold my questions and the options for each questions( four Options ) which i dont know how to do. I believe Java/Mysql Gurus here will lead me through, if only i can get the Login to solve the Problem, i'll be happy.

Thanks In Advance.
Do you know how to hold your data in memory? Arrays for instance?
If you do, then saving them to a database and loading them is a matter of a few things.

1. You have to install/setup a database software.
2. You have to create a table(container) to store your data in that database.
3. Each table you create will have at least 1 or more fields/columns to store various data, and you have to define the type of data.
4. You have to make your application talk to your database, using a database driver, ie, ODBC or something specific to your database.
5. Once you can connect to the database, you have to learn how to store data in it and how to fetch data via SQL queries.

Here is a tutorial for talking to Mysql using Java.
http://zetcode.com/db/mysqljava/
ProgrammingRe: How Hard Is Programming by DonSegmond(m): 1:33pm On Dec 15, 2015
Programming is as hard yet as easy as anything in life.

If you are having a hard time, it might be that you are moving too fast and don't have some prerequisite understanding. You need good books/materials, there are lots of materials online. Algorithms and data structures can be seem a bit daunting at first. But they are not really so, you just have to start with the fundamentals. Understand how to move around memory comfortably and you can grasp a stack and a queue. Understand how to reference another location in memory and you can start grasping trees and hash tables. The mathematics behinds algorithm analysis tho is not easy, so if you are not strong in maths, then I suggest you slowly start shoring up on your maths skills. Learn algebra, geometry, a little bit of calculus, a little bit of linear algebra. The main maths you need to know for computer science is discrete maths, so get a material on that and start working your way through.
ProgrammingRe: I Want To Be A Programer. Where Do I Start? Pls by DonSegmond(m): 1:27pm On Dec 15, 2015
You need a computer, you need access to the internet so you can access information (Books, blogs, manuals, videos). You need adequate understanding of the english language. You need to dedicate considerable effort in learning the craft of programming. You need to give up time distracting actions such as facebook, nairaland, watching movies. You need to put in multiple hours everyday for about a year.

I suggest you start with Python, Java or C#.
ProgrammingRe: Pls I Need House Advice by DonSegmond(m): 1:25pm On Dec 15, 2015
It is never too late, but if you want to do this. You must be willing to dedicate yourself to it and hone your craft. Are you willing to dedicate at least 4 hours every day, non stop for the next 1 year? If you are, then you can do it. There are lots to learn, but it's very doable.

1 2 3 4 5 6 7 8 9 (of 9 pages)