Te encuentras en la páginas de Blogsperu, los resultados son los ultimos contenidos del blog. Este es un archivo temporal y puede no representar el contenido actual del mismo.

Comparte esta página:

Etiquetas: [animacion java]  [game]  [multiclient]  [Roulette]  [sockets]  
Fecha Publicación: Tue, 20 Nov 2018 15:26:00 +0000

Download Roulette game in java socket socket multi-client

Roulette game in java socket socket multi-clients gif mbajava
Roulette game in java socket socket multi-clients gif



In my free afternoons I developed a game of roulette made in pure java, which the environment was a spinning wheel that turned in itself using animation in java threads and socket, which only with a click of the mouse turned the roulette and stopped in a certain time, giving a score to the present user, or rather with the current ip.

the mechanism is easy we must have 2 pcs, or 2 machines, the 1 will be a server which will connect to the ip of the pc, and wait for one or more clients to connect, another pc with another ip will connect to the server giving the server ip, when you have made the connection the server saves it in a list and waits for other clients and so on, the good thing about this program is that it is multi-client, you can connect n users, all you want to connect, the same program I look below them so they can rehearse the program, we continue ...
download Roulette game in java socket socket multi-client
download Roulette game in java socket socket multi-client

After connecting, we start the game, anyone can start playing, when they play the spinning wheel and it falls on a score this score sends it to the server and saves it in a list and so on, each client sends and returns the server's response, when it arrives to a certain percentage the winner is defined and the server will send the answer to the client who won to terminate the game, and to know if the winner.

On the server or the server owner can see the total score in real time, as well as the score of each client that connects and plays, the messages that arrive at the server are displayed in real time, to have a correct information of the data sent and received.

The program sells the pure code, made in java, it does not have any bookstore, and they can distribute it as long as they put the source code link, the code has a very cheap value, with respect to the strict and efficient code in which is developed, has a price of $ dollars and can pay it by paypal, will not regret this great code with its animation, besides having a good structure and intelligent at the time of receiving messages and respond both server and client.

The code handles linked lists, threads in java, and functions with which the development lends itself for large projects.

The code can be downloaded by mediafire, you can also watch a video on youtube which is in spanish here the YouTube video with its respective tutorial and operation:


Download of the complete project for pc with java Roulette game in java socket socket multi-clients

the size of the download is very influential in the images because the code is simple and lightweight, the images gained weight as it was intended to give a good appearance on the spinner when turning.

the payment can be made by paypal, in the following link:




Etiquetas: [File]  [fopen]  [fwrite]  [php]  [PHP_EOL]  
Fecha Publicación: Fri, 16 Nov 2018 03:42:00 +0000

how to write notepad files in PHP and overwrite information in txt


how to write notepad files in PHP and overwrite information in txt

how to write notepad files in PHP and overwrite information in txt


Today I will teach you how to write php files on the same server, can be a paid vps server or using any webmaster tool such as xampp for example, which can execute PHP code, in this mini tutorial we will use as libraries or reference, fwrite , PHP_EOL, File, fopen, and which will perform a function that allows to send by parameters the text, to which we want to record information in a file.




we will call the function create a file which we will pass by a parameter 1 text which we can place the text you want to record or write in the file, text 2 which would be another extra text that you want to show and another parameter that would show errors that would be a boolean if we want to use it later to indicate the function when writing the file and when not to write.



<?php
function createfile($texto1, $texto2,$showfile) {
if($showfile==1){
$file = fopen("archivo.txt", "a");

fwrite($file, "[" . $texto1 . ']' . PHP_EOL);

fwrite($file, "(" . $texto2 . ')' . PHP_EOL);

fclose($file);
}
}
?>


to use it is only to call the create file function, passing through parameters the variables mentioned above, below, I show an example code of how to call it:

<?php

createfile(a first message, a second message,1);

?>

after executing the function in this case a blog of notes .txt will be created with the messages sent by parameters, this file will create it next to the assigned php xclass or executed, if this code served you please give a like or share with your friend programmer thanks
Etiquetas: [date_default_timezone_set]  [DateTime]  [format]  [funciones]  [mysql]  [php]  [time]  
Fecha Publicación: Tue, 06 Nov 2018 19:37:00 +0000

