C,C++,Java,C#,Android,Photoshop etc. are elements of basic development, so many times we come across situations that don't have a solution in books. The problem related to practical is very different so need different resources to sort out. Here we try to share our experience to boost up programming skills of beginners.
Monday, December 30, 2019
Image Slider for website.
Website Tools > Image Slider
1. In this we will add an <img> tag in html, with the help of jQuery we will change its source file time to time by setInterval function.
Click Here! (Link for slider demo.)
jQuery:
CSS:
HTML:
<script>
$(document).ready(function(){
$(".sliderstatus").text('Slider Status:Working!');
var count=1;
var img=new Image();
img.src="../img/sliderImages/1.jpg";
$(".a1").attr("src","../img/sliderImages/1.jpg");
//When we click left button to see previous slide.
$(".leftb").click(function(){
clearInterval(start);
if($(".sliderstatus").text()!='Slider Status:paused!')
{
$(".sliderstatus").text( 'Slider Status:paused!');
}
$(".status").attr("src","../img/sliderImages/play.png");
$(".status").show();
if(count==1){count=4}
else{count--;}
$(".a1").attr("src","../img/sliderImages/"+count+".jpg");
});
//When we click right button to see next slide.
$(".rightb").click(function(){
clearInterval(start);
if($(".sliderstatus").text()!='Slider Status:paused!')
{
$(".sliderstatus").text( 'Slider Status:paused!');
}
$(".status").attr("src","../img/sliderImages/play.png");
$(".status").show();
if(count==4){count=1}
else{count++;}
$(".a1").attr("src","../img/sliderImages/"+count+".jpg");
});
$(".status").click(function(){
start=setInterval(function(){ slider()},2000);
if($(".sliderstatus").text()=='Slider Status:paused!')
{
$(".sliderstatus").text( 'Slider Status:Working!');
$(".status").hide();
}
});
function slider(){
if(count==4){count=1}
else{count++;}
$(".a1").animate({left: "-600px"});
$(".a1").animate({left: '0px'});
//This line will change source file of image tag.
$(".a1").attr("src","../img/sliderImages/"+count+".jpg");
};
var start=setInterval(function(){ slider() },2000);
});
function again(){
var start;
}
</script>
CSS:
#center{
position: relative;
top: 150px;
}
#slider{
position: relative;
height: 20%;
width: 60%;
left: 22%;
}
#center img{
position: absolute;
border: 3px #009933 solid;
}
#buttons{
position: relative;
top: 530px;
padding: 3px;
}
#buttons img:hover{
cursor: pointer;
}
.leftb{
position: absolute;
padding: 3px;
margin-left: -30px;
border: 1px solid black;
}
.rightb{
position: absolute;
padding: 3px;
margin-left: 30px;
border: 1px solid black;
}
.leftb:hover, .rightb:hover{
border: 1.5px solid black;
}
.status{
position: absolute;
top: 35px;
left: 56%;
}
HTML:
<div id="center">
<div id="slider">
<img class="a1">
</div>
</div>
<div id="buttons"><center>
<img class="leftb" src="../img/sliderImages/left.png">
<img class="rightb" src="../img/sliderImages/right.png">
<p class="sliderstatus">Slider Status:</p><img class="status">
</center>
</div>
Sunday, August 18, 2019
How to Fix Case bypasses initialization of a local variable.
This error occurs when we use switch statement and different cases. We declare or initialize variables in one case but when our switch statement bypass that case in which any variable is declared and that variable is used in other cases which match the switch statement arguments, in that case compiler will show this problem.
#CaseBypasses #cPlusPlusProblem
Saturday, August 17, 2019
Library Management System in C++
Clcik on thew link below to see code:
https://drive.google.com/file/d/1UEONd28lZQHWpr4U6bBfZOpCfZ6Qn6N5/view?usp=sharing
https://drive.google.com/file/d/1UEONd28lZQHWpr4U6bBfZOpCfZ6Qn6N5/view?usp=sharing
Friday, August 2, 2019
How to stop a loop for event listener in between or click a button when loop is running
Question:
How to stop a loop for event listener in between or click a button when loop is running?
Answer:
Add Application.DoEvents(); in loop.
How to stop a loop for event listener in between or click a button when loop is running?
Answer:
Add Application.DoEvents(); in loop.
Wednesday, July 31, 2019
Object and collection initializer expressions may not be applied to a delegate creation expression
A delegate has no members like a class or struct has, and so there is nothing for an object initializer to initialize. If you encounter this error, it is probably because there are braces after the delegate creation expression. Just remove the braces and this error will disappear.
To correct this error
- Remove the braces.
// cs1958.cs
public class MemberInitializerTest
{
delegate void D<T>();
public static void GenericMethod<T>() { }
public static void Run()
{
D<int> genD = new D<int>(GenericMethod<int>) { }; // CS1958
// Try the following line instead
// D<int> genD = new D<int>(GenericMethod<int>);
}
}
Reference: Microsoft Website
Monday, March 4, 2019
GYM Management System in C++ Source code Free Download
https://youtu.be/V9uc3nHLC2M
Source code for GYM Management System in C++
#include<iostream.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<time.h>
void main(){
mainmenu:
clrscr();
int regn;
cout<<"\n\t\t\tWelcome to GYM Management System";
cout<<"\n\t\t************************************************";
cout<<"\n\n\n\n\n";
cout<<"\t\t\tPress 1 for Registration.";
cout<<"\n\t\t\tPress 2 for Attendance Portal.";
cout<<"\n\t\t\tPress 3 for Fee Portal.";
cout<<"\n\t\t\tPress 4 for View Gym Data.";
cout<<"\n\t\t\tPress 5 for Exercise Schedule.";
cout<<"\n\t\t\tPress 6 for Exit.\n\n\n\t\t\t";
char input1;
char male[6],option[5],contact[15],month[10],amount[10],name[12],name3[12],name2[12];
long char address[55];
cin>>input1;
switch(input1){
case '1':
clrscr();
cout<<"\n\n\t\t\t Register New User:\n";
cout<<"\t\t\t***********************\n";
cout<<"\t\t\tEnter Name: ";gets(name);
cout<<"\n\t\t\tMale (M or F): ";
cin>>male;
cout<<"\n\t\t\tConatct: ";
cin>>contact;
cout<<"\n\t\t\tAddress: ";gets(address);
cout<<"\n\t\t\tPress any key to return main screen: ";
getch();
goto mainmenu;
case '2': clrscr();
cout<<"\n\n\t\t\t Attendance for Today:\n";
cout<<"\t\t\t****************************\n";
cout<<"\n\n\n\t\t\tName of trainee: ";
gets(name2);
cout<<"\n\n\n\n\t\t\t"<<name2<<" has marked attendance sucessfully !\n\n";
cout<<"\n\n\n\n\t\tPress any key to return main screen: ";
getch();
goto mainmenu;
case '3': clrscr();
cout<<"\n\n\t\t\t Fee Portal:\n";
cout<<"\t\t\t***********************\n";
cout<<"\n\n\n\t\t\tPress 1 to Submit Fee.";
cout<<"\n\t\t\tPress 2 to View Pending Fee.\n\t\t\t";
cin>>option;
if(*option=='1'){
cout<<"\n\t\t\tName of the Trainee :";
gets(name3);
cout<<"\n\t\t\tFee of Month :";
cin>>month;
cout<<"\n\t\t\tAmount :";
cin>>amount;
cout<<"\n\n\n******************** Payment Successful! *********************\n";
}
else{
cout<<"\n\t\t\tAll trainees have done their payments!";
}
cout<<"\n\n\n\t\t\tPress any key to return main screen: ";
getch();
goto mainmenu;
case '4':
clrscr();
cout<<"\n\n\t\t\t Gym Data:\n";
cout<<"\t\t\t***********************\n";
cout<<"\n\n\t\t\tName of trainee :";
cout<<name;
cout<<"\n\t\t\tMale (M or F): ";
cout<<male;
cout<<"\n\t\t\tConatct: ";
cout<<contact;
cout<<"\n\t\t\tAddress: ";cout<<address;
cout<<"\n\n\n\t\t\tPress any key to return main screen: ";
getch();
goto mainmenu;
case '5': clrscr();
cout<<"\n\n\t\t\t Exercise Schedule:\n";
cout<<"\t\t\t***********************\n";
cout<<"\n\n\t\t\tMonday: Chest";
cout<<"\n\n\t\t\tTuesday: Biceps";
cout<<"\n\n\t\t\tWednesday: Triceps";
cout<<"\n\n\t\t\tThursday: Back";
cout<<"\n\n\t\t\tFriday: Leg";
cout<<"\n\n\t\t\tSaturday: Shoulder";
cout<<"\n\n\n\t\t\tPress any key to return main screen: ";
getch();
goto mainmenu;
case '6':
exit(1);
default :
cout<<"\n\t\t\tPlease press key from 1 to 6.";
}
getch();
}
Saturday, February 16, 2019
Crop an Image Coding: How to make crop tool using c# sharp programming.
Please Subscribe my Youtube Channel
Video tutorial for crop tool https://youtu.be/7IR6J8Kw8cE
9
Video tutorial for crop tool https://youtu.be/7IR6J8Kw8cE
9
Here is the source code for program of image crop in C sharp.➠➡➧➤
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace crop_tool_pro
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Load image
Bitmap bmp = new Bitmap("C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg");
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = (Image)bmp;
}
private void button1_Click(object sender, EventArgs e)
{
//here we declare mouse event handlers
pictureBox1.MouseDown += new MouseEventHandler(pictureBox1_MouseDown);
pictureBox1.MouseMove += new MouseEventHandler(pictureBox1_MouseMove);
pictureBox1.MouseEnter += new EventHandler(pictureBox1_MouseEnter);
Controls.Add(pictureBox1);
}
//declare some variable for crop coordinates
int crpX,crpY,rectW,rectH;
// Declare crop pen for cropping image
public Pen crpPen = new Pen(Color.White);
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
Cursor = Cursors.Cross;
crpPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
// set initial x,y co ordinates for crop rectangle
//this is where we firstly click on image
crpX = e.X;
crpY = e.Y;
}
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = "Dimensions :" + rectW + "," + rectH;
Cursor = Cursors.Default;
//Now we will draw the cropped image into pictureBox2
Bitmap bmp2 = new Bitmap(pictureBox1.Width, pictureBox1.Height);
pictureBox1.DrawToBitmap(bmp2, pictureBox1.ClientRectangle);
Bitmap crpImg = new Bitmap(rectW, rectH);
for( int i = 0; i < rectW; i++)
{
for(int y = 0; y < rectH; y++)
{
Color pxlclr = bmp2.GetPixel(crpX + i, crpY + y);
crpImg.SetPixel(i, y, pxlclr);
}
}
pictureBox2.Image = (Image)crpImg;
pictureBox2.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
base.OnMouseEnter(e);
Cursor = Cursors.Cross;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
pictureBox1.Refresh();
//set width and height for crop rectangle.
rectW = e.X - crpX;
rectH = e.Y - crpY;
Graphics g = pictureBox1.CreateGraphics();
g.DrawRectangle(crpPen, crpX, crpY, rectW, rectH);
g.Dispose();
}
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
Cursor = Cursors.Default;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace crop_tool_pro
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Load image
Bitmap bmp = new Bitmap("C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg");
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = (Image)bmp;
}
private void button1_Click(object sender, EventArgs e)
{
//here we declare mouse event handlers
pictureBox1.MouseDown += new MouseEventHandler(pictureBox1_MouseDown);
pictureBox1.MouseMove += new MouseEventHandler(pictureBox1_MouseMove);
pictureBox1.MouseEnter += new EventHandler(pictureBox1_MouseEnter);
Controls.Add(pictureBox1);
}
//declare some variable for crop coordinates
int crpX,crpY,rectW,rectH;
// Declare crop pen for cropping image
public Pen crpPen = new Pen(Color.White);
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
Cursor = Cursors.Cross;
crpPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
// set initial x,y co ordinates for crop rectangle
//this is where we firstly click on image
crpX = e.X;
crpY = e.Y;
}
}
private void button2_Click(object sender, EventArgs e)
{
label2.Text = "Dimensions :" + rectW + "," + rectH;
Cursor = Cursors.Default;
//Now we will draw the cropped image into pictureBox2
Bitmap bmp2 = new Bitmap(pictureBox1.Width, pictureBox1.Height);
pictureBox1.DrawToBitmap(bmp2, pictureBox1.ClientRectangle);
Bitmap crpImg = new Bitmap(rectW, rectH);
for( int i = 0; i < rectW; i++)
{
for(int y = 0; y < rectH; y++)
{
Color pxlclr = bmp2.GetPixel(crpX + i, crpY + y);
crpImg.SetPixel(i, y, pxlclr);
}
}
pictureBox2.Image = (Image)crpImg;
pictureBox2.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
base.OnMouseEnter(e);
Cursor = Cursors.Cross;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
pictureBox1.Refresh();
//set width and height for crop rectangle.
rectW = e.X - crpX;
rectH = e.Y - crpY;
Graphics g = pictureBox1.CreateGraphics();
g.DrawRectangle(crpPen, crpX, crpY, rectW, rectH);
g.Dispose();
}
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
Cursor = Cursors.Default;
}
}
}
Subscribe to:
Comments (Atom)
-
Please Subscribe my Youtube Channel Video tutorial for crop tool https://youtu.be/7IR6J8Kw8cE 9 Here is the source code for pr...
-
https://youtu.be/V9uc3nHLC2M Source code for GYM Management System in C++ #include<iostream.h> #include<stdio.h> #inclu...
-
Re-Download Dependecies and Gradle Sync Failed Android Studio Error Fix when upgrade to new version.Problem: Re-download dependecies and sync project(requires network) Gradle 'MyApplication' project refresh...
