/*
    Name 1: Chia-Ju, Chen
    UTEID 1: cc65542
*/

/***************************************************************/
/*                                                             */
/*   LC-3b Simulator                                           */
/*                                                             */
/*   EE 460N                                                   */
/*   The University of Texas at Austin                         */
/*                                                             */
/***************************************************************/

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

/***************************************************************/
/*                                                             */
/* Files:  ucode        Microprogram file                      */
/*         isaprogram   LC-3b machine language program file    */
/*                                                             */
/***************************************************************/

/***************************************************************/
/* These are the functions you'll have to write.               */
/***************************************************************/

void eval_micro_sequencer();
void cycle_memory();
void eval_bus_drivers();
void drive_bus();
void latch_datapath_values();

/***************************************************************/
/* A couple of useful definitions.                             */
/***************************************************************/
#define FALSE 0
#define TRUE  1

/***************************************************************/
/* Use this to avoid overflowing 16 bits on the bus.           */
/***************************************************************/
#define Low16bits(x) ((x) & 0xFFFF)

/***************************************************************/
/* Definition of the control store layout.                     */
/***************************************************************/
#define CONTROL_STORE_ROWS 64
#define INITIAL_STATE_NUMBER 18

/***************************************************************/
/* Definition of bit order in control store word.              */
/***************************************************************/
enum CS_BITS {
    IRD,
    COND1, COND0,
    J5, J4, J3, J2, J1, J0,
    LD_MAR,
    LD_MDR,
    LD_IR,
    LD_BEN,
    LD_REG,
    LD_CC,
    LD_PC,
    GATE_PC,
    GATE_MDR,
    GATE_ALU,
    GATE_MARMUX,
    GATE_SHF,
    PCMUX1, PCMUX0,
    DRMUX,
    SR1MUX,
    ADDR1MUX,
    ADDR2MUX1, ADDR2MUX0,
    MARMUX,
    ALUK1, ALUK0,
    MIO_EN,
    R_W,
    DATA_SIZE,
    LSHF1,
    CONTROL_STORE_BITS
} CS_BITS;

/***************************************************************/
/* Functions to get at the control bits.                       */
/***************************************************************/
int GetIRD(int *x)           { return(x[IRD]); }
int GetCOND(int *x)          { return((x[COND1] << 1) + x[COND0]); }
int GetJ(int *x)             { return((x[J5] << 5) + (x[J4] << 4) +
				      (x[J3] << 3) + (x[J2] << 2) +
				      (x[J1] << 1) + x[J0]); }
int GetLD_MAR(int *x)        { return(x[LD_MAR]); }
int GetLD_MDR(int *x)        { return(x[LD_MDR]); }
int GetLD_IR(int *x)         { return(x[LD_IR]); }
int GetLD_BEN(int *x)        { return(x[LD_BEN]); }
int GetLD_REG(int *x)        { return(x[LD_REG]); }
int GetLD_CC(int *x)         { return(x[LD_CC]); }
int GetLD_PC(int *x)         { return(x[LD_PC]); }
int GetGATE_PC(int *x)       { return(x[GATE_PC]); }
int GetGATE_MDR(int *x)      { return(x[GATE_MDR]); }
int GetGATE_ALU(int *x)      { return(x[GATE_ALU]); }
int GetGATE_MARMUX(int *x)   { return(x[GATE_MARMUX]); }
int GetGATE_SHF(int *x)      { return(x[GATE_SHF]); }
int GetPCMUX(int *x)         { return((x[PCMUX1] << 1) + x[PCMUX0]); }
int GetDRMUX(int *x)         { return(x[DRMUX]); }
int GetSR1MUX(int *x)        { return(x[SR1MUX]); }
int GetADDR1MUX(int *x)      { return(x[ADDR1MUX]); }
int GetADDR2MUX(int *x)      { return((x[ADDR2MUX1] << 1) + x[ADDR2MUX0]); }
int GetMARMUX(int *x)        { return(x[MARMUX]); }
int GetALUK(int *x)          { return((x[ALUK1] << 1) + x[ALUK0]); }
int GetMIO_EN(int *x)        { return(x[MIO_EN]); }
int GetR_W(int *x)           { return(x[R_W]); }
int GetDATA_SIZE(int *x)     { return(x[DATA_SIZE]); }
int GetLSHF1(int *x)         { return(x[LSHF1]); }

/***************************************************************/
/* The control store rom.                                      */
/***************************************************************/
int CONTROL_STORE[CONTROL_STORE_ROWS][CONTROL_STORE_BITS];

/***************************************************************/
/* Main memory.                                                */
/***************************************************************/
/* MEMORY[A][0] stores the least significant byte of word at word address A
   MEMORY[A][1] stores the most significant byte of word at word address A
   There are two write enable signals, one for each byte. WE0 is used for
   the least significant byte of a word. WE1 is used for the most significant
   byte of a word. */

#define WORDS_IN_MEM    0x08000
#define MEM_CYCLES      5
int MEMORY[WORDS_IN_MEM][2];

/***************************************************************/

/***************************************************************/

/***************************************************************/
/* LC-3b State info.                                           */
/***************************************************************/
#define LC_3b_REGS 8

int RUN_BIT;	/* run bit */
int BUS;	/* value of the bus */

typedef struct System_Latches_Struct{

int PC,		/* program counter */
    MDR,	/* memory data register */
    MAR,	/* memory address register */
    IR,		/* instruction register */
    N,		/* n condition bit */
    Z,		/* z condition bit */
    P,		/* p condition bit */
    BEN;        /* ben register */

int READY;	/* ready bit */
  /* The ready bit is also latched as you dont want the memory system to assert it
     at a bad point in the cycle*/

int REGS[LC_3b_REGS]; /* register file. */

int MICROINSTRUCTION[CONTROL_STORE_BITS]; /* The microintruction */

int STATE_NUMBER; /* Current State Number - Provided for debugging */
} System_Latches;

/* Data Structure for Latch */

System_Latches CURRENT_LATCHES, NEXT_LATCHES;

/***************************************************************/
/* A cycle counter.                                            */
/***************************************************************/
int CYCLE_COUNT;

/***************************************************************/
/*                                                             */
/* Procedure : help                                            */
/*                                                             */
/* Purpose   : Print out a list of commands.                   */
/*                                                             */
/***************************************************************/
void help() {
    printf("----------------LC-3bSIM Help-------------------------\n");
    printf("go               -  run program to completion       \n");
    printf("run n            -  execute program for n cycles    \n");
    printf("mdump low high   -  dump memory from low to high    \n");
    printf("rdump            -  dump the register & bus values  \n");
    printf("?                -  display this help menu          \n");
    printf("quit             -  exit the program                \n\n");
}

/***************************************************************/
/*                                                             */
/* Procedure : cycle                                           */
/*                                                             */
/* Purpose   : Execute a cycle                                 */
/*                                                             */
/***************************************************************/
void cycle() {

  eval_micro_sequencer();
  cycle_memory();
  eval_bus_drivers();
  drive_bus();
  latch_datapath_values();

  CURRENT_LATCHES = NEXT_LATCHES;

  CYCLE_COUNT++;
}

/***************************************************************/
/*                                                             */
/* Procedure : run n                                           */
/*                                                             */
/* Purpose   : Simulate the LC-3b for n cycles.                 */
/*                                                             */
/***************************************************************/
void run(int num_cycles) {
    int i;

    if (RUN_BIT == FALSE) {
	printf("Can't simulate, Simulator is halted\n\n");
	return;
    }

    printf("Simulating for %d cycles...\n\n", num_cycles);
    for (i = 0; i < num_cycles; i++) {
	if (CURRENT_LATCHES.PC == 0x0000) {
	    RUN_BIT = FALSE;
	    printf("Simulator halted\n\n");
	    break;
	}
	cycle();
    }
}

/***************************************************************/
/*                                                             */
/* Procedure : go                                              */
/*                                                             */
/* Purpose   : Simulate the LC-3b until HALTed.                 */
/*                                                             */
/***************************************************************/
void go() {
    if (RUN_BIT == FALSE) {
	printf("Can't simulate, Simulator is halted\n\n");
	return;
    }

    printf("Simulating...\n\n");
    while (CURRENT_LATCHES.PC != 0x0000)
	cycle();
    RUN_BIT = FALSE;
    printf("Simulator halted\n\n");
}

/***************************************************************/
/*                                                             */
/* Procedure : mdump                                           */
/*                                                             */
/* Purpose   : Dump a word-aligned region of memory to the     */
/*             output file.                                    */
/*                                                             */
/***************************************************************/
void mdump(FILE * dumpsim_file, int start, int stop) {
    int address; /* this is a byte address */

    printf("\nMemory content [0x%.4x..0x%.4x] :\n", start, stop);
    printf("-------------------------------------\n");
    for (address = (start >> 1); address <= (stop >> 1); address++)
	printf("  0x%.4x (%d) : 0x%.2x%.2x\n", address << 1, address << 1, MEMORY[address][1], MEMORY[address][0]);
    printf("\n");

    /* dump the memory contents into the dumpsim file */
    fprintf(dumpsim_file, "\nMemory content [0x%.4x..0x%.4x] :\n", start, stop);
    fprintf(dumpsim_file, "-------------------------------------\n");
    for (address = (start >> 1); address <= (stop >> 1); address++)
	fprintf(dumpsim_file, " 0x%.4x (%d) : 0x%.2x%.2x\n", address << 1, address << 1, MEMORY[address][1], MEMORY[address][0]);
    fprintf(dumpsim_file, "\n");
    fflush(dumpsim_file);
}

/***************************************************************/
/*                                                             */
/* Procedure : rdump                                           */
/*                                                             */
/* Purpose   : Dump current register and bus values to the     */
/*             output file.                                    */
/*                                                             */
/***************************************************************/
void rdump(FILE * dumpsim_file) {
    int k;

    printf("\nCurrent register/bus values :\n");
    printf("-------------------------------------\n");
    printf("Cycle Count  : %d\n", CYCLE_COUNT);
    printf("PC           : 0x%.4x\n", CURRENT_LATCHES.PC);
    printf("IR           : 0x%.4x\n", CURRENT_LATCHES.IR);
    printf("STATE_NUMBER : 0x%.4x\n\n", CURRENT_LATCHES.STATE_NUMBER);
    printf("BUS          : 0x%.4x\n", BUS);
    printf("MDR          : 0x%.4x\n", CURRENT_LATCHES.MDR);
    printf("MAR          : 0x%.4x\n", CURRENT_LATCHES.MAR);
    printf("CCs: N = %d  Z = %d  P = %d\n", CURRENT_LATCHES.N, CURRENT_LATCHES.Z, CURRENT_LATCHES.P);
    printf("Registers:\n");
    for (k = 0; k < LC_3b_REGS; k++)
	printf("%d: 0x%.4x\n", k, CURRENT_LATCHES.REGS[k]);
    printf("\n");

    /* dump the state information into the dumpsim file */
    fprintf(dumpsim_file, "\nCurrent register/bus values :\n");
    fprintf(dumpsim_file, "-------------------------------------\n");
    fprintf(dumpsim_file, "Cycle Count  : %d\n", CYCLE_COUNT);
    fprintf(dumpsim_file, "PC           : 0x%.4x\n", CURRENT_LATCHES.PC);
    fprintf(dumpsim_file, "IR           : 0x%.4x\n", CURRENT_LATCHES.IR);
    fprintf(dumpsim_file, "STATE_NUMBER : 0x%.4x\n\n", CURRENT_LATCHES.STATE_NUMBER);
    fprintf(dumpsim_file, "BUS          : 0x%.4x\n", BUS);
    fprintf(dumpsim_file, "MDR          : 0x%.4x\n", CURRENT_LATCHES.MDR);
    fprintf(dumpsim_file, "MAR          : 0x%.4x\n", CURRENT_LATCHES.MAR);
    fprintf(dumpsim_file, "CCs: N = %d  Z = %d  P = %d\n", CURRENT_LATCHES.N, CURRENT_LATCHES.Z, CURRENT_LATCHES.P);
    fprintf(dumpsim_file, "Registers:\n");
    for (k = 0; k < LC_3b_REGS; k++)
	fprintf(dumpsim_file, "%d: 0x%.4x\n", k, CURRENT_LATCHES.REGS[k]);
    fprintf(dumpsim_file, "\n");
    fflush(dumpsim_file);
}

