To change the upload limit in web.config
<!-- maxRequestLength is in KB -->
<system.web>
<httpRuntime maxRequestLength="204800" executionTimeout="99999"/>
</system.web>
If the server is iis 7 or above, also put this:
<!-- maxAllowedContentLength is in Bytes! -->
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="524288000"/>
</requestFiltering>
</security>
</system.webServer>
Wednesday, October 26, 2011
Thursday, October 20, 2011
Thumbnails from Youtube
Para sacar ou apresentar um thumbnail (120x90) de um video do youtube
http://img.youtube.com/vi/VIDEO_ID/#.jpg
VIDEO_ID = Ao id do video de onde querem sacar o thumbnail
# = ao nº do thumbnail que o youtube gera, que vai do 1 ao 4, sendo que o youtube apresenta por default o 2. O thumbnail 0 (Zero) é a imagem em tamanho grande (480×360)
Source:
http://www.reelseo.com/youtube-thumbnail-image/
http://img.youtube.com/vi/VIDEO_ID/#.jpg
VIDEO_ID = Ao id do video de onde querem sacar o thumbnail
# = ao nº do thumbnail que o youtube gera, que vai do 1 ao 4, sendo que o youtube apresenta por default o 2. O thumbnail 0 (Zero) é a imagem em tamanho grande (480×360)
Source:
http://www.reelseo.com/youtube-thumbnail-image/
Reload AddThis Script Ajax
Quando se faz replace do html do AddThis, temos de fazer reload do script, aqui fica uma maneira de fazer (Precisa de jquery).
Source:
http://stackoverflow.com/questions/1603835/addthis-button-will-not-work-inside-ajax-but-will-work-normally
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
if (window.addthis){
window.addthis = null;
}
$.getScript( script );
Source:
http://stackoverflow.com/questions/1603835/addthis-button-will-not-work-inside-ajax-but-will-work-normally
Add facebook tab to page
Maneira simples de adicionar uma facebook tab ou app a uma página do facebook
1) Ter o id da tab ou app
2) ir até http://www.facebook.com/apps/application.php?id=YOUR_APP_ID e fazer replace do YOUR_APP_ID com o id da tab/app
3) fazer add to my page (algures no canto infeior esquerdo)
1) Ter o id da tab ou app
2) ir até http://www.facebook.com/apps/application.php?id=YOUR_APP_ID e fazer replace do YOUR_APP_ID com o id da tab/app
3) fazer add to my page (algures no canto infeior esquerdo)
Wednesday, October 19, 2011
Validate Portuguese NIF
private static bool IsValidNIF(string nif) { if (string.IsNullOrWhiteSpace(nif) || !Regex.IsMatch(nif, "^[0-9]+$") || nif.Length != 9) return false; char c = nif[0]; //Check first number is (5) apenas empresas //if (!c.Equals('5')) // return false; //Perform CheckDigit calculations int checkDigit = (Convert.ToInt32(c.ToString()) * 9); for (int i = 2; i <= 8; i++) { checkDigit += Convert.ToInt32(nif[i - 1].ToString()) * (10 - i); } checkDigit = 11 - (checkDigit % 11); //if checkDigit is higher than ten set it to zero if (checkDigit >= 10) checkDigit = 0; //Compare checkDigit with the last number of NIF //If equal the NIF is Valid. if (checkDigit.ToString() != nif[8].ToString()) return false; return true; }
Inline cshtml Macro Umbraco
<umbraco:Macro ID="Macro1" runat="server" language="cshtml">
.........
</<umbraco>
Monday, October 17, 2011
Change Browser Url Bar Without making new Post
window.history.pushState("object or string", "Title", "/Url");
Thursday, October 13, 2011
Get image from Media in Umbraco Template
<img src="<umbraco:Item field='imagemCrop' runat='server'
xslt='umbraco.library:GetMedia({0},true())/umbracoFile'
xsltDisableEscaping='true'></umbraco:Item>" />
xslt='umbraco.library:GetMedia({0},true())/umbracoFile'
xsltDisableEscaping='true'></umbraco:Item>" />
Get image from media umbraco razor
@Model.MediaById(Model.imagem).umbracoFile
Render Macro Umbraco example
@( Html.Raw(umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"share\" ></?UMBRACO_MACRO>", Model.Id)))
Subscribe to:
Posts (Atom)