Skip to content

Instantly share code, notes, and snippets.

View aykuttasil's full-sized avatar
🏍️

Aykut Asil aykuttasil

🏍️
View GitHub Profile
public boolean isInternetAvailable() {
try {
InetAddress ipAddr = InetAddress.getByName("google.com"); //You can replace it with your name
if (ipAddr.equals("")) {
return false;
} else {
return true;
}
public static Bitmap loadBitmapFromView(View v) {
Bitmap b = Bitmap.createBitmap( v.getLayoutParams().width, v.getLayoutParams().height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
v.draw(c);
return b;
}
@aykuttasil
aykuttasil / DetailsView Backend
Last active March 17, 2016 12:17
ASP.NET DetailsVİew Kullanımı
private void FillListView(decimal pKod)
{
_mDataTable = DbManager.GetPersonelDataSet(pKod).Tables[0];
ViewState.Add("PersonelData", _mDataTable);
DetailsView1.DataSource = _mDataTable;
DetailsView1.DataBind();
}
-- To Base64 string
CREATE FUNCTION [dbo].[fn_str_TO_BASE64]
(
@STRING VARCHAR(MAX)
)
RETURNS VARCHAR(MAX)
AS
BEGIN
RETURN (
SELECT
@aykuttasil
aykuttasil / sql_md5.sql
Created March 25, 2016 14:54
Convert SQL Column MD5
SELECT TOP 10
'http://localhost:51376/?q='
+ CONVERT(VARCHAR(32), HASHBYTES('MD5',
CAST(qwerty.Gonderi_No AS NVARCHAR(250))), 2)
FROM ( SELECT gnd.Gonderi_No
FROM dbo.Gonderiler AS gnd
) AS qwerty
ORDER BY qwerty.Gonderi_No;
@aykuttasil
aykuttasil / GetShortUrl
Created March 31, 2016 09:09
Short Url
private ShortUrlResponse GetShortUrl(ShortUrlRequest shortUrlRequest)
{
var postString = JsonConvert.SerializeObject(shortUrlRequest);
ShortUrlResponse response = null;
var urlpath = "https://www.googleapis.com/urlshortener/v1/url?key=" + ConfigurationManager.AppSettings["ShortUrlKey"];
var httpWebRequest = (HttpWebRequest)WebRequest.Create(urlpath);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
public class AutoFitTextView extends AppCompatTextView {
private static final int NO_LINE_LIMIT = -1;
private final RectF _availableSpaceRect = new RectF();
private final SizeTester _sizeTester;
private float _maxTextSize, _spacingMult = 1.0f, _spacingAdd = 0.0f, _minTextSize;
private int _widthLimit, _maxLines;
private boolean _initialized = false;
private TextPaint _paint;
@aykuttasil
aykuttasil / CameraPreview.java
Last active June 22, 2016 15:15
CameraPreviewFragment
/*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=" + sonSemt +
"&daddr=" + mNavigationAdresSemt));
startActivity(intent);
USE [colombo]
GO
-- drop prev version
IF EXISTS (SELECT name
FROM sysobjects
WHERE name = N'pco_cursor_test1'
AND type = 'P')
DROP PROCEDURE pco_cursor_test1
GO