Posts

Showing posts from March, 2013

html - Height and weight attributes being ignored by css -

we updates our sites design, can't figure out why css ignoring height , width? for instance, youtube embedded videos don't stay @ 625x352 <iframe width="625" height="352" src="https://www.youtube.com/embed/jpcfaqiyui4" frameborder="0" allowfullscreen></iframe> and images original width of 155px , height of 250px don't transform 155x180 specified in html. <a href="http://my.jpg" target="_blank"><img src="http://thumbnail.jpg" width="155" height="180" /></a> anybody has idea how fix this? for player remove width 100% iframe { /* width: 100%; */ min-width: 0; max-width: 100%; } or can add inline css "width: initial;" iframe if can not play stylesheet <iframe width="625" height="352" width: initial;"> </iframe>

function - Continuous PowerTransform/BoxCox Transformation in R -

Image
i have dataset need transfer normal distribution. first, generate reproducible dataset. df <- runif(500, 0, 100) second, define function. function continue transforming d.f. until p > 0.05. transformed d.f. generated , named y. boxcoxtrans <- function(y) { lambda <- 1 constant <- 0 while(shapiro.test(y)$p.value < 0.10) { constant <- abs(min(y, na.rm = true)) + 0.001 y <- y + constant lambda <- powertransform(y)$lambda y <- y ^ lambda } assign("y", y, envir = .globalenv) } third, test df shapiro.test(df) shapiro-wilk normality test data: df w = 0.95997, p-value = 2.05e-10 because p < 0.05, transform df boxcoxtrans(df) then gives me following error messages, error in qr.resid(xqr, w * fam(y, lambda, j = true)) : na/nan/inf in foreign function call (arg 5) what did wrong? you use box-muller transformation generate approximately normal distribut

where is scala get() method been defined -

def twosum(param1: list[int], param2: int) = { val gb = ((param1 combinations 2 tolist) find (_.sum == param2) get) val gb2 = gb map (param1.indexof(_)) sorted val index1 = gb2(0)+1 val index2 = gb2(1)+1 println(s" index1 = ${index1}, index2 = ${index2}") } in code, it's using @ second line. question scala get() method been defined. thanks find returns option . you therefore calling get method of option class.

java - Downloading file via SFTP using JSCH (android) -

i'm trying make app downloads file server using sftp. whenever run debugger, seems fine no errors. log says has downloaded specified file. however, can't seem find file supposedly downloaded anywhere in device. help? import android.app.activity; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import com.jcraft.jsch.channel; import com.jcraft.jsch.channelsftp; import com.jcraft.jsch.jsch; import com.jcraft.jsch.jschexception; import com.jcraft.jsch.session; import com.jcraft.jsch.sftpexception; import java.util.list; public class mainactivity extends activity { private string user = "user"; private string pass = "pass"; private string host = "hostname"; private int portnum = 22; private string filename = "sample.txt"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinsta

java - Text moving animation -

Image
i new animations in javafx, , basic idea of how works; need starting keyframe , and ending one, play it. what want have list of strings, say, "0, 1, 2, 3, 4, 5...10", , variable, index . want have 3 of them on screen @ time inside 3 different text objects: 0 1 2 in example above, index = 0 . if index = 1 , this: 1 2 3 you idea, want do, every time index increments (it have property ), there animation of numbers trading spaces. so (symbol numbers represent fading): index = 0 : 0 1 2 index = 1 : ) 1 2# frame --- : ) 1 2 # frame --- : )1 2 # frame --- : 1 2 3 so in theory, lists stores these numbers infinite can't (shouldn't) have separate text object each number. can't figure out how should done, keyframes moving text object complicates things. here sample. import javafx.animation.*; import javafx.application.application; import javafx.beans.binding.stringbinding; import javafx.beans.property.*; import jav

html - How to stack Second Div on First in Responsive (CSS)? -

