₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,171 members, 8,420,653 topics. Date: Friday, 05 June 2026 at 08:19 AM

Toggle theme

Larisoft's Posts

Nairaland ForumLarisoft's ProfileLarisoft's Posts

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

ProgrammingRe: Who Can Help Me Out With This Codes? by larisoft: 9:22am On Feb 26, 2016
larisoft:
you will have to use ajax to implement the feature

in your html:

<button onclick='increment_like(1, 3)'> Like </button> <!-- '1' being the id of the post and '3' being its current number of likes -->


Now in your javascript:

<script type='text/javascript'>

//

function increment_like(postId, currentLikes){

var variables = {id: postId, current_value: currentLikes};

$.post("http://ursite.com/increment_likes.php", variables , function(data, status){

alert('updated'); //this happens when the value has been changed

});

}
</script>

IN your increment_likes.php


<?php

$id = $_POST['id'];
$currentValue = intval($_POST['current_value']);

$currentValue++; // add 1 to the no of likes

//connect to database here (you know what i mean)

mysqli_query($conn, "UPDATE likes_table SET no_of_likes = $currentValue WHERE id = $id"wink or die("something went wrong"wink; // update the entry by changing the value of likes
mysqli_close($conn) //close the connection
?>
This will require jquery of course.

If this is too complicated, then you can use html to go to the post of the page where the like button is located after a reload.

http://mypage.php#postSection1.



You will have to assign a different post section id to each post like this


<section id='postSection1'>
<!-- post here -- >

<! -- post button here -- >

</section



Phew... I really hope any of this makes sense
ProgrammingRe: Who Can Help Me Out With This Codes? by larisoft: 9:15am On Feb 26, 2016
you will have to use ajax to implement the feature

in your html:

<button onclick='increment_like(1, 3)'> Like </button> <!-- '1' being the id of the post and '3' being its current number of likes -->


Now in your javascript:

<script type='text/javascript'>

//

function increment_like(postId, currentLikes){

var variables = {id: postId, current_value: currentLikes};

$.post("http://ursite.com/increment_likes.php", variables , function(data, status){

alert('updated'); //this happens when the value has been changed

});

}
</script>

IN your increment_likes.php


<?php

$id = $_POST['id'];
$currentValue = intval($_POST['current_value']);

$currentValue++; // add 1 to the no of likes

//connect to database here (you know what i mean)

mysqli_query($conn, "UPDATE likes_table SET no_of_likes = $currentValue WHERE id = $id"wink or die("something went wrong"wink; // update the entry by changing the value of likes
mysqli_close($conn) //close the connection
?>
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 8:46am On Feb 26, 2016
airsaylongcon:
Learner! Here are the options available.
A) O(k) (B) O(kn) (C) O(k²n) (D) O(n logk n) [log Base k] (E) O(n²)

Now do you wanna wipe of the rubbish you put up there as none of it is in the options available.
Please, i need everyone who knows a thing or two about algorithms to run my code and tell me if it does not address the stated problem in O(n log k) time.

Airsalong, am tired of doing the whole insult me I i insult you thing ( that is; if i ever did it before now). Now, examine your question, and examine my answer. Algorithms usually have different flavors of implementation, each of which may be less or more optimal. Bucketsort algorithm for instance, has an implementation that resolves its last stages with counting sort, and yet another that resolves it with insertion sort...etc. Each of these implementations vary in performance.

IN the options provided, I see how it is possible to implement a solution that will run in O(n log kn) (D) time. But my solution is obviously better than this. There is also the possiblity that a solution exists that implements the algorithm in O(k) time (which will be really really interesting). Whichever way, my solution is valid.

Please, you or anyone, should tell me why my solution is wrong. Is it because the place you copied your question from, implemented another flavor of the very popular k-array sort problem? Or is it because, you have read the answer and found fault with my algorithm ?

I am just trying to learn.
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft:
airsaylongcon:
A k-sorted array is a nearly sorted array in which no element is more than k locations away from its final position in the sorted array. Thus, a 0-sorted array is completely sorted and every array of size n is n-sorted. Suppose that A is a k-sorted array of size n. If insertion sort is used to sort A, what is the order of growth of the number of comparisons performed by the sorting algorithm in the worst case?
Give your answer in Big O notation


That's a question combining both data structures and algorithm.

Larisoft come and see o. A little data structures and algorithm question for you as you're seunthomas protégé and need to get your dirty mouth washed with kline and hypo
Lol! I just saw this now while reading the thread again.

So its me and you now eh? lol!

the answer to your question is O(n log k) time when we use insertion sort to sort the nearly sorted arrays. Insertion sort is an algorithm that runs through the array, upon meeting any element, it compares it with all the elements before it, till it finds its proper place in the array, after which it goes back to the element immediately after the swapped one.

Would you like an implementation of this? I got you covered!

here it is in C

void insertionSort(int A[], int size)
{
int i, key, j;
for (i = 1; i < size; i++)
{
key = A[i];
j = i-1;
while (j >= 0 && A[j] > key)
{
A[j+1] = A[j];
j = j-1;
}
A[j+1] = key;
}
}

this will sort the array in O(n log k). n being the length of the array and k being the maximum distance between an array element and its proper place when the array is sorted.

THANKS.
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 7:27pm On Feb 25, 2016
Anyone here that has followed this thread up till this moment and called the OP an incompetent programmer has no business programming. Even dhtml confirmed it.

Its a pity that both teenagers and men are given the same opportunity here to exchange words and the nooby teenagers wont even respect themselves and learn from people willing to teach them.

Bill Gates wrote windows and microsoft office?

What kind of ignorance has not been advertised on this thread! And he is trying to correct them, and they are arguing! You guys dont know what you are saying and its clear to anyone who has been in this game long enough. Why not shut up and learn from someone who does?

Na war ooo.
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 10:56am On Feb 25, 2016
seunthomas:
You can learn from me a lot. For example this code snippet you posted is bad code...... LOL.
Baba mi! I dey feel u sir!
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 7:41am On Feb 25, 2016
guru01:
Everybody is just claiming to sabi several language, basic,qbasic,prolog,ada etc.
As for me i still stick with my php, but if you need me to write in other language, give me 24 hours and i will build a program with anyone.
My brother; where you are now, many programmers, including myself have been and we will all tell you the same thing: learn at least 5 other languages. If PHP is all you know, then there are so many programming concepts you may be missing out on. Ones that readily come to mind will be delegates...interfaces...building apps with maven/ gradle e.t.c. Gods' speed.
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 7:33am On Feb 25, 2016
dhtml18:
This thread seem to be getting more and more interesting o jare. . .
Keep showing portfolio. The day I will challenge you; you will see you have nothing in that regard (Mobile, web, desktop and 15 languages developer? lol. For one, visit playstore and search 'larisoft' - or forget. Its not me and you...yet.) .

But unlike you, I know portfolios are what even kids possess. Programming Competitions are about problem solving!!! ALgorithms!!!! Data structures!!!!

No programming competition you will ever engage in will ask for what you have done and that's why am very mute about mine. Check out topcoder.com, coderbyte.com, codechef.com, codeforce.com, leetcode.com. These sites will show you your real worth.

If you do, and realize how much ground you have to cover in these, you will respect seunthomas and some other quiet people here, and criticize small small. Because, i assure you, you dont even know it, talk more, know it all.
ProgrammingRe: The Greatest Programmer On Nairaland by larisoft: 3:36pm On Feb 24, 2016
Seunthomas, I totally agree wtih you sir!

Programming is not about hacking up software and knowing a thing or two about every language. Every kid can do that. Its about problem solving, algorithms, and data structures.

I have been reading your comments on this forum and they are usually so informed and mature....unlike you-know-who that just makes me laugh all the time.

Am waiting and cheering boss! Today na today!!!
ProgrammingRe: Please Criticize It, Condemn It by larisoft: 9:23am On Feb 23, 2016
Your site is wonderful! You will have to spend more time working on it of course...we all do after every project; but am really impressed with all the bells and jingles in there. I bet you got a lot of 'inspiration' from facebook.


Things I noticed you should work on:

1. Font sizes
2. Your link hover effect is kinda unprofessional.
3. Your background image should be a little faded to allow text clarity
4. There is a missing picture on your header page, after logging in.
5. Password input boxes for sign up should hide entered text. (only one hides it at the moment)
6. Your logout symbol... kindly consider using the font-awesome icons. The blue color of that symbol is kinda off.
7. The fancy javascript loading thing is cool...but it seems to be affecting performance.

But like I told you; These are ordinarily expected in every project that has just been concluded. Thumbs up and keep us posted on its development!!!
ProgrammingRe: Shutting Down A Computer Using Notepad (beginners Tutorial) by larisoft: 9:04am On Feb 23, 2016
dhtml18:
I can even close my eyes and do that on windows. Just press LOGO-KEY + R, type command and press enter, no need of prompt sef.
Why would i want to write that in a batch file? I get better things to do with a batch file o jare - dont let us even go there. I be master for batch-file writing, but it is a basic skill that every win32 programmer should have.

Writing batch file for a windows programmer, is like writing bash files for linux - but i be cross-platform programmer sha.

This OP is just a bloody attention seeker, ain't even got better post to make sef. Deserves a permanent ban for constituting nuisance to the board.
@dhtml, are you sure you are not the one seeking attention? You honestly amuse me with your posts on this forum atimes. He has posted what he knows which many of us humble users do not. You know it. We dont. Would the world have shattered to pieces if you didnt rub it in our faces that you can do it with your eyes closed? And who asked if you are a cross platform batch programmer with unix skills? Do you know how many of us know same, and are quietly lauding the OP for being generous with his knowledge?

I know you and know you are a little skilled, but this is just immature.

@OP, thank you jare. I 've been using this to shutdown my system using a timer everynight (Love playing music at night) , but the adding comment thing never occurred to me till you posted this. Thanks, man!!!
ProgrammingRe: How Do I Create A Java App That Works With A Relational Database? by larisoft: 8:45am On Feb 22, 2016
Ur question is not clear enough. But if u re writing a java web app, there is mysql and jbdc. If its desktop, look into h2 db.
ProgrammingRe: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by larisoft: 4:20am On Feb 18, 2016
@dhtm, the idea behind ur wrapper is laudable but I think u should be more welcoming to criticism.

For one, what the wrapper offers in sql statements is an implementation of the active records pattern, which is already present in too many existing frameworks and wrappers. Its not any more concise than what's available, its not clear what real developer problem it addresses, and its security seems highly questionable.

Why then should a developer use this as opposed to other libraries that bring unique features to the table?

A mature response to these questions would have been: I was jst trying out stuff on my own or this is why my stuff is unique...

Still; nice work. U have potentials.
Tech JobsRe: Am In Need Of A Software Engineer With PHP knowledge Available For Hiring ? by larisoft: 10:51am On Dec 09, 2015
Well go to playstore and search for ' larysoft' (over 20apps to my name there ( my java skills))
now visit tfellow.com, and safehaventechnologies.com.ng ( my php/javascript/html5 skills)
now google Larry Okeke for other side attractions.

If you think you have what it takes to hire me, my email is larypetero@gmail.com.

Thanks
ProgrammingMy Free Quick Shopping List Android App by larisoft(op): 12:02am On Nov 01, 2015
I, ll appreciate programmers in the house to use and judge it. Am not a beginner oh. At worst, am an advanced intermediate developer, as such; criticism is highly welcome.

The app is for making lists of what you ll eventually buy. Its very simple to use. Just add items and price, and see overall total without needing a calculator.


Thanks.

ProgrammingRe: Why Do HTML5 Mobile Apps Have A Bad Reputation (cordova / Phonegap)? by larisoft: 11:55pm On Oct 31, 2015
Webcraft, I know you know your stuff; and your post is definitely in order. However, here are my observations about hybrid apps:

1. They are usually larger than native apps.
2. They are slower; optimize all you want. Even the ones given as example were impressive looking, but still lagged a little. I suppose this can be ameliorated by using higher end devices.

But your points are salient.
ProgrammingRe: In Need Of Software Developers by larisoft: 7:35am On Oct 05, 2015
kyrios:
it wouldn't hurt at least if I tell you the idea and you don't like it you can always cut all ties and its not like am asking you for money or trying to scam you
Anyone interested can call me on
Zero7zero64one485eight7
Nna eh, for this guy mind, Im be Steve Jobs.
ProgrammingRe: Google To Bring Free Wifi To The World by larisoft: 9:41am On Oct 04, 2015
Really bad market for telecom operators.
ProgrammingRe: In Need Of Software Developers by larisoft: 9:40am On Oct 04, 2015
What's your remuneration like, bro? Except your looking for amateurs, you don't think any developer that knows his onus would be waiting around for some genius to say he has a big idea that will break the market, so he can start brain storming and coding with this genius, do you?
ProgrammingRe: What Do Programmers Do In Airports?? by larisoft: 12:19pm On Aug 22, 2015
Maintaining software
CareerRe: First-class Can Sometimes Be Frustrating by larisoft: 10:55pm On Aug 11, 2015
Chidonc:
your foolishness is getting to you, u must nt comment on every post and if you should, atleast be sensible, was he the one that made you not to graduate with first class ?
Nonsense. In Nigeria; people who get first class from good universities are living fine! Most of them get job offers from the universities where they studied. The rest walk into offices established by their alumni and doors are thrown wide open. It is posts like this that discourage students in real universities from working hard.

As far as am concerned; if you can't pass jamb; go do something else with your life. Not everyone must have a degree. Go learn a skill..a trade.. or start a business.

If you must go to school; go to one that will be worth the stress and the money you are paying.

If the OP tells me he got that first class from UNILAG, UNIBADAN, UNN, or UNILORIN (Just to mention a few); then I apologize for being a fool. If he got it from a private, or unknown university; then he should know that his problem is not his first class; but the institution that awarded it. And he should style his complaints appropriately so as not to discourage others that are working hard towards what they believe in.
CareerRe: First-class Can Sometimes Be Frustrating by larisoft: 5:19pm On Aug 11, 2015
I smell a rotten fish here. Did you get a first class from all these private universities where firstclass is given to 80 percent of all graduants or did you get it from a renown institution in Nigeria, i.e. UNILAG, UNN, UNIPORT...e.t.c?

Am guessing your answer is no.

You got what was coming to you.
ProgrammingRe: Programming Is Like Sex... by larisoft: 5:11pm On Aug 11, 2015
dhtml:
When i posted a topic called "trollin", both I am the topic were banned till kingdom cum.
lol...even baba dhtml don comment. Okay; the post is growing oh...
ProgrammingRe: Programming Is Like Sex... by larisoft: 10:17am On Aug 11, 2015
And thats the post eh? If only people were made to pay for posts...
ProgrammingRe: Help Out! On SQL INJECTION by larisoft: 6:36pm On Aug 10, 2015
gimakon:
Why worry about php when you have a super duper c# environment you can use to save data and still protect it from hackers and thieves? And it's even quite simple to understand!
C# feels strong while using it; but php still pay bills here in Nigeria.
ProgrammingRe: Help Out! On SQL INJECTION by larisoft: 9:04am On Aug 10, 2015
All of these generally sterilize unwanted characters in your SQL statement. These unwanted characters like say "\x00, \n, \r, \, " can break your queries and cause you lots of trouble; so you sterilize your statments by telling the server to disregard them all and treat your input as dead text.

mysql_real_escape_string(): makes a text safe for input into the database. You dont need to worry about the details of the characters. The server determines what characters to remove.


add_slashes(): makes text safe for input to the database by escaping "'" and """ characters so mysql does not interpret these as delimiters.

preg_match() : a search function. you could use this to check if your text contains unsafe characters, before removing them with str_replace or something...


That said; You really should consult google first before posting questions like this. I am sure answers to your question abound in search engines.
ProgrammingRe: Do Certificates Matter When Employing A Programmer? by larisoft(op): 4:52pm On Aug 09, 2015
Wow:: thanks guys. Very interesting
ProgrammingRe: Do Certificates Matter When Employing A Programmer? by larisoft(op): 1:50pm On Aug 08, 2015
Thanks, guys. Your answers were really informative
ProgrammingDo Certificates Matter When Employing A Programmer? by larisoft(op): 12:04am On Aug 08, 2015
From experience; anytime a programmer fronts a lot of certificates; its a sign that he figured he would never become a good programmer; and sought to hide his incompetence in a sea of papers. Being a developer myself; i know no one can learn programming from school. But still; the Nigerian mentality is so certificate conscious that I wonder if this really affects the way coders are employed.

Please, the experiened coders in the house; has your possession or lack of a certificate aided or impeded you in securing a job in the industry?

Employers; when would you employ a developer who has no certificate but has an impressive portfolio?
ProgrammingRe: The 5 Types Of Programmers by larisoft: 5:49pm On Jun 21, 2015
dhtml18:
Me i belong to an unmentioned category called #TROLL PROGRAMMERS# - we work on every gaddem platform - web, pc, mac, cloud, android, ios, everything so long as we make GODDAMN MONEY! We dont even care whether we sabi the language or not, we just jump in, get the job done and walk out.
I work on a handful of platforms too...well all the platforms mentioned, save for IOS. Unfortunately, the money part aint happening yet. How does that even happen, bro? I know you are good at this code thing. Are you permanently employed or what? Your advise will be valuable not just to me, but to a lot of people reading this.
ProgrammingRe: How To Build An Android Chat Like Whatsapp For Absolute Beginners by larisoft: 6:30pm On Jun 20, 2015
Oga DHTML.... Have been following your posts on this of forum and I am feeling you black and white.. More grace to your elbow.
ProgrammingRe: The Eight Levels Of Programmers by larisoft: 12:50pm On Jun 18, 2015
believe I've read this at coding horror...but very refreshing still..

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