Questions Tagged with #Denial of service

Denial-of-service (or DoS) is the intentional attack of a machine or resource, aiming to make unavailable to its intended users, often by overloading it with artificially crafted requests.

select data up to a space?

I have an MSSQL database field that looks like the examples below: u129 james u300 chris u300a jim u202 jane u5 brian u5z brian2 Is there a way to select the first set of characters? Basic..

Delete/Reset all entries in Core Data?

Do you know of any way to delete all of the entries stored in Core Data? My schema should stay the same; I just want to reset it to blank. Edit I'm looking to do this programmatically so that a us..

jQuery Selector: Id Ends With?

Is there a selector that I can query for elements with an ID that ends with a given string? Say I have a element with an id of ctl00$ContentBody$txtTitle. How can I get this by passing just txtTitle..

count distinct values in spreadsheet

I have a Google spreadsheet with a column that looks like this: City ---- London Paris London Berlin Rome Paris I want to count the appearances of each distinct city (so I need the city name and th..

How to insert a character in a string at a certain position?

I'm getting in an int with a 6 digit value. I want to display it as a String with a decimal point (.) at 2 digits from the end of int. I wanted to use a float but was suggested to use String for a bet..

Convert IQueryable<> type object to List<T> type?

I have IQueryable<> object. I want to Convert it into List<> with selected columns like new { ID = s.ID, Name = s.Name }. Edited Marc you are absolutely right! but I have only access t..

How can I update a single row in a ListView?

I have a ListView which displays news items. They contain an image, a title and some text. The image is loaded in a separate thread (with a queue and all) and when the image is downloaded, I now call ..

Oracle Age calculation from Date of birth and Today

I want to calculate the current Age from Date of Birth in my Oracle function. What I am using is (Today-Dob)/30/12, but this is not accurate as some months have 31 days. I need to get the correct a..

Controlling fps with requestAnimationFrame?

It seems like requestAnimationFrame is the de facto way to animate things now. It worked pretty well for me for the most part, but right now I'm trying to do some canvas animations and I was wondering..

How to choose an AES encryption mode (CBC ECB CTR OCB CFB)?

Which of them are preferred in which circumstances? I'd like to see the list of evaluation crtieria for the various modes, and maybe a discussion of the applicability of each criterion. For exampl..

Adding a column to an existing table in a Rails migration

I have a Users model which needs an :email column (I forgot to add that column during the initial scaffold). I opened the migration file and added t.string :email, did rake db:migrate, and got a No..

How to kill a process running on particular port in Linux?

I tried to close the tomcat using ./shutdown.sh from tomcat /bin directory. But found that the server was not closed properly. And thus I was unable to restartMy tomcat is running on port 8080. I wan..

Hibernate error: ids for this class must be manually assigned before calling save():

Caused by: org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.rfid.model.Role; nested exception is org.hibernate.id.I..

In Git, how do I figure out what my current revision is?

I just want to know what my current version number is...

Remove leading and trailing spaces?

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]) ..

How I can check whether a page is loaded completely or not in web driver?

I am writing some Java Webdriver code to automate my application. How can I correctly check whether the page has been loaded or not? The application has some Ajax calls, too. I have declared an impli..

Could not instantiate mail function. Why this error occurring

When I'm trying to send mail through PHPMailer, i'm getting this error message. My code is below: <? require("phpmailer/class.phpmailer.php"); // First we require the PHPMailer libary in our scrip..

Python: convert string from UTF-8 to Latin-1

I feel stacked here trying to change encodings with Python 2.5 I have XML response, which I encode to UTF-8: response.encode('utf-8'). That is fine, but the program which uses this info doesn't like ..

how to pass this element to javascript onclick function and add a class to that clicked element

