Posts

javascript - No response data after call a function -

i have file called login.php , in file there box fill send login data server. when user press login button, code fired: var posturl = globalvariables.baseurl + 'application/controllers/user.php/ajax_check_login'; var postdata = { 'username': $('#username').val(), 'password': $('#password').val() }; $.post(posturl, postdata, function(response) { // stuff.. }, 'json'); the posturl valorized correctly by: http://localhost/app_name/application/controllers/user.php/ajax_check_login now have list of own controller allow me manage web app. 1 of controller user.php , how can see call ajax_check_login function. function check if data passed request exists in database , if correct. content: public function ajax_check_login() { echo "test?"; try { if(!isset($_post['username']) || !isset($_post['password'])) { throw new exception('ba...

ruby - Rails renders view when redirected -

so have rails 4 app uses devise authentication. have started writing controller tests when noticed odd behaviour , confirmed in firebug. when try access controller action, has before_action :authenticate_user! , returns response 302 found header , body first database entry , after redirects new_user_session_path . therefore if open console , @ it, can see information, that's supposed hidden them. and don't understand how can render body user, when user found @user = current_user , there no current_user , or @ least there shouldn't be. i have looked found nothing. here additional info: devise version 3.5.2, rails 4.2.4 edit rails log when trying access authenticated page started "/dashboard" 127.0.0.1 @ 2016-01-28 11:07:27 +0100 processing userscontroller#show html completed 401 unauthorized in 0ms (activerecord: 0.0ms) started "/users/sign_in" 127.0.0.1 @ 2016-01-28 11:07:27 +0100 processing users::sessionscontroller#new html rendere...

vb.net - Process.start in vb can't load modules -

i need start script ps1 (azure) vb, tried : process.start("powershell.exe", "-noprofile -executionpolicy unrestricted -noexit 'c:\test.ps1' ") but powershell have 1 module loaded, can't load azure module , can't import-module azure if have ideas great ! thx

sql server - How to change Date format to yyyy-mm-dd -

i want change output date format of parameter @dateissued "2013-12-31" format. you can try this: select convert(char(10), getdate(), 126) or in case: select convert(char(10), @dateissued, 126) you can cast , convert

javascript - Warning: React.createElement: type should not be null, undefined, boolean, or number -

warning: react.createelement: type should not null, undefined, boolean, or number. should string (for dom elements) or reactclass (for composite components). i putting react page , have come across error above when try use es2015 style code. when use following code error var react = require('react'); export default class storeapp extends react.component { getinitialstate() { return null; } render() { return ( <div> <p>this should display on screen</p> </div> ); } } this works fine... var react = require('react'); var storeapp = react.createclass({ render: function() { return ( <div> <p>this should display on screen</p> </div> ); } }); module.exports = storeapp; im using babel following presets ['react','es2015'] ideas whats going on here? in es6 can't use getinitialstate() . use constructor() . e.g. con...

Phonegap Cordova 5.x looking for working Android QR-Code-Scanner Plugin (Google API 23) -

i looking working barcode-scanner plugin.. i´ve found one: https://github.com/phonegap/phonegap-plugin-barcodescanner ..but unfortunately doesn´t work google api 23 (there errors occurring bookmarkcolumns plugin included).. far know works api 22 or less so errors ocurr in captureactivity (src folder) > com.google.zxing.client.android.share files: apppickeractivity.java bookmarkpickeractivity.java shareactivity.java error: bookmarkcolumns cannot resolved or not field so question is, there other barcode-scanner-solution phonegap or there way fix these errors? any appreciated! thanks! barcode scanner : click on below link find multiple numbers of barcode scanner plugin. please add ever shoots api level. barcode scanner plugins

JavaScript array find fitting range -

i have following array 2 objects: var myarr = [{ id: 3, licences: 100 new_value_pr_licence: 40 }, { id: 4, licences: 200 new_value_pr_licence: 25 }] a user wish buy 150 licences. means fall category 100 because above 100 licences below 200 means pay $40 per licence. note array object values varies. order plans price per licence: myarr.sort(function (a, b) { return a.new_value_pr_licence - b.new_value_pr_licence; }) then starting start of array, take many of plan can without going on number user wants buy: var numuserwants = 150; var purchases = {}; var cheapestavailableproduct = myarr.shift(); while (numuserwants > 0 && cheapestavailableproduct) { if (numuserwants <= cheapestavailableproduct.licences) { purchases[cheapestavailableproduct.id] = math.floor(cheapestavailableproduct.licences / numuserwants); numuserwants = cheapestavailableproduct.licences % numuserwants; } cheapestavailableproduct = myarr.shi...