Questions Tagged with #Displayattribute

displayname attribute vs display attribute

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?..

How to get the Display Name Attribute of an Enum member via MVC Razor code?

I've got a property in my model called Promotion that its type is a flag enum called UserPromotion. Members of my enum have display attributes set as follows: [Flags] public enum UserPromotion { N..

event.preventDefault() function not working in IE

Following is my JavaScript (mootools) code: $('orderNowForm').addEvent('submit', function (event) { event.preventDefault(); allFilled = false; $$(".required").each(function (inp) { ..

Use ffmpeg to add text subtitles

I am trying to add text subtitles to an .mp4 container using ffmpeg: ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mp4 When I am trying to run this line, it gives me an error :..

How to make scipy.interpolate give an extrapolated result beyond the input range?

I'm trying to port a program which uses a hand-rolled interpolator (developed by a mathematician colleage) over to use the interpolators provided by scipy. I'd like to use or wrap the scipy interpolat..

How to hide app title in android?

I want to hide the app title bar...

How to properly use jsPDF library

I want to convert some of my divs into PDF and I've tried jsPDF library but with no success. It seems I can't understand what I need to import to make the library work. I've been through the examples ..

How do you convert a DataTable into a generic list?

Currently, I'm using: DataTable dt = CreateDataTableInSomeWay(); List<DataRow> list = new List<DataRow>(); foreach (DataRow dr in dt.Rows) { list.Add(dr); } Is there a better/magi..

Java - No enclosing instance of type Foo is accessible

I have the following code: class Hello { class Thing { public int size; Thing() { size = 0; } } public static void main(String[] args) { Thin..

how to permit an array with strong parameters

I have a functioning Rails 3 app that uses has_many :through associations which is not, as I remake it as a Rails 4 app, letting me save ids from the associated model in the Rails 4 version. These a..

Is it not possible to stringify an Error using JSON.stringify?

Reproducing the problem I'm running into an issue when trying to pass error messages around using web sockets. I can replicate the issue I am facing using JSON.stringify to cater to a wider audience:..

Failed to authenticate on SMTP server error using gmail

I'm trying to set up email for my first laravel project, and was thrilled that there's a laracast for it: https://laracasts.com/lessons/mailers I've followed the simple steps, chose gmail in mail.ph..

How to Bootstrap navbar static to fixed on scroll?

I would like to make static navbar to fixed navbar on scroll, when it reaches top of the page. Is there a way to get it using bootstrap 3 css or javascript?..

How can I remove the outline around hyperlinks images?

When we use Text Replacement using CSS and give a negative test-indent i.e. text-indent:-9999px. Then when we click on that link the Dotted line appears like in the sample image below. What's the solu..

Git: How to remove remote origin from Git repo

I just did git init to initialize my folder as git repo and then added a remote repository using git remote add origin url. Now I want to remove this git remote add origin and add a new repository git..

How to get text and a variable in a messagebox

I just need to know how to have plain text and a variable in a messagebox. For example: I can do this: MsgBox(variable) And I can do this: MsgBox("Variable = ") But I can't do this: MsgBox("Variab..

Check string for nil & empty

Is there a way to check strings for nil and "" in Swift? In Rails, I can use blank() to check. I currently have this, but it seems overkill: if stringA? != nil { if !stringA!.isEmpty { ..

How do you develop Java Servlets using Eclipse?

I would like to program Java servlets using Eclipse and I plan on deploying them using Tomcat. I think I can build the projects using Ant which is bundled with Eclipse. I have the standard Eclipse IDE..

Remove empty lines in a text file via grep

FILE: hello world foo bar How can I remove all the empty new lines in this FILE? Output of command: FILE: hello world foo bar ..

How to use registerReceiver method?

I want to use dynamically registered BroadcastReceiver that has a reference to an Activity so it can modify its UI. I am using Context.registerReceiver() method but receiver's onReceive() method is ne..

Difference between Pragma and Cache-Control headers?

I read about Pragma header on Wikipedia which says: "The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and ..

How to make div background color transparent in CSS

I'm not using CSS3. So I can't use opacity or filter attributes. Without using these attributes how can I make the background-color transparent of a div? It should be kind of the text box example in t..

Custom alert and confirm box in jquery

Is there any alert and confirm dialog available in jquery with custom title and custom content in it. I have searched many sites but cannot find appropriate. Any site link or any content are appreciab..

Best way to check if an PowerShell Object exist?

I am looking for the best way to check if a Com Object exists. Here is the code that I have; I'd like to improve the last line: $ie = New-Object -ComObject InternetExplorer.Application $ie.Navigate(..

Send a base64 image in HTML email

Using a rich-text editor, our users can drag and drop a saved image from their desktop to the editor. The image appears and displays properly in the web page after they submit. Since the image is not..

Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an array but got an object?

How fix Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an array but got an object? // Service angular.module('admin.services', ['ngResource']) ..

How can I use an ES6 import in Node.js?

I'm trying to get the hang of ES6 imports in Node.js and am trying to use the syntax provided in this example: Cheatsheet Link I'm looking through the support table, but I was not able to find what ve..

How to set the first option on a select box using jQuery?

I have two HTML select boxes. I need to reset one select box when I make a selection in another. <select id="name" > <option value="">select all</option> <option value="1..

Trying to get property of non-object - CodeIgniter

I'm trying to make update form, that is going to retrieve the data for the specific ID selected, and fill in the form, so its going to be available for updating. When I click edit on the specific ent..

Accept server's self-signed ssl certificate in Java client

It looks like a standard question, but I couldn't find clear directions anywhere. I have java code trying to connect to a server with probably self-signed (or expired) certificate. The code reports t..

jQuery checkbox change and click event

_x000D_ _x000D_ $(document).ready(function() {_x000D_ //set initial state._x000D_ $('#textbox1').val($(this).is(':checked'));_x000D_ _x000D_ $('#checkbox1').change(function() {_x000D_ $('#te..

Rails has_many with alias name

In my User model I could have: has_many :tasks and in my Task model: belongs_to :user Then, supposing the foreign key 'user_id' was stored in the tasks table, I could use: @user.tasks My qu..

Selecting pandas column by location

I'm simply trying to access named pandas columns by an integer. You can select a row by location using df.ix[3]. But how to select a column by integer? My dataframe: df=pandas.DataFrame({'a':np.r..

Getting cursor position in Python

Is it possible to get the overall cursor position in Windows using the standard Python libraries?..

Hide header in stack navigator React navigation

I'm trying to switch screen using both stack and tab navigator. const MainNavigation = StackNavigator({ otp: { screen: OTPlogin }, otpverify: { screen: OTPverification}, userVerifie..

I am receiving warning in Facebook Application using PHP SDK

I used the following code to configure the facebook API and my structure what to follow is also OK. But I am receiving warning like that. Warning: session_start(): Cannot send session cache limiter -..

How do I get the name of the current executable in C#?

I want to get the name of the currently running program, that is the executable name of the program. In C/C++ you get it from args[0]...

Convert String to Double - VB

Is there an efficient method in VB to check if a string can be converted to a double? I'm currently doing this by trying to convert the string to a double and then seeing if it throws an exception. B..

Should Gemfile.lock be included in .gitignore?

I'm sort of new to bundler and the files it generates. I have a copy of a git repo from GitHub that is being contributed to by many people so I was surprised to find that bundler created a file that d..

How to convert a .eps file to a high quality 1024x1024 .jpg?

I have a .eps file that I can look at in Photoshop, and it has a very high resolution, sharp edges, etc. at even larger than 1024x1024. With ImageMagick I want to convert this .eps to a 1024x1024 .jp..

Is the size of C "int" 2 bytes or 4 bytes?

Does an Integer variable in C occupy 2 bytes or 4 bytes? What are the factors that it depends on? Most of the textbooks say integer variables occupy 2 bytes. But when I run a program printing the suc..

How to negate the whole regex?

I have a regex, for example (ma|(t){1}). It matches ma and t and doesn't match bla. I want to negate the regex, thus it must match bla and not ma and t, by adding something to this regex. I know I ca..

hasNext in Python iterators?

Haven't Python iterators got a hasNext method?..

decompiling DEX into Java sourcecode

How can one decompile Android DEX (VM bytecode) files into corresponding Java sourcecode?..

Should I put #! (shebang) in Python scripts, and what form should it take?

Should I put the shebang in my Python scripts? In what form? #!/usr/bin/env python or #!/usr/local/bin/python Are these equally portable? Which form is used most? Note: the tornado project use..

how can I display tooltip or item information on mouse over?

I am displaying 5 userImage on one screen.I want to display userID and email on mouseover on those userImage.I used alt property of image control but that not working in mozila,chrome and some versio..

How to pass integer from one Activity to another?

I would like to pass a new value for an integer from one Activity to another. i.e.: Activity B contains an integer[] pics = { R.drawable.1, R.drawable.2, R.drawable.3} I would like activity A to ..

How to declare and add items to an array in Python?

I'm trying to add items to an array in python. I run array = {} Then, I try to add something to this array by doing: array.append(valueToBeInserted) There doesn't seem to be a .append method f..

how to get GET and POST variables with JQuery?

How do I simply get GET and POST values with JQuery? What I want to do is something like this: $('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex')); ..

How to enable multidexing with the new Android Multidex support library

I want to use the new Multidex support library to break the method limit for one of my apps. With Android Lollipop Google introduced a multidex support library that makes it easy to multidex. What..

Recursively counting files in a Linux directory

How can I recursively count files in a Linux directory? I found this: find DIR_NAME -type f ¦ wc -l But when I run this it returns the following error. find: paths must precede expression: ¦..

JRE 1.7 - java version - returns: java/lang/NoClassDefFoundError: java/lang/Object

When running any java application, or just 'java', the jvm fails: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object Here is a list of wrong answers: ..

How to write into a file in PHP?

I have this script on one free PHP-supporting server: <html> <body> <?php $file = fopen("lidn.txt","a"); fclose($file); ?> </body> </html> It creates the file lidn..

Why use ICollection and not IEnumerable or List<T> on many-many/one-many relationships?

I see this a lot in tutorials, with navigation properties as ICollection<T>. Is this a mandatory requirement for Entity Framework? Can I use IEnumerable? What's the main purpose of using IColl..

Compile to a stand-alone executable (.exe) in Visual Studio

how can I make a stand-alone exe in Visual Studio. Its just a simple Console application that I think users would not like to install a tiny Console application. I compiled a simple cpp file using the..

Process list on Linux via Python

How can I get running process list using Python on Linux?..

Changing the Git remote 'push to' default

I want to change the Git default remote branch destination so I could just git push Instead of: git push upstream Currently this is set to the origin remote and I want to set it to a different r..

Format a datetime into a string with milliseconds

I want to have a datetime string from the date with milliseconds. This code is typical for me and I'm eager to learn how to shorten it. from datetime import datetime timeformatted= str(datetime.utcn..

Set specific precision of a BigDecimal

I have an XSD that requires me to use a BigDecimal for a lat/lon. I currently have the lat/lon as doubles, and convert them to BigDecimal, but I am only required to use about 12 places of precision. ..

Get number days in a specified month using JavaScript?

Possible Duplicate: What is the best way to determine the number of days in a month with javascript? Say I have the month as a number and a year...

INNER JOIN in UPDATE sql for DB2

Is there a way to use joins in update statements for DB2? Google has really let me down on this one This is roughly what I'm trying to achieve (... except obviously working ....) update file1 inner..

Unit testing private methods in C#

Visual Studio allows unit testing of private methods via an automatically generated accessor class. I have written a test of a private method that compiles successfully, but it fails at runtime. A fai..

How can I encode a string to Base64 in Swift?

I want to convert a string to Base64. I found answers in several places, but it does not work anymore in Swift. I am using Xcode 6.2. I believe the answer might be work in previous Xcode versions and ..

Convert a number into a Roman Numeral in javaScript

How can I convert integers into roman numerals? function romanNumeralGenerator (int) { } For example, see the following sample inputs and outputs: 1 = "I" 5 = "V" 10 = "X" 20 = "XX" 3999 = "MMMCM..

What is the fastest way to create a checksum for large files in C#

I have to sync large files across some machines. The files can be up to 6GB in size. The sync will be done manually every few weeks. I cant take the filename into consideration because they can change..

How to change credentials for SVN repository in Eclipse?

I have Eclipse 3.4.2 installed on Windows with subclipse. Another developer added an SVN repository with his credentials and selected 'Save password'. Now every time I do anything with SVN his cached ..

How to delete a stash created with git stash create?

Git stash seems to do a lot of what I want, except that it is a little hard to script, as the if you have no changes, then git stash; git stash pop will do something different than if you do have chan..

OPTION (RECOMPILE) is Always Faster; Why?

I encountered an odd situation where appending OPTION (RECOMPILE) to my query causes it to run in half a second, while omitting it causes the query to take well over five minutes. This is the case wh..

Passing an array of parameters to a stored procedure

I need to pass an array of "id's" to a stored procedure, to delete all rows from the table EXCEPT the rows that match id's in the array. How can I do it in a most simple way?..

programmatically add column & rows to WPF Datagrid

I'm new to WPF. I just want to know how should we add columns and rows programmatically to a DataGrid in WPF. The way we used to do it in windows forms. create table columns and rows, and bind it to D..

how to write value into cell with vba code without auto type conversion?

This problem seems very simple, yet I just can not find the solution (I am already loosing my mind about it :) ) OK, so I just want to put a certain value into an excel cell, using vba code, just as ..

JavaScript/regex: Remove text between parentheses

Would it be possible to change Hello, this is Mike (example) to Hello, this is Mike using JavaScript with Regex?..

jQuery: go to URL with target="_blank"

I am using this bit of jQuery code to get href of the link: var url = $(this).attr('href'); -- and this bit of code to go to that href: window.location = url; Everything is just the way I want i..

TypeError: 'str' does not support the buffer interface

plaintext = input("Please enter the text you want to compress") filename = input("Please enter the desired filename") with gzip.open(filename + ".gz", "wb") as outfile: outfile.write(plaintext) ..

How to add colored border on cardview?

I am new to Android and this is my first question here. I am trying to add a colored vertical border at the beginning of the cardview. How can I achieve it on xml ? I tried adding it with empty textv..

How to access parent scope from within a custom directive *with own scope* in AngularJS?

I'm looking for any manner of accessing the "parent" scope within a directive. Any combination of scope, transclude, require, passing in variables (or the scope itself) from above, etc. I'm totally ..

How to list the files inside a JAR file?

I have this code which reads all the files from a directory. File textFolder = new File("text_directory"); File [] texFiles = textFolder.listFiles( new FileFilter() { public boole..

Get unicode value of a character

Is there any way in Java so that I can get Unicode equivalent of any character? e.g. Suppose a method getUnicode(char c). A call getUnicode('÷') should return \u00f7...

How to grep Git commit diffs or contents for a certain word?

In a Git code repository I want to list all commits that contain a certain word. I tried this git log -p | grep --context=4 "word" but it does not necessarily give me back the filename (unless it's..

How to get AIC from Conway–Maxwell-Poisson regression via COM-poisson package in R?

Is there an easy way to get AIC for a Conway–Maxwell-Poisson regression from COM-poisson package in R? see http://cran.r-project.org/web/packages/COMPoissonReg/COMPoissonReg.pdf I am not able to f..

Finding the index of an item in a list

Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python?..

How does one Display a Hyperlink in React Native App?

How do I display a hyperlink in a React Native app? e.g. <a href="https://google.com>Google</a> ..

How to set python variables to true or false?

I want to set a variable in Python to true or false. But the words true and false are interpreted as undefined variables: #!/usr/bin/python a = true; b = true; if a == b: print("same");..

Alternative Windows shells, besides CMD.EXE?

I don't like CMD.EXE, the built-in Windows terminal. Among its problems: Hard to copy and paste. Hard to resize the window. Hard to open another window (no menu options do this). Seems to always sta..

Is object empty?

What is the fastest way to check if an object is empty or not? Is there a faster and better way than this: function count_obj(obj){ var i = 0; for(var key in obj){ ++i; } re..

ASP.NET 4.5 has not been registered on the Web server

In my Win 7 development machine, and in order to use SQL Express instance instead of the localDB installed by default. I unchecked "Use IIS Express" in my MVC 4 project properties page (Web tab), then..

DataGridView.Clear()

Here comes the trouble. I want to delete all rows from datagridview. This how i add rows: private void ReadCompleteCallback(object clientHandle, Opc.Da.ItemValueResult[] results) { foreach (O..

Can a unit test project load the target application's app.config file?

I am unit testing a .NET application (.exe) that uses an app.config file to load configuration properties. The unit test application itself does not have an app.config file. When I try to unit tes..

Resizing an iframe based on content

I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. How do I resize the iframes to fit the height of the iframes' content? I've t..

How can I plot a confusion matrix?

I am using scikit-learn for classification of text documents(22000) to 100 classes. I use scikit-learn's confusion matrix method for computing the confusion matrix. model1 = LogisticRegression() mode..

KnockoutJs v2.3.0 : Error You cannot apply bindings multiple times to the same element

I've just upgraded to 2.3.0 and now I'm getting the error You cannot apply bindings multiple times to the same element. that I wasn't getting in 2.2.1. I'm getting a partial view from my MVC c..

HTML Script tag: type or language (or omit both)?

<script type="text/javascript"> /* ... */ </script> vs. <script language="Javascript"> /* ... */ </script> Which should be used and why? Or, the third alternative..

Why std::cout instead of simply cout?

I get these error messages for all cout and endl: main.cc:17:5: error: ‘cout’ was not declared in this scope main.cc:17:5: note: suggested alternative: /usr/include/c++/4.6/iostream:62:18: note: ..

What should be the package name of android app?

I want to know that what should be the package name of android app? Means normally we used com.appname OR com.organizationName.appName, But when we are submitting our application in to market then som..

XAMPP PORT 80 is Busy / EasyPHP error in Apache configuration file:

This problem has completely shot my entire day. I reformatted my old windows XP comp and tried installing XAMPP only to find that when i try to start Apache xampp claims port 80 is busy....WHAT DOES T..

Using cURL with a username and password?

I want to access a URL which requires a username/password. I'd like to try accessing it with curl. Right now I'm doing something like: curl http://api.somesite.com/test/blah?something=123 I get an ..

%Like% Query in spring JpaRepository

I would like to write a like query in JpaRepository but it is not returning anything : LIKE '%place%'-its not working. LIKE 'place' works perfectly. Here is my code : @Repository("registerUserRep..

How to list installed packages from a given repo using yum

I want to list all packages I have installed on a system from a given repo using yum. Usually to do this I use yum list installed | grep "something". But now I am faced with a problem. The repo I am i..

How to get current route in Symfony 2?

How do I get the current route in Symfony 2? For example, routing.yml: somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" } How can I get this somePage value?..

JUnit test for System.out.println()

I need to write JUnit tests for an old application that's poorly designed and is writing a lot of error messages to standard output. When the getResponse(String request) method behaves correctly it re..

Function for C++ struct

Usually we can define a variable for a C++ struct, as in struct foo { int bar; }; Can we also define functions for a struct? How would we use those functions?..

Android Studio shortcuts like Eclipse

I am new to Android Studio and want to know about shortcuts. In Eclipse we use shift-ctrl-O for importing. In Android Studio we use alt-enter. My question about importing override methods and unimple..

How to display div after click the button in Javascript?

I have following DIV . I want to display the DIV after button click .Now it is display none <div style="display:none;" class="answer_list" > WELCOME</div> <input type="button" name="..

Where can I find a list of keyboard keycodes?

Is there a place where I can find all the keycodes for keys on a keyboard? (For example, the key up may be #114) I can't seem to find one no matter what I search :( Thanks!..

How to implement an STL-style iterator and avoid common pitfalls?

I made a collection for which I want to provide an STL-style, random-access iterator. I was searching around for an example implementation of an iterator but I didn't find any. I know about the need f..

IntelliJ: Never use wildcard imports

Is there a way to tell IntelliJ never to use wildcard imports? Under 'Settings > Code Style > Imports', I can see that you can specify the 'class count' prior to IntelliJ using wildcard imports. Howe..

setInterval in a React app

I'm still fairly new at React, but I've been grinding along slowly and I've encountered something I'm stuck on. I am trying to build a "timer" component in React, and to be honest I don't know if I'..

failed to open stream: HTTP wrapper does not support writeable connections

I have uploaded my localhost files to my website but it is showing me this error:- : [2] file_put_contents( ***WebsiteURL*** /cache/lang/ ***FileName*** .php) [function.file-put-contents]: failed to..

Why there is no ConcurrentHashSet against ConcurrentHashMap

HashSet is based on HashMap. If we look at HashSet<E> implementation, everything is been managed under HashMap<E,Object>. <E> is used as a key of HashMap. And we know that HashMap..

Lua String replace

How would i do this? I got this: name = "^aH^ai" string.gsub(name, "^a", "") which should return "Hi", but it grabs the caret character as a pattern character What would be a work around for thi..

Storing C++ template function definitions in a .CPP file

I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example..

C++ Error 'nullptr was not declared in this scope' in Eclipse IDE

I am running Eclipse Helios and I have g++-4.6 installed. Hope I am not wrong that g++4.6 implements C++ 11 features. I have created a C++ project which uses the nullptr and auto keywords. The build g..

What Makes a Method Thread-safe? What are the rules?

Are there overall rules/guidelines for what makes a method thread-safe? I understand that there are probably a million one-off situations, but what about in general? Is it this simple? If a method o..

How to resize images proportionally / keeping the aspect ratio?

I have images that will be quite big in dimension and I want to shrink them down with jQuery while keeping the proportions constrained, i.e. the same aspect ratio. Can someone point me to some code, ..

What is this Javascript "require"?

I'm trying to get Javascript to read/write to a PostgreSQL database. I found this project on github. I was able to get the following sample code to run in node. var pg = require('pg'); //native libpq..

Converting XML to JSON using Python?

I've seen a fair share of ungainly XML->JSON code on the web, and having interacted with Stack's users for a bit, I'm convinced that this crowd can help more than the first few pages of Google results..

How do you discover model attributes in Rails?

I am finding it difficult to easily see what attributes/properties exist on all of my model classes since they are not explicitly defined in my class files. To discover model attributes, I keep the s..

How do I convert a String to a BigInteger?

I'm trying to read some really big numbers from standard input and add them together. However, to add to BigInteger, I need to use BigInteger.valueOf(long);: private BigInteger sum = BigInteger.valu..

Should I call Close() or Dispose() for stream objects?

Classes such as Stream, StreamReader, StreamWriter etc implements IDisposable interface. That means, we can call Dispose() method on objects of these classes. They've also defined a public method call..

why does DateTime.ToString("dd/MM/yyyy") give me dd-MM-yyyy?

I want my datetime to be converted to a string that is in format "dd/MM/yyyy" Whenever I convert it using DateTime.ToString("dd/MM/yyyy"), I get dd-MM-yyyy instead. Is there some sort of culture inf..

Can I append an array to 'formdata' in javascript?

I'm using FormData to upload files. I also want to send an array of other data. When I send just the image, it works fine. When I append some text to the formdata, it works fine. When I try to attac..

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

C++, How to determine if a Windows Process is running?

This is concerning Windows XP processes. I have a process running, let's call it Process1. Process1 creates a new process, Process2, and saves its id. Now, at some point Process1 wants Process2 to d..

WCFTestClient The HTTP request is unauthorized with client authentication scheme 'Anonymous'

I've created one WCF service and deployed it on Server. When I browse this service it gives me positive response with ?wsdl URL. Now I'm trying to test the service through WCF Test client. It shows pr..

Call function with setInterval in jQuery?

I'm trying to create a interval call to a function in jQuery, but it doesn't work! My first question is, can I mix common JavaScript with jQuery? Should I use setInterval("test()",1000); or somethin..

How can I change the remote/target repository URL on Windows?

I created a local GIT repository on Windows. Let's call it AAA. I staged, committed, and pushed the contents to GitHub. git@github.com:username/AAA.git I realized I made a mistake with the name. On..

How to create a GUID in Excel?

I need a function to add a GUID to cells in excel. I found this previous question on stackoverflow, but it is not working. It suggests the following function: =CONCATENATE(DEC2HEX(RANDBETWEEN(0,429496..

Alphabet range in Python

Instead of making a list of alphabet characters like this: alpha = ['a', 'b', 'c', 'd'.........'z'] is there any way that we can group it to a range or something? For example, for numbers it can be..

How do I activate a virtualenv inside PyCharm's terminal?

I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However,..

Explain the "setUp" and "tearDown" Python methods used in test cases

Can anyone explain the use of Python's setUp and tearDown methods while writing test cases apart from that setUp is called immediately before calling the test method and tearDown is called immediately..

Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistent

I have downloaded some open source software written in Java and tried to compile it using Eclipse. I got the error: "The hierarchy of the type 'Class name' is inconsistent" in some files. What causes ..

Check if decimal value is null

I would like to check if the decimal number is NULL or it has some value, since the value is assigned from database in class object: public decimal myDecimal{ get; set; } and then I have myDecima..

"Not allowed to load local resource: file:///C:....jpg" Java EE Tomcat

I'm trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db) I had st..

Terminating a Java Program

I found out ways to terminate (shut-down or stop) my Java programs. I found two solutions for it. using return;When I want to quit or terminate my program execution , I add this. using System.exit(..

Decoding JSON String in Java

I am new to using the json-simple library in Java and I've been through both the encoding and decoding samples. Duplicating the encoding examples was fine, but I have not been able to get the decoding..

Incrementing in C++ - When to use x++ or ++x?

I'm currently learning C++ and I've learned about the incrementation a while ago. I know that you can use "++x" to make the incrementation before and "x++" to do it after. Still, I really don't know ..

How to use UTF-8 in resource properties with ResourceBundle

I need to use UTF-8 in my resource properties using Java's ResourceBundle. When I enter the text directly into the properties file, it displays as mojibake. My app runs on Google App Engine. Can any..

Using .htaccess to make all .html pages to run as .php files?

I need to run all of my .html files as .php files and I don't have time to change all of the links before our presentation tomorrow. Is there any way to "hack" this with my Apache server?..

How to compare dates in Java?

How do I compare dates in between in Java? Example: date1 is 22-02-2010 date2 is 07-04-2010 today date3 is 25-12-2010 date3 is always greater than date1 and date2 is always today. How do I veri..

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 do you reindex an array in PHP but with indexes starting from 1?

I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1): Current array (edit: the array actually looks like this): Array ( [2] => Object ( ..

A simple command line to download a remote maven2 artifact to the local repository?

I have a library that I distribute using maven 2. The typical user of this library doesn't use maven to build their applications, but is likely somewhat familiar with maven and probably has it instal..

Check list of words in another string

I can do such thing in python: l = ['one', 'two', 'three'] if 'some word' in l: ... This will check if 'some word' exists in the list. But can I do reverse thing? l = ['one', 'two', 'three'] if..

Circular gradient in android

I'm trying to make a gradient that emits from the middle of the screen in white, and turns to black as it moves toward the edges of the screen. As I make a "normal" gradient like this, I have been ex..

How to encrypt String in Java

What I need is to encrypt string which will show up in 2D barcode(PDF-417) so when someone get an idea to scan it will get nothing readable. Other requirements: should not be complicated it shoul..

Java Desktop application: SWT vs. Swing

I'm a web developer at day and thinking about building my first real desktop application. The idea is to build a tool that automates a very repetitive task in a web application where no API is availab..

Setting up FTP on Amazon Cloud Server

I am trying to set up FTP on Amazon Cloud Server, but without luck. I search over net and there is no concrete steps how to do it. I found those commands to run: $ yum install vsftpd $ ec2-authorize..

make bootstrap twitter dialog modal draggable

I'm trying to make bootstrap twitter dialog modal draggable with this jquery plugin: http://threedubmedia.com/code/event/drag#demos but it doesn't work. var $div = $('html'); console.debug($('.drag..

How can I find the last element in a List<>?

The following is an extract from my code: public class AllIntegerIDs { public AllIntegerIDs() { m_MessageID = 0; m_MessageType = 0; m_ClassID = 0; ..

How to configure SMTP settings in web.config

I'm trying to fix an email issue with an inherited website and don't have access to the code (i.e. just the compiled files). This site needs to be hosted on a new web server having a different SMTP se..

How do you create a temporary table in an Oracle database?

I would like to create a temporary table in a Oracle database something like Declare table @table (int id) In SQL server And then populate it with a select statement Is it possible? Thanks..

Connection string using Windows Authentication

I am creating a website, but in the database I use windows authentication. I know that you use this for SQL authentication <connectionStrings> <add name="NorthwindContex" conne..

adding multiple event listeners to one element

So my dilemma is that I don't want to write the same code twice. Once for the click event and another for the touchstart event. Here is the original code: document.getElementById('first').addEventLi..

Taking multiple inputs from user in python

I know how to take a single input from user in python 2.5: raw_input("enter 1st number") This opens up one input screen and takes in the first number. If I want to take a second input I need to rep..

'uint32_t' does not name a type

I'm trying to compile a C++ software package that was written in 2007 and I'm getting this error: error: ‘uint32_t’ does not name a type This is happening in 64-bit Ubuntu using g++ 4.5.2. It co..

How can I limit Parallel.ForEach?

I have a Parallel.ForEach() async loop with which I download some webpages. My bandwidth is limited so I can download only x pages per time but Parallel.ForEach executes whole list of desired webpages..

Stopping a CSS3 Animation on last frame

I have a 4 part CSS3 animation playing on click - but the last part of the animation is meant to take it off the screen. However, it always goes back to its original state once it has played. Anyon..

Convert string to symbol-able in ruby

Symbols are usually represented as such :book_author_title but if I have a string: "Book Author Title" is there a built in way in rails/ruby to convert it into a symbol where I can use the : no..

How to use the priority queue STL for objects?

class Person { public: int age; }; I want to store objects of the class Person in a priority queue. priority_queue< Person, vector<Person>, ??? > I think I need to define a class ..

How to .gitignore all files/folder in a folder, but not the folder itself?

Possible Duplicate: How do I add an empty directory to a git repository I want to check in a blank folder. How can I do this?..

Defining arrays in Google Scripts

I'm a javascript newbie and trying to write a script for a spreadsheet that will pull various things out of it. Right off the bat, I'm having trouble defining an array of names that will be in the spr..

Error in Swift class: Property not initialized at super.init call

I have two classes, Shape and Square class Shape { var numberOfSides = 0 var name: String init(name:String) { self.name = name } func simpleDescription() -> String { ..

How can I close a dropdown on click outside?

I would like to close my login menu dropdown when the user click anywhere outside of that dropdown, and I'd like to do that with Angular2 and with the Angular2 "approach"... I have implemented a solu..

How to install a specific version of a package with pip?

Possible Duplicate: Installing specific package versions with Pip I am a bit new to pip install and virtualenv in general. I have setup an virtualenv on my server as well as on my local de..

Check if a key is down?

Is there a way to detect if a key is currently down in JavaScript? I know about the "keydown" event, but that's not what I need. Some time AFTER the key is pressed, I want to be able to detect if it ..

JQuery $.ajax() post - data in a java servlet

I want to send data to a java servlet for processing. The data will have a variable length and be in key/value pairs: { A1984 : 1, A9873 : 5, A1674 : 2, A8724 : 1, A3574 : 3, A1165 : 5 } The data ..

Where is HttpContent.ReadAsAsync?

I see in tons of examples on the web using the new HttpClient object (as part of the new Web API) that there should be HttpContent.ReadAsAsync<T> method. However, MSDN doesn't mention this metho..

INSERT INTO...SELECT for all MySQL columns

I'm trying to move old data from: this_table >> this_table_archive copying all columns over. I've tried this, but it doesn't work: INSERT INTO this_table_archive (*) VALUES (SELECT * FROM t..

getElementsByClassName not working

I coded a php page that displays information from a mysql database neatly into tables. I would like to hide empty table rows with an onLoad event handler. Here is a sample table with code that hides ..

Run AVD Emulator without Android Studio

is there a way to run the emulator without starting the Android Studio first. Perhaps from the command line. I know that this feature was available in older versions and has vanished since then. But p..

How do I get my solution in Visual Studio back online in TFS?

I had my solution in Visual Studio 2012 (which is under TFS source control) open and the TFS server (2010) was down. When I then made a change to one of the files and attempted to save it I got a prom..

Disable form autofill in Chrome without disabling autocomplete

How can we disable Chrome's autofill feature on certain <input>s to prevent them from being automatically populated when the page loads? At the same time I need to keep autocomplete enabled, s..

querySelector and querySelectorAll vs getElementsByClassName and getElementById in JavaScript

I would like to know what exactly is the difference between querySelector and querySelectorAll against getElementsByClassName and getElementById? From this link I could gather that with querySelecto..

Set Session variable using javascript in PHP

Is it possible to set PHP session variables using Javascript?..

Convert NSDate to NSString

How do I convert, NSDate to NSString so that only the year in @"yyyy" format is output to the string?..

calculating the difference in months between two dates

In C#/.NET TimeSpan has TotalDays, TotalMinutes, etc. but I can't figure out a formula for total months difference. Variable days per month and leap years keep throwing me off. How can I get TotalMont..

How can I beautify JSON programmatically?

Do you know of any "JSON Beautifier" for JavaScript? From {"name":"Steve","surname":"Jobs","company":"Apple"} To { "name" : "Steve", "surname" : "Jobs", "company" : "Apple" } Example som..

How can I remove text within parentheses with a regex?

I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example: filename = "Exam..

Text on image mouseover?

I am trying to get a small box to appear on the bottom-left side of an image when a mouse moves over it. Inside the box there will be a link to a different page. Here is somewhat similar to what I wa..

The current .NET SDK does not support targeting .NET Standard 2.0 error in Visual Studio 2017 update 15.3

I want to create a class library project with Target Framework .NET Standard 2.0. I've updated my Visual Studio 2017 to Version 15.3 and also in Visual Studio installer checked .NET Framework 4.7 SD..

Recommendation for compressing JPG files with ImageMagick

I want to compress a JPG image file with ImageMagick but can't get much difference in size. By default the output size is bigger than the input. I don't know why, but after adding some +profile option..

When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0)

I am getting this error while running sudo npm install. On my server, npm was installed earlier. I've tried to delete the package-lock.json file, and ran npm cache clean --force, but it didn't work. ..

What are the new features in C++17?

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

from unix timestamp to datetime

I have something like /Date(1370001284000+0200)/ as timestamp. I guess it is a unix date, isn't it? How can I convert this to a date like this: 31.05.2013 13:54:44 I tried THIS converter for 13700012..

How to make a Qt Widget grow with the window size?

I want to have a small QFormLayout that grows to fill its parent widget. I created a new .ui file using the QWidget template in Qt Designer. I put a QFormLayout inside that 'window', then put some co..

C# generics syntax for multiple type parameter constraints

Possible Duplicate: Generic methods and multiple constraints I need a generic function that has two type constraints, each inheriting from a different base class. I know how to do this with..

How can I make space between two buttons in same div?

What is the best way to horizontally space Bootstrap buttons? At the moment the buttons are touching: <div class="btn-group"> <button class="btn btn-inverse dropdown-toggle" data-toggle..

Postgresql: Scripting psql execution with password

How can I call psql so that it doesn't prompt for a password? This is what I have: psql -Umyuser < myscript.sql However, I couldn't find the argument that passes the password, and so psql alway..

Why is it said that "HTTP is a stateless protocol"?

HTTP has HTTP Cookies. Cookies allow the server to track the user state, the number of connections, last connection, etc. HTTP has persistent connections (Keep-Alive) where several requests can be se..

Showing all session data at once?

I have tried the following but it is giving me errors: print_r($this->session->userdata()); How can I show all session data in CodeIgniter?..

Download image with JavaScript

Right now I have a canvas and I want to save it as PNG. I can do it with all those fancy complicated file system API, but I don't really like them. I know if there is a link with download attribute o..

Ranges of floating point datatype in C?

I am reading a C book, talking about ranges of floating point, the author gave the table: Type Smallest Positive Value Largest value Precision ==== ======================= ============..

SQL "IF", "BEGIN", "END", "END IF"?

Not a SQL person at all. Have the following code a consultant wrote. First, it makes sure only an elementary school has been chosen - then, after the BEGIN, if the variable @Term equals a 3 we wa..

How do I search for a pattern within a text file using Python combining regex & string/file operations and store instances of the pattern?

So essentially I'm looking for specifically a 4 digit code within two angle brackets within a text file. I know that I need to open the text file and then parse line by line, but I am not sure the bes..

jQuery keypress() event not firing?

I am trying to fire an event on the right and left arrow key presses with jQuery. Using the following code, I can fire events on any of the alphanumeric keys, but the cursor keys (up, down, left, righ..

How to query for Xml values and attributes from table in SQL Server?

I have a table that contains a Xml column: SELECT * FROM Sqm A sample of the xml data of a row would be: <Sqm version="1.2"> <Metrics> <Metric id="TransactionCleanupThread...

unique() for more than one variable

I have the following data frame in R: > str(df) 'data.frame': 545227 obs. of 15 variables: $ ykod : int 93 93 93 93 93 93 93 93 93 93 ... $ yad : Factor w/ 42 levels "BAKUGAN","BARBIE",..: ..

complex if statement in python

I need to realize a complex if-elif-else statement in Python but I don't get it working. The elif line I need has to check a variable for this conditions: 80, 443 or 1024-65535 inclusive I tried ..

How do you convert CString and std::string std::wstring to each other?

CString is quite handy, while std::string is more compatible with STL container. I am using hash_map. However, hash_map does not support CStrings as keys, so I want to convert the CString into a std::..

Python: can't assign to literal

My task is to write a program that asks the user to enter 5 names which it stores in a list. Next, it picks one of these names at random and declares that person as the winner. The only issue is that ..

SQLAlchemy: how to filter date field?

Here is model: class User(Base): ... birthday = Column(Date, index=True) #in database it's like '1987-01-17' ... I want to filter between two dates, for example to choose all users in..

How do I delete NuGet packages that are not referenced by any project in my solution?

Somehow during the upgrade to VS2012 and .NET 4.5, I've managed to get NuGet confused. There are packages that appear in the package manager (and the packages folder) that I cannot delete (I believe ..