Posts by carlosfigueira • 7,785 points
168 posts
-
0
votes1
answer3089
viewsA: Is it possible to pass variables by reference in javascript?
Not directly. But you can use an abstraction, such as an array or an object, for example, so that a function can "change the value" of the parameter passed. function alteraX(obj) { obj.x *= 5; } var…
javascriptanswered carlosfigueira 7,785 -
4
votes3
answers7652
viewsA: Graphic overlay on R
Instead of drawing the two graphs, you can draw the first graph, and then add only the lines of the second series. With this you will have the two graphics "superimposed" a = rnorm(1000) b =…
ranswered carlosfigueira 7,785 -
2
votes1
answer364
viewsA: How to assign Javascript value in Razor?
That can’t be done. The Razor markup is translated into HTML values on the server itself, and the response the client receives from the network (from the HTTP request) has no Razor markup, only pure…
-
4
votes2
answers40
viewsA: The functions do not end
Your program is starting 4 threads, and is not waiting for them to finish their run before printing out the time - which is exactly what it is doing. If you really want to calculate the time, you…
-
2
votes1
answer342
viewsA: Problem when making AJAX DELETE request by sending JSON
No (*). When the browser is sending AJAX requests for a service, it will send all cookies related to the service domain. To protect the scenery where you navigate to http://site.malvado.com/, and…
-
1
votes1
answer9872
viewsA: Error : subscripted value is neither array nor Pointer nor vector
The type of matriz is an integer pointer (array). In this case, when you have the operation matriz[i], the value you have is an integer. The problem is that you are trying to access the index [j] of…
canswered carlosfigueira 7,785 -
3
votes2
answers672
viewsA: Microsoft Azure to host website?
Azure has some options for hosting websites. The most common are the following: Virtual machines: the option of Iaas (Infrastructure as a Service) - you basically "rent" a computer that is running…
-
0
votes1
answer136
viewsA: WCF service hosting with endpoint creation?
Wcftestclient does not work to access WCF REST services. When you point Wcftestclient to a service, it attempts to access the Metadata endpoint of the service, which describes all operations, and…
-
2
votes1
answer26
viewsA: Remove links that have a certain string with Jquery
You can use the "attribute contains selector" jQuery to select the links that contain the "disabled string": $("li > a[href*='desativado']").hide(); Note that this will hide the text, but the…
jqueryanswered carlosfigueira 7,785 -
0
votes1
answer195
viewsA: Get nullable variable Serialized datetime in WCF service responses
The first idea to solve this problem would be to use an extra property, like string, decorated with the [DataMember] as in the code below: [DataContract(Name = "DADOS", Namespace = "")] public class…
-
8
votes1
answer22729
viewsA: How do I export table in R in txt or csv?
You can use the function write.csv or write.table (documentation), as in the example below. nomes <- c("Scooby", "Salsicha", "Fred", "Velma", "Daphne") idades <- c(10, 18, 20, 21, 19) tabela…
-
2
votes1
answer4304
viewsA: Difference between WADL and WSDL
They are used for different service implementations: WSDL (Web Services Description Language) is used to describe services implementing the SOAP standard, including various protocols known as WS-*…
-
2
votes2
answers405
viewsA: How to use the Maximum Common Divisor (GCD) function in Bigint.js
The GCD function needs its parameters to be of the type bigInt, and not whole. If you create bigInts x and y, you can then call the function correctly: var BI1 = int2bigInt(1124, 1, 1); var BI2 =…
javascriptanswered carlosfigueira 7,785 -
5
votes3
answers2449
viewsA: How to do terminal loading effect on just one line?
You can print a CR (\r, Carriage Return, which returns the cursor to the beginning of the line), clear the line and then continue printing its points, as in the example below: #include…
canswered carlosfigueira 7,785 -
5
votes4
answers374
viewsA: Orderby in lists<T>
OrderBy is a Extension method in namespace System.Linq. If you have it on your list of usings, then the method should appear. using System; using System.Collections.Generic; using System.Linq;…
-
3
votes1
answer101
viewsA: How to add an object at a random position of a Nsmutablearray?
When you initialize the NSMutableArray with a certain capacity, this is used more as a "hint" to the class of how many elements you think of storing (it is the initial number of objects the array…
objective-canswered carlosfigueira 7,785 -
3
votes3
answers2670
viewsA: Know the frequency of words
The idea is to divide all lines of your text into words (for example, using strsplit), concatenate all words and count the instances of each word (for example, using table). The code below shows a…
ranswered carlosfigueira 7,785 -
4
votes2
answers524
viewsA: Difference between Azure Queue and Queue Bus Service
This page of MSDN shows in detail the differences between the two types of queue (and there are many - in relation to performance, capacity, security, quotas, among others). Basically, you should…
-
0
votes1
answer138
viewsA: Identify WCF Service client (intranet or internet)
With WCF you can identify the IP address of the client that is connected in your service, through the property RemoteEndpointMessageProperty. From the IP you can use some subnet-based rule to decide…
-
3
votes2
answers297
viewsA: Best way to do an Action that does not return data
For ASP.NET MVC the EmptyResult works well. But if the function of your action is only to be called by AJAX (i.e., basically an API), then you can also use an Apicontroller (ASP.NET Web API), and in…
-
1
votes1
answer220
viewsA: Treat the return of a null datatable line
You can use DBNull.Value in C#, just like in VB: if (objclidto.DtAniversario == null) { cmd.Parameters.Add( new SqlParameter("@DataAniversario", SqlDbType.Date) ).Value = DBNull.Value; } else {…
returnanswered carlosfigueira 7,785 -
8
votes3
answers4910
viewsA: Split result equals zero in decimals
The problem is that the expression 1/3 is evaluated in the context of whole numbers. In an entire division, 1/3 == 0 (the expression is evaluated before being assigned to the variable numero). If…
-
8
votes1
answer191
viewsA: Is the appropriate type to serve Javascript "text/javascript" or "application/x-javascript" or "application/javascript"?
The "right" type is application/javascript according to the RFC 4329 (text/javascript is obsolete). But modern browsers can understand all of them. The reason why "application" is correct is that…
-
3
votes2
answers674
viewsA: Passing parameter between pages
In version 8.1 you now use the navigation from the Frame page, and takes the parameter from the object passed to the Onnavigatedto method: pag 1: private void Button_Click(object sender,…
-
2
votes3
answers1106
viewsA: Doubts with conditional commands in Batch files
You need to use a modifier to get the file extension. You will never have a file named *.jpg, what is what you are comparing. Using the modifier ~x as shown below should solve your problem. cls…
-
8
votes2
answers963
viewsA: How to get the public IP of a connected user via socket?
When you get the socket connected to the client, use the method getInetAddress of the socket class, which it will give you the IP (among other information) about the client that is connected to your…
-
2
votes2
answers2748
viewsA: Passing parameter null to a method
If you have used the primitive types (int, boolean, long, char, etc.) in the parameter, so you cannot pass null for a function: public java.util.Date Teste(boolean valor) { ... } public void Test2()…
-
1
votes1
answer121
viewsA: Update Memorystream when replacing Bookmark
Your code dealing with the stream has some problems: First: when you write on stream mem the stream cursor is at the end of the stream, which can cause your reading to fail. Tip: change the code…
-
1
votes1
answer51
viewsA: Transform Uiimage into Byte Array
You can use the functions Uiimagejpegrepresentation or Uiimagepngrepresentation to cover your image in a NSData. From there you can allocate an array of bytes the size of the data, and copy the…
-
2
votes1
answer186
viewsA: How do I get a contact list by code on Windows Phone 8.1?
Use the class ContactStore (that you get via the ContactManager). With the class you can use the method FindContactsAsync to get contacts, and with them assign the desired property in the property…
-
2
votes1
answer51
viewsA: What is the Order= parameter in the Authorize attribute?
According to the MSDN page, it indicates the order in which the attribute will be executed, among the filters which are configured in the pipeline of the MVC (IMvcFilter). If the only filter you…
asp.net-mvc-5answered carlosfigueira 7,785 -
1
votes1
answer586
viewsA: Read an xml file
The answer indicates that the method you are using (POST) is not accepted by the service. Try changing the line that defines the HttpWebRequest to use GET that should work: request.Method = "GET";…
-
4
votes1
answer783
viewsA: Access Denied when saving image to an application
You cannot access the local file system in a Silverlight application directly - if that were the case, a site could have a Silverlight control hidden in a page, and would have access to the file…
-
2
votes1
answer393
viewsA: How to generate an XML schema, where I have some nodes with namespace and others without
Your schema will be divided into two documents: one storing the default namespace information ("), and the other in the google namespace (http://base.google.com/ns/1.0). To generate the schema (in…
-
1
votes1
answer39
viewsA: Save new cell position after reordered and affect model (datasource)
In the @interface that implements the UITableViewDataSource (geralmente oview controller associated with the table), you need to implement the selector tableView:moveRowAtIndexPath:toIndexPath:. In…
-
5
votes2
answers145
viewsA: Number of repetitions per character
In your function you "declared" the variable i twice: once in the for external, and a for internal. However, for Javascript, the variable is declared only once. What happens is that at the end of…
javascriptanswered carlosfigueira 7,785 -
4
votes2
answers100
viewsA: How to know if a Nsarray is empty (or void) using IF
As in objective-c a message to nil returns nil, you can use the code below: NSArray *array = [obtem o valor]; if ([array count]) { // Nao é vazio nem nulo } If the array is nil, then the result of…
-
1
votes1
answer2006
viewsA: How do I change the border color of a Textbox in a Windows Phone 8.1 app?
Use the property BorderBrush class TextBox: private void btnOk_Click(object sender, RoutedEventArgs e) { if (txtResult.Text == "1") { this.txtResult.BorderBrush = new SolidColorBrush(Colors.Green);…
-
9
votes3
answers651
viewsA: Problem of stopping can be solved in practice?
The idea is interesting, but the halting problem says that given a program whichever and an entrance to the same... If you are limiting your program to running in a finite memory environment (be…
computer-theoryanswered carlosfigueira 7,785 -
2
votes5
answers1449
viewsA: Sorting in query - Leave last registration in first and then sort by a field
An auxiliary table can be used for this scenario: CREATE TABLE #temp (id int, nome nvarchar(max)) INSERT INTO #temp (id, nome) SELECT id, nome from tabela where id = (select max(id) from tabela)…
-
0
votes3
answers1459
viewsA: Parse Complex of JSON
Since the JSON schema is not static, you can use the JSON "DOM" that GSON offers (classes from package com.google.gson: Jsonobject, Jsonarray, Jsonprimitive, Jsonnull, Jsonelement) - Instead of…
-
4
votes3
answers5429
viewsA: Compile jar for exe and no longer need to have a JRE
There are some (commercial) tools that convert a JAR to executable, such as the Excelsior or the Jexepack, that can do what you want. Another alternative is to create an installation program that,…
javaanswered carlosfigueira 7,785 -
4
votes1
answer1340
viewsA: How to create functions with callback?
You need to call the callback when receiving the response to the ajax request. Note that in your logic it may be that two ajax requests are made (if (table) and if (select)). The code below assumes…
jqueryanswered carlosfigueira 7,785 -
5
votes1
answer344
viewsA: Data Alignment, Data Structure Padding and C
Variables in C are not placed in an arbitrary memory address. Each primitive type (with the exception of char, occupying 1 byte) has an alignment requirement, which is the type of address (in byte)…
canswered carlosfigueira 7,785 -
4
votes3
answers3244
viewsA: Calling a method from a Javascript class (OOP)
No, you cannot access an instance variable without having an instance for it. The function start is only created when creating a class instance SDK. You can use some tricks not to call the new SDK()…
-
9
votes2
answers477
viewsA: Java Performance of methods-filled and empty classes
Java instance methods are virtual by default. This means (saved in static methods or marked as final) whenever one of them is called, there is a lookup in the virtual table of the object to…
-
2
votes3
answers391
viewsA: Doubt in Arrays - Beginner
The location to initialize the employee array would be on builder class Enterprise, which is called every time an object of this class is created: class Empresa { // ... public Empresa(int…
-
1
votes3
answers4061
viewsA: Insert an empty row <tr> at each size range of an html table (With Javascript)
In the creation of HTML code you have no control in principle of the size of the rows in your table. What you need to do is for each row (individually or using a global CSS style) to set its height:…
-
1
votes1
answer247
viewsA: What do the Visual Studio object browser icons represent?
The links below point to pages (en) with icons for their respective versions of Visual Studio: VS 2013 VS 2012 VS 2010 VS 2008 VS 2005 Until VS 2008 they were called Babel icons, but this…
visual-studioanswered carlosfigueira 7,785 -
8
votes3
answers2578
viewsA: How to read another program’s variable?
I regret to inform you that only with basic knowledge you will not be able to do this - even with advanced knowledge this is not trivial. You need to somehow enter the process space of the other…