i trying stack div 1 & div 2 (which side side in desktop mode), stack div 2 follwed div 1 below. used floats cannot make work. please find attach image short description. desktop view div 1(img) & div 2(txt) tablet view 740px (stack div2 first & div 1) div 2(txt) div 1(img) if understand question you're asking, want have 2 divs, div1, , div2, next each other on desktop, on mobile have div2 stack on top of div1. to this. you'll want have html code div2 first in index.html file followed div1. specify float:right on desktop. i've attached fiddle below better understanding. http://jsfiddle.net/d2o7zn1v/ in fiddle, div2 remain right of div1 on desktop stack on top of div1 on screen size below 600px. i hope helps!

html - Unordered list elements won't position -

i built slide-out menu using jquery, list containing menu items has been behaving strangely. no matter how change css, various list elements stay in same place, right on top of each other. page in question this. .slide-menu { width: 30%; left: -30%; position: absolute; z-index: 1; background-color: white; } .dlink { font-size: 16px; position: absolute; width: 30%; display: block; } #slide-list{ list-style: none; top: 0%; margin-left: 0px; } .sli-list-item { width: 30%; } #slide-panel { height: 100%; top: 0%; } this relevant css. change .dlink class this: .dlink { font-size: 16px; position: relative; width: 30%; display: block; } position: absolute; made them line on top of each other.

how to add loop in c++ -

could me add loop program? here's code: cout << "what do?" "\n"; cout << "\n"; cout << "(press enter...)"; cin.ignore(); cout << "\n"; cout << "stay in bed?" "\n"; cout << "go bathroom?" "\n"; cout << "go downstairs?" "\n"; cout << "\n"; string answer; getline(cin, answer); if (answer == "stay in bed", "stay in bed") { cout << "you lay there, motionless. silent."; } else if (answer == "go bathroom", "go bathroom") { cout << "you , walk across hall bathroom"; } else if (answer == "go downstairs", "go downstairs") { cout << &quo

Javascript eventlisteners override other buttons? -

i've run problem using eventlisteners , javascript (though onclick seems have same effect). i have in html <input id="srch" type="button" value="zoek gebruikers!" onclick="searchbutton()"> now, worked fine , executes expected javascript code. but, when add in javascript function var addbutton = document.createelement("input"); addbutton.setattribute("id","openaddmenu"); addbutton.type = "button"; addbutton.value = "search"; addbutton.innerhtml = "zoek"; addbutton.addeventlistener('click',searchfriendsasync(),false); now initial button wil try execute 'searchfriendasync()' well. i'm quite inexperienced javascript, i'm sure it's basic i'm missing. yet search results on google find answers regarding adding 1 event multiple buttons etc, .. opposite of want. need multiple buttons different events - buttons generated using javascript.

How do I empty a python pandas dataframe? -

very new pandas please let me know how empty data-frame of data please? either use .loc set values none df.loc[:] = none or if want more explicit empty_df = pd.dataframe(data=none, columns=full_df.columns, index=full_df.index) speed wise .loc lot faster, unless doing many many times, or dataframe large, not see difference. n = 500000 values = np.random.uniform(size=(n, 5)) def using_loc(): df = pd.dataframe(values, columns=list('abcde')) df.loc[:] = none %timeit using_loc() # 100 loops, best of 3: 3.49 ms per loop def new_df(): df = pd.dataframe(values, columns=list('abcde')) pd.dataframe(data=none, index=df.index, columns=df.columns) %timeit new_df() # 10 loops, best of 3: 45.4 ms per loop

linux - Packages have unmet dependencies -

so understand there quite few different posts topic. have been of them , none of them helping me problem. please me out? thank in advance. following packages have unmet dependencies: libreadline6-dev : depends: libtinfo-dev not going installed libsqlite3-dev : depends: libsqlite3-0 (= 3.8.6-1) 3.8.7.4-1 installed libssl-dev : depends: libssl1.0.0 (= 1.0.1f-1ubuntu9.8) 1.0.1f-1ubuntu11.4 installed recommends: libssl-doc not going installed libxml2-dev : depends: libxml2 (= 2.9.1+dfsg1-4ubuntu1) 2.9.2+dfsg1-3 installed libxslt1-dev : depends: libxslt1.1 (= 1.1.28-2build1) 1.1.28-2build2 installed libyaml-dev : depends: libyaml-0-2 (= 0.1.6-1ubuntu0.1) 0.1.6-3 installed sqlite3 : depends: libsqlite3-0 (= 3.8.6-1) 3.8.7.4-1 installed zlib1g-dev : depends: zlib1g (= 1:1.2.8.dfsg-1ubuntu1) 1:1.2.8.dfsg-2ubuntu1 installed e: unable correct problems, have held broken packages.

