Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,008 members, 7,817,973 topics. Date: Sunday, 05 May 2024 at 12:48 AM

Kudaisi's Posts

Nairaland Forum / Kudaisi's Profile / Kudaisi's Posts

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

Programming / Re: Optimizations: Some Sketchy Rants by kudaisi(m): 1:02am On May 14, 2015
Good post bro, this is why I always view any thread with your name in It. But correct me if I am wrong, to avoid ambiguities shouldn't the title be compiler optimization rather than just optimization ?

Additionally, I'm looking forward to a post on other levels of optmization for the purpose we newbies who are the majority of nairaland programming section. May be you should start from higher level optimizations such as Design before easing us in to the lower ones so that a greater portion of audience can benefit and relate with it.

Attempting to do design level optimization in middle of a project in a lot of cases can infer re-coding the entire project or even go as far as changing the programming language of choice.... A newbie would want to know why and what design level optimization entails.

Then I have two questions. A lot of peeps will open this post and be like 'what is he talking about?' and 'how does he even know this kind of thing'.

In view of the a move mentioned, how many years of coding did it take you before you started worrying about compiler level optimization ?

Secondly, please share a scenario where I will find myself having to worry about compiler optimization (apart from the array example, I learnt that when I started understanding the importance of algorithm and data structure level optimizations). From my experience, the only time I've had to consider this sort of optimization is when I'm trying to figure out which compiler to use for a certain based on how optimized they are for the task herein.

4 Likes 1 Share

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:33am On May 05, 2015
The following iterative sequence is defined for the set of positive integers:

nn/2 (n is even)
n → 3 n + 1 (n is odd)

Using the rule above and starting with 13, we generate the following sequence:

13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.

Which starting number, under one million, produces the longest chain?

NOTE: Once the chain starts the terms are allowed to go above one million.
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:32am On May 05, 2015
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...

Let us list the factors of the first seven triangle numbers:

1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over five divisors.

What is the value of the first triangle number to have over five hundred divisors?
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:31am On May 05, 2015
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.
Programming / Re: PASCAL Program by kudaisi(m): 5:07pm On May 04, 2015
I haven't worked in pascal for years. But I'm positive your answer should look something like this. If you are comfortable with the linux terminal you can run it online @ Tutorialspoint
http://www.tutorialspoint.com/compile_pascal_online.php

Program solve_equation;
Var
m, n, a, b, x : real;

Begin {no semicolon}
Write('Input number m:');
Readln(m);
Write('Input number n:');
Readln(n);
Write('Input number a:');
Readln(a);
Write('Input number b:');
Readln(b);
x:=(m div (n-2)) div ((a-b)+3);
Write('The result is: ');
Writeln(x);
Readln;
End.
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 4:35pm On May 04, 2015
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

(see image for inserts)
For example, (see image for inserts)

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 4:29pm On May 04, 2015
Borwe:


What does this question mean LOL cheesy cheesy cheesy
The set of numbers are part of single 1000-digit number. if you look through carefully, on the thirteenth row you'll notice a combination of 9989 together within the 1000-digit number and they have the greatest product because no other product (multiplication) of 4 adjacent digits(numbers that appear side by side) is greater that 5832. Now, your required to find 13 adjacent numbers with the highest product. Clear now ?
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 12:26pm On May 04, 2015
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.

73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 12:03pm On May 04, 2015
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10 001st prime number?
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:44am On May 04, 2015
The sum of the squares of the first ten natural numbers is,

(see image for inserts)
The square of the sum of the first ten natural numbers is,

(see image for inserts)
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:48pm On May 01, 2015
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10 001st prime number?
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:47pm On May 01, 2015
The sum of the squares of the first ten natural numbers is,

12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,

