Questions Tagged with #Freebsd

FreeBSD is an advanced Unix-like operating system for modern server, desktop, and embedded computer platforms. It is open source and licensed under the 2-clause BSD license.

Determine the process pid listening on a certain port

As the title says, I'm running multiple game servers, and every of them has the same name but different PID and the port number. I would like to match the PID of the server which is listening on certa..

How to install packages offline?

What's the best way to download a python package and it's dependencies from pypi for offline installation on another machine? Is there any easy way to do this with pip or easy_install? I'm trying to i..

How can I get the behavior of GNU's readlink -f on a Mac?

On Linux, the readlink utility accepts an option -f that follows additional links. This doesn't seem to work on Mac and possibly BSD based systems. What would the equivalent be? Here's some debug inf..

Check if string is neither empty nor space in shell script

I am trying to run the following shell script which is supposed to check if a string is neither space nor empty. However, I am getting the same output for all the 3 mentioned strings. I have tried usi..

MySQL SELECT last few days?

I was playing with MYSQL and I know there's a limit command that shows a certain amount of results, but i was wondering if MySQL alone can show only the last 3 days or something. Just wondering. Upda..

Given a starting and ending indices, how can I copy part of a string in C?

In C, how can I copy a string with begin and end indices, so that the string will only be partially copied (from begin index to end index)? This would be like 'C string copy' strcpy, but with a begi..

How to make an AlertDialog in Flutter?

I am learning to build apps in Flutter. Now I have come to alert dialogs. I have done them before in Android and iOS, but how do I make an alert in Flutter? Here are some related SO questions: How ..

Where's my JSON data in my incoming Django request?

I'm trying to process incoming JSON/Ajax requests with Django/Python. request.is_ajax() is True on the request, but I have no idea where the payload is with the JSON data. request.POST.dir contains ..

Host binding and Host listening

How to use the host listener and host binding in angular 2? I tried like the below for host listener, but it's always showing a Declaration expected error. app.component.ts: import {Component, EventE..

Declaring functions in JSP?