Javascript filter array -

why following function return undefined when executed? seems though filter function indeed return appropriate object i'm not seeing why can't passed callback function. i'm new js. function getuserbyid(usersarr, userid, cb){ cb((usersarr.filter(function(el){ return el.id === userid; })[0])); } getuserbyid(users, '15a', function(user){ return 'the user id 15a has email of ' + user.email + ' name of ' + user.name + ' , address of ' + user.address; }); var users = [ { id: '43d', email: 'james@gmail.com', name: 'james', address: '16 n' }, { id: '15a', email: 'carry@gmail.com', name: 'carry', address: '14 n' }, { id: '87t', email: 'jeff@gmail.com', name: 'jeff', address: '23 n' }, ]; if have array of objects, , 1 or more of objects have id property assigned '15a&

android - Does opening an activity from a dialog fragment dismisses the dialog fragment? -

i have class inheriting dialogfragment: import org.xwalk.core.*; // ... public class webviewdialogfragment extends dialogfragment { private xwalkview webview; public static final string log_tag = "webviewdialogfragment"; private string url; private webviewjavascriptinterface javascriptinterface; // constructor use set url. public webviewdialogfragment(string url, webviewjavascriptinterface javascriptinterface) { this.url = url; } public webviewdialogfragment() { log.d(log_tag, "webviewdialogfragment empty constructor called."); } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.d(log_tag, "setting fullscreen mode"); setstyle(dialogfragment.style_normal, r.style.sagobizwebviewfullscreentheme); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate)

DropDownList refresh on second attempt in gridview asp.net c# -

i facing problem while adding new records selecting drop down items. gridview in select addresstype, country city cityarea , on using dropdown. in first attempt working fine, on second attempt when select country reset selected item. http://i.stack.imgur.com/gottu.jpg as can see in above picture, on second attempt going select country. select country refresh. in below picture: http://i.stack.imgur.com/obet5.jpg please me find solution. thanks. here code: <asp:templatefield headertext="country" headerstyle-width="14%"> <itemtemplate> <asp:label id="lblcountry" text='<%# databinder.eval(container, "dataitem.country.description") %>' runat="server"> </asp:label> </itemtemplate> <footertemplate> <asp:updatepanel r

ember.js - serializer in unit test doesn't process json -

the serializer in unit test not processing json @ all, works expected in application. yeah, wrote afterwards, question - why it's not working? tried create in place, inherit restserializer, create models in place, none of worked. maybe can give clue? update looks begins in isprimarytype: function (store, typename, primarytypeclass) { var typeclass = store.modelfor(typename); return typeclass.modelname === primarytypeclass.modelname; }, last string returns false, because of primarytypeclass.modelname undefined serializer unit test import ds 'ember-data'; import { moduleformodel, test } 'ember-qunit'; import setupstore 'app/tests/helpers/setup-store'; import profile 'app/models/profile'; import email 'app/models/email'; import address 'app/models/address'; import profileserializer 'app/serializers/profile'; var env; moduleformodel('profile', 'unit | serializer | profile', { need

c# - Check ComboBox (Xceed WPF Toolkit), How to get short name to display from database? -

