Analyzing iMessage With SQL

558fe5180e0e8fc922d31c23ef84d240

SQLite is an often overlooked flavor of SQL engines. Some have suggested it is the most prolific SQL engine in existence due to its highly flexible nature and ability to run on almost any platform with limited resources. Unlike other SQL engines like MySQL, PostgreSQL, MSSQL, or Oracle, SQLite runs without a server. SQLite does not rely on a data directory or a constantly running daemon: a database is encapsulated in a single file.

SQLite and iMessage

iMessage is one of the most popular messaging platforms today, largely because it is built into iOS and Mac devices. Since its release, it has evolved significantly. But, at its core, it is simply an instant messaging platform. iMessage uses SQLite in the background to store relational data about messages, conversations, and their participants.

Number of characters in a string – MIPS

558fe5180e0e8fc922d31c23ef84d240

Hello, I am trying to count the number of characters in a string $a0 that return a 1 when passed to the function, otherwise return 0. Heres what I did: I dont have the correct answer __ output format must be 3, I have 11

  .text
        .globl __start
__start:                # execution starts here  */


        la $a0,ans
        li $v0,4        # print out string
        syscall

        la $a0,str
        jal strchk      # call strchk function

        move $a0,$v0
        li $v0,1        # print out returned value
        syscall

        la $a0,endl     # system call to print
        li $v0,4        # out a newline
        syscall

        li $v0,10
        syscall         # au revoir...

#
# checkch is a function which takes a character
# in a0,  and returns either 0 or 1 in v0,
# depending on the result of some test.
# Do not rely of the particular operation performed
# by checkch or the registers used.
# These will be different in other mipsmark cases.
#

checkch:
        li $v0,0
        beq  $a0,'a',yes
        beq  $a0,'e',yes
        beq  $a0,'i',yes
        beq  $a0,'o',yes
        beq  $a0,'u',yes
        jr $ra
yes:    li $v0,1
        jr $ra

#/* Any changes above this line will be discarded by
# mipsmark. Put your answer between dashed lines. */
#/*-------------- start cut ----------------------- */

strchk:

        sub $sp, $sp, 16                # adjusting a stack pointer to store an address of string and return an address
        sw $a0, 0($sp)
        sw $s0, 4($sp)
        sw $s1, 8($sp)
        sw $ra, 12($sp)

        li $s0, 0                       # for total vowel count
        move $s1, $a0                   # move address in $a0


loop:

        lb $a0, 0($s1)                  # load char in $a0
        beqz $a0, done                  # if null char, branch to done
        jal checkch                     # jump to checkch
#       add  $s0, $s0, $v0              # increment an address offset
        addi $s1, $s1, 1                # add vowel counter
#       j loop
        bne $a0, $v0, jump

jump:

        add $s0, $s0, 1
        j loop

done:

        move $v0, $s0                   # use $v0 for result
        lw  $a0, 0($sp)
        lw $s0, 4($sp)
        lw $s0, 8($sp)

        add $a0, $0, $s1

        lw $ra, 12($sp)                 # retrieve a return address
        lw $a0, 0($sp)                  # retrieve value in $a0
        add $sp, $sp, 16                # adjust stack pointer
        jr $ra                          # jump to calling




#/*
        j __start       #nasty loop if mips program not exited */
#/*--------------  end cut  -----------------------
# Any changes below this line will be discarded by
# mipsmark. Put your answer between dashed lines.

#################################################
#                                               #
#               data segment                    #
#                                               #
#################################################

        .data                   #*/
str:    .asciiz "aei0956xyz\n"
ans:    .asciiz "number of characters that pass test = "
endl:   .asciiz "\n"
#