Posts

Showing posts from March, 2014

excel - Get adress of cell in function .Find -

i have code below, adress of cell in value if value found. because if macro find existing value in somerange, change value of cell. in advance idea. range(somerange).select set = selection.find(what:=something, after:=activecell, lookin:=xlvalues, _ lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false) you need guard against not finding anything. dim range range(somerange).select on error resume next set = selection.find(what:=something, after:=activecell, lookin:=xlvalues, _ lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false) if not nothing debug.print a.address(0, 0) = "changed value" end if

stored procedures - Trigger is not fired multiple time in sql server -

i have trigger on table, trigger on update of row. i have 10 rows in table. i updating rows condition within stored procedure. i have seen trigger got triggered once. but need run trigger each , every update of each row. can please me on this. in trigger, have table inserted same schema triggered table in you'll find 10 rows inserted/updated. can make batch treatment. other way, can iterate on temp table single treatment.

mysql - Laravel 5: run migrations on server environment, not local -

i have simple set of database migrations created within laravel 5 application, , run nicely on local development environment. now time run run migration on new production server environment. have configured db connection , deployed app, , app sees database, there no tables - migrations need run. the following command, believe, should run migrations using "production" environment, set remote db connection details: php artisan --env=production migrate the migration works, runs on local environment! here environment file production environment(using amazon elastic beanstalk service) : .elasticbeanstalk.env app_env=production app_debug=true app_url=<myappname.elasticbeanstalk.com> db_host=<myapp.amazonserveraddress.amazonaws.com:3306> db_database=<mydbname> db_username=<mydbusername> db_password=<mydbpassword> so either environment file not configured correctly, or artisan not able switch environment. change .env file (local d

javascript - Show div when radio button is activated -

this question has answer here: show div when radio button selected 4 answers i'm trying same already asked question . problem: have 40 divs shown , don't want 10 lines of code each one... has tips give on topic? thx guys. :) try . need replace id class. after comment .here 2 demo demo1 , demo2 think want . showing next div selection . if want show save div.then change var value=$(this).attr('value'); var value=$(this).attr('value')-1; $(document).ready(function() { $('input[type="radio"]').click(function() { $('.show-me').hide(); var value=$(this).attr('value'); $( ".show-me:eq("+value+")" ).show(); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <form id=&#

spring - java.lang.ClassNotFoundException: org.springframework.cglib.core.CodeGenerationException -

i trying use maven hibernate , spring , had problem not being able work out hibernate3 , spring 4.2.0 because of tx annotations. after downgrade @ 3.0.2, seems ok except when i'm running app this: caused by: java.lang.classnotfoundexception:org.springframework.cglib.core.codegenerationexception @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1702) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1547) ... 42 more should use version of cglib ? here dependencies: <dependencies> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>${org.springframework.version}</version> </dependency> <dependency> <groupid>org.springframewor

c# - MVC Authentication - Easiest Way -

i have looked @ asp.net identity , looks complex , difficult follow. want know easiest way authorize user on login [authorize] data annotation allow them through. follow these steps: install following nuget packages microsoft.owin microsoft.owin.host.systemweb microsoft.owin.security microsoft.owin.security.cookies inside app_start folder, add authconfig this: public static class authconfig { public const string defaultauthtype = "defaultappcookie"; //example public const string loginpath = "system/signin"; //example public static void configureauth(iappbuilder app) { app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = defaultauthtype, loginpath = new pathstring(loginpath) }); } } in root path of project, add startup.cs this [assembly: owinstartup(typeof(yourporject.startup))] namespace yourporject { public class startup {

python - Efficient lookup table for collection of numpy arrays -

i know what's efficient way create lookup table floats (and collection of floats) in python. since both sets , dicts need keys hashable, guess can't use sort of closeness check proximity inserted, can i? have seen this answer , it's not quite i'm looking don't want give burden of creating right key user , need extend collections of floats. example, given following code: >>> import numpy np >>> = {np.array([0.01, 0.005]): 1} traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: unhashable type: 'numpy.ndarray' >>> = {tuple(np.array([0.01, 0.005])): 1} >>> tuple(np.array([0.0100000000000001,0.0050002])) in false i last statement return true . coming c++ world, create std::map , provide compare function can comparison user defined tolerance check if values have been added data structure. of course question extends naturally lookup tables of arrays (for example num

android postDelayed method doesn't work -

i'm trying splash screen app. used postdelayed method. code: public class splashscreenactivity extends activity { private static final int splash_duration_ms = 1500; private static final string tag = splashscreenactivity.class.getsimplename(); private handler mhandler = new handler(); public static final int sdkversion = build.version.sdk_int; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.splash_screen); random r = new random(); int imagenumber = r.nextint(2 - 0) + 0; imageview splashscreenbackground = (imageview)findviewbyid(r.id.splash_screen_image); switch (imagenumber){ case 0: if(sdkversion > 20) splashscreenbackground.setbackground(getdrawable(r.drawable.splash_screen_back)); else splashscreenbackground.setbackgrounddrawable(getre

arrays - Windows Batch Static List Rename-Move -

i relatively new batch scripts , trying create windows batch file renames static array values in 1 group against static array values in - moving folder. this: setlocal enabledelayedexpansion set currentdate=%date:~-4,4%%date:~-10,2%%date:~-7,2% set frompath=c:\ set topath=c:\temp\ set filelist=(temp1.txt temp2.txt temp3.txt) set tolist=(name1 name2 name3) i'm looking @ style of array looks easier user i'm giving to add list. alone (without tolist) filelist works fine: for %%i in %filelist% ( if exist %frompath%%%i ren %frompath%%%i %%~ni_%currentdate%%%~xi & move %frompath%%%~ni_%currentdate%%%~xi %topath% ) but not renaming tolist in same order list in tolist . i tried code counter index (tried other variants of below aswell) no luck: for /l %%i in (0,1,10) ( if exist %frompath%%filelist[%%i]% ren %frompath%%%i %%~ni_%currentdate%%%~xi & move %frompath%%%~ni_%currentdate%%%~xi %topath% ) is possible? if not, i

html - Issue loading web fonts in I.E 11 - some browsers, not all browsers -

Image
i've looked around , found many questions , answers address fonts not loading in i.e what haven't found, question/answer fonts not loading in some instances of i.e my @font-face 's this: @font-face { font-family: 'open_sans_condensedbold'; src: url('/content/fonts/opensans-condbold-webfont.eot'); src: url('/content/fonts/opensans-condbold-webfont.eot?#iefix') format('embedded-opentype'), url('/content/fonts/opensans-condbold-webfont.woff') format('woff'), url('/content/fonts/opensans-condbold-webfont.ttf') format('truetype'), url('/content/fonts/opensans-condbold-webfont.svg#open_sans_condensedbold') format('svg'); font-weight: normal; font-style: normal; } there many of these. at times, clients browsers not loading fonts. my machine; they're fine. guy next me, don't load. clients call in same issues. some things we've

android - RxJava - Is an operator a task or the whole chain a task? -

i'm writing code insert record sqlite database (if table empty). before inserts data, makes web service call lovetodo.basecampclient().fetchme() return data. i'm using sqlbrite database access , retrofit web access. here code: observable.just(lovetodo.britedatabase()) .map(new func1<britedatabase, integer>() { @override public integer call(britedatabase britedatabase) { cursor cursor = britedatabase.query("select * accounts"); try { return cursor.getcount(); } { cursor.close(); } } }) .flatmap(new func1<integer, observable<person>>() { @override public observable<person> call(integer count) { if ( count == 0 ) { return lovetodo.basecampclient().fetchme(); } return null;

c# - Acknowledging concox GT06N gps device after receiving login packet -

i receiving login packet concox gt06n gps device.also have read it.but when trying send response packet(acknowledgement) device seems response packet not getting delivered. because after sending acknowledgement not receiving location packet device. below code using:- tcpclient cli = new tcpclient(); ipendpoint deviceipe = new ipendpoint(ipaddress.parse(system.configuration.configurationmanager.appsettings["cid"].tostring()) , convert.toint32(system.configuration.configurationmanager.appsettings["cport"])); cli.connect(deviceipe); logsys.enqueue("tcp client created"); using (networkstream clientstream = cli.getstream()) { byte[] data = (byte[])sdata1.dequeue(); string cip = suser1.dequeue().tostring(); string[] acip = new string[2]; if (cip != "") { acip = cip.split(':'); } technocompacket packet = new technocompacket(data); string rdata = packet.stringtobytearray(data); logsys.enqueue

ruby on rails - Why are Paperclip images coming up as missing.png? -

i know there couple of questions out there on stackoverflow, either went right on head or didn't seem relevant own question. i working on jumpstartlab's blogger 2 project tutorial , have reached i4 after completing beforehand. tutorial told install paperclip gem, add: class addpaperclipfieldstoarticle < activerecord::migration def change add_column :articles, :image_file_name, :string add_column :articles, :image_content_type, :string add_column :articles, :image_file_size, :integer add_column :articles, :image_updated_at, :datetime end end to new migration database add paperclip fields article (and rake this). i added code: has_attached_file :image validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png"] to apps/models/article.rb, added :image app/helpers/articles_helper.rb here _form.html.erb <%= form_for(@article, html: {multipart: true}) |f| %> <ul

java - Android: ActivityCompat.requestPermissions requires activity and not context :/ -

i'm calling activitycompat.requestpermissions in order permissions under android m, however, requires activity in argument. fine, except want call singleton, , singleton can used activity in app. activitycompat.requestpermissions(context, permissions_location, request_location); i want avoid holding reference activity within singleton that's surefire recipe memory leak, , i'd prefer singleton not hold activity @ because requires useless code in activities call (every single 1 of them going have include argument in getinstance() in order singleton hold activity - singleton needs activity somewhere ). now, can technically activity , set null straight after request permission, still leaves me tons of useless activity arguments in every single activity make call singleton. there more elegant solution problem i'm not seeing? the documentation on requestpermissions says activity parameter target activity want show pop if haven't included permission in m

c# - Refresh the user interface while a separated STA thread is adding many controls -

i add pushpins on map means of thread. thread sta , use dispatcher. the issue map not refreshed pushpins. no pushpin appears on map. i've class named "serialinterf" reads serial port. each reading invokes event 'datareceivedhandler': private void datareceivedhandler(object sender, serialdatareceivedeventargs e) { serialport port = (serialport)sender; string data = port.readexisting(); latlong message = getdata(data); serialinterfeventargs arg = new serialinterfeventargs(message); this.messagereceived(this, arg); } the event "datareceivedhandler" invokes event of same class called "messagereceived". class serialinterf instancied mainwindow class. in last one, event "messagereceived" defined: transm.messagereceived += new trans.serialinterfeventhandler(writetrace); the method writetrace launches thread (sta): private void writetrace(object sender, transmissioneventargs

linux - Docker mount a volume as root -

the problem description i have docker image, being executed volume mounting options large number of times. built in way default user not have root permissions. need make sure when mount volume being mounted root , not current working user because of security concerns. (the current working non-root user must not allowed delete files inside mounted volume.) example from host machine: docker run -it -v /path/to/mount:/container/mounting/path image-name inside container current-user@docker-container : all of files inside /container/mounting/path must have owner permissions root root , not current-user current-user . just make sure permissions on /path/to/mount set root:root , should good. like example, i'm mounting /sbin has root:root permissions on local machine. current-user@hostmachine:/sbin$ docker run -it -v /sbin:/home/sbin centos:6.6 /bin/bash [root@e9e21b0f36c7 /]# [root@e9e21b0f36c7 ~]# adduser current-user [root@e9e21b0f36c7 ~]# su current

javascript - multiple waves in wavesurfer with for loop -

i trying generate multiple wavesurfer audio waves using loop, code: $.ajax({ url: "./php/getmusic.php", datatype: "json", async: false, success: function(data){ var wavesurfer = [] var array = data; console.log(array) var = 0; while( < array.length){ document.addeventlistener('domcontentloaded', function () { document.getelementbyid("trackholder").innerhtml += '<div id="wave'+i+'" class="waveform"><div class="tracklogo">sample logo</div><div class="title"><p><font color="lightblue" size="5em">sample artist -<font size="4em">sample title</p></div></font></font></div></div>' wavesurfer[i] = object.create(wavesurfer);

Apache Storm Multilang: Purpose of ReadTasksIds -

i have been attempting use storm's multilang protocol project. i've read through protocol , part makes sense. looking on python multilang source code i've noticed in emit method after emitting tuple, calls readtaskids() method. def emit(*args, **kwargs): __emit(*args, **kwargs) return readtaskids() on concepts page , mentions using directgrouping() able send output specific task. , lines 124-129 of jsonserializer (which handles multilang communication) it's checking see if "need_task_ids" field present , not send taskids if it's defined false in json. so i'm wondering if can explain/confirm me why storm needs tasksids? there's nothing in multilang protocol mentions it. use case of wanting send tuples specific task using directgrouping()? or there benefit having it? adding "need_task_ids" field in json pretty easy stop happening (if understand correctly), don't know if there downsides in doing that? i not f

Pass variable from child view to parent view in Swift -

i'm trying pass variable child view (inputpopup.swift) parent view using setter , getter functions. here code in child view: var char: string! var buttonpressed = string() @ibaction func addbuttonpressed(sender: anyobject) { buttonpressed = "addbutton" setchar("+") getchar() self.removeanimate() } @ibaction func minusbuttonpressed(sender: anyobject) { buttonpressed = "minusbutton" setchar("-") self.removeanimate() } @ibaction func dividebuttonpressed(sender: anyobject) { buttonpressed = "dividebutton" setchar("/") self.removeanimate() } @ibaction func multiplybuttonpressed(sender: anyobject) { buttonpressed = "multiplybutton" setchar("*") self.removeanimate() } //setter method func setchar(var thischar: string){ char = thischar } //getter method func getchar()-> string{ if (buttonpressed == "addbutton"){ char =

Xamarin iOS not finding path for sqlite database -

i working on ios app needs have simple sqlite db. in portable class library using xamarin. in code i'm attempting connection db, i'm not sure should placing database in project folder nor if #if __ ios__ working honestly, i'm using based on xamarin docs here: http://bit.ly/1mxsyey public static sqliteconnection getconnection() { #if __ios__ var sqlitefilename = "messages.db"; var docs = environment.getfolderpath(environment.specialfolder.personal); var db = path.combine(docs, "..", "library", sqlitefilename); return new sqliteconnection(db); #endif return null; } in pcl should using interfaces , dependency injection instead using if directives in shared solution. eg. xamarin forms has dependency injection build in (but can use library): pcl shared library: public interface isqlite { sqliteconnection getconnection(); } ios specific project: [assembly: dependency (typeof (s

numberformatexception - Number format Exception in Java after inputting a string -

i have input character array , inputting number user. @ point getting numberformatexception code is: public static void main(string[] args) throws ioexception { bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); int n = integer.parseint(br.readline()); char c[] = new char[n]; (int = 0; < n; i++) { c[i] = (char) br.read(); } int k = integer.parseint(br.readline()); } at last line it's giving me error. you numberformatexception if try convert non-valid integer string or empty string integer . string x = "abcd"; int y = integer.parseint(x);//this raises exception abcd not valid number how handle it? non-technical solution: try smart man , enter numbers only. technical solution: try { string x = "abcd"; int y = integer.parseint(x); } catch(numberformatexcpetion ne) { system.out.println("numbers only!"); } do not use br.read() read characters. if enter them

How to force an empty namespace in a XML file using XSLT transformation -

i have xslt transformation converts xml, , need have following empty namespace in 1 tag: <rps xmlns=""> the header of xml file is: <?xml version="1.0" encoding="utf-8"?> <rps>...</rps> the header of xslt is: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:g="http://www.g2ka.com.br" xmlns:g2ka="com.g2ka.nfse.offline.util.offlineutils" xmlns:util="com.g2ka.nfse.util.util" exclude-result-prefixes="g g2ka util"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" standalone="yes" indent="yes"/> what can force xmlns="" in rps tag? help. this cannot done in xslt. empty namespace declaration on root element entirely redundant , removed (unless you're using libxslt processor).

java - Roboguice NoClassDefFoundError -

i started using roboguice today, following wiki https://github.com/roboguice/roboguice/wiki/your-first-view-injection , examples working fine when create new app, when trying integrate roboguice on existing app, given noclassdeffounderror @ runtime this mainactivity below. import android.app.searchmanager; import android.content.componentname; import android.content.context; import android.content.intent; import android.content.res.configuration; import android.net.uri; import android.os.bundle; import android.support.design.widget.navigationview; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbar; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.widget.toolbar; import android.util.log; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.widget.image

java - "Invalid authorization specification" error on UCanAccess connect -

i having problem ucanaccess driver namely when attempt connect database using following code public static void main(string[] args) { //establish connection database in order execute sql queries try { conn = drivermanager.getconnection("jdbc:ucanaccess://h:\\it_pat_program_localonly\\it_pat_database.accdb;showschema=true"); system.out.println("connection established"); } catch (sqlexception ex) { system.out.println("could not connect database\n"+ex); } //closes database connection @ program shutdown runtime.getruntime().addshutdownhook(new thread() { public void run() { try { conn.close(); system.out.println("shutdown succesful"); } catch (sqlexception ex) { system.out.println("an exception occured\n"+ex); } } }); } i met following error: could not connect database net.ucanacce

javascript - Submit button in a header fails to submit -

i'm developing jquery mobile app. in app there form user has submit , i've placed submit button in right side in header. when user done filling of form , taps on submit button class of "ui-btn-right" , fails submit. $(document).ready(function(){ $('.ui-btn-right').on('click', function(event) { $("#form1").on('submit',function(event){ event.preventdefault(); data = $(this).serialize(); $.ajax({ type: "post", url: "register.php", data: data }).success(function() { $("input[type=text]").val(""); }); }); }); }); html <a href='#' class='ui-btn-right' id="button" >register</a> just taking guess here, can't see markup. looks you're not submitting form when click button, you're wiring submit event. try this? $(document).ready(func

c++ - configuration opencv 2.4.11 with visual studio 2010 -

here situation. have tried 3 days configure opencv visual studio 2012 keeps on failing. want know how solve quick possible: my computer 64 bit operating system system variables set: name: opencv_dir value: c:\opencv\build\x64\vc10 path: add %opencv_dir%\bin in properties add -c/c++ -> additional include directories -> add '$(opencv_dir)\..\..\include' -linker -> general -> additional library directories-> add '$(opencv_dir)\lib' i put libraries in well linker -> input -> additional dependencies i open new emtry project finall try sample code found in official web of opencv http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_opencv/windows_visual_studio_opencv.html#windows-visual-studio-how-to (under "test it") however, keeps fail time! first , says there mis matched in machine, change file x64 x86. klater see bulid success, can not find pdb file. i have no idea why not work. sup

xmpp - Registering User using Smack 4.1.3 -

we building chat client in java , using smack 4.1.3. noticed there huge change in smack apis after smack 4.0 , registrations examples available on internet not working smack 4.1.3. not getting write apis register user. may give sample codes. in advance... this connects ejabberd server smack 4.1.3. xmpptcpconnectionconfiguration config = xmpptcpconnectionconfiguration.builder() .setusernameandpassword("testuser", "pass") .setservicename("example.com") .sethost("example.com") .setresource("test") .setsecuritymode(xmpptcpconnectionconfiguration.securitymode.disabled) .setport(5222) .build(); saslmechanism mechanism = new sasldigestmd5mechanism(); saslauthentication.registersaslmechanism(mechanism); saslauthentication.blacklistsaslmechanism("scram-sha-1"); saslauthentication.unblacklistsaslmechanism("digest-m

mysql - Strange error "A new entity was found through the relationship" in Symfony on production environment -

i have strange error doctrine common error: critical: uncaught php exception doctrine\orm\orminvalidargumentexception: "a new entity found through relationship 'isc\corebundle\entity\orders#ordersproducts' not configured cascade persist operations entity: isc\corebundle\entity\ordersproducts@000000000888648200000000198a79af strangeless in error frequency. can handle 5000 orders programming code , working good. 5001st order generate error, , not save ordersproducts. i googled solution, found (like doctrine - new entity found through relationship , https://groups.google.com/forum/#!topic/doctrine-user/bdy1qgm4tu4 , etc) doensn`t me. also, error occuring on production environment working lot of servers. on developer environment 1 server working good. in logs looks (user has 1 session id): www1 - visited product page www1 - added product1 in cart www2 - added product2 in cart www7 - visited cart www2 - choosed payment paypal www2 - initialized order (and

javascript - Enable and disable Slick Slider on certain break points -

i'm trying enable slick slider (slick.js) initiate on 520px wide. below , slides stack (i.e. no slick). possible can work without refreshing page? i've done this, works when dragging browser (narrow) below 500px, when move on 500px doesn't re-initiate without refreshing page... $('.slick').slick({ autoplay: true, autoplayspeed: 4000, delay: 5000, speed: 700, responsive: [ { breakpoint: 500, settings: "unslick" } ] }); is there way around this? i'm using https://github.com/kenwheeler/slick you can try reconstruct when window resized above 500. seems work in demo. jsfiddle demo function slickify(){ $('.slick').slick({ autoplay: true, autoplayspeed: 4000, delay: 5000, speed: 700, responsive: [ { breakpoint: 500, settings: "unslick" } ] });

Javascript|Jquery : Script not loading -

got weird problem cant fix : i've html page javascript have code aint working, tried simple alert got same problem : code between tags doesnt appear when @ source code in browser , cant see when in browser debugger... <script type="text/javascript"> $(document).ready(function(){ alert('hzhz') ; }); </script> when page source, can see : <script type="text/javascript"></script> if has idea or can tell me should for, great ! thx !

android - Dynamically set layout_below doesn't take effect -

i have checkbox layout_below 1 view. when view's visibility set gone, i'm trying set checkbox below one. can't work, code below, tip? if (certificate.gettype() == verifiedcertificate.student_card) { anchorschoolview.setvisibility(view.visible); imgschool.setvisibility(view.visible); txtschool.setvisibility(view.visible); txtschoolname.setvisibility(view.visible); relativelayout.layoutparams lp = (relativelayout.layoutparams) cbquestion.getlayoutparams(); lp.addrule(relativelayout.below, r.id.txtschoolname); cbquestion.setlayoutparams(lp); } else { anchorschoolview.setvisibility(view.gone); imgschool.setvisibility(view.gone); txtschool.setvisibility(view.gone); txtschoolname.setvisibility(view.gone); relativelayout.layoutparams lp = (relativelayout.layoutparams) cbquestion.getlayoutparams(); lp.addrule(r

php - How to use query strings -

i have php file json here , want use query string @ end of url find comment id 1 example. think should this: http://wowsk.org/comments/comments.php?id=1 this not work though , don't know doing wrong. have never worked query strings can't understand right away solution is. thanks help! in comments.php file, should value in $_request['id'], , include value in sql query (if using sql database). don't forget sql injection, @ least use intval() on id fields.

logging - Archiving JSON events from RabbitMQ to S3 -

i have process publishing json events rabbitmq exchange. i'd attach consumer both groups events , archives them s3 in sensible, buffered, , compressed manner. specifically, given event {"id": "1a2b3c4d5e6f", "ts": 1439995475, ... } , i'd end in @ s3 key looking %y/%m/%d/%h/1a2b3c4d5e6f.json.gz , datetime components of string derived flooring timestamp time interval, e.g.: new_ts = math.floor(event["ts"] / secs_per_hr) * secs_per_hr this seems relatively common problem, while could, i'm disinclined write own solution. it's pretty messaging pattern, , indeed seems lot of log management technologies should able handle this. specifically, looking @ logstash solution. seemed there relatively simple pipeline: rabbitmq input adapter json filter adds ts , id tags s3 output adapter buffers them , rolls them off. ( https://www.elastic.co/guide/en/logstash/current/plugins-outputs-s3.html ) still, i'm confronted severa

Is it possible to have grails test-app execute JUnit tests written in java? -

with grails 2.5, possible write tests (unit , integration) in java , have them executed grails test runner (grails test-app)? i'll provide little background on our situation. if had brand new app, we'd write our tests spock tests in groovy, , fine. however, have large application started out years ago spring mvc application written in java. ported grails 2.1 3 years ago. when ported grails, parts of converted groovy/grails, of remained in java, including lot of test code. since grails uses spring mvc under covers, able work without effort. grails 2.1, grails test runner (grails test-app) run our java tests without problems (they junit 4 tests). however, upgrading grails 2.5, , we run "grails test-app" grails 2.5, groovy tests executed--the java tests ignored. know how grails execute java tests in grails 2.5? here example integration test runs under grails 2.1 ignored grails 2.5: package com.finch.google.adwords.updaters; import com.finch.domain.cli

chromecast - Can I set the track ids after the video is playing? -

i'm trying implement subtitles on chromecast android app don't see way add tracks after media playing. missing or not possible? i'm pretty sure i've seen other apps doing it. thanks. you cannot add tracks after media loaded; need either add tracks before loading media or add , reload media

winforms - Saving Specific line of richTextBox in a Variable C# -

using code line of characters want store in variable string find = textbox1.text; string linetext = null; int linenum = richtextbox1.getlinefromcharindex(richtextbox1.find(find)); messagebox.show("line number " + linenum); how can store resulted line text richtextbox in string variable. you can use lines[] array: int charnum = richtextbox1.find(find); if (charnum > -1) { linetext = richtextbox1.lines[richtextbox1.getlinefromcharindex(charnum)]; }

cypher - Single match query request vs Multiple match query request in Neo4J -

which better between doing single match query request vs multiple match query requests in neo4j? (note: read (match/optional match) cypher here, no write operation cypher concerned). in case, using single match query request make cypher end many with statements , cypher big, i'm worry cypher readibility. on other side, using multiple match query requests, worry performance because there multiple database hits. so can give me thought this? if should after performance, should go single query request approach? fyi, i'm using neo4j v2.2. update: an example of single match query: match (a:a {id: {id} }), (b:b {id: {id2} }) a, b match (b)-[:r1]->(x:x) optional match (y:y)-[:r2]->(x) a, b, count(y) c optional match (a)-[r3:r3]->(b) a, b, c, count(r3) > 0 d; ... // match/optional match & statements return a, b, c, d, ...; if using multiple query request: // query 1 match (a:a {id: {id} }), (b:b {id: {id2} }) return a, b; // query 2 match (

PHP SOAP Client - sending serialised .NET object -

we trying interact soap server written in .net. 1 of parameters 1 of calls serialised, base64 encoded .net object: <parameter>base64binary</parameter> although know rough make of .net object, i’m @ loss of how serialise php array/object appropriately soap server handle. php , .net’s serialisation methods not same it’s not going simple that. .net object quite complex , made of number of child objects make things more fun. have no control on .net code either. does have advice on how handle such scenario?

php - MySQL query - where search with empty variable -

this elementary thing, can't find answer anywhere. need use equals variable post. but don't know if variable empty or not. have lot of parameters use in query, not every entered. have use if/else, or can search through database empty variable? if parameter variable not empty, want find rows in databse. if empty, want rows. you can use this: $db->query("select field table filter = '" . (isset($_post['field']) ? $db->real_escape_string($_post['field']) : "") . "'"); this prevents notices, if post variable not set. can use this, if variable set (just normal): $db->query("select field table filter = '" . $db->real_escape_string($_post['field']) . "'"); also, can use prepared statements etc.

Android Studio Gradle does not download maven depedencies -

i quite new android development , trying write test code. have downloaded android studio 1.3 version , created testapp. trying add com.facebook.android:facebook-android-sdk:4.1.0 depedency somehow it's not getting downloaded. here project level build.gradle file. buildscript { repositories { jcenter() mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files }} here module level build.gradle file. apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.testapp" minsdkversion 19 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.

c++ - thread not working for function with template arguments -

i trying implement multithreaded merge sort, attempt fails compile. here code : template <class randomaccessiterator> void merge_sort (randomaccessiterator begin,randomaccessiterator end) { int n = end - begin; int n1,n2; if (n == 1) return; randomaccessiterator mid = begin + (end-begin)/2; // merge_sort (begin,mid); // ok // merge_sort (mid,end); // ok thread t1 (merge_sort,begin,mid); // error thread t2 (merge_sort,mid,end); // error t1.join (); t2.join (); n1 = mid - begin; n2 = end - mid; merge (begin,n1,mid,n2); } errors messages gcc ( g++ -std=c++11 merge-multithread.cpp ): merge-multithread.cpp: in instantiation of ‘void merge_sort(randomaccessiterator, randomaccessiterator) [with randomaccessiterator = int*]’: merge-multithread.cpp:76:25: required here merge-multithread.cpp:60:33: error: no matching function call ‘std::thread::thread(<unresolved overloaded function type>, int*&,

asp.net mvc - How to extend the Owin OAuth to accommodate the Application level login confirmation -

i working mvc5 application using owin oauth authentication. looking forward extend login criteria have added couple of tables (application table (applicationid(guid), applicationname(nvarchar) , applicationusertable(id, applicationid(fk application table), userid(fk column aspnetusers table))) in security db. please give me idea on how access applicationusertable in owin context can verify first if user belong particular application? have looked through quite few examples didn't find relevant particular scenario working with. you set applicationid field clientid, have different clientid each application. when user sends authentication token request, in grantresourceownercredentials method when check user credentials, check if user belongs application received clientid represents. in simple way, following: public override async task grantresourceownercredentials(oauthgrantresourceownercredentialscontext context) { ... var user = await _userservice.getuser

Idiomatic clojure map lookup by keyword -

say have clojure map uses keywords keys: (def my-car {:color "candy-apple red" :horsepower 450}) i know can value associated keyword either using keyword or map function , other argument: (my-car :color) ; => "candy-apple red" (:color my-car) ; => "candy-apple red" i realize both forms can come in handy situations, 1 of them considered more idiomatic straightforward usage shown above? (:color my-car) standard. there few reasons this, , won't go of them. here's example. because :color constant, , my-car not, hotspot can inline dynamic dispatch of color.invoke(m) , can't m.invoke(color) (in java pseudo-code). that gets better if my-car happens record color field instead of plain map: clojure compiler can emit code check "hey, if my-car instance of cartype, return my-car.color ; otherwise complicated, slow, hashmap lookup."

connection - getting router ipv4 adress to android device -

Image
i need router ipv4 adress android phone. possible that? it's easy ipv4 computer jus need type ipconfig cmd but how connected router ipv4 android device? here's android code connect router @override public void onreceive(context context, intent intent) { list<scanresult> list = scanner.getscanresults(); for(scanresult result : list){ if(result.ssid.equals("micro")){ //connect network connect(result.ssid); break; } } } public void connect(string name){ string password = "logitech"; wificonfiguration conf = new wificonfiguration(); conf.ssid = "\"" + name + "\""; conf.presharedkey = "\""+ password +"\""; scanner.addnetwork(conf); list<wificonfiguration> list = scanner.getconfigurednetworks(); for( wificonfiguration