Questions Tagged with #Componentmodel

Error: the entity type requires a primary key

I would like to expand the question asked on this thread Binding listbox to observablecollection by giving it an ability to persistent the data. The structure is mostly the same except I installed E..

Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm

I want to compile an open source android project (Netguard) using gradel (gradlew clean build) But I encountered this Error: A problem occurred configuring project ':app'. > Exception thrown while..

The type or namespace name 'System' could not be found

I have the following errors (and more) in all my views (*.cshtml) when opening my project in Visual Studio 2015 Professional. Error CS0246 The type or namespace name 'System' could not be found ..

How to add LocalDB to Visual Studio 2015 Community's SQL Server Object Explorer?

Problem I don't understand how to make LocalDB show up in the SQL Server Object Explorer. On some VMs, it shows up automatically, on some other VMs, it doesn't. Still, after googling for hours, I don'..

SQL Connection Error: System.Data.SqlClient.SqlException (0x80131904)

I am seeing this in several situations and it is intermittent in our web based application connecting to SQL 2008 R2 serve back end. Users are coming across a point 2 point connection and seeing this..

The network path was not found

I'm running my code and getting this error. But what does it mean? The network path was not found Description: An unhandled exception occurred during the execution of the current web request. P..

How to refresh or show immediately in datagridview after inserting?

After entering data into all the textbox, and after clicking the submit button, it won't immediately show in the datagridview, I need to reopen the form in order to see the new inserted row. What code..

Use C# HttpWebRequest to send json to web service

I am new to JSON and need help. I have some JSON working in jquery and get the information back correctly from the web service I have running on the web. However, I can't get it to work using HttpWebR..

"The system cannot find the file specified"

I saw many questions on SO with this error. But none were related to forms. I just hosted my application server after testing locally. I think it worked for a few mins but I'm not sure as I may have l..

EntityType has no key defined error

Controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcApplication1.Models; using System.ComponentModel.DataAnnotations.Schema..

"Use the new keyword if hiding was intended" warning

I have a warning at the bottom of my screen: Warning 1 'WindowsFormsApplication2.EventControlDataSet.Events' hides inherited member 'System.ComponentModel.MarshalByValueComponent.Events'...

"Input string was not in a correct format."

I am working on a project in which I have a form through which I can edit a question available in a list view. Whenever I select a row from the list view and click on the 'modify' button, the text box..

String MinLength and MaxLength validation don't work ( mvc)

