Questions Tagged with #Markov models

How can I use Async with ForEach?

Is it possible to use Async when using ForEach? Below is the code I am trying: using (DataContext db = new DataLayer.DataContext()) { db.Groups.ToList().ForEach(i => async { await GetA..

Set div height to fit to the browser using CSS

I have two DIVs inside a container div, where I need to set them both to fit to the browser window like below, but it doesn't fit in my code, please suggest me a solution My Style Sheet code html..

Submitting the value of a disabled input field

I want to disable an input field, but when I submit the form it should still pass the value. Use case: I am trying to get latitude and longitude from Google Maps and wanna display it, but I don't wan..

Undefined reference to 'vtable for xxx'

takeaway.o: In function `takeaway': project:145: undefined reference to `vtable for takeaway' project:145: undefined reference to `vtable for takeaway' takeaway.o: In function `~takeaway': project:151..

How to convert md5 string to normal text?

I have saved user passwords in MD5 form in my database, now I want to send password to users in plaintext, is there any way I can convert an MD5 string to plaintext? ..

How to make a transparent HTML button?

I am using dreamweaver to create a website and I thought of just using Photoshop to create backgrounds. I decided to do so only because in case I'd choose to change the button name easily by just edit..

Is there a better way to run a command N times in bash?

I occasionally run a bash command line like this: n=0; while [[ $n -lt 10 ]]; do some_command; n=$((n+1)); done To run some_command a number of times in a row -- 10 times in this case. Often some_..

document.getElementById('btnid').disabled is not working in firefox and chrome

I'm using JavaScript for disabling a button. Works fine in IE but not in FireFox and chrome, here is the script what I'm working on: function disbtn(e) { if ( someCondition == true ) { do..

ImportError: No module named PytQt5

following are my python, qt and sip versions root@thura:~# python -V Python 2.7.3 root@thura:~# qmake --version QMake version 3.0 Using Qt version 5.0.2 in /usr/lib/i386-linux-gnu root@thura:~# sip -..

NumPy array is not JSON serializable

After creating a NumPy array, and saving it as a Django context variable, I receive the following error when loading the webpage: array([ 0, 239, 479, 717, 952, 1192, 1432, 1667], dtype=int64) ..

How to format time since xxx e.g. “4 minutes ago” similar to Stack Exchange sites

The question is how to format a JavaScript Date as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow. e.g. 1 minute ago 1 hour ago 1 day ago 1 month ago..

how to include glyphicons in bootstrap 3

I've not used any of the bootstrap frameworks before. I want to include some of the glyphicons in bootstrap 3 on my page. From what I understand they should be included in a bootstrap.css file which I..

React Native TextInput that only accepts numeric characters

I need to have a React Native TextInput component that will only allow numeric characters (0 - 9) to be entered. I can set the keyboardType to numeric which almost gets me there for input except for t..

AngularJS ng-click to go to another page (with Ionic framework)

Ideally, when I click on the button (which is in the Ionic navbar at the top), it should bring me to another page. However its not working. Upon click, the nav bar buttons all disappears. When I use..

'mat-form-field' is not a known element - Angular 5 & Material2

I'm trying to use <mat-form-field> in an Angular project using Material2 but I've hit a wall. Getting the error message below. Uncaught Error: Template parse errors: 'mat-form-field' is not a ..

How to insert data into SQL Server

What the problem on my coding? I cannot insert data to ms sql.. I'm using C# as front end and MS SQL as databases... name = tbName.Text; userId = tbStaffId.Text; idDepart = int.Parse(cbDepart.Selecte..

How do I bind the enter key to a function in tkinter?

I am a Python beginning self-learner, running on MacOS. I'm making a program with a text parser GUI in tkinter, where you type a command in a Entry widget, and hit a Button widget, which triggers my p..

What is the Regular Expression For "Not Whitespace and Not a hyphen"

I tried this but it doesn't work : [^\s-] Any Ideas?..

How to make a flex item not fill the height of the flex container?

As you can see in the code below, the left div inside the flex container stretches to meet the height of the right div. Is there an attribute I can set to make its height the minimum required for hold..

What is the default font of Sublime Text?

I was looking and could not find an answer on this one. Which is Sublime Text's default font type? ..

3-dimensional array in numpy

New at Python and Numpy, trying to create 3-dimensional arrays. My problem is that the order of the dimensions are off compared to Matlab. In fact the order doesn't make sense at all. Creating a matr..

How to access session variables from any class in ASP.NET?

I have created a class file in the App_Code folder in my application. I have a session variable Session["loginId"] I want to access this session variables in my class, but when I am writing the fo..

If (Array.Length == 0)

If an array is empty, it looks like you can't check it's length using ".length". What's the best way to check if an array is empty?..

How can I use a C++ library from node.js?

How can I use a C++ library from node.js?..

Foreach loop in java for a custom object list

I have an ArrayList for type Room (my custom object) Defined as below ArrayList<Room> rooms = new ArrayList<Room>(); After then adding a series of objects to the ArrayList I want to go ..

SecurityException: Permission denied (missing INTERNET permission?)

this error is really really really strange and I don't know how to reproduce it and how to fix it because I made a lot of searches but nothing was useful. Here's the stacktrace: Stack Trace ________..

Getting Access Denied when calling the PutObject operation with bucket-level permission

I followed the example on http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_examples.html#iam-policy-example-s3 for how to grant a user access to just one bucket. I then tested the conf..

Is there a difference between `continue` and `pass` in a for loop in python?

Is there any significant difference between the two python keywords continue and pass like in the examples for element in some_list: if not element: pass and for element in some_list: ..

How to build an APK file in Eclipse?

When I develop the project using Eclipse, the APK file goes on the emulator. But I want to upload my application to a real device. Is there a tool to build an APK file? What is the process? Or is it..

Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

today I just imported a sample app from Android SDK as a module in my project (analytics) and suddenly I got this gradle error when I try to sync it: Plugin is too old, please update to a more recent ..

AngularJS access parent scope from child controller

I've set up my controllers using data-ng-controller="xyzController as vm" I have a scenario with parent / child nested controllers. I have no problem accessing parent properties in the nested html by..

Jquery post, response in new window

I have a script that on.DocumentReady posts data to another page. That page responds with some HTML encapsulated in one div tag. My goal is to have this post response/data open in a new window. Any ..

Storing Data in MySQL as JSON

I thought this was a n00b thing to do. And, so, I've never done it. Then I saw that FriendFeed did this and actually made their DB scale better and decreased latency. I'm curious if I should do this. ..

Converting Date and Time To Unix Timestamp

I'm displaying the date and time like this 24-Nov-2009 17:57:35 I'd like to convert it to a unix timestamp so I can manipulate it easily. I'd need to use regex to match each part of the string t..

TypeError: $.browser is undefined

I am using msdropdown image combo box to create dropdown select options. when i run this code locally on my PC, everything works great. But when i run it on go daddy servers, the msdropdown becomes d..

What is the advantage of using heredoc in PHP?

What is the advantage of using heredoc in PHP, and can you show an example?..

How do I center content in a div using CSS?

How do I center content in a div both horizontally and vertically?..

How can I determine the character encoding of an excel file?

Possible Duplicate: Excel to CSV with UTF8 encoding Scenario: I have an excel file containing a large amount of global customer data. I do not know what encoding was used when the file was..

How to print an exception in Python 3?

Right now, I catch the exception in the except Exception: clause, and do print(exception). The result provides no information since it always prints <class 'Exception'>. I knew this used to work..

How to get the browser to navigate to URL in JavaScript

What is the best (correct, modern, cross-browser, safe) way to get a web browser to navigate to a URL of your choice using JavaScript?..

Git: how to reverse-merge a commit?

With SVN it is easy to reverse-merge a commit, but how to do that with Git?..

How can I style the border and title bar of a window in WPF?

We are developing a WPF application which uses Telerik's suite of controls and everything works and looks fine. Unfortunately, we recently needed to replace the base class of all our dialogs, changing..

how do you pass images (bitmaps) between android activities using bundles?

Suppose I have an activity to select an image from the gallery, and retrieve it as a BitMap, just like the example: here Now, I want to pass this BitMap to be used in an ImageView for another activit..

Java: Converting String to and from ByteBuffer and associated problems

I am using Java NIO for my socket connections, and my protocol is text based, so I need to be able to convert Strings to ByteBuffers before writing them to the SocketChannel, and convert the incoming ..

Why do I get a "permission denied" error while installing a gem?

I'm attempting to install Jekyll. After running gem install jekyll I get this error: ERROR: While executing gem ... (Errno::EACCES) Permission denied - /usr/local/lib/ruby/gems/2.0.0/gems/jekyll..

You can't specify target table for update in FROM clause

I have a simple mysql table: CREATE TABLE IF NOT EXISTS `pers` ( `persID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(35) NOT NULL, `gehalt` int(11) NOT NULL, `chefID` int(11) DEFAULT NUL..

Run a command over SSH with JSch

I'm trying to run a command over SSH with JSch, but JSch has virtually no documentation and the examples I've found are terrible. For example, this one doesn't show code for handling the output stream..

How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?

I have an image that doesn't match the aspect ratio of my device's screen. I want to stretch the image so that it fully fills the screen, and I don't want to crop any part of the image. CSS has the c..

PHP/MySQL insert row then get 'id'

The 'id' field of my table auto increases when I insert a row. I want to insert a row and then get that ID. I would do it just as I said it, but is there a way I can do it without worrying about the ..

Can I run CUDA on Intel's integrated graphics processor?

I have a very simple Toshiba Laptop with i3 processor. Also, I do not have any expensive graphics card. In the display settings, I see Intel(HD) Graphics as display adapter. I am planning to learn som..

C++ - How to append a char to char*?

I've tried so may ways on the Internet to append a character to a char* but none of them seems to work. Here is one of my incomplete solution: char* appendCharToCharArray(char * array, char a) { ..

HTML colspan in CSS

I'm trying to construct a layout similar to the following: +---+---+---+ | | | | +---+---+---+ | | +-----------+ where the bottom is filling the space of the upper row. If this wer..

How to import set of icons into Android Studio project

I downloaded collection of icons from Android Developers center Each icon in this collection is ordered in forlders according to its resolution: drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-..

Do I need to compile the header files in a C program?

Sometimes I see someone compile a C program like this: gcc -o hello hello.c hello.h As I know, we just need to put the header files into the C program like: #include "somefile" and compile the C p..

How to make a launcher

I have been developing for quite a time and I am now trying to make an app that will replace the original home (e.g. HTC sense). I need the app to open when the the user hits the home button on their..

How can moment.js be imported with typescript?

I'm trying to learn Typescript. While I don't think it's relevant, I'm using VSCode for this demo. I have a package.json that has these pieces in it: { "devDependencies": { "gulp": "^3.9.1", ..

trying to align html button at the center of the my page

I'm trying to align an HTML button exactly at the centre of the page irrespective of the browser used. It is either floating to the left while still being at the vertical centre or being somewhere on ..

What are the file limits in Git (number and size)?

Does anyone know what are the Git limits for number of files and size of files?..

Angular JS break ForEach

I have an angular foreach loop and i want to break from loop if i match a value. The following code does not work. angular.forEach([0,1,2], function(count){ if(count == 1){ break; } }); How..

"CASE" statement within "WHERE" clause in SQL Server 2008

I am working with a query which contains "CASE" statement within "WHERE" clause. But SQL Server 2008 is giving some errors while executing it. Can anyone please help me with the correct query? Here is..

Convert International String to \u Codes in java

How can I convert an international (e.g. Russian) String to \u numbers (unicode numbers) e.g. \u041e\u041a for OK ?..

Get selected row item in DataGrid WPF

I have a DataGrid, bound to Database table, I need to get the content of selected row in DataGrid, for example, I want to show in MessageBox content of selected row. Example of DataGrid: So, if I ..

Fit Image in ImageButton in Android

I have 6 ImageButton in my activity, I set images through my code in them ( not using xml). I want them to cover 75% of the button area. But where as some images cover less area, some are too big to ..

Java 11 package javax.xml.bind does not exist

I'm trying to deserialize XML data into a Java content tree using JAXB, validating the XML data as it is unmarshalled: try { JAXBContext context = JAXBContext.newInstance("com.acme.foo"); Unmarsh..

How do I show the schema of a table in a MySQL database?

From the MySQL console, what command displays the schema of any given table?..

Text Editor which shows \r\n?

I'm looking for a text editor that can show me the actual carriage returns and newlines. E.g. if I save this string: "This\rIs\r\nA\nString" Instead of showing This Is A String I'm looking for so..

How to toggle (hide / show) sidebar div using jQuery

I have 2 <div>s with ids A and B. div A has a fixed width, which is taken as a sidebar. The layout looks like diagram below: The styling is like below: html, body { margin: 0; padding: ..

How to replace NaNs by preceding values in pandas DataFrame?

Suppose I have a DataFrame with some NaNs: >>> import pandas as pd >>> df = pd.DataFrame([[1, 2, 3], [4, None, None], [None, None, 9]]) >>> df 0 1 2 0 1 2 3 1..

Debugging iframes with Chrome developer tools

I'd like to use the Chrome developer console to look at variables and DOM elements in my app, but the app exists inside an iframe (since it's an OpenSocial app). So the situation is: <containing ..

Running Command Line in Java

Is there a way to run this command line within a Java application? java -jar map.jar time.rel test.txt debug I can run it with command but I couldn't do it within Java...

bad operand types for binary operator "&" java

The error shows this line if ((a[0] & 1 == 0) && (a[1] & 1== 0) && (a[2] & 1== 0)){ This is the whole code: public class Ex4 { public static void main(String[] ar..

Selecting all text in HTML text input when clicked

I have the following code to display a textbox in a HTML webpage. <input type="text" id="userid" name="userid" value="Please enter the user ID" /> When the page displays, the text contains th..

CSS: create white glow around image

How can I create a white glow as the border of an unknown size image?..

Calling async method on button click

I created Windows Phone 8.1 project and I am trying to run async method GetResponse(string url) on button click and waiting for the method to finish, but method is never finishing. Here is my code: p..

What's the most efficient way to erase duplicates and sort a vector?

I need to take a C++ vector with potentially a lot of elements, erase duplicates, and sort it. I currently have the below code, but it doesn't work. vec.erase( std::unique(vec.begin(), vec.end..

Cannot find vcvarsall.bat when running a Python script

I am working on Vista, and using Python 2.6.4. I am using a software that utilizes a Python script, but bumped into the message: cannot find vcvarsall.bat So, I installed visual c++ 2010. Still the..

Read from file or stdin

I am writing a utility which accepts either a filename, or reads from stdin. I would like to know the most robust / fastest way of checking to see if stdin exists (data is being piped to the program)..

Checking whether the pip is installed?

I am using Python 2.7.12 and I want to check whether the pip is installed or not. For this, in command line of Python application I wrote pip list and pressed enter. However, I get an error like: Fil..

How to remove all white spaces from a given text file

I want to remove all the white spaces from a given text file. Is there any shell command available for this ? Or, how to use sed for this purpose. I want something like below: $ cat hello.txt | ..

Android Respond To URL in Intent

I want my intent to be launched when the user goes to a certain url: for example, the android market does this with http://market.android.com/ urls. so does youtube. I want mine to do that too...

How to execute the start script with Nodemon

How can I execute the start script from a package.json file with Nodemon?..

Project Links do not work on Wamp Server

I am installing the Wamp Server on another computer to run a mid-sized database and UI. I have been successful in blocking IIS and routing the server to Localhost:8080. But whenever I try to access on..

Setting the JVM via the command line on Windows

Is it possible to specify the JVM to use when you call "java jar jar_name.jar" . I have two JVM installed on my machine. I can not change JAVA_HOME as it may break code that is all ready running. Kin..

Exception Error c0000005 in VC++

Am working on VC++ Console Application. This application sends a file from Appdata\Roaming folder for a period of time. What happens is am getting this Crash error : Problem signature: Problem Even..

Scala vs. Groovy vs. Clojure

Can someone please explain the major differences between Scala, Groovy and Clojure. I know each of these compiles to run on the JVM but I'd like a simple comparison between them...

Change visibility of ASP.NET label with JavaScript

I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page. What can I do to resolve this?..

How to redirect to a route in laravel 5 by using href tag if I'm not using blade or any template?

Route::get('/page','UserController@view page'); is my route. I have a list with href tag and I want to redirect to this route. <ul> <li><a href="">how it works</a><..

Errno 13 Permission denied Python

In python, I am currently experimenting with what I can do with open command. I tried to open a file, and got an error message. Here's my code: open(r'C:\Users\****\Desktop\File1') My error message..

What exactly is an instance in Java?

What is the difference between an object, instance, and reference? They say that they have to create an instance to their application? What does that mean?..

Differences between C++ string == and compare()?

I just read some recommendations on using std::string s = get_string(); std::string t = another_string(); if( !s.compare(t) ) { instead of if( s == t ) { I'm almost always using the last one..

Tracking Google Analytics Page Views with AngularJS

I'm setting up a new app using AngularJS as the frontend. Everything on the client side is done with HTML5 pushstate and I'd like to be able to track my page views in Google Analytics...

Convert HTML to PDF in .NET

I want to generate a PDF by passing HTML contents to a function. I have made use of iTextSharp for this but it does not perform well when it encounters tables and the layout just gets messy. Is there..

How to load a tsv file into a Pandas DataFrame?

I'm new to python and pandas. I'm trying to get a tsv file loaded into a pandas DataFrame. This is what I'm trying and the error I'm getting: >>> df1 = DataFrame(csv.reader(open('c:/~/tr..

How do I use a C# Class Library in a project?

I've created a new Class Library in C# and want to use it in one of my other C# projects - how do I do this?..

How do I resize an image using PIL and maintain its aspect ratio?

Is there an obvious way to do this that I'm missing? I'm just trying to make thumbnails...

Redirecting to a certain route based on condition

I'm writing a small AngularJS app that has a login view and a main view, configured like so: $routeProvider .when('/main' , {templateUrl: 'partials/main.html', controller: MainController}) .when('..

How to UPSERT (MERGE, INSERT ... ON DUPLICATE UPDATE) in PostgreSQL?

A very frequently asked question here is how to do an upsert, which is what MySQL calls INSERT ... ON DUPLICATE UPDATE and the standard supports as part of the MERGE operation. Given that PostgreSQL ..

Failed to load AppCompat ActionBar with unknown error in android studio

Below is my xml file. In preview there is two error'Failed to load AppCompat ActionBar with unknown error' & 'Failed to instaniate more than one class'. How ever am able to run the app.But the app..

Using OR operator in a jquery if statement

I need to use the OR operator in a jQuery if statement to filter out 10 states. My code works wile only excluding one state, but fails when i try to include multiple states. Is there a correct way to ..

.Contains() on a list of custom class objects

I'm trying to use the .Contains() function on a list of custom objects This is the list: List<CartProduct> CartProducts = new List<CartProduct>(); And the CartProduct: public class Ca..

Could not resolve '...' from state ''

This is first time i am trying to use ui-router. Here is my app.js angular.module('myApp', ['ionic']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory b..

What is a good Hash Function?

What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a good hash function. As a rule of ..

How can I make my own event in C#?

How can I make my own event in C#?..

How to post data in PHP using file_get_contents?

I'm using PHP's function file_get_contents() to fetch contents of a URL and then I process headers through the variable $http_response_header. Now the problem is that some of the URLs need some data ..

Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4

Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin: <plugin> <artifactId>maven-source-plugin</artifa..

Show hide fragment in android

I am developing application which contains 2 fragments and i want to show hide according to my need. Following code has simple example of my problem. This simple Fragmentactivity contains 1 button an..

How do I read a date in Excel format in Python?

How can I convert an Excel date (in a number format) to a proper date in Python?..

JavaScript post request like a form submit

I'm trying to direct a browser to a different page. If I wanted a GET request, I might say document.location.href = 'http://example.com/q=a'; But the resource I'm trying to access won't respond pro..

size of uint8, uint16 and uint32?

The code base uses data types like uint8[1 byte wide unsigned integer], uint16[2 byte wide unsigned integer], uint32[4 byte wide unsigned integer] etc. question: uint8 is same as char ?? uint16 is sa..

Two HTML tables side by side, centered on the page

I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with): <style> #ou..

How to import classes defined in __init__.py

I am trying to organize some modules for my own use. I have something like this: lib/ __init__.py settings.py foo/ __init__.py someobject.py bar/ __init__.py somethingelse.py ..

Import Excel to Datagridview

I'm using this code to open an excel file and save it in a DataGridView: string name = "Items"; string constr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=" + Dialog_Excel.FileName.ToString() +..

How to loop through all enum values in C#?

This question already has an answer here: How do I enumerate an enum in C#? 26 answers public enum Foos { A, B, C } Is there a way to loop through the possible values of Foos? ..

How to list files in an android directory?

Here's my code so far: String path = Environment.getExternalStorageDirectory().toString()+"/Pictures"; AssetManager mgr = getAssets(); try { String list[] = mgr.list(pa..

Type datetime for input parameter in procedure

I have created a procedure with this structure but it doesn't work for datetime input parameter I executed this query but declare @a datetime declare @b datetime set @a='2012/04/06 12:23:45' set..

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

NuGet auto package restore does not work with MSBuild

I'm trying to build a solution with packages content missing (except repositories.config inside) with MSBuild 12.0. I expect it to auto restore all missing packages before building but this is not the..

What does mscorlib stand for?

mscorlib is definitely one of .net base class libraries and every program in C# depends on it, but what does it stand for? In the ECMA standard for the C# Language Specification the word is mentioned..

git stash changes apply to new branch?

I was working on master branch, made some changes and then stashed them. Now, my master is at HEAD. But now, I want to retrieve these changes but to a new branch which branches from the HEAD version ..

PowerShell script to return versions of .NET Framework on a machine?

What would a PowerShell script be to return versions of the .NET Framework on a machine? My first guess is something involving WMI. Is there something better? It should be a one-liner to return only..

Check if character is number?

I need to check whether justPrices[i].substr(commapos+2,1). The string is something like: "blabla,120" In this case it would check whether '0' is a number. How can this be done?..

How to get today's Date?

In other words, I want functionality that provides Joda-Time: today = today.withTime(0, 0, 0, 0); but without Joda-Time, only with java.util.Date. Methods such as .setHours() and etc. are deprecat..

How to unmerge a Git merge?

I accidentally did a git pull origin master from dev, and master got merged into dev. Is it possible to unmerge? I've already seen different solutions, i tried this one from both dev and master : gi..

How to get UTC+0 date in Java 8?

I have problems with Date class in Java. Date class returns local machine date but i need UTC-0. I have googled and found great solution for JavaScript but for Java nothing useful. How to get UTC+0 ..

Git removing upstream from local repository

I am working with a ruby on rails application and I am trying to sync a fork. It is worth mentioning that I am also on a Mac. I committed the following action: $ git remote -v to get a view of my l..

How do you change the document font in LaTeX?

How do you change the font for the whole document to sans-serif (or anything else)?..

How to only get file name with Linux 'find'?

I'm using find to all files in directory, so I get a list of paths. However, I need only file names. i.e. I get ./dir1/dir2/file.txt and I want to get file.txt..

How to restart a windows service using Task Scheduler

The easiest way to do this is to create a batch file with: NET stop <service name> NET start <service name> Once the batch file is created and tested, add it to Windows Task Scheduler a..

How to click an element in Selenium WebDriver using JavaScript

I have the following HTML: <button name="btnG" class="gbqfb" aria-label="Google Search" id="gbqfb"><span class="gbqfi"></span></button> My following code for clicking "Googl..

How to post SOAP Request from PHP

Anyone know how can I post a SOAP Request from PHP?..

Java: method to get position of a match in a String?

String match = "hello"; String text = "0123456789hello0123456789"; int position = getPosition(match, text); // should be 10, is there such a method? ..

Templated check for the existence of a class member function?

Is it possible to write a template that changes behavior depending on if a certain member function is defined on a class? Here's a simple example of what I would want to write: template<class T&g..

Difference between a Structure and a Union

Is there any good example to give the difference between a struct and a union? Basically I know that struct uses all the memory of its member and union uses the largest members memory space. Is there ..

What is the '.well' equivalent class in Bootstrap 4

In bootstrap-3 there is .well class which adds a rounded border around an element with a gray background color and some padding. <div class="well">Basic Well</div> But, I didn't find an..

.ssh directory not being created

To generate the .ssh dir I use this command: ssh-keygen taken from this tutorial: http://ebiquity.umbc.edu/Tutorials/Hadoop/05%20-%20Setup%20SSHD.html But the .ssh directory is not created so when..

Visual C++ executable and missing MSVCR100d.dll

I know this has been asked in other places and answered, but I'm having issues with MS Visual Studio 2010. I've developed a C++ executable but if I run the Release version on a machine that doesn't ha..

How can I use a Python script in the command line without cd-ing to its directory? Is it the PYTHONPATH?

How can I make any use of PYTHONPATH? When I try to run a script in the path the file is not found. When I cd to the directory holding the script the script runs. So what good is the PYTHONPATH? $ ec..

When is a C++ destructor called?

Basic Question: when does a program call a class' destructor method in C++? I have been told that it is called whenever an object goes out of scope or is subjected to a delete More specific questions..

Asynchronous vs synchronous execution, what does it really mean?

What is the difference between asynchronous and synchronous execution?..

Word wrap for a label in Windows Forms

How can one get word wrap functionality for a Label for text which goes out of bounds?..

How to upload images into MySQL database using PHP code

I am trying to save images in my database from HTML form. I have written PHP code to accomplish this task. The program is not generating any error message, but also not inserting image data in MySQL d..

How can I get the current PowerShell executing file?

Note: PowerShell 1.0 I'd like to get the current executing PowerShell file name. That is, if I start my session like this: powershell.exe .\myfile.ps1 I'd like to get the string ".\myfile.ps1" (o..

Resize jqGrid when browser is resized?

Is there any way to resize a jqGrid when the browser window is resized? I have tried the method described here but that technique does not work in IE7...

Extracting zip file contents to specific directory in Python 2.7

This is the code I am currently using to extract a zip file that lives in the same current working directory as the script. How can I specify a different directory to extract to? The code I tried is ..

filter: progid:DXImageTransform.Microsoft.gradient is not working in ie7

I want to apply a gradient background color to my div. For IE I have used the property: filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fad59f', endColorstr='#fa9907') It's work..

What can be the reasons of connection refused errors?

I'm trying to write a server program in C, using another client, I get this error when I try to connect through port 2080 for example. connection refused What can be the reasons of this error?..

How to open CSV file in R when R says "no such file or directory"?

I have an excel file that I want to open in R. I tried both of these commands after saving the excel file as a csv file or a text file. read.table() or read.csv() I think part of the problem is wher..

Can't use method return value in write context

I would think the following piece of code should work, but it doesn't (Edited: Now works in PHP 5.5+): if (!empty($r->getError())) Where getError() is simply: public function getError() { r..

Regex using javascript to return just numbers

If I have a string like "something12" or "something102", how would I use a regex in javascript to return just the number parts?..

Check whether a variable is a string in Ruby

Is there anything more idiomatic than the following? foo.class == String ..

How to get json response using system.net.webrequest in c#?

I need to get json data from an external domain. I used webrequest to get the response from a website. Here's the code: var request = WebRequest.Create(url); string text; var response = (HttpWebRespo..

Python3 integer division

In Python3 vs Python2.6, I've noticed that I can divide two integers and get a float. How do you get the Python2.6 behaviour back? Is there a different method to get int/int = int?..

Declaring and initializing arrays in C

Is there a way to declare first and then initialize an array in C? So far I have been initializing an array like this: int myArray[SIZE] = {1,2,3,4....}; But I need to do something like this int ..

How to select true/false based on column value?

I have a table with the following columns: EntityId, EntityName, EntityProfile, ................. I want to select the Id and Name and true/false column based on the value of entity profile, for exam..

How do I remove trailing whitespace using a regular expression?

I want to remove trailing white spaces and tabs from my code without removing empty lines. I tried: \s+$ and: ([^\n]*)\s+\r\n But they all removed empty lines too. I guess \s matches end-of-li..

What is a callback URL in relation to an API?

I've been scouring the net, and can't seem to wrap my head around the idea of a callback URL. In my case I have a few callback URLs that I have to define myself. A popular one is a "default callback U..

How to get $HOME directory of different user in bash script?

I need to execute part of a bash script as a different user, and inside that user's $HOME directory. However, I'm not sure how to determine this variable. Switching to that user and calling $HOME does..

How can I use an array of function pointers?

How should I use array of function pointers in C? How can I initialize them?..

Postgres: How to do Composite keys?

I cannot understand the syntax error in creating a composite key. It may be a logic error, because I have tested many varieties. How do you create composite keys in Postgres? CREATE TABLE tags ..

How to print the current Stack Trace in .NET without any exception?

I have a regular C# code. I have no exceptions. I want to programmatically log the current stack trace for debugging purpose. Example: public void executeMethod() { logStackTrace(); method()..

Difference between object and class in Scala

I'm just going over some Scala tutorials on the Internet and have noticed in some examples an object is declared at the start of the example. What is the difference between class and object in Scala?..

Android Linear Layout - How to Keep Element At Bottom Of View?

I have a TextView which I want to pin at the bottom of a landscape activity that is using LinearLayout with vertically arranged elements. I have set android:gravity="bottom" on the text view, but i..

How to call a javaScript Function in jsp on page load without using <body onload="disableView()">

How can a JavaScript function in JSP be called during page load without using <body onload="disableView()"> I have to call this function in a few JSP's on page load but JSP's are divided into..

javascript change background color on click

Can you show me Javascript that allows you to change the background color of the page to another color. For example, I have a blue background color and I want to change it to green. The color must be ..

What is the correct "-moz-appearance" value to hide dropdown arrow of a <select> element

I'm trying to style the dropdown arrow of a <select> element with CSS only , it works perfectly in Chrome/Safari: select { -webkit-appearance: button; -webkit-border-radius: 2px; -webkit-..

How to plot multiple functions on the same figure, in Matplotlib?

How can I plot the following 3 functions (i.e. sin, cos and the addition), on the domain t, in the same figure? from numpy import * import math import matplotlib.pyplot as plt t = linspace(0, 2*math..

C: printf a float value

I want to print a float value which has 2 integer digits and 6 decimal digits after the comma. If I just use printf("%f", myFloat) I'm getting a truncated value. I don't know if this always happens i..

When to use CouchDB over MongoDB and vice versa

I am stuck between these two NoSQL databases. In my project I will be creating a database within a database. For example, I need a solution to create dynamic tables. So users can create tables wit..

How to Create a real one-to-one relationship in SQL Server

I have two tables tableA and tableB, I set tableB's primary key as foreign key which references tableA's primary. But when I use Entity Framework database-first, the model is 1 to 0..1. How does one..

How to get the entire document HTML as a string?

Is there a way in JS to get the entire HTML within the html tags, as a string? document.documentElement.?? ..

Pass multiple values with onClick in HTML link

Hi Im trying to pass multiple values with the HTML onclick function. Im using Javascript to create the Table var user = element.UserName; var valuationId = element.ValuationId; $('#ValuationAssignedT..

Toolbar Navigation Hamburger Icon missing

I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true..

CSS Border Not Working

I've been trying to get a border on either side of my white container. It's just not showing. I've tried to put it in three different elements just in case! (see below). Any ideas on how to make it wo..

Oracle Error ORA-06512

Just can't figure out why it gives me ORA-06512 Error PROCEDURE PX(pNum INT,pIdM INT,pCv VARCHAR2,pSup FLOAT) AS vSOME_EX EXCEPTION; BEGIN IF ((pNum < 12) OR (pNum > 14)) THEN ..

Change a web.config programmatically with C# (.NET)

How can I modify / manipulate the web.config programmatically with C# ? Can I use a configuration object, and, if yes, how can I load the web.config into a configuration object ? I would like to have ..

Bound method error

I am creating a word parsing class and keep getting a "bound method Word_Parser.sort_word_list of <main.Word_Parser instance at 0x1037dd3b0>" error when I run this: class Word_Parser: """docs..

Loading custom configuration files

I know I can open config files that are related to an assembly with the static ConfigurationManager.OpenExe(exePath) method but I just want to open a config that is not related to an assembly. Just a ..

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

I just updated Python to 2.6.4 on my Mac. I installed from the dmg package. The binary did not seem to correctly set my Python path, so I added '/usr/local/lib/python2.6/site-packages' in .bash_prof..

how to delete the content of text file without deleting itself

I want to copy the content of file 'A' to file 'B'. after the copying is done I want to clear the content of file 'A' and want to write on it from its beginning. I can't delete file 'A' as it is relat..

INSERT INTO @TABLE EXEC @query with SQL Server 2000

Is it true that SQL Server 2000, you can not insert into a table variable using exec? I tried this script and got an error message EXECUTE cannot be used as a source when inserting into a table varia..

Checking whether a variable is an integer or not

How do I check whether a variable is an integer?..

Android Support Design TabLayout: Gravity Center and Mode Scrollable

I am trying to use the new Design TabLayout in my project. I want the layout to adapt to every screen size and orientation, but it can be seen correctly in one orientation. I am dealing with Gravity ..

Why doesn't Git ignore my specified file?

I added the following line to .gitignore: sites/default/settings.php but when I type git status it shows the file as unstaged file. What's the problem? All other patterns work well...

How to manually trigger click event in ReactJS?

How can I manually trigger a click event in ReactJS? When a user clicks on element1, I want to automatically trigger a click on the input tag. <div className="div-margins logoContainer"> <..

Get URL of ASP.Net Page in code-behind

I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-beh..

How to add Tomcat Server in eclipse

I just installed Java EE plugin in plain eclipse and I am trying to add tomcat server. I opened add new server which showing "Choose the type of server to create" but there is no server list. How can..

When does System.getProperty("java.io.tmpdir") return "c:\temp"

Just curious as to when System.getProperty("java.io.tmpdir") returns "c:\temp". According to the java.io.File Java Docs- The default temporary-file directory is specified by the system property ..

How to change Toolbar Navigation and Overflow Menu icons (appcompat v7)?

I am having a hard time with v7 Toolbar. What was once a simple task for ActionBar, now seems overly complex. No matter what style I set, I cannot change either navigation icon (which opens a Drawer) ..

Jquery ajax call click event submit button

I've to build an ajax call when the user clicks a submit button, so i've included jquery and i've written the following code (taken from the jquery documentation): <script src="http://code.jquery...

How to overlay density plots in R?

I would like to overlay 2 density plots on the same device with R. How can I do that? I searched the web but I didn't find any obvious solution. My idea would be to read data from a text file (columns..

Extract only right most n letters from a string

How can I extract a substring which is composed of the rightmost six letters from another string? Ex: my string is "PER 343573". Now I want to extract only "343573". How can I do this?..

Markdown `native` text alignment

Does markdown support native text-alignment without usage html + css?..

Filtering a list based on a list of booleans

I have a list of values which I need to filter given the values in a list of booleans: list_a = [1, 2, 4, 6] filter = [True, False, True, False] I generate a new filtered list with the following li..

Delete last commit in bitbucket

I made a mistake and I don't know how to delete my latest push in the repository. I pull the latest updates of the app but it has conflicts and I push it to repository. How to delete my last commit?..

What is the best way to measure execution time of a function?

Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more sophisticated. Any tips appreciated...

How to publish a website made by Node.js to Github Pages?

I made a website using Node.js as the server. As I know, the node.js file should start working by typing commands in terminal, so I'm not sure if Github Pages supports node.js-hosting. So what should ..

How to truncate text in Angular2?

Is there a way that I could limit the length of the string to a number characters? for e.g: I have to limit a title length to 20 {{ data.title }}. Is there any pipe or filter to limit the length?..

Detect when an HTML5 video finishes

How do you detect when a HTML5 <video> element has finished playing?..

How do I convert from BLOB to TEXT in MySQL?

I have a whole lot of records where text has been stored in a blob in MySQL. For ease of handling I'd like to change the format in the database to TEXT... Any ideas how easily to make the change so as..

Uncaught Typeerror: cannot read property 'innerHTML' of null

Can anyone explain what is theses errors? Uncaught TypeError: cannot read property 'innerHTML' of null View on my website This is the line which is causing the error: var idPost=document.getEle..