Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,037 members, 7,818,066 topics. Date: Sunday, 05 May 2024 at 06:43 AM

Challenge Me - Programming (5) - Nairaland

Nairaland Forum / Science/Technology / Programming / Challenge Me (15533 Views)

(2) (3) (4)

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (Reply) (Go Down)

Re: Challenge Me by Olyboy16(m): 9:08pm On Oct 24, 2017
dhtml118:
It can come back to life, if we want it back to life. This is the first really interesting topic in a long while.

I move the motion that we bring this board to life - what do you say guys?
told you you wouldn't last long without nairaland!

1 Like

Re: Challenge Me by QueryUnical: 9:19pm On Oct 24, 2017
TheOtherGeek:
Things are looking nice, seeing fellow devs talkin real stuff is awesome..


Hey, @queryunical what's up?

Any luck?

No, not yet. Just wondered, if u can afford d time to help craft out an algorithm.
Re: Challenge Me by Olyboy16(m): 10:16pm On Oct 24, 2017
DanielTheGeek:
But before then, I have a simple question.. I don't need to see code; just logical reasoning..
(Taken from an interview of a company I worked for)

In a co-ordinate plane, a line segment is drawn from the origin to a point A(x,y). With great efficiency, find the number of cells the line passes through Assuming X and Y are ints...

Google may not be of too much help, this is largely theoretical.

Mod: let's have more of this kind of questions as the ones involving code can easily be Googled or outsourced.. This tests the fundamental knowledge of computer science.. Programming is more of thinking than coding

step distance can be derived by
.
x' = x2 - (x1 + ni)
y' = y2 - (y1 + nj)
.
where ni and nj are loop controls for ni < x2 and nj < y2 respectively.
{(x', y')} should be a proper set of all steps from (x, y) to A(x,y) or (x2, y2)
Re: Challenge Me by bearnana(f): 10:54pm On Oct 24, 2017
Good Lord, a lot of comments to read through... shocked shocked cool cool
DanielTheGeek smiley smiley
Re: Challenge Me by Nobody: 5:41am On Oct 25, 2017
Olyboy16:

told you you wouldn't last long without nairaland!
you know nothing my friend, your stmt is very foolish.
Re: Challenge Me by Olyboy16(m): 7:11am On Oct 25, 2017
dhtml118:
you know nothing my friend, your stmt is very foolish.
what does your bible tell you about calling someone foolish?
Re: Challenge Me by Nobody: 7:27am On Oct 25, 2017
@olyboy16,
Call a thing by its proper name, you enter a thread and see people contributing meaningfully, why not follow suit? Rather you try looking for trouble, and this is why I said you are foolish (if i say otherwise, then I will be lying).

@seunthomas, please send this boy out of your thread (he is a detractor and needs jail sentence)

1 Like

Re: Challenge Me by Olyboy16(m): 7:34am On Oct 25, 2017
dhtml118:
If you cannot contribute to this thread, just gerrout of it already (you are what the oyinbo people call a pain in the neck)
i did contribute my little best a few posts away, but then i couldn't but notice you have fallen out of par with your malice with nairaland.

was just pulling your leg boss, have a great day sire.
EDIT: BTW just because you are offended doesn't give everyone your deliquent opinion!(you were once a black sheep remmba?)
if your skin is too soft for facts and i've actually pierced it with mine, then my apology(though unreserved) is on podium. Sorry Sir!

EDIT(after the post below me): (^_^) , @dhtml118 "love your neighbour as yourself" and "do not let the sun set on your anger"
Re: Challenge Me by Nobody: 7:41am On Oct 25, 2017
Do not joke about such a sensitive matter again, it is not a play play matter that I am still going to discipline Seun. I am still oiling his cane to be honest.
Re: Challenge Me by Nobody: 8:44am On Oct 25, 2017
bearnana:
Good Lord, a lot of comments to read through... shocked shocked cool cool
DanielTheGeek smiley smiley

It's a good thing majority of the comments are constructive and useful... Lol

I'm still trying to come up with a solution for that girl that quoted me cry

You should ff back on Github, BTW, are you somehow affiliated with bearnana?
Re: Challenge Me by TheOtherGeek(f): 9:44am On Oct 25, 2017
@danielthegeek

Hahahaha...let's agree your .ass got partially whooped cheesy

Okay, try another language...

1 Like

Re: Challenge Me by TheOtherGeek(f): 9:47am On Oct 25, 2017
QueryUnical:


No, not yet. Just wondered, if u can afford d time to help craft out an algorithm.

Throw it at me already man... All the guys doing all the tough stuff at work, lemme take this grin
Re: Challenge Me by Nobody: 10:38am On Oct 25, 2017
Okay, I actually almost cut my fingers coding a solution in Java... lol

