Posts

Showing posts from January, 2010

dictionary - How to do this list/dict comprehension in python -

i creating python dictionary follows: d= {i : chr(65+i) in range(4)} now output of d {0: 'a', 1: 'b', 2: 'c', 3: 'd'} i have list of keys want follows: l = [0, 1] now want create list contains values corresponding these keys , wanted know if there pythonic way using list or dict comprehensions. i can follows: [x x in d[0]] however, not know how iterate on entries of list in setting. tried: [x x in d[a] in l] # name 'a' not defined [x x in d[for in l]] # invalid syntax you want iterate on l , use for element in l . stuff in dictionary in left-hand side, in value-producing expression: [d[element] element in l] note dictionary mapping consecutive integers starting @ 0 letters isn't efficient; may make list: num_to_letter = [chr(65 + i) in range(4)] this still maps 0 'a' , 1 'b' , etc, without hashing step.

python - Dynamic group assignment for ansible playbook -

i'm working on ansible playbook provision redis cluster. have 3 groups playbook looks in, can't figure out how assign nodes group properly. the problem arises because have dynamic number of nodes. if 2 nodes requested i'd have groups this: [redis_master] node1 [redis_slave] node2 in case of 3: [redis_master] node1 [redis_slave] node2 [redis_sentinel] node3 and in case of 4 etc: [redis_master] node1 node4 [redis_slave] node2 [redis_sentinel] node3 is there paradigm i'm missing here? i'm not sure understand situation completely. pre-define involved hosts , arrange them in groups. hosts playbook might process, required defined in inventory. hosts processed playbook more or less fixed. mean by: if x nodes requested ... i know can use --limit limit playbook subset of defined hosts. can use param defined in --extra-vars pick specific group or set of hosts. still need pre-defined in inventory , seems strange (and error prone) me depe

java - The Inverse of a bit-shift to the left in the format 1 << n -

let's have following bit masks: 1 << 1, // 2 1 << 2, // 4 1 << 3, // 8 1 << 4, // 16 1 << 5, // 32 1 << 6 // 64 i 'inverse'. this job: void foo(int n) { int c = 1; while (n/2 >= 2) { n /= 2; c++;; } println(c); } for example, 1 << 4 resulted in 16. if run foo(16) prints 4. however, feel done lot simpler, can't figure out how. is possible? biginteger has many useful methods - including getlowestsetbit() . fast can possibly done. public void test() { system.out.println(biginteger.valueof(16).getlowestsetbit()); }

java - RESTEasy POJO json "embedded" objects as links/id's -

i have problem struggling how represent embedded objects in pojo links, instead of embedding them directly. i'm unsing resteasy jettison provider. in 3.0.11.final version. the book.java pojo public class book { private integer bookid; private string title; private author author; } the author.java pojo public class author { private integer authorid; private string name; } when use resteasy generate xml or json representation of book, see this: <book> <bookid>1</bookid> <title>my book</title> <author> <authorid>2</authorid> <name>andre schild</name> </author> </book> but wan't have this: <book> <bookid>1</bookid> <title>my book</title> <author author="2"><atom:link rel="list" href="http://.../rest/authors/2"/></author> </book> since us

json - How to use HTTP.GET in AngularJS correctly? (Dynamically) -

i create has service, , pass controller, problem have read static file (1.json), , have populated folder more 1 json, know, how can bring them in, , make call dynamically. service: todoapp.factory('eventdata', function($http, $q){ return { getevent: function(){ var deferred = $q.defer(); $http({method: 'get', url: '/data/phonebook/1'}). success(function (data, status, headers, config){ deferred.resolve(data); }). error(function (data, status, headers, config){ deferred.reject(status); }); return deferred.promise; } }; }); controller: todoapp.controller('feedercontroller', function feedercontroller($scope, eventdata) { eventdata.getevent().then( function(event){$scope.event = event;}, function(statuscode) {console.log(statuscode)}); } ); best wishes you'll want parameterize service call. once

Missing dot (.) in email address - getProfileUserInfo() on Chrome OS -

i use identity.getprofileuserinfo() logged-in user's e-mail address. however, on chrome os (beta, channel 44) dot (.) - if present - removed address. for example, if address first.last@domain.com returned address firstlast@domain.com the same api returns correct/full address in chrome on windows. has run problem? workarounds? consumer gmail ignores dots/periods in username, gmail google apps does not , i.e. consumer gmail addresses username@gmail.com , user.name@gmail.com , u.s.e.r.n...a.m.e@gmail.com same. i don't know of email service this, , other services know consider "dotted" gmail addresses distinct "undotted" variant. getprofileuserinfo() either normalizes email address stripping periods or account logged in chrome os dotted variant of email address.

