How to find More than 1 GB files of the Bash command line for Linux
find / -type f -size +10000000k;
find / -size +1000M -exec ls -l \;
How to find More than 1 GB files of the Bash command line for Linux
How to find More than 1 GB files of the Bash command line for Linux
find / -type f -size +10000000k;
find / -size +1000M -exec ls -l \;
SQL Server Split function
USE [A5GODB]
GO
/****** Object: UserDefinedFunction [dbo].[SPLIT_FUNC] Script Date: 10/23/2014 10:08:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[SPLIT_FUNC](@string nvarchar(1000),@spliter char(1)=',')
returns @table table(id int identity(1,1) primary key,items varchar(100) not null)
AS
begin
if patindex('%'+@spliter+'%',@string)=1
begin
set @string=substring(@string,2,len(@string))
end
if patindex('%'+@spliter+'%',reverse(@string))=1
begin
set @string=reverse(substring(reverse(@string),2,len(@string)))
end
while patindex('%'+@spliter+'%',@string)>0
begin
declare @file varchar(1000)
set @file=substring(@string,0,patindex('%'+@spliter+'%',@string))
insert into @table(items)
select @file
set @string=substring(@string,patindex('%'+@spliter+'%',@string)+1,len(@string))
end
if patindex('%'+@spliter+'%',@string)=0
begin
select @file=substring(@string,0,len(@string)+1)
insert into @table(items)
select @file
end
return
end
How to show preview of image before upload using HTML5?
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<input type="file" onchange="previewFile()"><br>
<img src="" height="200" alt="Image preview...">
<script defer="defer">
function previewFile()
var preview = document.querySelector('img');
var file = document.querySelector('input[type=file]').files[0];
alert (file);
var reader = new FileReader();
reader.onloadend = function ()
preview.src = reader.result;
alert (preview.src);
if (file)
reader.readAsDataURL(file);
else
preview.src = "";
</script>
</body>
</html>
How to save uploaded image in grails
View
<g:form action="upload" method="post" ENCTYPE="multipart/form-data">
<div class="file-upload">
<label>Choose image</label>
<input id="fileupload" type="file" name="fileupload"/>
<input type="submit" value="Upload file" />
</div>
</g:form>
Controller
class TestController
def index()
def upload()
if (params.fileupload)
if (params.fileupload instanceof org.springframework.web.multipart.commons.CommonsMultipartFile)
// new FileOutputStream('testimage.jpg').leftShift( params.fileupload.getInputStream() )
params.fileupload.transferTo(new File('testimage.jpg'))
else
log.error("")
How to save a base64 decoded image in the filesystem using grails
Controller
import sun.misc.BASE64Decoder
class TestController
def index()
def save()
def file = params.file.toString().substring((params.file.toString().indexOf(",") + 1), params.file.toString().size())
byte[] decodedBytes = new BASE64Decoder().decodeBuffer(file)
def image = new File("C:/Users/Steven/Desktop/test/testimage.jpg")
image.setBytes(decodedBytes)
View
<!DOCTYPE HTML>
<html>
<head>
<style>
body
margin: 0px;
padding: 0px;
#buttons
position: absolute;
left: 10px;
top: 0px;
button
margin-top: 10px;
display: block;
</style>
</head>
<body>
<div id="container"></div>
<div id="buttons">
<button id="save">
Save
</button>
</div>
<script type="text/javascript" src="$resource(dir: 'js', file: 'jquery-1.7.min.js')"></script>
<script type="text/javascript" src="$resource(dir: 'js', file: 'sammy.js')"></script>
<script type="text/javascript" src="$resource(dir: 'js', file: 'kinetic-v5.1.0.min.js')"></script>
<script defer="defer">
var stage = new Kinetic.Stage(
container: 'container',
width: 578,
height: 200
);
var layer = new Kinetic.Layer();
var box = new Kinetic.Rect(
x: 200,
y: 80,
width: 100,
height: 50,
fill: '#00D2FF',
stroke: 'black',
strokeWidth: 4,
draggable: true,
dragOnTop: true
);
box.on('mouseover', function()
document.body.style.cursor = 'pointer';
);
box.on('mouseout', function()
document.body.style.cursor = 'default';
);
var box2 = new Kinetic.Rect(
x: 200,
y: 80,
width: 100,
height: 50,
fill: '#00D2FF',
stroke: 'black',
strokeWidth: 4,
draggable: true,
dragOnTop: true
);
box2.on('mouseover', function()
document.body.style.cursor = 'pointer';
);
box2.on('mouseout', function()
document.body.style.cursor = 'default';
);
var box3 = new Kinetic.Rect(
x: 200,
y: 80,
width: 100,
height: 50,
fill: '#00D2FF',
stroke: 'black',
strokeWidth: 4,
draggable: true,
dragOnTop: true
);
box3.on('mouseover', function()
document.body.style.cursor = 'pointer';
);
box3.on('mouseout', function()
document.body.style.cursor = 'default';
);
var box = new Kinetic.Rect(
x: 200,
y: 80,
width: 100,
height: 50,
fill: '#00D2FF',
stroke: 'black',
strokeWidth: 4,
draggable: true,
dragOnTop: true
);
layer.add(box);
layer.add(box2);
layer.add(box3);
stage.add(layer);
// $(stage.content).on('mousewheel', ui.zoom);
document.getElementById('save').addEventListener('click', function()
stage.toDataURL(
callback: function(dataUrl)
$.ajax(
type: "POST",
url: "save",
data: file: dataUrl
).done(function( respond )
alert(respond);
);
// window.open(dataUrl);
);
, false);
</script>
</body>
</html>
sugarhosts.com November Specials @ 2014
Shared Web Hosting
Promotion #1: Free Dedicated IP for Shared Pro Plan
Valid On: Any New Shared Pro Annual, Biennial and Triennial Orders
Valid Until: November 30, 2014 GMT
* Please contact Sales Department for dedicated IP after ordering.
* This can be applied UNLIMITED TIMES per client globally.
Promotion #2: 30% Off First Payment
Promotion Code: November2014
Valid On: Any New Shared Standard and Shared Pro Annual, Biennial and Triennial Orders
Valid Until: November 30, 2014 GMT
* Not valid on renewal invoices
* This can be applied UNLIMITED TIMES per client globally.
Promotion #3: Get Hong Kong Hosting at the same price as hosting in other datacenters
Valid On: Any New Hong Kong Shared Web Hosting Orders
Valid Until: November 30, 2014 GMT
* 40% price increase is waived in November.
Visit cheap vps services provider: sugarhosts.com!
New Servers Arrived NeedaServer.Net Great Offer- Promo Code K9Z5XQV2R2
The Bronze is Dual Quad Core 24 GB RAM 1TB SATA Drive or 128 GB SSD Drive with 100 Mbps Unmetered for only $53.96 with this Promo Code K9Z5XQV2R2
The Silver Starts $71.95 with this 2 x Hex Core Intel Processors- 100 Mbps 1 TB SATA Drive 24 GB RAM – Use Discount Code K9Z5XQV2R2
Order quick while they last- The Bronze can be up today, allow till Friday for Silver or Gold
Visit NeedaServer.Net!