Posts by Pedro Camara Junior • 6,637 points
151 posts
-
2
votes2
answers837
viewsA: How does a Json object return?
The second "JSON" you are using is not a list, so you do not need the index to access the properties of the object. out += arr.id + arr.name + arr.summonerLevel; One-night stand in this Javascript…
-
1
votes2
answers268
viewsA: Space Lock with REGEX
Your REGEX is almost right, as you only want digits, just remove the space from the REGEX that will work. new RegExp("^[0-9]*$") See example working: $('#rg').on('keypress', function() { var regex =…
-
4
votes4
answers1837
viewsA: How to use Json in an html
Its variable arr1is a list of objects and not just an object, to access it you need to inform the índice of each object in the list. Use the forto access all items in this list, within the for the…
-
3
votes5
answers106
viewsA: link is not called
This is because you are not assigning the event click element before it exists in HTML. As a solution you should create the click event right after adding the div to the HTML.…
jqueryanswered Pedro Camara Junior 6,637 -
15
votes3
answers2716
viewsA: Change class with javascript when resizing the screen
Using Javascript Note that I am checking the size inside the block window.addEventListener('resize', function() {..});, the function will be called every time the screen resolution is changed.…
-
1
votes4
answers118
viewsA: Working with Array and selecting a specific Input
So, see if this way helps. I think that the way to check the index should only be improved, so I think it is very manual, but it is already a way. EDITED: Using the selectedIndex quoted by @Sanction…
-
12
votes2
answers14461
viewsA: Convert string to date
The builder new Date() string should be in format mm-dd-yyyy or mm/dd/yyyy or you can also use the whole constructor new Date(yyyy, mm, dd) Reference:…
javascriptanswered Pedro Camara Junior 6,637 -
2
votes2
answers2719
viewsA: Append/Prepend in DIV with fixed child - jQuery
You can create a div only to serve as container to the others and add the content within this div. Take an example: $(document).ready(function() { var $divContainer = $('.container #minhaDiv');…
jqueryanswered Pedro Camara Junior 6,637 -
3
votes2
answers213
viewsA: Add days to a date within the method and return it with new period
You are adding 60 days based on the current date new Date(), you need to use the setDate() using the date of exclusion. var exclusao = new Date('2014-03-14T23:54:00'); var novaData = exclusao;…
javascriptanswered Pedro Camara Junior 6,637 -
1
votes3
answers633
viewsA: Add class to a datatable
You can use the Child selector jQuery $("table#ctl19_tableAreas tr>td").addClass("myClass"); .myClass { width: 33%; padding-top: 20px; color: red; } <script…
-
3
votes4
answers8543
viewsA: Ordering an array of objects by date
I performed some tests with the function and was performing the ordination wrong, because the date was string. to work properly, you must use a variable of type Date You can use the sort even, it…
javascriptanswered Pedro Camara Junior 6,637 -
1
votes1
answer178
viewsA: How to convert date at select time and return via Json
You can format your date using jQuery, see an example: function formatarData(data) { var arrData = data.split("-"); return arrData[2] + "/" + arrData[1] + "/" arrData[0]; } var dataInicial =…
-
3
votes4
answers11049
viewsA: How to select in 3 tables?
You need to make use of JOIN in your consultation. SELECT T.ID_Tabela1, T.Descricao, T3.Descricao FROM Tabela1 T INNER JOIN Tabela2 T2 ON T2.ID_Tabela2 = T.ID_Tabela2 INNER JOIN Tabela3 T3 ON…
-
2
votes3
answers2045
viewsA: Inserting record and recovering ID generated by SQL Server 2012
How are you using the Executescalar, you can add in your query/insert a select MAX(ID_Venda) right after the Insert and will be returned a object with the value. cmd.CommandText = @"INSERT INTO…
-
5
votes2
answers1831
viewsQ: How to recover the description of an enumerator?
I have the following enumerator public enum MeuEnumerador { [Description("Descrição do item do enumerador")] Enumerador1 = 1, [Description("Outra descrição")] Enumerador2 = 2 } How do I get the…
-
4
votes2
answers1831
viewsA: How to recover the description of an enumerator?
I found a solution by creating the following extensions for the type Enum public static T ObterAtributoDoTipo<T>(this Enum valorEnum) where T : System.Attribute { var type =…
-
1
votes2
answers60
viewsA: I cannot print out the values of my Array.
What is occurring is that your AJAX request is assíncrona, which means that when you request javascript will not "wait" for the request to be completed to run the next block of code. You can make…
-
6
votes3
answers6678
viewsA: Equivalent to PHP LIKE
You can use the function strpos which is used to find the occurrence of one string within another $valor = "PARALELEPIPEDO"; if (strpos($valor,"PARA") !== false) { echo "Encontrou"; } Using regular…
phpanswered Pedro Camara Junior 6,637 -
3
votes1
answer4505
viewsA: Disable button in Angular depending on a variable
You can assign boleanos values to your variable, and on your HTML button you use the property ng-disabled <input class="btn submit-btn" type="submit" value="Salva" ng-disabled="desabilitaBotao"…
angularjsanswered Pedro Camara Junior 6,637 -
3
votes3
answers523
viewsA: Get code from a li
Explaining the exchange of parents for Parent as quoted by @Tobymosque Parents: Will bring a list of all previous elements. Parent: It will bring only one parent element, in our case we are using…
-
0
votes2
answers756
viewsA: How to Download FTP Files
It’s not the most beautiful shape, but you already have the file name in your url, so you can split the url and get the file name. Remember that in the second parameter you also define the location…
-
3
votes2
answers244
viewsQ: Customize css link as per url
I’ve seen somewhere that has how to apply a certain css to a "to" if you have a certain text in the link, but can no longer find. For example, I have the following links in my html <a…
cssasked Pedro Camara Junior 6,637 -
6
votes1
answer6222
viewsA: Onchange trigger in select - javascript
There are some very simple mistakes to solve in your code. You are assigning the value of select directly to your var x var x = document.getElementById("mySelect").value; No if where you check if it…
-
4
votes1
answer3127
viewsA: How to find the Expressjs version?
Use the command npm list To get the express version npm list express To see the version of installed packages use in the project npm list or npm list -g to see all installed packages.…
-
10
votes1
answer3523
viewsQ: Convert int or string to Enum
How to convert type variables int and string for a enum?
-
15
votes1
answer3523
viewsA: Convert int or string to Enum
Convert int to enum var meuInteiro = 0; MinhaEnum foo = (MinhaEnum)meuInteiro; // foo == MinhaEnum.Primeiro Convert string to Enum var minhaString = "Segundo"; MinhaEnum foo =…
-
-1
votes1
answer331
viewsA: Send email to different servers
The configured server serves the sender and receiver account or sender only? You will configure only the sender, and with this sender you can send e-mail to any other server and how many times you…
-
1
votes4
answers25519
viewsA: The input character string was not in an incorrect format. Operators
Just not to exclude the answer, what I answered is wrong, it is possible yes store a int in double. I think the mistake is exactly in the line you pointed out double ram =…
-
1
votes4
answers18875
viewsA: Change color of button text by clicking
I would use jQuery for that; var $divLogin = $("#login"); $divLogin.click(function(){ if ($divLogin.hasClass("dourado")) $divLogin.addClass("branco").removeClass("dourado"); else…
-
2
votes2
answers318
viewsA: How do I leave an element with page height all the time?
I will suggest you use a page template with side menu that the own bootstrap suggests, Simple sidebar How are you doing, the menulateral is inside a row, which is not recommended, since the row is a…
-
5
votes3
answers1170
viewsA: Count Mysql records
You can use the function COUNT() to get the total records and function MAX() to get the highest time and date of sale. SELECT v.nome, (select MAX(vd.data_venda) from vendas vd where vd.nome =…
mysqlanswered Pedro Camara Junior 6,637 -
6
votes2
answers4267
viewsA: Assign a value to my td inside a table with jQuery
My response was more like a "demonstration" of the other functions which can be used, the error really must be the lack of the reference to jQuery or is tried to access the element before it be…
-
1
votes2
answers62
viewsA: Difficulty with creating SQL query
It is also possible to use sub selects in the query: select PES.COD_PESSOA as ra, PES.NOM_PESSOA as nome, (select PAI.NOM_PESSOA from PESSOA as PAI where PAI.COD_PESSOA = PES.COD_PESSOA_PAI) as…
sqlanswered Pedro Camara Junior 6,637 -
2
votes1
answer63
viewsA: Display a formatted Timespan time
You can do it this way: var horaI = new TimeSpan(10, 00, 00); var horaFormatada = string.Format("{0:hh\\:mm}", horaI); Of course there are several other ways to do this. Source:…
-
1
votes1
answer531
viewsQ: Serialize/Deserializar Datetime
I am saving in text file a serialized object that contains only fields of type Datetime, however, the date is saving in the wrong way. I will demonstrate with an example what I am doing. My…
-
2
votes1
answer83
viewsA: TFS Api - Query error with Datetime
I solved using a "POG" with Linq. When I get the Api items I search all with the same date or higher than I want, without considering the time, then I do a Search only from the time I want. It’s not…
-
1
votes2
answers2726
viewsA: Run Function only when div appears
Call the jQuery.ready of your div and not of the document. $("#divHorario").ready(function (){ $('.spincrement').spincrement({ from: 0.0, decimalPlaces:0 , duration: 5000, }); }); Using the…
-
4
votes1
answer83
viewsQ: TFS Api - Query error with Datetime
I am trying to perform a query using the TFS API where I need to get all the Workitems that have been edited from a certain date, however I get the following error: An unhandled Exception of type…
-
1
votes1
answer541
viewsA: Get the return of a Webapi method?
From what I’ve seen, you’re using that model to develop your API. You have to return true or false in the delete method, for this I made some modifications to your code, take a look at: public bool…
-
1
votes1
answer120
viewsA: Load Page with Swipebox
In the page load you emulate the click on your link: $(document).ready(function () { $('.swipebox').on('click', function(e) { e.preventDefault(); $.swipebox([ { href: urlBase + '/imagem.jpg',…
-
1
votes2
answers725
viewsA: How can I save TXT file in C: directory using C#?
If you are trying to save to a folder within C it may not exist,s and that is the case, you can check if it exists and create it if the case: var dirPath = @"C:\Temp\"; var filePath = dirPath +…
-
6
votes2
answers1098
viewsA: Angular POST with custom header and CORS
Problem solved, really the problem was in my Webapi. To add support to CORS I had to use the package Microsoft.AspNet.Webapi.Cors from Nuget, following the article I found here. Add the package…
-
0
votes1
answer42
viewsA: TFS Api - Assign new work item to a parent
I have found a solution, but I believe there must be other ways. The Assignedto field is inside the Fields property, so to access it is very simple: workItem.Fields[CoreField.AssignedTo].Value =…
-
0
votes1
answer42
viewsQ: TFS Api - Assign new work item to a parent
I am creating a new Workitem and need to change the responsible person(Field: Assigne To) for it. To create the Workitem I do as follows: WorkItem workItem = new WorkItem(workItemType) { State = "A…
-
-1
votes2
answers3379
viewsA: How to catch a . JSON from a JS URL
You need to configure your API to accept Cross Domain requests This article explains how to do this if you use php:…
-
4
votes2
answers1064
viewsA: How to use $(this) + checked?
Try it this way: $(this).is(":checked") Something I also like to do, particularly, is to assign everything in variavies, so: var $myRadio = $("#idDoRadio"); $myRadio.on('click', function () { if…
-
1
votes2
answers618
viewsA: Changing style of a div
Using jQuery On the radio that will perform the show action $("#idDoRadio").on("click", function(){ $("#idDaDiv").show(); }); And on the radio you will perform the occult action…
javascriptanswered Pedro Camara Junior 6,637 -
0
votes1
answer166
viewsA: Move Div Up with Jquery
Try something like that: var $campos = $(".campos"); var $formerControl = $(".jFormerControl"); $formerControl.append($campos);
-
2
votes1
answer13456
viewsA: How to go through attributes of a JSON?
I think the best way is for you to work with objects. If you assign your JSON string to an object you can easily access it. var arrayJson = JSON.parse("tua string JSON");…
-
4
votes2
answers83
viewsA: How to prevent data from being posted to google search?
Edited: Setting up robots.txt only will not remove your page from google indexes. Robots.txt: Does not allow a search engine to receive content from a particular page. Meta tag robots: Allows access…