Posts

Showing posts from January, 2011

Impose max combined file size for file inputs through jQuery validator -

i have interesting scenario @ hand, i'm not versed jquery validate @ moment. goal: using fileapi, determine file size of each file uploaded in multiple <input type="file" /> controls while using jquery validate plugin, ensuring combined total of bytes not greater 50mb. these elements can dynamically added/deleted. for sake of consistency, i'd validation work through jquery validator plugin, error message appended under last input file control. from understand, adding method validator verifies 1 element @ time, guess first question, can single method validate multiple elements once opposed being fired each element. ex.: <input type="file" name="file1" id="file1" /> <input type="file" name="file2" id="file2" /> <input type="file" name="file3" id="file3" /> <script type="text/javascript"> $(function() { // add

julia lang - Immutable dictionary -

is there way enforce dictionary being constant? i have function reads out file parameters (and ignores comments) , stores in dict: function getparameters(filename::abstractstring) f = open(filename,"r") dict = dict{abstractstring, abstractstring}() ln in eachline(f) m = match(r"^\s*(?p<key>\w+)\s+(?p<value>[\w+-.]+)", ln) if m != nothing dict[m[:key]] = m[:value] end end close(f) return dict end this works fine. since have lot of parameters, end using on different places, idea let dict global. , know, global variables not great, wanted ensure dict , members immutable. is approach? how do it? have it? bonus answerable stuff :) is code ok? (it first thing did julia, , coming c/c++ , python have tendencies things differently.) need check whether file open? reading of file "julia"-like? readall , use eachmatch . don't see "right way it" (like in python).

Laravel - 2 queries over nothing? -

hello guys, in official doc of eloquent laravel , way make update table : $flight = app\flight::find(1); $flight->name = 'new flight name'; $flight->save(); i must say, don't understand that. me, means basic update, there 2 queries database - select , update ? anyone explain me why solution ? thanks ! any abstraction used complex applications. code simple can not feel advantage. object relation mapping (orm) used hide details of operating databases, or running sql queries. just mvc model, different layers in charge of different fields. view: render html controller: logical control, if .. else .. model: data access, data modification , persistence. the controller layer won't take care of how model layer works, find object $flight , , change property, , save() . natural , neat. controller layer object modifying, instead of data modifying. by separating data , object, can easily, or @ lease possibly, change implementation of data pe

android - google signin uid & firebase uid don't match after firebase upgrade to 9.2.0 -

i upgraded firebase database version 9.2.0. firebase uid used google:(google signin id), but, doesn't match now. before upgrade - google signin uid = 101672719428298324455 firebase uid = google:101672719428298324455 after upgrade - google signin uid = 101672719428298324455 firebase uid = fcojpimyqwthp02yzwysrezshkp2 the google uid returned other services such classroom, so, need use uid tell user is. update users field use google sign-in uid instead of firebase one. but, then, how write security rules auth using google signin uid upgraded firebase? specific use case rules teacher can read student's report card. teacher , student uids provided google classroom class roster match google sign-in uids, not firebase uid. below the code being used login after upgrade - firebaseauth auth = firebaseauth.getinstance(); authcredential credential = googleauthprovider.getcredential(token, secret); auth.signinwithcredential(credential).addoncompleteli

How to upload an image to cloudant database? -

i trying upload image cloudant database, using cloudant client - 2.0.0 here's code looks : public static void main(string[] args) throws malformedurlexception, exception { try { cloudantclient client = clientbuilder.account("uri").username(user).password(password).build(); system.out.println("server version: " + client.serverversion()); database db = client.database("rss_news", false); jsonobject obj = new jsonobject(); obj.put("_attachments", new attachment(encodefiletobase64binary("c:/users/public/pictures/sample pictures/desert.jpg"), "image/jpeg")); obj.put("name", "bhanwar"); db.save(obj); } catch (exception e) { e.printstacktrace(); } } // java type can serialized json private static string encodefiletobase64binary(string filename) throws ioexception { file file = new file(filename); sys

javascript - How do I export Google Script form data to Google Drive? -

i have built simple form in google scripts. file upload feature functional: uploads file google drive. cannot figure out how grab form information (name, organization, content type), save spreadsheet, , upload google drive. how upload form data (text fields) drive? !!update 7/19!! code updated spreadsheet app code. , improved html. css not included don't think it's relevant issue. !!update 7/20!! code working. updated reflect full functionality. sandy assistance. form.html <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=montserrat:400"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <div id="main"> <div class="form"> <form id='myform'> <div class="header"> <h1>information submission form</h1> <h2>center alternative fuels</h2>

python - Pygame failing. Badly -

i've been trying learn pygame this site , , keeps failing. i'm it's supposed python 3. here's code that's failing (straight site): import pygame # colors black = (0, 0, 0) white = (255, 255, 255) blue = (0, 0, 255) # screen dimensions screen_width = 800 screen_height = 600 # player. without player, game? class player(pygame.sprite.sprite): def __init__(self, x, y): super.__init__() # set height, width self.image = pygame.surface([15, 15]) self.image.fill(white) # make our top-left corner passed-in location. self.rect = self.image.get_rect() self.rect.y = y self.rect.x = x # set speed vector self.change_x = 0 self.change_y = 0 self.walls = none def changespeed(self, x, y): # think twat? # keff keff. changes player's speed. self.change_x += x self.change_y += y def update(self):

Loss not converging in Polynomial regression in Tensorflow -

import numpy np import tensorflow tf #input data: x_input=np.linspace(0,10,1000) y_input=x_input+np.power(x_input,2) #model parameters w = tf.variable(tf.random_normal([2,1]), name='weight') #bias b = tf.variable(tf.random_normal([1]), name='bias') #placeholders #x=tf.placeholder(tf.float32,shape=(none,2)) x=tf.placeholder(tf.float32,shape=[none,2]) y=tf.placeholder(tf.float32) x_modified=np.zeros([1000,2]) x_modified[:,0]=x_input x_modified[:,1]=np.power(x_input,2) #model #x_new=tf.constant([x_input,np.power(x_input,2)]) y_pred=tf.add(tf.matmul(x,w),b) #algortihm loss = tf.reduce_mean(tf.square(y_pred -y )) #training algorithm optimizer = tf.train.gradientdescentoptimizer(0.01).minimize(loss) #initializing variables init = tf.initialize_all_variables() #starting session session sess = tf.session() sess.run(init) epoch=100 step in xrange(epoch): # temp=x_input.reshape((1000,1)) #y_input=temp _, c=sess.run([optimizer, loss], feed_dict={x: x_

locality and establishment not working in google map -

i have options autocomplete google map search when added locality , types wont work. var options = { types:['school'], componentrestrictions: { locality:'caloocan', country: 'ph'} }; based documentation , componentrestrictions can used restrict results specific groups. currently, can use componentrestrictions filter country. country must passed as two-character, iso 3166-1 alpha-2 compatible country code. here example documentation var input = document.getelementbyid('searchtextfield'); var options = { types: ['(cities)'], componentrestrictions: {country: 'fr'} }; autocomplete = new google.maps.places.autocomplete(input, options); i think locality part of code made errors. because stated in documentation " in general single type allowed ". and (cities) type collection instructs places service return results match e

javascript - How to parse binary data from websockets? -

i'm trying parse frames websockets. did fiddler, shows me binary data frame. need same result need via javascript or php (or other language). tried js var = new websocket("ws://example.com"); a.onopen = function() { console.log("open"); a.send("test"); var b = new uint8array([8,6,7,5,3,0,9]); a.send(b.buffer); }; a.onmessage = function(e) { console.log(e.data.tostring());}; a.onclose = function() { console.log("closed");}; but didn't receive data on "a.onmessage". @ moment i've stucked. clarify question 1 more time. need simple code example parses frames websockets. example of i'm trying parse thanks! using dataview : var socket = new websocket('ws://127.0.0.1:8081'); socket.binarytype = 'arraybuffer'; socket.onmessage = function (e) { var data = e.data; var dv = new dataview(data); // reads uint16 @ beginning var uint16= dv.getuint16(0); // reads next ui

ruby on rails - active admin image field is shown dirty -

i using activeadmin gem admin console in ror application. in activeadmin model-featuredevent have declared form creating featured event. featuredevent model image field tried writing it. says nomethoderror in admin::featuredevents#new undefined method `new' nil:nilclass. following activeadmin model: activeadmin.register featuredevent permit_params permitted = [:name, :location, :start_time, :description,:image,:phone, :email, :event_url, :active, :free, :image, :s3_credentials] permitted << :other if params[:action] == 'create' permitted end controller def create byebug @featuredevent = event.new(permitted_params[:featuredevent]) if @featuredevent.save redirect_to '/admin/featured_events#index' else flash[:message] = 'error in creating image.' end end def event_params params.require(:event).permit(:name, :location, :start_time, :description,:image,:phone, :email, :event_url, :active, :free, :image, :s

regex - What regular expression can I use to find in an HTML document tables that only contain one row? -

i'm searching through html documents , trying find tables contain single row. regex can use this? i've tried negative lookahead , can isolate single row, don't see how ensure there's single <tr></tr> between <table></table> tags. here's regex i'm working now: <table[\w].*?<tr[\w].*?<\/tr>.*(?!.*<tr[\w])<\/table> this should not match regex: <html> <body> <table> <tr> <td>a</td> </tr> <tr> <td>b</td> </tr> <tr> <td>c</td> </tr> <tr> <td>d</td> </tr> </table> </body> </html> this should match regex: <html> <body> <table> <tr> <td>a</td> </tr> </table> </body> </html> this should work: <table>(?>[^<]++|<(?!\

ios - Trouble indexing into array within asynchronous call, Swift -

Image
i'm trying create scrollview of "match" object images correlates array of "match" objects within view controller, if tap onto image of "match" in scrollview, can take index of image in minimatchescontainer, , use access match object within array that image corresponds to. tried going for-loop, problem since i'm getting match images server asynchronously, calls return out of order , containerview indexes off (i've added image of console's print statemen show mean). i'm @ bit of impasse, , appreciate advice go here. should change approach? there i'm missing? code added below. //function create contentscrollview minimyatches func setupminicontentscroll(contentscroll: uiscrollview) { let scalar:double = 4/19 let contentviewdimension = contentscroll.frame.width * cgfloat(scalar) let contentscrollwidth = cgfloat(localuser.matches.count) * (contentviewdimension + cgfloat(12)) - cgfloat(12) let matchmanager = matchesma

typescript - What is the meaning of an object param in a function signature? -

what meaning of object param in function signature? came across code snippet, , i'm not sure what's going on here. export const items = (state: = [], {type, payload}) => { case (type) { ... } }; i don't understand {type, payload} in function signature. this example of destructuring . you can see this: let items = (state: = [], {type, payload}) => { }; compiles on typescript playground : var items = function (state, _a) { if (state === void 0) { state = []; } var type = _a.type, payload = _a.payload; }; and can infer means second parameter of function object property called "type", , property called "payload". further, able refer "type" , "payload" directly in function body: let items = (state: = [], {type, payload}) => { console.log(type); console.log(payload); }; let myobj = { payload: "blue", type: "no-type" } items(null, myobj);

How to multiply every other list item by 2 in python -

Image
i'm making program validates credit card, multiplying every other number in card number 2; after i'll add digits multiplied 2 ones not multiplied 2. of double digit numbers added sum of digits, 14 becomes 1+4. have photo below explains all. i'm making python program of steps. i've done code below it, have no idea next? please help, , appreciated. code have returns error anyway. class validator(): def __init__(self): count = 1 self.card_li = [] while count <= 16: try: self.card = int(input("enter number "+str(count)+" of card number: ")) self.card_li.append(self.card) #print(self.card_li) if len(str(self.card)) > 1: print("only enter 1 number!") count -= 1 except valueerror: count -= 1 count += 1 self.validate() def validate(self):

c++ - Can we omit const on local variables in constexpr functions? -

for example: constexpr int g() { return 30; } constexpr int f() { // can omit const? const int x = g(); const int y = 10; return x + y; } is there any point ever declare local variables in constexpr function const ? aren't constexpr functions const local variables equivalent no const ? in other words, constexpr on function impose (imply) const on local variables? the same arguments declaring variables const in non- constexpr functions apply constexpr functions: declaring variable const documents fact won't ever changed. may in instances make function more readable. declaring variable const affects overload resolution, , may make h(x) resolve h differently depending on whether x const . of course, in opposite direction, mentioned in comments already: even in constexpr functions, local variables may changed. if variables changed const , attempts change them no longer accepted.

node.js - Error: Could not find module `eventsource` imported from a route -

i'm having trouble importing node module ember-cli app. in notebook/route.js, have import ember 'ember'; import eventsource 'eventsource'; i see other files importing other node modules 'ember-data' way. following in console when navigate route: error: not find module `eventsource` imported `ui/notebooks/route` @ requirefrom (loader.js:110) @ reify (loader.js:97) @ mod.state (loader.js:140) @ tryfinally (loader.js:21) @ requiremodule (loader.js:139) @ ember.defaultresolver.extend._extractdefaultexport (ember-resolver.js:390) @ resolveother (ember-resolver.js:122) @ superwrapper (ember.debug.js:21571) @ exports.default._emberruntimesystemobject.default.extend.resolveroute (ember.debug.js:5014) @ exports.default._emberruntimesystemobject.default.extend.resolve (ember.debug.js:4847) i installed node module using npm install eventsource --save , generated following in package.json: "devdependencies": { "body-parser": "^1

php - Why is it that sometimes I have to JSON.parse() my AJAX response? -

i have non-uniformity how client-side jquery handles json ajax responses via server-side php. here 2 example ajax calls have: function checkorders() { $.ajax({ type: "post" , url:"/service/index.php" , data: { q: "checkorders" } , complete: function(result) { // note here json.parse() clause var x = json.parse(result.responsetext); if (x['unhandled_status']>0) { noty({ text: '<center>there <b>'+x['unhandled_status']+'</b> unhandled orders.', type: "information", layout: "topright", modal: false , timeout: 5000 } }); } } , xhrfields: { withcredentials: true } }); }

javascript - typeahead returns only the first 5 rows of the database -

can me this? have form <form action={{'/query'}} method="get" autocomplete="off"> <input type="text" name="places" id="places"> <input type="submit" value="go"> </form> this searh.js $(document).ready(function(){ var places = new bloodhound({ datumtokenizer:bloodhound.tokenizers.obj.whitespace('name'), querytokenizer:bloodhound.tokenizers.whitespace, remote: '/query' }); places.initialize(); $('#places').typeahead({ hint:true, highlight: true, minlength:2 },{ name:'places', displaykey: 'name', source: places.ttadapter() }); }); this route route::get('/query',['uses'=>homecontroller@query]); this query function in homecontroller public function query() { $query = input::get('places'); $results = db::table('evac_center')->w

python 3.4 - How can I use pytest.raises with multiple exceptions? -

i'm testing code 1 of 2 exceptions can raised: machineerror or notimplementederror. use pytest.raises make sure @ least 1 of them raised when run test code, seems accept 1 exception type argument. this signature pytest.raises : raises(expected_exception, *args, **kwargs) i tried using or keyword inside context manager: with pytest.raises(machineerror) or pytest.raises(notimplementederror): verb = verb("donner<ind><fut><rel><sg><1>") verb.conjugate() but assume checks whether first pytest.raises none , sets second 1 context manager if is. passing multiple exceptions positional arguments doesn't work, because pytest.raises takes second argument callable. every subsequent positional argument passed argument callable. from documentation : >>> raises(zerodivisionerror, lambda: 1/0) <exceptioninfo ...> >>> def f(x): return 1/x ... >>> raises(zerodivisionerror, f, 0) <excepti

Following redirects internally with Varnish -

i'm trying implement rubygems reverse proxy using varnish 4.1. clients inside intranet not have general outbound nat, need varnish internally follow redirects, preferably caching both 302 rubygems.org , response cdn server. here's default.vcl: vcl 4.0; import std; backend default { .host = "rubygems.org"; .port = "80"; } sub vcl_recv { std.syslog(180, "doing vcl_recv"); std.syslog(180, "req.url = " + req.url); } sub vcl_deliver { std.syslog(180, "doing vcl_deliver"); std.syslog(180, "resp.status = " + resp.status); if (resp.status == 302) { set req.url = resp.http.location; std.syslog(180, "restarting req.url = " + req.url); return(restart); } } sub vcl_backend_fetch { std.syslog(180, "doing vcl_backend_fetch"); std.syslog(180, "bereq.retries = " + bereq.retries); } sub vcl_backend_error { std.syslog(180, &qu

configuration - Ansible similar role refactoring -

installing munin plugins similar: create symlinks + template config file. for example: role munin_plugin_nginx : --- - name: create symlink plugin file: src="/usr/share/munin/plugins/{{ item }}" dest="/etc/munin/plugins/{{ item }}" state=link with_items: - "nginx_request" - "nginx_status" - name: template /etc/munin/plugin-conf.d/nginx template: src: etc/munin/plugin-conf.d/nginx.j2 dest: /etc/munin/plugin-conf.d/nginx owner: root group: root mode: 0644 notify: restart munin-node role munin_plugin_httpd : --- - name: create symlink plugin file: src="/usr/share/munin/plugins/{{ item }}" dest="/etc/munin/plugins/{{ item }}" state=link with_items: - "apache_accesses" - "apache_processes" - "apache_volume" - name: template /etc/munin/plugin-conf.d/httpd template: src: etc/munin/plugin-conf.d/httpd.j2

android - Use Custom Layout in NavigationDrawer With Header And list -

Image
how add custom layout in navigationview , design create custom navigationview use material design,i want put drawer icon right , text left of this i search , experience works fine at first create layout header. name nav_header_main.xml put in layouts folders in res , put code in it.. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="@dimen/nav_header_height" android:background="@drawable/header" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:theme="@style/themeoverlay.appcompat.dark" android:gravity="top"

php - string to array, max length, break on words -

i have string break array. each array needs have set length, let say, 45 characters. each break point needs based on words , not characters (so, never more 45, in 30'ish range, if long-char word used) so, let take string $content = 'sed suscipit enim in consectetur lacus vestibulum efficitur convallis luctus curabitur vehicula massa nec pretium sed maximus nunc in aliquam orci nulla facilisi nullam vulputate ornare dictum sed fermentum sapien nec felis gravida eget consequat ex iaculis vestibulum nec feugiat nisl sed consequat nulla sed in odio congue dictum augue et mollis nunc integer libero leo eleifend sed congue ut ultrices sed nulla integer sapien felis sollicitudin et turpis nec mattis egestas augue phasellus non lectus ac ipsum ultrices consectetur eu @ justo nam'; and resulting array (what after) $data = []; $data[] = 'sed suscipit enim in consectetur lacus'; $data[] = 'vestibulum efficitur convallis luctus'; $data[]

android - Sony Xperia E6833 4K Display, Xamarin's Resources.DisplayMetrics.DensityDpi returns incorrect value -

cpecifications e6833 says device has screen resolution of 4k 2160 x 3840 pixels (~ 801 ppi pixel density). however, xamarin resources.displaymetrics.densitydpi returns value android.util.displaymetricsdensity.xxhigh corresponding hd display, instead of android.util.displaymetricsdensity.xxxhigh, corresponding 4k display. knows - why?

javascript - Slick Slider width recalculation -

i'm trying add slide in panel on slick container css. carousel works except new width not being calculated when space has been added. recalibrate once advance next slide i'd happen each time panel opened or closed. i've tried adding both margin , padding, neither makes difference. ideas? https://jsfiddle.net/mhigley/dpf7mlpl/ html: <button type="button" id="button"><i class="fa fa-arrow-right"></i></button> <aside> <h2>slide in panel</h2> <ol> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> </ol> </aside> <main role="main"> <div class="sections"> <section> <article> <h2>first slide</h2> <p>lorem ipsum d

django rest-auth get user profile -

i´m little bit lost... i´m trying develop ionic app witch needs authenticated versus django web application. i installed django-rest-framework , django-rest-auth. i´m able login, getin user token, how can retrieve more user data? url(r'^rest-auth/', include('rest_auth.urls')), url(r'^rest-token-auth/$',obtain_auth_token), with django-rest-auth in host.com/rest-auth/user/ url have data: http 200 ok content-type: application/json vary: accept allow: get, put, head, options, patch { "username": "ikerib", "email": "ikerib@gmail.com", "first_name": null, "last_name": null } but need more! id, user_photo, city... i tried configuring user serializer this: from rest_framework import serializers gamer.models import gameruser class gameuserserializer(serializers.modelserializer): class meta: model = gameruser fields = ('id', 'fullname', '

How to add elements dynamically in fragment in android -

i have fragment , , want add elements (textview, button) dynamically when click on floating action button . code: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view view = inflater.inflate(r.layout.xyz, container, false); floatingactionbutton fab = (floatingactionbutton) view.findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { // new elements on click // new elements on click } }); return view; } try xml code fragment <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="

setting variables to a value using linear programming in r -

i have developed linear programming model in r , know command set variable value, here code , results: install.packages("lpsolveapi") library(lpsolveapi) #want solve 6 variables, these correspond number of bins lprec <- make.lp(0, 6) lp.control(lprec, sense="max") #model 1 set.objfn(lprec, c(13.8, 70.52,122.31,174.73,223.49,260.65)) add.constraint(lprec, c(13.8, 70.52, 122.31, 174.73, 223.49, 260.65), "=", 204600) add.constraint(lprec, c(1,1,1,1,1,1), "=", 5000) here results: > solve(lprec) [1] 0 > get.objective(lprec) [1] 204600 > get.variables(lprec) [1] 2609.309 2390.691 0.000 0.000 0.000 0.000 i set first result (2609) 3200,and last result 48, , optimize on other variables, appreciated. ideally expectation constrained optimization should add more constraints per requirement. not familiar lpsolveapi , not able correct coding need like: add.constraint(lprec, c(1, 0, 0, 0, 0, 0), "="

php - How to sort associative array? -

i have associative array. on print_f($array_name), got this array ( [0] => array ( [teamid] => abc [distance] => 1.25 ) [1] => array ( [teamid] => xyz [distance] => 0.25 ) ) this array want sort according distance . eg, should after sorting, array ( [0] => array ( [teamid] => xyz [distance] => 0.25 ) [1] => array ( [teamid] => abc [distance] => 1.25 ) ) if know answer please explain or suggest me link can understand beginning. thank you. here need do. $a = array(array( 'teamid' => 'abc', 'distance' => 1.25 ), array( 'teamid' => 'xyz', 'distance' => 0.25 )); $distance = array(); foreach ($a $key => $row) { $distance[$key] = $row['distance']; } array_multisort($distance, sort_asc, $a); print_r($a); this outputs array (

java - My input only read three commands and does nothing with the ones it reads? -

i have write user interface takes in data command screen , uses access methods in linked list class. both in same file , node class written , compiles fine. if can me figure out why reads 3 commands, such dog, cat, p , says java.io.ioexception: stream closed. checked if adding spaces i.e. commanding dog cat, bird, p affected amount of lines read , didn't. exception same. tips appreciated. public static void main(string[] args){ linkedlist link= new linkedlist(); int n=0; system.out.println("type command\n"); try{ bufferedreader in=new bufferedreader(new inputstreamreader(system.in)); s=in.readline(); while(in.readline()!=null){ s=in.readline(); char first=s.charat(0); int space= s.indexof(" "); while(space<=n){ if(first=='i'){ string w=s.substring(space); link.inse

html - Node Mysql not inserting -

var mysql = require('mysql'); var url = require('url'); var express = require('express'); var http = require('http'); var app = express(); var aluno, disc; app.get('/', function(req, res){ console.log("aluno: " + req.query.aluno); console.log("disc: " + request.query.disc); }); var connection = mysql.createconnection({ host: "localhost", user: "root", password: "161616", database: "matricula" }); connection.connect(); var post = {iddisciplinasmatriculada: aluno*3+disc*2, iddisciplina: disc, idaluno: aluno}; connection.query('insert disciplinasmatriculadas set ?', post, function(err, result) {}); when change few things can run throught cmd receiving args, when receives "/index.js?aluno=2&disc=2" browser, nothing happens @ db. does know problem might be? also, here html file i'm using: <html> <head> <title>d

grails - inheritance of variable in groovy -

maybe late hours :) can 1 tell why parent class pull variables child foo { public string mystring = "my test string of foo" public printoutstring () { println this.mystring } } bar extends foo { public string mystring = "my test string of bar" } foo.printoutstring() //prints out "my test string of foo" expected bar.printoutstring() //prints out "my test string of foo" not expected thought take string bar instead there no field inheritance in groovy nor in java . can override value of field, linked question's answer suggest: class foo { public string mystring = "my test string of foo" public printoutstring () { mystring } } class bar extends foo { { mystring = "my bar" } } assert new foo().printoutstring() == "my test string of foo" assert new bar().printoutstring() == "my bar"

CentOS PHP curl unable to negotiate an acceptable set of security parameters -

on ubuntu 14.04.3 code works fine: $url_login = "https://test.example.com/login.do"; $cert_file = '/var/www/html/test/cert.pem'; $ssl_key = '/var/www/html/test/cert_private.pem'; $post_fields = 'useraction=1&cancelreason=&canceltype=&account=&memotype=&usertext=&userid=99999999&password=xxxxxxxxxxxxxxxx'; $ch = curl_init(); $options = array( curlopt_returntransfer => 1, curlopt_header => 1, curlopt_followlocation => 1, curlopt_ssl_verifyhost => 0, curlopt_ssl_verifypeer => 0, curlopt_useragent => 'mozilla/4.0 (compatible; msie 5.01; windows nt 5.0)', curlopt_verbose => 0, curlopt_url => $url_login , curlopt_sslcert => $cert_file , curlopt_sslcerttype, 'pem', curlopt_sslkey => $ssl_key, curlopt_cookiesession => 1, curlopt_post => true, curlopt_postfields => $post_fields ); curl_setopt_a