Posts by deFreitas • 694 points
31 posts
-
1
votes2
answers1032
viewsA: Generate sequential java number with Hibernate
Yes there is, just create a generator and specify it in the column that is the ID, in the example below I will create the id based on the model and year of the car. The Entity: @Entity public class…
-
0
votes2
answers736
viewsA: What is the advantage of using Junit to test methods in a class?
I understand that the big advantage is mainly one, the same one that makes me use JAVA: Standardization. If you use a "mini framework" that you made to test instead of using one that is already…
-
1
votes1
answer578
views -
1
votes3
answers1167
viewsA: How to make language selector
The select HTML does not support this natively, you cannot customize the internal html of select To do what you want are used plugins that assemble elements that seem selects and do the same thing…
-
0
votes4
answers7150
viewsA: In inheritance with private attributes, does not the daughter class take its attributes from the mother class?
The daughter class takes the attributes of the mother class: yes and no. Yes They exist in the daughter class, they just can’t be accessed by her, to solve this you can: put the access modifier of…
-
0
votes2
answers6738
viewsA: How to get the name of the properties of a Javascript or JSON object?
You’re trying to get the name of the property of the object, you can do something like this: var meuObjeto = {"carro": "civic", "casa": "fazenda"}; Object.keys(meuObjeto); this will print ["carro",…
-
2
votes4
answers77025
viewsA: How to run . jar with prompt?
Depends on the jar There are two types of jar: The jar executable This is easy if you just run: java -jar meuJar.jar The jar bundle This jar can be executed but not born for it so the way to execute…
-
-2
votes2
answers668
viewsA: Why is a Fibonacci faster in Java than in C?
Java has an intelligent compiler called JIT, this compiler 'guesses' patterns in code and optimizes processes, in Fibonacci for example, is the same pattern in each for and if, compiler understands…
-
3
votes4
answers33277
viewsA: Using the keywords Throws and Throw
Throws You’re making an exception, example public void acordar() throws Exception { throw new Exception("opa, deu erro"); } That is, you are "telling" to whomever call this method that he CAN (does…
-
2
votes3
answers1011
viewsA: @Override is required in Java?
Is recommended, non-compulsory, because if you work with JREs legacy as the 1.4 or earlier, there are no annotations, so in this case you should not use @Override, it’s just a convention to…
-
2
votes1
answer7492
viewsA: How to exclude an element from a vector in Java
The quick response is: You cannot remove elements from a vector. Vectors have defined sizes so there is no way to change their size, what you can do is leave the position x as null, as follows in…
-
2
votes2
answers1865
viewsA: Update JSON value with Javascript
Quick response: var data = [{ "dM": 'lolololo' }]; for(var i=0; i < data.length; i++){ data[i].dM= "dado " + i; } alert(JSON.stringify(data)); The @bfavaretto answer is correct but to understand…
-
2
votes1
answer531
viewsA: How to pass objects between controllers in MVC using POO
It wasn’t explicit but it looks like you want it sent by session. So you can just set in session and take it back in the other control. <?php // declaração da classe Pessoa class Pessoa { public…
-
0
votes2
answers474
viewsA: Sockets in java
Dude, when I went to learn how to work with sockets I had a really good tutorial from which I don’t need comments, basically you need two files that are below, so just run the ChatServer.java and…
-
1
votes1
answer276
viewsA: header using relative address and " .. / " does not work
If you are using real paths (ie if you are not using Apache URL rewriting) something like the following code could solve: $linkAtual = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $string =…
-
1
votes1
answer3373
viewsA: How to change content on a page?
The quick answer is: Yes, you can point to the CSS of the source server without having to download them. You will need to change the downloaded HTML to point to the server, simple like this, ex: of…
-
3
votes3
answers972
viewsA: Why are there so many ways to check if a value is NULL? How to standardize?
The answer is much simpler than it seems, there is no difference, this is one of the small problems of PHP, it was not written under a standardized specification, in fact I do not know how its…
-
3
votes1
answer740
viewsA: How to temporarily store data with good practices?
In practice? No problem, if what you want is for an anonymous user or not to fill in a field in which after browsing any other page and returning to this, the field will always be filled in that…
-
2
votes2
answers212
viewsA: How to make the A click active for all LI
I would recommend using the display: inline-block on the tag a This makes it fill the whole li, so whatever you click in li will open the link (tag a) ex: ul{ padding: 0px; list-style:none; } ul li…
-
0
votes5
answers6499
viewsA: Save the binary content of an image in the database
Well, if what you want is the byte array to save in the bank here is how to do: $filename = "myFile.sav"; $handle = fopen($filename, "rb"); $fsize = filesize($filename); $contents = fread($handle,…
-
1
votes2
answers356
viewsA: Is it possible to apply push technology?
When you need to keep the client synchronized with the server making AJAX requests may not be the best option, the best option we have is the use of sockets where unlike the common request from…
-
1
votes2
answers13354
viewsA: How to take the value dynamically from a select
Well then the question we have is: How to get select values from the PHP server without "refreshing" the page? The answer is: Use AJAX, there are some ways to use Ajax and in my opinion the easiest…
-
1
votes1
answer81
viewsA: Checkbox in theme options
Actually your solution is in a client-side language, in this case javascript, follows a solution that would solve http://jsfiddle.net/deFreitas/wsc7sot4/1/ <input type="checkbox" class="checkbox"…
-
1
votes3
answers6817
viewsA: Recover Mysql Table
In relational databases is used a resource for data security which is the log with it Mysql in case saves all queries except those of SELECT in the log file then you will have there all the Sqls to…
-
6
votes1
answer60
viewsA: Why is this script returning an object to me?
It seems you’ve already noticed but for didactic purposes.. in the example: html <input id="prod_name" /> javascript var nome = $("#prod_nome"); name receives an encapsulated object by jQuery…
-
2
votes1
answer340
viewsA: new File() does not create the file
Well I also took a little while to figure out, the problem is that when you run: FileWriter writer = new FileWriter(arqEscrita); This object deletes any file that existed or not and already creates…
-
1
votes2
answers986
viewsA: Dialog some after opening
This is because p:link turns the tag <a> and in HTML when this tag does not receive any link is considered to be the link of the current page. example <a href="">clique aqui</a>…
-
0
votes1
answer903
viewsA: Auto logout when browser close
If you want the session to close when it closes the window then use $_SESSION instead of $_COOKIE, now the session will only be destroyed when the entire Browser is closed and not just a tab. What…
-
1
votes2
answers662
viewsA: How to load external scripts
Well I imagine you do not want complicated things, knowing that the best way would be in PRODUCTION put all this sequentially in a single file and compress it with this Google tool…
-
2
votes3
answers648
viewsA: How to hide the tooltip created by the Title attribute?
Just don’t use the attribute title that exists in the tag img example: http://jsfiddle.net/deFreitas/jdgtx1px/…
-
2
votes3
answers249
viewsA: How do you make sure the person who used the system is really her?
I see that the only way is with a login, as it is a university everyone has to have their RA registered in the entity or you should use this to authenticate them as well as there should be a…