Questions Tagged with #Ironruby

IronRuby is an open-source implementation of the Ruby programming language which is tightly integrated with the .NET Framework.

Mocking methods of local scope objects with Mockito

I need some help with this: Example: void method1{ MyObject obj1=new MyObject(); obj1.method1(); } I want to mock obj1.method1() in my test but to be transparent so I don't want make and c..

Android EditText Hint

I have set a hint for an EditText, currently the hint visibility is gone. When a user starts typing, I want to remove the hint text, when the cursor is visible in the EditText, not at the time when a ..

Fill DataTable from SQL Server database

This one is a mystery for me, I know the code I took it from others, in my case the datatable it returns is empty conSTR is the connection string, set as a global string public DataTable fillDataTab..

Datetime current year and month in Python

I must have the current year and month in datetime. I use this: datem = datetime.today().strftime("%Y-%m") datem = datetime.strptime(datem, "%Y-%m") Is there maybe another way?..

How to reload the current state?

I'm using Angular UI Router and would like to reload the current state and refresh all data / re-run the controllers for the current state and it's parent. I have 3 state levels: directory.organisati..

How to delete SQLite database from Android programmatically

I would like to delete the database file from the Android file system programatically? Can I have a shell script launch adb which in turns runs a shell script in the Android space to do the database ..

Postgresql Select rows where column = array

This is a summary of what I am trying to do: $array[0] = 1; $array[1] = 2; $sql = "SELECT * FROM table WHERE some_id = $array" Obviously, there are some syntax issues, but this is what I want to d..

How to set a tkinter window to a constant size

I'm programming a little game with tkinter and briefly, I'm stuck. I have a kind od starting menu, in which are two buttons and one label. If I just create the frame everything is fine, it has the s..

VBScript: Using WScript.Shell to Execute a Command Line Program That Accesses Active Directory

I'm attempting to execute a .NET (3.5) command line program from within a VBScript file which does two main things: Connects to an Active Directory that is on the same domain as the server the scrip..

How to remove all the occurrences of a char in c++ string

I am using following: replace (str1.begin(), str1.end(), 'a' , '') But this is giving compilation error...

How to set the value of a hidden field from a controller in mvc

I want to set the value of a hidden field from a controller.How can i do this? In view part i have given like this.. <div> @Html.Hidden("hdnFlag", null, new { @id = "hdnFlag" }) </div>..

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

Can I install/update WordPress plugins without providing FTP access?

I am using WordPress on my live server which only uses SFTP using an SSH key. I want to install and upgrade plugins, but it appears that you are required to enter your FTP login to install the plug..

Android: How to create a Dialog without a title?

I'm trying to generate a custom dialog in Android. I create my Dialog like this: dialog = new Dialog(this); dialog.setContentView(R.layout.my_dialog); Everythings works fine except for the title o..

SQL RANK() over PARTITION on joined tables

I have two tables RSLTS and CONTACTS: RSLTS QRY_ID | RES_ID | SCORE ----------------------------- A | 1 | 15 A | 2 | 32 A | 3 | 29 C | ..

How to add a href link in PHP?

I'm very new to PHP and trying to make a site update on the fly. I need to update the code so that the link will direct to www.otherwebsite.com. Currently the link directs to the current websites RSS..

jquery Ajax call - data parameters are not being passed to MVC Controller action

I'm passing two string parameters from a jQuery ajax call to an MVC controller method, expecting a json response back. I can see that the parameters are populated on the client side but the matching p..

MySQL Fire Trigger for both Insert and Update

Is it possible to fire a mysql trigger for both the insert and update events of a table? I know I can do the following CREATE TRIGGER my_trigger AFTER INSERT ON `table` FOR EACH ROW BEGIN ....

If file exists then delete the file

I have a vbscript that is used to rename files. What I need to implement into the script is something that deletes the "new file" if it already exists. For example: I have a batch of files that are ..

How do I get the path of the current executed file in Python?

This may seem like a newbie question, but it is not. Some common approaches don't work in all cases: sys.argv[0] This means using path = os.path.abspath(os.path.dirname(sys.argv[0])), but this does ..

How to use greater than operator with date?

No idea what is going on here. Here is the query, right from phpMyAdmin: SELECT * FROM `la_schedule` WHERE 'start_date' >'2012-11-18'; But I consistently get all records in the table returned, ..

changing textbox border colour using javascript

I'm doing form validation. when the form input is incorrect i add a red border to the textbox: document.getElementById("fName").style.borderColor="#FF0000" this then gives me a 2px red border. what..

Mysql adding user for remote access

I created user user@'%' with password 'password. But I can not connect with: mysql_connect('localhost:3306', 'user', 'password'); When I created user user@'localhost', I was able to connect. Why? D..

How to rename HTML "browse" button of an input type=file?

How to rename the browse button as "Select the file"? E.g.: <input type=file name=browse > ..