I have little practical knowledge of Rust, so I was able to easily cook up a solution in C++ (C++14)

So, here's my implementation in C++14

I tested it and it works as expected, returning Yes through stdout based on the given parameters..
The solution has an exponential time complexity and aux space used is 0(1)

1 Like

Re: Challenge Me by Nobody: 10:49am On Oct 25, 2017
I did a Mandelbrot program in Rust, nothing close to a pixel manipulator but something cool



use std::io::Write;
fn main() {
let args: Vec<String> = std::env::args().collect( ) ;
if args.len() != 5 {
writeln!(std::io::stderr(),
"Usage: mandelbrot FILE PIXELS UPPERLEFT LOWERRIGHT " )
.unwrap();
writeln!(std::io::stderr(),
"Example: {} mandel.png 1000x750 -1.20,0.35 -1,0.20 ",
args[0])
.unwrap( ) ;
std::process::exit(1 ) ;
}
let bounds = parse_pair(&args[2], 'x')
.expect("error parsing image dimensions" ) ;
let upper_left = parse_pair(&args[3], ',')
.expect("error parsing upper left corner point" ) ;
let lower_right = parse_pair(&args[4], ',')
.expect("error parsing lower right corner point" );
let mut pixels = vec![0; bounds.0 * bounds.1] ;
render(&mut pixels[..], bounds, upper_left, lower_right) ;
write_bitmap(&args[1], &pixels[..], bounds)
.expect("error writing PNG file" ) ;
}

Re: Challenge Me by olulove(m): 1:14pm On Oct 25, 2017
4kings:

Rename KNMIS.mdf file, cos you've used it with a previous project or put it in a different folder.

Thank you very much sir.
i appreciate, how do i go about putting it in a new folder
USE [master]
GO

