Questions Tagged with #Operating system

An operating System (OS) is a basic software whose role is to be an abstract layer between software requisitions for resources and the hardware available, manage input/output, memory allocation/deallocation, file systems, among other basic tasks a device (not necessarily a computer) should do.

How do I set a Windows scheduled task to run in the background?

Does anyone know how to set a scheduled task to run in background using Windows Task Scheduler? There doesn't seem to be any option to do this...

What is the difference between the operating system and the kernel?

I do not understand the difference between operating system and kernel. Can someone please explain it?..

What are the differences between virtual memory and physical memory?

I am often confused with the concept of virtualization in operating systems. Considering RAM as the physical memory, why do we need the virtual memory for executing a process? Where does this virtual..

Calculating Waiting Time and Turnaround Time in (non-preemptive) FCFS queue

I have 6 processes as follows: -- P0 -- arrival time = 0 burst time = 10 -- P1 -- arrival time = 110 burst time = 210 -- P2 -- arrival time = 130 burst time = 70 -- P3 -- ar..

Difference between multitasking, multithreading and multiprocessing?

Whats the difference between multitasking, multiprogramming & multiprocessing This comes regularly for my university OS exams and I can't find a good answer. I know quite a bit about multitasking..

How to run regasm.exe from command line other than Visual Studio command prompt?

I want to run regasm.exe from cmd. which is available in c:\windows\Microsoft.net\framework\2.057 I do like this c:\ regasm.exe It gives regasm is not recognized as internal or external command. So..

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

Comprehensive methods of viewing memory usage on Solaris

On Linux, the "top" command shows a detailed but high level overview of your memory usage, showing: Total Memory, Used Memory, Free Memory, Buffer Usage, Cache Usage, Swap size and Swap Usage. My qu..

python: get directory two levels up

