2018-10-22         Drew

Whats the alternative syntax for ActiveRecord::RecordNotFound in Rails 3

With the introduction of ActiveModel in Rails 3 whats the new method of calling ActiveRecord::RecordNotFound. ActiveModel::RecordNotFound ? This is the definition (1) of ActiveModel: ActiveModel is a class to be implemented by each ORM to allow Rails to generate customized controller code.ActiveRecord implements ActiveModel. ActiveRecord raises its ActiveRecord::RecordNotFound exception when it can't find record by given id or a set of ids (2) in the database.This mean there can't be such exception like ActiveModel::RecordNotFound. [XXX]ActiveModel is a set of modul...

 ruby-on-rails-3                     2 answers                     8 view
 2018-10-22         Drew

Accessing Payment service configuration from within JAVA code

At our webshop, there is a need to retrieve some payment method configuration values. On the old ES6.4 based webshop, we used to retrieve payment service configuration values like this:Iterator<? extends PaymentInstrumentInfo> piis = order.createPaymentInstrumentInfoIterator(); /* order.getPaymentMethod(); */ PaymentInstrumentInfo pii = piis.next(); final String isCreditCard = pii.getPaymentService().getConfiguration().getString("CreditCardPayment"); String pmn = pii.getPaymentService().getID();In IS7.9 it seems the method getPaymentService() on PaymentInstru...

 java                     1 answers                     11 view
 2018-10-22         Drew

YML files in Symfony - can you get associative arrays more than 1 level down?

I have a load of data I want to store in /apps/frontend/modules/builder/config/module.yml.I have it looking something like:all: series_options: compact: name: Compact description: Something small. enabled: 1 large: name: Large description: Bit bigger. enabled: 0In the actions.class if I write this:sfConfig::get('mod_builder_series_options_compact');I get thisArray( [name] => Compact [description] => Something small. [enabled] => 1)Perfect. But I want to write this:sfConfig::get('mod_builder_series_options');Which gives NULL.I...

 symfony1                     2 answers                     63 view
 2018-10-22         Drew

Why to use class based OOP style inheritance in javascript?

If I'm not completely wrong every framework/library/approach in javascript tends today to mimick class based OOP style inheritance. Reasons for this seem to be people thinking class based OOP inheritance is far easier to understand and that most programmers know OOP. In my experience I don't find evidence for either of this opinions. I think javascript prototypal inheritance is just fine (and I doubt the usefulness to force another paradigm upon a language than the one it is built on). Most of the developers I meet aren't even that good in classical OOP either. So what are ...

 javascript                     8 answers                     88 view
 2018-10-22         Drew

Can’t seed data from my Laravel plugin

I developed a Laravel Plugin, which contains seed data : https://github.com/xoco70/laravel-tournamentsWhen I try to seed it inside a fresh laravel 5.6 project, with: php artisan db:seed --class=LaravelTournamentSeederI get: ErrorException : include(/Users/julien/Documents/Proyectos/test/vendor/composer/../../database/seeds/LaravelTournamentSeeder.php): failed to open stream: No such file or directoryWhen I try to namespace all my seeds file with : namespace Xoco70\LaravelTournaments\Database\Seeds;and then ruin it with php artisan db:seed --class=Xoco70\\LaravelTou...

 laravel                     1 answers                     59 view
 2018-10-22         Drew

Django Templates - Changing context for an 'include' template

