Posts

Showing posts from June, 2014

vue.js - ie Edge svg text fill render error -

i'm new in svg. when use vue.js change svg's fill attribute. it's position render error! render correctly in other browser! try google , search in stackoverflow,but there not solution solve issue. thx. <svg width="8.4em" height="2.2em" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewbox="0 0 315 70"> <g> <text x="50%" y="50%" :fill="data.fill"> </g> </svg> in ie edge the issue link(ps: reputation under 10,so paste link :) https://i.stack.imgur.com/9i7tf.png but it's ok on ie10,ie11 and demo url : http://codepen.io/wangxizhu/pen/ppxbww

android - Opening a screenshot image in another activity -

i created application take screen shot of current screen , open image in new activity. reason application crashes when want open new activity view picture. here's code: public static bitmap getscreenshot(view view) { view screenview = view.getrootview(); screenview.setdrawingcacheenabled(true); bitmap bitmap = bitmap.createbitmap(screenview.getdrawingcache()); screenview.setdrawingcacheenabled(false); return bitmap; } this onsave method gets image , meant set , display image in activity: public void onsave(view view){ bitmap bm = getscreenshot(view); imageview view= (imageview) findviewbyid(r.id.newview); view.setimagebitmap(bm); intent saveintent = new intent(this, savepicture.class); startactivity(saveintent); } this saveintent activity xml code: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical

c# - How to get the files from the hierarchy of Zip Folder -

i have directory structure this: a.zip - - - 1.dat 2.dat i want read files 1.dat , 2.dat inside directory hierarchy. able read file contentby c#, if file directly inside zip folder due inner directory structure become inaccessible. any appreciated. in advance. not sure how reading zip file contents without example, reading zip file contents using system.io.compression , system.io.compression.filesystem assemblies pretty simplistic. see following example of how read files regardless of subdirectory within zip file: using system; using system.io.compression; namespace zipreader { class program { const string zippath = @"d:\test\test.zip"; static void main(string[] args) { using (var archive = zipfile.openread(zippath)) { foreach (var entry in archive.entries) { console.writeline(entry.fullname); } }

amazon web services - AWS EC2 is running but website is showing connection time out -

i running bitnami wordpress on aws server website working since 2 days stop showing , connection timeout showing. instance ec2 running fine, , have seen ip logs, , nothing suspicious has come up. based on above comments guess issue internal web server make sure web server running fine. , not mean checking ec2 instance state, because possible ec2 instance running web server down, causing issue

regex - Regular expression character class with parenthesis with grep command -

regular expression grep command. example let have file called regular.txt contain date below: $ cat regular.txt july jul fourth 4th 4 so trying match these text input file,using below process method: method 1: match fourth|4th|4 $egrep '(fourth|4th|4)` regular.txt output method 1: fourth 4th 4 method 2: match fourth|4th|4 using optional parenthesis $ egrep '(fourth|4(th)?)` regular.txt output method 2: fourth 4th 4 method 3: match entire file july, jul, fourth, 4th, 4. using command below: $ egrep 'july? (fourth|4(th)?)` regular.txt output method 3: nothing match here. how ? could please me on ? thanks, your july? (fourth|4(th)?) regex matches sequence of patterns, jul followed optional y , space, , 2 alternatives: fourth or 4 optionally followed th substring. if plan match jul or july 3rd alternative, add grouping construct: 'fourth|4(th)?|july?'

mysql - #1286 - Unknown storage engine 'InnoDB' -

please me error #1286 - unknown storage engine 'innodb' running query: create table if not exists `tbl_prize` ( `prize_id` int(11) not null, `prize` int(11) not null, `chance` int(11) not null default '1' ) engine=innodb auto_increment=3 default charset=utf8 collate=utf8_bin; alter table `tbl_prize` add primary key (`prize_id`); alter table `tbl_prize` modify `prize_id` int(11) not null auto_increment,auto_increment=3; insert `tbl_prize` (`prize_id`, `prize`, `chance`) values(1, 100, 1),(2, 200, 1); create table if not exists `tbl_user` ( `user_id` int(11) not null, `reffer_id` int(11) default null, `wallet` varchar(500) not null, `ref_pending` int(11) unsigned not null default '0', `earn` int(11) unsigned not null default '0', `playnum` int(11) unsigned not null, `ip` int(10) unsigned default null, `reset` int(4) unsigned not null ) engine=innodb default charset=latin1; alter table `tbl_user` add primary key

