Questions Tagged with #Mirah

Mirah is a statically typed programming language with ruby-like syntax. Mirah code can compile to Java bytecode.

Clean out Eclipse workspace metadata

I use multiple workspaces with Eclipse. I recently noticed that some of my workspaces have a lot of cruft in them from software packages that I installed and then later removed. As far as I can tell, ..

Where are the Properties.Settings.Default stored?

I thought I knew this, but today I'm being proven wrong - again. Running VS2008, .NET 3.5 and C#. I added the User settings to the Properties Settings tab with default values, then read them in usin..

Specific Time Range Query in SQL Server

I'm trying to query a specific range of time: i.e. 3/1/2009 - 3/31/2009 between 6AM-10PM each day Tues/Wed/Thurs only I've seen that you can get data for a particular range, but only for start t..

Origin null is not allowed by Access-Control-Allow-Origin

I have made a small xslt file to create an html output called weather.xsl with code as follows: <!-- DWXMLSource="http://weather.yahooapis.com/forecastrss?w=38325&u=c" --> <xsl:styleshee..

How can I create a small color box using html and css?

I have a picture on a html file/site and I want to add the list of available colors for that picture. I want to create very small boxes or dots, a small box for every color. How can I do this? Thank..

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods

When integrating the Apptentive iOS SDK via Cocoapods, I get the following errors: Undefined symbols for architecture i386: "_OBJC_CLASS_$_ATConnect", referenced from: objc-class-ref in AppDe..

Split a large pandas dataframe

I have a large dataframe with 423244 lines. I want to split this in to 4. I tried the following code which gave an error? ValueError: array split does not result in an equal division for item in np.s..

In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?

I am building a small chat application for friends, but unsure about how to get information in a timely manner that is not as manual or as rudimentary as forcing a page refresh. Currently, I am imple..

Convert java.util.Date to java.time.LocalDate

What is the best way to convert a java.util.Date object to the new JDK 8/JSR-310 java.time.LocalDate? Date input = new Date(); LocalDate date = ??? ..

Draw an X in CSS

I've got a div that looks like a orange square I'd like to draw a white X in this div somehow so that it looks more like Anyway to do this in CSS or is it going to be easier to just draw this in..

Disable XML validation in Eclipse

My Eclipse validates XML files every time I save a file and it takes a while to validate them. The project is created using gwt-maven-plugin. The XML files are not under any Source folder build path ..

What is the reason for a red exclamation mark next to my project in Eclipse?

I have a red exclamation mark over my project name in Eclipse, looking like this - . Does anyone know what this means and what I should I do about it?..

When to use 'raise NotImplementedError'?

Is it to remind yourself and your team to implement the class correctly? I don't fully get the use of an abstract class like this: class RectangularRoom(object): def __init__(self, width, height)..

Is the 'as' keyword required in Oracle to define an alias?

Is the 'AS' keyword required in Oracle to define an alias name for a column in a SELECT statement? I noticed that SELECT column_name AS "alias" is the same as SELECT column_name "alias" I am ..

pip3: command not found

I want to install Tensorflow following this instructions. https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation. But when I try this code on terminal, it returns an error...

C++ sorting and keeping track of indexes

Using C++, and hopefully the standard library, I want to sort a sequence of samples in ascending order, but I also want to remember the original indexes of the new samples. For example, I have a set, ..

Invalid URI: The format of the URI could not be determined