I have a template that includes several tables. I want to use a sub-template which renders these tables in the same way. I can get it to work for a single table, by setting the context in the view and passing that to the template. But how do you change the data for to render another table for different data?**'myview.py'**from django.shortcuts import render_to_responsetable_header = ("First Title", "Second Title")table_data = (("Line1","Data01","Data02"), ("Line2","Data03","Data03"))return render_to_response('mytemplate.html',locals())**'mytemplate.html'**{% ex...

 django                     2 answers                     91 view
 2018-10-22         Drew

Tab order broken with stripe card-element and vue.js

When using Vue.js and having a stripe card-element inside the Vue main element the tabindex is not working properly. Check the following code:<html><head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script src="https://js.stripe.com/v3/"></script></head><body> <input type="text" placeholder="first tab element on page"><br /> <br /> <div id="stripeDiv"> <div id="card-element" style="border: 1px solid black;max-width:300px"> <!-- A Stripe...

 javascript                     1 answers                     54 view
 2018-10-22         Drew

Calling Apps Script API function from Golang with Parameters?

I want to call Apps Script function from Golang.I can send the Parameter from Golang but cannot make it work in runMyFunction. If I add return myParameter; - I can see the parameter I am passing but using it inside SQL to BigQuery is not working. I am getting undefinedvar sql = ' SELECT column1, column2 ' + ' FROM dataset.mytable WHERE SUBSTR ( column1) = "'+ myParameter + '" ;'My Apps Script Function:function runMyFunction(myParameter) {...return myParameter;}In Golang, calling runMyFunctiontype Message struct { myParameter string}m := Message{"1234"}a := make([]inter...

 go                     1 answers                     74 view
 2018-10-22         Drew

Access SQL SELECT Query: Required to use the table alias in WHERE clause?

Current Environment: Split Access Database, Local Access Front End, Access Backend on shared network driveI'm writing a stupid long SELECT statement. Using table aliases to makes my code more readable.I was taught to write out full table names in WHERE statements because they are executed before the FROM statement. However, when I did that - Access isn't finding the table / field referenced when I write the full table name out. Strangely, I tried using the alias in the WHERE statement and it works!!?Does Access execute the statement differently than I was taught? Or am I un...

 sql                     1 answers                     16 view
 2018-10-22         Drew

Give unique IDs to Distinct names sql server

I have a sql server table containing names:Serial Name1 Roger2 John3 John4 Mike5 Roger6 John7 MikeI want to insert a UID column that will have unique IDs for unique names. So, it should look like,Serial Name UID1 Roger 12 John 23 John 24 Mike 35 Roger 16 John 27 Mike 3Can anyone please help me with the query. First add the column to the table.ALTER TABLE yourtableADD [UID] INT NULL;ALTER TABLE yourtableADD constraint fk_yourtable_uid_id foreign key ([UID]) referenc...

 sql                     3 answers                     35 view
 2018-10-22         Drew

Counting records of my RDDs in a large Dstream

I am trying to work with a large RDD as read by a file DStream.The code looks as follows:val creatingFunc = { () => val conf = new SparkConf() .setMaster("local[10]") .setAppName("FileStreaming") .set("spark.streaming.fileStream.minRememberDuration", "2000000h") .registerKryoClasses(Array(classOf[org.apache.hadoop.io.LongWritable],classOf[org.apache.hadoop.io.Text], classOf[GGSN])) val sc = new SparkContext(conf) // Create a StreamingContext val ssc = new StreamingContext(sc, Seconds(batchIntervalSeconds)) val appF...

 scala                     2 answers                     44 view
 2018-10-22         Drew

Building a form with dynamic array of objects in .Net core

I'm currently building a form with .Net core 2 which contains List of objects in it. Here's an example of form itself.public class InsuranceForm{ public IList<WindowModel> Windows { get; set; }}public class WindowModel{ public string WindowImage { get; set; } public string WindowDamageDescription { get; set; }}In View I need to be able to add two input fields (window image and window damage description) by button click and then send form with array of this properties via submit button. I have tried to implement adding new input fields with VueJs but didn't su...

 .net                     1 answers                     37 view
 2018-10-22         Drew

Add YAML validation file in Symfony 4

How can I add a file in /config/validation.yaml as a mapping validation in order to avoid using annotations in my DTOs? Is quite simple.Just add in validator.yaml file the following:framework: validation: email_validation_mode: html5 mapping: paths: - '%kernel.project_dir%/src/<path to validation file>' [XXX]

 symfony                     1 answers                     31 view
 2018-10-22         Drew

Any patterns for high availability of a Windows Service?

SituationI have a windows service which I would like to make highly available.I have two unclustered servers (Windows server 2003 standard edition).The question is:What options do I have to make my service highly available in an automated way?I can think of the asymmetric master-slave option which consists of keeping the service running on both machines with a communication heartbeat between them so one acts as the master and the slave takes over automatically whenever the master does not respond.Do you know any other ways to implement this?note: Please don't point me to th...

 windows                     2 answers                     57 view
 2018-10-22         Drew

How to get column with identity specifcation on for view created in SQL Server?

I have created a view where one of my column is primary key.In that field identity specifcation is also set to yes.when i open the view it doesnot contains primary key field.When i set the identity specification to No then only my view contains the primary key field.What is the reason?Are there any sql queries to set is identity to No?My view : create view userAccounts as select user_id ,br_id,user_name,role_id, ,email ,created_dt ,updated_dt ,status from user_accountsHere user_id doesnot appear in my view. I can't replicate the behaviour the OP is describing. In the S...

 sql-server                     1 answers                     34 view
 2018-10-22         Drew

Autoshrinking text size for multiple ui labels

I have five ui labels for one view. All of them have variable text content. To prevent truncating I have to use Autoshrink text size. My ui labels are aligned in x axis top to bottom. The problem is; when autoshrinking, all ui labels have different font sizes.Is there a way to equalize font sizes of all ui labels when autoshrink. I use interface builder autolayout constraints.Thank you. You could loop through your labels, find the smallest text size and then set that text size to all of them. That way, you know they'll all fit and have the same text size. You would have ...

 ios                     1 answers                     79 view

Page 1 of 144  |  Show More Pages:  Top Prev Next Last