mardi 1 août 2017

Google App Maker Alternatives: free, simple, beginner-friendly, secure

I need to build a secure commercial web application that guides users through steps (like, 1, create your account and login 2, select subscription type, 3, redirect to payment page, 4, other). Some of these steps involve making backend HTTP GET/PUT/POST requests based on the user inputted information (so perhaps Wordpress, Wix, Weebly, Squarespace, and some others may be ruled out). I could also use PythonAnywhere or Google Cloud App Engine but it requires much more configuration. I have also tried MS Azure which had a perfect one-click enable login setting but it was expensive. I have also not given Zoho Creator a try since it is not free.

I noticed that Google App Maker was released in beta for GSuite users, which is excellent because it is Google, is secure, free, and allows for super simple web development. But since it is still in Beta they have blocked off sharing web apps outside of your own organization. I looked around and I found Firebase (requires some coding to implement the login, no WYSIWYG editor) and Google Apps Script (does not have a WYSIWYG editor and shows yellow bar at the top, but login is automatic), which I will end up using unless you can provide any great alternative.

Am I missing any affordable/free, simple, beginner-friendly, secure web development platforms?




angular toPromise call that returns csvFile

I have to write the promise call and component method to call the webAPI that returns csv file. I can see, my code wont work without creating a proper header. Please let me know, how I can fix this issue

Component:


downloadfile() { this.isLoading = true; this.customerMonitoringService.getMyFileFromBackend(this.productionDataUrl).subscribe( res => { this.isLoading = false; res; }, (error: any) => Observable.throw(error || 'Server error') ); }

cust-monitoring.service.ts


getMyFileFromBackend(productionURL: string): Observable {

    return this.http.get("`"+productionURL+"`")
        .map(res => res.text())
            .catch((error: any) => Observable.throw(error || 'Server error'));
}

Web API call


    [HttpGet]
    [HttpPost]
    public async Task<IHttpActionResult> Index(string systemName)
    {
          var negotiator = Configuration.Services.GetContentNegotiator();

        var mediaTypeFormatterCollection = new MediaTypeFormatterCollection();
        mediaTypeFormatterCollection.Clear();
        mediaTypeFormatterCollection.Add(new ProductionPeriodFormatter());
        mediaTypeFormatterCollection.Add(new JsonMediaTypeFormatter());

        var result = negotiator.Negotiate(typeof(ProductionPeriod), Request, mediaTypeFormatterCollection);
        if (result == null)
            throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable));

        var production = await Production(systemName);
        var content = new ObjectContent<ProductionPeriod>(
            production,
            result.Formatter,
            result.MediaType.MediaType
        );
        if (result.Formatter is JsonMediaTypeFormatter)
        {
            ((JsonMediaTypeFormatter) result.Formatter).SerializerSettings.ContractResolver =
                new CamelCasePropertyNamesContractResolver();
            content.Value = new ProductionPeriod(production.Start, production.End, production.TimeZone, interval.Value,
                NormalizedIntervals(production, interval.Value));
        }
        else
        {
            try
            {
                WebRequest.DefaultWebProxy = null;

                content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
                {
                    FileName = "production.csv"
                };
            }
            catch (Exception ex)
            {
                string msg = "";
                msg = ex.Message.ToString();
            }
        }

        var response = new HttpResponseMessage()
        {
            Content = content
        };

        return ResponseMessage(response);
    }




Angular 4 - TypeError: _co.send is not a function. (In '_co.send($event)', '_co.send' is undefined)

I am trying to create real-time chat between Django backend and Angular 4 frontend using PostgreSQL database. I would like to input my own text on frontend, press enter and send it. I get an error in Angular 4 - TypeError: _co.send is not a function. (In '_co.send($event)', '_co.send' is undefined). I am not sure where is a problem. Any ideas what is wrong?

app.component.html:

<button (click)="sendMsg()">Send Message</button>