/***************************************************************/
/*                                                             */
/* Procedure : get_command                                     */
/*                                                             */
/* Purpose   : Read a command from standard input.             */
/*                                                             */
/***************************************************************/
void get_command(FILE * dumpsim_file) {
    char buffer[20];
    int start, stop, cycles;

    printf("LC-3b-SIM> ");

    scanf("%s", buffer);
    printf("\n");

    switch(buffer[0]) {
    case 'G':
    case 'g':
	go();
	break;

    case 'M':
    case 'm':
	scanf("%i %i", &start, &stop);
	mdump(dumpsim_file, start, stop);
	break;

    case '?':
	help();
	break;
    case 'Q':
    case 'q':
	printf("Bye.\n");
	exit(0);

    case 'R':
    case 'r':
	if (buffer[1] == 'd' || buffer[1] == 'D')
	    rdump(dumpsim_file);
	else {
	    scanf("%d", &cycles);
	    run(cycles);
	}
	break;

    default:
	printf("Invalid Command\n");
	break;
    }
}

/***************************************************************/
/*                                                             */
/* Procedure : init_control_store                              */
/*                                                             */
/* Purpose   : Load microprogram into control store ROM        */
/*                                                             */
/***************************************************************/
void init_control_store(char *ucode_filename) {
    FILE *ucode;
    int i, j, index;
    char line[200];

    printf("Loading Control Store from file: %s\n", ucode_filename);

    /* Open the micro-code file. */
    if ((ucode = fopen(ucode_filename, "r")) == NULL) {
	printf("Error: Can't open micro-code file %s\n", ucode_filename);
	exit(-1);
    }

    /* Read a line for each row in the control store. */
    for(i = 0; i < CONTROL_STORE_ROWS; i++) {
	if (fscanf(ucode, "%[^\n]\n", line) == EOF) {
	    printf("Error: Too few lines (%d) in micro-code file: %s\n",
		   i, ucode_filename);
	    exit(-1);
	}

	/* Put in bits one at a time. */
	index = 0;

	for (j = 0; j < CONTROL_STORE_BITS; j++) {
	    /* Needs to find enough bits in line. */
	    if (line[index] == '\0') {
		printf("Error: Too few control bits in micro-code file: %s\nLine: %d\n",
		       ucode_filename, i);
		exit(-1);
	    }
	    if (line[index] != '0' && line[index] != '1') {
		printf("Error: Unknown value in micro-code file: %s\nLine: %d, Bit: %d\n",
		       ucode_filename, i, j);
		exit(-1);
	    }

	    /* Set the bit in the Control Store. */
	    CONTROL_STORE[i][j] = (line[index] == '0') ? 0:1;
	    index++;
	}

	/* Warn about extra bits in line. */
	if (line[index] != '\0')
	    printf("Warning: Extra bit(s) in control store file %s. Line: %d\n",
		   ucode_filename, i);
    }
    printf("\n");
}

/************************************************************/
/*                                                          */
/* Procedure : init_memory                                  */
/*                                                          */
/* Purpose   : Zero out the memory array                    */
/*                                                          */
/************************************************************/
void init_memory() {
    int i;

    for (i=0; i < WORDS_IN_MEM; i++) {
	MEMORY[i][0] = 0;
	MEMORY[i][1] = 0;
    }
}

/**************************************************************/
/*                                                            */
/* Procedure : load_program                                   */
/*                                                            */
/* Purpose   : Load program and service routines into mem.    */
/*                                                            */
/**************************************************************/
void load_program(char *program_filename) {
    FILE * prog;
    int ii, word, program_base;

    /* Open program file. */
    prog = fopen(program_filename, "r");
    if (prog == NULL) {
	printf("Error: Can't open program file %s\n", program_filename);
	exit(-1);
    }

    /* Read in the program. */
    if (fscanf(prog, "%x\n", &word) != EOF)
	program_base = word >> 1;
    else {
	printf("Error: Program file is empty\n");
	exit(-1);
    }

    ii = 0;
    while (fscanf(prog, "%x\n", &word) != EOF) {
	/* Make sure it fits. */
	if (program_base + ii >= WORDS_IN_MEM) {
	    printf("Error: Program file %s is too long to fit in memory. %x\n",
		   program_filename, ii);
	    exit(-1);
	}

	/* Write the word to memory array. */
	MEMORY[program_base + ii][0] = word & 0x00FF;
	MEMORY[program_base + ii][1] = (word >> 8) & 0x00FF;
	ii++;
    }

    if (CURRENT_LATCHES.PC == 0) CURRENT_LATCHES.PC = (program_base << 1);

    printf("Read %d words from program into memory.\n\n", ii);
}

/***************************************************************/
/*                                                             */
/* Procedure : initialize                                      */
/*                                                             */
/* Purpose   : Load microprogram and machine language program  */
/*             and set up initial state of the machine.        */
/*                                                             */
/***************************************************************/
void initialize(char *ucode_filename, char *program_filename, int num_prog_files) {
    int i;
    init_control_store(ucode_filename);

    init_memory();
    for ( i = 0; i < num_prog_files; i++ ) {
	load_program(program_filename);
	while(*program_filename++ != '\0');
    }
    CURRENT_LATCHES.Z = 1;
    CURRENT_LATCHES.STATE_NUMBER = INITIAL_STATE_NUMBER;
    memcpy(CURRENT_LATCHES.MICROINSTRUCTION, CONTROL_STORE[INITIAL_STATE_NUMBER], sizeof(int)*CONTROL_STORE_BITS);

    NEXT_LATCHES = CURRENT_LATCHES;

    RUN_BIT = TRUE;
}

/***************************************************************/
/*                                                             */
/* Procedure : main                                            */
/*                                                             */
/***************************************************************/
int main(int argc, char *argv[]) {
    FILE * dumpsim_file;

    /* Error Checking */
    if (argc < 3) {
	printf("Error: usage: %s <micro_code_file> <program_file_1> <program_file_2> ...\n",
	       argv[0]);
	exit(1);
    }

    printf("LC-3b Simulator\n\n");

    initialize(argv[1], argv[2], argc - 2);

    if ( (dumpsim_file = fopen( "dumpsim", "w" )) == NULL ) {
	printf("Error: Can't open dumpsim file\n");
	exit(-1);
    }

    while (1)
	get_command(dumpsim_file);

}

/***************************************************************/
/* Do not modify the above code.
   You are allowed to use the following global variables in your
   code. These are defined above.

   CONTROL_STORE
   MEMORY
   BUS

   CURRENT_LATCHES
   NEXT_LATCHES

   You may define your own local/global variables and functions.
   You may use the functions to get at the control bits defined
   above.

   Begin your code here 	  			       */
/***************************************************************/
#include "math.h"

#define mask01 0x01
#define mask04 0x0F
#define mask05 0x01F
#define mask06 0x03F
#define mask08 0x0FF
#define mask09 0x01FF
#define mask11 0x7FF

/*Get bit N's value of ir */
int getBit(int n,int ir) {
  int bitN;
  return (ir>>n)&mask01 ;
}

/*get integer represented by [to:from] bits*/
int getBitRange(int from,int to, int ir) {
    int mask, tFrom, tTo;
    tFrom = from;
    tTo = to ;
    if(from > to) {
        tFrom = to;
        tTo = from ;
    }
    mask = pow(2,tTo-tFrom+1)-1 ;
    return (ir>>tFrom)&mask ;
}

int sext(int n, signed int Num) {
    /*n is the total number of bits of int Num */
    signed int tmp ;
    int ns = 32 - n ;
    tmp = (Num<<ns)>>ns ;
    return tmp ;
}

void setCC(int dr) {
    if (NEXT_LATCHES.REGS[dr]==0)  {
        NEXT_LATCHES.N=0;
        NEXT_LATCHES.Z=1;
        NEXT_LATCHES.P=0;
        printf("Info: In func: setCC : set Z =1 based dr 0x%x\n",NEXT_LATCHES.REGS[dr]);
    } else if (getBitRange(15,15,NEXT_LATCHES.REGS[dr])==0)  {
        NEXT_LATCHES.N=0;
        NEXT_LATCHES.Z=0;
        NEXT_LATCHES.P=1;
        printf("Info: In func: setCC : set P =1 based on dr 0x%x\n",NEXT_LATCHES.REGS[dr]);
    } else if(getBitRange(15,15,NEXT_LATCHES.REGS[dr])==1){
        NEXT_LATCHES.N=1;
        NEXT_LATCHES.Z=0;
        NEXT_LATCHES.P=0;
        printf("Info: In func: setCC: set N = 1 based on dr 0x%x\n",NEXT_LATCHES.REGS[dr]);
    }
}

/*
* Evaluate the address of the next state according to the
* micro sequencer logic. Latch the next microinstruction.
*/

enum COND {Unconditional, Memory_Ready, Branch, Addressing_Mode} COND;

