Posts

Showing posts from February, 2011

Distributed Java desktop app mySQL database -

i'm in process of learning java , swing , in doing trying create desktop app. part of app have set mysql database app connected to, i'm uncertain how work if distribute app other users, how create database able use on system if don't have mysql installed or database initiated. help appreciated. you should use embedded database. not recommend mysql commercial applications, because expensive. try use hsqldb - fast , not has memory leaks (at least didn't noticed). here implementation example: private static connection conn; /** * gets database connection. * * @return database connection. * @throws sqlexception if database error occurs. */ public static connection getconnection() throws sqlexception { if (conn == null || conn.isclosed()) { conn = drivermanager.getconnection("jdbc:hsqldb:file:data", "somedb", ""); // conn.setautocommit(false); } return conn; } make sure have added hsqldb.ja...

logging - Collect logs from Mesos Cluster -

my team deploying new cluster on amazon ec2 instances. after bit of research, decided go apache mesos cluster manager , spark computation. the first question asked ourself best way collect logs machines, each different framework. till now, developed custom bash/python scripts collect logs predefined locations, zip them , send compressed file s3. kind of rotation activated cron job, runs every hour. i have been searching "best" (or standard) way this. found apache flume , data collector logs, don't understand how integrated in mesos cluster collect logs (and spark). i found this "similar" question, solutions not open source or no more supported. is there better way rotate logs or standard way i'm missing? thank much there no perfect answer this. if using spark , interested in using flume, have either write custom flume -> spark interface 1 doesn't exist far know. however, can this: use flume ingest log data in realtime. ha...

php - guzzle 6 post method is not working -

This summary is not available. Please click here to view the post.

Rust FFI. Casting to void pointer -

i've function has prototype below //opaque struct struct mosquitto; struct mosquitto *mosquitto_new(const char *id, bool clean_session, void *obj); in c code, i'm calling below. struct mosquitto *m = mosquitto_new(buf, true, null); now want call above api in rust code. rust-bindgen generated following bindings pub enum struct_mosquitto { } pub fn mosquitto_new(id: *const ::libc::c_char, clean_session: u8, obj: *mut ::libc::c_void) -> *mut struct_mosquitto; when i'm trying call above api, i'm getting mismatch @ 3rd argument. let s = cstring::new("ravi").unwrap(); let mqtt = mosquitto::mosquitto_new(s.as_ptr(), 1, ptr::null()); how pass null *mut c_void? bonus question: how pass rust struct *mut c_void ? the ptr::null() function returns *const t , want ptr::null_mut() function, since argument function of type *mut ::libc::c_void . for passing actual value, have @ answer working c_void in ffi

java - ArrayList Adapter constructor fails (?) -

edit: need know how create arraylist filled textview i trying create arrayadapter multidimensional (2d) arraylist : final arrayadapter<arrayadapter<arraylist<string>>> adapternames = new arrayadapter<arrayadapter<arraylist<string>>>(this,android.r.layout.simple_list_item_1, android.r.id.text1, arraynamesone); this log error get: error:(28, 76) error: no suitable constructor found arrayadapter(mainactivity,int,int,arraylist>) constructor arrayadapter.arrayadapter(context,int,int,arrayadapter>[]) not applicable (argument mismatch; arraylist> cannot converted arrayadapter>[]) constructor arrayadapter.arrayadapter(context,int,int,list>>) not applicable (argument mismatch; arraylist> cannot converted list>>) if prefer take better @ whole code interested, here go: public class mainactivity extends actionbaractivity { //1st declaration arraylist<arraylist<string>> arraynam...

backbone.js - Returned gameScore Parse.Object object from Parse.Query.get documentation gives undefined gameScore object -

directly parse.com javascript guide : var gamescore = parse.object.extend("gamescore"); var query = new parse.query(gamescore); query.get("xwmyz4yegz", { success: function(gamescore) { // object retrieved successfully. }, error: function(object, error) { // object not retrieved successfully. // error parse.error error code , message. } }); var score = gamescore.get("score"); var playername = gamescore.get("playername"); var cheatmode = gamescore.get("cheatmode"); basically gives uncaught referenceerror: gamescore not defined... here code troubleshoot this: // retrieve class var gamescore = parse.object.extend("gamescore"); //redefine gamescore class based on cloud. var query = new parse.query(gamescore); var my_object; var some_object = query.get("sqv1dzxv5p", { success: function(gamescore) { //gamescore retrieved object. alert('object retrieved, object id: ' + gam...

javascript - Append link to href from JSON -

can explain me how can append link json file a href ? grab images have no idea how links. this code using <body style="background: #e5e5e5"> <div class="container"> <div class="row"> <div class="col-sm-4"> <a href=""> <div class="cover" id="img"></div> </a> </div> </div> </div> <script> var data = { "info": [{ "cover": "highlighted/1.gif", "link":"http://google.com" }, { "cover": "highlighted/1.gif", "link":"http://google.com" }] }; data.info.foreach( function(obj) { ...

java - Calling native method from rest service -

i using restlet framework create rest service uses native library. have tested native library in simple java application. when try load library ( libsomename.so on linux) inside rest service, library not found. looks environment variable ld_library_path not set local rest engine inside restlet framework.i calling main restlet application enviroment variable set, inside serverresource can't load library , java.lang.unsatisfiedlinkerror exception. idea wrong?

javascript - Creating a (ES6) promise without starting to resolve it -

using es6 promises, how create promise without defining logic resolving it? here's basic example (some typescript): var promises = {}; function waitfor(key: string): promise<any> { if (key in promises) { return promises[key]; } var promise = new promise(resolve => { // don't want try resolving here :( }); promises[key] = promise; return promise; } function resolvewith(key: string, value: any): void { promises[key].resolve(value); // not valid :( } it's done other promise libraries. jquery's example: var deferreds = {}; function waitfor(key: string): promise<any> { if (key in promises) { return deferreds[key].promise(); } var def = $.deferred(); deferreds[key] = def; return def.promise(); } function resolvewith(key: string, value: any): void { deferreds[key].resolve(value); } the way can see store resolve function away somewhere within promise's executor seems messy, , i'm not sure it's d...

html - How to vertically align text in a definition list? -

i have definition list. want vertically align text in middle of each dd. dl, dt, dd { margin:0; } dt { background: blue; } dd { min-height: 100px; background: gold; border-bottom: 3px solid white; } <dl> <dt>fruit</dt> <dd>apple</dd> <dd>banana</dd> <dd>pear</dd> </dl> i've tried using table cell method - jsfiddle . has caused of dd's output in 1 line when should on top of each other. how can stacked list, text vertically aligned in each gold coloured section? please note: no flexfox please, , text multi-lined . since can add tags <dd> , here solution, set each <dd> table , each <span> inside table-cell , can set vertical alignment it. it works multiple lines of text, see following demo. dl, dt, dd { margin:0; } dl { width: 100px; } dt { background: crimson; } dd { display: table;...

android - Making listview move to last item position -

am trying make listview move last item when new items added view. textview achieve doing layout layout = myview.getlayout(); if(layout != null){ int scrolldelta = layout.getlinebottom(myview.getlinecount() - 1) - myview.getscrolly() - myview.getheight(); if(scrolldelta > 0) myview.scrollby(0, scrolldelta); } but listview adapter, can't seem figure out method call. adapter setup myview = (listview) findviewbyid(r.id.myview_list); myadapter = new arrayadapter<>(this, r.layout.list, entries); myview.setadapter(myadapter); use smoothscrolltoposition(int position) . scroll listview passed in element on screen. if don't know number of items, use listview.smoothscrolltoposition(adapter.getcount());

How to configure log4js in protractor -

can suggest how configure log4js in protractor config. when use var log4js = require('log4js');var logger = log4js.getlogger(); im able print logs in console. want configure log4js logs file. please see link install log4j npm configure in conf.js - appender section declare in main.js / main entry of program add logging in scripts var log4js = require('log4js'); log4js.loadappender('file'); log4js.addappender(log4js.appenders.file('data.log'), 'logs'); var logger = log4js.getlogger('logs'); logger.info('started testcases '); http://247knowledge.blogspot.in/2014/07/logger-in-protractor-e2e-testing.html

excel - Finishing Code - VBA Function to Skip Blank Cells and Begin A Procedure Whenever It Comes Across Text -

i have spreadsheet has broad groups in column , specific data points in column b (with more data throughout specific rows). looks this: b c d e f group name weight gross net contribution equity 25% 10% 8% .25 ibm 5% 15% 12% aapl 7% 23% 18% fixed income 25% 5% 4% .17 10 yr bond 10% 7% 5% emerging mrkts i want macro scroll through column until finds "group" (e.g. equity) , have spit out name other data each specific holding within every group. i have started writing macro, , have procedure (that works) , function. can't function work. can take , tell me see wrong? thanks here code: sub demo1() dim ptr integer ptr = 12 activesheet.cells(1, ptr).select dim wb...

c# - How to get encrypted records from table in sql server by symmetryk key using sqlserver.management.smo -

i using symmetrickey password field. , want records table decrypted passwords. , using microsoft.sqlserver.management.smo. var tbls = new table(); tbls = db.tables[tblname]; scriptingoptions options = new scriptingoptions(); options.scriptdata = true; options.scriptdrops = false; options.enforcescriptingoptions = true; options.scriptschema = false; options.includeheaders = true; options.appendtofile = true; options.indexes = true; options.withdependencies = true; serverversion sv = new serverversion(2008, 2005); options.settargetserverversion(sv); var script = tbls.enumscript(options); string queryes =""; foreach (var line in script) { if (line.contains("values")) { queryes += line; } } how decrypted record's data? if field had been encrypted using symmetric key, should open symmetric key using below statement. open sym...

javascript - How to move td content to another td at the same row across borders -

i'm trying code animation push td content (which div inside td) td (to end of row) in same tr across tds borders without changing width of td. is there way this? css / jquery? if animation want (the first td content seems "slide" td animation), came (hopefully got question right): $div = $('td.first > div'); $div .css({position:'relative'}) .animate({ left:$('td.second').offset().left - $('td.first').offset().left }, { complete:function(){ $div.appendto('td.second'); $div.css({position:'', left:''}); }, duration:1000 }); so do? set position of content "relative". way, can move relative original position. animate goes should if inside td.second. calculate distance between cells jquery's offset() function at end of animation, copy div inside second . before visually, not in other td. we remove instantly po...

lisp - Parsing s-expressions in Go -

here's link lis.py if you're unfamiliar: http://norvig.com/lispy.html i'm trying implement tiny lisp interpreter in go. i've been inspired peter norvig's lis.py lisp implementation in python. my problem can't think of single efficient way parse s-expressions. had thought of counter increment 1 when see's "(" , decrement when sees ")". way when counter 0 know you've got complete expression. but problem means have loop every single expression make interpreter incredibly slow large program. any alternative ideas great because can't think of better way. there s-expression parser implemented in go @ rosetta code: s-expression parser in go it might give idea of how attack problem.

apache - Accessing Virtual Host Name (xampp) on network returns 404 error -

i want access virtual host on network other devices. set apache's virtual host using xampp this: namevirtualhost *:80 <virtualhost *:80> documentroot "d:/xampp/htdocs/site_mobile" servername site.mobile <directory "d:/xampp/htdocs/site_mobile"> options indexes followsymlinks includes execcgi allowoverride order allow,deny allow </directory> </virtualhost> and how access servername in network: 192.168.1.102/site.mobile/ unfortunately, error considering object not found! requested url not found on server... accessing path , not servername works fine on own device , on network: localhost/site_mobile/ 192.168.1.102/site_mobile/ i have mention accessing site.mobile on own device works fine

c - Clarification need on calling a function in the kernel -

i having issue calling function (ext3_get_inode_loc) exec.c exists in several other files. i should mention new , entirely self-taught i'm sure have major knowledge gaps. appreciate pointers or advice on i'm missing, and/or answers. below result of recursive grep linux-3.10.0.123.20.1.el7 directory - "grep ext3_get_inode_loc -r *" fs/ext3/inode.c: fs/ext3/inode.c:static int __ext3_get_inode_loc(struct inode *inode, fs/ext3/inode.c:ext3_error (inode->i_sb, ext3_get_inode_loc", fs/ext3/inode.c:ext3_error(inode->i_sb, ext3_get_inode_loc", fs/ext3/inode.c:int ext3_get_inode_loc(struct inode *inode, struct ext3_iloc *iloc) fs/ext3/inode.c:return __ext3_get_inode_loc(inode, iloc, fs/ext3/inode.c:ret = __ext3_get_inode_loc(inode, &iloc, 0); fs/ext3/inode.c:err = ext3_get_inode_loc(inode, iloc); fs/ext3/inode.c:err = ext3_get_inode_loc(inode, &iloc); fs/ext3/ext3.h:extern int ext3_get_inode_loc(struct inode *, struct ext3_...

sql - Table name after parenthesis notation -

i going through old-ish sql code else had written couldn't quite understand. have simplified structure here, if can walk me through going on, appreciated! may ignore specific column operations examples. select table.*, column1 - column2 'col1 - col2', ... columnn 'coln' (select ... ) table what don't understand final line. assuming definition of "table" in from (select ...) part, , ) table part indicates name of defined table. thanks in advance! an inner select needs alias name select alias_name.* ( select * some_table ... ) alias_name

asp.net - Updating Microsoft aspnet mvc 5 failed -

i'm trying install umbraco in fresh .net mvc project in vs express web 2013. if choose .net framework 4.5 or 4.5.1, try install umbraco via nuget, following error: updating microsoft.aspnet.mvc 5.2.3 microsoft.aspnet.mvc 4.0.20710.0 failed. unable find version of umbracocms.core conpatible microsoft.aspnet.mvc 4.0.20710.0. i've tried changing target framework 4.5 4.5.1 , tried unistalling microsoft.aspnet.mvc via package manager , reinstalling no joy. can tell me how resolve this? i think issue version of umbraco trying install. may point towards following blog post, may of help: https://our.umbraco.org/forum/ourumb-dev-forum/bugs/64654-mvc-5-umbraco-nuget-install alternatively, have not tried manual installation of umbraco? prefer option (i lot more control :p). see following guide manually installing umbraco: https://our.umbraco.org/documentation/installation/install-umbraco-manually during manual installation create blank visual studio solut...

How to Adjust the width of navigation drawer in android studio -

i downloaded navigation template, , want adjust width of navigation. i've tried different methods think nothing suited. how can solve problem? can't adjust width of navigation drawer. this code navigationaldrawerfragment.java package com.example.user.navigationkamo; import android.app.activity; import android.app.fragment; import android.content.sharedpreferences; import android.content.res.configuration; import android.content.res.resources; import android.graphics.bitmap; import android.graphics.bitmapshader; import android.graphics.canvas; import android.graphics.colorfilter; import android.graphics.paint; import android.graphics.pixelformat; import android.graphics.rect; import android.graphics.rectf; import android.graphics.shader; import android.graphics.drawable.drawable; import android.os.bundle; import android.preference.preferencemanager; import android.support.v7.app.actionbardrawertoggle; import android.support.v4.widget.drawerlayout; im...

java - Skip Certain Test Iterations Using TestNG DataProvider -

i'm using testng dataprovider read datapool.xls file contains 1017 test cases , 214 columns in class called readdata. i pass 214 string parameters @test annotation in separate class called enterdata. @test(dataprovider="autodata", dataproviderclass = readautodata.class) public void autoentry(string quote, string garage_zip, etc...) { i have created loop within @test perform actions ceratin iterations (say 1-10), work entering 10 test cases in total. problem @ end of run still shows "total tests run: 1017" instead of 10 did because of loop. // start loop entering auto policies (int = start; <= end; a++) { if (quote == a) { system.out.println("tier = " + tier); } } i realize why shows total number of tests run being entire datapool because technically passed in , ran through in datapool, can't figure out how have show number of tests ran. basically, i'm looking way put @test an...

Android app doesn't connect to a Bluetooth Low Energy device -

i'm starting android development, , i'm trying make simple bluetooth low energy connection between android phone , microcontroller (psoc4ble) write value in 1 of microcontroller characteristics. as know microcontroller mac, , service , characteristic uuid, want android app opens, makes connection microcontroller without user interaction, , when press button, app writes value characteristic. the problem app crash when run it, , in cases when tweaking code work, doesn't connect microcontroller, i'm doing wrong? here code: public class mainactivity extends activity { // bluetooth variables private bluetoothadapter mbluetoothadapter; private bluetoothgatt mbluetoothgatt; private bluetoothgattcharacteristic mmycharacteristic; private static final uuid car_service = uuid.fromstring("00000000-0000-1000-1000-100000000000"); private static final uuid car_characteristic = uuid.fromstring("00000000-0000-2000-2000-200000000000"); private final bluet...

smtp - Getting Discourse Rails forum to send emails -

anybody able try , install discourse normal rails app (no docker) , see why won't send emails ones localhost smtp server? sending emails other rails apps work fine. https://meta.discourse.org/t/emails-with-local-smtp/23645/16

android - Nexus 6 Kernel Build Error -

working on building nexus 6 kernel (source: https://android.googlesource.com/kernel/msm.git ) under android-msm-shamu-3.10-lollipop-mr1 branch. using arm-linux-androideabi-4.9 toolchain. i'm receiving following error: cc drivers/net/wireless/bcmdhd/dhd_linux.o drivers/net/wireless/bcmdhd/dhd_linux.c: in function 'dhd_watchdog_thread': drivers/net/wireless/bcmdhd/dhd_linux.c:2978:47: error: 'max_rt_prio' undeclared (first use in function) param.sched_priority = (dhd_watchdog_prio < max_rt_prio)? ^ drivers/net/wireless/bcmdhd/dhd_linux.c:2978:47: note: each undeclared identifier reported once each function appears in drivers/net/wireless/bcmdhd/dhd_linux.c: in function 'dhd_dpc_thread': drivers/net/wireless/bcmdhd/dhd_linux.c:3095:42: error: 'max_rt_prio' undeclared (first use in function) param.sched_priority = (dhd_dpc_prio < max_rt_prio)?dhd_dpc_prio:(max_rt_prio-1); ...

powershell - Script to Create Home Drives -

i trying create small script creates folder on our file server, creates share, sets acls on share, maps share u: drive via home folder in active directory. the server running 2012 r2, active directory powershell module installed. this have far: $session = new-pssession -computername fileserver enter-pssession $session $user = read-host 'input username' import-module activedirectory new-item -name $user -itemtype directory -path "\\fileserver\g$" | out-null new-smbshare -name "$user$" -path "g:\$user" -continuouslyavailable $true -fullaccess "domain\domain admins" -changeaccess "domain\$user" set-aduser $user -homedirectory "\\fileserver\$user$" -homedrive u: i read using enter-pssession command doesn't allow remote commands pass through, , instead needed use invoke-command -scriptbatch . it telling me share created, though not. ideas? you don't need remote session of commands, provided r...

phalcon - PhalconPHP - set the default foreign key action -

is there way define default foreign key action used in every model don't have keep defining inside every model below? $this->hasone('id', '\namespace', 'id', [ 'foreignkey' => [ 'action' => \phalcon\mvc\model\relation::action_cascade ] ]); override hasone(). class yourbasemodel extends \phalcon\mvc\model { protected function hasone($local, $remote_model, $remote_field, $options = null) { $options['foreignkey'] = [ 'action' => \phalcon\mvc\model\relation::action_cascade ]; parent::hasone($local, $remote_model, $remote_field, $options); } } class yourmodel extends yourbasemodel { public function initialize() { $this->hasone('id', '\namespace', 'id'); } }

python - AttributeError: 'module' object has no attribute 'Tk' -

this question has answer here: importing installed package script raises “attributeerror: module has no attribute” or “importerror: cannot import name” 1 answer i started learn gui developement using tkinter python library faced problem pycharm ide community edition 4.5.2 my problem is: when write code below in idle, works fine!!! when write using the pycharm ide, error message appears: attributeerror: 'module' object has no attribute 'tk' please me, need , thank lot my code: import tkinter app = tkinter.tk() app.title("hello world") app.minsize(300, 300) hellolabel = tkinter.label(app, text="hello gui") hellolabel.pack() app.mainloop() note: i'm using python 2.7.6, os: ubuntu 14.04 lts the problem named file tkinter.py . when import, python sees file , tries import instead of tkinter library. rename file,...

ios - How do I change the direction of an object with swipe? -

i made path object , keeps repeating time. need object stop action , move @ direction swipe (up, down, right, left). after stopping , moving in swipe direction, need object resume path when touching it. this code: import spritekit class gamescene: skscene { // functions defines happen when doing swipes // in different directions. // player.removeactionforkey("trailrunning") stops // skaction.repeatactionforever path created // object. trailrunning keyword created // manipulate whether action should continue or not. func swipedright(sender:uiswipegesturerecognizer){ println("swiped right") player.removeactionforkey("trailrunning") } func swipedleft(sender:uiswipegesturerecognizer){ println("swiped left") player.removeactionforkey("trailrunning") } func swipedup(sender:uiswipegesturerecognizer){ println("swiped up") ...

How do I change the GDM login background in Fedora 22? -

has figured out how change gdm login background in fedora 22 yet? in fedora 21 (and older versions), did by: /usr/share/gnome-shell/theme make copy of "noise-texture.png" [gdm background] copy "selected-background-image.png" /usr/share/gnome-shell/theme delete "noise-texture.png" rename "selected-background-image.png" "noise-texture.png" when 'sudo find / |grep noise-texture', can find /usr/share/gnome-control-center/pixmaps/noise-texture-light.png, , when replace that, , log out, still uses grey background, not custom image. i've read login screen uses wayland now, instead of x, have not been able find more details other that, or if it's accurate. has figured out how fedora 22 yet? starting gnome shell 3.16 themes stored binary in .gresource file. you can tell url of noise-texture.png gdm's default background @ line 1607. $ vi /usr/share/gnome-shell/theme/gnome-classic.css #lockdialoggroup { ...

WebScanner Java Applet App Not working in chrome , NPAPI deprecated any solutions? -

java applet not working in chrome, np-api been depreciated there alternative solution, load applet in browser , scanner invoked scan file. advance thanks, appreciated. scanner applet application what's chrome version?? copy , paste "chrome://flags/#enable-npapi" chrome browser , hit enter click enable link. quit chrome browser, re-open it.

java - Android if statement onClick doing nothing -

i have android test app (because new android development) has couple of onclick secrets in changes screen, in particular 2 won't work. have find , click first 1 gain access other. before added system, both of secrets worked , changes made no problems. my goal prevent people triggering second method before triggering first one. when first 1 triggered, app allows second method triggered. the relevant java code: private boolean colorchangable = false; public void changesecret(view v) { button btn = (button) findviewbyid(r.id.button); btn.settext("your mind has been blown!"); btn.settextcolor(color.blue); colorchangable = true; } public void changecolor(view v) { if (colorchangable){ textview tw = (textview) findviewbyid(r.id.textview); tw.settextcolor(color.red); tw.settext("again, mind has been blown."); } } and relevant xml code: <textview android:id="@+id/textview" android:oncl...

apache2.4 - How do I test httpd.conf on my Windows? -

Image
different websites give me different answers question, think area linux. http://httpd.apache.org/docs/2.2/programs/apachectl.html gives me useful tool, cannot used on command prompt (picture below). thank answers. on windows, test configuration with: httpd.exe -t

python 2.7 - How can I save .jpg file from my .exe (PyQt4 Python2.7 py2exe)? -

i'm having problem program, i'm working pyqt4 , python2.7 , used py2exe create .exe the problem it's screenshot programs it's supose create not being save in directory or anyother way. this it's setup.py from distutils.core import setup import py2exe setup(windows=['capture.py'], options={"py2exe": {"includes": ["sip", "pyqt4.qtgui", "pyqt4.qtcore"]}}) and it's capture.py import os import datetime import time import sys pyqt4 import qtcore pyqt4.qtgui import * class capturescreenshoot (qtcore.qthread): def __init__(self): qtcore.qthread.__init__(self, parent=app) self.count_time = 0 self.complete_path = "" self.signal = qtcore.signal("signal") self.signal_cap = qtcore.signal("signal") def run(self): while true: = datetime.datetime.now() date = str(now.strftime("%y_%m_%d_%h_...

c - void pointer as an argument in function -

this question has answer here: c actions , variables 1 answer i have function f1 expects void pointer. caller want have generic logic of passing void pointer a modifies pointer internally. sample code pasted below : #include "stdio.h" #include "malloc.h" void f1(void* a) { printf("f(a) address = %p \n",a); = (void*)(int*)malloc(sizeof(int)); printf("a address = %p \n",a); *(int*)a = 3; printf("data = %d\n",*(int*)a); } void f(void) { void* a1=null; printf("a1 address = %p \n",a1); f1(a1); printf("a1 address = %p \n",a1); printf("data.a1 = %d\n",*(int*)a1); } int main() { f(); } but causes segmentation fault. there way make work without changing prototype of function f1 ? c uses pass-by-value function argument passing. if ...

angularjs - passing argument to filter not in html template -

we can pass arguments filter in template such as: <li ng-repeat="friend in friends | somefilter:var1"> for angular.module('myapp.filters', []) .filter('somefilter', function () { return function (input, var1) { return var1; } }); but how pass variable when filter assigned in controller, when dont have access internal template of component using. example ui-grid column has cellfilter property. for example want pass data $resource filter if have in template : <li ng-repeat="friend in friends | somefilter:var1"> you'll have in controller : $filter('somefilter')(friend, var1); // $filter('filtername')(filteredvalue, args)

How to pre-process Riak data entry before sending it to a client -

i have riak installation many nodes. stores entries, relatively big blobs on value side. in cases, clients need subset of data, there no need transfer them on network. is there elegant solution pre-process data on server side, before sending them client. the idea have install small "agent" on every node, interact client in it's own protocol , acts proxy, reduce data based on query. but such solution work only, if can know (based on key) on node particular entry stored. there way it? you may able mapreduce, if specify single bucket/key input. map function run local data stored, , send result reduce function on whichever node received request client. since providing specific key, there shouldn't coverage folding causes heavy load docs warn about. this mean requests using r=1, if there ever outage false not found results.

ruby on rails - How to decorate an object with another name in draper? -

this question i have event model , user model. an event has 1 creator of class user. used line in event model associate it: belongs_to :creator, :class_name => "user" so can access creator through line: event.creator my user decorator has line: def full_name "#{first_name} #{last_name}" end so can decorate user object , access user.full_name but need decorate event, , use "decorates_association" decorate associated user. need call line: event.creator.full_name i have tried this: decorates_association :creator, {with: "userdecorator"} decorates_association :creator, {with: "user"} but throws , "undefined method `full_name'" error. how can prevent error? thank you! in eventdecorator class can like: class eventdecorator < draper::decorator decorates_association :creator, with: userdecorator # no quotes delegate :full_name, to: :creator, allow_nil: true, prefix: true e...

Date comparison in mongodb -

i want retrieve documents after particular date. database has date - dateadded:"2014-12-17 10:03:46.000z" i wrote following query- db.collection.find({dateadded:{"$lte":new date("2015-06-17 10:03:46.000z")}}) but results doesn't fetches record though there records dates upto 2015-06-24 . you can use isodate compare dates: "$lte" : isodate("2015-06-17t10:03:46z") isodate works because format date in. new date() wraps date in isodate helper, not able convert in query. check out link more information: http://docs.mongodb.org/manual/core/shell-types/

php - Laravel 5 POST routes to index instead of store -

i working on laravel 5 restful api seems not routing post requests correctly. this routes.php: route::group(array('prefix' => 'api/v1'), function() { route::resource('messages', 'incomingmessages'); }); and controller: class incomingmessages extends controller { public function index() { return "this index"; } public function store() { return "this store"; } public function update() { return "this update"; } } and happens: request get mydomain.com/api/v1/messages/ --> index request put mydomain.com/api/v1/messages/1 --> update request post mydomain.com/api/v1/messages/ --> this index this php artisan route:list returns: get|head : api/v1/messages : api.v1.messages.index : app\http\controllers\incomingmessages@index get|head : api/v1/messages/create : api.v1.messages.create : app\http\controllers\incomingmessages@create post ...

How to use DryIoC in ASP.Net WebForms Application? -

i have basic sample how use dryioc webforms application basepage (base pages) , irepository , repository connection database (via nhibernate) at moment made using application property containing nhibernate session. make dryioc in order use repository database operation everywhere . best way that?

Python - pickle.dump() without a file -

this question has answer here: pickle.dump variable 1 answer this code have: with open(testify, 'w') fh: pickle.dump((f,t), fh) i need data in code without dumping file because needs send remote location. i have tried: data = pickle.dumps(f, t) but did not work. how can done? you can use pickle.dumps((f, t)) dump string instead

sprite kit - How to choose which scene shows up first spritekit/swift? -

where declared scene show first on load of app? first file made game shows first, if i'm wanting switch main menu pops first, how , do that? thanks in view controller, first scene set. default, it's automatically set gamescene can change altering code in gamescene. should change line in unarchive file: let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! gamescene let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! scenename , line in didmovetoview if let scene = gamescene.unarchivefromfile("gamescene") as? gamescene { if let scene = gamescene.unarchivefromfile("gamescene") as? scenename { cause game load scenename, or whatever scene called initial scene.

java - jLabel output won't output text within same instance of GUI -

i have jlabel supposed output computer name based on active directory search. computer name gets assigned variable "cn" no problem, won't show on jlabel unless run gui again. how can jlabel text appear in real time within same instance of gui? cn variable appears towards bottom of code posted. stringbuffer sbuffer = new stringbuffer(); bufferedreader in = new bufferedreader(new inputstreamreader(p .getinputstream())); try { while ((line = in.readline()) != null) { system.out.println(line); // textarea.append(line); string dn = "cn=fdcd111304,ou=workstations,ou=sim,ou=accounts,dc=fl,dc=net"; ldapname ldapname = new ldapname(dn); string commonname = (string) ldapname.getrdn( ldapname.size() - 1).getvalue(); } computerquery....

multithreading - Threads handling in C++ 11 -

i have base class, manages threaded functions , derived, can set it's functions run concurrently of base class. during test in emulating fast starts/stops of function, programs crashes. seems, problem in mutexes can wrong. problem? class threadedbase { public: threadedbase(){} virtual ~threadedbase() { (int = 0; < m_threadedtasks.size(); ++i) { *m_threadedtasks[i]->run = false; m_threadedtasks[i]->thread->join(); } while (m_threadedtasks.size()) { m_threadedtasks.erase(m_threadedtasks.begin()); } } void addtask(std::function<void()> f) { static int = 0; m_threadedtasks.insert({ i++, new threadedtask(f)}); } void startn(int n) { std::lock_guard<std::mutex> lock(m_threadedtasks[n]->mtx); std::cout << "startn\n"; if (*m_threadedtasks[n]->run == true) return; *m_threadedtasks[n]->run = true;...