Posts

Showing posts from February, 2011

bash - Compress/expand sound from Mp3 files in Linux server/terminal? -

in python script on ubuntu server, need process many incoming mp3 audio files sound compressor. e.g. tool reduces difference between quiet , loud sound levels. is possible? believe don't need write program this. if so, utility should use , how configure it? ffmpeg has filter compressing or expanding audio’s dynamic range called compand . can exec within python script. check documentation usage examples. random example (for audio whisper , explosion parts): ffmpeg -i input.mp3 -af "compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0" output.mp3 meaning: attack 0, decay 1, points -90/900, -70/-70, -30/-9. 0/-3, soft-knee 6, gain 0, volume 0, delay 0 to install can sudo apt-get install ffmpeg or compile source latest features.

android - Using AsyncTask with timer in fragment -

i'm using asynctask load data via volley. want asynctask invoked after n minutes, maybe duplicate , silly question, cant figure how implement it. maybe need implement asynctask in fragment ? this asynctask.class package com.aa.qc.task; import android.os.asynctask; import com.aa.qc.callbacks.zlecenialoadedlistner; import com.aa.qc.extras.zleceniasorter; import com.aa.qc.extras.zleceniautils; import com.aa.qc.network.volleysingleton; import com.aa.qc.pojo.zlecenia; import com.android.volley.requestqueue; import java.util.arraylist; public class taskloadzlecenia extends asynctask<void, void, arraylist<zlecenia>>{ private zlecenialoadedlistner mycomponent; private volleysingleton volleysingleton; private requestqueue requestqueue; private zleceniasorter msorter = new zleceniasorter(); public taskloadzlecenia(zlecenialoadedlistner mycomponent) { this.mycomponent = mycomponent; volleysingleton = volleysingleton.getsinstance(

mysql - Updating error in sequelize -

what kind of error this? unhandled rejection sequelizedatabaseerror: er_empty_query: query empty @ query.formaterror (node_modules/sequelize/lib/dialects/mysql/query.js:159:14) @ query._callback (node_modules/sequelize/lib/dialects/mysql/query.js:35:21) @ query.sequence.end (node_modules/mysql/lib/protocol/sequences/sequence.js:96:24) @ query.errorpacket (node_modules/mysql/lib/protocol/sequences/query.js:94:8) @ protocol._parsepacket (node_modules/mysql/lib/protocol/protocol.js:274:23) @ parser.write (node_modules/mysql/lib/protocol/parser.js:77:12) @ protocol.write (node_modules/mysql/lib/protocol/protocol.js:39:16) @ socket.<anonymous> (node_modules/mysql/lib/connection.js:96:28) @ socket.emit (events.js:107:17) @ readableaddchunk (_stream_readable.js:163:16) @ socket.readable.push (_stream_readable.js:126:10) @ tcp.onread (net.js:538:20) i'm trying update entity following code: db.account.update({

Continuation Line error in R -

this feels simple question, can't find answer anywhere i've searched. i'm new r , when try break code across several lines ctrl+shift+enter, don't '+' should start line in console, , error message when try run it. sample code is: for (j in 1:length(codes)) { currcountry <- subset(currregion, country.code == codes[j]) currcountry <- currcountry[order(currcountry$variable, decreasing=false),] lines(1960:2009, currcountry$value, col="#00200070", lwd=0.8) } i following error: error: unexpected input in "for (j in 1:length(codes)) {‚" if copy same code online tutorial i'm doing, works fine, each line starts '+'. can this?

php - .htaccess returning mod_rewrite redirect to the index page of the www folder of wamp -

i trying create "pretty urls dynamically created pages. desire render pages index page. i working on computer using wamp 2.5/apache 2.4.9 the apache httpd.conf set to: listen 0.0.0.0:7080 listen [::0]:7080 documentroot "c:/wamp/www/" servername localhost:7080 i have tried several different approaches have resulted in blank page returning 404 error page. code below returns index.php in /www/ folder in wamp. this non-working .htaccess code: # turn rewrite engine options +followsymlinks rewriteengine on #rewritecond %{request_filename} !-d #rewritecond %{request_filename} !-f #rewritecond %{request_filename} !-l # pages rewriterule ^([a-za-z0-9]+)$ index.php?topic=$1 # rewrite www. rewritecond %{http_host} ^localhost:7080/demo [nc] rewriterule ^(.*)$ http://www.localhost:7080/demo/$1 [r=301,nc] the clupret line of code believe: rewriterule ^([a-za-z0-9]+)$ index.php?topic=$1 which thinking sort of path issue not sure... assistance appreciated

