w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Debug non verbose code in eclipse
Is there a good way to debug the output of the getAbsolutePath() without breaking the code up into multiple lines? You can set a breakpoint on the compound line, and then either: use Inspect to examine the return value of getAbsolutePath() add an Expression to look at the return value of getAbsolutePath() Both of those alternatives will reevaluate the method though, so it's at least questionable whether that would be useful for anything stateful. Next question is whether you want to. If your concern is readability, I'd say that if you find yourself debugging such a compound statement that often, you should put it on a separate line because it's clearly important and complicated enough to deserve that bit of clarification.

Categories : Eclipse

I need a make code that make a check that is ExtJS Checkbox checked or not
RadioPeriod.getValue() It's all in API docs: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Checkbox-method-getValue

Categories : Extjs

I wish to make my code validate a field to make sure it is a number of four digits. How can I do this?
Regarding checking if it is number, you can use some regex: e.g. var reg = /^d{4}$/ig; var regExRes = reg.exec(document.ExamEntry.examnumber.value); if (document.ExamEntry.examnumber.value == "" || (regExRes == null || regExRes.length == 0)) { msg += "You must enter your Examination Number "; document.ExamEntry.examnumber.focus(); document.getElementById('examnumber').style.color = "red"; result = false; } To avoid entering anything beside number, I would suggest you to use something like jquery pluging called masked input EDIT: line changed from var reg = /d{4}/ig; to var reg = /^d{4}$/ig;

Categories : Javascript

more verbose git cherry
Well, you can list all the commits with git cherry and then run them through a loop to show each one returned. Would something like this work for you? for i in $(git cherry old_trunk | cut -d" " -f 2); do git show $i --quiet --pretty=fuller; done

Categories : GIT

What are Verbose Errors
Generally speaking, verbose errors are supplied with the name of the unhandled exception and a stack trace showing where the error occurred in the first place, usually accompanied by a line number and file name. A developer would want to see that sort of stuff while debugging or testing (debugging=true) but you would probably want a user to see a friendlier error message, or at least less low-level information, without giving away any architectural clues that might guide a would-be intruder, They originate from your run-time environment during execution. This is true to the definition of verbose which is: "Using or expressed in more words than are needed"

Categories : Vb.Net

Can I get a 'better' verbose output in Netbeans 7.3?
You can do something like this using the following ways: One: Put either of these codes in every method in your program: System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName()); System.out.println(new Object(){}.getClass().getEnclosingMethod().getName()); Two: Use the dumpStack() method: Thread.currentThread().dumpStack(); Three: Use the printStackTrace of Throwable new Throwable().printStackTrace(); Four: This is a variation of the first solution StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); for(StackTraceElement st : stackTrace){ System.err.println(st); }

Categories : Java

how to tell tomcat be verbose while deploying war
Set the application level logging to DEBUG and you should be getting all the logs about which bean getting initialized, which jar is being loaded and so on. It should be more than enough - at least it is in my case

Categories : Tomcat

Can I put C# and Java code in the same file to make porting my code easier?
I would say the idea is good, but the code would be hard to read. A mess. Maybe if you have a very simple codebase... but in reality would result BIG CHAOS! You maybe spend a lot of time by looking at wrong code, scrolling up n down and getting more confused. Clean code in the files will have your focus, when you open your java project you know you work with java. And when you do open the c# you know it is C# etc. Do a java branch and a c# branch of your code. It is more easy to maintain and keep it clean. Think of situation where you want to upgrade the environment, why wasting time/money to recompile the Java code while you are about to upgrade only the C# code, etc! Will you port to php, ruby, perl, python etc in same files too ? Just let programmers to open the code they want to

Categories : C#

XSLT output is verbose and messy
I'm not sure if this works for you because I'm using a different xlst processor (xsltproc). Also my output with your original xslt does not completely look like your output. So anyway: I have mainly removed the namespace attribute from xlst and add two times the namespace prefix "newns". Try this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oldns="namespace/1.0" xmlns:newns="namespace/1.1" version="1.0"> <xsl:param name="newnsParam">namespace/1.1</xsl:param> <!-- copy all document --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template>

Categories : Xml