I have this class using System.ComponentModel.DataAnnotations; using Argussoft.BI.DAL.Domain.Users; namespace Argussoft.BI.DAL.DTOs.UserDTOs { public class CreateUserDto { [Required(..

Connect to SQL Server 2012 Database with C# (Visual Studio 2012)

Evening all, I'm trying to connect to a SQL Server 2012 database from C#. My connection settings when using SQL Server Management Studio are as below:- Server Type: Database Engine Server Name: ..

Win32Exception (0x80004005): The wait operation timed out

I'm running an ASP.NET Web Pages page that upon initial load pulls a list of items from a SQL server. This query runs in a second or so and loads the page within 2 seconds. The return is about a 1000 ..

How to change column width in DataGridView?

I have created a database and table using Visual Studio's SQL Server Compact 3.5 with a dataset as my datasource. On my WinForm I have a DataGridView with 3 columns. However, I have been unable to fig..

Chart creating dynamically. in .net, c#

Does anybody have some experience working with charts in .NET? Specially I want to create them programmatically. using System; using System.Collections.Generic; using System.ComponentModel; using Sys..

HttpClient does not exist in .net 4.0: what can I do?

Ok i edited my code i dont get errors but the messageBox.Show return nothing empty box. Maybe i need to add something in the referrer string ? I didnt understand what is the referrer and what should i..

Why can't I reference System.ComponentModel.DataAnnotations?

I'm trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following: using System.ComponentModel.DataAnnotations; However, I get the error The type or..

The calling thread cannot access this object because a different thread owns it

My code is as below public CountryStandards() { InitializeComponent(); try { FillPageControls(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Coun..

Does not contain a static 'main' method suitable for an entry point

I began organizing my code to day into seperarate .cs files, and in order to allow the methods that work with the UI to continue to do so I would create the .cs code under the same namespace and publi..

Validation failed for one or more entities. See 'EntityValidationErrors' property for more details

I am having this error when seeding my database with code first approach. Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. To be honest I don't..

How to add dll in c# project

I am trying to add a [Science.dll] in my project which should be staright forward. But I am getting a problem. Can someone tell me why? My C# project which I just copied from internet. using System;..

Extension methods must be defined in a non-generic static class

I'm getting the error: Extension methods must be defined in a non-generic static class On the line: public class LinqHelper Here is the helper class, based on Mark Gavells code. I'm really c..

The type or namespace name 'DbContext' could not be found

I am VERY new to ASP.NET MVC (3) and am having a hard time resolving a build error in Visual Studio: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an..

Int or Number DataType for DataAnnotation validation attribute

On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my prediction class looks like this: [Range(0, 15, ErrorMessage = "Can only be between ..

The type initializer for 'MyClass' threw an exception

The following is my Windows service code. When I am debugging the code, I am getting the error/ exception: The type initializer for 'CSMessageUtility.CSDetails' threw an exception. using System;..

Serialize an object to XML

I have a C# class that I have inherited. I have successfully "built" the object. But I need to serialize the object to XML. Is there an easy way to do it? It looks like the class has been set up for ..

The type or namespace cannot be found (are you missing a using directive or an assembly reference?)

I get the following error when I try to compile my C# program: The type or namespace name 'Login' could not be found (are you missing a using directive or an assembly reference?) using System; us..

Error in Process.Start() -- The system cannot find the file specified

I am using the following code to fire the iexplore process. This is done in a simple console app. public static void StartIExplorer() { var info = new ProcessStartInfo("iexplore"); info.UseSh..

How can I bind a background color in WPF/XAML?

What do I have to change to the following code so that the background is red, neither of the 2 ways I tried worked: (source: XAML: <Window x:Class="TestBackground88238.Window..

Getting attributes of Enum's value

I would like to know if it is possible to get attributes of the enum values and not of the enum itself? For example, suppose I have the following enum: using System.ComponentModel; // for Description..

How to get a List<string> collection of values from app.config in WPF?

The following example fills the ItemsControl with a List of BackupDirectories which I get from code. How can I change this so that I get the same information from the app.config file? XAML: <Win..

Using PropertyInfo.GetValue()

I have a class that creates a static array of all properties, using a static constructor. I also have a function -- GetNamesAndTypes() -- that lists the name & type of each property in that array..

Setting the default value of a DateTime Property to DateTime.Now inside the System.ComponentModel Default Value Attrbute

Does any one know how I can specify the Default value for a DateTime property using the System.ComponentModel DefaultValue Attribute? for example I try this: [DefaultValue(typeof(DateTime),DateTime...

Creating a constant Dictionary in C#

What is the most efficient way to create a constant (never changes at runtime) mapping of strings to ints? I've tried using a const Dictionary, but that didn't work out. I could implement a immuta..

Winforms issue - Error creating window handle

We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening. System.ComponentModel.Win32Excepti..

loading json data from local file into React JS

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

Why is it common to put CSRF prevention tokens in cookies?

I'm trying to understand the whole issue with CSRF and appropriate ways to prevent it. (Resources I've read, understand, and agree with: OWASP CSRF Prevention CHeat Sheet, Questions about CSRF.) As I..

How to convert string into float in JavaScript?

I am trying to parse two values from a datagrid. The fields are numeric, and when they have a comma (ex. 554,20), I can't get the numbers after the comma. I've tried parseInt and parseFloat. How can I..

Good PHP ORM Library?

Is there a good object-relational-mapping library for PHP? I know of PDO/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the doma..

Removing space from dataframe columns in pandas

I am trying to remove spaces from a dataframe I have. The columns names look like below. I am trying to get the spaces between name out and replace it with "_" wherever present. ['join_date' 'fiscal_..

How to list the files in current directory?

I want to be able to list the files in the current directory. I've made something that should work but doesn't return all the file names. File dir = new File("."); File[] filesList = dir.listFiles();..

How to increment a JavaScript variable using a button press event

Can I create a javascript variable and increment that variable when I press a button (not submit the form). Thanks!..

How to export/import PuTTy sessions list?

Is there a way to do this? Or I have to take manually every record from Registry?..

Ignore 'Security Warning' running script from command line

I am trying to execute a script from shared folder that I trust: PowerShell -file "\\server\scripts\my.ps1" But I get a security warning, and have to press 'R' to continue Security Warning Run ..

Disable Transaction Log

Oracle has SQL commands that one can issue so that a transaction does not get logged. Is there something similar for SQL Server 2008? My scenario: We need Tx logs on servers (Dev, QA, Prod), but mayb..

How to configure encoding in Maven?

When I run maven install on my multi module maven project I always get the following output: [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!..

Debugging doesn't start

When I hit F5 (debugging mode) nothing happens. Building works correctly, exe file I can launch properly, but can't start debug. Why?..

Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources

I have been working with Rails and it sends me back this error. Please provide questions. Thanks for all the help. I will update this question with a better one because I don't know how to ask it. Bu..

How to install python-dateutil on Windows?

I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo c..

Making the iPhone vibrate

How can the iPhone be set to vibrate once? For example, when a player loses a life or the game is over, the iPhone should vibrate...

How to POST JSON request using Apache HttpClient?

I have something like the following: final String url = ""; final HttpClient httpClient = new HttpClient(); final PostMethod postMethod = new PostMethod(url); postMethod.addRequest..

How to programmatically set the SSLContext of a JAX-WS client?

I'm working on a server in a distributed application that has browser clients and also participates in server-to-server communication with a 3rd party. My server has a CA-signed certificate to let my ..

In Visual Basic how do you create a block comment

Possible Duplicate: commenting VB code Does anybody know how to do a block comment in Visual Basic? Note: I did a few searches on here and neither those results nor the results for 'Questi..

Angular cookies

I've been looking all around for Angular cookies but I haven't been able to find how to implement cookies management in Angular. Is there any way to manage cookies (like $cookie in AngularJS)?..

Convert PEM to PPK file format

Is there a way to convert PEM files to PPK files? (you may guess that Amazon EC2 gives me a PEM file, and I need to use the PPK format for SSH connectivity)...

Assembly code vs Machine code vs Object code?

What is the difference between object code, machine code and assembly code? Can you give a visual example of their difference?..

batch file to list folders within a folder to one level

I have searched and searched to no avail so apologies if the answer does exist. I am not very good with batch files so please keep this in mind. All I am after is a single batch file that will list/..

jQuery validate Uncaught TypeError: Cannot read property 'nodeName' of null

I have the following code: $(document).ready ( function () { $.validator.addMethod( "lessThan", function (value, element, param) { // bind to the b..

Understanding the map function

map(function, iterable, ...) Apply function to every item of iterable and return a list of the results. If additional iterable arguments are passed, function must take that many arguments and is app..

How to convert date format to DD-MM-YYYY in C#

How to convert date format to DD-MM-YYYY in C#? I am only looking for DD-MM-YYYY format not anything else...

Python strptime() and timezones?

I have a CSV dumpfile from a Blackberry IPD backup, created using IPDDump. The date/time strings in here look something like this (where EST is an Australian time-zone): Tue Jun 22 07:46:22 EST 2010 ..

How to HTML encode/escape a string? Is there a built-in?

I have an untrusted string that I want to show as text in an HTML page. I need to escape the chars '<' and '&' as HTML entities. The less fuss the better. I'm using UTF8 and don't need other ..

Regex: Remove lines containing "help", etc

I have a long document of commands. Using Notepad++ or regex, I want to delete all lines containing "help" including keyboard_help, etc. How can this be done?..

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

How to add "required" attribute to mvc razor viewmodel text input editor

I have the following MVC 5 Razor HTML helper: @Html.TextBoxFor(m => m.ShortName, new { @class = "form-control", @placeholder = "short name"}) I need this field to be required (i.e. have a red..

Android Studio 3.0 Flavor Dimension Issue

Upgraded to Studio Canary build. My previous project of Telegram Messenger is giving following error. Error:All flavors must now belong to a named flavor dimension. The flavor 'armv7' is not assig..

How to set TLS version on apache HttpClient

How can I change the supported TLS versions on my HttpClient? I'm doing: SSLContext sslContext = SSLContext.getInstance("TLSv1.1"); sslContext.init( keymanagers.toArray(new KeyManager[keymanager..

How do I get specific properties with Get-AdUser

I have the following PS script written: Get-ADUser -Filter * -SearchBase 'OU=Users & Computers, DC=aaaaaaa, DC=com' -Properties DisplayName | Export-CSV "ADUsers.csv" From what I can tell it s..

Basic HTTP authentication with Node and Express 4

It looks like implementing basic HTTP authentication with Express v3 was trivial: app.use(express.basicAuth('username', 'password')); Version 4 (I'm using 4.2) removed the basicAuth middleware, tho..

How to sort a collection by date in MongoDB?

I am using MongoDB with Node.JS. I have a collection which contains a date and other rows. The date is a JavaScript Date object. How can I sort this collection by date?..

mysqldump with create database line

I'm in the process of moving my files onto another computer, and one thing I would like to do is to transfer the data in my MySQL database. I want to dump the databases into .sql files, but also have ..

Python lookup hostname from IP with 1 second timeout

How can I look up a hostname given an IP address? Furthermore, how can I specify a timeout in case no such reverse DNS entry exists? Trying to keep things as fast as possible. Or is there a better ..

Python: count repeated elements in the list

I am new to Python. I am trying to find a simple way of getting a count of the number of elements repeated in a list e.g. MyList = ["a", "b", "a", "c", "c", "a", "c"] Output: a: 3 b: 1 c: 3 ..

Bind event to right mouse click

How can I trigger some action with right click after disabling the browser context menu ? I tried this . . . $(document).ready(function(){ $(document).bind("contextmenu",function(e){ $(..

SQLite3 database or disk is full / the database disk image is malformed

My database is about 25 MB, and I've verified that the username accessing it, as well as the file permissions haven't changed in months. I'm having a problem where queries are failing due to a "databa..

HTML - Change\Update page contents without refreshing\reloading the page

I get the data from DB and display it in a div... what I want to do is when I click a link it should change the content of the div one option is to pass parameter through URL to itself and reload the..

Change bundle identifier in Xcode when submitting my first app in IOS

I'm trying to submit my first app in iOS. I have entered iOS Provisioning Portal and I am about to create an app ID. Lets say that I name my bundle identifier: com.mycompany.appdemo Then going to..

Copy / Put text on the clipboard with FireFox, Safari and Chrome

In Internet Explorer I can use the clipboardData object to access the clipboard. How can I do that in FireFox, Safari and/or Chrome?..

How do I change the default application icon in Java?

I'm using NetBeans, trying to change the familiar Java coffee cup icon to a png file that I have saved in a resources directory in the jar file. I've found many different web pages that claim they ha..

MySQL Results as comma separated list

I need to run a query like: SELECT,, (SELECT name FROM sites s WHERE = p.site_id) AS site_list FROM publications p But I'd like the sub-select to ret..

Dropdown using javascript onchange

I have a simple drop down and I want to have it so that if the user selects Have a Baby the message changes to Have a Baby, but for any other selection. The message stays the same (nothing), but this..

Check if input is number or letter javascript

I'm using forms in HTML and javascript. I would like an alert to pop up only if the user inputs a LETTER and clicks submit. So I have the HTML code: <form name="myForm" action="" onsubmit="return..

CSS :selected pseudo class similar to :checked, but for <select> elements

Is there a way to style the currently selected <option> element in a <select> element? I could then give a background color to the currently selected option element? That way I can style ..

How can I change the image displayed in a UIImageView programmatically?

I have an IBOutlet to a UIImageView, but when I look at the UIImageView doc, I can't see any hints about programmatically changing it. Do I have to fetch an UIImage object from that UIImageView?..

Generate random integers between 0 and 9

How can I generate random integers between 0 and 9 (inclusive) in Python? For example, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9..

creating an array of structs in c++

I'm trying to create an array of structs. Is the code below valid? I keep getting an expected primary-expression before '{' token error. int main() { int pause; struct Customer { int uid; ..

How to find a value in an array of objects in JavaScript?

I have an array of objects: Object = { 1 : { name : bob , dinner : pizza }, 2 : { name : john , dinner : sushi }, 3 : { name : larry, dinner : hummus } } I want to be able to search the obje..

How to obtain values of request variables using Python and Flask

I'm wondering how to go about obtaining the value of a POST/GET request variable using Python with Flask. With Ruby, I'd do something like this: variable_name = params["FormFieldValue"] How would ..

What do all of Scala's symbolic operators mean?

Scala syntax has a lot of symbols. Since these kinds of names are difficult to find using search engines, a comprehensive list of them would be helpful. What are all of the symbols in Scala, and what..

No more data to read from socket error

We are using Oracle as the database for our Web application. The application runs well most of the time, but we get this "No more data to read from socket" error. Caused by: java.sql.SQLRecoverableEx..

Create unique constraint with null columns

I have a table with this layout: CREATE TABLE Favorites ( FavoriteId uuid NOT NULL PRIMARY KEY, UserId uuid NOT NULL, RecipeId uuid NOT NULL, MenuId uuid ) I want to create a unique constra..

Find() vs. Where().FirstOrDefault()

I often see people using Where.FirstOrDefault() to do a search and grab the first element. Why not just use Find()? Is there an advantage to the other? I couldn't tell a difference. namespace LinqFin..

Python Image Library fails with message "decoder JPEG not available" - PIL

PIL does support JPEG in my system. Whenever I do an upload, my code is failing with: File "PIL/", line 375, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOErr..

Which is the correct C# infinite loop, for (;;) or while (true)?

Back in my C/C++ days, coding an "infinite loop" as while (true) felt more natural and seemed more obvious to me as opposed to for (;;) An encounter with PC-lint in the late 1980's and subsequen..

Select by partial string from a pandas DataFrame

I have a DataFrame with 4 columns of which 2 contain string values. I was wondering if there was a way to select rows based on a partial string match against a particular column? In other words, a fu..

jQuery set checkbox checked

I already tried all the possible ways, but I still didn't get it working. I have a modal window with a checkbox I want that when the modal opens, the checkbox check or uncheck should be based on a dat..

CSS: how to position element in lower right?

I am trying to position the text element "Bet 5 days ago" in the lower right-hand corner. How can I accomplish this? And, more importantly, please explain so I can conquer CSS! ..

"OverflowError: Python int too large to convert to C long" on windows but not mac

I am running the exact same code on both windows and mac, with python 3.5 64 bit. On windows, it looks like this: >>> import numpy as np >>> preds = np.zeros((1, 3), dtype=int) &g..

If greater than batch files

I wrote a simple batch file to run Frequently Used websites based on a number selection. Here's the code I have. I am trying to set it so if someone inputs a number 6 or greater it will go to :N but w..

shell script to remove a file if it already exist

I am working on some stuff where I am storing data in a file. But each time I run the script it gets appended to the previous file. I want help on how I can remove the file if it already exists...

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting Infinite recursion (StackOverflowError) All I fou..

What is the difference between exit(0) and exit(1) in C?

Can anyone tell me? What is the difference between exit(0) and exit(1) in C language?..

Sending private messages to user

I'm using the discord.js library and node.js to create a Discord bot that facilitates poker. It is functional except the hands are shown to everyone, and I need to loop through the players and send th..

How do you decompile a swf file

I am the maintainer of a site that has allegedly 'lost' the source code to a flash swf file. How do I decompile this source? Are there any programs online or offline that I could use?..

What does git rev-parse do?

What does git rev-parse do? I have read the man page but it raised more questions than answers. Things like: Pick out and massage parameters Massage? What does that mean? I'm using as a resolv..

Convert array of indices to 1-hot encoded numpy array

Let's say I have a 1d numpy array a = array([1,0,3]) I would like to encode this as a 2D one-hot array b = array([[0,1,0,0], [1,0,0,0], [0,0,0,1]]) Is there a quick way to do this? Quicker than jus..

FPDF utf-8 encoding (HOW-TO)

Does anybody know how to set the encoding in FPDF package to utf-8? Or at least to ISO-8859-7 (Greek) that support greek characters? Basically I want to create a pdf file containing greek characters...

Is it possible to add an array or object to SharedPreferences on Android

I have an ArrayList of objects that have a name and an icon pointer and I want to save it in SharedPreferences. How can I do? NOTE: I don't want to use Database..

How do I generate random numbers in Dart?

How do I generate random numbers using Dart?..

PHP memcached Fatal error: Class 'Memcache' not found

I've pasted the example from for using memcached in php and I'm getting: Fatal error: Class 'Memcache' not found I have this in my php.ini: [memcache] memcache.hash_strategy = "consiste..

What is the "proper" way to cast Hibernate Query.list() to List<Type>?

I'm a newbie with Hibernate, and I'm writing a simple method to return a list of objects matching a specific filter. List<Foo> seemed a natural return type. Whatever I do, I can't seem to make ..

How do you connect localhost in the Android emulator?

I have made a php script inside localhost and I am connecting that with httpClient but I am getting a problem. Please tell me how can I connect to a php file at localhost from the emulator?..

How to get the current TimeStamp?

I'm trying to get the current time as TimeStamp without success. I have this code: QDateTime setTime = QDateTime::fromString (QString("1970-07-18T14:15:09"), Qt::ISODate); QDateTime current = QDateT..

Using getResources() in non-activity class

I am trying to use getResources method in a non-activity class. How do I get the reference to the "resources" object so that I can access the xml file stored under resources folder? Example: XmlPull..

Custom Date Format for Bootstrap-DatePicker

Can anyone guide me for formatting date in Bootstrap-DatePicker. And I used Eternicode/bootstrap-datepicker. Here my codes at JSP.. <div>Date : </div> <input type="text" style="width..

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

I tried the following code different ways, like by taking out the while or the if, but when I put both together (if and while), I always get the error at the end... undefine numero set serveroutput o..

How to use LocalBroadcastManager?

How to use/locate LocalBroadcastManager as described in google docs and Service broadcast doc? I tried to google it, but there is no code available to start with? The documents say that I should use..

PySpark: multiple conditions in when clause

I would like to modify the cell values of a dataframe column (Age) where currently it is blank and I would only do it if another column (Survived) has the value 0 for the corresponding row where it i..

Inner join of DataTables in C#

Let T1 and T2 are DataTables with following fields T1(CustID, ColX, ColY) T2(CustID, ColZ) I need the joint table TJ (CustID, ColX, ColY, ColZ) How this can be done in C# code in a simple way? ..

Reading binary file and looping over each byte

In Python, how do I read in a binary file and loop over each byte of that file?..

Count records for every month in a year

I have a table with total no of 1000 records in it.It has the following structure: EMP_ID EMP_NAME PHONE_NO ARR_DATE 1 A 545454 2012/03/12 I want to calculate no of records for ever..

Is there 'byte' data type in C++?

If exists is there header file to include? This code give compilation error: #include <iostream> using namespace std; int main() { byte b = 2; cout << b << endl; re..

Dynamic Height Issue for UITableView Cells (Swift)

Dynamic text of variable length are being injected into tableview cell labels. In order for the tableview cells' heights to be dynamically sized, I have implemented in viewDidLoad(): self.tableView.e..

How to set commands output as a variable in a batch file

Is it possible to set a statement's output of a batch file to a variable, for example: findstr testing > %VARIABLE% echo %VARIABLE% ..

Remove CSS from a Div using JQuery

I'm new to JQuery. In my App I have the following: $("#displayPanel div").live("click", function(){ $(this).css({'background-color' : 'pink', 'font-weight' : 'bolder'}); }); When I click on a Div..

ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?

I use pickle to dump a file on python 3, and I use pickle to load the file on python 2, the ValueError appears. So, python 2 pickle can not load the file dumped by python 3 pickle? If I want it? Ho..

Find out where MySQL is installed on Mac OS X

How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?..

Converting Chart.js canvas chart to image using .toDataUrl() results in blank image

I am using Chart.js. I am trying to convert the chart to an image by getting a base 64 string. The tutorial ( devotes an entire 1 line on the topic: The canvas element..

error: strcpy was not declared in this scope

I get this problem in a c++ problem compiling in Ubuntu g++ version 4.4.3. I dont know the headers to include to solve this problem.. Thanks centro_medico.cpp: In constructor ‘Centro_medico::Centro..

CSS flexbox not working in IE10

In IE10, this code isn't working correctly: .flexbox form { display: -webkit-flex; display: -moz-flex; display: -ms-flex; display: -o-flex; display: flex; -webkit-flex-directi..

jQuery show/hide not working

I have a basic html page with some JS and CSS: _x000D_ _x000D_ $('.expand').click(function() {_x000D_ $('.img_display_content').show();_x000D_ });_x000D_ @charset "utf-8";_x000D_ _x000D_ /* CSS Doc..

Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean

I've a problem with the following dependency in my pom.xml where org.springframework.version = 3.1.0.RELEASE: <!-- Spring MVC framework --> <dependency> <groupId>org.springframe..

How do you 'redo' changes after 'undo' with Emacs?

This article says that "Emacs has redo because you can reverse direction while undoing, thereby undoing the undo". What does this mean? How can a user 'redo' with Emacs?..

React Error: Target Container is not a DOM Element

I just got started using React so this is probably a very simple mistake, but here we go. My html code is very simple: <!-- base.html --> <html> <head> <title>Note Cards..

Python string prints as [u'String']

This will surely be an easy one but it is really bugging me. I have a script that reads in a webpage and uses Beautiful Soup to parse it. From the soup I extract all the links as my final goal is to..

Set the selected index of a Dropdown using jQuery

How do I set the index of a dropdown in jQuery if the way I'm finding the control is as follows: $("*[id$='" + originalId + "']") I do it this way because I'm creating controls dynamically and sin..

How to create an Array, ArrayList, Stack and Queue in Java?

I was reading a Java article, but found no differences in the declaration and was confused over. Can anyone list me out this? Added the Article

Check if list contains element that contains a string and get that element

While searching for an answer to this question, I've run into similar ones utilizing LINQ but I haven't been able to fully understand them (and thus, implement them), as I'm not familiarized with it. ..

Setting Short Value Java

I am writing a little code in J2ME. I have a class with a method setTableId(Short tableId). Now when I try to write setTableId(100) it gives compile time error. How can I set the short value without d..

Why emulator is very slow in Android Studio?

I just setup Android Studio on my PC, which is new launch to develop Android application. My problem is that, when I try to run my small app in emulator, it take to much time to launch and after then..

Javascript getElementsByName.value not working

I am trying to make a simple javascript program bit it isn't working. Kindly help. In eclipse I have created a dynamic web project and in DD my welcome file is index.jsp. Given below is my code for in..

How to convert a string to character array in c (or) how to extract a single char form string?

I need to convert a string to a char array in C; how can I do this? Or at least, how can I extract single chars from a string incrementally?..

How do emulators work and how are they written?

How do emulators work? When I see NES/SNES or C64 emulators, it astounds me. Do you have to emulate the processor of those machines by interpreting its particular assembly instructions? What else..

How do I find the index of a character within a string in C?

Suppose I have a string "qwerty" and I wish to find the index position of the e character in it. (In this case the index would be 2) How do I do it in C? I found the strchr function but it returns ..

How to save a figure in MATLAB from the command line?

Is there a command in MATLAB which allows saving a figure in FIG or JPEG or both formats automatically?..

How to save and extract session data in codeigniter

I save some data in session on my verify controller then I extract this session data into user_activity model and insert session data into activity table. My problem is only username data saved in ses..

SQL DELETE with JOIN another table for WHERE condition

I have to delete rows from guide_category that have no relation with guide table (dead relations). Here is what I want to do, but it of course does not work. DELETE FROM guide_category AS pgc WHER..

How to make an AJAX call without jQuery?

How to make an AJAX call using JavaScript, without using jQuery? ..

Codesign wants to access key "access" in your keychain, I put in my login password but keeps asking me

I'm trying to learn to load apps on my iPhone from Xcode. When I do I keep getting "Codesign wants to access key "access" in your keychain, I put I my login password but it keeps popping up over and..

Error inflating class

I am trying to get Material Design for my App by following this method. Whenever I run the App it shows the following error: Error inflating class I checked..

What is the difference between `git merge` and `git merge --no-ff`?

Using gitk log, I could not spot a difference between the two. How can I observe the difference (with a git command or some tool)?..

How to make circular background using css?

I need make something like this. and I want to do it for a <div></div> which has width in % I can do this by using an image and adding another div inside and z-index. But I want to kno..

What is the purpose of the return statement?

What is the simple basic explanation of what the return statement is, how to use it in Python? And what is the difference between it and the print statement?..

What is the difference between a HashMap and a TreeMap?

I started learning Java. When would I use a HashMap over a TreeMap?..

What datatype should be used for storing phone numbers in SQL Server 2005?

I need to store phone numbers in a table. Please suggest which datatype should I use? Wait. Please read on before you hit reply.. This field needs to be indexed heavily as Sales Reps can use this fi..

Can grep show only words that match search pattern?

Is there a way to make grep output "words" from files that match the search expression? If I want to find all the instances of, say, "th" in a number of files, I can do: grep "th" * but the output..

How do I clear a combobox?

I have some combo-boxes that are set up as drop down lists, and the user can pick a number in them. I also have a Clear button that should clear the text from the combo boxes but I can't seem to get i..

How to add rows dynamically into table layout

I have certain data in sqllite and it update every time whenever, I click on save button and I want to show the data into a table layout for adding more rows for updated data. I have certain code but..

Define variable to use with IN operator (T-SQL)

I have a Transact-SQL query that uses the IN operator. Something like this: select * from myTable where myColumn in (1,2,3,4) Is there a way to define a variable to hold the entire list "(1,2,3,4)"..

How to send emails from my Android application?

I am developing an application in Android. I don't know how to send an email from the application?..

Downloading Java JDK on Linux via wget is shown license page instead

When I try to download Java from Oracle I instead end up downloading a page telling me that I need agree to the OTN license terms. Sorry! In order to download products from Oracle Technology ..

PHP session handling errors

I have this at the very top of my send.php file: ob_start(); @session_start(); //some display stuff $_SESSION['id'] = $id; //$id has a value header('location: test.php'); And the following at the..

How to make an "alias" for a long path?

I tried to make an "alias" for a path that I use often while shell scripting. I tried something, but it failed: myFold="~/Files/Scripts/Main" cd myFold bash: cd: myFold: No such file or directory ..

How to concatenate two strings to build a complete path

I am trying to write a bash script. In this script I want user to enter a path of a directory. Then I want to append some strings at the end of this string and build a path to some subdirectories. For..

How can I confirm a database is Oracle & what version it is using SQL?

I'm building an installer for an application. The user gets to select a datasource they have configured and nominate what type of database it is. I want to confirm that the database type is indeed Or..

How to replace innerHTML of a div using jQuery?

How could I achieve the following: document.all.regTitle.innerHTML = 'Hello World'; Using jQuery where regTitle is my div id?..

Dynamically display a CSV file as an HTML table on a web page

I'd like to take a CSV file living server-side and display it dynamically as an html table. E.g., this: Name, Age, Sex "Cantor, Georg", 163, M should become this: <html><body><table..

Python set to list

How can I convert a set to a list in Python? Using a = set(["Blah", "Hello"]) a = list(a) doesn't work. It gives me: TypeError: 'set' object is not callable ..

How to debug an apache virtual host configuration?

Once again, I have a problem with my apache virtual host configuration. (The default configuration is used instead of my specific one). The problem is not really the misconfiguration but how to solve..

How to make a div with no content have a width?

I am trying to add a width to a div, but I seem to be running into a problem because it has no content. Here is the CSS and HTML I have so far, but it is not working: CSS body{ margin:0 auto; width:10..

How to concatenate two strings in C++?

I have a private class variable char name[10] to which I would like to add the .txt extension so that I can open the file present in the directory. How do I go about this? It would be preferable to..

How to configure Git post commit hook

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

Tower of Hanoi: Recursive Algorithm

Although I have no problem whatsoever understanding recursion, I can't seem to wrap my head around the recursive solution to the Tower of Hanoi problem. Here is the code from Wikipedia: procedure Ha..

What is the maximum possible length of a .NET string?

What is the longest string that can be created in .NET? The docs for the String class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of intern..

TypeError : Unhashable type

I am trying to get a list of list of tuples : something like [ [(1,0),(2,0),(3,0)],[(1,1),(2,1),(3,1)....]] I used this statement set([(a,b)for a in range(3)]for b in range(3)) But it gives me an ..

How to handle checkboxes in ASP.NET MVC forms?

Caution: This question is over nine years old! Your best option is to search for newer questions, or to search the answers below looking for your specific version of MVC, as many answers here are ob..

How to use ADB in Android Studio to view an SQLite DB

I need to view my SQLite db but I don't know how to do it. I've gone to and downloaded the command line shell for my OS, but when I run the program and type adb .....

Send values from one form to another form

I want to pass values between two Forms (c#). How can I do it? I have two forms: Form1 and Form2. Form1 contains one button. When I click on that button, Form2 should open and Form1 should be in in..

Import MySQL database into a MS SQL Server

I have a .sql file from a MySQL dump containing tables, definitions and data to be inserted in these tables. How can I convert this database represented in the dump file to a MS SQL Server database?..

The remote host closed the connection. The error code is 0x800704CD

I receive error emails from my website whenever an exception occurs. I am getting this error: The remote host closed the connection. The error code is 0x800704CD and don't know why. I get about ..

Convert hex to binary

I have ABC123EFFF. I want to have 001010101111000001001000111110111111111111 (i.e. binary repr. with, say, 42 digits and leading zeroes). How?..

Another git process seems to be running in this repository

I'm trying to learn how to use Git and have created a small project with an HTML, CSS, and Javascript file. I made a branch from my basically empty project and then made some changes to my code. I tri..

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL:..

How to call function on child component on parent events

Context In Vue 2.0 the documentation and others clearly indicate that communication from parent to child happens via props. Question How does a parent tell its child an event has happened via props..

How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how you..

Calculate days between two Dates in Java 8

I know there are lots of questions on SO about how to get Dates in Java, but I want an example using new Java 8 Date API. I also know about the JodaTime library, but I want a method without relying on..

SQL - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have been getting the following error when running a SQL to convert my data type value from varchar to datetime. Msg 242, Level 16, State 3, Line 1 The conversion of a varchar data type to a d..

Different class for the last element in ng-repeat

I am creating a list using ng-repeat something like this <div ng-repeat="file in files"> {{}} </div> But for the last element alone I would like to have a class (<di..

SQL How to correctly set a date variable value and use it?

I have the following query which uses a date variable, which is generated inside the stored procedure: DECLARE @sp_Date DATETIME SET @sp_Date = DateAdd(m, -6, GETDATE()) SELECT DISTINCT pat.Publicati..

Verifying that a string contains only letters in C#

I have an input string and I want to verify that it contains: Only letters or Only letters and numbers or Only letters, numbers or underscore To clarify, I have 3 different cases in the code, eac..

How can I time a code segment for testing performance with Pythons timeit?

I've a python script which works just as it should, but I need to write the execution time. I've googled that I should use timeit but I can't seem to get it to work. My Python script looks like this:..

Change the color of a bullet in a html list?

All I want is to be able to change the color of a bullet in a list to a light gray. It defaults to black, and I can't figure out how to change it. I know I could just use an image; I'd rather not do ..

Get free disk space

Given each of the inputs below, I'd like to get free space on that location. Something like long GetFreeSpace(string path) Inputs: c: c:\ c:\temp \\server \\server\C\storage ..

How does one generate a random number in Apple's Swift language?

I realize the Swift book provided an implementation of a random number generator. Is the best practice to copy and paste this implementation in one's own program? Or is there a library that does thi..

System.currentTimeMillis vs System.nanoTime

Accuracy Vs. Precision What I would like to know is whether I should use System.currentTimeMillis() or System.nanoTime() when updating my object's positions in my game? Their change in movement is d..

How to include js and CSS in JSP with spring MVC

I want to include js and css files in my jsp, but I'm not able to do so. I'm new to the concept of spring MVC. For a long time, I've been working on this same topic. My index Page is like this <!D..

difference between System.out.println() and System.err.println()

What is the difference between System.out.println() and System.err.println() in Java?..

Styling multi-line conditions in 'if' statements?

Sometimes I break long conditions in ifs onto several lines. The most obvious way to do this is: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_som..

How to escape regular expression special characters using javascript?

I need to escape the regular expression special characters using java script.How can i achieve this?Any help should be appreciated. Thanks for your quick reply.But i need to escape all the special ..

Is there a way to do repetitive tasks at intervals?

Is there a way to do repetitive background tasks in Go? I'm thinking of something like Timer.schedule(task, delay, period) in Java. I know I can do this with a goroutine and Time.sleep(), but I'd li..

Copying and pasting data using VBA code

I have a button on a spreadsheet that, when pressed, should allow the user to open a file, then copy columns A-G of the spreadsheet "Data", then paste the data from those columns on the current sheet...

Are there bookmarks in Visual Studio Code?

How can I set bookmarks in Visual Studio Code? I can't find any keyboard shortcuts. Or is there anything else that I can use instead?..

If/else else if in Jquery for a condition

I am having a set of text fields where i am doing validation Say I am Having a field called "seats" this can accept value less than "99999".Meaning I should not able to enter the "99999" any thing ..

How to change max_allowed_packet size

I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error Packets larger than max_allowed_packet are not allowed. Here is what i've trie..

How to get Device Information in Android

Possible Duplicate: How to detect system information like os or device type I am new to android application development. I developed one small application,and install that application .apk..

How can I use the HTML5 canvas element in IE?

I am trying to use the HTML5 canvas element to draw some arcs and circles - this works perfectly in FF but IE8 does not seem to support it. Now, there exist Javascript libraries which seem to make IE..

Count number of records returned by group by

How do I count the number of records returned by a group by query, For eg: select count(*) from temptable group by column_1, column_2, column_3, column_4 Gives me, 1 1 2 I need to count the a..

How can I pad an int with leading zeros when using cout << operator?

I want cout to output an int with leading zeros, so the value 1 would be printed as 001 and the value 25 printed as 025. How can I do this?..

How to convert currentTimeMillis to a date in Java?

I have milliseconds in certain log file generated in server, I also know the locale from where the log file was generated, my problem is to convert milliseconds to date in specified format. The proces..

Using union and order by clause in mysql

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

Sorting a tab delimited file

I have a data with the following format: foo<tab>1.00<space>1.33<space>2.00<tab>3 Now I tried to sort the file based on the last field decreasingly. I tried the following co..

How do I get the last day of a month?

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

Sorting string array in C#

Maybe it sounds weird, but after a long time programming, I just got on array sorting. Everything was as I expected, until I tried to sort an array of strings containing two identical strings inside. ..

jQuery get textarea text

Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were abl..

MYSQL into outfile "access denied" - but my user has "ALL" access.. and the folder is CHMOD 777

Any ideas? SELECT * INTO OUTFILE '/home/myacnt/docs/mysqlCSVtest.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '*' LINES TERMINATED BY '\n' FROM tbl_property WHERE managerGroupID = {$manager..

How do I print out the contents of a vector?

How do I print out the contents of a std::vector to the screen? A solution that implements the following operator<< would be nice as well: template<container C, class T, String delim = "..

How to delete duplicate lines in a file without sorting it in Unix?

Is there a way to delete duplicate lines in a file in Unix? I can do it with sort -u and uniq commands, but I want to use sed or awk. Is that possible?..

requestFeature() must be called before adding content

I am trying to implement a custom titlebar: Here is my Helper class: import; import android.view.Window; public class UIHelper { public static void setupTitleBar(Activity c..

SQL query for finding records where count > 1

I have a table named PAYMENT. Within this table I have a user ID, an account number, a ZIP code and a date. I would like to find all records for all users that have more than one payment per day with ..

How can I format a number into a string with leading zeros?

I have a number that I need to convert to a string. First I used this: Key = i.ToString(); But I realize it's being sorted in a strange order and so I need to pad it with zeros. How could I do this..

Uploading Laravel Project onto Web Server

I am trying to upload my Laravel project onto my web server, but my past two attempts have been unsuccessful. I believe I am not uploading the files to the right location. This is my web server's stru..

How can I use/create dynamic template to compile dynamic Component with Angular 2.0?

I want to dynamically create a template. This should be used to build a ComponentType at runtime and place (even replace) it somewhere inside of the hosting Component. Until RC4 I was using Componen..

How can I use tabs for indentation in IntelliJ IDEA?

How can I use tabs instead of multiple spaces for indentation in IntelliJ IDEA 11.0? I have "Use tab character" checked under "Code Style" > "General" > "Default Indent Options". And also tried to ha..

How to make overlay control above all other controls?

I need to make a control appear above all other controls, so it will partially overlay them...

onActivityResult is not being called in Fragment

The activity hosting this fragment has its onActivityResult called when the camera activity returns. My fragment starts an activity for a result with the intent sent for the camera to take a picture...

php variable in html no other way than: <?php echo $var; ?>

I work a lot in mixed HTML and PHP and most time I just want solid HTML with a few PHP variables in it so my code look like this: <tr><td> <input type="hidden" name="type" value="<?..

Node Version Manager (NVM) on Windows

I am trying to downgrade my version of node I ran: npm install nvm and I exported the bin folder to my Windows path variable, C:\Program Files (x86)\nodejs\node_modules\npm\bin but I still get..

How do I find if a string starts with another string in Ruby?

What the best way to find if a string starts with another in Ruby (without rails)?..

Extract substring from a string

what is the best way to extract a substring from a string in android?..

Make an image width 100% of parent div, but not bigger than its own width

I’m trying to get an image (dynamically placed, with no restrictions on dimensions) to be as wide as its parent div, but only as long as that width isn’t wider than its own width at 100%. I’ve t..

Can anyone explain me StandardScaler?

I am unable to understand the page of the StandardScaler in the documentation of sklearn. Can anyone explain this to me in simple terms?..

Pip error: Microsoft Visual C++ 14.0 is required

I just ran the following command: pip install -U steem and the installation worked well until it failed to install pycrypto. Afterwards I did the pip install cryptography command because I thought i..

[Vue warn]: Cannot find element

I'm using Vuejs. This is my markup: <body> <div id="main"> <div id="mainActivity" v-component="{{currentActivity}}" class="activity"></div> </div> </body> ..

How do you implement a class in C?

Assuming I have to use C (no C++ or object oriented compilers) and I don't have dynamic memory allocation, what are some techniques I can use to implement a class, or a good approximation of a class? ..

Need a query that returns every field that contains a specified letter

I have an SQL table with 11000 keywords in it. I want a query that can find fields which contain a certain letter. So, if I include "a" and "b" the query will select all fields which contain the let..