id stringlengths 3 6 | prompt stringlengths 100 55.1k | response_j stringlengths 30 18.4k |
|---|---|---|
111206 | I'm creating a JSON webservice in CakePHP 1.3.
I want to be able to send AJAX requests from a different server to this webservice.
I know this is a cinch in Cake 2+, but I cannot for the life of me figure it out for v1.3. [Based on what I have found in the docs](http://book.cakephp.org/1.3/en/The-Manual/Core-Componen... | ```
header("Access-Control-Allow-Origin: *");
```
I know this is an old post but I jut want to answer this to help others. |
111279 | Some years ago, I picked up a Cannondale R3000 and moved all the components to my current bike as an exercise in bike building, never repeated (in fairness, the Cannondale fit me a little better but my beautiful 1998 Klein has such a sweet, sweet paint job...). I've been putting the frame on Craigslist off and on for a... | If you want to use it for "proper mountain biking" (however you define that) the answer is almost certainly no. You won't be able to fit wide enough tyres to give you decent grip, and punctures are likely to be a problem. Additionally, the geometry will be all wrong (if you put straight bars on it you'll probably feel ... |
111770 | I am using Webdriver in Ruby and I want to locate an element by its xpath, below is an example html:
```
<li id="ID1">
<label for="accountNumber"> </label>
123456
<span id="accountNumber"></span>
</li>
```
How do I get 123456 by xpath or ID?
I have tried below and it does not work:
```
element = ... | Your database files are probably in /var/lib/mysql. If you have THOSE files backed up, with EXACTLY the same version of mysql, same libraries, etc., then you could just restore them to another machine, and check the configuration for hostnames (MySQL only uses these IN the database though, for login security, iirc, so ... |
111798 | I am trying to repair a simple form which should be sending a simple email
I receive no javascript errors, but the ajax request is not fired. I seached a lot of answers here and in google, but none was helping my case.
Here the form html code
```
<form method="post" id="signupform">
<input type="text" name="name... | what does the `return false;` do after the success method? better remove that. furthermore you have semicolon after the `url: 'send.php';`it should be a normal comma.
Except that everything looks right.
For finding this kind of errors just check the console (i think) every browser enables you to use. There warnings... |
111806 | I am writing a code that creates a PowerPoint from Excel VBA, using data from the Excel document. In this document, i have a Sheet called IMG where there is a series of images named "Picture X", X being the number of the current picture. The code I have for copying these pictures and pasting them on their respective Po... | I would go for the **jsonlite** package in combination with the usage of **mapply**, a **transformation function** and data.table's **rbindlist**.
```
# data
raw_df <- data.frame(id = 1:2, json = c('{"user": "xyz2", "weightmap": {"P1":100,"P2":0}, "domains": ["a2","b2"]}', '{"user": "xyz1", "weightmap": {"P1":0,"P2":... |
111831 | I'm building an interface where **I need to process touch events**. In particular I would to be able to enable them only to a confined area in a fragment.
To better understand the problem, to respect the standards and for the goal of my application, **I planned the navigation drawer, which assumes the presence of many ... | I'm not sure if I understood your problem, but I will try to answer this. So to get touch events on fragment I would do this:
-in your fragment onCreateView:
```
View view = inflater.inflate(R.layout.fragment_test, container, false);
view.setOnTouchListener(new View.OnTouchListener() {
public boolean... |
111855 | Make a discord.js bot send ephemeral messages when a user uses a slash command, i have tried using `interation.editReply({content: "etc-etc", ephemeral:true});` ,
and anything that seemed reasonable but it seemed unsuccessful, please send an example how i would implement ephemeral message!
Edit:
My Slash command Help... | According to the [docs](https://discord.js.org/#/docs/) you need to add the [`ephemeral` option](https://discord.js.org/#/docs/discord.js/stable/typedef/InteractionReplyOptions) in your [`InteractionReplyOptions`](https://discord.js.org/#/docs/discord.js/stable/typedef/InteractionReplyOptions). You can also check out D... |
111921 | What is meant by "Enabling command line editing and vi and emacs editing modes"?
I know `vi` is an editor and have used it as well, but what and how is it related to command line editing bamboozles me. I am using bash shell and a Red Hat system essentially in command line mode to learn. | This refers to which keys to use to move move the cursor (and go to beginning of line, etc).
In `vi` mode use `h` (left), `j` (down), `k` (up), `l` (right)
In 'emacs mode use `Ctrl`+`F` (left), `Ctrl`+`N` (down), `Ctrl`+`P` (up), `Ctrl`+`B` (right) |
112055 | I have discover that the pushFrontViewController function in SWReveal.
I have added the UIViewController in the storyboard's Contact.
And I am trying covert to swift, but it do not work.
Here is the code:
```
override func tableView(tableView: UITabl... | SWRevealViewControllor is not that much hard. you should follow [this example](http://www.appcoda.com/sidebar-menu-swift/). I think its a perfect example you can try. It may help you ! |
112112 | Suppose I have a function that is continuous in every point of its domain, but its domain is only a subset of the real numbers (for example $\mathbb{R}-\{1\}$). Can I say that the function is continuous in $\mathbb{R}$? If not, what's the best way to express it? | Manos, I know the frustration, so let me make another attempt in a different direction. I will do a simple case, where $n=3,s=2$. So, we have $V(F\_1,F\_2)=X\subset\mathbb{P}^3$, a smooth, irreducible complete intersection curve. Let $I\subset\mathcal{O}\_{\mathbb{P}^3}$ be its ideal sheaf. Then, we have the Koszul res... |
112185 | I have two Windows 2008 R2 64-bit servers that are identical in pretty much every way. Each of them has an app that basically does a lot of calculations. The hard drive is not really accessed at all. The app is very much CPU bound.
Inexplicably, though, one of the servers is processing 1/3 less data than the other one... | Much like many IT problems you're going to have to divide the problem, measure and then divide again...
If you can I'd move the hard disk/s of the 'slow' server to the hardware of the 'fast' server, does the problem follow the disks? If yes then you've probably got an OS/filesystem/config issue, if not then maybe you'... |
112282 | I'm new to PHP. I tried creating a contact form using HTML and PHP. This contact form when submitted will send a mail to receiver.
**Below is the code the code for the contact form in HTML :**
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitio... | I have feel quiet difficult to see your full code.. Because you have added with css everything.. Please follow the following URL to create a form with validation
<http://www.freecontactform.com/email_form.php>
Please follow the steps and improve your code. |
112456 | I am attempting to center an image vertically inside of a parent fluid container.
[Here is a fiddle that outlines the problem.](https://jsfiddle.net/DTcHh/10247/)
```
<div class="container-fluid">
<div class="row">
<div class="col-md-2 col-sm-4 col-xs-4 col-xxs-4">
<div class="">
<a hre... | There are two ways of centring elements vertically within other elements, both of them are dependent upon styles of the parent container. One is to set the line height the same as the container height, and the other is to use table cells:
```css
img {
height: 25px;
width: 25px:
}
.container {
height: 50px;
... |
112529 | I use the following code to build a desired path for an XML file:
```
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
```
When executed from a Windows Forms application, it returns:
```
C:\Users\MyUsername\AppData\Roaming\...\Database.xml
```
When executed from within a Windows... | Only you know what the specific requirements are for this folder, but if it's to share data between multiple users, `ApplicationData` is the wrong choice:
>
> The directory that serves as a common repository for application-specific data for the current roaming user.
>
>
> A roaming user works on more than one comp... |
112557 | In C# its possibly to use [AsDynamic](http://blogs.msdn.com/b/davidebb/archive/2010/01/18/use-c-4-0-dynamic-to-drastically-simplify-your-private-reflection-code.aspx) to invoke a overloaded method on a subclass (example [here](https://github.com/gregoryyoung/m-r/blob/master/SimpleCQRS/Domain.cs)) thus allowing an abstr... | You could try something like:
```
list<string> iterator it = whichList.begin();
std::advance(it, i);
if(*it == "") { /* ... */ }
```
But I think you need to clearly define what you mean by "empty" here - you can't compare strings to 0.
The key point is that `list` doesn't support random access - because of its impl... |
112894 | I have a data frame with duplicated rows having one continuous variable column and 2-factor columns (0,1). The goal is to find the duplicated rows and identify them as replicates in a new column.
Here is the structure of the data frame
```
cont.var fact1 fact2
1 1.0 1 0
2 1.0 0 1
3 1.... | You can use `data.table::rleid`:
```r
library(dplyr)
df %>%
mutate(rleid = data.table::rleid(cont.var, fact1, fact2))
cont.var fact1 fact2 rleid
1 1.0 1 0 1
2 1.0 0 1 2
3 1.5 1 0 3
4 1.5 1 0 3
5 1.5 0 1 4
6 1.5 0 1 ... |
113268 | I'm trying to do three jQuery posts, set their results equals to a variable outside their scope and then after all three have returned, if they are succcessful, execute another function. Right now I'm doing nested callbacks and would like to move away from that if possible.
I looked at the documentation for jQuery pro... | using [$.when](http://api.jquery.com/jQuery.when/)
```
var postobj = {
id: workoutId
};
var getWorkout = $.post("./RowingWorkouts/GetWorkoutUsingId", postobj);
var getDiet = $.post("./Diet/GetDietUsingId", postobj);
var getFeedback = $.post("./RowingWorkouts/GetWorkoutFeedback", postobj);
// When all three are suc... |
113335 | I've got a search working for my application however it only works for the first page when I click next page I get the following error:
[](https://i.stack.imgur.com/R9mV1.png)
I've the following code in my vehicles controller:
```
def search
ve... | **Exact Problem:**
If you see your error, it is pointing to **`VehicleController#show`**
It is happening because `get 'vehicles/search'` is going to show action but not `search`
Show will be something like,
`get '/vehicles/:id', to: 'vehicles#show'`, so the search it is thiniking as Id and giving you error.
**Solu... |
113415 | A similar question was asked [here](http://social.msdn.microsoft.com/Forums/en/msbuild/thread/9d2e32c2-09bc-445d-9c0c-e5b75b808b34) without any answers. I have a cs project with a reference to MySql.Data.Dll with CopyLocal=true. When I run the msbuild from command line on one computer (Windows 7 64 bit), it works perfe... | MySql.Data.Dll may be in the GAC on the Win 2008 RC2 computer and not on the Win7 one, which could explains the different behaviours. |
113930 | I've checked a few other threads around the topic and search around, I am wondering if someone can give me a clear direction as to ***why*** should I consider NoSQL and ***which*** one (since there are quite a few of them each with different purposes)
* [Why NoSQL over SQL?](https://softwareengineering.stackexchange.c... | NoSQL isn't a very well defined term and all the solutions that run under this name have very different features, so a lot may be possible or not depending on what exactly you are planning to do with it.
Basically you could use some of the more general solutions like maybe MongoDB or Cassandra to simply replace your c... |
114030 | I have integrated the `Wepay payment gateway`. But I have facing a problem to pass `json object to wepay`. It always shows a incorrect json format. Please look at the below code.
```
$forca_a = array(
'debit_opt_in'=>true
);
$forca = json_encode($forca_a,JSON_FORCE_OBJECT);
$wepay_create_array = array(
'name' =>"... | The problem is that you are using the [Object.ToString()](https://msdn.microsoft.com/en-us/library/system.object.tostring(v=vs.110).aspx) method. This method, does not have arguments. If you want to convert it into a date, you might try this:
```
DateTime dt = DateTime.Parse(rdr.GetValue(4).ToString())
lblDate.Text = ... |
114234 | I'm trying to add values to a table using jQuery - unfortunately, I don't know how to get jQuery to add table cells to an existing row. For example:
```
$("<td><a href='#'>" + key + "</a></td>").click(function(e) {
e.preventDefault();
testset(key);
}).appendTo('#table1');
```
This adds cells to the end of th... | ```
.appendTo('#table1 #rowId');
```
Or you could do:
```
.appendTo('#table1 tr:nth-child(5)');
```
<http://api.jquery.com/nth-child-selector/> |
114570 | I have a table like this:
```
col | status
----+-------
1 | 0
1 | 1
2 | 1
2 | 2
3 | 1
3 | 0
```
I want to select only the row with having max status value. But also want to ignore if there is any 0 in status. So expected rows would be as follows (I am ignoring 1 and 3 for having status = 0).
```
c... | Use `HAVING` clause:
```
SELECT col, MAX(STATUS)
FROM tab
GROUP BY col
HAVING SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) = 0;
```
**[DBFiddle](http://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=f2b476c01046d253cacbd383a2852ae7)**
---
If your minimal value for `STATUS` is `0` then you could use:
```
SELECT col, MAX(STA... |
114586 | I've created a multilingual TYPO3 6.2 website with fluid and Gridelements.
I have a big Problem with the language translations (btw: same problems occur in TYPO3 7.6)
If I create an alternative page language with **no** content inside, I want to show the **default language**, in my case German.
Otherwise, if there **i... | Add 'includeRecordsWithoutDefaultTranslation = 1' to 'after.cObject.select.' The styles.content.get is some kind of shortcut for colPos 0 ... 3, but does not affect your TypoScript at this point. |
114696 | Example:
test.py
```
class test_class(object):
def display(self):
print "Hello"
```
lock1.py
```
from test import test_class
from time import sleep
obj = test_class()
while True:
obj.display()
sleep(1)
```
lock2.py
```
from test import test_class
obj = test_class()
# Raise error if instance ... | You can't apply a lock to this situation, since importing doesn't work this way. An imported module is only executed **once**, the first time it is imported. Subsequent imports only copy the existing reference from `sys.modules`. You will need to figure out what your actual problem is and ask about that instead. |
114871 | **This is my task**
```
journey = """Just a small tone girl
Leaving in a lonely whirl
She took the midnight tray going anywhere
Just a seedy boy
Bored and raised in South Detroit or something
He took the midnight tray going anywhere"""
```
Gross. Okay, so for this exercise, your job is to use Python's string replace... | Here is a sample way to replace words from text. you can use **python re** package.
please find the below code for your guidance.
```
import re
journey = """ just a small tone girl Leaving in a lonely whirl she took a
midnight tray going anywhere Just a seedy boy bored and raised in south
detroit or something He to... |
115278 | We have an Sharepoint Online 2013. Yammer Embed is added to our site. In Firefox and Chrome it works swell, in IE it does not work.
On IE:
When logging in the first time Yammer pops up an windows stating that it is trying to authenticate. Then a message appears stating that a webpage is trying to close the window. Wha... | We had a similar situation with office 365 and yammer embed in IE 11. Enabling Protected Mode for the Trusted Sites Zone (Internet Options > Security > Trusted Sites > Enable Protected Mode) solved it. Apparently Protected Mode used to be on by default in IE but no longer is. |
115455 | I am installing Pimcore 5 using Nginx 1.12.1, MYSQL 5.6, Redis 3.2.4, PHP 7.0, PHP 7.0 FPM with user set nginx and started at 127.0.0.1:9000 on Amazon Linux AMI
My virtual host setting is as
```
#
# A virtual host using mix of IP-, name-, and port-based configuration
#
upstream php-pimcore5 {
server 127.0.0.1:900... | `Contains` actually looks for substring in it, you need here is full match so you can try using `==` operator here like:
```
var project = db.Projects.FirstOrDefault(x => projectIds.Any(id=> id ==x.ProjectId))
```
This will now make sure to match the complete string value in it. |
115595 | i'm not searching to do something complicated , i just want to retrieve certain titles from a website , the first button was just for a test ... The thing is , even the "lala" text isn't showing up which means it doesn't enter in the loop in the first place ...
```
Public Class Form1
Function ElementsByClass(docum... | You are giving to onTouchTap void, because that's what this.doSomething(id) returns .
```
this.doSomething(id)
```
is executed the firs time MyOwnComponent is rendered.
Instead you should do this :
```
class MyOwnComponent extends Component {
doSomething = () => {
const {id} = this.props.object;
ale... |
115733 | I am using CodeIgniter and have a login system. I am still fairly new with php and I am wondering once the user is logged in, how I can access his/her data to use throughout the site? Right now I am trying to make it say welcome "username" but I dont know where the variables come from and how I should use them. Right n... | >
> Question: How do you access a logged-in user's data for use throughout the site?
>
>
>
The logged-in user specific data is usually stored in a session. For codeigniter, you can access session data using `$this->session->userdata('item');`, or for example `$this->session->userdata('username');`.
However, if yo... |
115773 | **Bug introduced after 10.0, in 10.3 or earlier and persisting in 13.2.1**
---
I'm fairly sure the following is a bug, and I would normally just report it to WRI. However, this is related to my answer to
[When using NDsolve, how to determine the positions of steady states?](https://mathematica.stackexchange.com/quest... | Here is a workaround suggested by the response I received from WRI:
```
{sol} = NDSolve[{x'[t] == -0.08 x[t], x[0] == 1.,
WhenEvent[Norm[{x'[t]}] < 0.0001, {x[t] -> 1.}]},
{x}, {t, 0, 200},
Method -> {"EquationSimplification" -> "Residual"}
]
Plot[x[t] /. sol, {t, 0, 200}]
```
](https://i.stack.imgur.com/RajQh.jpg)
I want a tutorial or i... | Welcome to stackoverflow and C++!
I tool the liberty of fixing some smaller issues with the code:
`<cmath>` is the proper C++ header, use that instead of `<math.h>` (the C header. C and C++ are different).
Do not build an early habit of `using namespace std`. Yes, it seems convenient, but [read here why you should n... |
116707 | We had to write a program that would perform rotation of elements in an array. The array size was entered by user, so it had to be in a sense, dynamic.
**Rotation or Circular Shifting**
Initial Array: `1 3 7 4 8 6 5 2 9`
Shift by: `4`
Final Array: `6 5 2 9 1 3 7 4 8`
Notice, in rotation, each elements position i... | I see some things that may help you improve your program.
Separate I/O from calculations
------------------------------
The program has three basic phases. First, it gets input, then it manipulates that input, and then it produces output. I would recommend putting the rotation code into a separate function.
Consider... |
116756 | As far as I am aware,
1. HDMI 2.1 does support 12-bit 4K 60fps, Also it doesn't use TMDS, rather FRL. Sends upto 48Gbps
2. GPUs can do calculation in fp32 and from some reference, I think that it can send 16bpc (48-bit per pixel deep color) (Assuming that it is a high end Quadro GPU) (fp16 had the capability to send 1... | The short answer is, cost. Higher bit-depths require more bandwidth at every point in the digital signal chain, from rendering unit, DRAM, link, all the way to the DACs that drive the panel.
Technology being what it is, as pipeline costs have come down, deeper color standards have been introduced, so panels have evolv... |
116762 | From the OPTPARSE library reference:
```
option_list = [
make_option("-f", "--filename",
action="store", type="string", dest="filename"),
make_option("-q", "--quiet",
action="store_false", dest="verbose"),
]
parser = OptionParser(option_list=option_list)
```
---
Like the... | You can give `argparse.ArgumentParser` a list of [parent parsers](http://docs.python.org/2.7/library/argparse.html#parents):
```
parent = argparse.ArgumentParser(add_help=False)
parent.add_argument('-f','--filename')
parent.add_argument('-q','--quiet',action='store_false',dest='verbose')
parser = argparse.ArgumentPar... |
117149 | I have two tables in my db, one that records exceptions, and another that records log messages.
I am leveraging the `SqlDependency` object to be notified when those tables change so that I can update my web dashboard. I got this working:
```
public IEnumerable<ElmahException> GetExceptions()
{
using (var ... | It is possible to concatenate another SqlStatement using a semicolon.
Here's a snippet from your code, with my changes.
```
[...]
connection.Open();
var queries = new [] {@"SELECT [application],[time_stamp],[logLevel],[logger],[message] FROM [dbo].[LogTable] ORDER BY [time_stamp] desc",
@"S... |
117837 | Let me begin with the disclaimer: I am a mathematician and not an electrical engineer. That being said, surely I am missing something simple. For classroom demonstrations in dynamical systems, I have been constructing analogue computers from op-amp circuits. Some of the circuits are of my own design, and some are copie... | Here's is my thoughts I think that implementation might fail is because in the paper you reference, the author's use the device AD632AD multiplier while you are using the AD633JN multiplier. A quick glance through the datasheet and we can see that the AD632AD multiplier performance total error has maximum of +/-1 while... |
117881 | I can't seem to get my head around the off-line minimum algo. Can someone explain it to me more?
Possibly with pseudo-code in a "near-code" fashion.
Say, for example, that I have the following sequence:
```
"5","4","6","E","1","7","E","E","3","2"
```
**What are the steps to return the smallest integer in the whole ... | If you want people to give you the code they wont.
In terms of this particular problem with the list you have given you can either
1) sort it then start from the begining to find the smallest integer
2) just run through every number
You can keep a temporary variable to keep the current lowest. Then step through and co... |
118016 | I've looked at a number of questions but can't find a **good** solution for a View-Based NSOutlineView
[Coloring NSTableView Text per row](https://stackoverflow.com/questions/2786362/coloring-nstableview-text-per-row)
[Change color of NSTableViewCell](https://stackoverflow.com/questions/2879154/change-color-of-nstabl... | You could subclass NSTableViewCell, and add a method to it which sets its color.
NSTableViewCell is already a subclass of NSView, so in your subclass, you would add the following method:
```
- (void)setBackgroundColor {
self.layer.backgroundColor = CGColorCreateGenericRGB(0, 0, 0, 1.0f); // or whatever color
}
... |
118042 | How can i check if user is logged in to umbraco from the view(.cshtml)?
I would also know how to check the users role.
`User.Identity.IsAuthenticated` always returns false.
```
if( User has role = "someRole" )
{
do stuff
}
```
Im using Umbraco version: 7.8.1 | If `User.Identity.IsAuthenticated` is false you are probably not calling `FormsAuthentication.SetAuthCookie(username, true);` after the user is successfully validated.
To check the authentication and roles use:
```
var userIsAuthenticated = Request.IsAuthenticated;
var userIsAdmin = User.IsInRole(role: "admin");
``` |
118690 | **Problem:** Consider the subfield $$E = \mathbb{Q} \big(\left\{\sqrt[n]{2} \mid n \in \mathbb{N} \setminus \left\{0\right\} \right\} \big)$$ of $\mathbb{R}$. Prove that $[E: \mathbb{Q}]$ is not finite.
**Attempt:** I proved that $E$ is algebraic over $\mathbb{Q}$. Because let $u \in E$. Then there is a $n \in \mathbb... | The good news is that looks like you have all the pieces of information required; you just need to arrange them into the correct order to make the argument.
As you noted, if $f$ is an irreducible polynomial of degree $n$ over some field $F$, then $F(\alpha)$ is a degree $n$ field extension of $F$, for any root $\alph... |
118827 | >
> **Possible Duplicate:**
>
> [Rails 3 deprecated methods and APIs](https://stackoverflow.com/questions/3648063/rails-3-deprecated-methods-and-apis)
>
>
>
What resources are out there (free or paid) that help walk you through the process of migrating a Ruby on Rails 2 application to Rails 3? I've seen some b... | Watch this <http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1> |
118865 | I have been trying to code a script to upload files only if all selected files match predefined type (pdf,doc or docx). For example if user select 3 files all of them need to match the criteria or none of the selected ones will be uploaded.
here is what I have so far:
```
<?php
for($i=0; $i<count($_FILES['file']['na... | You don't have an `.accordion` element ?
```
$('.accordion-group').on('show hide', function (n) {
$(n.target).siblings('.accordion-heading').find('.accordion-toggle i').toggleClass('icon-chevron-up icon-chevron-down');
});
```
[**FIDDLE**](http://jsfiddle.net/HwNYB/19/) |
119895 | Problem Background
------------------
I am currently working on a camel based ETL application that processes groups of files as they appear in a dated directory. The files need to be processed together as a group determined by the beginning of the file name. The files can only be processed once the done file (".flag")... | You can refer to a custom ProcessStrategy from the endpoint uri using the processStrategy option, eg file:xxxx?processStrategy=#myProcess. Notice how we prefix the value with # to indicate it should lookup it from the registry. So in Spring XML you just add a
<bean id="myProcess" ...> tag
In Java its probably easier t... |
120230 | So I've designed a program that runs on a computer, looks for particular aspects of files that have been plaguing us, and deletes the files if a flag is passed. Unfortunately the program seems to be almost-randomly shutting down/crashing. I say almost-randomly, because the program always exits after it deletes a file, ... | Firstly, it'll be hell of a lot easier to work out what's going on if you base your code around something like this...
```
for fname in glob.glob('*.php'):
with open(fname) as fin:
lines = fin.readlines()
if '$output' in lines[-4] or 'set_time_limit(0)' in lines[0]:
try:
os.remove(f... |
120276 | ```
numberrange returns [String value]
: numberrangesub
{
String numberRange = ($numberrangesub.text);
String [] v = numberRange.split(",");
if ( Integer.parseInt(v[0].trim()) < Integer.parseInt(v[1].trim())) $value =numberRange;
else throw new RecognitionException();
... | try reordering your chaining like:
```
Product.currency(0.69).all
```
I have not tested that, but you may have issue with other arbitrary conditions since your `:select` contains `*` |
120495 | I have a 1-0 matrix data from excel csv file for market basket analysis to apply association rule. However, program cannot find any rule. Probably, it reads the 0 and 1s as string. When I convert to them numeric, the program gives error and cannot generate any rules again.
How can I convert it to binary variables in o... | I had to add the type="javax.sql.DataSource" in the context of my application
```
<ResourceLink
name="jdbc/toto"
global="shared/jdbc/toto"
type="javax.sql.DataSource"
/>
```
You need to write the type in the ressource definition and in the context of your server.xml |
120730 | I have a class which has a property of generic type as given below. Type T can be any number (short, int, float ...)
```
public class EqualFilter <T> : Filter {
private T _value;
public override T Value {
get {
return _value;
}
set {
if (!EqualityComp... | You could try the following:
```
filter.Value = Convert.ChangeType(myTextBox.Text, filter.getFilterType());
```
This won't work if the conversion isn't defined though.
**Edit:**
I didn't notice your `Value` property was generic.
To make this work you could extend your filter object by something like this:
```
pub... |
120933 | I am creating a game in objective C, and I am stopped by a matter : I have a warning for passing multiple variables on @selector.
What I want to do, is call a method in my UIViewController but after a delay. So I try to make a first method, that call the other after delay like this :
```
-(void)AnimationCoinInitWith_x... | Here, your problem is that `NSInvocation` doesn't automagically set the offsets of arguments you need, and as all objective-c methods have two invisible arguments (`self` and `_cmd`), you must offset your argument indices by 2, not 1.
Another issue here is that you are failing to pass the arguments by reference, so yo... |
121088 | I am making a program that continually prompts the user to input numbers which are then stored in an array until the user provides a given response (E.g "continue"), where the program then displays the array in terminal.
I have been debugging my program and it is setting all values within the array to the last value f... | Aside from `goto`, which is pretty bad, the problem is the code loops through the entire array on every entry. It needs an integer variable that starts at 0 and increments with each new input, so it can set just that position each time.
```
public static void Main(string[] args)
{
Console.WriteLine("Begin");
d... |
122151 | I want to get only `hh:mm` from date.
How I can get this?
I have tried this :
```
CONVERT(VARCHAR(8), getdate(), 108)
``` | Just use the first 5 characters...?
```
SELECT CONVERT(VARCHAR(5),getdate(),108)
``` |
122371 | There are [many](http://www.alistapart.com/articles/howtosizetextincss) [articles](http://www.w3.org/TR/CSS2/fonts.html#font-size-props) and [questions](https://stackoverflow.com/questions/132685/font-size-in-css-or-em) about [percentage-sized vs other-sized](http://kyleschaeffer.com/best-practices/css-font-size-em-vs-... | My understanding is that when the font is set as follows
```
body {
font-size: 100%;
}
```
the browser will render the font as per the user settings for that browser.
The spec says that % is rendered
>
> relative to parent element's font size
>
>
>
<http://www.w3.org/TR/CSS1/#font-size>
In this case, I ta... |
122443 | How can I get specific data from **JSON**?
**JSON:**
```
[
{ "TotalPageCount": 66 },
{ "TotalTitleCount": 199 },
{ "Title": "cola" },
{ "Title": "elvis tom" },
{ "Title": "dvd" }
]
```
**Javascript Code:**
```
<script>
function updateTitlesArea() {
$.g... | When you do `x in data` you get every key of objects. So you have to do a simple check if it's `TotalPageCount` or `TotalTitleCount`. Like this;
```
<script>
function updateTitlesArea() {
$.getJSON(
"/lates/json/",
null,
function(data) {
var x, totalPageC... |
122497 | I am very new in .net programming. I have a database of product suppliers and there are some details about the suppliers. On the phonetextbox i want the phone number to be at least 8 digits. I coded this but doesn't work. Could you please help me?
```
'Dim numbers As Decimal = Convert.ToDecimal(PhoneTextBox.Text)
... | *(Note: This is probably the kind of information that should be added to the Wiki, as it is not so much a language question but the kind of thing that is subject to change over time. But, answerable, so...)*
If you're using the GNU make method to build (where `make -f makefile.boot` generates a makefile for you) then ... |
123523 | WARNING:I'm not asking for a better code, I'm asking for a shorter code for HackerRank just to learn what can be done to shorten it.
I'm newbie to Java and was trying out this FizzBuzz problem:
>
> Write a program that prints the numbers from 1 to 100. But for multiples of three print >“Fizz” instead of the number a... | What about something like:
```
for(int i=0;i++<100;System.out.println((i%3>0?"":"Fizz")+(i%5>0?i%3>0?i:"":"Buzz")))
```
**Warning:** this code is just an exercise of trying to *make the code shorter*. It is neither good or readable as normal code should try to be! |
123730 | Swift 4 / Xcode 9.3 / OS X 10.13.4 / iOS 11.3 & 11.2.6
I'm trying to build my app and I'm getting the above error message. I've checked the code over and over and over and I can't figure out why I'm getting this error. I'm not certain which part of the code you need to see, but here is the page I'm getting the error o... | First of all your container has to have `max-width` or `width` fixed. Second of all your `overflow` has to be `hidden` instead of `none`:
```css
.outer {
background-color: #FFAAAA;
display: flex;
flex-direction: row;
}
.inner {
background-color: #AAAAFF;
display: flex;
flex-direction: column;
m... |
123735 | OK, I must be overlooking something silly because I am unable to get my tabhost to display in my Activity class. I am getting the dreaded force close when I try to run the app. It will work if i extend TabActivity, **but I can't do that** [see edit below] because once I move the code from my prototype project its going... | I changed the class to
```
public class my_proto extends ActivityGroup
```
and change the following:
```
this.mHost = (TabHost) findViewById(R.id.tabhost);
this.mHost.setup(getLocalActivityManager());
```
It seems ok for me |
123971 | I'm using MVC3 and I have a model like this:
```
public class Foo
{
[Required]
[Range(0.01, 99.99)]
public double? f1{ get; set; }
}
```
And I want to ugnore javascript range validation, but keep the required javascript validation.
How can I do that? | I found solution, just removed some attributes from textbox:
```
$('#fieldId').removeAttr("data-val-range");
$('#fieldId').removeAttr("data-val-range-min");
$('#fieldId').removeAttr("data-val-range-max");
``` |
123984 | Do Perl, Python or Ruby run flawless on a 64bit Win7 system, or do you have to keep in mind pitfalls with integers and restriction on functions like I have read of on PHP? | Updated: Please have a look at <http://jsfiddle.net/p96denv4/2/>
Here's what you would do.
HTML
```
<div id="ifMobile1"></div>
```
CSS
```
#ifMobile1 {
background-image: url(/images/arts/IMG_1447m.png)
width: set your width ;
height: set your height ;
}
@media all and (max-width: 499px) {
#ifM... |
124006 | I have a very annoying problem, and it is bugging me for some time now, and I've tried everything to fix it, but I simply fail at doing so.
The problem is: I have a navigation which consists of many `<div>` elements inside `<div>`, which is inside another `<div>` and so on.
**Here is the code for my navigation:**
``... | You are floating the "dropdown" parts of the menu. And if all the rest of the content are also floating, all the things are in the same flow. Thus they get all "weird", even though this is not at all weird but rather exactly the expected behavior.
Instead, you should be using absolute positioning for the parts that yo... |
124024 | In AfterScenario method, I want to get the rows from table "Examples" in Scenario Outline, to get the values in it, and search that specific values in the database
I know that this can be achieved by using `Context.Scenario.Current`...
```
Context.Scenario.Current[key]=value;
```
...but for some reason I'd like to... | You can use [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event which fires on mobile browsers.
```
$('nav li.bg').on('click touchstart', function(){
return true;
});
```
[**More touch based events**](http://www.w3.org/TR/touch-events/) |
124134 | I have a table that is similar below.
```
| user_id | point_1 | point_2 | point_3
453123 1234 32 433
321543 1 213 321
```
My query is something like this:
```
$query = "SELECT * FROM my_table WHERE user_id = 12345 OR user_id = 987654321"
```
... | You could use an inline view as a rowsource for your query. To return a zero in place of a NULL (which would be returned by the outer join when no matching row is found in my\_table, you can use the `IFNULL` function.
e.g.
```
SELECT s.user_id
, IFNULL(t.point_1,0) AS point_1
, IFNULL(t.point_2,0) AS point_... |
125209 | I have a HTML table with few rows. [Demo](http://jsfiddle.net/R3Jy7/2/). I want to expand all collapsed rows on hitting "Ctrl + F" on keyboard.
Currently I using following piece of code for expand/collapse the required rows.
```
$('#resultDetails').on('click', '.toggle', function () {
var findChildren = function (tr... | Use `window.onkeyup` event:
```
window.onkeyup = function(event) {
if (e.ctrlKey && e.keyCode == 70) { // Your Code Here }; }
```
This [**fiddle**](http://jsfiddle.net/Karim_AG/PcR7v/) might help you |
125602 | >
> Given a list of points, find the shortest path that visits all points and returns to the starting point.
>
>
>
The [Travelling Salesman Problem](http://en.wikipedia.org/wiki/Travelling_salesman_problem) is well-known in the computer science field, as are many ways to calculate/approximate it. It's been solved ... | UntangleBot (formerly NiceBot)
==============================
A C++11 bot that uses two strategies.
At first it will try to "untangle" the path if possible, by detecting intersections between paths that are closer than 25 points (since untangling implies modifying all points in-between).
If the first strategy fa... |
125685 | I dont get it - I cannot align the `RelativeLayout` in the `ListView` - that is I want to center the `RelativeLayout` that holds and image and some textviews.
The `RelativeLayout` is still on the lefthand-side of the screen, though the listview-width should match the parent. What could be wrong?
Here's the xml, for t... | Use this as rootLayout of your item :-
```
<RelativeLayout
xmlns:android
="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout_os_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
>
```
Y... |
126029 | I am planning to drive over the [Curonian Spit](http://en.wikipedia.org/wiki/Curonian_Spit) from the Lithuanian side in 2013. I would love to travel on into the Russian side and visit Kaliningrad. Is there a border crossing on the Spit? If not, will I have to travel back up the Lithuanian side and find an alternative c... | As you say you're going to pass the border at Curonian Spit, you'll be in Klaipeda before this. @Marcel C. already said about the Nida station, but I want to add some information which can be useful for you and others who will view this question.
So, you have two different ways to get from Klaipeda to Curonian Spit an... |
126285 | Let `T={t|t=1,2,3..T}` be the time (sequence order number) For each group, at each `t` when/if a sequence occurs, we need to make sure the sequence (it is a number,let's assume it is `X`) is within the set of {`K-1,K,K+1`}, where `K` is the previous sequence number at `t-1`. For example, if the previous sequence number... | You can use the `diff` function to check if the adjacent sequence satisfies the condition:
```
library(dplyr)
dt %>% group_by(group) %>% summarize(label = all(abs(diff(seq)) <= 1))
# A tibble: 3 x 2
# group label
# <fctr> <lgl>
#1 a TRUE
#2 b FALSE
#3 c TRUE
```
Here is the corresponding `data.t... |
126398 | I am on Day 4 of trying to get an `autocomplete` field to fire in an RSpec test. Works super in the browser, it is just incredibly resistant to running in my request specs.
---
UPDATE: It looks like my RSpec/Capy scripts are running against the dev db instead of the test db. I'm using Pow, so I don't know what to set... | I had a similar problem and even though Capybara's documentation says that `have_selector` will wait for the AJAX call to complete, it did not work for me.
The following worked in my case:
```
def fill_in_autocomplete(field_label, field_class, options = {})
field_id = "##{page.evaluate_script("$('#{field_class}').a... |
126534 | I'm new to Julia and learning use of Map, reduce, filter.
It is becoming very hard for me to comprehend how it can replace for and while loops.
For ex for below code, I would like to replace for loop
```
function addMultiplesOf3And5(N::Int)
sumOfMultiples = 0
if(N == 3)
return sumOfMultiples + N
end
for i ... | To understand how you can replace your 'for loop + if block' code with 'map / reduce / filter' you need to know exactly how they work and why they might be chosen instead.
---
1. The `map` function
=====================
`map` is a function that takes a *function* variable and a list as arguments, and returns a *new*... |
127471 | ```
my_dict = {"fruits": ["apple", "orange", "grape", "maracuya", "pineapple"],
"countries": [["India", "China", "Brazil", "Lesotho", "Nepal"],
["Spain", "Italy", "Japan", "Indonesia", "Russia"],
["Germany", "Austria", "Paraguay", "New Zealand", "Peru"],
... | One approach, although it doesn't feel very pythonic, is to just loop through the values and, if a value is a list, test each item in the list to see whether *it* is a list, keeping count of the ones that are:
```
for key, value in my_dict.items():
count = 0
if isinstance(value, list):
for val in value... |
127505 | Hopefully a simple question but My google foo is failing me - I've got a maven project where we're using SLF4J with Log4J 1.2 bindings.
We now want to move to Log4j 2 particularly for the performance improvement - however, I can't for the life of me find the maven dependency for the log4j 2.0 binding. I've found some ... | ```
"org.apache.logging.log4j:log4j-slf4j-impl:2.0-beta9" -
LOG4J implementation of SLF4J API
"org.apache.logging.log4j:log4j-core:2.0-beta9" - Core LOG4J implementation
```
This, plus a valid log4j2.xml on the classpath should get you started. |
127565 | I am using C# serial port controlling gsm modem. Now in Mikroelectronia USART Terminal
after sending:
>
> AT+CUSD=1,"\*778#",15
>
>
>
It receives:
>
> AT+CUSD=1,"\*778#",15
>
>
> OK
>
>
> +CUSD: 0,"Balance: 0.00 TK. Validity: 29-Jul-13. Bonus: 0.00TK. Free Min: 0. Dial \*121\*2092# for 3 hit songs of Ashiq... | the `TextBox.CheckForIllegalCrossThreadCalls = false;` makes me very suspicious, I think that is what is breaking your program, simply just invoke to update the text box properly and I think it will work. Just change the event code to the following:
```
void sp_DataReceived(object sender, SerialDataReceivedEventArgs e... |
127583 | I am retrieving some data from an external API using javascript, I'm then displaying this data on a HTML page.
Within this returned data is a URL, it's in the following format;
```
var url = https://img.evbuc.com/moreStuff
```
I need to rewrite this URL so that it's prefixed with `www`, like this;
```
var url = h... | You can use a regular expression to search and replace.
Following example also works with:
* `http://img.evbuc.com/moreStuff`
* `//img.evbuc.com/moreStuff`
* `https://img.evbuc.com/moreStuff//someMoreStuff`
```js
function prependUrl(url) {
return url.replace(/^([^\/]*)(\/\/)(.*)/, '$1//www.$3');
}
const urls =... |
127925 | I have a number of strings similar to `Current Level: 13.4 db.` and I would like to extract just the floating point number. I say floating and not decimal as it's sometimes whole. Can RegEx do this or is there a better way? | If your float is always expressed in decimal notation something like
```
>>> import re
>>> re.findall("\d+\.\d+", "Current Level: 13.4db.")
['13.4']
```
may suffice.
A more robust version would be:
```
>>> re.findall(r"[-+]?(?:\d*\.\d+|\d+)", "Current Level: -13.2db or 14.2 or 3")
['-13.2', '14.2', '3']
```
If y... |
127943 | after i spend 2 days of searching the bug i have to ask for help here. i do have MapViewController and place some pins on the map. i´ve copied most of the code from MapCallouts and WeatherMap of the apple code samples.
anyhow it seems that i´ve deleted or missed essential parts. it seems there is no connection betwee... | Make sure the map view's `delegate` property is set.
If the map is created in IB, right-click on it and hook up its delegate outlet to File's Owner.
If the map is created in code, set the delegate after creating the map view:
```
mapView.delegate = self;
``` |
128083 | I have one-to-many relation between tables user and tag:
```
Users:
id username
--------------
1 Bob
2 Alice
3 Eve
Tags:
id user_id name
--------------------
1 1 java // Bobs tags...
2 1 java script
3 1 C#
4 2 java // Alices ... | Try this one:
```
const to = moment("2020-06-30T00:00:00");
const toNextDay = moment(to.add(1, 'days').toDate());
```
As moment is modifying the original moment object, either use toString() or toDate() to get the modified date.
```js
const to = moment("2020-06-30T00:00:00");
const toNextDay = moment(to.add(1, 'da... |
128592 | I am new to regex, so any help is really appreciated.
I have an expression to identify a URL :
`(http[^'\"]+)`
Unfortunately on some URLs, I get additional square brackets at the end
For instance "http://example.com]]"
As the result want to receive "http://example.com"
How do I get rid of those brackets with the hel... | What you actually have is called a negated character class, so just add characters that should not be matched. In addition, there's not really a need for a capturing group. That said, you could use
```
http[^'"\]\[]+
# ^^^^
```
Note that this will exclude square brackets *anywhere* in your possible url not jus... |
128671 | I am using Android Jetpack Navigation to navigate between fragments in my App and using a single Main Activity. I have a nav host fragment in main activity and a bottom navigation to naviagte between fragments.
```
navController = Navigation.findNavController(this,R.id.nav_host_fragment_container);
BottomNavigationVie... | You have to create your custom NavHostFragment(). There is a simple example here
<https://medium.com/@programmerr47/navigate-back-with-navigation-component-6cec37ba6964> |
128763 | Is it possible to create a user in PostgreSQL without providing the plain text password (ideally, I would like to be able to create a user providing only its password crypted with sha-256) ?
What I would like to do is to create a user with something like that :
```
CREATE USER "martin" WITH PASSWORD '$6$kH3l2bj8iT$KK... | You may provide the password already hashed with `md5`, as said in the doc ([CREATE ROLE](http://www.postgresql.org/docs/9.2/static/sql-createrole.html)):
>
> ENCRYPTED UNENCRYPTED These key words control whether the password is
> stored encrypted in the system catalogs. (If neither is specified, the
> default beha... |
128830 | This query works:
```
item = db.GqlQuery("SELECT * FROM Item WHERE CSIN = 13")[0]
```
although if there are no results returned, it blows up in my face. (How can I get around this? A `for` loop seems dubious when I want at max one iteration.)
This query does not work:
```
item = db.GqlQuery("SELECT * FROM Item WHE... | You're trying to get an item from a list (or a list-like object) that is empty. What you're doing is sort of comparable to the following:
```
>>> results = [] # an empty list
>>> item = results[0] # Raises an IndexError, because there is nothing in the list
```
What you need to do instead is:
```
item = db.GqlQuery... |
128834 | I've ran into some problems while using cordova plugin File Transfer. Thats my code:
```
window.requestFileSystem(
LocalFileSystem.PERSISTENT,
0,
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getFile(
"dummy.html", {create: true, exclusive: false},
function gotF... | Just found a "solution" to my problem.
What I did was to downgrade the file-transfer plugin version from 0.5.0 to 0.4.8.
If someone ever face similar problem, do as below:
1. Delete the existing file-transfer plugin by running 'cordova plugins list' and then 'cordova plugin remove *name\_from\_list*'
2. Go to <https:... |
128973 | I am currently concatenating a first and a last name like this (using PostgreSQL):
```
concat(customers.firstname, ' ', customers.lastname)
```
The problem I am having here is that I have customers that were entered with just a first name (ie. "Ronaldo"). The query above will return "Ronaldo " and that will not matc... | You could use a [`TRIM()` function](http://www.postgresqltutorial.com/postgresql-trim-function/) call to strip off any leading or trailing spaces :
```
TRIM(CONCAT(customers.firstname, ' ', customers.lastname))
```
`TRIM()` also allows you to specific the characters you which to remove along with the location within... |
129410 | I have a working hibernate setup using annotations
```
@Entity
@Table(name="Users")
public class User implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="USER_ID")
private int id = 0;
@Column(name="EMAIL")
private String email = "";
@Temporal(Te... | You could `.join()` the new distributions to your existing `df` and then `.plot()` using wide format:
```
lower, upper = df.total_bill.quantile([.25, .75]).values.tolist()
df = df.join(df.loc[df.total_bill < lower, 'total_bill'], rsuffix='_lower')
df = df.join(df.loc[df.total_bill > upper, 'total_bill'], rsuffix='_upp... |
129441 | We have an outdated build of SQL Server 2008 R2(SP1) and therefore we are in need of patching(SP3).
Does this have any impact on SharePoint?
What measures should I take, besides backing everything up and testing before doing in production? | SharePoint 2010 is supported on SQL 20018 R2 SP3, so no, there shouldn't be any issue installing the service pack onto your SQL Server.
I'd test (if at all possible) on a test system first, simply to ensure that any other solution installed within the SharePoint farm also continues to function as expected once the ser... |
129503 | Say you are a program, and you are given some source code but you don't know in what language, it can be C++/Java/Python/Lisp/... all you know is that it is highly structured and LR(1) parse-able, and you want to make **some guesses on the corresponding syntactic tree**.
How would you try to achieve this, and would yo... | You might be interested in learning about [grammar induction](https://en.wikipedia.org/wiki/Grammar_induction): given a set of examples of strings from a context-free language, there are algorithms to learn a context-free grammar that generates those strings.
To learn more about it, read the Wikipedia article I linked... |
129677 | JavaScript happy times fun land
```js
// make a method
var happy = function(a, b, c) {
console.log(a, b, c);
};
// store method to variable
var b = happy;
// bind a context and some arguments
b.bind(happy, 1, 2, 3);
// call the method without additional arguments
b();
```
Output. Yay!
```
1 2 3
```
---
In R... | Normally, rebinding methods isn't something you do in Ruby. Instead, you use blocks:
```
# This is our receiver "R"
def idiot(&block)
puts("yes, master; #{block.call}")
end
# Here's a couple method "M" examples
def calculateSomethingDifficult(a, b)
return "the sum is #{a + b}"
end
def applyJam(object)
return "... |
129715 | ```
public override Task<IdentityResult> ValidateAsync(AppUser item)
{
if(item.Email != "a@a.com")
{
IEnumerable<string> errors = new List<string>() { "error1" };
}
}
```
The IdentityResultjust needs a simple array or ienumerable of strin... | If you absolutely need to have ValidateAsync() instead of just Validate(), use a TaskCompletionSource to simulate.
```
public override Task<IdentityResult> ValidateAsync(AppUser item)
{
var result = new IdentityResult();
var tcs = new TaskCompletionSource<IdentityResult>();
if(item.Email != "a@a.com")
... |
130082 | This code interprets an abstract syntax tree generated by a recursive descent parser for a dynamic scripting language called Hassium. The syntax of this language looks like this
```
# Recursion functions
func fibonacci(n) {
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;
}
retur... | Well, it's a large chunk of code so here just a few things which came to mind when skimming over it:
1. You don't have any unit tests (at least none that I could find on github). You should start writing them. I suspect it will be a PITA to do so which is good since it will highlight refactoring targets plus it will p... |
130259 | how to get id or position of a checkbox inside listview?
I need to update database when isChecked = true or false, but I need position...
maybe I could just do same things as in OnItemClick method?
```
@Override
public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id){
CheckBox cbx ... | You can set tag to the checkbox, and when you get the callback for the event, you can extract the tag from view provided in callback. Set the position in the tag (setTag() is the method for setting tag).
So your stuff should look something like following:
```
public View getView(int position, View convertView, ViewGro... |
130448 | After countless attempts and sieving through every SO answer + google result, it baffles me that working with EXIF on iOS is so frustrating.
Below is working code with its results.
```
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler:^(CMSampleBufferRef imag... | Scott, a developer at Apple, returned with my incident report and fixed the issue:
>
> The previous code above is writing **string values** for the GPS
> values - *this won't work*, they **must be NS/CFNumbers** (we extract
> a float value for EXIF).
>
>
>
I'll be filing a bug report to Apple against their docu... |
130486 | Recently i came across a question during a programming contest on codeforces. Problem tags referred that the problems could be solved by using two pointer method.
What exactly is the Two Pointer Method? | Google reports 2350 hits for "two pointer method" but the first couple pages use the phrase to refer to a variety of algorithms. It's seldom capitalized. Probably they were referring to one of several alternatives that had already been established in other discussion, literature, etc specific to the group hosting the c... |
130710 | **This is my connection string**
```
{
"Data": {
"PhotoGalleryConnection": {
"ConnectionString": "Server=WINDOWS-B7MJR5T\\SQLEXPRESS;User Id=sa;password=allah;Database=PhotoGallery;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
}
```
**And I am facing this exception**
>
> An exception... | It should work after You delete Trusted\_Connection=True; from connection string.
>
> If you specify either Trusted\_Connection=True; or Integrated
> Security=SSPI; or Integrated Security=true; in your connection string
> THEN (and only then) you have Windows Authentication happening. Any
> user id= setting in th... |
131026 | I am getting
```
yld: Symbol not found: _OBJC_CLASS_$_UIUserNotificationSettings
```
and here's the function that is causing the error ***when the application is running on an iOS7 device*** and without even calling the function at all in the code.
>
>
> ```
> func reigsterForRemoteUserNotifications(notification... | **Update:** This is fixed in Xcode 6 beta 6 (build 6A280e)
---
~~Here's a (perhaps not so great) workaround: explicitly link to UIKit weakly (I know that `import` statements are supposed to link to frameworks already, but we do it explicitly anyway).~~
* Click on the project in Xcode
* select the target in the drop ... |
131276 | I'm trying to use Android Annotations and dynamically add layout components when my **createNewRow** button is clicked. The app runs and displays the default rows defined in **activity\_main.xml** and, after clicking **createNewButton** I see children attached to my **dynamicTable** in the debugger but the new children... | Don't use the annotated class when you're inflating the view and make sure you're calling the build method that inflates it.
```
@Click
void createNewRow() {
log.info("clicked");
InflatedRow inflatedRow = new InflatedRow_.build(this);
dynamicTable.addView(inflatedRow,0);
}
``` |
132041 | I have a class that I would like to map to a single table in two different ways, for privacy reasons. Let's say the class looks like this:
```
class Person
{
public int ID { get; set; }
public string Name { get; set; }
// ... many other properties omitted ...
}
```
And the corresponding database table looks... | Thanks for the data sample.
You need to:
* read each paragraph/line
* split the line by whitespace to extract each tagged word, e.g. `Summerdale/np`
* split the word by `/` to see if it is tagged `np`
* if so, add the other half of the split (the actual word) to your noun list
So something like the following (based ... |
132176 | Is it possible? I mean
```
Select * from tbl limit 100;
```
I want to replace with a query like
```
Select * from tbl WHERE ...some_condition...
``` | You could use `row_number()` for that:
```
select *
from (
select row_number() over () as rn
, *
from YourTable
) as SubQueryAlias
where rn <= 100
```
If you have a specific ordering in mind, you can add an `order by` clause:
```
select row_number() over (order by da... |
132329 | I'm trying to use jQuery to detect the orientation of a number of images. Once detected, I want to add a class to indicate this i.e `.landscape`.
The code below seems to only be assessing the first image it comes across, and then applying that to all subsequent images. For example, if the first image is landscape, thi... | In each loop, you're selecting `$("img")`, which is *every `<img>` on the page*.
You need to limit your search to find the `img` within the current element, using `$(this).find("img")` instead.
```js
// Detect image orientation
$('.carousel-cell').each(function() {
"use strict";
var $img = $(this).find('img'... |
132504 | I have used the CAM::PDF module to read the text content from PDF file. In a directory I am having list of PDF files, so i have used the code like below to read the text content, which is not giving me the text in $text variable.
```
my $Filepath = "E:/test/";
opendir (DIR, $Filepath);
while (my $filename = readdir(DI... | To answer my own question, achieved with a trial and error:
```
$scope.$apply(function() {
$location.path('/home');
$window.location.reload();
});
```
This will go to /home (default) and reload everything, thus creating new service, module, controllers etc. If there is a better way of doing it (if I change ... |
132604 | I have a problem with very simple `UIView` animation:
```
- (void)showView:(CGFloat)delay
{
[UIView animateWithDuration:1.0 delay:delay options:0 animations:^{
// self.alpha = 0.5; // Works OK with delay
self.frame = CGRectMake(100, 100, 100, 30); // delay is ignored
} completion:nil];
}
```
... | The frame is probably being set for you, perhaps by layout being performed by the superview, or this view itself. You haven't said how you're adding this view or what it does so its difficult to give specific advice, but in general terms:
* Don't let a view be in control of its own frame - this is the superview's or v... |
133134 | The code below serves to change connection string in App.config at runtime, I found it [here](http://www.c-sharpcorner.com/uploadfile/1a81c5/configuring-connection-string-in-app-config-file-during-runt/?login=true&user=66f1ec) but this code did not work for me on Visual Studio 2010 and SQL Server 2008, I could not open... | The error is telling you that you are passing incorrect parameters to your [SqlDataAdapter](http://msdn.microsoft.com/en-us/library/kx703tc9.aspx). I think the proper call would be:
```
SqlDataAdapter da = new SqlDataAdapter("select * from employee", Db);
```
**Edit**
It looks like you're creating your connection ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.