working on it ...

Filters

Explore Public Snippets

Sort by

Found 1,604 snippets

    public by juntalis  874  0  3  0

    Not-quite-compatible implementation of NASM's __utf16__ keyword for YASM.

    Not-quite-compatible implementation of NASM's __utf16__ keyword for YASM.: utf16_for_yasm.asm
    BITS 32
    
    %macro __utf16__ 1
    	%assign idx 1
    	%xdefine wstring 
    	%xdefine cstring %1
    	%strlen cstrlen cstring
    	%rep cstrlen
    		%substr cchar cstring idx
    		%if idx = 1
    			%xdefine wstring cchar, 0x0
    		%elif idx = cstrlen
    			%xdefine wstring wstring cchar, 0x0
    		%else
    			%xdefine wstring wstring cchar, 0x0,
    		%endif
    		%assign idx idx+1
    	%endrep
    	db wstring
    %endmacro
    
    %define u(S) __utf16__ S
    
    main:
    	pushf
    	pusha
    	xor eax, eax
    	add eax, wsDllPath - $
    	ret
    wsDllPath:
    	u('injected_dll')
    	dw 0x0
    
    
    

    public by ramntry  608  0  3  0

    Debugger

    Debugger: dbg.asm
    		model	tiny
    		.code
    		.486
    		org	100h
    _:
    
    fm_aligned = (offset free_memory - _ + 100h + 15) / 16 * 16
    load_address = fm_aligned + 100h
    
    start:		call	get_fname
    		call	open_file
    		call	get_fsize
    		call	read_file
    		call	close_file
    		call	set_int
    		mov	al, int_mode
    		cmp	al, 1
    		jz	victim_enter
    		call	set_breakpoint
    		jmp	victim_enter
    
    int_raport:	push	bp
    		mov	bp, sp
    		mov	dx, offset line_msg
    		mov	bx, ax
    		mov	ah, 9
    		int	21h
    		mov	dx, offset ip_eq_msg
    		int	21h
    		mov	ax, bx
    		call	hex4
    		mov	dx, offset segment_msg
    		mov	ah, 9
    		int	21h
    		mov	ax, [bp + 4]
    		call	hex4
    		mov	dx, offset ax_eq_msg
    		mov	ah, 9
    		int	21h
    		mov	ax, [bp + 6]
    		call	hex4
    		mov	dx, offset bx_eq_msg
    		mov	ah, 9
    		int	21h
    		mov	ax, [bp + 8]
    		call	hex4
    		mov	dx, offset cx_eq_msg
    		mov	ah, 9
    		int	21h
    		mov	ax, [bp + 10]
    		call	hex4
    		mov	dx, offset dx_eq_msg
    		mov	ah, 9
    		int	21h
    		mov	ax, [bp + 12]
    		call	hex4
    		mov	dx, offset line_msg
    		mov	ah, 9
    		int	21h
    		xor	ax, ax
    		int	16h
    		cmp	al, 'q'
    		jz	victim_ret
    		pop	bp
    		ret
    
    int_handler:	push	bp
    		mov	bp, sp
    		push	dx
    		push	cx
    		push	bx
    		push	ax
    		push	ds
    		push	cs
    		pop	ds
    		xor	cx, cx
    		mov	cl, int_mode
    		shr	cx, 1
    		mov	ax, [bp + 2]
    		sub	ax, cx
    		mov	[bp + 2], ax
    		call	int_raport
    		or	cl, cl
    		mov	al, broken_byte
    		mov	bx, breakpoint
    		pop	ds
    		mov	byte ptr [bx], al
    		pop	ax
    		pop	bx
    		pop	cx
    		pop	dx
    		pop	bp
    		iret
    
    set_int:	mov	al, int_mode
    		mov	ah, 35h
    		int	21h
    		mov	cx, bx
    		mov	bx, offset int_old
    		mov	[bx], cx
    		mov	cx, es
    		mov	[bx + 2], cx
    		mov	dx, offset int_handler
    		mov	ah, 25h
    		int	21h
    		ret
    
    restore_int:	mov	bx, offset int_old
    		mov	dx, [bx]
    		mov	cx, [bx + 2]
    		mov	al, int_mode
    		push	ds
    		mov	ds, cx
    		mov	ah, 25h
    		int	21h
    		pop	ds
    		ret
    
    set_breakpoint:	mov	ax, breakpoint
    		mov	bx, offset fm_aligned
    		add	bx, ax
    		mov	al, byte ptr [bx]
    		mov	dx, bx
    		mov	bx, offset broken_byte
    		mov	byte ptr [bx], al
    		mov	bx, dx
    		mov	byte ptr [bx], 0CCh
    		ret	
    
    victim_enter:	pushf
    		push	cs
    		push	offset victim_ret
    		push	0
    		pushf
    		jnz	bp_mode
    		pop	ax
    		or	ax, 100h
    		push	ax
    bp_mode:	mov	ax, cs
    		xor	bx, bx
    		add	bx, offset fm_aligned
    		mov	byte ptr [bx], 0CFh
    		shr	bx, 4
    		add	ax, bx
    		mov	es, ax
    		push	ax
    		push	100h
    		push	0
    		push	0
    		push	0
    		push	0
    		push	ax
    		mov	ax, 100h
    		mov	cl, int_mode
    		cmp	cl, 1
    		jnz 	bp_mode2
    		call	int_raport
    bp_mode2:	pop	ds
    		add	sp, 8
    		xor	ax, ax
    		xor	bx, bx
    		xor	cx, cx
    		xor	dx, dx
    		iret
    
    victim_ret:	push	cs
    		pop	ax
    		mov	ds, ax
    		mov	es, ax
    		mov	dx, offset line_msg
    		mov	ah, 9
    		int	21h
    		mov	dx, offset debug_endmsg
    		int	21h
    		mov	dx, offset line_msg
    		int	21h
    		call	restore_int
    		int	20h
    
    print_cmd:	mov	bx, 80h		; PSP:80 - command line length
    		xor	cx, cx
    		mov	cl, [bx]
    		or	cx, cx
    		jz	print_cmd_ret
    		dec	cx
    		mov	dx, 82h		; PSP:81 - command line itself
    		mov	bx, 1		; stdout handle
    		mov	ah, 40h		; write to a file
    		int	21h
    print_cmd_ret:	ret
    
    get_fname:	mov	bx, 80h
    		xor	cx, cx
    		mov	cl, [bx]
    		mov	di, offset filename
    		or	cx, cx
    		jz	print_usage
    		dec	cx
    		mov	si, 82h
    		cld
    get_fname_loop:	mov	al, byte ptr [si]
    		cmp	al, ' '
    		jz	get_fname_addr
    		movsb
    		loop	get_fname_loop
    		xor	ax, ax
    		stosb
    		jmp	this_is_trapmode
    get_fname_addr:	xor	ax, ax
    		stosb
    		xor	bx, bx
    		dec	cx
    get_fname_lp2:	inc	si
    		mov	bl, byte ptr [si]
    		sub	bx, 30h
    		cmp	bx, 9h
    		jle	get_fname_sml
    		sub	bx, 7h
    get_fname_sml:	shl	ax, 4
    		or	ax, bx
    		loop	get_fname_lp2
    		mov	bx, offset breakpoint
    		mov	[bx], ax
    		ret
    this_is_trapmode:
    		mov	bx, offset int_mode
    		mov	byte ptr [bx], 1
    		ret
    
    open_file:	mov	dx, offset filename
    		mov	ax, 3D00h		; open file in read mode
    		int	21h
    		jc	open_file_err
    		ret
    open_file_err:	mov	dx, offset fopen_errmsg
    		mov	ah, 9
    		int	21h
    		int	20h
    
    close_file:	mov	bx, ax
    		mov	ah, 3Eh			; close file
    		int	21h
    		ret
    
    get_fsize:	mov	bx, ax
    		mov	ax, 4201h		; seek from current position
    		xor	cx, cx
    		xor	dx, dx
    		int	21h
    		mov	di, dx
    		mov	si, ax			; DI:SI <- original position
    		mov	ax, 4202h		; seek from end of file
    		xor	cx, cx
    		xor	dx, dx
    		int	21h
    		push	ax
    		mov	ax, 4200h		; seek from start of file
    		mov	cx, di
    		mov	dx, si
    		int	21h			; restore original position
    		pop	cx			; CX <- size of file
    		mov	ax, bx
    		ret
    
    read_file:	push	ax
    		mov	bx, ax
    		mov	ah, 3fh			; read file
    		mov	dx, load_address
    		int	21h
    		jc	read_file_err
    		pop	ax
    		ret
    read_file_err:	mov	dx, offset fread_errmsg
    		mov	ah, 9
    		int	21h
    		int	20h
    		
    hex4:		push	ax
    		mov	al, ah
    		call	hex2
    		pop	ax
    hex2:		push	ax
    		shr	al, 4
    		call	hex1
    		pop	ax
    hex1:		push	ax
    		and	al, 0Fh
    		cmp	al, 10
    		sbb	al, 69h
    		das
    		mov	dl, al
    		mov	ah, 2h
    		int	21h
    		pop	ax
    		ret
    
    print_usage:	mov	dx, offset usage_str
    		mov	ah, 9
    		int	21h
    		int	20h
    
    filename	db	13 dup (?)
    usage_str	db	"Usage: dbg <filename>[ <breakpoint>]"
    		db	13,10,"  If a breakpoint isn't specified,"
    		db	13,10,"  dbg will go to tracing mode. Use keys:"
    		db	13,10,"       [Enter] -> next point"
    		db	13,10,"       [q]     -> quit",13,10
    		db	"Written by Roman Tereshin (tereshin.roman@gmail.com)$"
    fopen_errmsg	db	"Can not open file$"
    alloc_errmsg	db	"Can not allocate memory$"
    fread_errmsg	db	"Can not read file$"
    line_msg	db	13,10,"---------",13,10,'$'
    ip_eq_msg	db	      "ip = $"
    segment_msg	db	13,10,"ds = $"
    ax_eq_msg	db	13,10,"ax = $"
    bx_eq_msg	db	13,10,"bx = $"
    cx_eq_msg	db	13,10,"cx = $"
    dx_eq_msg	db	13,10,"dx = $"
    debug_endmsg	db	"END$"
    int_old		dw	2 dup (?)
    breakpoint	dw	0
    broken_byte	db	0CFh
    int_mode	db	3
    
    free_memory:
    
    end start
    
    

    external by SAGAR SAHA  1  0  2  0

    PostAsJsonAsync() not working in .Net Core 3.1 when updated my project from .Net Core 2.2 to 3.1 (Missing Assembly)

    I have Update my Dot Net Core project from 2.2 to 3.1. It is an MVC project, I have called my .net core API from my MVC project and all of my post method calls gives an error. Here is the error: 'HttpClient' does not contain a definition for 'PostAsJsonAsync' and no accessible extension method 'PostAsJsonAsync' accepting a first argument of t
    /* 
    This works for me.
    
    Dot net core 3.x doesn't have any assembly for PostAsJsonAsync().
    
    And Dot Net Core 2. not supported by Microsoft. So we should not use anything that not in 3.x. should not add assembly from 2.x.
    
    The possible alternative is PostAsync();
     */
    HttpResponseMessage resNews = 
    await client.PostAsync("News/GetNews/"+ Id, new StringContent(JsonConvert.SerializeObject(Object), 
    Encoding.UTF8, "application/json"));
    
    If pass only string:
    
      HttpResponseMessage resNews = 
      await client.PostAsync("News/GetNews/"+ Id, new StringContent("string"));
    
    
    /* 
    
     */
    

    external by StackOverflow  1  0  2  0

    Missing assembly binding redirect from StackExchange.Redis 2.0.513 package

    I am getting the following exception when trying to use the latest Nuget package StackExchange.Redis in Cloud Service for .Net 4.7 System.InvalidOperationException: The assembly for System.Buffers and System.IO.Pipelines could not be loaded; this usually means a missing assembly binding redirect - try checking this, and adding any that are miss
    /* 
    Add assembly redirect:
    
    <dependentAssembly>
        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" />
        <bindingRedirect oldVersion="4.0.2.0-4.0.3.0" newVersion="4.0.3.0" />
    </dependentAssembly>
    
    
    Found the details here.
     */
    

    external by todbott  1  0  3  0

    How to achieve assembly binding redirect in a plugin scenario?

    I have a plugin P extending and application A (.NET40) that I have no control over. The P assembly (.NET40) has a shared dependency D (.NET35). Both P and D depend on FSharp.Core, but different versions: P is compiled against FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a D is compiled against FSharp.Core, Versio
    /* 
    Yes, indeed.  If you are writing a plugin, an app.config file is useless for redirecting assemblies.  The plugin will look 1st to the machine.config file on the user's computer, then look to the *.config file of the main program.
    
    Here is the two-step process I used for carrying out assembly-binding redirecting in a plugin scenario when writing a plugin for SDL Trados 2017--
    
    Step One: Use a try-catch statement in the plugin itself to discover the information about the assembly which is failing to load.
    In my case, I suspected one of the handful of assemblies required to create a Google Cloud AutoML client was to blame, so I put a try-catch statement around the point where the plugin first tries to create a Google Cloud AutoML client:
     */
        try
        {
            client = AutoMlClient.Create(); 
        }
        catch (Exception err)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter("C:/Desktop/log.txt", true))
            {
                file.WriteLine(err.ToString());
            }
        }
    
    
    /* 
    When I checked the "log.txt" file created during the error, I found the following information:
     */
        System.IO.FileNotFoundException: Could not load file or assembly 'Google.Apis.Auth, Version=1.41.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified.
    
    
    /* 
    So! It was clear that, in the process of creating an AutoML client, the plugin was trying to find.Google.Apis.Auth version 1.41.1.0.  However, in order to get my plugin to compile correctly, I had to install Google.Apis.Auth version 1.42.0.0 with NuGet.  Hence the need for the assembly binding redirect.
    
    Step Two: Add an event handler related to that particular assembly which will change it's version / public key token information before loading it.
    At the very beginning of the program--where the main form window of the plugin is initialized, I added this code:
     */
        public Main_form()
        {
            InitializeComponent();
    
            Version V14200 = new Version("1.42.0.0");
            RedirectAssembly("Google.Apis.Auth", V14200, "4b01fa6e34db77ab");
        }
    
        public static void RedirectAssembly(string assembly_name, Version targetVersion, string publicKeyToken)
        {
            ResolveEventHandler handler = null;
    
            handler = (sender, args) => {
                //gets the name of the assembly being requested by the plugin
                var requestedAssembly = new AssemblyName(args.Name);
    
                //if it is not the assembly we are trying to redirect, return null
                if (requestedAssembly.Name != assembly_name)
                    return null;
    
                //if it IS the assembly we are trying to redirect, change it's version and public key token information
                requestedAssembly.Version = targetVersion;
                requestedAssembly.SetPublicKeyToken(new AssemblyName("x, PublicKeyToken=" + publicKeyToken).GetPublicKeyToken());
                requestedAssembly.CultureInfo = CultureInfo.InvariantCulture;
    
                //finally, load the assembly
                return Assembly.Load(requestedAssembly);
            };
            AppDomain.CurrentDomain.AssemblyResolve += handler;
        }
    
    
    /* 
    So basically, you have to get information from the plugin (using a try-catch statement) about which assembly is failing to load.  Then, you have to add an event handler, which will go into effect when the assembly in question begins to load.  
    
    In my case, I knew that Google.Apis.Auth was the problem--the plugin wanted to load version 1.41.1.0, but my plugin contained version 1.42.0.0.  When the plugin begins looking for Google.Apis.Auth (1.41.1.0), the event handler steps in and changes the version number, so the plugin loads version 1.42.0.0.
    
    Having never had any formal training in computer science or programming, I don't know how robust/recommendable this solution is, but it worked for me.
     */
    

    external by StackOverflow  1  0  2  0

    BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

    I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". Could not load file or assembly 'dcasdk, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an inc
    /* 
    In VS, go to tools, then click on options.
    
    Search "iis" in search bar and check this option, and run the project, this is working for me as I was getting error in web project.
     */
    

    external by BinaryWizard  1  0  2  0

    Cannot use loaded Oracle.ManagedDataAccess assembly in Powershell

    I am trying to connect to an existing oracle database using Powershell and Oracle.ManagedDatabaseAccess.dll. I have the code running in C# using the very same library. The assembly is loaded but i cannot use it. I am using Win10 and Powershell ISE. I also use VS2017/15.3.2 and .Net 4.7.02046. I tried using "Add-Type -AssemblyName" and "Add-Type
    /* 
    First of all, you need to make sure the version of the NuGet Assembly you're using is compatible with the version of PowerShell you're using.  You mentioned that you're writing code on Windows 10 in the PowerShell ISE.  Since PowerShell ISE does not support PowerShell Core and Windows 10 Anniversary includes 5.1 out of the box, I'm going to assume you're writing code in Windows PowerShell, not the newer PowerShell Core.
    
    This is important, because up to Windows PowerShell 5.1, PowerShell was based on the .NET Framework, while with PowerShell Core Microsoft switched to the multi-platform .NET Core.  And as it happens, Oracle publishes different versions of the Oracle Data Provider for each.
    
    When using the .NET Framework (Windows PowerShell 5.1 and below), use Oracle.ManagedDataAccess
    When using .NET Core (PowerShell Core 6 and above), use Oracle.ManagedDataAccess.Core
    
    Second, you need to import the assembly into the current session.  While this sounds easy enough, Oracle had the brilliant idea of using the same assembly name for both Core & non-Core versions, managed & unmanaged, so you're going to want to do that with the full assembly path.  Otherwise it's likely you'll unreliably import an incompatible version.
    
    Fortuitously you can combine both finding the assembly and downloading it if missing into a quick operation using only native PowerShell Commands run in the userspace.
    
    
    Use Get-Package to check if ODP.NET is installed already and get it's location.
    If a ObjectNotFound exception is returned, download ODP.NET from NuGet.org using Install-Package.
    If a ObjectNotFound exception is returned, install NuGet.org as an untrusted PackageProvider.
    Import the newly installed assembly explicitly via Add-Type and the assembly path.
    
    
    You can then use ODP.NET in PowerShell as expected.
    
    Example Implementation
     */
    #Requires -PSEdition Desktop
    
    try { $nugetPkg = (Get-Package Oracle.ManagedDataAccess.Core -ProviderName NuGet -MinimumVersion "2.18.3" -ErrorAction Stop -Debug:$false).Source }
    catch [System.Exception] {
        if($_.CategoryInfo.Category -eq "ObjectNotFound") {
            # Register NuGet.org as a package source if it is missing.
            try { Get-PackageSource -Name "nuget.org" -ProviderName NuGet -Debug:$false -ErrorAction Stop }
            catch [System.Exception] {
                if($_.CategoryInfo.Category -eq "ObjectNotFound") {
                    Register-PackageSource -Name "nuget.org" -Location "https://www.nuget.org/api/v2/" -ProviderName NuGet -Debug:$false
                }
                else { throw $_ }
            }
    
            # Install Oracle drivers.
            $pkg = (Install-Package Oracle.ManagedDataAccess.Core -ProviderName NuGet -MinimumVersion "2.18.3" -Verbose -Scope CurrentUser -Force -Debug:$false).Payload.Directories[0]
            $nugetPkg = Join-Path -Path $pkg.Location -ChildPath $pkg.Name
            Remove-Variable pkg
        }
        else { throw $_ }
    }
    # Add ODP.NET to the assemblies available in-session.  Using the path instead of AssemblyName avoids conflicts with ODP.NET (Core).
    # See https://docs.oracle.com/en/database/oracle/oracle-data-access-components/18.3/odpnt/index.html for documentation.
    Add-Type -Path (Get-ChildItem (Split-Path ($nugetPkg) -Parent) -Filter "Oracle.ManagedDataAccess.dll" -Recurse -File)[0].FullName
    
    
    # Begin Query Operations
    try {
        # TESTB connection string.  You can replace the Data Source value with a tnsnames alias.
        $con = New-Object Oracle.ManagedDataAccess.Client.OracleConnection(
            "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testb)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=testb))); User Id=test;Password=user;"
            )
        $con.Open()
        Write-Host ("Connected to database: {0} – running on host: {1} – Servicename: {2} – Serverversion: {3}" -f $con.DatabaseName, $con.HostName, $con.ServiceName, $con.ServerVersion) -ForegroundColor Cyan -BackgroundColor Black
    
        # Get a single value
        Write-Host "Returning a Scalar Value from Oracle" -ForegroundColor Cyan -BackgroundColor Black
        $cmd = $con.CreateCommand()
        $cmd.CommandText = "SELECT 'Hello World!' FROM DUAL"
        $cmd.ExecuteScalar()
    
        # Get several defined values
        Write-Host "Retrieving manually typed ordinals from v`$version via OracleDataReader" -ForegroundColor Cyan -BackgroundColor Black
        $cmd.CommandText = 'SELECT BANNER FROM v$version'
        $rdr = $cmd.ExecuteReader()
        while ($rdr.Read()) {
            $rdr.GetString(0)
        }
        $rdr.Dispose()
    
        # Use a DataAdapter to get defined Data objects.
        Write-Host "Using a DataAdapter to return NLS_SESSION_PARAMETERS from Oracle" -ForegroundColor Cyan -BackgroundColor Black
        $adap = New-Object Oracle.ManagedDataAccess.Client.OracleDataAdapter("SELECT * FROM NLS_SESSION_PARAMETERS",$con)
        # Create the builder for the adapter to automatically generate the Command when needed.
        $oraCmdBldr = New-Object Oracle.ManagedDataAccess.Client.OracleCommandBuilder($adap)
    
        [System.Data.DataSet]$dataset = New-Object System.Data.DataSet
        $adap.Fill($dataset,"NLSSesParams")
        $dataset.Tables["NLSSesParams"]
        Remove-Variable dataset
    }
    catch {
        Write-Error ("Can't open connection: {0}n{1}" -f $con.ConnectionString, $_.Exception.ToString())
    }
    finally {
        if ($con.State -eq 'Open') { $con.close() }
        $con.Dispose()
        Write-Host "Disconnected from database" -ForegroundColor Cyan -BackgroundColor Black
    }
    
    
    /* 
    Example Output
    
    Connected to database: testb – running on host: bat – Servicename: testb – Serverversion: 11.2.0.4.0
    Returning a Scalar Value from Oracle
        Hello World!
    Retrieving manually typed ordinals from v$version via OracleDataReader
        Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
        PL/SQL Release 11.2.0.4.0 - Production
        CORE    11.2.0.4.0  Production
        TNS for Linux: Version 11.2.0.4.0 - Production
        NLSRTL Version 11.2.0.4.0 - Production
    Using a DataAdapter to return NLS_SESSION_PARAMETERS from Oracle
        17
    
    Disconnected from database
        PARAMETER               VALUE                       
        ---------               -----                       
        NLS_LANGUAGE            AMERICAN                    
        NLS_TERRITORY           AMERICA                     
        NLS_CURRENCY            $                           
        NLS_ISO_CURRENCY        AMERICA                     
        NLS_NUMERIC_CHARACTERS  .,                          
        NLS_CALENDAR            GREGORIAN                   
        NLS_DATE_FORMAT         DD-MON-RR                   
        NLS_DATE_LANGUAGE       AMERICAN                    
        NLS_SORT                BINARY                      
        NLS_TIME_FORMAT         HH.MI.SSXFF AM              
        NLS_TIMESTAMP_FORMAT    DD-MON-RR HH.MI.SSXFF AM    
        NLS_TIME_TZ_FORMAT      HH.MI.SSXFF AM TZR          
        NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
        NLS_DUAL_CURRENCY       $                           
        NLS_COMP                BINARY                      
        NLS_LENGTH_SEMANTICS    BYTE                        
        NLS_NCHAR_CONV_EXCP     FALSE
    
    
    
    This code can be easily modified to work in PowerShell Core by:
    
    
    Replacing #Requires -PSEdition Desktop with #Requires -PSEdition Core
    Changing the Installation assembly from Oracle.ManagedDataAccess to Oracle.ManagedDataAccess.Core
    Changing the -MinimumVersion parameter value of Get-Package and Install-Package from "19.3.1" to "2.18.3".
     */
    

    external by marcuslx  1  0  1  0

    Recursive Factorial of an integer in MIPS assembly

    Recursive Factorial of an integer in MIPS assembly: MIPSfactorial.asm
    .data
    	n: .word 5
    	result: .asciiz "Fact(x) = "
    	
    .text
    .globl main
    
    	main:
    		lw $a0, n		#$a0 = n
    		jal verifier
    			
    		#print the result
    		li $v0, 4
    		la $a0, result  #prints the string: "Fact(x) = "
    		syscall 
    		
    		li $v0, 1
    		mflo $a0	#$a0 = $lo = result of the factorial
    		syscall
    		
    		#return 0
    		li $v0, 10
    		syscall
    	
    	verifier:
    		slti $t0, $a0, 1			#if($a0<1), then $t0=1 
    		beq $t0, $zero, factorial	#if($a0 >= 1) goto factorial
    		addi $v0, $zero, 1			#$v0 = 1
    			jr $ra
    	
    	factorial:
    		addi $sp, $sp, -8			#allocate space on stack
    		sw $ra, 0($sp)
    		sw $s0, 4($sp)
    		
    		add $s0, $a0, $zero 		#$s0 = $a0 = n
    		addi $a0, $a0, -1			#$a0--
    			jal verifier			# $v0 = factorial(n-1)
    		mult $s0, $v0				#$lo = n*factorial(n-1)
    		mflo $v0					#$v0 = $lo
    		
    		lw $s0, 4($sp)
    		lw $ra, 0($sp)
    		addi $sp, $sp, 8			#deallocate space on stack
    			jr $ra
    
    

    external by StackOverflow  1  0  2  0

    Using .Net 4.8 Framework in VS Code

    I'm relatively new to the .NET environment and need to develop in VS Code (no VS available for reasons). I also need to use an assembly, build for the .NET 4 framework, but every single thread only lists .NET Core for VS Code. If I understand correctly both are .NET frameworks, but Code can be used on more plattforms and is based on the .NET 2.x/3
    /* 
    Visual Studio Code for .Net Framework
    
    
      First thing, the more recent updates for Visual Studio Code do support
      building and debugging projects for .NET Framework, but it is very
      limited:
      
      
        The C# extension supports limited full .NET framework debugging. It
        can only debug 64-bit applications with portable PDBs.
        https://github.com/OmniSharp/omnisharp-vscode/wiki/Desktop-.NET-Framework
      
      
      As it says in OmniSharp (responsible for C# extension) github, the
      project must be a 64-bit application with portable PDBs.
     */
    

    external by StackOverflow  1  0  2  0

    Getting strange BadImageFormatException: Cannot load a reference assembly for execution

    I'm getting a crazy system load issue, which I have not idea what it is. The error and the output from the Server Error in '/' Application. Cannot load a reference assembly for execution. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the erro
    /* 
    What worked for me was deleting the bin and obj folders. Then clean and rebuild the solution
     */
    
    • Public Snippets
    • Channels Snippets