Specifying levels (e.g. --verbose) using Boost program_options
This is how I envisage the code being used. We use level_value in place of the normal program_options::value pass option_level<CHAR>(your_value) where CHAR is the short option letter, and your_value is the optional level, e.g. verbosity, being supplied Example #include <boost/program_options.hpp> using namespace boost; using namespace boost::program_options; int main() { unsigned verbosity = 0U; unsigned something_else = 0U; options_description desc("options"); desc.add_options() ("verbose,v", level_value(option_level<'v'>(&verbosity)), "Print more verbose messages at each additional verbosity level.") ("something_else,s", value<unsigned>(&something_else);

Categories : C++

Verbose exception catch clauses
When catch exceptions I usually find that more specific is better, that being said typing out all of those different blocks that do the same thing can get really annoying. Thankfully in the Java 7 release a try-catch notation was added where you can specific multiple exceptions for a single block: try{ //some statements } catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | FileNotFoundException | IOException | UnrecoverableKeyException | NoPropertyFoundException e) { LOGGER.error(e); } This sounds like what you are looking for, but there is more detailed information in the Oracle docs: http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.htm

Categories : Java

How to turn off Rspec's verbose logging?
The issue was not with Rspec after all. Instead Someone had written 'p params' in a controller helper. This question is not really valid due to this. Relishapp's docs were very useful in uncovering this https://www.relishapp.com/rspec/rspec-rails/docs

Categories : Ruby On Rails

JPA2 data validation verbose logging
A couple of things here. First of you have to distinguish between JPA and Bean Validation. Two different specifications and things. @Basic is a JPA annotation whereas @NotNull is a Bean Validation annotation. Using @Basic(optional=false) in conjunction with schema creation you will indeed get a database constraint which in turn lead to a JDBC exception during persist. By introducing Bean Validation you activate the JPA integration of Bean Validation. In this case prior to writing to the database the data will be validated via Bean Validation. In this case as part of pre-persist. As per specification a ConstraintViolationException is thrown in this case. You can call ConstraintViolationException.getConstraintViolations to get a set of the failing constraints. It is up to you to catch this

Categories : Java

Disable gphoto2's verbose error messages
A friend dug through the source code. He found that errors go to stderr, advice to stdout; so the advice (but not the errors) is suppressed by gphoto2 ... > /dev/null Also, --debug suppresses the advice, so another answer is gphoto2 ... --debug --debug-logfile=/dev/null For everyday use, make one of those an alias in whatever shell you use.

Categories : C

Making ffmpeg/javacv less verbose in java
had the same problem a few minutes ago, and also looked on the net, nothing except your question. Then i started digging in the ffmpeg sources and found a solution, add the import: import com.googlecode.javacv.cpp.avutil; and then just call: avutil.av_log_set_level(avutil.AV_LOG_QUIET); before you create the FFmpegFrameGrabber -> No more messages form ffmpeg. Regards Daniel

Categories : Java

CakePHP Unit Testing too verbose when using logging
Your minimal test case illustrates some aspects quite nicely: You are using $this->assertTrue(true) just for the sake of asserting something. Your tested function does some logging, which is not tested. Your test run is cluttered with log output. Let's address the third point first: Whatever logger you use, it should be able to get configured to put the log messages somewhere. As it currently seems, the logger just echos the messages. You probably also have the ability to log into a file, or send a mail. Or do nothing at all. So in theory you should be able to silence the log output by applying a configuration just for the tests. The second point: Whenever you silence the logger output, you cannot verify that the logging actually works correctly. Logging actually comes it multiple

Categories : PHP

Any way to turn on/off a println in java (verbose mode)
Your best choice is to use an appropriate logger of some kind (log4j for example). If that's not possible, you can "consume" the stdout and stderr using something like... PrintStream nullPrintStream = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { } }); System.setErr(nullPrintStream); System.setOut(nullPrintStream); Which prevent ALL output from begin printed. You can use a proxy process (using the current stdout wrapped in a proxy PrintStream) to filter the content if that's more appropriate...

Categories : Java

Matlab libsvm svmpredict accuracy verbose
If you are using matlab, just find the line of code that is displaying this information (usually using 'disp', 'sprintf', or 'fprintf') and comment it out using the commenting operator %. example: disp(['Accuracy= ' num2str(x)]); change it to: % disp(['Accuracy= ' num2str(x)]); If you are using the main libsvm library then you need to modify it before making. 1- Open the file 'svmpredict.c' 2- find this line of code: info("Accuracy = %g%% (%d/%d) (classification) ", (double)correct/total*100,correct,total); 3- just comment it out using // operator 4- save and close the file 5- make the project

Categories : Matlab

Disable verbose debugging in unix using set command
Saying: set +x would disable trace. From the manual: Using ‘+’ rather than ‘-’ causes these options to be turned off. The options can also be used upon invocation of the shell. The current set of options may be found in $-.

Categories : Debugging

Changing verbose report format for nosetests
You need to override the str method of your TestCase class in the following way: def __str__(self): return __name__ + "." + self.__class__.__name__ + "." + self._testMethodName Modify the return string at your will.

Categories : Python

How do you tell Xamarin Studio to give verbose output for a build?
Right click on your main project in the solution -> Options. On the left-hand side, under Build -> iOS Build you see Additional Options -> Additional mtouch arguments. Enter -v -v -v -v for a verbose log. PS Since i am writing this a year and a half after the question, I am talking about Xamarin Studio 5.7.1

Categories : Android

More verbose error messages with recursive algorithms in Matlab?
Add a try catch block on your recursive algorithm, print the information you think it would be valid and then rethrow an error that will terminate your other callbacks silently. You may use the keyboard matlab function to check the matlab workspace as the recursive function goes on. You can choose to add it just before your error message, so it will be called every time it goes deeper in the recursive level, so that you can check what is going on, or you can add it when the error occurs (on the catch). This is just a draft, it may contain errors, adapt it into your needs: try % recursive routine catch ext if strcmp(ext.identifier,'MyPackage:MyRecursiveRoutine:TerminateSilently')) % Do nothing else % Display useful information, you edit it to add information you think would

