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
int main(int argc, const char *argv[]) { | |
// First way, using the language | |
@autoreleasepool { | |
// A new pool is created and released outside this, we can nest pools as well | |
} | |
// Using the class | |
NSAutoreleasePool *pool; | |
pool = [NSAutoreleasePool new]; | |
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
#include "stdafx.h" | |
#include <stdio.h> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
auto banana = 1; | |
auto func1 = [banana](int i) -> int { return i + banana; }; | |
banana = 5; | |
auto result = func1(3); |
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
[AcceptVerbs(HttpVerbs.Post)] | |
public ViewResult Register(Member member, PasswordEntryForm password_entry) | |
{ | |
Validate(member); | |
Validate(password_entry); | |
if (ModelState.IsValid) { | |
registrationService.RegisterCandidate(member, password_entry.Password); | |
ControllerContext.HttpContext.Session["candidate_username"] = member.Username; | |
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
[ActionName("FirstAction")] | |
public ActionResult DoSomething(string someValue) | |
{ | |
} | |
[ActionName("SecondAction")] | |
public ActionResult DoOther(string someValue) | |
{ |
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 System.Collections.Generic; | |
using System.Web.Mvc; | |
using Rioshu.Educa.Extensions; | |
using Rioshu.Educa.Forms; | |
using Rioshu.Educa.Model; | |
using Rioshu.Educa.Services; | |
using Rioshu.Utils; | |
using Rioshu.Utils.Dbc; | |
namespace Rioshu.Educa.Controllers |
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
<%@ Page Language="C#" Inherits="MvcContrib.FluentHtml.ModelViewPage<MemberEntryForm>" Culture="auto" %> | |
<%@ Import Namespace="Rioshu.Educa.HtmlHelpers"%> | |
<%@ Import Namespace="Rioshu.Educa.Controllers"%> | |
<%@ Import Namespace="Rioshu.Educa.Forms"%> | |
<%@ Import Namespace="MvcContrib.FluentHtml" %> | |
<%@ Import Namespace="Microsoft.Web.Mvc" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" > | |
<head runat="server"> |
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
var resizedImage = origImage.ToSize(260); | |
var jpegEncoder = GetEncoder(ImageFormat.Jpeg); | |
var qualityEncoder = Encoder.Quality; | |
var qualityParam = new EncoderParameter(qualityEncoder, 100L); | |
var parameters = new EncoderParameters(1); | |
parameters.Param[0] = qualityParam; | |
// Cambiamos la calidad del jpeg | |
context.Response.ContentType = "image/jpeg"; |
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 Image ToSize(this Image image, int width, int height) | |
{ | |
var resizedImage = new Bitmap(width, height); | |
using (var graphics = Graphics.FromImage(resizedImage)) | |
{ | |
graphics.DrawImage(image, 0, 0, width, height); | |
} | |
return resizedImage; | |
} |
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
private static ImageCodecInfo GetEncoder(ImageFormat format) | |
{ | |
var codecs = ImageCodecInfo.GetImageEncoders(); | |
foreach (var codec in codecs) { | |
if (codec.FormatID == format.Guid) { | |
return codec; | |
} | |
} | |
return null; | |
} |
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 Image ToSize(this Image image, int width, int height) | |
{ | |
var resizedImage = new Bitmap(width, height); | |
using (var graphics = Graphics.FromImage(resizedImage)) | |
{ | |
graphics.SmoothingMode = SmoothingMode.HighQuality; | |
graphics.CompositingQuality = CompositingQuality.HighQuality; | |
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; | |
graphics.DrawImage(image, 0, 0, width, height); | |
} |
OlderNewer