git diff between two different files

In HEAD (the latest commit), I have a file named foo. In my current working tree, I renamed it to bar, and also edited it. I want to git diff foo in HEAD, and bar in my current working tree...

TypeError: $.ajax(...) is not a function?

I'm trying to create a simple AJAX request which returns some data from a MySQL database. Here's my function below: function AJAXrequest(url, postedData, callback) { $.ajax() ({ type: 'PO..

javascript regex - look behind alternative?

Here is a regex that works fine in most regex implementations: (?<!filename)\.js$ This matches .js for a string which ends with .js except for filename.js Javascript doesn't have regex lookbehi..

Iterate over array of objects in Typescript

I need to iterate over the array of objects in angular 2 and limit the string length display for a particular key in the object. this.productService.loadAllProducts(product).subscribe(data => { ..

How to initialize java.util.date to empty

I need your help in initializing a java.util.Date variable to empty. As I am running the page and it is showing NullPointerException if I didn't select any date. The code is: private java.util.Date da..

Return index of greatest value in an array

I have this: var arr = [0, 21, 22, 7]; What's the best way to return the index of the highest value into another variable?..

Chrome - ERR_CACHE_MISS

Does anybody know what the following Chrome error is? Failed to load resource: net::ERR_CACHE_MISS I have had a look online, but have not found a good answer yet. Somebody said it might be related ..

Remove ':hover' CSS behavior from element

I have CSS that changes formatting when you hover over an element. _x000D_ _x000D_ .test:hover { border: 1px solid red; }_x000D_ <div class="test">blah</div>_x000D_ _x000D_ _x000D_ In som..

How to execute an oracle stored procedure?

I am using oracle 10g express edition. It has a nice ui for db developers. But i am facing some problems executing stored procedures. Procedure: create or replace procedure temp_proc is begin DBM..

How should we manage jdk8 stream for null values

Hello fellow Java developers, I know the subject may be a bit in advance as the JDK8 is not yet released (and not for now anyway..) but I was reading some articles about the Lambda expressions and par..

Converting year and month ("yyyy-mm" format) to a date?

I have a dataset that looks like this: Month count 2009-01 12 2009-02 310 2009-03 2379 2009-04 234 2009-05 14 2009-08 1 2009-09 34 2009-10 2386 I want to plot the data (months as x value..

ASP.NET Core Get Json Array using IConfiguration

In appsettings.json { "MyArray": [ "str1", "str2", "str3" ] } In Startup.cs public void ConfigureServices(IServiceCollection services) { services.A..

Bootstrap 3 .img-responsive images are not responsive inside fieldset in FireFox

In Firefox (tested on Win7 and Win8), with the code below - when a responsive image is inside of a <fieldset> it is no longer responsive. This means that as my form resizes for the phone, the i..

isPrime Function for Python Language

So I was able to solve this problem with a little bit of help from the internet and this is what I got: def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False..

Pass a reference to DOM object with ng-click

I have multiple elements with the same callback on ng-click: <button ng-click="doSomething()"></button> <button ng-click="doSomething()"></button> <button ng-click="doSomet..

How to capture a backspace on the onkeydown event

I have a function that is triggered by the onkeydown event of a textbox. How can I tell if the user has hit either the backspace key or the del key?..

how can I copy a conditional formatting in Excel 2010 to other cells, which is based on a other cells content?

I need to copy a formula based conditional formatting to other cells but i have to change the formula for every single cell condition. how can I do a copy of this condition so that the formula changes..

URL encoding the space character: + or %20?

When is a space in a URL encoded to +, and when is it encoded to %20?..

Print text instead of value from C enum

int main() { enum Days{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}; Days TheDay; int j = 0; printf("Please enter the day of the week (0 to 6)\n"); scanf("%d",&j); T..

How to Generate a random number of fixed length using JavaScript?

I'm trying to generate a random number that must have a fixed length of exactly 6 digits. I don't know if JavaScript has given below would ever create a number less than 6 digits? Math.floor((Math.r..

How to show row number in Access query like ROW_NUMBER in SQL

I have a table in Microsoft Access, and I want to show row number in a column using a select query in Access just like using ROW_NUMBER() function in SQL Server. In SQL Server, I can using this query..

Remove git mapping in Visual Studio 2015

This question has nothing to do with git itself; rather, it has to do with removing a binding/mapping to a git repository that Visual Studio 2015 (VS2015) has previously seen. Here's a screen shot of..

Question mark and colon in statement. What does it mean?

What do the question mark (?) and colon (:) mean? ((OperationURL[1] == "GET") ? GetRequestSignature() : "") It appears in the following statement: string requestUri = _apiURL + &q..

Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0

I am trying to include a php file in a page via require_once(http://localhost/web/a.php) I am getting an error Warning: require_once(): http:// wrapper is disabled in the server configuration ..

Use multiple custom fonts using @font-face?

I'm sure I'm missing something really straight forward. Been using a single custom font with normal font face: @font-face { font-family: CustomFont; src: url('CustomFont.ttf'); } All works ..

How to replace all occurrences of a character in string?

What is the effective way to replace all occurrences of a character with another character in std::string?..

Python read JSON file and modify

Hi I am trying to take the data from a json file and insert and id then perform POST REST. my file data.json has: { 'name':'myname' } and I would like to add an id so that the json data looks l..

Copy a variable's value into another

I have a variable which has a JSON object as its value. I directly assign this variable to some other variable so that they share the same value. This is how it works: var a = $('#some_hidden_var').v..

How do I generate a random number between two variables that I have stored?

Possible Duplicate: Generating random integer from a range I am trying to create a program where the computer guesses a number the user has in his/her mind. The only user input required is ..

Clicking at coordinates without identifying element

As part of my Selenium test for a login function, I would like to click a button by identifying its coordinates and instructing Selenium to click at those coordinates. This would be done without ident..

How should I resolve java.lang.IllegalArgumentException: protocol = https host = null Exception?

I am working on a SSL client server program and I have to reuse the following method. private boolean postMessage(String message){ try{ String serverURLS = getRecipientURL(message); ..

How to count string occurrence in string?

How can I count the number of times a particular string occurs in another string. For example, this is what I am trying to do in Javascript: var temp = "This is a string."; alert(temp.count("is")); /..

Chart.js v2 hide dataset labels

I have the following codes to create a graph using Chart.js v2.1.3: var ctx = $('#gold_chart'); var goldChart = new Chart(ctx, { type: 'line', data: { labels: dates, datasets:..

How to write a cursor inside a stored procedure in SQL Server 2008

I have two tables in my database Coupon Table id (int) Name (nvarchar(max)) NoofUses (int) CouponUse Table id(int) Couponid(int) CreateDate(datetime) Whenever a user clicks on a coupon an e..

Correct way of looping through C++ arrays

Recently I have found a lot of examples, most of them regards the C++ 98, anyways I have created my simple-array and a loop (codepad): #include <iostream> using namespace std; int main () { ..

Set Text property of asp:label in Javascript PROPER way

I have a series of textboxes on a form. When the user inserts numbers into these textboxes, calculations are made and <asp:Label> controls are updated via JavaScript to reflect these calculatio..

Formatting DataBinder.Eval data

How can I format data coming from a DataBinder.Eval statement in an ASPX page? For example, I want to display the published date of the news items in a particular format in the homepage. I'm using th..

Install python 2.6 in CentOS

I have a shell that runs CentOS. For a project I'm doing, I need python 2.5+, but centOS is pretty dependent on 2.4. From what I've read, a number of things will break if you upgrade to 2.5. I want..

Finding last index of a string in Oracle

I need to find the last index of a string (e.g. -) within another string (e.g. JD-EQ-0001 in Oracle's SQL (version 8i). Is there a way to do this with INSTR() or another function?..

How to convert a JSON string to a dictionary?

I want to make one function in my swift project that converts String to Dictionary json format but I got one error: Cannot convert expression's type (@lvalue NSData,options:IntegerLitralConvertibl..

Why does Google prepend while(1); to their JSON responses?

Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response while turning a calendar on and off in Google Calendar: while (1); [ ['u', [ ['smsSentFlag',..

Using isKindOfClass with Swift

I'm trying to pick up a bit of Swift lang and I'm wondering how to convert the following Objective-C into Swift: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesB..

How to process a file in PowerShell line-by-line as a stream

I'm working with some multi-gigabyte text files and want to do some stream processing on them using PowerShell. It's simple stuff, just parsing each line and pulling out some data, then storing it in ..

Insert Multiple Rows Into Temp Table With SQL Server 2012

These StackOverflow questions here, here, and here all say the same thing, but I can't get it to run in SSMS or SQLFiddle CREATE TABLE #Names ( Name1 VARCHAR(100), Name2 VARCHAR(100) ) ..

Unable to open debugger port in IntelliJ IDEA

I have a problem that I can not set up my application in debug mode with IntelliJ IDE, but run mode is OK. My OS is Windows 7, IDE is IntelliJ IDEA, web container is Tomcat 6. I have tried for a long..

Convert hours:minutes:seconds into total minutes in excel

How can I convert hours:minutes:seconds into total minutes in Excel?..

Accessing the logged-in user in a template

I'm using FOSuserbundle to get started with User registration https://github.com/FriendsOfSymfony/FOSUserBundle I've got it registering / logging in and out. What I want to do now is grab the logged ..

Cannot find Microsoft.Office.Interop Visual Studio

I need to develop an application which will has the capability to send emails using C# with visual studio. The app will be able to use templates for mail, and a lot of things, but I have a problem. I..

Resolve host name to an ip address

I developed a client/server simulation application. I deployed client and server on two different Windows XP machines. Somehow, the client is not able to send requests to the server. I tried below op..

Getting list of items inside div using Selenium Webdriver

Say I have the following <div class="facetContainerDiv"> <div> <label class="facetLabel"> <input class="facetCheck" type="checkbox" /> </lab..

nodejs npm global config missing on windows

I can't find at all where npm has its global settings stored. npm config get userconfig C:\Users\Jack\.npmrc npm config get globalconfig C:\Users\Jack\AppData\Roaming\npm\etc\npmrc There's no f..

Fully custom validation error message with Rails

Using Rails I'm trying to get an error message like "The song field can't be empty" on save. Doing the following: validates_presence_of :song_rep_xyz, :message => "can't be empty" ... only displ..

Set QLineEdit to accept only numbers

I have a QLineEdit where the user should input only numbers. So is there a numbers-only setting for QLineEdit?..

How to add items to array in nodejs

How do I iterate through an existing array and add the items to a new array. var array = []; forEach( calendars, function (item, index) { array[] = item.id }, done ); function done(){ consol..

Are there bookmarks in Visual Studio Code?

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

How to use new PasswordEncoder from Spring Security

As of Spring Security 3.1.4.RELEASE, the old org.springframework.security.authentication.encoding.PasswordEncoder has been deprecated in favour of org.springframework.security.crypto.password.Password..

How to force keyboard with numbers in mobile website in Android

I have a mobile website and it has some HTML input elements in it, like this: <input type="text" name="txtAccessoryCost" size="6" /> I have embedded the site into a WebView for possible Andro..

Cannot read property 'style' of undefined -- Uncaught Type Error

I would like to change the color, fontsize and font weight of the text in a span element of the html page. I am using the following code: if(window.location.href.indexOf("test") > -1){ var se..

How to replace values at specific indexes of a python list?

If I have a list: to_modify = [5,4,3,2,1,0] And then declare two other lists: indexes = [0,1,3,5] replacements = [0,0,0,0] How can I take to_modify's elements as index to indexes, then set corr..

Rails migration for change column

We have script/generate migration add_fieldname_to_tablename fieldname:datatype syntax for adding new columns to a model. On the same line, do we have a script/generate for changing the datatype of a..

Getting content/message from HttpResponseMessage

I'm trying to get content of HttpResponseMessage. It should be: {"message":"Action '' does not exist!","success":false}, but I don't know, how to get it out of HttpResponseMessage. HttpClient httpCli..

Find where python is installed (if it isn't default dir)

Python is on my machine, I just don't know where, if I type python in terminal it will open Python 2.6.4, this isn't in it's default directory, there surely is a way of finding it's install location f..

Pandas split DataFrame by column value

I have DataFrame with column Sales. How can I split it into 2 based on Sales value? First DataFrame will have data with 'Sales' < s and second with 'Sales' >= s ..

Why does configure say no C compiler found when GCC is installed?

I am trying to make Sphinx from source on a 32-bit CentOS 6 VPS. When I run this command: ./configure --prefix=/usr/local/sphinx I get this error output: checking build environment --------------..

Count number of records returned by group by

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

sys.argv[1] meaning in script

I'm currently teaching myself Python and was just wondering (In reference to my example below) in simplified terms what the sys.argv[1] represents. Is it simply asking for an input? #!/usr/bin/python..

Difference between F5, Ctrl + F5 and click on refresh button?

I have often experienced while developing my web applications that pressing F5 or refresh doesn't produce or refresh the proper result. But when we hit Ctrl + F5 it generates the correct result. What ..

PHP Parse error: syntax error, unexpected T_PUBLIC

I am getting this error in this PHP code on line 3, what could be wrong? This code has been taken from php manual user notes by frank at interactinet dot com <?php public function myMethod() { re..

CSS full screen div with text in the middle

I have a css class defined so I can make a div to use all the browser's viewport, the rule is the following: .fullscreenDiv { background-color: #e8e8e8; width: 100%; height: auto; bot..

Angular : Manual redirect to route

I just recently started using angular 4 instead of angular.js 1. I have followed the heroes tutorial to learn about the fundamentals of angular 4 and I am currently using angular's own "RouterModule"..

How to programmatically empty browser cache?

I am looking for a way to programmatically empty the browser cache. I am doing this because the application caches confidential data and I'd like to remove those when you press "log out". This would h..

Find files containing a given text

In bash I want to return file name (and the path to the file) for every file of type .php|.html|.js containing the case-insensitive string "document.cookie" | "setcookie" How would I do that?..

How to get Current Directory?

I've been doing this in C# and Delphi ,but C++ is evil.The purpose is to create a file in the current directory(where the executable is running). My code: LPTSTR NPath = NULL; DWORD a = GetCurrentDi..

PostgreSQL: FOREIGN KEY/ON DELETE CASCADE

I have two tables like here: DROP TABLE IF EXISTS schemas.book; DROP TABLE IF EXISTS schemas.category; DROP SCHEMA IF EXISTS schemas; CREATE SCHEMA schemas; CREATE TABLE schemas.category ( ..

Check if certain value is contained in a dataframe column in pandas

I am trying to check if a certain value is contained in a python column. I'm using df.date.isin(['07311954']), which I do not doubt to be a good tool. The problem is that I have over 350K rows and the..

JavaScript function in href vs. onclick

I want to run a simple JavaScript function on a click without any redirection. Is there any difference or benefit between putting the JavaScript call in the href attribute (like this: <a href="..

Filter Linq EXCEPT on properties

This may seem silly, but all the examples I've found for using Except in linq use two lists or arrays of only strings or integers and filters them based on the matches, for example: var excludes = us..

What is the difference between background and background-color

What's the difference between specifying a background color using background and background-color? Snippet #1 body { background-color: blue; } Snippet #2 body { background: blue; } ..

Python assigning multiple variables to same value? list behavior

I tried to use multiple assignment as show below to initialize variables, but I got confused by the behavior, I expect to reassign the values list separately, I mean b[0] and c[0] equal 0 as before. ..

Laravel Eloquent get results grouped by days

I currently have a table of page_views that records one row for each time a visitor accesses a page, recording the user's ip/id and the id of the page itself. I should add that the created_at column i..

Detect changed input text box

I've looked at numerous other questions and found very simple answers, including the code below. I simply want to detect when someone changes the content of a text box but for some reason it's not wo..

HTTP Error 404 when running Tomcat from Eclipse

I have installed Eclipse and Tomcat 7. The error is that when I run Tomcat from Eclipse it starts, but after that, when I open localhost:8080 in Google Chrome I get HTTP Error 404(). How can I solve t..

Nginx not running with no error message

I am trying to start my nginx server. When I type "$> /etc/init.d/nginx start", I have a message appearing "Starting nginx:", and then nothing happens. There is no error message, and when I check the ..

How to select an element by classname using jqLite?

I'm trying to remove jquery from my Angular.js app in order to make it lighter, and put Angular's jqLite instead. But the app makes heavy use of find('#id') and find ('.classname'), which are not supp..

Calling a Javascript Function from Console

In Chrome's JavaScript console, how do I call a function that belongs to a .js file included in the webpage I am viewing?..

how can I Update top 100 records in sql server

I want to update the top 100 records in SQL Server. I have a table T1 with fields F1 and F2. T1 has 200 records. I want to update the F1 field in the top 100 records. How can I update based on TOP 10..

Should have subtitle controller already set Mediaplayer error Android

Whenever I play a media, it shows a warning in DDMS Should have subtitle controller already set MY CODE: private void start() { mediaPlayer.start(); mediaPlayer.setOnCompletionListener(ne..

File loading by getClass().getResource()

I have followed the way of loading the resource file by using getClass.getResource(path). The snippet of code is here : String url = "Test.properties"; System.out.println("Before printing paths..");..

How to automatically reload a page after a given period of inactivity

How can I automatically reload a webpage, if there have been no activity on the page for a given period of time?..

Error: The processing instruction target matching "[xX][mM][lL]" is not allowed

This error, The processing instruction target matching "[xX][mM][lL]" is not allowed occurs whenever I run an XSLT page that begins as follows: <?xml version="1.0" encoding="windows-1256"?&g..

How to open maximized window with Javascript?

I'm using Javascript's self.open() to open a link in a new window and i'd like that window to be maximized. I tried the fullscreen=yes option, which really doesn't do what I want. I am using below cod..

Java Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable

I have a script using java to connect to display X11 in the port 10.0 at localhost but i get always this error java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as t..

Stopping fixed position scrolling at a certain point?

I have an element that is position:fixed and so scrolls with the page how i want it to however. when the user scrolls up I want the element to stop scrolling at a certain point, say when it is 250px f..

Line Break in XML?

I'm a beginner in web development, and I'm trying to insert line breaks in my XML file. This is what my XML looks like: <musicpage> <song> <title>Song Title</title> ..

css rotate a pseudo :after or :before content:""

anyway to make a rotation work on the pseudo content:"\24B6"? I'm trying to rotate a unicode symbol...

Getting Data from Android Play Store

I have seen some Apps and Websites who use Data from the Android Play store. E.g. Apps or Sites with a top Apps ranking etc. But how can you get the Data? From where I can parse it? ..

How to measure time in milliseconds using ANSI C?

Using only ANSI C, is there any way to measure time with milliseconds precision or more? I was browsing time.h but I only found second precision functions...

C dynamically growing array

I have a program that reads a "raw" list of in-game entities, and I intend to make an array holding an index number (int) of an indeterminate number of entities, for processing various things. I would..

SQL Sum Multiple rows into one

I need some help with the SUM feature. I am trying to SUM the bill amounts for the same account into one grand total, but the results I am getting show my SUM column just multiples my first column by..

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

When i use the command C:\>keytool -list -alias androiddebugkey -keystore .android\debug.keystore -storepass android -keypass android I get this error: 'keytool' i..

Why can't I reference my class library?

I have a solution that contains a website and a class library in Visual Studio 2008. I then have another web site project outside of the solution that needs to reference the class library. I right c..

Multiple HttpPost method in Web API controller

I am starting to use MVC4 Web API project, I have controller with multiple HttpPost methods. The Controller looks like the following: Controller public class VTRoutingController : ApiController { ..

How to find specified name and its value in JSON-string from Java?

Let's assume we have the next JSON string: { "name" : "John", "age" : "20", "address" : "some address", "someobject" : { "field" : "value" } } What is the easiest (but s..

How do I set a textbox's text to bold at run time?

I'm using Windows forms and I have a textbox which I would occassionally like to make the text bold if it is a certain value. How do I change the font characteristics at run time? I see that there i..

Partly JSON unmarshal into a map in Go

My websocket server will receive and unmarshal JSON data. This data will always be wrapped in an object with key/value pairs. The key-string will act as value identifier, telling the Go server what ki..

RegEx to match stuff between parentheses

I'm having a tough time getting this to work. I have a string like: something/([0-9])/([a-z]) And I need regex or a method of getting each match between the parentheses and return an array of match..

Difference between Console.Read() and Console.ReadLine()?

I'm new to this field and I'm very confused: what is the real difference between Console.Read() and Console.ReadLine()?..

log4j logging hierarchy order

What is the hierarchy of log4j logging? DEBUG INFO WARN ERROR FATAL Which one provides the highest logging which would be helpful to troubleshoot issues? Can any one provide the order or hierarchy ..

Find maximum value of a column and return the corresponding row values using Pandas

Using Python Pandas I am trying to find the Country & Place with the maximum value. This returns the maximum value: data.groupby(['Country','Place'])['Value'].max() But how do I get the corr..

jQuery set checkbox checked

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

Read url to string in few lines of java code

I'm trying to find Java's equivalent to Groovy's: String content = "http://www.google.com".toURL().getText(); I want to read content from a URL into string. I don't want to pollute my code with bu..

How to escape JSON string?

Are there any classes/functions available to be used for easy JSON escaping? I'd rather not have to write my own...

php resize image on upload

I got a form where the user is inserting some data and also uploading an image. To deal with the image, I got the following code: define("MAX_SIZE", "10000"); $errors = 0; $image = $_FILES["fileFiel..

Posting a File and Associated Data to a RESTful WebService preferably as JSON

This is probably going to be a stupid question but I'm having one of those nights. In an application I am developing RESTful API and we want the client to send data as JSON. Part of this application r..

When to use Common Table Expression (CTE)

I have begun reading about Common Table Expression and cannot think of a use case where I would need to use them. They would seem to be redundant as the same can be done with derived tables. Is there ..

Use of REPLACE in SQL Query for newline/ carriage return characters

I have a database filed named Account Type that has carriage return and newline characters in it (CHAR(10) and CHAR(13)). When I search for this value I need to do a REPLACE as shown below. The foll..

ArrayAdapter in android to create simple listview

I tried to create an Activity in Android, This Activity only contains a ListView nothing else. As I know to fill the listview we need to use an ArrayAdapter. So to understand the ArrayAdapter I have..

How to remove all click event handlers using jQuery?

I'm having a problem. Basically, when a user clicks an 'Edit' link on a page, the following Jquery code runs: $("#saveBtn").click(function () { saveQuestion(id); }); By doing this, the onClick ..

Regular Expression Match to test for a valid year

Given a value I want to validate it to check if it is a valid year. My criteria is simple where the value should be an integer with 4 characters. I know this is not the best solution as it will not al..

How to retrieve element value of XML using Java?

I am new to XML. I want to read the following XML on the basis of request name. Please help me on how to read the below XML in Java - <?xml version="1.0"?> <config> <Reques..

How to write a link like <a href="#id"> which link to the same page in PHP?

like in HTML, I could write <a href="#id"> which could link to the place where I make a <a id="id"> . but it seems that it does not work in PHP. How to do that? the original code is from ..

How do I get the number of elements in a list?

Consider the following: items = [] items.append("apple") items.append("orange") items.append("banana") # FAKE METHOD: items.amount() # Should return 3 How do I get the number of elements in the l..

Subscripts in plots in R

I can't find a way how to write subscripts in the title or the subtitle in R. How can I write v 1,2 with 1,2 as subscripts? Thanks for your help!..

AWS : The config profile (MyName) could not be found

Every time I want to config something with AWS I get the following error : "The config profile (myname) could not be found" like : aws configure I'm using Python 3.4 and I want to use AWS CLI Key..

How to keep the console window open in Visual C++?

I'm starting out in Visual C++ and I'd like to know how to keep the console window. For instance this would be a typical "hello world" application: int _tmain(int argc, _TCHAR* argv[]) { cout &..

No provider for Router?

Im getting this error: EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0 caused by: No provider for Router! This is my app component: import {Component} from '@angul..

How to start an Android application from the command line?

How to start an Android application from the command line? There are similar question asked, but I can not find good any answers...

Is it possible to remove the focus from a text input when a page loads?

I have a site with one textfield for search however I dont want the focus to be on it when the page loads however it is the only text input on the form, is it possible to remove the focus?..

Authentication failed for https://xxx.visualstudio.com/DefaultCollection/_git/project

I am trying to use git to push my repository to a visual studio team services project, but I get the error: fatal: Authentication failed for (url of team project) I am using the commands: git remote ..

VBA Go to last empty row

I have a project on excel macro, I need to highlight the next last row that has an empty value. example cell A1:A100 have data and the next cell is A101 is empty. when user click a button it should h..

How to get store information in Magento?

In Magento, how can I get active store information, like store name, line number, etc?..

Escape a string in SQL Server so that it is safe to use in LIKE expression

How do I escape a string in SQL Server's stored procedure so that it is safe to use in LIKE expression. Suppose I have an NVARCHAR variable like so: declare @myString NVARCHAR(100); And I want to ..

Unable to find the requested .Net Framework Data Provider in Visual Studio 2010 Professional

Why am I getting "Unable to find the requested .Net Framework Data Provider" when trying to setup a new datasource in Visual Studio 2010 Professional? My stats: Windows 7 64bit 16gig RAM Visual Stu..

Twitter Bootstrap - add top space between rows

How to add margin top to class="row" elements using twitter bootstrap framework?..

Change NULL values in Datetime format to empty string

I have a table which contains 'NULL' values which are of type 'Datetime'. Now i have to convert those into empty string but when when i use convert function ISNULL( [Accrued Out of Default] ,'' ) h..

Assign command output to variable in batch file

I'm trying to assign the output of a command to a variable - as in, I'm trying to set the current flash version to a variable. I know this is wrong, but this is what I've tried: set var=reg query hkl..

How to extract table as text from the PDF using Python?

I have a PDF which contains Tables, text and some images. I want to extract the table wherever tables are there in the PDF. Right now am doing manually to find the Table from the page. From there I a..

How to fix: "UnicodeDecodeError: 'ascii' codec can't decode byte"

as3:~/ngokevin-site# nano content/blog/20140114_test-chinese.mkd as3:~/ngokevin-site# wok Traceback (most recent call last): File "/usr/local/bin/wok", line 4, in Engine() File "/usr/local/lib/python2..

SQL Server - boolean literal?

How to write literal boolean value in SQL Server? See sample use: select * from SomeTable where PSEUDO_TRUE another sample: if PSEUDO_TRUE begin select 'Hello, SQL!' end Note: The query above..

How to change shape color dynamically?

I have <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#FFFF00"..

How to check if a variable is both null and /or undefined in JavaScript

Possible Duplicate: Detecting an undefined object property in JavaScript How to determine if variable is 'undefined' or 'null' Is there a standard function to check for null, ..

SQL Server : Arithmetic overflow error converting expression to data type int

I'm getting this error msg 8115, level 16, state 2, line 18 Arithmetic overflow error converting expression to data type int. with this SQL query DECLARE @year VARCHAR(4); ..

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

How to call a View Controller programmatically?

I have looked at all the tutorials I can find on this one, and I still don't have the answer. I need to call another view from the code. I am using UIStoryboards. I have changed the view many times..

MongoDB: exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating

I created /data/db in root directory and ran ./mongod: [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating [initandlisten] s..

phpMyAdmin - config.inc.php configuration?

With this configuration i found the error The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click here. W..

Get string after character

I have a string that looks like this: GenFiltEff=7.092200e-01 Using bash, I would like to just get the number after the = character. Is there a way to do this?..

Can I use an HTML input type "date" to collect only a year?

I have a field that is required to collect a year from the user (i.e. a date with a year resolution - for ease of storage I'd prefer to store an actual date value and not a number). I would like to ..

PHP order array by date?

Possible Duplicate: PHP Sort a multidimensional array by element containing date I have some data from XML or JSON in a PHP array that looks like this: [0]= array(2) { ["title"]= strin..

How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with: var first = str.charAt(0); and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exists in J..

PHP: Best way to check if input is a valid number?

What is the best way of checking if input is numeric? 1- +111+ 5xf 0xf Those kind of numbers should not be valid. Only numbers like: 123, 012 (12), positive numbers should be valid. This is mye cu..

What is the difference between 'E', 'T', and '?' for Java generics?

I come across Java code like this: public interface Foo<E> {} public interface Bar<T> {} public interface Zar<?> {} What is the difference among all three of the above and what ..

Select a Column in SQL not in Group By

I have been trying to find some info on how to select a non-aggregate column that is not contained in the Group By statement in SQL, but nothing I've found so far seems to answer my question. I have a..

How to embed a Facebook page's feed into my website

I am working with a group to help promote a charity event. The page I would like to embed is NOT my Facebook profile, but a Facebook page someone has created. I would like to show that news feed in m..

SQL Server : fetching records between two dates?

In SQL I write a SELECT statement to fetch data between two dates, using between and Ex: select * from xxx where dates between '2012-10-26' and '2012-10-27' But the rows returned are for 26th o..

Faster way to zero memory than with memset?

I learned that memset(ptr, 0, nbytes) is really fast, but is there a faster way (at least on x86)? I assume that memset uses mov, however when zeroing memory most compilers use xor as it's faster, co..

A non well formed numeric value encountered

I have a form that passes two dates (start and finish) to a PHP script that will add those to a DB. I am having problems validating this. I keep getting the following errors A non well formed numeri..

PermGen elimination in JDK 8

I have installed JDK 8 and trying to run Eclipse. I am getting following warning message: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 Wh..

How do I add an active class to a Link from React Router?

I've created a bootstrap-style sidebar using Link. Here is a snippet of my code: <ul className="sidebar-menu"> <li className="header">MAIN NAVIGATION</li> <li><Link to=..

IF Statement multiple conditions, same statement

Hey all, looking to reduce the code on my c# if statements as there are several repeating factors and was wondering if a trimmer solution is possible. I currently have 2 if statements that need to ca..

How can I call a method in Objective-C?

I am trying to build an iPhone app. I created a method like this: - (void)score { // some code } and I have tried to call it in an other method like this: - (void)score2 { @selector(score..

How to pick a new color for each plotted line within a figure in matplotlib?

I'd like to NOT specify a color for each plotted line, and have each line get a distinct color. But if I run: from matplotlib import pyplot as plt for i in range(20): plt.plot([0, 1], [i, i]) pl..

How to get/generate the create statement for an existing hive table?

Assuming you have "table" already in Hive, is there a quick way like other databases to be able to get the "CREATE" statement for that table?..

How to schedule a periodic task in Java?

I need to schedule a task to run in at fixed interval of time. How can I do this with support of long intervals (for example on each 8 hours)? I'm currently using java.util.Timer.scheduleAtFixedRate...

How can I pad a value with leading zeros?

What is the recommended way to zerofill a value in JavaScript? I imagine I could build a custom function to pad zeros on to a typecasted value, but I'm wondering if there is a more direct way to do th..

Is there a difference between "throw" and "throw ex"?

There are some posts that asks what the difference between those two are already. (why do I have to even mention this...) But my question is different in a way that I am calling "throw ex" in another..

How to Check whether Session is Expired or not in asp.net

I've specified the session timeout in web.config file. When the session is timeout I'm not getting redirect to the login page but I am getting an error saying object reference not set to an instance. ..

Why do we need boxing and unboxing in C#?

Why do we need boxing and unboxing in C#? I know what boxing and unboxing is, but I can't comprehend the real use of it. Why and where should I use it? short s = 25; object objshort = s; //Boxing ..

HREF="" automatically adds to current page URL (in PHP). Can't figure it out

Longtime reader of stackoverflow but first question. I'm working with Wordpress (specifically thesis theme) in the custom_functions.php file and am finding for some reason is automatically adding th..

How to run ssh-add on windows?

I'm following #335 Deploying to a VPS , and near the end of the episode, we need to run ssh-add to give server access to github repo. The problem is how do I run it in windows? What need to install? ..

Change color of Button when Mouse is over

I want to change the background color of a button when IsMouseOver == True <Button Command="{Binding ClickRectangleColorCommand}" Background="{Binding Color, Converter={StaticResource RGBCtoBr..

Is either GET or POST more secure than the other?

When comparing an HTTP GET to an HTTP POST, what are the differences from a security perspective? Is one of the choices inherently more secure than the other? If so, why? I realize that POST doesn't ..

How to redirect single url in nginx?

I'm in the process of reorganizing url structure. I need to setup redirect rules for specific urls - I'm using NGINX. Basically Something like this: http://example.com/issue1 --> http://exampl..

How to Handle Button Click Events in jQuery?

I need to have a button and handle its event in jQuery. And I am writing this code but it'snot working. Did I miss something? <!-- Begin Button --> <div class="demo"> <br> <br&..

Calling a class function inside of __init__

I'm writing some code that takes a filename, opens the file, and parses out some data. I'd like to do this in a class. The following code works: class MyClass(): def __init__(self, filename): ..

How to make code wait while calling asynchronous calls like Ajax

I am looking for something like this function someFunc() { callAjaxfunc(); //may have multiple ajax calls in this function someWait(); // some code which waits until async calls complete console.log..