FAQ Database Discussion Community


Sidebar Object on Sublime Plugin

python,sublimetext,sublimetext3,sublime-text-plugin
I want to build a plugin in order to affect the sidebar. Mainly visual stuff at first. But I can't find any documentation about it. Is it possible, as we can obtain view() and window() in the plugin, to have something like sidebar(), and be able to treat all the...

How to get filtered results with backbone.localStorage?

javascript,backbone.js,local-storage
I have events collection the contains the following documents: { _id: ObjectId, title: 'Untitled', date: '01.01.2014' } I'm executing the following fetch query /events/01.01.2014 var Collection = Backbone.Collection.extend({ localStorage: new Backbone.LocalStorage("events"), initialize: function () { this.fetch({ url: '/events/01.01.2015' }) } }); The problem here is that collections returns all events...

Mongo not working with nodejs

javascript,node.js,mongodb
I'm working on a simple problem to insert a collection in a Mongo database using Node.js. However I am facing two problems: 1. When I use {safe: true} in the .insert function (below: albums.insert(a1, {safe: false}, cb); and albums.insert(a2, {safe: false}, cb);), the collections dont get inserted in the database...

How to include an overridden model class in a Helper file

ruby-on-rails,ruby,ruby-on-rails-3.2
I have a model app/models/my_model.rb class MyModel < ActiveRecord::Base ... end I have another class overridden from MyModel inside app/models/my_model_r_r.rb class MyModelRR < MyModel ... end I have a helper file in app/helpers/v2/some_helper.rb where I want to use MyModelRR module V2::SomeHelper # Want to use MyModelRR end I tried using:...

Deserialize JSON attribute to class

c#,json,deserialization
For the most part my JSON deserialization seems to work fine except for the last attribute that I added. I have the following JSON string. If I keep my class property type as string for the attribute httpVerb, the deserialization works just fine. But if I keep class property type...

Reduction from 3-Coloring to Fair-3-Coloring

algorithm,graph-algorithm,np
I am exercising for a final. The problem asks to show that the 3-Coloring problem polytime reduces to Fair-3-Coloring (3-Coloring <p Fair-3-Coloring), where: Fair-3-Coloring: Input: Graph Output: "Yes" if each color is used exactly the same number of times. "No" otherwise. So, in essence, I need to somehow modify the...

How to resolve theme has no action bar error, make it so options menu is highlighted?

android,android-layout,github,android-actionbar,android-menu
This is based off my last question - How would you implement this tutorial screen in Android app? I went and looked over the ReadMe for the github project the person recommended - https://github.com/amlcurran/ShowcaseView/blob/master/README.md I followed the instructions and added the github project as a depenency and copied this code...

Switch statement not properly functioning

android,onclick
The goal here is to sense when a certain view is clicked (by ID name identified by the specific button that is clicked) and then trigger an action in an instance of another class. I'm not 100% sure that it is reading correctly. I'll post the code and then explain...

ANTLR4: grammar with runtime matching of number of integers not working correctly

parsing,antlr,grammar,antlr4,context-free-grammar
I am trying out a grammar in the ANTLR 4 book (p. 48-9), but the grammar isn't behaving as advertised. The input is a series of integers. One integer indicates the number of following integers. For example, the first 2 in the following input indicates that there are two following...

Python - parse xml with lxml trouble

python,xml,lxml
I've found a lot of questions on this issue but nothing I saw fits mine. I'm new to lxml so need some help. my users.xml file: <?xml version="1.0" encoding="UTF-8"?> <root> <user> <login>elena</login> <password>elena</password> <group>1</group> </user> <user> <login>anele</login> <password>anele</password> <group>2</group> </user> </root> the trouble function: def analize_data(login): doc = etree.parse("/myapp/users.xml") for...

Having trouble passing $conn variable to functions

