c# – error al subir imagen a base de datos SQL SERVER desde ASP.NET MVC

Buenas estoy teniendo problemas al subir una imagen a la base de datos sql server, tengo un campo de tipo image en la base de datos

Captura de la base de datos

desde el controlador tengo el siguiente codigo

public ActionResult Create(Models.ItemModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    JoyeriaEntities contexto = new JoyeriaEntities();


                    HttpPostedFileBase file = Request.Files("ImageData");
                    byte() img = ConvertToBytes(file);

                    Items items = new Items
                    {
                        IdItem = model.IdItem,
                        Nombre = model.Nombre,
                        IdKMaterial = model.IdKMaterial,
                        Costo = model.Costo,
                        Precio = model.Precio,
                        Image = img
                    };               
                    contexto.Items.Add(items);
                    contexto.SaveChanges();

                    return RedirectToAction("Index");
                }
                catch (Exception)
                {

                    return View(model);
                }
            }

            return View(model);
        }

Este es el método que utilizo para convertir la imagen a bytes

 public byte() ConvertToBytes(HttpPostedFileBase image)
        {
            byte() imageBytes = null;
            BinaryReader reader = new BinaryReader(image.InputStream);
            imageBytes = reader.ReadBytes((int)image.ContentLength);
            return imageBytes;
        }

y este seria el código de la vista


        <div class="form-group">
             @Html.LabelFor(model => model.Image, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">

                @using (Html.BeginForm("Create", "Content", FormMethod.Post, new { enctype = "multipart/form-data" }))
                {
                    <input type="file" name="ImageData" id="ImageData" onchange="fileCheck(this);" />
                }


                @Html.ValidationMessageFor(model => model.Image, "", new { @class = "text-danger" })
            </div>
        </div>

ahora bien cuando trato de crear un nuevo item me tira un error de que no se puede convertir un objeto de tipo in32 a Array
introducir la descripción de la imagen aquí

theming – How can I customize breakpoints in USWDS base theme?

I’m using the USWDS_base theme as a base for my custom theme. Version 8.x-2.10

In this file: web/themes/custom/my_child_theme/sass/_uswds-theme-utilities.scss I find the tokens used for the breakpoints (see screenshot).

In the comments, I can see what size those tokens represent. I can’t find anywhere where those numbers are set so that I can override them. I’ve been combing through the theme for hours. Can anyone point me in the right direction?

Breakpoints

c# – Mostrar imagem reapeter ASP.NET através de base de dados SQL

Alguém sabe como se mostra uma imagem no reapeter através de uma base de dados , pois eu consigo fazer com que todos os dados apareçam menos a imagem.

<div class="container-fluid">
    <div class="titulo">
        <h2>Gestor de Cursos</h2>
        <asp:Repeater ID="rpt_curso" runat="server" DataSourceID="SqlDataSource1">
            <HeaderTemplate>

                <table border="1">
                        <tr>
                            <td>
                                <b>Cod.Curso</b>
                            </td>
                            <td>
                                <b>Curso</b>
                            </td>
                            <td>
                                <b>Descricao</b>
                            </td>
                            <td>
                                <b>Preco</b>
                            </td>
                            <td>
                                <b>Imagem</b>
                            </td>
                            
                        </tr>
            </HeaderTemplate>
            
            
            <ItemTemplate>
                <tr>
                            <td>
                                <%# Eval("cod_produto")%>
                            </td>
                            <td>
                                <%# Eval("produto")%>
                            </td>
                            <td>
                                <%# Eval("descricao")%>
                            </td>
                            <td>
                                <%# Eval("preco")%>
                            </td>
                       
                            <td>                                
                                <%Eval("dados");%>                         
                            </td>
                        </tr>

            </ItemTemplate>

            <FooterTemplate>
                </table>



            </FooterTemplate>
        </asp:Repeater>
        <br />
    </div>
</div>

Codigo por trás

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings("SYS4NOOBSConnectionString").ConnectionString);
        SqlCommand myCommand = new SqlCommand();


        myCommand.CommandText = "SELECT produto.cod_produto, produto.descricao, produto.produto, produto.preco, ficheiro.dados, ficheiro.contentType, ficheiro.ficheiro FROM ficheiro INNER JOIN produto ON ficheiro.cod_ficheiro = produto.cod_ficheiro";

        myCommand.Connection = myConn;
        myConn.Open();

        SqlDataReader reader = myCommand.ExecuteReader();

       
        List<curso> lista = new List<curso>();

        while (reader.Read())
        {
            curso obj = new curso();
            obj.cod_produto = reader.GetInt32(0);
            obj.produto = reader.GetString(1);
            obj.descricao = reader.GetString(2);
            obj.preco = reader.GetDecimal(3);
            obj.dados = reader.GetByte(4);

            lista.Add(obj);
        }
        reader.Close();
        myConn.Close();


        myConn.Close();

        rpt_curso.DataSource = lista;
        rpt_curso.DataBind();



    }

    public class curso
    {
        public int cod_produto { get; set; }
        public string produto { get; set; }
        public string descricao { get; set; }
        public decimal preco { get; set; }
        public byte dados { get; set;}
        
    }(!(inserir a descrição da imagem aqui)(1))(1)

