2018-10-22         Jacqueline

AASM Gem broken by Rails 2.3.2?

Has anyone had any problems using the AASM state machine Gem with Rails 2.3.2? It was working fine for me but is now giving a NoMethodError:NoMethodError (undefined method `state' for #<Comment:0x25cb8ac>): /usr/local/lib/ruby/gems/1.8/gems/rubyist-aasm-2.0.5/lib/persistence/active_record_persistence.rb:231:in `send' /usr/local/lib/ruby/gems/1.8/gems/rubyist-aasm-2.0.5/lib/persistence/active_record_persistence.rb:231:in `aasm_read_state' /usr/local/lib/ruby/gems/1.8/gems/rubyist-aasm-2.0.5/lib/persistence/active_record_persistence.rb:135:in `aasm_current_state' /u...

 ruby-on-rails                     2 answers                     99 view
 2018-10-22         Jacqueline

concatenating 2 variables to create new variable in MS .bat-file

First time posting so please be patient.I am trying to create a .bat file as followsset a=fileset b=3set file3=successSETLOCAL ENABLEDELAYEDEXPANSIONecho %%a%!b!%I was hoping it would parse as "echo %file3%" and would then print "success". Would appreciate guidance as to how to achieve the intended result. I would also appreciate it if someone could explain what actually happened. What you want to do with delayedExpansions is to expand one variable before an other. The one which should be expanded first is the one in %percentages%, the one which should be expanded delaye...

 batch-file                     2 answers                     8 view
 2018-10-22         Jacqueline

Angular 5 app in mvc web app with sharing jwt token

I have a mvc web application. I am able to generate a jwt token and save the token in a http cookie. Later upon each request to the web api I pass the jwt as a bearer token. In some of the pages I have to load angular 5 app. I have created a httpInterceptor in the angular app but I am unable to get the same cookie value there so that I can attach an authorization header. Not sure if i am understanding the question well but on the angular side if you are having problems setting and retrieving cookies then i would 100% check out this package. https://www.npmjs.com/package/...

 asp.net                     1 answers                     98 view
 2018-10-22         Jacqueline

Make running tests mandatory before runserver in django

Is there any way to make running tests compulsory before running the server in django? I have a project on which many people will be working on so i want to make the testing compulsory before running it and all tests must pass before it runs. So basically lock the runserver command until all the tests pass successfully. This implementation will be just for some time and not for long. I agree with @LFDMR that this is probably a bad idea and will make your development process really inefficient. Even when with test-driven development, it is perfectly sensible to use the de...

 django                     2 answers                     35 view
 2018-10-22         Jacqueline

Completely capture output of call to GNU screen

In a Python 3 program of mine, I open a GNU screen session at some point. Upon closing this session, the output [screen is terminating]is printed to the surrounding session (the terminal in which the python program is run). How do I prevent this? I am currently running something like import subprocess subprocess.run('screen',stdout=subprocess.PIPE,stderr=subprocess.PIPE)Usually, the [stdout,stderr]=subprocess.PIPE captures the output and err (e.g. for run('echo hello',stdout=subprocess.PIPE) nothing is printed) but for some reason this doesn't work with screen You should...

 python                     1 answers                     81 view
 2018-10-22         Jacqueline

How to handle firefox default page while executing selenium webdriver python script

I have wrote basic selenium webdriver script using python. But while executing this script ,firefox displayed default page You can not control the Homepage using Selenium, But what I think is your homepage is causing any obstruction in your script then you can change your Firefox homepage by going to --> FireFox--> **options** --> **General** --> set Home page as "**Show a Blank Page**" from dropdown [XXX]

 python-3.x                     1 answers                     88 view
 2018-10-22         Jacqueline

Passing function reference to sibling-ish in react + react-router-dom

I have a menu which has routes as siblings and in one of those routes, namely Landing (see below), I have a function, scrollToTop, that I would prefer if the menu has access to. I would strongly prefer to do this with pure reactjs or js but so far I have not been able to do so in a pragmatic way. What approach would you recommend to this problem?App.jsclass App extends Component { constructor(props) { super(props); this.state = { scrollToTop: undefined, }; this.landingComp = () => <Landing setScrollToTop={(scrollToTop) => t...

 javascript                     1 answers                     53 view
 2018-10-22         Jacqueline

Spring Data Repository ignores Hibernate's @Convert

I have the following native query:@Transactional@Query(nativeQuery = true, value = "INSERT INTO my_entity (update_date_time) " + "VALUES (:#{#e.getUpdateDateTime()}) " + "ON CONFLICT (hash) DO NOTHING RETURNING *")Long insert(MyEnitity e);Here is mapping:@Entity@Table(name = "my_entity")public class MyEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Access(AccessType.PROPERTY) private Long id; @Column(name = "update_date_time") @Convert(converter = LocalDateTimeAttributeConverter.class) private LocalDateTime upd...

 java                     1 answers                     56 view
 2018-10-22         Jacqueline

Eloquent query to select values from many to many relationship using laravel

I'm working on a project that have a many to many relationship between 2 tables the first table is the cities table and the second one is the checkpoints table.. The city have many checkpoints and the checkpoints may belong to many cities.. So far I have created a new table called checkpoint_city contain the checkpoint_id and the city_id.. So city A have chickpoints X,Y BUT city B have X,ZNow I want to select the only checkpoints that belongs to city A and B together which is X.. My code until now is : $checkpoints = CheckPoint::select('*')->where('type', 'n')->where...

 laravel                     1 answers                     51 view
 2018-10-22         Jacqueline

SQL querying data based on the timestamp difference

I have a problem related to the sql databases.Namely I want to create a query get the average value of a certain measurment column, but only for those subsequent rows whose time difference is less than 60 seconds.An example table would look something like this:| ID | Measurement | Timestamp | | 1 | 0.564 | 1535648400|| 2 | 0.456 | 1535648459|| 3 | 0.785 | 1535648501|| 4 | 0.321 | 1535648620|The difference between the timestamps would be ok for all rows, except between 3 and 4, where they differ for more than 60 seconds. In that case, average woul...

 mysql                     2 answers                     69 view
 2018-10-22         Jacqueline

Unable to retrieve access token with Application Only OAuth using Reddit API

So I have read the documentation at the following link https://github.com/reddit-archive/reddit/wiki/OAuth2. I am trying to retrieve an access token for my application which only requires an Application Only OAuth since it does not require the user to insert their credentials. I have followed the instructions on the page mentioned, but I am unable to retrieve the access token and I always get:"{\"message\": \"Unauthorized\", \"error\": 401}"Here is my code:#include "reddit.h"#include <QtNetwork>#include <QUuid>const QString GRANT_URL = "https://oauth.reddit.com...

 c++                     1 answers                     10 view
 2018-10-22         Jacqueline

Database Mail with HTML formating

I am working on sending information to our customers about the checks they may expect in mail soon. I wanna know how do I put check num information in the body of the email as right now I am just generating a table which gives them remittance information. Basically I want the body of the email to say " Check num : 1234567 has been issued to you.So far I have the following query declare @docnum nvarchar(50) declare @numatcard nvarchar(50) declare @checknum nvarchar(50) declare @checkAmt nvarchar(100)declare @EMaIL nvarchar(200)declare @Date nvarchar(200)declare @...

 html                     1 answers                     28 view
 2018-10-22         Jacqueline

How to get executed client details inside PL/pgSQL function

could you please let me know, how can i get the function executed client(single client only) details inside the PL/pgSQL function(something $whoexecuted). i'm getting the current all active client details.as per the following code.beginselect ps.usename, ps.client_addr,ps.application_name from pg_stat_activity pswhere state = 'active'and ps.usename in('user1') into pg_stat_activity_rowtype; The content of pg_stat_activity is available from PLpgSQL too. So you can use do $$declare r record;begin for r in select * from pg_stat_activity where pid = pg_backend_pid() loop ...

 postgresql                     1 answers                     34 view
 2018-10-22         Jacqueline

Flask Dance OAuth via Microsoft Azure errors

I am testing an Azure web app that will use Flask Dance to authorize users via their Microsoft accounts. I took the code right from Azure's documentation:blueprint = make_azure_blueprint( client_id="id_here", client_secret="secret_here")app.register_blueprint(blueprint, url_prefix="/login")@app.route('/')def login(): if not azure.authorized: return redirect(url_for("azure.login")) response = azure.get("/v1.0/me") assert resp.ok return "You are {mail} on Azure AD".format(mail=resp.json()["userPrincipalName"])So when I run it, I get the login scre...

 azure                     1 answers                     43 view
 2018-10-22         Jacqueline

Is it possible to change the drive letter of the Azure Temporary Storage Drive?

I have a new VM instance in Azure, and by default it comes with C: and D:. I understand that D: is volatile and can be lost at some points.My application uses drive D: as a working drive though, and stores all my the utilities and process output files there.I've attached a new drive, but it's F:. Is there any way to change the drive letters so that my attached drive is D: and the temporary one is anything else? Things what you can do is change the drive letters. You can do it under Server Manager -> Storage Manager -> Pick The Drive -> Change Drive Letter and Path. There...

 azure                     3 answers                     46 view
 2018-10-22         Jacqueline

Is it possible to have multiple .htaccess files for the same application?

I have two domains having same document root. As per the requirement, I want both the domains should have their own .htaccess file. Is their any way with whom I can achieve this? Below example contain two domain and we have to select query parameter based on the domain.RewriteCond %{HTTP_HOST} ^www\.site1\.example [NC] RewriteRule ^(.*)$ index.php?domainname=site1 [NC,QSA] RewriteCond %{HTTP_HOST} ^www\.site2\.example [NC] RewriteRule ^(.*)$ index.php?domainname=site2 [NC,QSA] But it's not possible to add more than one .htaccess file in the same folder. [XXX]There's m...

 php                     2 answers                     43 view

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