void eval_micro_sequencer() {
    int cond, j;
    if(GetIRD(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        NEXT_LATCHES.STATE_NUMBER = getBitRange(12, 15, CURRENT_LATCHES.IR) & mask04;
    }

    else {
        cond = GetCOND(CURRENT_LATCHES.MICROINSTRUCTION);
        j = GetJ(CURRENT_LATCHES.MICROINSTRUCTION);

        switch (cond) {
            case Unconditional:
                NEXT_LATCHES.STATE_NUMBER = j;
                break;
            case Memory_Ready:
                NEXT_LATCHES.STATE_NUMBER = (getBitRange(2, 5, j) << 2) + (CURRENT_LATCHES.READY << 1) + getBit(0, j);
                break;
            case Branch:
                NEXT_LATCHES.STATE_NUMBER = (getBitRange(3, 5, j) << 3) + (CURRENT_LATCHES.BEN << 2) + getBitRange(0, 1, j);
                break;
            case Addressing_Mode:
                NEXT_LATCHES.STATE_NUMBER = (getBitRange(1, 5, j) << 1) + getBit(11, CURRENT_LATCHES.IR);
                break;
        }

    }

    memcpy(NEXT_LATCHES.MICROINSTRUCTION, CONTROL_STORE[NEXT_LATCHES.STATE_NUMBER], sizeof(int)*CONTROL_STORE_BITS);
}

/*
* This function emulates memory and the WE logic.
* Keep track of which cycle of MEMEN we are dealing with.
* If fourth, we need to latch Ready bit at the end of
* cycle to prepare microsequencer for the fifth cycle.
*/
int mem_cycle_count;

void cycle_memory() {
    int memIndex;
    NEXT_LATCHES.READY = 0;

    if(GetMIO_EN(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        memIndex = CURRENT_LATCHES.MAR >> 1;

        if(mem_cycle_count == 4) {
            NEXT_LATCHES.READY = 1;
        }

        if(mem_cycle_count == 5) {
            /* Read Logic */
            if(GetR_W(CURRENT_LATCHES.MICROINSTRUCTION) == 0) {
                if(GetLD_MDR(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
                    NEXT_LATCHES.MDR = Low16bits((MEMORY[memIndex][1] << 8) + MEMORY[memIndex][0]);
                }
            }

            /* WE LOGIC */
            else {
                /* STB odd addr*/

                if(getBit(0, CURRENT_LATCHES.MAR) == 1) {
                    MEMORY[memIndex][1] = getBitRange(8, 15, CURRENT_LATCHES.MDR);
                }

                else {
                    /* STB even addr*/
                    if(GetDATA_SIZE(CURRENT_LATCHES.MICROINSTRUCTION) == 0) {
                        MEMORY[memIndex][0] = getBitRange(0, 7, CURRENT_LATCHES.MDR);
                    }

                    /* STW */
                    else {
                        MEMORY[memIndex][0] = getBitRange(0, 7, CURRENT_LATCHES.MDR);
                        MEMORY[memIndex][1] = getBitRange(8, 15, CURRENT_LATCHES.MDR);
                    }
                }
            }

        }
        /* track of cycle */
        mem_cycle_count++;
    }

    else {
        mem_cycle_count = 1;
    }
}

int Gate_MARMUX_val, Gate_PC_val, Gate_ALU_val, Gate_SHF_val, Gate_MDR_val;
int sext0to4, sext0to5, sext0to8, sext0to10, zextlshf1;
int sr1, sr2;
int amount4;
int adderVal;
enum ADDR2MUX {ZERO, offset6, PCoffset9, PCoffset11} ADDR2MUX;
enum SHF {LSHF, RSHFL, RESERVE, RSHFA} SHF;
enum ALUK {ADD, AND, XOR, PASSA} ALUK;

/*
* Datapath routine emulating operations before driving the bus.
* Evaluate the input of tristate drivers
*             Gate_MARMUX,
*         Gate_PC,
*         Gate_ALU,
*         Gate_SHF,
*         Gate_MDR.
*/

void eval_bus_drivers() {
    /* GateALU */
    int A, B;

    sext0to4 = sext(5, getBitRange(0, 4, CURRENT_LATCHES.IR));

    if(GetSR1MUX(CURRENT_LATCHES.MICROINSTRUCTION) == 0)
        sr1 = CURRENT_LATCHES.REGS[getBitRange(9, 11, CURRENT_LATCHES.IR)];
    else sr1 = CURRENT_LATCHES.REGS[getBitRange(6, 8, CURRENT_LATCHES.IR)];

    sr2 = CURRENT_LATCHES.REGS[getBitRange(0, 2, CURRENT_LATCHES.IR)];

    A = sr1;
    if(getBit(5, CURRENT_LATCHES.IR) == 0)
        B = sr2;
    else B = sext0to4;

    switch (GetALUK(CURRENT_LATCHES.MICROINSTRUCTION)) {
        case ADD:
            Gate_ALU_val = Low16bits(A + B);
            break;
        case AND:
            Gate_ALU_val = Low16bits(A & B);
            break;
        case XOR:
            Gate_ALU_val = Low16bits(A ^ B);
            break;
        case PASSA:
            Gate_ALU_val = Low16bits(A);
            break;
    }

    /* GateSHF */
    amount4 = getBitRange(0,3, CURRENT_LATCHES.IR);

    switch(getBitRange(4, 5, CURRENT_LATCHES.IR)) {
        case LSHF:
            Gate_SHF_val = Low16bits(sr1 << amount4);
            break;
        case RSHFL:
            Gate_SHF_val = Low16bits(sr1 >> amount4);
            break;
        case RSHFA:
            Gate_SHF_val = Low16bits((sr1 << 16) >> (amount4 + 16));
            break;
        default:
            Gate_SHF_val = 0;
            break;
    }

    /* GateMARMUX */
    int addOp1, addOp2;

    sext0to5 = sext(6, getBitRange(0, 5, CURRENT_LATCHES.IR));
    sext0to8 = sext(9, getBitRange(0, 8, CURRENT_LATCHES.IR));
    sext0to10 = sext(11, getBitRange(0, 10, CURRENT_LATCHES.IR));
    zextlshf1 = getBitRange(0, 7, CURRENT_LATCHES.IR) << 1;

    /* Attention: adderVal is shared between MARMUX and PCMUX! */
    if(GetADDR1MUX(CURRENT_LATCHES.MICROINSTRUCTION) == 0)
        addOp1 = CURRENT_LATCHES.PC;
    else addOp1 = sr1; /* BaseR */

    switch(GetADDR2MUX(CURRENT_LATCHES.MICROINSTRUCTION)) {
        case ZERO:
            addOp2 = 0;
            break;
        case offset6:
            addOp2 = sext0to5;
            break;
        case PCoffset9:
            addOp2 = sext0to8;
            break;
        case PCoffset11:
            addOp2 = sext0to10;
            break;
    }

    if(GetLSHF1(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        addOp2 = addOp2 << 1;

    adderVal = addOp1 + addOp2;

    if(GetMARMUX(CURRENT_LATCHES.MICROINSTRUCTION) == 0)
        Gate_MARMUX_val = Low16bits(zextlshf1);

    else Gate_MARMUX_val = Low16bits(adderVal);

    /* GatePC */
    Gate_PC_val = Low16bits(CURRENT_LATCHES.PC);

    /* GateMDR */

    /* Even addr */
    if(getBit(0, CURRENT_LATCHES.MAR) == 0) {
        if(GetDATA_SIZE(CURRENT_LATCHES.MICROINSTRUCTION) == 0) /* LDB of lower byte */
            Gate_MDR_val = Low16bits(sext(8, getBitRange(0, 7, CURRENT_LATCHES.MDR)));
        else Gate_MDR_val = Low16bits(CURRENT_LATCHES.MDR); /* LDW */
    }

    else /* Odd addr, aka LDB of higher byte */
        Gate_MDR_val = Low16bits(sext(8, getBitRange(8, 15, CURRENT_LATCHES.MDR)));

}

/*
* Datapath routine for driving the bus from one of the 5 possible
* tristate drivers.
*/

void drive_bus() {
    if(GetGATE_MARMUX(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        BUS = Gate_MARMUX_val;
    else if(GetGATE_PC(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        BUS = Gate_PC_val;
    else if(GetGATE_ALU(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        BUS = Gate_ALU_val;
    else if(GetGATE_SHF(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        BUS = Gate_SHF_val;
    else if(GetGATE_MDR(CURRENT_LATCHES.MICROINSTRUCTION) == 1)
        BUS = Gate_MDR_val;
    else
        BUS = 0;

}

/*
* Datapath routine for computing all functions that need to latch
* values in the data path at the end of this cycle.  Some values
* require sourcing the bus; therefore, this routine has to come
* after drive_bus.
*/
int dr;
enum PCMUX {PCplus2, Bus, Adder} PCMUX;

void latch_datapath_values() {
    /* LD.MAR */
    if(GetLD_MAR(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        NEXT_LATCHES.MAR = Low16bits(BUS);
    }

    /* LD.MDR */
    if(GetLD_MDR(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        if(GetMIO_EN(CURRENT_LATCHES.MICROINSTRUCTION) == 0) {
            if(getBit(0, CURRENT_LATCHES.MAR) == 0) {
                if(GetDATA_SIZE(CURRENT_LATCHES.MICROINSTRUCTION) == 0) /* STB of the lower byte */
                    NEXT_LATCHES.MDR = Low16bits((getBitRange(0, 7, BUS) << 8) + getBitRange(0, 7, BUS));
                else /* STW */
                    NEXT_LATCHES.MDR = Low16bits(BUS);
            }

            else { /* STB of the higher byte */
            	NEXT_LATCHES.MDR = Low16bits((getBitRange(0, 7, BUS) << 8) + getBitRange(0, 7, BUS)); /* The same as MAR[0] == 0, different operations will be applied in cycle_memory. */
            }
        }
    }

    /* LD.IR */
    if(GetLD_IR(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        NEXT_LATCHES.IR = Low16bits(BUS);
    }

    /* LD.BEN */
    if(GetLD_BEN(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        NEXT_LATCHES.BEN = (CURRENT_LATCHES.N & getBit(11, CURRENT_LATCHES.IR))
            + (CURRENT_LATCHES.Z & getBit(10, CURRENT_LATCHES.IR))
                + (CURRENT_LATCHES.P & getBit(9, CURRENT_LATCHES.IR));
    }

    /* LD.REG */
    if(GetLD_REG(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        if(GetDRMUX(CURRENT_LATCHES.MICROINSTRUCTION) == 0)
            dr = getBitRange(9, 11, CURRENT_LATCHES.IR);
        else dr = 7;

        NEXT_LATCHES.REGS[dr] = Low16bits(BUS);
    }

    /* LD.CC */
    if(GetLD_CC(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        if(BUS == 0) {
        	NEXT_LATCHES.N = 0;
        	NEXT_LATCHES.Z = 1;
        	NEXT_LATCHES.P = 0;
        }

        else if(getBit(15, BUS) == 0) {
        	NEXT_LATCHES.N = 0;
        	NEXT_LATCHES.Z = 0;
        	NEXT_LATCHES.P = 1;
        }

        else if(getBit(15, BUS) == 1) {
        	NEXT_LATCHES.N = 1;
        	NEXT_LATCHES.Z = 0;
        	NEXT_LATCHES.P = 0;
        }
    }

    /* LD.PC */
    if(GetLD_PC(CURRENT_LATCHES.MICROINSTRUCTION) == 1) {
        switch (GetPCMUX(CURRENT_LATCHES.MICROINSTRUCTION)) {
            case PCplus2:
                NEXT_LATCHES.PC = Low16bits(CURRENT_LATCHES.PC + 2);
                break;
            case Bus:
                NEXT_LATCHES.PC = Low16bits(BUS);
                break;
            case Adder:
                NEXT_LATCHES.PC = Low16bits(adderVal);
                break;
        }
    }
}


2009 Communication Channels
The working assumption here is that more is better. More is certainly more and we should absolutely not ignore or block these opportunities. The trick, I think, is to think carefully and complexly and not make an immediate leap into "new is better." It may well be better--but the question bears thinking about, lest we end up making equal and opposite errors as we rush from one ideology to another.


Energy Technology RD&D Budgets Data Explorer
Detailed breakdown of public budgets on energy RD&D submitted to the IEA by its member and association countries
Cite data tool
IEA (2022), Energy Technology RD&D Budgets Data Explorer, IEA, Paris https://www.iea.org/data-and-statistics/data-tools/energy-technology-rdd-budgets-data-explorer
The explorer displays public budgets on energy RD&D submitted to the IEA by its member or association countries. The data is available in the IEA Energy Technology RD&D Budgets database, which is updated twice a year in May and October.
To find more information on the definition of energy RD&D as well as the definition of each of the technology categories in the explorer, please refer to the IEA Guide to Reporting Energy RD&D Budgets/Expenditures Statistics. To find more information on the geographical and time coverage, details on each of the countries datasets and definitions of the products, please refer to the database documentation.
The IEA aggregates include estimates when data points are missing. European Union refers to the European Union budget under Horizon 2020 and the Innovation Fund, and not to the sum of national budgets of European Union member countries. The large increase in 2009 is in large part due to the American Recovery and Reinvestment Act (ARRA) budgeted by the United States in that year.
While the database contains data for many countries as far back as 1974, the lengths of the time axes are automatically adjusted to the available data for a given data selection.
For any questions or feedback, please contact us at firstname.lastname@example.org.


What You Missed
This page is for students who have missed some or all of an Open Source Comes to Campus event.
If you run into any trouble following this guide, feel free to email us or join us on IRC!
How to use this page
This page presents the materials we cover in the order we typically present them. If you're coming in late to an event, ask a mentor where the group is in the schedule and complete all the activities you've missed, up to the present. If you're planning to miss part of the event, or had to leave early, you can view what you missed here. If you're not sure exactly what you missed, email the organizers for clarification.
To set up your computer, go to our Laptop Setup page.
Intro to Open Source Tools
Currently the best way to get a handle on the Open Source Tools lecture is to view the video available on this page. It's approximately 20 minutes long. Alternatively, there's a transcript also available. If you want to do the activities mentioned in the video, you can access the activities mentioned by following the links in the video or following the links in the transcript.
At the event, we likely did some version of the Practicing Git activity. That's difficult to reproduce online (though we can try if you ask us on IRC!) so you might try the Git training mission instead.
Picking a Project
We used this handout (warning: auto-downloaded PDF) to work through the process of finding a project to contribute to. Although the handout is phrased for working in pairs, you can just apply the questions to yourself. (Or find a person to partner with! You can do this with a friend or classmate, or someone on the #openhatch IRC.)
We spent the last part of the day contributing to open source projects. If you need help identifying good issues to work on, join us on #openhatch and we'll do our best to help you out.


//           Copyright Nathaniel Christen 2019.
//  Distributed under the Boost Software License, Version 1.0.
//     (See accompanying file LICENSE_1_0.txt or copy at
//           http://www.boost.org/LICENSE_1_0.txt)

#ifndef PHR_SCOPE_SYSTEM__H
#define PHR_SCOPE_SYSTEM__H

#include "kans.h"

#include "accessors.h"

#include <QtGlobal>
#include <QQueue>

#include <QMap>

#include "phr-runtime-scope.h"

KANS_(Phaon)

class PHR_Runtime_Scope;

class PHR_Scope_System
{
 PHR_Runtime_Scope* current_scope_;
 QQueue<PHR_Runtime_Scope*> phr_scope_queue_;

public:

 PHR_Scope_System();

 ACCESSORS(PHR_Runtime_Scope* ,current_scope)
 ACCESSORS__RGET(QQueue<PHR_Runtime_Scope*> ,phr_scope_queue)

 quint64 find_value_from_current_scope(QString key, PHR_Type** rty = nullptr);

 PHR_Type* get_type_for_symbol_name(QString sym);
};

_KANS(Phaon)

#endif //PHR_SCOPE_SYSTEM__H


The local toolbar contains the following commands:
- Opens the search bar to allow you to locate messages.
- Collapse All
- Collapses all messages.
Note: You can also access this command through the Ctrl+- keyboard shortcut.
- Expand All
- Expands all messages.
Note: You can also access this command through the Ctrl+= keyboard shortcut.
- Reset Runs
- Invokes the Reset Runs dialog box to remove previous run results and to set the run status back to Not Started for the selected runs.
- Reset to Previous Step
- Resets the selected run to the preceding step. This allows you to step backward through a run, make any needed changes, and then step forward to complete the run.
- Launch Runs
- Invokes the Launch Runs dialog box to launch the selected runs.
- Launch Next Step
- Launches the next step of the selected run. For implementation runs, the
available steps are
write_bitstream. Synthesis only has one step,
- Create Runs
- Invokes the Create New Runs wizard to create and configure new synthesis or implementation runs. For more information, see the Running Synthesis section of the Vivado Design Suite User Guide: Synthesis (UG901) or the Vivado Design Suite User Guide: Implementation (UG904) .
- Show Percentage
- Shows utilization by percentage rather than by number.


As you know Microsoft has retrieve the data from Hadoop with by polybase and extended the R language to External language(R and Phython). now Microsoft is wanted to make sure that it has feasibility for all the environment whichever is available in the market. earlier I blog on MongoDB which is happening and favorable to developers for document store and containers concept, CosmosDB is the similar architecture of MongoDB for horizontal data storage , container and Document with the help of DocumentDB.
Microsoft has introduced many things recently(SQL 2016/17):
SQL Server on Linux
SQL Server – PolyBase (Hadoop Compatibility- data retrieval)
Azure SQL Server – CosmosDB – MongoDB
This indicates that Microsoft do not want to be isolated on Windows platform nor want to restrict to small scale… and Its been proved that Microsoft is doing great on this area… the only thing I believe is the SME for those new concepts which has been introduced unless we do not know how to manage it we may not be expert of doing it so.
Posted in Azure, Cloud, NoSQL, Others, sql 2016, SQL Server 2017, SQLonLinux
Tagged Azure, Cloud, NoSQL, SQL Server 2017, Whats New
Yes thats true, SQL Server New version will be release this year and call it “SQL Server 2017” where sql can also work on Windows, MacOS and Linux
SQL Server is running on Linux now with SQLPAL- SQL Platform Abstraction Layer(SQLPAL) -it will work as a virtual Windows server on Linux so I think now Microsoft should able to include things which we are doing on Windows Server.
on that note, Now vNext with CTP 1.4 Microsoft has introduce the SQL Server Agent functionality on vNext.
Yes that is true, now SQL Server is on Linux.
Download the public preview
I am learning it and would love to write more blogs soon.
In our earlier blog we discussed an introduction to MongoDB. so, how is MongoDB is into BigData, MongoDB has a concept called sharding with replication, so here using sharding it uses a cluster like configuration and data will be load-balance- equally distribute to multiple shard with the shard key.
so if we consider the HDFS- hadoop concept here unlike named node we have config server and shard is like data node. but here we have data is distributed to multiple shards but in hadoop system data is replicated to multiple data nodes. and MongoDB maintain the redundancy by using Replication.
Balancer makes sure that data is distruted equally to all the shards if data is not balanced balancer will run the processes at background and balance the data.
here shard key plays a very important role.
will write more on it later.
We have discussed hadoop and its HDFS management tools for big data system, which works horizontal scaling for data distribution and can be used for data warehousing. can manage big data/heavy data
There is another BIG Data system called MongoDB, which is again an open source. this is very developer friendly NoSQL system. as you know about RDBMS it has pre defined record structure and rows size is static. so for developer if they want to think and make some changes in the metadata by adding any columns or make changes in data type of the column will intern has to make the changes into the complete data and its related indexes. MongoDB is document oriented NoSQL.
MongoDB consider record as a document and you can dynamically add the columns into it and for developer its not necessary to input all the column information into one record/document. this way developer likes this database system.
MongoDB is written in C, C++, and java scripts. and it works same as developments.
In our last blog on Future DBA, we discussed on HADOOP -HDFS system. how as we know HDFS management is quite difficult so with the help of Vendors -Cloudera/Hortonworks/MapR we can integrate the tools/utility in a GUI way and can be manage easily and efficiently.
This HDFS data can be retrieved and inserted using HIVE utility which will provide us the access to HDFS data in a SQL like way and we can create a access the data just like sql queries.
Hive requires the Meta store system, can be any RDBMS opensource -MySQL or PostgreSQL or any other RDBMS which will store the metadata on the HIVE and actual data would be stored in HDFS.
HIVE uses Map-Reduce process for retrieving data from HDFS.
So for DBA we can work on HDFS data efficiently and just like our RDBMS.
In our last blog on Hadoop Big Data we have discussed about Hadoop and its tools/utility to connect to HDFS. on continue to that hadoop is mostly for big data and the on hadoop is stored in HDFS with named node contains pointers /address of data location and data stores contains the actual data. there are multiple data stores and the data on data store is replicated to multiple data nodes for redundancy purpose. and accessing the data on multiple nodes would be faster.
we can store or use one node static to store data as a backup node. Hadoop is used for data warehouse purpose and as its a BIG Data, data stored on it is in bulk /huge and used for read purpose. so if we use hive/impala or any other tool HDFS data can be mostly be used for READ-ONLY data warehouse and used to generate the report and get the data once data is inserted into HDFS. There are mappers to read the data on data nodes.
*HDFS /BIG DATA is effective on data reads and not work best for UPDATES.


View Full Version : [ubuntu] how do i install a patch to module
November 16th, 2008, 01:37 PM
hey all i have found some patchs to apply to gspca to hopefully get my webcam working can anyone tell me how to do it correctly please. thanks in advance
November 16th, 2008, 02:03 PM
I don't have gspca, but after watching this video (http://www.linuxjournal.com/video/get-your-webcam-working-gspca)
I think I understand the general steps:
Install the build-essential package. It is in the official repositories. This package will draw in tools you'll need to compile other programs.
Download the gspca source code. The video shows how to do this. You might want to google around to see if there is a newer version however.
Put the patch file either in the directory above the gspca source or at the top level of the source. You need to look inside the patch file to determine this. Then read
to determine the right command. If you are unsure, post the patch file, or a url to the patch file.
After you've successful run the patch command,
you should be able to follow the rest of the instructions as shown in the video.
Note that other Linux distros use "su" to gain a root shell. Ubuntu uses "sudo -i" to gain a root shell.
November 16th, 2008, 02:59 PM
ok so that shows howto instal gspca but the patching part for it is ruybbish
i have been trying to use the patch -p0 command but it isnt working
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.


#ifndef N_E_EVAL_H
#define N_E_EVAL_H

#include "../common/errors.h"

void
n_init_eval(NError* error);

#endif /* N_E_EVAL_H */


Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).

Iahub wants to know how many Coders can be placed on an n × n chessboard, so that no Coder attacks any other Coder.


Hello, how do i remove the likes and views showing on my post grid blog?
Welcome to our forum.
Not sure which Post Grid plugin are you using? we don't have like and views on our pos grid plugin. can you please send me your post grid page url?


Linked cells in Multiple Workbooks
I am tracking dates and have linked cells from another workbook so as t
not have to duplicate the data entry of dates. The dates are linked t
projects that are listed in rows and there is information in m
workbook that is additional information within the row. So if someon
changes the order of the other workbook, the information that is in m
workbook does not get sorted with the order. Is there a way to link m
cells to the linked cells?
Project ID Start Date Milestone
EndDate Person Assigned
1234 (linked) 11/15/04 11/20/04(lin...How can I bind the results of Web service to a ListView?
I'm new to ASP.NET so I apologize if this is a basic question.
I have a Web application. This web application has a ListView on it.
For this web app I make calls to a web service which returns data from a
database. I return the data using the following format:
public List<Record> Search()
List<Record> list = new List<Record>();
/* Populate list with data from a db */
public class Record
public String name;
public String address;
public int ageInYears;
Now I would like from the Web Appl...How can I search for a ? in Publisher?
I did a Search & Replace and somehow ? marks were placed throughout my
32-page document. I want to be sure I found them all, but when I search for
?, it stops at every letter.
Appreciate some advice. Thanks.
It doesn't work for me either. It doesn't work in 2010 as well. You can
checkmark *Match whole words only* Publisher will look between each word rather
than each letter. Not much help when you are dealing with 32 pages.
"guymaine" <email@example.com> wrote in message
news:B89D6FF6-B7...Importing a .cdr file in Publisher 2007
Hi there, someone has sent me a .cdr file, is there a way to import it into
You can import a .cdr file in 2007. Not sure about the version however. I cannot
import CorelDraw 12 images into Publisher. Your sender can convert the .cdr in
Corel to a .wmf or .emf or any other format.
Try importing, Insert, picture, from file.
If your sender cannot convert the file, send it to me and I will convert it for
mary-sauer at columbus.rr.com
Mary Sauer MSFT MVP
"Ulli" <Ul...Formatting four pages onto one 12x18 sheet
I'm trying to figure out how to format a 12 x 18 sheet with four individual
5.5 x 8.5 pages on it. Any ideas? The closest I can get is under page
setup...selecting "postcards" and that will give me three pages per sheet,
but I need four.
Any ideas or thoughts are greatly appreciated.
If your printer can be custom setup to 12 x 18 then you can divide it into four
parts. Are you sure you aren't trying to setup a 11 x 17 landscaped sheet? In
any event, setup your printer first.
File, Page Setup, Advanced on the right, type 18 width, 12 height or 17 width,
11 ...Problem using Microsoft Web Browser control
I am trying to access the Custom properties of a Web Browser ActiveX control
on a form and I keep getting a message telling me that "The Operation on the
Microsoft Web Browser object failed. The OLE server may not be registered.
To register the OLE server, reinstall it."
I searched TechNet and MSDN and could not resolve this. I reinstalled Access
2003 (I have 2003 and 2007 installed on my workstation, XP Pro) and still no
Has anyone else seen this and if so, can you tell me how to resolve this?
Does anyone know the name of the file the message...How to open workbook without hardcoding path
Could anyone tell me how to open a workbook from another workbook, where
both files are in the same folder, without hardcoding the path. I have tried
code like this without success.
Workbooks.open (path & "\somefile.xls")
Thanks in advance
Excel automatically looks in the current folder, so :-
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com
...Converting Publisher 2002 catalog to PDF
I created a catalog using Publisher 2002. Now I need to
convert it to PDF. The problem is that when I convert if,
the pages do not appear in consecutive order (i.e., the
first page of the catalog appears with the last page).
Does anyone have a solution for this problem?
Are you producing the catalog as a saddle-stitched book? What you are
getting is printer's/press spreads, which, unless it is going on a large
format press, is probably fine for your printer. If you are printing
separate sheets to be bound by a different method, or if it is going on a
large format press, and the printe...click on page form tab to filter subform
I have page tab with following names: Flat Rate, Global Rate, MSRP Rate. I
would like to have subform only show the rates for each page tab. How do I
go about doing this. I am new to VBA and from reading all the threads, I
can't seem to find the one that fits my exact need. Please explain
step-by-step since I am new. Let me know if I need to provide more details.
Presumably you have a field in the RecordSource of your subform that
contains one of the three values (Flat Rate, Global Rate, MSRP Rate) or some
other text or code that corresponds to these values....One link breaks every time I open a workbook...
I have 3 workbooks tied together with links. One is a source only, the other
two push and pull data.
One of the sources, Payroll Master, on opening updates all links fine to the
source only workbook but not
to the third workbook (which is in the parent directory). Every time I open
it it prompts me to show it where the Payroll Entry is. Doesn't matter if I
hit cancel and
do Edit Links, I can change it there, but will still lose it upon closing
(the link appears in the box and looks ok, just won't update...)
Try going Edit->Links. Break the link and re-establish it? That m...How do I look at two worksheets in one Excel workbook at same time
I know how to arrange windows to look at multiple workbooks. But I want to
have two worksheets displayed at the same time from the same workbook. Is
there a way to do that?
Window - New Window
this will create a second view of active workbook. Then you can do Window -
Arrange, active workbook only.
"PeoriaJean" <firstname.lastname@example.org> wrote in message
>I know how to arrange windows to look at multiple workbooks. But I want to
> have two worksheets di...Signature page not printed for Credit card transaction
I have set up new POS system and the POS system does not print
signature page for credit card use.
I check 'require signarue' for the receipt from tender type window and
print Z-out to apply it but it still does not printing out the
Please be advised.
thank you for your help!
This is a multi-part message in MIME format.
Make sure the receipt is set to print it. Manager | Database | Register =
Lis...Biggest worldwide free Entertainment multi language Video web , Travel, Sports, Health , Racing cars , Massages techniques, Games , Fashions, Jokes , Top models , Free online IT learning , 5000 l
I'd like to introduce you 2 biggest free Video multi language
entertainment websites :
...Publisher font issue
I have an issue with Publisher 2000 and the calendar font
size. The defaulted font size is 18. In each calendar
date box, when I enter information is a smaller font (8
font), and save; close the program and then reopen; the 8
font text defaults to 18 font. I need the smaller font
for information that needs to go into the calendar. I
have tried a few tings through the help feature but
nothing I do seems to work. Can someone help me with this
or tell me how to fix this problem?
Try this, put the calendar on the background (master page) Ctrl + m , use text boxes
for your i...how to use a saved master page
I have created a new master page and saved it as a .pub file. The question
is when opening a new document, how do I apply the saved master file?
Open the master file, copy, paste to your new publication.
Mary Sauer MSFT MVP
"Colin" <Colin @discussions.microsoft.com> wrote in message
>I have created a new master page and saved it as a .pub file. The question
> is when opening a new document, how do I apply the saved mas...Do I need Publisher installed to read/edit articles in an e-mail?
I will be receiving e-mails with attachments containing Publisher2002 created
articles. Do I need to have Publisher 2002 or later editions in order to
read and edit these e-mail articles?
On Mon, 7 Nov 2005 22:20:03 +0000, quilter512 wrote
(in article <email@example.com>):
> I will be receiving e-mails with attachments containing Publisher2002 created
> articles. Do I need to have Publisher 2002 or later editions in order to
> read and edit these e-mail articles?
You can answer your own question by STFW. You not heard of Google Grou...Workbook there but not visible! Help!
I was working on some VBA code for an excel application I
am writing. I switched between the VBE and the
spreadsheet and all of a sudden my workbook is no longer
visible! In the VBE project explorer window it shows my
project and my code but in the excel window...no
Ran a test procedure calling IsAddin to see if somehow I
accidentally clicked a button/box telling Excel to make
this file an addin but it returned false.
I did close the file and re-open it.
Maybe it's just off the visible screen:
Window|Arrange|tiled (and resize manually)
or maybe y...Conditional Formatting for Image box on Continuous Forms
This problem is driving me crazy. I am a car enthusiast and love
taking photos of classic cars. I have a table which describes the
make and model in a series of fields. There are several fields that
contain a reference to photos of those cars. Ie: the fields are
called "Front" "Side" "Rear" "Angle". My form has four image boxes to
display the images stored in these fields. But when I open the form
all the records show the images of the first car only.
I asked about this a few days ago and was advised to check out
http://www.lebans.co...Loading Publisher 2003 on to Vista Home Premium
I have recently bought a new computer with Vista Home Premium, but my
Publisher 2003 will not load as it states there is no Windows XP or 2000
running. Quite right, but do I really have to buy the 2007 version? As a UK
charity we have bought the Student 2007 office version - is there a student
version of Publisher 2007?
Mark Ward Senior User
Try installing in safe mode.
Do you get an error other than there is no XP or 2000.
Publisher 2003 should install on Vista.
List of system requirements for Microsoft Office 2003
Mary Sauer MSFT ...page numbers in Word 2007
I have a Microsoft Word 2007 document which has a title and
table of contents on the first page and the various chapters on
the following pages. I have used an automatic TOC and then
clicked on the Insert tab and then Page Number -> Bottom of
Page to insert page numbers.
My problem is that I don't want the first page to be numbered
so that the second page starts with the number 1.
I have tried clicking Page Number -> Format Page Numbers...
to set the first page number at zero but then when I delete the
zero all page numbers are deleted by Word 2007 just as th...Help! New to Publisher
What is the A...at the bottom of a page inside a small
box? I am typing a newsletter. Shouldn't one page flow
to the next like in Microsoft Office? If it is text
overflow, I cannot retrieve. What am I doing wrong?
That indicates that there is more text inside that area that cannot be seen.
If you stretch that text box down, you'll see the rest of your text. To make
it flow from one box to another, you need to set it up for that. (I will
admit that I break mine manually because I've never taken the time to learn
how to do it correctly.)
The problem with ...How do I publish to the web a 3 page web pubblication from Publis.
I created a 3 page web publication in Publisher 2003, but when I 'publish it
to the web', only the first page is converted. What do I need to do?
Review the FAQ - http://www.publishermvps.com/Default.aspx?tabid=30
David Bartosik - MS MVP
"Bazbo" <firstname.lastname@example.org> wrote in message
> I created a 3 page web publication in Publisher 2003, but when I 'publish
> to the web', only the first page is converted. What do I need to do?
...publisher screen pulsing
my publisher file won't stop flashing or pulsing and its driving me crazy!
is it because my files is too large?
Wouldn't think large files would cause pulsating. How current is your video driver?
Do you have high contrast enabled in the accessibility options?
Mary Sauer MSFT MVP
"Bridget" <email@example.com> wrote in message
> my publisher file won't stop flashing or pulsing and its driving me crazy!...blank page prints after group (sometimes)
I have report of students with the class_id defined as a group. "Force New
Page" is defined "Before Section".
Whether I have a page and a group header defined (they can be the same anyway)
or just a page header defined, I am getting the same problem:
27 students can fit onto a page. However, if there is a class of 25 students,
the next page is blank except for the header. (I have not seen a class of
27 students so I have not tested that yet).
I can't seem to find a way out of it. Where I am I going wrong?
Message posted via AccessMonster.com
http://www.acce...Batch conversion between publisher versions.
My parents downloaded the trial of office 2007, unknown to me, and created
lots of documents that are quite important. The trial has expired, is there a
way to batch convert these to publisher 2000 format, as that is what they
were using before. There is 100+documents.
No, there is no batch conversion. Your only recourse would be to buy Publisher
2002, 2003 or 2007. Or find some kind soul to convert the files for you, one at
a time. This conversion isn't necessary with newer versions of Publisher because
the newer versions will open 2000 files.
Mary Sauer MSFT MVP


Denis was very sad after Nastya rejected him. So he decided to walk through the gateways to have some fun. And luck smiled at him! When he entered the first courtyard, he met a strange man who was selling something.

Denis bought a mysterious item and it was... Random permutation generator! Denis could not believed his luck.

When he arrived home, he began to study how his generator works and learned the algorithm. The process of generating a permutation consists of $$$n$$$ steps. At the $$$i$$$-th step, a place is chosen for the number $$$i$$$ $$$(1 \leq i \leq n)$$$. The position for the number $$$i$$$ is defined as follows:

- For all $$$j$$$ from $$$1$$$ to $$$n$$$, we calculate $$$r_j$$$  — the minimum index such that $$$j \leq r_j \leq n$$$, and the position $$$r_j$$$ is not yet occupied in the permutation. If there are no such positions, then we assume that the value of $$$r_j$$$ is not defined.
- For all $$$t$$$ from $$$1$$$ to $$$n$$$, we calculate $$$count_t$$$  — the number of positions $$$1 \leq j \leq n$$$ such that $$$r_j$$$ is defined and $$$r_j = t$$$.
- Consider the positions that are still not occupied by permutation and among those we consider the positions for which the value in the $$$count$$$ array is maximum.
- The generator selects one of these positions for the number $$$i$$$. The generator can choose any position.

Let's have a look at the operation of the algorithm in the following example:

Let $$$n = 5$$$ and the algorithm has already arranged the numbers $$$1, 2, 3$$$ in the permutation. Consider how the generator will choose a position for the number $$$4$$$:

- The values of $$$r$$$ will be $$$r = [3, 3, 3, 4, \times]$$$, where $$$\times$$$ means an indefinite value.
- Then the $$$count$$$ values will be $$$count = [0, 0, 3, 1, 0]$$$.
- There are only two unoccupied positions in the permutation: $$$3$$$ and $$$4$$$. The value in the $$$count$$$ array for position $$$3$$$ is $$$3$$$, for position $$$4$$$ it is $$$1$$$.
- The maximum value is reached only for position $$$3$$$, so the algorithm will uniquely select this position for number $$$4$$$.

Satisfied with his purchase, Denis went home. For several days without a break, he generated permutations. He believes that he can come up with random permutations no worse than a generator. After that, he wrote out the first permutation that came to mind $$$p_1, p_2, \ldots, p_n$$$ and decided to find out if it could be obtained as a result of the generator.

Unfortunately, this task was too difficult for him, and he asked you for help. It is necessary to define whether the written permutation could be obtained using the described algorithm if the generator always selects the position Denis needs.


//
//  SwiftyOnceTV.h
//  SwiftyOnceTV
//
//  Created by Steve Jun on 10/29/18.
//  Copyright © 2018 ktustanowski. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for SwiftyOnceTV.
FOUNDATION_EXPORT double SwiftyOnceTVVersionNumber;

//! Project version string for SwiftyOnceTV.
FOUNDATION_EXPORT const unsigned char SwiftyOnceTVVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SwiftyOnceTV/PublicHeader.h>


#if !defined(AFX_NTGRAPH_H__CF55B0EC_CF41_453C_BFEB_4740927AE8B3__INCLUDED_)
#define AFX_NTGRAPH_H__CF55B0EC_CF41_453C_BFEB_4740927AE8B3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++

// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.

// Dispatch interfaces referenced by this interface
class COleFont;
class CPicture;

/////////////////////////////////////////////////////////////////////////////
// CNTGraph wrapper class

class CNTGraph : public CWnd
{
protected:
	DECLARE_DYNCREATE(CNTGraph)
public:
	CLSID const& GetClsid()
	{
		static CLSID const clsid
			= { 0xc9fe01c2, 0x2746, 0x479b, { 0x96, 0xab, 0xe0, 0xbe, 0x99, 0x31, 0xb0, 0x18 } };
		return clsid;
	}
	virtual BOOL Create(LPCTSTR lpszClassName,
		LPCTSTR lpszWindowName, DWORD dwStyle,
		const RECT& rect,
		CWnd* pParentWnd, UINT nID,
		CCreateContext* pContext = NULL)
	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
		const RECT& rect, CWnd* pParentWnd, UINT nID,
		CFile* pPersist = NULL, BOOL bStorage = FALSE,
		BSTR bstrLicKey = NULL)
	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
		pPersist, bStorage, bstrLicKey); }

// Attributes
public:
	short GetAppearance();
	void SetAppearance(short);
	CString GetCaption();
	void SetCaption(LPCTSTR);
	BOOL GetEnabled();
	void SetEnabled(BOOL);
	unsigned long GetAxisColor();
	void SetAxisColor(unsigned long);
	unsigned long GetGridColor();
	void SetGridColor(unsigned long);
	unsigned long GetLabelColor();
	void SetLabelColor(unsigned long);
	unsigned long GetCursorColor();
	void SetCursorColor(unsigned long);
	COleFont GetLabelFont();
	void SetLabelFont(LPDISPATCH);
	COleFont GetTickFont();
	void SetTickFont(LPDISPATCH);
	COleFont GetTitleFont();
	void SetTitleFont(LPDISPATCH);
	COleFont GetIdentFont();
	void SetIdentFont(LPDISPATCH);
	short GetXGridNumber();
	void SetXGridNumber(short);
	short GetYGridNumber();
	void SetYGridNumber(short);
	BOOL GetShowGrid();
	void SetShowGrid(BOOL);
	CString GetXLabel();
	void SetXLabel(LPCTSTR);
	CString GetYLabel();
	void SetYLabel(LPCTSTR);
	unsigned long GetElementLineColor();
	void SetElementLineColor(unsigned long);
	unsigned long GetElementPointColor();
	void SetElementPointColor(unsigned long);
	long GetElementLinetype();
	void SetElementLinetype(long);
	long GetElementWidth();
	void SetElementWidth(long);
	long GetElementPointSymbol();
	void SetElementPointSymbol(long);
	BOOL GetElementSolidPoint();
	void SetElementSolidPoint(BOOL);
	BOOL GetElementShow();
	void SetElementShow(BOOL);
	long GetTrackMode();
	void SetTrackMode(long);
	CString GetElementName();
	void SetElementName(LPCTSTR);
	BOOL GetElementIdentify();
	void SetElementIdentify(BOOL);
	BOOL GetXLog();
	void SetXLog(BOOL);
	BOOL GetYLog();
	void SetYLog(BOOL);
	CPicture GetControlFramePicture();
	void SetControlFramePicture(LPDISPATCH);
	CPicture GetPlotAreaPicture();
	void SetPlotAreaPicture(LPDISPATCH);
	unsigned long GetControlFrameColor();
	void SetControlFrameColor(unsigned long);
	unsigned long GetPlotAreaColor();
	void SetPlotAreaColor(unsigned long);
	long GetFrameStyle();
	void SetFrameStyle(long);
	CString GetAnnoLabelCaption();
	void SetAnnoLabelCaption(LPCTSTR);
	double GetAnnoLabelX();
	void SetAnnoLabelX(double);
	double GetAnnoLabelY();
	void SetAnnoLabelY(double);
	unsigned long GetAnnoLabelColor();
	void SetAnnoLabelColor(unsigned long);
	BOOL GetAnnoLabelHorizontal();
	void SetAnnoLabelHorizontal(BOOL);
	short GetAnnotation();
	void SetAnnotation(short);
	BOOL GetAnnoVisible();
	void SetAnnoVisible(BOOL);
	short GetAnnoCount();
	void SetAnnoCount(short);
	short GetElement();
	void SetElement(short);
	short GetElementCount();
	void SetElementCount(short);
	unsigned long GetAnnoLabelBkColor();
	void SetAnnoLabelBkColor(unsigned long);
	short GetCursorCount();
	void SetCursorCount(short);
	short GetCursor();
	void SetCursor(short);
	double GetCursorX();
	void SetCursorX(double);
	double GetCursorY();
	void SetCursorY(double);
	short GetCursorStyle();
	void SetCursorStyle(short);
	BOOL GetCursorVisible();
	void SetCursorVisible(BOOL);
	short GetCursorMode();
	void SetCursorMode(short);
	CString GetFormatAxisBottom();
	void SetFormatAxisBottom(LPCTSTR);
	CString GetFormatAxisLeft();
	void SetFormatAxisLeft(LPCTSTR);
	BOOL GetYTime();
	void SetYTime(BOOL);
	BOOL GetXTime();
	void SetXTime(BOOL);
	double GetMinXRange();
	void SetMinXRange(double);
	double GetMaxXRange();
	void SetMaxXRange(double);
	double GetMinYRange();
	void SetMinYRange(double);
	double GetMaxYRange();
	void SetMaxYRange(double);

// Operations
public:
	void SetRange(double xmin, double xmax, double ymin, double ymax);
	void AutoRange();
	void CopyToClipboard();
	void PrintGraph();
	void AddElement();
	void DeleteElement(short ElementID);
	void ClearGraph();
	double GetElementXValue(long index, short ElementID);
	void SetElementXValue(long index, short ElementID, double newValue);
	double GetElementYValue(long index, short ElementID);
	void SetElementYValue(long index, short ElementID, double newValue);
	void PlotXY(double X, double Y, short ElementID);
	void PlotY(double Y, short ElementID);
	void ShowProperties();
	void SaveAs(LPCTSTR szFilename);
	void AddAnnotation();
	void DeleteAnnotation(short annoID);
	void AddCursor();
	void DeleteCursor(short cursorID);
	void AboutBox();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_NTGRAPH_H__CF55B0EC_CF41_453C_BFEB_4740927AE8B3__INCLUDED_)


We here at MakeTechEasier got a lot of positive feedback on our coverage of Google Wave, along with quite a few requests for additional information. So here, by reader request, is the second installment of Wave. Today we’ll be covering some of the more advanced and detailed features that didn’t fit into the original post. In this installment we’ll take a look at Wave’s use of folders, contacts, extensions, and believe it or not, even scroll bars.
One of GMail’s strengths is its ability to handle large volumes of email while allowing you to keep things organized. Wave built on GMail’s experience and has also included some useful features for keeping things in order. For starters, you’ve got Folders which work like GMail’s labels and everything else’s… well… folders. You can drag and drop waves into these folders and they will not show up in your inbox. To view that message you can either click the title of the folder or choose All at the top of the Navigation pane.
As you can see in the screenshot, you can also colorize each of the folders individually. I can see how this could be helpful if you have a LOT of folders and want to use colors to group them together, or if there’s a particular folder you want to keep highlighted to catch your eye.
In addition to managing waves through folders, you also have two ways to essentially forget about a message until it’s needed. First, you can Mute a wave, so that it no longer shows up as unread even when it has been modified by others. If you just want a wave out of your inbox but still want to know when it’s been updated, you can Archive that message. You won’t see it until someone makes an update to that wave. Both muted and archived waves will show up in searches and in the All section.
I’ve found it useful to archive almost everything. When a wave has pretty clearly ended, I’ll set it to Archive and leave only messages I intend to keep alive in my inbox. If anyone happens to update one of those waves, it’ll pop right back up in my inbox like normal. Without this I think it wouldn’t take long for Wave to feel a bit overwhelming, if you use it frequently.
One messaging feature I really like is the ability to embed a reply inside the original message. In this example, Tara wrote the original message, and instead of creating a separate reply or copy & pasting her words, I can choose any spot in her message and insert my reply.
Let’s say you’re in a wave with everyone at the office. Your boss is discussing the importance of TPS reports. Suddenly, a witty remark pops into your head, and you have a choice. Do you uphold your status as the office comedian, or bite your tongue to keep your job? Wave provides a third option – create a private branch. Only the people specified in that branch can see those messages. In this example screenshot, there are many people in the wave but only the person I included in my private reply can see what I wrote.
The only really notable feature about the contacts is that you can do an incremental search for people in your contact list, as demonstrated below. My only complaint is that Wave does not apparently include GMail type status messages with the contacts. I’ve seen no word so far on whether or not that will be a feature in future Wave revisions.
We covered extensions briefly in our first report on Wave, but there’s plently more to be said. Extensions can be installed and removed through the Extensions Gallery, which is a wave itself. For me, the extension gallery showed up in my inbox the day after I activated my Wave account. In it is a list of available extensions you can choose to install.
One of the most notable aspects of Wave in regards to extensions is they Google strongly encourages independent developers to create their own Wave extensions. The recommended language is Java but they also have a Python client library. As a fan of Python I think this is great news.
With the many clever options Wave provides for message management and extensions, Wave is clearly going to be a contender for online communications. Right now the biggest obstacle is establishing a firm user base, as Wave is only useful if all your friends and associates also use it. Leaving the system open will work to Google’s benefit in that sense, as future users won’t be limited to just the official Wave website and client, but will be able to communicate over any wave-compatible platform. I, for one, look forward to seeing what the future holds for Wave.
Our latest tutorials delivered straight to your inbox


Conditional Expressions don't solve the problem
dale at riverhall.NOTHANKS.co.uk
Thu Oct 18 14:26:38 CEST 2001
salemail at dial.pipex.com (Kevin D) wrote:
>Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> wrote in message news:<pehrstk4sg9uhcugmrfeharqsvdbf6t4be at 4ax.com>...
>> But worst of all is that I can't assign a value and test it at the
>> same time. It means I have to add at least an extra line of code and I
>> have to retype a variable name. It makes for more verbose code and it
>> reduces my productivity.
>Are you sure you need to "assign a value and test it at the same time"
> Are you saying that just because that's what you're used to from C ?
>What are the _problems_ you encounter that make you wish for this
Too many and varied to have any hope of addressing them all with
specific inventions. And why bother with other inventions when this
small facility would do the job?
Also, why should I spend longer investigating a 'pythonic' solution
(and some are pretty obscure) when I *know* my 'traditional' construct
will do the job nicely and very transparetly to most programmers.
> What are the alternative solutions to those problems ?
Riverhall Systems Ltd
More information about the Python-list


Родители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родители Васи считают плохими. Когда Вася получает подряд три хорошие оценки, ему сразу вручают подарок, но для того, чтобы получить ещё один подарок, ему вновь надо получить подряд ещё три хорошие оценки.

Например, если Вася получит подряд пять «четвёрок» оценок, а потом «двойку», то ему дадут только один подарок, а вот если бы «четвёрок» было уже шесть, то подарков было бы два.

За месяц Вася получил n оценок. Вам предстоит посчитать количество подарков, которые получил Вася. Оценки будут даны именно в том порядке, в котором Вася их получал.


/*
 * Copyright 2020 The TensorFlow Runtime Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// MatMul + Fusion kernel implementation (fusion added via output kernel).

#ifndef TFRT_BACKENDS_CPU_LIB_KERNELS_CPU_FUSED_MATMUL_KERNEL_H_
#define TFRT_BACKENDS_CPU_LIB_KERNELS_CPU_FUSED_MATMUL_KERNEL_H_

#include "./matmul_kernel.h"
#include "tfrt/common/compat/eigen/contraction_output_kernel.h"
#include "tfrt/common/compat/eigen/eigen_dtype.h"
#include "tfrt/common/compat/eigen/eigen_evaluator.h"
#include "tfrt/common/compat/eigen/eigen_kernel.h"
#include "tfrt/common/compat/eigen/tensor_types.h"
#include "tfrt/support/forward_decls.h"
#include "tfrt/tensor/dense_host_tensor.h"
#include "tfrt/tensor/dense_host_tensor_view.h"

namespace tfrt {
namespace cpu {
namespace {

template <typename OutputKernel, typename T, typename EigenEvaluator>
typename EigenEvaluator::DependencyToken FusedMatMulInternal(
    const DenseHostTensor& a, const DenseHostTensor& b, DenseHostTensor* output,
    const DenseHostTensor& fusion_input, bool transpose_a, bool transpose_b,
    EigenEvaluator eigen) {
  DHTArrayView<T> bias_view(&fusion_input);
  OutputKernel output_kernel(compat::AsEigenConstTensor(bias_view));
  return cpu::MatMul<T>(1.0, a, b, 0.0, output, transpose_a, transpose_b,
                        std::move(output_kernel), eigen);
}

}  // namespace

template <typename T, typename EigenEvaluator, typename FuseInputsRange>
typename EigenEvaluator::DependencyToken FusedMatMul(
    const DenseHostTensor& a, const DenseHostTensor& b, DenseHostTensor* output,
    FuseInputsRange fusion_inputs, bool transpose_a, bool transpose_b,
    AggregateAttr fused_ops_attr, const ExecutionContext& exec_ctx) {
  static_assert(std::is_same<std::decay_t<decltype(fusion_inputs[0])>,
                             DenseHostTensor>::value,
                "fusion_inputs must be a range of DenseHostTensor");

  EigenEvaluator eigen{exec_ctx.host()};

  // Parse the MatMul fusion config.
  llvm::SmallVector<string_view, 4> fused_ops(fused_ops_attr.GetNumElements());
  for (int i = 0; i < fused_ops_attr.GetNumElements(); ++i) {
    fused_ops[i] = fused_ops_attr.GetAttribute(i).cast<StringAttr>().GetValue();
  }

  if (fused_ops.empty()) {
    return eigen.MakeError("FusedMatMul must specify fused operations");
  }

  // Match the fusion to Eigen contraction output kernel.
  auto match_fusion = [&](std::initializer_list<string_view> ops) -> bool {
    return fused_ops.size() == ops.size() &&
           std::equal(fused_ops.begin(), fused_ops.end(), ops.begin());
  };

  // Dispatch fusion to correct Eigen contraction output kernel.
  // Validate BiasAdd operands.
  if (fused_ops[0] == "BiasAdd") {
    auto& bias = fusion_inputs[0];

    if (bias.shape().GetRank() != 1)
      return eigen.MakeError("Bias tensor must a vector");

    const Index inner_dim = output->shape().GetDimensionSize(1);
    if (bias.NumElements() != inner_dim)
      return eigen.MakeError("The number of bias elements ", bias.NumElements(),
                             " doesn't match output inner dimension ",
                             inner_dim);
  }

  // Fusion: BiasAdd
  if (match_fusion({"BiasAdd"})) {
    return FusedMatMulInternal<compat::BiasAddOutputKernel<T>, T>(
        a, b, output, fusion_inputs[0], transpose_a, transpose_b, eigen);
  }

  // Fusion: BiasAdd + Relu
  if (match_fusion({"BiasAdd", "Relu"})) {
    return FusedMatMulInternal<compat::BiasAddOutputKernel<T, compat::Relu>, T>(
        a, b, output, fusion_inputs[0], transpose_a, transpose_b, eigen);
  }

  // Fusion: BiasAdd + Relu6
  if (match_fusion({"BiasAdd", "Relu6"})) {
    return FusedMatMulInternal<compat::BiasAddOutputKernel<T, compat::Relu6>,
                               T>(a, b, output, fusion_inputs[0], transpose_a,
                                  transpose_b, eigen);
  }

  // Fusion: BiasAdd + Elu
  if (match_fusion({"BiasAdd", "Elu"})) {
    return FusedMatMulInternal<compat::BiasAddOutputKernel<T, compat::Elu>, T>(
        a, b, output, fusion_inputs[0], transpose_a, transpose_b, eigen);
  }

  return eigen.MakeError("Unsupported fusion type");
}

}  // namespace cpu
}  // namespace tfrt

#endif  // TFRT_BACKENDS_CPU_LIB_KERNELS_CPU_FUSED_MATMUL_KERNEL_H_


I know that 「か」in the middle of a sentence can be used for embedded questions or as "or," but I don't see any of that here.
The embedded "question" in this case isn't really a question, but it is there
is the English equivalent of
How hard you're working
For a very direct translation that comes out to something like
I'm worried about how hard you're working
Though it's worth noting that while the English sounds like something you would say to someone who you were worried was working too hard, the above Japanese sounds to me like it means the opposite. Of course it's very difficult to be certain without context.
か in subordinate clauses to talk about the degree or manner of something is very common, the same way
how is used in subordinate clauses in English. Here's another example from an online dictionary:
Worry about how one is being perceived
思われてる of course literally means "thought of" for "how one is being thought of". "Perceived" is just more natural English.


Aug 19, 2020
Thank you Professor Dorian A. Canelas! It made me much more easier to understand the basic principles of chemistry and it builds me a lot of confidence in answering some of the problems in chemistry.
Jun 12, 2020
It is a wonderful course for Middle school students. A first course in Chemistry, for the gifted students who will do AP Chemistry. Not suitable for adult learners who need an advanced introduction.
创建者 Lukas K•
Dec 17, 2017
I learnd many things in this cours and it was as well fun
Jan 20, 2022
Great course, highly recommend for chemistry beginners!
创建者 Lindiwe K•
May 18, 2020
It was soo educative I enjoyed every lesson.
创建者 Anastasia S•
Jul 18, 2021
I think it's one of the best classes out here so far!
创建者 Carl J•
Apr 20, 2021
Solid course. Easy to understand and great refresher!
创建者 Prakash V•
Nov 17, 2020
really excellent course by dr. Dorian! well explained
创建者 Prashant K M•
Apr 11, 2018
It was a very interesting course. I enjoyed it a lot!
创建者 Jose C G•
Dec 27, 2017
Muy bueno para aprender la introducción a la química.
创建者 Jeyaseeli F•
Aug 5, 2021
super duper .............. chemistry lecture .......
创建者 Omkar P•
Oct 3, 2020
very understandable contents and excellent teaching
创建者 Nataliya C•
Aug 1, 2020
Amazing Professor. She explains everything so good!
创建者 Amira A•
Aug 14, 2020
Important course with good and various information
Jul 10, 2019
the teacher is the best, also she is really funny
创建者 Iram I•
Oct 9, 2021
It was amazing to learn chemistry by this course
创建者 Daniela M•
Mar 19, 2022
Amazing teacher, super clear for beginners too!
创建者 Lorena R•
Dec 13, 2020
Excellent course, excellent teacher, thank you!
创建者 Alexander S•
Jul 2, 2021
Thank you for the efficient and useful course!
创建者 Albert K•
Jul 31, 2020
Thank you so much. This is excellent course
Jun 15, 2020
This course has helped to refresh my basics
创建者 Afsar u D•
May 13, 2020
it is excellent course for basic chemistry
创建者 Dr. S J M•
Apr 30, 2020
The course was helpful and encouraging ...
创建者 Liz C•
Jun 19, 2017
Thanks Dr Canelas! You gave me confidence.
Mar 11, 2021
Really great course. Fun and interactive!
创建者 Mauritius X•
Oct 20, 2017
I learned something new. That was my goal


Getting closer and closer to a mathematician, Serval becomes a university student on math major in Japari University. On the Calculus class, his teacher taught him how to calculate the expected length of a random subsegment of a given segment. Then he left a bonus problem as homework, with the award of a garage kit from IOI. The bonus is to extend this problem to the general case as follows.

You are given a segment with length $$$l$$$. We randomly choose $$$n$$$ segments by choosing two points (maybe with non-integer coordinates) from the given segment equiprobably and the interval between the two points forms a segment. You are given the number of random segments $$$n$$$, and another integer $$$k$$$. The $$$2n$$$ endpoints of the chosen segments split the segment into $$$(2n+1)$$$ intervals. Your task is to calculate the expected total length of those intervals that are covered by at least $$$k$$$ segments of the $$$n$$$ random segments.

You should find the answer modulo $$$998244353$$$.


$$$n$$$ people came to the festival and decided to dance a few round dances. There are at least $$$2$$$ people in the round dance and each person has exactly two neighbors. If there are $$$2$$$ people in the round dance then they have the same neighbor on each side.

You decided to find out exactly how many dances there were. But each participant of the holiday remembered exactly one neighbor. Your task is to determine what the minimum and maximum number of round dances could be.

For example, if there were $$$6$$$ people at the holiday, and the numbers of the neighbors they remembered are equal $$$[2, 1, 4, 3, 6, 5]$$$, then the minimum number of round dances is$$$1$$$:

- $$$1 - 2 - 3 - 4 - 5 - 6 - 1$$$

- $$$1 - 2 - 1$$$
- $$$3 - 4 - 3$$$
- $$$5 - 6 - 5$$$


In Veritas Operations Manager, you can edit the virtualization discovery that you have already configured.
You can edit a virtualization discovery configuration to modify the following information:
Name of the configuration.
Name of the VirtualCenter or HMC server that you have specified when you configured the virtualization discovery.
Credentials to log on to the VirtualCenter or HMC server.
To edit a virtualization discovery configuration in Veritas Operations Manager
In the Veritas Operations Manager console, select Settings > Virtualization.
In the Virtualization Management view, in the table that displays the details of the virtualization discovery configurations, select the configuration that you want to edit.
At the top of the table, which displays the virtualization discovery configurations, click Actions > Edit Configuration.
In the Virtualization Configuration wizard panel, modify the required information, click Next.
In the Select option wizard panel, edit the method for virtualization discovery of the servers, click Finish.
In the result panel, view the progress of the configuration, click OK.


I believe he is saying that anything he writes or links in a facebook post containing Fracking or Fracing seems to not go through.
Maybe you ate too many cookies...
I have had facebook not like videos I have posted which have copyrighted music. They wouldn't post our firework show because of the music that was playing gets flagged by their software as copyrighted. It would download, but never post, and never tell you anything, just wouldn't post.


The SAP Pushbutton Graphics system presents you with a pushbutton pad. This pad contains buttons you can click on to request information, call up menus or execute specific programs.
The following figure shows an example of an SAP Pushbutton pad.
What the buttons say and what they do when you click on them depends on the ABAP program you are running.
For more information, see the ABAP documentation.
On Apple frontends, a number of alternative and additional options are available for SAP Graphics. For more information, see the following topic:


Words/Time: 30 minutes working on some prep for a series of posts for my Facebook author page.
I have decided to post about each of the 7 Pithea books that are planned out enough for me to feel they’re worth sharing. For each book, I’ll post a series of posts with various information like a short synopsis, main character introductions, book stats, and small excerpts. I am currently working on the posts for the first book, “Pithea,” and what’s slowing me down is character introductions. I’ve always been terrible at trying to explain characters in a boiled-down sense.


You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).

Your task is to find a maximum sub-rectangle on the grid (x1, y1, x2, y2) so that it contains the given point (x, y), and its length-width ratio is exactly (a, b). In other words the following conditions must hold: 0 ≤ x1 ≤ x ≤ x2 ≤ n, 0 ≤ y1 ≤ y ≤ y2 ≤ m, $$\frac{x_{2}-x_{1}}{y_{2}-y_{1}}=\frac{a}{b}$$.

The sides of this sub-rectangle should be parallel to the axes. And values x1, y1, x2, y2 should be integers.

If there are multiple solutions, find the rectangle which is closest to (x, y). Here "closest" means the Euclid distance between (x, y) and the center of the rectangle is as small as possible. If there are still multiple solutions, find the lexicographically minimum one. Here "lexicographically minimum" means that we should consider the sub-rectangle as sequence of integers (x1, y1, x2, y2), so we can choose the lexicographically minimum one.


A little clarification, as long as you have a legal activated copy up and
running on the computer, yes I do believe you can install to a different
Drive or partition. Before you install though, there are programs out
there that you can run to retrieve your install key. But for the life of me
I can't think of the name right now.
I'm sure someone here will supply it. Edit.
I remember now http://www.magicaljellybean.com/
This should do the trick.


Arkady is playing Battleship. The rules of this game aren't really important.

There is a field of $$$n \times n$$$ cells. There should be exactly one $$$k$$$-decker on the field, i. e. a ship that is $$$k$$$ cells long oriented either horizontally or vertically. However, Arkady doesn't know where it is located. For each cell Arkady knows if it is definitely empty or can contain a part of the ship.

Consider all possible locations of the ship. Find such a cell that belongs to the maximum possible number of different locations of the ship.


Can we say "my hobby is read book"? Is it correct?
In the sense that you mean it, no.
Your example contains is read. If read is the base form (as your question implies), this is not grammatical. [As it happens read is also the past participle of read (pronounced differently: the base form sounds the same as reed, but the past participle sounds the same as red), so is read can be grammatical; but it is passive, so something every night a book is read makes sense. But I don't think this is what you meant.]
What I think you are trying to say is my hobby is reading books. Various things can follow is: a noun or noun phrase, an adjective or adjectival phrase, an adverb or adverbial phrase; but not a verb phrase. The -ing form of verbs acts like a noun, or introduces a clause which acts like a noun phrase. So reading books acts like a noun phrase, and can follow My hobby is.


i recently updated to nero oem edition from express.when i start it it tells me to go to the nero site as it has a problem with my version of windows.i use xp home with sp2 installed.when i go to the site it tells me there is four downloads to do.can i get a friend to down load these to a cd as my download rate comes in at 1kbs per second on a dial up.is this possible to do ?any help please
You are able to download the items and save to file. I have done it. However whereas it states after the installation of SP2 there could be some problems with Nero and you therefore need the Nero updates I found a problem after installing the Nero updates and reversed back to the original version 6.3.02 and to the best of my knowledge there have been no problems with that setup.
I've got Nero 6 and when i updated to SP2, my nero did not work so i went to nero site and saved the downloads to a folder on my computerand then ran the relivant upgrade and it's worked fine. This is great for me as if i need to wipe computer then the files are ready to upgrade when i'm ready and don't have to visit the site each time. follow this link for hdownloads: click here


This is a copy of the help found inside CGI:IRC.
The interface of CGI:IRC is very similar to a standard graphical IRC client, it
should be easy to use if you are familiar with IRC clients. Along the top is a
list of tabs, there will be a tab here for each channel you are in and each
query (private message) you have open. To close a window click the X button on
the far right of the tab list.
The userlist is on the right, when in a channel tab it will show a list of all
the people in that channel. Double clicking a nickname will open a query with
that user or perform whichever other action you select in the select box at the
The text entry box should be simple, the little arrow to the right of the text
entry area shows a toolbar that allows easy typing of colour, bold and underline. It is also where you enter all the commands.
Commands begin with / and should be familar to anyone who has used IRC before
- here is a quick summary of the most useful commands.
|/me||This turns the text after /me into an action, eg: /me looks
|/join||Joins the specified channel. eg: /join #cgiirc|
|/list||Lists all the channels on the network (this outputs a lot
|/part||Leaves the current channel (same as clicking the X while
in the channel).|
|/quit||Quits IRC totally (same as clicking X in Status window).|
|/msg||Sends a private message to a user. eg: /msg someone Hi|
|/whois||Gives some information about a user.|
The options window lets you change some settings in CGI:IRC. Hopefully it
should be fairly self explanatory, change a setting and it should take effect
There are several shortcuts to help make using CGI:IRC nicer, tab completion
which will complete a nickname or channel when you press tab, alt+number will
go to that number window if you number the windows from the left (Status = 1
and so on).
CGI:IRC is written in Perl by David Leadbeater with help from lots of people. See the website
for more information.


I have an issue with frequently occuring compass variance. Arducopter 4.1.3
Reviewing the log, it can be seen that there are big spikes especially with MAG in x-axis and z-axis. MAG does not show any spikes
- Is MAG the internal or external compass? I am a bit confused about which MAG[xx] or MAGx.is the internal compass.
- What is the reason for the spikes (up to -4gauss)
Thanks for your kind support
I think from your settings that the first compass is external and is in use. This is correct.
It’s not badly affected by battery current and I see you’ve done the compass/motor calibration.
Those glitches in Mag X are almost like a connector issue. The glitches are there in Y and Z axis too but not as bad.
Also GPS HDOP is getting too high for most of that flight. The GPS readings also have “glitches” but not at the same times as the compass readings. Maybe the whole unit is bad.
Check all your connectors, and measure that a good solid 5 volts DC is getting to your GPS unit.
Thanks very much for your help. Especially the hint that the FC also looses satellites frequently - which I have not noticed - was very helpful and made the focus clear to the GPS unit or cable.
I changed the cable and made 5 flights altogether today and no problems/spikes anymore from Compass as well as stable hdop / numbers of satellites.


I haven't noticed any changes to placements yet.
There's quite a lot of changes but they aren't too significant. Looks like Google spent a lot of time rewriting the old algorithm. So they wasn't the kind of disruption like after Jagger and Big Daddy updates.
Originally Posted by Zash
Interesting article about caffeine. I speculate for the static sites "fresh links to old content" may have a similar effect to regularly publishing fresh content.
Originally Posted by ChillingBreeze
Caffeine likes the Web 2.0 So lots of social media and publishing a stream with Google profiles should help - https://www.google.com/accounts/ServiceLogin?service=profiles&continue=http://www.google.com/profiles/me<mpl=landing
Why do google play with something that is not broke :(
Are these changes going to be good or bad??
I haven't noticed any changes... Have you? Ok, I did, I saw the results from Twitter(from few seconds ago) on first place in Google index... Is this part of caffeine?
Caffeine is more than an algorithm update. Rather it updates the Google File System and infrastructure. So not only is Caffeine faster it will allow Google to do more things.
Originally Posted by robmac
So it's not so much what Caffeine does but "what Caffeine will do" in the future.


Programming Assignment Help Provided
I think two students had an A in our Java class. Funny enough both of us had our assignments completed by your Java assignment help team. Your programming assignment help team has simply been the best. In one of my papers, we were working until 4 am because the paper was due the following day. The tutor I had been assigned was good enough to keep updating me on the progress of the paper.


Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Let's call the set of concentric circles with radii 1, 2, ..., K and the center in the point (z, 0) a (K, z)-set. Thus, on the square were painted a (N, x)-set and a (M, y)-set. You have to find out how many parts those sets divided the square into.


If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a=29,a=56 upto array.. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..1352
character array A can hold5 8053
Write a program for print infinite numbers3 8961
How to print India by nested loop? I IN IND INDI INDIA3 12293
An entire structure variable can be assigned to another structure variable if __________3 13489
How to print %d in output6 4770
wat is the meaning of c?9 6956
what is the output of below code int x=8,y; x>>=2; y=x; what is y value. NOTE:EXPLANATION IS COMPALSARY with binary bits2 4113
WHAT IS ABSTRACT DATA TYPE4 4753
SRUCTURE PROGRAMMING3 4974
How much bytes do integer and decimal data types hold in python?
Is python good for machine learning?
Could you explain aws auto scaling vs. Auto scaling for individual services?
What is the stylesheet structure used with xslt?
What will you do to improve your product or service or your company?
How will you calculate days between two dates in PHP?
How do I change apache to mpm?
Please tell me how to discuss about the salary in the hr interview. My current ctc is 3.32l and my expectation is 6.0 L. If they negotiate i can come up to 5.5l. How i can handle the situation. Please answer.
How can a user find "commit work" statement in the pm orders (t-code iw32)?
What is a proxy object?
What are the advantages of go?
Are you aware of containment and Aggregation ?
What is difference between path and classpath?
How do you make a website HTTPS?