I come from PHP world, where declaring a function in the middle of a php page is pretty simple. I tried to do the same in JSP: public String getQuarter(int i){ String quarter; switch(i){ case 1: ..

docker container ssl certificates

Is there any elegant way to add ssl certificates to images that have come from docker pull?. I'm looking for a simple and reproducible way of adding a file into /etc/ssl/certs and run update-ca-certi..

SSL handshake fails with - a verisign chain certificate - that contains two CA signed certificates and one self-signed certificate

I am stuck with a issue and trying to debug it. We purchased a Verisign certificate. When we use: openssl> s_client -connect -showcerts SSL Handshake never completes and at the end..

How to read pdf file and write it to outputStream

I need to read a pdf file with filepath "C:\file.pdf" and write it to outputStream. What is the easiest way to do that? @Controller public class ExportTlocrt { @Autowired private PhoneBookService ph..

What is causing ImportError: No module named pkg_resources after upgrade of Python on os X?

I just updated Python to 2.6.4 on my Mac. I installed from the dmg package. The binary did not seem to correctly set my Python path, so I added '/usr/local/lib/python2.6/site-packages' in .bash_prof.. Connection reset by peer: socket write error When serving a file

I am trying to implement an HTTP Server using Sockets. If the Client (For example a browser) requests a directory the server displays a list of available files. The problem arises when the client is r..

Does document.body.innerHTML = "" clear the web page?

When I refresh the page below in FF 3.0, I expected the web page to clear but it didn't. Why doesn't document.body.innerHTML = "" clear the page? UPDATE: I am trying to clear the previous screen dur..

Regular expression to match URLs in Java

I use RegexBuddy while working with regular expressions. From its library I copied the regular expression to match URLs. I tested successfully within RegexBuddy. However, when I copied it as Java Stri..

Change a Nullable column to NOT NULL with Default Value

I came across an old table today with a datetime column called 'Created' which allows nulls. Now, I'd want to change this so that it is NOT NULL, and also include a constraint to add in a default val..

How can I reverse a NSArray in Objective-C?

I need to reverse my NSArray. As an example: [1,2,3,4,5] must become: [5,4,3,2,1] What is the best way to achieve this?..

C# Convert string from UTF-8 to ISO-8859-1 (Latin1) H

I have googled on this topic and I have looked at every answer, but I still don't get it. Basically I need to convert UTF-8 string to ISO-8859-1 and I do it using following code: Encoding iso = Enco..

How do you create vectors with specific intervals in R?

I have a question about creating vectors. If I do a <- 1:10, "a" has the values 1,2,3,4,5,6,7,8,9,10. My question is how do you create a vector with specific intervals between its elements. For ex..

Simple regular expression for a decimal with a precision of 2

What is the regular expression for a decimal with a precision of 2? Valid examples: 123.12 2 56754 92929292929292.12 0.21 3.1 Invalid examples: 12.1232 2.23332 e666.76 The decimal point may be ..

How to print object array in JavaScript?

I have created an object array in JavaScript. How can I print the object array in the browser window, similar to print_r function in PHP? var lineChartData = [{ date: new Date(2009, 10, 2..

How to convert numbers to words without using num2word library?

I need to turn numbers from 1 - 99 into words. This is what I got so far: num2words1 = {1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', \ 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine',..

Using atan2 to find angle between two vectors

I understand that: atan2(vector.y, vector.x) = the angle between the vector and the X axis. But I wanted to know how to get the angle between two vectors using atan2. So I came across this solution:..

Escape double quote character in XML

Is there an escape character for a double quote in xml? I want to write a tag like: <parameter name="Quote = " "> but if I put ", then that means string has ended. I need something like thi..


I have the following two tables: 1. Lecturers (LectID, Fname, Lname, degree). 2. Lecturers_Specialization (LectID, Expertise). I want to find the lecturer with the most Specialization. When I try t..

Change limit for "Mysql Row size too large"

How can I change the limit Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 ..

Performing a Stress Test on Web Application?

In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a f..

Best practice for Django project working directory structure

I know there is actually no single right way. However I've found that it's hard to create a directory structure that works well and remain clean for every developer and administrator. There is some st..

What's the whole point of "localhost", hosts and ports at all?

I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that? I feel to know what a "host" actually is. Something that executes something...

How can I set the focus (and display the keyboard) on my EditText programmatically

I have a layout which contains some views like this: <LinearLayout> <TextView...> <TextView...> <ImageView ...> <EditText...> <Button...> </linearLayout> H..

Swift: How to get substring from start to last index of character

I want to learn the best/simplest way to turn a string into another string but with only a subset, starting at the beginning and going to the last index of a character. For example, convert "www.stac..

How to make Twitter Bootstrap tooltips have multiple lines?

I am currently using the below function to create text that will be displayed using Bootstrap’s tooltip plugin. How come multiline tooltips only work with <br> and not \n? I prefer that there ..

C++ sorting and keeping track of indexes

Using C++, and hopefully the standard library, I want to sort a sequence of samples in ascending order, but I also want to remember the original indexes of the new samples. For example, I have a set, ..

Jersey Exception : SEVERE: A message body reader for Java class

I have a Jersey based Rest WS which outputs JSON. I am implementing a Jersey Client to invoke the WS and consume the JSON response. The client code I have is below WebResource r = restClient.resourc..

Spring Security with roles and permissions

I'm trying to set up role-based Security with permissions. I'm trying to do this together with Spring-Security. I don't want to set up ACL as it seems it's an overkill for my requirements. I just w..

Regular Expression to match string starting with a specific word

How do I create a regular expression to match a word at the beginning of a string. We are looking to match stop at the beginning of a string and anything can follow it. For example the expression sh..

How can I wrap or break long text/word in a fixed width span?

I want to create a span with a fixed width that when I type any thing in the span like <span>lgasdfjksdajgdsglkgsadfasdfadfasdfadsfasdfasddkgjk</span>, a long string of non-spaced text, th..

Add disabled attribute to input element using Javascript

I have an input box and I want it to be disabled and at the same time hide it to avoid problems when porting my form. So far I have the following code to hide my input: $(".shownextrow").click(funct..

boolean in an if statement

Today I've gotten a remark about code considering the way I check whether a variable is true or false in a school assignment. The code which I had written was something like this: var booleanValue =..

reactjs - how to set inline style of backgroundcolor?

I want to set the style properties of some elements but I don't have the syntax correct. Can anyone suggest where I am wrong? import React from 'react'; import debug from 'debug' const log = debug(..

Converting string to Date and DateTime

If I have a PHP string in the format of mm-dd-YYYY (for example, 10-16-2003), how do I properly convert that to a Date and then a DateTime in the format of YYYY-mm-dd? The only reason I ask for both D..

Oracle: How to filter by date and time in a where clause

How can I do this: select * from tableName where SESSION_START_DATE_TIME > To_Date ('12-Jan-2012 16:00', 'DD-MON-YYYY hh24:mi' ) SESSION_START_DATE_TIME is in the format '12/01/2012 13:16:32.000..

javascript compare strings without being case sensitive

I have to check some strings using JavaScript but case sensitivity is causing problems. for example if('abc'=='ABC') { return true; } it will not go inside the if loop though the meaning of the w..

Class file for not found

I am using Fragment for the designing of the Firebase simple login registration. I get error in the OnCreateView() method on initializing auth = FirebaseAuth.getInstance(); error:- Error:(58, 28) ..

AngularJS $http-post - convert binary to excel file and download

I've created an application in Angular JS for downloading an Excel workbook through $http post. In the below code I'm passing the information in the form of JSON , and send it to the server REST web ..

What are and

These two files are mostly seen in open source projects. What are they for, and how do they work?..

twitter bootstrap autocomplete dropdown / combobox with Knockoutjs

I have a requirement where I HAVE TO use bootstrap autocomplete dropdown, BUT user can have free form text in that dropdown if they wish. Before you think about TypeAhead, I could use Bootstrap TypeAh..

Deprecated Java HttpClient - How hard can it be?

All I'm trying to do is download some JSON and deserialize it into an object. I haven't got as far as downloading the JSON yet. Almost every single HttpClient example I can find, including those on t..

iOS - UIImageView - how to handle UIImage image orientation

Is it possible to setup UIImageView to handle image orientation? When I set the UIImageView to image with orientation RIGHT (it is photo from camera roll), the image is rotated to right, but I want to..

Xcode - iPhone - profile doesn't match any valid certificate-/private-key pair in the default keychain

I tried to add my iPhone to Xcode4 to test my Application on it. I added the device in the Apple Developer-Center and downloaded the Provision-Profile. We pay 99$ per month for the account and I'm not..

How to make a boolean variable switch between true and false every time a method is invoked?

I am trying to write a method that when invoked, changes a boolean variable to true, and when invoked again, changes the same variable to false, etc. For example: call method -> boolean = true -> cal..

Create an application setup in visual studio 2013

I already have a project which is ready to build. Currently, I am using visual studio 2013. But, I don't know how to create an MSI setup in visual studio 2013, but for visual studio 2010 there are pl..

package javax.servlet.http does not exist

I have the jre7 and jdk1.7.0 installed along with the Tomcat 7.0 but it shows this error. servlet.http is not the only one that "does not exist", there are also other (servlet.) components. Can anybo..

Scatter plot with error bars

How can I generate the following plot in R? Points, shown in the plot are the averages, and their ranges correspond to minimal and maximal values. I have data in two files (below is an example). x ..

SSRS Conditional Formatting Switch or IIF

I currently have the following 2008 SSRS Report and I want to conditionally format background of the columns based on some logic. I have three columns and two of which I would like to change the back..

What is a good practice to check if an environmental variable exists or not?

I want to check my environment for the existence of a variable, say "FOO", in Python. For this purpose, I am using the os standard library. After reading the library's documentation, I have figured ou..

Convert JS Object to form data

How can I can convert my JS Object to FormData? The reason why I want to do this is, I have an object that I constructed out of the ~100 form field values. var item = { description: 'Some Item',..

Android check internet connection

I want to create an app that uses the internet and I'm trying to create a function that checks if a connection is available and if it isn't, go to an activity that has a retry button and an explanatio..

How to create a secure random AES key in Java?

What is the recommended way of generating a secure, random AES key in Java, using the standard JDK? In other posts, I have found this, but using a SecretKeyFactory might be a better idea: KeyGenerat..

Center a 'div' in the middle of the screen, even when the page is scrolled up or down?

I have in my page a button which when clicked displays a div (popup style) in the middle of my screen. I am using the following CSS to center the div in the middle of the screen: .PopupPanel { b..

Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE

What is the best way to disable the warnings generated via _CRT_SECURE_NO_DEPRECATE that allows them to be reinstated with ease and will work across Visual Studio versions?..

SQL: How to get the count of each distinct value in a column?

I have a SQL table called "posts" that looks like this: id | category ----------------------- 1 | 3 2 | 1 3 | 4 4 | 2 5 | 1 6 | 1 7 | 2 Each category number corresponds to a category. How wo..

how to get vlc logs?

I am trying to run rtsp url from the VLC player. But an error appears, and "see logs for details" comes up in a dialog box. How can I enable logs in VLC?..

Uncaught ReferenceError: angular is not defined - AngularJS not working

I'm attempting to learn angular and I am struggling with a simple button click. I followed an example which has an identical code to the one below. The result I am looking for is for the button click..

Server is already running in Rails

When I am starting rails server using rails s command it is showing A server is already running. Check C:/Sites/folder/Pids/Server.pids When I open the file it is outputting a 4 digit number only so ..

CSS to line break before/after a particular `inline-block` item

Let's say I have this HTML: <h3>Features</h3> <ul> <li><img src="alphaball.png">Smells Good</li> <li><img src="alphaball.png">Tastes Great</..

How do I implement basic "Long Polling"?

I can find lots of information on how Long Polling works (For example, this, and this), but no simple examples of how to implement this in code. All I can find is cometd, which relies on the Dojo JS ..

SQL Stored Procedure set variables using SELECT

I have a stored procedure in SQL Server 2005 with multiple variables and I want to set the values of these variables using a select statement. All three variables come from a same table and there shou..

How to make Sonar ignore some classes for codeCoverage metric?

I have a Sonar profile in Maven. Everything works fine except the code coverage metric. I want to make Sonar ignore some classes only for the code coverage metric. I have the following profile: <..

What does "Changes not staged for commit" mean

I thought if you want to track the files you should git add [files you want to track] I don't know why I got the messages Changes not staged for commit. If those files were not staged, shouldn't gi..

PHP Fatal Error Failed opening required File

I am getting the following error from Apache [Sat Mar 19 23:10:50 2011] [warn] mod_fcgid: stderr: PHP Fatal error: require_once() [function.require]: Failed opening required '/common/configs/config_..

What is POCO in Entity Framework?

I just started learning POCO but cannot understand its use and advantage. Even following link of stackoverflow did not help me. what is Entity Framework with POCO Can anybody explain the usage of PO..

Using union and order by clause in mysql

I want to use order by with union in mysql query. I am fetching different types of record based on different criteria from a table based on distance for a search on my site. The first select query ret..

Convert Numeric value to Varchar

i m trying to fetch the record using append some alphabt in my numeric column. but i m getting error, i tried with cast and convert function. for exmaple select convert(varchar(10),StandardCost +'S'..

How to specify the private SSH-key to use when executing shell command on Git?

A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer. Basically like this: git clone [email protected]:TheUser/T..

Spring,Request method 'POST' not supported

First of all say apology to ask this repeated Question.. Actually in my spring Application i have user.jsp and professional.jsp here is my User.jsp: <form:form action="profile/user" modelAttri..

handling dbnull data in

I want to generate some formatted output of data retrieved from an MS-Access database and stored in a DataTable object/variable, myDataTable. However, some of the fields in myDataTable cotain dbNull d..

Get the value for a listbox item by index

This must be very easy but I am stuck. I have a listBox with X Items. Each Item has a text description (Which appears in the listBox) and its value(numerical). I want to be able to get the value prop..

Compare object instances for equality by their attributes

I have a class MyClass, which contains two member variables foo and bar: class MyClass: def __init__(self, foo, bar): = foo = bar I have two instances of this ..

How to vertical align an inline-block in a line of text?

I want to create an inline-block that will take on some unknown width and height. (It'll have a table inside it with content dynamically generated). Further, the inline-block should be placed inside ..

Is it possible to use argsort in descending order?

Consider the following code: avgDists = np.array([1, 8, 6, 9, 4]) ids = avgDists.argsort()[:n] This gives me indices of the n smallest elements. Is it possible to use this same argsort in descendin..

How to retrieve an Oracle directory path?

I created the following Oracle Directory csvDir: create or replace directory csvDir as 'd:\oracle\oradata\external_data\downloadedFiles'; Now, how can I retrieve the path from this csvDir alias? ..

Reset select2 value and show placeholder

How do I set the placeholder on value reset by select2. In my example If locations or grade select boxes are clicked and my select2 has a value than the value of select2 should reset and show the defa..

How to open up a form from another form in VB.NET?

This I thought would be easy. I have not used VB.NET all that much, and I am trying to open up a form from a button click. The form will not show and I get a null exception error. What is wrong with ..

Best lightweight web server (only static content) for Windows

I got application server running in Windows – IIS6.0 with Zend Server to execute PHP. I am looking for lightweight static content only web server on this same machine which will relive IIS form hand..

What is the use of hashCode in Java?

In Java, obj.hashCode() returns some value. What is the use of this hash code in programming?..

exclude @Component from @ComponentScan

I have a component that I want to exclude from a @ComponentScan in a particular @Configuration: @Component("foo") class Foo { ... } Otherwise, it seems to clash with some other class in my project...

Importing CSV with line breaks in Excel 2007

I'm working on a feature to export search results to a CSV file to be opened in Excel. One of the fields is a free-text field, which may contain line breaks, commas, quotations, etc. In order to cou..

Paritition array into N chunks with Numpy

There is this How do you split a list into evenly sized chunks? for splitting an array into chunks. Is there anyway to do this more efficiently for giant arrays using Numpy?..

AttributeError: 'module' object has no attribute

I have two python modules: import b def hello(): print "hello" print "" print hello() print b.hi() import a def hi(): print "hi" When I run, I get: AttributeError: 'm..

How to build a Debian/Ubuntu package from source?

I have the source of a program (taken from cvs/svn/git/...) and I'd like to build a Debian/Ubuntu package for it. The package is present in the repositories, but: It is an older version (lacking fea..

Is there a way to get colored text in GitHubflavored Markdown?

I need to document a library on GitHub that output colored text in the terminal. I've tried both span <style="color:red"> and <font color="red">, but it seems to strip ..

How to fix docker: Got permission denied issue

I installed Docker in my machine where I have Ubuntu OS. When I run: sudo docker run hello-world All is ok, but I want to hide the word sudo to make more short the command. If I write the command wit..

Row count where data exists

I need to count the total number of rows that have data. I want to be able to use this on multiple sheets with different amounts of data rows. I cannot figure out generic code that will count the nu..

Shell script not running, command not found

I am very, very new to UNIX programming (running on MacOSX Mountain Lion via Terminal). I've been learning the basics from a bioinformatics and molecular methods course (we've had two classes) where w..

how can I see what ports mongo is listening on from mongo shell?

If I have a mongo instance running, how can I check what port numbers it is listening on from the shell? I thought that db.serverStatus() would do it but I don't see it. I see this "connections" : { ..

source command not found in sh shell

I have a script that uses sh shell. I get an error in the line that uses the source command. It seems source is not included in my sh shell. If I explicitly try to run source from shell I get: sh: ..

Using jQuery to center a DIV on the screen

How do I go about setting a <div> in the center of the screen using jQuery?..

Encode String to UTF-8

I have a String with a "ñ" character and I have some problems with it. I need to encode this String to UTF-8 encoding. I have tried it by this way, but it doesn't work: byte ptext[] = myString.getBy..

How can I make a float top with CSS?

I know that CSS only supports left and right values for the float property, but is there a technique to implement a floating top? I will try to explain. I have the following code: <div style="floa..

Alternate background colors for list items

I have a list, and each item is linked, is there a way I can alternate the background colors for each item? <ul> <li><a href="link">Link 1</a></li> <li><..

How to include duplicate keys in HashMap?

I need linked and multiple keys in key set. I tried this: LinkedHashMap<Integer, String> map = new LinkedHashMap< Integer,String>(); map.put( -1505711364,"4"); map.put(294357273, "15");..

How to query SOLR for empty fields?

I have a large solr index, and I have noticed some fields are not updated correctly (the index is dynamic). This has resulted in some fields having an empty "id" field. I have tried these queries, b..

Regex that matches integers in between whitespace or start/end of string only

I'm currently using the pattern: \b\d+\b, testing it with these entries: numb3r 2 3454 3.214 test I only want it to catch 2, and 3454. It works great for catching number words, except that the bo..

What is the difference between origin and upstream on GitHub?

What is the difference between origin and upstream on GitHub? When a git branch -a command is done, some branches have a prefix of origin (remotes/origin/..) while others have a prefix of upstream (r..

Linq order by, group by and order by each group?

I have an object that looks something like this: public class Student { public string Name { get; set; } public int Grade { get; set; } } I would like to create the following query: group ..

How to use a class object in C++ as a function parameter

I am not sure how to have a function that receives a class object as a parameter. Any help? Here is an example below. #include<iostream> void function(class object); //prototype void function..

How to sum a list of integers with java streams?

I want to sum a list of integers. It works as follows, but the syntax does not feel right. Could the code be optimized? Map<String, Integer> integers; integers.values().stream().mapToInt(i ->..

submit the form using ajax

I'm developing an application (a kind of social network for my university). I need to add a comment (insert a row in a specific database). To do this, I have a HTML form in my html page with various f..

WPF MVVM ComboBox SelectedItem or SelectedValue not working

Update After a bit of investigating. What seems to be the issue is that the SelectedValue/SelectedItem is occurring before the Item source is finished loading. If I sit in a break point and wait a ..

Vagrant shared and synced folders

I created a Vagrantfile with the following content: do |config| config.vm.define :foo do |cfg| = 'foo' cfg.vm.host_name = "foo.localdomain.local" cfg..

VBScript - How to make program wait until process has finished?

I have a problem in a VBScript that I am using with a VBA/Excel macro and a HTA. The problem is just the VBScript, I have the other two components, i.e. the VBA macro and HTA front-end working perfect..

How to send a message to a particular client with

I'm starting with + node.js, I know how to send a message locally and to broadcast socket.broadcast.emit() function:- all the connected clients receive the same message. Now, I would like t..

What are the rules for calling the superclass constructor?

What are the C++ rules for calling the superclass constructor from a subclass one? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an impl..

Play audio as microphone input

I am to test voice recognition programs. Some which I have access to the code and others where I don't. Sadly my (beautiful) voice is not perfect, so when I am reading a text it sounds slightly diffe..

How to document Python code using Doxygen

I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have /* .. */ comments, and also has its own self-documentation fa..

How to POST JSON data with Python Requests?

I need to POST a JSON from a client to a server. I'm using Python 2.7.1 and simplejson. The client is using Requests. The server is CherryPy. I can GET a hard-coded JSON from the server (code not show..

ERROR in Cannot find module 'node-sass'

Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error: ERROR in Cannot find module 'node-sass' After this I run: npm i nod..

How to "crop" a rectangular image into a square with CSS?

I know that it is impossible to actually modify an image with CSS, which is why I put crop in quotes. What I'd like to do is take rectangular images and use CSS to make them appear square without di..

How to set the DefaultRoute to another Route in React Router

I have the following: <Route name="app" path="/" handler={App}> <Route name="dashboards" path="dashboards" handler={Dashboard}> <Route name="exploreDashboard" path="explore..

Fetch API with Cookie

I am trying out the new Fetch API but is having trouble with Cookies. Specifically, after a successful login, there is a Cookie header in future requests, but Fetch seems to ignore that headers, and a..

How can I update a row in a DataTable in VB.NET?

I have the following code: Dim i As Integer = dtResult.Rows.Count For i = 0 To dtResult.Rows.Count Step 1 strVerse = blHelper.Highlight(dtResult.Rows(i).ToString, s) ' syntax error here ..

Swap two variables without using a temporary variable

I'd like to be able to swap two variables without the use of a temporary variable in C#. Can this be done? decimal startAngle = Convert.ToDecimal(159.9); decimal stopAngle = Convert.ToDecimal(355.87)..

Insert results of a stored procedure into a temporary table

How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]? Select all data from BusinessLine into tmpBusLine works fine. select * into tmpB..

What is the C# Using block and why should I use it?

What is the purpose of the Using block in C#? How is it different from a local variable?..

Test if registry value exists

In my powershell script I'm creating one registry entry for each element I run script on and I would like to store some additional info about each element in registry (if you specify optional paramete..

Pointer to incomplete class type is not allowed

For some reason I cannot use functions attached to the object I want to use. I added a comment to the line that is not working. As an error I get "Error; pointer to incomplete class type is not allowe..

string encoding and decoding?

Here are my attempts with error messages. What am I doing wrong? string.decode("ascii", "ignore") UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 37: ordinal not i..

Android: How can I print a variable on eclipse console?

I wanted to print the value of a variable on the console for my debugging purpose, but System.out.println doesn't work...

Add leading zeroes to number in Java?

Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something..

How to justify a single flexbox item (override justify-content)

You can override align-items with align-self for a flex item. I am looking for a way to override justify-content for a flex item. If you had a flexbox container with justify-content:flex-end, but you..

How to stop "setInterval"

How do I stop and start setInterval? Suppose I have a textarea. I want to stop setInterval on focus and restart setInterval on blur (with jQuery)...

changing the owner of folder in linux

I have a folder in my subdomain which is created through WHM so the owner of that subdomain is not the owner of main domain. I want to change the owner of one of the folders of subdomain to domain o..

AngularJs: How to check for changes in file input fields?

I am new to angular. I am trying to read the uploaded file path from HTML 'file' field whenever a 'change' happens on this field. If i use 'onChange' it works but when i use it angular way using 'ng-c..

Launch an event when checking a checkbox in Angular2

I'm newbie in Angular2 and in web globally , I want to launch an action that changes an oject paramater value in the Database when checking a checkbox and or unchecking it using Material-Design, I tri..

Compress images on client side before uploading

Does anyone know of any free script that compresses JPG, GIF and PNG files as much as possible?..

Escape double quotes in parameter

In Unix I could run myscript '"test"' and I would get "test". In Windows cmd I get 'test'. How can I pass double-quotes as a parameter? I would like to know how to do this manually from a cmd window..

loading json data from local file into React JS

I have a React component and I want to load in my JSON data from a file. The console log currently doesn't work, even though I'm creating the variable data as a global 'use strict'; var React = requ..

Is it ok having both Anacondas 2.7 and 3.5 installed in the same time?

I am using currently Anaconda with Python 2.7, but I will need to use Python 3.5. Is it ok to have them installed both in the same time? Should I expect some problems? I am on a 64-bit Win8...

Get characters after last / in url

I want to get the characters after the last / in an url like How do I do with php?..

How to get html to print return value of javascript function?

What is the preferred syntax to get html to print return value of javascript function? function produceMessage(){ var msg= 'Hello<br />'; return msg; } EDIT: Yikes, too many answers w..

Best way to convert text files between character sets?

What is the fastest, easiest tool or method to convert text files between character sets? Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa. Everything goes: one-liners in you..

How to Uninstall RVM?

Possible Duplicate: How to remove rvm (ruby version manager) from my system? How can I uninstall (or reinstall) RVM on Ubuntu 9.10? I messed up my current installation...

How to get length of a list of lists in python

So, if I have a list called myList I use len(myList) to find the number of elements in that list. Fine. But how do I find the number of lists in a list? text = open("filetest.txt", "r") myLines = tex..

ReferenceError: describe is not defined NodeJs

I am trying to define some endpoints and do a test using nodejs. In server.js I have: var express = require('express'); var func1 = require('./func1.js'); var port = 8080; var server = express(); se..

add a string prefix to each value in a string column using Pandas

I would like to append a string to the start of each value in a said column of a pandas dataframe (elegantly). I already figured out how to kind-of do this and I am currently using: df.ix[(df['col'] ..

How do you add a scroll bar to a div?

I have a popup that displays some results, and I want a scroll bar to be display since the results are being cutt off (and I don't want the popup to be too long)...

Move top 1000 lines from text file to a new file using Unix shell commands

I wish to copy the top 1000 lines in a text file containing more than 50 million entries, to another new file, and also delete these lines from the original file. Is there some way to do the same wit..

jQuery get values of checked checkboxes into array

I am trying to get values of all checkboxes that are currently checked and store them into an array. Here is my code so far: $("#merge_button").click(function(event){ event.preventDefault(); ..

How to take the nth digit of a number in python

I want to take the nth digit from an N digit number in python. For example: number = 9876543210 i = 4 number[i] # should return 6 How can I do something like that in python? Should I change it to ..

How to submit a form using PhantomJS

I'm trying to use phantomJS (what an awesome tool btw!) to submit a form for a page that I have login credentials for, and then output the content of the destination page to stdout. I'm able to access..

How to count the number of columns in a table using SQL?

How to count the number of columns in a table using SQL? I am using Oracle 11g Please help. t...

Darken background image on hover

How would I darken a background image on hover without making a new darker image? CSS: .image { background: url(''); ..

What is python's site-packages directory?

The directory site-packages is mentioned in various Python related articles. What is it? How to use it?..

jQuery-UI datepicker default date

I have a problem with the jQuery-UI datepicker, I have searched and searched but I didn't find the answer. I have the following code: <script type="text/javascript"> $(function() { ..

How to convert Excel values into buckets?

I have a set of data in Excel and in one column is a estimate (number of weeks) I want an Excel formula to bucket it into Small Medium Large where if the value is 0 - 10 then put it Small. If th..

How do I get textual contents from BLOB in Oracle SQL

I am trying to see from an SQL console what is inside an Oracle BLOB. I know it contains a somewhat large body of text and I want to just see the text, but the following query only indicates that the..

How to delete rows in tables that contain foreign keys to other tables

Suppose there is a main table containing a primary key and there is another table which contains a foreign key to this main table. So if we delete the row of main table it will delete the child table ..

Create a list with initial capacity in Python

Code like this often happens: l = [] while foo: # baz l.append(bar) # qux This is really slow if you're about to append thousands of elements to your list, as the list will have to be con..

How to insert an element after another element in JavaScript without using a library?

There's insertBefore() in JavaScript, but how can I insert an element after another element without using jQuery or another library?..

What does it mean by select 1 from table?

I have seen many queries with something as follows. Select 1 From table What does this 1 mean, how will it be executed and, what will it return? Also, in what type of scenarios, can this be used..

This could be due to the service endpoint binding not using the HTTP protocol

I have a WCF Service running fine on my local machine. I put it on the servers, and I am receiving the following error: An error occurred while receiving the HTTP response to http://xx.xx.x.xx..

Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?

Why do I get this error message? ValueError: setting an array element with a sequence. Thank you Z=np.array([1.0,1.0,1.0,1.0]) def func(TempLake,Z): A=TempLake B=Z return A*B Nlayers=..

how to create a logfile in php?

I want to create a logfile for my system to register/log every action they do inside the system. But I have no idea how to do it. For example, I have this php code that does the login function. publ..

Attach parameter to button.addTarget action in Swift

I am trying to pass an extra parameter to the buttonClicked action, but cannot work out what the syntax should be in Swift. button.addTarget(self, action: "buttonClicked:", forControlEvents: UIContro..

HttpClient - A task was cancelled?

It works fine when have one or two tasks however throws an error "A task was cancelled" when we have more than one task listed. List<Task> allTasks = new List<Task>(); allTasks.Add(......

Run php function on button click

I want to run a php function on button click. for eg : <input type="button" name="test" id="test" value="RUN" onclick="<?php echo testfun(); ?>" /><br/> <?php function testfun..

Login to Microsoft SQL Server Error: 18456

I am getting this error while trying to connect to the SQL Server. Microsoft SQL Server Error: 18456 Can anybody tell me what the error code means?..

Parse json string using JSON.NET

I have a string like the following in C#. I need to loop through and create an HTML table output. I tried with JSON.NET but couldn't figure out how to retrieve the keys (Name, Age & Job). string..

How to select the first row for each group in MySQL?

In C# it would be like this: table .GroupBy(row => row.SomeColumn) .Select(group => group .OrderBy(row => row.AnotherColumn) .First() ) Linq-To-Sql translates it to ..

Binary search (bisection) in Python

Is there a library function that performs binary search on a list/tuple and return the position of the item if found and 'False' (-1, None, etc.) if not? I found the functions bisect_left/right in th..

Java SSLHandshakeException "no cipher suites in common"

I'm using an SSLServerSocket to accept client connections on my openSUSE server, but none of them can connect. I always get an SSLHandshakeException saying no cipher suites in common. I've activated a..

Android Emulator Error Message: "PANIC: Missing emulator engine program for 'x86' CPUS."

I am trying to run a Android Emulator by using AVD Manager. this is my avd: and this is what happens by starting:

How do I get the current time zone of MySQL?

Anyone knows if there is such a function in MySQL? UPDATE This doesn't output any valid info: mysql> SELECT @@global.time_zone, @@session.time_zone; +--------------------+---------------------+ ..

How do I assign a null value to a variable in PowerShell?

I want to assign a null value to a variable called $dec, but it gives me errors. Here is my code: import-module activedirectory $domain = "" $dec = null Get-ADComputer -Filter {Desc..

How to use double or single brackets, parentheses, curly braces

I am confused by the usage of brackets, parentheses, curly braces in Bash, as well as the difference between their double or single forms. Is there a clear explanation?..

How to select a drop-down menu value with Selenium using Python?

I need to select an element from a drop-down menu. For example: <select id="fruits01" class="select" name="fruits"> <option value="0">Choose your fruits:</option> <option v..

Examples of good gotos in C or C++

In this thread, we look at examples of good uses of goto in C or C++. It's inspired by an answer which people voted up because they thought I was joking. Summary (label changed from original to make..

Tar archiving that takes input from a list of files

I have a file that contain list of files I want to archive with tar. Let's call it mylist.txt It contains: file1.txt file2.txt ... file10.txt Is there a way I can issue TAR command that takes myli..

Authentication issue when debugging in VS2013 - iis express

I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using: If I run this on my Dev Server it works fine, if I run it ..

How to assign bean's property an Enum value in Spring config file?

I have a standalone enum type defined, something like this: package my.pkg.types; public enum MyEnumType { TYPE1, TYPE2 } Now, I want to inject a value of that type into a bean property: ..

Android get current Locale, not default

How do I get the user's current Locale in Android? I can get the default one, but this may not be the current one correct? Basically I want the two letter language code from the current locale. Not ..

Import file size limit in PHPMyAdmin

I have changed all the php.ini parameters I know: upload_max_filesize, post_max_size. Why am I still seeing 2MB? Im using Zend Server CE, on a Ubuntu VirtualBox over a Windows 7 host...

Resize Google Maps marker icon image

When I load an image into the icon property of a marker it displays with its original size, which is a lot bigger than it should be. I want to resize to the standard to a smaller size. What is the be..

Turn off display errors using file "php.ini"

I am trying to turn off all errors on my website. I have followed different tutorials on how to do this, but I keep getting read and open error messages. Is there something I am missing? I have tried..

Sort JavaScript object by key

I need to sort JavaScript objects by key. Hence the following: { 'b' : 'asdsad', 'c' : 'masdas', 'a' : 'dsfdsfsdf' } Would become: { 'a' : 'dsfdsfsdf', 'b' : 'asdsad', 'c' : 'masdas' } ..

Dynamic loading of images in WPF

I have a strange issue with WPF, I was loading images from the disk at runtime and adding them to a StackView container. However, the images were not displayed. After some debugging I found the tric..

Hash function that produces short hashes?

Is there a way of encryption that can take a string of any length and produce a sub-10-character hash? I want to produce reasonably unique ID's but based on message contents, rather than randomly. I..

Where to put a textfile I want to use in eclipse?

I need to read a text file when I start my program. I'm using eclipse and started a new java project. In my project folder I got the "src" folder and the standard "JRE System Library" + staedteliste.t..

How to set width of a div in percent in JavaScript?

Is it possible to set the height/width of an element in percent using JavaScript or jQuery?..

Bootstrap: How do I identify the Bootstrap version?

I want to update Bootstrap on a site, but I don't know the installed version. How can I identify the bootstrap version, with only bootstrap.css and bootstrap.min.js files? There is no version in the..

How do you declare an object array in Java?

Possible Duplicate: How to declare an array in Java? Suppose I have an object car (class vehicle) and I want to create an array of N number of cars . How do I declare that in Java? vehic..

Could not find 3.2.25 4.0.30 4.1.32 4.2.40 4.2.42 4.3.23 4.4.52 5.0.77 5.0.89 5.2.08 6.1.11 6.1.71 6.5.87

referencing the play-services via gradle stopped working for me - boiled it down - even the sample I used as a reference in the first place stopped working:

How to set Spinner Default by its Value instead of Position?

I have 1-50 records in the database. I am fetching those data using cursor and set those values to Spinner using Simple Cursor Adapter. Now what i need is i want to set one value say 39th value as def..

Argparse: Required arguments listed under "optional arguments"?

I use the following simple code to parse some arguments; note that one of them is required. Unfortunately, when the user runs the script without providing the argument, the displayed usage/help text d..

check if a key exists in a bucket in s3 using boto3

I would like to know if a key exists in boto3. I can loop the bucket contents and check the key if it matches. But that seems longer and an overkill. Boto3 official docs explicitly state how to do th..

Python: print a generator expression?

In the Python shell, if I enter a list comprehension such as: >>> [x for x in string.letters if x in [y for y in "BigMan on campus"]] I get a nicely printed result: ['a', 'c', 'g', 'i', '..

How to get everything after last slash in a URL?

How can I extract whatever follows the last slash in a URL in Python? For example, these URLs should return the following: URL: returns: TEST1 URL:

What characters can be used for up/down triangle (arrow without stem) for display in HTML?

I'm looking for a HTML or ASCII character which is a triangle pointing up or down so that I can use it as a toggle switch. I found ↑ (&uarr;), and ↓ (&darr;) - but those have a narr..

What are the new features in C++17?

C++17 is now feature complete, so unlikely to experience large changes. Hundreds of proposals were put forward for C++17. Which of those features were added to C++ in C++17? When using a C++ compile..

Slack URL to open a channel from browser

This iTunes URL will open The Hitchhiker's Guide to the Galaxy in your iTunes: itmss:// This Spotify URL will open ALL by the..

How to close Browser Tab After Submitting a Form?

<?php /* ... SQL EXECUTION TO UPDATE DB ... */ ?> <form method = "post" action = "<?=$_SERVER['php_self']?>" onSubmit= "window.close();"> ... <input type="..