I keep getting this error. Invalid URI: The format of the URI could not be determined. the code I have is: Uri uri = new Uri(slct.Text); if (DeleteFileOnServer(uri)) { nn.BalloonTipText = s..

Convert int to string?

How can I convert an int datatype into a string datatype in C#?..

React Native fixed footer

I try to create react native app that looks like existing web app. I have a fixed footer at bottom of window. Do anyone have idea how this can be achieved with react native? in existing app it's simp..

Check if list<t> contains any of another list

I have a list of parameters like this: public class parameter { public string name {get; set;} public string paramtype {get; set;} public string source {get; set;} } IEnumerable<Param..

Convert a SQL query result table to an HTML table for email

I am running a SQL query that returns a table of results. I want to send the table in an email using dbo.sp_send_dbMail. Is there a straightforward way within SQL to turn a table into an HTML table? ..

Your content must have a ListView whose id attribute is 'android.R.id.list'

I have created an xml file like this: <?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" ..

How to do SELECT MAX in Django?

I have a list of objects how can I run a query to give the max value of a field: I'm using this code: def get_best_argument(self): try: arg = self.argument_set.order_by('-rating')[0].det..

Android ListView Divider

I have this code: <ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cashItemsList" android:cacheColorHint="#00000000" and..

If statements for Checkboxes

I wanted to know how to write if statements to see if one or another check box is checked or not. I have two check boxes. I wanted it to check to see if checkbox 1 is checked and checkbox 2 is null ..

Call javascript from MVC controller action

Can I call javascript function from MVC controller action (not from view page) and get return value? How? I need to make request to server from code (.cs) using javascript like here (but this is as..

Should I use pt or px?

What is the difference between pt and px in CSS? Which one should I use and why?..

AngularJS: factory $http.get JSON file

I am looking to develop locally with just a hardcoded JSON file. My JSON file is as follows (valid when put into JSON validator): { "contentItem": [ { "contentID" : "1", ..

Peak memory usage of a linux/unix process

Is there a tool that will run a command-line and report the peak RAM usage total? I'm imagining something analogous to /usr/bin/time..

How can I select an element by name with jQuery?

Have a table column I'm trying to expand and hide: jQuery seems to hide the td elements when I select it by class but not by element's name. For example, why does: $(".bold").hide(); // s..

How to resolve Error listenerStart when deploying web-app in Tomcat 5.5?

I've deployed an Apache Wicket web-application that uses Spring and Hibernate to my Tomcat 5.5 instance. When I navigate to the Tomcat Manager interface I see that the web-application I deployed is no..

Scala best way of turning a Collection into a Map-by-key?

If I have a collection c of type T and there is a property p on T (of type P, say), what is the best way to do a map-by-extracting-key? val c: Collection[T] val m: Map[P, T] One way is the followin..

Eloquent get only one column as an array

How to get only one column as one dimentional array in laravel 5.2 using eloquent? I have tried: $array = Word_relation::select('word_two')->where('word_one', $word_id)->get()->toArray(); ..

back button callback in navigationController in iOS

I have pushed a view onto the navigation controller and when I press the back button it goes to the previous view automatically. I want to do a few things when back button is pressed before popping th..

Where to find free public Web Services?

I want some usefull free public WebServices like Weather, Currency Converter, Mathematics etc. Please tell me where I can get them Thanks in advance!..

Measure the time it takes to execute a t-sql query

I have two t-sql queries using SqlServer 2005. How can I measure how long it takes for each one to run? Using my stopwatch doesn't cut it...

TypeError: 'bool' object is not callable

I am brand new to python. I got a error while not cls.isFilled(row,col,myMap): TypeError: 'bool' object is not callable Would you please instruct how to solve this issue? The first "if" check is f..

Create a function with optional call variables

Is there a way to create a parameter in a PowerShell function where you have to call it in order to have it considered? An example given by commandlet (the bold being what I want to do): Invoke-Comm..

Create a date time with month and day only, no year

I am creating a timer job in VS for sharepoint, and I want to create a Date object that only has a month and day. The reason for this is because I want this job to run annually on the specific date. ..

Cannot push to Git repository on Bitbucket

I created a new repository and I'm running into a strange error. I've used Git before on Bitbucket but I just reformatted and now I can't seem to get Git to work. After doing a commit, I had to add m..

Simple way to repeat a string

I'm looking for a simple commons method or operator that allows me to repeat some string n times. I know I could write this using a for loop, but I wish to avoid for loops whenever necessary and a sim..

Excel data validation with suggestions/autocomplete

Apologies for my low level of Excel understanding, maybe what I am looking to do is not possible. I have a list of 120 entries that I want to use as data validation. But instead of people having to..

Android: set view style programmatically

Here's XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/LightStyle" android:layout_width="fill_parent" android:layout_height="55dip" ..

Error :The remote server returned an error: (401) Unauthorized

I want get picture of internet and insert into word . I use this code . MainDocumentPart mainPart = wordprocessingDocument.MainDocumentPart; System.Net.WebRequest request = System.Net.HttpWebRe..

spark submit add multiple jars in classpath

I am trying to run a spark program where i have multiple jar files, if I had only one jar I am not able run. I want to add both the jar files which are in same location. I have tried the below but it ..

Remove/ truncate leading zeros by javascript/jquery

Suggest solution for removing or truncating leading zeros from number(any string) by javascript,jquery...

How to create a blank/empty column with SELECT query in oracle?

I want to generate an output with blank/empty column with a "Select" query in oracle. I'm able to achieve this with below sql query: SELECT CustomerName AS Customer, "" AS Contact FROM Customers; ..

Why does sed not replace all occurrences?

If I run this code in bash: echo dog dog dos | sed -r 's:dog:log:' it gives output: log dog dos How can I make it replace all occurrences of dog?..

How can I find the number of elements in an array?

I have an int array and I need to find the number of elements in it. I know it has something to do with sizeof but I'm not sure how to use it exactly...

How to set the color of "placeholder" text?

Is that possible to set the color of placeholder text ? <textarea placeholder="Write your message here..."></textarea> ..

TypeError: $ is not a function WordPress

I might have an error in a .js document in a theme I have purchase: $('.tagcloud a').wrap('<span class="st_tag" />'); I am trying to solve it but I am not a programmer so I don't know how. Th..

How to execute an external program from within Node.js?

Is it possible to execute an external program from within node.js? Is there an equivalent to Python's os.system() or any library that adds this functionality?..

How do you print in Sublime Text 2

Sublime Text 2 seems like a great editor. I just started using it a week ago in eval mode and it doesn't seem to have any printing functionality. This seems preposterous to me, but I can't find it an..

How to get a single value from FormGroup

I am aware I can get the values of a form using JSON.stringify(this.formName.value) however, I want to get a single value from the form. How do I go about doing that?..

Inheritance with base class constructor with parameters

Simple code: class foo { private int a; private int b; public foo(int x, int y) { a = x; b = y; } } class bar : foo { private int c; public bar(int a, in..

Checking for an empty field with MySQL

I've wrote a query to check for users with certain criteria, one being they have an email address. Our site will allow a user to have or not have an email address. $aUsers=$this->readToArray(' S..

What parameters should I use in a Google Maps URL to go to a lat-lon?

I would like to produce a url for Google Maps that goes to a specific latitude and longitude. Now, I generate a url such as this: http://maps.google.com/maps?z=11&t=k&q=58 41.881N 152 31.324W..

Unable to install pyodbc on Linux

I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in error: command 'gcc' failed with..

How to place div side by side

I have a main wrapper div that is set 100% width. Inside that i would like to have two divs, one that is fixed width and the other that fills the rest of the space. How do i float the second div to fi..

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0

I am getting the following error ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0 when trying to connect to my MySQL server. What I am doing..

Simplest way to set image as JPanel background

How would I add the backgroung image to my JPanel without creating a new class or method, but simply by inserting it along with the rest of the JPanel's attributes? I am trying to set a JPanel's bac..

Linking dll in Visual Studio

How can I add a .dll in Visual Studio 2010? I just cannot find the option there...

How to dismiss ViewController in Swift?

I am trying to dismiss a ViewController in swift by calling dismissViewController in an IBAction @IBAction func cancel(sender: AnyObject) { self.dismissViewControllerAnimated(false, completion:..

How to make an Asynchronous Method return a value?

I know how to make Async methods but say I have a method that does a lot of work then returns a boolean value? How do I return the boolean value on the callback? Clarification: public bool Foo(){ ..

Concat strings in a shell script

How can I concat strings in shell? Is it just... var = 'my'; var .= 'string'; ?..

retrieve data from db and display it in table in php .. see this code whats wrong with it?

$db = mysql_connect("localhost", "root", ""); $er = mysql_select_db("ram"); $query = "insert into names values('$name','$add1','$add2','$mail')"; $result = mysql_query($query); print "<p&..

Easy way to convert a unicode list to a list containing python strings?

Template of the list is: EmployeeList = [u'<EmpId>', u'<Name>', u'<Doj>', u'<Salary>'] I would like to convert from this EmployeeList = [u'1001', u'Karick', u'14-12-2020'..

How to cast Object to its actual type?

If I have: void MyMethod(Object obj) { ... } How can I cast obj to what its actual type is?..

How to check if multiple array keys exists

I have a variety of arrays that will either contain story & message or just story How would I check to see if an array contains both story and message? array_key_exists() only looks for th..

Truncating long strings with CSS: feasible yet?

Is there any good way of truncating text with plain HTML and CSS, so that dynamic content can fit in a fixed-width-and-height layout? I've been truncating server-side by logical width (i.e. a blindly..

Cannot find "Package Explorer" view in Eclipse

I opened a project in Eclipse, but found that I cannot switch to the package explorer by clicking Window->Show View. In the menu shown under Show View, I just could not find the item "Package Explore..

Convert NSArray to NSString in Objective-C

I am wondering how to convert an NSArray [@"Apple", @"Pear ", 323, @"Orange"] to a string in Objective-C...

Why Would I Ever Need to Use C# Nested Classes

I'm trying to understand about nested classes in C#. I understand that a nested class is a class that is defined within another class, what I don't get is why I would ever need to do this...

Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory

The problem Whenever I run my projects JUnit test (using JUnit 5 with Java 9 and Eclipse Oxygen 1.a) I encounter the problem that eclipse can't find any tests. The description Under the run configu..

swift How to remove optional String Character

How do I remove Optional Character let color = colorChoiceSegmentedControl.titleForSegmentAtIndex(colorChoiceSegmentedControl.selectedSegmentIndex) println(color) // Optional("Red") let imageURLS..

How to write std::string to file?

I want to write a std::string variable I am accepting from the user to a file. I tried using the write() method and it writes to the file. But when I open the file I see boxes instead of the string. ..

The default XML namespace of the project must be the MSBuild XML namespace

I cloned the ASP.NET Core SignalR Repo locally, and try opening the solution from within the following environment. IDE Microsoft Visual Studio Enterprise 2015 Version 14.0.25431.01 Update 3 Microso..

Transfer data from one HTML file to another

I'm new to HTML and JavaScript, what I'm trying to do is from an HTML file I want to extract the things that set there and display it to another HTML file through JavaScript. Here's what I've done so..

Center a DIV horizontally and vertically

Is there a way to CENTER A DIV vertically and horizontally but, and that is important, that the content will not be cut when the window is smaller than the content The div must have a background colo..

Java - What does "\n" mean?

I had created a 2-dimensional array in Java and I was looking for a way to print it out on the console so that I could confirm that the stuff I was making was correct. I found some code online that pe..

How do I set path while saving a cookie value in JavaScript?

I am saving some cookie values on an ASP page. I want to set the root path for cookie so that the cookie will be available on all pages. Currently the cookie path is /v/abcfile/frontend/ Please help..

What are good examples of genetic algorithms/genetic programming solutions?

Genetic algorithms (GA) and genetic programming (GP) are interesting areas of research. I'd like to know about specific problems you have solved using GA/GP and what libraries/frameworks you used if..

How to parse JSON in Java

I have the following JSON text. How can I parse it to get the values of pageName, pagePic, post_id, etc.? { "pageInfo": { "pageName": "abc", ..

What's the key difference between HTML 4 and HTML 5?

What are the key differences between HTML4 and HTML5 draft? Please keep the answers related to changed syntax and added/removed html elements...

Display only date and no time

In MVC razor, I am putting current date in the database like this.. model.Returndate = DateTime.Now.Date.ToShortDateString(); Since the database field is a datetime datatype and I am converting the..

What is the difference between Document style and RPC style communication?

Can somebody explain to me the differences between Document and RPC style webservices? Apart from JAX-RPC, the next version is JAX-WS, which supports both Document and RPC styles. I also understand d..

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES) Symfony2

I tried to create my DB with Symfony2 typing the command below: php app/console doctrine:create:database The result is: Could not create database for connection named jobeet SQLSTATE[280..

Add column to dataframe with constant value

I have an existing dataframe which I need to add an additional column to which will contain the same value for every row. Existing df: Date, Open, High, Low, Close 01-01-2015, 565, 600, 400, 450 N..

ES6 Class Multiple inheritance

I've done most of my research on this on BabelJS and on MDN (which has no information at all), but please feel free to tell me if I have not been careful enough in looking around for more information ..

Use URI builder in Android or create URL with variables

I'm developing an Android app. I need to build a URI for my app to make an API request. Unless there's another way to put a variable in a URI, this is the easiest way I've found. I found that you need..

Changing upload_max_filesize on PHP

I'm using PHP 5.3.0 and have encountered something that might be a bug (in which case I'll report it) or might be me - so I'm asking to make sure. When running this code: <?php ini_set('upload_ma..

How to present UIActionSheet iOS Swift?

How To Do UIActionSheet in iOS Swift? Here is my code for coding UIActionSheet. @IBAction func downloadSheet(sender: AnyObject) { let optionMenu = UIAlertController(title: nil, message: "Choose O..

How do ports work with IPv6?

Conventional IPv4 dotted quad notation separates the address from the port with a colon, as in this example of a webserver on the loopback interface: 127.0.0.1:80 but with IPv6 notation the address..

How do I print debug messages in the Google Chrome JavaScript Console?

How do I print debug messages in the Google Chrome JavaScript Console? Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the p..

Check if a string within a list contains a specific string with Linq

I have a List<string> that has some items like this: {"Pre Mdd LH", "Post Mdd LH", "Pre Mdd LL", "Post Mdd LL"} Now I want to perform a condition that checks if an item in the list contains a..

How much data / information can we save / store in a QR code?

I would like to use this script https://github.com/jeromeetienne/jquery-qrcode (or is there even a better solution?) What I like to do is "save" some small scripts or programs and even files like xml..

How can I sort a std::map first by value, then by key?

I need to sort a std::map by value, then by key. The map contains data like the following: 1 realistically 8 really 4 reason 3 reasonable 1 reasonably 1 reass..

Find the files that have been changed in last 24 hours

E.g., a MySQL server is running on my Ubuntu machine. Some data has been changed during the last 24 hours. What (Linux) scripts can find the files that have been changed during the last 24 hours? Pl..

In a Dockerfile, How to update PATH environment variable?

I have a dockerfile that download and builds GTK from source, but the following line is not updating my image's environment variable: RUN PATH="/opt/gtk/bin:$PATH" RUN export PATH I read that that ..

How can I make a jQuery UI 'draggable()' div draggable for touchscreen?

I have a jQuery UI draggable() that works in Firefox and Chrome. The user interface concept is basically click to create a "post-it" type item. Basically, I click or tap on div#everything (100% high ..

How to grant permission to users for a directory using command line in Windows?

How can I grant permissions to a user on a directory (Read, Write, Modify) using the Windows command line?..

How do I run a docker instance from a DockerFile?

I finally figured out how to get docker up and running. docker run --name my-forum-nodebb --link my-forum-redis:redis -p 80:80 -p 443:443 -p 4567:4567 -P -t -i nodebb/docker:ubuntu I linked it to ..

Eclipse - no Java (JRE) / (JDK) ... no virtual machine

I am trying to get Eclipse v3.5 (Galileo) to re-run on my computer - I have run it before with no problems, but now I keep getting this error: A Java Runtime Environment (JRE) or Java Develop..

How to force file download with PHP

I want to require a file to be downloaded upon the user visiting a web page with PHP. I think it has something to do with file_get_contents, but am not sure how to execute it. $url = "http://example...

How do I POST with multipart form data using fetch?

I am fetching a URL like this: fetch(url, { mode: 'no-cors', method: method || null, headers: { 'Accept': 'application/json, application/xml, text/plain, text/html, *.*', 'Content-Type'..

Reading a binary input stream into a single byte array in Java

The documentation says that one should not use available() method to determine the size of an InputStream. How can I read the whole content of an InputStream into a byte array? InputStream in; //assu..

What is an 'undeclared identifier' error and how do I fix it?

What are undeclared identifier errors? What are common causes and how do I fix them? Example error texts: For the Visual Studio compiler: error C2065: 'cout' : undeclared identifier For the GCC com..

VBA Excel 2-Dimensional Arrays

I was trying to find out how to declare a 2-Dimensional array but all of the examples I have found so far are declared with set integers. I'm trying to create a program that will utilize two 2-Dimens..

apache server reached MaxClients setting, consider raising the MaxClients setting

I am running centos 5.5 with 768mb ram. i keep getting server reached MaxClients setting, consider raising the MaxClients setting in the logs also apache runs really slow. when i look at cacti graphs ..

Find length of 2D array Python

How do I find how many rows and columns are in a 2d array? For example, Input = ([[1, 2], [3, 4], [5, 6]])` should be displayed as 3 rows and 2 columns...

ToString() function in Go

The strings.Join function takes slices of strings only: s := []string{"foo", "bar", "baz"} fmt.Println(strings.Join(s, ", ")) But it would be nice to be able to pass arbitrary objects which impleme..

How do I fix the indentation of selected lines in Visual Studio

In vim I can use = to reindent badly indented lines so foo; bar; baz; becomes foo; bar; baz; Is there an equivalent keyboard-shortcut for visual studio? Where can I find a list of such shortc..

What's the meaning of exception code "EXC_I386_GPFLT"?

What's the meaning of exception code EXC_I386_GPFLT? Does its meaning vary according to the situation? In that case, I'm referring to exception type EXC_BAD_ACCESS with exception code EXC_I386_GPFLT..

What is the difference between signed and unsigned int

What is the difference between signed and unsigned int?..

How to fix apt-get: command not found on AWS EC2?

I installed Ubuntu 12.04 on my instance and am trying to install packages using apt-get, but I am getting the following error: sudo: apt-get: command not found How do I fix this?..

How to make a flex item not fill the height of the flex container?

As you can see in the code below, the left div inside the flex container stretches to meet the height of the right div. Is there an attribute I can set to make its height the minimum required for hold..

Convert data.frame column format from character to factor

I would like to change the format (class) of some columns of my data.frame object (mydf) from charactor to factor. I don't want to do this when I'm reading the text file by read.table() function. An..

How to execute a program or call a system command from Python

How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?..

jQuery Change event on an <input> element - any way to retain previous value?

I've been searching around this morning and I'm not finding any simple solutions... basically, I want to capture a change in an input element, but also know the previous value. Here's a change event..

Change bar plot colour in geom_bar with ggplot2 in r

I have the following in order to bar plot the data frame. c1 <- c(10, 20, 40) c2 <- c(3, 5, 7) c3 <- c(1, 1, 1) df <- data.frame(c1, c2, c3) ggplot(data=df, aes(x=c1+c2/2, y=c3)) + geom..

JSR 303 Validation, If one field equals "something", then these other fields should not be null

I'm looking to do a little custom validation with JSR-303 javax.validation. I have a field. And If a certain value is entered into this field I want to require that a few other fields are not null. ..

SqlServer: Login failed for user

I've written a very simple JDBC login test program. And after all kinds of problems I've almost got it working. Almost, just can't seem to get past this "SQLServerException: Login failed for user..

Whether a variable is undefined

How do I find if a variable is undefined? I currently have: var page_name = $("#pageToEdit :selected").text(); var table_name = $("#pageToEdit :selected").val(); var optionResult = $("#pageToEditOpt..

What is a postback?

The best explanation I've found for a postBack is from Wiki. a postback is an HTTP POST to the same page that the form is on. While the article does explain how a second page was needed in ASP, but ..

Specifying Style and Weight for Google Fonts

I am using Google fonts in a few of my pages and hit a wall when trying to use variations of a font. Example: http://www.google.com/webfonts#QuickUsePlace:quickUse/Family:Open+Sans I am importing thr..

How do you align left / right a div without using float?

When doing something like this: <div style="float: left;">Left Div</div> <div style="float: right;">Right Div</div> I have to use an empty div with clear: both; which f..

MySQL - Rows to Columns

I tried to search posts, but I only found solutions for SQL Server/Access. I need a solution in MySQL (5.X). I have a table (called history) with 3 columns: hostid, itemname, itemvalue. If I do a sel..

C# Return Different Types?

I got something like this: public [What Here?] GetAnything() { Hello hello = new Hello(); Computer computer = new Computer(); Radio radio = new Radio(); return radio; or return c..

View content of H2 or HSQLDB in-memory database

Is there a way to browse the content of an H2 or an HSQLDB in-memory database for viewing? For example, during a debugging session with Hibernate in order to check when the flush is executed; or to ma..

Fastest way to remove first char in a String

Say we have the following string string data= "/temp string"; If we want to remove the first character / we can do by a lot of ways such as : data.Remove(0,1); data.TrimStart('/'); data.Substring..

Postgres "psql not recognized as an internal or external command"

For Postgres, I keep getting this error multiple times even though I have already set the location of the bin folder to the path variable in Windows 8. Is there something else I'm missing? (I can't p..

center aligning a fixed position div

I'm trying to get a div that has position:fixed center aligned on my page. I've always been able to do it with absolutely positioned divs using this "hack" left: 50%; width: 400px; margin-left:-200p..

TypeError: 'str' does not support the buffer interface

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

Constructors in Go

I have a struct and I would like it to be initialised with some sensible default values. Typically, the thing to do here is to use a constructor but since go isn't really OOP in the traditional sense..

Unable to connect to SQL Server instance remotely

I’m trying to access the SQL Server instance on my VPS from SQL Server Management Studio on my local machine. It’s not working (the error I’m getting is: A network-related or instance-specif..

How can I quantify difference between two images?

Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much loo..

Checking on a thread / remove from list

I have a thread which extends Thread. The code looks a little like this; class MyThread(Thread): def run(self): # Do stuff my_threads = [] while has_jobs() and len(my_threads) < 5: ..

Illegal character in path at index 16

I am getting the following error in RAD: java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base...... Could you please let me know what is ..

What is meant with "const" at end of function declaration?

I got a book, where there is written something like: class Foo { public: int Bar(int random_arg) const { // code } }; What does it mean?..

Remove leading zeros from a number in Javascript

Possible Duplicate: Truncate leading zeros of a string in Javascript What is the simplest and cross-browser compatible way to remove leading zeros from a number in Javascript ? e.g. If I h..

Font awesome is not showing icon

I am using Font Awesome and do not wish to add CSS with HTTP. I downloaded Font Awesome and included it in my code, yet Font Awesome is showing a bordered square box instead of an icon. Here is my cod..

Visual Studio setup problem - 'A problem has been encountered while loading the setup components. Canceling setup.'

I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to un..

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

jQuery counting elements by class - what is the best way to implement this?

What I'm trying to do is to count all of the elements in the current page with the same class and then I'm going to use it to be added onto a name for an input form. Basically I'm allowing users to cl..

Vuejs: v-model array in multiple input

I have an input text field with a v-model attached, and every time someone hits the "Add" button, another input text get added to the DOM with the same v-model attached. I thought I'd then get an arra..

How to add a jar in External Libraries in android studio

I am new to Android Studio. What I need to do is add a few jar files in the External Libraries below the < JDK > folder. If anyone has knowledge of how to do this, please help me...

Pass a simple string from controller to a view MVC3

I know this seems pretty basic, and it should be, but I cant find out where I am going wrong. (I hve read other articles with similar titles on SO, and other resources on the web but still cant figure..

Get HTML inside iframe using jQuery

Here is my situation. I have a file called iframe.html, which contains the code to for a image slideshow. The code is somewhat like <html> <head> <!-- Have added title and js fi..

How do I automatically update a timestamp in PostgreSQL

I want the code to be able to automatically update the time stamp when a new row is inserted as I can do in MySQL using CURRENT_TIMESTAMP. How will I be able to achieve this in PostgreSQL? CREATE TA..

How do you convert between 12 hour time and 24 hour time in PHP?

I have a time as a string, for example: $time = '5:36 pm'; I require this to be in 24 hour format (i.e. 17:36), however I don't know which functions I need to use to convert it. Please help...

Chrome sendrequest error: TypeError: Converting circular structure to JSON

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

Using client certificate in Curl command

Curl Command: curl -k -vvvv \ --request POST \ --header "Content-Type: application/json" \ --cert client.pem:password \ --key key.pem \ "https://test.com:8443/testing" I..

"While .. End While" doesn't work in VBA?

The code below is VBA for Excel. I am using the Visual Basic editor that comes with Excel 2007. Dim counter As Integer counter = 1 While counter < 20 counter = counter + 1 end while '<- t..

How to switch between python 2.7 to python 3 from command line?

I'm trying to find the best way to switch between the two python compilers, 2.7 to 3.3. I ran the python script from the cmd like this: python ex1.py Where do I set the "python" environment in t..

Increasing the timeout value in a WCF service

How do I increase the default timeout to larger than 1 minute on a WCF service?..

Returning JSON response from Servlet to Javascript/JSP page

I think (actually I KNOW!) I'm doing something wrong here I am trying to populate some values into HashMap and add each hasmap to a list which will be added to a JSON object: JSONObject json = new JS..

Do I need to compile the header files in a C program?

Sometimes I see someone compile a C program like this: gcc -o hello hello.c hello.h As I know, we just need to put the header files into the C program like: #include "somefile" and compile the C p..

mysqldump Error 1045 Access denied despite correct passwords etc

This is a tricky one, I have the following output: mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect When attempting to export my..

CSS table column autowidth

Given the following how do i make my last column auto size to its content? (The last column should autosize-width to the content. Suppose i have only 1 li element it should shrink vs. having 3 li elem..

Get single row result with Doctrine NativeQuery

I'm trying to get a single row returned from a native query with Doctrine. Here's my code: $rsm = new ResultSetMapping; $rsm->addEntityResult('VNNCoreBundle:Player', 'p'); $rsm->addFieldResult(..

TypeError: Router.use() requires middleware function but got a Object

There have been some middleware changes on the new version of express and I have made some changes in my code around some of the other posts on this issue but I can't get anything to stick. We had it..

How to remove square brackets from list in Python?

LIST = ['Python','problem','whatever'] print(LIST) When I run this program I get [Python, problem, whatever] Is it possible to remove that square brackets from output?..

Multiple rows to one comma-separated value in Sql Server

I want to create a table valued function in SQL Server, which I want to return data in comma separated values. For example table: tbl ID | Value ---+------- 1 | 100 1 | 200 1 | 300 1 | 400 ..

URL to load resources from the classpath in Java

In Java, you can load all kinds of resources using the same API but with different URL protocols: file:///tmp.txt http://127.0.0.1:8080/a.properties jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.c..

Python Error: "ValueError: need more than 1 value to unpack"

In Python, when I run this code: from sys import argv script, user_name =argv prompt = '>' print "Hi %s, I'm the %s script." % (user_name, script) I get this error: Traceback (most recent cal..

Read the package name of an Android APK

I need to get the package name of an Android APK. I have tried to unzip the APK and read contents of AndroidManifest.xml, but seems it's not a text file. How can I extract the APK's package name?..

DropDownList's SelectedIndexChanged event not firing

I have a DropDownList object in my web page. When I click on it and select a different value, nothing happens, even though I have a function wired up to the SelectedIndexChanged event. First, the act..

How to pass a datetime parameter?

How to pass UTC dates to Web API? Passing 2010-01-01 works fine, but when I pass a UTC date such as 2014-12-31T22:00:00.000Z (with a time component), I get a HTTP 404 response. So http://domain/api..

How to update specific key's value in an associative array in PHP?

I've a following associative array named $data Array ( [0] => Array ( [transaction_user_id] => 359691e27b23f8ef3f8e1c50315cd506 [transaction_no] => 195009..

Simple linked list in C++

I am about to create a linked that can insert and display until now: struct Node { int x; Node *next; }; This is my initialisation function which only will be called for the first Node: vo..

Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4

I wanna make web project using the Maven to import automatically all libraries that I need, so I chose "maven-archetype-webpp" after that I got this error on pom.xml file : Description Resource Pat..

How to create a fixed sidebar layout with Bootstrap 4?

I'm trying to create a layout like the screenshot using Bootstrap 4 but I'm having some problems with making the sidebar fixed and achieving this layout at the same time. Going with a basic example..

download a file from Spring boot rest service

I am trying to download a file from a Spring boot rest service. @RequestMapping(path="/downloadFile",method=RequestMethod.GET) @Consumes(MediaType.APPLICATION_JSON_VALUE) public ResponseEnti..

How to create JSON string in JavaScript?

window.onload = function(){ var obj = '{ "name" : "Raj", "age" : 32, "married" : false }'; var val = eval('(' + obj + ')'); alert( "name :..

Get all LI elements in array

How can i make JS select every LI element inside a UL tag and put them into an array? <div id="navbar"> <ul> <li id="navbar-One">One</li> <li id="navbar..

Convert a JSON String to a HashMap

I'm using Java, and I have a String which is JSON: { "name" : "abc" , "email id " : ["[email protected]","[email protected]","[email protected]"] } Then my Map in Java: Map<String, Object> retMap = new ..

How do I reset the scale/zoom of a web app on an orientation change on the iPhone?

When I start my app in portrait mode, it works fine. Then I rotate into landscape and it's scaled up. To get it to scale correctly for the landscape mode I have to double tap on something twice, firs..

How to initialize a nested struct?

I cannot figure out how to initialize a nested struct. Find an example here: http://play.golang.org/p/NL6VXdHrjh package main type Configuration struct { Val string Proxy struct { A..

Basic Authentication Using JavaScript

I am building an application that consumes the Caspio API. I am having some trouble authenticating against their API. I have spent 2-3 days trying to figure this out but it may be due to some understa..

Find a pair of elements from an array whose sum equals a given number

Given array of n integers and given a number X, find all the unique pairs of elements (a,b), whose summation is equal to X. The following is my solution, it is O(nLog(n)+n), but I am not sure whether..

XPath OR operator for different nodes

How can I do with XPath: //bookstore/book/title or //bookstore/city/zipcode/title Just //title won't work because I also have //bookstore/magazine/title p.s. I saw a lot of or examples but mainly..

Google drive limit number of download

I have obtain the download url via webContentLink (https://docs.google.com/a/onwardsct.com/uc?id=0ByvXJAlpPqQPYWNqY0V3MGs0Ujg&export=download) During testing, I try to download 28 times (testing) ..

Reimport a module in python while interactive

I know it can be done, but I never remember how. How can you reimport a module in python? The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I ..

Append value to empty vector in R?

I'm trying to learn R and I can't figure out how to append to a list. If this were Python I would . . . #Python vector = [] values = ['a','b','c','d','e','f','g'] for i in range(0,len(values)): ..

Getting a list of all subdirectories in the current directory

Is there a way to return a list of all the subdirectories in the current directory in Python? I know you can do this with files, but I need to get the list of directories instead...

How to add a downloaded .box file to Vagrant?

How do I add a downloaded .box file to Vagrant's list of available boxes? The .box file is located on an external drive. I tried running vagrant box add my-box d:/path/to/box, but Vagrant interprets ..

Change header text of columns in a GridView

I have a GridView which i programmatically bind using c# code. The problem is, the columns get their header texts directly from Database, which can look odd when presented on websites. So basically, i..

Eclipse - Failed to create the java virtual machine

I'm having issue with running my Eclipse with the following config: eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launc..

Convert seconds value to hours minutes seconds?

I've been trying to convert a value of seconds (in a BigDecimal variable) to a string in an editText like "1 hour 22 minutes 33 seconds" or something of the kind. I've tried this: String sequenceCa..

python plot normal distribution

Given a mean and a variance is there a simple function call which will plot a normal distribution?..

Max size of an iOS application

What is the maximum size of an iOS application? any constraints?..

Align contents inside a div

I use css style text-align to align contents inside a container in HTML. This works fine while the content is text or the browser is IE. But otherwise it does not work. Also as the name suggests it i..

80-characters / right margin line in Sublime Text 3

You can have 80-characters / right margin line in Netbeans, Text Mate and probably many, many more other IDEs. Is it possible to have it in Sublime Text 3 as well? Any option, plugin etc.?..

How to validate a credit card number

I just want to validate a credit card number in the JavaScript code. I have used a regular expression for digit numbers, but I don't know why it is not working! Here is my function as per below: fun..

Node package ( Grunt ) installed but not available

I'm trying to build a github jquery-ui library using grunt, but after running npm install I still can't run the command according to the readme file. It just gives No command 'grunt' found: james@ub..

How to input a string from user into environment variable from batch file

I want to prompt the user for some input detail, and then use it later as a command line argument...

Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

Because of the Twitter API 1.0 retirement as of June 11th 2013, the script below does not work anymore. // Create curl resource $ch = curl_init(); // Set url curl_setopt($ch, CURLOPT_URL, "http://..

Using NotNull Annotation in method argument

I just started using the @NotNull annotation with Java 8 and getting some unexpected results. I have a method like this: public List<Found> findStuff(@NotNull List<Searching> searchingLi..

SQLAlchemy insert or update example

In Python, using SQLAlchemy, I want to insert or update a row. I tried this: existing = db.session.query(Toner) for row in data: new = Toner(row[0], row[1], row[2]) It does not work. How do I..

How to add/subtract time (hours, minutes, etc.) from a Pandas DataFrame.Index whos objects are of type datetime.time?

I've got a DataFrame who's index is just datetime.time and there's no method in DataFrame.Index and datetime.time to shift the time. datetime.time has replace but that'll only work on individual item..