/****** Object: Database [KNMIS] Script Date: 09/03/2016 06:00:23 ******/
CREATE DATABASE [KNMIS] ON PRIMARY
( NAME = N'KNMIS', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\KNMIS.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'KNMIS_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\KNMIS_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

thank you sir
Re: Challenge Me by 4kings: 1:35pm On Oct 25, 2017
olulove:


Thank you very much sir.
i appreciate, how do i go about putting it in a new folder
USE [master]
GO

/****** Object: Database [KNMIS] Script Date: 09/03/2016 06:00:23 ******/
CREATE DATABASE [KNMIS] ON PRIMARY
( NAME = N'KNMIS', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\KNMIS.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'KNMIS_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\KNMIS_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

thank you sir
Wait first, didn't you write this code yourself?
May i ask what you think the parameter FILENAME does?


Don't call me Sir

1 Like

Re: Challenge Me by 4kings: 4:02pm On Oct 25, 2017
DanielTheGeek:
I did a Mandelbrot program in Rust, nothing close to a pixel manipulator but something cool

what's parse_pair ?
Re: Challenge Me by olulove(m): 4:05pm On Oct 25, 2017
4kings:

Wait first, didn't you write this code yourself?
May i ask what you think the parameter FILENAME does?


Don't call me Sir
yes pls.

a friend wrote and sent to me has a project, while trying to execute on SSMS i encountered that error msg 1801, level16

thank you
Re: Challenge Me by Olyboy16(m): 6:24pm On Oct 25, 2017
dhtml118:
Do not joke about such a sensitive matter again, it is not a play play matter that I am still going to discipline Seun. I am still oiling his cane to be honest.
Goodluck with that champ!


BTW in a discrete matter, there so many googled answers here!
Re: Challenge Me by Nobody: 6:34pm On Oct 25, 2017
Olyboy16:

Goodluck with that champ!


BTW in a discrete matter, there so many googled answers here!
Hmn, I cannot help but notice too. . . .I am somewhere else off nairaland battling someone over advantages of xml over json (i am for json, while the other unfortunate dude is for xml - we are still at draws, no winner yet)

1 Like

Re: Challenge Me by seunthomas: 7:03pm On Oct 25, 2017
dhtml118:

Hmn, I cannot help but notice too. . . .I am somewhere else off nairaland battling someone over advantages of xml over json (i am for json, while the other unfortunate dude is for xml - we are still at draws, no winner yet)
In most use cases json is much better as its more compact. I will always pick json over xml where i have a choice...
Re: Challenge Me by seunthomas: 7:07pm On Oct 25, 2017
DanielTheGeek:
I did a Mandelbrot program in Rust, nothing close to a pixel manipulator but something cool

use std::io::Write;
fn main() {
let args: Vec<String> = std::env::args().collect( ) ;
if args.len() != 5 {
writeln!(std::io::stderr(),
"Usage: mandelbrot FILE PIXELS UPPERLEFT LOWERRIGHT " )
.unwrap();
writeln!(std::io::stderr(),
"Example: {} mandel.png 1000x750 -1.20,0.35 -1,0.20 ",
args[0])
.unwrap( ) ;
std::process::exit(1 ) ;
}
let bounds = parse_pair(&args[2], 'x')
.expect("error parsing image dimensions" ) ;
let upper_left = parse_pair(&args[3], ',')
.expect("error parsing upper left corner point" ) ;
let lower_right = parse_pair(&args[4], ',')
.expect("error parsing lower right corner point" );
let mut pixels = vec![0; bounds.0 * bounds.1] ;
render(&mut pixels[..], bounds, upper_left, lower_right) ;
write_bitmap(&args[1], &pixels[..], bounds)
.expect("error writing PNG file" ) ;
}

Why do i suspect this guys code?? You thief this code online abi?? See person wey wan challenge me wey dey thief code online.
Programmer wey dey thief code online dat one na real programmer...
Mtchewwwww Ole buruku....
Plagiarism King.....

2 Likes

Re: Challenge Me by QueryUnical: 9:07pm On Oct 25, 2017
TheOtherGeek:


Throw it at me already man... All the guys doing all the tough stuff at work, lemme take this grin

I'm not sure but i tnk it might take several days to come up with detailed instructions.As soon as i do i will let u know.

1 Like

Re: Challenge Me by Olyboy16(m): 9:15pm On Oct 25, 2017
dhtml118:

Hmn, I cannot help but notice too. . . .I am somewhere else off nairaland battling someone over advantages of xml over json (i am for json, while the other unfortunate dude is for xml - we are still at draws, no winner yet)
json against xml? there'd be no winner if the other guy knows his tuff well. infact, aside being lightweight, js compatible, favoured by startups and easy data recovery; a good xml fanatic may seriously floor you.
Re: Challenge Me by WhiZTiM(m): 9:19pm On Oct 25, 2017
Olyboy16:


step distance can be derived by
.
x' = x2 - (x1 + ni)
y' = y2 - (y1 + nj)
.
where ni and nj are loop controls for ni < x2 and nj < y2 respectively.
{(x', y')} should be a proper set of all steps from (x, y) to A(x,y) or (x2, y2)

Hmmn
Re: Challenge Me by Olyboy16(m): 9:20pm On Oct 25, 2017
seunthomas:

Why do i suspect this guys code?? You thief this code online abi?? See person wey wan challenge me wey dey thief code online.
Programmer wey dey thief code online dat one na real programmer...
Mtchewwwww Ole buruku....
Plagiarism King.....
thought as much, that guy probably knows phew about imaging! i can smell it from behind my new iphone X2.

1 Like

Re: Challenge Me by Nobody: 9:20pm On Oct 25, 2017
It was a constructive argument (xml vs json), I can see the other dude too is quite vast. We declared draw in the end.
We both agreed that both have their uses, and cannot entirely replace each other all the time. But when it comes to database engine, and compression - json is best.
Re: Challenge Me by Olyboy16(m): 9:22pm On Oct 25, 2017
WhiZTiM:


With the assumptions that the cells are square and each corner is a coordinate (x,y)...

Then I think the cells cut through by a line is

cells = max(abs(x), abs(y))


your x and y are what sir? please add more logic to your assertion
Re: Challenge Me by WhiZTiM(m): 9:24pm On Oct 25, 2017
Olyboy16:

your x and y are what sir? please add more logic to your assertion

Nevermind...
Re: Challenge Me by Olyboy16(m): 9:26pm On Oct 25, 2017
dhtml118:
It was a constructive argument (xml vs json), I can see the other dude too is quite vast. We declared draw in the end.
We both agreed that both have their uses, and cannot entirely replace each other all the time. But when it comes to database engine, and compression - json is best.
thought as much, xml happens to be very vast, comparing xml against json is like comparing python and java.
Re: Challenge Me by Olyboy16(m): 9:30pm On Oct 25, 2017
WhiZTiM:

Nevermind...
**checked my post again to make sure i didnt type nonsense sir**
Re: Challenge Me by 4kings: 9:40pm On Oct 25, 2017
olulove:

yes pls.

a friend wrote and sent to me has a project, while trying to execute on SSMS i encountered that error msg 1801, level16

thank you
create a folder and let the FILENAME be something like:
N'C:\Users\Documents\name_of_folder'
Do same for both .mdf and .ldf file.

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

Why Self Taught Programmers Over “Exaggerate”. / Function Points (FP) Vs Lines Of Code (LOC) / Mobile Technology: Lets Build A Mobile App With Javascript

(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. 45
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.