Questions Tagged with #Simpletest

Simpletest is a Unit and Web Testing framework developed in PHP. You can read more about it and how to set it up at

Eclipse JUnit - possible causes of seeing "initializationError" in Eclipse window

I know this question is pretty general but I haven't found any hints on why this error may show up. What are possible causes of seeing initalizationError in Eclipse window? I get no useful information..

Why does visual studio 2012 not find my tests?

I have some tests that use the built in Microsoft.VisualStudio.TestTools.UnitTesting, but can not get them to run. I am using visual studio 2012 ultimate. I have a solution of two projects; One has ..

how to add value to combobox item

How can I add data value of each item to combobox in Visual Basic 2010? Like html drop-down box. Or is there anyway to add values to each item ? I am adding item from MySQL database like this: Com..

Play/pause HTML 5 video using JQuery

I am trying to control HTML5 videos using JQuery. I have two clips in a tabbed interface, there are six tabs in total, the others just have images. I am trying to make the video clips play when their ..

How can I add spaces between two <input> lines using CSS?

I want to control the layout with CSS. How can I regulate the spaces between <input> elements(I hope they are on two lines) using CSS? _x000D_ _x000D_ <form name="publish" id="publish" actio..

Android OnClickListener - identify a button

I have the activity: public class Mtest extends Activity { Button b1; Button b2; public void onCreate(Bundle savedInstanceState) { ... b1 = (Button) findViewById(; b2 = (But..

Define preprocessor macro through CMake?

How do I define a preprocessor variable through CMake? The equivalent code would be #define foo...

How to get the response of XMLHttpRequest?

I'd like to know how to use XMLHttpRequest to load the content of a remote URL and have the HTML of the accessed site stored in a JS variable. Say, if I wanted to load and alert() the HTML of http://..

How do I make an http request using cookies on Android?

I'd like to make an http request to a remote server while properly handling cookies (eg. storing cookies sent by the server, and sending those cookies when I make subsequent requests). It'd be nice t..

How to remove a Gitlab project?

I have created several repositories in GitLab. One of those was for testing purposes and has some commits and branches. I want to delete or remove this repository. How can I do this? ..

Get Return Value from Stored procedure in

i have a stored procedure ALTER PROC TESTLOGIN @UserName varchar(50), @password varchar(50) As Begin declare @return int; set @return = (SELECT COUNT(*) FROM C..

Simple function to sort an array of objects

I would like to create a (non-anonymous) function that sorts an array of objects alphabetically by the key name. I only code straight-out JavaScript so frameworks don't help me in the least. var peop..

How to convert dataframe into time series?

I have one csv file in which I have 2 closing prices of stock(on daily basis) Dates Bajaj_close Hero_close 3/14/2013 1854.8 1669.1 3/15/2013 1850.3 1684.45 3/18/2013 1812.1 1690.5 3/19/201..

Retrieve Button value with jQuery

A simple one, I'm trying to retrieve the value attribute of a button when its been pressed using jQuery, here's what I have: <script type="text/javascript"> $(document).ready(function() { ..

PHP Composer update "cannot allocate memory" error (using Laravel 4)

I just can't solve this one. I'm on Linode 1G RAM basic plan. Trying to install a package via Composer and it's not letting me. My memory limit is set to "-1" on PHP.ini Is there anything else I can..

Return Index of an Element in an Array Excel VBA

I have an array prLst that is a list of integers. The integers are not sorted, because their position in the array represents a particular column on a spreadsheet. I want to know how I find a particu..

How to set -source 1.7 in Android Studio and Gradle

I'm getting following error when trying to compile my project in Android Studio: Gradle: error: diamond operator is not supported in -source 1.6 I have 1.7 set as target in all project preferences ..

How to keep :active css style after click a button

Once the button is clicked I want it to stay with the active style instead of going back to normal style. Can this be done with CSS please? Im using blurb button from DIVI Theme (WordPress). Please h..

How to get the name of a class without the package?

In C# we have Type.FullName and Type.Name for getting the name of a type (class in this case) with or without the namespace (package in java-world). What is the java equivalent to Type.Name? Clearly..

How do I escape spaces in path for scp copy in Linux?

I'm new to linux, I want to copy a file from remote to local system... now I'm using scp command in linux system.. I have some folders or files names are with spaces, when I try to copy that file, it ..

How to get rows count of internal table in abap?

How do I get the row count of an internal table? I guess that I can loop on it. But there must be a saner way. I don't know if it makes a difference but the code should run on 4.6c version...

Double value to round up in Java

I have a double value = 1.068879335 i want to round it up with only two decimal values like 1.07. I tried like this DecimalFormat df=new DecimalFormat("0.00"); String formate = df.format(value); dou..

What does "'') " mean in Flask

I am reading the Flask documentation. I was told that with''), I could make the server publicly available. What does it mean ? How can I visit the server in another computer (j..

Get value of a merged cell of an excel from its cell address in vba

How to get the value of a merged cell of an excel having range address like "$B$4:$B$11" in vba..

Convert a string into an int

I'm having trouble converting a string into an integer. I googled it but all I can find is how to convert an int into a string. Does anyone know how to do it the other way around? Thanks...

Thymeleaf: how to use conditionals to dynamically add/remove a CSS class

By using Thymeleaf as template engine, is it possible to add/remove dynamically a CSS class to/from a simple div with the th:if clause? Normally, I could use the conditional clause as follows: <a..

How to enable cURL in PHP / XAMPP

How do I enable cURL in PHP? ??..

Adding a simple UIAlertView

What is some starter code I could use to make a simple UIAlertView with one "OK" button on it?..

Aren't promises just callbacks?

I've been developing JavaScript for a few years and I don't understand the fuss about promises at all. It seems like all I do is change: api(function(result){ api2(function(result2){ api..

Checking if a string is empty or null in Java

I'm parsing HTML data. The String may be null or empty, when the word to parse does not match. So, I wrote it like this: if(string.equals(null) || string.equals("")){ Log.d("iftrue", "seem to b..

jQuery UI: Datepicker set year range dropdown to 100 years

Using the Datepicker the year drop down by default shows only 10 years. The user has to click the last year in order to get more years added. How can we set the initial range to be 100 years so that ..

C compile error: "Variable-sized object may not be initialized"

Why do I receive the error "Variable-sized object may not be initialized" with the following code? int boardAux[length][length] = {{0}}; ..

How to get the last row of an Oracle a table

I want to get the last row, which I inserted into a table in an Oracle 11g Express database. How can I do this?..

Is there a way to get the XPath in Google Chrome?

I have a webpage I want to use with YQL. But I need the XPath of a specific item. I can see it in the debug tools area for Google Chrome but I don't see a way to copy that XPath. Is there a way to ..

Making an array of integers in iOS

If you want to make an array of integers, can you use NSInteger? Do you have to use NSNumber? If so, then why?..

Get name of object or class

Is there any solution to get the function name of an object? function alertClassOrObject (o) { window.alert(o.objectName); //"myObj" OR "myClass" as a String } function myClass () { ..

How to make a drop down list in yii2?

How to make a dropdown in yii2 using an activeform and a model? Since all the methods has changed in yii2,how it is done in the new one?..

JavaScript onclick redirect

I have this text field and button here <input name="txtSearch" type="text" id="txtSearch" class="field" /> <input type="submit" name="btnSearch" value="" id="btnSearch" class="bt..

Display Bootstrap Modal using javascript onClick

I need to be able to open a Twitter bootstrap modal window using the onClick="" or similar function. Just need the code to go into the onClick="". I am trying to make a click-able div to open the moda..

How to drop a PostgreSQL database if there are active connections to it?

I need to write a script that will drop a PostgreSQL database. There may be a lot of connections to it, but the script should ignore that. The standard DROP DATABASE db_name query doesn't work when t..

Time in milliseconds in C

Using the following code: #include<stdio.h> #include<time.h> int main() { clock_t start, stop; int i; start = clock(); for(i=0; i<2000;i++) { printf("%d", (..

Add Items to ListView - Android

This is my first experience with android. I'm trying to add items to my ListView. I use Tabs, and the only way to see that the item was added is to change tab and then come back to the first tab. I s..

How can I render HTML from another file in a React component?

Is it possible to render HTML from another file in a React component? I have tried the following, but it does not work: var React = require('react'); /* Template html */ var template = require('./t..

Wait Until File Is Completely Written

When a file is created (FileSystemWatcher_Created) in one directory I copy it to another. But When I create a big (>10MB) file it fails to copy the file, because it starts copying already, when the fi..

How do I insert values into a Map<K, V>?

I am trying to create a map of strings to strings. Below is what I've tried but neither method works. What's wrong with it? public class Data { private final Map<String, String> data = new ..

Hive: Convert String to Integer

I am looking for a Built-in UDF to convert values of a string column to integer in my hive table for sorting using SELECT and ORDER BY. I searched in the Language Manual, but no use. Any other suggest..

How do I concatenate strings with variables in PowerShell?

I'm trying to build a file path in PowerShell and the string concatenation seems to be a little funky. I have a list of folders: c:\code\MyProj1 c:\code\MyProj2 I want to get the path to a DLL fil..

What is your single most favorite command-line trick using Bash?

We all know how to use <ctrl>-R to reverse search through history, but did you know you can use <ctrl>-S to forward search if you set stty stop ""? Also, have you ever tried running bind ..

Submit two forms with one button

I have HTML two forms, one that submits data upon entry to a database using PHP, the other directs the user to a paypal payment page, my problem is that the user would have to submit both forms which ..

Read .csv file in C

I have a .csv file : lp;imie;nazwisko;ulica;numer;kod;miejscowosc;telefon;email;data_ur 1;Jan;Kowalski;ul. Nowa;1a;11-234;Budry;123-123-456;[email protected];1980.05.13 2;Jerzy;Nowak;ul. Konopnicka;13a/3;00-..

Showing loading animation in center of page while making a call to Action method in ASP .NET MVC

My application makes several calls to an Action method (ASP .NET MVC) which returns a Json object. When the application is waiting for this method to return its data I want to display a loading animat..

When to use single quotes, double quotes, and backticks in MySQL

I am trying to learn the best way to write queries. I also understand the importance of being consistent. Until now, I have randomly used single quotes, double quotes, and backticks without any real t..

mysql error 2005 - Unknown MySQL server host 'localhost'(11001)

I was using mysql 5.6.11,it usually turned down and show me this: 2005 - Unknown MySQL server host 'localhost'(11001). Currently my resolution is to turn off the network,than it return to normal..

Django: OperationalError No Such Table

I'm building a fairly simple application, research, in my Django project that uses Django-CMS. (It's my first ground-up attempt at a project/application.) It's main purpose is to store various intel..

MySQL pivot table query with dynamic columns

I'm using the following tables for storing product data: mysql> SELECT * FROM product; +---------------+---------------+--------+ | id | name | description | stock | +---------------+------..

Java get String CompareTo as a comparator object

I would like to sort and binary search a static array of strings via the String.CompareTo comparator. The problem is that both sorting, and binary searching requires that a Comparator object be passe..

Passing struct to function

I'm a new C programmer and I wanted to know how I can pass a struct through to a function. I'm getting an error and can't figure out the correct syntax to do it. Here is the code for it.... Struct: ..

How to generate the whole database script in MySQL Workbench?

I want to take the whole database. Where do I find the database file? And is there a way to write the whole database with all data to a text file (like the one in SQL Server)?..

Active Menu Highlight CSS

I want to highlight the current menu you have click. I'm using CSS, but it is now working. here is my css code: #sub-header ul li:hover{ background-color: #000;} #sub-header ul li:hover a{ color: #f..

Updating Anaconda fails: Environment Not Writable Error

I'm trying to update Anaconda and its packages using conda update --name root conda, but it fails every time. Error message : EnvironmentNotWritableError: The current user does not have write p..

How to use Java property files?

I have a list of key/value pairs of configuration values I want to store as Java property files, and later load and iterate through. Questions: Do I need to store the file in the same package as th..

Running Node.Js on Android

So I know this has been questioned quite a lot. To be exact for example in these questions: Run NodeJs server in Android How to run my node.js project on android? and NodeJS on IOS/Android ..

Best way to run scheduled tasks

Today we have built a console application for running the scheduled tasks for our ASP.NET website. But I think this approach is a bit error prone and difficult to maintain. How do you execute your sch..

Datetime equal or greater than today in MySQL

What's the best way to do following: SELECT * FROM users WHERE created >= today; Note: created is a datetime field...

How to set a value for a span using jQuery

How to set a value for a <span> tag using jQuery… For example… Below is my <span> tag: <span id="submittername"></span> In my jQuery code: jQuery.noConflict(); ..

How do I check if a number is positive or negative in C#?

How do I check if a number is positive or negative in C#?..

Defining constant string in Java?

I have a list of constant strings that I need to display at different times during my Java program. In C I could define the strings like this at the top of my code: #define WELCOME_MESSAGE "Hello, w..

How to redirect to logon page when session State time out is completed in mvc

I have an ASP.NET MVC4 application where I am implementing sessionTimeout like: <configuration> <system.web> <sessionState timeout="2"></sessionState> </system.web&..

get dataframe row count based on conditions

I want to get the count of dataframe rows based on conditional selection. I tried the following code. print df[(df.IP == head.idxmax()) & (df.Method == 'HEAD') & (df.Referrer == '"-"')].count..

How do I do logging in C# without using 3rd party libraries?

I would like to implement logging in my application, but would rather not use any outside frameworks like log4net. So I would like to do something like DOS's echo to a file. What is the most effectiv..

"Could not find acceptable representation" using spring-boot-starter-web

I am trying to use spring-boot-starter-web to create a rest service serving up JSON representations of Java objects. From what I understand this boot-starter-web jar is supposed to handle the conversi..

Fastest way to convert string to integer in PHP

Using PHP, what's the fastest way to convert a string like this: "123" to an integer? Why is that particular method the fastest? What happens if it gets unexpected input, such as "hello" or an array?..

Using Eloquent ORM in Laravel to perform search of database using LIKE

I want to use Eloquent's active record building to build a search query, but it is going to be a LIKE search. I have found the User::find($term) or User::find(1), but this is not generating a like sta..

Why is this printing 'None' in the output?

I have defined a function as follows: def lyrics(): print "The very first line" print lyrics() However why does the output return None: The very first line None ..

Updating .class file in jar

I want to update a .class file in a jar with a new one. What is the easiest way to do it, especially in the Eclipse IDE?..

Java: How to insert CLOB into oracle database

I need to write an XML file content into oracle database where the column is of CLOB datatype. How will I do that?..

Output data with no column headings using PowerShell

I want to be able to output data from PowerShell without any column headings. I know I can hide the column heading using Format-Table -HideTableHeaders, but that leaves a blank line at the top. Here ..

How do I use dataReceived event of the SerialPort Port Object in C#?

I am attempting to create a small application to collect data received from an external sensor attached to COM10. I have successfully created a small C# console object and application that opens the ..

View not attached to window manager crash

I am using ACRA to report app crashes. I was getting a View not attached to window manager error message and thought I had fixed it by wrapping the pDialog.dismiss(); in an if statement: if (pDialog!..

What's the difference between .NET Core, .NET Framework, and Xamarin?

Microsoft now has .NET Core, .NET Framework and Xamarin (Mono) in its family. It seems to be a lot of overlap here. What's the difference between these types of .NET Platforms? When should I choose to..

How do you fix a bad merge, and replay your good commits onto a fixed merge?

I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the ..

How to Maximize a firefox browser window using Selenium WebDriver with node.js

How do we maximize a firefox browser using Selenium WebDriver (Selenium 2) with node.js. I am using wd package for Selenium WebDriver to write the tests. I have tried executing window.resizeTo(1366,76..

Reading my own Jar's Manifest

I need to read the Manifest file, which delivered my class, but when I use: getClass().getClassLoader().getResources(...) I get the MANIFEST from the first .jar loaded into the Java Runtime. My app..

What is the use of static constructors?

Please explain to me the use of static constructor. Why and when would we create a static constructor and is it possible to overload one?..

HTML form with multiple "actions"

I'm setting up a form wherein I need two "actions" (two buttons): 1 - "Submit this form for approval" 2 - "Save this application for later" How do I create an HTML form that supports multiple "actio..

How do I group Windows Form radio buttons?

How can I group the radio buttons in Windows Form application (a lot like ASP.NET's radiobuttonlist!)? So I can switch between each case chosen from the options...

How to remove numbers from a string?

I want to remove numbers from a string: questionText = "1 ding ?" I want to replace the number 1 number and the question mark ?. It can be any number. I tried the following non-working code. ques..

How to use '-prune' option of 'find' in sh?

I don't quite understand the example given from the man find, can anyone give me some examples and explanations? Can I combine regular expression in it? The more detailed question is like this: ..

How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

I need some guide lines on how to install a Date Picker Bootstrap 3 on a MVC 5 project using the Razor engine. I found this link here but couldn't make it work in VS2013. Copying from the example in..

Returning anonymous type in C#

I have a query that returns an anonymous type and the query is in a method. How do you write this: public "TheAnonymousType" TheMethod(SomeParameter) { using (MyDC TheDC = new MyDC()) { var ..

Could not find a version that satisfies the requirement tensorflow

I installed the latest version of Python (3.6.4 64-bit) and the latest version of PyCharm (2017.3.3 64-bit). Then I installed some modules in PyCharm (Numpy, Pandas, etc), but when I tried installing ..

How to use string.replace() in python 3.x

The string.replace() is deprecated on python 3.x. What is the new way of doing this?..

Complexities of binary tree traversals

What is the time complexity of inorder,postorder and preorder traversal of binary trees in data structures?? Is it O(n) or O(log n) or O(n^2)?? ..

Android ListView selected item stay highlighted

I have an XML with two ListView, one with a list of clients filled by a select query (lv_cli) and the other with the details of the client selected (lv_cli_det). I would like to keep the client select..

"id cannot be resolved or is not a field" error?

I keep getting this error. Should I just make id a field? My code is: public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); ImageView mainimage = ..

jQuery object equality

How do I determine if two jQuery objects are equal? I would like to be able to search an array for a particular jQuery object. $.inArray(jqobj, my_array);//-1 alert($("#deviceTypeRoot") == $("#de..

No Title Bar Android Theme

In my application I want to use the Theme.NoTitleBar, but on the other hand I also don't want to loose the internal Theme of the Android OS.. I searched on the net and Found the following answer.. I h..

Constants in Kotlin -- what's a recommended way to create them?

How is it recommended to create constants in Kotlin? And what's the naming convention? I've not found that in the documentation. companion object { //1 val MY_CONST = "something" //2 ..

The tilde operator in Python

What's the usage of the tilde operator in Python? One thing I can think about is do something in both sides of a string or list, such as check if a string is palindromic or not: def is_palindromic(s..

How to remove margin space around body or clear default css styles

I am admittedly a beginner, but I also did a fair amount of searching before posting this. There seems to be extra space around my div element. I also would like to point out that I tried many combina..

What is the difference between the operating system and the kernel?

I do not understand the difference between operating system and kernel. Can someone please explain it?..

How to handle change of checkbox using jQuery?

I have some code <input type="checkbox" id="chk" value="value" /> <label for="chk">Value </label> <br/> <input type="button" id="But1" value="set value" /> <br /> ..

How can I obfuscate (protect) JavaScript?

I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible?..

How to show/hide JPanels in a JFrame?

The application I am developing is a game. What I want to do is have JPanels that appear in the JFrame, like a text or message window, and then disappear when they are no longer used. I have designe..

How do I set an un-selectable default description in a select (drop-down) menu in HTML?

I have a drop down where the user selects a language: <select> <option>English</option> <option>Spanish</option> </select> I want the default option tha..

How to enable Auto Logon User Authentication for Google Chrome

I have a site I go to that allows me to auto log in with my creditentials (windows) and using Internet Explorer I can just set the option under "User Authentication" to "Automatic logon with current u..

Printing out a linked list using toString

Ok guys, so I am trying to learn how to print out a linked list. I have all the methods that I would need to use for the list, but I can't figure out how to display the values of the nodes. Right no..

Eclipse "Server Locations" section disabled and need to change to use Tomcat installation

I have set up a dynamic web project in Eclipse with a Tomcat 5.5 installation. I want to be to set the server to us the Tomcat installation instead of the workspace metadata location, but when Eclips..

Razor/CSHTML - Any Benefit over what we have?

Anyone out there using the new CSHTML pages feature and is finding that they prefer this new view engine syntax over the existing ASP.NET MVC default view engine or over web forms, and if so, why? Wh..

How to check if an array element exists?

Example: I'm checking for the existence of an array element like this: if (!self::$instances[$instanceKey]) { $instances[$instanceKey] = $theInstance; } However, I keep getting this error: Not..

Add Favicon with React and Webpack

I am attempting to add a favicon to a React-based website that I made using webpack. It has been a total nightmare to add a favicon and I have tried many solutions to no avail. The latest solution tha..

How to scanf only integer?

I want the code to run until the user enters an integer value. The code works for char and char arrays. I have done the following: #include<stdio.h> int main() { int n; printf("Plea..

How to SUM parts of a column which have same text value in different column in the same row

I have a column with names and a column with numbers: FirstName Name Number John Smith 17 John Smith 26 Peter Smith 116 Peter Smith 25 Franck ..

How do I check if a string contains another string in Objective-C?

How can I check if a string (NSString) contains another smaller string? I was hoping for something like: NSString *string = @"hello bla bla"; NSLog(@"%d",[string containsSubstring:@"hello"]); But ..

How to configure Docker port mapping to use Nginx as an upstream proxy?

Update II It's now July 16th, 2015 and things have changed again. I've discovered this automagical container from Jason Wilder: and it solves this prob..

Submit form without reloading page

I have a function built in JavaScript that I want to be executed after a form submit is hit. It basically changes the look of the page completely. But I need a variable from the search box to still go..

PDO closing connection

Just a rather simple question with regards to PDO compared to MySQLi. With MySQLi, to close the connection you could do: $this->connection->close(); However with PDO it states you open the c..

How to run Pip commands from CMD

As I understand, Python 2.7.9 comes with Pip installed, however when I try to execute a Pip command from CMD (Windows) I get the following error: 'pip' is not recognized as an internal or external c..

Create Windows service from executable

Is there any quick way to, given an executable file, create a Windows service that, when started, launches it?..

Oracle date "Between" Query

I am using oracle database. i want to execute one query to check the data between two dates. NAME START_DATE ------------- ------------- Small Widget 15-JAN-10

Pause Console in C++ program

Which is best way to pause the console in C++ programs? using cin.get() or using system("pause") or using C functions like getch() or getchar()? Is it true that use of system("pause") leads to non..

How to update multiple columns in single update statement in DB2

I want to update multiple columns of a table in DB2 with single Update statement. Any hint or idea will be appreciable. Thanks...

How to read/process command line arguments?

I am originally a C programmer. I have seen numerous tricks and "hacks" to read many different arguments. What are some of the ways Python programmers can do this? Related What’s the best way t..

Find string between two substrings

How do I find a string between two substrings ('123STRINGabc' -> 'STRING')? My current method is like this: >>> start = 'asdf=5;' >>> end = '123jasd' >>> s = 'asdf=5;iw..

How to do one-liner if else statement?

Can I write a simple if-else statement with variable assignment in go (golang) as I would do in php? For example: $var = ( $a > $b )? $a: $b; Currently I have to use the following: var c int if a ..

Emulator error: This AVD's configuration is missing a kernel file

This problem was discovered when I tried to run the Android emulator in Eclipse. Can't figure out what happened. I searched online for the solution, but it seemed to be vague and I don't understand cl..

How to exclude 0 from MIN formula Excel

i need to know how can i exclude 0 from rows and get the MIN Value. But also i need to exlude the F1 Cell. Ex: A B C D E F 1 0 18 20 0 150 = 18 but if i do this In excel with =MIN(A..

How to get share counts using graph API

I can get the share count of an URL using PHP SDK and using the deprecated rest API, but didn't find a way to get the share counts of an URL using graph API. Is there any way to find out?..

PHP-FPM and Nginx: 502 Bad Gateway

Configuration Ubuntu Server 11.10 64 bit Amazon AWS, Ec2, hosted on the cloud t1.micro instance Before I write anything else, I'd like to state that I've checked both nginx 502 bad gateway and Ngi..

Can enums be subclassed to add new elements?

I want to take an existing enum and add more elements to it as follows: enum A {a,b,c} enum B extends A {d} /*B is {a,b,c,d}*/ Is this possible in Java?..

VB.NET - If string contains "value1" or "value2"

I'm wondering how I can check if a string contains either "value1" or "value2"? I tried this: If strMyString.Contains("Something") Then End if This works, but this doesn't: If strMyString.Contain..

Determine function name from within that function (without using traceback)

In Python, without using the traceback module, is there a way to determine a function's name from within that function? Say I have a module foo with a function bar. When executing, is ther..

Unique constraint on multiple columns

CREATE TABLE [dbo].[user]( [userID] [int] IDENTITY(1,1) NOT NULL, [fcode] [int] NULL, [scode] [int] NULL, [dcode] [int] NULL, [name] [nvarchar](50) NULL, ..

Execution order of events when pressing PrimeFaces p:commandButton

I am trying to execute a JSF2 bean method and show a dialog box after completion of the method on click of PrimeFaces <p:commandButton>. <p:commandButton id="viewButton" value="View" act..

How do I make a composite key with SQL Server Management Studio?

How do I make a composite key with SQL Server Management Studio? I want two INT columns to form the identity (unique) for a table..

How to handle click event in Button Column in Datagridview?

I am developing a windows application using C#. I am using DataGridView to display data. I have added a button column in that. I want to know how can I handle click event on that button in DataGridVie..

Adding a directory to the PATH environment variable in Windows

I am trying to add C:\xampp\php to my system PATH environment variable in Windows. I have already added it using the Environment Variables dialog box. But when I type into my console: C:\>path it ..

What's the difference between a method and a function?

Can someone provide a simple explanation of methods vs. functions in OOP context?..

How can I stop the browser back button using JavaScript?

I am doing an online quiz application in PHP. I want to restrict the user from going back in an exam. I have tried the following script, but it stops my timer. What should I do? The timer is stored in..

Convert a list of objects to an array of one of the object's properties

Say I have the following class: public class ConfigItemType { public string Name { get; set; } public double SomeOtherThing { get; set; } } and then I make a list of the following classes (..

How can I change a button's color on hover?

I need to change the color of a button on hover. Here is my solution, but it doesn't work. a.button { display: -moz-inline-stack; display: inline-block; width: 391px; height: 62px; ba..

Check if xdebug is working

Without installing a texteditor or an IDE, is it possible to test if xdebug is working, i.e. if it can debug php code? The only part xdebug comes up in phpinfo() is the following: Additional .ini..

Parse JSON from JQuery.ajax success data

I am having trouble getting the contents of JSON object from a JQery.ajax call. My call: $('#Search').click(function () { var query = $('#query').valueOf(); $.ajax({ url: '/Products/S..

Android: findviewbyid: finding view by id when view is not on the same layout invoked by setContentView

I have an activity MyActivity that extends from MapActivity. In the .xml file containing the layout I can only include the MapView < xmlns:android="http://schema..

How to suppress "error TS2533: Object is possibly 'null' or 'undefined'"?

I have a type: type tSelectProtected = { handleSelector?: string, data?: tSelectDataItem[], wrapperEle?: HTMLElement, inputEle?: HTMLElement, listEle?: HTMLElement, resultEle?: HTMLEleme..

Convert double to BigDecimal and set BigDecimal Precision

In Java, I want to take a double value and convert it to a BigDecimal and print out its String value to a certain precision. import java.math.BigDecimal; public class Main { public static void ..

Find the index of a char in string?

I have a string that goes like "abcdefg..." I would like to find the index where the letter d is at, so I can get the number 3. I managed to do it by looping through each letter in the string, but t..

Convert/cast an stdClass object to another class

I'm using a third party storage system that only returns me stdClass objects no matter what I feed in for some obscure reason. So I'm curious to know if there is a way to cast/convert an stdClass obje..

How do I perform HTML decoding/encoding using Python/Django?

I have a string that is HTML encoded: '''&lt;img class=&quot;size-medium wp-image-113&quot;\ style=&quot;margin-left: 15px;&quot; title=&quot;su1&quot;\ src=&quot;h..

load Js file in HTML

My first PhoneGap application includes 2 HTML files. The first one is named index.html which uses index.js. This file will display a list item. When I click an item in that list, it brings me to det..

How to replace all double quotes to single quotes using jquery?

I need to replace all double quotes to single quotes using jquery. How I will do that. I tested with this code but its not working properly. newTemp = newTemp.mystring.replace(/"/g, "'");..

Find location of a removable SD card

Is there an universal way to find the location of an external SD card? Please, do not be confused with External Storage. Environment.getExternalStorageState() returns the path to the internal SD mou..

How to select the row with the maximum value in each group

In a dataset with multiple observations for each subject I want to take a subset with only the maximum data value for each record. For example, with a following dataset: ID <- c(1,1,1,2,2,2,2,3..

How to close the command line window after running a batch file?

I've got a batch file. After it finished running, i.e. all command lines have been executed, the cmd.exe window stays open. However, I'd like to have it closed right after the batch file finishes its ..

Create a dropdown component

I want to create a dropdown menu using Angular 2, but I'm not sure how to do it in the "Angular 2 way". I could create a dropdown component that is used like this: <dropdown> <li (click..

How to set the From email address for mailx command?

I am working on a KornShell (ksh) script running on a Solaris server that will send out an email when and error condition is met. I am sending the email via mailx. Question: How do I set the "From..

Can I automatically increment the file build version when using Visual Studio?

I was just wondering how I could automatically increment the build (and version?) of my files using Visual Studio (2005). If I look up the properties of say C:\Windows\notepad.exe, the Version tab g..

How to show full object in Chrome console?

var functor=function(){ //test } functor.prop=1; console.log(functor); this only show the function part of the functor, cannot show the properties of the functor in console...

Get unique values from a list in python

I want to get the unique values from the following list: ['nowplaying', 'PBS', 'PBS', 'nowplaying', 'job', 'debate', 'thenandnow'] The output which I require is: ['nowplaying', 'PBS', 'job', 'deba..

How to store a datetime in MySQL with timezone info

I have thousands of photos that were taken in Tanzania and I want to store the date and time each photo was taken in a MySQL database. The server, however, is located in the U.S. and I run into proble..

How do you migrate an IIS 7 site to another server?

I'm wondering what is the best practice for moving a website to another server (along with all settings, etc.) Manually recreate the site on the new server (not maintainable for obvious reasons) Cop..

How might I schedule a C# Windows Service to perform a task daily?

I have a service written in C# (.NET 1.1) and want it to perform some cleanup actions at midnight every night. I have to keep all code contained within the service, so what's the easiest way to accomp..

Abstract Class:-Real Time Example

Recently in a interview I was asked a very general question "what is abstract in java".I gave the definition and it was followed with some other question on abstract as what is abstract method and dif..

How to convert an iterator to a stream?

I am looking for a concise way to convert an Iterator to a Stream or more specifically to "view" the iterator as a stream. For performance reason, I would like to avoid a copy of the iterator in a ne..

How to get element value in jQuery

Why is it not returning value in 'li'? What am i doing wrong? $("#list li").click(function() { var selected = $(this).val(); alert(selected); }) ..

Submitting HTML form using Jquery AJAX

Im trying to submit a HTML form using AJAX using this example. My HTML code: <form id="formoid" action="studentFormInsert.php" title="" method="post"> <div> <label class="..

How to use RecyclerView inside NestedScrollView?

How to use RecyclerView inside NestedScrollView? RecyclerView content is not visible after setting adapter. UPDATE layout code updated. < xmlns:android="..

Checking Value of Radio Button Group via JavaScript?

This may seem silly and downright stupid but I can't seem to figure out how to check the value of a radio button group in my HTML form via JavaScript. I have the following code: <input type="radio..

Ternary operation in CoffeeScript

I need to set value to a that depends on a condition. What is the shortest way to do this with CoffeeScript? E.g. this is how I'd do it in JavaScript: a = true ? 5 : 10 # => a = 5 a = false ? ..

What does servletcontext.getRealPath("/") mean and when should I use it

In the following snippet: ServletContext context = request.getServletContext(); String path = context.getRealPath("/"); What does / in the method getRealPath() represent? When should I use it?..

Python function to convert seconds into minutes, hours, and days

Question: Write a program that asks the user to enter a number of seconds, and works as follows: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or eq..

how to implement login auth in node.js

I have this node server running : var server=http.createServer(function(request, responsehttp) { if (request.method == 'POST') { var body = ''; request.on('data', function (data) ..

Ruby on Rails: Clear a cached page

I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page in the development environment. This wouldn't be so much of an issue, but the cached page's a elements are incorrect. I ha..

How to replace multiple substrings of a string?

I would like to use the .replace function to replace multiple strings. I currently have string.replace("condition1", "") but would like to have something like string.replace("condition1", "").r..

How do I use cx_freeze?

I've created my file as instructed but I don't actually.. understand what to do next. Typing "python build" into the command line just gets a syntax error. So, what do I do? setup...

How to use select/option/NgFor on an array of objects in Angular2

I'm having trouble creating a select in Angular2 that is backed by an array of Objects instead of strings. I knew how to do it in AngularJS using ngOptions, but it doesn't seem to work in Angular2 (I'..

Query comparing dates in SQL

I have a table with dates that all happened in the month November. I wrote this query select id,numbers_from,created_date,amount_numbers,SMS_text from Test_Table where created_date <= '2013-04..

FirstOrDefault returns NullReferenceException if no match is found

Here is my code: string displayName = Dictionary.FirstOrDefault(x => x.Value.ID == long.Parse(options.ID)).Value.DisplayName; The code works fine if x.Value.ID matches options.ID. However, I get..

Check whether a path is valid in Python without creating a file at the path's target

I have a path (including directory and file name). I need to test if the file-name is a valid, e.g. if the file-system will allow me to create a file with such a name. The file-name has some unicode c..

Set Page Title using PHP

I wish to set the title of my webpage to - Whatever the post title. I want it to display the post title. The posts are submitted to a MySQL database and the title row is called "title". Any h..


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

JavaScript: Alert.Show(message) From ASP.NET Code-behind

I am reading this JavaScript: Alert.Show(message) From ASP.NET Code-behind I am trying to implement the same. So I created a static class like this: using System; using System.Collections.Generic; u..

How to animate GIFs in HTML document?

I have the following <img> tag in a static HTML document. <img src="foo.gif" alt="This is an animated gif image, but it does not move"/> After I set its src attribute to point to a .gif..

"Strict Standards: Only variables should be passed by reference" error

I am trying to get an HTML-based recursive directory listing based on code here: Code runs fine but it throws some errors: ..

C# Convert string from UTF-8 to ISO-8859-1 (Latin1) H

I have googled on this topic and I have looked at every answer, but I still don't get it. Basically I need to convert UTF-8 string to ISO-8859-1 and I do it using following code: Encoding iso = Enco..

SQL Error: 0, SQLState: 08S01 Communications link failure

I am getting this error (not so frequently): 2013-05-08 16:44:35,786 WARN ( [org.hibernate.util.JDBCExceptionReporter, logExceptions] - SQL Error: 0, SQLState: 08S01 2..

How do I find a particular value in an array and return its index?

Pseudo Code: int arr[ 5 ] = { 4, 1, 3, 2, 6 }, x; x = find(3).arr ; x would then return 2. ..

Increasing the Command Timeout for SQL command

I have a little problem and hoping someone can give me some advice. I am running a SQL command, but it appears it takes this command about 2 mins to return the data as there is a lot of data. But the ..

Split Java String by New Line

I'm trying to split text in a JTextArea using a regex to split the String by \n However, this does not work and I also tried by \r\n|\r|n and many other combination of regexes. Code: public void inse..

How do I return a char array from a function?

I've tried the following: char[10] testfunc() { char[10] str; return str; } ..

SQL Server NOLOCK and joins

Background: I have a performance-critical query I'd like to run and I don't care about dirty reads. My question is; If I'm using joins, do I have to specify the NOLOCK hint on those as well? For ins..

Running Selenium WebDriver python bindings in chrome

I ran into a problem while working with Selenium. For my project, I have to use Chrome. However, I can't connect to that browser after launching it with Selenium. For some reason, Selenium can't find..

add title attribute from css

How to add title='mandatory' from css to the following <label class='mandatory'>Name</label> .mandatory { background-image:url(/media/img/required.gif); background-position:top righ..

PHP - concatenate or directly insert variables in string

I am wondering, What is the proper way for inserting PHP variables into a string? This way: echo "Welcome ".$name."!" Or this way: echo "Welcome $name!" Both of these methods work in my PHP v5...

How do I detect the Python version at runtime?

I have a Python file which might have to support Python versions < 3.x and >= 3.x. Is there a way to introspect the Python runtime to know the version which it is running (for example, 2.6 or 3.2.x..

Difference between left join and right join in SQL Server

I know about joins in SQL Server. For example. There are two tables Table1, Table2. Their table structures are the following. create table Table1 (id int, Name varchar (10)) create table Table2 (..

Pass in an enum as a method parameter

I have declared an enum: public enum SupportedPermissions { basic, repository, both } I also have a POCO like this: public class File { public string Id { get; set; } public st..

Simple PHP Pagination script

I have rows of data coming from database, I would like to have a table with a simple pagination, what is the easiest way of doing it? I'd be glad if anyone could provide...

error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web'

I am trying to use JavaScriptSerializer in my application. I initially received Cannot find JavaScriptSerializer and I solved it by adding: using System.Web.Script.Serialization; But then t..

Linker command failed with exit code 1 - duplicate symbol __TMRbBp

Since I've updated to Xcode 8.1 I can't archive and also not run in Release mode (in debug mode its working). The error is that there are several "duplicate symbols for architecture arm64" and all are..

If statement with String comparison fails

I really don't know why the if statement below is not executing: if (s == "/quit") { System.out.println("quitted"); } Below is the whole class. It is probably a really stupid logic problem but..