Questions Tagged with #Network tools

How to detect if multiple keys are pressed at once using JavaScript?

I'm trying to develop a JavaScript game engine and I've came across this problem: When I press SPACE the character jumps. When I press → the character moves right. The problem is that w..

How to delete a folder and all contents using a bat file in windows?

I want to delete a folder with all files and subfolders using a bat file. I have tried the following, but it is not working: @DEL D:\PHP_Projects\testproject\Release\testfolder*.* Can anybody hel..

How to remove outliers in boxplot in R?

Possible Duplicate: Changing the outlier rule in a boxplot I need to visualize my result using box-plot. x<-rnorm(10000) boxplot(x,horizontal=TRUE,axes=FALSE) How can i filter outli..

MySQL - How to select data by string length

SELECT * FROM table ORDER BY string_length(column); Is there a MySQL function to do this (of course instead of string_length)?..

Change the Theme in Jupyter Notebook?

I like dark themes. However, the default theme of Jupyter notebooks is light, and I can't find the option to change the theme/background-color. How is this done?..

What is the difference between Trap and Interrupt?

What is the difference between Trap and Interrupt? If the terminology is different for different systems, then what do they mean on x86?..

Mongoose and multiple database in single node.js project

I'm doing a Node.js project that contains sub projects. One sub project will have one Mongodb database and Mongoose will be use for wrapping and querying db. But the problem is Mongoose doesn't all..

WordPress asking for my FTP credentials to install plugins

I installed a WordPress blog in my local system. But when I try to add plugins from admin it asks for FTP access. What do I need to configure for WordPress to be able to upload without FTP?..

How to disable copy/paste from/to EditText

In my application, there is a registration screen, where i do not want the user to be able to copy/paste text into the EditText field. I have set an onLongClickListener on each EditText so that the co..

What are the "standard unambiguous date" formats for string-to-date conversion in R?

Please consider the following $ R --vanilla > as.Date("01 Jan 2000") Error in charToDate(x) : character string is not in a standard unambiguous format But that date clearly is in a standard..

How do I convert datetime.timedelta to minutes, hours in Python?