mongodb - mongdb index does not work properly -

environment 10.10.109.131:23000 => shard000 10.10.109.131:23001 => shard001 10.10.111.251:23000 => shard000 10.10.111.251:23001 => shard001 10.10.97.197:23000 => shard000 10.10.97.197:23001 => shard001 phenomenon view abnormally high in system.profile table scan, explain query again found table scan return normal issue sql: db.followers.find({"$and":[{"$or":[{"vaild":0},{"vaild":null}]},{"from":{"$in":[576893,2095602,1184292,650082,1373126,875232,815151,556585,1391458,813307,600211,2273636,106322,2206656,804217]}},{"to":1600312},{"$or":[{"vaild":null},{"vaild":0}]}]}) system.profile "op" : "query", "ns" : "chuyesocial.followers", "query" : { ... }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 424277

objective c - Best way and how to display multiple views in a mac osx cocoa application? -

i learning create simple cocoa mac osx application. however, need research few things before jumping in. coming background in ios development. trying see best way replicate interface below. http://macmagazine.com.br/wp-content/uploads/2011/08/08-sparrow.png?cda6c1 i want show multiple views 1 below. have idea on how accomplish this, not sure if best way. in app delegate, thinking making references 3 different views . then, display each 1 subview main view. idea , if possible can show me example code on how achieve this? the code below had in mind. self.window represents window in mainview. [self.window.contentview addsubview:self.viewcontroller1.view]; [self.window.contentview addsubview:self.viewcontroller2.view]; that looks nssplitview. can set size of subviews splitview in xib/storyboard width like. there more documentation here: https://developer.apple.com/library/prerelease/mac/documentation/cocoa/reference/applicationkit/classes/nssplitview_class/index.ht

css - Having multiple clickable segment in a html canvas circle that fills color in each area that is clicked -

Image
i need create rating circle rating ranging between 1 5. have circle 5 different segments. on click of each segment color of segment should filled. being new design canvas, i'm unable figure out in splitting canvas multiple clickable segments. image i able attain using css divs in place <div class="main"> <div class="quarter quarter1"></div> <div class="quarter quarter2"></div> <div class="quarter quarter3"></div> <div class="quarter quarter4"></div> <div class="cutout"></div> </div> link jsfiddle i because steadfast in purpose after many days. decide completion answer. hope answer complete. var context; var canvas_width; var canvas_height; var canvas_offset_left; var canvas_offset_top; var center_location_x = 100; var center_location_y = 100; var item_selected; colors = ["#fff212", "#a8cf45", &

C# Windows Service - UDP listener stops service form starter -

