Posts

Showing posts from June, 2014

python - How to cross-domain in cherrypy normal application? -

class helloworld: @cherrypy.expose def hello(self): return "hello world!" cherrypy.quickstart(helloworld()) i cross-domain request: http://ip:port/hello unsuccessfully, , add decorator(which working in restful application) before method hello that: def crossdomain(func): def decorate(*args, **kwargs): cherrypy.response.headers["access-control-allow-origin"] = "*" cherrypy.response.headers["access-control-allow-methods"] = "get, post, head, put, delete" allow_headers = ["cache-control", "x-proxy-authorization", "x-requested-with", "content-type"] cherrypy.response.headers["access-control-allow-headers"] = ",".join(allow_headers) return func(*args, **kwargs) return decorate class helloworld: @cherrypy.expose @crossdomain def hello(self): return "hello world!" cherrypy.quick

html - Bootstrap dropdown's do not render correctly on mobile -

Image
when view project on desktop dropdowns aligned , flush looks nice, when minimize browser view on mobile looks like, as can see dropdowns difference sizes, i'm not sure how happened? i'm aware takes considering content have in each i.e how long each word there safe way within bootstrap can achieve fixed width dropdowns wether being viewed on mobile/tablet or desktop? current markup above picture <div class="row col-lg-12"> <div class="col-lg-5"> <div class="form-group"> <label class="col-lg-4 control-label">country</label> <div class="col-lg-8 input-group"> @html.dropdownlistfor(m => m.userdetails.selectedcountry, model.userdetails.listcountries, "please select country", new { @class = "form-control", onchange = "javascript:this.form.submit();" }) </div>

canvas - Absolute position click potion of zoomed image in android -

