Programming › Re: Lets Start A Thread For Solving Problems From Projecteuler.net by DonSegmond(m): 1:04am On Dec 11, 2015 |
Solutions in Prolog Problem 1 multipleOfM(M,N):- 0 is mod(N, M).
divisibleBy3or5(N):- (multipleOfM(3,N) ; multipleOfM(5,N)).
range(F,F,[F]). range(From, To, [From|L]):- From < To, F1 is From + 1, range(F1, To, L).
start(R2):- range(1,999,L), include(divisibleBy3or5, L, R), sum_list(R,R2).
Problem 2 :- dynamic stored/1. memo(Goal) :- ( stored(Goal) -> true ; Goal, assertz(stored(Goal)) ).
fib(0, A, _, A). fib(N, A, B, F):- N1 is N - 1, Sum is A + B, fib(N1, B, Sum,F). fib(0,1). fib(N,F):- N > 0, N1 is N+1, fib(N1, 0, 1, F).
%add A to B only if B is even and return the result, else return A addIfEven(A, B, Res):- (0 is mod(B, 2) -> Res is A + B; Res = A).
%count's upward from 0 to infinity %get fib of count and if the result is less than the limit %add it else return the total so far sumUpWhileBelow(Limit,Cnt,TotalEvenFib,R):- FibCnt is Cnt+1, memo(fib(FibCnt,FibRes)), (FibRes =< Limit -> (addIfEven(TotalEvenFib,FibRes, NewTotal), sumUpWhileBelow(Limit,FibCnt,NewTotal,R)) ; fin(TotalEvenFib,R) ). fin(R,R).
sumUpWhileBelow(N,R):- sumUpWhileBelow(N,0,0,R).
Problem 3
:-use_module(library(clpfd)).
% solves the problem, but super fucking slow. Bleep! factors(N, L):- findall(X, (X in 1..N, 0 #= N rem X, indomain(X)), L).
prime(P):- factors(P, L), L = [1, P].
solve(N, LargestPrimeFactor):- factors(N, Factors), include(prime, Factors, Primes), max_member(LargestPrimeFactor, Primes).
Problem 4 solve(R):- findall(P, get_palindromes(P), PalindromeList), max_list(PalindromeList, R). get_palindromes(N):- between(100,999,I), between(I,999,J), N is I * J, palindrome(N).
palindrome(N):- number_codes(N, A), reverse(A, B), A = B.
|
Programming › You Can't Be A Good Programmer Without a Solid Grasp Of A Natural Language by DonSegmond(op): 2:29pm On Dec 07, 2015 |
When one finds themselves tooling and toying around alone at the computer. It's simply, you and the machine in a vacuum. The only language that matters at that point is the one you choose to communicate with to the machine, be it a low level or high level language. So long as you have a good grasp of that language, the machine will bend to your will and do what you command it to.
This in itself is enough if you program for you and only you alone. The moment you decide to build software for others, it becomes immediately obvious that you must have a great command of at least two languages. The one you speak to the computer to, and the one you communicate with to other people. In essence when you build software for people. You are an interpreter between the computer and your client who doesn't speak the computer language. A poor grasp of either language will lead to disaster as is the case in any interpretation duty.
I see a lot of desire to learn programming, but yet very few to get a solid grasp of English which happens to be the lingua franca for programmers. My fellow Nairalanders, if you must be a good programmer, then I urge you to get a good grasp of the language. You will need a fine balance across the four cores, speaking, listening, writing and reading.
Speaking is important when you wish to communicate an idea across to someone who is non technical. You must find ways to relate the abstract concept of programming to a layman in a concise way. Listening is also very important. As we all know, natural language is very ambiguous and with passive listening, you are bound to find yourself at a cross road where you will not be able to move forward without going back to your client to reiterate what was already discussed. In as much as we need to stay agile when developing, we want to reduce the back and forth to a minimal or else it will translate into increased development costs due to the time increase in communication.
Writing and reading likewise parallel speaking and listening when it comes to understanding software specifications. They are likewise more so important, because this is the most direct means by which most of us will learn. If you wish to grow, you must read the most important books and papers in the fields that concern you. What you will come to find out is how dense such material usually are even when you have a firm grasp of the prerequisites. Without a good command of the language, you will miss out in understand the latest and relevant research in the industry and have to settle for titbits published in mass media.
I therefore, urge you all to not just obsess about your favourite language, be it, C#, Java, Python, Lisp, etc. But to also obsess about the main language in your region, English, Chinese, German, etc. |
Programming › Re: Dear Programmer In Nigeria: How Much Is Your Salary? by DonSegmond(m): 7:03pm On Nov 28, 2015 |
I pay N1600 for 4 hours of work. (Work from home). |
Programming › Re: Logical Math Question by DonSegmond(m): 5:28pm On Nov 21, 2015 |
Kodejuice: Think you're smart?, try this
A painter charges $40 per day for himself, and he also charges $10 per day for his assistant. if he paints some cars for some couple of days and received $2000. And the painter worked 10 days more than his assistant. How much will the assistant and the painter receive ? Basic algebra. Let days assistance worked = D D * 10 = Amount Assistance got paid D+10 * 40 = Amount painter got paid ((D+10) * 40) + (D * 10) = 2000 40D + 400 + 10D = 2000 50D + 400 = 2000 50D + 400-400 = 2000-400 50D = 1600 50D/50 = 1600/50 D = 32 Therefore assistance received 32 * 10 = 320 painter received 40D + 400 = 1280 + 400 = 1680 |
Programming › Re: Fizzbuzz Problem Using "Switch" Statement Construct by DonSegmond(m): 2:59am On Nov 12, 2015 |
Don't need a switch statement. for ($i = 1; $i <= 100; $i++) { $str = (($i % 3 == 0) ? "Fizz" : "" ) . (($i % 5 == 0) ? "Buzz" : "" ); echo ($str == "" ) ? "$i\n" : "$str\n"; }
|
Programming › Re: Hiring Programmers by DonSegmond(op): 2:38am On Nov 10, 2015 |
I have replied to everyone that sent a resume. I'll start conducting interviews this week and should finish next week. Thanks! |
Programming › Re: Hiring Programmers by DonSegmond(op): 4:55pm On Nov 07, 2015 |
macsleven: 07032365456 java(android),python,C,sqllite,mysql,HTML/css Please send in your resume. |
Programming › Re: Hiring Programmers by DonSegmond(op): 4:54pm On Nov 07, 2015 |
DonaldGenes: Okay, just to give you a benefit of doubt,hence, Let me see how this pans out anyway,So, how do we go about it? I'm IN Please read the first post. I posted the email where you can send in your resume. |
Programming › Re: Hiring Programmers by DonSegmond(op): 1:13am On Nov 07, 2015 |
DonaldGenes: first thing, what are you aiming at to achieve with programmers? What's your budget like and where is your location. Be specific They will be given work and paid accordingly. Location is irrelevant. You are allowed to work remote. |
Programming › Re: C Programming Help by DonSegmond(m): 6:01am On Nov 06, 2015 |
You can install linux and use gcc. It's free. |
Programming › Re: Hiring Programmers by DonSegmond(op): 5:57am On Nov 06, 2015 |
If you know anyone else, please refer them to this. |
Programming › Hiring Programmers by DonSegmond(op): 5:00am On Nov 03, 2015*. Modified: 1:54pm On Nov 06, 2015 |
I'm looking for solid programmers or those who have potential and are willing to learn You will get paid accordingly to your output, make extra income,
Knowledge of Object Oriented Programming Great written communication skills Knowledge of Javascript/HTML5/CSS and at least 1 of the following 1. Java/Android 2. Swift/IOS 3. PHP 4. Python
Recommended but not required SQL, SQLite, Postgres, Unix Environment
Send your resume to segmond AT gmail dot com. Mention your github if you have one. p/s - give me a week at most to respond
Thanks |
Programming › Re: Which Language/framework Is Recommended For Startups? by DonSegmond(m): 6:15am On Sep 23, 2015 |
DharkPoet: I never wanted to make this just a framework battle, since I would be including PHP which is purely a language though it accommodates a lot of successful frameworks.
So my question, concerning the current status quo in the techno-sphere, which of these would be suitable to start a web based startup?
1) Ruby with Ruby on Rails 2) Python with Django 3) PHP with any framework(Code Igniter, Zend 2, Yii, CakePHP or any other framework) 4) Any other Language or Framework not listed.
Thanks as I await your feedback. Whatever language you know best. Knowledge of the tooling will get your further than the language. Python, Ruby, PHP are all pretty much the same. |
Programming › Re: Can One Build A Money Making App Without Money? by DonSegmond(m): 3:02am On Sep 05, 2015 |
if you have an idea, and can't program. what else can you do? if you can bring other value, you can then pair up with a developer, if your idea is solid and they believe, they might do it for free. |
Tech Jobs › Re: A Professional Programmer To Partner With. by DonSegmond(m): 1:27am On Sep 01, 2015 |
I prayed about it, and God told me to tell you, No! |
Programming › Re: Checkout This Poultry Management App by DonSegmond(m): 1:25am On Sep 01, 2015 |
How long did it take you to build? |
Programming › Re: What Do You Hate Most In Programming by DonSegmond(m): 1:45pm On Aug 31, 2015 |
complexity |
Programming › Re: What Do Programmers Do In Airports?? by DonSegmond(m): 4:18pm On Aug 23, 2015 |
chiemmaxy2: what exactly is d work of a programmer in an airport. Take a flight or pick up someone. |
Tech Jobs › Re: Android Developer Needed by DonSegmond(m): 4:17pm On Aug 23, 2015 |
proxy20: I want to hire an app developer to create an app for my blog . pls state your pricing . I will give you the source code to use to prompt the project . I will only accept android studio or eclipse as the tool . If you show me a sample of the application will pay . let start negotiations . c jacob 5, Dhtml ,nollyj and runzlord There are already blogs that have a corresponding app, just install those blogs and you can automatically leverage their apps. |
Programming › Re: PHP Programmer Needed Urgently by DonSegmond(m): 4:13am On Aug 22, 2015 |
sheg105: hello Nairalanders, Please I need a PHP Programmer that can Use PHP with other programming language effectively and the programmer must reside in Ibadan, Oyo state.
I want to build a team of programmers to work on an existing Project (School Management System), kindly contact: 08130300766 or send me an email: shegdirectkonsult@gmail.com There are already tons of school management systems out there, it would be cheaper to use an existing one. |
|
Programming › Re: My New Year Resolution: 1 Million Naira A Month From Android App Dev In 2015 by DonSegmond(m): 2:05pm On Aug 20, 2015 |
nollyj: I am not yet near my target but my revenue has also increased since I published this post. Since this year I have just released one app https://play.google.com/store/apps/details?id=inducesmile.com.completeenglishclassic.
I am planning to develop more. I will write in December the success that I have made so far and why I might not be able to hit the 1 million bench mark.
I wish I have time like I use to but it is for good. Good luck, you will get there. Keep at it. |
Programming › Re: Tic-tac-toe by DonSegmond(m): 2:04pm On Aug 20, 2015 |
Teempakguy: I need an algorithm for tic-tac-toe.
Using JavaScript. game_over = false while not game_over: player1.move if is_game_over? game_over = true else: player2.move if is_game_over? game_over = true
function is_game_over?: if match_diagonal or match_vertical or match_horizontal: return true else: return false
function move: do get move_location if move_location.has_no_piece_on_it: valid_move = true until valid_move
That's the general idea. |
Programming › Re: Please Solve This Java Problem. by DonSegmond(m): 1:56pm On Aug 20, 2015*. Modified: 1:28am On Aug 21, 2015 |
lekropasky: Develop a Java application that determines the Gross pay for each of three employees. The company pays straight time for the first 40hours worked by each employee and time and a half for all hours worked in excess of 40hours. You're given a list of the employees, their number of hours worked last week and their hourly rates. Your program should input this information for each employee. Then determine and display the employee"s gross pay. Use class scanner to input the data.
Goodluck. For each employee: employee.pay = employee.hours * REGULAR_PAYRATE if employee.hours > 40: employee.pay = employee.pay + ((employee.hours - 40) * 0.5 * REGULAR_PAYRATE) print employee.pay
Now, write it in Java your damn self. Goodluck! |
Programming › Re: Developing An Idea Into An Application by DonSegmond(m): 7:42am On Aug 20, 2015 |
Anywhere from N10,000 to N1,000,000,0000. |
Programming › Re: My New Year Resolution: 1 Million Naira A Month From Android App Dev In 2015 by DonSegmond(m): 7:41am On Aug 20, 2015 |
Good stuff, it's almost one year later. Are you on track for your goal? |
Programming › Re: So What Does It Mean To Be Self-taught? by DonSegmond(m): 8:49am On Aug 19, 2015 |
self taught when it comes to programming is rarely true. a lot of us learn by ourselves from others by reading books, blogs, articles, code snippets, etc. so are we really self taught? at the end of the day, it really doesn't matter. only the level of competence and ability to do the job matters. |
Programming › Re: Please Help Me Test And Give Feedback On An Application I Just Wrote by DonSegmond(m): 8:42am On Aug 19, 2015 |
Great job, it looks good. How long have you been working on it? |
Programming › Re: A Simple Question by DonSegmond(m): 8:39am On Aug 19, 2015 |
eatthatcode: Hello guys, I wont say am an expert in programming, but I know my stand. With the rate at which the forum is growing, I think it's high time we we remake the forum android app, i think I can volunteer myself in that aspect, but am really dont know if it violates the foum TOS since it's not official You can't "remake" the forum as a mobile app. I have no idea what forum software they are using, but to retain the forum. The first step will be to expose it as an API if it doesn't have one already. If it doesn't, that will be a sizeable undertaking. After you have this local API, expose it as a RESTAPI that can be consumed. Then build a mobile client. The amount of effort involved and the return on investment is not truly worth it. Why not just start and solve a new project? |
Programming › Re: What Happened To Programming? by DonSegmond(m): 2:58am On Aug 18, 2015 |
Folks are still solving very exciting problems. But there's a wide gulf between being an academia and a business. One is purely for the joy and fun of it, the other is for pay. When it comes to making money, most of the problems businesses are trying to solve are simple. They want it hot and fast like you will want your akara. First to market gains the most advantage, so cobble it together by any means necessary. But hey, folks are solving interesting problem, and you can too, you just have to be willing to give up the money in lieu of fun for a while. The money might or might not come. |
Programming › What's The Biggest Project You Have Ever Worked On By Yourself? by DonSegmond(op): 9:13pm On Aug 16, 2015 |
What programming language? How long did it take you? What platform? iOS, Window, Unix, Android, Javascript? How big was your code base? 1000 lines of code? 10,000 lines of code? etc |
Programming › Re: How To Improve My Php Skills by DonSegmond(m): 1:09am On Aug 15, 2015 |
Best way is to 1) Study, but don't over study. 2) Pick a small project, work on it and FINISH IT. 3) Study other people's code (great projects) modify to your taste or contribute REPEAT
Study Computer Science in general. Programming is generic, php is just a syntax and it's library. Most books won't teach problem solving. You need to seek out books that teach problem solving, books on algorithms & data structures, design patterns, architectural designs, etc. |