less - How to dynamically define dependencies for a marko template being rendered in express JS route using lasso? -

for example: consider route /theme route should render in theme (read: less color variables) specified route/query param. based on theme parameter, custom js script may need injected. the scripts , styles may or may not included depending on provided parameter (which rules out preconfiguring lasso or using bower.json). means dependencies must specified right before route renders template. i using marko v4 + expressjs + lasso + less + lasso-marko + lasso-less i not posting code it's little on place after trying many things out. please let me know if description not clear enough. try putting sandbox demonstration purposes. update: adding in core files , directory structure sandbox |- components | |- app-main.marko |- dependencies | |- theme1 | |- main.js | |- variables.less | |- theme2 | |- main.js | |- variables.less |- node_modules |- public |- templates | |- base | |- index.marko | |- style.less | |- browser.json |- index.js |- packa

c# - ZeroMQ High Availability over SSL -

i have worked on poc zeromq project in c# language in had 1 zeromq server , 1 zeromq client connected through sockets (tcpip) data exchange , worked well. now actual project require 2 things: high availability secure transport (like https) i have checked documentation of zeromq version 4 , seems started support encryption there still no support https. for high availability planning prepare 2 machines server not sure how routing work did not find relative sample code that. kindly these 2 points.

python - scrapy error processing url -

hi i'm new python , scrapy, i'm trying code spider can't find error or solution error while processing starting url, don't know if it's problem xpath or other thing, of threads found talks wrong indentation, not case. code: import scrapy scrapy.exceptions import closespider scrapy_crawls.items import vino class bodebocaspider(scrapy.spider): name = "bodeboca" allowed_domains = ["bodeboca.com"] start_urls = ( 'http://www.bodeboca.com/vino/espana', ) counter = 1 next_url = "" vino = none def __init__(self): self.next_url = self.start_urls[0] def parse(self, response): sel in response.xpath( '//div[@id="venta-main-wrapper"]/div[@id="venta-main"]/div/div/div/div/div/div/span'): #print sel # href a_href = sel.xpath('.//a/@href').extract() the_href = a_href[0]

jquery - Settimeout() not working synchronusly -

i have page submitbutton.when submit button clicked,i need show dialog box notification messages 2 seconds.after 2 seconds,i need redirect page location. settimeout(function(){ $('#wrapper_dialog').dialog('close'); }, 2000); //after popup closes,i need redirect page window.location = "?load=parents/communication"; when this,dialog comes , page asynchronously leading next page. settimeout(function(){ $('#wrapper_dialog').dialog('close');}, 2000).then(function(){ window.location = "?load=parents/communication"; }); this not working. settimeout doesn't return promise, returns number; there's no then function available on it. just put location assignment after call close dialog, within settimeout callback: settimeout(function(){ $('#wrapper_dialog').dialog('close'); window.location = "?load=par

wifi - Microchip Wi-Fi MRF24WN0MA -

i using following devices microchip on embedded system: usb starter kit iii (pic32mx470f512l) + starter kit i/o expansion board mrf24wn0ma. so use spi1 channel communication 6-axis sensor (all works fine). want transmit these data through spi2 wifi module (mrf24wn0ma), chose because need wireless module minimum data rate of 1mbits/s , reliable communication. i using mplab harmony v2_02_00b configure wifi module. have tested several example projects provided microchip "wifi_easy_configuration", "wifi_ap_demo" , don't work me. followed this tutorial migrate project toward pic32 due lack of documentation in datasheet of module , several other issues, switched mrf24j40ma has lower data rate complete datasheet (registers included!).

Jira cloud add-on configuration page -

Image
i have troubles when creating configuration page plugin (add-on). use jira cloud. i use module configurepage display configure button when open plugin info on manage add-ons page. when click on button configuration page opens , looks works expected. but still have issues it. configuration page opens full page, need opens panel (see attach) i managed display web-section , web-item on left panel of add-ons page, can't open configure page. redirect me https://_hash_.ngrok.io/configure , wanted redirect https://_sub-domain_.atlassian.net/plugins/servlet/ac/com.company.jira-plugin/configure my atlasian-connect.json file (only modules): "modules": { "configurepage": { "url": "/configure", "name": { "value": "code quality configure page" }, "key": "config" }, "webitems": [ { "location":

