Posts

Showing posts from July, 2015

android - Statusbar color doesn't set properly on Meizu PRO 6 -

Image
i got device-specific problem meizu pro 6 / android 6.0 i try set statusbar color defining colorprimarydark in theme file when set #ff0000 (red) works fine but when set #000000 (black) doesn't apply (as see, color same colorprimary ) the same code run on lg nexus 5x: what go wrong here? , how can fixed? suppose current device has kind of color filtering statusbar, maybe allows colors, lighter colorprimary or this... the problem meizu has custom launcher , it's own implementation. for me getwindow().setstatusbarcolor(color); actionbar.setbackgrounddrawable(new colordrawable(color)); works ok. when tried use in activity not in focus yet didn't work. but workaround (see snipet below) works . update colors when activity has focus @override public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); if (hasfocus) { //... code colorization } }

hadoop - Python 2.6.6 and hive connectivity issue? -

i have vm default python version 2.6.6 , hive 1.2. have installed pyhs2 successfully. when run python script error below. file "test.py", line 7, in <module> pyhs2.connect(host='localhost', port=10000, authmechanism="plain", user='hive', password='hive', database='xxxx') conn: file "/usr/lib/python2.6/site-packages/pyhs2/__init__.py", line 7, in connect return connection(*args, **kwargs) file "/usr/lib/python2.6/site-packages/pyhs2/connections.py", line 46, in __init__ transport.open() file "/usr/lib/python2.6/site-packages/pyhs2/cloudera/thrift_sasl.py", line 55, in open self._trans.open() file "/usr/lib64/python2.6/site-packages/thrift/transport/tsocket.py", line 101, in open message=message) thrift.transport.ttransport.ttransportexception: not connect localhost:10000 in hive-site.xml have below configuration. <property> <name>hive.server2.authentication</name&

c - Return 1 in non main function -

i learning c , have confusion regarding return: int factorial (int n) { if (n == 1) return 1; else return n * factorial (n -1); } in above recursive code in last call when n 1, return 1 return integer value 1 or error in execution in main. had confusion because return 1 treated differently in main , in function called main... will return 1 return integer value 1 or error in execution in main? return 1 returns integer value 1 any function declared return int , even if function happens int main() . a non-zero return value main() interpreted (by execution environment, e.g. shell) indicate error in execution. happens semantic of return value of main() .

amazon web services - Want to take Backup and Restore of DynamoDB tables on weekly basis robustly -

i looking take backup , restore of dynamodb tables on weekly basis. have options such aws datapipeline (for full refresh), lambda function (for delta imports) , python's dynamodump module , python's dynamodb_utils (for full refresh) module. here question is, module suitable , 1 give better performance. please suggest 1 module above list or other available options. client not intresting in using aws solutions, asking python solution provides better performance, since data huge (in 10 of millions) thanks, uday

mib - Is it possible to send table in SNMP Trap? -

i'm using net-snmp library (c/c++) write snmp trap sender. basic object types, it's quite simple add object trap: snmp_varlist_add_variable(notification_vars, mibname, length, mibtype, mibvalue, len); where 'mibname' being oid, 'mibvalue' value string , 'mibtype' asn type. now, how indexed table? there support this? how add rows elements trap? or there simpler alternatives this? it bad practice send entire snmp table within snmp trap. snmp tables pretty big in terms of number of oid instances. problem snmp uses udp transport protocol. snmp allows pdus sized mtu of network. buffer should big largest anticipated packet, should correspond mtu, if possible. example, ethernet allows 1500 byte frame payloads. so pdu max size 10 varbinds in average. the common use case scenario here send out snmp trap notifying user has changed/happened. user need fetch data table using get-next/get-bulk upon trap reception details of event.

swing - How to use TableColumnModelListener to change the column color based on the reposition in java -