I had an html navigation code as below _x000D_ _x000D_ function Data(string) { //1. get some data from server according to month year etc., //2. unactive all the remaining li's and make the curren..

Differences between Ant and Maven

Could someone tell me the differences between Ant and Maven? I have never used either. I understand that they are used to automate the building of Java projects, but I do not know where to start from...

How can I verify a Google authentication API access token?

How can I verify a Google authentication access token? I need to somehow query Google and ask: Is [given access token] valid for the [[email protected]] Google account? Short version: It's clear h..

how to set ASPNETCORE_ENVIRONMENT to be considered for publishing an asp.net core application?

when i publish my asp.net core web application to my local file system, it always takes the production-config and the ASPNETCORE_ENVIRONMENT variable with the value = "Production". how and where do i..

Changing capitalization of filenames in Git

I am trying to rename a file to have different capitalization from what it had before: git mv src/collision/b2AABB.js src/collision/B2AABB.js fatal: destination exists, source=src/collision/b2AABB.js..

C# Creating an array of arrays

I'm trying to create an array of arrays that will be using repeated data, something like below: int[] list1 = new int[4] { 1, 2, 3, 4 }; int[] list2 = new int[4] { 5, 6, 7, 8 }; int[] list3 = new int..

How do you revert to a specific tag in Git?

I know how to revert to older commits in a Git branch, but how do I revert back to a branch's state dictated by a tag? I envision something like this: git revert -bytag "Version 1.0 Revision 1.5" I..

C# ASP.NET Send Email via TLS

In order to comply with HIPAA regulations, we need to send email from an external site (outside the firewall) to an internal Exchange server (inside the firewall). Our Exchange admins tell us we need ..

How do I get the last day of a month?

How can I find the last day of the month in C#? For example, if I have the date 03/08/1980, how do I get the last day of month 8 (in this case 31)?..

How can an html element fill out 100% of the remaining screen height, using css only?

I have a header element and a content element: #header #content I want the header to be of fixed height and the content to fill up all the remaining height available on the screen, with overflow-y:..

How to print the data in byte array as characters?

In my byte array I have the hash values of a message which consists of some negative values and also positive values. Positive values are being printed easily by using the (char)byte[i] statement. Now..

Prevent div from moving while resizing the page

I'm quite new to CSS and I'm trying to get a page up and running. I managed to successfully produce what I thought was a nice page until I resized the browser window then everything started to move ar..

What does "opt" mean (as in the "opt" directory)? Is it an abbreviation?

What does "opt" mean (as in the "opt" directory)? I commonly see this directory in Unix systems with development tools inside. Is it an abbreviation?..

SQL where datetime column equals today's date?

How can I get the records from a db where created date is today's date? SELECT [Title], [Firstname], [Surname], [Company_name], [Interest] FROM [dbo].[EXTRANET_users] WHERE DATE(Submission_date) = ..

How to put table in the center of the page using CSS?

I am using the following code. How to put this table in the center of the page using CSS? <html> <head> <link rel="stylesheet" type="text/css" href="..

How can I show a message box with two buttons?

How can I show a message box with two buttons (For example: "on", "off")?..

How to remove title bar from the android activity?

Can someone please help me with the issue.I want my activity as full screen and want to remove title from the screen.I have tried several ways but not able to remove it. Activity Code : public clas..

What does 'var that = this;' mean in JavaScript?

In a JavaScript file I saw: function Somefunction(){ var that = this; ... } What is the purpose of declaring that and assigning this this to it? ..

phpinfo() - is there an easy way for seeing it?

Each time I want to see the phpinfo(); I have to: Create a info.php file; Write phpinfo(); in it. Go to the browser and type my "thisproject.dev/info.php" I'm on Ubuntu. Isn't there a more practi..

Multiple returns from a function

Is it possible to have a function with two returns like this: function test($testvar) { // Do something return $var1; return $var2; } If so, how would I be able to get each return separately..

How to capture the android device screen content?

Possible Duplicate: How to programatically take a screenshot on Android? How to capture the android device screen content and make an image file using the snapshot data? Which API should I..

Pass table as parameter into sql server UDF

I'd like to pass a table as a parameter into a scaler UDF. I'd also prefer to restrict the parameter to tables with only one column. (optional) Is this possible? EDIT I don't want to pass a table..

How do you run JavaScript script through the Terminal?

For instance, if you were to run a Python script you would type python filename.py or if you wanted to run a C program make filename then ./ filename. How do you do this with .js files?..

Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone

You can use the function tz_localize to make a Timestamp or DateTimeIndex timezone aware, but how can you do the opposite: how can you convert a timezone aware Timestamp to a naive one, while preservi..

How to convert an int array to String with toString method in Java

I am using trying to use the toString(int[]) method, but I think I am doing it wrong: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Arrays.html#toString(int[]) My code: int[] array = new i..

Sending email with gmail smtp with codeigniter email library

<?php class Email extends Controller { function Email() { parent::Controller(); $this->load->library('email'); } function index() { $config['p..

Conditional Logic on Pandas DataFrame

How to apply conditional logic to a Pandas DataFrame. See DataFrame shown below, data desired_output 0 1 False 1 2 False 2 3 True 3 4 True ..

Resetting MySQL Root Password with XAMPP on Localhost

So for the past hour I've been trying to figure out how to reset my 'root' password for MySQL as I cannot log into PHPMyAdmin. I've tried changing the password in the config.inc.php file and searching..

How to add a recyclerView inside another recyclerView

I'm planning to develop an app that shows some dynamic data inside a recyclerCardView. So i decided add a recyclerView called CheckBoxRecyclerView inside my main recyclerView. This is my code for my a..

internet explorer 10 - how to apply grayscale filter?

This CSS code works pretty nice for Internet Explorer until 9. img.gray { filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><f..

How to delete an element from an array in C#

Lets say I have this array, int[] numbers = {1, 3, 4, 9, 2}; How can I delete an element by "name"? , lets say number 4? Even ArrayList didn't help to delete? string strNumbers = " 1, 3, 4, 9, 2"..

How to dismiss notification after action has been clicked

Since API level 16 (Jelly Bean), there is the possibility to add actions to a notification with builder.addAction(iconId, title, intent); But when I add an action to a notification and the action i..

Undo a Git merge that hasn't been pushed yet

Within my master branch, I did a git merge some-other-branch locally, but never pushed the changes to origin master. I didn't mean to merge, so I'd like to undo it. When doing a git status after my me..

Content is not allowed in Prolog SAXParserException

I am trying to call a web service but facing a strange behavior. we have a web-service running on my server but the code is not open to us so can not see what going on behind the wall The owner of the..

best way to get the key of a key/value javascript object

If I have a JS object like: var foo = { 'bar' : 'baz' } If I know that foo has that basic key/value structure, but don't know the name of the key, what's the easiest way to get it? for ... in? $.ea..

The cast to value type 'Int32' failed because the materialized value is null

I have the following code. I'm getting error: "The cast to value type 'Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nul..

Docker: How to delete all local Docker images

I recently started using Docker and never realized that I should use docker-compose down instead of ctrl-c or docker-compose stop to get rid of my experiments. I now have a large number of unneeded do..

How do you round UP a number in Python?

This problem is killing me. How does one roundup a number UP in Python? I tried round(number) but it round the number down. Example: round(2.3) = 2.0 and not 3, what I would like The I tried int(n..

jQuery Scroll to Div

I am making an FAQ page and have buttons across the top to jump to a category (it jumps to the p tag that I use as the category label, ex. <p id="general"> for my general category). Instead of j..

How to use a variable for a key in a JavaScript object literal?

Why does the following work? <something>.stop().animate( { 'top' : 10 }, 10 ); Whereas this doesn't work: var thetop = 'top'; <something>.stop().animate( { thetop : 10 }, 10 );..

Ubuntu: OpenJDK 8 - Unable to locate package

So I just installed Ubuntu, and this is my first time working in a Linux environment, so bear with my noobishness here. Anyway, I downloaded the Java 8 JDK directly from Oracle, but I understand ther..

Convert a Unicode string to an escaped ASCII string

How can I convert this string: This string contains the Unicode character Pi(p) into an escaped ASCII string: This string contains the Unicode character Pi(\u03a0) and vice versa? The curren..

Multiple INNER JOIN SQL ACCESS

Syntax Error (missing Operator) in query expression 'tbl_employee.emp_id = tbl_netpay.emp_id INNER JOIN tbl_gross ON tbl_employee.emp_id = tbl_gross.emp_ID INNER JOIN tbl_tax ON tbl_employee.emp_id - ..

'' is not recognized as an internal or external command, operable program or batch file

Whenever I try and run mycommand.exe from my windows cmd.exe terminal, I get this error: ''mycommand.exe' is not recognized as an internal or external command, operable program or batch file' Th..

Keep only date part when using pandas.to_datetime

I use pandas.to_datetime to parse the dates in my data. Pandas by default represents the dates with datetime64[ns] even though the dates are all daily only. I wonder whether there is an elegant/clever..

Convert the first element of an array to a string in PHP

I have a PHP array and want to convert it to a string. I know I can use join or implode, but in my case array has only one item. Why do I have to use combine values in an array with only one item? ..

how to use free cloud database with android app?

I am developing an Google maps android application in which I want to use database in cloud for saving usernames, passwords, GPS Locations etc. Can any option to achieve this with free of cost ? If t..

Select distinct values from a list using LINQ in C#

I have a collection of Employee Class Employee { empName empID empLoc empPL empShift } My list contains empName,empID,empLoc,empPL,empShift E1,1,L1,EPL1,S1 E2,2,L2,EPL2,S2 ..

Installing tensorflow with anaconda in windows

I have installed Anaconda on Windows 64 bit. I have downloaded PyCharm for creating a project and in the terminal of PyCharm I have installed numpy, scipy, matplotlib using the following commands: co..

How to hide close button in WPF window?

I'm writing a modal dialog in WPF. How do I set a WPF window to not have a close button? I'd still like for its WindowState to have a normal title bar. I found ResizeMode, WindowState, and WindowStyl..

How to compare different branches in Visual Studio Code

How do I compare different branches in Visual Studio Code 1.9? Is it possible?..

Align Bootstrap Navigation to Center

I'm having a problem with bootstrap 3 navigation, i have some content on the left, center and right. it seems there is no option for centering the navigation. http://jsfiddle.net/29tQt/embedded/resul..

How to iterate for loop in reverse order in swift?

When I use the for loop in Playground, everything worked fine, until I changed the first parameter of for loop to be the highest value. (iterated in descending order) Is this a bug? Did any one else ..

Java Class.cast() vs. cast operator

Having being taught during my C++ days about evils of the C-style cast operator I was pleased at first to find that in Java 5 java.lang.Class had acquired a cast method. I thought that finally we hav..

How to convert byte array to string and vice versa?

I have to convert a byte array to string in Android, but my byte array contains negative values. If I convert that string again to byte array, values I am getting are different from original byte arr..

How to get file creation date/time in Bash/Debian?

I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time. ls -lh a.txt and stat -c %y a.txt both only give the modification time...

The model backing the 'ApplicationDbContext' context has changed since the database was created

First of all, I have not seen this error anywhere else and I guess it's not a replicate so please read the whole situation first. Everything was working just fine then I tried to update one of my mod..

What does the 'b' character do in front of a string literal?

Apparently, the following is the valid syntax: my_string = b'The string' I would like to know: What does this b character in front of the string mean? What are the effects of using it? What are a..

fcntl substitute on Windows

I received a Python project (which happens to be a Django project, if that matters,) that uses the fcntl module from the standard library, which seems to be available only on Linux. When I try to run ..

Textfield with only bottom border

How can I create a Text field that has a transparent or no background, no top,left and right border? I am only using CSS and HTML...

How to connect to MySQL Database?

New to C# programming, I'd like to be able to access MySQL Databases. I know MySQL connector/NET and MySQL for Visual Studio are required for C# development. Do I need to install them into my app? ..

How to source virtualenv activate in a Bash script

How do you create a Bash script to activate a Python virtualenv? I have a directory structure like: .env bin activate ...other virtualenv files... src shell.sh ...my code..

Convert Json string to Json object in Swift 4

I try to convert JSON string to a JSON object but after JSONSerialization the output is nil in JSON. Response String: [{\"form_id\":3465,\"canonical_name\":\"df_SAWERQ\",\"form_name\":\"Activity 4 w..

Compute elapsed time

I am looking for some JavaScript simple samples to compute elapsed time. My scenario is, for a specific point of execution in JavaScript code, I want to record a start time. And at another specific po..

List all the files and folders in a Directory with PHP recursive function

I'm trying to go through all of the files in a directory, and if there is a directory, go through all of its files and so on until there are no more directories to go to. Each and every processed item..

Custom alert and confirm box in jquery

Is there any alert and confirm dialog available in jquery with custom title and custom content in it. I have searched many sites but cannot find appropriate. Any site link or any content are appreciab..

HTML/CSS--Creating a banner/header

I've got a horizontal image as a GIF and JPG. It is something I made with Paint--a text logo with an image on a solid background. I am having a lot of trouble trying to get it to display as a banner/..

Remove object from a list of objects in python

In Python, how can I remove an object from array of objects? Like this: x = object() y = object() array = [x,y] # Remove x I've tried array.remove() but it only works with a value, not a specific l..

How to filter wireshark to see only dns queries that are sent/received from/by my computer?

I am new to wireshark and trying to write simple queries. To see the dns queries that are only sent from my computer or received by my computer, i tried the following: dns and ip.addr==159.25.78.7 ..

How to run an EXE file in PowerShell with parameters with spaces and quotes

How do you run the following command in PowerShell? C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="Data Source=mysource;Integrated Security=false;User ID=sa;P..

Android EditText for password with android:hint

Just noticed that android:password has been deprecated, and we should be using android:inputType. Was experimenting with it by setting in my xml android:inputType="textPassword" Indeed it behaves..

Pass parameter to EventHandler

I have the following EventHandler to which I added a parameter MusicNote music: public void PlayMusicEvent(object sender, EventArgs e,MusicNote music) { music.player.Stop(); System.Timers.Tim..

Stop executing further code in Java

I have looked in the Javadoc but couldn't find information related to this. I want the application to stop executing a method if code in that method tells it to do so. If that sentence was confusing..

How to convert a DataTable to a string in C#?

I'm using Visual Studio 2005 and have a DataTable with two columns and some rows that I want to output to the console. I hoped there would be something like: DataTable results = MyMethod.GetResults()..

How to link to part of the same document in Markdown?

I am writing a large Markdown document and would like to place a table of contents of sorts at the beginning that will provide links to various locations in the document. How can I do this? I tried us..

What is console.log in jQuery?

What is console.log? What is it used for in jQuery?..

Postgres user does not exist?

I have just installed Postgres and have been tinkering with it and various configurations for 1-2 hours. I am stuck on being unable to change to the postgres-user $ su - postgres yields the followin..

How to run Java program in terminal with external library JAR

This should be simple but I have never done it before and didn't find any solution. I am currently using Eclipse to code my program, which imports some external JAR library such as google data api li..

HTML 5 Favicon - Support?

I was reading the Favicon page on Wikipedia. They mention the HTML 5 spec for Favicon: The current HTML5 specification recommends specifying size icons in multiple sizes using the attributes rel=..

Detecting installed programs via registry

I need to develop a process that will detect if the users computer has certain programs installed and if so, what version. I believe I will need a list with the registry location and keys to look for ..

Count number of rows within each group

I have a dataframe and I would like to count the number of rows within each group. I reguarly use the aggregate function to sum data as follows: df2 <- aggregate(x ~ Year + Month, data = df1, sum)..

How to cherry-pick from a remote branch?

I'm having trouble performing a cherry-pick. On my local machine, I'm currently on my "master" branch. I want to cherry-pick in a commit from another branch, named "zebra". The "zebra" branch is a rem..

Center content in responsive bootstrap navbar

I'm having trouble centering my content in the bootstrap navbar. I'm using bootstrap 3. I've read many posts, but the CSS or methods used will not work with my code! I'm really frustrated, so this is ..

How do I tell matplotlib that I am done with a plot?

The following code plots to two PostScript (.ps) files, but the second one contains both lines. import matplotlib import matplotlib.pyplot as plt import matplotlib.mlab as mlab plt.subplot(111) x = ..

Removing all unused references from a project in Visual Studio projects

I just wondered if it possible within various Visual Studio versions to automatically remove all references from a project that were never been used? In your answer, please specify which version of V..

How to render string with html tags in Angular 4+?

In my angular 4 app, I have a string like comment: string; comment = "<p><em><strong>abc</strong></em></p>"; When I serve this text in my html, like {{comment}}..

Automatically scroll down chat div

I have this code, to load chat function getMessages(letter) { var div = $('#messages'); $.get('msg_show.php', function (data) { div.html(data); }); } setInterval(getMessages, 100); What ..

How to call controller from the button click in asp.net MVC 4

Please i am working on MVC website, i have a Search page and another search form on index page. I want to call the the same search page controller when i click the search button from index page. Below..

What is the difference between pip and conda?

I know pip is a package manager for python packages. However, I saw the installation on IPython's website use conda to install IPython. Can I use pip to install IPython? Why should I use conda as ano..

How to stop java process gracefully?

How do I stop a Java process gracefully in Linux and Windows? When does Runtime.getRuntime().addShutdownHook get called, and when does it not? What about finalizers, do they help here? Can I send s..

"use database_name" command in PostgreSQL

I am beginner to PostgreSQL. I want to connect to another database from the query editor of Postgres - like the USE command of MySQL or MS SQL Server. I found \c databasename by searching the Inter..

Importing CommonCrypto in a Swift framework

How do you import CommonCrypto in a Swift framework for iOS? I understand how to use CommonCrypto in a Swift app: You add #import <CommonCrypto/CommonCrypto.h> to the bridging header. However,..

Is it possible to use jQuery .on and hover?

I have a <ul> that is populated with javascript after the initial page load. I'm currently using .bind with mouseover and mouseout. The project just updated to jQuery 1.7 so I have the option ..

Convert a JSON Object to Buffer and Buffer to JSON Object back

I have a JSON object and I'm converting it to a Buffer and doing some process here. Later I want to convert the same buffer data to convert to valid JSON object. I'm working on Node V6.9.1 Below is ..

where is create-react-app webpack config and files?

I create a ReactJS project with the create-react-app package and that worked well, but I cannot find webpack files and configurations. How does react-create-app work with webpack? Where are the webpa..

How to install libusb in Ubuntu

I have a C program that have #include part in the header. I have download libusb-1.0.0 to my computer. If I simply copy libusb-1.0.0 folder to the folder where my C program is, it will not work. The..

Cannot add or update a child row: a foreign key constraint fails

table 1 +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+--------..

How can you export the Visual Studio Code extension list?

I need to send all my installed extensions to my colleagues. How can I export them? The extension manager seems to do nothing... It won't install any extension...

Intersect Two Lists in C#

I have two lists: List<int> data1 = new List<int> {1,2,3,4,5}; List<string> data2 = new List<string>{"6","3"}; I want do to something like var newData = data1.intersec..

After Spring Boot 2.0 migration: jdbcUrl is required with driverClassName

SOLVED: My solution: I delete dataSource() method from DatabaseConfig.java. Then, the application was started successfully :) I've just updated my Spring Boot project from 1.5.x to 2.0.0. Before the ..

How/When does Execute Shell mark a build as failure in Jenkins?

The horror stories I found while searching for an answer for this one... OK, I have a .sh script which pretty much does everything Jenkins supposed to do: checks out sources from SVN build the proj..

Why can I not push_back a unique_ptr into a vector?

What is wrong with this program? #include <memory> #include <vector> int main() { std::vector<std::unique_ptr<int>> vec; int x(1); std::unique_ptr<int> ptr..

How to write ternary operator condition in jQuery?

In this fiddle http://jsfiddle.net/mjmitche/6nar4/3/, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be..

How to stick table header(thead) on top while scrolling down the table rows with fixed header(navbar) in bootstrap 3?

Bootstrap layout with fixed-navbar. Having table with so many rows in body. Issue? As i scroll the page navigation-bar will be there because it is fixed. as i scroll more i want table header to be fi..

View JSON file in Browser

It is not a programming question, but need your views in few words. When we hit the JSON url in Broswer, it asks us to save the file. Why this happens ? Is there any way to view it on the page its..

Swift - Remove " character from string

I have a string which is "Optional("5")". I need to remove the "" surrounding the 5. I have removed the 'Optional' by doing: text2 = text2.stringByReplacingOccurrencesOfString("Optional(", withStri..

Add string in a certain position in Python

Is there any function in Python that I can use to insert a value in a certain position of a string? Something like this: "3655879ACB6" then in position 4 add "-" to become "3655-879ACB6"..

Count immediate child div elements using jQuery

I have the following HTML node structure: <div id="foo"> <div id="bar"></div> <div id="baz"> <div id="biz"></div> </div> <span></span>..

SQL Server Text type vs. varchar data type

I have variable length character data and want to store in SQL Server (2005) database. I want to learn some best practices about how to choose TEXT SQL type or choose VARCHAR SQL type, pros and cons i..

DISABLE the Horizontal Scroll

Ok for some reason my webpage scrolls from left to right and shows a lot of ugly space. I have searched for results but they just made the scrollbar HIDDEN That's now what I want, I want to physic..

How do I use cx_freeze?

I've created my setup.py file as instructed but I don't actually.. understand what to do next. Typing "python setup.py build" into the command line just gets a syntax error. So, what do I do? setup...

Angular 2 @ViewChild annotation returns undefined

I am trying to learn Angular 2. I would like to access to a child component from a parent component using the @ViewChild Annotation. Here some lines of code: In BodyContent.ts I have: import {View..

How do I extract a substring from a string until the second space is encountered?

I have a string like this: "o1 1232.5467 1232.5467 1232.5467 1232.5467 1232.5467 1232.5467" How do I extract only "o1 1232.5467"? The number of characters to be extracted are not the same always. H..

How to display image from URL on Android

I want to display image on screen. Image should come from URL, and not drawable. Code is here: <ImageView android:id="@+id/ImageView01" android:src = "http://l.yimg.com/a/i/us/we/52/21.gif" a..

How to sum up an array of integers in C#

Is there a better shorter way than iterating over the array? int[] arr = new int[] { 1, 2, 3 }; int sum = 0; for (int i = 0; i < arr.Length; i++) { sum += arr[i]; } clarification: Better ..

python pandas convert index to datetime

How do i convert a pandas index of strings to datetime format my dataframe 'df' is like this value 2015-09-25 00:46 71.925000 2015-09-25 00:47 71.625000 2015-09-..

Eclipse jump to closing brace

What is the keyboard short cut in Eclipse to jump to the closing brace of a scope?..

Creating a node class in Java

So I'm fairly new to Java and programming and I was wondering how to create a node class? So far I have: public class ItemInfoNode{ private ItemInfoNode next; private ItemInfoNode prev; ..

What's the quickest way to multiply multiple cells by another number?

If I have a block of cells such as A1:D5, what's the quickest way of multiplying each cell by another number, 1.1 using Microsoft Excel?..

Netbeans installation doesn't find JDK

installing Netbeans 6.0.1 on my windows computer, I find this error: Even if I my enviroment variables seems to be ok, when executing: I rebooted my system, but the error persists. Does anybody k..

Setting individual axis limits with facet_wrap and scales = "free" in ggplot2

I'm creating a facetted plot to view predicted vs. actual values side by side with a plot of predicted value vs. residuals. I'll be using shiny to help explore the results of modeling efforts using d..

Can the Android layout folder contain subfolders?

Right now, I'm storing every XML layout file inside the 'res/layout' folder, so it is feasible and simple to manage small projects, but when there is a case of large and heavy projects, then there sho..

Rename all files in directory from $filename_h to $filename_half?

Dead simple. How do I rename 05_h.png 06_h.png to 05_half.png 06_half.png At least, I think it's simple, but it's hard to Google for this kind of thing unless you already know. Thanks......

Making HTML page zoom by default

I've designed a page, where buttons look good when the browser zoom is at 90%, but by default other users view it at 100/125%+ in their browser which is resulting an overlap in buttons and input forms..

send/post xml file using curl command line

How can I send/post an xml file to a local server http://localhost:8080 using curl from the command line? What command should I use?..

Are there .NET implementation of TLS 1.2?

Since I just discovered that RFC 5425 requires TLS 1.2 to be used, and that .NET doesn't yet support it, I wonder if there are any implementation, possibly open source, of TLS 1.2 protocol, as defined..

Google Maps API: open url by clicking on marker

I want to open a new window by clicking on a marker using Google Maps API 3. Unfortunately there are not many examples for the Google Maps API and I found out this code: google.maps.event.addListene..

How to get values of selected items in CheckBoxList with foreach in ASP.NET C#?

I have a CheckBoxList like this: <asp:CheckBoxList ID="CBLGold" runat="server" CssClass="cbl"> <asp:ListItem Value="TGJU"> TG </asp:ListItem> <asp:ListItem Value="GOLDOZ"..

Git undo local branch delete

I just deleted the wrong branch with some experimental changes I need with git branch -D branchName. How do I recover the branch?..

C - reading command line parameters

I have made little program for computing pi (p) as an integral. Now I am facing a question how to extend it to compute an integral, which will be given as an extra parameter when starting an applicati..

How do I change the value of a global variable inside of a function

I am using JavaScript and I create a global variable. I define it outside of a function and I want to change the global variable value from inside a function and use it from another function, how do I..

How to sort a list of strings numerically?

I know that this sounds trivial but I did not realize that the sort() function of Python was weird. I have a list of "numbers" that are actually in string form, so I first convert them to ints, then a..

How can I resize an image using Java?

I need to resize PNG, JPEG and GIF files. How can I do this using Java?..

How to check if Location Services are enabled?

I'm developing an app on Android OS. I don't know how to check if Location Services are enabled or not. I need a method that returns "true" if they are enabled and "false" if not (so in the last case..

Calling Java from Python

What is the best way to call java from python? (jython and RPC are not an option for me). I've heard of JCC: http://pypi.python.org/pypi/JCC/1.9 a C++ code generator for calling Java from C++/Python ..

How to subtract X days from a date using Java calendar?

Anyone know a simple way using Java calendar to subtract X days from a date? I have not been able to find any function which allows me to directly subtract X days from a date in Java. Can someone poi..

Create an array with same element repeated multiple times

In Python, where [2] is a list, the following code gives this output: [2] * 5 # Outputs: [2,2,2,2,2] Does there exist an easy way to do this with an array in JavaScript? I wrote the following func..

Jquery asp.net Button Click Event via ajax

I was wondering if anyone can point me in the right direction. I have an asp.net button with a click event (that runs some server side code). What i'd like to do is call this event via ajax and jquer..

Run PostgreSQL queries from the command line

I inserted a data into a table....I wanna see now whole table with rows and columns and data. How I can display it through command? ..

ImportError: cannot import name

I have two files app.py and mod_login.py app.py from flask import Flask from mod_login import mod_login app = Flask(__name__) app.config.update( USERNAME='admin', PASSWORD='default' ) mod..

Table row and column number in jQuery

How do I get the row and column number of the clicked table cell using jQuery, i.e., $("td").onClick(function(event){ var row = ... var col = ... }); ..

What exactly does a jar file contain?

As an intern, I use company code in my projects and they usually send me a jar file to work with. I add it to the build path in Eclipse and usually all is fine and dandy. However, I got curious to kn..

Insert variable values in the middle of a string

In C#: If I want to create a message like this: "Hi We have these flights for you: Flight A,B,C,D. Which one do you want" where just the section in bold is dynamic and I pass its value at run time, b..

How to stretch the background image to fill a div

I want to set a background image to different divs, but my problems are: The size of image is fixed(60px). Varying div's size How can I stretch the background-image to fill the whole backgrou..

How to set up fixed width for <td>?

Simple scheme: <tr class="something"> <td>A</td> <td>B</td> <td>C</td> <td>D</td> </tr> I need to set up a fixed widt..

Best method for reading newline delimited files and discarding the newlines?

I am trying to determine the best way to handle getting rid of newlines when reading in newline delimited files in Python. What I've come up with is the following code, include throwaway code to test..

CSS border less than 1px

Possible Duplicate: HTML: Sub-pixel border The default border:1px is too big. However, border: 0.5px solid; is not working. Is there a CSS solution that would make the border half the size..

Select a dummy column with a dummy value in SQL?

I have a table with the following Table1 col1 col2 ------------ 1 A 2 B 3 C 0 D Result col1 col2 col3 ------------------ 0 D ABC I am not sure how to go ..

How do I find the data directory for a SQL Server instance?

We have a few huge databases (20GB+) which mostly contain static lookup data. Because our application executes joins against tables in these databases, they have to be part of each developers local S..

Android TextView Text not getting wrapped

Can anyone tell me what's going wrong with the text? Text longer than one line doesn't wrap to the next line but goes beyond the screen. Following is the code: <LinearLayout xmlns:android="http:/..

Spark: Add column to dataframe conditionally

I am trying to take my input data: A B C -------------- 4 blah 2 2 3 56 foo 3 And add a column to the end based on whether B is empty or not: A B C D -..

Find nearest value in numpy array

Is there a numpy-thonic way, e.g. function, to find the nearest value in an array? Example: np.find_nearest( array, value ) ..

Insert the same fixed value into multiple rows

I've got a table with a column, lets call it table_column that is currently null for all rows of the table. I'd like to insert the value "test" into that column for all rows. Can someone give me the..

Reverse the ordering of words in a string

I have this string s1 = "My name is X Y Z" and I want to reverse the order of the words so that s1 = "Z Y X is name My". I can do it using an additional array. I thought hard but is it possible to d..

jQuery vs document.querySelectorAll

I heard several times that jQuery's strongest asset is the way it queries and manipulates elements in the DOM: you can use CSS queries to create complex queries that would be very hard to do in regula..

IIS AppPoolIdentity and file system write access permissions

Here's an issue with IIS 7.5 and ASP.NET that I've been researching and getting nowhere with. Any help would be greatly appreciated. My question is: using ASP.NET in IIS 7.5, how does IIS and/or the ..

The server committed a protocol violation. Section=ResponseStatusLine ERROR

I have created a program, tried to post a string on a site and I get this error: "The server committed a protocol violation. Section=ResponseStatusLine" after this line of code: gResponse = (..

load scripts asynchronously

I am using several plugins, custom widgets and some other libraries from JQuery. as a result I have several .js and .css files. I need to create a loader for my site because it takes some time to load..

Preserve Line Breaks From TextArea When Writing To MySQL

I'm using a textarea to enable users to input comments. However, if the users enters new lines, the new lines don't appear when they are outputted. Is there any way to make the line breaks stay. An..

APT command line interface-like yes/no input?

Is there any short way to achieve what the APT (Advanced Package Tool) command line interface does in Python? I mean, when the package manager prompts a yes/no question followed by [Yes/no], the scri..

Java string to date conversion

What is the best way to convert a String in the format 'January 2, 2010' to a Date in Java? Ultimately, I want to break out the month, the day, and the year as integers so that I can use Date date =..

How to BULK INSERT a file into a *temporary* table where the filename is a variable?

I have some code like this that I use to do a BULK INSERT of a data file into a table, where the data file and table name are variables: DECLARE @sql AS NVARCHAR(1000) SET @sql = 'BULK INSERT ' + @ta..

Keyboard shortcuts are not active in Visual Studio with Resharper installed

I have Visual Studio 2012 + Resharper 7.1.1000.900 + StyleCop 4.7.44 installed. The problem is that no shortcuts are active since Resharper was installed. For example: I can rename via 'Refactor > ..

Running Windows batch file commands asynchronously

Say, if I have foo.exe bar.exe baz.exe How do I run all of them from a batch file asynchronously, i.e. without waiting for the previous program to stop?..

How to detect lowercase letters in Python?

I need to know if there is a function that detects the lowercase letters in a string. Say I started writing this program: s = input('Type a word') Would there be a function that lets me detect a lo..

How can I find the length of a number?

I'm looking to get the length of a number in JavaScript or jQuery? I've tried value.length without any success, do I need to convert this to a string first?..

How do I implement IEnumerable<T>

I know how to implement the non generic IEnumerable, like this: using System; using System.Collections; namespace ConsoleApplication33 { class Program { static void Main(string[] arg..

Parameterize an SQL IN clause

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one? SELECT * FROM Tags WHERE Name IN ('ruby','rails','scruffy','rubyonrails') ORDER BY Count DES..

jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

I am running a Maven project which is also a dynamic web project. I have used all Spring libraries in Maven. I created web.xml, but when I start my Tomcat 7 server I am getting the following message: ..

How to deep copy a list?

I have some problem with a List copy: So After I got E0 from 'get_edge', I make a copy of E0 by calling 'E0_copy = list(E0)'. Here I guess E0_copy is a deep copy of E0, and I pass E0_copy into 'kar..

Unable to verify leaf signature

I'm using node.js request.js to reach an api. I'm getting this error [Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE] All of my credentials are accurate and valid, and the server's fine. I made the same..

Find out whether radio button is checked with JQuery?

I can set a radio button to checked fine, but what I want to do is setup a sort of 'listener' that activates when a certain radio button is checked. Take, for example the following code: $("#eleme..

What is Bit Masking?

I am fairly new to C programming, and I encountered bit masking. Can someone explain to me the general concept and function of bit masking? Examples are much appreciated...

How to use a WSDL file to create a WCF service (not make a call)

I have an old WSDL file and I want to create a server based on this WSDL file. The WSDL is generated from a ASMX (I suppose but I am not sure). How can I achieve this ? original question where th..

How to see full absolute path of a symlink

When I'm using ls -la symlinkName or stat symlinkName not all the path is displayed (e.g ../../../one/two/file.txt) What is the linux command that reveals the full path?..

How do I build JSON dynamically in javascript?

var myJSON = { "list1" : [ "1", "2" ], "list2" : [ "a", "b" ], "list3" : [ { "key1" : "value1" }, { "key2" : "value2" } ], "not_a_list" : "11"..

Send form data using ajax

I want to send all input in a form with ajax .I have a form like this. <form action="target.php" method="post" > <input type="text" name="lname" /> <input type="text" name="fn..

How to set index.html as root file in Nginx?

How to set index.html for the domain name e.g. https://www.example.com/ - leads user to index.html in root directory. I've tried different things like: server { # some configs location = ..

Get index of a row of a pandas dataframe as an integer

Assume an easy dataframe, for example A B 0 1 0.810743 1 2 0.595866 2 3 0.154888 3 4 0.472721 4 5 0.894525 5 6 0.978174 6 7 0.859449 7 8 0.541247 8 9 0.232302 9..

Configuring Log4j Loggers Programmatically

I am trying to use SLF4J (with log4j binding) for the first time. I would like to configure 3 different named Loggers that can be returned by a LoggerFactory which will log different levels and push ..

JavaScript Array splice vs slice

What is the difference between splice and slice? $scope.participantForms.splice(index, 1); $scope.participantForms.slice(index, 1); ..

How to import XML file into MySQL database table using XML_LOAD(); function

I have an XML file which looks like this : <?xml version="1.0" encoding="UTF-8"?> <resultset statement="YOUR SQL STATEMENTS TO GENERATE THIS XML FILE" xmlns:xsi="http://www.w3.org/..