FAQ Database Discussion Community


“”“Diagonal”“” -1/+1 Matrix

matlab,matrix
I need to construct the tech cycle constraint matrix Aa and the right side ba. The aim is building the technology cycle matrices in order to solve the scheduling linear problem constrained by Ax<=b. In this case -1 and +1 in A refers to the coefficients of the constraints of...

Creating array to hold 1000000 numbers

c,arrays
I wrote a code in C that read a text file with numbers into memory and the create an 2d int array to store them. The file has the following format: 9 9 5 6 2235 45558 6 5544 56565 2 The first number is the size of the array...

Passing complex types from SignalR hub to javascript

javascript,c#,asp.net,signalr
From the hub i need to call a function on the client that is expecting an undefined number of object-type parameters like this {name: 'John', age: 20}, {key: 'Smith', id: 5, ...} ...etc but i obviously can't write the arguments like that on the server side. I could just send...

Catch rails confirm box action

ruby-on-rails,ujs
I have the following rails button: <%= link_to "Remove Product", product_path(product), remote: true, method: :delete, data: { confirm: 'Are you sure you want to delete this product?' } %> I'm using rails-ujs to show the confirm() dialog; is there an easy way catch the confirm answer with javascript?...

Documents are removed from MongoDb but sh.getShardDistribution() command still shows chunks available on each shard

mongodb,sharding,chunks
I removed all documents from my collection as mongos> db.myCollectioName.remove({}); WriteResult({ "nRemoved" : 88517 }) mongos> But when i ran the following command it showed me chunks:5 for each shard mongos> db.myCollectioName.getShardDistribution(); Shard shard0 at shard0/some_ip1:some_port,some_ip2:some_port,some_ip3:some_port data : 0B docs : 0 chunks : 5 estimated data per chunk :...

Does TypeScript infer castings when assigning anonymous objects to a typed property?

typescript
Bit of a convoluted example, but I'm not sure why TypeScript isn't throwing an error here. export class Square { width: number; } export class MyShapeBox<T> { shape: T; } var mySquareBox = new MyShapeBox<Square>(); var rectangle = { width: 3, height: 10 }; // Should this not fail? mySquareBox.shape...

display calender in click event

