Posts by Mansueli • 3,734 points
79 posts
-
1
votes1
answer274
viewsA: Java - Add information in XML file with Jdom
First you have to read the file before adding the new comments: private static Document lerArquivo(String path) throws FileNotFoundException, JDOMException, IOException{ Document doc = null; Element…
-
3
votes1
answer2234
viewsA: Event click on Image Javafx
Onmouseclicked is not very recommended because it is not generic, (because there is also onTouched etc). But you could also use the same in this situation. The best way to create a "clickable image"…
-
4
votes1
answer14856
viewsA: How to organize random integer values in descending order in a Java array?
In java this is much simpler than what is trying, there is the method sort of the static class Arrays made for it. See the full example below: Crescent Order package meupacote; import…
-
2
votes2
answers1417
views -
7
votes1
answer4479
viewsA: Portuguese dictionary online for performing requests
The only dictionary I know of and has a public API for such queries is the open-dictionary which uses JSON as the API response. Among the options provided by the same exists:…
-
1
votes1
answer5335
viewsA: Java remove an item within a chained list Simple
You just have to swap the link by removing the current one and pass the next one from the current one to the predecessor. The logic is quite simple: List {Node-Previous} -> {Node to Be Deleted}…
-
3
votes1
answer71
viewsA: Filecopyutils of Spring With strange behavior
Try creating recursively the Path to the directory that will work: Trade where the base.mkdirs() is: if (!base.exists()) { criaPath(base); } Recursive method to create the Path: /** * @param d o…
-
15
votes3
answers759
viewsA: Comparison between a numeric string and an alphanumeric string
1e0 is the scientific notation for 1 i.e 1 vezes 10 elevado a 0. And the php converts numeric strings in numbers for comparison. var_dump("1000" == "1e3"); //1000 == 1000 -> true var_dump("1" ==…
-
2
votes1
answer625
viewsA: Check encoding of an XML
Just check the encoding by the method getEncoding() present in the XMLStreamReader: Below a complete example: import java.io.InputStream; import java.net.URL; import…
-
5
votes1
answer1924
viewsA: Message "Could not reserve enough space for Object heap" in JVM
As the limit of 32bit systems is 4GB of RAM and the system needs memory for Swap, kernel among others the practical limit is around 1.4GB to 1.6 GB (source). Relationship between Permsize and…
-
6
votes4
answers317
viewsA: Why are maps "faster" than arrays?
Maps or hashmaps have a hash which allows you to locate your elements in O(1). While in arrays you need to search for the element in order to execute. Arrays perform better than maps since you know…
-
1
votes1
answer121
viewsA: Syntax Highlighting with/in the Swing framework
For the Swing framework there is Rsyntaxtextarea who inherits from the class javax.swing.Jtextarea who uses a license derived from BSD which allows you to use the code both in open and private code…
-
1
votes2
answers123
viewsA: How to use two Python text decorators?
Definition: Decorators are functions returning another function using the syntax of @wrapper or packaging. As described in official documentation decorators are nothing more than syntactic sugar.…
-
1
votes2
answers1470
viewsA: How to find out if the session has expired?
To check if the session is still valid just check the property: HttpContext.Current.User.Identity.IsAuthenticated. And make the code you want according to the result. (modal, redirection) I…
asp.net-mvc-5answered Mansueli 3,734 -
11
votes3
answers3561
viewsA: Java and Offline Databases
Download and install the Sqlite and the driver for the Sqlite Sqlite is a server-less database system, in which the database will be a single file on the computer. There is more information about it…
-
10
votes2
answers39212
viewsA: Replace in SQL - Character to keep a piece of text
Postgresql; MS SQL Server 2012; Oracle 11g; Mysql CREATE TABLE tabela(email VARCHAR(320)); INSERT INTO tabela VALUES ('[email protected]'); INSERT INTO tabela VALUES ('[email protected]'); UPDATE tabela SET…
-
6
votes2
answers30147
viewsA: Joptionpane, for example?
Pretty basic example: import javax.swing.JFrame; import javax.swing.JOptionPane; public class CriaDialogo { public static void main(String[] args) { // Algo que deseja mostrar (aviso, mensagem de…
-
3
votes1
answer1276
viewsA: Mark (colorize) a string to write to the file
If your input text is quite simple (I suppose it is because you want to color a String). I believe that the easiest option and that can still open in word without problems is to use RTF (Rich Text…
-
5
votes2
answers136
viewsA: Problems in the implementation of methods
You just played your code and did not explain limitations. The why of the structures used and asked to explain how to implement two methods. I will give a summary of the problems as well as an…
-
14
votes2
answers3795
views -
4
votes1
answer723
viewsA: Find all instances of a pattern in a text
Your code works normally here: #!/usr/local/bin/python2.7 letra = "AEIoSDEaaAEIoSDEaaAEIoSDEAaaEIoSDEAEIoSDEAEIoSDEAEIoSDEAEIoSDEAEIoSDEAEIoSDEAEIoSDE" for i in range(0, len(letra) - 7): if…
-
2
votes2
answers87
viewsA: Domains with different endings, pointing to the same wordpress hosting
You just need to edit yours config.php where is: define( 'WP_SITEURL', 'http://meusite.com/wordpress' ); swap for: define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress' ); This way…
-
3
votes2
answers4665
viewsA: How to convert milliseconds to date
Just pass the time in milliseconds to the builder of the type Date() : tempo = //milisegundos date = new Date(tempo); alert(date.toString());
-
2
votes1
answer1116
viewsA: How to read a line in C
You might as well continue with what you are doing and create a vector of a virtually unlimited size e.g entrada[500000]; Or create a buffer and load the items partially : #include <stdio.h>…
-
1
votes1
answer426
viewsA: How to debug in Code::Blocks using the VS 2010 Express compiler
GNU Debugger is not compatible with the Microsoft compiler and although it seems strange Microsoft provides the CDB Debugger as a item "optional" and therefore should be downloaded from their…
-
1
votes2
answers157
viewsA: You can distribute program with GPL License along with GPL
As set out in GPL FAQ The installer and the files it installs are Separate Works. As a result, the Terms of the GPL do not apply to the installation software. That is to say: The installation and…
-
1
votes1
answer48
viewsA: Time redirection
The .htaccess must be at the root of your domain app.com.br : RewriteEngine On RewriteBase / #Para todos os requestes para www.app.com.br RewriteCond %{HTTP_HOST} ^www\.app\.com\.br$ #Redireciona…
-
3
votes1
answer953
viewsA: Restrict Vimeo videos to my website only
Just like @brasofilo said in the comments this can be done by the interface of website even. Or through the API, using the method vimeo.videos.embed.setPrivacy: That is, you need to pass the Oauth,…
-
1
votes2
answers879
viewsA: major/minor in vectors
You didn’t do anything with the i and with the j in your last go and notice that even if you were what I believe you were thinking of doing would be wrong: v1 : {2,5,20} v2: {44,34,23}…
-
5
votes1
answer1357
viewsA: Dynamic graphical user interface in Java
The ideal is to create lists and place these components so you can easily access them later. And for the question of the layout I recommend using the emcapsulamento in boxes (Box) because it can…
-
9
votes4
answers1428
viewsA: Application of 5S in agile methods
Just like Lean and Kanban 5S appeared in Japan from JIT (Just in Time). The 5S was and still is widely used in the automotive industry and complements the Kanban to maintain a perspective of…
-
2
votes3
answers428
viewsA: Test equal values (data) in PHP
Using date() <?php date_default_timezone_set('America/Sao_Paulo'); $mes = 07; $ano = 2014; $dias = cal_days_in_month(CAL_GREGORIAN, $mes, $ano); $ultimo = mktime(0, 0, 0, $mes, $dias, $ano); $dia…
-
3
votes1
answer1877
viewsA: Problem reading file . xlsx too big in Java
1 Read the full file: Increase the heap size of the JVM: java Xmx80m seuprograma //80 megabytes (só para mostrar a sintaxe) java -Xmx6g seuprograma // 6 gigabytes Note that JVM is limited to…
-
0
votes1
answer250
viewsA: Check events that occurred in a given period of time
Since you did not specify if you have any aversion to Javafx, this is probably what you are looking for, as this technology allows lists with Listeners ie it is only a matter of checking whenever…
-
8
votes1
answer10227
viewsA: Font size, px or pt?
Always use px in css when using absolute values, if you want to see the table below to do the substitution: +---------+---------+----------+---------+ | Points | Pixels | Ems | % |…
-
2
votes1
answer1080
viewsA: Get cell phone position. GPS
1. Define in the manifest that will use the GPS: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"> 2. Create a Locationmanager LocationManager gerenciadordeLugar =…
-
13
votes4
answers28007
viewsA: How to read CSV files in Java
If you make a split of the lines and a map or even a list to store each position you will have no problem, then to each line just make an interacting loop for each element resulting from the split.…
-
1
votes2
answers306
viewsA: Doubt in Struct + Pointer in C
So far I don’t understand what you wanted to do with printf("\n 2 %f",*(Param+sizeof(int)) ); //size of int matricula; But if you replace it with that, you’ll have the license plate: printf("\n 2…
-
5
votes1
answer120
viewsA: Is it possible to call the Internal (no visibility operator) method from a class inherited from another package?
Two ways to achieve this through emergency technical adaptations (a.k.a Gambiarra). Works in java but not on android 1.Create a third class heiress in the same restrictive class package public class…
-
4
votes4
answers2195
viewsA: Fetch date 7 days before current php date
<?php //Precisa de definir a função abaixo para evitar warnings date_default_timezone_set('America/Los_Angeles'); //Sua data original $Date = "2014-07-29"; //Modifica a data (7 dias atrás)…
-
4
votes3
answers176
viewsA: Syntactic Sugar in PHP
Yes, if since it would not need the same to achieve such result, as well as many other functions: while and do while. But, the languages must evolve and this ends up being considered natural over…
-
2
votes3
answers1247
viewsA: Is there a payment gateway that accepts mobile credits?
Since the Pagtotal has been discontinued, only traditional and foreign options remain: Boku Boku is one of the first mobile payment platforms and after searching in a search engine I saw that…
integrationanswered Mansueli 3,734 -
0
votes1
answer1134
viewsA: Manipulating links with accents
Can remove the Slug by regex: <?php $url = "http://www.fab.mil.br/noticias/mostra/18047/TREINAMENTO---Cadetes-da-Academia-da-For%E7a-A%E9rea-realizam-instru%E7%E3o-de-salto-de-emerg%EAncia-";…
-
3
votes3
answers456
viewsA: Infinite object?
You can instantiate an object of the same class within an object of the same class and in some cases it is a good solution due to the recursiveness of some problems. But you should never do and…
-
3
votes1
answer128
viewsA: Smallest unit of time possible
The fastest you can do is nanoseconds and the maximum resolution depends on the processor: #include <sys/time.h> int main() { timespec ts; // clock_gettime(CLOCK_MONOTONIC, &ts); // Para…
-
1
votes2
answers2256
viewsA: Login system back to previous page in php
I have tested no further I suggest doing something along those lines: page that requires login.php: if (!$_SESSION["logado"]) redirecionar_para_login(); login.php if (loginSucesso()){ $pattern =…
-
2
votes2
answers725
viewsA: Organization of projects in packages
Don’t use wildcards this is * with that you can make: package pacotes; import pacotes.objeto.Texto; public class Teste{ public static void main(String[] args) { Texto t = new Texto(); } } Detail the…
-
16
votes3
answers568
viewsA: Compute secure data randomly
Use external hardware Cannot generate fully random numbers without external hardware. As already indicated in the comments of your reply, could use either the Lavarand If you enter the sites that…
-
6
votes2
answers1174
viewsA: Instantiating an Object with a different reference
When a Cat is instantiated in the Animal, this animal will have all the properties of the cat as you can see in the example below. But he will remain an animal and any additional method of the Cat…
-
2
votes3
answers43625
viewsA: Regular expression that accepts only numbers and/or letters in Java
public class Regex { public static boolean validaString(String str) { return str.matches("[a-zA-Z0-9]+"); } public static void main(String[] args) { String[] teste = {"asdfads89as89", "", "asdf…