2015年05月

How to redirect the output of the program Valgrind is running on?

Background of the question:

I run a command like this:



$ valgrind ./my_program < 1.in


And I get Valgrind's messages about leaks and errors as well as the output stdout and stderr streams of the my_program.



Question:

I would like to redirect/mute all the streams of my_program (both stdout and stderr).



Where's what I've learnt so far:


Running > /dev/null doesn't mute the stderr stream of my_program.


Running > /dev/null 2> /dev/null mutes all the output stream of my_program all together with Valgrind's messages.


According to this thread: How to redirect Valgrind's output to a file? Valgrind is capable of streaming its output directly to a log file using valgrind --log-file="filename".




Possible solution:

I've came up with a solution like this



$ valgrind --log-file="filename" ./my_program < 1.in && cat filename


Is there an easier way to do this?



Answers

To separate valgrind and application output you can redirect valgrind output to another file descriptor:
valgrind --log-fd=9 9>>test.log ./app





How to set the default langage in iOS7?

I have an app with 3 langages, Base, French and English.



The app displays in French when I set the iOS7 langage to Italian



Why is the app considering French as the default langage ?
How to change that to English ?



Answers

Access your target by clicking on your project.
Switch to the Info
pane.
Within Custom iOS Target Properties, check the value for the
entry Localization native development region.
You can set it to en or choose from the suggested list.




Answers

This is what happens :




I set the iPhone langage to Italian
The OS doesn't find Italian localization in my app
Then it checks my iPhone region : "France"
The app is displayed in French


When I change the region to Italy, the langage falls back to English.





Redirect url if checkboxes are selected

I have some problem with redirecting urls after checkboxes are selected. I am using document.location for this, but this doesn´t work in my code. I'm trying to fix it, but without success.



This is the part of my code which doesn't work:



function objednat() {
var adress = "";
if (document.getelementbyid('BoxtarifVolani1').checked == true) {
adress += "#tarifVolani1";
}
window.location = 'http://www.investcon.webinpage.cz/cz/objednat-tarif-dobijeci-cislo/' + adresa;
}


I want to redirect this to a form, which will be filled with the selected values. I don't know why, but this document.location doesn't work in the code.



This is the part of the code I use in the formula for grabbing the hash from the url.



<script type="text/javascript">
if(window.location.hash) {

//set the value as a variable, and remove the #
var hash_value = window.location.hash.replace('#', '');

if (tarifVolani1 == true) {
document.getelementbyid('BoxtarifVolani1").checked = true;}
....
</script>


What am I doing wrong?



Answers

Whatever you have done is right, except, the function name is wrong case:




Change getelementbyid to getElementById.
Change adresa to adress.




Code:



function objednat() {
var adress = "";
if (document.getElementById('BoxtarifVolani1').checked == true) {
adress += "#tarifVolani1";
}
window.location = 'http://www.investcon.webinpage.cz/cz/objednat-tarif-dobijeci-cislo/' + adress;
}


Answers

jQuery way of doing it



function objednat() {
var adress = "";
if ($('#BoxtarifVolani1').is(':checked')) {
adress += "#tarifVolani1";
}
window.location = 'http://www.investcon.webinpage.cz/cz/objednat-tarif-dobijeci-cislo/'+adress;
}


For your ref: jQuery :checked Selector





Add white space in HTML page

I would like to add white space in HTML page. For now I use just basic



<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
....


Is there other way to add white space in order to add some padding between the components?



Answers

div,p,span and every html element add padding and margin.



like



p {margin-bottom:15px;} 
div {padding-bottom:15px;}
span {padding:15px 15px 15px 15px;}
p {margin:15px 15px 15px 15px;}


Answers

To create a space between elements, on the outside of the element, use margin.



To create a space on the inside of the element, use padding.



Also, see the image below.





Answers

You can just create a <div> with a min-height / height of the amount of white space you want to have. Also add width:100% just to make sure.





Running 2 JavaFx projects?

I have written a client-server application and I made the client GUI in JavaFX. To test the functionality of my application, I am trying to run 2 instances of Eclipse with the same project in each Eclipse workspace ( I have two workspaces : one contains the client and the server, the other one contains the same client project ). When I hit run on both client projects, the GUI freezes and I have no alternative but to close them.



Does anyone know a solution for this? Thank you in advance.





↑このページのトップヘ