Categories : Matlab

Git clone verbose mode – show each incoming object
It is not possible to list objects (files, commits, blobs, whatever) one-by-one, simply because git packs them in a single file for efficiency reasons. For the same reason, you will only see a hidden .git folder while cloning, files will be created only if the full pack file has been downloaded. If you are wondering, these pack files will be downloaded to .git/objects/pack/ with a name like tmp_pack_XXXXXX. (later on, it will be renamed to something like pack-*.pack with a related pack-*.idx file)

Categories : GIT

Is it possible to make a code like Join two tables with PHP code
<?php $array1 = array("make","model","color","year"); $array2 = array("Jeep","Liberty","Black","2005"); $newArray = array_combine($array1, $array2); foreach ($newArray as $key => $value) { echo "$key - <strong>$value</strong> <br />"; } try like this one.

Categories : PHP

Use regex with grep to filter data from the output of a verbose command
Let's go by parts. Best way I can think of is redirecting the output to a file, in unix-like environments you do it like: cat your-command > filename.txt Second, you need to read the file line by line, I would use a python script or a perl script if you know any of those, or whatever language fits you. Third, you can get values two different ways: Read columns by position, you can get colums with a regex like: [^s]+ Write regular expressions for every specific column, so for IP you could have something like this: ([0-9]{1,3}.){4} for monitoring monitoring-([^s]+) and so on.

Categories : Regex

Android: Log Verbose throws error on 2.2 for a new String "byte array" initialization
Try to initialize the byte[] or check whether the byte[] is null or not. Log.v("Upper Case", (encryptedActivationKey != null ? new String(encryptedActivationKey) : null));

Categories : Java

Rspec with Guard and Spork will not run some tests, and doesn't give verbose error statements for failures
It looks like one of the arguments to rspec is --out /dev/null. So your output is being redirected from STDOUT. One possibility is that this is being caused by one or more bad tests. Have you tried commenting out various tests to see if you can isolate the problematic ones? If you're running your tests in order, I'd start with the ones just before and after the point at which rspec exits prematurely.

Categories : Ruby On Rails

Vague error from Apache and Phusion Passenger on failed Rails apps - how to address such a non-verbose issue?
This error message is printed when the HelperAgent has crashed. The code in Apache will wait until the Watchdog restarts the HelperAgent, after which the connection is reestablished. If anything goes wrong, this is the message you get. What you should look for are the earlier messages. Are there any messages from earlier that may tell you why the HelperAgent crashed in the first place, or why it failed to restart? If you look at passenger-memory-stats, do you see the PassengerHelperAgent and PassengerWatchdog?

Categories : Ruby On Rails

