Skip to content

Instantly share code, notes, and snippets.

View facebookegypt's full-sized avatar
🏠
Working from home

Ahmed Samir facebookegypt

🏠
Working from home
View GitHub Profile
@facebookegypt
facebookegypt / ITextExtractionStrategy.vb
Created July 11, 2021 17:35
A text extraction renderer that keeps track of relative position of text on page '' * The resultant text will be relatively consistent with the physical layout that most '' * PDF files have on screen.
Namespace LocTextExtraction
Public Class LocTextExtractionStrategy
Implements ITextExtractionStrategy
'* set to true for debugging
Private _UndercontentCharacterSpacing = 0
Private _UndercontentHorizontalScaling = 0
Private ThisPdfDocFonts As SortedList(Of String, DocumentFont)
Public Shared DUMP_STATE As Boolean = False
'* a summary of all found text
Private locationalResult As New List(Of TextChunk)()
Imports dao
Module DaoConnection
Public Sub ConnectAsDAO()
Dim Attrib As String
Dim prpLoop As dao.Property
Dim DBEngin As New Microsoft.Office.Interop.Access.Dao.DBEngine
Dim wrkMain As Microsoft.Office.Interop.Access.Dao.Workspace = DBEngin.Workspaces(0)
Dim dbsPubs As Database = _
wrkMain.OpenDatabase("C:\Databases\db.accdb", False, False, ";pwd=MyPassword")
Dim tBldef As TableDef
/* PrismJS 1.20.0
https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+basic+sql+vbnet */
/**
* okaidia theme for JavaScript, CSS and HTML
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
* @author ocodia
*/
code[class*="language-"],
pre[class*="language-"] {
/* PrismJS 1.20.0
https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+basic+sql+vbnet */
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,C={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof _?new _(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function t(e,r){var a,n;switch(r=r||{},C.util.type(e)){case"Object":if(n=C.util.objId(e),r[n])return r[n];for(var i in a={},r[n]=a,e)e.hasOwnProperty(i)&&(a[i]=t(e[i],r));return a;case"Array":return n=C.util.objId(e),r[n]?r[n]:(a=[],r[n]=a,e.forEach(function(e,n)
@facebookegypt
facebookegypt / MyConfigs.vb
Created July 8, 2020 13:23
Create app.config file , Set config Value, Get Config value
Imports System.Configuration
Imports System.Reflection
Public Class MyConfigs
Private _config As Configuration
Private _settings As AppSettingsSection
Public Function GetProperty(propertyName As String) As String
Return _settings.Settings.Item(propertyName).Value
End Function
Public Sub SetProperty(propertyName As String, propertyValue As String)
_settings.Settings.Item(propertyName).Value = propertyValue
@facebookegypt
facebookegypt / Datagridview_Resize_Image.vb
Created July 3, 2020 15:04
Resize Image in DataGridView Control in VB.Net
'Visual Basic Form
'Form1 (DataGridView1)
Public Class Form1
Private Sub DataGridView1_CellFormatting(sender As Object, _
e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If e.RowIndex = -1 Or e.ColumnIndex = -1 Then Exit Sub
Dim Col_Name as String = ("ImageCol")
Try
If Not IsNothing(e.Value) Then
If DataGridView1.Columns(e.ColumnIndex).ValueType = GetType(Byte()) Then
'Visual Basi .Net Class
Imports System.Data.OleDb
Public Class FillDataGridView
Public Shared Function FillDataGridFromTable(TableName As String) As DataTable
Dim SqlStr As String = ("SELECT * FROM [" & TableName & "]")
Dim MY_CONN_STR As String = MY_CONNECTIONSTRING_FROM_CONFIGFILES
Using MyTable As DataTable = New DataTable
Try
Using Conn As New OleDbConnection With {.ConnectionString = MY_CONN_STR},
CMD As New OleDbCommand(SqlStr, Conn)
Imports System.Data.OleDb
Public Class ThisClass
Private ConnectionString As String
Private CN As OleDbConnection = New OleDbConnection
'This function Returns the Oledb Provider for your Project
'I.e: if you have Office 2016 installed, it will return :
'Microsoft.ACE.OLEDB.16.0
Public Function FindProvider() As String
Dim Provider As String = String.Empty
Dim reader = OleDbEnumerator.GetRootEnumerator()
@facebookegypt
facebookegypt / ProgressBarWithText.vb
Created May 5, 2020 20:29
Visual Basic Class - Custom Progress Bar With Text shows progress %
Imports System.ComponentModel
Public Class ProgressBarWithText
Inherits ProgressBar
'Note : ME=Control
Public Sub New()
'flags are used to categorize supported behavior. A control can enable a style by calling the SetStyle method
'and passing in the appropriate ControlStyles bit (or bits)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
End Sub
@facebookegypt
facebookegypt / DropboxC.vb
Created April 27, 2020 21:53
Visual Basic .Net Dropbox Api Class using [Access Token] Flow method to Auth. , upload and download files.
'Open Project->Settings->Add user scope [accesstoken | User] , [uid | user].
'Create VB Class [DropboxC.vb] in your Visual Basic project, place this code in it.
Imports System.IO
Imports System.Net
Imports System.Net.Http
Imports System.Runtime.InteropServices
Imports Dropbox.Api
Imports Dropbox.Api.Common
Imports Dropbox.Api.Files
Imports Dropbox.Api.Files.Routes