Ok...I dont know where module x is, but I know that I need to get the path to the directory two levels up. So, is there a more elegant way to do: import os two_up = os.path.dirname(os.path.dirname(_..

Running windows shell commands with python

How can we interact with OS shell using Python ? I want to run windows cmd commands via python. How can it be achieved ?..

Context.startForegroundService() did not then call Service.startForeground()

I am using Service Class on the Android O OS. I plan to use the Service in the background. The Android documentation states that If your app targets API level 26 or higher, the system imposes..

What is the difference between a process and a thread?

What is the technical difference between a process and a thread? I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes..

What is private bytes, virtual bytes, working set?

I am trying to use the perfmon windows utility to debug memory leaks in a process. This is how perfmon explains the terms: Working Set is the current size, in bytes, of the Working Set of this proce..

Best way to find os name and version in Unix/Linux platform

I need to find the OS name and version on Unix/Linux platform. For this I tried following: lsb_release utility /etc/redhat-release or specific file But it does not seem to be best solution as LSB_..

What is an OS kernel ? How does it differ from an operating system?

I am not able to understand the difference between a kernel and an operating system. I do not see any difference between them. Is the kernel an operating system?..

DNS caching in linux

I am confused about DNS caching. I am writing a small forward proxy server and want to use OS DNS cache on a Linux system. If I understand correctly, then there is DNS caching at the browser level. T..

How to detect my browser version and operating system using JavaScript?

I have tried using the code below but it only display results in Chrome and Mozilla not working in IE6. <div id="example"></div> <script type="text/javascript"> txt = "<p>B..

How is TeamViewer so fast?

Sorry about the length, it's kinda necessary. Introduction I'm developing a remote desktop software (just for fun) in C# 4.0 for Windows Vista/7. I've gotten through basic obstacles: I have a robust..

How to run a program without an operating system?

How do you run a program all by itself without an operating system running? Can you create assembly programs that the computer can load and run at startup, e.g. boot the computer from a flash drive an..

Get operating system info

I recently started wondering about sites like http://thismachine.info/ that get the user's operating system info. I have not been able to find out how to do that with PHP, and wanted to try to figure ..

Find Process Name by its Process ID

Suppose I know the process ID. I want to find the process name by its ID, using windows batch script. How can I do this?..

What is the difference between the kernel space and the user space?

What is the difference between the kernel space and the user space? Do kernel space, kernel threads, kernel processes and kernel stack mean the same thing? Also, why do we need this differentiation?..

What is the return value of os.system() in Python?

I came across this: >>> import os >>> os.system('ls') file.txt README 0 What is return value of os.system()? Why I get 0?..

Get Windows version in a batch file

I need to get the OS version with a batch file. I 've seen a lot of examples online, many uses something like this code: @echo off ver | find "XP" > nul if %ERRORLEVEL% == 0 goto ver_xp if not e..

How to uninstall a windows service and delete its files without rebooting

My current project involves deploying an upgraded .exe file that runs as a Windows Service. In order to overwrite the existing .exe with the new version, I currently need to: Stop the service Unins..

What resources are shared between threads?

Recently, I have been asked a question in an interview what's the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. T..

What languages are Windows, Mac OS X and Linux written in?

I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI compon..

Fork() function in C

Below is an example of the Fork function in action. Below is also the output. My main question has to to do with the a fork is called how values are changed. So pid1,2 and 3 start off at 0 and get cha..

How can I safely create a nested directory?

What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried: import os file_path = "/my/direct..

What are file descriptors, explained in simple terms?

What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it? Does a process ta..

How to find the operating system version using JavaScript?

How can I find the OS name and OS version using JavaScript? ..

How do I check CPU and Memory Usage in Java?

I need to check CPU and memory usage for the server in java, anyone know how it could be done?..

Difference between binary semaphore and mutex

Is there any difference between a binary semaphore and mutex or are they essentially the same?..

What is the difference between user and kernel modes in operating systems?

What are the differences between User Mode and Kernel Mode, why and how do you activate either of them, and what are their use cases?..

Detect Windows version in .net

How can I detect the Windows OS versions in .net? What code can I use?..

Maximum number of processes in linux

What is the maximum limit to the number of processes possible in a linux system? How can we find it ?..

How do I programmatically determine operating system in Java?

I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on ..

How do I check the operating system in Python?

I want to check the operating system (on the computer where the script runs). I know I can use os.system('uname -o') in Linux, but it gives me a message in the console, and I want to write to a varia..

How to make parent wait for all child processes to finish?

I'm hoping someone could shed some light on how to make the parent wait for ALL child processes to finish before continuing after the fork. I have cleanup code which I want to run but the child proces..

How do I check OS with a preprocessor directive?

I need my code to do different things based on the operating system on which it gets compiled. I'm looking for something like this: #ifdef OSisWindows // do Windows-specific stuff #else // do Unix-sp..

What is the difference between user variables and system variables?

What is the difference between user variables such as PATH, TMP, etc. and system variables? I accidentally deleted the user variable PATH. What am I supposed to do?..

how to display excel sheet in html page

I want to display EXCEL sheet embedded in IE with plain HTML. I have gone through other questions on stackoverflow but could not find any useful one. Here is my html file <html> <body> &..

Python argparse: default value or specified value

I would like to have a optional argument that will default to a value if only the flag is present with no value specified, but store a user-specified value instead of the default if the user specifies..

How to make ng-repeat filter out duplicate results

I'm running a simple ng-repeat over a JSON file and want to get category names. There are about 100 objects, each belonging to a category - but there are only about 6 categories. My current code is ..

How to include file in a bash shell script

Is there a way to include another shell script in a shell script to be able to access its functions? Like how in PHP you can use the include directive with other PHP files in order to run the functio..

Disabling enter key for form

I have been trying to disable the Enter key on my form. The code that I have is shown below. For some reason the enter key is still triggering the submit. The code is in my head section and seems to b..

Inline style to act as :hover in CSS

I know that embedding CSS styles directly into the HTML tags they affect defeats much of the purpose of CSS, but sometimes it's useful for debugging purposes, as in: <p style="font-size: 24px">..

Access properties file programmatically with Spring?

We use the code below to inject Spring beans with properties from a properties file. <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name=..

How to implement Enums in Ruby?

What's the best way to implement the enum idiom in Ruby? I'm looking for something which I can use (almost) like the Java/C# enums...

How to convert a string to an integer in JavaScript?

How do I convert a string to an integer in JavaScript?..

Removing leading and trailing spaces from a string

How to remove spaces from a string object in C++. For example, how to remove leading and trailing spaces from the below string object. //Original string: " This is a sample string ..

Convert text to columns in Excel using VBA

I'm trying to convert text to columns using a macro but I'm not able to do it, I have tried to record a macro to achieve this, however I'm running into some issues since the text to columns VBA functi..

How to pass parameters on onChange of html select

I am a novice at JavaScript and jQuery. I want to show one combobox-A, which is an HTML <select> with its selected id and contents at the other place on onChange(). How can I pass the complete..

Convert JSON String to Pretty Print JSON output using Jackson

This is the JSON string I have: {"attributes":[{"nm":"ACCOUNT","lv":[{"v":{"Id":null,"State":null},"vt":"java.util.Map","cn":1}],"vt":"java.util.Map","status":"SUCCESS","lmd":13585},{"nm":"PROFILE","..

How to set adaptive learning rate for GradientDescentOptimizer?

I am using TensorFlow to train a neural network. This is how I am initializing the GradientDescentOptimizer: init = tf.initialize_all_variables() sess = tf.Session() sess.run(init) mse = tf.r..

How to prevent column break within an element?

Consider the following HTML: <div class='x'> <ul> <li>Number one</li> <li>Number two</li> <li>Number three</li> <..

Java POI : How to read Excel cell value and not the formula computing it?

I am using Apache POI API to getting values from an Excel file. Everything is working great except with cells containing formulas. In fact, the cell.getStringCellValue() is returning the formula used..

Catch an exception thrown by an async void method

Using the async CTP from Microsoft for .NET, is it possible to catch an exception thrown by an async method in the calling method? public async void Foo() { var x = await DoSomethingAsync(); ..

How to customize a Spinner in Android

I want to add a custom height to the dropdown of a Spinner, say 30dp, and I want to hide the dividers of the dropdown list of Spinner. So far I tried to implement following style to the Spinner: <..

List all kafka topics

I'm using kafka 0.10 without zookeeper. I want to get kafka topics list. This command is not working since we're not using zookeeper: bin/kafka-topics.sh --list --zookeeper localhost:2181. How can I ..

Eclipse/Java code completion not working

I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ). Now I find when I'm editing Java projects the code completion is not working. If..

What is the preferred syntax for defining enums in JavaScript?

What is the preferred syntax for defining enums in JavaScript? Something like: my.namespace.ColorEnum = { RED : 0, GREEN : 1, BLUE : 2 } // later on if(currentColor == my.namespace.Colo..

How to get user agent in PHP

I'm using this JS code to know what browser is user using for. <script> document.write(navigator.appName); </script> And I want to get this navigator.appName to php code to use it li..

VB.NET Connection string (Web.Config, App.Config)

Really having an annoying time with connection strings. I have two projects together in a single solution. A Web forms application acting as the presentation layer, and a class library supporting it ..

How do I change a TCP socket to be non-blocking?

How do you make a socket non-blocking? I am aware of the fcntl() function, but I've heard it's not always reliable...

How to get a jqGrid cell value when editing

How to get a jqGrid cell value when in-line editing (getcell and getRowData returns the cell content and not the actuall value of the input element)...

Android Studio - How to Change Android SDK Path

When I open Android SDK Manager from Android Studio, the SDK Path displayed is: \android-studio\sdk I want to change this path. How do I do it?..

How do you change the value inside of a textfield flutter?

I have a TextEditingController where if a user clicks a button it fills in with information. I can't seem to figure out how to change the text inside of a Textfield or TextFormField. Is there a soluti..

How to see the proxy settings on windows?

Our work laptops are configured to use proxy to access external sites and I don't have access to see the proxy information. All our applications like IDEs are configured to use system proxy. Is there ..

"No Content-Security-Policy meta tag found." error in my phonegap application

After update Cordova 5.0 in my system, I create new applications. When I tested my application on a device that time I get an error in the console log: No Content-Security-Policy meta tag found. Plea..

Setting Custom ActionBar Title from Fragment

In my Main FragmentActivity, I setup my custom ActionBar title like this: LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View ..

What is the purpose of wrapping whole Javascript files in anonymous functions like “(function(){ … })()”?

I have been reading a lot of Javascript lately and I have been noticing that the whole file is wrapped like the following in the .js files to be imported. (function() { ... code ... })()..

Using current time in UTC as default value in PostgreSQL

I have a column of the TIMESTAMP WITHOUT TIME ZONE type and would like to have that default to the current time in UTC. Getting the current time in UTC is easy: postgres=# select now() at time zone '..

What is 0x10 in decimal?

I have the following code: SN.get_Chars(5) SN is a string so this should give the 5th Char. Ok! Now I have another code but: SN.get_Chars(0x10) I wonder what 0x10 is? Is it a number? If it's so, ..

How to get row number in dataframe in Pandas?

How can I get the number of the row in a dataframe that contains a certain value in a certain column using Pandas? For example, I have the following dataframe: ClientID LastName 0 34 ..

jQuery UI: Datepicker set year range dropdown to 100 years

Using the Datepicker the year drop down by default shows only 10 years. The user has to click the last year in order to get more years added. How can we set the initial range to be 100 years so that ..

Should jQuery's $(form).submit(); not trigger onSubmit within the form tag?

I have the following: <script type="text/javascript"> function CancelFormButton(button) { $(button.form).submit(); } </script> <form onsubmit="alert('here');"> <input type="..

Android Studio Run/Debug configuration error: Module not specified

I am getting a 'Module not specified' error in my run config. I have no module showing in the drop down yet I can see my module no probs. The issue came about when I refactored my module name, changed..

jQuery count number of divs with a certain class?

Considering something like this; <div class="wrapper"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div cla..

How do I get the command-line for an Eclipse run configuration?

I have several JUnit run configurations in Eclipse that I need to replicate on the command-line in order to use a third-party analysis tool. So far I've just been writing the command-line manually by..

How do I mount a host directory as a volume in docker compose

I have a development environment I'm dockerizing and I would like the ability to livereload my changes without having to rebuild docker images. I'm using docker compose because redis is one of my app'..

Fastest way to tell if two files have the same contents in Unix/Linux?

I have a shell script in which I need to check whether two files contain the same data or not. I do this a for a lot of files, and in my script the diff command seems to be the performance bottleneck...

What is the maximum float in Python?

I think the maximum integer in python is available by calling sys.maxint. What is the maximum float or long in Python?..

Invalid character in identifier

I am working on the letter distribution problem from HP code wars 2012. I keep getting an error message that says "invalid character in identifier". What does this mean and how can it be fix..

Bind service to activity in Android

I'm trying to write a simple media player that plays streaming audio using RTSP. I have a GUI-activity and a service that performs the playback. My question is how to best communicate between the acti..

PHP + curl, HTTP POST sample code?

Can anyone show me how to do a php curl with an HTTP POST? I want to send data like this: username=user1, password=passuser1, gender=1 To www.domain.com I expect the curl to return a response lik..

Accessing AppDelegate from framework?

I'm creating my first framework in Objective-C that wraps the facebook SDK in a more intuitive way. There are several points in my framework where I'd like to reference the AppDelegate, but there is n..

How do you load custom UITableViewCells from Xib files?

The question is simple: How do you load custom UITableViewCell from Xib files? Doing so allows you to use Interface Builder to design your cells. The answer apparently is not simple due to memory mana..

Nginx serves .php files as downloads, instead of executing them

I am installing a website in a droplet (Digital Ocean). I have a issue for install NGINX with PHP properly. I did a tutorial https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx..

What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?

May I know what is the difference between:- Spring Struts Struts 2 Hibernate JavaServer Faces JavaServer Pages Tapestry Are these technologies/framework complementary to each other? Or they are al..

Iterate through string array in Java

I have String array with some components, this array has 5 components and it vary some times. What I would like to do is to iterate through that array and get the first component and the component nex..

How can I check whether an array is null / empty?

I have an int array which has no elements and I'm trying to check whether it's empty. For example, why is the condition of the if-statement in the code below never true? int[] k = new int[3]; if (k..

How to get cell value from DataGridView in VB.Net?

I have a problem, how can i get value from cell of datagridview ---------------------------------- id | p/w | post | ---------------------------------- 1 | 1234 | A ..

Python: Get HTTP headers from urllib2.urlopen call?

Does urllib2 fetch the whole page when a urlopen call is made? I'd like to just read the HTTP response header without getting the page. It looks like urllib2 opens the HTTP connection and then subs..

Why do we usually use || over |? What is the difference?

I'm just wondering why we usually use logical OR || between two booleans not bitwise OR |, though they are both working well. I mean, look at the following: if(true | true) // pass if(true | fals..

Why is ZoneOffset.UTC != ZoneId.of("UTC")?

Why does ZonedDateTime now = ZonedDateTime.now(); System.out.println(now.withZoneSameInstant(ZoneOffset.UTC) .equals(now.withZoneSameInstant(ZoneId.of("UTC")))); print out false? I would e..

error opening trace file: No such file or directory (2)

I am getting the above error: error opening trace file: No such file or directory (2) when I run my android application on the emulator. Can someone tell me what could be the possible reason f..

What is the difference between __str__ and __repr__?

What is the difference between __str__ and __repr__ in Python?..

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found

How can I get GLIBCXX_3.4.15 in Ubuntu? I can't run some programs that I'm compiling. When I do: strings /usr/lib/libstdc++.so.6 | grep GLIBC I get: GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCX..

How can I access Google Sheet spreadsheets only with Javascript?

I want to access Google Spreadsheets using JavaScript only (no .NET, C#, Java, etc.) I came here and was shocked to know that there is NO API for JavaScript to access Google Sheets. Please tell me h..

Converting java.sql.Date to java.util.Date

What's the simplest way to convert a java.sql.Date object to a java.util.Date while retaining the timestamp? I tried: java.util.Date newDate = new Date(result.getDate("VALUEDATE").getTime()); with..

How to read strings from a Scanner in a Java console application?

import java.util.Scanner; class MyClass { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int employeeId, supervisorId; String name; ..

Best Java obfuscator?

I am developing a security software and want to obfuscate my java code so it will become impossible to reverse engineer. What is the most reliable java obfuscator ?..

numpy get index where value is true

>>> ex=np.arange(30) >>> e=np.reshape(ex,[3,10]) >>> e array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [20, 21, 22, ..

Converting Stream to String and back...what are we missing?

I want to serialize objects to strings, and back. We use protobuf-net to turn an object into a Stream and back, successfully. However, Stream to string and back... not so successful. After going thr..

"unrecognized selector sent to instance" error in Objective-C

I created a button and added an action for it, but as soon as it invoked, I got this error: -[NSCFDictionary numberButtonClick:]: unrecognized selector sent to instance 0x3d03ac0 2010-03-16 22:23:58..

How to check if an NSDictionary or NSMutableDictionary contains a key?

I need to check if an dict has a key or not. How?..

What languages are Windows, Mac OS X and Linux written in?

I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI compon..

MySQL Install: ERROR: Failed to build gem native extension

I'm trying to get MySQL installed to the latest version due to some installation going wrong somewhere along the line. I run the command gem install mysql and I receive the following: Building na..

Using regular expressions to do mass replace in Notepad++ and Vim

So I've got a big text file which looks like the following: <option value value='1' >A <option value value='2' >B <option value value='3' >C <option value value='4' >D It's ..

Where can I view Tomcat log files in Eclipse?

Where can I view Tomcat log files in Eclipse? For some reason my Tomcat installation/log folder is always empty. BTW, does Tomcat dump to the log file after a while or is it immediate?..

How to cast or convert an unsigned int to int in C?

My apologies if the question seems weird. I'm debugging my code and this seems to be the problem, but I'm not sure. Thanks!..

Python function overloading

I know that Python does not support method overloading, but I've run into a problem that I can't seem to solve in a nice Pythonic way. I am making a game where a character needs to shoot a variety of..

What is the purpose of Node.js module.exports and how do you use it?

What is the purpose of Node.js module.exports and how do you use it? I can't seem to find any information on this, but it appears to be a rather important part of Node.js as I often see it in source c..

Using custom font in android TextView using xml

I have added a custom font file to my assets/fonts folder. How do I use it from my XML? I can use it from code as follows: TextView text = (TextView) findViewById(R.id.textview03); Typeface tf = ..

Is there anything like .NET's NotImplementedException in Java?

Is there anything like .NET's NotImplementedException in Java?..

Can I avoid the native fullscreen video player with HTML5 on iPhone or android?

I've built a web app that uses the HTML5 tag and JavaScript code that renders other content synchronized with the running video. It works great in desktop browsers: Firefox, Chrome, and Safari. On an..

Converting VS2012 Solution to VS2010

I'm working in VB project with VS 2012 and after finish I try to add setup project. I didn't find it (because the Setup Project was discontinued after VS2010) so I switched to VS2010 but the problem..

Clear the cache in JavaScript

How do I clear a browsers cache with JavaScript? We deployed the latest JavaScript code but we are unable to get the latest JavaScript code. Editorial Note: This question is semi-duplicated in the f..

Regular expression: zero or more occurrences of optional character /

What is the regular expression pattern to say: zero or more occurrences of the character / ?..

How to find value using key in javascript dictionary

I have a question about Javascript's dictionary. I have a dictionary in which key-value pairs are added dynamically like this: var Dict = [] var addpair = function (mykey , myvalue) [ Dict.push({ ..

Field 'browser' doesn't contain a valid alias configuration

I've started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can't seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js M..

concat scope variables into string in angular directive expression

I am using a scope method in an angular ng-click directive like so: <a ng-click="$navigate.go('#/path/obj.val1/obj.val2')">{{obj.val1}}, {{obj.val2}}</a> The trouble here is that obj.va..

How to add RSA key to authorized_keys file?

I've created an RSA public key and I want to add that to authorized_keys file, but there is no such file in my Ubuntu 11.10 machine. How can I add the key to authorized_keys?..

get an element's id

Is there another way to get an DOM element's ID? element.getAttribute('id') ..

How do you use subprocess.check_output() in Python?

I have found documentation about subprocess.check_output() but I cannot find one with arguments and the documentation is not very in depth. I am using Python 3 (but am trying to run a Python 2 file t..

http://localhost:8080/ Access Error: 404 -- Not Found Cannot locate document: /

I'm really very new to this Tomcat stuff. I downloaded Tomcat 7.0 windows installer and installed it using the default configuration. After installing, I typed localhost:8080 in my browser to see if T..

Hash Map in Python

I want to implement a HashMap in Python. I want to ask a user for an input. depending on his input I am retrieving some information from the HashMap. If the user enters a key of the HashMap, I would..

Cannot start GlassFish 4.1 from within Netbeans 8.0.1 Service area

On Windows 7 I downloaded the 'netbeans-8.0.1-javaee-windows.exe' installer from this site https://netbeans.org/downloads/. The installer installs GlassFish 4.1, Java 1.8.0_20 and NetBeans 8.01. After..

'Java' is not recognized as an internal or external command

When trying to check the current version of Java in which I am running, I received the error "java is not recognized as an internal or external command, operable program or batch file.". I a..

How to set Angular 4 background image?

I am trying the following lines to set the background image.but it not works. what are the way set background image in constantly in my application. app.component.html <div [ngStyle]="{'backgroun..

Using Excel VBA to run SQL query

I am fairly new to SQL and VBA. I have written a SQL query that I would like to be able to call and run from a VBA sub in an excel workbook and then bring the query results into the workbook. I have f..

What should my Objective-C singleton look like?

My singleton accessor method is usually some variant of: static MyClass *gInstance = NULL; + (MyClass *)instance { @synchronized(self) { if (gInstance == NULL) gInstance ..

How to pass extra variables in URL with WordPress

I am having trouble trying to pass an extra variable in the url to my WordPress installation. For example /news?c=123 For some reason, it works only on the website root www.example.com?c=123 but it..

Should I use window.navigate or document.location in JavaScript?

What's the preferred method to use to change the location of the current web page using JavaScript? I've seen both window.navigate and document.location used. Are there any differences in behavior? Ar..

C++, copy set to vector

I need to copy std::set to std::vector: std::set <double> input; input.insert(5); input.insert(6); std::vector <double> output; std::copy(input.begin(), input.end(), output.begin()); //E..

Automated testing for REST Api

I would like to write an automated testing suite for a REST API. As we complete new services, we'd like to check to make sure all the previously created services are working as expected. Any suggestio..

'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository

I am not able to clone or push to a git repository at Bitbucket in Eclipse: It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error ke..

jQuery validation: change default error message

Is there a simple way to change the default error values in the jQuery validation plugin? I just want to rewrite the error messages to be more personal to my app--I have a lot of fields, so I don't w..

Session TimeOut in web.xml

I am trying to understand the real purpose of session configuration in Web.xml for session timeout. <!-- Session Configuration --> <session-config> <session-timeout>60</s..

Restrict varchar() column to specific values?

Is there a way to specify, for example 4 distinct values for a varchar column in MS SQL Server 2008? For example, I need a column called Frequency (varchar) that only accepts 'Daily', 'Weekly', 'Mont..

Transaction marked as rollback only: How do I find the cause

I am having issues with committing a transaction within my @Transactional method: methodA() { methodB() } @Transactional methodB() { ... em.persist(); ... em.flush(); log("OK..

Converting EditText to int? (Android)

I am wondering how to convert an edittext input to an int, I have the user input a number, it than divides it by 8. MainActivity.java @SuppressWarnings("unused") public void calcSpeed(View view) { ..

What is the difference between IQueryable<T> and IEnumerable<T>?

What is the difference between IQueryable<T> and IEnumerable<T>? See also What's the difference between IQueryable and IEnumerable that overlaps with this question...

How to redirect cin and cout to files?

How can I redirect cin to in.txt and cout to out.txt?..

Creating a batch file, for simple javac and java command execution

It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet. My goal is to create a .bat which will open cmd and execute m..

How to clear exisiting dropdownlist items when its content changes?

ddl2 populates based on ddl1 selected value successfully. My issue is the data that is already present in ddl2 does not clear before appending the new data so ddl2 content just continues to grow ever..

Find row where values for column is maximal in a pandas DataFrame

How can I find the row for which the value of a specific column is maximal? df.max() will give me the maximal value for each column, I don't know how to get the corresponding row...

PHP Create and Save a txt file to root directory

I am trying to create and save a file to the root directory of my site, but I don't know where its creating the file as I cannot see any. And, I need the file to be overwritten every time, if possible..

How to install ia32-libs in Ubuntu 14.04 LTS (Trusty Tahr)

I installed Ubuntu 14.04 (Trusty Tahr) yesterday. Everything seems OK. But when I tried to compile some C code, I encounter the following error. The error seems to be due to the OS lacking the 32-bit ..

Angularjs: input[text] ngChange fires while the value is changing

ngChange is firing while the value is changing (ngChange are not similiar to the classic onChange event). How can i bind the classic onChange event with angularjs, that will only fire when the content..

When should I create a destructor?

For example: public class Person { public Person() { } ~Person() { } } When should I manually create a destructor? When have you needed to create a destructor? ..

python multithreading wait till all threads finished

This may have been asked in a similar context but I was unable to find an answer after about 20 minutes of searching, so I will ask. I have written a Python script (lets say: scriptA.py) and a script..

How do I create an Android Spinner as a popup?

I want to bring up a spinner dialog when the user taps a menu item to allow the user to select an item. Do I need a separate dialog for this or can I use Spinner directly? I see this link, mentions a..

Access a JavaScript variable from PHP

I need to access a JavaScript variable with PHP. Here's a stripped-down version of the code I'm currently trying, which isn't working: <script type="text/javascript" charset="utf-8"> var te..

How to set the default value of an attribute on a Laravel model

How to set the default value of an attribute on a Laravel model? Should I set the default when creating a migration or should I set it in the model class?..

How to make Java work with SQL Server?

I know this is a basic question, but I can't seem to find an answer and I apologize, if this question is way too stupid, but here we go: I am supposed to work with SQL Server (no problem so far) and ..

How to access private data members outside the class without making "friend"s?

I have a class A as mentioned below:- class A{ int iData; }; I neither want to create member function nor inherit the above class A nor change the specifier of iData. My doubts:- How to acc..

UTL_FILE.FOPEN() procedure not accepting path for directory?

I am trying to write in a file stored in c:\ drive named vin1.txt and getting this error .Please suggest! > ERROR at line 1: ORA-29280: invalid > directory path ORA-06512: at > "SYS.UTL_FILE..

Converting a String array into an int Array in java

I am new to java programming. My question is this I have a String array but when I am trying to convert it to an int array I keep getting java.lang.NumberFormatException My code is private void p..

How to move mouse cursor using C#?

I want to simulate mouse movement every x seconds. For that, I'll use a timer (x seconds) and when the timer ticks I'll make the mouse movement. But, how can I make the mouse cursor move using C#?..

Load image with jQuery and append it to the DOM

I'm trying to load an image from a given link var imgPath = $(imgLink).attr('href'); and append it to the page, so I can insert it into a given element for an image viewer. Even though I searched ..

get user timezone

Possible Duplicate: How can I determine a web user's time zone? Which is the best way to do this ? php or javascript.Can someone provide me with some snippets ? thanks...

What is Gradle in Android Studio?

Gradle is a bit confusing to me, and also for any new Android developer. Can anyone explain what Gradle in Android Studio is and what its purpose is? Why is it included in Android Studio?..

What is a .pid file and what does it contain?

I recently come across a file with the extension .pid and explored inside it but didn't find much. The documentation says: A Pid-File is a file containing the process identification number (pid) t..

Problems using Maven and SSL behind proxy

I just downloaded Maven and was trying to run the simple command found on the "Maven in Five Minutes" page (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). This is the comm..

How to query a CLOB column in Oracle

I'm trying to run a query that has a few columns that are a CLOB datatype. If i run the query like normal, all of those fields just have (CLOB) as the value. I tried using DBMS_LOB.substr(column) and..

Android - java.lang.SecurityException: Permission Denial: starting Intent

I have a library (jar) on build path of my project. The project accesses the MainActivity in the jar, using the following intent: final Intent it = new Intent(); it.setClassName("com.example.lib", "c..

How to use Ajax.ActionLink?

First of all, where is the documentation for Ajax.* methods in asp.net mvc? Can Ajax.ActionLink be used to call an action, get a partial view, open a modal window and put the content in it?..

How to get just the parent directory name of a specific file

How to get ddd from the path name where the test.java resides. File file = new File("C:/aaa/bbb/ccc/ddd/test.java"); ..

Get JSON data from external URL and display it in a div as plain text

I have an external resource similar to https://www.googleapis.com/freebase/v1/text/en/bob_dylan which returns a JSON. I want to display the value of result key in a div in html (lets say the name of t..

Service vs IntentService in the Android platform

I am seeking an example of something that can be done with an IntentService that cannot be done with a Service (and vice-versa)? I also believe that an IntentService runs in a different thread and a ..

Install Visual Studio 2013 on Windows 7

I would like to install Visual Studio 2013 on Windows 7 64-bit. For some reason, the installer says "Setup Blocked" with an error "This version of Visual Studio requires a computer with a newer versi..

How to get nth jQuery element

In jQuery, $("...").get(3) returns the 3rd DOM element. What is the function to return the 3rd jQuery element?..

Replace part of a string in Python?

I used regular expressions to get a string from a web page and part of the string may contain something I would like to replace with something else. How would it be possible to do this? My code is thi..

Restart container within pod

I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test. Is it possible to restart a single container within a pod and how? If not, how do I restart..

Mismatch Detected for 'RuntimeLibrary'

I downloaded and extracted Crypto++ in C:\cryptopp. I used Visual Studio Express 2012 to build all the projects inside (as instructed in readme), and everything was built successfully. Then I made a t..

How to pause javascript code execution for 2 seconds

I want to stop execution for 2 seconds. So is this, but now follows a code block: <html> <head> <title> HW 10.12 </title> <script type="text/javascript"> ..

Get refresh token google api

I can't get my refresh token with my code. I can only get my access token, token type etc., I have followed some tutorials like putting access_type=offline on my login URL: echo "<a href='https://..

How to ignore files/directories in TFS for avoiding them to go to central source repository?

Is it possible to set up files/folders to ignore on a per-project basis in TFS source control? For example, I've a website with an assets folder that I do not want to go in to source control. These a..

JavaScript - get the first day of the week from current date

I need the fastest way to get the first day of the week. For example: today is the 11th of November, and a Thursday; and I want the first day of this week, which is the 8th of November, and a Monday. ..

REST API error code 500 handling

We are building a new REST API. I was arguing that error code 500 (Internal Server Error) should never be returned. Now, of course if you know the client's params are wrong or something you have eve..

How do you run your own code alongside Tkinter's event loop?

My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely,..

CSS On hover show another element

I want to use CSS to show div id='b' when I hover over div id='a', but I cannot figure out how to do it because the div 'a' is inside another div that div 'b' is not in. <div id='content'> ..

Set initial value in datepicker with jquery?

I'm trying to set an initial value in my jquery ui datepicker. I've tried several different ways, but nothing seems to display the date, it's empty. var idag = new Date(); $("#txtFrom").datepicker("s..

Include another JSP file

I am currently trying to learn JSP. My question is, at present I used to include the header and footer of the page using: <%@include file="includes/header.jsp" %> and <%@include file="in..

Floating point exception

I successfully complied this code: #include <stdio.h> #include <math.h> int q; int main() { srand( time(NULL) ); int n=3; q=ceil(sqrt(n)); printf("%d\n %d\n", n,q); ..

C#: Waiting for all threads to complete

I'm running into a common pattern in the code that I'm writing, where I need to wait for all threads in a group to complete, with a timeout. The timeout is supposed to be the time required for all thr..

Floating elements within a div, floats outside of div. Why?

Say you have a div, give it a definite width and put elements in it, in my case an img and another div. The idea is that the content of the container div will cause the container div to stretch out,..

How can I merge two commits into one if I already started rebase?

I am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready. I ran git rebase --interactive HEAD~2 In the resulting editor, I change pick to squ..

How to switch activity without animation in Android?

How can I use properly the Intent flag FLAG_ACTIVITY_NO_ANIMATION in AndroidManifest file? I supose my problem is trivial, but I can't find good example or solution to it. <intent-filter> ..

Removing fields from struct or hiding them in JSON Response

I've created an API in Go that, upon being called, performs a query, creates an instance of a struct, and then encodes that struct as JSON before sending back to the caller. I'd now like to allow the..

Calculate time difference in Windows batch file

How can I get the difference between two times in a Batch file? Because I want to print it in an HTML file. I thought this would be possible, but it isn't. Set "tijd=%time%" echo %tijd% echo %time%-..

mysql: get record count between two date-time

I am stuck with a problem in MySQL. I want to get the count of records between two date-time entries. For example: I have a column in my table named 'created' having the datetime data type. I want to..

How to store .pdf files into MySQL as BLOBs using PHP?

How to store .pdf files into MySQL as BLOBs from PHP?..

Where to find "Microsoft.VisualStudio.TestTools.UnitTesting" missing dll?

I am getting following error in my C# visual studio project: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) I also..

Parse HTML table to Python list?

I'd like to take an HTML table and parse through it to get a list of dictionaries. Each list element would be a dictionary corresponding to a row in the table. If, for example, I had an HTML table wi..

open new tab(window) by clicking a link in jquery

I have a web app that displays rows with go and delete buttons. If a user clicks go, it should open new tab/window with url built from the row's data. how can I do this in jquery? What I'm doing is ..

Parsing JSON array into java.util.List with Gson

I have a JsonObject named "mapping" with the following content: { "client": "127.0.0.1", "servers": [ "8.8.8.8", "8.8.4.4", "156.154.70.1", "156.154.71.1" ..

How to launch jQuery Fancybox on page load?

I would like to launch a Fancybox (e.g. Fancybox's version of a modal or light box) on page load. I could bind it to a hidden anchor tag and fire the click event of that anchor tag via JavaScript, but..

ngrok command not found

I'm trying to install ngrok (which I've been using for a while on Windows with no issues) on my 1 week old yosemite and these are the steps I've followed so far. Downloaded ngrok from here https://n..

How can I divide two integers stored in variables in Python?

I've got two numbers stored in varibles, a and b, and i'd like to see of the ratio of those two is an integer or not in python. However when I try result = a./b it gives me a SyntaxError: invali..

How to change the application launcher icon on Flutter?

When I create an app with a flutter create command, the flutter logo is used as an application icon for both platforms. If I want to change the app icon, shall I go to both platforms directories and r..

How do I call a function twice or more times consecutively?

Is there a short way to call a function twice or more consecutively in Python? For example: do() do() do() maybe like: 3*do() ..

Clear text area

In Onselect event I have script: $("#vinanghinguyen_images_bbocde").val(''); $("#vinanghinguyen_images_bbocde").val(vinanghinguyen_final_bbcode); I want clear text area id="vinanghinguyen_images_bb..

jinja2.exceptions.TemplateNotFound error

i use flask and i got this error when i call this url: /login Here's my login method: @app.route('/login') def login(): if authenticateForPanel(): return redirect(url_for("panel")) e..

Get top n records for each group of grouped results

The following is the simplest possible example, though any solution should be able to scale to however many n top results are needed: Given a table like that below, with person, group, and age column..

How can I tell which button was clicked in a PHP form submit?

I have several buttons on my page, but I'm not sure how to tell which one was clicked. Here's the markup for my two buttons: <input type="submit" id="btnSubmit" value="Save Changes" /> <inpu..

how to run mysql in ubuntu through terminal

trying to run mysql in ubuntu typing mysql in terminal and getting error ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO) Can anybody please sort out this problem....

CSS show div background image on top of other contained elements

Not sure if this is possible and how, but I tried playing around with the z-index of the elements in my code with no success. I have a div element that has a background image set in css. inside the ..

How to get package name from anywhere?

I am aware of the availability of Context.getApplicationContext() and View.getContext(), through which I can actually call Context.getPackageName() to retrieve the package name of an application. The..

Entityframework Join using join method and lambdas

It seems there are different ways to do joins using linq. One is more straightforward and involves just joining tables like this: var found = from c in s.categories join cm in s.categorym..

Switching from zsh to bash on OSX, and back again?

So Im learning to develop in Rails, and have discovered the power of zsh. However, for some of my other tasks, I wish to use normal Bash. Although they are the same, I just feel comfortable with the l..

android.app.Application cannot be cast to android.app.Activity

I'm trying to change a LinearLayout from another class, but when i run this code: public class IRC extends PircBot { ArrayList<String> channels; ArrayList<Integer> userCount; ArrayList&l..

How to get current memory usage in android?

I have used /proc/meminfo and parsed command response.however it result shows that : MemTotal: 94348 kB MemFree: 5784 kB means. it shows there is only 5MB free memory. Is it possibl..

Select multiple columns in data.table by their numeric indices

How can we select multiple columns using a vector of their numeric indices (position) in data.table? This is how we would do with a data.frame: df <- data.frame(a = 1, b = 2, c = 3) df[ , 2:3] # ..

How to get the HTML's input element of "file" type to only accept pdf files?

is there any way that html element file <input name="file1" type="file" style="width:300px"> only accept PDF files and when we browse its only show PDF files... Thanks..

Passing structs to functions

I am having trouble understanding how to pass in a struct (by reference) to a function so that the struct's member functions can be populated. So far I have written: bool data(struct *sampleData) { }..

How do you completely remove the button border in wpf?

I'm trying to create a button that has an image in it and no border - just like the Firefox toolbar buttons before you hover over them and see the full button. I've tried setting the BorderBrush to T..

Start and stop a timer PHP

I need some information regarding starting and stopping a timer in PHP. I need to measure the elapsed time from the start of my .exe program (I'm using exec() function in my php script) until it compl..

HTML email in outlook table width issue - content is wider than the specified table width

My HTML email template is displaying correctly without major problems in Gmail, Apple Mail and iOS Mail. Outlook however is a horrifying mess and I can't for the life of me figure out what I've done w..

get everything between <tag> and </tag> with php

I'm trying to grab a string within a string using regex. I've looked and looked but I can't seem to get any of the examples I have to work. I need to grab the html tags <code> and </code> and ..

iOS - Dismiss keyboard when touching outside of UITextField

I'm wondering how to make the keyboard disappear when the user touches outside of a UITextField...

Uncaught Invariant Violation: Too many re-renders. React limits the number of renders to prevent an infinite loop

I'm trying to add a snackBar in order to display a message whenever a user signIn or not. SnackBar.jsx: import React from "react"; import PropTypes from "prop-types"; import classNames from "classnam..

Making the Android emulator run faster

The Android emulator is a bit sluggish. For some devices, like the Motorola Droid and the Nexus One, the app runs faster in the actual device than the emulator. This is a problem when testing games an..

How to format a Java string with leading zero?

Here is the String, for example: "Apple" and I would like to add zero to fill in 8 chars: "000Apple" How can I do so?..

PHP to write Tab Characters inside a file?

How do i simply write out a file including real tabs inside? tab means real tab which is not the spaces. How to write the tab or what is the character for real tab? For example here: $chunk = "a,b,c..

How to avoid reverse engineering of an APK file?

I am developing a payment processing app for Android, and I want to prevent a hacker from accessing any resources, assets or source code from the APK file. If someone changes the .apk extension to .z..

Live video streaming using Java?

Are there any good libraries for streaming live video using Java? Ideally both ends of the pipe should be written in Java but I am mostly concerned about the video player. What software would you reco..

How to install requests module in Python 3.4, instead of 2.7

I have both Python 2.7 and 3.4 installed on my Ubuntu 14.04 machine. I want to install the 'requests' module so it is accessible from Py3.4. When I issued pip install requests on my terminal cmd lin..

Force re-download of release dependency using Maven

I'm working on a project with dependency X. X, in turn, depends on Y. I used to explicitly include Y in my project's pom. However, it was not used and to make things cleaner, I instead added it to X'..

How can I rename a field for all documents in MongoDB?

Assuming I have a collection in MongoDB with 5000 records, each containing something similar to: { "occupation":"Doctor", "name": { "first":"Jimmy", "additional":"Smith" } Is there an easy wa..

Creating a JSON dynamically with each input value using jquery

I got a situation where I would like to read some data off a JSON format through PHP, however I am having some issues understanding how I should construct the Javascript object to create the JSON form..

install beautiful soup using pip

I am trying to install BeautifulSoup using pip in Python 2.7. I keep getting an error message, and can't understand why. I followed the instructions to install pip, which was installed to the followi..

rsync copy over only certain types of files using include option

I use the following bash script to copy only files of certain extension(in this case *.sh), however it still copies over all the files. what's wrong? from=$1 to=$2 rsync -zarv --include="*.sh" $f..

Postgres manually alter sequence

I'm trying to set a sequence to a specific value. SELECT setval('payments_id_seq'), 21, true This gives an error: ERROR: function setval(unknown) does not exist Using ALTER SEQUENCE doesn't ..

Why doesn't JavaScript have a last method?

Its kinda weird that the JavaScript Array class does not offer a last method to retrieve the last element of an array. I know the solution is simple (Ar[Ar.length-1] ), but, still, this is too frequen..

In php, is 0 treated as empty?

Code will explain more: $var = 0; if (!empty($var)){ echo "Its not empty"; } else { echo "Its empty"; } The result returns "Its empty". I thought empty() will check if I already set the variable a..

Functions that return a function

I'm stuck with this concept of 'Functions that return functions'. I'm referring the book 'Object Oriented Javascript' by Stoyan Stefanov. Snippet One: _x000D_ _x000D_ function a() {_x000D_ ..

Combine [NgStyle] With Condition (if..else)

I have read NgStyle Documentation For Angular 2, and it is a little bit confusing for me. How do I use NgStyle with condition like (if...else) to set background image of any element? ..

How do I open an .exe from another C++ .exe?

What I want to do is open an .exe from another .exe. I really don't know how to do this, so I searched the internet. I tried some suggested methods from the internet, but it didn't work. Here's my co..