Skip to main content

Add custom CSS to WordPress

Add custom CSS to WordPress

The Theme I'm using (evolve by Theme4Press) in this WordPress Blog is not rendering bullets on unordered lists.

To fix this problem I did the following:

  • Go to Dashboard, Appearance, Custom CSS
  • Add the following to the file
/* Insert Custom CSS here */
.post-content ul li{
list-style:disc;
}
.post-content ul li ul li{
list-style:circle;
}

That's It! Now the first level of unordered lists will show disc bullets and the second level circle bullets, like this:

  • First level
    • Second level

A C# polygon library for Boolean operations

A C# polygon library for Boolean operations

Today I was looking for a library for Boolean and offsetting operations on polygons and I stumbled upon this little library called Clipper by
Angus Johnson.

It is distributed in source form in various languages including C# and is freeware both for opensource and commercial applications.

I needed to solve this problem:

  • Offset a rectangular polygon by a fixed amount, rounding corners.
  • Intersect the previous polygon with a second polygon.
  • Compute area and perimeter of resulting polygon.


This is needed to solve a problem in civil engineering about punching of columns through slabs in case of corner or border columns.


I put together this small demo app in Vb.Net to test this library. You can check it out at:
https://github.com/andreaboriani/clipper_test

Use PubNub in VB.Net

Use PubNub in VB.Net

I made some experiments using PubNub in VB.NET, as the examples on the site are only in C#. If you still don't know PubNub is a real-time messaging service based on channels with a  publish-subscribe protocol (similar to Telegram). The base plan is free till 1M transactions and 1GB of data persistence. At first, you have to register, create an app and give it a name. Two keys will be created, one to publish (pub-.....) and one to subscribe to a channel (sub-.....).

  1. Create a  VB.NET project with a form
  2. In Visual Studio go to Tools-> NuGet Packages and import  PubNub package.

Now we can write our code: I put everything in  form_shown

Private Sub FrmMAIN_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown   
  Dim pnConfiguration As New PubnubApi.PNConfiguration()  
  'insert key here   
  pnConfiguration.SubscribeKey = "sub-xxxxxxxxxxxxx"   
  pnConfiguration.Secure = False   
  PubNub = New PubnubApi.Pubnub(pnConfiguration)   
  'prepare call back   
  Dim IncomingMessages As Action(Of PubnubApi.Pubnub, 
  PubnubApi.PNMessageResult(Of Object)) = AddressOf IncomingMessagesCB   
  Dim IncomingPresence As Action(Of PubnubApi.Pubnub, PubnubApi.PNPresenceEventResult) = AddressOf IncomingPresenceCB   
  Dim IncomingStatus As Action(Of PubnubApi.Pubnub, PubnubApi.PNStatus) = AddressOf IncomingStatusCB   
  Dim sc As New PubnubApi.SubscribeCallbackExt(IncomingMessages, IncomingPresence, IncomingStatus)   
  'set up listener   
  PubNub.AddListener(sc)   
  PubNub.Subscribe(Of String).Channels(New String() {"my_channel"}).Execute()  
End Sub  
'callback for messaes  
Private Sub IncomingMessagesCB(pn As PubnubApi.Pubnub, messageResult As PubnubApi.PNMessageResult(Of Object))         
  If messageResult IsNot Nothing Then             
    Debug.Print("In Example, SubscribeCallback received PNMessageResult")             
    Debug.Print("In Example, SubscribeCallback messsage channel = " + 
  messageResult.Channel)             
    Debug.Print("In Example, SubscribeCallback messsage channelGroup = " + messageResult.Subscription)             
    Debug.Print("In Example, SubscribeCallback messsage publishTimetoken = " + messageResult.Timetoken.ToString)            
    Debug.Print("In Example, SubscribeCallback messsage publisher = " + messageResult.Publisher)             
    Dim jsonString = messageResult.Message.ToString()             
    Dim msg As Dictionary(Of String, String) = 
    Newtonsoft.Json.JsonConvert.DeserializeObject(Of Dictionary(Of String, String))(jsonString)             
    Debug.Print("msg: " + msg("msg"))         
  End if     
End Sub    
'callback for presence 
Private Sub IncomingPresenceCB(pn As PubnubApi.Pubnub, presencResult As PubnubApi.PNPresenceEventResult)         
  If presencResult IsNot Nothing Then             
    Debug.Print("In Example, SubscribeCallback received PNPresenceEventResult")             
    Debug.Print(presencResult.Channel + " " + presencResult.Occupancy + " " + presencResult.Event)         
  End If     
End Sub     
'callback for status     
Private Sub IncomingStatusCB(pn As PubnubApi.Pubnub, statusResult As PubnubApi.PNStatus)         
  If statusResult.Category = bnubApi.PNStatusCategory.PNConnectedCategory Then             
    Debug.Print(statusResult.Category.ToString)         
  End If     
End Sub