Author Archive
Creating a List with XSLT
by Bruno Rebelo on May.19, 2009, under XML, XSD, XSLT
For this XML:
<listaitems> <item>ITEM 1</item> <item>ITEM 2</item> <item>ITEM 3</item> <item>ITEM 4</item> <item>ITEM 5</item> <item>Etc...</item> </listaitems> |
using this XSLT :
<xsl:template match="rel:listaitems"> <ul> <xsl:for-each select="rel:item"> <li><xsl:value-of select="."/></li> </xsl:for-each> </ul> </xsl:template> |
The result:
- ITEM 1
- ITEM 2
- ITEM 3
- ITEM 4
- ITEM 5
- Etc…
Add Files embebed in eSpace [ Add Resource ]
by Bruno Rebelo on Mar.13, 2009, under OutSystems
To add a resource to your eSpace you can use the omlresources utility found on Service Studio directory.
You can use it like this:
>OmlResources.exe -oml youreSpace.oml -add YourFile.txt
Exporting a SQL Server Reporting Services Report Directly to PDF
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
ReportViewer report = new ReportViewer(); report.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); report.ServerReport.ReportPath = "/ReportFolder/ReportName"; string mimeType, encoding, extension, deviceInfo; string[] streamids; Warning[] warnings; string format = "PDF"; //Desired format (PDF, Excel, or Image) deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"; byte[] bytes = report.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); System.IO.FileStream sw; sw = new System.IO.FileStream(@"c:\output.pdf", System.IO.FileMode.OpenOrCreate); for (int i = 0; i < bytes.Length; i++) sw.WriteByte(bytes[i]); sw.Close(); |
How to call a report (reportserver) using C#
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
After your report been deployed, you have to add a REPORTVIEWER to your form and then :
reportURL.Text = "/REPORT1/report"; reportURL.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; reportURL.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); reportURL.ServerReport.ReportPath = reportURL.Text; reportURL.RefreshReport(); |
voilá… there its your report
Converting your Barcode to BarCode Text for EAN13 true font
by Bruno Rebelo on Feb.10, 2009, under .Net, C#
public string EAN13(string chaine) { int i; int first; int checksum = 0; string CodeBarre = ""; bool tableA; if (Regex.IsMatch(chaine, "^\\d{12}$")) { for (i = 1; i < 12; i += 2) { System.Diagnostics.Debug.WriteLine(chaine.Substring(i, 1)); checksum += Convert.ToInt32(chaine.Substring(i, 1)); } checksum *= 3; for (i = 0; i < 12; i += 2) { checksum += Convert.ToInt32(chaine.Substring(i, 1)); } chaine += (10 - checksum % 10) % 10; CodeBarre = chaine.Substring(0, 1) + (char)(65 + Convert.ToInt32(chaine.Substring(1, 1))); first = Convert.ToInt32(chaine.Substring(0, 1)); for (i = 2; i <= 6; i++) { tableA = false; switch (i) { case 2: if (first >= 0 && first <= 3) tableA = true; break; case 3: if (first == 0 || first == 4 || first == 7 || first == 8) tableA = true; break; case 4: if (first == 0 || first == 1 || first == 4 || first == 5 || first == 9) tableA = true; break; case 5: if (first == 0 || first == 2 || first == 5 || first == 6 || first == 7) tableA = true; break; case 6: if (first == 0 || first == 3 || first == 6 || first == 8 || first == 9) tableA = true; break; } if (tableA) CodeBarre += (char)(65 + Convert.ToInt32(chaine.Substring(i, 1))); else CodeBarre += (char)(75 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "*"; for (i = 7; i <= 12; i++) { CodeBarre += (char)(97 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "+"; } return CodeBarre; } |
how to make a scroll using a DIV
by Bruno Rebelo on Feb.02, 2009, under CSS
just add this to your CSS:
.Scroll350 { height: 350px; overflow: auto; scrollbar-arrow-color: blue; scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color: #888888 width: 700px; background-color: #DCDCDC; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr= '#DCDCDC' , EndColorStr= 'white' ); border: #84A3C1 1px solid; padding: 0; vertical-align: top; } |
in this example we are using a Gradient background for DIV.
Modal Popup
by Bruno Rebelo on Jan.20, 2009, under CSS, Javascript, OutSystems
function sm(obl, wd, ht) { var h='hidden'; var b='block'; var p='px'; var obol=$('ol'); var obbxd = $('mbd'); obbxd.innerHTML = $(obl).innerHTML; obol.style.height=pageHeight()+p; obol.style.width=pageWidth()+p; obol.style.top=posTop()+p; obol.style.left=posLeft()+p; obol.style.display=b; var tp=posTop()+((pageHeight()-ht)/2)-12; var lt=posLeft()+((pageWidth()-wd)/2)-12; var obbx=$('mbox'); obbx.style.top=(tp<0?0:tp)+p; obbx.style.left=(lt<0?0:lt)+p; obbx.style.width=wd+p; obbx.style.height=ht+p;inf(h); obbx.style.display=b; return false; } function hm(){ var v='visible'; var n='none'; $('ol').style.display=n; $('mbox').style.display=n; inf(v); document.onkeypress='' } function initmb(){ var ab='absolute'; var n='none'; var obody=document.getElementsByTagName('body')[0]; var frag=document.createDocumentFragment(); var obol=document.createElement('div'); obol.setAttribute('id','ol'); obol.style.display=n; obol.style.position=ab;obol.style.top=0; obol.style.left=0; obol.style.zIndex=998; obol.style.width='100%'; frag.appendChild(obol); var obbx=document.createElement('div'); obbx.setAttribute('id','mbox'); obbx.style.display=n; obbx.style.position=ab; obbx.style.zIndex=999; var obl=document.createElement('span'); obbx.appendChild(obl); var obbxd=document.createElement('div'); obbxd.setAttribute('id','mbd'); obl.appendChild(obbxd); frag.insertBefore(obbx,obol.nextSibling); obody.insertBefore(frag,obody.firstChild); window.onscroll = scrollFix; window.onresize = sizeFix; } window.onload = initmb |
css necessária :
/*Style de inicio para o panel wait*/ #mbox{ background-color:#eee; padding:8px; border:2px outset #666; } #mbm{ font-family:sans-serif; font-weight:bold; float:right; padding-bottom:5px; } #ol{ background-image: url(img/overlay.png); } .dialog { display:none; } * html #ol{ background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="img/overlay.png", sizingMethod="scale"); } /*Style de fim para o panel wait*/ |
é necessário uma imagem com efeito de transparencia.
A imagem usada no exemplo encontra-se disponivel aqui
Como usar ?
Basta criar uma div que tenha como class css dialog e colocar a infomação que pretende abrir em popup dentro da div.
para invocar a div :
botaoXPTO.Attributes["onclick"] = "sm('box',200,50);return false;"; |
How to audit from an extension ?
by Bruno Rebelo on Jan.17, 2009, under C#, OutSystems
How to save to servicenter an exception from one extension :
using OutSystems.HubEdition.RuntimePlatform.Log; … private void LogError(Exception e) { ErrorLog.StaticWrite( DateTime.Now, AppInfo.GetAppInfo().OsContext.Session.SessionID, AppInfo.GetAppInfo().eSpaceId, AppInfo.GetAppInfo().Tenant.Id, AppInfo.GetAppInfo().OsContext.Session.UserId, e.Message, e.ToString(), “My Message here”); } |