php,mysql
I am trying to set up a basic shopping cart application with a link to a database. Obviously I have the connection set up at the top of the code with: $dsn = "mysql:dbname=MYDATABASE"; $username = "root"; $password = "MYPASSWORD"; try { global $conn; $conn = new PDO( $dsn, $username,...

Is there a way to know if a JPanel is finished loading it's content?

java,swing,jpanel,cardlayout
I'm writing an application that adds cards (JPanels) to a CardLayout during runtime. The problem is that some components on the card loads faster than others, making it appear glitchy and not properly rendered before it's displayed. I want it to be ready when shown for the first time. I...

Invalid redeclaration of UITableViewDataSource method?

cocoa-touch,swift
I'm trying to implement the required methods of UITableViewDataSource but I'm getting a weird error: "invalid redeclaration of 'tableview(_:cellForRowAtIndexPath:)'" However I'm not sure what the problem is. Here are the two relevant lines of code, the declaration of the class and conforming protocols/superclass: class SubjectFormViewController: UIViewController,UITableViewDelegate,UITableViewDataSource and the function declaration...

How does getSubimage(…) work?

java,image
I'm trying to extract a part of an image from a BufferedImage. How do I do this? It's not letting me put a value for y that is greater than zero. Ex: getSubimage(0,0,theImage.getWidth(),theImage.getHeight()); //OK getSubimage(0,(int)theImage.getHeight()/2,theImage.getWidth(), theImage.getHeight()); //ERROR! Here is the error message: Exception in thread "main" java.awt.image.RasterFormatException: (y + height)...

How to avoid buffering on stdin and stdout?

rust
When reading from std::io::stdin(), input is buffered until EOF is encountered. I'd like to process lines as they arrive, rather than waiting for everything to be buffered. Given a shell function bar that runs echo bar every second forever, I'm testing this with bar | thingy. It won't print anything...

Deadbolt 2 Restrict function has only one possible failure code

scala,playframework-2.1,deadbolt-2
This question may have a bit of philosophical aspect to it. I have been using Deadbolt 2 (Scala) in my Play application and it works quite well. In looking at the Restrict function definition (line 47) I noticed that it will invoke the onAuthFailure for one of the following reasons:...

Using form_for with nested resources. “Undefined method _index_path”

ruby-on-rails,ruby-on-rails-4
I'm trying to upload files on a form, using Carrierwave. So far, I've managed to 'nest' one model onto another, but now I'm having trouble to do the 'form_for' correctly. The idea is to setup a page (index) that would list the photographs (Fotografias) corresponding to each individual (Individuo), and...

Angular $scope not applying in callback function, even with $scope.$apply

javascript,angularjs,angularjs-scope
I am trying to convert this JSFiddle to AngularJS: http://jsfiddle.net/danlec/nNesx/ This is my attempt @ JSFiddle: http://jsfiddle.net/leighboone/U3pVM/11279/ var onAuthorize = function () { updateLoggedIn(); $scope.testname = "this works"; Trello.members.get("me", function (member, $scope) { var test = member.fullName; console.log(test) $scope.$apply(function(){$scope.applytest = member.fullName;}) $scope.member = member.fullName; }); }; With this code, I...

JAXB - adapter for a library object

xml-parsing,jaxb,xmladapter
I want to read an integer (inside XML element) to a Semaphore instead of int, effectively calling Semaphore(int theInteger) . Problem is - Semaphore doesn't have a default constructor. If it was a class I wrote I could either make a no-arg private constructor or write an adapter, but since...

uniq for Enumerator::Lazy

ruby
I am processing something with lots of repeated lines: # => [ [1, "A", 23626], [1, "A", 31314], [2, "B", 2143], [2, "B", 5247] ] puts xs # => [ [1, "A"], [2, "B"] ] puts xs.uniq{ |x| x[0] }.map{ |x| [x[0], x[1]] } But xs is huge. I'm trying...

Problems with datagridview [closed]

c#,winforms,datagridview
How can I change the borderstyle of one needable row? dgv_All.DataSource = dt2; and after this i want to change borderstyle of row, for example, number 12. I've tried some variants, but they don't work....

Difference between using Drawable and decoding resource directly

android,android-drawable
I'm using a bitmap resource to mask another image using DST_IN transfer mode. This is the bitmap: (You probably can't see it because it's white and transparent.) If I load it like this, everything works as expected: mMaskBitmap = BitmapFactory.decodeResource(getResources(), mMaskId); But if I load it like this, it's as...

Add a handler of event for each class which implements the interface

.net,vb.net,events,interface
I have this class : Public Class Form1ViewModel #Region "Classes collègues" Public objInfoViewModel As InfoViewModel Public objResultViewModel As ResultViewModel #End Region #Region "Constructor" Public Sub New() objInfoViewModel = New InfoViewModel objResultViewModel = New ResultViewModel Dim collegue As IMediatorForm1 AddHandler collegue.ChangeStatut, AddressOf OnChangingStatut 'AddHandler objInfoViewModel.ChangeStatut, AddressOf OnChangingStatut End Sub #End Region...

cudaMemcpy invalid arguments

c++,cuda
I'm having some trouble running cudaMemcpy to get some data back from my GPU. cudaErrorString is "invalid argument" and it happens on the memcpy from device to host. Here is my isolated code: //To render particles out of. GLfloat* particleRenderData = new GLfloat[particleContainer.size() * 4]; //particlePosBuffer lives on GPU and...

variable no accessible after a Firebase call [duplicate]

javascript,database,firebase,variable-scope
This question already has an answer here: Passing variable in parent scope to callback function 3 answers I'm using Firebase to access to same data, but i can't use the data out of the function used to access it. How i can make a console log of the data...

AngularJS Code not working with NodeJS

angularjs,node.js,mean-stack
I am new to the MEAN Stack. I tried out something pretty basic in html with some angularJS which is working when I open it in my browser. But unfortunately the code is not working anymore when I try to render it with my nodeJS server. The index.html is shown...

android.view.InflateException: Binary XML file line #45: Error inflating class fragment

android,google-maps,android-inflate
Use eclipse. I want use google map on my app. when i run app on genymotion emulator logcut show error :android.view.InflateException: Binary XML file line #45: Error inflating class fragment. I add google-play-services_lib in eclipse and add it in library. MainActivity : public class MainActivity extends FragmentActivity { @Override protected...

Pygame, inheritance issue

python,list,class,inheritance,pygame
I am either new nor experience in python and i find myself in a fat problem that even after many hours in Google and Bing i can find the answer for. My problem starts with this code: class Rectangulo(object): def __init__ (self, x, y, color, largo, alto, cambio_x, cambio_y): self.alto...

Changing fontsize in python subplots

python,matplotlib,font-size,subplot
I have made a phase plot of a bistable stable, with the nulclines on the main graph and have added a subplot with the trajectories overlaying it. However, no matter what I try, I cannot seem to get the x and y labels to increase in font size to 20....

Using brackets/parentheses in EBNF or GNU Bison grammar

c++,parsing,syntax,grammar,bison
I am defining my own grammar for a parser generator that outputs C/C++ code. I chose Bison for this, but have run into a problemm. I would like to use brackets ("(", ")") within rules, but Bison doesn't accept themFor example, to declare a character I use (the three dots...

How to convert time to hours only (php)? [duplicate]

php,algorithm,function,time
This question already has an answer here: Convert Time String to Decimal Hours PHP [closed] 1 answer I need little function in PHP which will convert hour:minutes only to hours. a.g. 15:30 = 15.5 15:15 = 15.25 15:45 = 15.75 and so on Thank you guys ...

Stack in assembly - what's the purpose?

assembly
I'm reading about 6502 assembly don't understand what the stack is for. I get it that it's a FIFO memory and understand the push/pop thing but what is it for? How is it different (the use) from the registers or the RAM? What sort of data do you put in...

Compare two columns using pandas

python,pandas
Using this as a starting point a = [['10', '1.2', '4.2'], ['15', '70', '0.03'], ['8', '5', '0']] df = pd.DataFrame(a, columns=['one', 'two', 'three']) Out[8]: one two three 0 10 1.2 4.2 1 15 70 0.03 2 8 5 0 I want to use something like an if statement within pandas....

Interact with python script running infinitive loop from web

python,http,web,raspberry-pi
I have a python script on my raspberry-pi continuously (every 5 seconds) running a loop to control the temperature of a pot with some electronics through GPIO. I monitor temperature on a web page by having the python script write the temperature to a text file witch I request from...

NSAutoLayout issues with vertical compression in Interface Builder

ios,interface-builder,size-classes,nsautolayout
I am messing around with Autolayout in Interface Builder using Size Classes in Xcode 6. Preview view shows me previews at different devices and they are look almost ok: Also there is no warnings at debug panel. But compiling this I'm getting: The same on real devices. I what I...

Django empty request object

python,django,django-views,django-urls,slug
I have a custom UpdateView in Django that should manage the update process for a given object. I am currently using a slug (the identifier of the object rather than the pk), so I define the field "slug_field = 'cluster_id'" with the name of the slug as given in the...

Establish a Connection with a Server using Android app [closed]

android
I have a web server that by username and password I can connect to it and retrieve data from it. I need to connect this server from an Android app. So far, I tried to post the username and password with HttpPost to the server. But, the server doesn't allow...

Azure Notification Hub - Limit on registrations

azure,azure-notificationhub
What is the limit on registrations to cause a 403 for register create/update? According to the documentation, registration create/update (http://msdn.microsoft.com/en-us/library/azure/dn223265.aspx) may return a 403. So there must be some kind of limit, though I'm not sure what the limit is. The pricing page does not say anything about a registration...

ElasticSerach cluster performance

elasticsearch
I was running a single-node ElasticSearch server with 6kk docs indexed. I was filling a lack of performance, so I decided to scale out. I configured 4 additional nodes in cloud(4 more instances). So I have one master node( on which I also store data) and 4 non-master nodes with...

What's the best way to work on a website with a team collaboratively? [closed]

website
I am working on a website with a group of friends. The problem that we are having is that when any one of us wants to make a change in the code, we have to send the project back to one main person, who uploads it online. Is there a...

Supporting “out / ref” parameters in expressions with conversion to “object”

c#,.net-4.0,delegates,function-pointers,linq-expressions
My journey to this question started with an implementation of Jon Skeet's article: "Making reflection fly and exploring delegates": and in it, he states: Note: I was going to demonstrate this by calling DateTime.AddDays, but for value type instance methods the implicit first first parameter is passed by reference, so...

Webkit bug: Overflow auto triggered after resizing a child element to matching size

javascript,css,google-chrome,safari,webkit
I have the following simple set-up: Jsfiddle. The issue can be reproduced in: Chrome 39.0.2171.95 (64-bit) (for OS X) Chrome 39.0.2171.95 m (for Windows) Opera 26.0.1656.32 (for Windows) Safari 5.1.7 (for Windows) The issue is not present in: Firefox 33.1.1 (for OS X) Firefox 34.0.1 (for Windows) IE 11.0 (for...

In Mac app signing process, how to apply the renew certificate?

osx,code-signing
I have a Mac app that already code signed using a valid certificate from Mac membership program. Now entering 2015, my Team Agent update the certificate. Upon entering "Certificates, Identifiers and Profiles" section, I can see the Developer ID Installer and and Developer ID Application with expire date on year...

ngShow inside a directive

angularjs
I am creating a directive with an ngShow statement that depends on some attribute/condition I want to pass. When I hardcode the ng-show it works fine but if I try to assign the value to scope then add to template it does not respond to my form. The rendered html...

Increasing HIT MaxAssignments

python,mechanicalturk
I would like to programmatically increase or decrease the number of opportunities based upon getting a consensus answer. For example: Start with 3 opportunities If the first two are correct, remove the third opportunity If each of the first three are different, add another opportunity etc. Is there a way...

Trying to replace spaces with dashes using ng-model

angularjs,angularjs-filter,angular-ngmodel
I'm new to AngularJS and trying to create a simple app that will allow me to upload files to my Laravel driven website. I want the form to show me the preview of what the uploaded item will look like. So I am using ng-model to achieve this and I...

ghost shape triggering greensock's TransformManger move cursor

actionscript-3,flex,flex4,greensock
This may be a long shot but I've spent over a day at this so I thought I would ask. I am using greensock's TransformManger v: 1.9669 in a Flex 4.6/AS project. The issue is that with an item selected, the TM "move" cursor appears outside the selection bounds, and...

Iterator VS const_iterator, using it with distance()

c++,vector,stl,iterator,const-iterator
Just a question, on the use of const_iterator vs just iterator. More specifically with the use of distance(). Below is some basic code that just craps out a list of "fav_games" that the user enters (earlier in the application). I wanted to also crap out the 'index' of the vector...

libgdx getChildren

libgdx
battleStage.addActor(aPlayer.handCard1); aPlayer.handCard1.setPosition(300, -256); aPlayer.handCard1.addAction(Actions.sequence(Actions.delay(0), Actions.moveTo(300, 50, 1))); aPlayer.handCard1.getChildren().items[1].addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { aPlayer.handCard1.getChildren().items[1].addAction(Actions.hide()); System.out.println("duh"); } }); This is included in a method that is called in my render method. It doesn't get Clicked. Nothing comes up in my console. I...

How do you indicate that a class will have a particular static method?

java,interface,static-methods
I currently have an interface Ring that specifies methods like add, multiply, and so on. Thus, I can make a class of vectors whose elements are of type E that has an addition method, a dot product, etc. as long as E extends Ring. For example, a very simple class...

Unable to submit add action form - Rails 4

ruby-on-rails,forms,ruby-on-rails-4.1
So my problem is more or less as follows. I have a rails applications with the following classes: Users Skills Each user can have multiple skills and they are added from the users profile screen which is the show action for the users controller. Currently I have the Skills set...

Mongodb aggregate not grouping documents by date

mongodb,mongodb-query,aggregation-framework
I have the following 3 documents in my MongoDB: [Object_id: "tMSfNq9JR85XDaQe5"date: Sun Dec 07 2014 19:50:21 GMT+0800 (HKT)description: "Test" projectid: "S83NEGHnrefvfASrf"totalseconds: 22200__proto__: Object, Object_id: "FeyzdMosaXCht8DKK"date: Mon Dec 15 2014 00:00:00 GMT+0800 (HKT)description: "444"projectid: "S83NEGHnrefvfASrf"totalseconds: 3660__proto__: Object, Object_id: "cCKByxSdQMHAsRKwd"date: Mon Dec 15 2014 00:00:00 GMT+0800 (HKT)description: "555"projectid: "S83NEGHnrefvfASrf"totalseconds: 3660__proto__: Object] I...

Linear regression in R using lm: Different summary output in a function

r,linear-regression,lm
Brief question regarding linear regression in R using the lm function. I noticed that the output is different when using the summary command as part of a function. When I enter: model1 <- lm (PostVal_Ave ~ Int) summary(model1) The follow is returned in the console: Call: lm(formula = PostVal_Ave ~...

Prevent instantiation of MongoDB data model outside of current assembly or prevent misuse

c#,mongodb,factory,instantiation,internal
Ive got a mongo database set up and if its designed to use strongly typed objects: public class Message : IDatabaseObject { [DataMember] [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } [DataMember] public string MessageBody { get; set; } } The class and all properties need to be public...

Populating a drop down list in JSP from a Array List of Bean type

eclipse,java-ee,arraylist,jstl
In my Java EE project I have the following Servlet: import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import javax.naming.InitialContext; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; /** * Servlet implementation...

How to move value from JSON Object to JS array

javascript,json
I'm trying to save certain JSON values to JS array. var count = Object.keys(item.programme).length; // item is JSON file, count is 23 for (i=0; i<count; i++) { var title = item.programme[i].title.de; console.log(typeof title); //string console.log(title); // desired values, title when i listData = []; listData[i] = title; } console.log(listData); //...

Two linked JTextPanes

java,swing,jtextpane
I have two JTextPanes with static size and I want to connect them like two pages in text processor. If I write something in the first JTextPane (page) and it will be too long for one JTextPane then it overflow to the second JTextPane (page). I don't want something like...

ui-router getting current path on state change for google analytics

angularjs,angular-ui-router
I am trying to get the path of the state to send to google analytics. There are some issues. I am using abstract states, so using something like toState.url wont work as it wont grab the entire url. I thought of using $window.location.pathname on $stateChangeSuccess, but it turns out success...

How Would I Delete This Class Object? (C++)

c++,class,object
I'm working on a simple inheritance class right now to practice for a test, and I can't seem to figure out how to delete one of the objects. Code is as follows: #include <iostream> #include <string> using namespace std; class Human { public: void speakNicely(); void speakRudely(); int getAge(); void...

How can I use the StringEscapeUtils Class to secure the code from LDAP injection vulnerabilities?

java,security,ldap,code-injection
How can I use the StringEscapeUtils Class to secure the code from LDAP injection vulnerabilities? How do I escape searchBase, searchMask, scontrols? try { do { NamingEnumeration<SearchResult> answer = null; try { answer = ctx.search(searchBase, searchMask, scontrols); printSearchEnumeration(answer); if (maxSize == 0) exceedLimit = false; else { if (list.size() >=...

Java and synchronized linked list

java,multithreading,collections,synchronization
I have to questions. The first one is why when we run this function we have ConcurrentModificationException ? public static void testList() { List<String> list = new ArrayList<String>(); list.add("str3"); for (String st : list) { if (st.equalsIgnoreCase("str3")) { list.remove("str3"); } } System.out.println(list); } I thing, because enhanced for use Iterator...

Initializing a particular class member in an Array List

java,arraylist
I have a class public class BeanTitle { private String btitle; public String getBtitle() { return btitle; } public void setBtitle(String btitle) { this.btitle = btitle; } } In another class I am creating an ArrayList of BeanTitle Type and trying to initialize the "btitle".. class xyz { void someMethod()...

Error, infinite loop

go
I am going through the Go language tutorial. I would like to check the answer to this question: Note: a call to fmt.Sprint(e) inside the Error method will send the program into an infinite loop. You can avoid this by converting e first: fmt.Sprint(float64(e)). Why? I believe this is because...

how do I change the source of image_tag helper using JQuery?

jquery,ruby-on-rails,asset-pipeline
I am using Image_tag helper and the assets pipeline from rails, this way: <%= image_tag "win_jorge_start_0.jpg", :id => "image0" %> I am trying to change the source of the image_tag using JQuery like this: $('#image0').attr( "src" , "win_jorge_complete_0.jpg" ); the src of the image is changed as expected: <img alt="Win...

CSS: Why will my background not repeat-x or stretch to full width?

html,css,positioning
I'm a designer, so bare with me. I've been coding a website to the best of my ability and it seemed to be going okay but there's been a couple of bugs that I just can't seem to suss out. Please note the nav utilises JS aswell as the footer...

Yii2 get url based on module base url

php,module,frameworks,yii2
I have multi modules application. I want to create url based on module baseurl For example: $link=\Yii::$app->getUrlManager()->createUrl( 'dish/getNew' ); i want: '/web/modules/kitchen/dish/getNew' and the function gave me '/web/dish/getNew'...

Does using PresentViewController release the presenting ViewController from memory? [closed]

ios,objective-c,memory-management,uiviewcontroller
I was wondering if using PresentViewController releases the presenting viewController from the stack, I could not find any information about this in the documentation. If it doesn't, does DismissViewController release the previous viewcontroller? Thanks. EDIT: I am not sure why you put this question on hold. My question is more...

Enumerating all controls on JFrame

java,swing,jframe,jpanel
I am quite new to Java and am trying to set the visible property to false for all JPanels on my JFrame (frame.) When I execute the following, It returns null to console: public void mouseClicked(MouseEvent e){ for (Component c : frame.getComponents()) { System.out.println(c.getName()); if (c instanceof JPanel) { ((JPanel)c).setVisible(false);...

reference a class with a variable

actionscript-3,class,variables
I Have this code I have to execute 12 diferent times in my game, and the only thing I need to change is the class name, so I dont have to stay with 12 copies of it (this is just a fraction of it... its a lot to have 12...)...

What is the name of the technique of holding open a web API call until new data is available, or the request times out?

web-api
I would like to research a technique for building Web API methods but I am having trouble looking up information on it partly because I do not know what the technique is called. The idea is that instead of the client polling the web API on a tight loop and...

Display image on page after upload

c#,asp.net-mvc,image,file-upload
I have a file upload on my page when the user uploads an image and clicks save this gets stored in the DB as a BYTE When the view is return I pass back the BYTE to try and display the image but I keep getting the following error An...

Abstract Generic Implicit Conversion to a Derived Type, Error?

c#,generics,abstract,implicit-conversion
Suppose the following definition of an abstract type A: public abstract class A<T, J> : where J : A<T, J>, new() { public virtual T Value { get; set; } //Error: User-defined conversion must convert to or from the enclosing type public static implicit operator J(T value) { return new...

Sitecore and Json serialization - weird conversion

json,serialization,sitecore7.1
I have an issues as follows: On my local, Azure, + 3 other servers my mapping code looks at latitude and longitude coordinates that are stored in a Sitecore item. On my new QA and PROD Sitecore servers, that I have not used before as they are sitting on a...

MySQL Update command with auto increment [duplicate]

mysql
This question already has an answer here: How to reset the auto increment number/column in a MySql table 4 answers I have a table named users_items. In this table there are 3 columns. 1 of them is called id. There are like 100.000 - 150.000 data in this table....

Other type of “const”?

c++,oop,const
consider the following code: class Bar { public: int GetValue() const { return aVeryImportantValue; } void SetValue(int value) { aVeryImportantValue = value; } private: int aVeryImportantValue; }; class Foo { public: Foo(const Bar &bar) : _bar(bar) {} void SetBar(const Bar &bar) { _bar = bar; }//my compiler won't like this...

How to show the shadow of the ActionBar&Toolbar of the support library on all Android versions?

android,android-actionbar,android-support-library,android-elevation
This is a simple question: I use the new support library, which allows me to have a Toolbar instance and even set it as the actionBar of the activity (or use the default one). How do I customize the shadow being cast by the Toolbar (or the default ActionBar) ?...

How to keep Bootstrap columns centred when viewed on mobile or notepad

html,css,twitter-bootstrap
I have six simple Bootstrap columns that look good on the desktop, nicely centred horizontally, but when the browser is shrunk, or the page is viewed on a notepad or a mobile the columns are not centred horizontally any more but closer to the left side than to the right....

Threading, Tasks and variables correct approach

c#,multithreading,task
I have a web api method that initiates work that could potentially take a long time so I would like to hand over this work to a new thread and return back to the caller. In the code below I have defined an Action that will initiate n number of...

Build and deploy IBM MobileFirst Platform 6.3 adapters using Ant Builder

ant,mobilefirst
I am trying build and deploy adapters from my ant build.xml on to MobileFirst Server,but when i am trying to access the below lines of code in ant.It throws me an error. Error: Could not load definitions from resource com/worklight/ant/builders/defaults.properties. It could not be found. Code: <taskdef resource="com/worklight/ant/builders/defaults.properties"> <classpath> <pathelement...

Differentiation in Mathematica

wolfram-mathematica,differentiation
I want to differentiate f(x)=sin(x^2-1) in Mathematica Software I used this command D[Sin[x^2 - 1], x] The output is 2 x Cos[1 - x^2] Why the angle is 1-x^2 instead of x^2-1 ?? Thanks....

How do you match a dollar range value with a regular expression?

regex
How do you match a dollar range value with a regular expression? What I have so far matches a single dollar value, such as: $100, $1,000,123, or $1,234 [\$]((\d{1,3}(,\d{3})*)|\d{1,3}) But, what if I want to ALSO match a range value like: $100 - $3,000 or $1,000-$5,000 Can anyone help me...

define nested design in R

r,statistics,mixed-models,nlme
I have three factors A,B,C. B and C are random. And B is nested with A. There is interacion between C and B , C and A. I try with lme function, but I don't know how to define nesting and the interacion C and B. lme(dades~A*C,random=list(~1|B, ~1|C),data=mydata) ...

Java blocking IO - Are there any advantages for write operations?

java,tcp,io,nio,nonblocking
In Java's blocking IO API accept() blocks until a connection is available and read() blocks until input is available. But does write() block also for different blocking IO OutputStreams? So how long does write() block in FileOutputStream and SocketOutputStream (TCP) classes? Edit: or to ask even more generally: Does nonblocking...

multiplayer cardgame - start child process or handle in one process

node.js
So Im learning node.js and making a random player vs player cardgame. I will be using sockets and sessions. Theoreticall ill have lots of games running at the same time. Whats the best practice here, do I spawn a child process of my node server for every game, or simply...

Are if(0) and if(1) statements optimized?

c++,visual-c++,logging,compilation,c-preprocessor
For debugging purposes I wanted to have a preprocessor definition such as #define LOGGING 1 //or #define LOGGING 0 when logging is undesired and add if (LOGGING) log("Text here!"); wherever I want it to happen in the code. Now, I only want to do this if the compiler is able...

Import custom font theme into Android Studio Editor\Fonts for IDE

fonts,android-studio,themes,editor
I am trying to set a custom font theme into Android Studio, I am trying to import a font similar to Menlo from Snow Leopard. The font that I have found is this. I don't know how to import a .tff file into Android Studio. This is what I am...

Why is a store-load barrier considered expensive?

multithreading,concurrency,cpu-architecture,lock-free
Most CPU architectures will re-order stores-load operations, but my question is why? My interpretation of a store-load barrier would look like this: x = 50; store_load_barrier; y = z; Furthermore, I don't see how this barrier would be have much use in lock-free programming in comparison to release and acquire...

Keep scale on windows resize CorePlot 2.0 Mac OSX?

osx,core-plot
Have been looking for the opposit to scaleToFit. I would like to keep the horizontal scale when the windows is resized? Is the any setting or do I have to re-calculate the x-axis scale manually based on the size of the window when it's resized? I would appreciate any hints...

color schema of emacs auto-complete mode

python,emacs,autocomplete,jedi
I am using auto-complete + jedi in python mode And i am wandering how to change the color of the second column in the popup menu? the yellow one: "function:posix.closerange" also what't yellow popup window on the right side called? And how to change its color? i found these...

jquery-mobile returning blank pages in rails 4 environment

ruby-on-rails,jquery-mobile
Some links don't work when I use jquery-mobile with rails and I don't know why. All I get is a blank page. The URL changes, and if I press "refresh" on my browser, the target web page comes up ok. But the web page appears blank when I first click...

All the subsets of size N which satisfy a condition in Haskell

algorithm,haskell,optimization,complexity-theory
I would like to write a function, which takes a list and returns a list of all possible subsets which satisfy given condition. For example for I want to have all 3-size subsets of [1,2,3,4] but without any subset which contains 2 and 3. $> func [1,2,3,4] 3 [[1,2,4],[1,3,4]] To...

What is proper way to copy trusted host patterns from one Request to another?

php,symfony2
I am working on a Symfony 2.6 application, and have a scenario where I need to copy the trusted host patterns from one Request object to another. Request::setTrustedHosts accepts an array of regular expressions w/o the delimiters, and then the method creates proper PCRE patterns with delimiters, and saves them...

Cleaner way to get the contents of a file as string in Rust?

file-io,rust
As my first dive into Rust in a while, I started writing code to dump the contents of a file to a string, for later processing (right now I'm just printing it out though) Is there a cleaner way to do this than I currently am? It seems like I'm...

how to loop through elements of array of in Swift

arrays,swift
I am new to Swift and wanted to loop through an array of MKMapPoints which I get from an MKPolygon by calling myPoly.points(). However, I am stuck as to how to loop through every element of the C-Array of pointers. for element in myPointsArray {} does not work and I...

How can i get from a listView1 item(file) the file full path?

c#,.net,winforms
I have this in my designer: On the right is the files in a listView1. On the left is the directory main directory of this files treeView1. I have this code in menu strip item clicked event : void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Text == "Upload") { List<String>...

How to tell if you're running through Pythonwin or console

python,user-interface,input,console-application
I'm using PythonWin. If in the IDE I click Run, then any input() commands will pop up as a windows message box. But in the console they are printed console commands. I tried using msvcrt.getch() in PythonWin, and it returns the character \xFF every time. I would like to have...

Struts 2 ,Spring and hibernate Integration : model class variable of struts 2 is always null

spring,hibernate,jsp,struts2,ognl
i am developing an web application using Struts 2 ,Spring and hibernate . and when i am running the application its always returning null in model class variables in action class. here are the snippets class : StudentPersonalDetails.java @Entity @Table(name="STUDENT_PERSONAL_DETAILS") public class StudentPersonalDetails { @Id @Column(name="Student_ID", unique=true, nullable=false, length=20) private...

Is there a limit for RSA key exponents in .NET?

c#,cryptography,rsa,exponent,system.security
Using C# I cannot import a public RSA key with an exponent of {1, 0, 0, 0, 15}: There is an exception: System.Security.Cryptography.CryptographicException was caught HResult=-2146893819 Message=Bad Data. Source=mscorlib StackTrace: at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle& hKey) at...

Run function in background and continue with program

python,multithreading
I am trying to run a function in the background, whilst continuing with said code in python. The function I want to run in the background is from socket. Looking for specific data to cut the program off. Here is the function: def receive(): host = "" port = 13000...

Rails equivalent of setInterval?

javascript,ruby-on-rails,ruby
Here's a piece of code (based on an example at W3Schools) that uses Javascript to update a page on a regular basis: <!DOCTYPE HTML> <html> <head> <title>Timer test</title> <script> var myVar=setInterval(function () {myTimer()}, 1000); function myTimer() { var d = new Date(); document.getElementById("timeNow").innerHTML = d.toLocaleTimeString(); } </script> </head> <body> <h1>The...