₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,786 members, 8,423,716 topics. Date: Wednesday, 10 June 2026 at 07:47 AM

Toggle theme

Share Your Code Snippet - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingShare Your Code Snippet (2155 Views)

1 Reply (Go Down)

Share Your Code Snippet by raymod170(op):
With constant complains about how boring this section is becoming

I may just have a solution to one of the problems for now

Hello to all Senior developers and junior developers
let's share a snippet of our current project or past project and explain it briefly or extensively for educational purposes only

Thanks as you engage for fun as well
Re: Share Your Code Snippet by raymod170(op): 10:53pm On Apr 14, 2018
The code in the image below is the written using C# and sql programming languages

It's function is to update an existing record in a MySQL database to save the newly inputed values

From The image you can see from the second line that an sql query is made

line 3-5 stores each values in those objects (text boxes) in thier data rows respectively

line 6-10 does the task of converting an Image to byte array and saving the array as a blob in its respective datarow

line 11 updates the data adapter

line 12-14 interacts with the user of the system by displaying a timed information notifying the user the operation was successful

line 15 performs another method which was created outside of this method entirely

Re: Share Your Code Snippet by Doughboysss: 2:53am On Apr 15, 2018
The code below is written in php and postgresql. The function of the code is to send a different post to Facebook every time the code is run. The posts are stored in a database and a post consists of a message and an image

1. Firstly you have to install Facebook SDK for php

2. Then , we check for the id of the last sent post. If no post has been sent , we start sending from the first post otherwise we add one to the returned I'd so as to send the next post.



3. Before sending the code checks if all posts have been sent and stops sending if the limit has been reached so that the code won't crash.


4. We then send the post . first we initialise the facebooksdk then send the post.


5. After sending the post we update the table so as to know which posts have been sent.

pic3 shows the config.php file. here you have to supply your appid, appsecret, pageaccesstoken, pageid. you can get these from the developers.Facebook page.

Re: Share Your Code Snippet by raymod170(op): 12:24am On Apr 28, 2018
Implementation of conditional statements
the snippet shows the use of if/else statements for a particular function of checking if Various objects are without strings or intergers

Re: Share Your Code Snippet by raymod170(op): 4:48pm On Jun 12, 2018
raymod170:
The code in the image below is the written using C# and sql programming languages

It's function is to update an existing record in a MySQL database to save the newly inputed values

From The image you can see from the second line that an sql query is made

line 3-5 stores each values in those objects (text boxes) in thier data rows respectively

line 6-10 does the task of converting an Image to byte array and saving the array as a blob in its respective datarow

line 11 updates the data adapter

line 12-14 interacts with the user of the system by displaying a timed information notifying the user the operation was successful

line 15 performs another method which was created outside of this method entirely
Re: Share Your Code Snippet by NaHiim: 12:26am On Jul 22, 2018
Hello,
I just wanna ask the Java coders in the house, what this code snippet does. It really beats me.

private int xLevel = DEBUG_MODE ? 8 : 0;
Re: Share Your Code Snippet by abumeinben(m):
NaHiim:
Hello,
I just wanna ask the Java coders in the house, what this code snippet does. It really beats me.

private int xLevel = DEBUG_MODE ? 8 : 0;
This is simplified if else statement.
Expanded is
private int xLevel;

if (DEBUG_MODE is true)
xLevel = 8;
esle xLevel = 0;
Re: Share Your Code Snippet by Nobody: 7:26am On Jul 22, 2018
abumeinben:
This is simplified if else statement.
private int xLevel;
if (DEBUG_MODE is true)
     xLevel = 8;
 esle xLevel = 0;
 
shocked
abumeinben:
This is simplified if else statement.
private int xLevel;
if (DEBUG_MODE is true)
     xLevel = 8;
 esle xLevel = 0;
 
Re: Share Your Code Snippet by abumeinben(m): 8:37am On Jul 22, 2018
Re: Share Your Code Snippet by NaHiim: 12:25am On Jul 23, 2018
abumeinben:
This is simplified if else statement. Expanded is private int xLevel;
if (DEBUG_MODE is true)
     xLevel = 8;
 esle xLevel = 0;
 
Thank you very much sir, God bless you
Re: Share Your Code Snippet by NaHiim: 3:49am On Feb 18, 2019
check out my newly release game on play store
https://play.google.com/store/apps/details?id=com.xploore.coronawars
please review and rate it
1 Reply

Let Me Debug Your Code For YouShare Your Remote Job Experience As A DeveloperGain Confidence In Your Code Through Testing234

Web Developer NeededWhat Language should I start with?Get Your Online Banking Website Now. Hire The Best Web Developer.