mysql – ¿Cómo leer la información de una base de datos cleardb creada en heroku?

Con los credenciales dado por ClearDB en Heroku fue capaz de crear una database:

engine = create_engine('mysql://user:password@host.cleardb.com/heroku_02c821a76ca04c8')
df.to_sql('attributs', engine,if_exists='append')

Pero al leerlas informaciones parece que faltan derechos. Intenté:

ubu@DESKTOP-QL4RO3V:/mnt/c/Windows/system32$ mysql -u user -p'password' -h host.cleardb.com -D heroku_02c821a76ca04c8
mysql: (Warning) Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 47008095
Server version: 5.6.50-log MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> SHOW TABLES;
+----------------------------------+
| Tables_in_heroku_02c821a76ca04c8 |
+----------------------------------+
| attributs                        |
+----------------------------------+
1 row in set (0.03 sec)

mysql> use attributs;
ERROR 1044 (42000): Access denied for user 'user'@'%' to database 'attributs'

Entonces como leer las informaciones en la mia database? Necisto ser root ? O hacer un nuevo usario ?

ag.algebraic geometry – Base locus of a linear system after blow-up

I have a smooth proejective fourfold $X$ with an effective divisor $D$ on it.
The base locus ${rm Bs}|D|$ of the linear system $|D|$ is a smooth rational curve $C$ and a generic member of $|D|$ has multiplicity two along $C$.

Let $pi: Y rightarrow X$ be the blow-up along $C$ and $D’ = pi^*(D) – 2 E$, where $E$ is the exceptional divisor over $C$.
I guess that the base locus ${rm Bs}|D’|$ lies on $E$.

Is it true that $dim ({rm Bs}|D’|) < 1$?
In particular, I would like know when $|D’|$ is base-point free.

php – ¿Por qué el UPDATE con la línea del WHERE en mysql no realiza las actualizaciones en mi base de datos?

