This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER FUNCTION NumeroExtenso(@Num INT) | |
RETURNS VARCHAR(500) | |
AS BEGIN | |
--Por Ycaro Afonso 2013-09-18 | |
--V 2.0 | |
DECLARE @FAT INT, @_FAT INT | |
DECLARE @NumRes INT = @Num, @_NumRes INT, @_NumT INT | |
DECLARE @Ret VARCHAR(500) = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION ConvertDecimalParaRealPorExtenso(@Num DECIMAL(8, 2)) | |
RETURNS VARCHAR(500) | |
AS BEGIN | |
DECLARE @Ret VARCHAR(500) = '' | |
DECLARE @N1 INT = FLOOR(@Num) | |
DECLARE @N2 INT = REPLACE(CAST(@Num - FLOOR(@Num) AS VARCHAR(20)), '0.', '') | |
IF(@N1 > 0) BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult Edit(Pessoa pessoa) | |
{ | |
if (ModelState.IsValid) | |
{ | |
db.PessoaSet.Attach(pessoa); | |
System.Data.Objects.ObjectStateEntry entry = db.ObjectStateManager.GetObjectStateEntry(pessoa); | |
entry.SetModifiedProperty("Nome"); | |
entry.SetModifiedProperty("DataNascimento"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static System.Drawing.Image Redimensionar(System.Drawing.Image image, int NewWidthMax, int NewHeightMax) | |
{ | |
float Fator = 0; | |
if (image.Width / WidthMaximo > image.Height / HeightMaximo) | |
Fator = (float)image.Width / WidthMaximo; | |
else | |
Fator = (float)image.Height / HeightMaximo; | |
int NewWidth = (int)((float)image.Width / Fator); | |
int NewHeight = (int)((float)image.Height / Fator); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER FUNCTION [dbo].[Split](@Input VARCHAR(MAX), @Var VARCHAR(MAX)) | |
RETURNS @Return TABLE (ID INT, Item VARCHAR(MAX)) | |
BEGIN | |
DECLARE @ID INT | |
SET @ID = 0 | |
WHILE CHARINDEX(@Var, @Input) > 0 BEGIN | |
SET @ID = @ID + 1 | |
INSERT INTO @Return VALUES (@ID, LTRIM(SUBSTRING(@Input, 0, CHARINDEX(@Var, @Input)))) | |
SET @Input = SUBSTRING(@Input, CHARINDEX(@Var, @Input) + 1, LEN(@Input) - 1) | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DotNetXmlHttpRequest; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
XMLHttpRequest xml = new XMLHttpRequest(); | |
xml.Open(XMLHttpRequest.EnumMethod.GET, "http://ycaro.net/"); | |
xml.Send(); | |
System.Console.Write(System.Text.RegularExpressions.Regex.Match(xml.responseText, "(.*)")); | |
System.Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[NExtenso_Extenso](@Num INTEGER) | |
RETURNS VARCHAR(50) | |
AS | |
BEGIN | |
-- Por Ycaro Afonso 03/12/2011 | |
-- V 0.1 | |
RETURN CASE @Num | |
WHEN 1000 THEN 'Mil' WHEN 1000000 THEN 'Milhões' WHEN 1000000000 THEN 'Bilhões' | |
WHEN 100 THEN 'Cento' WHEN 200 THEN 'Duzentos' WHEN 300 THEN 'Trezentos' WHEN 400 THEN 'Quatrocentos' WHEN 500 THEN 'Quinhentos' WHEN 600 THEN 'Seiscentos' WHEN 700 THEN 'Setecentos' WHEN 800 THEN 'Oitocentos' WHEN 900 THEN 'Novecentos' | |
WHEN 10 THEN 'Dez' WHEN 11 THEN 'Onze' WHEN 12 THEN 'Doze' WHEN 13 THEN 'Treze' WHEN 14 THEN 'Quartorze' WHEN 15 THEN 'Quinze' WHEN 16 THEN 'Dezesseis' WHEN 17 THEN 'Dezesete' WHEN 18 THEN 'Dezoito' WHEN 19 THEN 'Dezenove' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<system .webserver=""> | |
<rewrite> | |
<rules> | |
<!-- Se possuir mais de um blog no servidor, mude a "name" da linha abaixo para um nome qualquer --> | |
<rule name="wordpress" stopprocessing="true"> | |
<match url="^(.*)"> | |
<conditions> | |
<add input="{REQUEST_FILENAME}" matchtype="IsFile" negate="true"> | |
<add input="{REQUEST_FILENAME}" matchtype="IsDirectory" negate="true"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Module Module1 | |
Sub Main() | |
Dim ajax As New XMLHttpRequest | |
' Teste com GET | |
ajax.Open(XMLHttpRequest.EnumMethod.GET, "http://site.ycaro.net/teste.php?teste=123") | |
ajax.Send() | |
If ajax.readystate = 4 Then | |
If ajax.Status = 200 Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Module Module1 | |
Sub Main() | |
Console.WriteLine("----------------- Exemplo com Queue -----------------") | |
Dim queueList As New Queue | |
queueList.Enqueue("Item1") | |
queueList.Enqueue("Item2") | |
queueList.Enqueue("Item3") | |
queueList.Enqueue("Item4") | |
Console.WriteLine("* Queue: O primeiro a ser inserido é o primeiro a sair.") | |
Console.WriteLine("* O primeiro da fila é o -> " & queueList.Peek) |
OlderNewer