Skip to content

Instantly share code, notes, and snippets.

View diogobaltazar's full-sized avatar

diogo diogobaltazar

  • Novo Nordisk
  • United Kingdom
View GitHub Profile
@diogobaltazar
diogobaltazar / src.aspx
Created December 20, 2017 16:04
ASP.NET UpdatePanel UpdateMode=Conditional
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="webForm1.aspx.cs" Inherits="aspnet_webapp.webForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Pure asp.net testing </title>
</head>
<body>
@diogobaltazar
diogobaltazar / with-anonymous-inner-class.java
Created December 30, 2017 00:46
(JAVA) Event handlers, Anonymous inner classes, lambda expressions
import java.sql.Connection;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
public class UI extends Application {
@diogobaltazar
diogobaltazar / RemConn.java
Last active December 30, 2017 03:07
(JAVA) Autocommit: database setting
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/mydatabase", "username", "pwd");
con.setAutoCommit(false);
@diogobaltazar
diogobaltazar / aspx.cs
Created January 16, 2018 09:40
(C#) nullable types (primary, complex)
decimal? percDeficiencia = candidatoData.InfoDeficiencia.PercentagemDeficiencia;
if (percDeficiencia.HasValue)
{
}
/// <summary>
/// É necessário alterar os dados, 'ddlnecalterardados'? Se sim, mostrar a
/// opção 'ddldadospessoaisalterados' de dizer se foram ou não alterados.
/// </summary>
private void ShowEscolhaAlteracaoDados()
{
// quando o valor da ddl for alterado, será gerado um postback cujo único propósito
// é o de que o fluxo volte a entrar neste método, de modo a que se valide a condição do if
ddlnecalterardados.Attributes.Add("onchange", "javascript:setTimeout('__doPostBack(\'alterarDadosPessoais\',\'\')', 0)");
public Atividade1(FormFormalizarContratoTrabalho form) : base(form)
{
// No code by default
}
protected void PopulateDropDown(DropDownList dropDown, SPList listUrl, string field, bool addSelectedItem = true)
{
int iterator = 0;
var valores = Utils.ListFieldToDropDown(listUrl, field);
if (addSelectedItem)
{
AddDefaultValueDropDownList(dropDown);
iterator++;
@diogobaltazar
diogobaltazar / prob-solving-strat.cs
Created January 22, 2018 15:07
(C#) Problem Solving Strategy
// criar uma row por cada item devolvido na query
if (tiposContratoSelect.Count > 0)
{
// clear previously created rows
// 'Multiple controls with the same ID' exception otherwise
tbtipocontrato.Rows.Clear();
foreach (SPListItem item in tiposContratoSelect)
if ((var as = Item.GetValue(TAXA_FIXA_IRS)) == "Sim")
{
SetValueAndVisible(tbcpercentagemirs, PERCENTAGEM_IRS, WebControlType.TableCell);
}
// js NONE
-- haskell
> sum [x | x <- [1..10]]