How would an upgrade from verbose JSON to JSON light affect someone who only looks at the data, and not the metadata?
"I don't care about metadata; I only care about the data" That's actually a great tagline for JSON Light as a whole :) The core principle of JSON light is that servers can cut down on unnecessary metadata in the payload. When a client does need a certain bit of metadata (for example, the URL it should use to edit the entity), the client can generate that URI itself based on common OData URI conventions. A client can control how much metadata the server should include in the payload by requesting one of the three different metadata levels: "application/json;odata=fullmetadata" for clients who need to use metadata and don't have a way to compute it themselves "application/json;odata=minimalmetadata" for clients who use metadata but are fine computing it themselves "application/json;oda

Categories : Json

How to make this code more efficient?
you can bind your properties directly to your textboxes <UserControl xmlns:Properties="clr-namespace:MyProjectNamespace.Properties" > <TextBox Text="{Binding Source={x:Static Properties:Settings.Default}, Path=strT1L1, Mode=TwoWay}" />

Categories : C#

How To Make this Code work
The problem is your reading linevalue again before adding to items: You can do it in an easier way: var lines = File.ReadAllLines("Scheduler.txt").ToList(); lines.Sort(); foreach(var line in lines) Console.WriteLine( line );

Categories : C#

To make the following code run faster?
Both check and runcheck have this code that reads the entire file, then iterates over all the lines. Replace the following: lines = f.readlines() for line in lines: with: for line in f: to only read and process the lines in one pass.

Categories : Python

Make PHP code execute only once
The usual approach: URL to create a new entry would be http://your.site/requests/new or http://your.site/requests/create or just http://your.site/request. URL to update an existing entry would be http://your.site/requests/123. After a new entry is created, the user is redirected to the /123 page where they can update their entry. The php is the same for both URLs. Check that isset($_GET['ID']) in which case, you are editing an existing record. If $_GET['ID'] is not set, then you are creating a new record. Wrap the INSERT statement in an if (isset($_GET['ID'])) block.

Categories : PHP

I can not make my code iterate x -= 1
Your code is overly complicated, try this recursive implementation adapted from wikipedia: def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) It seems that you were looking for an iterative solution (the question is misleading). If that was the case, here are a couple of possible implementations, also adapted from wikipedia: def gcd(a, b): while b: a, b = b, a % b return a def gcd(a, b): while a != b: if a > b: a -= b else: b -= a return a

Categories : Python

Why can't i use this code to make a minecraft launcher in c#?
The arguments you are giving have an environment variable in them - %APPDATA%. The command line will expand this by default, but the .net library won't. See How do I ensure c# Process.Start will expand environment variables?

Categories : C#

Can I make this Javascript code shorter?
Sure, you can use a map: function createDragName1(){ var random1 = Math.floor(Math.random() * 17), // [0, 17) names = ['Va', 'Tuul']; // title cased names return names[random1] || 'Error'; } The expression names[random1] || 'Error' returns a name if 0 <= random1 < names.length and 'Error' otherwise. I've also removed the title case logic by manually title casing names. Btw, the random number will in most cases be outside of the desired range, so you will return Error an awful many times.

Categories : Javascript

Can someone identify what's wrong with the following code? i am trying to make a Tic Tac Toe
You are using buttons.length horizontally and vertically but your number of buttons is different than your number of columns/rows. In fact this number is the number of columns multiplied by number of rows. Try to use sqrt on this number. Also instead of the integer variable turn you should use a boolean, and after each turn write: turn = !turn. Edit: Moreover I don't understand why are you using the while.

Categories : Java

How can I make my email code work PHP?
To make your own callback you can't just pass the constant MAIL_NAME_ERROR. If you want to pass your own function you have to do something like: function mail_name_error(){ //do your thing here } function isValidName($name){ if(filter_var($name, FILTER_CALLBACK, array('options' => 'mail_name_error'))){ return true; } else { return false; } } See the options section at http://php.net/manual/en/function.filter-var.php .

Categories : PHP

How to make call HTTPS url from php code?
Look at http://www.php.net/manual/en/ref.http.php Here is an example from php.net: <?php $response = http_get("http://www.example.com/", array("timeout"=>1), $info); print_r($info); ?>

Categories : PHP

How can I use or operator here to make my code shorter?
Since they seem to do the same: $(document).ready(function() { $("#id_event_type_1,#id_event_type_2,#id_event_type_3").click(function(){ $("#id_end_date").show(); $('label[for="id_end_date"]').show(); }); });

Categories : Jquery



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.