animation - CSS transition & transform from hamburger bars --> X on click (using stylus) -

i have menu hamburger "icon" mobile breakpoint. have set 3 lines , want them transition x (that close menu). i want top bar go 45 degrees, middle bar disappear, , bottom bar go 45 degrees other way. top , bottom bars shift , create x as of now....it animates long hold mouse down. why so? need animation complete on click. html: <a class="navbar-item-link" "javascript:void(0)" > <div class="hamburger-icon"><span></span></div> </a> stylus: .hamburger-icon &:before, &.hamburger-icon span, &:after content '' display block height 2px width 20px background-size 100% background rgba(255,255,255,0.5) margin 6px auto 7px auto transition 0.2s linear &:active &.hamburger-icon span background-color transparent &:before transform rotate(45deg) top -10px height 2px

http - Uploading file gets Bad Request from the server -

i trying send file using http c++ application (no html-boxes). server keeps answering code 400/ bad request. keep simple, have changed manually content of file simple string (later on, need upload real binary files). the post request following: post /post.php http/1.0 host: posttestserver.com accept: */* content-type: multipart/form-data; boundary=boundary --boundary content-disposition: form-data; name="userfile"; filename="example.txt" content-type:text/plain 123abc --boundary-- connection: close any idea going on?

markdown - Formatting readme.txt file for WordPress Plugin -

i published free plugin wordpress repository , not format readme.txt file display ordered list in correct way, list items appears on same line. please check description on link: https://wordpress.org/plugins/wp-cloaker/ i tried separate list items comma article says http://www.smashingmagazine.com/2011/11/improve-wordpress-plugins-readme-txt/ not work any help? it's markdown...you need blank line between initial content , ordered list: here features of **wp cloaker** plugin: 1. hide, shorten links. 2. custom redirection type: 301,302,303,307 , javascript redirection. 3. categorize links. 4. custom permalinks e.g : www.yoursite.com/visit/link-category-slug/link-slug. 5. track links clicks, each time visitor click on link, plugin store visitor information (ip address, click date/time, country, etc..). 6. can add third party tracking code. as file has currently been written , blank line not exist.

html - Creating a 2x2 fluid layout and fill the entire screen -

Image
i'm having hard time trying figure out how tackle seemingly simple problem. have request make 2x2 box layout fill entire screen, break down single column @ width. the breaking down part isn't problem, it's 2x2 grid fluid i'm struggling with. i've attempted using this: .outer-div{ display: table; width: 100%; height: 100%; } .inner-div{ display: table-row; width: 100%; height: 100%; } .inner-block{ display: table-cell; width: 50%; height: 100%; } this sort of works, doesn't seem fluid. @ least, not expect. there better way accomplish this? ideas appreciated! (picture attached visual reference) edit ok, feel idiot. solution had working, problem have div display content absolute positioned , fixed height i'm not sure how account for. please see fiddle example: https://jsfiddle.net/q2j940r1/1/ the key set container elements height:100% , including html , body tags. , set 50% of width , height each item. jsfiddle

Which jquery draggable/resizable dashboard template to use -

background i'm making front end interface display log data. have table shows raw data plenty of operations, calendar similar heat-map , bar chart displaying aggregated data chosen attribute, time period , granularity (using d3). data size rather huge actions done @ back-end (literally, filter/sort etc. ajax call server side). there should more graphs come, in similar fashion. goal what i'm trying have dashboard using jquery graphs , stats later. have briefly skimmed through following options: gridlist dashing gridly (can't insert 2+ links because of reputation...) sdashboard ^ gridster (according gridlist it's no longer in development , uncertain reliability?) the problem can't tell significant difference between of them or 1 fits better, , have limited front-end experience (i looked , learned js function definition syntax couple days ago). below list of functionalities achieve ideally: each widget behaves normal dom object, or if there no wid

JQuery's wildcard symbol to ignore characters in the middle? -

i'm wondering how search through of html li matching id attribute. google search, see begin , end nothing use both ignore middle part. example... to elements starting "jander" should use: $("li[id^=jander]") to end "jander" $("[id$=jander]") but matching ones start "abc" , end "xyz"? $("li[id???=abc???xyz]") as in $("li[id???=abc???xyz]").on('click', function() { alert('foo'); }); you can chain expressions: $('li[id ^="abc"][id $="xyz"]') $('li[id ^="abc"][id $="xyz"]').each(function(){ $("ul#results").append('<li>' + $(this).text() + '</li>'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> unit tests: <ul> <li id="foo">a</li> <li id="b

Crystal Reports: using results of one report as input parameter in another -

i trying combine 2 reports. 1 report pulls list of id , other report displays general data on ids. i'm trying write 1 report uses ids generated in first report input parameters in second. you can use sub reports purpose. select id in runtime , pass value input second report way can required output. edit---------------------------------------------------------------- create parameter id @ run time.. , after link parameter sub report using sub report links pass id record selection part of sub report , when sub report refreshed data id... make sure prepare sub report according required details

php - Pagination in codeigniter. Extra set of values passed in to model and db->limit not working -

pagination in codeigniter. can't seem set limit of posts on every page (it shows of them on every page). think links working (they show on uri), not select rows per page. the model: public function index( $limit,$start, $var1,$var2,$var3,$var4 ){ $sql = "select trabalho.var1 trabalho.var2 empregos.var3 empregos.var4 trabalho.empregos join trabalho.empresas on empregos.id_empresa = empresas.id_empresa trabalho.var1 ? or trabalho.var2 ? or empregos.var3 ? or empregos.var4 ? ;"; $variables_form = array($var1,$var2,$var3,$var4); $this->db->limit($limit, $start); $query2 = $this->db->query($sql,$variables_form); return $query2->result(); } the controller: $config['base_url'] = base_url().'index.php/main_controller/index'; $config['total_rows'] = 10; $config['per_page'] = 5; $config['num_links

OpenCV Android Green Color Detection -

Image
currently i'm making app user detect green colors. use photo testing: my problem can not detect green pixel. before worked blue color , worked fine. can't detect though tried different combinations of rgb . wanted know whether it's problem green or detection range, made image in paint using (0, 255, 0) , worked. why can't see circle then? use code detection: core.inrange(hsv_image, new scalar([i change value]), new scalar(60, 255, 255), ultimate_blue); it have been set wrong range, use photoshop color of 1 of green pixels , convert rgb value of hsv . yet doesn't work. don't detect pixel i've sampled. what's wrong? in advance. using miki's answer: green color hsv space has h = 120 , it's in range [0, 360]. opencv halves h values fit range [0,255], h value instead of being in range [0, 360], in range [0, 180]. s , v still in range [0, 255]. as consequence, value of h green 60 = 120 / 2. you upper , lower bound should

java - Issue with sounds in libgdx -

i having issues libgdx sound inside clicklistener button. getting error syntax error on token "playbuttonsound", identifier expected after token soundmanager: import utils.constants; import com.badlogic.gdx.gdx; import com.badlogic.gdx.audio.music; import com.badlogic.gdx.audio.sound; public class soundmanager { private static sound buttonsound = gdx.audio.newsound(constants.buttonsound); private static music song = gdx.audio.newmusic(constants.song); public static void playmusic() { song.setlooping(true); song.setvolume(0.2f); song.play(); } public static void playbuttonsound() { buttonsound.play(); } public void destryoaudio() { buttonsound.dispose(); song.dispose(); } } and mainmenu: public class mainmenu implements screen { private stage stage; private sprite sprite; private textureregion menubackgroundimg; private textureatlas menubutton; private skin

node.js - My javascript module is not working when I used gulp and browserify -

my javascript module not working when concat javscript files gulp , browserify. this module. lastestpost.js var postbox = require('../objects/postbox'); var lastestposts = (function() { var btnleft; var btnright; var postboxs = (function() { var arr = new array(); (var i=0; i<4; i++) { var post_box = new postbox(); arr.push(post_box); } return arr; })(); var index = 0; var lastindex; return({ initdom: function($) { btnleft = $('#btn-lastest-previous'); btnright = $('#btn-lastest-next'); /* codes */ }, initindex: function() { if (index == 0) { /* codes */ } else if (index == lastindex) { /* codes */ } else { /* codes */ } }, getlastindex: function() { $.get(

android - Running AOSP build on Mac (Yosemite and later) -

i able source code android-5.0.1_r1 working directory. however, have trouble building , running code on emulator because lunch command giving me trouble. repo has been initialized in /volumes/aospdiskimage/aosp nikhils-mbp:aosp nikhil$ . build/envsetup.sh including device/asus/deb/vendorsetup.sh including device/asus/flo/vendorsetup.sh including device/asus/fugu/vendorsetup.sh including device/asus/grouper/vendorsetup.sh including device/asus/tilapia/vendorsetup.sh including device/generic/mini-emulator-arm64/vendorsetup.sh including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh including device/generic/mini-emulator-mips/vendorsetup.sh including device/generic/mini-emulator-x86/vendorsetup.sh including device/generic/mini-emulator-x86_64/vendorsetup.sh including device/lge/hammerhead/vendorsetup.sh including device/lge/mako/vendorsetup.sh including device/moto/shamu/vendorsetup.sh including device/samsung/manta/vendorsetup.sh including sdk/bash_completion/adb.bash nik

c++ - Qt QWidget::minimumSizeHint delay (#2) -

when hide widget in application, minimumsizehint isn't updated immediatly. i tried qlayout::activate() solution suggested @ this post , doesn't work me because qlayout::activate() returns false . i try @ mainwindow class this: ui.groupbox->setvisible(!ui.groupbox->isvisible()); qdebug() << this->layout()->activate(); qdebug() << this->minimumsizehint(); this->resize(this->minimumsizehint()); any ideas why it's not working? my current workaround is: qtimer::singleshot(10, this, slot(on_resizemin())); but noticed 10ms may not enough on slow system. nasty workaround. the size hints meant used @ appropriate moments layout system. you're not supposed using them elsewhere - that's why appear "not work". you appear want constrain size of main widget (the window) 1 of size hints. you'll need set appropriate sizeconstraint on widget's layout. there 2 approaches: use qlayout::setfixedsi

scala - Spark - LinearRegressionWithSGD on Coursera Machine Learning by Stanford University samples -

Image
software version : apache spark v1.3 context : i've been trying "translate" octave/matlab code scala on apache spark. more precisely, work on ex1data1.txt , ex1data2.txt coursera practical part ex1 . i've made such translation julia lang (it went smoothly) , i've been struggling spark...without success. problem : performance of implementation on spark poor. cannot works correctly. that's why ex1data1.txt added polynomial feature, , worked with: theta0 using setintercept(true) , non-normalized column of 1.0 values(in case set intercept false). receive silly results. so, 've decided start working ex1data2.txt . below can find code , expected result. of course spark result wrong. did have similar experience? grateful help. the scala code exd1data2.txt: import org.apache.spark.mllib.feature.standardscaler import org.apache.spark.mllib.linalg.vectors import org.apache.spark.mllib.optimization.squaredl2updater import org.apache.spark.mllib.regr

java - Arquillian: missing dependency error when injecting EJB with mappedName -

i writing arquillian test class uses factory class named werkkatalogfactory (injected @ejb , in turn has field named werkkatalogrepositoryport , concrete implementation of gets injected via annotation @ejb(mappedname = "java:app/core/wkrepository-default-impl") , jndi name annotated on stateless session bean werkkatalogjpaadapter via @stateless(name = "wkrepository-default-impl") all seems run until during deployment container tries inject werkkatalogjpaadapter @ point test fails with: org.jboss.arquillian.container.spi.client.container.deploymentexception: cannot deploy: werkkatalogjpaadaptertest.war @ org.jboss.as.arquillian.container.archivedeployer.deployinternal(archivedeployer.java:83) @ org.jboss.as.arquillian.container.archivedeployer.deployinternal(archivedeployer.java:64) @ org.jboss.as.arquillian.container.archivedeployer.deploy(archivedeployer.java:46) @ org.jboss.as.arquillian.container.commondeployablecontainer.deploy(commond

c# - CheckBox checked become unchecked after sorting or paging (not GridView) -

i have checkbox in aspx form page, external gridview. if checked checkbox executed 1 query populated gridview , update rows. this gridview paginated , when change page returns initial gridview rows , lost selection in checkbox. is there way keep checked after sorting , paging? thanks. edit #1 my code below. when checkbox checked in binddata(); executed different query initial. int ck = 0; protected void page_load(object sender, eventargs e) { if (!page.ispostback) { binddata(); } } protected void ddlpages_selectedindexchanged(object sender, eventargs e) { gridviewrow gvrpager = gvproducts.bottompagerrow; dropdownlist ddlpages = (dropdownlist)gvrpager.cells[0].findcontrol("ddlpages"); gvproducts.pageindex = ddlpages.selectedindex; binddata(); } protected void gridview1_pageindexchanging(object sender, gridviewpageeventargs e) { gvproducts.pageindex = e.newpageindex; binddata(); } protected void paginate(ob

shell - Replacing pattern with pattern+incrementing number -

here snippet of text files want edit: "> record:w7_s7_l001_r2_001_43549049:wang1141_nem_0425_6 aggctcgaacttcctttggatgaactccaaaagtccctctaagaagttaacaccttacaa "> record:w41_s41_l001_r2_001_36873913:wang1141_nem_0425_6 tgcctcaaacttccgtggattaaacatccacagtccctctaagaagttagccgtcaaccaa "> record:w32_s56_l001_r2_001_29095773:wang1141_nem_0425_6 tgcctcaaacttccttatgcttgcacataaagtccctctaagaagttagactccctattta now want replace every ">" ">$a" , incrementing "$a++". found solution worked: >awk '/>/{sub(/start/,++n);{print}' but replaces > number without >. i appreciate every help! it's hard believe glance @ man page , maybe quick google couldn't figure out how fix code snippet had found want here is: $ awk '/>/{sub(/>/,">"++n)}{print}' file ">1 record:w7_s7_l001_r2_001_43549049:wang1141_nem_0425_6 aggctcgaacttcctttggatgaactccaaaagtccctctaagaagttaacaccttac

Getting the values for dependent variable in binary independent variable in R -

i have data frame named orf. trying work out coding on how calculate values dependent variable in binary independent variable e.g breed. table gives me number of breeds in each category. how go coding calculate instance 341 breed type 1 had 500 cases of disease. y here cases table(orf$breed) 1 2 341 405 example: breed cases2012 2 0 1 0 2 8 2 73 2 0 2 26 2 0 2 45 1 0 2 22 1 0 1 0 2 0 2 6 1 539 this 1 of things there's million ways of doing in r. here's how i'd in dplyr library(dplyr) data %>% group_by(breed) %>% summarise(cases = sum(cases2012))

spring - How to intercept a method in java -

here method: public static boolean startmodule(module mod, servletcontext servletcontext, boolean delaycontextrefresh) here method call in java file: webmoduleutil.startmodule(module, getservletcontext(), false); i cannot make changes these files, want intercept method , add of code (i want access parameters well) code wrote in java file not successful: public void main(string[] args) throws exception { module module = null; webmoduleutil wmb = new webmoduleutil(); proxyfactory pf = new proxyfactory(wmb); pf.addadvice(new methodinterceptor() { public object invoke(methodinvocation invocation) throws throwable { if (invocation.getmethod().getname().startswith("start")) { system.out.println("method " + invocation.getmethod() + " called on " + invocation.getthis() + " args " + invocation.getarguments()); system.out.println("************

datetimepicker - disable selection of past months and enable selection on future month and date in materialdatetimepicker in android -

integrating https://github.com/wdullaer/materialdatetimepicker library in android app,here code select date , time.i'm able implement enabling future date in month , disable past date in month want implement disable option past months , enable selection option future months.here code private void selectdate() { final timepickerdialog timepickerdialog12h = timepickerdialog .newinstance(new ontimesetlistener() { @override public void ontimeset(radialpickerlayout view, int hourofday, int minute) { object c = pad3(hourofday); selectedtime = new stringbuilder() .append(pad2(hourofday)).append(":") .append(pad(minute)).append(c); string str_date = selecteddate.tostring() + " " + selectedtime + ""; string str_date_cur

Excel VBA Userform - How to increase/decrease date by one month -

using following code, increase value of date displayed in textbox spinbuttons. mainuserform_initialize() datetextbox.value = format(date, "dd-mm-yyyy") ... end sub 'add 1 day when spinning up. private sub spinbuttondate1_spinup() datetextbox .value = format(dateadd("d", 1, .value), "dd-mm-yyyy") end end sub 'remove 1 day when spinning down. private sub spinbuttondate1_spindown() datetextbox .value = format(dateadd("d", -1, .value), "dd-mm-yyyy") end end sub the problem is, if spin down 11-07-2015, goes 12-07-2015 06-12-2015 instead of 11-07-2015. why that? (i have same problem when increasing value. dates given example.) i have same issue if set regional format us. try fix should work regardless of regional settings: 'add 1 day when spinning up. private sub spinbuttondate1_spinup() datetextbox .value = format(getdatefromuk(.value) + 1, "dd-mm-yyyy")

qt - QMainWindow: size management of central widget and dock widgets -

Image
i want mainwindow keep approximate ratio of dock widget sizes , central widget size, when window's size changed. i've written simplest mainwindow central widget , 6 dock widgets: #include <qplaintextedit> #include <qdockwidget> #include "mainwindow.h" mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) { this->setgeometry(20, 20, 600, 600); this->setcentralwidget( new qplaintextedit("central", this) ); qdockwidget *p_dw; (int = 0; < 6; ++i){ p_dw = new qdockwidget("dock " + qstring::number(i)); p_dw->setwidget( new qplaintextedit("dock " + qstring::number(i), this) ); qt::dockwidgetarea area; switch (i){ case 0: case 1: area = qt::topdockwidgetarea; break; case 2: area = qt::rightdockwidgetarea; break; case 3:

validation - Prismatic schema: removing unanticipated keys -

my api receiving json data client. i use schema perform validation , coercion on data receive, 1 additional requirement: if there map key not described in schema, ignore , remove instead of failing validation (this because client may send me "garbage" properties along ones care about. want tolerant that.). so in nutshell, perform "deep select-keys " on input data using schema, before validation/coercion. example of need: (require '[schema.core :as sc]) (def myschema {:a sc/int :b {:c sc/str (sc/optional-key :d) sc/bool} :e [{:f sc/inst}]}) (sanitize-and-validate myschema {:a 2 :b {:c "hello" :$$garbage-key 32} :e [{:f #inst "2015-07-23t12:29:51.822-00:00" :garbage-key 42}] :_garbage-key1 "woot"}) => {:a 2 :b {:c "hello"} :e [{:f #inst "2015-07-23t12:29:51.822-00:00"}]} i haven't yet found reliable way of doing this:

java - How does the sort() method of the Collection class call the Comparable's compareTo()? -

suppose want sort list of employee objects: employee emp1 = new employee("abhijit", 10); employee emp2 = new employee("aniket", 5); employee emp3 = new employee("chirag", 15); list<employee> employees = new arraylist<employee>(); employees.add(emp1); employees.add(emp2); employees.add(emp3); collections.sort(employees); system.out.println("sorted list is: "+employees); and employee class implements comparable , therefore must override compareto() method. , have write sorting logic in compareto() method. class employee implements comparable<employee> { string name; int empid; public employee(string name, int empid) { this.name= name; this.empid = empid; } public string getname() { return name; } public void setname(string name) { this.name = name; } public int getempid() { return empid; } public void setempid(int em

android - How do I convert decimal input into an int? -

i have edittext field user can enter weight in kilogram, i.e. 11.7. want store in database gramms, i.e. 11700. how convert string "11.7" integer 11700? to value edittext use http://developer.android.com/reference/android/widget/edittext.html#gettext() string userinput = edittext.gettext().tostring(); to convert string double use code @govindpatel http://developer.android.com/reference/java/lang/double.html#parsedouble(java.lang.string) try { double kg = double.parsedouble(userinput) } catch (numberformatexception nfe) { edittext.seterror(r.string.invalid_double); // or whatever want show user } to convert kg g: long gramms = math.round(kg * 1000); you replace double , long float , int if know don't need precision or range of larger variables.

osx - Git Reset --hard : file does not reflect on the server -

after executing command git reset --hard commitid , git push --force , , pushing commits on repo(staging), new commits not reflect on server. my colleagues able see commits changes not reflect on site , when checking on file on server, file not updated. the head looks correct based on can see sourcetree , terminal . already tried reseting head new commit make sure still having same problem. also tried git push origin staging , git push origin staging:staging , still having same problem. edit tried git log on server , noticed commits different local. of latest commits server should removed because of reset made local git has been updated.

java - Intellij code formatting, keep /*package*/ on the same line -

Image
in cases makes lot of sense use package visibility methods. convention, put /* package */ comment in place of modifier in order make clear intentional : /* package */ int getspan() { return mspan; } however, intellij automatic formatting keeps putting comment on separate line ... final methods :/ . there way configure formatting occurrences of comment left on same line ? i had similar issue in intellij scala code following: import executioncontext.implicits.global // todo use own execution context was getting formatted into: import executioncontext.implicits.global // todo use own execution context i managed stop happening ticking comment @ first column under keep when formatting :

Cassandra Racks show ? on Owns clusters -

Image
i run cassandra daemon on servers , set endpoint_snitch gossipingpropertyfilesnitch, rpc_address ip's server, listen_address ip's server, seed_provider list servers on ./nodetool status show me what can question marks disappear? thank help if specify keyspace, question marks change percent of data owned keyspace. nodetool status <keyspace name>

Syntax error near unexpected token 'elif' shell script -

i facing syntax error near unexpected token,elif error following code. if [ "$1" == "abc" ]; echo "abc" elif [ "$1" == "xyz" ]; echo "xyz" else echo "unkown parameter" exit 0 fi error is: abc.sh: line 28: syntax error near unexpected token elif' abc.sh: line 28: elif [ "$1" == "xyz" ]; then code seems alright point add os on running. == works fine linux redhat/suse or solaris machine on os hpux or aix don't work. should use = correct comparing strings.

jquery - Infinite loop while adding a row in bootstrap table -

i have table has 5 rows , want add row dynamically , dont want add row through onclick event. want row added automatically chose 'post-header.bs.table' event. running infinite loop , browser crashes because of that. dont know why running infinite loop , please let me know how solve this. code: $(function () { $('#table2').on('post-header.bs.table', function () { $('#table2').bootstraptable('insertrow', { index:5, row: { data:{ practice: 'score', input: '12345' } } }); }); }); i need pass data in row:{data:{practice:'score',input:'12345'}} format.

javascript - Call JS function for specific id in HTML -

i have below function in js file name hello.js inside js folder. js function hello(){ alert('hello world !); } html <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript" src="js/hello.js"></script> <script> $(function() { $("#hello").hello(); }); </script> </head> <body> <button type="button" id="hello">click me!</button> </body> </html> how attach hello() function button id="hello" ? i'm doing wrong can't find what. edit : recommend reading answers completeness. edit2: purpose of question clarify general method of attaching functions specific elements on html. button , click interaction example.

javascript - Form will not submit with captcha -

i have used starting point form on website needs captcha, upon adding it, not submit action.php page move on user. what can submit? http://jsfiddle.net/swade/m5rvh/ <form id="form" action="action.php"> <input type="text" name="name" placeholder="name" /> <input type="submit" value="send" /> </form> $(function(){ var mathenticate = { bounds: { lower: 5, upper: 50 }, first: 0, second: 0, generate: function() { this.first = math.floor(math.random() * this.bounds.lower) + 1; this.second = math.floor(math.random() * this.bounds.upper) + 1; }, show: function() { return this.first + ' + ' + this.second; }, solve: function() { return this.first + this.second; } }; mathenticate.generate();

c# - How to read the date that is return from a stored procedure which have no parameter using asp.net? -

alter procedure [dbo].[usp_currentdate] begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; -- insert statements procedure here select convert(varchar(10), getdate(), 101) end this stored procedure code. got correct date, unable read values in asp.net. public datetime getcurrentdate() { try { datetime dt; sqldatareader reader; sqlconnection objsqlconn = new sqlconnection(connstring); sqlcommand cmd = new sqlcommand(); cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = "usp_currentdate"; cmd.connection = objsqlconn; objsqlconn.open(); me(1); reader = cmd.executereader(); dt = reader.getdatetime(1); return dt; } catch (exception ex) { throw ex; } } but it's not working. throws exception invalid attempt read when no data present what changes

objective c - How to fix the Table view as Dialog or Popup For all View Controllers in ios -

Image
totally have 5 view controllers , have fixed 1 button account button in 5 view controllers, once clicked account button need show tablewview below image,first tried 1 table view show hide in first view controller want show table view 5 view controller when clicked account button, this want show in view controllers, when click option navigate my account -> accountvc, track order -> trackordervc, customer services ->cusservicesvc same thing implemented in 1 of project.create subclass of uiview , in .h file write 2 method - (void)showmenuviewanimatedwithframe:(cgrect)rect; - (void)hidemenuviewanimated; and in .m file create object of table view implement it's delegate , datasource method , write code as - (void)showmenuviewanimatedwithframe:(cgrect)rect{ listtableview.frame = cgrectmake(0, 10, rect.size.width, rect.size.height - 10); [uiview animatewithduration:0.3f animations:^{ self.frame = rect; }]; } - (void)hidemenuvi