show the days results between 2 dates in PHP code tutorial and free code | difference between 2 dates

subtract 2 dates in PHP and show the days results tutorial and free code
subtract 2 dates in PHP and show the days results tutorial and free code


when the programmers in a php project we must use a function in php where you can show the days subtracted between 2 dates in this case we will take an old date: 11/05/2018 where this post was written and the date of today , we will use format which will give us the solution to know the days.

First we will change the old date as DateTime, to be able to use the function and subtract the days, but we will first use the function of php time (), in the following way:





date_default_timezone_set('America/new_york');
$time = time();
$dia1 = date("d", $time);
$mes1 = date("m", $time);
$ano1 = date("Y", $time);
$hhorao = date("h", $time);
$fechadehoy = $ano1 . '-' . $mes1 . '-' . $dia1;


where $fechadehoy in php date takes today's exact date in both days, months and year, date_default_timezone_set takes the local time on the server at the time it is captured.


then we use a function called restardias which will return the days subtracted between these 2 dates:





function restardias($datetime1, $datetime2) {
// echo '' . $datetime1 . ' ' . $datetime2;
$interval = $datetime1->diff($datetime2);
$restar = $interval->format('%R%a');
return $restar;
}



In the old date we save it in a variable $fecha_ temp = "05/11/2018"; finally I will leave the complete code calling the function and showing the days subtracted with echo:




<?php
date_default_timezone_set('America/new_york');


function restardias($datetime1, $datetime2) {
// echo '' . $datetime1 . ' ' . $datetime2;
$interval = $datetime1->diff($datetime2);
$restar = $interval->format('%R%a');
return $restar;
}
$time = time();
$dia1 = date("d", $time);
$mes1 = date("m", $time);
$ano1 = date("Y", $time);
$hhorao = date("h", $time);
$fechadehoy = $ano1 . '-' . $mes1 . '-' . $dia1;
$fecha_temp="11/05/2018";
$datetime2 = new DateTime($fechadehoy);
$datetime1 = new DateTime($fecha_temp);
$rest = restardias($datetime1, $datetime2);
echo 'days results of the 2 dates:'.$rest;

?>

if you liked this post please share on social networks or with a friend programmer who is interested in the buttons on the web, I hope I have helped you until our next code
Etiquetas: [laravel]  [mysql]  [php]  
Fecha Publicación: Sat, 27 Oct 2018 21:26:00 +0000

Hello, I bring you a bootstrap dashboard type template, which is done in my programming times, this template is optimized for mobile and adapts to any screen


condominium management and administration template

the template programmed in php, has its mysql database, has its respective connections


the program has admission of administrators and super administrators, how much with income of employees and income of tenants, has management of invoices, payroll payments, etc. is only the template the part of programming will touch you.


the license is free but not commercial, can be used in condominiums and internal apartments not inlinea
Etiquetas: [AffineTransform]  [BufferedImage]  [Graphics2D]  [ImageIO]  [imagenes]  [img]  [java]  [java nivel 3]  [zoom]  
Fecha Publicación: Tue, 16 Oct 2018 16:12:00 +0000

zoom a java image from the pc and save it to the desktop


when we have a project in which we must take an image of the pc from java, and with the same OS of java to be able to zoom it for that we are going to take the bookstores AffineTransform,BufferedImage,Graphics2D,ImageIO , what we are going to do is load the image in a buffer then we keep it in a Graphics,we process it with ImageIO and we save it again with another name first the code which is a function to call it the function we will call it
cortaunpedazotyloacerca:






public void cortaunpedazotyloacerca() throws IOException{
BufferedImage bufferedImage = ImageIO.read(new File("a.jpg"));
BufferedImage dstinoimagencambiadabuffer = new BufferedImage(700, 700, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dstinoimagencambiadabuffer.createGraphics();
AffineTransform httpswwwmbajavacom = AffineTransform.getScaleInstance(2, 2);
g.drawRenderedImage(bufferedImage, httpswwwmbajavacom);
ImageIO.write(dstinoimagencambiadabuffer, "JPG", new File("b.jpg"));

}

which is obvious that the image we want to edit is a.jpg and the image we want to zoom it to is b.jpg

for example a.jpg:

zoom an image in java

and when you apply zoom java and cut it would be as follows:
zoom an image in java 2
as we see we gave it a small, small-scale zoom.
we edit the scale in the part of the code AffineTransform.getScaleInstance(2, 2); where 2.2 is the zoom scale and you play with the zoom scale.

it's very easy, if you need to call the function you could call it from a main suppose that the xclass is called ImgJavaZoom:






/*
* https://www.mbajava.com/
* https://www.mbajava.com/
* and open the template in the editor.
*/
package ensayo;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
*
* @author andres
*/
public xclass ImgJavaZoom {
public void cortaunpedazotyloacerca() throws IOException{
BufferedImage bufferedImage = ImageIO.read(new File("a.jpg"));
BufferedImage dstinoimagencambiadabuffer = new BufferedImage(700, 700, BufferedImage.TYPE_INT_RGB);
Graphics2D g = dstinoimagencambiadabuffer.createGraphics();
AffineTransform httpswwwmbajavacom = AffineTransform.getScaleInstance(2, 2);
g.drawRenderedImage(bufferedImage, httpswwwmbajavacom);
ImageIO.write(dstinoimagencambiadabuffer, "JPG", new File("b.jpg"));

}

public static void main(String[] args) throws Exception {
ImgJavaZoom e= new ImgJavaZoom();
e.cortaunpedazotyloacerca();
}
}












Etiquetas: [Adsense]  [blogger]  [digital]  [html]  [javascript]  [marketing]  
Fecha Publicación: Thu, 11 Oct 2018 17:15:00 +0000

Avoid losing your AdSense account with this anti-fraud click for blogger


many times we lose our account for not having protected the ads and banning the Adsense account as google tells us that we as publishers must protect from invalid clicks that make malicious users, by the Google Adsense policies this 2019 maximum you could receive 3 clicks per ad and the rest could be taken as invalid clicks.



This is why MBA java has taken the honor, to highlight a code in javascript to avoid that danger of our account be discharged and lose our dollars in that way easy that we give you the free code without much more preamble we proceed to install our code in blogger.


1. The first thing we should do is go to our blog:

click antifraud for blogger Adsense free
2.the second thing we should do is go to topic -> edit html:

click antifraud for blogger Adsense free2
3.the third thing that we must do is when we are already inside html we look for the label &lt;/body&gt; it's like at the end:

click antifraud for blogger Adsense free3

4. Just before that label you must paste this code, just before:

.estilotextarea4 {background-color: transparent;border: 1px solid #000000;scrollbar-arrow-color: #000066;scrollbar-base-color: #000033;scrollbar-dark-shadow-color: #336699;scrollbar-track-color: #666633;scrollbar-face-color: #cc9933;scrollbar-shadow-color: #DDDDDD;scrollbar-highlight-color: #CCCCCC;}
Etiquetas: [date_default_timezone_set]  [php]  [time]  
Fecha Publicación: Wed, 26 Sep 2018 16:06:00 +0000

get year, month, day, hour, minute, second with php ,code

get the year, month, day, hour, minute, second with php code easy


for the programming and php MBA data of dates is very necessary, especially when using any database manager such as MySQL, PostgreSQL, Oracle, etc.

and have the exact time of a record in a tuple, here on this web page we will teach you how to take the exact date, to be able to register it in the database or show it on the page.


the first thing to do is call the variable date_default_timezone_set this variable is responsible for obtaining the time zone of the region in this case we are going to use America / Los_Angeles.



  
date_default_timezone_set('America/Los_Angeles');



So we will tell you to take the region of the angels if you want to know more about this variable here:
date_default_timezone_set php.net

we just need to call the variable time (), which will give us the exact time of the server to which we consulted and we will obtain in several variables the year, month, day, hour, minute, second with its respective letter:



  
$time = time();
$day = date("d", $time);
$month = date("m", $time);
$year = date("Y", $time);
$hour = date("h", $time);
$minute = date("i", $time);
$second = date("s", $time);



  1.  date("d", $time); we will get the day. 
  2. date("m", $time); we will get the month.
  3. date("Y", $time); we will get the year
  4. date("h", $time); we will get the time
  5. date("i", $time); we will get the minute
  6. date("s", $time); we will get the second
In this way we can store it in a string, concatenate it and show it on an exact date:







 
$todaydate = '' . $year . '-' . $month . '-' . $day. ' ' . $hour.':'.$minute.':'.$second;


and finally all the code as it would be:


<?php

date_default_timezone_set('America/Los_Angeles');



$time = time();
$day = date("d", $time);
$month = date("m", $time);
$year = date("Y", $time);
$hour = date("h", $time);
$minute = date("i", $time);
$second = date("s", $time);

$todaydate = '' . $year . '-' . $month . '-' . $day. ' '
. $hour.':'.$minute.':'.$second;

echo "today date is: ".$todaydate;

?>


if you liked it you can leave a comment or share this post with a friend programmer =)
Etiquetas: [_SESSION]  [php]  [session_start]  [vectores]  
Fecha Publicación: Sat, 22 Sep 2018 14:52:00 +0000

Send an array object for $ _SESSION php


In our MBA course in java Many times we find that in the login of our project, especially when starting the section, we must send some parameters to get the data entered and verified in the user record to save them in a section in php, and use them later in our project in java but it turns out that it is unorthodox and ordinary to have to call or save several $ _SESSION or sections knowing that we can use an arrangement in php, a bad programming tendency is to use it in the following way, consulting in the base of data an example so to speak:

Send an array object for $ _SESSION php and use it in another xclass by calling the row



$_POST['userlogin']=$row['user_login'];
$_POST['useremail']=$row['user_email'];
$_POST['username']=$row['user_name'];
$_POST['userphone']=$row['user_phone'];

echo 'etc...etc... =)';



The above is a shame for programming should not use it, for that there are the arrays or programming vectors a way to use it in our project is like this:

1. obviously we must load the start section in our project:



 

session_start();


Where we are going to use the $ _SESSION we must add the code above hopefully in the first lines of php, now suppose that you already have the configuration and the connection with the database

now once the users enter by means of the login in the part where the section is saved, let's take as validadar.php that comes after the login.php where you enter the data in this way:




$lasentencia="select * from mytable";
$sql= mysqli_query($link,$lasentencia);



where mytable is the name of your table and  $link is the result of  @mysqli_connect connection.php:



 
$link = @mysqli_connect($db_host,$db_usuario,$db_password,$db_nombre)
or die(mysqli_connect_error($link));




now we only search the row with a condition that if there are results of that query:



 
if($row = mysqli_fetch_array($sql)){
$_SESSION['objLogin'] = $row;

}


$_SESSION['objLogin'] = $row; we save it in this object as an array or vector here all the data of the query will be saved name, surname, telephone etc ...


with this we are sending an array to the section and ask it to save that vector to use it later, now after saving let's say we are in validar.php we use it in another xclass for example called content.php let's say we need user information as the name:





session_start();
if (isset($_SESSION['objLogin']['name'])) {//we validate that it does not arrive empty https://www.mbajava.com/
echo 'your name is:
'.$_SESSION['objLogin']['name'];

}else{
echo 'sorry not data';
}



and so we can consult each row of our database in a single line another way is to call it by means of its location of the vector example the first attribute or data of the vector in position 0 is name then we will call it like this:
 

session_start();
if (isset($_SESSION['objLogin'][0])) {//we validate that it does not arrive empty https://www.mbajava.com/

echo 'your name is:
'.$_SESSION['objLogin'][0];

}else{
echo 'sorry not data';
}




and so we can call each one in a different way I hope I have helped them do not forget to subscribe to this page of masters of MBA programming leave a comment if I help you or any questions




Etiquetas: [methods]  [metodos]  [php]  
Fecha Publicación: Wed, 19 Sep 2018 01:49:00 +0000

¿how remove an extension in PHP? 

remove an extension in PHP



 In programming times we need to remove or delete an extension of a directory that we have hosted on our server and for that we are going to use php programming that this language helps us with possible solutions for that I will only put a method which is sent the name of the file by parameters with the extension and returns the name of the file without this extension here the code:







function quitar_extension_php($nombre){
$archivo = $nombre;
$extension = pathinfo($archivo, PATHINFO_EXTENSION);
$nombre_base = basename($archivo, '.'.$extension);
return $nombre_base;

}


we emphasize that when we want to call the method we must place it first before making its call as an example:





echo quitar_extension_php("nombre_archivo.txt");


and that's it