Posts by novic • 35,673 points
1,265 posts
-
1
votes1
answer2714
viewsA: Ajax Request with Laravel 5.4
The error appears because the route has been set only to accept the verb POST and this will work with your function in ajax, because, face your configuration is for the verb POST same as configured…
-
0
votes2
answers83
viewsA: ASP.NET MVC 5, I can’t bring set when I edit
Failed to pass fourth and last parameter to indicate which of the items is to stay selected: var items = db.Users .Select(x => new { UsuarioId = x.Id, Nome = x.Nome + " " + x.Sobrenome }); var id…
-
1
votes2
answers182
viewsA: Can an object be instantiated?
A new feature has been introduced in the version of PHP 5.3 that can be created an instance of an object. My question is as follows, if this code is right and what it means because I have never…
-
1
votes1
answer191
viewsA: Laravel 5.5: Pick name of each table in select Union
In itself SQL create the identification of each SELECT, example: $first = Lista::where('serie_id', $serie->id) ->select('descricao as result1') ->selectRaw("'Lista' as tabela"); $atividades…
-
0
votes1
answer86
viewsA: Checkbox value is null, Column 'situation' cannot be null
The correct in this case would be with select and not with checkbox, because, force the choice of the text active or exonerated with the proposed structure, example: {{ Form::select('situacao',…
-
2
votes2
answers167
viewsA: Deserialize Json string[] for string[]
Good already given a solution with a type, but, I will also propose an answer, actually can be done with a structure that already exists which is the Dictionary (representing a collection of keys…
-
3
votes1
answer549
viewsA: Circular relationship with Entityframework Core
Basically by the model of your question (and consequently by the comment that the other entities are not required to quote) the functional configuration model is: Models public partial class Pessoa…
-
2
votes2
answers266
viewsA: ASP.NET Razor Pages error while processing the request
The error occurs because the Razor Page cannot know at runtime which of the two methods GET created in your code, that is to say, OnGet and OnGetAsync is to be executed, summarizing can not coexist…
-
1
votes1
answer232
viewsA: Laravel 5.5 : Wherehas in relationship Many to one
I believe it was lacking to filter the more internal list, that is, the relationship, it is always good to make the charge with with, example: $serie = $this->serie ->with(['lista' =>…
-
1
votes1
answer814
viewsA: Edit form Laravel
In this passage html make the comparison if it is the same idcurso option to assign the property selected, who will position in the idcurso registered in your table, example: <div class="col-xs-3…
-
5
votes1
answer792
viewsA: Delete php session when closing browser
Goes in the file application/config/config.php, search for $config['sess_expiration'] and assign the value 0, as demonstrated just below: $config['sess_driver'] = 'files';…
-
7
votes3
answers717
viewsA: How do I get the name of an input
The most recommended way to get the name would be with getelementsbytagname(), example: var nomes = document.getElementsByTagName("input"); console.log(nomes[0].name); <input type="text"…
javascriptanswered novic 35,673 -
2
votes1
answer248
viewsA: Split sum and Count output in the same Query?
Could make the split in the SQL as follows, example: $query = Avaliar::select(DB::raw('(SUM(nota) / COUNT(id)) as nota')) ->where('serie_id', $serie->id) ->first(); $nota = $query->nota;…
-
1
votes2
answers150
viewsA: Real-time account for table generated with jQuery
The code was using what was with a change in the calculation part, then add a plugin so that in the input Let me type number with comma (jquery.Numeric), and in the input amount and price in the…
-
2
votes1
answer272
viewsA: How to create default filters with Entity framework 6?
Entity Framework 6 The Entity Framework 6 does not have the own resource to make Global Query Filter, but with the addition of packages via nuget: Z.EntityFramework.Plus.EF6…
-
1
votes1
answer1788
viewsA: Entity Framework 7, Insert or Update
Create a class to create an extension method named InsertOrUpdate<T> generic, in this code you first search for the primary key(s) (s) of your settings that were made for your Model, with this…
-
1
votes1
answer632
viewsA: How to make a ranking with SQL?
Make a label for you to have the uniform name and its quantity and join the 3 selections with UNION ALL, then create a select for ordering the quantity, example: SELECT * FROM ( SELECT…
-
2
votes3
answers4541
viewsA: Syntax error in Python code. What is it?
Error of syntax missed placing two stitches on if and in the else print("**************") print("Seja Bem Vindo") print("**************") numero_secreto = 65 chute = input("Digite um numero:")…
-
3
votes4
answers662
viewsA: How to improve SQL performance with IN clause?
Make the proof use distinct, example: SELECT id, nome, url FROM categorias WHERE status = 1 AND id_ls IN (SELECT distinct id_categoria FROM cliente_categorias) GROUP BY url…
-
0
votes5
answers545
viewsA: Different format for display and return (bootstrap-datepicker)
Can be set your way and call the event changeDate To rescue the chosen value and format the new output, can be used a function another screen component ai gets the choice, example:…
-
2
votes2
answers686
viewsA: How to count the total of records in a limit and offset query?
When it is used limit and the offset it is mandatory to use another SQL to count the number of records. For me in this case you can use the paginate() that will have the same effect and what brings…
-
1
votes2
answers4096
viewsA: Create and manipulate array with classic Asp
The ASP Dictionary Object, the example below: <% '//Criando o dicionário Dim d Set d = CreateObject("Scripting.Dictionary") '//Adicionando os itens d.Add "re","Red" d.Add "gr","Green" d.Add…
-
0
votes5
answers335
viewsA: How to know the dynamically created textbox id?
A minimal example is to create a function and pass the object via parameter in the event KeyDown, example: function onGetId(input){ console.log(input.id); } <input type="text" id="t1"…
javascriptanswered novic 35,673 -
1
votes1
answer480
viewsA: Generate Twitter-Bootstrap Alert within the script itself by clicking a button
There was a problem with your code that only checked the value of input page loading, but, just put it in the event button to be checked at all times of the click on the button if you have value…
-
4
votes2
answers1387
viewsA: Name of fields of a generic object - Reflection
Basically, this would be the method to discover the names of fields of any type, example: void DescobridorDeNome<T>(T objeto) { var items = objeto.GetType() .GetProperties() .Select(x =>…
-
1
votes1
answer439
viewsA: Pick first letter of each word
<?php $nome = preg_split("/((de|da|do|dos|das)?)[\s,_-]+/", "A C Loja do Supermercado"); $iniciais = ""; foreach($nome as $n) { if (strlen($n) > 0) { $iniciais .= $n[0]; } } echo $iniciais;…
-
2
votes2
answers1243
viewsA: Receive images in ASP.Net Core and save to Entity Framework
From what I could see the code could receive 1 or several photos, but in your html failed to declare what the attribute is multiple in the input type file, alteration: <form method="post"…
-
0
votes2
answers39
viewsA: Date help in order printing
I believe in your field the format is date and time, so first is to extract the date and then with the date format the output as you want, example: <strong>Data do Pedido:</strong>…
-
2
votes1
answer82
viewsA: ASP.NET MVC - Label does not display because of "dot" character at the end of the name parameter
The Html Label. there are overheads and which you need to use in your code is the next: @Html.Label("CA", "Codigo Aut.", htmlAttributes: new { @class = "control-label col-md-1" }) where is the text…
asp.net-mvcanswered novic 35,673 -
2
votes1
answer42
viewsA: UPDATE not working with ajax?
Your SQL is wrong, the error is because in SET fields are separated by comma and in the SQL of the question is the AND, corrected example: $insert=mysql_query("UPDATE nome_tabela SET nome = '$nome',…
-
1
votes1
answer196
viewsA: Return result_array codeigniter
Use the function array_map and make the necessary adjustments, there is no move, each item must be created and removed when it is unnecessary, example: public function…
-
1
votes1
answer346
viewsA: Load list from txt in c#
A minimal example would be: List<List<string>> lista = new List<List<string>>(); lista.Add("1|2|3".Split("|").ToList()); i.e., in the text found in each line I would do the…
-
0
votes2
answers47
viewsA: I can’t email my Webapi
Do so: [AcceptVerbs("GET")] [Route("api/Usuarios/GetUsuarioPorEmail")] public IQueryable<Usuarios> GetUsuarioPorEmail(string email) { } and call in to test so:…
asp.net-web-apianswered novic 35,673 -
2
votes2
answers126
viewsA: How to insert a Where into a Linux query
It is simple to just create the variable with the value of CNPJ and make a Where, same example below: var cnpj = "valor do cnpj"; var result = (from line in db.ApadrinhamentoListas where…
-
3
votes3
answers232
viewsA: Filter array value
With all the data and messages that we can not solve in sql, then do so: $arr = array(); while($r = mssql_fetch_assoc($query)) { $b = $r['cnpj']; if (count(array_filter($arr, function($a) use($b) {…
-
1
votes3
answers886
viewsA: Load Datagridview with Mysql
You don’t need the class Mysqldataadapter (which is unnecessary, even has a low performance by its structure), only then would it solve, example: public DataTable CarregarAluno() { string sql =…
-
1
votes1
answer445
viewsA: Find the best-selling products (Laravel / eloquent)
One way would be to search for all id of products in the table conta_produto and use method wherein in search of the array of id returnees, example: public function maisVendidos($quantidade) { $ids…
-
1
votes1
answer422
viewsA: ORDER BY in string date
Utilize orderByRaw with the function of your bank, for example, to mysql utilize str_to_date to write the text-to-date conversion function, example:…
-
1
votes1
answer419
viewsA: How to return a list of a json?
Following the same logic of the question How to get value from a json? the Json that returns in classes, example: public class Rootobject { public Response response { get; set; } public Highlighting…
-
3
votes1
answer6901
viewsA: Use sum with Eloquent
Because the values of Client and Item are coming null, because, in Select done does not have the fields for which the eloquent make the relation and load the values, how to solve? public function…
-
1
votes1
answer193
views -
1
votes5
answers212
viewsA: Get array object by description in index
Do with Dictionary, example: Base Class: public class MyObject { public string Name {get; set;} public string Value {get; set;} public int Prop1 {get; set;} public double Prop2 {get; set;} public…
-
1
votes1
answer1148
viewsA: Problems with paging in the Standard
Make the following changes: No Controller The amount is redeemed $texto, so you need to give a appends in pagination to have the effect on other pages, send the amount to your View, example: public…
-
7
votes1
answer5901
viewsA: General error: 1215 Cannot add Foreign key Constraint
It is wrong, that is, reversed, the correct is $table->foreign( 'cliente' )->references( 'id' )->on( 'clientes' ) ; and the method references put the field name that will build relationship…
-
2
votes1
answer76
viewsA: Error using Sqlcommand and foreach
If you have to add the parameter and then delete to add again because in your case it is an item interaction and you can still change the CommandText out of the foreach, you only need to know this…
-
3
votes1
answer42
viewsA: Return Number of Responses PHP Array
First you must filter the items of array to bring only what you need that in your specific case is total_respostas == 0 then use the count to count the quantity returned, example: $total =…
-
0
votes1
answer86
viewsA: Uniting arrays where they have a certain equal field
Put, example: while($result = $acesso->result->fetch(PDO::FETCH_ASSOC)) { $retorno[$result['id_pergunta']][] = $result; } will group by key id_pergunta, this happens because the key is the…
-
0
votes1
answer220
viewsA: VB.NET Working with XML?
Its initial implementation is redundant and fails at some points, for example: Dim SearchMusic As New DataSet SearchMusic.ReadXml(My.Application.Info.DirectoryPath & "\Configuracao.xml")…
-
2
votes2
answers1379
viewsA: Select line from a gridview and pass the values to a textbox
The simplest and most objective way to make such code without much information in the question is: Put a CommandField (<asp:CommandField ShowSelectButton="True" />) in the GridView, complete…
-
1
votes1
answer289
viewsA: More of a relationship with the table below
The relationship in this specific case remains the same informed form in the documentation of Eloquent - Laravel, example: Relationships in your project: class Clientes { protected $primaryKey =…