this first post , relative newbie regarding things programming related. hope patient me. have wpf application working on. current issue check combobox using. when make selections out of list pulled sqlite database file, full name of selection displayed. change , have short name database appear in combobox area while leaving long descriptive name in dropdown portion. thought working display , value member out, have yet working. can 1 or other changing column index reference sqlite db. combobox multi-select item , needs update selections made or cleared. below bit of code have populates combobox. unable attach image of data due low rep numbers. column 0 full descriptive name, column 1 has short name interested in displaying. public void fill_modality() { sqliteconnection sqlitecon = new sqliteconnection(dbconnectionstring); try { sqlitecon.open(); string query = "select * modality_list";

sql - Are there any shortcuts for creating a table variable to match the columns in a view? -

i need create table variables within procedures, store top 25 rows view processing. i need store these small batches in variables temporarily, because i'm performing numerous operations modify data within underlying tables, , of these operations cause rows no longer appear within view based on view criteria (this design). i need keep data around entire processing session, , can't rely on view remain consistent through operation. the problem is, since we're doing in many instances across multiple databases, if ever make changes columns in of our views, code becomes bug-prone since have make sure modify relevant table types - without making typos or mistakes, or overlooking anything. so question is, can declare table variables (or table types, if necessary) stating "match current columns in view?" that make things easier, since automatically keep relevant table variables in sync current layout of views in question, , eliminate headache comes trying k

c# - Use MachineKey.Protect Outside of ASP.NET -

i need encrypt cookie outside of asp.net (console app, powershell etc.) since cookie read mvc application needs encrypted same key. i can use machinekey class outside of asp.net can't specify encryption type or key these outlined in application's web.config doesn't exists in context. since there no config key randomly generated everytime. how can encrypt data using same decryption key below guaranteed decrypted later mvc application? <machinekey validationkey="207fe3b8e01d0ff81871d7f3efc082a14341a7820942d24d3bef8954cae53d860f46fbcdda73f752ce1052d475d442cc8c14fc814739a757d52d152ef5ee179e" decryptionkey="326c47e59eb1b38aea84dbc9633bb770c318a740e477c82f3a8d9506f030d953" validation="sha1" decryption="aes" /> some possible ideas. just use app.config console app , mirror machine key web.config of main project. grab machine key programatically. need path of machine key (perhaps store in db, windows regis

php - Complex (or very, very simple) MySQL query? -

i'm making database handles dialogue translation projects. i have project table, dialogue table, , translation table. each entry in each table has id column. dialogue has projectid column indicates project dialogue part of. translation has dialogueid column indicates dialogue entry being translated. so explain problem, here's pseudo-query i've constructed: select * translation (translation.dialogueid refers dialogue dialogue.projectid = x) basically, want fetch translation entries project x. since there's no direct route project -> translation, i'd have go through project -> dialogue, dialogue -> translation. i've opted add projectid translation table in meantime, little clunky. if know id of project (x) use: select t.* translation t, dialogue d t.dialogueid = d.id , d.projectid = x if don't know project id know it's name (x) or can refer it, can use: select t.* translation t, dialogue d, project p

android - Why are permissions being automatically added to my AndroidManifest when including Google Play Services library -

i noticed following permissions automatically added when use following in build.gradle file compile 'com.google.android.gms:play-services:7.5.0' this did not occur earlier versions of play-services. have solution remove these unwanted permissions? i using ads function (internet , accessnetwork_state). got no need location , use_credentials permissions. how remove these unwanted permissions? i noticed 'manifest-merger-xxx-debug-report.txt' file contains following ...<snipped bunch of other merges> merged com.google.android.gms:play-services-maps:7.5.0:22:5 android:name added com.google.android.gms:play-services-maps:7.5.0:22:22 uses-permission#android.permission.access_coarse_location added com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 merged com.google.android.gms:play-services-maps:7.5.0:23:5 android:name

linux - View log files real time in Tera term and pause terminal output for a while -

in tera term (terminal emulator) , viewing log files real-time. used command "tail -f ". question ... when saw log line want read, pause terminal output while without stopping "tail" process. i heard there's way in tera term. cannot find out how do. can tell me? in advance. usually terminal configured honor xon/xoff, control q , control s , e.g., $ stty -a speed 38400 baud; rows 40; columns 80; line = 0; intr = ^c; quit = ^\; erase = ^h; kill = ^u; eof = ^d; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^q; stop = ^s; susp = ^z; rprnt = ^r; werase = ^w; lnext = ^v; flush = ^o; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt

java - Springframework and @Value with placeholder -

i have annotated service in jar, included in webapp. the service has properties valued @value annotation, uses placeolders. property-placeholder defined in webapp, not in jar. problem @ runtime placeholders not resolved. this example. in jar: @service public class myservice { @value("${property.myvalue}") private myvalue; } in war applicationcontext: <context:property-placeholder location="classpath:myprops.properties"/> naturally myprops.properties exists in war , loaded (i tried remove , obtain explicit file not found error). moreover, unit test myprops.properties in test classpath passed. is there classpath issue?

javascript - AddEventListener for loop closure -

before linked anything, want know have read plenty issue. , know question's title edited duplicate, okay if end getting solution & explanation problem. so have table , wanted change names of headers, on click of them. want whenever click on 1 of headers. want take innerhtml , make textbox's value. i have been trying loop without success. each time click on of headers , textbox filled last header. have working version of code individual click events functions each, think possible loop & closure. /*/ =========================================================== /*/ (var = 1; < 4; i++) { document.getelementbyid('h' + i).addeventlistener("click", headerclicked); console.log("th " + + " click event added!"); (var x = 0; x < 2; x++) { function headerclicked() { headertext.focus(); headertext.value = tableheaders[x].innerhtml; console.log("th clicked"); console.log(

Spring Data Neo4j polymorphic association appears embedded -

i'm having problem exposing relationship sub-type via rest. have abstract class called page: @nodeentity @jsontypeinfo(use = jsontypeinfo.id.name, include = jsontypeinfo.as.property, property = "category", visible = true) @jsonsubtypes({ @type(value = musician.class), @type(value = book.class), @type(value = song.class) }) public abstract class page extends baseentity{ @fetch @createdby private user creator; @jsonserialize(using = localdatetimeserializer.class) @jsondeserialize(using = localdatetimedeserializer.class) @graphproperty(propertytype = long.class) @createddate private localdatetime timecreated; @notempty @size(min = 1, max = 160) @indexed(indextype = indextype.fulltext, indexname = "search") private string screenname; @fetch @relatedto(type = "channel") private channel channel = new channel(); public channel getchannel() { return channel; } publi

python - 'u' is prepended to all text in TextBlob -

this question has answer here: printing string prints 'u' before string in python? 4 answers i using textblob processing textual data. my code is: from textblob import textblob wiki = textblob("python high-level, general-purpose programming language.") wiki.tags i getting output as: [(u'python', u'nnp'), (u'is', u'vbz'), (u'a', u'dt'), (u'high-level', u'jj'), (u'general-purpose', u'jj'), (u'programming', u'nn'), (u'language', u'nn')] instead of: [('python', 'nnp'), ('is', 'vbz'), ('a', 'dt'), ('high-level', 'jj'), ('general-purpose', 'jj'), ('programming', 'nn'), ('language', 'nn')] what might reason letter 'u&#

ruby - Can't use `gem-install` command in pry -

i tried install gem using gem-install command in pry, failed. % pry pry(main) > gem-install pry-doc nomethoderror: undefined method `split' nil:nilclass /users/ironsand/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/rubygem.rb:60:in `install' i install gem using gem command bash. there must configure use gem-install command in pry ? i hadn't used pry while. looking through source code found gem-install command code. look @ gem.configuration['gem'] , find nil. it looks comes ~/.gemrc settings or default values. in ~/.gemrc file, if place line gem: '' this solved issue me no longer doing split on nil, on assigned value gem: key in .gemrc file.

c - Find the largest rectangle with no repeated elements -

find max size of rectangular contiguous submatrix of unique (i.e. non repeated within given submatrix) element. how can solve this? you should set maximum value 0. iterate rows of matrix , if not repeating (whatever means), compare size maximum. if bigger, store new maximum value , use further iterations. in case found new maximum, store whatever need store. so, algorithm looks this: maximum <- 0 rows row if (row not repeating) if (row rectangle size > maximum) maximum <- new maximum store whatever need store end if end if end note, if not have further information, pointless binary search, since have check size of each rectangle. if have further knowledge rectangles, algorithm might optimized.

objective c - Sample Image Capture with Scanner to Yosemite -

i tested code page of apple developers , not work nose if special because i'm testing on mac osx yosemite because when try view scanners connected not show me none, instead if use software company scanner performs scanning me well, please provide me example works in yosemite know begin , whether developed in yosemite. regarding not recognize printer yosemite , try following no more scanning after upgrading macos x 10.10

swing - I need help on a few things on Java JFrame -

i have created progress code , want close automatically after going 100% , open new frame text in frame. how do this? import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; import java.util.*; class progress extends jframe implements actionlistener { jprogressbar pb; jbutton b1; progress() { super("progress"); setlayout(null); b1 = new jbutton("start"); b1.setbackground(color.light_gray); pb = new jprogressbar(1,100); pb.setvalue(0); pb.setstringpainted(true); pb.setforeground(color.green); pb.setbackground(color.pink); b1.setbounds(20, 20, 80, 25); pb.setbounds(110, 20, 200, 25); pb.setvisible(false); add(b1); add(pb); b1.addactionlistener(this); setresizable(false); setdefaultcloseoperation(exit_on_close); } public void actionperformed(actionev

version control - Work on visual studio project with 2-3 people at the same time? -

i'm going start working on project 2 friends , we're using visual studio 2013 ultimate. i'm using tortoisesvn gets messy when updating removes code written. there live editor plugin? 1 person can work on toolbox.cpp , after saves it sync other team members? i check out git. here links started! super simple getting started guide http://rogerdudler.github.io/git-guide/ learn git in 15 minutes doing https://try.github.io/levels/1/challenges/1 git won't let work in same "instance" of project, allow merge changes , see changes before merge. allow go previous versions of project. git knowledge , usage par course in many places. friend asked 1 question in interview after resume looked over; asked if knew how use git. if chance, make sure read git documentation on website also. edit: git won't let work on same "instance" in terms of live project when types on side auto syncs , updates toolbox.cpp on side in real time. can, howe

c# - Selenium; Unable to find element by class in Internet Explorer -

trying test simple page using selenium running visual studio 2013 in c#. internet explorer 11 starts , goes correct page, cannot find element it's class (the next thing does). can use developer tools see class clear day , place it's used. note works fine in chrome , firefox, using same test . the html is; <input class="btn btn-default" type="submit" value="log in"> and code i'm using find is; iwebelement login = new webdriverwait(driver, timespan.fromseconds(5)).until(expectedconditions.elementexists(by.classname("btn"))); i've tried turning "protected mode" off 4 internet zones, still no joy. this can issue native vs synthetic event of operating system. read this . disabling native events of iedriver should in such case. i following same environment have var options = new internetexploreroptions { enablenativeevents = false }; driver = new internetexplorerdriver(options);

java - Create a Countdown Timer in Android Action Bar -

i'm having trouble creating countdown timer viewed action bar. right menu_main.xml , part of mainactivity.java code: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); undovaluesa.add(scoreteama); undovaluesb.add(scoreteamb); if (savedinstancestate != null) { scoreteama = savedinstancestate.getint(score_team_a_key); scoreteamb = savedinstancestate.getint(score_team_b_key); undovaluesa = savedinstancestate.getintegerarraylist(undo_a_key); undovaluesb = savedinstancestate.getintegerarraylist(undo_b_key); } displayforteama(scoreteama); displayforteamb(scoreteamb); swish = mediaplayer.create(this, r.raw.swish); textviewtime = (textview) findviewbyid(r.id.timer); textviewtime.settext("3:00"); } <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.co

logstash - How to extract feature from the Elasticsearch _source to index -

i have used logstash,elasticsearch , kibana collect logs. log file json this: {"_id":{"$oid":"5540afc2cec7c68fc1248d78"},"agentid":"0000000bab39a520","handler":"susicontrol","sensorid":"/gpio/gpio00/level","ts":{"$date":"2015-04-29t09:00:00.846z"},"vhour":1} {"_id":{"$oid":"5540afc2cec7c68fc1248d79"},"agentid":"0000000bab39a520","handler":"susicontrol","sensorid":"/gpio/gpio00/dir","ts":{"$date":"2015-04-29t09:00:00.846z"},"vhour":0} and code have used in logstash: input { file { type => "log" path => ["/home/data/1/1.json"] start_position => "beginning" } } filter { json{ source => "message" } } output { elasticsearch { em

ios - Set NSLayoutConstraint Constant in iOS7 -

Image
ok, have super weird issue. have uiscrollview i'm using update position of second uiview. so, when scroll uiscrollview, uiview moves @ proportional slower speed. code pretty simple. scroller.scrolled += delegate { if (scroller.contentoffset.y <= 0) { filterstop.constant = 0; } else { filterstop.constant = -(scroller.contentoffset.y / 2); } } filterstop nslayoutconstraint. scroller uiscrollview. the problem whenever set filterstop.constant value derived scroller.content.y, resets scroll.contentoffset 0 in ios7 only. code works fine in ios8+. i've tried dozen variations on this. if set filterstop.constant static number (ie: 123.5), works. i've tried saving value variable , forcing type thinking maybe getting cast improperly. if trace out value, works. but, minute set filterstop.constant, resets scroller.constentoffset.y again. scroller , filters not related. not nested or associated each other in way. so, have no idea why setting constant on cons

hardware - How does Google, Facebook etc. deal with memory corruption etc -

i wondering how google, facebook etc. deal hardware errors memory corruptions, calculating errors in cpu etc. given increasing density (and shrinking size) of circuits, seems frequency of hardware errors going up, not down. also, big providers google , facebook have many machines memory corruption must everyday occurrence. wondering kind pf policy have regards this. after all, algorithms assume underlying hardware operating correctly , data doesnt change in memory etc. if does, bets off. cause corruption not specific data being affected error, conceivably spread other computations. instance if error affects locking/synchronization protocol cause data hazards threads or nodes etc. or corrupt database, causing violations of invariants assumed elsewhere etc. cause other nodes, discover corruption, fail. have seen in practice erroneous data in database (an invalid timestamp in configuration-related row) caused whole system fail because application validated timestamp whenever reading r

bash - How can I remove specific lines from each datablock? -

i have repeating dataset looks 700 block1 1 2 b b b c 3 4 5 d 6 8 10 .... ff dd 22 11 700 block2 1 b b b c d f q .... the file made of 100 data blocks, , each data block have 702 lines. first line of each data block number of data (=700), , second line of each data block number of data block. here, hope remove 3rd ~ 100th line every data block (this remove 98 lines), left 101th ~ 700th line in each data block. there way in sed or grep? need use loop? i know how remove lines specific patter using grep -v , sed, couldn't find how delete multiple lines inside each data block. this might work (gnu sed): sed '/^700$/,+1p;//,+99d' file print lines want , delete lines don't.

server - How can I record my bash session as an executable? -

i want login server. run series of bash commands installing programs , setting configurations. want these commands recorded executable script can subsequently run on similar servers automate setup. how do this? i'm familiar script command, not want because not create executable scripts. though should again @ script , there autoexpect part of expect package. record interactions replay, including commands prompt yes/no , similar answers.

python - Sorting Pandas dataframe data within Groupby groups -

i have large pandas dataframe can represented structurally as: id date status 0 12 2015-05-01 0 1 12 2015-05-22 1 2 12 2015-05-14 1 3 12 2015-05-06 0 4 45 2015-05-03 1 5 45 2015-05-12 1 6 45 2015-05-02 0 7 51 2015-05-05 1 8 51 2015-05-01 0 9 51 2015-05-23 1 10 51 2015-05-17 1 11 51 2015-05-03 0 12 51 2015-05-05 0 13 76 2015-05-04 1 14 76 2015-05-22 1 15 76 2015-05-08 0 and can created in python 3.4 using: tempdf = pd.dataframe({ 'id': [12,12,12,12,45,45,45,51,51,51,51,51,51,76,76,76], 'date': ['2015-05-01','2015-05-22','2015-05-14','2015-05-06','2015-05-03','2015-05-12','2015-05-02','2015-05-05','2015-05-01','2015-

osx - Installing BLAS on a mac OS X Yosemite -

i'm trying install blas on mac, every time run make error (shown below link). trying follow instructions on this website : gfortran -o3 -c isamax.f -o isamax.o make: gfortran: no such file or directory make: *** [isamax.o] error 1 i have no idea means or how fix appreciated. i'm trying install cblas , lapack tips/instructions nice if know of source...everything i've found far pretty confusing. tried install atlas kept not working. this error caused because gfortran apparently not installed, you'll need download installer package os x yosemite 10.10 , install it: gfortran 5.1 or gfortran 4.9.2 ( info ) once installed run make command in blas directory.

Apply IsNull function on a date column (SQL Server) -

i trying apply isnull function column of datatype date . trying is, replace word null empty string (actual null value) when retrieving data the code using is; select isnull("update_dt", '') mytable i have tried select isnull("update_dt", 0) mytable the error getting msg 103010, level 16, state 1, line 1 parse error @ line: 4, column: 1: incorrect syntax near 'from'. if want see column empty string rather "null", need convert output string. control format, use convert() : select coalesce(convert(varchar(10), update_dt, 121), '') . . . then use coalesce() (or if must, isnull() ) replace null value string.

python - code that check if number is prime number -

this question has answer here: checking if number prime number in python [duplicate] 8 answers i have code check if number prime or note the problem in code : when run give error : take code : a = int (input("your numbre :")) b = range(1,a+1) if a%b == 0: in b : if b == or b == 1: print("the numbre input prim number") else: print("the nmubre input note prem numbre") take @ error : traceback (most recent call last): file "c:\users\admin\desktop\chap8ex2.py", line 3, in <module> if a%b == 0: typeerror: unsupported operand type(s) %: 'int' , 'range' the range function creates array of numbers between parameters. example: >>> range(1, 4) => [1, 2, 3] in code you're saying a%b finding remainder between number user inputted , range objec

javascript - How to dynamically create mixed HTML content in jQuery -

considering want create html dynamically: <li><img src="a"/>some text</li> some text text string potentially unsafe, let's stored in variable 'some_text'. the idea call $('<li>').append($('<img>').attr({src:"a"}), ... ); using $(some_text) bad idea because it's unsafe. using text(some_text) doesn't work because text not child of element. i not want wrap text <span> i not want invent/use function sanitizes or escapes string there many ways, possibly simplest first add text content li element , prepend image correct order. $('<li>').text(some_text).prepend($('<img>').attr({src:"a"}), ... );

JQuery bind() method not working -

i make code ajax give me pagination bar <a href="" class="page-navi page--4">4</a> example. bind , alert not working. why? <script ... > $(function() { $(".page-navi").bind("click",function() { alert("!!!"); }); $.ajax( { url: "some url", type: "get", success:function(data, status, jqxhr) { $("#pagination").html(data); }, error: function (request, status, error) { console.log(request.responsetext); } }); }); </script> it looks calling ajax method update #pagination element after loading. if .page-navi element inside #pagination element event handler attached via bind wiped out. move inside ajax success.

AngularJs custom sorting wont accept value returned from a function -

i'm calling api company uses returns array of objects, 1 of them looks like: {ip = 127.0.0.1, connected: 2015-01-01 00:00:00, disconnected: 2015 01-01 01:00:00, traffic:90000} i able create anugular app produces table ng-repeat sortable ip , connected , , disconnected . traffic var number of bytes transmitted during session subtracted dates number of bytes transmitted per second , able display on table table looks below. clicking headers sort table value , clicking again reverse , display appropriate arrow. results response http post: js: $scope.reverseorder = function(predicate) { $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : true ; $scope.predicate = predicate; }; $scope.bytespersecond = function(startdate, enddate, traffic) { var = moment(startdate); var = moment(enddate); var seconds = to.diff(from, 'seconds'); return traffic/seconds; }; html: <table class="...">