i have table 4 columns called id, name, subject, marks . if marks below 35, changing marks column colour red else black . here, have issue if change column position of marks becoming `black' , 1 there in marks position getting coloured. i have tried implementing tablecolumnmodellistener , overridden columnmoved() method. when try column index tablemodel.getcolumnindex("marks") still giving previous position index not new one. is there way new column index passing name? you setting colors in implementation of tablecellrenderer (possibly deriving defaulttablecellrenderer ). row , column indexes reported in gettablecellrenderercomponent method view indexes, not model indexes. using view index index model, or vice versa. you can change index view model using of jtable.convertxxxindextomodel methods, or model view jtable.convertxxxindextoview (where xxx row or column ). see jtable class documentation more details.

c# - Output Window not working on Visual Studio Isolated Shell -

i having problem displaying text output window in visual studio isolated shell.everything working fine if run isolated shell on machine has isolated+integrated shell redistributable + visual studio professional 2015 + sdk installed. on machine doesn't have visual studio installed, output window remains blank on isolated shell although work on integrated shell. i using following create custom output window: ivsoutputwindow opwindow = package.getglobalservice( typeof( svsoutputwindow ) ) ivsoutputwindow; guid customguid = new guid("0f44e2d1-f5fa-4d2d-ab30-22be8ecd9789"); string customtitle = "my title"; opwindow.createpane( ref customguid, customtitle, 1, 1 ); ivsoutputwindowpane oppane; opwindow.getpane( ref customguid, out oppane); oppane.outputstring( "hello, test!" ); oppane.activate(); can shed light? thanks i've found problem. in end due dlls version different caused behaviour differences. more details can found in link:

objective c - Changing UserDefaultLanguage Swift problems -

i new programming , have found how change cllocation reverse geolocation in objective c: nsmutablearray *userdefaultlanguages = [[nsuserdefaults standarduserdefaults] objectforkey:@"applelanguages"]; [[nsuserdefaults standarduserdefaults] setobject:[nsarray arraywithobjects:@"en", nil] forkey:@"applelanguages"]; [self.geocoder reversegeocodelocation:newlocation completionhandler:^(nsarray* placemarks, nserror* error){ mkplacemark *placemarker = [placemarks objectatindex:0]; nslog(@"%@",placemarker.locality); }]; [[nsuserdefaults standarduserdefaults] setobject:userdefaultlanguages forkey:@"applelanguages"]; and have big difficulties translate in swift, managed do: let userdeflang = userdefaults.standard.array(forkey: "applelanguages") var placemark: clplacemark! placemark = placemarks?[0] if let city = placemark.addressdictionary!["state"] as? string {

Month & Year filter in SQL Server -

Image
i have sql server table following columns: now, have write query return me records "month > may" , "f year > 2016". i providing both "month" (may) & "f year" (2016) application. there multiple records same month & f year column values. i tried date part, cast etc. not getting required result. you can (with month name) select * tablename datepart(mm, ([month] + ' 01 2016')) > datepart(mm,'may' + ' 01 2016') , fyear > 2016 or (with month number) select * tablename datepart(mm, ([month] + ' 01 2016')) > 5 , fyear > 2016

Spark read CSV realtive path -

how can read csv spark using relative path? far using absolute path worked fine (1.6.2, 2.0.1) require loading of data via relative path. trying read file like val mynewdf = spark.read .option("header", "true") .option("inferschema", "true") .option("charset", "utf-8") .option("delimiter", ";") .csv("~/myproject/somefolder/data.csv") results in following exception path not exist: file:/users/geoheil/source/to/scala/sparkproject/~/myproject/somefolder/data.csv; so not spark blamed ;) settled on using plain scala relative file path: var path = "~/myproject/data/data.csv" path = path.replacefirst("^~", system.getproperty("user.home"))

Using JAWS screen reader with Flash / Flex : enabling forms mode -

we have legacy flash / flex application full accessibility used work jaws screen reader. while reviewing recently, found not possible either use app or navigate jaws running as; 1. keyboard controls navigation intercepted jaws 2. none of accessibilityproperties of flash / flex recognised back when app first built, scripts required integrate jaws links these scripts broken / not maintained , 1 of links found states scripts no longer required since version 11 of jaws (jaws on version 18!). there supposed "forms" mode switches input methods of jaws support form entry - used picked automatically, fails flash in browsers tested now. so... please can point me references or assistance on how allow jaws , flex work jaws can recognise innumerable accessibilityproperties definitions built in , flash / flex can receive , process essential keyboard entry strokes required navigate without mouse? thanks, g

docker - Cannot start container: process is killed -

my containers killed on new installation of fedora 24 atomic: #docker run -ti nginx /bin/bash docker: error response daemon: cannot start container f24104b29f7f1f1614024414e8346e1a98c722c027f4122e6c70f7ace0cc5353: [9] system error: exit status 1. after debugging session, think process gets killed right after trying assign address on network bridge (see docker daemon logs in next links). have no idea why nor how debug further. some additional info reported here: selinux disabled: bash-4.3# getenforce -> permissive docker info docker daemon log in debug mode. @ line 9 receives kill signal. any appreciated! best, mario i've found problem: https://bugzilla.redhat.com/show_bug.cgi?id=1320601 adding systemd flag launch script of daemon: --exec-opt native.cgroupdriver=systemd solved problem. thanks, federkun, help! best, mario

spark, count and saveAsObjectFile without computing it twice -

using spark, filter , transform collection. want count size of result collection , save result collection file. so, if result collection not fit in memory, mean output computed twice? there way count , saveasobjectfile @ same time, not computed twice? val input: rdd[page] = ... val output: rdd[result] = input.filter(...).map(...) // expensive computation output.cache() val count = output.count output.saveasobjectfile("file.out") solution #1 using cache memory , disk you can use cache memory , disk - you'll avoid computing twice, you'll have read data disk (instead of ram) using persist() memory_and_disk parameter. save computed data memory or disk http://spark.apache.org/docs/latest/programming-guide.html#which-storage-level-to-choose memory_and_disk store rdd deserialized java objects in jvm. if rdd not fit in memory, store partitions don't fit on disk, , read them there when they're needed. solution #2 perform count using accumu

shell - Why octave figure closed very soon in emacs -

i use gnu emacs 24.3.1 on ubuntu 14.04 , have simple octave script it's name test.m : #! /usr/bin/octave -qf x=1:10 plot(x); when try execute m-! ./test.m , empty figure window appears closed , saw result in emacs : warning: function ./test.m shadows core library function x= 1 2 3 4 5 6 7 8 9 10 how can solve problem? the warning that: function file test.m shadows built in function test long don't want call built in test function can ignore (although it's considered bad practice shadow core functions). the plot disapears because octave exits after running test.m. have call octave --persist or it's common add pause @ end of script waits keypress: #! /usr/bin/octave -qf x=1:10 plot(x); pause

Calculated fields in Laravel and general PHP -

in laravel / php easy create accessors , mutators transform or create dynamic fields database. although easy duplicate same logic throughout app, when not accessing same data through orm model (e.g. direct queries). $order->totalplustax; // (total * 10%) the logic calculate field should written once, testable , not tied orm. what best practices or design patterns around logic? design patterns have evolved way organise , provide performance gains our code. address specific issues. question broad design pattern solve degree. for example, if have logic checks database conditions before creating object, live in objects factory class , else. if have logic finds object checking conditions in database, logic live in repository class , else. the solution problem isn't 1 particular design pattern. solved many design patterns, oo classes , methods, , following solid principles. side note: i'm sorry if not answer expecting. found myself in similar position

arrays - how to manipulate an image very fast in accordance to an own math function in python -

i'm trying create 360 degree camera google street cameras (this whole code if interested) i have individual kind of perspective equation map pixel [xold,yold] [xnew,ynew] in accordance alpha , beta angles inputs. to simplify equation , question, assume i'm trying rotate image. question how rotate image using rotation equation on each pixel fast on pygame or anyother intractive shell: xnew = xold * cos(alpha) - yold * sin(alpha) ynew = xold * sin(alpha) + yold * cos(alpha) assume pygame.transform.rotate() not available read following words pygame.org: http://www.pygame.org/docs/ref/surface.html "there support pixel access surfaces. pixel access on hardware surfaces slow , not recommended. pixels can accessed using get_at() , set_at() functions. these methods fine simple access, considerably slow when doing of pixel work them. if plan on doing lot of pixel level work, recommended use pygame.pixelarray object direct pixel access of surfaces, gives a

c# - How to restream live jpeg image from event handler to WebAPI PushStreamContent? -

summary we using milestonesys c# sdk live jpeg camera. have jpeglivesource class can instantiate. class has event handler livecontentevent(object sender, eventargs e ) fired every new live frame camera. e parameter, image content ( byte []) can convert memorystream => bitmap. we setup .net web api 2 , end point when user go to: http://localhost:9000/camera/id/live , should see stream of jpeg in browser. the problem we don't know how restream new image continuously livecontentevent pushstreamcontent . we tried pushstreamcontent code many different websites, of them streaming static video file or collections of images in folder. the code [httpget] [route("{cameraid}/live")] public httpresponsemessage livestream(string cameraid) { var camera = getcamera(cameraid); httpresponsemessage response = new httpresponsemessage(); if (camera == null) return ok("camera not found.").request.createresponse(); var livesource = new jpe

css - How it's possible add style on hover if element is an immediate previous of that element? -

a:hover + ul{ display:none; } <li> <a>hover me</a> <ul> hide me</ul> </li> <li> <p>change color</p> <ul>hover me</ul> </li> i know it's possible add style particular element using '+' if it's immediate next element(as shown above).is possible apply hover if element immediate previous ? that not possible css selectors use kind of hack change order of elements flexbox , use + selector. div { display: flex; flex-direction: column; } strong:hover + p { color: blue; } p { order: -1; } <div> <strong>hover me</strong> <p>change color</p> </div>

vb.net - Posting MIME encoded attachment to Ariba Supplier Network "Premature end of file" -

my problem response after posting string ariba network. had @ similiar question, don't found answer: codesnippet: ' check -> no request send if chkcheckonly.checked = false dim bytearray byte() = encoding.utf8.getbytes(strrequestfile) dim request webrequest = webrequest.create(txtaspserver.text) dim intlength integer = bytearray.length request .timeout = val(strtimeout) .method = "post" .contenttype = "multipart/related;boundary=" & strboundary & ";type=""text/xml"";start=""<part1.pc@ganter-interior.com""" .credentials = credentialcache.defaultcredentials .contentlength = bytearray.length end ' create stream data dim datastream system.io.stream datastream = request.getrequeststream() datastream.write(bytearray, 0, bytearray.length) datastream.close() dim response webresponse = request.getresponse ' stream containing content returned server datastream =

Bigcommerce stencil CMS page image url error -

i created cms page image on bigcommerce backend. in html editor,the url of image ' https://store-xxxxxx.mybigcommerce.com/product_images/uploaded_images/xx.jpg '. when run stencil theme locally, noticed image url changed '/product_images/uploaded_images/xx.jpg'. why changed? can me?

c++ - Trying to dynamically increase array size -

i working on program user keeps entering numbers, saved array, when array full trying copy original array new 1 one , continue fill array cannot work @ all. here code far #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int size; cout << "please enter how many numbers want enter: "; cin >> size; double *array = new double*[size]; cout << "please enter numbers: "; for(int = 0; < size; i++) { cin >> array[i]; if(i == size-1) { int newsize = 2*size; double *arrayb = new double*[newsize]; for(int = 0;i<size;i++) { arrayb[i] = array[i]; } delete [] array; array = arrayb; size = newsize; } } } i can compile making double pointers point @ doubles, instead of arrays of double pointers int size; cout <<

php - how to join 3 table without repeating the id? -

i have 3 tables: te_event, te_venue, te_category. te_event table has columns: categoryid, venueid, event description, title, date, price. te_venue table has columns: venueid, venuename , location. te_category has columns: catid , catdesc. here query select * te_events inner join te_venue on te_events.venueid = te_venue.venueid inner join te_category on te_events.catid = te_category.catid but show reapeating id eventid | eventtitle | eventdescription |venueid | catid| eventstartdate |eventenddate |eventprice | venueid | venuename | location| catid | catdesc why not select columns need? example: select e.eventid, e.eventtitle, e.eventdescription, e.eventstartdate, e.eventenddate, e.eventprice e.catid, v.venueid, v.venuename, v.location te_events e inner join te_venue v on e.venueid = v.venueid inner join te_category c on e.catid = c.catid it may bit longer ma

mysql - prevent Posting Data From Different Domain PHP -

i have form in php page. in page, opening window popup. in popup there fields. fill form , submit it. after submitting form send mail user. form user can give reference of website friend sending mail him. unfortunately hacked website , uses php script sending mails. so, want restrict access of php script outside server. should restrict access. have tried option did not success. there 2 ways can mitigate this, totally stopping not possible. use http referer: $referer = parse_url($_server['http_referer']); $alloweddomain = 'yourdomain.com'; if ($referer['host'] == $alloweddomain){ //process mail script here. } note can not trust http_referer value. can spoofed. use tokens: generate random token , put within form post like: if (!isset($_post['submit'])){ $_session['random_code'] = rand(0, 1000000); }else{ if ($_post['random_code'] == $_session['random_code']){ //process mail script he

Convert AES encryption of android in Objective-c xcode -

i have use aes encryption , decryption similiar below code need pass similiar data android did generate key package encypt.com; import java.io.bufferedreader; import java.io.filereader; import java.security.*; import java.security.spec.invalidkeyspecexception; import javax.crypto.cipher; import javax.crypto.spec.secretkeyspec; import sun.misc.*; public class testing { private static final string algorithm = "aes"; private static final int iterations = 2; private static final byte[] keyvalue = new byte[] { 't', 'h', 'i', 's', 'i', 's', 'a', 's', 'e', 'c', 'r', 'e', 't', 'k', 'e', 'y'}; public static string encrypt(string value, string salt) throws exception { key key = generatekey(); cipher c = cipher.getinstance(algorithm); c.init(cipher.encrypt_mode, key); string valuetoenc = null; string evalue = value;

primary key - Auto increment depending on value of column in PostgreSQL -

the question follows, can auto increment (verification_number) depending on value of specific column (here business_uuid) verification_number increments 1 (1) depending on business_uuid's own highest number of verification_number? database looks follows: table: verification verification_id = integer, sequence (primary key) business_uuid = text verification_number = integer the verification_id primary key in table , want verification_number follow it's own auto increment depending on it's highest value filtered business_uuid. the business_uuid unique identifier each business. is possible? it not clear if want verification_number saved table possible create @ query time: select verification_id, business_uuid, row_number() over( partition business_uuid order verification_id ) verification_number verification the problem above approach verification_number change if rows deleted window functions

javascript - ag-grid sorting on cell value changed -

values in grid table can change @ time. keep sorted after every value change in sorted column. there grid or column api can call in oncellvaluechanged event? regards you try like gridoptions.api.setsortmodel(gridoptions.api.getsortmodel()) but may overkill - can state off current column sort , apply accordingly

xslt - Docbook ebnf.assignment -

i trying use right arrow glyph postscript symbol font docbook ebnf assignment operator, this: <xsl:param name="ebnf.assignment"> <fo:inline font-family="symbol"> &#x2234; </fo:inline> </xsl:param> but places arrow in subscript position. moving superscript possible, have not been able find way place in middle. any ideas how work? any other ways use nice looking bnf assignment operator?

jquery - Why is jQplot Coming Up Blank? -

i'm new jquery , jqplot. i have web application needs plot array of points onto graph. graph showing blank , problem don't know it's running trouble... the body of code responsible executing plot simple, see below: function graphdata(pricedata){ var options = { series:[{showmarker:false}], axes: { xaxis: { renderer:$.jqplot.dateaxisrenderer, tickoptions:{ formatstring:'%h:%m:%s' }, tickinterval:'15 second' }, yaxis: { numberticks: 6, tickoptions:{formatstring:'%.2f'} } } } var plot = $.jqplot('chartcontainer',[[data]], options); } and i'm seeing blank canvas. clear went , checked data array made of, , sure enough it's 2d array each nested array looks [x-coord, y-coord], here's sample ["08:11:15", "29.21"] ["08:12:35", "29.21"]

jquery - Ajax xhr.upload.addEventListener doing big progress steps -

i have trouble showing progress of jquery ajax upload. here ajax call: jquery.ajax({ url: aurl, method: 'post', datatype: 'text', data: data, crossdomain: true, processdata: false, success: function() { this.saveentrysuccess(transportno, id); }.bind(this), error: function(response) { this.saveentryfail(response, id, transportno); }.bind(this), xhr: function() { var myxhr = $.ajaxsettings.xhr(); if(myxhr.upload){ myxhr.upload.addeventlistener('progress', this.progress, false); } return myxhr; }.bind(this) }); this works fine , in "this.progress" calculate progressbar. fine until here. in safari , edge event calls , progressbar working smooth. 1,2,4,5,6,8% , on. in chrome(versio

Jquery autocomplete does not always work -

i've been using code autocomplete input . in many cases code works fine, in doesn't. relates ios user, android user, windows 7, 8, 10 user, chrome , firefox . availabetags includes 13500 listings. thanks ;) $( "#tags" ).autocomplete({ minlength: 3, delay: 100, autofocus: false, source: function (request, response) { var term = $.ui.autocomplete.escaperegex(request.term) , startswithmatcher = new regexp("^" + term, "i") , startswith = $.grep(availabletags, function(value) { return startswithmatcher.test(value.label || value.value || value); }) , containsmatcher = new regexp(term, "i") , contains = $.grep(availabletags, function (value) { return $.inarray(value, startswith) < 0 && containsmatcher.test(value.label || value.value || value); }); response(startswith.concat(conta

Python docx: insert_after()? -

right now, have "template file" several paragraphs exist (like education, career, aims, etc.) , every paragraph composed like 1. education 2. career 3. aims now, i'd fill these paragraphs text database make like 1. education education text database 2. career nasty career stuff database 3. aims aims defined here database searched through api documentation found close function called insert_paragraph_before(text) - counterpart exist? desired output should be: from docx import document document = document('template.docx') p in document.paragraphs: if p.text == 'some keyword here': p.insert_paragraph_after('some text insert here') ^ | function not (yet?) exist document.save('result.docx') the short answer "not yet". what might able though: def insert_paragraph_after(paragraphs, idx, text=none): next_paragraph_idx = idx + 1 if idx == len(paragraph

server - How to redirect from domain to same domain but one difference using .htaccess? -

i have little knowledge .htaccess , redirects. there way redirect every page of website domain.com/page_1 domain.com/en/page_1 ? happen every page. if have domain.com/page_2 redirect domain.com/en/page_2 , on. you can use negative lookahead based rule in site root .htaccess: rewriteengine on rewritecond %{request_filename} !-f rewriterule ^(?!en/)(.+)$ /en/$1 [l,nc,r=301] (?!en/) match except uri starts /en/

c# - Implement accordion within table and asp:repeater -

Image
i create table inside repeater , data appears correctly, 2 records looks in image below. want: how make accordion when user clicks on deposit number(example 16), new table appear , contain data. this repeater first repeater code: <asp:repeater id="rptdep" runat="server" > <headertemplate> <table class="table table-hover table-striped table-condensed table-bordered table-responsive"> <tr> <th>deposit no.</th> <th>custom declaration no.</th> <th>category</th> <th>location</th> <th>goods description</th> <th>units balance</th> <th>wt balance</th> <th>goods balance amount(lc)</th> </tr> </headertemplate> <itemtemplate> <tr>

java - Drawing a background image -

Image
i draw image background image, fine when i'm trying add jbuttons frame whole business goes wrong picture drew disappear , see original background. the picture drawing looks that: public void paint(graphics g){ g.drawimage(bg, 0, 0, null); } i guess problem paint method, need mentioned i'm extending jframe class. edit: here pictures demonstrate mean. it first draw image: and when move mouse place buttons should have been drew, that's get: import java.awt.*; import java.awt.image.bufferedimage; import javax.swing.*; import javax.swing.border.emptyborder; import java.net.url; import javax.imageio.imageio; public class framewithbg { public static void main(string[] args) throws exception { url url = new url("http://i.stack.imgur.com/ovog3.jpg"); final bufferedimage bg = imageio.read(url); runnable r = new runnable() { @override public void run() { jpanel c = new panel

eclipse - How to Obfuscate Selenium Framework in java using Proguard gui? -

i trying obfuscate selenium automation framework using proguard gui. exported project executable jar file , obfuscated code using proguard. problem obfuscated executable jar file cant executed....if check keep library check box of proguard(shrinking tab) executable, code not obfuscated. proguard appreciable.

Kotlin: is it possible to have a constant property dependent on an implementation generic type? -

i have following abstrac base class abstract class vec2t<t : number>(open var x: t, open var y: t) { companion object { val size = 2 * when (/** t instance type */) { byte, ubyte -> 1 short, ushort -> 2 int, uint, float -> 4 long, ulong, double -> 8 else -> throw arithmeticexception("type undefined") } } } that implemented, example, vec2 data class vec2(override var x: float, override var y: float) : vec2t<float>(x, y) i wondering if possible define size in vec2t , call on 1 of implementation, example vec2.size although cannot "have static fields have different values different instantiations of generic class" (as @yole commented ), can define properties on each implementation , companion objects. e.g.: abstract class vec2t<t : number> { abstract var x: t abstract var y: t abstract val size: int } class vec2f(ov

sql - mysql select datetime query to find ids which are 1 year old, 2 year old and so on -

i want ids created in last 1 year, or year > 1 year < 2, , on. suppose if table: +----+--------------------------+---------------------+ | id | data | cur_timestamp | +----+--------------------------+---------------------+ | 1 | time of creation is: | 2014-02-01 20:37:22 | | 2 | time of creation is: | 2015-01-01 20:37:22 | | 3 | time of creation is: | 2015-02-01 20:37:22 | | 4 | time of creation is: | 2015-12-01 20:37:22 | | 5 | time of creation is: | 2016-02-01 20:37:22 | | 6 | time of creation is: | 2016-04-01 20:37:22 | +----+--------------------------+---------------------+ i table this: +-----------------------+-------+ | date range | count | +-----------------------+-------+ | last 1 year | 3 | | > 1 year & < 2 years | 2 | | > 2 years | 1 | +-----------------------+-------+ any content in first column fine. have count specified above. have tried various things. select co

how to create maven mojo plugin to overwrite files directories in target project -

i writing maven plugin generates java source code based on input text file , additional configuration. e.g. user creates maven project , adds plugin in project's pom.xml below - <plugin> <groupid>abc.plugin</groupid> <artifactid>abc-maven-plugin</artifactid> <version>1.0.0</version> <executions> <execution> <goals> <goal>abc</goal> </goals> </execution> </executions> <configuration> <schemapath>${basedir}\input</schemapath> <package>com.svc.xyz</package> <filenametxt>${basedir}\input.txt</filenametxt> </configuration> </plugin> as part of executing goal of plugin, plugin delete pre existing java source files/directories in user's project rewrite pom.xml o

php - Encrypted message doesn't appear on page -

i'm using pgp-2fa , on local working great. i've trying on host doesn't show encrypted message. the way working is $key = db::table('users')->select('pgp_key')->where('user_id', '=', $data['user_id'])->first(); $pgp = new pgp_2fa(); $msg = ''; $pgp->generatesecret(); $enc = $pgp->encryptsecret($key->pgp_key); return view::make('users.auth', ['enc'=> $enc]); here i've selected users public pgp key profile , encrypt message must decrypt private key. when var_dump($enc); i've received bool(false) and var_dump($pgp); object(pgp_2fa)#336 (1) { ["secret":"pgp_2fa":private]=> string(15) "603893251905515" } which correct string(15) "603893251905515" . problem in view don't see $enc because it's returning bool(false) . this have in view <pre>{{ $enc }}</pre> again: working great on local can't

javascript - Lower casing the keys in JSON - Node JS -

i want change json array keys names upper case letters lower case keys following [ { "_id": "581f2749fb9b6f22308f5063", "workshopid": "1", "workshoptitle": "workshop1", "workshopprice": "200", "workshopdescription": "workshop1 test workshop", "floornumber": "1", "roomnumber": "205", "workshoplanguage": "english language", "lastonlineregistrationdate": "15/10/2016", "workshopdate": "1/11/2016", "workshopstarttime": "8:00 am", "workshopendtime": "11:00 am", "workshoprules": "rules mentioned here", "workshopcapacity": "200", "speaker": { "speakername": &q

asp.net - IIS redirect from Default Web Site -

i have following applications structure default web site (localhost/) first application (locahost/application1) second application (localhost/application2) default web site showing iisstart.html now. want redirect user when goes localhost/ directly localhost/application1. url rewrite rule pattern ^http(s)?://localhost(:80)?/$ , rewrite url http://localhost/application1 . url rewrite rule default web site doesn't work. also, i've tried enable http redirect, "only redirect request content in directory" checkbox checked, applies applications. help, please?

java - why jTransform makes image turn yellow -

the fft , ifft sequence using jtransform not generates same results, although no visible difference can seen. visualized difference , found out not matter input image is, diff.jpg yellow, why happening? how can fix that? original image diff here testing code, in check.java; import org.jtransforms.fft.doublefft_2d; import org.jtransforms.fft.doublefft_3d; import static java.lang.math.abs; public class check { public static void main(string[] args){ try { double[][][] im=parser.getimagergb("res//kato_megumi.jpg"); doublefft_3d f3d=new doublefft_3d(im.length,im[0].length,im[0][0].length/2); f3d.complexforward(im); f3d.complexinverse(im,true); parser.setimagergb(im,"reflect.jpg"); double[][][] ref=parser.getimagergb("reflect.jpg"); double[][][] cmp=new double[im.length][im[0].length][im[0][0].length]; for(int i=0;i<im.length;i++)

c# - SQLDataAdapter changing value type returned from SQL -

Image
in c# project, executing query against sql 2014 database retrieve employee data, including periodend stored in database decimal (i.e., nov 17, 2016 stored 20161117). database querying not our product cannot change type datetime field. here sql script being executed: select distinct e.employee empno, ch.perend periodend, ch.prpoststat upempl e inner join upchkh ch on e.employee = ch.employee ch.perend = @periodend here sqldataadapter call: executesqlcommandscript(string sqlscript, list<sqlparams> sqlparams) { . . . (setup sqlconnection info) using (sqlconnection _conn = new sqlconnection(connectionstring)) { using (sqlcommand _cmd = new sqlcommand()) { _cmd.commandtext = sqlscript; _cmd.connection = _conn; _cmd.connection.open(); // add sqlparameters sql command if (sqlparams != null) { _cmd.parameters.addrange(sqlpar

c++ - Netbeans Cpp compiles and runs project, but not test with cppunit -

i have c++ project using libraries such wiringpi , mysql connector. regular project compiles when run it. when try test 1 of tests, fails building project. here's output: "/usr/bin/make" -f nbproject/makefile-debug.mk qmake= subprojects= .build-conf make[1]: entering directory '/home/nick/netbeansprojects/utest' "/usr/bin/make" -f nbproject/makefile-debug.mk dist/debug/gnu-linux/utest make[2]: entering directory '/home/nick/netbeansprojects/utest' make[2]: 'dist/debug/gnu-linux/utest' date. make[2]: leaving directory '/home/nick/netbeansprojects/utest' make[1]: leaving directory '/home/nick/netbeansprojects/utest' "/usr/bin/make" -f nbproject/makefile-debug.mk subprojects= .build-tests-conf make[1]: entering directory '/home/nick/netbeansprojects/utest' "/usr/bin/make" -f nbproject/makefile-debug.mk dist/debug/gnu-linux/utest make[2]: entering directory '/home/nick/netbeansprojects

javascript - Fire iframe and submit form on the same button press -

spend few hours on 1 , couldn't find solution here goes: i having tracking pixel in iframe. on button click want firstly fire tracking pixel , submit form. have page in middle fire pixel , pass form in project have no access backend , cannot make intermediate page. have tried add onclick='firepixel()' button assuming submit form , load iframe not. have tried create 2nd function , add callback in way: onclick(firepixel(submitform)) having submitform callback - no luck. p.s have tried have button outside of form (as seen below) inside form - no luck. not sure what's best practice here? don't mind if iframe being fired in background - user never seeing - it's tracking pixel. please find code (which not work) below: <iframe id='conversioniframe' data-src="testframe.html" src="about:blank" width='100px' height="100px"> <div class='panel clearfix'> <form id="options-

jquery - How to create a Table with JSON in this case -

i have following json , creating table { "tag_video_details": [{ "video_id": "369", "tag_name": "three", "video_name": "test 001", "video_file": "xxx", "video_details": [ "one", "two", "three" ] }] } while creating table , how can create td shown below inner array <td> <span class="btn btn-sm btn-success btn-circle">one</span> <span class="btn btn-sm btn-success btn-circle">two</span> <span class="btn btn-sm btn-success btn-circle">three</span> </td> i have hardcoded in fiddle http://jsfiddle.net/cod7ceho/297/ function updatetable(aajxresponse) { var html = '<tr class="existingvideos">\ <th width="20%&quo

html - CSS border dissapear on hover -

i'm having trouble stylesheet , have no idea next. i created <p class="button">more</p> since wanted text looks button. this css part i'm using modify it. .content .bothead a.part .dole p.button{font-size: 16px;border: 2px solid #6d6d6d;padding: 10px 0px 10px 0px; margin-bottom: 10px; border-radius: 25px; -webkit-border-radius: 25px; -moz-border-radius: 25px;} problems begin when want button dissapear after putting mouse on whole <a> button in. i'm using bit of code make whole text disappear border stay anyways. .content .bothead a.part:hover {color: transparent; border: transparent;} i managed rid of border using bit of code make disappear. .content .bothead a.part .dole p.button:hover {color: transparent; border: transparent !important;} problem code have hover mouse on button , set transparent color when hover mouse on whole <a> . .content .bothead a.part:hover { color: transparent; border: transpar

VBA if else and columns headers -

hello i'm newbie vba , macros. i've found many interesting hints if else couldn't use them purpose. have sheet many columns , alphanumeric data, need fill empty column under few conditions. try give example following table: tuesday friday colors 10 20 10 b 30 b 20 b 20 i need fill column colors using data columns tuesday , friday, conditions simple, eg: if tuesday=a , friday=10 colors=yellow. if tuesday=a , friday=20 colors=red my problem need every week , columns location can change, example can add column called monday. conditions not change , based on columns tuesday , friday, column should filled named colors. final result should be tuesday friday colors 10 yellow 20 red 10 yellow b 30 green b 20 black b 20 black can please give me advice? i'm not skilled vba related comment useful me. ps: example

sitecore8 - Sitecore glassmapper how to fetch the datasource from the rendering -

need suggestion on sitecore rendering want use glassmodel render item. i have page , has many renderings , each renderings has data source associated it. i know below statement give me current context, not datasource item. var context = new sitecorecontext(); model = context.getcurrentitem<homepage>(); what best option solve query? gave gone through this article. i'm not convinced method i'm using ioc (windsor castle) , have write unit test cases each method. may have mock these objects later. i'm looking approach using interface not class. appreciate help. if controller derived glasscontroller can use getdatasourceitem<i..>() . give datasource.