I get a start_date like this: from django.utils.timezone import utc import datetime start_date = datetime.datetime.utcnow().replace(tzinfo=utc) end_date = datetime.datetime.utcnow().replace(tzinfo=u..

PHP header(Location: ...): Force URL change in address bar

I'm currently working on a mobile site with authentication using PHP sessions with a database. I have a login page with a form that goes to server_login.php on submit. The php file then creates some s..

Page redirect after certain time PHP

There is a certain PHP function for redirecting after some time. I saw it somewhere but can't remember. It's like the gmail redirection after logging in. Please, could anyone remind me?..

How to customize an end time for a YouTube video?

I'm trying to figure out how I can specify a custom end time for an embedded YouTube video. I know that I can customize the start time by adding &start=30, but I haven't seen anything relating to ..

How to compare strings

I wanted to compare a string without actually defining one of them as a string, something like this, if (string == "add") Do I have to declare "add" as a string or is it possible to compare in a si..

How to escape apostrophe (') in MySql?

The MySQL documentation says that it should be \'. However, both scite and mysql shows that '' works. I saw that and it works. What should I do?..

Terminal Multiplexer for Microsoft Windows - Installers for GNU Screen or tmux

I am looking for a terminal multiplexer for Microsoft Windows. I was unable to locate the installers for Microsoft Windows for both tmux and GNU Screen. Currently I'm using Putty to connect to my Lin..

C#, Looping through dataset and show each record from a dataset column

In C#, I'm trying to loop through my dataset to show data from each row from a specific column. I want the get each date under the column name "TaskStart" and display it on a report, but its just sho..

Best Python IDE on Linux

Possible Duplicate: What IDE to use for Python? Can anybody suggest me good Python IDE for Linux?..

How to programmatically open the Permission Screen for a specific app on Android Marshmallow?

I have a question regarding the new Android Marshmallow release: Is it achievable to display the Permission Screen for a specific app via an Intent or something similar? It's possible to display t..

LaTeX table too wide. How to make it fit?

I just started to learn latex and now I'm trying to create a table. This is my code: \begin{table} \caption{Top Scorers} \begin{tabular}{ l l } \hline \bf Goals & \bf Players\\ \hline..

Java - Search for files in a directory

This is supposed to be simple, but I can't get it - "Write a program that searches for a particular file name in a given directory." I've found a few examples of a hardcoded filename and directory, bu..

Javascript Get Element by Id and set the value

I have a javascript function to which I pass a parameter. The parameter represents the id of an element (a hidden field) in my web page. I want to change the value of this element. function myFunc(va..

For-loop vs while loop in R

I have noticed a curious thing whilst working in R. When I have a simple program that computes squares from 1 to N implemented using for-loop and while-loop the behaviour is not the same. (I don't car..

How to set a header in an HTTP response?

I've a servlet A where I'm setting a header in the HTTP response: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Stri..

How can I set the background color of <option> in a <select> element?

How do you set the background color of an item in an HTML list?..

Interop type cannot be embedded

I am creating a web application on the .NET 4.0 framework (beta2) in C#. When I try to use a assembly called "ActiveHomeScriptLib", I get the following error: Interop type 'ActiveHomeScriptLib...

removing bold styling from part of a header

Is there a way to remove bold styling from part of a header? <h1>**This text should be bold**, but this text should not</h1> Is there a way to accomplish this?..

Groovy Shell warning "Could not open/create prefs root node ..."

I tried to open the Groovy Shell (groovysh) on Windows 8 and got the following output: java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft..

Validating URL in Java

I wanted to know if there is any standard APIs in Java to validate a given URL? I want to check both if the URL string is right i.e. the given protocol is valid and then to check if a connection can b..

IIS 500.19 with 0x80070005 The requested page cannot be accessed because the related configuration data for the page is invalid error

I want to upload my own asp.net website on IIS with IIS Manager. But when I do this, I get the following error HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed b..

Does .NET provide an easy way convert bytes to KB, MB, GB, etc.?

Just wondering if .NET provides a clean way to do this: int64 x = 1000000; string y = null; if (x / 1024 == 0) { y = x + " bytes"; } else if (x / (1024 * 1024) == 0) { y = string.Format("{0:n..

ImportError: No module named 'selenium'

I'm trying to write a script to check a website. It's the first time I'm using selenium. I'm trying to run the script on a OSX system. Although I checked in /Library/Python/2.7/site-packages and selen..

Common elements comparison between 2 lists

def common_elements(list1, list2): """ Return a list containing the elements which are in both list1 and list2 >>> common_elements([1,2,3,4,5,6], [3,5,7,9]) [3, 5] >&g..

How can I generate UUID in C#

I am creating an .idl file programmatically. How do I create UUIDs for the interfaces and Methods Programmatically. Can I generate the UUID programmatically?..

HRESULT: 0x80131040: The located assembly's manifest definition does not match the assembly reference

The located assembly's manifest definition does not match the assembly reference getting this when running nunit through ncover. Any idea?..

How do I install a plugin for vim?

I'd like to try the plugin for Vim linked below. It adds syntax highlighting for .haml and (perhaps) .sass files. http://github.com/tpope/vim-haml I did this... $ cd ~/.vim $ git clone git://github..

AngularJS : Custom filters and ng-repeat

I'm an AngularJS newbie and I'm building up a small proof-of-concept car hire listings app that pulls in some JSON and renders out various bits of that data via an ng-repeat, with a couple of filters:..

Get first word of string

Okay, here is my code with details of what I have tried to do: var str = "Hello m|sss sss|mmm ss"; //Now I separate them by "|" var str1 = str.split("|"); //Now I want to get the first word of every..

python re.split() to split by spaces, commas, and periods, but not in cases like 1,000 or 1.50

I want to use python re.split() to split a string into individual words by spaces, commas and periods. But I don't want "1,200" to be split into ["1", "200"] or ["1.2"] to be split into ["1", "2"]. E..

Program to find largest and second largest number in array

I have searched many websites for this question. They are doing it by some different approach. This code is just not giving output if I input first element of array as largest i.e. a[0]. I think some ..

Emulate/Simulate iOS in Linux

I'm developing a web app that apparently is having problems in iOS devices. The problem is that I don't own an iOS device and I develop in Linux Ubuntu. I'm looking for a way to emulate/simulate this ..

How to parse JSON with VBA without external libraries?

I have a json like below: {"sentences":[{"trans":"something ru","orig":"english word","translit":"Angliyskoye slovo","src_translit":""}], "src":"en","server_time":69} and parse it: Function jsonDe..

Is it possible to save HTML page as PDF using JavaScript or jquery?

Is it possible to save HTML page as PDF using JavaScript or jquery? In Detail: I generated one HTML Page which contains a table . It has one button 'save as PDF'. If user clicks that button then tha..

How to sort in mongoose?

I find no doc for the sort modifier. The only insight is in the unit tests: spec.lib.query.js#L12 writer.limit(5).sort(['test', 1]).group('name') But it doesn't work for me: Post.find().sort(['upd..

Equivalent of typedef in C#

Is there a typedef equivalent in C#, or someway to get some sort of similar behaviour? I've done some googling, but everywhere I look seems to be negative. Currently I have a situation similar to the ..

How to tell when UITableView has completed ReloadData?

I am trying to scroll to the bottom of a UITableView after it is done performing [self.tableView reloadData] I originally had [self.tableView reloadData] NSIndexPath* indexPath = [NSIndexPath ind..

ASP.Net MVC – Resource Cannot be found error

I am completely new to ASP.Net MVC. I just created an MVC3 project in Visual Studio 2010. The view engine is razor. When I just ran the application it gave the proper result in the browser. The URL i..

how to convert string into dictionary in python 3.*?

I want to convert the following string into dictionary without using eval() function in Python 3.5. d="{'Age': 7, 'Name': 'Manni'}"; Can anybody tell me the good way than using the eval() function?..

Inheritance and init method in Python

I'm begginer of python. I can't understand inheritance and __init__(). class Num: def __init__(self,num): self.n1 = num class Num2(Num): def show(self): print self.n1 mynumb..

Pass C# ASP.NET array to Javascript array

Does anyone know how to pass a C# ASP.NET array to a JavaScript array? Sample code will also be nice. Sorry if I was vague earlier guys. The question is actually quite simple. Let's say for simplicit..

How do you delete a column by name in data.table?

To get rid of a column named "foo" in a data.frame, I can do: df <- df[-grep('foo', colnames(df))] However, once df is converted to a data.table object, there is no way to just remove a column. ..

How do you create a read-only user in PostgreSQL?

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be: GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy'; What is the equi..

Viewing contents of a .jar file

What would be the easiest way to view classes, methods, properties, etc. inside a jar file? I'm looking for something equivalent to the very useful Lutz Roeder .NET Reflector - for Java..

What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?

What's the difference if one web page starts with <!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> and If page starts with <..

Threads vs Processes in Linux

I've recently heard a few people say that in Linux, it is almost always better to use processes instead of threads, since Linux is very efficient in handling processes, and because there are so many p..

jquery background-color change on focus and blur

I have the following problem: I have a form with three text input fields, and I want to change the background-color when one of the fields has focus, and get it set back when it loses focus. I have co..

Don't change link color when a link is clicked

I have a link in an HTML page: <a href="#foo">foo</a> The color of the link text is originally blue. When the link is clicked, the color of the link text changes to Red first, and then ..

Google Maps setCenter()

I'm using google maps. In my code i've used setCenter() function. My problem is that marker is always located on top left corner of map area (not at the center). Please tell me how to resolve it? My ..

How to change UINavigationBar background color from the AppDelegate

I know how to change the UINavigationBar background image by doing [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nabbar"] forBarMetrics:UIBarMetricsDefault]; and I know ho..

How to convert Double to int directly?

May be this is silly question. I want to get rid of the fractional part of the Double number. But I cant do that. It shows the error that incompatible types. What to do? Double to int conversion in o..

Can I call a constructor from another constructor (do constructor chaining) in C++?

As a C# developer I'm used to running through constructors: class Test { public Test() { DoSomething(); } public Test(int count) : this() { DoSomethingWithCount(count);..

strdup() - what does it do in C?

What is the purpose of the strdup() function in C?..

Logging levels - Logback - rule-of-thumb to assign log levels

I'm using logback in my current project. It offers six levels of logging: TRACE DEBUG INFO WARN ERROR OFF I'm looking for a rule of thumb to determine the log level for common activities...

How to remove the character at a given index from a string in C?

How do I remove a character from a string? If I have the string "abcdef" and I want to remove "b" how do I do that? Removing the first character is easy with this code: #include <stdio.h> #..

How to remove files and directories quickly via terminal (bash shell)

From terminal window: When I use the rm command it can only remove files. When I use the rmdir command it only removes empty folders. If I have a directory nested with files and folders within f..

base64 encode in MySQL

I want to select a blob col from one table, base64 encode it and insert it into another tables. Is there any way to do this without round tripping the data out of the DB and through my app?..

jQuery and TinyMCE: textarea value doesn't submit

I am using jQuery and TinyMCE to submit a form, but there is a problem in serialization in that the Textarea value doesn't post. Here is the code: <form id="myForm" method="post" action="post.php..

Regular expression for only characters a-z, A-Z

I don't know how to create a regular expression in JavaScript or jQuery. I want to create a regular expression that will check if a string contains only characters between a-z and A-Z with any arrang..

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

How do I dynamically change the content in an iframe using jquery?

I was wondering if it is possible to have a site with an iframe and some jquery code that changes the iframe content every 30 seconds. The content is in different webpages. Something like this: <..

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have setup my path variable to the .../bin directory. When I run my "Hello world" in Notepad++..

How do I compile with -Xlint:unchecked?

I'm getting a message when I compile my code: Note: H:\Project2\MyGui2.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. How do I recompile with -Xlint:un..

AngularJS ng-if with multiple conditions

I'd like to know if it's possible to have something like this: div ng-repeat="(k,v) in items" <div ng-if="k == 'a' || k == 'b'"> <!-- SOME CONTENT --> </div> Knowing that item..

How do I get logs/details of ansible-playbook module executions?

Say I execute the following. $ cat test.sh #!/bin/bash echo Hello World exit 0 $ cat Hello.yml --- - hosts: MyTestHost tasks: - name: Hello yourself script: test.sh $ ansible-playbook He..

Creating files and directories via Python

I'm having trouble creating a directory and then opening/creating/writing into a file in the specified directory. The reason seems unclear to me. I'm using os.mkdir() and path=chap_name print "Path ..

How do I round a float upwards to the nearest int in C#?

In C#, how do I round a float upwards to the nearest int? I see Math.Ceiling and Math.Round, but these returns a decimal. Do I use one of these then cast to an Int?..

Max value of Xmx and Xms in Eclipse?

Now my settings for these in the ini file are: -Xms768M -Xmx1024M When setting them higher, eclipse doesn't start anymore... Is there a way to increase these values without eclipse crashing?..

What is a Python equivalent of PHP's var_dump()?

When debugging in PHP, I frequently find it useful to simply stick a var_dump() in my code to show me what a variable is, what its value is, and the same for anything that it contains. What is a good..

Is it possible to make an HTML anchor tag not clickable/linkable using CSS?

For example if I have this: <a style="" href="page.html">page link</a> Is there anything I can use for the style attribute that will make it so the link isn't clickable and won't take me..

check if a std::vector contains a certain object?

Is there something in <algorithm> which allows you to check if a std:: container contains something? Or, a way to make one, for example: if(a.x == b.x && a.y == b.y) return true; retu..

Warnings Your Apk Is Using Permissions That Require A Privacy Policy: (android.permission.READ_PHONE_STATE)

In manifest not added android.permission.READ_PHONE_STATE. permission. Why error comes when I upload a new apk version error comes below. Your app has an apk with version code 1 that requests the foll..

End of File (EOF) in C

I am currently reading the book C Programming Language by Ritchie & Kernighan. And I am pretty confused about the usage of EOF in the getchar() function. First, I want to know why the value of E..

What are Maven goals and phases and what is their difference?

What is the difference/relation between Maven goals and phases? How they are related to each other?..

How can multiple rows be concatenated into one in Oracle without creating a stored procedure?

How can I achieve the following in oracle without creating a stored procedure? Data Set: question_id element_id 1 7 1 8 2 9 3 10 3 ..

Oracle date to string conversion

I have a string column COL1 when I am doing this SELECT TO_CHAR(TO_DATE(COL1,'dd-mon-yy'), 'mm/dd/yyyy') FROM TABLE1 The data in COL1 is in dd-mon-yy, eg: 27-11-89 and 89 is 1989 but the select ret..

How to push to History in React Router v4?

In the current version of React Router (v3) I can accept a server response and use browserHistory.push to go to the appropriate response page. However, this isn't available in v4, and I'm not sure wha..

join on multiple columns

I have two tables (Table A and Table B) which I want to join on multiple columns in both tables. Table A Col1 Col2 ================ A11 A..

Only allow Numbers in input Tag without Javascript

I am fairly new. I am creating a webpage that ask a user for their ID. I want it to be a required field and only allow numbers. I appreciate if you lead me in the correct direction. this is what I ha..

How do I solve this "Cannot read property 'appendChild' of null" error?

I tried to use this code below, which adds buttons in slideshow on my site: window.onload = function loadContIcons() { var elem = document.createElement("img"); elem.src = "http://arno.agnian..

How to replace multiple strings in a file using PowerShell

I am writing a script for customising a configuration file. I want to replace multiple instances of strings within this file, and I tried using PowerShell to do the job. It works fine for a single re..

Is it correct to use DIV inside FORM?

I'm just wondering what are you thinking about DIV-tag inside FORM-tag? I need something like this: <form> <input type="text"/> <div> some </div> <div> another &l..

How to prevent favicon.ico requests?

I don't have a favicon.ico, but my browser always makes a request for it. Is it possible to prevent the browser from making a request for the favicon from my site? Maybe some META-TAG in the HTML head..

Fatal error: Class 'SoapClient' not found

I'm trying a simple web service example and I get this error even though I uncommented extension=php_soap.dll in the php.ini file: Fatal error: Class 'SoapClient' not found in C:\Program Files (x8..

Fast check for NaN in NumPy

I'm looking for the fastest way to check for the occurrence of NaN (np.nan) in a NumPy array X. np.isnan(X) is out of the question, since it builds a boolean array of shape X.shape, which is potential..

Using Jquery Datatable with AngularJs

I'm trying to use the jquery datatable plugin in my angularjs project. but my question is does it support lazy loading of value for angularjs? i want beacuse i have many row. how to use datatable pip..

Sorting a List<int>

Using C# what is the best way to sort a List numerically? my list has items 5,7,3 and I would like them sorted 3,5,7. I know some longer ways, but I would imagine linq has a quicker way? sorry this ..

Sql query to insert datetime in SQL Server

I want to insert a datetime value into a table(SQL Server) using the sql query below insert into table1(approvaldate)values(18-06-12 10:34:09 AM); But I get this Error msg. Incorrect syntax near '1..

Useful example of a shutdown hook in Java?

I'm trying to make sure my Java application takes reasonable steps to be robust, and part of that involves shutting down gracefully. I am reading about shutdown hooks and I don't actually get how to m..

JAVA_HOME should point to a JDK not a JRE

I am trying to set up maven for my project and I am getting this error "JAVA_HOME should point to a JDK not a JRE" I know there are already similar question but it did not work. How can I point J..

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

How do I enable the column selection mode in Eclipse?

News wrote that Eclipse 3.5 finally supports column selection. Unfortunately I don't know HOW to enable it. I tried pressing the ALT-key like I am used to in Visual Studio and all other Microsoft pro..

How can I list all foreign keys referencing a given table in SQL Server?

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers preferable..

How to set up googleTest as a shared library on Linux

Debian does not provide any precompiled packages for gTest anymore. They suggest you integrate the framework into your project's makefile. But I want to keep my makefile clean. How do I set up gTest l..

Distinct in Linq based on only one field of the table

I am trying to use .distinct in Linq to get result based on one field of the table (so do not require a whole duplicated records from table). I know writing basic query using distinct as followed: v..

Scp command syntax for copying a folder from local machine to a remote server

I am using putty for copying files from local machine to remote server.My folder is in C:/site can any one give syntax for copying folder from C:/site to remote server using scp..

How to debug SSL handshake using cURL?

I would like to troubleshoot per directory authentication with client certificate. I would specially like to find out which acceptable client certificates does server send. How do I debug SSL handsha..

creating triggers for After Insert, After Update and After Delete in SQL

I am trying to create a trigger each time after data is inserted, updated or deleted. The trigger for inserting is working fine but i am having some issues with the Update and Delete. Here is After ..

How can I generate a list or array of sequential integers in Java?

Is there a short and sweet way to generate a List<Integer>, or perhaps an Integer[] or int[], with sequential values from some start value to an end value? That is, something shorter than, but..

Angularjs autocomplete from $http

I'm trying to write an autocomplete directive that fetches data from the server using an $http request (without using any external plugins or scripts). Currently it works only with static data. Now, I..

What's the difference between ng-model and ng-bind

I'm currently learning AngularJS and am having difficulty understanding the difference between ng-bind and ng-model. Can anyone tell me how they differ and when one should be used over the other?..

Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)

I need some help with this error : Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse () at Object.success (dashboard.js:22) at fire (jquery-3.3.1.js:3268) at..

Checking if a double (or float) is NaN in C++

Is there an isnan() function? PS.: I'm in MinGW (if that makes a difference). I had this solved by using isnan() from <math.h>, which doesn't exist in <cmath>, which I was #includeing at..

What is the maximum size of a web browser's cookie's key?

What is the maximum size of a web browser's cookie's key? I know the maximum size of a cookie is 4KB, but does the key have a limitation as well?..

make arrayList.toArray() return more specific types

So, normally ArrayList.toArray() would return a type of Object[]....but supposed it's an Arraylist of object Custom, how do I make toArray() to return a type of Custom[] rather than Object[]?..

maven error: package org.junit does not exist

I'm trying to create the javadoc with maven and it fails. It also fails when doing the verify. mvn verify I get the following error: (...) [INFO] ----------------------------------------------..

How to handle notification when app in background in Firebase

Here is my manifest <service android:name=".fcm.PshycoFirebaseMessagingServices"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /&g..

Get hours difference between two dates in Moment Js

I'm able to get the difference between two dates using MomentJs as follows: moment(end.diff(startTime)).format("m[m] s[s]") However, I also want to display the hour when applicable (only when >= 60..

Getting file names without extensions

When getting file names in a certain folder: DirectoryInfo di = new DirectoryInfo(currentDirName); FileInfo[] smFiles = di.GetFiles("*.txt"); foreach (FileInfo fi in smFiles) { builder.Append(fi...

Uri content://media/external/file doesn't exist for some devices

I have an issue with some devices. I cannot replicate it on any device but I have quite a lot of crash reports reported by some users. It is this exception: java.lang.IllegalArgumentException: Unkno..

How to give a time delay of less than one second in excel vba?

i want to repeat an event after a certain duration that is less than 1 second. I tried using the following code Application.wait Now + TimeValue ("00:00:01") But here the minimum delay time is one ..

How to return a class object by reference in C++?

I have a class called Object which stores some data. I would like to return it by reference using a function like this: Object& return_Object(); Then, in my code, I would call it like this..

Re-ordering factor levels in data frame

I have a data.frame as shown below: task measure right m1 left m2 up m3 down m4 front m5 back m6 . . . The task column takes only six different values, which are treated as fac..

How to restart a node.js server

I've installed and is running a node.js server on osx. I've dled a chat module and is happily running it. I've altered some pieces and need to restart the server to see the effects. I only know how t..

Skipping Iterations in Python

I have a loop going, but there is the possibility for exceptions to be raised inside the loop. This of course would stop my program all together. To prevent that I catch the exceptions and handle them..

Prevent flex items from stretching

Sample: _x000D_ _x000D_ div {_x000D_ display: flex;_x000D_ height: 200px;_x000D_ background: tan;_x000D_ }_x000D_ span {_x000D_ background: red;_x000D_ }_x000D_ <div>_x000D_ <span&g..

android.widget.Switch - on/off event listener?

I would like to implement a switch button, android.widget.Switch (available from API v.14). <Switch android:id="@+id/switch1" android:layout_width="wrap_content" android:layout_height=..

Index of Currently Selected Row in DataGridView

It's that simple. How do I get the index of the currently selected Row of a DataGridView? I don't want the Row object, I want the index (0 .. n)...

Sticky Header after scrolling down

I saw this sticky header on this website: http://dunked.com/ (no longer active, view archived site) When you scroll down the sticky header comes down from the top. I looked at the code, but it looks..

PHP: check if any posted vars are empty - form: all fields required

Is there a simpler function to something like this: if (isset($_POST['Submit'])) { if ($_POST['login'] == "" || $_POST['password'] == "" || $_POST['confirm'] == "" || $_POST['name'] == "" || $_PO..

Checking if a field contains a string

I'm looking for an operator, which allows me to check, if the value of a field contains a certain string. Something like: db.users.findOne({$contains:{"username":"son"}}) Is that possible? ..

Codeigniter: Passing data from controller to view

I want to pass $data from the controller named poll to the results_view however I am getting an undefined variable error. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'..

What would be the Unicode character for big bullet in the middle of the character?

I want something like 0x2022 8226 BULLET • But bigger. I can't even seem to find them at http://www.ssec.wisc.edu/~tomw/java/unicode.html What should I search for? Dots? bullets?..

What are examples of TCP and UDP in real life?

I know the difference between the two on a technical level. But in real life, can anyone provide examples (the more the better) of applications (uses) of TCP and UDP to demonstrate the difference?..

Django. Override save for model

Before saving model I'm re-size a picture. But how can I check if new picture added or just description updated, so I can skip rescaling every time the model is saved? class Model(model.Model): i..

Pushing from local repository to GitHub hosted remote

I created a local repository of my Visual Studio 2010 solution folder using Git GUI on my dev machine. I then created a remote repository in my GitHub account. Now, I am looking for how to push my loc..

Adding a HTTP header to the Angular HttpClient doesn't send the header, why?

Here is my code: import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http'; logIn(username: string, password: string) { const url = 'http://server.com/index.php'; ..

What's the fastest way to do a bulk insert into Postgres?

I need to programmatically insert 10's of millions of records into a postgres database. Presently I am executing 1000's of insert statements in a single "query". Is there a better way to do this, ..

Difference between "as $key => $value" and "as $value" in PHP foreach

I have a database call and I'm trying to figure out what the $key => $value does in a foreach loop. The reason I ask is because both these codes output the same thing, so I'm trying to understand..

How to change Elasticsearch max memory size

I have an Apache server with a default configuration of Elasticsearch and everything works perfectly, except that the default configuration has a max size of 1GB. I don't have such a large number of ..

Xcode - Warning: Implicit declaration of function is invalid in C99

Getting a warning : Implicit declaration of function 'Fibonacci' is invalid in C99. What's wrong? #include <stdio.h> int main(int argc, const char * argv[]) { int input; printf("Please..

Replace "\\" with "\" in a string in C#

I still don't get how to do this. I saw many posts regarding this, but none of the solutions worked for me. I have a string called "a\\b". The result I need is "a\b". How is this done? I have a text..

Calculate business days

I need a method for adding "business days" in PHP. For example, Friday 12/5 + 3 business days = Wednesday 12/10. At a minimum I need the code to understand weekends, but ideally it should account for..

What do the result codes in SVN mean?

What do the result codes in SVN mean? I need a quick reference...

How to remove a package from Laravel using composer?

What is the correct way to remove a package from Laravel using composer? So far I've tried: Remove declaration from composer.json (in "require" section) Remove any Class Aliases from app.ph..

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I'm setting up a new server and keep running into this problem. When I try to login to the MySQL database with the root user, I get the error: ERROR 1698 (28000): Access denied for user 'root'@'..

How to configure Git post commit hook

How to trigger a build remotely from Jenkins? How to configure Git post commit hook? My requirement is whenever changes are made in the Git repository for a particular project it will automatically s..

jQuery $(this) keyword

Why is it important to use $(this) instead of re-selecting the class? I am using a lot of animate and css editing in my code, and I know I can simplify it by using $(this)...

If Else in LINQ

Is it possible to use If Else conditional in a LINQ query? Something like from p in db.products if p.price>0 select new { Owner=from q in db.Users select q.Name } else select new { O..

POST unchecked HTML checkboxes

I've got a load of checkboxes that are checked by default. My users will probably uncheck a few (if any) of the checkboxes and leave the rest checked. Is there any way to make the form POST the che..

How can I make my website's background transparent without making the content (images & text) transparent too?

I'm doing a website for a school project, and I'm currently having a small problem... I can't make the body's background transparent without it also affecting the content in it. Here's my HTML code: ..

Reordering Chart Data Series

How does one reorder series used to create a chart in Excel? For example, I go to the chart, right click > Select Data. In the left column I see series 1, series 2, to series n. Say, I want to move..

Use 'import module' or 'from module import'?

I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basica..

How to develop Android app completely using python?

I would like to develop a (rather simple) android app to be distributed via Play Store. I would like to do so completely in python. However, the online research hasn't quite enlightened me: most comme..

How can I declare and define multiple variables in one line using C++?

I always though that if I declare these three variables that they will all have the value 0 int column, row, index = 0; But I find that only index equals zero & the others are junk like 844553 ..

Simple int to char[] conversion

I have a simple question How to simply convert integer (getting values 0-8) to char, e.g. char[2] in C? Thanks..

Open Facebook page from Android app?

from my Android app, I would like to open a link to a Facebook profile in the official Facebook app (if the app is installed, of course). For iPhone, there exists the fb:// URL scheme, but trying the ..

How can I get zoom functionality for images?

Is there a common way to show a big image and enable the user to zoom in and out and pan the image? Until now I found two ways: overwriting ImageView, that seems a little bit too much for such a c..

Update records using LINQ

I need to set a value in a table for a subset of rows. In SQL, I would do this: UPDATE dbo.Person SET is_default = 0 WHERE person_id = 5 Is there a way to do this in LINQ? I currently use the: va..

Nginx subdomain configuration

I have nginx acting as a reverse proxy to apache. I now need to add a new subdomain that will serve files from another directory, but at the same time I want all location and proxy_pass directives tha..

What size should apple-touch-icon.png be for iPad and iPhone?

Are Apple touch icons bigger than 60x60 supported, and if so, what dimensions should I use for the iPad and iPhone?..

How to upgrade Git to latest version on macOS?

I just bought a new Mac with OS X Lion and I checked in the Terminal what version of git is installed by default. I got the answer git --version > git version 1.7.5.4 I would like to upgrade git..

Unable to compile class for JSP

I am working in a JSP project. While runnning the project using Netbeans with Tomcat 6 server, I got the following exception, org.apache.jasper.JasperException: Unable to compile class for JSP: An ..

What is the equivalent of Java's final in C#?

What is the equivalent of Java's final in C#?..

Convert String with Dot or Comma as decimal separator to number in JavaScript

An input element contains numbers a where comma or dot is used as decimal separator and space may be used to group thousands like this: '1,2' '110 000,23' '100 1.23' How would one convert th..

LogCat message: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included

I have an application that uses the Google Maps Android v2 API. I've added the google-play-services_lib library project to my workspace and added a reference to it from my application project, followi..

Java: Sending Multiple Parameters to Method

Here is my Scenario: I've got to call a method. Let the parameters be: Parameter1, Parameter2, .. , .. , Parameter N But the Parameters to be sent to the method might change in each case. Case 1: On..

event.returnValue is deprecated. Please use the standard event.preventDefault() instead

I have this script: <script> $(document).ready(function () { $("#changeResumeStatus").click(function () { $.get("{% url 'main:changeResumeStatus' %}", function (data) { ..

twitter bootstrap 3.0 typeahead ajax example

There are a lot of typeahead ajax examples out there for bootstrap 2, for example this here twitter bootstrap typeahead ajax example. However I am using bootstrap 3 and I could not find a complete ex..

Remove Datepicker Function dynamically

I want to remove datepicker function depending on the dropdownlist selected value. I try the following codes, but it still shows the calendar when I put the cursor in the text box. Please give me a ..

python: restarting a loop

i have: for i in range(2,n): if(something): do something else: do something else i = 2 **restart the loop But that doesn't seem to work. Is there a way to restart that ..

AngularJS: Basic example to use authentication in Single Page Application

I am new to AngularJS and gone through their tutorial and got a feel for it. I have a backend for my project ready where each of the REST endpoints needs to be authenticated. What I want to do a.) I..

How can I run Tensorboard on a remote server?

I'm new to Tensorflow and would greatly benefit from some visualizations of what I'm doing. I understand that Tensorboard is a useful visualization tool, but how do I run it on my remote Ubuntu machin..

Get data from php array - AJAX - jQuery

I have a page as below; <head> <script type="text/javascript" src="jquery-1.6.1.js"></script> <script type="text/javascript"> $(document).ready( function() { $('#prev').click(..

How do you test a public/private DSA keypair?

Is there an easy way to verify that a given private key matches a given public key? I have a few *.puband a few *.key files, and I need to check which go with which. Again, these are pub/key files, D..

Accessing a local website from another computer inside the local network in IIS 7

Ok, so here is the scenario: I have computer A inside my local network running IIS 7. I added a new website, let's say samplesite.local, through IIS Manager, and edited the hosts file inside %systemr..

jquery how to catch enter key and change event to tab

I want a jquery solution, I must be close, what needs to be done? $('html').bind('keypress', function(e) { if(e.keyCode == 13) { return e.keyCode = 9; //set event key to tab }..

How to create a template function within a class? (C++)

I know it's possible to make a template function: template<typename T> void DoSomeThing(T x){} and it's possible to make a template class: template<typename T> class Object { public: ..

How to use absolute path in twig functions

I have an application with Symfony2 (2.2). When I want to send a mail, I'm having trouble with the paths, which are all relative paths and obviously aren't working inside emails for rendering the pat..

How to do something to each file in a directory with a batch script

How do you iterate over each file in a directory with a .bat or .cmd file? For simplicity please provide an answer that just echoes the filename or file path...

Service will not start: error 1067: the process terminated unexpectedly

We have a custom service that we install with our application. The only problem is that after it is installed, it will not start, generating the error above. I have tried to diagnose what the proble..

C++ trying to swap values in a vector

This is my swap function: template <typename t> void swap (t& x, t& y) { t temp = x; x = y; y = temp; return; } And this is my function (on a side note v stores string..

Object of class DateTime could not be converted to string

I have a table with string values in the format of Friday 20th April 2012 in a field called Film_Release I am looping through and i want to convert them in datetime and roll them out into another tab..

Regular expression for decimal number

I need to validate a textbox input and can only allow decimal inputs like: X,XXX (only one digit before decimal sign and a precision of 3). I'm using C# and try this ^[0-9]+(\.[0-9]{1,2})?$?..

How to put a UserControl into Visual Studio toolBox

I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can't. the UserControl is in my project namespace, and I tried Cho..

Django: multiple models in one template using forms

I'm building a support ticket tracking app and have a few models I'd like to create from one page. Tickets belong to a Customer via a ForeignKey. Notes belong to Tickets via a ForeignKey as well. I'd ..

"message failed to fetch from registry" while trying to install any module

I can't install any node module from the npm. npm install socket.io The above command resulted to below output, it is not able to install socket.io npm http GET https://registry.npmjs.org/socket.i..

Disable click outside of bootstrap modal area to close modal

I am making a bootstrap website, with a couple of Bootstrap 'Modals'. I'm trying to customize some of the default features. Problem is this; You can close the modal by clicking on the background. Is ..

How to concatenate string and int in C?

I need to form a string, inside each iteration of the loop, which contains the loop index i: for(i=0;i<100;i++) { // Shown in java-like code which I need working in c! String prefix = "pre_";..

In PHP, what is a closure and why does it use the "use" identifier?

I'm checking out some PHP 5.3.0 features and ran across some code on the site that looks quite funny: public function getTotal($tax) { $total = 0.00; $callback = /* This line here: *..

How to convert a date to milliseconds

I want to convert String myDate = "2014/10/29 18:10:45" to long ms (i.e. currentinmlilies)? I look for it on Google, but I can only find how to convert ms to date. Note: To make it clear, I want to..

How to turn a String into a JavaScript function call?

I got a string like: settings.functionName + '(' + t.parentNode.id + ')'; that I want to translate into a function call like so: clickedOnItem(IdofParent); This of course will have to be done in..

How to call a JavaScript function, declared in <head>, in the body when I want to call it

I have a working JavaScript function declared in the head of an HTML page. I know how to create a button and call the function when the user clicks the button. I want to call it myself some where on t..

NameError: global name 'unicode' is not defined - in Python 3

I am trying to use a Python package called bidi. In a module in this package (algorithm.py) there are some lines that give me error, although it is part of the package. Here are the lines: # utf-8 ?..

How to reload .bash_profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bash_profile by exiting and logging back in but I would like to be able to do it on demand...

Iterating Over Dictionary Key Values Corresponding to List in Python

Working in Python 2.7. I have a dictionary with team names as the keys and the amount of runs scored and allowed for each team as the value list: NL_East = {'Phillies': [645, 469], 'Braves': [599, 54..

How to use radio buttons in ReactJS?

I am new to ReactJS, sorry if this sounds off. I have a component that creates several table rows according to the received data. Each cell within the column has a radio checkbox. Hence the user can..

MySQL Multiple Joins in one query?

I have the following query: SELECT dashboard_data.headline, dashboard_data.message, dashboard_messages.image_id FROM dashboard_data INNER JOIN dashboard_messages ON dashboard_message_id = da..

PHP convert date format dd/mm/yyyy => yyyy-mm-dd

I am trying to convert a date from dd/mm/yyyy => yyyy-mm-dd. I have using the mktime() function and other functions but I cannot seem to make it work. I have managed to explode the original date us..

JPanel setBackground(Color.BLACK) does nothing

I have the folowing custom JPanel and I have aded it to my frame using Netbeans GUI builder but the background won't change! I can see the circle, drawing with g.fillOval(). What's wrong? public clas..