<html lang="es">
   <body class="body">
        <form action="editar.php" method="post" class="form_contact">
            <input type="text" value="<?php echo $datos('nombre_apellido');?>" class="name entry " name="nombre_apellido" placeholder="Nombre y Apellido" required/>
            <input type="email" value="<?php echo $datos('email');?>" class="email entry" name="email" placeholder="E-mail"/>
            <textarea class="message entry" name="mensaje" placeholder="Mensaje"><?php echo $datos('mensaje');?></textarea>
            <button class="submit" name="guardar">Guardar</button>
        </form>
        
        <?php
        break;
        }
        }
  
        if(isset($_POST('guardar'))) {

        $nombre_apellido = $_POST('nombre_apellido');
        $email = $_POST('email');
        $mensaje = $_POST('mensaje');

        mysqli_query($conexion,"UPDATE contactos SET
        nombre_apellido = '$nombre_apellido',
        email = '$email',
        mensaje = '$mensaje',
        WHERE mensaje = '$mensaje'"); #El where de un update debe ir sobre una llave primaria

        header('Location: solicitudes_contacto.php');
        exit();
        }

        include("cerrar_conexion.php");
        ?>

    </body>
</html>

Por que UPDATE con WHERE en mysql no realiza cambios en mi base de datos. Aclaro que mensaje es una clave primaria. Si quito la línea de código del WHERE sí actualiza pero me modifica todas las filas de la base de datos.

php – Criptografía base de datos

¡Hola a todos!
Una preguntita trivial:
¿Alguien me sabría explicar como se lleva a cabo la criptografía en una base de datos, con el lenguaje mysql más exactamente? Investigando, yo encontré las funciones blowfish() en php y aes_encrypt() en mysql, pero no me quedó claro cuál es la diferencia entre ambas, si se deben complementar, o si puede ser suficiente con aplicar solo una de ellas.
Porque debo preparar un proyecto sobre una base de datos y tenía pensado mencionar que a los datos sensibles se les deberá aplicar cierta criptografía, pero quisiera ir más allá y hacer una demostración tal vez con el código de Mysql o php, tema que no hemos considerado nunca con mi profesora, y no sé que tan complicada sea la cosa.
Agradezco de antemano por las respuestas.

base de datos – Método de búsqueda en Mongodb

Estoy haciendo una base de datos para una biblioteca donde los libros suelen ser conocidos por el apellido del autor del libro. En mi campo de autor tengo el nombre completo por ejemplo “Raymond Chang” si yo busco “Raymond Chang” me devuelve todos los libros que tengan ese autor pero si busco solamente “Chang” me sale vacía la búsqueda. Quisiera saber como hacer para que si un libro tiene por ejemplo como autor “Raymond Chang” Al hacer la Búsqueda “de Raymond” salgan todos los libros que tienen el autor ya sea con nombre o apellido Raymond, Raymond Chang y que también al buscar “Chang” pase lo mismo.

python – Filtrando filas de un dataframe en base a los valores de otro dataframe

Tengo los siguientes dataframes:

df1

start_date,end_date,pollster,sponsor,sample_size,population,party,subject,tracking,text,approve,disapprove,url
2020-02-02,2020-02-04,YouGov,Economist,1500,a,all,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,42,29,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/73jqd6u5mv/econTabReport.pdf
2020-02-02,2020-02-04,YouGov,Economist,376,a,R,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,75,6,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/73jqd6u5mv/econTabReport.pdf
2020-02-02,2020-02-04,YouGov,Economist,523,a,D,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,21,51,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/73jqd6u5mv/econTabReport.pdf
2020-02-02,2020-02-04,YouGov,Economist,599,a,I,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,39,25,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/73jqd6u5mv/econTabReport.pdf
2020-02-07,2020-02-09,Morning Consult,"",2200,a,all,Trump,FALSE,Do you approve or disapprove of the job each of the following is doing in handling the spread of coronavirus in the United States? President Donald Trump,57,22,https://morningconsult.com/wp-content/uploads/2020/02/200214_crosstabs_CORONAVIRUS_Adults_v4_JB.pdf
2020-02-07,2020-02-09,Morning Consult,"",684,a,R,Trump,FALSE,Do you approve or disapprove of the job each of the following is doing in handling the spread of coronavirus in the United States? President Donald Trump,88,4,https://morningconsult.com/wp-content/uploads/2020/02/200214_crosstabs_CORONAVIRUS_Adults_v4_JB.pdf
2020-02-07,2020-02-09,Morning Consult,"",817,a,D,Trump,FALSE,Do you approve or disapprove of the job each of the following is doing in handling the spread of coronavirus in the United States? President Donald Trump,37,37,https://morningconsult.com/wp-content/uploads/2020/02/200214_crosstabs_CORONAVIRUS_Adults_v4_JB.pdf
2020-02-07,2020-02-09,Morning Consult,"",700,a,I,Trump,FALSE,Do you approve or disapprove of the job each of the following is doing in handling the spread of coronavirus in the United States? President Donald Trump,50,22,https://morningconsult.com/wp-content/uploads/2020/02/200214_crosstabs_CORONAVIRUS_Adults_v4_JB.pdf
2020-02-07,2020-02-09,Morning Consult,Politico,1996,rv,all,Trump,FALSE,"And, do you approve or disapprove of how each of the following have handled the response to the coronavirus? President Trump",39,35,https://morningconsult.com/wp-content/uploads/2020/02/200213_crosstabs_POLITICO_RVs_v1_AUTO.pdf
2020-02-07,2020-02-09,Morning Consult,Politico,700,rv,R,Trump,FALSE,"And, do you approve or disapprove of how each of the following have handled the response to the coronavirus? President Trump",71,8,https://morningconsult.com/wp-content/uploads/2020/02/200213_crosstabs_POLITICO_RVs_v1_AUTO.pdf
2020-02-07,2020-02-09,Morning Consult,Politico,788,rv,D,Trump,FALSE,"And, do you approve or disapprove of how each of the following have handled the response to the coronavirus? President Trump",15,60,https://morningconsult.com/wp-content/uploads/2020/02/200213_crosstabs_POLITICO_RVs_v1_AUTO.pdf
2020-02-07,2020-02-09,Morning Consult,Politico,508,rv,I,Trump,FALSE,"And, do you approve or disapprove of how each of the following have handled the response to the coronavirus? President Trump",34,33,https://morningconsult.com/wp-content/uploads/2020/02/200213_crosstabs_POLITICO_RVs_v1_AUTO.pdf
2020-02-09,2020-02-11,YouGov,Economist,1500,a,all,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,39,28,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/79zfxkws33/econTabReport.pdf
2020-02-09,2020-02-11,YouGov,Economist,378,a,R,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,74,7,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/79zfxkws33/econTabReport.pdf
2020-02-09,2020-02-11,YouGov,Economist,510,a,D,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,19,50,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/79zfxkws33/econTabReport.pdf
2020-02-09,2020-02-11,YouGov,Economist,607,a,I,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,33,25,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/79zfxkws33/econTabReport.pdf
2020-02-16,2020-02-18,YouGov,Economist,1500,a,all,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,39,32,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/m3wzkd0n59/econTabReport.pdf
2020-02-16,2020-02-18,YouGov,Economist,381,a,R,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,78,8,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/m3wzkd0n59/econTabReport.pdf
2020-02-16,2020-02-18,YouGov,Economist,529,a,D,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,11,59,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/m3wzkd0n59/econTabReport.pdf
2020-02-16,2020-02-18,YouGov,Economist,583,a,I,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,36,25,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/m3wzkd0n59/econTabReport.pdf
2020-02-23,2020-02-25,YouGov,Economist,1500,a,all,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,39,31,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/zye3phsf7t/econTabReport.pdf
2020-02-23,2020-02-25,YouGov,Economist,386,a,R,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,77,7,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/zye3phsf7t/econTabReport.pdf
2020-02-23,2020-02-25,YouGov,Economist,525,a,D,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,14,56,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/zye3phsf7t/econTabReport.pdf
2020-02-23,2020-02-25,YouGov,Economist,588,a,I,Trump,FALSE,Do you approve or disapprove of Donald Trump’s handling of the coronavirus outbreak?,34,26,https://d25d2506sfb94s.cloudfront.net/cumulus_uploads/document/zye3phsf7t/econTabReport.pdf
continua.......

df2

introducir la descripción de la imagen aquí

continua...

Hasta el momento he importado los datasets como dataframes:

df1 = pd.read_csv(path)
df2 = pd.read_excel(path2)

Además he aplicado las siguientes condiciones de acuerdo con los requerimientos:

newdf1 = df1(df1("tracking") == "FALSE")
newdf2 = df2(df2("Banned by 538") == "no")

Además de esto, quiero que el df1 solo contenga las filas por las que el valor de la columna pollster existe en el df2. En este sentido, si pollster toma el valor “Morning Consult”, “Morning Consult” también deberá aparecer en Pollster del df2. En caso contrario, la fila en el df1 será eliminada. Cómo podria hacer esto?

ag.algebraic geometry – Is “very ampleness” etale/fpqc local on the base (under reasonable conditions?)

Let $f : Xrightarrow S$ be a quasicompact morphism of schemes, and $mathcal{L}$ a line bundle on $X$.

Let $g : S’rightarrow S$ be a surjective map, and $f’ : X_{S’}rightarrow S’$ the base change.

Under what conditions on $f,g$ does $mathcal{L}|_{X_{S’}}$ being very ample imply that $mathcal{L}$ is very ample?

Certainly this holds if $g$ is a Zariski covering. Does it hold if $g$ is an etale covering? fpqc covering? (possibly with some conditions on $f$?)

Part of the problem is that I’m having difficulty finding cohomological characterizations of very ampleness.