i want calculate un-scaled absolute position of image drawn on canvas based on position clicked user on scaled canvas. i used following zoom implementation translate/scale bitmap within boundaries? so far, public boolean inme(int x, int y, region clickregion) { if(mscalefactor == 0) mscalefactor = 1; float curx = ((x*1.0f)/ mscalefactor) - (mposx * mscalefactor); float cury = ((y*1.0f) / mscalefactor) - (mposy * mscalefactor); x = (int)curx; y = (int)cury; //clickregion grapics.region computed on non-zoomed coordinates if (clickregion.contains(x, y)) return true; else return false; } this works fine, when there no zooming, when zoomed there significant issues. edit this algo used zooming , panning. public class panzoomview extends view { public static final string tag = panzoomview.class.getname(); private static fin

zend framework2 - How to call on view on dyanmic actions in zf2 -

hello friends new in zf2. stuck @ 1 place. in project want to call 1 view on many action. url "baseurl/g/any-thing-from-from-database" want call view on "any-thing-from-from-database" action module or same. my g module have code on module.config.php return array( 'controllers' => array( 'invokables' => array( 'g\controller\g' => 'g\controller\gcontroller', ), ), 'router' => array( 'routes' => array( 'g' => array( 'type' => 'segment', 'options' => array( 'route' => '/g[/:action][/:id]', 'constraints' => array( 'action' => '[a-za-z][a-za-z0-9_-]*', 'id' => '[0-9]+', ), 'defaults' => array(

c# - how to create binding for an extern declaration -

i'm trying create binding ios library. when creating native app library, requires include .h header file declares global applicationkey variable this: extern const unsigned char applicationkey[]; and supposed implement const unsigned char applicationkey[] = {0x11, ... }; now, when creating xamarin binding library, header file mapped objective sharpie to partial interface constants { // extern const unsigned char [] applicationkey; [field ("applicationkey")] byte[] applicationkey { get; } } how change able set applicationkey c# code? your apidefination.cs file should [basetype (typeof(nsobject))] public partial interface constants { [export ("applicationkey")] typeofproperyinnativecode applicationkey { get; set; } } in order access property create instance of constant class of binding project , access binding.constant cons= new binding.constant(); cons.applicationkey =value; for better u

ruby on rails - Get data in batch using ActiveRecord -

i create rails app , fetch data batch starting specific point. use ar , table structure looks following: create_table(:types) |t| t.string :name, null: false t.string :type, null: false t.string :type_id, null: false t.text :metadata t.timestamps end to data use type_id in following format (guid): "b2d506fd-409d-4ec7-b02f-c6d2295c7edd" i fetch specific count of data, ascending or descending ,starting specific type_id. more specific want do this: model.get_batch(type_id: type, count: 20).desc can in activerecord? you can use activerecord::batches find records in batches example model.where('your condition').find_in_batches(start: 2000, batch_size: 2000) |group| # batch end check activerecord::batches.find_in_batch

regex - Extract number embedded in string -

so run curl command , grep keyword. here (sanitized) result: ...dir');">town / village</a></th><th><a href="javascript:setfilter(3,'listpublicasdf','asdfdir');">phone number</a></th></tr><tr class="rowodd"><td><a href="javascript:calldialog('asdf','&mode=view&hellothereid=42',600,800);"... i want number 42 - command line one-liner great. search string hellothereid= extract number right beside (42 in above case) does have tips this? maybe regex numbers? i'm afraid don't have enough experience construct elegant solution. you use grep -p ( perl-regexp ) parameter enabled. $ grep -op 'hellothereid=\k\d+' file 42 $ grep -op '(?<=hellothereid=)\d+' file 42 \k here job of positive lookbehind. \k keeps text matched far out of overall regex match. references: http://www.regular-expressions.i

in app - Android in app purchases: is it possible to buy few subscriptions at same time? -

from google documentation don't understand - 1 subscription can active @ same time? or possible buy few subscriptions simultaneously? please explain me. you can create multiple products , configure attributes subscription each subscription product quoting the docs configuring subscriptions to create , manage subscriptions, can use developer console set product list app, configure these attributes each subscription product: purchase type: set subscription subscription id: identifier subscription publishing state: unpublished/published language: default language displaying subscription title: title of subscription product description: details tell user subscription price: default price of subscription per recurrence recurrence: interval of billing recurrence additional currency pricing (can auto-filled)

java - I need help on regular expression to allow number with character -

condition: 123 not valid 123 valid abc123 valid abc123ab valid i have apply regular expression compulsory character number? this match string starting optional set of digits followed combination of white spaces, letters , digits. still matches 123_ (that's 123 followed space `) ^\d*[\sa-za-z0-9]+$ the following check if have @ least 1 letter in string combined optional digits, white spaces , letters. [a-za-z\s\d]*[a-za-z]+?[a-za-z\s\d]* [a-za-z\s\d] match single character present in [] . quantifier * : between 0 , unlimited times, many times possible, giving needed [greedy] quantifier: +? between 1 , unlimited times, few times possible, expanding needed [lazy]

xml - Android Action bar not showing Icons -

how can display icons in actions bar, here code, <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/search_icon" android:icon="@drawable/ic_action_search" android:showasaction="always" android:orderincategory="0" android:title="search" > </item> </menu> and @override public boolean oncreateoptionsmenu(menu menu){ menuinflater mif = getmenuinflater(); mif.inflate(r.menu.custom_action_bar,menu); return super.oncreateoptionsmenu(menu); } thanks ! if using app compat use app:showasaction <item android:id="@+id/search_icon" android:icon="@drawable/ic_action_search" app:showasaction="always" android:orderincategory="100" android:title=&qu

design patterns - JAVA: Choosing algorithm based on multiple dimensions -

i have instance of class address, have change according environment: 1) region: base class sub-classes regiona , regionb 2) site: base class sub-classes sitea, siteb , sitec 3) language: base class sub-classes languagea , languageb each subclass defines constraints address modification. problem each tuple (region, site, language) has define own modifier. so, have method adjust(address a, region r, site s, language l): void adjust(address a, region r, site s, language l){ if(r instanceof russia && s instanceof mailru && language instanceof russian){ a.set_street("abc") } else if(r instanceof russia && s instanceof mailru && language instanceof english){ a.set_street("fgh") } } what best design patter use in case? use polymorphism loose if s , instanceof s! use abstract factory pattern easier creation of street info. region , language (sub)products (resp. factories, w

c# - Call method with assembly loaded from GAC -

i trying call save method system.drawing.image object, after loading assembly gac: _drawingassembly = assembly.load ("system.drawing, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"); _drawingassembly.gettype("image").getmethod("save").invoke(myimageobject, new object[] { path }); but it's not working. can't type reason; returns null: var t = _drawingassembly.gettype("image"); // null you need specify full type name system.drawing.image indicated documentation: https://msdn.microsoft.com/en-us/library/y0cd10tb(v=vs.110).aspx

php - Force authentication external website with Google Apps Domain -

morning folks, i need implement way force authentication of people inside google apps domain access website. to clear, user try site.com . if doesn't have cookie, he's redirected , forced google oauth2 login form. if has one, can visit website. in addition, aim here restrict login users inside google apps domain (people other google email adresses gmail won't work here). i hope clear enough, lot in advance guys ;) if website running on apache webserver, or can front website apache web server operating reverse proxy, mod_auth_openidc ( https://github.com/pingidentity/mod_auth_openidc ) can enforce authentication google account , restrict particular google apps domain, see: https://github.com/pingidentity/mod_auth_openidc#openid-connect-sso-with-google-sign-in

git stash apply results in the conflict - why? -

i've tried unstash changes , git reported conflict: auto-merging core/scaldi/modules.scala conflict (content): merge conflict in core/scaldi/modules.scala i'm curious why conflict occurs, since have no changes neither in working directory nor in index: git diff #outputs nothing git diff --cached #outputs nothing git status #outputs `nothing commit, working directory clean` 'm curious why conflict occurs, since have no changes neither in working directory nor in index: it's not enough. seems stashed changes commits ago. assume tree looks this: a------b------c------d[master] \ stashed -------^ (stash apply) sources so stashed file changes of core/scaldi/modules.scala conflicts changes in c or d.

doxygen - Put dot in brief description -

i got sample code. want dot in brief comment. const int myvar = 1; //!< doxygen long brief\. //! brief sentence two. i escape dot told in doxygen manual. not work. first line brief, second detailed. bug? note: multiline_cpp_is_brief , qt_autobrief yes ! use latest version (1.8.9.1). the doxygen manual says if enable option , want put dot in middle of sentence without ending it, should put backslash , space after it. your backslash ist on wrong side of dot, , manual has taken literally, meaning space required after backslash. the following should work (without curly braced part): const int myvar = 1; //!< doxygen long brief.\ {← space here!} //! brief sentence two.

matlab - creating a bus header file from a bus object specified in the workspace or from a bus selector -

i have bus object has many elements inside , in turn bus objects again. can tell me there way generate bus header files typedef struct busobject instead of doing manually using script? there direct function or way this? so example have bus object elements d,e again bus objects , have 2 bus elements each d_a,d_b,e_a,e_b. there function or simple way process bus object output as: typedef struct { uint8 d_a; uint8 d_b; }d; typedef struct { uint8 e_a; uint8 e_b; }e; typedef struct { d d; e e; }a; which bus header. you need set bus datascope exported. 1 way go workspace , double click defined bus. open bus editor gui. when click on bus name there a menu different options: name, data scope, header file, alignment. use drop down menu data scope select exported. code generator create header file. can specify filename of header file typing foo.h in header file field. if leave blank matlab create header file using bus name.

Special and accented characters in mysql generates bad symbols in PHP -

my collation set utf8_general_ci both on tables , fields. html has meta tag changes charset utf8. when use php framework, such codeigniter, or use following queries before selecting database, see no problem on pages mysql_query("set names 'utf8'"); mysql_query('set character_set_connection=utf8'); mysql_query('set character_set_client=utf8'); mysql_query('set character_set_results=utf8'); but i'm neither using kind of framework nor libraries, i'm working in company had project finished , noticed that, when save accented characters in database, example, "maçã" (apple in pt), seem stored fine mysql (at least when use phpmyadmin read table) displayed badly php/html. looks similar this: ma< ?>< ?> this known bad character question mark keeps coming everytime echo these words on code. is there kind of configuration mysql or php solves problem (this specific one, i'm not talking general solution cha

java - Where is the actionperfomed() method called? -

i'm java beginner , come down work interfaces, want know happens. suppose example actionlistener interface. all know interfaces is, forces implement methods given interface. don't get, actionperformed(actionevent e) method called. , there simple examples show me happens in background? anyway. in case of jbutton, superclass abstractbutton calls actionperformed method through method fireactionperformed protected method. if check source code you'll see constructs actionevent object , calls actionperformed using argument.

java - Why is Spring Security working in Tomcat but not when deployed to Weblogic? -

i'm not java developer, project client has required me be, maybe i'm missing glaringly obvious. i'm using springboot , works fine when application runs in tomcat on local machine , on our testing server. however, application deployed weblogic it's if there no security @ all routes accessible. login , logout routes non-existent well. that being said. else appears work fine, without security @ all. i don't have access weblogic client 1 deploying code have told it's running on 12c. can fix or troubleshoot this? here's relevant config application.java: /** * type authentication security. */ @order(ordered.highest_precedence) @configuration protected static class authenticationsecurity extends globalauthenticationconfigureradapter { /** * users. */ @autowired private users users; /** * init void. * * @param auth auth * @throws exception exception */ @override public void init(authenticat

sending at commands with c++ on cubietruck -

i have cubieboard3 (cubietruck) , i'm trying send @ commands cb modem, i'm stuck on reading answer modem. c++ code: #include <stdio.h> #include <string.h> #include <iostream> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> using namespace std; int main(void) { int fd; /* file descryptor port */ fd = open("/dev/ttys1", o_rdwr | o_noctty | o_ndelay); if (fd == -1)//if not open port { perror("open_port: unable open /dev/ttys1 - "); } else //if port opened { fcntl(fd, f_setfl, fndelay); //sending data std::cout<<"port opened!"<<endl; std::cout<<"sending 'atz\r' "<<endl; int n = write(fd, "atz\r", 4); if (n < 0) fputs("write() of 4 bytes failed!\n", stderr); else std::cout<<"data send!"<<endl; //reading data char buf [10];

html - Display flattened list items with count of more items that fit in a div -

Image
i have few list items want display in flattened order on website. items not fit on same line, trying show count of 'how many more items' available. 8 items: screen size 1: ============================== item1, item2, item3 +5 items ============================== screen size 2: ==================================================== item1, item2, item3, item4, item5, item6 +2 items ==================================================== the skeleton of code have is: <div class="col-md-10"> <span ng-repeat="item in items | canfit"> <span class="itemname">{{item}}</span> </span> </div> <div class="col-md-2" ngshow="n>0"> <span>+{{n}} items</span> </div> i implemented using algorithm calculate character count, font-size, padding, screen size may change in future , trying have more agnostic of changes less perf impact. is there simpler way achieve

.net - How to call generic methods with generic type parameter -

its more generics ninject, curious. the following is working fine . kernel.bind(typeof(ientityrepository<,>)).to(typeof(loggerrepository<,>)); but if want use generics? following gives me compile time error . kernel.bind<ientityrepository<,>>().to<loggerrepository<ientity<>,int>(); or kernel.bind<ientityrepository<,>>().to<loggerrepository<,>(); i sure missing pretty simple, , must have got answered in st. can kindly direct me answer please? edit: following works fine . kernel.bind<ientityrepository<appuser, int>>().to<entityrepository<appuser, int>>(); but guess there should way without specifying types(appuse , int). when not type arguments of generic specified, cannot used in expression other typeof(). article helpful you: unbound generics: open , closed case i'm referring part in particular, discusses use of unbound generics in conjunction dependency injection

perl - Make hash from regex expression patten match -error -

i making hash regex expression. run program below , have check @ end see if hash made ok. keep getting error value., array(0x1a1c740), when should 437768. keys can display ok. didnt split because need key first part of species name. matching. # "aaaaaaaaaa","aaaaaaaaaa","437768","cryptophyta sp. cr-mal06",0 thanks may give. use strict; use warnings; open (my $in_fh,"$argv[0]") or die "failed open file: $!\n"; open (my $out_fh, ">genus.txt"); %hash; while ( $line = <$in_fh> ) { # # "aaaaaaaaaa","aaaaaaaaaa","437768","cryptophyta sp. cr-mal06",0 # if ($line =~ m/\"+\w+\"+\,+\"+\w+\"+\,+\"+(\d+)\"+\,+\"+(\w+)+.+/) { $v = $1; $k = $2; $hash{$k} = [$v]; } } if (exists $hash{'cryptophyta'}) { print $out_fh $hash{'cryptophyta'}; } else { print $out_fh &

jquery - Event listener don't work -

i have next selector "#btn-similar", why listener works: $("#btn-similar").click(function(e){ console.log("similar click"); }); but listener not: $(document).on("click", "#btn-similar", function(e){ console.log("similar click"); }); the html markup is: <div id="btn-similar" class="details-tab active-nav"> <span class="angle"></span> <div class="title">overview</div> </div> i using jquery 1.10, ideas ? since both pieces of code correct , work in circumstances, can think of these reasons why second 1 not work: there's <a> tag or form post in hierarchy causing browser go new page before results of code can seen. you have more 1 object in page id=btn-similar . there's script error right before second block of code keeps executing. you have typo somewhere , code doesn't match desired id. in ques

python - how to use GridSearchCV with custom estimator in sklearn? -

i have estimator should compatible sklearn api. trying fit 1 parameter of estimator gridsearchcv not understand how it. this code: import numpy np import sklearn sk sklearn.linear_model import linearregression, lassolarscv, ridgecv sklearn.linear_model.base import linearclassifiermixin, sparsecoefmixin, baseestimator class elm(baseestimator): def __init__(self, n_nodes, link='rbf', output_function='lasso', n_jobs=1, c=1): self.n_jobs = n_jobs self.n_nodes = n_nodes self.c = c if link == 'rbf': self.link = lambda z: np.exp(-z*z) elif link == 'sig': self.link = lambda z: 1./(1 + np.exp(-z)) elif link == 'id': self.link = lambda z: z else: self.link = link if output_function == 'lasso': self.output_function = lassolarscv(cv=10, n_jobs=self.n_jobs) elif output_function == 'lr':

css - Create 3 price boxes with Bootstrap -

i create 3 boxes equal height using bootstrap not sure how it. i found can use flexbox , main boxes equal height want inner div have border , div fill main div , cannot it. i have other problems: how position button @ center bottom of div , have there description paragraph , paragrahps equal heights, because use border @ bottom. here example code: <div class="container text-center"> <div class="row"> <div class="col-md-4"> <div class="box"> <div class="box-header"> </div> <div class="box-body"> <p class="box-info">some description of product 1</p> <ul class="box-list"> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul>

elasticsearch - Kibana 4 detects geodata but doesn't display any results on the map -

i have created elasticsearch index data set containing geodata. have set mapping data. tried create kibana visualisation using data set. kibana detects geodata property finds no result though there plenty of. ran test on data set different , simpler layout, , kibana visualised geodata. here's sample works: "location": { "lat": 56.290525, "lon": -30.163298 }, and mapping: "location": { "type": "geo_point", "lat_lon": true, "geohash": true } and 1 doesn't work: "groupoflocations": { "@type": "point", "locationfordisplay": { "lat": 59.21232, "lon": 9.603803 } } and mapping: { ... // nested type &quo

android - How to display alertDialog in an activity when sqlite database is empty -

i display alertdialog when there no data stored in database.however have tried seems not achieve desired goal alert dialog not called when database empty. here how check existance of tables in database: public boolean checkfortables() { boolean hastables = false; sqlitedatabase db = this.getwritabledatabase(); cursor cursor = db.rawquery("select count(*)from" + contacts_table_name, null); if (cursor != null && cursor.getcount() > 0) { hastables = true; cursor.close(); } return hastables; } and in activity oncreate: if (mydb.checkfortables()) { showtable(); btn.setvisibility(view.visible); } else { showalert(); btn.setvisibility(view.gone); } where method showtable() private void showtable() { arraylist<string> array_list = mydb.getallcontacts(); ar

dictionary - C++: Why my hash_map is giving me an ordered result like a map? -

since map implemented using tree , hash_map using hash, created code test if map give me ordered result , hash_map print examples in order registered map<string, int> mymap; hash_map<string, int> myhashmap; mymap["lucas"] = 1; mymap["abel"] = 2; mymap["jose"] = 1; myhashmap["lucas"] = 1; myhashmap["abel"] = 2; myhashmap["jose"] = 1; for(map<string, int>::iterator = mymap.begin(); != mymap.end(); it++){ cout << it->first << " " << it->second << endl; } cout << endl; for(hash_map<string, int>::iterator = myhashmap.begin(); != myhashmap.end(); it++){ cout << it->first << " " << it->second << endl; } but both results were: abel 2 jose 1 lucas 1 why hash_map gave me ordered result? there no order guarantee in hash_map - means can store results in any order, depending on implementation.

how to use different layout for different pages in ruby on rails? -

i know application.html.erb default every page .i want use different layout when user login .i mean dashboard after login should of different layout rather default one(application.html.erb). create new layout eg app/views/layouts/dunno.html.erb . use in controller class dashboardcontroller < applicationcontroller layout 'dunno' end or per action class dashboardcontroller < applicationcontroller def index render layout: 'dunno' end end see docs details

Jsoup select parent of direct child -

i'm trying select elements <p> tag direct child. i've tried using following *:has(p) but doesn't return direct parents. use element.parent() , parent of element. string html = "<div> blah <p> </p> </div>"; document doc = jsoup.parsebodyfragment(html); element p = doc.select("p").first(); string mytext = p.parent().text(); //selects enclosing div, , gets text in div. system.out.println(mytext); prints: blah afaik, there no selector parent, have go th parent() method.

python - How to switch tasks between queues in Celery -

i've got couple of tasks in tasks.py in celery. # should go 'math' queue @app.task def add(x,y): uuid = uuid.uuid4() result = x + y return {'id': uuid, 'result': result} # should go 'info' queue @app.task def notification(calculation): print repr(calculation) what i'd place each of these tasks in separate celery queue , assign number of workers on each queue. the problem don't know of way place task 1 queue within code. so instance when add task finishes execution need way place resulting python dictionary info queue futher processing. how should that? thanks in advance. edit -clarification- as said in comments question becomes how can worker place data retrieved queue a queue b . you can try this. wherever calling task,you can assign task queue. add.apply_async(queue="queuename1") notification.apply_async(queue="queuename2") by way can put tasks in seperate queue.

javascript - Pushing data into an array in a Json object -

i need push an object array in in json file. make simple lets json looks this: var jsonobj = { "elements" : [] } i tried push() method didnt work. tried assign jsonobj.elements[0]= ... fails. how can make work? try way, has work: jsonobj.elements.push(1); fiddle: https://jsfiddle.net/29qa4bfw/1/

regex - Notepad++ regular expression: line does not contain certain pattern -

i have following list of objects: type="user" n="ag12345" status="active" type="user" n="he98745" status="active" type="user" n="user1" status="active" type="user" n="84566" status="active" type="user" n="iu78965" status="active" i need find lines tag "n" not match pattern @@#####. in other words valid user has created 2 consecutive alphabetic characters , 5 numbers. regular expression looking should show me lines: type="user" n="user1" status="active" type="user" n="84566" status="active" i've tried many many things can't seem understand how this. one of attempts was: find what: type=user" n="(?![\l]{2}[\d]{5})" status="active" and also: type=user" n="(?![\l]{2})(?![\d]{5})" status="active"

'npm install' extremely slow on Windows -

for me npm install extremely slow. i'm using windows 8.1 latest npm version. connection speed around 100mbit/s. the project i'm trying install has around 20 packages/dependencies , takes around 30 minutes install dependencies ... does have clue? i ran same problem, using --verbose peterh mentioned showed me source of problem: behind proxy, uses own certificates https-connections. according user "mletter1" on https://github.com/npm/npm/issues/8872 issue quite solved using http: npm config set registry http://registry.npmjs.org/ --global and voilà, it's fast again. of course should this, if you're ok cleartext npm infos on net ;-)

data.table - How to assign column names with fread in R? -

i have following code - zz3 <- 'data,key "va1,va2,20140524,,0,0,5969,20140523134902,s7,s1147,140,20140523134902,m/t",4503632376496128 "va2,va3,20140711,,0,0,8824,20140601095714,s1,s6402,175,20140601095839,m/t",4503643113914368 "va1,va3,20140710,,0,0,11678,20140604085203,s1,s1430,250,20140604085329,m/t",4503666467799040 "va2,va1,20140724,,0,0,7109,20140523133835,s7,s793,130,20140523133835,m/t",4503679218483200 "va3,va1,20140925,,0,0,10592,20140604092548,s7,s109,395,20140604092714,m/t",4503694653521920' columnclasses <- c("or"="factor", "d"="factor", "ddate"="factor", "rdate"="factor", "changes"="integer", "class"="factor", "price"="integer", "fdate"="factor", "company"="factor", "number"="factor", "dur"="i

html - CSS hover text over image on hover -

Image
i following tutorial hover effect on images text pops , background turns dark. tutorial here . i having small problem hover effect, when mouse hovers on image, want image go dark , entire image covered, when set ul.img-list li height 100% takes 100% of text, can set height height of image, when height changes based on window size, won't cover properly. missing something? html: <div class="column large-6"> <ul class="img-list"> <li> <a href="#"> <img src="https://www.ricoh.com/r_dc/r/r8/img/sample_08.jpg" /> <span class="text-content"> <span>hello@!</span> </span> </a> </li> </ul> css: ul.img-list { list-style-type: none; margin: 0; padding: 0; text-align: center; } ul.img-list li { display: inline-block; height: 100%; margin: 0 1em 1em 0; position: relative; width:

javascript - Replacing closing HTML tags with HTML tag + \n -

i'm trying replace closing html tags closing tag + line break, found similar posts here on so, none helped me accomplish i'm looking for. </li> </li>\n <img property /> <img property />\n i managed in php following funtion, works well: public static function addlbinhtml($htmlcode){ $pattern= array('~(</.*?>)~','(/>)'); $replace= array('${1} hallo \n ','/>\n '); return preg_replace($pattern, $replace, $htmlcode); } i'm trying same in javascript / jquery , i'm failing on getting variable(in php regex ${1} ). i tried .split .join , .replace, , think .replace right way go. here got (my last , closest attempt) function setlinebreaks(taid){ var strcontent = $('#'+taid).val(); var regex = new regexp("</.*?>", "gi"); strcontent.replace(regex, "${1} \n ") .replace(/\/>/g,'/> \n ');

Saving a Huffman Tree compactly in C++ -

let's i've encoded huffman tree in compressed file. have example file output: 001a1c01e01b1d i'm having issue saving string file bit-by-bit. know c++ can output file 1 byte @ time, i'm having issue storing string in bytes. possible convert first 3 bits char without program padding byte? if pads byte traversal codes tree (and codes) messed up. if chop 1 byte @ time, happens if tree isn't multiple of 8? happens if compressed file's bit-length isn't multiple of 8? hopefully i've been clear enough. the standard solution problem padding. there many possible padding schemes. padding schemes pad number of bytes (i.e., multiple of 8 bits). additionally, encode either length of message in bits, or number of padding bits (from message length in bits can determined subtraction). latter solution results in more efficient paddings. most simply, can append number of "unused" bits in last byte additional byte value. one level up, start

asp.net - RadioButtonList and their 'Value' property -

i wondering 'value' property of item in radiobuttonlist. if want value of selected radio button in list, these must unique or auto-select first item finds value i'm looking for. no duplicate values. why this? i've looked around net, used them, , such know how working, know why works way. if select item in list, knows item selected. button fills in, can index of item selected...so why doesn't go: "okay, selected item @ index x. want value? okay, let me access list, go item x , value." i can think when want value of item, looking value rather index value? update 1: in particular case doing this: i have 1 radiobuttonlist has 3 items(radiobuttons) in it. following select...case occurs inside of button click. select case radiobuttonlist1.selecteditem.text case "texta" case "textb" //this radiobutton has value of 200 case "textc" //this radiobutton has value of 200 end select this work

mongoose - Mongodb -Moogose query array fields filter -

i want filter when agg : 6 , 'value' greater : 1000 , agg : 5 , 'value' greater : 2000 schema: posting query:db.postings.find( { agg: { $elemmatch: { $and:[ {agg:'5', value: { $gte: '2000'} }, {agg:'6', value: { $gte: '1000'} } ] } }} ); result : [] empty collection': { "_id":1, "agg" : [ { "value" : "2014", "agg" : "5"}, {"value" : "2500","agg" : "6"} ], } { _id:2, "agg" : [ { "value" : "2015", "agg" : "5"}, { "value" : "1000","agg" : "6" } ], } how write query correctly? it looks want documents agg

hadoop - Hive Query performance tuning -

i'm newbie hadoop & hive. can please suggest if there performance tuning steps apache hive running on cloudera 5.2.1 . what tuning parameters in order improve hive queries performance hive version :- hive 0.13.1-cdh5.2.1 hive query :- select distinct a1.chain_number chain_number, a1.chain_description chain_description staff.organization_hierarchy a1; hive table created external option "stored text format" , table properties below :- after changing below hive setting have seen 10 sec improvement set hive.exec.parallel=true; can please suggest other setting apart above improve hive query performance type of query using. you can use group by replace distinct ,because there 1 reduce job distinct job. try this select chain_number, chain_description staff.organization_hierarchy group chain_number, chain_description if reduce job number still small.you can specific using mapred.reduct.tasks configure

java - How to select an remembered item in the text box with Selenium webdriver? -

how select remembered item in text box selenium webdriver? hashmap<string, arraylist<integer>> map = new hashmap<string, arraylist<integer>>(); for(int i=0; i<strs.length; i++){ char[] arr = strs[i].tochararray(); arrays.sort(arr); string t = string.valueof(arr); if(map.get(t) == null){ arraylist<integer> l = new arraylist<integer>(); l.add(i); map.put(t, l); }else{ map.get(t).add(i); } please try below: webdriverwait wait = new webdriverwait(driver,30); driver.findelement(by.id("product_quickaddinput")).sendkeys(“00006692”); webelement element = driver.findelement(by.xpath("//div[@id='div_0']")); wait.until(expectedconditions.elementtobeclickable(element)); element.click();

css - Remove 'x' Input Decoration In Microsoft Edge (formerly Project Spartan) -

in css of website i'm working on use following css hide 'x' button internet explorer 10 , 11 add input fields users clear contents: input::-ms-clear { display: none; } viewing same website in first build of microsoft edge (formerly codenamed "project spartan") on windows 10 build 10049 css has no effect. isn't surprising microsoft edge breaking away legacy of internet explorer, want achieve same effect. what equivalent css required microsoft edge not render this? it turns out css had been broken since written, , wasn't working in ie 10+ either. since fixing css, microsoft edge (formerly project spartan) behaving same ie10+ , not displaying 'x' in input fields.

wpf - How do I use a ViewModel variable for a DynamicResource? -

this isn't mahapps.metro-specific, happens i'm using. have set of viewmodels have string property representing icon use resource xaml file. public class commandviewmodel : viewmodel { public commandviewmodel(string displayname, icommand command, string icon) { if (command == null) throw new argumentnullexception("command"); displayname = displayname; command = command; icon = icon; } public icommand command { get; private set; } public string icon { get; set; } } icon end being "appbar_add" mahapps.metro.resources. these defined in icons.xaml file. how write in itemtemplate such correct resource shows. i'm either getting errors on execution (not @ edit/build) or i'm getting no icons @ all. the "no icon" xaml looks this: <itemscontrol itemssource="{binding}"> <itemscontrol.itemtemplate> <datatemplate> <sta