javascript,jquery,html
This code is working well in input box.it is not working in a tag I want to get the same action in a tag 'sample' I attached my code. <div id="datepickerContainer"> </div> <input id="datepicker" type="text"> <script src="/external/jquery.js"></script> <script src="/jquery-ui.js"></script> <script> $( "#datepicker" ).datepicker({ inline: true }); $('#datepickerContainer').on('click',function() { $( "#datepicker"...

getActiveSession gives null on Activity start although logged in to Facebook

android,facebook,facebook-sdk-4.0
I'm trying to implement a logic where the Activity starts normal when the user has already an opened session in Facebook. When the user is not logged in he is forwarded to a LoginActivity. However I couldn't find any approach yet that works fine. When I use the getActiveSession() method...

Checking out multiple files of the same name in Git

eclipse,git
I merged from several other branches on a big project with multiple eclipse projects, and ended up with a bunch of org.eclipse.jdt.core.prefs settings being changed, that I'd like to revert on my branch. Is there magic command I can use to 'reset' only these files, over all the eclipse projects...

using subprocess for the youtube-dl for automatic song list downloading

python,json,youtube,subprocess,youtube-dl
From the following code, I want to query each line which contains a song name (a line from a file "playlist.txt") from the google search engine, then based on the results I am taking the youtube link and using the youtube-dl, I am extracting the audio. When i run the...

Disable TFS Check-In Based on Work Item State

tfs,tfs2012,tfsbuild
I've been wondering if it is possible to deny a TFS check-in based on certain policies. In TFS I can set that you need to associate the code with a work item to do a check-in, and I can see that you can add a Work Item Query Policy that...

Using $watch method in AngularJS

javascript,angularjs,watch
I'm following the book "Pro AngularJS" by Adam Freeman. But I'm stuck at listing 15-10. The code he provided doesn't work at all. The demo code is below. It's supposed to work in the following manner: when we click on the button to modify the prices, this list must update...

How to avoid variable substitution in Perl regex?

regex,perl,variable-subsitution
I have the following regex: my ($pkg) = ( $xmldirname =~ /$db(.*)^/ ); What it should do is: check if the xmldirname starts ($) with "db" and take the rest of the string into $pkg. What it does is: "Global symbol $db requires explicit package name". How do I do...

Correct structure for github libraries

php,git,github,composer-php
I wrote a cURL-class that I wanted to share on github and also make available through composer. I successfully put my lib on github https://github.com/tzfrs/SimpleCurl, but I still have problems understanding the correct folder structure. I currently have it like that: The git repository is named "SimpleCurl" The repository contains...

python multithread not working in my code?

python
from threading import Thread def multithread(): t1= Thread(target = producer) t1.run() t2 = Thread(target = consumer) t2.run() def producer(): print "current thread id is {0}".format(Thread.name) def consumer(): print "current thread id is {0}".format(Thread.name) running result shows me that they are in the same thread ?? why ? any wrong in...

jsPlumb multiple instances dnd bug

jquery,drag-and-drop,multiple-instances,jsplumb
im using jsPlumb with multiple instances in one Overview, all created dynamicly. Its way to mutch code to post it in here und as it is dynamicly generated from mySQL i cant generate a fiddle. But maybe someone has had that problem before and knows where that bug is created...

How exactly works Spring AOP context selecting pointcuts?

java,spring,spring-mvc,aop,spring-aop
I am studying for the Spring Core certification and I have the following doubts try to understand how AOP Context Selecting Pointcuts work and for what pourposes it is used for. So looking on the documentation I read that pointcuts can also select useful join point context instead the simple...

how do you doing for autocomplete one form from database for update information in django

python,mysql,django,forms,web
views.py def editarmission(request): if request.method=="POST": formulariomission = FormMission() if formulariomission.is_valid(): formulariomission.save() return HttpResponseRedirect('/albatrosmt/misiones') else: formulariomission = FormMission() return render(request,'editarmission.html',{'formulariomission_template':formulariomission}) and formularios.py class FormMission(ModelForm): class Meta: model = bd_mission fields = ('missionname','dispositivos_id', 'commits') My question is how i can introduce the information from database...

Is possible to efficiently skip a line of an unknown size in Java?

java,file
While reading very huge files (GB scale) in Java, I know exactly which lines I need to process. But, I do not know the size of each line and they could be different. My question is the following: Do you have an efficient approach to skip useless lines ? My...

How to fix AOT ExecutionEngineException for GenericEqualityComparer of struct in Unity

c#,unity3d,mono
I'm making a Unity game on iOS. I'm aware of the AOT limitations. When I added a Dictionary which happened to have a struct Key type, I got a flurry of ExecutionEngineExceptions. Most of these I could fix by dummy-declaring things, to make it visible to the AOT compiler: Dictionary<MyStruct,GameObject>...

How to query the three best players in Oracle?

sql,oracle
I have the following table: NAME | SCORE ALICE | 100 BOB | 90 CHARLES| 90 DUKE | 80 EVE | 70 ... My question is the following: How can I extract with one query the name of the three best players? In my example the query should return four...

C FILE I/O, USING TXT FILE

c
I am just learning C language and I am experiencing a problem with implementing a program with test.txt file as input to the program. contents of test.txt file is: 1 30 30 40 50 60 2 40 30 50 60 60 3 30 20 10 20 30 4 40 20...

Find nearest points of latitude and longitude from different data sets with different length

r
I have two data set of different stations. The data are basically data.frames with coordinates, longitudes and latitudes. Given the first data set (or vice versa), I want to find the nearest station for each station in the other data set. My main problem here is that the coordinates are...

Disabling Swagger with Spring MVC

spring-mvc,swagger
I am using Swagger with Spring MVC. I would like to selectively disable swagger in specific environments (like Production). How can I do that?

hexdump and reading binary files to text

linux,text,binary,hexdump
Could someone tell me what the fraction for the hexdump command in linux means hexdump -v -e '7/4 "%010u "' -e '"\n"' binary-file-name I believe it tells hexdump when to stop reading the binary file and start another line? im unsure and i couldnt see an obvious answer in the...

Cast List to unknown type c#,dynamic
I have a input string, which is received by a file. It contains some values, separated by ; E.g. 1;2;3 I want to convert this to a List. The property is retrived by reflection, so i don't have any fix list type. In short: As inputs i have a PropertyInfo...

how to apply strftime on localtime

sqlite,sqlite3,android-sqlite
I want to get the day of the month from a datetime column in my Sqlite database. I could use simply select strftime('%d',myColumn) from myTable But the values are stored in UTC in the database and i want to get the dates based on the localtime. So i can do...

Identically named parameters for nested function calls and ellipsis

r,parameter-passing,ellipsis
Let's consider the following situation: foo <- function(param, ...) { print(paste("foo:", param)) bar(...) } bar <- function(param = NA) { print(paste("bar:", param)) } Question: how to call foo, so that foo gets param = "foo" and bar gets param = "bar"? Answer is given here, one can use partial matching:...

CSS - Connecting multiple :hover with different section

html,css,hover
I need little help with :hover on multiple objects with different colors. When I hover on the first section, the second one should change the color too. HTML <section class="object1"></section><section class="object2"></section> CSS .object1 { background-color:#F00; width:100px; height:50px; } .object2 { background-color:#00F; width:100px; height:50px; } .object1:hover{ background-color:#FF0; } .object2:hover { background-color:#000;...

Building a bit flag using linq / lambda

c#,linq,lambda,bitmask
Is it possible to build up a bit mask based on the result of a linq query; for example: class MyClass { public int Flag{get;set;} public bool IsSelected {get;set;} } myVar = GetlistMyClass(); int myFlag = myVar.Where(a => a.IsSelected).Select(?); ...

LinkedIn Api Callback expires session [closed]

asp.net,asp.net-mvc-4,session,linkedin
I have TYPE in session e.g. Session["TYPE"]. I access LinkedIn Api to get a LinkedIn user profile but after authentication in LinkedIn Api when Redirect URL is called back my session is expired, which means now Session["TYPE"] is null. Same process is working perfectly on my development server, there is...

Esri InfoWindow not showing results returned

javascript,arcgis,infowindow,esri
I was having some problem when trying to retrieve data and show them onto the infoWindow using ArcGIS. Here is my javascript: var map; require(["esri/map","esri/dijit/Scalebar","esri/layers/FeatureLayer", "esri/dijit/Legend", "dojo/_base/array", "dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer","esri/InfoTemplate","dojo/dom-construct","dojo/domReady!"], function(Map,Scalebar, FeatureLayer, Legend, arrayUtils, parser, InfoTemplate,domConstruct){ parser.parse(); map=new...

What is the best way to host an ASP.NET MVC6 Application

asp.net,asp.net-mvc-6,vs-2015-preview
If I understand correctly part of the motivation of ASP.NET vNext is to reduce overhead. An MVC6 application can be self hosting. My question is what is the best practice way of hosting a ASP.NET vNext application. Is there something similar to the WCF activation services that monitor the health...

Inheriting an interface with a refined return type [duplicate]

c#,inheritance
This question already has an answer here: Understanding Covariant and Contravariant interfaces in C# 2 answers subtype and covariant return type 6 answers If I have interface Parent{} interface Child : Parent {} interface MyInterface { Parent P {get;} } why doesn't class MyClass : MyInterface { public Child...

Detect OS Language & Provide Different Language Dropdown Menu

.net,vb.net,visual-studio-2012
I have a small application to update user's details in Active Directory. The application works fine in English. But I now want to modify it to start using it for French, Italian & German users. So I'd like to be able to detect the OS language, and then provide the...

Linux commands to substitute pattern with conditions

linux,shell
I am still learning Linux commands, and I was wondering if anyone could help me out with what I am trying to do: I have a file like this: 3 rs123 0 600001 A G 3 rs345 0 600002 T G 3 3:124369637:A_G 0 124369637 A G 3 3:124369637:G_GT 0...

Google column chart with logarithmic rendering values below baseline

javascript,google-visualization
Problem I am rendering a column chart using the Google charts javascript API where some it is possible that some of the values can be under 1%. When I render these values the bar is being rendered below the baseline of the graph. If these values are >= 1 then...

Ribbon Load Balancer cannot see list of servers

java,spring-boot,spring-cloud
I am playing around with SprinG Cloud 1.0.0.M3. I have my Eureka as well as my configuration servers work. I also have two microservices: fancyserver and fancyribbon. The server code is the standard Hello World: @Configuration @EnableAutoConfiguration @RestController @EnableEurekaClient public class Application { @RequestMapping("/") public String home() { return "Hello...

Azure API Management - OAuth server Token endpoint?

azure,active-directory,oauth-2.0,azure-api-management
im currently setting up an Web API on Azure Cloud Service and want to use Azure API Management with OAuth and Azure Active Directory (AD) as Authorization Server. My question is: In AD I have created my application and looking in the "View Endpoints" list my endpoint for the token...

what happens when executing `(read “[Red]”) :: [Color]` under ghci?

haskell,real-world-haskell
I am reading RWH Chapter 6 typeclasses 's subsection about a instance of Read for Color, which implements readsPrec function, I don't know what happens when I type (read "[Red]") :: [Color] under ghci, finally I got [Red] For simplicity, I change this implementation of the function a little as...

How to grep strings in executable

bash,grep
I would like to grep every word in every files (including executables and recursively) in a folder. I already tried strings * | grep -Hn 'word'. But it return: (standard input):32824:word (standard input):84015:word ... Instead of: test:3:word welcome.exe:15:word ... I understand that it's because of pipe that return strings *...

How to use relative paths in ReSharper DotSettings layers

resharper
We want to share .DotSettings between several solutions. The goal is to have one CodeStyle.DotSettings that we reference as a layer in all our X.sln.Dotsettings. However, I am seeing unexpected behaviour when I add the layer. I go to "Manage Options", right click "Solution X team-shared" -> "Add Layer" ->...

View worker / executor logs in Spark UI since 1.0.0+

apache-spark,yarn
In 0.9.0 to view worker logs it was simple, they where one click away from the spark ui home page. Now (1.0.0+) I cannot find them. Furthermore the Spark UI stops working when my job crashes! This is annoying, what is the point of a debugging tool that only works...

Should I use OrderByDescending twice in LINQ?

c#,performance,linq
I have a products table like this:- ProductID ProductName Price 1 Milk 10 2 Banana 20 3 Apple 15 1 Grapes 12 2 Banana 25 1 Milk 8 I want to find the products who have maximum price for each productId. Sample Output:- ProductID ProductName Price 1 Grapes 12 2...

Dart on CentOS 6.5

dart,centos6.5
I'm trying to get dart up and running on a CentOS 6.5 machine. The furthest I got so far was getting Dart Editor 64 bit up and running. When clicking run in Dartium, I get the following error: "Could not start pub serve or connect to pub" When running Dart...

Lyx not working with any \cite, or MMD cite

lyx,cite
I have a slight problem with Lyx and citations that I have not been able to find a solution to anywhere else. When inserting any citation style, such as the following (notice #1 and #4 are identical, expect that #1 is greyed out as i inserted it manually): Lyx outputs...

Detect synthetic clicks on a webpage

javascript,events,click
Through Javascript is it possible to detect synthetic clicks (the clicks that were not generated by human but instead was generated using JS or some other automation tool) ?

How do I convert a CVS repository to Mercurial on Windows?

mercurial,converter,cvs
I can access the CVS server which is authenticated with :pserver:, I managed to checkout from CVS, now I want to try to convert this to Mercurial, with history from CVS. So, I tried hg convert location-of-CVS-repo I get the following: assuming destination repo-hg initializing destination repo-hg repository connecting to...

Assigning FileUpload value to a variable in asp.net

c#,asp.net,variables,file-upload
Is it possible to assign image uploaded using fileupload assigned to a variable? If yes then how can it be possible?

How to convert a list into string and this string back to the initial list?

python,string,list
I have the following issue with Python and I was wondering if there is a direct way to deal with it (using a specific function which I am not aware of, etc.). I have a list with different types of inputs (integer, string, etc.). I transform the list into a...

Ruby: How to generate lines of code inside a program?

ruby,metaprogramming,parslet
I am developing a parser in Ruby using the parslet library. The language I am parsing has a lot of keywords that can be merged into a single parsing rule like this: rule(:keyword) { str('keyword1') | str('keyword2') | str('keyword2') ... } Is there a good way to generate this set...

vimscript match combine \V with word boundaries

regex,design-patterns,vim,match,word-boundary
I have the problem that I want to combine the \V and word boundaries in the match function, like this: let index = match(line, "\\<\V".pattern."\v\\>") the following works perfect: let index = match(line, "\\<".pattern."\\>") Does anyone have an idea how to combine those two things?...

Create command For creating Node in Neo4j

neo4j
I was going through Neo4j Manuals to get started with Neo4j. So I installed Neo4j server and created my first node from the docs CREATE (n:Actor { name:"Tom Hanks" }); As a node can have labels and properties. I interpreted the above query as creating a node with label Actor...

Remote Powershell return value

powershell,iis,winrm
I want to run a powershell with WinRM on serveral servers. I am using Invoke-Command with a script block. I am reading from IIS and want to return a AppPool-Object, but I cannot access its properties - always empty. #--imagine this code in a foreach block $result = Invoke-Command -ComputerName...

Checking if input is integer

c++,cin
I know that there are many questions like this, with correct answers. However, what I am concerned here is why my explanation of the below code is wrong. #include <iostream> #include <string> int main(){ std::cout << "Write an integer:\n>"; int n; std::cin >> n; while (!std::cin) { std::cout << "ERROR,...

What's the purpose of Generics in a method inside a class which doesn't use Generics?

java,generics
I've seen this code approach in a lot of API's ant always wondered what was the real purpose of it. If we have a class with a simple signature, let's say: public class MyClass {...} And inside this class we have a variable of type Object, with a getter and...

How to use required_if Laravel Validation in php

php,validation,laravel
I want to give validation if weight is not empty then shipping_cost required and vise verse. array('weight' => 'numeric|required_if:shipping_cost,value', 'shipping_cost' => 'numeric|required_if:weight,value') What will be the value for 'weight,value' and 'shipping_cost,value' ?...

iOS click on dynamic UIButton crashes

ios,onclick,crash,uibutton,addtarget
I'm creating programmatically a UIButton with an Image. UIButton * bericht = [[UIButton alloc] initWithFrame:CGRectMake(tableView.bounds.size.width- height, 0, height, height)]; [bericht setBackgroundImage:[UIImage imageNamed:@"bericht.png"] forState:UIControlStateNormal]; [bericht addTarget:self action:@selector(imageClicked:) forControlEvents:UIControlEventTouchUpInside]; [cell.contentView addSubview:bericht]; - (void) imageClicked:(UIButton *) sender { NSLog(@"test message"); } When I click on this button I got the following error code:...

Primefaces commandButton asynchronous actions not fired

ajax,jsf,primefaces,commandbutton
i have a Primefaces application in which i fire up a dialog that contains a form. The dialog has a save/cancel button-pair. Within this dialog, i do not manage to have the oncomplete, onstart, etc., methods called. I saw on other replies the cause is no AJAX is being executed....

Java REST Api (running on tomcat) - easiest way to get real-time synchronization between client and Server

java,mysql,ajax,backbone.js,real-time
I wanted to achieve real-time synchronization between my clients and my server without Ajax Interval pulling. So here is my setup: Frontend: Backbone API: Java REST Api (GET/PUT/POST) Database: MySQL So this is how my webapp works right now: Ajax Request to API -> API retrieves information from Database ->...

How to search a string(Phone number) which can be stored in different format in mssql

c#,sql,asp.net,sql-server
I am having a table of customers where we are having phone number field defined as varchar(50). Since there is no validation different customers have saved there phone number in their own preferred way eg cust1 --> xxx-xxx-xxx cust2 --> (xxx)xxx-xxx cust3 --> xxx xxx xxx this hasn't created any...

write inline select query with LINQ to SQl

linq-to-sql
Pardon if title is improper.. How to write below sql query with linq to sql without dividing it in multiple parts? select BookName, Author, TotalCopies=(select COUNT(*) from tbEHBookCopies c where c.BookID=b.BookID) from dbo.tbEHBooks b ...

How to return to some activity after button finish is clicked

android
I have this in last activity where is inserted into database: btnFinish = (Button) findViewById(R.id.btnFinish); btnFinish.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle extras = getIntent().getExtras(); if (extras != null) { Name = getIntent().getExtras().getString("Name"); Email = getIntent().getExtras().getString("Email"); Phone = getIntent().getExtras().getString("Phone"); } new SummaryAsyncTask().execute((Void) null); startActivity(getIntent()); } }); Currently...

Reload data of page after the modal is closed

angularjs,controller,modal-dialog
I have a page, let me call it "Basic Page" where I call modal. In this modal I do something and after I close the modal I should reload the data of "Basic Page". How are this two scopes related with each other and what is the solution of this...

Regular Expression to avoid optional group inside an URL

java,regex
I need a regular expression to validate an URL like this: Valid http://url-example.com http://url-example.com/anything http://www.url-example.com http://www.url-example.com/anything Not valid http://url-example.com.br (not valid) http://www.url-example.com.br (not valid) http://www.url-example.com.br/anything (not valid) The main goal is to ignore all URLs finishing with .br or with .br plus the subdirectories. In Java I'm doing this: Pattern.compile("http:\\/\\/(www\\.)?url-example.com^(\\.br).*");...

In HTML & CSS, can't properly see my icons in front of my buttons

html,css,html5,css3
I've tried to create a background which, when hovered over reveals 2 buttons. Each of these buttons should then have a different icon on it. I've also attempted within css to alter the color of each, of these icons from black to white. But for some reason I'm not being...

Finding active iframe with Selenium

selenium,iframe
i am trying to navigate a page with Selenium WebDriver, and have the problem, that there are up to 3 iframes in this page, but only one is "active" the others are set on display: none everytime i move from one page to another, the new page is loaded in...

Changing css properties in an iframe based on parent window

javascript,html,css,iframe
I'm trying to run an iframe on two different pages on a website but with different css properties. Due to a limitation of space on my index.php, I'd like to confine text in the iframe to a small width, whereas on another page (samples/index.php), there is no limitation on width...

How can I call .map() on ImplicitlyUnwrappedOptional?

swift
Optional<T> has map method. /// If `self == nil`, returns `nil`. Otherwise, returns `f(self!)`. func map<U>(f: (T) -> U) -> U? When we want to convert Int? to UInt64?, we can: let iVal:Int? = 42 let i64Val = iVal.map { UInt64($0) } Instead of: var i64Val:UInt64? if let iVal =...

Php How to split a string containing special characters

php
Hello I have a string as $str = "[10-1],[20-2],[30-3],"; this I want to split int two arrays as- Array1 ( [0] => 10 [1] => 20 [2] => 30 ) Array2 ( [0] => 1 [1] => 2 [2] => 3 ) How it can be done? also my variable...

Java ArrayList.add() method thread safe for purely parallel adding? [duplicate]

java,multithreading,arraylist,thread-safety
This question already has an answer here: Collections.synchronizedList and synchronized 5 answers Consider a for-loop over a function that takes an ArrayList reference and adds an object to that ArrayList. I would now like to execute each function call in parallel. Is the ArrayList.add() method thread safe if I...

Microsoft.Composition (MEF2) Conventions and Open Generics

c#,mef2
I have a type public class Queue<T> : IQueue { .... } I can export this using [Export(typeof(Queue<>))] which will enable me to import with [Import] Queue<StockController> [Import] Queue<FileController> However, I would like to import these types as [ImportMany] IQueue which doesn't seem possible without creating concrete types for each...

Can I validate input with dynamically assigned min attribute in AngularJS?

javascript,html,angularjs
I've got two input fields of type number. I want second to have minimum attribute dependant on first field. I can dynamically change the attribute, but ng-valid does not change, when value is lower than minimum. jsfiddle code example: http://jsfiddle.net/NBhn4/87/ Is that a bug or am I doing something wrong?...

How to add the borders to the UIBarButtonItem

ios,objective-c,uibarbuttonitem
I want to have the following look of the UIBarButtonItem: And I have this image. (save it because it has the same color as StackOverflow background so you're unable to see it right here) How can I add the borders like in the first image to the UIBarButtonItem? Is it...

server side operation only return data to grid for particular page

c#,linq,kendo-ui,kendo-grid,kendo-asp.net-mvc
I'm using telrik mvc grid I can get pagination to work but want to know how I can only return the data the user can view. For example, A user has a total of 50 records page size is set to 5 and the current page is 1. On initial...

How to use Guice AssistedInject with multiple implementations of an interface?

java,guice,factory,assisted-inject
I'm having trouble finding how to have a "dynamic AssistedInject". What i mean by that is i would like to provide to the factory the implementing class name it needs to use at runtime based on a parameter. Here's what i currently have: interface Letter {} abstract class ALetter implements...

CALayer with NSScrollView, zooming panning and clicking

osx,calayer,nsview,nsscrollview
I have a CALayer hosting view, which I would like to be able to zoom, scroll around and click in. If I embed it in a scrollview, the scrolling works fine, but zooming causes the contents to fly away everywhere. If I don't embed it in a scrollview, I can...

GNU Makefile - Generic Makefile for several targets

c++,makefile,rules,targets
I am currently developing a little C++ package with small code examples for teaching purposes. I managed to write a Makefile like the following that will compile all *.cpp files to *.o files an link them to executables: CC=gcc CFLAGS=-g LDFLAGS= -lstdc++ ECHO = echo SILENT = @ MODULES =...

Twisted - Stop all Deferred in DeferredList

python,twisted,deferred
I have a few task in DeferredList and sometimes worker can throw some error. How to stop all Deferrs in DeferredList? if something going wrong in worker def worker(word): #can throw Exception return word.upper() def worker_err(error): #todo: stop all deffered in list return 0 def processing(words): workers_list = [] for...

Using reflection Invoke

.net,visual-studio,reflection,c++-cli,invoke
It is possible to call function with int* arguments using reflection Invoke? My dream code: Function for invoking: long Invoked_Function(Int32, Int32*); Invoking code Int32 First_Parameter; Int32 Second_Parameter; Int32* Second_Parameter_Pointer = &Second_Parameter; array<Object^>^ Parameters_Objects = gcnew array<Object^>(2){ First_Parameter, Second_Parameter_Pointer}; long Result = (long)Function_Type->Invoke(Class_Instace, Parameters_Objects); It sying me about string "array^ Parameters_Objects...

Paginate Advanced Custom Fields results in WordPress

php,wordpress,pagination,advanced-custom-fields,paginate
I'm currently using the 'Advanced Custom Field' WordPress plugin, and I'm wondering if it's possible to paginate my results. Here is the code I'm using on a custom page template: <?php while ( have_posts() ) : the_post(); ?> <?php $args = array( 'posts_per_page' => 5, 'meta_key' => 'course_date', 'order'=> 'ASC',...

Adding new data with a file upload

javascript,c#,asp.net,ajax
I have this form which has two fields, a name and a image field. Below is the code for the form @using (Html.BeginForm("AddNewRecipe", "Kitchen", FormMethod.Post, new { enctype = "multipart/form-data", id = "addNewRecipe", data_partitionId = Model.Id })) { <input type="text" placeholder="Recipe Name" name="newRecipeName" id="newRecipeName" value="" /> <input type="file" accept="image/*" name="newRecipeImage"...

How to do update if exist without creating a duplicate row in SQL?

mysql,sql
I want to update the table called "user_star_rate" if the row is exists, otherwise insert data into table. It works well, but it is creating a duplicate row when updating. I want to prevent this problem. Here is my SQL code. $rate = "INSERT INTO user_star_rate (email, product_id, rate_value) VALUES...

Transposing a Column in Oracle

oracle,oracle11g,pivot
I have requirement in which I have to return data in following format: Batch Id Element1 Element2 Element3 .. Element n Date ------------------------------------------------------------ 1 0.25 1.5 3.5 2.2 1/12/2014 2 1.3 2.3 5.5 1.1 5/12/2014 3 4.5 5.5 4.3 6.3 7/12/2014 .. .. .. .. .. .. n 1.5 2.3...

add jframe in system tray on the click of cross not in the case of minimize button

java,swing,jframe,system-tray,windowlistener
frame.addWindowStateListener(new WindowStateListener() { @Override public void windowStateChanged(WindowEvent e) { if (e.getNewState() == ICONIFIED) { try { tray.add(trayIcon); frameLogin.setVisible(false); } catch (AWTException ex) { } } } }); this will add my application in system tray but i want to add my application in system tray when user clicked on cross...

User config section with a list

c#,custom-configuration
I know that what I am trying to do is possible, because I have done it - I just no longer have access to the code that I did it in. What is more, I cannot find using Google the details for how to do it. I have a config...

passing a variable to XSLT from .vb file - without XML

asp.net,xml,vb.net,xslt
How to pass the constant variable to xslt , here I hard coded the college name in the xslt, but I don't want to do that way instead I want to pass that college name "CollegeName" as string. < xsl: template match="/"> < xsl:for-each select="Analysis"> <html> <body> <table> <tr> <td...

jQuery - Block input until after $.getJson is done

javascript,jquery,json,synchronize
I need to make sure that all user-input is blocked until the json data are recieved and processed. I read somewhere that I can do this with Deffered objects, but it doesn't seem to work. My code: function checkDTCCardAvailability() { var defer = $.Deferred(), isAvailable = defer.then(function() { $('#pass-search-form').block({ message:...

Which update to install in nexus 7 4.3 manually?

android-5.0-lollipop,nexus-7
I got new nexus 7 2013 edition wifi with 32 gb razor flo with 4.3 . Automatic system update is showing updating to 4.4.2 and its very slow stick at 253.2 mb . I want to know which update can i install manually via adb , I downloaded 5.0.1 image...

From y(x) animation to y(t) at a given x

python,matplotlib,args,kwargs
I am currently running code simulating a string's motion, and I wish to read its amplitude at a given point and plot this as a function of time, thus representing data that would be read from a guitar's pickup. As I am new to animation in python, the task of...

ambiguous call to overloaded function with “bind” when i add header file“boost/function”

visual-studio-2012,c++11,boost,bind
I write a test of boost::function. These codes are working. #include <iostream> #include <boost/lambda/lambda.hpp> #include <boost/bind.hpp> //#include <boost/function.hpp> #include <boost/ref.hpp> using namespace std; using namespace boost; template<typename FUN,typename T> T fun( FUN function, T lhs, T rhs ){ cout << typeid(function).name() << endl; return function(lhs,rhs); } int add4(int a, int...

How to get all of the input value using a class name in jQuery?

jquery
This is my code: $(document).ready(function () { $("#afiseaza_subtotal").click(function(){ var i = 0; var list = []; $(".name1").each(function(){ list[i] = $(this).val(); i++; }); var uniqueNames = []; $.each(list, function(i, el){ if (el !=""){ if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el); } }); var html = ""; if (uniqueNames.length > 0){ $.each(uniqueNames, function(i, value){...

Whitespace in returned query with Python and py-postgresql

python,postgresql,whitespace,removing-whitespace
I'm using the py-postgresql driver. Whenever I do a SELECT it works correctly, but I get the full width of the column returned, with whitespace. So if I have a field of character(25) which holds "Name", and do: SELECT name WHERE name = 'Name' I get "Name " << "Name"...

Rotate a line by a given angle

math,geometry,netlogo
Given the coefficients of a line A , B and C. Ax + By + C = 0 I wish to rotate the line by angle say x in clockwise or ant-clockwise direction. How can I achieve this so that I get new coefficients then?(In NetLogo) EDIT: Sorry consider point...

iOS VIPER architecture, who has to instantiate a whole module?

ios,architecture
Taking into account the VIPER structure I have two modules, A and B. The first module A, via presenter, wants to perform an action that has to be done in the module B, so tells its wireframe to do it. The question is, who is responsible of instantiate the whole...

How to define URL in Javascript to call ActionResult methode which resides in a controller

javascript,ajax,asp.net-mvc,entity-framework,crud
i have created web application in MVC using Entity Framework to perform CRUD operations. in when i Delete any record it takes me to Delete View and then i am able to Delete that Record. but instead of doing that i want to have a alert box stating "Are you...

Difference between exporting an unsigned and signed app package

android,export,apk
How do I differentiate between exporting the app for launching it as to whether I should select the unsigned option or signed option. There are many posts, but I didn't find anything useful as to describing which one should be used in which case. Please if anyone can elaborate...

How to I select after longpress or holding event in apache cordova visual studio community (spec for windows phone)

arrays,cordova,visual-studio-2012
We are creating a book that should select a particular text after the long press(touch) or holding the window(spec for windows phone) for highlighting the selected text. How should I select the para or word after a long press or holding the window.

XPages (Application Timeout vs Session Timeout) vs (Server Session Timeout)

xpages,lotus-domino
I am finding it difficult to understand the difference/purpose of the following. Edit 1: I was wrong here. It does get updated, just made a mistake between users, so ignore point "1" if anyone is reading this question. Server Session Timeout: I created a Web SSO configuration document and updated...

How to edit JSON array after encoded

javascript,arrays,json
How would I edit a JSON array after it's been encoded as JSON? I would like to edit the following JSON array : {"Status":"OK","Message":"API Call worked","Result":[{"interval":"2014-11-30", "leads":0,"name":"CarEnquiry","status":"NEW","appointment":0}, {"interval":"2014-11-30","leads":0,"name":"CarEnquiry","status":"CALL1","appointment":0}, {"interval":"2014-11-30","leads":0,"name":"CarEnquiry","status":"CALL2","appointment":0}]} To change it to this {"Result":"OK","Records":[{"interval":"2014-11-30",...