Skip to content

Instantly share code, notes, and snippets.

View JaDogg's full-sized avatar
🐢
I may be slow to respond.

JaDoggx86 JaDogg

🐢
I may be slow to respond.
View GitHub Profile
@JaDogg
JaDogg / 5digits.cpp
Created January 10, 2011 13:02
Input 5 digit number and output it space separated
#include <iostream>
// #define WINDOWS_OS //enable this line if you are using windows
#define INP cout << "Input : ";
using namespace std;
int x10(int x) {
// this func calculate 10 to ther power x
int n,m ;
m = 1;
if (x>0){
@JaDogg
JaDogg / paper1b_1.cpp
Created February 25, 2011 13:10
paper1b_1.cpp
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int m_upper;
double x,B = 0.0,den;
@JaDogg
JaDogg / wxmain.cpp
Created August 9, 2013 22:48
Wxwidgets hello world in single cpp file
/*$T indentinput.cpp GC 1.140 08/10/13 01:51:37 */
/*
* wxWidgets "Hello world" Program ;
* For compilers that support precompilation, includes "wx/wx.h".
*/
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
@JaDogg
JaDogg / Thread1000.cs
Created December 10, 2013 06:47
Run thousand threads !!
using System;
using System.Threading;
namespace ThousandThreads
{
class Thread1000
{
static void Main(string[] args)
{
for (int i = 1; i <=1000; i++)
@JaDogg
JaDogg / HTMLEditorCustomizationSample.java
Last active August 29, 2015 14:03 — forked from jewelsea/HTMLEditorCustomizationSample.java
Sample Showing how to add an image to HTMLEditor
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;
@JaDogg
JaDogg / HTMLEditorCustomizationSample.java
Last active October 2, 2020 17:20 — forked from jewelsea/HTMLEditorCustomizationSample.java
Insert An Image On Caret Position JavaFX:HTMLEditor
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.web.HTMLEditor;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.scene.image.Image;
import javax.imageio.ImageIO;
import java.awt.image.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public Image getJavaFXImage(byte[] rawPixels, int width, int height) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ImageIO.write((RenderedImage) createBufferedImage(rawPixels, width, height), "png", out);
@JaDogg
JaDogg / rsctobyte.java
Created July 11, 2014 09:05
Resource to byte Array
try {
InputStream is = this.getClass().getResourceAsStream(
"/classpath/dummy.png");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = is.read(data, 0, data.length)) != -1) {
@JaDogg
JaDogg / Coordinate.java
Last active August 29, 2015 14:03
Kryo & Apache Commons Codec. Object to base64 string serialization (+ JavaFX SimpleStringProperty).
package jadogg.test;
import java.util.List;
import java.util.Optional;
import javafx.beans.property.SimpleStringProperty;
/**
* Coordinate Class
* @author jadogg
*/
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.*;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.BoxBlur;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;