<h4>Type away! Press [enter] when done.</h4>
<div><key-up3 (keyup7)="send($event)"></key-up3></div>

<h4>Little Tour of Heroes</h4>
<p><i>Add a new hero</i></p>
<div><little-tour></little-tour></div>

app.component.ts:

import { Component } from '@angular/core';
import { WebsocketService } from './websocket.service';
import { ChatService } from './chat.service';
import { Output, EventEmitter } from '@angular/core';
import {enableProdMode} from '@angular/core';

enableProdMode();


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers: [ WebsocketService, ChatService ]
})
export class AppComponent {

    constructor(private chatService: ChatService) {
        chatService.messages.subscribe(msg => {
      console.log("Response from websocket: " + msg.message);
        });
    }

    private message = {
        message: 'this is a test message'
    }

  sendMsg() {
        console.log('new message from client to websocket: ', this.message);
        this.chatService.messages.next(this.message);
        this.message.message = 'this is a test message2';
    }



}

@Component({
  selector: 'key-up3',
  template: `
    <input #box (keyup.enter)="keyup7.emit(box.value)">
    <p></p>
  `
})
export class KeyUpComponent_v3 {
   @Output() keyup7 = new EventEmitter<string>();
}

websocket.service.ts:

import { Injectable } from '@angular/core';
import * as Rx from 'rxjs/Rx';

@Injectable()
export class WebsocketService {
  constructor() { }

  private subject: Rx.Subject<MessageEvent>;

  public connect(url): Rx.Subject<MessageEvent> {
    if (!this.subject) {
      this.subject = this.create(url);
      console.log("Successfully connected: " + url);
    }
    return this.subject;
  }

  private create(url): Rx.Subject<MessageEvent> {
    let ws = new WebSocket(url);

    let observable = Rx.Observable.create(
    (obs: Rx.Observer<MessageEvent>) => {
        ws.onmessage = obs.next.bind(obs);
        ws.onerror = obs.error.bind(obs);
        ws.onclose = obs.complete.bind(obs);
        return ws.close.bind(ws);
    })
let observer = {
        next: (data: Object) => {
            if (ws.readyState === WebSocket.OPEN) {
                ws.send(JSON.stringify(data));
            }
        }
    }
    return Rx.Subject.create(observer, observable);
  }

}

chat.service.ts:

import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs/Rx';
import { WebsocketService } from './websocket.service';

const CHAT_URL = 'ws://localhost:8000/';

export interface Message {
    message: string
}

@Injectable()
export class ChatService {
    public messages: Subject<Message>;

    constructor(wsService: WebsocketService) {
        this.messages = <Subject<Message>>wsService
            .connect(CHAT_URL)
            .map((response: MessageEvent): Message => {
                let data = JSON.parse(response.data);
                return {
                    message: data.message
                }
            });
    }
}




Library for web application generate 10x50 grid with text input box?

I have assigned a task to create a form with 10 columns x 50 rows grid with CRUD function similar to spreadsheet, so looking for a free or opensource library for time saving.

regardless of programming language, is it any recommend?




Letter grade mapping

I saw the "Letter grade mapping" announcement on canvas, but I was curious as to my current score. Am I to assume that my % on Canvas after the participation score is posted is accurate, or does a weighting still need to be applied? I am trying to decide on taking the final.




CSS calc(percent - pixels) being interpreted as calc(percent - percent) by browser

Okay, so this could be a really simple thing that I've done (one of those days) but I cannot for the life of me figure this one out.

Long story short, In my main.scss:

.test{
    width: calc(100% - 50px);
}

In my auto-complied main.css (viewed in code editor and even online file manager):

.test{
    width: calc(100% - 50px);
}

Yet, in the browser it isn't displaying correct and on inspection, it has somewhere been converted to:

.extra-test{
    width: calc(50%);
}

Any ideas on what could be causing this?

(Using latest version of Chrome)




Status=403 while login to the website / does not accept credentials using jsoup

