Larisoft's Posts
Nairaland Forum › Larisoft's Profile › Larisoft's Posts
1 2 3 4 5 6 7 8 9 10 11 12 (of 12 pages)
larisoft: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 |
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" or die("something went wrong" ; // update the entry by changing the value of likesmysqli_close($conn) //close the connection ?> |
airsaylongcon: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. |
airsaylongcon: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. |
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. |
seunthomas:Baba mi! I dey feel u sir! |
guru01: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. |
dhtml18: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. |
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!!! |
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!!! |
dhtml18:@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!!! |
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. |
@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. |
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 |
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.
|
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. |
kyrios:Nna eh, for this guy mind, Im be Steve Jobs. |
Really bad market for telecom operators. |
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? |
Maintaining software |
Chidonc: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. |
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. |
dhtml:lol...even baba dhtml don comment. Okay; the post is growing oh... |
And thats the post eh? If only people were made to pay for posts... |
gimakon:C# feels strong while using it; but php still pay bills here in Nigeria. |
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. |
Wow:: thanks guys. Very interesting |
Thanks, guys. Your answers were really informative |
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? |
dhtml18: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. |
Oga DHTML.... Have been following your posts on this of forum and I am feeling you black and white.. More grace to your elbow. |
believe I've read this at coding horror...but very refreshing still.. |
or die("something went wrong"