python - Data Appending issue -

i trying add combination of words in existing string using python . achieve have written below code. import subprocess subprocess import popen, pipe cat = subprocess.popen(["hadoop", "fs", "-cat", "/user/cloudera/rank_t/*"], stdout=subprocess.pipe) dumpoff = popen(["hadoop", "fs", "-put", "-", "/user/cloudera/data"],stdin=pipe) obrind = "0" line1 = "" line in cat.stdout: runnno= line.split('|')[0] code = line.split('|')[1] idval = line.split('|')[2] if (code == "obr"): obrind = runnno line =line + "|"+"obr_"+obrind dumpoff.stdin.write(line) print(line) my sample data: 1|orc||4002c3|4002c3||||||20141231|||1962 2|obr|1||4002c3|197 hp, rx 16/l|||20141|20141||||||||196248||rj||3711028|||||f 3|obx|1|st|2263||negative intraepithelial l.||||||f|||20141231|rj @#l 4|nte|1|l|negative i

Zeppelin runs with sudo but gives error for non-root user -

i running apache zeppelin 0.6.2 on local machine. when fire zeppelin-daemon.sh start other user(not root) give me below error. java hotspot(tm) 64-bit server vm warning: ignoring option maxpermsize=512m; support removed in 8.0 slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/usr/local/zeppelin-0.6.2-bin-all/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/usr/local/zeppelin-0.6.2-bin-all/lib/zeppelin-interpreter-0.6.2.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. slf4j: actual binding of type [org.slf4j.impl.log4jloggerfactory] error statuslogger no log4j2 configuration file found. using default configuration: logging errors console. exception in thread "main" java.lang.incompatibleclasschangeerror: implementing class @ java.lang.classloader.defineclass1(native method) @ java.lang.classl

redux-form doesn't get submitted -

