I'm looking at the article C# - Data Transfer Object on serializable DTOs.
The article includes this piece of code:
public static string SerializeDTO(DTO dto) {
try {
XmlSerializer xmlSe..
I want to catch and log exceptions without exiting, e.g.,
try:
do_stuff()
except Exception, err:
print(Exception, err)
# I want to print the entire traceback here,
# not just the excep..
Within node.js readFile() shows how to capture an error, however there is no comment for the readFileSync() function regarding error handling. As such, if I try to use readFileSync() when there is no ..
This is the try catch in PowerShell 2.0
$urls = "http://www.google.com", "http://none.greenjump.nl", "http://www.nu.nl"
$wc = New-Object System.Net.WebClient
foreach($url in $urls)
{
try
{
..
If I run the code:
connection = manager.connect("I2Cx")
The program crashes and reports a KeyError because I2Cx doesn't exist (it should be I2C).
But if I do:
try:
connection = manager.connec..
Is there an efficient method in VB to check if a string can be converted to a double?
I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. B..
I need to catch some warnings being thrown from some php native functions and then handle them.
Specifically:
array dns_get_record ( string $hostname [, int $type= DNS_ANY [, array &$authns ..
I want to implement a good error handling in my app, I have forced this file for catching the error.
App\Services\PayUService
try {
$this->buildXMLHeader; // Should be $this->buildXMLHeader(..
I have a question that might seem fairly simple (of course if you know the answer).
A certain function I have calls another function but I want to continue execution from the caller even though the c..
I am trying to write an MS sql script that has a transaction and a try/catch block. If it catches an exception, the transaction is rolled back. If not, the transaction is committed. I have seen a f..
I wrote some code for testing the impact of try-catch, but seeing some surprising results.
static void Main(string[] args)
{
Thread.CurrentThread.Priority = ThreadPriority.Highest;
Process.Ge..
I have a recursive call to a method that throws a stack overflow exception. The first call is surrounded by a try catch block but the exception is not caught.
Does the stack overflow exception behav..
I'm trying to use the following code to execute builds, and in the end, execute post build actions when builds were successful. Still, I get a MultipleCompilationErrorsException, saying that my try bl..
I need to catch two exceptions because they require the same handling logic. I would like to do something like:
catch (Exception e, ExtendsRuntimeException re) {
// common logic to handle both ex..
I often see comments on other Stack Overflow questions about how the use of except: pass is discouraged. Why is this bad? Sometimes I just don't care what the errors are and I want to just continue wi..
I have a PHP function in a Drupal 6 .module file. I am attempting to run initial variable validations prior to executing more intensive tasks (such as database queries). In C#, I used to implement IF..
I am trying to use a bit of code I found at the bottom of this page. Here is the code in a class that I created for it:
import java.io.LineNumberReader;
import java.io.FileReader;
import java.io.IOE..
I recently wrote a PowerShell script that works great - however, I'd like to now upgrade the script and add some error checking / handling - but I've been stumped at the first hurdle it seems. Why won..
I've just seen a question on try-catch, which people (including Jon Skeet) say empty catch blocks are a really bad idea? Why this? Is there no situation where an empty catch is not a wrong design deci..
Try-catch is meant to help in the exception handling. This means somehow that it will help our system to be more robust: try to recover from an unexpected event.
We suspect something might happen wh..
I'm a beginner java programmer following the java tutorials.
I am using a simple Java Program from the Java tutorials's Data Streams Page, and at runtime, it keeps on showing EOFException. I was wond..
I want to write trycatch code to deal with error in downloading from the web.
url <- c(
"http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html",
"http://en.wikipedia.org/..
I'm reviewing some new code. The program has a try and a finally block only. Since the catch block is excluded, how does the try block work if it encounters an exception or anything throwable? Does..
I have a loop that looks something like this:
for (int i = 0; i < max; i++) {
String myString = ...;
float myNum = Float.parseFloat(myString);
myFloats[i] = myNum;
}
This is the main..
I need to catch segmentation fault in third party library cleanup operations. This happens sometimes just before my program exits, and I cannot fix the real reason of this. In Windows programming I co..
I have been using try..catch blocks in my PHP code, but I'm not sure if I've been using them correctly.
For example, some of my code looks like:
try {
$tableAresults = $dbHandler->doSometh..
Is it possible to raise an error in a stored procedure manually to stop execution and jump to BEGIN CATCH block? Some analog of throw new Exception() in C#.
Here is my stored procedure's body:
BEGIN..
Is there some way in Python to capture KeyboardInterrupt event without putting all the code inside a try-except statement?
I want to cleanly exit without trace if user presses Ctrl+C...
I'm trying the following code:
Try ' DOESN'T WORK
Throw 2 ' How do I throw an exception?
Catch ex
'What do I do here?
End Try
but I'm getting the error Statement expected in the catch claus..
So when I do a code of blocks inside a try{}, and I try to return a value, it tells me
no return values
import org.w3c.dom.ranges.RangeException;
public class Pg257E5
{
public static void ma..
From time to time in Python, I see the block:
try:
try_this(whatever)
except SomeException as exception:
#Handle exception
else:
return something
What is the reason for the try-except-else..
By reading all the questions already asked in this forum related to the topic above (see title), I thoroughly understand that finally gets always called. (except from System.exit and infinite loops). ..
I have a problem with my code in the try block.
To make it easy this is my code:
try:
code a
code b #if b fails, it should ignore, and go to c.
code c #if c fails, go to d
code d
exce..
I know it's possible to check whether the value of a text box or variable is numeric using try/catch statements, but IsNumeric is so much simpler. One of my current projects requires recovering value..
In Java, I want to do something like this:
try {
...
} catch (/* code to catch IllegalArgumentException, SecurityException,
IllegalAccessException, and NoSuchFieldException at t..
while maintaining my colleague's code from even someone who claims to be a senior developer, I often see the following code:
try
{
//do something
}
catch
{
//Do nothing
}
or sometimes they write ..
I don't know much about Javascript, and the other questions I found are related to operations on dates, not only getting the information as I need it.
Objective
I wish to get the date as below-forma..
Related question is "Datetime To Unix timestamp", but this question is more general.
I need Unix timestamps to solve my last question. My interests are Python, Ruby and Haskell, but other approaches..
I wrote a PHP code like this
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
But when I remove "http://" from $site I get the following warning:
Warning:
fil..
I want to repeat the rows of a data.frame, each N times. The result should be a new data.frame (with nrow(new.df) == nrow(old.df) * N) keeping the data types of the columns.
Example for N = 2:
..
trying to run mysql in ubuntu
typing mysql in terminal
and getting error
ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO)
Can anybody please sort out this problem....
I need to debug a GLSL program but I don't know how to output intermediate result.
Is it possible to make some debug traces (like with printf) with GLSL ?..
Can somebody please explain (in succinct terms) what exactly is domain driven design? I see the term quite a lot but really don't understand what it is or what it looks like. How does it differ from n..
Which shell command gives me the actual version of pip I am using?
pip gives with pip show all version of modules that are installed but excludes itself...
Can any body please tell me what code is used for clear screen in Java? For example in C++
system("CLS");
What code is used in Java for clear screen?
Thanks!..
Is it possible, using CSS only, to make the background of an element semi-transparent but have the content (text & images) of the element opaque?
I'd like to accomplish this without having the te..
I'm trying to delete images stored in internal storage. I've come up with this so far:
File dir = getFilesDir();
File file = new File(dir, id+".jpg");
boolean deleted = file.delete();
And this is f..
How can I make a frame in Tkinter display in fullscreen mode? I saw this code, and it's very useful…:
>>> import Tkinter
>>> root = Tkinter.Tk()
>>> root.overrideredirect..
On Android, I have a WebView that is displaying a page.
How do I get the page source without requesting the page again?
It seems WebView should have some kind of getPageSource() method that returns ..
This is iframe code of google translate.
<div id="contentframe" style="top: 160px; left: 0px;">
<iframe src="/translate_p?hl=en&ie=UTF8&prev=_t&sl=auto&tl=en&..
Is there a way to not have a newline inserted before a div without using float: left on the previous element?
Maybe some tag on the div that will just put it to the right?..
I am working with an Oracle database that stores HTML as a Long datatype. I would like to query the database to search for a specific string within the HTML data stored in the Long.
I tried, "sele..
I am preparing a presentation using Google Slides, though I can also work on the presentation within Open Office that will include code snippets.
Is there any easy way to perform basic syntax highli..
I know that I can test for a JavaScript variable and then define it if it is undefined, but is there not some way of saying
var setVariable = localStorage.getItem('value') || 0;
seems like a much cle..
I want to dynamically include a script tag in a webpage however I have no control of it's src so src="source.js" may look like this.
document.write('<script type="text/javascript">')
document.w..
I developed a dynamic web project in Eclipse.
I can access the app through my browser using the following URL:
http://localhost:8080/MyDynamicWebApp
I want to change the access URL to:
http://lo..
I am trying to get values from the following text. How can this be done with Regex?
Input
Lorem ipsum dolor sit %download%#456 amet, consectetur adipiscing %download%#3434 elit. Duis non nunc nec..
I need to write a simple function that takes a URL and processes the response which is XML or JSON, I have checked the Sun website https://swingx-ws.dev.java.net/servlets/ProjectDocumentList , but the..
Android Studio 0.4.2 was working fine and today I opened it and almost everything was red and the auto-completion had stopped working. I look at the imports and AS seems to be telling me it can't find..
if I have two schemas like:
var userSchema = new Schema({
twittername: String,
twitterID: Number,
displayName: String,
profilePic: String,
});
var User = mongoose.model('User')
v..
I'm trying to exclude several folders on the "Explore" tab in Visual Studio Code. To do that I have added a following jsconfig.json to the root of my project:
{
"compilerOptions": {
"targ..
So, I'm testing a component that relies on an event-emitter. To do so I came up with a solution using Promises with Mocha+Chai:
it('should transition with the correct event', (done) => {
const cF..
I just want to hide rows in SSRS report having Zero Quantity..
There are following multiple Quantity Columns like Opening Stock , Gross Dispatched,Transfer Out, Qty Sold, Stock Adjustment and Closing ..
I'd like to create a shape that's like the following image:
Notice the top half gradients from color 1 to color 2, but theres a bottom half that gradients from color 3 to color 4. I know how to ma..
I've been using Dependency Injection (DI) for a while, injecting either in a constructor, property, or method. I've never felt a need to use an Inversion of Control (IoC) container. However, the mor..
I've been trying to open a file and output text, but I keep getting errors. So I thought I would start at the very beginning and just try opening the file. This is my code:
#include <stdio.h>..
i want move up the object, delay 1000ms , then hide it,
i get the code:
$("#test").animate({"top":"-=80px"},1500)
.animate({"top":"-=0px"},1000)
.animate({"opacity":"0"},500);
i use "...
From the documentation I see it's possible to create a laravel project
via laravel installer:
$laravel new blog
or via composer:
$composer create-project laravel/laravel --prefer-dist
If I try t..
CentOS 7 EPEL now includes Python 3.4: yum install python34
However, when I try that, even though Python 3.4 installs successfully, it doesn't appear to install pip. Which is weird, because pip shoul..
It seems like this should be a simple task, with the options in the Preferences menu for different JREs and the ability to set different compiler and build paths per project. However, it also seems to..
Hi I am trying to check the variable is already set or not using blade version. But the raw php is working but the blade version is not. Any help?
controller:
public function viewRegistrationForm()
..
For python 3.2 I used sudo apt-get install python3.2-numpy.It worked.
What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc.
Thanks.
Edit: this is how it looks like
radu..
I've been given to understand that Python is an interpreted language...
However, when I look at my Python source code I see .pyc files, which Windows identifies as "Compiled Python Files".
Where ..
Some elements in my array are empty strings based on what the user has submitted. I need to remove those elements. I have this:
foreach($linksArray as $link)
{
if($link == '')
{
unset..
I am a nodejs programmer . Now I have a table of data that I want to save in Excel File format . How do I go about doing this ?
I found a few Node libraries . But most of them are Excel Parsers rath..
I have the following dataframe:
Date abc xyz
01-Jun-13 100 200
03-Jun-13 -20 50
15-Aug-13 40 -5
20-Jan-14 25 15
21-Feb-14 60 80
I need to group the data by yea..
I have seen this question a lot both on SO and the Web. But none of them has been what I am looking for.
How do I add a color-overlay to a background image using CSS only?
Example HTML:
<div cla..
I have the following code in the controller.js,
var myApp = angular.module('myApp',[]);
myApp.service('dataService', function($http) {
delete $http.defaults.headers.common['X-Requested-With'];
this..
How to increase browser zoom level on page load?
here is my web link recently i got the task to increase its width just like if Firefox we press Ctrl + and browser zoom level is increases is there an..
In this boxplot we can see the mean but how can we have also the number value on the plot for every mean of every box plot?
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplo..
I have a simple if statement as such:
if ($('html').hasClass('m320')) {
// do stuff
}
This works as expected. However, I want to add more classes to the if statement to check if any of the class..
I am adding a whole new section to a website using Twitter Bootstrap 3, however the container cannot go wider than 940px in total for Desktop - as it will throw out the Header and Footer {includes}.
..
I have a pretty basic problem here, that has happened so haphazardly to me that up until now, I've just ignored it. I downloaded tomcat web server and "Murach's Java Servlets and JSP" book is telling ..
I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in multiple separate applications. I could add them to the applications' assemblies, but it's better i..
I am in the process of upgrading to MVC4. I have followed the instructions at http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806 but in my Razor views and layouts I have errors like
'S..
I keep getting the following error:
I have reinstalled, deleted and tried about EVERYTHING to get Genymotion to work again.
I do not have the device I need, but Genymotion was PERFECT for the job,..
I have a stored procedure that select * from book table , using sub query my query is
USE [library]
GO
/****** Object: StoredProcedure [dbo].[report_r_and_l] Script Date: 04/17/2013 12:42:39 **..
If I wish to store the current value of an iterator to compare to the next value of the iterator in a Reduce method, Hadoop requires that I clone it instead of simply assigning its reference to a temp..
I'm trying to write a custom servlet (for AJAX/JSON) in which I would like to reference my @ManagedBeans by name. I'm hoping to map:
http://host/app/myBean/myProperty
to:
@ManagedBean(name="myBean..
After I update my Docker version to 0.8.0, I get an error message while entering sudo docker version:
Client version: 0.8.0
Go version (client): go1.2
Git commit (client): cc3a8c8
2014/02/19 12:54:16..
I am new to Laravel. I just started it tonight. Actually, I have the following code:
'key' => env('APP_KEY', 'SomeRandomString'),
In xampp/htdocs/laravel/blog/config/app.php.
I want to change t..
How to change point size and shape and color in gnuplot.
plot "./points.dat" using 1:2 title with dots
I am using above command to plot graph ,but it shows very small size points.
I tried to use c..
I'm on a Mac running El Capitan. I have node v5.6.0 and npm v3.6.0.
When I try to run nodemon, I get:
-bash: nodemon: command not found
I thought this may mean that I didn't have nodemon installe..
Say we have a table 'data' containing Strings in several columns. We want to find the indices of all rows that contain a certain value, or better yet, one of several values. The column, however, is un..
I have two tables and I need to create a view. The tables are:
credit_orders(id, client_id, number_of_credits, payment_status)
credit_usage(id, client_id, credits_used, date)
I use the following qu..
Can Anyone tell me the difference between window.location.href and top.location.href ?
And also where to use which one.
And which one will be better when redirecting after an ajax call in mvc?..
I have looked on few articles and discussion like one here and Here about image resolutions that new iPhones will use @3x images for display. Is it true?
So does it mean we will have to keep three i..
How can I order by descending my query set in django by date?
Reserved.objects.all().filter(client=client_id).order_by('check_in')
I just want to filter from descending all the Reserved by check_in..
Is there an easy way to read a single char from the console as the user is typing it in Java? Is it possible? I've tried with these methods but they all wait for the user to press enter key:
char tmp..
How do I make \n actually work in my output? At the moment it just writes it all in 1 long block. Thanks for any help
Dir.chdir 'C:/Users/name/Music'
music = Dir['C:/Users/name/Music/*.{mp3, MP3}']
p..
I found an example for en/decoding strings in PHP. At first it looks very good but it wont work :-(
Does anyone know what the problem is?
$Pass = "Passwort";
$Clear = "Klartext";
$crypted = fnEncry..
i am using Django to create a user and an object when the user is created. But there is an error
__init__() got an unexpected keyword argument 'user'
when calling the register() function in view.py...
Is it possible to write a new line (NOT a paragraph) in the Bitbucket markdown?
Two new lines in the source creates one new paragraph. I only want a new line. And I don't want to use a code block...
Does it matter how many files I keep in a single directory? If so, how many files in a directory is too many, and what are the impacts of having too many files? (This is on a Linux server.)
Backgroun..
I would like to read data from the keyboard in python
I try this:
nb = input('Choose a number')
print ('Number%s \n' % (nb))
But it doesn't work, neither with eclipse nor in the terminal, it's alw..
In C++03, an expression is either an rvalue or an lvalue.
In C++11, an expression can be an:
rvalue
lvalue
xvalue
glvalue
prvalue
Two categories have become five categories.
What are these..
I have searched and read few post but my problem is not the same as described. So here's the issue: using git clone into folder under external partition of the disk works fine but all git commands fai..
I have the following problem: I would like to visualize a discrete and a continuous variable on a boxplot in which the latter has a few extreme high values. This makes the boxplot meaningless (the poi..
I make this call to a static singleton instance from the class GameManager.java.
HUD.getInstance().update(timeDelta);
HUD.java contains the HUD class as well as two other related classes, HUDTextEl..
I'm designing an HTML template for an email newsletter. I've learned that many email clients ignore linked stylesheets, and many others (including Gmail) ignore CSS block declarations altogether. Are ..
Possible Duplicate:
How do you get a timestamp in JavaScript?
Calculating milliseconds from epoch
How can I get the current epoch time in Javascript? Basically the number of milliseconds..
I've built a simple music player in Android. The view for each song contains a SeekBar, implemented like this:
public class Song extends Activity implements OnClickListener,Runnable {
private Se..
I have been trying to add background image to a div class using CSS, but I didn't have any success.
HTML code:
<header id="masthead" class="site-header" role="banner"&..
My flask application currently consists of a single test.py file with multiple routes and the main() route defined. Is there some way I could create a test2.py file that contains routes that were not ..
I'm trying to use laravel, when I start a project and type composer create-project /Applications/MAMP/htdocs/test_laravel in terminal it shows
[InvalidArgumentException] ..
New at Python and Numpy, trying to create 3-dimensional arrays. My problem is that the order of the dimensions are off compared to Matlab. In fact the order doesn't make sense at all.
Creating a matr..
I have setup the angular code on my local machine. I need to know the version of the angular that I am using in the project. how can I easily find it in cmd prompt?..
I haven't found something like setTag(String tagName) method in the Fragment class. The only way to set a Fragment tag that I have found is by doing a FragmentTransaction and passing a tag name as par..
I'm having a hard time trying to use .strip with the following line of code.
Thanks for the help.
f.write(re.split("Tech ID:|Name:|Account #:",line)[-1])
..
In jQuery you can get the top position relative to the parent as a number, but you can not get the css top value as a number if it was set in px.
Say I have the following:
#elem{
position:relative..
I have the following:
How do I get rid of the blue underline?
The code is below:
<Link to="first"><MenuItem style={{paddingLeft: 13, textDecoration: 'none'}}> Team 1 </MenuItem&g..
When embedding JavaScript in an HTML document, where is the proper place to put the <script> tags and included JavaScript? I seem to recall that you are not supposed to place these in the <he..
I've a form which I'm submitting (through GET as it is required this way) to a crm (ViciDial). I can successfully submit the form however if I do that the processing file at crm will just echo a succe..
I'll try to be as clear as possible, and I'll start by explaining why I want to transform two arrays into a matrix.
To plot the performance of a portfolio vs an market index I need a data structure l..
How do I set up the basic authorization using 64 encoded credentials ?
I tried below the two commands but of no use , please suggest.
curl -i -H 'Accept:application/json' Authorization:Basic <use..
Using Jinja2, how do I format a date field? I know in Python I can simply do this:
print(car.date_of_manufacture.strftime('%Y-%m-%d'))
But how do I format the date in Jinja2?..
I'd like to show the current language that the device UI is using. What code would I use?
I want this as an NSString in fully spelled out format. (Not @"en_US")
EDIT: For those driving on by, there..
This is my code to generate random numbers using a seed as an argument:
double randomGenerator(long seed) {
Random generator = new Random(seed);
double num = generator.nextDouble() * (0.5);
..
In my application I have a single EditText together with some TextViews, button and a spinner. My EditText receives focus since it is the only focusable view in this activity, I believe. My EditText s..
I can't seem to figure out the Chrome debugging tool.
I have chrome version 21.0.1180.60 m.
Steps I took:
I pressed ctrl-shift-i to bring up the console.
Clicked on Sources then select the relevan..
I have a new SPA with a stateless authentication model using JWT. I am often asked to refer OAuth for authentication flows like asking me to send 'Bearer tokens' for every request instead of a simple ..
Is it possible to create a dictionary comprehension in Python (for the keys)?
Without list comprehensions, you can use something like this:
l = []
for n in range(1, 11):
l.append(n)
We can sho..
I have installed rewrite_module and modified php.ini on Apache.
I create rewrite.php and .htaccess files, but it's not working.
My filesystem folders like:
/var/www/html
/var/www/html/test
/var/www..
Apologies for the code dump:
gameObject.cpp:
#include "gameObject.h"
class gameObject
{
private:
int x;
int y;
public:
gameObject()
{
x = 0;
y = 0;
}
gameObj..
I am working with Spring 3 and RestTemplate. I have basically, two applications and one of them have to post values to the other app. through rest template.
When the values to post are Strings, it's..
So I'm trying to make a very basic node.js server that with take in a request for a string, randomly select one from an array and return the selected string. Unfortunately I'm running into a few prob..
I have an HTML page from page builder, and it injects style attribute directly to the element. I found it's considered as element.style.
I want to override it using CSS. I can match the element, but ..
Does anyone know why CGContextDrawImage would be drawing my image upside down? I am loading an image in from my application:
UIImage *image = [UIImage imageNamed:@"testImage.png"];
And then simply ..
I've been trying for two days to find a way to set the maximum value of the yAxis on Highcharts.
I got a percentage column graphic, but the highest value in the series is 60, so it adjusts the axis t..
How can we center a popup window opened via javascript window.open function on the center of screen variable to the currently selected screen resolution ?..
How to select row number in postgres.
I tried this:
select
row_number() over (ORDER BY cgcode_odc_mapping_id)as rownum,
cgcode_odc_mapping_id
from access_odc.access_odc_mapping_tb
order by..
I'm having some troubles with a slideshow I'm building.
I've created 2 animations in xml for fade in and fade out:
fadein.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:a..
I have the following code that changes the pages from within JavaScript:
var newUrl = [some code to build up URL string];
window.location.replace(newUrl);
But it doesn't change the top URL, so when..
What do the following terms mean?
SaaS
PaaS
IaaS?
There are various cloud services available today, such as Amazon's EC2 and AWS, Apache Hadoop, Microsoft Azure and many others. Which category do..
I'm looking to accept digits and the decimal point, but no sign.
I've looked at samples using the NumericUpDown control for Windows Forms, and this sample of a NumericUpDown custom control from Micro..
Whenever a question pops up on SO about Java synchronization, some people are very eager to point out that synchronized(this) should be avoided. Instead, they claim, a lock on a private reference is t..
I want to write a Spring Data JPA repository interface method signature that will let me find entities with a property of an embedded object in that entity. Does anyone know if this is possible, and i..
I am trying to add a progress/loading bar to my application that uses WebView. I am confused on how to implement a progress bar that appears every time a link is clicked.
Current code:
public class ..
Is it possible to read the raw HTML content of a web page that has been loaded into a UIWebView?
If not, is there another way to pull raw HTML content from a web page in the iPhone SDK (such as an eq..
I want to get the new created ID when you insert a new record in table.
I read this: http://msdn.microsoft.com/en-us/library/ms177564.aspx but it needs to create temporary table.
I want to return th..
Here I need to calculate the difference of the two dates in the PostgreSQL.
In SQL Server: Like we do in SQL Server its much easier.
DATEDIFF(Day, MIN(joindate), MAX(joindate)) AS DateDifference;..
I have a string that I load throughout my application, and it changes from numbers to letters and such. I have a simple if statement to see if it contains letters or numbers but, something isn't quite..
I have an application that manage collections of books (like playlists).
I want to display a list of collection with a vertical RecyclerView and inside each row, a list of book in an horizontal Recyc..
Right now, I have to use df.count > 0 to check if the DataFrame is empty or not. But it is kind of inefficient. Is there any better way to do that?
Thanks.
PS: I want to check if it's empty so th..
So, I have the following:
std::vector< std::vector <int> > fog;
and I am initializing it very naively like:
for(int i=0; i<A_NUMBER; i++)
{
std::vector <int&g..
I want to know how and when can I use the exit() function like the program in my book:
#include<stdio.h>
void main()
{
int goals;
printf("enter number of goals scored");
scanf("%d"..
I am really interested in how MySQL indexes work, more specifically, how can they return the data requested without scanning the entire table?
It's off-topic, I know, but if there is someone who coul..
I have a textbox. Is there a way where the highest value the user can enter is 100 and the lowest is 0?
So if the user types in a number more than 100 then it will automatically change the value to 1..
I have two doubles like the following
double min = 100;
double max = 101;
and with a random generator, I need to create a double value between the range of min and max.
Random r = new Random();
r...
I just upgraded from Yosemite to El Capitan (and replicated the problem upgrading from El Capitan to Sierra), and when I try to type for example git status inside a terminal, I get the following error..
For a web page that exists, but for which a user does not have sufficient privileges (they are not logged in or do not belong to the proper user group), what is the proper HTTP response to serve?
401..
I'm currently learning some android for a school project and I can't figure out the way to set text dynamically to a TextView.
Here is my code:
protected void onCreate(Bundle savedInstanceState) {
..
I've looked at various Q&As on SO similar to this question but haven't found a solution.
What I have is an enum which represents different ways to view a TV Guide...
In the NDroid Application cl..
I'm having a similar issue to The current transaction cannot be committed and cannot support operations that write to the log file, but I have a follow-up question.
The answer there references Using ..
Can someone advise me on how to create a user in Oracle 11g and only grant that user the ability only to execute one particular stored procedure and the tables in that procedure.
I am not really sure..
I want to get the selected label or value of a drop down using Selenium WebDriver and then print it on the console.
I am able to select any value from the drop down, but I am not able to retrieve the..
Possible Duplicate:
source code of c/c++ functions
I was wondering where I can find the C code that's used so that when I write printf("Hello World!"); in my C programm to know that it has ..
I am trying to write a stored procedure in MySQL which will perform a somewhat simple select query, and then loop over the results in order to decide whether to perform additional queries, data transf..
I have a funny effect using migration (EF 5.0) and code-first:
I created some models with GUID primary keys. (BTW: It is important for me, that SQL Server uses NEWSEQUENTIALID(), which seems to be th..
This is a button selector such that when normal it appears red, when pressed it appears grey.
I would like to ask how could the code be further directly modified such that when PRESSED the text size ..
Section 6.3 of the TypeScript language spec talks about function overloading and gives concrete examples on how to implement this. However if I try something like this:
export class LayerFactory {
..
Is there a way to change the color of a button, or at least the color of the button label programmatically?
I can change the label itself with
document.getElementById("button").object.textElement.in..
>>> range(1,11)
gives you
[1,2,3,4,5,6,7,8,9,10]
Why not 1-11?
Did they just decide to do it like that at random or does it have some value I am not seeing?..
UPDATE CattleProds
SET SheepTherapy=(ROUND((RAND()* 10000),0))
WHERE SheepTherapy IS NULL
If I then do a SELECT I see that my random number is identical in every row. Any ideas how to generate uniqu..
I'm getting this error while loading a Puppet image from a Oracle virtual box. How can I fix it?
Failed to open a session for the virtual machine learn-puppet-centos-6.4-pe-3.1.0.
VT-x is disabled i..
I have a MS SQL 2005 database with a table Test with column ID. ID is an identity column.
I have rows in this table and all of them have their corresponding ID auto incremented value.
Now I would l..
I have a dataframe generated from Python's Pandas package. How can I generate heatmap using DataFrame from pandas package.
import numpy as np
from pandas import *
Index= ['aaa','bbb','ccc','ddd',..
I've always thought of git reset and git checkout as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redu..
I am using Python 2.5. And using the standard classes from Python, I want to determine the image size of a file.
I've heard PIL (Python Image Library), but it requires installation to work.
How migh..
This question also has the answer, but it mentions DB2 specifically.
How do I search for a string using LIKE that already has a percent % symbol in it? The LIKE operator uses % symbols to signify wil..
Do you think it is a good practice to commit .gitignore into a Git repo?
Some people don't like it, but I think it is good as you can track the file's history. Isn't it?..
I am using prepared statements to execute mysql database queries. And I want to implement a search functionality based on a keyword of sorts.
For that I need to use LIKE keyword, that much I know. A..
Why isn't ngOnInit() called when an Injectable class is resolved?
Code
import {Injectable, OnInit} from 'angular2/core';
import { RestApiService, RestRequest } from './rest-api.service';
@Injectabl..
I want to add a new folder to my newly created GitHub repository without installing the Git setup for (Mac, Linux, and Windows). Is it possible to do so?
I can't have Git all the time with me when I ..
When using iostream in C++ on Linux, it displays the program output in the terminal, but in Windows, it just saves the output to a stdout.txt file. How can I, in Windows, make the output appear in the..
I'm new on cordova, so if my question is not relevant, forgive me.
i have a cordova project in my Windows 7 x64 machine.
Yesterday i was build my cordova app via cordova build android --release.
But i..
I just got this exception (ProtocolViolationException) in my .NET 2.0 app (running on windows mobile 6 standard emulator). What confuses me is that as far as i know, I have not added any content body..
I know there's plenty of questions related to this error and I've checked most of them and none help me solve my issue. (Which seems so easy to debug...)
I have an array (which is empty aat first):
..
After answering a question about how to force-free objects in Java (the guy was clearing a 1.5GB HashMap) with System.gc(), I was told it's bad practice to call System.gc() manually, but the comments ..
At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file.
Are there tool or libraries that we can us..
Is there an easy way to verify that an object belongs to a given class? For example, I could do
if(a.getClass() = (new MyClass()).getClass())
{
//do something
}
but this requires instantiating ..
I'm following the tutorial from the HeadFirst Python book. In chapter 7, I get an error message when trying to run the next code:
Athlete class:
class AthleteList(list):
def __init__(self, a_nam..
How can I jump to to a function definition using vim? For example with Visual Assist, I can type Alt+g under a function and it opens a context menu listing the files with definitions.
How can I do so..
I'm not able to access values in configuration file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var clientsFilePath = config.AppSettings.Settings["..
I am using Ansible 2.1. I have the following inventory host file and a role being called by a play that needs access to the host file variable. Any thoughts on how to access it (currently getting an..
I'm trying to assign the output of a command to a variable - as in, I'm trying to set the current flash version to a variable. I know this is wrong, but this is what I've tried:
set var=reg query hkl..
I installed java and set path to environment and when I execute echo $JAVA_HOME I get the following output:
/usr/lib/jvm/java-7-oracle/jre/bin/java
I Also installed apache-maven and changed environ..
My apologies if this is a very simple question, but how do you use google material icons without a
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
?
..
In React Native, borderRadius is working but the background color given to the button stays a square. What is going on here?
JS
<TouchableHighlight
style={styles.submit}
onPress={() => thi..
I am using Authlogic-Connect for third party logins. After running appropriate migrations, Twitter/Google/yahoo logins seem to work fine but the facebook login throws exception:
SSL_connect returned=..
Executing docker version command on Windows returns the following results:
C:\Projects> docker version
Client:
Version: 1.13.0-dev
API version: 1.25
Go version: go1.7.3
Git commit: d8..
I am implementing Kosaraju's Strong Connected Component(SCC) graph search algorithm in Python.
The program runs great on small data set, but when I run it on a super-large graph (more than 800,000 no..
I'm writing a C Shell program that will be doing su or sudo or ssh. They all want their passwords in console input (the TTY) rather than stdin or the command line.
Does anybody know a solution?
Sett..
Design an OO parking lot. What classes and functions will it have. It should say, full, empty and also be able to find spot for Valet parking. The lot has 3 different types of parking: regular, handic..
I noticed that when using SimpleXMLElement on a document that contains those CDATA tags, the content is always NULL. How do I fix this?
Also, sorry for spamming about XML here. I have been trying to ..
Every time I have to iterate over a collection I end up checking for null, just before the iteration of the for-each loop starts. Like this:
if( list1 != null ){
for(Object obj : list1){
}
}..
I'm using fetch API within my React app. The application was deployed on a server and was working perfectly. I tested it multiple times. But, suddenly the application stopped working and I've no clue ..