FAQ Database Discussion Community


How to update error value in ModelStateDictionary?

c#,asp.net-mvc,asp.net-mvc-3,model-view-controller
I am working on MVC project and want to be able to update Error messages on the fly inside ModelStateWrapper, but the problem is that there are no set methods for specific key, and dictionarry is readonly. var x = new ModelStateDictionary(this.ModelState); foreach (var item in x.modelState) { if (item.Value.Errors.Count...

can a user view vb.net settings in application [duplicate]

vb.net
This question already has an answer here: Where are My.Settings saved in VB 2010 .NET? 3 answers I am creating a VB.net application and including my database credentials in the settings of the project, so to access i use: My.Settings.SettingName Is there any way a user using the application...

Verify user device in asp.net identity

c#,asp.net
I'm trying to verify user's device when he/she is trying to log in with his registered devices. the username, password and the grant_type is sent using x-www-form-urlencoded the request is grant_type=password&username=user1&password=123&device_id=123456789 the devise_id is alrady captured in the client and sent with reqest. how can i read the device_id value...

How to change listview DataSet on Gallery drag?

android,listview,gallery
I have a gallery with custom views that represent categories, depending on which category of the gallery is selected the listview should display one dataset or another, it is working, but the dataset shown does not correspond with the category selected, Here is the adapter for the gallery: public class...

Calling a @Bean annotated method in Spring java configuration

java,spring,cglib
I'm curious about how spring injection handles calling methods with the @Bean annotation. If I put a @Bean annotation on a method, and return an instance, I understand that that tells spring to create a bean by calling the method and getting the returned instance. However, sometimes that bean has...

Pass template object between functions with a change of type

c++,templates,casting,type-conversion
I have some large code where I need to use a templated functor with layers of functions that call each other. The problem is that the type changes at various stages. Below is a minimal example of the type conflict problem. Is there a way to call foo from bar...

Performance impact of base image in docker

docker,dockerfile
I am learning to use docker. I want to dockerize a java application. Is there any difference in performance or resource usage(other than disk space) if I use a minimal base image like busybox instead of ubuntu (debian) as the base image in docker?

How GHC forces evaluation in multithreaded applications?

haskell,concurrency
For example: I have a quite simple memoised implementation of fibonacci sequence, which I request in multiple threads: {-# LANGUAGE BangPatterns #-} module Main where import Control.Concurrent import Control.DeepSeq import System.Environment (getArgs) import System.IO.Unsafe (unsafePerformIO) data Tree a = Tree (Tree a) a (Tree a) instance Functor Tree where fmap...

5 divs in one row, can't align them in one line

html,css,html5,responsive-design
I'm quite new on web development. I'm struggling with this question for a while. Now I post my question(s) here. The souce code is as linked: Source Code The HTML: <div id="wrap"> <div id="main" class="clearfix"> <ul class="ranklist" id = "ranklist"> <li class="ranklistitem font-size-0"> <div class="itemnumber divinline"> <span class="helper"></span>1</div> <div class="userprofile...

Force SSL and WWW on apache2 for raspbian

apache,.htaccess,mod-rewrite,ssl,raspberry-pi
When I use the mod_rewrite and mod_ssl concurrently below, the resulting domain is: https://www.domain.com// I find this extra '/' annoying and I would like to get rid of it. Is the problem the way I code it or should I consider using .htaccess instead? 000-default: <VirtualHost *:80> RewriteEngine on RewriteCond...

C# regex expression for allowing spaces but not at the beginning, end and repeated spaces

c#,regex,expression
I have a regex expression validation for an UI field: ^[a-z|A-Z|0-9|_|\-]+$ Now I need to allow spaces for the entry, so if I add space to the regex expression, like this: ^[a-z|A-Z|0-9|_| |\-]+$ It does allow spaces at the beginning, end and repeated spaces. Could someone help me with this...

NSTimer - how to delay in Swift

ios,swift,nstimer
I have a problem with delaying computer's move in a game. I've found some solutions but they don't work in my case, e.g. var delay = NSTimer.scheduledTimerWithTimeInterval(4, target: self, selector: nil, userInfo: nil, repeats: false) I tried to use this with function fire but also to no effects. What other...

Javascript date to xs:dateTime

javascript,xml,date,datetime
Is there a simple way to convert standard Javascript date format to xs:dateTime So I have a date value (new Date()) and I need in the format: 2015-01-16T20:26:53.974+03:00 so Fri Jan 16 2015 22:26:53 GMT+0500 (Ekaterinburg Standard Time) -> 2015-01-16T20:26:53.974+03:00 It strange but cound't find simple solution....

ProgressBar running faster after each onclick in android

android,multithreading,timer,android-progressbar,thread-sleep
I am Stuck here with this application in android. In my application i am trying to implement a progressbar which shows timer for certain seconds. When the Button is clicked the timer should refresh and again start from 0 in progressBar. For this I am using Thread. The Problem is,...

Data from c# application into Ms Access transferring incorrectly

c#,ms-access,ado.net
... using System.Data; using System.Data.OleDb; namespace accessloginapp { public partial class Ramen : Form { private OleDbConnection connection = new OleDbConnection(); public Ramen() { InitializeComponent(); connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\...\Users.accdb;Persist Security Info=False;"; } private void btn_Save_Click(object sender, EventArgs e) { try{ connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText...

wordpress : how to change the display of meta on single custom post type

php,wordpress,post,meta
I found code for displaying the meta terms of a custom post type. but it shows the metas as a vertical list. I want the code to show CPT meta in a row, instead. any help please? the code: <?php //get all taxonomies and terms for this post (uses post's...

How to remove SSRS Report Manager URL login screen

sql-server,reporting-services,ssrs-2012
I am trying to migrate several SSRS reports from a client's old SQL Server 2008 R2 on Windows Server 2003 R2 to a new SQL Server 2012 on Windows Server 2008 R2. I have it all set up except that on the new system, when I click on the Report...

Calling method from another class in onPostExecute causing nullPointerException

java,android,android-asynctask,nullpointerexception
This might help someone also: How to get the result of OnPostExecute() to main activity because AsyncTask is a separate class? I am calling method from another class in onPostExecute(). I assume that onPostExecute() is called after doInBackground(String... params) and that is right, according to documentation and debugger. Calling the...

How to properly do infinite loading in listview

android,listview
Theme: I am downloading a bunch of data from my external database and I would like to display only a few of them (10) at a time. When the user scrolls down I want to automatically download and display another 10 (and display a Loading progress bar below the Listview...

PHP sort multiple arrays

php,arrays,sorting
I have a PHP report which goes out to an array of servers to get their uptime. Then present the uptime in a table. Very simple. I'm looking to see how to sort this array so that the highest uptime is at the top of the list. I know about...

Scope of a function in Common Lisp

common-lisp
Suppose I have to define a function called foo. Suppose that, in order to define it, I use some auxiliary functions foo1, foo2, foo3, ... When I load the file containing those functions, from the top-level I can use all of them. Instead I want to "see" from the top-level...

STL map Custom Key Class [default constructor]

c++,graph,stl,stdmap
I have a graph implementation with a Node class like below class Node { public: Node() : idx(0), volume(1.0), futureVol(1.0), isCoarse(false) { } Node(index n) : idx(n), volume(1.0), futureVol(1.0), isCoarse(false) { } Node(const Node& a) : idx(a.idx), volume(a.volume), futureVol(a.futureVol), isCoarse(a.isCoarse) { } ... bool operator<(const Node& n) const { return...

Deleting a tree of nodes, using cypher?

neo4j,cypher
I've got an arbitrary depth tree of nodes which I'd like to delete. I'd expected this to work: MATCH (a)<-[rels*]-(t) WHERE ID(a)=135 FOREACH(r in rels | DELETE r) DELETE t,a but it fails: javax.transaction.HeuristicRollbackException: Failed to commit transaction Transaction(32, owner:"qtp1200654940-73") [STATUS_NO_TRANSACTION,Resources=1], transaction rolled back ---> Node record Node[137,used=false,rel=347,prop=-1,labels=Inline(0x0: []),light] still...

Spring Integration xsl-resource from database

java,xml,spring,xslt,integration
In Spring Integration, is there any way to load an xsl-resource dynamically, say from a database without it being horribly hacky? <int-xml:xslt-transformer id="tenderXsltTransformer" input-channel="tenderTransformChannel" output-channel="tenderOutChannel" xsl-resource="classpath:/META-INF/xsl/submit-info.xsl" /> ...

What will part of db be load in memory when i do request?

android,android-sqlite
I plan to add a big local database to my application. What part of the db will be loaded in memory when I do the request? All tables from the DB or only the table that I request?

Does not contain _id or shard key for pattern {_id:hashed}

mongodb
db.books.update({bookId:"123461"},{$set:{"bookPrice":"6.23"}}) I get the error: update { q: { bookId: "123461" }, u: { $set: { bookPrice: "6.23" } }, multi: false, upsert: false } does not contain _id or shard key for pattern { _id: "hashed" } But when I use below it works. db.books.update({_id:ObjectId("54b88167498ec382221a82c2")},{$set: {"bookPrice":"6.23"}}) Why doesn't it...

How to make an effect in HTML like this one https://www.google.com.pk/green/energy/ [closed]

javascript,jquery,html,css
I want to make an effect in HTML/CSS and Javascript like the this one in Google Green website https://www.google.com.pk/green/energy/. When we hover on Using Green Power or Investment Plans a green and red circle comes up. I shall be thankful to him or her who will answer my question. Thanks.

Find min, max in array with objects

javascript,arrays,object,max,min
I have this array with objects inside: var pts = [ { "X": 52.67528921580262, "Y": 8.373513221740723 }, { "X": 52.6759657545252, "Y": 8.374114036560059 }, { "X": 52.682574466310314, "Y": 8.37256908416748 }, { "X": 52.68356308524067, "Y": 8.373942375183105 }, { "X": 52.68293869694087, "Y": 8.375487327575684 }, { "X": 52.67685044320001, "Y": 8.376259803771973 }, { "X": 52.6756535071859,...

Run-Time Error 424 Started without warning

excel,vba,runtime-error
I know there are a lot of similar questions, but none of them have helped my specific issue. I have been teaching myself VBA and began learning Userforms from http://www.excel-easy.com/vba/userform.html Everything worked fine and dandy until out of the blue, I received the 424 Error code when I tried to...

How can I allow only certain people to commit in Visual Studio Online?

git,tfs,visual-studio-online
I have a Visual Studio Online account and multiple projects. On each project I would like to choose who can commit into different branches. For example, I would like the lead developer to be the only person who can commit to 'master' which will then kick off a CI build....

Should the company name given in google play developer console be registered?

google-play
I wanted to publish a game on Google play. Should the company name entered in the developer console be registered? Or can we simply give any name of our choice? Thanks in advance

NSLocalizedString with variable in swift

ios,swift,nslocalizedstring
How can I translate a string that has a variable in it like this: let alert = UIAlertController(title: NSLocalizedString("NEUEARTIKEL",comment:"Bitte gib einen neuen Artikel für \(titelArr[sender.tag]) an:"), message: nil, preferredStyle: .Alert) When I just translate the String normally like this in the localizable.string: NEUEARTIKEL="Add an item to \(titelArr[sender.tag]):"; The alert will...

How to load ajax data into DIV without using .get() or .load()?

javascript,jquery,html,ajax
I have been given a URL by a partnering company to load content into a DIV. We put the following onto a page: <div id="catalog"></div> And then use .get() to put content into it. A problem arises due to the fact that we're using jQuery 1.3.2 on some of the...

For each loop using Java Iterator [closed]

java,foreach,iterator
So I've been looking over some java code that i understand is used for a foreach loop but it seems like it is overly complicated. I have a Control.java file that contains properties. I have a Controls.java file that uses Iterator and takes Control as the data type. public class...

Get Direct Child - Not Nested Children

javascript,jquery,html,css
I have a layout such as this: <ul id="tax_id"> <li> <label>Input One <input type="checkbox" /> Checkbox One </label> ... elements ... <ul class="children"> <li> <label>Input Two <input type="checkbox" /> Checkbox Two </label> ... elements ... <ul class="children"> ... elements ... </ul> </li> </ul> </li> </ul> Whenever I check an input,...

Asynchronous Fetching Swift Xcode

ios,swift,core-data,asynchronous
I use a collection view to display images stored in CoreData, only a few (around 15) but when I scroll down it lags, It seams to be because I am not fetching my data asyncrhronously, is it possible with only 15 UIImages? So here is my problem I cannot find...

Finding Primes with Modulo in Python

python,lambda,primes,modulus,sieve-of-eratosthenes
I have been sweating over this piece of code -- which returns all the primes in a list: primes = range(2, 20) for i in range(2, 8): primes = filter(lambda x: x == i or x % i, primes) print primes It works... but I don't understand the role "x...

Can a docker process access programms on the host with ipc

docker,ipc,websphere-mq
I´m working on a clustered tomcat system that uses MQSeries. Today MQSeries is accessed in bindings mode, i.e. via IPC and tomcat and mqeries run on the same host without any virtualization/docker support. I´d like to transform that to a solution, where mqseries runs on the host (or possible in...

jQuery checkbox select all and change background color on select

jquery,html
I have a table with checkboxes in the first column, and a "select all" checkbox in the header. When I check a checkbox, I need the row color to change. var $tbl = $('#tbl'); var $bodychk = $tbl.find('tbody input:checkbox'); $(function () { $bodychk.on('change', function () { $(this).closest('tr').toggleClass('hilite'); }); $tbl.find('thead input:checkbox').change(function...

SSH password script using root

linux,bash,ssh,scripting,redhat
Hello I am trying to work on a SSH password script. The user I am using is root because this is for a cluster of servers and the root user has password less entry to all of the other servers in the cluster. What I have here works as on...

Express 'res.render' Error: Rendering page multiple times

node.js,mongodb,express,mongoose
I'm using a simple query to find a value in a database, as I return to a page it renders the page once correctly with the object that was retrieved, then renders it again with a null object (none was found), and the console.log files are being run twice, once...

R: glmnet - cox error

r,glmnet,cox-regression
I am running a coxph model using glmnet. The following is the code that I am using: data <- read.csv("CSM Tiers by Org.csv", stringsAsFactors = FALSE, na.strings = "?") x <- model.matrix(~ data$CSM + data$Exclude + data$Queue) y <- data$Time status <- data$Event glmnet(x,Surv(y,status), family = "cox") However, I am...

MSI fails to install with “A newer version of the product is already installed” although , ProductCode, ProductVersion, PackageCode are different

windows-installer
I am trying to install an update of a product (so that MSI will uninstall the old version and install the new one). The new MSI has the same upgrade code, and different productCode, packageCode. Also the productVersion number is larger than the old version. Still, getting "Unable to install...

best way to present images in SpriteKit

objective-c,sprite-kit,skspritenode,sktexture
I have been using SpriteKit for a year now, and am very comfortable with it. However much of what I do is habitual, and I am not necessarily sure of why I do some things. My images are all sorted in texture atlases, but there appears to be 3 different...

modify multiple html files with Powershell

html,powershell
I need to modify over a thousand html files in a certain directory. I need to remove all the content and replace it with the html below. What would be the best way of doing this? <html xmlns:v="urn:schemas-microsoft-com:vml"> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> Please use the Supplemental Information...

In Interface Builder, how I do to resize correctly this image to make it device specific?

ios,xcode,interface-builder
I am using the Auto Layout feature, and I would like to know if I can use different image sizes for different screen sizes. Here's what my Storyboard File looks like. As you can see, there is an image of a guy. How do I keep the size of image...

joining multidimensional array Into pairs Ruby

ruby,arrays,multidimensional-array
For this program I'm making i need to join together some arrays in a multidimensional array: What the array is: [["2", "2"]["0", "9"]["2", "2"]["2", "7"]["1", "7"]["0", "8"]["0", "1"] ["0", "9"]] And I want it to become like this: ["22", "09", "22", "27", "17", "08", "01", "09"] Sorry if this is...

Swift: UIImage — Could not find an overload for 'init' that accepts the supplied arguments

swift,ios8,uiimage
Below is the code that I'm using to build an array of images var _displayImage : Array<UIImage>! required init(coder aDecoder: NSCoder) { self._displayImage = [] } func buildImageSet() { self._displayImage = [UIImage(named: "image1"), UIImage(named: "image2"), UIImage(named: "image3"), UIImage(named: "image4"), UIImage(named: "image5")] } I get an error: Could not find an...

Word VBA to delete Content Controls with specific Tags

vba,word-vba
I read the answers to the question on How to find and disable a content control by tag on SO (below is the code for your convenience). In my case, I need to delete Content Controls (CC) with SPECIFIC tags. For Example, out of the 150 CCs that I have...

HttpWebRequest using GET on redirect instead of POST like idHttp

c#,delphi,httpwebrequest
Sorry for my english. In Delphi I have an idHttp component with the hoWaitForUnexpectedData option activated. When I send a POST request to a URL, it redirects the client to a second URL with the same POST request and headers. Also, the server response contains "Connection: keep-alive" in its header....

show all companies that have a job

ruby-on-rails,ruby,ruby-on-rails-4,associations
I have an association between jobs and companies where company has_many: jobs and job belongs_to: company. Now I am trying to access a page where there are only companies that have a job, so for this i have this code in my controller def recruiting @companies = Company.all end and...

iOS - In App Purchase suddenly stopped working

ios,ios7,ios8,in-app-purchase
I have developed an application for a customer over a year ago. This app has In App Purchases, and my customer have been receiving money from her clients that use the app, I can clearly see that in iTunesConnect. Last time someone bought something was in november. But now all...

GoCardless SDK “requires a later version of the .NET Framework than the one specified in the project” (ASP.NET 3.5, Visual Studio 2010)

visual-studio-2010,visual-studio,dependencies,nuget,gocardless
UPDATE 201521011559: I'm wondering if this is caused by an error in the dependency specifications in the .nuspec file used to build the package... The .nuspec file for the client SDK is on GoCardless' GitHub repo https://github.com/gocardless/gocardless-dotnet/blob/master/GoCardlessSdk/GoCardlessSdk.nuspec and includes this section: <dependencies> <group targetFramework="net20"> <dependency id="Newtonsoft.Json" version="4.5.11"/> <dependency id="RestSharp.Net2" version="1.1.11"/>...

How to copy and paste rows from workbook to another with non consecutive rows

excel,vba,excel-vba
Private Sub CommandButton21_Click() Dim x As Workbook Dim y As Workbook '## Open both workbooks first: Set x = Workbooks.Open("Name of Copied Document") Set y = Workbooks.Open("Name of Pasted Document") 'Now, copoy what you want from x: x.Sheets("Report Data").Range("A7:ax7").Copy 'Now, paste to y worksheet: y.Sheets("Jan").Range("A7:ax7").PasteSpecial 'Close x: x.Close End Sub...

Extract House Number and Street Name from string using Python Regex

python,regex
I'm new to Regex and am trying to use it to parse apart addresses into House Number and Street. Example: 123 Main St --> ['123', 'Main St'] It gets slightly complicated by the fact that some of my street strings will have hyphenated street addresses, in which case I want...

Bash script : select lines starting with number in specific range

linux,bash,awk,sed,grep
I have a file containing lines like: 121<some letters> random text ... 1234<some letters> random numbers etc... Each line starts with a number followed by some letters.I'm looking for a way to select only the lines which start with a number in a specific interval, for example : [0-9999] ....

Need help in SQL join

sql,oracle
I have two tables and records in it as below: User --------------------- ID UserId --------------------- 1 User1 2 User2 Department_User ------------------------------ ID DEPT_ID USER_ID ------------------------------ 1 1 1 2 2 1 3 1 2 Now I want a oracle query which will return only those users who are serving in...

Why am I be getting a 403 Forbidden error when using @csrf_exempt in AJAX request?

jquery,ajax,django
I am trying to write a very basic AJAX request in Django, and I keep getting the 403 forbidden error in both the Chrome Dev and Django consoles. I posted a similar question the other day and have tried all of the proposed solutions including @csrf_exempt (to rule out if...

What is the difference between function and function* [duplicate]

javascript,function,generator,ecmascript-6,ecmascript-harmony
This question already has an answer here: What is “function*” in JavaScript? 3 answers What is the difference between generator functions created with function and function* function a(i){ for(;i>0;i--){ yield i*i; } } function *b(i){ for(;i>0;i--){ yield i*i*i; } } ...

AsyncController method declarations, assist with understanding syntax

c#,.net,asp.net-mvc-4,async-await
I am looking to implement async coding for some web services. I came across a tutorial and tried to follow it and implement it however one specific section I am having trouble with. My example public void CalculatePricingAsync(QuoteInput obj) { AsyncManager.OutstandingOperations.Increment(); var apiService = new ApiService(); ApiService.CalculatedPricingCompleted += (sender, e)...

Images randomly change

android,android-imageview,android-gridview
I have the following issue : I'm having a GridView which displays alot of ImageViews , If I start scrolling the Items randomly start to change so there are wrong images at wrong positions and they start swapping everytime from position to position. ImageAdapter package com.zippyscore.pr0gramm.Adapter; import android.content.Context; import android.graphics.Bitmap;...

Android setUpMapIfNeeded(); gives null pointer exception

android
So i just created a new google maps activity and it gives me a null pointer exception if i try to run my application private GoogleMap mMap; // Might be null if Google Play services APK is not available. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpMapIfNeeded(); } @Override protected...

How to reference jQuery plugin instance dynamically?

javascript,jquery,this,self
Within my jQuery plugin execution flow I render this sidebar list of links. //render method var render = function(self){ var sidebar = ''; var main = ''; /* Sidebar */ sidebar += '<ul>' sidebar += '<li><a href="javascript:self.data(activeFolder,1);self.data(render);">Rootobject 1</a></li>'; } Only I don't want the link to print out self, but...

Using a specific version of MSBuild in a FAKE build script

f#,msbuild,f#-fake
I currently have VS2013 and VS2015 installed on my machine. By default FAKE F# Make seems to be building with VS2015. I tried passing into my MSBuild task the VisualStudioVersion 12.0 but that didn't seem to have any effect. I saw some articles say to change the MSBuildPath in the...

Python Script to run a C Program [closed]

python,c++,c,scripting
I have a C/C++ program which takes a set of arguments and displays a set of outputs to a command line (for my research). I would like to write a Python script to run this program multiple times for different inputs and write outputs to a file. I am planning...

Add ViewModel to View type mapping for intercepted types

c#,caliburn.micro,ninject-interception
I'm using Caliburn Micro and Ninject together in a WPF app. I'm using Ninject.Extensions.Interception to intercept and log calls to my ViewModels, however this is preventing Caliburn to locate the view for ViewModels because Caliburn is being handed the intercepted viewModel (proxy) which is of a different namespace and name....

Getting String info from another java class rather than the same one

java,string
so I have 2 classes, 1 for a very small interface and 1 for some calculations. basically I want to have a string displayed in a box. That's done but now I need the string to be obtained from my other class. Here is where my question lies, How do...

Why am I getting Unknown column in 'where clause' using a sub-query alias with MySQL?

mysql,sql
I am getting an error message when I'm trying to give an Alias to a Sub-Query and then reference it in a Where clause: Unknown column 'point_status' in 'where clause' SELECT goals.id, goals.status, ifnull((SELECT point_status FROM pts WHERE point_id = ?), goals.status) as point_status FROM goals WHERE goals.name = ?...

Cordova - how to detect the app is not actively used anymore Android

javascript,android,cordova
Okay, so my application is a flashlight/torch app found here: https://github.com/Skelware/Fancy-Flashlight and it uses a Cordova plugin found here: https://github.com/Skelware/Cordova-Flashlight Currently I only care about Android. To briefly explain the way an app like this works on Android: The app has to request access to the camera and this is...

Why this refers to global object?

javascript
I have this code: function F() { function C() { return this; } return C(); } var o = new F(); Can someone explain why this refers to the global object and not to the function C when create the object o? Maybe this is happening because when create the...

XML Deserialization : from xmlString to complex class

c#,.net,xml,class,deserialization
This is the xml what I get from database: > <Library> > <Header> > <HeaderID>01</HeaderID> > </Header> > <Books> > <Book> > <Name>Book1</Name> > <Category>Fiction</Category> > <Authors>2</Authors> > </Book> > <Book> > <Name>Book2</Name> > <Category>Non - Fiction</Category> > <Authors>1</Authors> > </Book> > </Books> > <Authors> > <Author>...

Dynamic prefix sum

algorithm,data-structures,binary-search-tree,prefix-sum
Is there any data structure which is able to return the prefix sum [1] of array, update an element, and insert/remove elements to the array, all in O(log n)? [1] "prefix sum" is the sum of all elements from the first one up to given index For example, given the...

Load data into external text file using django [closed]

python,mysql,django,jenkins
I have apache+mysql+django. in mysql I store some data, and use django to interact with it. Now I need to store data from mysql into some external text file(like csv) in a propper format(I want to parse it later with jenkins as a source to parameters). How can I create...

Converting Enum Error Code To String

c,error-handling,enums
In a project I am working on, I have defined a basic enum to store a list of the possible errors the application could encounter. However, I would like to find a way to return a string describing the error. Here's the enumeration I'm using: enum _library_results_enum{ LIB_SUCCESS = 1,...

Concatenating dataframes single label row selection returns multiple rows

python,numpy,pandas
I have three DataFrame objects with the same column names, with a column 'a' of interest to me that I would sort on eventually. And, once they are combined, I would like to access them iteratively. df1 = pd.DataFrame(np.random.randn(10, 4), columns=['a','b','c','d']) df2 = pd.DataFrame(np.random.randn(10, 4), columns=['a','b','c','d']) df3 = pd.DataFrame(np.random.randn(10, 4),...

Can't Preview my mobilefirst application

eclipse,mobilefirst
I've created a project & application, and deployed successfully. But When I click Run As->Preview, it runs with no error and it is taking me to wordpad and pops up "Failed to load document". If I run the project on server it again get deployed successfully but it is giving...

Rails / Devise - Passing Username into Profile Build

ruby-on-rails,ruby-on-rails-4,devise,friendly-id
I am currently working on a rails project using devise, and I have ran into a bit of an issue. I have the default devise:install running with my User model, and I have a another model called Profile. It belongs_to :user, and the user has_one :profile. The issue I have,...

SQLite/python: 'str' object is not callable error [closed]

python,sql,pycharm
I'm new to python and I've got an error that i tried to solve by myself for couple of hours with no result. (I use Pycharm & SQLite).Here's my code: Id = cur.execute("select id from abonnement where libelle=%s and prix=%s and estPackGar=%s ;" (abonnement.libelle, abonnement.prix, abonnement.estPackGar)) And this is what...

grunt-html2js and injecting the 'templates-xxx' module (a dash in the module name)

angularjs
With grunt-html2js I'm getting a views.js which contains: angular.module('templates-dist', ['../views/attachment-modal.html', ... ... angular.module("../views/attachment-modal.html", []).run(["$templateCache", function($templateCache) { ... (etc. all the views) I've added this module to my app.js, like this: angular.module('myApp', [ 'ngRoute', 'ui.bootstrap', 'templates-dist', // <--- there it is. 'ui.select']); I want to add this module also to my...

How do I set up basic routing for .NET WEBAPI?

c#,asp.net,asp.net-web-api,asp.net-web-api2,asp.net-web-api-routing
I'm trying to learn .NET Web API so I decided to follow this very simple introduction: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api However, I can't even get this working. I copied and pasted code directly to make sure I wasn't making some mistake, but when I run it, trying to access a path such as...

Get this week's monday's date in Postgres?

postgresql
How can I get this week's monday's date in PostgreSQL? For example, today is 01/16/15 (Friday). This week's monday date is 01/12/15....

c libcurl CURLOPT_POSTFIELDS strange error

c
i'm a quite new c developer and I have a little trouble with libcurl. I searched a lot in the net before but i didn't managed to find an answer working for me. This is pure c, no ++. I have this code and the request is failing char *...

x64 rounding inconsistency in cvRound() (_mm_cvtsd_si32)

c++,opencv,visual-c++,rounding-error
On x64 Windows using MSVC2013, I am using the cvRound function of OpenCV with the intention of round up from x.5 values. I've come across an inconsistency where cvRound(17.5f) returns 18 (good!), but cvRound(20.5f) returns 20 and not 21 as expected cvRound is simply implemented thus, so it seems to...

Asynchronous calls with delegate

c#,delegates,asynchronously
I'm currently using delegate to make asynchronous calls in a for loop, the issue I'm running into is - how do I know when those asynchronous calls are finished? for example: public delegate string GetMergeSectionCaller(string something1, out int threadId); public Dataset GetDataset (param1, param2) { int threadId; Dataset ds =...

Php not equal array combine

php
I can't understand how to combine these arrays. $data = array("a", "b", "c") $array = array(0 => Array(1 , 2, 3), 1 => Array(4, 5, 6)) I tried different functions such as merge, combine, map.. Result has to be: array( 'a' => array(1, 4), 'b' => array(2, 5), 'c' =>...

Perl can't catch bzip2 console output

perl,bzip2
I have some difficulties with my perl + gtk GUI app. Why can't perl catch bzip2's output text from console? Instead of being catched into variable, output is just printed in console. I have no problem with any other program - it's just bzip2. My code: wypisz($cmd); my $out =...

How do I make Powershell wait until a command is done before continuing?

powershell
My script uninstalls a Windows Store app before installing the newer version. I need to make sure the uninstall is finished before installing, so how can I make sure I've waited long enough? Remove-Appxpackage MyAppName # ~wait here~ Add-Appxpackage .\PathToNewVersion ...

Pass content as object in angular-strap popover

javascript,angularjs,angular-strap
I am trying to do the following: I have a json array of questions which I pass like this: <a href="" ... title="Questions" data-content="{{item.questions}}" data-template="popover.question.tpl.html" ... bs-popover> {{item.questions.length}} </a> and a template 'popover.question.tpl.html' that contains the following code: <div class="popover"> <div class="arrow"></div> <h3 class="popover-title" ng-bind="title" ng-show="title"></h3> <div class="popover-content" ng-model="content"> <ul>...

Visual Studio SharePoint API Code Works on other Computers but not mine

c#,visual-studio-2012,sharepoint
C# Console Application connects to SharePoint 2013 on other machines. I run it on my laptop and I continue to get a 401 Unauthorized error. I am able to connect to the SharePoint through my browser without any problems.

FindBugs custom detector to check variable naming

java,variables,findbugs,static-code-analysis
I am working on a custom findbugs plugin which finds the variable naming errors in java classses. For example Button variables must starts with btn* and if not, report it. Button btnSave; // It's ok Button close; //Report it, not starts with btn I have been working on this project...

Remove part of an array if its not contain

php,arrays,remove-if
I have an array in php called $json. It looks like this Array ( [0] => Array ( [name] => Knife [url] => http://steamcommunity.com/market/listings/753/297120... [price] => 0.16 USD [image] => http://steamcommunity-a.akamaihd.net/economy/imag... [quantity] => 30 [game] => Counter-Strike: Global Offensive ) [1] => Array ( [name] => Strange Knife [url] =>...

How to get sed to include a double \\ that's included in a variable

sed
I'm writing a script in bash that performs a simple transform of a file we'll call storage.config. Parameters are passed from our automation system (VCAC\AppD) to our action script, which performs the transform using sed. To keep things simple, I'll use the following example storage.config - To be transformed url=jdbc:sqlserver://@myDB...

[R]: applying a function to columns based on conditional row position

r,for-loop,conditional-statements,apply
I am attempting to find the number of observations by column in a data frame that meet a certain condition after the max for that column has been encountered. Here is a highly simplified example: fake.dat<-data.frame(samp1=c(5,6,7,5,4,5,10,5,6,7), samp2=c(2,3,4,6,7,9,2,3,7,8), samp3=c(2,3,4,11,7,9,2,3,7,8),samp4=c(5,6,7,5,4,12,10,5,6,7)) samp1 samp2 samp3 samp4 1 5 2 2 5 2 6 3...

Gradle plugin task ordering

java,gradle,build-process,build.gradle
What I have? Java source file with Main class (MainApp) gradle build script apply plugin: 'application' mainClassName = "MainApp" sourceSets.main.java.srcDirs = ['.'] So when I do gradle run, it executes main method and everything works just perfectly. C:\tmp\gradle-fun>gradle run :compileJava :processResources UP-TO-DATE :classes :run Hello MainApp !! BUILD SUCCESSFUL What...

What is the AT&T syntax equivalent for Intel instructions with the same suffix?

x86,att,mmx
In AT&T syntax instructions often have to be suffixed with the appropriate operand size, with q for operations on 64-bit operands. However in MMX there is also movq instruction. So how will this be represented in AT&T? Is another q suffix needed like movqq %mm1, %mm0 or not? And if...

PHP : return last inserted Id on statement

php,mysql
So I want to get and return last inserted id from query. I am successfully get the last inserted id but I have a little problem when try to return it to index.php file This is my method code : public function InsertUserCard(UserCard $uc) { if(!$this->DuplicateUserCard($uc)) { $stmt = $this->conn->prepare("INSERT...

Mount SMB/CIFS share within a Docker container

linux,windows,docker,mount,cifs
I have a web application running in a Docker container. This application needs to access some files on our corporate file server (Windows Server with an Active Directory domain controller). The files I'm trying to access are image files created for our clients and the web application displays them as...

Matlab Code to distribute points on plot

matlab
I have edited a code that i found online that helps me draw points somehow distributed on a graph based on the minimum distance between them This is the code that i have so far x(1)=rand(1)*1000; %Random coordinates of the first point y(1)=rand(1)*1000; minAllowableDistance = 30; %IF THIS IS TOO...

Wrapping a block of text if the line that textView sits on gets too long

android,xml,android-layout,layout
I'm looking for the best way to meet this requirement. I apologize if it's been answered elsewhere, I can't find a solution to what seems like an easy problem. You have a line of text in a list that looks something like this: Title of the item - (5 items)...

HowTo configure phpMyAdmin to show specific databases only for root user

php,mysql,phpmyadmin,apache2,ubuntu-14.04
I just installed phpMyAdmin 4 on Ubuntu 14.04 with access for multiple users. This works fine but I am wondering how to hide specific databases for all users except root. For all users I edited /etc/phpmyadmin/config.inc.php: $cfg['Servers'][$i]['hide_db'] = '^(information_schema|mysql)$'; And how to configure phpMyAdmin to show this databases only for...