i have strange bug in app. want let user update name of group via redux form. exchanging old name input field works without problem, when click on submit, nothing happens. strange me, because using same form create group in first place , there works totally fine. import react, { component } 'react'; import { connect} 'react-redux'; import { deleteaccessgroup, editaccessgroup } '../actions/useractions'; import { showmodal } '../actions/modalactions'; import * types '../actions/index'; import accessgroupcreation '../components/accessgroupcreation'; class accessgroupelement extends component { constructor(props) { super(props); this.state = { toggle: false } } handlesubmit = values => { this.props.editaccessgroup(values); console.log(this.state, "das sind die values: ", values); this.edit; console.log(this.state); } edit = () => this.setstate({toggle: !this.state.toggle});

sublimetext3 - Is there a root keyword in JavaScript or why does Sublime display it like this? -

Image
i used variable called root in recent js project, , sublime3 displayed this: so i'm wondering if there root keyword in js, , if does... otherwise i'd know way stop sublime3 displaying differently... console says referenceerror: root not defined in type in there. hopefully can :) root used variable in node.js deprecated in v6. the declaration comes this file in sublime. update : remove syntax rule, install packageresourceviewer per instructions here , open javascript.sublime-syntax file, find word root (there's one) , remove (and following | character). note you'll need run sublime administrator on windows in order edit file.

swift - Background REST API call in ios with timer -

i want know possible call apis particular time interval if app killed , not in background. func application(_ application: uiapplication, performfetchwithcompletionhandler completionhandler: @escaping (uibackgroundfetchresult) -> void) { above code not working timer. fired once.

Python timeit or custom Timer for production -

we using custom timer class (sample given below) compute , log time taken various pieces of modules in our tornado app. exploring timeit module , wonder if should make use of instead. i understand timeit used ad-hoc testing of piece of code. but, our scenario got log execution time every time method/ piece of code called, in our logs. i find following points on timeit limiting blending in our current app code: it expects string function call. makes weird call function every time string, passing timeit. i don't find direct method return value of method when pass function timeit. there stack overflow discussion same. but, looks more workaround , parsing tuple every time sounds clumsy. should stick our custom timer class? if not, how include timeit code, without disrupting code? any appreciated! thank in advance. sample timer class import time class timer(object): def __init__(self, ...): ... def __enter__(self): self.start = time.time(

python - How to use pretrained Word2Vec model in Tensorflow -

i have word2vec model trained in gensim . how can use in tensorflow word embeddings . don't want train embeddings scratch in tensorflow. can tell me how example code? let's assume have dictionary , inverse_dict list, index in list corresponding common words: vocab = {'hello': 0, 'world': 2, 'neural':1, 'networks':3} inv_dict = ['hello', 'neural', 'world', 'networks'] notice how inverse_dict index corresponds dictionary values. declare embedding matrix , values: vocab_size = len(inv_dict) emb_size = 300 # or whatever size of embeddings embeddings = np.zeroes((vocab_size, emb_size)) gensim.models.keyedvectors import keyedvectors model = keyedvectors.load_word2vec_format('embeddings_file', binary=true) k, v in vocab.items(): embeddings[v] = model[k] you've got embeddings matrix. good. let's assume want train on sample: x = ['hello', 'world

delphi - Create FMX window with MessageBox style -

Image
i have question: how can create fmx window make looks showmessage window? showmessage (contain move , close items): fmx window: bordericons := [tbordericon.bisystemmenu]; borderstyle := tfmxformborderstyle.single; what need: remove icon , delete disabled menu items on windows, showmessage() displays system dialog using win32 api messageboxindirect() function. to customize default system menu of standard fmx form, have drop down win32 api layer , manipulate system menu directly. means getting hwnd of form (you can use formtohwnd() function in fmx.platform.win unit) , use win32 api getmenu() , deletemenu() functions. to remove form's icon, use win32 api sendmessage() function send hwnd wm_seticon message lparam set 0. or use setwindowlongptr() enable ws_ex_dlgmodalframe window style. override form's virtual createhandle() method perform these operations, eg: interface ... type tform1 = class(tform) ... {$ifdef mswindows

Double clicking on a cell in Excel, open source file of that line on userform -

i trying , don't know if it's possible. i have 20 progress reports of projects. these projects being updated users use userform. once week, have few macros running goes each of them, copy data , put them in project summary in different workbook. want able double click on first cell in given row( there's 200 projects) in project summary workbook , opens specific project in existing userform users using. want open @ source file not in data dump of project summary worksheet. is there way can this? edit: i have tried this: sub worksheet_beforedoubleclick(byval target range, cancel boolean) dim cell range if intersect(target, range("a:a")) nothing else each cell in range("e:e") if (cell.value = "a, b") workbooks.open filename:= _ "filepath", password:="...", readonly:=true progressreport.show end if next cell end if end sub i willdo each of 20 other progress report based

C++ Math with diffrent types, when do i cast? -

while writing short program arduino pro mini (atmega328, 8mhz) thought math part , want optimize it, don't know wich way best. since i'm working on 8bit without dedicated float math, , space(sram) rare, want have in integer-math possible (is correct?) here part of code, have not included casts now, keep clean. //in future can change (that's why no "const") uint8_t deadband = 2; uint8_t amp_fwd = 20; uint8_t amp_break = 5; int8_t throttle; //this read potentiometer if (throttle > deadband){ outputfwd(throttle * amp_fwd / 127); } else if (throttle < -deadband) { outputbreak((throttle + 127) * amp_break / (127 - amp_break)); } else { outputfwd(0); outputbreak(0); } void outputfwd(float ampere){} // positive values void outputbreak(float ampere){} // positive values some explanation: it's control motor. reads value (throttle) potentiometer. on mid throttle (0 127) drives fwd output , below (-127 0) drives breaks. have included deadb

multithreading - Networking and multihreading in C++. Errors and how to make my code design better? -

i trying create simple local server accepts connections on different thread. trying create simple backup program files(kinda dumbed down cloud house). have setup networking things in different classes. getting error when trying run accept on different thread. have not included required includes here save space , have not completed final code right wanna make working can @ least accept connections when use main server class's accept(down below) without thread compiles doesn't work expected not wait connection request prints out -1 fd. when put thread following compiler error. thank time. bipgen@genbox:~/documents/college projects/trans_lair$ g++ -std=c++11 server.cpp server_socket.cpp client.cpp in file included /usr/include/c++/5/thread:39:0, server.cpp:9: /usr/include/c++/5/functional: in instantiation of ‘struct std::_bind_simple<void (*(int))(server&)>’: /usr/include/c++/5/thread:137:59: required ‘std::thread::thread(_callable&&, _

ms access - One to many relationship turned into one to one relationship -

i made copy of access file. on copy have 1 table having one-to-many relationship other tables. on original access file, decided redo 1 of tables. deleted records other tables start anew. able redo one-to-many relationship except 1 recognized one-to-one. why happening?

angular material - Exist similar method like mdt-row={'data' : messages} but for md-table? -

i'm new angular material. want make table data received server, don't know how. saw example : <mdt-table table-card="{title: 'sms list'}" mdt-row="{ 'data': messages, 'column-keys': [ 'id', 'title', 'text', 'status' ] }"> <mdt-header-row> <mdt-column align-rule="left">id</mdt-column> <mdt-column align-rule="right">titlu</mdt-column> <mdt-column align-rule="right">detali8i</mdt-column> <mdt-column align-rule="right">status</mdt-column> </mdt-header-row> </mdt-table> but use method (with md-table ) : <table md-table md-row-select="operation=='view'"

regex - Perl: Find line with matching string(str1) and only in those matched lines, replace one string(str2) with specific string(str3) -

i have 1 file a.txt contents follow: a aa aaa b bb value = 11 xyz c cc ccc b bb value = 222 abc d dd ddd i have find string "bb". once matching line found have replace "value = xxx" "value = 77" here, xxx integer number of digit(11,222 in above case). i have tried below perl command: perl -n -e 'print; if (m/\bbb\b/) { s/value = (\d+)/value = 77/g; print; }' < a.txt it gives me output as: a aa aaa b bb value = 11 xyz b bb value = 77 xyz c cc ccc b bb value = 22 abc b bb value = 77 abc d dd ddd here looking in-place replacement, instead of new line required changes. expecting output follow: a aa aaa b bb value = 77 xyz c cc ccc b bb value = 77 abc d dd ddd can me here in updating command? also 1 more quick question, can update above command in way can search string "bb" , matching lines remove string "value = xxx" matching line. xxx integer number of digit. you print twice when have match. if d

android - get recyclerview item index in the middle of the screen -

i have recyclerview item, want index of item middle of screen. can item index middle of first item visible , last item visible. here's screenshot: image and here's code mylist = (recyclerview) v.findviewbyid(r.id.frag_penampilanobat_pilih_bentuk); final linearlayoutmanager layoutmanager = new linearlayoutmanager(getactivity(), linearlayoutmanager.horizontal, false); display display = getactivity().getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); itemwidth = getresources().getdimension(r.dimen.item_width); padding = (size.x - itemwidth) / 2; firstitemwidth = getresources().getdimension(r.dimen.padding_item_width); allpixels = 0; extraitemsadapter bentuk_adapter = new extraitemsadapter(0, clone, padding); mylist.setadapter(bentuk_adapter); mylist.addonscrolllistener(new recyclerview.onscrolllistener() { @override public void onscrolled(recyclerview recyclerv

batch file - why is vba in outlook adding an extra line for no reason? -

Image
i want receive email in outlook, use outlook rule run batch file in windows takes input subject , body of email (this means 2 arguments). if run line directly c:\users\me\desktop\firstplink.bat "subjectparta subjectpartb" "bodya bodyb", correct thing. there 2 arguments, in quotes. have , b there @ least 2 words in subject , in body. my code below right thing, seems adding new line messing batch file. why added new line? sub firstplink(item outlook.mailitem) strsubject = item.subject msgbox strsubject strbody = item.body msgbox strbody strprogramname = "c:\users\me\desktop\firstplink.bat" strall = strsubject & " " & strbody = """" & strprogramname & """ """ & strsubject & """ """ & strbody & """" msgbox call shell("""" & strprogramname & "&q

python - Use multiple foreign keys -

i'm beginner on django , bit more advanced on python. i'm amazed django , i've been playing week now. looked lot of tutorials , stackoverflow questions/answers , discovered lot. however, i'm still little bit lost when comes onetomany / foreign key relationships , way access it. had @ "library/book" example of official documentation still trying figure out how solve below problem. [explanations] i have users (already created) to django-built users, added profile (onetoonefield) the profile contains 1 item each user: title (foreign key) the title in turn comes existing list of available titles finally, have opportunities (a class) has 1 user linked (foreign key) in models.py class profilestatus(models.model): """ table of available titles users """ status = models.charfield(max_length=100) def __str__(self): return self.status class profile(models.model): """ add title exi

ffmpeg - Why PTS and DTS are same in my stream? -

i testing mp4 file h264 video using ffprobe. using following command frame information. ffprobe -i <input_mp4_file> -show_frames -select_streams v i following output. [frame] media_type=video stream_index=0 key_frame=1 pkt_pts=0 pkt_pts_time=0.000000 pkt_dts=0 pkt_dts_time=0.000000 best_effort_timestamp=0 best_effort_timestamp_time=0.000000 pkt_duration=512 pkt_duration_time=0.033333 pkt_pos=48 pkt_size=513516 width=1920 height=1920 pix_fmt=yuv420p sample_aspect_ratio=1:1 pict_type=i coded_picture_number=0 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 [/frame] [frame] media_type=video stream_index=0 key_frame=0 pkt_pts=512 pkt_pts_time=0.033333 pkt_dts=512 pkt_dts_time=0.033333 best_effort_timestamp=512 best_effort_timestamp_time=0.033333 pkt_duration=512 pkt_duration_time=0.033333 pkt_pos=513564 pkt_size=3299 width=1920 height=1920 pix_fmt=yuv420p sample_aspect_ratio=1:1 pict_type=p coded_picture_number=1 display_picture_number=0 interlace

c++ - How to use std::cout with mini-gmp mpz-t? -

just title suggests, i'm having issues when trying print mpz_t values using std::cout mini-gmp. can use mpz_get_si convert integer, , seems working, defeats purpose of gmp altogether. when use std::cout seems print memory address of mpz_t variable. have solution printing mpz_t values using mini-gmp? by documentation seems class overrides cout is, should supported https://gmplib.org/manual/c_002b_002b-formatted-output.html note: feature loss due mini-gmp vs gmp although caution: "but note ostream output (and istream input, see c++ formatted input) overloading available gmp types , instance using + mpz_t have unpredictable results. classes overloading, see c++ class interface." aside if getting memory address think there should value, make sure aren't dealing mpz_t* , dereference , see if type error. it's hard tell without seeing code

.net - Build errors when multi-targeting in csproj file -

i'm trying build class library multi-targets both .net 4.5.1 , .net standard 1.3. according the documentation , should able this: <propertygroup> <targetframeworks>net451;netstandard1.3</targetframeworks> </propertygroup> however, when try build, these odd errors: cannot infer targetframeworkidentifier and/or targetframeworkversion targetframework='net451'. must specified explicitly. msb3645 .net framework v3.5 service pack 1 not found. in order target ".netframework,version=v1.3", .net framework v3.5 service pack 1 or later must installed. msb3644 reference assemblies framework ".netframework,version=v1.3" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. note assemblies resolved global assembly cache (gac) , used in place of reference assemblies. therefore assembly may not correctly targeted

Ruby on Rails - undefined method - Model can't be accessed by Controller -

solved - i've added if statement in html.erb before displaying profile avatar , it's appearing. thank mark , holger help. i'm trying make users appear in league table i'm getting error message saying there undefined method in leaguescontroller file. i've tried following class names controller file - leaguescontroller < application controller , leaguescontroller < userscontroller (i know method has been defined in class, post both below). 'index' matches html.erb file name. leaguescontroller (i've tried user.includes(:profile).order(etc) still doesn't pick user fields) class leaguescontroller < applicationcontroller def index @lmsusers = user.order('last_sign_in_at desc') @mvpusers = user.order('sign_in_count desc') @lmsuser_position = user.order('last_sign_in_at desc').find_index(current_user) @mvpuser_position = user.order('sign_in_count desc').find_index(current_user) end end

Logstash metric filter for log-level -

can please me metric filter. want set logstash check log-level= error every 5s , if log-level = error exceeds more 1 , should send email. using logstash 2.2.4 input { file { path => "/var/log/logstash/example" start_position => beginning } } filter { grok{ match => { "message" => "\[%{timestamp_iso8601:timestamp}\]\[%{loglevel:log-level}\s*\]" } } if [log-level] == "error" { metrics { meter => [ "log-level" ] flush_interval => 5 clear_interval => 5 } } } output { if [log-level] == "error" { if [log-level][count] < 1 { email { port => 25 address => "mail.abc.com" authentication => "login" use_tls => true => "alerts@logstash.com" subject => "logstash alert" => "siya@abc.com" via => "

sas - PROC FREQ on multiple variables combined into one table -

i have following problem. need run proc freq on multiple variables, want output on same table. currently, proc freq statement tables erstatus age race, insurancestatus; calculate frequencies each variable , print them on separate tables. want data on 1 table. any appreciated. thanks! p.s. tried using proc tabulate, didn't not calculate n correctly, i'm not sure did wrong. here code proc tabulate. variables categorical, need know n , percentages. proc tabulate data = bcanalysis; class erstatus prstatus race tumorstage insurancestatus; table (erstatus prstatus race tumorstage) * (n colpctn), insurancestatus; run; the above code not return correct frequencies based on insurancestatus 0 = insured , 1 = uninsured, proc freq does. doesn't calculate correctly rowpctn. way can proc freq calculate multiple variables on 1 table, or proc tabulate return correct frequencies, appreciated. here nice image of output in simplified analysis of erstatus , insurancestatus. can s

AngularJS ng-repeat update does not apply when object keys stay the same? -

i'm trying make minimal fancy angularjs tutorial example, , running issue after updating entire tree model (inside scope of ng-change update), template driven top-level ng-repeat not re-rendered @ all. however, if add code $scope.data = {} @ strategic place, starts working; display flashes instead of being nice , smooth. , it's not great example of how angularjs automatic data binding works. what missing; , right fix? exact code - select country dropdown - jsfiddle not work: http://jsfiddle.net/f9zxt36g/ jsfiddle works flickers: http://jsfiddle.net/y090my10/ var app = angular.module('factbook', []); app.controller('loadfact', function($scope, $http) { $scope.country = 'europe/uk'; $scope.safe = function safe(name) { // makes safe css class name return name.replace(/[_\w]+/g, '_').tolowercase(); }; $scope.trunc = function trunc(text) { // truncates text 500 chars return (text.length < 500) ? text : text.substr(0,

javascript - Webpack: how to export css file from css-loader? -

i have app structure this: /src /app.js /styles.css /images /img.png the app.js file content is: const styles = require('./styles.css'); console.log(styles) // => here want have url css file under public folder the src/styles.css file content follows: .element { background: url(./images/img.png); } so, js file requires css file. , css file requires png file. i want files exported public folder: public/app.js const styles = 'styles.css' // => path public/styles.css console.log(styles) pubic/styles.css .element { background: url(img.png); /* path public image file */ } public/img.png (source image copy) the filenames not important. public folder output important. css file exported separate file, contains proper path image. js file knows path of public css file. if there no image present, file-loader used import css file. in case css file has first processed css-loader in order resolve url() path. app

list - Control main thread with multiple Future jobs in scala -

def fixture = new { val xyz = new xyz(spark) } val flist: scala.collection.mutable.mutablelist[scala.concurrent.future[dataset[row]]] = scala.collection.mutable.mutablelist[scala.concurrent.future[dataset[row]]]() //mutable list of future means list[future] test("test case") { val tasks = (i <- 1 10) { flist ++ scala.collection.mutable.mutablelist[scala.concurrent.future[dataset[row]]](future { println("executing task " + ) val ds = read(fixture.etlsparklayer,i) ds }) } thread.sleep(1000*4200) val futureoflist = future.sequence(flist)//list of future job in future sequence println(await.ready(futureoflist, duration.inf)) val await_result: seq[dataset[row]] = await.result(futureoflist, duration.inf) println("squares: " + await_result) futureoflist.oncomplete { case success