(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 9:46pm On May 01, 2015
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
Programming / Re: I Doubt If You All Know The Name Of Some Of The Keys On An English Keyboard! by kudaisi(m): 9:04am On May 01, 2015
lordZOUGA:
"Octothorpe"? nah man. I won't even remember that next time.
Oga just go with Hash. Octothorpe sounds like some medical term.

2 Likes

Programming / Re: I Doubt If You All Know The Name Of Some Of The Keys On An English Keyboard! by kudaisi(m): 3:52pm On Apr 30, 2015
I'm guilty.... Didn't know this --> ~ === Tilde

1 Like 1 Share

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 2:43pm On Apr 30, 2015
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

1 Like

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 2:43pm On Apr 30, 2015
The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

1 Like

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 2:43pm On Apr 30, 2015
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

1 Like 1 Share

Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 2:42pm On Apr 30, 2015
#include <stdio.h>

int main (int argc, char argv){
int sum = 0;
int counter;
for(counter=0; counter < 1000; counter++){
if ((counter%3==0) || (counter%5==0)){
sum = sum + counter;
}
}
printf("The sum of all the multiples of 3 or 5 below 1000 is %d \n", sum);
}

Answer: 233168

1 Like

Programming / Re: What are The Criteria For Closing A Thread On Nairaland ? by kudaisi(m): 2:12pm On Apr 30, 2015
LOL @
WhiZTiM:
If this thread is not closed, somebody will trek from Sokoto to Calabar smiley
Programming / Re: Trivia Coding Questions (euler Project) by kudaisi(m): 2:10pm On Apr 30, 2015
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

2 Likes

Programming / Trivia Coding Questions (euler Project) by kudaisi(m): 2:06pm On Apr 30, 2015
Series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

Have fun coding!!

PS: Try not to view other peoples solutions to problem until you have solved it yourself or you'll be deceiving yourself by copying other peoples answer, after all the whole idea it to improve your application logical thought patterns to programming.

Answer the questions in any language of your choice. Post both your solutions and the answer you arrived at after running the code.

1 Like

Programming / Re: Programming Or Msc by kudaisi(m): 11:16am On Apr 30, 2015
jonath0012:
Hello guys, please I need your candid advice on this issue:
I'm a graduate still managing somewhere and one of my cousins who works in a top coy has advised me to learn programming to increase my chance of getting good job.
However, I've been saving for a master's degree comes next year, which means if I start I start learning programming now I may not have the resources to go on with my MSc programm.

My questions are:
1. How long do you think it will take to be a guru in programming?
2. Does it really worth abandoning MSc program for?
3. Which of the best IT training centers should I enrol? N.B: I'm considering UGRL at Alen Ikeja, money wise. Need more info on this
4. Which of the programming stuff is best for me to start with?

Over to you, the gurus in the house.

Thanks.
Why do you need to ditch Msc to learn programming when you can do both ?
My advice,
1. Get some programming materials.
2. Go ahead with your Msc.
3. Learn and improve on your programming skills while doing your Msc.
4. Go through first post in the programming section, it will guide you on with programming path to take.
5. Practice and practice and practice and keep practicing [that's how programming gurus are made].

1 Like

Programming / What are The Criteria For Closing A Thread On Nairaland ? by kudaisi(m): 12:42pm On Apr 29, 2015
It seems to me that a little criticism of Nairaland is what earns a thread "Closed Thread". Or I'm i missing something ? Are there some terms of agreement I haven't read ? Can someone please enlighten me. Why are these threads closed? https://www.nairaland.com/1135108/missing-nairaland-functions and https://www.nairaland.com/2282946/nl-dream

I mean what could be wrong in wanting a syntax highlighter for the programming section of a forum where more than 50% of entries are codes ?
Have you tried to copy and paste a python code from this forum before? I bet it won't run on your computer unless you know what you are doing (Thanks to all the spacing syntax the python programmers chose to live by and the forum that refused to give us a code syntax highlighter and formatter). *kmt*

2 Likes

Programming / Re: Jquery Users Your Help Is Needed by kudaisi(m): 10:19am On Apr 29, 2015
henryobinna:
how do I create an array from a webpage content(i.e list) with an unknown length.

like creating an array that would contain list of countries on a webpage and I don't know the Number of countries available.
which means the code would fetch the total Number of countries then assign it to the area with its array.



I really need this for a little project, thanks in advance
Where are you generating the list of countries from ?...is from a JSON source or are you selecting from certain elements with specific attributes from an HTML page ? Need more specifics or code you've written so far.
Programming / Re: Please Help With This Python Code by kudaisi(m): 9:43am On Apr 29, 2015
sisqology:

No bro, I was only talking about another aspect where u can see **
Oh!..okay. Cool.
Programming / Re: Please Help With This Python Code by kudaisi(m): 2:02am On Apr 29, 2015
sisqology:
def foo(*args, **kwargs):
#some code
undecided
Did I miss something ? If you mean to refer to '*args, **kwargs' it just a common idiom used in such scenarios. It can be changed with any variable name you please as long as it does not interfere with the inbuilt Python keywords.
Programming / Re: Please Help With This Python Code by kudaisi(m): 1:55pm On Apr 28, 2015
Also bear in Mind that ** when being used with a function argument it will have entirely different meaning in variance to power function it performs in this example. So if you see a code like this
def foo(arg1, ** arg2):
#some code here
The above does note mean arg1 raised to the power of arg2
Programming / Re: Day To Day Linux Terminal Commands by kudaisi(m): 11:24am On Apr 28, 2015
HOW DO I CHECK A PACKAGE'S INFORMATION ?
apt-cache show youtube-dl
apt-cache show youtube-dl
Package: youtube-dl
Priority: extra
Section: web
Installed-Size: 2464
Maintainer: Rogério Brito <rbrito@ime.usp.br>
Architecture: all
Version: 2015.04.17-1~webupd8~precise0
Recommends: libav-tools | ffmpeg, libav-tools | ffmpeg (>= 4:0.6) | ffprobe, mplayer2 | mplayer, rtmpdump
Depends: python-pkg-resources, python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.cool
Filename: pool/main/y/youtube-dl/youtube-dl_2015.04.17-1~webupd8~precise0_all.deb
Size: 648644
MD5sum: 3796efaaf78dd21909e5e440ba0a363c
SHA1: e71064dfdda4a1c451b570bf364625fb392d2c2c
SHA256: 45ca670b804187456d1a93892df811ae973f1dd5e54907626252cdade9f5824f
Description-en: downloader of videos from YouTube and other sites
youtube-dl is a small command-line program to download videos from
YouTube.com and other sites that don't provide direct links to the
videos served.
Programming / Re: Day To Day Linux Terminal Commands by kudaisi(m): 11:22am On Apr 28, 2015
pcguru1:
Nice one i usually use the

sudo dkpg -i sometimes some software never install till i use the debian files. any code for reducing brightness my Ubuntu 14.04 is broken i think it's xrand but i still feel the battery sapping. I hate Ubuntu angry
lol @ I hate Ubuntu angry
To solve your brightness problem install xbacklight as so
sudo apt-get install xbacklight
Then you can manage you brightness within a range of 1-100 as so
xbacklight -set 40
Or if you like to work per current brightness then you can increase or decrease like this
xbacklight -dec 10
xbacklight -inc 10
Programming / Re: Who Will Teach Me Python Intensively For About 3weeks by kudaisi(m): 4:38pm On Apr 27, 2015
Borwe:
Please stop learning this slow stupid language and just switch to java for everything.
Choi!! You called Python silly and slow. In fact, i rest my case.
Programming / Re: Who Will Teach Me Python Intensively For About 3weeks by kudaisi(m): 4:29pm On Apr 27, 2015
Borwe:
Here is some prove for you...
Only reason python is cool is cause it is some how faster and easier when at writing code. But shit slow when it comes to performing the codes. WHat's the point of writing short code that lags and save 1 hour instead of writing java code that will run smoothly but probably need more code and more time to code.

Java code is compiled into byte code and then moved to the JVM to be turned to native code to excecute by the system.
Main steps after compiling java code to running it is:
ByteCode-->(by JVM)Native Code;

But Python code is written without byte code compilation. This is done in the back scene so before running a single line of code it it transformed to bytecode by the python interpreter then to native code all on the go. So everytime you run the program you have to generate bytecode over and over and over again. While Java compiles into bytecode for its JVM and excecutes only once. No need to recreate the byte code over and over again.

That is the main reason why Python sucks in performance compared to Java.
Bro I've used Python extensively and equally Java. If you really knew this two programming languages like you claim you wouldn't even dare compare them with each other (as in they are not even related). They both have their perks and caveats. We should try to maintain some professionalism when writing up post in this forum abeg.

Some beginner programmer will read a your post on python being slow and skip learning python entirely cause you said so. VLC(and many more solid application such as GNU radio) is of the most fastest media player I've come across and it might interest you to know that it was written in python. Or try doing some Digital Signal Processing (DSP) with Java as against python...life go tire you. Even for Image processing I'll def pick Python before Java. I rarely write GUI application in python however I develop most of all my utility tools in python. That said because I use them both so much for so different stuffs, please don't compare them as it is not worth it. And don't discourage people from learning either of them.

The delay in your GUI might even be as a result of the code your wrote or the GUI framework your used. It's an hasty conclusion to say that python is slow as poo (Whatever that means)

1 Like

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

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 62
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.