i trying make service listens udp packet. , works fine in debug mode. when have installed services problems start. onstart() run startlistener(). when listener runs service stops, when comment out , try again works. 1053 error code pops up. public partial class service1 : servicebase { private const int listenport = 9; public service1() { initializecomponent(); } protected override void onstart(string[] args) { startlistener(); } protected override void onstop() { } private static void startlistener() { udpclient listener = new udpclient(listenport); ipendpoint groupep = new ipendpoint(ipaddress.any, listenport); try { byte[] bytes = listener.receive(ref groupep); string mac = string.join("", bytes.skip(6).take(6).select(b => b.tostring("x2"))); } catch (exception e) { }

What is this error in fortran and how to stop the program when it occurs? -

i have program reads information input file. since code has nothing wrong, can compiled. question if there reading error, program still running not thing when program gets larger , hard me find out error occurs. the program is: program main implicit none integer ioerr, switch_1(3), switch_2, open(100, file='./input_error.gr', action='read', iostat=ioerr) if (ioerr == 0) read(100,*) (switch_1(i), i=1,3) write(*,*) 'switch_1 is: ', switch_1 read(100,*) switch_2 write(*,*) 'switch_2 is: ', switch_2 else write(*,*) 'file not read' end if end program main and input file is: 1,2,3 3 and works fine. if input file is: 1,2 i reading error don't know , want program stop every time error occurs, , if possible gives me error message did file opening: forrtl: severe (24): end-of-file during read, unit 100, file /users/ranranking/develop/test/switch_test/./input_error.gr image pc

utf 8 - Writing to file in python gives ascii error -

i'm trying write results web scraping html file. i'm using beautiful soup scrape links , text web pages. when i'm creating file , writing it, following error: unicodeencodeerror: 'ascii' codec can't encode characters in position 939-940: ordinal not in range(128) the line writing file looks this: file_object.write(file_content) and when instead this: file_object.write(file_content.encode('utf-8')) i don't error, can't print special characters, å or ä. i realize kind of encoding error, can't understand how around it. project in entirety is located here , line 81, since had trouble extracting runnable , logical sub parts. i'm using mac, had similar problem running same script on pc. using python 2.7 yes use open() codecs module, or, in python 3 normal (built-in) open() this: f = open(path, "wt", encoding="utf-8") but, if don't want change code much, not need special. trick add correc

node.js - Node http-proxy in Docker container -

i have following code works great in local environment. however, when try run same code docker container (via boot2docker), cannot https://[boot2docker_ip]:4000 i tried updating target value in code below these options none of them seemed trick: target: 'http://localhost:3000', target: 'http://0.0.0.0:3000', target: 'http://127.0.0.1:3000', target: 'http://<boot2docker_ip>:3000', var fs = require('fs'); require('http-proxy').createproxyserver({ ssl: { key: fs.readfilesync(__dirname + '/certs/ssl.key', 'utf8'), cert: fs.readfilesync(__dirname + '/certs/ssl.crt', 'utf8') }, target: 'http://localhost:3000', ws: true, xfwd: true }).listen(4000); i using node-http-proxy package https://github.com/nodejitsu/node-http-proxy edit here git repo try out behavior; have checked in fake ssl simplicity. dockerfile: from readytalk/nodejs add ./src /app add ./s

android - When image moves from left to right and right to left a blank space is seen -

Image
when image moves left right , right left, left white space. want fill layout image animation looks better , no white space see. this white area covered picture complete background moves. mainactivity.java package com.example.abdul.game; import android.opengl.matrix; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.animation.animation; import android.view.animation.translateanimation; import android.widget.framelayout; import android.widget.imageview; import android.widget.linearlayout; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); framelayout img_animation = (framelayout) findviewbyid(r.id.img_animation); translateanimation animation = new translateanimation(0.0f, 400.0f, 0.0f, 0.0f); //

angularjs - Angular X-editable timepicker or external jQuery plugin -

i using angular x-editable (editable row) in laravel. add timepicker configuration (there no in x-editable time). more need read , write data database. i trying use x-editable time , timepicker jquery plugin, still don't know how integrate timepicker field generated x-editable (table row). satisfied result me add external timepicker jquery plugin. is there possibility add external jquery plugin field in x-editable table if not there way integrate field generated x-editable (editable row) add time database , add configuration it? any or advice welcome. what html5 date/time picker? <input type="time" name="usr_time"> ui-bootstrap option more nice looking: https://github.com/gillardo/bootstrap-ui-datetime-picker

javascript - How to filter objects in AngularJS by specifying a filter type for each object? -

i have following data: { "records": [ { "name": "visits", "jan": "25000", "feb": "31050", "type" : "number" }, { "name": "cpc", "jan": "52", "feb": "39", "type" : "currency" }, { "name": "weather", "jan": "26", "feb": "28", "type" : "temperature" } ] } and i'm displaying in table following template: <table ng-app="myapp" ng-controller="kpiscontroller"> <thead> <tr> <th ng-repeat="(key, val) in objects[0]">{{key}}</th> </tr> </t

httpclient - hitting knox rest services using java? -

i new apache knox. have configured knox , started playing using command line. want hit knox webservices using java httpclient. there example or guide this? or there groovy script purpose? thanks you can use browser rest clients postman.easy use. to it.., launch chrome browser goto chrome extension library (google it) search postman rest client . add chrome extensions.

C++ Error with big three leak in memory-pointer being freed was not allocated (not duplicate) -

my code not run correctly , don't know how fix it. not duplicate question asking rule of 3 because post not me in solving question in post im using pointer pointer array. don't know did wrong in big 3 functions can please me correct mistake. compiler highlighting delete[] matrix[i]; in the destructor when i=2 inside loop in header file have: #ifndef fasdf_dynn_h #define fasdf_dynn_h #include <iostream> #include <fstream> #include<string> #include <cstdlib> #include <vector> using namespace std; template <class t> class matrixdynvector{ public: // matrixdynvector() { //creates 3 3 matrix elements equal 0 m=3; n=3; matrix=new int*[m]; for(int i=0;i<m;i++) matrix[i]=new int[n]; for(int i=0;i<m;i++) for(int j=0;j<n;j++) matrix[i][j]=0; } // matrixdynvector(int m,int n); template <class h> matrixdynvector<h>(const ma

The requirement for authentication of event subscribers in ServiceStack -

my client-server application uses servereventsfeature send commands client server. in client use servereventsclient , start method subscribe events, first i'm sending authentication request server using servereventsclient.serviceclient , send method. my client needs connect server if connection broken. use onexception action property of servereventsclient, , when connection breaks, call stop method in cycle , try again send authentication request until server responds. it works well, if restart server, before client has time send authentication request, see on server subscribe events (onconnect, onsubscribe, , on), , when checking properties of subscription, strange values isauthenticated: false, userid: -2. comes authentication request, , again there expected subscribe events, , time, property values expected isauthenticated: true, userid: 46. sessionid in first case differs value before disconnected, not match value after authentication. in onconnect event handler tr

amazon s3 - Laravel accessing S3 bucket vs AWS Role -

i have ec2 instance runs laravel 5.1. using s3 bucket through laravel's api: amazon_key=key amazon_secret=secret amazon_region=us-west-2 amazon_s3_bucket=my_app_bucket but set role enables box use particular bucket. why need key , secret? analysis of code, looks laravel demands key , secret, seem have create iam user account key/secret , use s3 access instead of using roles, preferred. there way around this, or how laravel s3 access works? a fix use iam credentials filesystem, queue, , email merged few days ago, upgrading laravel v5.1.7 should trick. https://github.com/laravel/framework/pull/9558

c++ - How to unbind a RenderTarget texture so it can be used as input to the next pass -

i have texture, along shaderresourceview, render scene's original image using rendertarget. like millions before me, use input next shader can blur, hdr, of that. the simple "new me" problem when go call pssetshaderresources , put texture shader's texture/constant buffer error: "resource being set ps shader resource slot 0 still bound on output" ...which makes sense, may still be. question how unbind texture being render target of initial pass? i'm doing this, presume sets original rendertargetview dxut using @ beginning, doesn't seem free texture: id3d11rendertargetview * rendertargetviewarraytq[1] = { dxutgetd3d11rendertargetview() }; pd3dimmediatecontext->omsetrendertargets(1, rendertargetviewarray, nullptr); assuming render target in slot 0: id3d11rendertargetview* nullrtv = nullptr; d3dcontext->omsetrendertargets(1, &nullrtv, nullptr); you need pass array of id3d11rendertargetview* of length 1, first of ne

java - Insert and update methods of dao are not working -

for reason adduser() , updateuser() methods not working. can 1 please @ code , figure out i'm making mistake. public void adduser(user user) { try { preparedstatement preparedstatement = connection.preparestatement("insert users(userid, firstname, lastname, jobtitle, email, username, password) values (?,?,?,?,?,?,?)"); // parameters start 1 preparedstatement.setint(1,user.getuserid()); preparedstatement.setstring(2, user.getfirstname()); preparedstatement.setstring(3, user.getlastname()); preparedstatement.setstring(4, user.getjobtitle()); preparedstatement.setstring(5, user.getemail()); preparedstatement.setstring(6, user.getusername()); preparedstatement.setstring(7, user.getpassword()); preparedstatement.executeupdate(); } catch (sqlexception e) { e.printstacktrace(); }

initialization - Declaring and assigning variables with file scope in C -

say declare following variable: int num; num = 0; int main(void) { /* ... */ exit(exit_success); } the compiler complain num being undeclared , default type int . not happen when in 1 step: int num = 0; or if move assignment main() : int main(void) { num = 0; /* ... */ exit(exit_success); } i once read explanation behavior cannot find anymore. update me again. i'm compiling gcc -std=c11 -o2 -g -pedantic -wall -c -fmessage-length=0 -v num = 0; statement can exist inside function. cannot exist in global scope. if put statement outside function, it's wrong , not allowed. think like, if have statement outside functions, in global scope, when , how statement can executed? so, that's wrong. a special case, initialization while defining allowed in form of int num = 0;

ios - replace a object in NSMutableArray -

i try replace object array string. use @property (strong, nonatomic) nsmutablearray *myarray; nsstring *oldstring = [nsstring stringwithformat:@"oldobject"]; nsstring *toreplace = [nsstring stringwithformat:@"newobject"]; nsuinteger index = [self.myarray indexofobject:oldstring]; [self.firstlanguagearray replaceobjectatindex:index withobject:toreplace]; but every time try replace, app crash. edit: logged "index". become integer 2147483647 . probably because call indexofobject returns nsnotfound . nsnotfound constant tells oldstring object not found in self.myarray dictionary, , constant has value of (nsuinteger)-1 (which equivalent unsigned value 2147483647 because of integer underflow), value crash app "out of bounds" exception. the solution test whether index != nsnotfound before using it. or make sure array self.myarray contains object of type nsstring value "oldobject" . if, given actual code, exp

javascript - CKEditor Get Preceding Text on the same line -

i use instance of ckeditor , able insert text within ckeditor @ point of cursor. want able grab text left of cursor start of line. i've tried finding x,y coordinates of cursor , didn't help. i'm confident of ckeditor's tools, can done, have not been able figure out tools use make work. var theeditor = ckeditor.instances.editorfull; sel = theeditor.getselection(); obj = sel.getstartelement().$; range = theeditor.getselection().getranges(); container = range[0].startcontainer.$; textlen = typeof obj.textcontent === "undefined" ? obj.innertext.length : obj.textcontent.length; offset = range[0].startoffset; if(container.nodetype === 3) { while (container.previoussibling) { container = container.previoussibling; if(container.length) { offset += container.length; }else{ offset += container.textcontent ? container.textcontent.length : container.innertext.length; } } } var pct = textlen > 0 ? offset / textlen : 0; cursor = math.floor(obj.offseth

javascript - How do I pass a angularjs variable into html tag? -

in controller: $scope.height = "height:100px;"; $scope.color = "red" in html: <div class="capsule" ng-style="{'height': height; 'background': color}"></div> how can make work? you have semi colon ';' in between style, ng-style expects object (comma separated). below code should work - <div class="capsule" ng-style="{'height': height, 'background': color}"></div>

nlp - How to slice a sentence like this in Python? -

assuming have sentence "the food not delicious.". if use traditional method slice sentence words, result may follows: "the/food/is/not/delicious/" but want slice sentence following: "the/food/is/not delicious/" the question how realize in python? lot! sorry decribing quesition breif before, in sentence "the food not delicious", "not delicious" attibute of "food" , when slice sentence want let word group "not delicious" go single slot. similarly, assuming have sentence this: "mr.lee nice person." now, "nice" attribute of person , slicing result is: "mr.lee/is/a/nice/person" but if change sentence to: "mr.lee not nice person." i wonder if it's possible slice sentence as: "mr.lee/is/a/not nice/person" i think difficult problem find out word decorated negative word. maybe question stupid enough, lot anyway!

shell - check whether elements are present in list or not bash -

this question has answer here: check if bash array contains value 31 answers : ${models:=foo bar foobar baz} : ${special_list:=station_tracks user_features} model in $models; echo $model if # model in special list; # how test this? # continue fi done so, how test whether variable model in special_list or not? perl has smartmatch operator ~~ . has been noted , bash , not awk have equivalent, use grep workaround. before continue, if going use bash array, use bash array. syntax going break horribly once beyond simple example, space, gets involved: models=(foo bar foobar baz) special_list=(station_tracks user_features) model in "${models[@]}" echo "$model" if printf '%s\0' "${special_list[@]}" | grep -fqxz "$model" continue fi done if prefer can use equi

java - Suppress clojure logging in Eclipse? -

i'm working 3rd party library implemented in clojure logs messages using clojure.tools.logging. i want suppress these messages in eclipse , have tried following suggestion no avail. any (hacky) solutions appreciated. it sounds clojure.tools.logging using different underlying logging implementation rest of application? for example if application using java.util.logging, have stray log4j library in classpath, clojure.tools.logging detect log4j , therefore not react logging config changes making. the logic detecting underlying logging implementation here: https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/impl.clj specifically: (defn find-factory "returns first non-nil value slf4j-factory, cl-factory, log4j-factory, , jul-factory." [] (or (slf4j-factory) (cl-factory) (log4j-factory) (jul-factory) (throw ; should never happen in 1.5+ (runtimeexception. "

c - Need Help Understanding Segmentation Faults -

i segfaults , causes them, question why pointer causing them? i'm trying write simple linked list adds on nodes containing 5 , segfault @ temp->x = 5;. thought malloc() should have allowed me access memory needs? #include <stdio.h> #include <stdlib.h> struct node{ int x; struct node *next; }; void append(struct node *root){ struct node *temp, *right; temp = (struct node *)malloc(sizeof(struct node)); temp->x = 5; right = (struct node *)root; while(right->next != null){ right = right->next; } right->next = temp; right = temp; } int main(){ struct node *root; root = null; int userinput; printf("pick operation: "); scanf("%d", &userinput); if(userinput == 1){ append(root); } } your mistake here: while(right->next != null){ right = right->next; } you trying check "right->next" "right" null.

css - How do I set up Quixote with Karma? -

quixote looks cool. having bit of trouble getting working karma. tried emulating bjorn's example getting error: error: mismatched anonymous define() module: function () {var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new error("cannot find module '"+o+"'");throw f.code="module_not_found",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ in karma.conf.js, have: files: [ 'www/latest/tests/lib/jasmine-beforeall.js', 'www/latest/tests/lib/sinon-1.7.3.js', 'www/latest/tests/test-main.js', {pattern: 'www/lates

php - Laravel whereIn with a where clause on each array item -

say have user object (which belongstomany groups) , i'm doing wherein array of respected ids so: wherein('user_id', $group->users->modelkeys()) i need to, however, set condition pull data each array item based on condition of group_user pivot table, "created_at" (which timestamp of when user added group). so need this: wherein('user_id', $group->users->modelkeys())->whereraw('visits.created_at > group_user.created_at') that doesn't work though because it's not doing whereraw each array item it's doing once query whole. might need nested wherein not sure if that'll solve either. thoughts? my full query now: $ids = $group->users->modelkeys(); return db::table('visits')->wherein('user_id', function($query) use ($ids) { $query->select('user_id')->from('group_user')->wherein('group_user.user_id', $ids)->whereraw('visits

node.js - Google IO web app setup error -

i have been trying setup google io web app learn more polymer framework uses. google made open source, have been trying download it, using instructions at: https://github.com/googlechrome/ioweb2015 as per instructions, have installed go 1.4.2, gcloud (and run update app command). completed first 3 of setup commands, when running 'gulp setup', following error: [19:54:17] using gulpfile c:\polymer\ioweb2015\gulpfile.js [19:54:17] starting 'setup'... [19:54:17] starting 'bower'... [19:54:17] starting 'godeps'... [19:54:17] starting 'addgithooks'... events.js:85 throw er; // unhandled 'error' event ^ error: spawn ../node_modules/bower/bin/bower enoent @ exports._errnoexception (util.js:746:11) @ process.childprocess._handle.onexit (child_process.js:1053:32) @ child_process.js:1144:20 @ process._tickcallback (node.js:355:11) @ function.module.runmain (module.js:503:11) @ startup (node.js:129:16)

swing - GridBagLayouts in GridLayout -

Image
trying build gui in swing: in mainframe set gridlayout achieve 1 row, 2 columns: setlayout(new gridlayout(1, 2)); in left column figures need gridbaglayout in right column. normal gridlayout doesn't work anymore because want different sizes of each row. left column tried this: gridbagconstraints gbc = new gridbagconstraints(); mappanel = new mappanel(map); gbc.fill = gridbagconstraints.both; gbc.gridx = 0; gbc.gridy = 0; gbc.gridheight = 10; add(mappanel, gbc); controlpanel = new jpanel(); controlpanel.add(new jbutton("test")); controlpanel.add(new jbutton("test 2")); controlpanel.add(new jbutton("test 3")); controlpanel.add(new jbutton("test 4")); gbc.fill = gridbagconstraints.both; gbc.gridx = 0; gbc.gridy = 1; gbc.gridheight = 1; add(controlpanel, gbc); logpanel = new logpanel(); gbc.fill = gridbagconstraints.both; gbc.gridx = 0; gbc.gridy = 2;

Hosted VB.Net Application with SQL Server Database & Filesharing? -

a company work has application written in vb.net sql server database storing information. works fine no complaints, want upload/download files within application, , have files + sql server database on remote server i.e. working on internet. we use vpn that's not best method. suggest use communicate securely between application , remote server both database , filesharing? i thinking of doing on https, need kind of agent on other end receive requests. sorry if noob question, have no experience vb.net myself, use php + c! thanks use vpn. implies deployment , configuration. 'going on https' means rewrite application, current vb app expecting t-sql , smb endpoints discuss with.

javascript - Clickable cell in Angularjs -

i can create clickable cells in pure js, doesn't work when trying simple using angularjs: when clicking on cell, complained dum function doesn't exit. idea why? <!doctype html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="myapp" ng-controller="customersctrl"> <table> <tr ng-repeat="x in names"> <td onclick="dum();">{{ x.name }}</td> <td>{{ x.country }}</td> </tr> </table> </div> <script> var app = angular.module('myapp', []); app.controller('customersctrl', function($scope, $http) { $http.get("http://www.w3schools.com/angular/customers.php") .success(function (response) {$scope.names = response.records;}); $scope.dum = function() { alert("hi you"); } }); </script> </body> &

java - JMockit consecutive expectations -

i came across issue explained below , not find explanation it. code under test looked ok test failing. took me while understand wrong code under test not simple 1 presented below. i sharing guys hope find explanations , conclude whether jmockit bug or desired behavior , consequently watch out when implementing our tests. the comments in code show issue is. thank in advance inputs. package my.tst.pkg; import mockit.expectations; import mockit.mocked; import org.testng.annotations.test; import java.util.collection; import static java.util.arrays.aslist; import static org.testng.assertjunit.assertfalse; public class consecutiveexpectationstest { class keyholder{ private string key; string getkey() { return key; } } class classundertest { private collection<keyholder> keyholders; classundertest(collection<keyholder> keyholders) { this.keyholders = keyholders; } boolean i

Initialize associated object in rails -

i have trouble fill associated objects. i have associated object, try fill local db's tables form data, can fill building , object composed : light_reseller, stage, furniture, location. don't find how fill component "points" of stage , furniture ! here model building.rb class building < activerecord::base has_many :stage, dependent: :destroy has_many :furniture, dependent: :destroy has_one :light_reseller, dependent: :destroy has_one :location, dependent: :destroy accepts_nested_attributes_for :light_reseller, :location, :stage, :furniture, :allow_destroy => true end class lightreseller < activerecord::base belongs_to :building end class location < activerecord::base belongs_to :building end class stage < activerecord::base belongs_to :building has_many :points, dependent: :destroy accepts_nested_attributes_for :points end class furniture < activerecord::base belongs_to :building has_many :points, dependent: :destroy a

javascript - How To Make Two Container Heights Match? -

Image
i'm building twitter-bootstrap site has 2 columns: narrow side column , main article column. on each page, widths of columns fixed , heights depend on how inside them. side column's height must match main column's, main column's height variable. on pages, main column short because there aren't many articles inside while on other pages height longer. when main column's height taller side column's, side column's increases. my question is, best methods/technologies implement this, without using cms? i'm thinking classes, maybe along lines of masonry css...but not quite sure start. smaller-screen version, i'm planning align them 1 column, won't need responsive. i've prepared crude drawing of i'm trying accomplish: if can away it, recommend using flex box . if not, here css solution http://plnkr.co/edit/geevztduy4pdejqvnhmp?p=preview html: <body> <div class="container"> <div class=&quo

performance - Variable storage versus redundant arithmetic -

i'm writing simple loop in lua lÖve game i'm developing. understand i'll waste more time worrying ever spent on cpu clock cycles answer question saves me, want deeper knowledge of how works. the current body of loop so: local low = mid - diff local high = mid + diff love.graphics.line(low, 0, low, wheight) love.graphics.line(high, 0, high, wheight) i want know if more computationally efficient keep or change to: love.graphics.line(mid - diff, 0, mid - diff, wheight) love.graphics.line(mid + diff, 0, mid + diff, wheight) with second body, have calculate low , high differences twice each. first, have store them in memory , access them twice each. which more efficient? the short answer it'll unlikely make difference @ all. if there kind of difference, code next drawing line, example. drawing aliased line optimized bresenham implemented in native code enormously expensive in comparison add , subtract. function call alone dwarf cost.

eclipse - Netbeans/Java scrambling/garbled text rendering -

Image
i running netbeans 8.0.2 (first time netbeans user) , when run gui program, text on buttons or frame disappears or gets garbled when hover on them, if had refreshing problem. i used eclipse before , had same problem set binary/exe files eclipse use second/dedicated graphics card , solved problem. unfortunately, did not work on netbeans, , workaround disable cleartype on windows system, it's pain switch on , off everytime i'm working in netbeans hoping find fixes or better workarounds folks here. so know fix? , have encountered before? here attached screenshot of how looks i found fix: -update graphics card driver, in case, intel hd 4000. solved problem.

html - Div does not fill parent with width:100% -

html <main> <div class="homediv"> <p>test</p> </div> </main css div.homediv { background-color: yellow; width: 100%; position: static; /*the lower z-index, further in background element*/ z-index: -1; } at first glance, should make div horizontally fill screen. did not. few answers on here said width:100% work when width of parent set, set. ensure that, gave html, body, main , div width:100% attribute. did not fix it. after trying around in chrome devtools, found out main fill screen width. contained seemingly pre-set attributes had remove. google told me padding , margin - if not specified - set browser, fix css, had add main { padding:0; margin:0; } i posted here in hopes helps somebody, if reason believe should not on here - maybe because might seem noobish mistake - guess can understand if gets downvoted

How to combine np string array with float array python -

i combine array full of floats array full of strings. there way this? (i having trouble rounding floats, insert changing them scientific notation; unable reproduce small example) a=np.array([[1/3,257/35],[3,4],[5,6]],dtype=float) b=np.array([7,8,9],dtype=float) c=np.insert(a,a.shape[1],b,axis=1) print(np.arround(b,decimals=2)) d=np.array(['name1','name2','name3']) how append d onto end of c in same way appended b onto (insert d last column of c)? i suspect there type issue between having strings , floats in same array. answer questions if there way change float (or maybe scientific number, numbers displayed '5.02512563e-02') string 4 digits (.0502). i believe concatenate not work, because array dimensions (3,3) , (,3). d 1-d array, d.t no different d. also, when plug in "valueerror: input arrays must have same number of dimensions." i don't care accuracy loss due appending, last step before print. try making d nump

javascript - hide div if it doesn't have a certain class -

i need hide class if doesn't have class active . $(document).ready(function() { if (!$('.active').hasclass('active')) { $(this).hide(); }; }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="subheader active"> <p>hello</p> </div> <div class="subheader"> <p>goodbye</p> </div> <div class="subheader"> <p>hello again</p> </div> to hide subheader doesn't have class active , use $('.subheader:not(.active)').hide(); a better solution be, think, use pure css this: .subheader { display: none; } .subheader.active { display: block; } as demonstrated in snippet, uses jquery toggle class, , uses css decide happens visually. $('.subheader').on('click', function(){ $('.subheader').togglecl