Posts by CesarMiguel • 4,800 points
128 posts
-
2
votes1
answer603
viewsA: retrieve all records from the last 12 months including zero
Try taking the FROM_UNIXTIME: SELECT y, m, Count(bud_quotations.created_at) FROM ( SELECT y, m FROM (SELECT YEAR(CURDATE()) y UNION ALL SELECT YEAR(CURDATE())-1) years, (SELECT 1 m UNION ALL SELECT…
-
5
votes1
answer319
viewsQ: How to search for markers already created on a map - Google Maps
I have a map where there are already loads of Markers. In this map I need to fetch all markers, and show a list with markers visible to the user, to make a small list of data similar to this…
-
1
votes3
answers372
viewsA: List dates calculated per month based on parameters
Here is the solution: set @NumSemana = datepart(day, datediff(day, DATEADD(mm, DATEDIFF(mm,0,@StartDate), 0), @StartDate)/7 * 7)/7 + 1; WITH AllDays AS ( SELECT @StartDate AS [Date], DATEPART(month,…
-
4
votes3
answers372
viewsQ: List dates calculated per month based on parameters
Based on two dates received per parameter, I am trying to list all dates per month (one date per month) based on the start date and up to the end date. These dates returned have to check the day of…
-
3
votes2
answers545
viewsA: Find string inside a php tag
What you can do is a preg_match of tag with a regular expression: $link_to_getURL= '<iframe width="420" height="315" src="https://www.youtube.com/embed/HLhuNbO0egU" frameborder="0"…
-
4
votes1
answer321
viewsA: Jquery is not working
Your error is not loading Jquery, but syntax error: Uncaught Syntaxerror: Missing ) after argument list. In the slides.wrapAll which you are using, the quotation marks need to be removed "" when…
jqueryanswered CesarMiguel 4,800 -
1
votes2
answers6610
viewsA: Select within select sorted by the second mysql query
The problem is you have to do the count of tipoServico in the ORDER BY: SELECT * FROM tblTecnicos WHERE tipoServico > 0 ORDER BY COUNT(tipoServico) DESC If you wanted to present the result by…
-
3
votes2
answers817
viewsA: I can’t implement a @Foreach on MVC
The error is giving because you have to send the data list to the view, the type of data you receive on Model view-side. So you need to send a list of data: public ActionResult Index() { var…
-
3
votes3
answers185
viewsA: Update to 2 tables
If you’re creating a new Pessoa and new Catequizando you can never make a EntityState.Modified;, because basically the items don’t exist. Or the element you’re instantiating has a id existing, where…
-
2
votes1
answer249
viewsA: Return and assign to a query result textbox
You have two ways of doing it. Use a Viewbag: bm.IRPJ = br.IRPJ(Tipo).ToString(); Viewbag.IRPJ = bm.IRPJ; And in View: @Html.TextBox("txtTitle", (string)ViewBag.IRPJ , new {@class = "form-control…
asp.net-mvcanswered CesarMiguel 4,800 -
2
votes1
answer3034
viewsA: How to select by taking the record that has the maximum value of a field?
One of the solutions is to make a subquery to fetch the MAX of that element: SELECT VP.VAL_PREVISTO FROM TB_META M INNER JOIN TB_SUPER_FUNCAO_META SFM ON M.COD_META = SFM.COD_META AND SFM.COD_FUNCAO…
-
7
votes1
answer601
viewsA: Can foreign key be null in Entity?
The problem is when you define the field of your FK. You will need to set the field to accepting null’s, placing the ? the secondary key (called nullable): public class Uniao { public int UniaoId {…
-
1
votes1
answer208
viewsA: Query in HQL using Hibernate
You need to group the data by Description and count (count) for the grouped quantity, then one SUM to count the number of errors - ERRO, and at the end add the description: SELECT COUNT(*) as…
-
2
votes1
answer2301
viewsA: Not receiving negative numbers in an input
What you can do is replace of your last character inserted, check if you have the Keycode (Link) corresponding to "-" (which is 109), and replace: $('input').keyup(function(e) { var code = e.keyCode…
-
2
votes2
answers2260
viewsA: Fill div with ajax result
If your function returns HTML code just send it to div, in your Success: success: function(data){ $("#resultado").html(data); }…
-
8
votes1
answer4562
viewsA: How to exit a method before ending in c#
There are two ways to quit/finish the function: Return Throw You can use a return; at any time to end the function: public void MEUMETODO() { ... return; ... } Or use the Throw when an exception…
c#answered CesarMiguel 4,800 -
3
votes2
answers738
viewsA: Create a link that when clicked caught your text
In the construction of your table you send your item.ID which will define each td (also had some errors in tags): $('#tbl').append("<tr class=\"corpoTbl\"> <td class=\"ids\" id=\"tdID_" +…
-
0
votes1
answer221
viewsA: Add multiple fields from the same table in the same query
You can do several SELECT for the intended result: SELECT (SELECT COUNT (*) FROM tbl_x WHERE MONTH(dataCriacao) = 4) AS Numero_registos_Abril, (SELECT COUNT (*) FROM tbl_x WHERE MONTH(dataCriacao) =…
-
4
votes2
answers1150
viewsA: Sort month that is in full in Postgres
I’ve been looking into it, and I think I found a solution for you string of the month for the respective number (ex.: Janeiro = 1): SELECT CASE WHEN mes = "Janeiro" THEN 1 WHEN mes = "Fevereiro"…
-
11
votes2
answers31518
viewsA: Picking the first characters of a string
Exactly, you can use the .substring to get the first 10 characters: var str = window.location.pathname; alert(str.substring(0,10));//intervalo de caracteres prentendido…
javascriptanswered CesarMiguel 4,800 -
3
votes3
answers15590
viewsA: How to call a JS variable for an H1 HTML
A possible solution is to send the code/text you want to your h1: var count = 0; $("li").each(function(){ count++; }); $('h1').empty().append("I have " + count + " list items"); <script…
-
1
votes0
answers362
viewsQ: Error with Ajaxsubmit
In doing .ajaxSubmit() of a form with a input type="file" I always get the error: Uncaught Typeerror: jQuery(...). data(...) is not a Function Form: @using…
-
2
votes2
answers149
viewsA: Jquery does not run because of syntax
It’s because there really is one missing ), which is at the end to close the clause of document.ready: $(document).ready(function(){ $('input[placeholder], textarea[placeholder]').focus(function(){…
-
10
votes2
answers10690
viewsA: Display a Loader while processing ajax
In addition to Silvio’s answer, you have yet another valid way of doing so, using the method beforeSend in the request: <div id="divCorpo"></div> $.ajax({ url: url, type: 'GET',…
-
0
votes4
answers18313
viewsA: Change point per comma to input value
Using Jquery you can use replace to replace a character or even a character set in a String: function alteraPonto(valorInput){ alert("Valor original: " + valorInput.val()); alert("Valor com virgula:…
-
1
votes3
answers2872
viewsA: How to Set a Larger Size for a Textboxfor
Just add the class and size in Htmlattributes: Html.TextBoxFor(model => model.TeuCampo, new { @class = "form-control", style="width:50px;"}
asp.net-mvcanswered CesarMiguel 4,800 -
2
votes4
answers2540
viewsA: Checkbox that selects all
You can do this by Javascript, associating the action to a main Checkbox that will select all the others. Here’s an example, where you select all Checkboxes by the CSS class checkbox1: <input…
javascriptanswered CesarMiguel 4,800 -
15
votes1
answer2038
viewsA: Place text side by side
Yes, it is possible. Just set the property column-count in the CSS with the number of columns you want to split the text: .newspaper { -webkit-column-count: 2; /* Chrome, Safari, Opera */…
-
1
votes2
answers52
viewsA: List group only that contain items
First you have to reference the class Item to the Grupo: public class Item { publit int Id {get;set;} public int GrupoId {get;set;} public string Nome {get;set;} public virtual Grupo Grupo { get;…
-
0
votes0
answers47
viewsQ: Javascript and components fail to respond
I’m having some problems with session times (I assume that’s the problem) in my application. My client says that sometimes the application does not work, namely Javascript’s and components that are…
-
2
votes1
answer2846
viewsQ: Error: Could not load file or Assembly 'Dotnetopenauth.Aspnet' or one of its dependencies
I’m having this error running the application: Could not load file or Assembly 'Dotnetopenauth.Aspnet' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057…
-
1
votes1
answer97
viewsA: Concatenate aps.net expressions with literal text
I suggest you add at the end of your <asp:Label /> the text "by:", leaving: <asp:Label Text='<%# Eval("Analista") %>' runat="server" /><label> …
-
2
votes3
answers1870
viewsA: Search book details with Google Books API in PHP
You can read the data by JSON and so manipulate it the way you want: <?php $page =…
-
2
votes2
answers1969
viewsA: How to make a CSS animation stop in the last state?
You can add the property -webkit-animation-fill-mode: forwards; not to return to initial position: #div1 { height:100px; width:100px; background-color:silver; position:relative;…
-
0
votes1
answer630
viewsQ: Usage Tempdata ASP MVC
What I’ve been researching (here), I can save a data list in a Tempdata created in one function, to use in another function in my Controller. All right, I’m trying to do just that, I’m just not…
-
2
votes2
answers4798
viewsA: creation of tables with margins between them
What you have to do is set the edge for each td, something like: <style> td { padding: 15px; border: 1px solid black; } </style> Also removes the border = "1" defined in the table. td {…
-
2
votes1
answer136
viewsQ: Additional settings for referencing . NET 4.0?
Today when trying to publish a new version of my application, the following error appeared: Error 26 Mixed mode Assembly is built Against version 'v2.0.50727' of the Runtime and cannot be Loaded in…
-
1
votes1
answer165
viewsQ: Error trying to generate PDF file with the same name
When trying to generate PDF files, I often come across as the error: Mensage: The process cannot access the file’D:.... 23381708.pdf' because it is being used by Another process. Which tells me that…
-
11
votes4
answers2486
viewsA: How to make this arrow in CSS
You can use a Unicode HTML (decimal or hexadecimal) to make the arrow, and be able to adapt the font size, colors, etc with css: <p style="font-size:40px;">→<p> <p…
cssanswered CesarMiguel 4,800 -
5
votes2
answers608
viewsA: Use of the Ienumerable
It means that the variable ent has a data instance of the type EntFuncionarios, already defined in the database. In other words, it’s like a new data row in the table EntFuncionarios, where all…
-
8
votes1
answer122
viewsA: Use of val() in script makes me miss line breaks
What you can do is a .replace of a \n for <br /> to be interpreted correctly: var mensagem = $("#campodetexto").val(); var text = mensagem.replace(/\r?\n/g, '<br />'); Then, instead of…
-
1
votes1
answer3095
viewsA: Convert a date into yyyy-dd-mm format to dd-mm-yyyy
You can use the .ToString("dd-MM-yyyy") on your date (must be a valid date), leaving: MySqlDataAdapter da = new MySqlDataAdapter("SELECT idConduta,valor_Lido FROM valores_conduta WHERE data_Leitura…
-
4
votes1
answer3295
viewsQ: Selecting directory/directory in an input
I’m trying to create something that looks like a input type="file", Only instead of uploading a file, you’d have to choose a folder. Something like the "Save As" dialog, where we choose the folder…
-
2
votes1
answer90
viewsA: Property is coming as Undefined
@pnet, you are returning a list from your controller, and by making an alert from data.result_carrega_pagina.NM_Usuario gives undefined, because in fact property does not exist. To give alert you…
-
5
votes1
answer1108
viewsQ: Why @Html.Checkboxfor returns "true,false"
In the construction of my View, I have a field of the kind: public bool? RegistoGesOleos { get; set; } Who I represent using Razor as: @Html.CheckBoxFor(model => model.RegistoGesOleos.Value) Now…
-
4
votes2
answers75
viewsA: Problems in passing arguments by parameter
If you repair your function imc is asking for two parameters: float imc(float tam, float pes). In your printf you have printf("%f", imc(resultado));, that is, at the moment you are sending a…
canswered CesarMiguel 4,800 -
1
votes3
answers2450
viewsA: Remove list item based on property value
As far as I’m concerned, you want to remove a list of objects where x => x.nit_codit == 0, then you have to use the RemoveAll to remove a data list: PlItens.RemoveAll(PlItens.Where(x =>…
c#answered CesarMiguel 4,800 -
5
votes1
answer624
viewsA: Reload page with MVC
If you want to reload a view, you can use window.location.href in the success of your request Ajax. So it’ll be something like: $.ajax({ url: '/CadastroCargo/GravaResponsavel', datatype: 'json',…
-
2
votes1
answer341
viewsA: lambda expression gives conversion error
I think your mistake is in doing OrderBy before the condition. Tries: var resultado_rede_descricao = (from _pdv in db.PDV .Where(r => r.Tipo_PDV == _tipo_rede) select new { _pdv.Descricao,…
-
1
votes2
answers998
viewsA: Javascript, hit sequence of numbers
There were some errors in that code. Since lenght misspelled, fetching input value. I leave here the solution with the corrected errors: var botaoclicado=function() { var segredo= new…