Posts by novic • 35,673 points
1,265 posts
-
2
votes1
answer2272
viewsA: Object of class Illuminate Database Eloquent Builder could not be converted to string. Standard 5.2
The error is conversion: an object Illuminate\Database\Eloquent\Builder cannot be converted to string, in fact, its concatenation is invalid. How to solve: In parts, working with the ease of…
-
2
votes2
answers878
viewsA: Limit record occurrences for each type
Utilize UNION ALL, that will combine the results without execution at the end of a distinct bringing the data even if there is repetition, I believe that in your case it already solves. If by chance…
-
2
votes3
answers5179
viewsA: Format decimal places in PHP using point and comma
Use the str_replace putting what you seek in a array and what changes in the particular case quotation marks with no space (''): <?php $numero = "1.000,00"; $result = str_replace(['.',','],'',…
-
0
votes1
answer1417
viewsA: How to write and block the textbox by clicking the button
By the code and comments you only need to lock the typing, instead of using Enabled that is very restrictive and disables even use events ReadOnly: private void button6_Click(object sender,…
-
2
votes2
answers9661
viewsA: CRUD with MVC and DAO in PHP
I’d change a few details: database class class Database { private $host = "localhost"; private $username = "root"; private $password = "123456"; private $database = "crud"; private $conexao = null;…
-
2
votes2
answers247
viewsA: how to parse a json return with complex object
To identify a phone key on this one array would be: //cria um array associativo quando segundo paramentro é true $array = json_decode($json, true); //retorna true se a chave existir…
-
8
votes1
answer3084
viewsA: Call a method that calls another method of the same class?
Must use a design pattern called Fluent Interface, that links the methods so facilitate in the development, has a nice explanatory text about Interface Fluent and Builder Patterns in the Sopt that…
-
1
votes2
answers477
viewsA: View Ocutar Password using Editorfor
The logic would be this: when the element <input /> receive the focus, the attribute needs to be changed type for text and when the focus is lost the type for password Follows examples: jQuery…
-
5
votes1
answer8769
viewsA: Create/Modify table without deleting data Laravel Migrate
When you create a Migrations by command: php artisan make:migrations create_cars A blank file with two methods is created: up() and down(), and within them are written what is to be done, example:…
-
2
votes3
answers182
viewsA: Linq filttar elements of LEFT JOIN
To filter an item from a relation using Join must write the filter directly in the interface (Join or GroupJoin need a IEnumerable<T> to function), in that specific case use GroupJoin: var…
-
2
votes1
answer236
viewsA: Picking up monthly items ELOQUENT MODEL
In the version Larable until 5.2 use the whereRaw: $mes = date('m'); $vendas = Encomenda::where('FlgStEncomenda', 'O') ->whereRaw("MONTH(created_at)={$mes}") ->count(); or $vendas =…
-
2
votes1
answer388
viewsA: Would it be possible to override Laravel’s with method?
No, you cannot overwrite this method in this way, but there is something that can be done in the class Controller which will serve as a basis for all controllers who inherit their behavior: <?php…
-
1
votes2
answers92
viewsA: When using the Laravel view helper, what kind of data is being returned?
A pattern used by Larable that’s how it is: /** * Return Instance of View. * * @return Illuminate\View\View */ public function index() { $posts = Post::orderBy('created_at',…
-
2
votes1
answer120
viewsA: How to read objects from an XML?
The Xml that was made available had errors, was missing close some items and this Xml returns a ArrayList and not a array simple: <java version="1.8.0_101" class="java.beans.XMLDecoder"> XML:…
-
1
votes1
answer805
views -
4
votes1
answer1118
viewsA: How to convert Byte[] to Image in Xamarin MVVM?
Would basically: Image image = new Image(); Stream stream = new MemoryStream(byteArray); image.Source = ImageSource.FromStream(() => {return stream; }); where byteArray would be the corresponding…
-
1
votes3
answers357
viewsA: Data bank without foreign key in Laravel
It should have the relationship of foreign key relating the tables product and category, That is a fact. Other than this can work via code, but the aggravating factor is the queries that will be…
-
2
votes2
answers1377
viewsA: How, after a POST request, to receive JSON feedback on C#?
There are two ways I know: private async void button1_Click(object sender, EventArgs e) { await RequestJson(); MessageBox.Show(retornojson); } private static string retornojson; public async Task…
-
4
votes1
answer6521
viewsA: Using Count() in Laravel
My question is, in instruction 1 I am running a select fulltable, returning all table columns and then passing to the Count() method to perform the count? In this first code is returned 1 user of…
-
1
votes1
answer691
viewsA: ASP NET MVC 5 Dapper with SQL Server?
Edit the Stored Procedure and renamed the fields according to the name of the respective class fields ClienteModel. The Dapper uses the name relation of the results obtained with those of the class,…
-
1
votes1
answer978
viewsA: Laravel update type error
The problem of your code, which was being passed a class Request, but the method requires a array with values failed to call $request->all() and failed to configure your model with fillable which…
-
0
votes1
answer88
viewsA: Modify generic method to merge information into classes
Yes, there is a way to bring you a list with type created at runtime (can also be created a class representing this new data model), create a method with the code below, where TResult is a new data…
-
9
votes1
answer501
viewsA: namespace com php
To work this type of code and automatically load by namespace directories must follow the same name as in namespace, in your case already have a problem the directory should be…
-
0
votes1
answer183
viewsA: After inclusion/exclusion setar active my tab-panel (Laravel)
Within the form have a field of the type hidden who is responsible for storing the last tab selected, in this example the name is tabSelected, <form action="/tabpost" method="post"> <input…
-
4
votes2
answers719
viewsA: How to keep foreign key restriction using softdelete?
You’re quite right in what you say, but this is one of the ways proposed by eloquent not to summarily exclude the data (permanently), standing up as historical in its groundwork, with the…
-
5
votes1
answer575
viewsA: Laravel Auth::Atempt() always returns false
The default way to authenticate follows a field pattern e-mail and password (respectively on the table users: email and password), as demonstrated on the link and on that other link. The ideal and…
-
2
votes1
answer127
viewsA: Using Simpleject with Class Library
In console application, is different, you need to use the commands within the classe Main to work. If you are Web you can work with dependency injection, but in your specific case (Console…
-
2
votes1
answer475
viewsA: Laravel 5.2 - How to view @foreach in View, only logs referring to the authenticated user?
In his controller in that line: Webinar::all(); change: Webinar::where("id_user", Auth::user()->id)->get(); specifying a filter where, with the value of Auth::user() (Auth::user()->id) that…
-
0
votes1
answer1144
views -
2
votes2
answers147
viewsA: How do I migrate Code First without deleting data from the table attribute?
In the method Up and Down, clear the code and put RenameColumn, with sequential parameters in the method Up: Nome da tabela Nome atual do campo da tabela Novo nome para o campo da tabela In the…
-
2
votes1
answer391
viewsA: Validate data from an object with Dataannotations C# Winforms
Implement a class that is responsible for checking your Model is valid: public sealed class ModelValid { public ICollection<ValidationResult> ValidationResults { get; private set; } public…
-
3
votes2
answers687
viewsA: How is the query generated in Linq mounted when we do UPDATE?
As the context (DbContext) works when I call an entity by First(), FirstOrDefault(), Find(value), that is, I bring a record for change: Model: [Table("Credit")] public class Credit { public Credit()…
-
5
votes1
answer308
viewsA: Problems with csrf_token Laravel
1) I would have some way to treat this error, so that it is not "spit" on my user’s screen ? Yes, not to show the error screen (debug) that developing is useful, but in production is unacceptable…
-
0
votes3
answers681
viewsA: Convert Stamp time to full date with php
If your date comes like this 2016-10-25 22:36:52, then: <?php setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); $data = strtotime('2016-10-25 22:36:52'); echo utf8_encode(…
-
1
votes1
answer189
viewsA: Call Partial with Ienumerable within a page that has its Ienumerable Asp.net mvc?
Make a class that will represent the result of the two collections: public class ViewModelHome { public List<Generico.Dominio.TB_NOTIFICACAO> Notificacoes { get; set; } public…
-
0
votes1
answer174
viewsA: How to read this XML and ignore the ID field using Xstream
Create a class Contato that will serve as a model: package models; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; public…
-
0
votes1
answer121
viewsA: How to validate a Ienumerable property using Dataannotations?
There is an error in HTML in ValidationMessageFor it should be like this: @Html.ValidationMessageFor(model => model.selectedItems) and the value that was formasPagto was wrong. Full html: @using…
-
1
votes1
answer1071
viewsA: Injection of Depension with Ninject C#
So that dependency injection with Ninject work so much to Web MVC and Webapi requires the installation of two packages: Install-Package Ninject.MVC5-Version 3.2.0 and Install-Package…
-
4
votes1
answer1294
viewsA: How to bring only the latest records with Laravel 5.2
Has the method is take, but it is important that the ordination (orderBy), to have no surprises in the result. $this->sale->orderBy('id','desc')->take(10)->get() return view('home.home',…
-
0
votes3
answers1236
viewsA: Calculate age by date of birth
Utilize IsDate(valor) who will return true if the date is valid, use Text to take the content value MaskedBox and finally not Date is Now to catch the current date, I mean, you have three problems…
visual-basic-6answered novic 35,673 -
2
votes1
answer1254
viewsA: Receiving an ajax request with Laravel
Has adjustment to be made for shipping ajax in the Larable: Within the tag head of html need to have: <meta name="csrf-token" content="{{ csrf_token() }}">: <!DOCTYPE html> <html…
-
1
votes1
answer35
viewsA: Doubts about requests and Returns
In fact it is a set of factors at first the routes that are configured with the type of verb (POST, GET, DELETE, PUT), example: Route::get('/exemplo', "ExemploController@index");…
-
9
votes5
answers497
views -
1
votes1
answer59
viewsA: Object only becomes available when I give dd()?
At the end of the var_dump() has a category that is coming NULL ["categoria"]=> NULL then, from what I can gather there may be SubCategorias without Categorias? If yes in your code foreach…
-
1
votes1
answer698
viewsA: Php formatting of numerics to save to mysql database as DECIMAL
In that case the CIELO reported, would indicate the division by 100 and would abandon the idea to use substr_replace, because: Values below 100, in the case 20 could bring a die like this: Code echo…
-
1
votes2
answers786
viewsA: Count lines
1) Accurate counts all subcategories, that is, this count needs to be dynamic. Remember that I need this information in my view, because I’m using it like this: CATEGORY NAME (QTY PRODUCT) The…
-
0
votes2
answers177
viewsA: C# - Problems reading data from an XML returned from a site
The return in XML maybe not the best, but there is a way: Example of the return: <Response> <IP>8.8.8.8</IP> <CountryCode>US</CountryCode> <CountryName>United…
-
1
votes3
answers807
viewsA: Remove row from an array
Could use System.IO.File.ReadAllLines to read all lines of the file and delete those that are blank with Linq ([Where](c => !string.IsNullOrEmpty(c))): string[] arquivo =…
-
2
votes1
answer75
viewsA: XML only brings empty value
In that $xml I did the test and it worked, but it was used simplexml_load_string because a text with xml. $xml = '<DistanceMatrixResponse> <status>OK</status>…
-
7
votes4
answers17399
viewsA: Average between 3 notes
Your code has a signal that’s reversed in comparison: Change: if ( media =< 5 ) // wrong for: if ( media <= 5 ) Observing: the signs of > (greater) and < (minor) are always before the =…