Questions Tagged with #Manytomanyfield

Manytomanyfield is a field of a model class in Django that defines many-to-many relationship

django - get() returned more than one topic

When I tried to relate an attribute with another one which has an M to M relation I received this error: get() returned more than one topic -- it returned 2! Can you guys tell me what that means..

How to convert Django Model object to dict with its fields and values?

How does one convert a Django Model object to a dict with all of its fields? All ideally includes foreign keys and fields with editable=False. Let me elaborate. Let's say I have a Django model like t..

django no such table:

I have models in Django set up as below. class Pupil(models.Model): forename = models.CharField(max_length=30) surname = models.CharField(max_length=30) dateofbirth = models.DateField() ..

What is the difference between null=True and blank=True in Django?

When we add a database field in django we generally write: models.CharField(max_length=100, null=True, blank=True) The same is done with ForeignKey, DecimalField etc. What is the basic difference i..

Creating a dynamic choice field

I'm having some trouble trying to understand how to create a dynamic choice field in django. I have a model set up something like: class rider(models.Model): user = models.ForeignKey(User) ..

What is `related_name` used for in Django?

What is the related_name argument useful for on ManyToManyField and ForeignKey fields? For example, given the following code, what is the effect of related_name='maps'? class Map(db.Model): membe..

Django ManyToMany filter()

I have a model: class Zone(models.Model): name = models.CharField(max_length=128) users = models.ManyToManyField(User, related_name='zones', null=True, blank=True) And I need to contruct a ..

How to add data into ManyToMany field?

I can't find it anywhere, so your help will be nice for me :) Here is that field: categories = models.ManyToManyField(fragmentCategory) FragmentCategory: class fragmentCategory(models.Model): ..

C# using Sendkey function to send a key to another application

