Questions Tagged with #Diem

how to fix the issue "Command /bin/sh failed with exit code 1" in iphone

I used a cocoa static library in my application. When I compile my library I got the following error: Shell Script invocation error:can't open input file: /Users/sijuthomas/Library/Developer/Xcode/De..

moment.js 24h format

How do I display my time in 24h format instead of 12? I am using moment.js. I am pretty sure that these lines could have something to do with it. meridiem : function (hours, minutes, isLower) { ..

Pretty printing XML with javascript

I have a string that represents a non indented XML that I would like to pretty-print. For example: <root><node/></root> should become: <root> <node/> </root> ..

click command in selenium webdriver does not work

I have just recently done an export of my selenium IDE code to selenium web driver. I have found that a lot of the commands that worked in IDE either fail to work or selenium web driver claims to not ..

How to do a timer in Angular 5

I'm using Angular 5. I want to know how can I start timing when a 'play' button is pressed, in order to know how much time has passed since I clicked. I'd also like to know if it's possible to stop ..

What is the best way to get all the divisors of a number?

Here's the very dumb way: def divisorGenerator(n): for i in xrange(1,n/2+1): if n%i == 0: yield i yield n The result I'd like to get is similar to this one, but I'd like a smarter a..

Export to CSV using MVC, C# and jQuery

I am trying to export a list to a CSV file. I got it all working up to the point I want to write to file to the response stream. This doesn't do anything. Here is my code: Call the the method from t..

How can I use a reportviewer control in an asp.net mvc 3 razor view?

I'm trying to use a reportviewer control, within a razor view, in the mvc 3 framework. The online documentation talks of drag and drop. Any suggestion on how to insert it into the view...

Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query

I have a table with a column that stores the date and time. I need to write a query to get only the date from that column, SELECT CAST(CONVERT(VARCHAR, LoginTime, 101) AS datetime) FROM AuditTrail ..

import dat file into R

Apologies in advance for the simplicity of this question. I am trying to import a .dat file from a website into R with the following code: www = "http://www.nilu.no/projects/ccc/onlinedata/ozone/CZ03..

How to check if a list is empty in Python?

The API I'm working with can return empty [] lists. The following conditional statements aren't working as expected: if myList is not None: #not working pass if myList is not []: #not working ..

Does C have a "foreach" loop construct?

Almost all languages have a foreach loop or something similar. Does C have one? Can you post some example code?..

How do I obtain crash-data from my Android application?

How can I get crash data (stack traces at least) from my Android application? At least when working on my own device being retrieved by cable, but ideally from any instance of my application running o..

Change div width live with jQuery

Is it possible to change a div's width live with jQuery? And if it is, how? What I want is to change its width depending on the browser's window width in real time, so if/when the user changes the br..

Query to get only numbers from a string

I have data like this: string 1: 003Preliminary Examination Plan string 2: Coordination005 string 3: Balance1000sheet The output I expect is string 1: 003 string 2: 005 string 3: 1000 And ..

Python Pandas replicate rows in dataframe

If the data look like: Store,Dept,Date,Weekly_Sales,IsHoliday 1,1,2010-02-05,24924.5,FALSE 1,1,2010-02-12,46039.49,TRUE 1,1,2010-02-19,41595.55,FALSE 1,1,2010-02-26,19403.54,FALSE 1,1,2010-03-05,2182..

How to remove css property in jQuery

if(prev_clicked) { $("#accordion li a.category").css('background-image', 'url("img/off_all_channel.png")'); $("#accordion li a.comment").css('background-image', 'url("im..

How do I set the time zone of MySQL?

On one server, when I run: mysql> select now(); +---------------------+ | now() | +---------------------+ | 2009-05-30 16:54:29 | +---------------------+ 1 row in set (0.00 sec) On..

Android Studio: Application Installation Failed

I've been trying to learn how to use Android Studio but when I attempted to run one of the sample programs I get this error message: Installation failed with message null. It is possible tha..

PHP: Possible to automatically get all POSTed data?

Simple question: Is it possible to get all the data POSTed to a page, even if you don't know all the fields? For example, I want to write a simple script that collects any POSTed data and emails it. ..

Capturing browser logs with Selenium WebDriver using Java

Is there a way to capture browser logs while running automated test cases with Selenium? I found an article on how to capture JavaScript errors in Selenium. But that is just for Firefox and only for e..

What's the difference between OpenID and OAuth?

I'm really trying to understand the difference between OpenID and OAuth? Maybe they're two totally separate things?..

Isn't the size of character in Java 2 bytes?

I used RandomAccessFile to read a byte from a text file. public static void readFile(RandomAccessFile fr) { byte[] cbuff = new byte[1]; fr.read(cbuff,0,1); System.out.println(new String(c..

Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

I'm writing a simple site that takes as input an idiom, and return its meaning(s) and example(s) from Oxford Dictionary. Here's my idea: I send a request to the following URL: http://www.oxfordlearner..

Is there a good JavaScript minifier?

What JavaScript minifier do you recommend?..

Javascript: The prettiest way to compare one value against multiple values

Whats the prettiest way to compare one value against multiples options? I know there are loads of ways of doing this, but I'm looking for the neatest. i ask because i'd hoped this was workable (it i..

How can I call PHP functions by JavaScript?

I am trying to call a PHP function from an external PHP file into a JavaScript script. My code is different and large, so I am writing a sample code here. This is my PHP code: <?php function add..

Select multiple columns by labels in pandas

I've been looking around for ways to select columns through the python documentation and the forums but every example on indexing columns are too simplistic. Suppose I have a 10 x 10 dataframe df =..

ASP.Net MVC – Resource Cannot be found error

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

how to "execute" make file

I tried to use a make file in code::blocks but I am doing it wrong. I have the version installed with the compilers included. http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Windows/co..

How to read a single char from the console in Java (as the user types it)?

Is there an easy way to read a single char from the console as the user is typing it in Java? Is it possible? I've tried with these methods but they all wait for the user to press enter key: char tmp..

Making HTTP Requests using Chrome Developer tools

Is there a way to make an HTTP request using the Chrome Developer tools without using a plugin like POSTER?..

iPhone/iPad browser simulator?

I need to see how my webpages are looking on an iPhone and iPad on my windows desktop. Is this possible? A quick search yielded some iPhone testing sites, which seemed like what I wanted. However, th..

Best Practices for mapping one object to another

My question is, what is the best way I can map one object to another in the most maintainable manner. I cannot change the way the Dto object that we are getting is setup to be more normalized so I nee..

How to make the division of 2 ints produce a float instead of another int?

In another Bruce Eckels exercise in calculating velocity, v = s / t where s and t are integers. How do I make it so the division cranks out a float? class CalcV { float v; float calcV(int s, int..

How do I convert an object to an array?

<?php print_r($response->response->docs); ?> Outputs the following: Array ( [0] => Object ( [_fields:private] => Array ..

How do I install imagemagick with homebrew?

I'm trying to install Imagemagick on OSX Lion but something is not working as expected. -> brew install imagemagick /usr/local/git/bin/git ==> Cloning https://github.com/adamv/ImageMagick.git ..

How do I repair an InnoDB table?

We (apparently) had poorly executed of our Solaris MySQL database engine last night. At least some of the InnoDB tables are corrupted, with timestamp out of order errors in the transaction log, and a ..

Can I use a case/switch statement with two variables?

I am a newbie when it comes to JavaScript and it was my understanding that using one SWITCH/CASE statements is faster than a whole bunch of IF statements. However, I want to use a SWITCH/CASE state..

What does bundle exec rake mean?

What does bundle exec rake db:migrate mean? Or just bundle exec rake <command> in general? I understand that bundle takes care of maintaining things in the Gemfile. I know what the word "exec"..

What are good message queue options for nodejs?

Looking to use a message queue in a small web app I'm building with node.js. I looked at resque but not sure that's appropriate. The goal is to push notifications to clients based on backend and other..

Access denied; you need (at least one of) the SUPER privilege(s) for this operation

So I try to import sql file into rds (1G MEM, 1 CPU). The sql file is like 1.4G mysql -h xxxx.rds.amazonaws.com -u user -ppass --max-allowed-packet=33554432 db < db.sql It got stuck at: ERROR 12..

What does the question mark and the colon (?: ternary operator) mean in objective-c?

What does this line of code mean? label.frame = (inPseudoEditMode) ? kLabelIndentedRect : kLabelRect; The ? and : confuse me...

java collections - keyset() vs entrySet() in map

I put a string array elements is a map where elements of string array is key and frequency of word is value, e.g.: String[] args = {"if","it","is","to","be","it","is","up","me","to","delegate"}; ..

must declare a named package eclipse because this compilation unit is associated to the named module

I just downloaded eclipse for Java Yesterday but when I was trying to get make my first program, I kept on getting this error: must declare a named package eclipse because this compilation unit is a..

Select parent element of known element in Selenium

I have a certain element that I can select with Selenium 1. Unfortunately I need to click the parent element to get the desired behaviour. The element I can easily locate has attribute unselectable, ..

How to round a numpy array?

I have a numpy array, something like below: data = np.array([ 1.60130719e-01, 9.93827160e-01, 3.63108206e-04]) and I want to round each element to two decimal places. How can I do so? ..

Map a 2D array onto a 1D array

I want to represent a 2D array with a 1D array. A function will pass the two indicies (x,y) and the value to store. These two indicies would represent a single element of a 1D array, and set it accord..

HTML table with horizontal scrolling (first column fixed)

I have been trying to think of a way to make a table with a fixed first column (and the rest of the table with a horizontal overflow) I saw a post which had a similar question. but the fixed column b..

How do I translate an ISO 8601 datetime string into a Python datetime object?

I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe). One hackish option seems to be to parse the string using time.strptime and passing the first six ele..

How to compile or convert sass / scss to css with node-sass (no Ruby)?

I was struggling with setting up libsass as it wasn't as straight-forward as the Ruby based transpiler. Could someone explain how to: install libsass? use it from command line? use it with task runn..

how to use concatenate a fixed string and a variable in Python

I want to include file name 'main.txt' in the subject for that I am passing file name from command line. but getting error in doing so python sample.py main.txt #running python with argument msg['..

Duplicate keys in .NET dictionaries?

Are there any dictionary classes in the .NET base class library which allow duplicate keys to be used? The only solution I've found is to create, for example, a class like: Dictionary<string, Lis..

Running Command Line in Java

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

R object identification

I am often ending up with a function producing output for which I don't understand the output data type. I'm expecting a list and it ends up being a list of lists or a data frame or something else. Wh..

What GRANT USAGE ON SCHEMA exactly do?

I'm trying to create for the first time a Postgres database, so this is probably a stupid question. I assigned basic read-only permissions to the db role that must access the database from my php scri..

Create space at the beginning of a UITextField

I want to leave a bit of space at the beginning of a UITextField, just like here: Add lefthand margin to UITextField But I don't know how to do that with Swift...

Python ValueError: too many values to unpack

I am getting that exception from this code: class Transaction: def __init__ (self): self.materials = {} def add_material (self, m): self.materials[m.type + m.purity] = m ..

MySQL ORDER BY multiple column ASC and DESC

I have 2 MYSQL tables, users and scores. Detail: users table: scores table: My intention is get 20 users list that have point field sort DESC (descending) combine avg_time field sort ASC (a..

Get file name from URI string in C#

I have this method for grabbing the file name from a string URI. What can I do to make it more robust? private string GetFileName(string hrefLink) { string[] parts = hrefLink.Split('/'); stri..

pandas loc vs. iloc vs. at vs. iat?

Recently began branching out from my safe place (R) into Python and and am a bit confused by the cell localization/selection in Pandas. I've read the documentation but I'm struggling to understand the..

File upload from <input type="file">

Using angular 2 beta, I cannot seem to get an <input type="file"> to work. Using diagnostic, I can see two-way binding for other types such as text. <form> {{diagnostic}} <div..

What are the differences between git branch, fork, fetch, merge, rebase and clone?

I want to understand the difference between a branch, a fork and a clone in Git? Similarly, what does it mean when I do a git fetch as opposed to a git pull? Also, what does rebase mean in comparis..

What is the difference between varchar and varchar2 in Oracle?

What is the difference between varchar and varchar2?..

How to use a WSDL

I need to consume a Web Service. They sent me the WSDL file. What should I do to add it to my website and start using it as the proxy. ( If I put it on a Virtual Directory it can be discovered, but d..

TypeError: string indices must be integers, not str // working with dict

I am trying to define a procedure, involved(courses, person), that takes as input a courses structure and a person and returns a Dictionary that describes all the courses the person is involved in. H..

best way to preserve numpy arrays on disk

I am looking for a fast way to preserve large numpy arrays. I want to save them to the disk in a binary format, then read them back into memory relatively fastly. cPickle is not fast enough, unfortuna..

Chrome / Safari not filling 100% height of flex parent

I want to have a vertical menu with a specific height. Each child must fill the height of the parent and have middle-aligned text. The number of children is random, so I have to work with dynamic va..

numpy max vs amax vs maximum

numpy has three different functions which seem like they can be used for the same things --- except that numpy.maximum can only be used element-wise, while numpy.max and numpy.amax can be used on part..

Linux command line howto accept pairing for bluetooth device without pin

Is there a way to pair a device in linux without requiring a pin(for testing purposes so I need it to be done w/out human interaction, assuming you have root access)? bluez-simple-agent seems to requ..

What are Transient and Volatile Modifiers?

Can someone explain what the transient and volatile modifiers mean in Java?..

how to pass data in an hidden field from one jsp page to another?

I have some data in an hidden field on a jsp page <input type=hidden id="thisField" name="inputName"> how to access or pass this field onsubmit to another page?..

Set attribute without value

How do I set a data attribute without adding a value in jQuery? I want this: <body data-body> I tried: $('body').attr('data-body'); // this is a getter, not working $('body').attr('data-body..

SQL Server - An expression of non-boolean type specified in a context where a condition is expected, near 'RETURN'

Getting this error with the following query in SQL Server 2012. An expression of non-boolean type specified in a context where a condition is expected, near 'RETURN'. CREATE FUNCTION [dbo].[GetPMRes..

How to say no to all "do you want to overwrite" prompts in a batch file copy?

By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location. You can add "/Y" to say "Yes to all" replacements. But how can you say "No t..

How to plot two histograms together in R?

I am using R and I have two data frames: carrots and cucumbers. Each data frame has a single numeric column which lists the length of all measured carrots (total: 100k carrots) and cucumbers (total: 5..

Temporarily switch working copy to a specific Git commit

How to switch to specific Git commit without losing all the commits made after it? I want that local files will be changed, but commits' database will remain intact, only the current position pointer..

Efficiently test if a port is open on Linux?

From a bash script how can I quickly find out whether a port 445 is open/listening on a server. I have tried a couple of options, but I want something quick: 1. lsof -i :445 (Takes seconds) 2. netst..

Python dictionary get multiple values

Sry if this question already exists, but I've been searching for quite some time now. I have a dictionary in python, and what I want to do is get some values from it as a list, but I don't know if th..

Simple C example of doing an HTTP POST and consuming the response

I would like to create a very simple C application that does an HTTP post. It will take a few parameters, and use these to construct a URL. I'd just like to do a simple HTTP POST and get the respons..

Where do I get servlet-api.jar from?

In order to write servlets code I need servlet-api.jar. Where do i get servlet-api.jar from ?..

Call an activity method from a fragment

Trying to call a method in my activity from a fragment. I want the fragment to give the method data and to get the data when the method return. I want to achieve similar to call on a static method, bu..

Exists Angularjs code/naming conventions?

Does anyone know if exists any official or most accepted reference for Angular naming conventions to use when we build our applications? Angular has many different types of components such as filters,..

Fixing Segmentation faults in C++

I am writing a cross-platform C++ program for Windows and Unix. On the Window side, the code will compile and execute no problem. On the Unix side, it will compile however when I try to run it, I get ..

What's the environment variable for the path to the desktop?

I'm writing a Windows batch file and want to copy something to the desktop. I think I can use this: %UserProfile%\Desktop\ However, I'm thinking, that's probably only going to work on an Engli..

AttributeError: 'dict' object has no attribute 'predictors'

I am new to python and couldn't find the answer to this. Referring to the code at the end of the message, can I know what does the part "for item, total in totals.items()" in the line below mean? ran..

initialize a numpy array

Is there way to initialize a numpy array of a shape and add to it? I will explain what I need with a list example. If I want to create a list of objects generated in a loop, I can do: a = [] for i in..

Chaining multiple filter() in Django, is this a bug?

I always assumed that chaining multiple filter() calls in Django was always the same as collecting them in a single call. # Equivalent Model.objects.filter(foo=1).filter(bar=2) Model.objects.filter(f..

Check if value is in select list with JQuery

How can I, using JQuery, check if a value belongs to dropdown list or not?..

How to write a shell script that runs some commands as superuser and some commands not as superuser, without having to babysit it?

I want to write a shell script to automate a series of commands. The problem is some commands MUST be run as superuser and some commands MUST NOT be run as superuser. What I have done so far is someth..

Check whether IIS is installed or not?

I am trying to create a Local IIS Website using ASP.NET. When I click on New -----> Website and select the type as HTTP and from the dialog box if I select the option as LOCAL IIS WEBSITE I am get..

Is there any way I can define a variable in LaTeX?

In LaTeX, how can I define a string variable whose content is used instead of the variable in the compiled PDF? Let's say I'm writing a tech doc on a software and I want to define the package name in..

JavaScript naming conventions

I know there is a lot of controversy (maybe not controversy, but arguments at least) about which naming convention is the best for JavaScript. How do you name your variables, functions, objects and s..

Android/Java - Date Difference in days

I am getting the current date (in format 12/31/1999 i.e. mm/dd/yyyy) as using the below code: Textview txtViewData; txtViewDate.setText("Today is " + android.text.format.DateFormat.getDateFor..

MVC web api: No 'Access-Control-Allow-Origin' header is present on the requested resource

I tried everything that is written in this article: http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api, but nothing works. I'm trying to get data from webAPI2 (MVC5..

AndroidStudio: Failed to sync Install build tools

Going crazy with this error from about a couple of hours. The error is: failed to find Build Tools revision 23.0.0 rc1 But I think to have all update (also the release candidate!) This is the ima..

MySQL root password change

I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is there. Once restarting th..

How to change color of the back arrow in the new material theme?

I've updated my SDK to API 21 and now the back/up icon is a black arrow pointing to the left. I would like it to be grey. How can I do that? In the Play Store, for example, the arrow is white. I'..

How to send email using simple SMTP commands via Gmail?

For educational purposes, I need to send an email through an SMTP server, using SMTP's fundamental and simple rules. I was able to do that using smtp4dev. I telnet localhost 25 and and commands are:..

Are vectors passed to functions by value or by reference in C++

I'm coding in C++. If I have some function void foo(vector<int> test) and I call it in my program, will the vector be passed by value or reference? I'm unsure because I know vectors and arrays a..

Typing the Enter/Return key using Python and Selenium

I'm looking for a quick way to type the Enter or Return key in Selenium. Unfortunately, the form I'm trying to test (not my own code, so I can't modify) doesn't have a Submit button. When working with..

symbol(s) not found for architecture i386

When trying to compile with Xcode, I am getting the following error: **Ld /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimula..

How do I run a program with a different working directory from current, from Linux shell?

Using a Linux shell, how do I start a program with a different working directory from the current working directory? For example, I have a binary file helloworld that creates the file hello-world.txt..

the getSource() and getActionCommand()

What is getSource? and what does it return? and what is getActionCommand() and what does it return?? I am getting confused between these two can anyone give or differentiate them to me? what's the u..

How to add Python to Windows registry

I've downloaded Enthought Canopy EPD Free (now Canopy Express) from https://www.enthought.com/products/epd/free/ and want to install SciKit Learn (http://sourceforge.net/projects/scikit-learn/files/) ..

onChange and onSelect in DropDownList

I have a DropDownList that asks the user if he want to join the club: Do you want to join the club Yes No Under this list there is another list that is set to disabled as a default. This list has t..

Recommended method for escaping HTML in Java

Is there a recommended way to escape <, >, " and & characters when outputting HTML in plain Java code? (Other than manually doing the following, that is). String source = "The less than si..

How to take input in an array + PYTHON?

I am new to Python and want to read keyboard input into an array. The python doc does not describe arrays well. Also I think I have some hiccups with the for loop in Python. I am giving the C code sn..

How to COUNT rows within EntityFramework without loading contents?

I'm trying to determine how to count the matching rows on a table using the EntityFramework. The problem is that each row might have many megabytes of data (in a Binary field). Of course the SQL wou..

Performance of Arrays vs. Lists

Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it's in the heart of the inner most loop of a high volume pro..

JavaScript - Get minutes between two dates

If I have two dates, how can I use JavaScript to get the difference between the two dates in minutes?..

Combine two arrays

I have two arrays like this: array( '11' => '11', '22' => '22', '33' => '33', '44' => '44' ); array( '44' => '44', '55' => '55', '66' => '66', '77' => '77' ); I want to c..

Typescript: difference between String and string

Does anyone know the difference between String and string in TypeScript? Am I correct in assuming that they ought to be the same? var a: String = "test"; var b: string = "another test"; a = b; b = a;..

How to properly compare two Integers in Java?

I know that if you compare a boxed primitive Integer with a constant such as: Integer a = 4; if (a < 5) a will automatically be unboxed and the comparison will work. However, what happens when ..

autocomplete ='off' is not working when the input type is password and make the input field above it to enable autocomplete

I have an form with autocomplete disabled but it does not works and makes the autocomplete to be enabled in firefox and higher version of chrome <form method="post" autocomplete="off" action="">..

Reading a text file using OpenFileDialog in windows forms

I am new to the OpenFileDialog function, but have the basics figured out. What I need to do is open a text file, read the data from the file (text only) and correctly place the data into separate text..

Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prep for iOS 14. Codebase was previously Obj-C, but now contains both Obj-C and Swift, and uses pods that are..

IF... OR IF... in a windows batch file

Is there a way to write an IF OR IF conditional statement in a windows batch-file? For example: IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE ..

How can I send an email through the UNIX mailx command?

How can I send an email through the UNIX mailx command?..

Accessing all items in the JToken

I have a json block like this: { "ADDRESS_MAP":{ "ADDRESS_LOCATION":{ "type":"separator", "name":"Address", "value":"", "FieldID":40 ..

List submodules in a Git repository

I have a Git repository that has several submodules in it. How do I list the names of all the submodules after git submodule init has been run? The git submodule foreach command could echo the names ..

How to exclude a directory from ant fileset, based on directories contents

How can I create an ant fileset which excludes certain directories based on the contents of the directory? I use ant to create a distribution jar which has each localization in separate directories, ..

How to get DataGridView cell value in messagebox?

How can I get DataGridView cell value to be written in the MessageBox in C#?..

Convert date yyyyMMdd to system.datetime format

Possible Duplicate: how to convert date from yyyyMMdd format to mm-dd-yyyy fomrat I have a string which contains date in yyyyMMdd format. I want to convert that date into system date format..

How do you log all events fired by an element in jQuery?

I'd like to see all the events fired by an input field as a user interacts with it. This includes stuff like: Clicking on it. Clicking off it. Tabbing into it. Tabbing away from it. Ctr..

What is the purpose of meshgrid in Python / NumPy?

Can someone explain to me what is the purpose of meshgrid function in Numpy? I know it creates some kind of grid of coordinates for plotting, but I can't really see the direct benefit of it. I am stu..

Having links relative to root?

Is there a way to have all links on a page be relative to the root directory? For example, on www.example.com/fruits/apples/apple.html I could have a link saying: <a href="fruits/index.html">B..

How do you create a dropdownlist from an enum in ASP.NET MVC?

I'm trying to use the Html.DropDownList extension method but can't figure out how to use it with an enumeration. Let's say I have an enumeration like this: public enum ItemTypes { Movie = 1, ..

Delete rows from multiple tables using a single query (SQL Express 2005) with a WHERE condition

This is the query I'm using: DELETE TB1.*, TB2.* FROM TB1 INNER JOIN TB2 ON TB1.PersonID = TB2.PersonID WHERE (TB1.PersonID)='2' It's working fine in MS Access but getting error (Inc..

prevent refresh of page when button inside form clicked

I have an issue while using buttons inside form. I want that button to call function. It does, but with unwanted result that it refresh the page. My simple code goes like this <form method="POST"..

Find all tables containing column with specified name - MS SQL Server

Is it possible to query for table names which contain columns being LIKE '%myName%' ?..

Error "The goal you specified requires a project to execute but there is no POM in this directory" after executing maven command

I have a pom.xml in C:\Users\AArmijos\Desktop\Factura Electronica\MIyT\componentes-1.0.4\sources\pom.xml and I executed: mvn install:install-file -DgroupId=es.mityc.jumbo.adsi -DartifactId=xmlsec-1.4..

How to execute only one test spec with angular-cli

I have Angular2 project build with Angular-CLI (beta 20). Is there a way to run tests against only one selected spec file? I used to have a project based on Angular2 quick start, and I could manual..

Regex to validate password strength

My password strength criteria is as below : 8 characters length 2 letters in Upper Case 1 Special Character (!@#$&*) 2 numerals (0-9) 3 letters in Lower Case Can somebody please give me regex..

How do I make a relative reference to another workbook in Excel?

I am producing a sheet to calculate prices. The sheet has to have a reference to several other workbooks to get the prices for different components. This works fine on my computer but when I move them..

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Collections.Generic.IList'

I have a method: public DzieckoAndOpiekunCollection GetChildAndOpiekunByFirstnameLastname(string firstname, string lastname) { DataTransfer.ChargeInSchoolEntities db = new DataTransfer.ChargeInSc..

Example of waitpid() in use?

I know that waitpid() is used to wait for a process to finish, but how would one use it exactly? Here what I want to do is, create two children and wait for the first child to finish, then kill the s..

Using a dictionary to count the items in a list

I'm new to Python and I have a simple question, say I have a list of items: ['apple','red','apple','red','red','pear'] Whats the simpliest way to add the list items to a dictionary and count how ma..

How to change style of a default EditText

I am creating three EditTexts in my xml file using code like this: <EditText android:id="@+id/name_edit_text" android:layout_width="wrap_content" android:layout_height="wrap_content" ..

Stylesheet not updating

I am creating a website, but when I made changes to the stylesheet on my site, and I refreshed the site, none of the changes were there. I tried to use the view source tool to check the stylesheet.cs..

How to get bean using application context in spring boot

I am developing a SpringBoot project and I want to get the bean by its name using applicationContext. I have tried many solution from web but could not succeed. My Requirement is that I have a control..

jQuery $.ajax(), pass success data into separate function

I am using the jQuery $.ajax() function. I have put this into a parent function, which passes some values into the ajax function. What I would like to do, is have a user defined callback function, w..

jackson deserialization json to java-objects

Here is my Java code which is used for the de-serialization, i am trying to convert json string into java object. In doing so i have used the following code: package ex1jackson; import com.fasterxml..

jquery if div id has children

This if-condition is what's giving me trouble: if (div id=myfav has children) { do something } else { do something else } I tried all the following: if ( $('#myfav:hasChildren') ) { do some..

Iterating through populated rows

So I am trying to iterate through a worksheet in an Excel spreadsheet using VBA. I want to iterate through each row, and then through each column, and despite googling, I can't actually find an intuit..

pandas groupby sort within groups

I want to group my dataframe by two columns and then sort the aggregated results within the groups. In [167]: df Out[167]: count job source 0 2 sales A 1 4 sales B 2 6 sales C 3 ..

Command not found after npm install in zsh

I'm having some problems installing vows via npm in zsh. Here's what I get. I tried installing it with and without the -g option. Do you have any idea what's wrong here? [? ~/Desktop/sauce-node-demo..

Compress images on client side before uploading

Does anyone know of any free script that compresses JPG, GIF and PNG files as much as possible?..

How do I rename a column in a SQLite database table?

I would need to rename a few columns in some tables in a SQLite database. I know that a similar question has been asked on stackoverflow previously, but it was for SQL in general, and the case of SQLi..

Run java jar file on a server as background process

I need to run a java jar in server in order to communicate between two applications. I have written two shell scripts to run it, but once I start up that script I can't shut down / terminate the proce..

Difference between HttpModule and HttpClientModule

Which one to use to build a mock web service to test the Angular 4 app?..

no module named zlib

First, please bear with me. I have hard time telling others my problem and this is a long thread... I am using pythonbrew to run multiple versions of python in Ubuntu 10.10. For installing pythonbre..

Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0

I have an Insert stored procedure which will feed data to Table1 and get the Column1 value from Table1 and call the second stored procedure which will feed the Table2. But when I call The second stor..

What is a "web service" in plain English?

I've been reading about "web services" here on SO, on Wikipedia, Google, etc., and I don't quite understand what they are. What is the plain English definition/description? If I make a simple websit..

Plot a bar using matplotlib using a dictionary

Is there any way to plot a bar plot using matplotlib using data directly from a dict? My dict looks like this: D = {u'Label1':26, u'Label2': 17, u'Label3':30} I was expecting fig = plt.figure(..

Loop through files in a directory using PowerShell

How can I change the following code to look at all the .log files in the directory and not just the one file? I need to loop through all the files and delete all lines that do not contain "step4" or ..

How to get the full path of the file from a file input

Possible Duplicate: Full path from file input using jQuery I have the following html element <input type="file" id="upload"> If I use $("#upload").val(); I only the file name,..

Parse XML document in C#

Duplicate: This is a duplicate of Best practices to parse xml files with C#? and many others (see https://stackoverflow.com/search?q=c%23+parse+xml). Please close it and do not answer. How do you p..

Using querySelectorAll to retrieve direct children

I am able to do this: <div id="myDiv"> <div class="foo"></div> </div> myDiv = getElementById("myDiv"); myDiv.querySelectorAll("#myDiv > .foo"); That is, I can succes..

How to remove a package in sublime text 2

I would like to remove and/or deactivate the Emmet package in Sublime Text 2. Should I just remove the Emmet directory or what is the typical workflow for removal of a package?..

How to Convert string "07:35" (HH:MM) to TimeSpan

I would like to know if there is a way to convert a 24 Hour time formatted string to a TimeSpan. Right now I have a "old fashion style": string stringTime = "07:35"; string[] values = stringTime.Spl..

IndexError: list index out of range and python

I'm telling my program to print out line 53 of an output. Is this error telling me that there aren't that many lines and therefore can not print it out?..

ruby LoadError: cannot load such file

When I require a file, for example (called st.rb): require 'rubygems' require 'mongrel' class TestHandler < Mongrel::HttpHandler def process(request, response) response.start(200) do |head..

.crx file install in chrome

I have just created a very simple chrome extension and it works fine. But when I converted to .crx file and try to open it with chrome, nothing happens. my chrome browser version is 19.0.1081.2 dev-m...

How to access site running apache server over lan without internet connection

I am running a server on Windows XP SP2 computer using EasyPhp. Lets call it computer_1. The ip address of computer is 192.168.1.2 Now I have another computer ( computer_2) on the lan with ip address..

In Perl, how to remove ^M from a file?

I have a script that is appending new fields to an existing CSV, however ^M characters are appearing at the end of the old lines so the new fields end up on a new row instead of the same one. How do I..

How do I get the total Json record count using JQuery?

I couldn't find anything about getting the total JSON record count using jQuery. Here is the JSON returned: {"Email":"Please enter your Email.","Password":"Please enter a password."} Here is my cod..

Why do we use arrays instead of other data structures?

As I was programming, I haven't seen an instance where an array is better for storing information than another form thereof. I had indeed figured the added "features" in programming languages had imp..

org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

I am trying run a spring-boot application which uses hibernate via spring-jpa, but i am getting this error: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null..

How to detect Safari, Chrome, IE, Firefox and Opera browser?

I have 5 addons/extensions for FF, Chrome, IE, Opera, and Safari. How can I recognize the user browser and redirect (once an install button has been clicked) to download the corresponding addon?..

How do malloc() and free() work?

I want to know how malloc and free work. int main() { unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char)); memset(p,0,4); strcpy((char*)p,"abcdabcd"); // **deliberately sto..

Convert spark DataFrame column to python list

I work on a dataframe with two column, mvv and count. +---+-----+ |mvv|count| +---+-----+ | 1 | 5 | | 2 | 9 | | 3 | 3 | | 4 | 1 | i would like to obtain two list containing mvv values and c..

What's a good IDE for Python on Mac OS X?

I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a ..

Technically what is the main difference between Oracle JDK and OpenJDK?

I have been using OpenJDK for ages, initially for small projects where it has no problems. But since I started to play with it for big toys, I started to notice random/unknown fatal error and crashes ..

Setting Authorization Header of HttpClient

I have an HttpClient that I am using for a REST API. However I am having trouble setting up the Authorization header. I need to set the header to the token I received from doing my OAuth request. I sa..

CSS Selector for <input type="?"

Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I'm setting the background color for text boxes, but I don't wa..

Way to ng-repeat defined number of times instead of repeating over array?

Is there a way to ng-repeat a defined number of times instead of always having to iterate over an array? For example, below I want the list item to show up 5 times assuming $scope.number equal to 5 i..

angularjs getting previous route path

<h1>{{header}}</h1> <!-- This Back button has multiple option --> <!-- In home page it will show menu --> <!-- In other views it will show back link --> <a ng-href="{{..

Having services in React application

I'm coming from the angular world where I could extract logic to a service/factory and consume them in my controllers. I'm trying to understand how can I achieve the same in a React application. Let..

Main differences between SOAP and RESTful web services in Java

For now I have a slight idea about the differences between SOAP and RESTful services. My question is when I should use SOAP, and when I should use RESTful; which one is "better" when it comes to perf..

What is the best way to get the minimum or maximum value from an Array of numbers?

Let's say I have an Array of numbers: [2,3,3,4,2,2,5,6,7,2] What is the best way to find the minimum or maximum value in that Array? Right now, to get the maximum, I am looping through the Array, an..

How can I retrieve the remote git address of a repo?

How can I retrieve the remote git address of a repo? I tried git remote but that just lists the branches. ..

Ignoring a class property in Entity Framework 4.1 Code First

My understanding is that the [NotMapped] attribute is not available until EF 5 which is currently in CTP so we cannot use it in production. How can I mark properties in EF 4.1 to be ignored? UPDATE:..

Swift - how to make custom header for UITableView?

I need to add custom header to my table I try this func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = UIView(frame: CGRect(x: 0, y: 0, width:..

How to change background and text colors in Sublime Text 3

My questions are: How do I change the overall colors (background and font)? How do I change the colors based on the file type that is open? Do I need to learn how to create a whole theme? I read ..

bower proxy configuration

is there a way to configure bower not only to use a proxy but ignore the proxy configuration for some domains? I have the problem, that I will run an internal bower registry for our own developed com..

How to split a String by space

I need to split my String by spaces. For this I tried: str = "Hello I'm your String"; String[] splited = str.split(" "); But it doesn't seem to work...

How do I log errors and warnings into a file?

How do I turn on all error and warnings and log them to a file, but to set up all of that within the script (not changing anything in php.ini)? I want to define a file name and so that all errors and..

How can I connect to MySQL on a WAMP server?

This might be ridiculously easy for you but I've been struggling with this for an hour... :( <?php $connect = mysql_connect("localhost:8080", "root", "mypassword"); echo($connect);?> This is ..

Dynamically load JS inside JS

I have a dynamic web page where I need to import an external JS file (under an IF condition) inside another javascript file. I tried to search for a feasible solution but it didn't work. I have tri..

Python pandas insert list into a cell

I have a list 'abc' and a dataframe 'df': abc = ['foo', 'bar'] df = A B 0 12 NaN 1 23 NaN I want to insert the list into cell 1B, so I want this result: A B 0 12 NaN 1 23 ['foo',..

How can I create a Java method that accepts a variable number of arguments?

For example, Java's own String.format() supports a variable number of arguments. String.format("Hello %s! ABC %d!", "World", 123); //=> Hello World! ABC 123! How can I make my own function that ..

Program to find largest and smallest among 5 numbers without using array

Yesterday I went for an interview where I have been asked to create a program to find largest and smallest among 5 numbers without using array. I know how to create the program using array. int lar..

How do I use an image as a submit button?

Can someone help to change this to incorporate an image called BUTTON1.JPG instead of the standard submit button? <form id='formName' name='formName' onsubmit='redirect();return false;'> &l..

How to populate options of h:selectOneMenu from database?

I am creating a web application, where you have to read a list of objects / entities from a DB and populate it in a JSF <h:selectOneMenu>. I am unable to code this. Can someone show me how to do..

How to get the caller class in Java

I want to get the caller class of the method, i.e. class foo{ bar(); } In the method bar, I need to get the class name foo, and I found this method: Class clazz = sun.reflect.Reflection.getCa..

Loading scripts after page load?

I work with an advertising company, where we tag certain pages to track activity. A client of mine wants to fire off a javascript tag to track activity AFTER the page has finished loading entirely (to..

Chrome sendrequest error: TypeError: Converting circular structure to JSON

I've got the following... chrome.extension.sendRequest({ req: "getDocument", docu: pagedoc, name: 'name' }, function(response){ var efjs = response.reply; }); which calls the following.. c..

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine

I am facing this problem since more than a month, here is what I see when I run java on command line: $ java -Xmx1300m Error occurred during initialization of VM Could not reserve enough space for o..

How to silence output in a Bash script?

I have a program that outputs to stdout and would like to silence that output in a Bash script while piping to a file. For example, running the program will output: % myprogram % WELCOME TO MY PROGR..

Function Pointers in Java

This may be something common and trivial, but I seem to be having trouble finding a concrete answer. In C# there is a concept of delegates, which relates strongly to the idea of function pointers from..

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

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