Im new here so please be patient :)

I know there is bunch questions of this type, but i do not found answear for this kind of problem. I'm trying to login to website but i have two problems. I will post source code below and after that i will explaint what is wrong.

Connection.Response loginForm = Jsoup.connect("http://ift.tt/2w1RcyK") .method(Connection.Method.GET) .execute();

//System.out.println(loginForm);

Document document = Jsoup.connect("http://ift.tt/2uRoxxP")
        .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36")
        .data("cookieexists", "false")
        .data("login_username", "login")
        .data("login_password", "password")
        .data("action", "login")
        .cookies(loginForm.cookies())
        .post();

System.out.println(document);

In this case i get below error:

> Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=http://ift.tt/2w1RdTk
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:682)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:629)
    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:261)
    at org.jsoup.helper.HttpConnection.post(HttpConnection.java:256)
    at test.Test_1.main(Test_1.java:89)

I want you to know that this website is working only after connecting to VPN so proxy settings are unnecessary here. Additional I turned off certificate validation in Java HTTPS Connections because this was also one of my problem. Any idea how to resolve whis problem?

I also tried to connect using method get(); instead of post(); - result below:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://ift.tt/kTyqzh">
<html>
 <head> 
  <title>Login to Website</title> 
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
  <style type="text/css">
    <!--
        BODY, TABLE, TR, TD {font-family: Verdana, Arial, Helvetica, sans-
serif; font-size: 12px;}
        A {text-decoration: none;}
        A:active { text-decoration: none;}
        A:hover {text-decoration: underline; color: #333333;}
        A:visited {color: Blue;}
    -->
    </style> 
  <script type="text/javascript">if (top != self) {top.location.href = 
self.location.href;}</script>
  <script type="text/javascript">var csrfMagicToken = 
"sid:2cab4af55d51696dff403441da56e8f7777b205d,1501588419";var csrfMagicName 
= 
"__csrf_magic";</script>
  <script src="/website/include/csrf/csrf-magic.js" type="text/javascript">
</script>
 </head> 
 <body onload="document.login.login_username.focus()"> 
  <form name="login" method="post" action="graph_view.php">
   <input type="hidden" name="__csrf_magic" 
value="sid:2cab4af55d51696dff403441da56e8f7777b205d,1501588419"> 
   <input type="hidden" name="action" value="login"> 
   <table id="login" align="center"> 
    <tbody>
     <tr> 
      <td colspan="2">
       <center>
        <img src="/website/images/auth_login.gif" border="0" alt="">
       </center></td> 
     </tr> 
     <tr style="height:10px;">
      <td></td>
     </tr> 
     <tr> 
      <td id="error" colspan="2"><font color="#FF0000"><strong>Invalid User 
Name/Password Please Retype</strong></font></td> 
     </tr> 
     <tr style="height:10px;">
      <td></td>
     </tr> 
     <tr id="login_row"> 
      <td colspan="2">Please enter your Website user name and password 
below:</td> 
     </tr> 
     <tr style="height:10px;">
      <td></td>
     </tr> 
     <tr id="user_row"> 
      <td>User Name:</td> 
      <td><input type="text" name="login_username" size="40" style="width: 
 295px;" value=""></td> 
     </tr> 
     <tr id="password_row"> 
      <td>Password:</td> 
      <td><input type="password" name="login_password" size="40" 
style="width: 295px;"></td> 
     </tr> 
     <tr style="height:10px;">
      <td></td>
     </tr> 
     <tr> 
      <td><input type="submit" value="Login"></td> 
     </tr> 
    </tbody>
   </table> 
  </form> 
  <script type="text/javascript">CsrfMagic.end();</script>  
 </body>
</html>

In HTML code there is information "Invalid User Name/Password Please Retype" but i'm sure that provided credential are correct. I have no idea where is problem... I will be grateful for your help.

PS I need that to get image which is available only after login to the website.