I want to send a specific key (e.g. k) to another program named notepad, and below is the code that I used: private void SendKey() { [DllImport ("User32.dll")] static extern int SetForeground..

Float right and position absolute doesn't work together

I want a div to be always at the right of its parent div, so I use float:right. It works. But I also want it to not affect other content when inserted, so I use position:absolute. Now float:right do..

Lint: How to ignore "<key> is not translated in <language>" errors?

I can't compile/debug our Android app, because the localization files are not perfect yet. My IDE's validation tool Lint create errors saying: newCardsOrderVals is not translated in ar, bg, ca, c..

Use success() or complete() in AJAX call

I want to understand the AJAX call below, in terms of the complete() method; When I replace complete() with success(), I get an empty responseText just as with the AJAX error() method. On the other..

Google Maps Android API v2 Authorization failure

My steps: got SHA1 code from debug.keystore create app in google apis console enabled google map api v2 input SHA1;my.package.name get API key created AndroidManifest file: ..

How do I execute a MS SQL Server stored procedure in java/jsp, returning table data?

I am having difficulty executing a MS SQL Server stored procedure from Java/jsp. I wish to return a table set of data; the last line of the stored procedure is a regular select statement from a table..

Capture key press (or keydown) event on DIV element

How do you trap the keypress or key down event on a DIV element (using jQuery)? What is required to give the DIV element focus?..

How can I find out if an .EXE has Command-Line Options?

Suppose you have an .EXE and you want to check if it has Command-Line Options. How can one know if the .EXE has this ability. In my case I know that Nir Sofers WebBrowserPassView.exe has the ability t..

How to name an object within a PowerPoint slide?

So I know how to name a textbox, or a like object in PowerPoint with VB, but I was wondering if there was a way to name objects through the Ribbon (PowerPoint 2007). For instance, if I add a text box ..

Upload files from Java client to a HTTP server

I'd like to upload a few files to a HTTP server. Basically what I need is some sort of a POST request to the server with a few parameters and the files. I've seen examples of just uploading files, but..

Add animated Gif image in Iphone UIImageView

I need to load an animated Gif image from a URL in UIImageview. When I used the normal code, the image didn't load. Is there any other way to load animated Gif images?..

Detect enter press in JTextField

Is it possible to detect when someone presses Enter while typing in a JTextField in java? Without having to create a button and set it as the default...

How to rename JSON key

I have a JSON object with the following content: [ { "_id":"5078c3a803ff4197dc81fbfb", "email":"[email protected]", "image":"some_image_url", "name":"Name 1" }, { "_id":"5078c..

Simple way to calculate median with MySQL

What's the simplest (and hopefully not too slow) way to calculate the median with MySQL? I've used AVG(x) for finding the mean, but I'm having a hard time finding a simple way of calculating the media..

Split string based on a regular expression

I have the output of a command in tabular form. I'm parsing this output from a result file and storing it in a string. Each element in one row is separated by one or more whitespace characters, thus I..

Merge two HTML table cells

I'm creating a table in HTML and I'd like to have my top cell be the width of two. Here's a rough drawing: __________________________________________ | HEADER | | ..

How do I iterate over the words of a string?

I'm trying to iterate over the words of a string. The string can be assumed to be composed of words separated by whitespace. Note that I'm not interested in C string functions or that kind of charac..

Object of class mysqli_result could not be converted to string in

I am getting the error: Object of class mysqli_result could not be converted to string This is my code: $result = mysqli_query($con, "SELECT classtype FROM learn_users WHERE username='abcde'&qu..

Intent from Fragment to Activity

I was trying to go to another page using button, but it always fail. Here is my First Class with its XML: public class FindPeopleFragment extends Fragment { public FindPeopleFragment(){} @..

How to subtract days from a plain Date?

Is there an easy way of taking a olain JavaScript Date (e.g. today) and going back X days? So, for example, if I want to calculate the date 5 days before today...

How to call shell commands from Ruby

How do I call shell commands from inside of a Ruby program? How do I then get output from these commands back into Ruby?..

Formatting a float to 2 decimal places

I am currently building a sales module for a clients website. So far I have got the sale price to calculate perfectly but where I have come stuck is formatting the output to 2 decimal places. I am cu..

Number of processors/cores in command line

I am running the following command to get the number of processors/cores in Linux: cat /proc/cpuinfo | grep processor | wc -l It works but it does not look elegant. How would you suggest improve it..

Printing without newline (print 'a',) prints a space, how to remove?

I have this code: >>> for i in xrange(20): ... print 'a', ... a a a a a a a a a a a a a a a a a a a a I want to output 'a', without ' ' like this: aaaaaaaaaaaaaaaaaaaa Is it possib..

Creating the checkbox dynamically using JavaScript?

I am trying to create a checkbox dynamically using following HTML/JavaScript. Any ideas why it doesn't work? <div id="cb"></div> <script type="text/javascript"> var cbh = docume..

The type or namespace name 'System' could not be found

I have the following errors (and more) in all my views (*.cshtml) when opening my project in Visual Studio 2015 Professional. Error CS0246 The type or namespace name 'System' could not be found ..

Export DataTable to Excel with Open Xml SDK in c#

Sorry for my english please. I'm new in open xml sdk. My program have ability to export some data and DataTable to Excel file (template) In the template I insert the data to some placeholders. It's wo..

Using a Glyphicon as an LI bullet point (Bootstrap 3)

How can I change the bullet points in an HTML list and use the glyphicons that come with Bootstrap 3? So that: <ul> <li>...</li> <li>...</li> </ul> Disp..

UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 0: ordinal not in range(128)

I want to parse my XML document. So I have stored my XML document as below class XMLdocs(db.Expando): id = db.IntegerProperty() name=db.StringProperty() content=db.BlobProperty() ..

How to add Headers on RESTful call using Jersey Client API

Here is the Format for RESTful call: HEADERS: Content-Type: application/json;charset=UTF-8 Authorization: Bearer Rc7JE8P7XUgSCPogjhdsVLMfITqQQrjg REQUEST: GET https://api.example.com/1/r..

Input mask for numeric and decimal

I realized a software application management invoicing after having tested my program I noticed the following error: my table in sqlserver contains: price numeric (6,2) the user of my program enter pr..

How to send json data in the Http request using NSURLRequest

I'm new to objective-c and I'm starting to put a great deal of effort into request/response as of recent. I have a working example that can call a url (via http GET) and parse the json returned. The..

What are the differences between "=" and "<-" assignment operators in R?

What are the differences between the assignment operators = and <- in R? I know that operators are slightly different, as this example shows x <- y <- 5 x = y = 5 x = y <- 5 x <- y =..

Enforcing the type of the indexed members of a Typescript object?

I would like to store a mapping of string -> string in a Typescript object, and enforce that all of the keys map to strings. For example: var stuff = {}; stuff["a"] = "foo"; // okay stuff["b"] = "..

What does the ">" (greater-than sign) CSS selector mean?

For example: div > p.some_class { /* Some declarations */ } What exactly does the > sign mean?..

How can I insert new line/carriage returns into an element.textContent?

As silly as it may sound, I still haven't found an appropriate answer. Let's say I want to dynamically create a new DOM element and fill up its textContent/innerText with a JS string literal. The str..

Can you blur the content beneath/behind a div?

I'm creating a new web design in Photoshop at the moment, but I'd like to know if it's possible to blur the content beneath a div? I'd like to create a half transparent nav bar on my page that's fixe..

Multiple scenarios @RequestMapping produces JSON/XML together with Accept or ResponseEntity

I am working with Spring 4.0.7 About Spring MVC, for research purposes, I have the following: @RequestMapping(value="/getjsonperson", method=RequestMethod.GET, pro..

HTTP status code 0 - Error Domain=NSURLErrorDomain?

I am working on an iOS project. In this application, I am downloading images from the server. Problem: While downloading images I am getting Request Timeout. According to documentation HTTP ..

How to run a specific Android app using Terminal?

I installed Eclipse and Android SDK already. Everything is running fine. I want to install an .apk file so I follow the instruction already. But the problem is, when I start the emulator, it doesn't ..

What exactly does the "u" do? "git push -u origin master" vs "git push origin master"

I'm apparently terrible at using git, despite my best attempts to understand it. From kernel.org for git push: -u --set-upstream For every branch that is up to date or successfully pus..

Java IOException "Too many open files"

I'm doing some file I/O with multiple files (writing to 19 files, it so happens). After writing to them a few hundred times I get the Java IOException: Too many open files. But I actually have only ..

Conditionally change img src based on model data

I want to represent model data as different images using Angular but having some trouble finding the "right" way to do it. The Angular API docs on expressions say that conditional expressions are not..

What is pluginManagement in Maven's pom.xml?

This is a snippet of my pom file. .... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>mav..

Getting the difference between two repositories

How can we get the difference between two git repositories? The scenario: We have a repo_a and repo_b. The latter was created as a copy of repo_a. There have been parallel development in both the rep..

Redirect within component Angular 2

I have a simple method that at the end of it I want to redirect to another component: export class AddDisplay{ display: any; addPairTo(name: string, pairTo: string){ this.display = {}; t..

How do I change the root directory of an Apache server?

How can I change the document root of the Apache server? I basically want localhost to come from /users/spencer/projects directory instead of /var/www. I ended up figuring it out. Some suggested I ch..

Alert after page load

This is my script : <% if (TempData["Resultat"] != null){ %> <script type="text/javascript"> alert('<%: TempData["Resultat"]%>'); </script> <% } %> In this..

R numbers from 1 to 100

Possible Duplicate: How to generate a vector containing a numeric sequence? In R, how can I get the list of numbers from 1 to 100? Other languages have a function 'range' to do this. R's ra..

Oracle comparing timestamp with date

I have a timestamp field and I just want to compare the date part of it in my query in Oracle How do I do that, SELECT * FROM Table1 WHERE date(field1) = '2012-01-01' ..

Open a PDF using VBA in Excel

I'm trying to open all appropriate PDFs found in the same directory as my Excel workbook using VBA. I've added the Adobe Acrobat xx.x Type Library reference to the project. But when I try to create ..

How to serialize Object to JSON?

I need to serialize some objects to a JSON and send to a WebService. How can I do it using the org.json library? Or I'll have to use another one? Here is the class I need to serialize: public class P..

What is the difference between screenX/Y, clientX/Y and pageX/Y?

What is the difference between screenX/Y, clientX/Y and pageX/Y? Also for iPad Safari, are the calculations similar as on desktop—OR there is some difference because of viewport? It would be great..

printf with std::string?

My understanding is that string is a member of the std namespace, so why does the following occur? #include <iostream> int main() { using namespace std; string myString = "Press ENTER..

Difference between <? super T> and <? extends T> in Java

What is the difference between List<? super T> and List<? extends T> ? I used to use List<? extends T>, but it does not allow me to add elements to it list.add(e), whereas the List&..

Amazon Interview Question: Design an OO parking lot

Design an OO parking lot. What classes and functions will it have. It should say, full, empty and also be able to find spot for Valet parking. The lot has 3 different types of parking: regular, handic..

How do we check if a pointer is NULL pointer?

I always think simply if(p != NULL){..} will do the job. But after reading this Stack Overflow question, it seems not. So what's the canonical way to check for NULL pointers after absorbing all discu..

How do you see recent SVN log entries?

Typing svn log spits out an incredibly long, useless list on a command line. I have no idea why that is the default. If I wanted to read (or even could read) 300 entries on the terminal, I wouldn't mi..

Python's "in" set operator

I'm a little confused about the python in operator for sets. If I have a set s and some instance b, is it true that b in s means "is there some element x in s such that b == x is true"?..

What's the difference between ASCII and Unicode?

What's the exact difference between Unicode and ASCII? ASCII has a total of 128 characters (256 in the extended set). Is there any size specification for Unicode characters?..

redirect COPY of stdout to log file from within bash script itself

I know how to redirect stdout to a file: exec > foo.log echo test this will put the 'test' into the foo.log file. Now I want to redirect the output into the log file AND keep it on stdout i.e...

Redirect output of mongo query to a csv file

I am using MongoDB 2.2.2 for 32-bit Windows7 machine. I have a complex aggregation query in a .js file. I need to execute this file on the shell and direct the output to a CSV file. I ensure that the ..

How can I send an email by Java application using GMail, Yahoo, or Hotmail?

Is it possible to send an email from my Java application using a GMail account? I have configured my company mail server with Java app to send email, but that's not going to cut it when I distribute ..

What is the best collation to use for MySQL with PHP?

I'm wondering if there is a "best" choice for collation in MySQL for a general website where you aren't 100% sure of what will be entered? I understand that all the encodings should be the same, such ..

String.Format alternative in C++

I don't have much experience working with C++. Rather I have worked more in C# and so, I wanted to ask my question by relating to what I would have done in there. I have to generate a specific format ..

what is the difference between GROUP BY and ORDER BY in sql

When do you use which in general? Examples are highly encouraged! I am referring so MySql, but can't imagine the concept being different on another DBMS..

php.ini: which one?

I moved from my old apache to nginx and php 5.3.10. And when I tried to modify php.ini to suit my needs, I found there are 3 of them: $ locate php.ini /etc/php5/cgi/php.ini /etc/php5/cli/php.ini /et..

How to update the value of a key in a dictionary in Python?

I have a dictionary which represents a book shop. The keys represent the book title and values represent the number of copies of the book present. When books are sold from the shop,the number of copie..

Getting Error - ORA-01858: a non-numeric character was found where a numeric was expected

I am getting the error in the below sql: ORA-01858: a non-numeric character was found where a numeric was expected SELECT c.contract_num, CASE WHEN ( MAX (TO_CHAR (TO_D..

cannot open shared object file: No such file or directory

I met the share library not found on the head node of a cluster with torch. I have built the library as well as specify the correct path of the library while compiling my own program "absurdity" by g+..

What are enums and why are they useful?

Today I was browsing through some questions on this site and I found a mention of an enum being used in singleton pattern about purported thread safety benefits to such solution. I have never used enu..

Base64 encoding in SQL Server 2005 T-SQL

I'd like to write a T-SQL query where I encode a string as a Base64 string. Surprisingly, I can't find any native T-SQL functions for doing Base64 encoding. Does a native function exist? If not, wh..

Finding length of char array

I have some code as follows: int i=0; char a[7]={0x00,0xdc,0x01,0x04}; int len=0; len = sizeof(a); printf("The Length is : %d", len); Here I want to find the length of the array a in c? How can thi..

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

The following code: Class.forName("com.mysql.jdbc.Driver"); Connection m_connection = DriverManager.getConnection("jdbc:mysql://localhost","root","root"); Throws this exception on getConnection(): ..

JQuery window scrolling event?

I have an ad in my header and a fixed ad at the bottom of my page that is always there. I want the fixed ad to appear only if the user has scrolled under the header ad. I looked into the JQuery docume..

Where can I get a virtual machine online?

I am looking for some VPS/ Virtual machine which should be available all the time and I must be able to access it from any computer having internet. I know a few paid services but just wondering If I..

Android sample bluetooth code to send a simple string via bluetooth

I want to send a simple string data such as 'a' from an android device to other one via bluetooth. I looked sample bluetooth code in android sdk but it is so complex for me. I cannot understand how I ..

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

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

How to perform mouseover function in Selenium WebDriver using Java?

I want to do mouseover function over a drop down menu. When we hover over the menu, it will show the new options. I tried to click the new options using the xpath. But cannot click the menus directly...

"Sources directory is already netbeans project" error when opening a project from existing sources

I've installed NetBeans 6.9.1 and installed few updates for it. Then I've created a new project from existing sources. After a few changes I've closed it. And now I am having an error, when trying to..

Good PHP ORM Library?

Is there a good object-relational-mapping library for PHP? I know of PDO/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the doma..

Counting inversions in an array

I'm designing an algorithm to do the following: Given array A[1... n], for every i < j, find all inversion pairs such that A[i] > A[j]. I'm using merge sort and copying array A to array B and th..

How to convert FileInputStream to InputStream?

I just want to convert a FileInputStream to an InputStream, how can I do that? e.g FileInputStream fis = new FileInputStream("c://filename"); InputStream is = ?; fis.close(); ..

Cannot make a static reference to the non-static method

Building a multi-language application in Java. Getting an error when inserting String value from R.string resource XML file: public static final String TTT = (String) getText(R.string.TTT); This i..

Google Geocoding API - REQUEST_DENIED

Apparently I do not need a 'Maps API key' to use the 'Google Geocoding API' according to: http://code.google.com/apis/maps/documentation/geocoding/index.html However, I obtain this: { "status": "..

How to save SELECT sql query results in an array in C# Asp.net

I have wrote this query to get some results, if I want to save the results in an array what I have to do? I want to use the values which are in col1 and col2 in an IF statement, that's why I am think..

Retrieving parameters from a URL

Given a URL like the following, how can I parse the value of the query parameters? For example, in this case I want the value of def. /abc?def='ghi' I am using Django in my environment; is there a ..

How can I assign the output of a function to a variable using bash?

I have a bash function that produces some output: function scan { echo "output" } How can I assign this output to a variable? ie. VAR=scan (of course this doesn't work - it makes VAR equal the s..

Best practices for catching and re-throwing .NET exceptions

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a differen..

Which ORM should I use for Node.js and MySQL?

I'm rewriting a project to use Node.js. I'd like to keep using MySQL as the DB (even though I don't mind rewriting the schema). I'm looking for a simple-to-use, reasonable-performance ORM, which suppo..

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". in a Maven Project

I have a dependency for SLF4J. I am getting this error: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http:..

Run jar file in command prompt

How do we run a jar file in command prompt?..

Half circle with CSS (border, outline only)

I'm trying to create a circle with CSS, which looks exactly like on the following picture: ...with only one div: <div class="myCircle"></div> and by using only CSS definitions. No SV..

Detecting attribute change of value of an attribute I made

I created an attribute in HTML data-select-content-val and it is stuffed with information dynamically. Is there a way to detect when the attribute's value has changed? $(document).on("change", "div[..

How to check if the key pressed was an arrow key in Java KeyListener?

Can you help me refactor this code: public void keyPressed(KeyEvent e) { if (e.getKeyCode()==39) { //Right arrow key code } else if (e.getKeyCode()==37) { ..

Measuring code execution time

I want to know how much time a procedure/function/order takes to finish, for testing purposes. This is what I did but my method is wrong 'cause if the difference of seconds is 0 can't return the elap..

Gradle build without tests

I want to execute gradle build without executing the unit tests. I tried: $ gradle -Dskip.tests build That doesn't seem to do anything. Is there some other command I could use?..

JavaFX 2.1 TableView refresh items

I have this common issue, as it appears to be. My table view wont refresh my items after I reset them. I have checked the data and it's the new one. I tried multiple solution from internet but no su..

Is there a way to iterate over a range of integers?

Go's range can iterate over maps and slices, but I was wondering if there is a way to iterate over a range of numbers, something like this: for i := range [1..10] { fmt.Println(i) } Or is there..

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

How do browser cookie domains work?

Due to weird domain/subdomain cookie issues that I'm getting, I'd like to know how browsers handle cookies. If they do it in different ways, it would also be nice to know the differences. In other wo..

Hide Button After Click (With Existing Form on Page)

I am trying to hide a button (not inside form tags) after it has been clicked. Below is the existing code. All solutions I have tried either break the functionality or interfere with the form on the p..

Cookie blocked/not saved in IFRAME in Internet Explorer

I have two websites, let's say they're example.com and anotherexample.net. On anotherexample.net/page.html, I have an IFRAME SRC="http://example.com/someform.asp". That IFRAME displays a form for the ..

Adding CSRFToken to Ajax request

I need to pass CSRFToken with Ajax based post request but not sure how this can done in a best way. Using a platform which internally checking CSRFToken in request (POST request only) initially I was..

Convert string to ASCII value python

How would you convert a string to ASCII values? For example, "hi" would return 104105. I can individually do ord('h') and ord('i'), but it's going to be troublesome when there are a lot of letters...

MySQL foreach alternative for procedure

My problem is fairly simple. I have table sets that store product sets (more products looking like one on the outside - computer, mouse and keyboard for ex.) it's connected M:N using sets_products tab..

jquery find element by specific class when element has multiple classes

So I am working on something that wasn't well thought out in the build from the backend team. That leaves me with a document full of divs. What I am doing is rolling back from the element I need to ..

What data is stored in Ephemeral Storage of Amazon EC2 instance?

I am trying to stop a Amazon EC2 instance and get the warning message Warning: Please note that any data on the ephemeral storage of your instance will be lost when it is stopped. My Question ..

How do I store and retrieve a blob from sqlite?

I have used sqlite in c++, python and now (perhaps) in C#. In all of these I have no idea how to insert a blob into a table. How do I store and retrieve a blob in sqlite?..

How to detect when a youtube video finishes playing?

I am working on a site that has a ton of embedded youtube videos, the client wants to show a popup whenever a video stops splaying. I looked at the youtube api and there seems to be a way to detect w..

Invalid http_host header

I am trying to develop a website using Django framework and launched using DigitalOcean.com and deployed the necessary files into django-project. I had to include static files into Django-project and..

How do I import/include MATLAB functions?

I have some MATLAB functions defined in .m files and I'd like to import them into MATLAB (as in I'd like to be able to call them as I do a built-in function). How can I do this?..

How to open google chrome from terminal?

I'm trying to create an alias that opens google chrome to localhost. Port 80 in this case. I'd also really like to be able to be in any git directory and have it open that specific project in the br..

How to create a jQuery function (a new jQuery method or plugin)?

I know that in JavaScript the syntax is as follows: function myfunction(param){ //some code } Is there a way to declare a function in jQuery that can be added to an element? For example: $('#my_..

css3 text-shadow in IE9

Is there an easy way to have css3 text-shadow's working in IE9? At least a single text shadow would be great. I guess ideally IE8 is supported as well. I'm hoping there's a simple jquery plugin or ..

How can I list the scheduled jobs running in my database?

I am new to oracle. I need to get the scheduled jobs in my database. I queried DBA_SCHEDULER_JOBS, DBA_SCHEDULER_SCHEDULES, DBA_SCHEDULER_PROGRAMS, DBA_SCHEDULER_JOB_CLASSES, DBA_JOBS. But Ora..

How do I import a CSV file in R?

I have a .csv file in my workstation. How can I open that file in R and do statistical calculation?..

Get Today's date in Java at midnight time

I need to create two date objects. If the current date and time is March 9th 2012 11:30 AM then date object d1 should be 9th March 2012 12:00 AM date object d2 should contain the current dat..

How do I concatenate strings and variables in PowerShell?

Suppose I have the following snippet: $assoc = New-Object PSObject -Property @{ Id = 42 Name = "Slim Shady" Owner = "Eminem" } Write-Host $assoc.Id + " - "..

Select data between a date/time range

How do I select data between a date range in MySQL. My datetime column is in 24-hour zulu time format. select * from hockey_stats where game_date between '11/3/2012 00:00:00' and '11/5/2012 23:59:0..

WebSockets and Apache proxy : how to configure mod_proxy_wstunnel?

I have : Apache (v2.4) on port 80 of my server for www.domain1.com, with mod_proxy and mod_proxy_wstunnel enabled node.js + socket.io on port 3001 of the same server. Accessing www.domain2.com (wi..

How can I easily view the contents of a datatable or dataview in the immediate window

Sometimes I will be at a breakpoint in my code and I want to view the contents of a DataTable variable (or a DataTable in a DataSet). The quick watch doesn't give you a very clear view of the contents..

Retrieve WordPress root directory path?

How can I retrieve the path to the root directory in WordPress CMS?..

how to get the current working directory's absolute path from irb

I'm running Ruby on Windows though I don't know if that should make a difference. All I want to do is get the current working directory's absolute path. Is this possible from irb? Apparently from a..

Amazon S3 exception: "The specified key does not exist"

I am using the AmazonS3Client in an Android app using a getObject request to download an image from my Amazon S3 bucket. Currently, I am getting this exception: com.amazonaws.services.s3.model.Amazo..

How to determine whether a given Linux is 32 bit or 64 bit?

When I type uname -a, it gives the following output. Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux How can I know from this that the given OS is 32 or ..

Android Min SDK Version vs. Target SDK Version

When it comes to developing applications for Android, what is the difference between Min and Target SDK version? Eclipse won't let me create a new project unless Min and Target versions are the same!..

iterating through Enumeration of hastable keys throws NoSuchElementException error

I am trying to iterate through a list of keys from a hash table using enumeration however I keep getting a NoSuchElementException at the last key in list? Hashtable<String, String> vars = new ..

Losing Session State

I have an ASP.net application where Users aren't able to successfully complete certain actions, for reasons, I'm assuming, can only be related to losing their session (which is where I maintain their ..

Oracle PL Sql Developer cannot find my tnsnames.ora file

I have an Oracle tnsnames.ora file from my previous workplace. I want to pick it up with my newly installed PL SQL Developer on another computer. I have copied the file into ..ORACLE/product/11.2.0/cl..

How to send a HTTP OPTIONS request from the command line?

I tried to use cURL but it seems that by default (Debian) is not compiled with HTTPS support and I dont want to build it myself. wget seems to have SSL support but I found no information on how to ge..

Filtering DataGridView without changing datasource

I'm developing user control in C# Visual Studio 2010 - a kind of "quick find" textbox for filtering datagridview. It should work for 3 types of datagridview datasources: DataTable, DataBinding and Dat..

How do I tell if .NET 3.5 SP1 is installed?

How can I find out if SP1 has been installed on a server which has .NET 3.5?..

How to activate JMX on my JVM for access with jconsole?

How to activate JMX on a JVM for access with jconsole?..

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

Rounding numbers to 2 digits after comma

I have no idea how to do this? I'm adding comma numbers, result is of course always a number with way too many digits after the comma. anyone?..

Cutting the videos based on start and end time using ffmpeg

I tried to cut the video using the start and end time of the video by using the following command ffmpeg -ss 00:00:03 -t 00:00:08 -i movie.mp4 -acodec copy -vcodec copy -async 1 cut.mp4 By using t..

jQuery - simple input validation - "empty" and "not empty"

I have an input that I want to validate: <input type="text" id="input" /> And here's the JS: jQuery("#input").live('change', function() { if("#input:not(:empty)") { ..

How to transform currentTimeMillis to a readable date format?

I want to use currentTimeMillis twice so I can calculate a duration but I also want to display Time and Date in user readable format. I'm having trouble as currentTimeMillis is good for the calculatio..

Android translate animation - permanently move View to new position using AnimationListener

I have android translate Animation. I have an ImageView with random generated position (next1, next2). I am calling void every 3 seconds. It generates new position of the View and then make animation ..

Makefile ifeq logical or

How do you perform a logical OR using make's ifeq operator? e.g., I have (simplified): ifeq ($(GCC_MINOR), 4) CFLAGS += -fno-strict-overflow endif ifeq ($(GCC_MINOR), 5) CFLAGS += -fno-stric..

Convert String to equivalent Enum value

Is it possible for me to convert a String to an equivalent value in an Enumeration, using Java. I can of course do this with a large if-else statement, but I would like to avoid this if possible. Gi..

How to make an HTTP get request with parameters

Is it possible to pass parameters with an HTTP get request? If so, how should I then do it? I have found an HTTP post requst (link). In that example the string postData is sent to a webserver. I would..

Round up value to nearest whole number in SQL UPDATE

I'm running SQL that needs rounding up the value to the nearest whole number. What I need is 45.01 rounds up to 46. Also 45.49 rounds to 46. And 45.99 rounds up to 46, too. I want everything up one w..

How to use OrderBy with findAll in Spring Data

I am using spring data and my DAO looks like public interface StudentDAO extends JpaRepository<StudentEntity, Integer> { public findAllOrderByIdAsc(); // I want to use some thing like thi..

How to append in a json file in Python?

I have the a json file whose contents is {"67790": {"1": {"kwh": 319.4}}}. Now I create a dictionary a_dict which I need to append it into the json file. I tried the following but was not able to do i..

How to Check if value exists in a MySQL database

Suppose I have this table: id | name | city ------------------ 1 | n1 | c1 2 | n2 | c2 3 | n3 | c3 4 | n4 | c4 I want to check if the value c7 exists under the variable city or not. ..

Java Strings: "String s = new String("silly");"

I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this: String s = new String("silly"); Because it creates unnecessary String objec..

Python != operation vs "is not"

In a comment on this question, I saw a statement that recommended using result is not None vs result != None I was wondering what the difference is, and why one might be recommended over the oth..

Regex that accepts only numbers (0-9) and NO characters

I need a regex that will accept only digits from 0-9 and nothing else. No letters, no characters. I thought this would work: ^[0-9] or even \d+ but these are accepting the characters : ^,$,(,)..

Checking if a SQL Server login already exists

I need to check if a specific login already exists on the SQL Server, and if it doesn't, then I need to add it. I have found the following code to actually add the login to the database, but I want t..

Redirecting to a page after submitting form in HTML

I'm fairly new to coding in HTML. After hours of searching the internet for a way to do this, I failed and so I'm here. I was setting up a CSRF Proof of concept page here, I want it to redirect to ano..

Slack URL to open a channel from browser

This iTunes URL will open The Hitchhiker's Guide to the Galaxy in your iTunes: itmss://itunes.apple.com/us/audiobook/hitchhikers-guide-to-galaxy/id315596797 This Spotify URL will open ALL by the..

Remove Fragment Page from ViewPager in Android

I'm trying to dynamically add and remove Fragments from a ViewPager, adding works without any problems, but removing doesn't work as expected. Everytime I want to remove the current item, the last on..

How to download a Nuget package without nuget.exe or Visual Studio extension?

How can I download a NuGet package? I don't have the NuGet Visual Studio extension or the command line program nuget.exe. How can I download the .nupack file from the web? As I understand I will be ab..

Print debugging info from stored procedure in MySQL

Is there a way in MySQL to print debugging messages to stdout, temptable or logfile? Something like: print in SQLServer DBMS_OUTPUT.PUT_LINE in Oracle ..

Change background color of edittext in android

If I change the background color of my EditText using the below code, it looks like the box is shrunken and it doesn't maintain the ICS theme of a blue bottom border that exists for a default EditText..

What is the official "preferred" way to install pip and virtualenv systemwide?

Is it this, which people seem to recommend most often: $ sudo apt-get install python-setuptools $ sudo easy_install pip $ sudo pip install virtualenv Or this, which I got from http://www.pip-instal..

How to use 'git pull' from the command line?

We were using a build script to automate our publishing process and it was working with SVN but now we are using Git and need to do some command line operations to pull from our remote repository. I ..

How to convert string to string[]?

How to convert string type to string[] type in C#?..

Make div 100% Width of Browser Window

I'm trying to make one of my containers 100% of the width of the screen. Here is my SASS body, html { width: 100%; height: 100%; padding: 0; margin: 0; } #neo_wrapper { width..

How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

I have imported maven project in STS, when I run update update project I receive: "Updating Maven Project". Unsupported IClasspathEntry kind=4 Is there a workaround for this?..

How can I remove an SSH key?

I currently have an old SSH key uploaded on a server. The problem is I lost my ~/.ssh directory (with the original id_rsa and id_rsa.pub files). Consequently, I want to remove the old SSH key directly..

Most efficient way to check for DBNull and then assign to a variable?

This question comes up occasionally, but I haven't seen a satisfactory answer. A typical pattern is (row is a DataRow): if (row["value"] != DBNull.Value) { someObject.Member = row["value"]; ..

Finding first blank row, then writing to it

I need to find the first blank row in a workbook and write information to (row, 1) and (row, 2). I think I'm currently pretty stuck... Function WriteToMaster(num, path) As Boolean 'Declare variables..

How do you run your own code alongside Tkinter's event loop?

My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely,..

How to enter quotes in a Java string?

I want to initialize a String in Java, but that string needs to include quotes; for example: "ROM". I tried doing: String value = " "ROM" "; but that doesn't work. How can I include "s within a str..

How to find keys of a hash?

I know in javascript Objects double as hashes but i have been unable to find a built in function to get the keys var h = {a:'b',c:'d'}; I want something like var k = h.keys() ; // k = ['a','c'];..

Scrolling to an Anchor using Transition/CSS3

I have a series of links which are using an anchor mechanism: <div class="header"> <p class="menu"><a href="#S1">Section1</a></p> <p class="menu"><a hre..

How can I count the number of characters in a Bash variable

How can I count all characters in a bash variable? For instance, if I had "stackoverflow" the result should be "13" ..

What does "dereferencing" a pointer mean?

Please include an example with the explanation...

Python 2: AttributeError: 'list' object has no attribute 'strip'

I have a small problem with list. So i have a list called l: l = ['Facebook;Google+;MySpace', 'Apple;Android'] And as you can see I have only 2 strings in my list. I want to separate my list l by '..

Powershell: A positional parameter cannot be found that accepts argument "xxx"

I am trying to understand what this error actually means. So far a search of similar help requests for this error range from missing parameters, missing pipes, use of single or multi-lines, and also c..

Scroll to bottom of div?

I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom without much luck. I am wrapping everything in this div: #scroll { height:400px; overflow:sc..

How to duplicate a git repository? (without forking)

I have two repositories, and I need to copy whole of one onto the other empty one which has different access levels from the first one. The copy and the mother repository should not be linked together..

Is there any good dynamic SQL builder library in Java?

Anyone knows some good SQL builder library for Java like Squiggle (not maintained anymore it seems). Preferably, a project in active development. Preferably with syntax like Zend_Db_Select, something..

Httpd returning 503 Service Unavailable with mod_proxy for Tomcat 8

I'm trying to integrate Tomcat with Apache. My aim is to redirect all the requests with http://localhost/myapp to http://localhost:8080 I followed this guide: http://tomcat.apache.org/tomcat-8.0-doc/..

Plotting dates on the x-axis with Python's matplotlib

I am trying to plot information against dates. I have a list of dates in the format "01/02/1991". I converted them by doing the following: x = parser.parse(date).strftime('%Y%m%d')) which gives 19..

Combine two arrays

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

LogisticRegression: Unknown label type: 'continuous' using sklearn in python

I have the following code to test some of most popular ML algorithms of sklearn python library: import numpy as np from sklearn import metrics, svm from sklearn.linear_model ..

iPhone hide Navigation Bar only on first page

I have the code below that hides and shows the navigational bar. It is hidden when the first view loads and then hidden when the "children" get called. Trouble is that I cannot find the event/action..

Android center view in FrameLayout doesn't work

I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text I want to center both in the FrameLayout but I can't manage to do it..

In Postgresql, force unique on combination of two columns

I would like to set up a table in PostgreSQL such that two columns together must be unique. There can be multiple values of either value, so long as there are not two that share both. For instance: ..

Spring @Transactional read-only propagation

I'm experimenting with using the command pattern to allow my web layer to work with Hibernate entities within the context of a single transaction (thus avoiding lazy loading exceptions). I am, however..

g++ undefined reference to typeinfo

I just ran across the following error (and found the solution online, but it's not present in Stack Overflow): (.gnu.linkonce.[stuff]): undefined reference to [method] [object file]:(.gnu.link..

How can I tell jackson to ignore a property for which I don't have control over the source code?

Long story short, one of my entities has a GeometryCollection that throws an exception when you call "getBoundary" (the why of this is another book, for now let's say this is the way it works). Is t..

How to click an element in Selenium WebDriver using JavaScript

I have the following HTML: <button name="btnG" class="gbqfb" aria-label="Google Search" id="gbqfb"><span class="gbqfi"></span></button> My following code for clicking "Googl..

HTML Agility pack - parsing tables

I want to use the HTML agility pack to parse tables from complex web pages, but I am somehow lost in the object model. I looked at the link example, but did not find any table data this way. Can I us..

Remove empty space before cells in UITableView

I am currently trying to put a UITableView in a different location rather than at the top of my view controller. With this said, it is trying to add the header in the top to account for the navigation..

How can I combine two commits into one commit?

I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. The command git merge --squash sounds promising, but when I run git merge -..

JQuery Parsing JSON array

I have a JSON output like the following: ["City1","City2","City3"] I want to get each of the city names, how can i do this? $.getJSON("url_with_json_here",function(json){ }); EDIT: $.getJSON('..

AWS S3 - How to fix 'The request signature we calculated does not match the signature' error?

I have searched on the web for over two days now, and probably have looked through most of the online documented scenarios and workarounds, but nothing worked for me so far. I am on AWS SDK for PHP V..

Babel 6 regeneratorRuntime is not defined

I'm trying to use async, await from scratch on Babel 6, but I'm getting regeneratorRuntime is not defined. .babelrc file { "presets": [ "es2015", "stage-0" ] } package.json file "devDependenc..

MySQL CURRENT_TIMESTAMP on create and on update

I want to define table which will have 2 TIMESTAMP fields, someting like this: CREATE TABLE `msgs` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `msg` VARCHAR(256), `ts_create` TIMESTAMP DEFAULT..

What is the unix command to see how much disk space there is and how much is remaining?

I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info...

How to push both value and key into PHP array

Take a look at this code: $GET = array(); $key = 'one=1'; $rule = explode('=', $key); /* array_push($GET, $rule[0] => $rule[1]); */ I'm looking for something like this so that: print_r($GET..

How to hide keyboard in swift on pressing return key?

I am using UITextfied while clicking on textfied keyboard appear but when i pressed the return key, keyboard is not disappearing. I used the following code: func textFieldShouldReturn(textField: UITe..

JQuery Ajax POST in Codeigniter

I have searched a lot of tutorials with POST methods and saw answered questions here too but my POST still doesn't work...I thought i should post it here if you guys see something that i don't! My js..

Nginx: Permission denied for nginx on Ubuntu

I am new to system administration. After installing nginx via puppet on Ubuntu I get the following output: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permiss..

In Bash, how to add "Are you sure [Y/n]" to any command or alias?

In this particular case, I'd like to add a confirm in Bash for Are you sure? [Y/n] for Mercurial's hg push ssh://[email protected]//somepath/morepath, which is actually an alias. Is there ..